kordoc 4.7.1 → 4.7.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 +14 -0
- package/dist/{-O42BMYNX.js → -CVPGGSAB.js} +8 -8
- package/dist/{chunk-USGC3ZKU.cjs → chunk-46VU6YXF.cjs} +4 -4
- package/dist/chunk-46VU6YXF.cjs.map +1 -0
- package/dist/{chunk-3UIT4PPQ.js → chunk-7CWNBDWQ.js} +5 -3
- package/dist/{chunk-3UIT4PPQ.js.map → chunk-7CWNBDWQ.js.map} +1 -1
- package/dist/{chunk-AFX6ZXER.js → chunk-BSWJCSG7.js} +2 -2
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-DJKLOLBT.cjs → chunk-DZBMQC2N.cjs} +3 -11
- package/dist/chunk-DZBMQC2N.cjs.map +1 -0
- package/dist/{chunk-ZDWP3LLY.cjs → chunk-E2XTVK7H.cjs} +12 -10
- package/dist/chunk-E2XTVK7H.cjs.map +1 -0
- package/dist/{chunk-JEX5P66D.js → chunk-FJBOVJAG.js} +3 -3
- package/dist/{chunk-PLEGO474.js → chunk-GLZMUKYL.js} +3 -3
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-I4TP7HYB.js +11 -0
- package/dist/chunk-I4TP7HYB.js.map +1 -0
- package/dist/{chunk-GZDOWYJM.js → chunk-IMY4LQ3J.js} +2 -2
- package/dist/{chunk-VECVLIWE.js → chunk-IN2AOMX6.js} +3 -3
- package/dist/{chunk-BQENBAUC.js → chunk-IVSEGHI2.js} +2 -2
- package/dist/{chunk-IZEUWEEY.js → chunk-JMWBMGNH.js} +3 -11
- package/dist/chunk-JMWBMGNH.js.map +1 -0
- package/dist/{chunk-7ZIOZ6PU.js → chunk-LJW5EQXS.js} +2 -2
- package/dist/{chunk-UZB3UGC5.js → chunk-O4VLHQVG.js} +2 -2
- package/dist/{chunk-YWDN5PQC.js → chunk-P7HPLWEP.js} +2 -2
- package/dist/{chunk-IMEMTJ76.js → chunk-PGDJUJ4L.js} +2 -2
- package/dist/{chunk-ZV5OKQ3Z.cjs → chunk-PV6WSN6E.cjs} +28 -2
- package/dist/chunk-PV6WSN6E.cjs.map +1 -0
- package/dist/{chunk-UAFSPWU7.js → chunk-QKHN7LEV.js} +8 -1
- package/dist/chunk-QKHN7LEV.js.map +1 -0
- package/dist/{chunk-5KPNXBNR.js → chunk-QXC5NPO2.js} +8 -8
- package/dist/chunk-TYIFZT5H.js +52 -0
- package/dist/chunk-TYIFZT5H.js.map +1 -0
- package/dist/chunk-URTDBXV6.cjs +11 -0
- package/dist/chunk-URTDBXV6.cjs.map +1 -0
- package/dist/{chunk-6663UXPE.js → chunk-VEBTOI3I.js} +3 -3
- package/dist/{chunk-J3W6Q3AX.js → chunk-VXB52EWX.js} +2 -2
- package/dist/{chunk-3H5X63BQ.js → chunk-Y3VDFFAW.js} +27 -1
- package/dist/chunk-Y3VDFFAW.js.map +1 -0
- package/dist/{chunk-TZ3WCAJZ.cjs → chunk-YU3PLOX4.cjs} +6 -6
- package/dist/chunk-YU3PLOX4.cjs.map +1 -0
- package/dist/chunks-RNP6VLGK.js +10 -0
- package/dist/cli.js +55 -19
- package/dist/cli.js.map +1 -1
- package/dist/{formula-CG4S7TWO.cjs → formula-7D3MLOSV.cjs} +9 -8
- package/dist/formula-7D3MLOSV.cjs.map +1 -0
- package/dist/{formula-LIVQSCMM.js → formula-GHGK7T3S.js} +3 -2
- package/dist/{formula-JLYS73QL.js → formula-RTGCS55B.js} +4 -2
- package/dist/{formula-LIVQSCMM.js.map → formula-RTGCS55B.js.map} +1 -1
- package/dist/{image-ocr-5QRZBNOF.js → image-ocr-2UMWFGRS.js} +9 -8
- package/dist/{image-ocr-5QRZBNOF.js.map → image-ocr-2UMWFGRS.js.map} +1 -1
- package/dist/{image-ocr-MKD6MKWO.cjs → image-ocr-PRI2JKDW.cjs} +12 -11
- package/dist/image-ocr-PRI2JKDW.cjs.map +1 -0
- package/dist/{image-ocr-TAJHRZ5T.js → image-ocr-TQ5THN35.js} +6 -5
- package/dist/{image-ocr-TAJHRZ5T.js.map → image-ocr-TQ5THN35.js.map} +1 -1
- package/dist/index.cjs +181 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +32 -15
- package/dist/mcp.js.map +1 -1
- package/dist/model-bundle-5RLZV7P2.js +104 -0
- package/dist/model-bundle-5RLZV7P2.js.map +1 -0
- package/dist/{models-6SIKLKRH.js → models-RSHR2BY7.js} +5 -3
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-RCEHB2EV.js → parser-FXEIK3VJ.js} +7 -6
- package/dist/{parser-RCEHB2EV.js.map → parser-FXEIK3VJ.js.map} +1 -1
- package/dist/{parser-UMFBJG2D.js → parser-QPMTNRPU.js} +6 -6
- package/dist/{parser-SWY4RKGD.cjs → parser-SCQ7NJUJ.cjs} +27 -26
- package/dist/parser-SCQ7NJUJ.cjs.map +1 -0
- package/dist/pdf-ocr-HPRM24SP.js +16 -0
- package/dist/pdf-ocr-I6DISTBR.js +13 -0
- package/dist/pdf-ocr-JNWL65YW.cjs +14 -0
- package/dist/pdf-ocr-JNWL65YW.cjs.map +1 -0
- package/dist/{profile-io-HT62OAEU.js → profile-io-I4UGTNP6.js} +3 -3
- package/dist/{rasterize-GL67HQC7.js → rasterize-QY3XJKCH.js} +2 -2
- package/dist/render-HEQX5DII.js +10 -0
- package/dist/seal-NB2YJ5F4.js +10 -0
- package/dist/{setup-GUQT5ELJ.js → setup-T2BY3VME.js} +30 -7
- package/dist/setup-T2BY3VME.js.map +1 -0
- package/dist/{watch-5ST75Q7Q.js → watch-JJE2UGVK.js} +12 -8
- package/dist/watch-JJE2UGVK.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-3H5X63BQ.js.map +0 -1
- package/dist/chunk-DJKLOLBT.cjs.map +0 -1
- package/dist/chunk-IZEUWEEY.js.map +0 -1
- package/dist/chunk-TZ3WCAJZ.cjs.map +0 -1
- package/dist/chunk-UAFSPWU7.js.map +0 -1
- package/dist/chunk-USGC3ZKU.cjs.map +0 -1
- package/dist/chunk-ZDWP3LLY.cjs.map +0 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +0 -1
- package/dist/chunks-C7DJL4RE.js +0 -10
- package/dist/formula-CG4S7TWO.cjs.map +0 -1
- package/dist/image-ocr-MKD6MKWO.cjs.map +0 -1
- package/dist/parser-SWY4RKGD.cjs.map +0 -1
- package/dist/pdf-ocr-3NTV3MYP.js +0 -12
- package/dist/pdf-ocr-7BOO4JA7.js +0 -15
- package/dist/pdf-ocr-JDHELYBY.cjs +0 -13
- package/dist/pdf-ocr-JDHELYBY.cjs.map +0 -1
- package/dist/render-IQ4IZLY4.js +0 -10
- package/dist/seal-AGSZ6MUR.js +0 -10
- package/dist/setup-GUQT5ELJ.js.map +0 -1
- package/dist/watch-5ST75Q7Q.js.map +0 -1
- /package/dist/{-O42BMYNX.js.map → -CVPGGSAB.js.map} +0 -0
- /package/dist/{chunk-AFX6ZXER.js.map → chunk-BSWJCSG7.js.map} +0 -0
- /package/dist/{chunk-JEX5P66D.js.map → chunk-FJBOVJAG.js.map} +0 -0
- /package/dist/{chunk-PLEGO474.js.map → chunk-GLZMUKYL.js.map} +0 -0
- /package/dist/{chunk-GZDOWYJM.js.map → chunk-IMY4LQ3J.js.map} +0 -0
- /package/dist/{chunk-VECVLIWE.js.map → chunk-IN2AOMX6.js.map} +0 -0
- /package/dist/{chunk-BQENBAUC.js.map → chunk-IVSEGHI2.js.map} +0 -0
- /package/dist/{chunk-7ZIOZ6PU.js.map → chunk-LJW5EQXS.js.map} +0 -0
- /package/dist/{chunk-UZB3UGC5.js.map → chunk-O4VLHQVG.js.map} +0 -0
- /package/dist/{chunk-YWDN5PQC.js.map → chunk-P7HPLWEP.js.map} +0 -0
- /package/dist/{chunk-IMEMTJ76.js.map → chunk-PGDJUJ4L.js.map} +0 -0
- /package/dist/{chunk-5KPNXBNR.js.map → chunk-QXC5NPO2.js.map} +0 -0
- /package/dist/{chunk-6663UXPE.js.map → chunk-VEBTOI3I.js.map} +0 -0
- /package/dist/{chunk-J3W6Q3AX.js.map → chunk-VXB52EWX.js.map} +0 -0
- /package/dist/{chunks-C7DJL4RE.js.map → chunks-RNP6VLGK.js.map} +0 -0
- /package/dist/{formula-JLYS73QL.js.map → formula-GHGK7T3S.js.map} +0 -0
- /package/dist/{models-6SIKLKRH.js.map → models-RSHR2BY7.js.map} +0 -0
- /package/dist/{parser-UMFBJG2D.js.map → parser-QPMTNRPU.js.map} +0 -0
- /package/dist/{pdf-ocr-3NTV3MYP.js.map → pdf-ocr-HPRM24SP.js.map} +0 -0
- /package/dist/{pdf-ocr-7BOO4JA7.js.map → pdf-ocr-I6DISTBR.js.map} +0 -0
- /package/dist/{profile-io-HT62OAEU.js.map → profile-io-I4UGTNP6.js.map} +0 -0
- /package/dist/{rasterize-GL67HQC7.js.map → rasterize-QY3XJKCH.js.map} +0 -0
- /package/dist/{render-IQ4IZLY4.js.map → render-HEQX5DII.js.map} +0 -0
- /package/dist/{seal-AGSZ6MUR.js.map → seal-NB2YJ5F4.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk46VU6YXFcjs = require('./chunk-46VU6YXF.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,6 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _chunkURTDBXV6cjs = require('./chunk-URTDBXV6.cjs');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
@@ -27,7 +28,8 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
var _chunkDZBMQC2Ncjs = require('./chunk-DZBMQC2N.cjs');
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -482,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
482
484
|
// src/hwpx/parser-shared.ts
|
|
483
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
484
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
485
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunkDZBMQC2Ncjs.KordocError {
|
|
486
488
|
constructor(message) {
|
|
487
489
|
super(message);
|
|
488
490
|
this.name = "ZipBombError";
|
|
@@ -497,7 +499,7 @@ function createSectionShared() {
|
|
|
497
499
|
function createXmlParser(warnings) {
|
|
498
500
|
return new (0, _xmldom.DOMParser)({
|
|
499
501
|
onError(level, msg2) {
|
|
500
|
-
if (level === "fatalError") throw new (0,
|
|
502
|
+
if (level === "fatalError") throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
501
503
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
502
504
|
}
|
|
503
505
|
});
|
|
@@ -532,13 +534,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
532
534
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
533
535
|
const checksumType = attrOf(inner, "checksum-type");
|
|
534
536
|
if (algorithm !== AES256_CBC) {
|
|
535
|
-
throw new (0,
|
|
537
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
536
538
|
}
|
|
537
539
|
if (startKey !== START_KEY_SHA256) {
|
|
538
|
-
throw new (0,
|
|
540
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
539
541
|
}
|
|
540
542
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
541
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
542
544
|
}
|
|
543
545
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
544
546
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -546,10 +548,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
546
548
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
547
549
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
548
550
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
549
|
-
throw new (0,
|
|
551
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
550
552
|
}
|
|
551
553
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
552
|
-
throw new (0,
|
|
554
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
553
555
|
}
|
|
554
556
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
555
557
|
}
|
|
@@ -582,11 +584,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
582
584
|
for (const entry of entries) {
|
|
583
585
|
const file = zip.file(entry.path);
|
|
584
586
|
if (!file) {
|
|
585
|
-
throw new (0,
|
|
587
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
586
588
|
}
|
|
587
589
|
const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
588
590
|
if (!plain) {
|
|
589
|
-
throw new (0,
|
|
591
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
590
592
|
}
|
|
591
593
|
decrypted.push({ path: entry.path, plain });
|
|
592
594
|
}
|
|
@@ -634,10 +636,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
634
636
|
const xml = await file.async("text");
|
|
635
637
|
if (decompressed) {
|
|
636
638
|
decompressed.total += xml.length * 2;
|
|
637
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
639
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
638
640
|
}
|
|
639
641
|
const parser = createXmlParser();
|
|
640
|
-
const doc = parser.parseFromString(
|
|
642
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
641
643
|
if (!doc.documentElement) continue;
|
|
642
644
|
const domDoc = doc;
|
|
643
645
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -826,9 +828,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
826
828
|
let level = 0;
|
|
827
829
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
828
830
|
const ratio = block.style.fontSize / baseFontSize;
|
|
829
|
-
if (ratio >=
|
|
830
|
-
else if (ratio >=
|
|
831
|
-
else if (ratio >=
|
|
831
|
+
if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H1) level = 1;
|
|
832
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H2) level = 2;
|
|
833
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H3) level = 3;
|
|
832
834
|
}
|
|
833
835
|
const compactText = text.replace(/\s+/g, "");
|
|
834
836
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1421,7 +1423,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1421
1423
|
|
|
1422
1424
|
// src/hwpx/table-build.ts
|
|
1423
1425
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1424
|
-
const table2 =
|
|
1426
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1425
1427
|
if (state.caption) table2.caption = state.caption;
|
|
1426
1428
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1427
1429
|
const anchors = [];
|
|
@@ -1492,7 +1494,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1492
1494
|
const cell2 = parentTable.cell;
|
|
1493
1495
|
(cell2.blocks ??= []).push(block);
|
|
1494
1496
|
cell2.hasStructure = true;
|
|
1495
|
-
let flat =
|
|
1497
|
+
let flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1496
1498
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1497
1499
|
if (flat) {
|
|
1498
1500
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1508,7 +1510,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1508
1510
|
// src/hwpx/section-walker.ts
|
|
1509
1511
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1510
1512
|
const parser = createXmlParser(warnings);
|
|
1511
|
-
const doc = parser.parseFromString(
|
|
1513
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1512
1514
|
if (!doc.documentElement) return [];
|
|
1513
1515
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1514
1516
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1615,8 +1617,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1615
1617
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1616
1618
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1617
1619
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1618
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1619
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1620
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunk46VU6YXFcjs.MAX_COLS);
|
|
1621
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
1620
1622
|
}
|
|
1621
1623
|
break;
|
|
1622
1624
|
case "p": {
|
|
@@ -1887,7 +1889,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
1887
1889
|
const sink = [];
|
|
1888
1890
|
const st = { rows: [], currentRow: [], cell: null };
|
|
1889
1891
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
1890
|
-
let flat =
|
|
1892
|
+
let flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, st.rows);
|
|
1891
1893
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
1892
1894
|
const built = [];
|
|
1893
1895
|
completeTable(st, [], built, ctx);
|
|
@@ -2042,7 +2044,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2042
2044
|
let url = (ch.textContent || "").trim();
|
|
2043
2045
|
if (!url) continue;
|
|
2044
2046
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2045
|
-
const safe =
|
|
2047
|
+
const safe = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, url);
|
|
2046
2048
|
if (safe) return safe;
|
|
2047
2049
|
}
|
|
2048
2050
|
return void 0;
|
|
@@ -2202,7 +2204,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2202
2204
|
case "hyperlink": {
|
|
2203
2205
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2204
2206
|
if (url) {
|
|
2205
|
-
const safe =
|
|
2207
|
+
const safe = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, url);
|
|
2206
2208
|
if (safe) href = safe;
|
|
2207
2209
|
}
|
|
2208
2210
|
walk(child, depth + 1);
|
|
@@ -2484,7 +2486,7 @@ function decompressStream(data) {
|
|
|
2484
2486
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2485
2487
|
}
|
|
2486
2488
|
function parseFileHeader(data) {
|
|
2487
|
-
if (data.length < 40) throw new (0,
|
|
2489
|
+
if (data.length < 40) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2488
2490
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2489
2491
|
return {
|
|
2490
2492
|
signature: sig,
|
|
@@ -2936,13 +2938,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2936
2938
|
}
|
|
2937
2939
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
2938
2940
|
for (const path of allCandidates) {
|
|
2939
|
-
if (
|
|
2941
|
+
if (_chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, path)) continue;
|
|
2940
2942
|
const file = zip.file(path);
|
|
2941
2943
|
if (!file) continue;
|
|
2942
2944
|
try {
|
|
2943
2945
|
const data = await file.async("uint8array");
|
|
2944
2946
|
decompressed.total += data.length;
|
|
2945
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2947
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2946
2948
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
2947
2949
|
const mimeType = imageExtToMime(ext);
|
|
2948
2950
|
imageIndex++;
|
|
@@ -2952,7 +2954,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2952
2954
|
usedPaths.add(path);
|
|
2953
2955
|
break;
|
|
2954
2956
|
} catch (err) {
|
|
2955
|
-
if (err instanceof
|
|
2957
|
+
if (err instanceof _chunkDZBMQC2Ncjs.KordocError) throw err;
|
|
2956
2958
|
}
|
|
2957
2959
|
}
|
|
2958
2960
|
if (!img) _optionalChain([warnings, 'optionalAccess', _81 => _81.push, 'call', _82 => _82({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -2972,11 +2974,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2972
2974
|
if (sweepUnreferenced) {
|
|
2973
2975
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
2974
2976
|
for (const file of binEntries) {
|
|
2975
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
2977
|
+
if (file.dir || usedPaths.has(file.name) || _chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
2976
2978
|
try {
|
|
2977
2979
|
const data = await file.async("uint8array");
|
|
2978
2980
|
decompressed.total += data.length;
|
|
2979
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
2981
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2980
2982
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
2981
2983
|
let mimeType = imageExtToMime(ext);
|
|
2982
2984
|
if (mimeType === "application/octet-stream") {
|
|
@@ -2990,7 +2992,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2990
2992
|
images.push(img);
|
|
2991
2993
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
2992
2994
|
} catch (err) {
|
|
2993
|
-
if (err instanceof
|
|
2995
|
+
if (err instanceof _chunkDZBMQC2Ncjs.KordocError) throw err;
|
|
2994
2996
|
_optionalChain([warnings, 'optionalAccess', _83 => _83.push, 'call', _84 => _84({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
2995
2997
|
}
|
|
2996
2998
|
}
|
|
@@ -3041,7 +3043,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3041
3043
|
}
|
|
3042
3044
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3043
3045
|
const name = new TextDecoder().decode(nameBytes);
|
|
3044
|
-
if (
|
|
3046
|
+
if (_chunkDZBMQC2Ncjs.isPathTraversal.call(void 0, name)) {
|
|
3045
3047
|
pos = fileStart + compSize;
|
|
3046
3048
|
continue;
|
|
3047
3049
|
}
|
|
@@ -3059,16 +3061,16 @@ function extractFromBrokenZip(buffer) {
|
|
|
3059
3061
|
continue;
|
|
3060
3062
|
}
|
|
3061
3063
|
totalDecompressed += content.length * 2;
|
|
3062
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3064
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3063
3065
|
sectionNum++;
|
|
3064
3066
|
blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
|
|
3065
3067
|
} catch (e17) {
|
|
3066
3068
|
continue;
|
|
3067
3069
|
}
|
|
3068
3070
|
}
|
|
3069
|
-
if (blocks.length === 0) throw new (0,
|
|
3071
|
+
if (blocks.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3070
3072
|
applyPageText(blocks, shared);
|
|
3071
|
-
const markdown =
|
|
3073
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3072
3074
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3073
3075
|
}
|
|
3074
3076
|
async function readKordocLayout(zip) {
|
|
@@ -3093,18 +3095,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3093
3095
|
if (paths.length > 0) return paths;
|
|
3094
3096
|
}
|
|
3095
3097
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3096
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3098
|
+
return sectionFiles.map((f) => f.name).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
3097
3099
|
}
|
|
3098
3100
|
function parseSectionPathsFromManifest(xml) {
|
|
3099
3101
|
const parser = createXmlParser();
|
|
3100
|
-
const doc = parser.parseFromString(
|
|
3102
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3101
3103
|
const items = doc.getElementsByTagName("opf:item");
|
|
3102
3104
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3103
3105
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3104
3106
|
for (let i = 0; i < items.length; i++) {
|
|
3105
3107
|
const item = items[i];
|
|
3106
3108
|
const id = item.getAttribute("id") || "";
|
|
3107
|
-
const href =
|
|
3109
|
+
const href = _chunkDZBMQC2Ncjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3108
3110
|
if (id && href) idToHref.set(id, href);
|
|
3109
3111
|
}
|
|
3110
3112
|
if (spine.length > 0) {
|
|
@@ -3115,7 +3117,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3115
3117
|
}
|
|
3116
3118
|
if (ordered.length > 0) return ordered;
|
|
3117
3119
|
}
|
|
3118
|
-
return Array.from(idToHref.values()).sort(
|
|
3120
|
+
return Array.from(idToHref.values()).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
3119
3121
|
}
|
|
3120
3122
|
|
|
3121
3123
|
// src/hwpx/metadata.ts
|
|
@@ -3128,7 +3130,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3128
3130
|
const xml = await file.async("text");
|
|
3129
3131
|
if (decompressed) {
|
|
3130
3132
|
decompressed.total += xml.length * 2;
|
|
3131
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3133
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3132
3134
|
}
|
|
3133
3135
|
parseDublinCoreMetadata(xml, metadata);
|
|
3134
3136
|
if (metadata.title || metadata.author) return;
|
|
@@ -3138,7 +3140,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3138
3140
|
}
|
|
3139
3141
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3140
3142
|
const parser = createXmlParser();
|
|
3141
|
-
const doc = parser.parseFromString(
|
|
3143
|
+
const doc = parser.parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3142
3144
|
if (!doc.documentElement) return;
|
|
3143
3145
|
const getText = (tagNames) => {
|
|
3144
3146
|
for (const tag of tagNames) {
|
|
@@ -3163,7 +3165,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3163
3165
|
|
|
3164
3166
|
// src/hwpx/parser.ts
|
|
3165
3167
|
async function parseHwpxDocument(buffer, options) {
|
|
3166
|
-
|
|
3168
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3167
3169
|
let zip;
|
|
3168
3170
|
try {
|
|
3169
3171
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3172,7 +3174,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3172
3174
|
}
|
|
3173
3175
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3174
3176
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3175
|
-
throw new (0,
|
|
3177
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3176
3178
|
}
|
|
3177
3179
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3178
3180
|
if (manifestFile) {
|
|
@@ -3187,7 +3189,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3187
3189
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3188
3190
|
}
|
|
3189
3191
|
}
|
|
3190
|
-
throw new (0,
|
|
3192
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
3191
3193
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3192
3194
|
);
|
|
3193
3195
|
}
|
|
@@ -3199,7 +3201,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3199
3201
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3200
3202
|
const warnings = [];
|
|
3201
3203
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3202
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3204
|
+
if (sectionPaths.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3203
3205
|
metadata.pageCount = sectionPaths.length;
|
|
3204
3206
|
const pageFilter = _optionalChain([options, 'optionalAccess', _94 => _94.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3205
3207
|
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
@@ -3229,7 +3231,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3229
3231
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
|
|
3230
3232
|
detectHwpxHeadings(blocks, styleMap);
|
|
3231
3233
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3232
|
-
const markdown =
|
|
3234
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3233
3235
|
return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3234
3236
|
}
|
|
3235
3237
|
|
|
@@ -4229,7 +4231,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4229
4231
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4230
4232
|
var TAG_ID_MAPPINGS = 17;
|
|
4231
4233
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4232
|
-
const wrong = () => new (0,
|
|
4234
|
+
const wrong = () => new (0, _chunkDZBMQC2Ncjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
4233
4235
|
let records;
|
|
4234
4236
|
try {
|
|
4235
4237
|
records = readRecords3(data);
|
|
@@ -4241,7 +4243,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4241
4243
|
}
|
|
4242
4244
|
function assertSupportedEncryptVersion(version) {
|
|
4243
4245
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4244
|
-
throw new (0,
|
|
4246
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
4245
4247
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4246
4248
|
);
|
|
4247
4249
|
}
|
|
@@ -4324,7 +4326,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4324
4326
|
lenientCfb = parseLenientCfb(buffer);
|
|
4325
4327
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4326
4328
|
} catch (e24) {
|
|
4327
|
-
throw new (0,
|
|
4329
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4328
4330
|
}
|
|
4329
4331
|
}
|
|
4330
4332
|
const readRawStream = (path) => {
|
|
@@ -4335,14 +4337,14 @@ function parseHwp5Document(buffer, options) {
|
|
|
4335
4337
|
return lenientCfb.findStream(path);
|
|
4336
4338
|
};
|
|
4337
4339
|
const headerData = readRawStream("/FileHeader");
|
|
4338
|
-
if (!headerData) throw new (0,
|
|
4340
|
+
if (!headerData) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4339
4341
|
const header = parseFileHeader(headerData);
|
|
4340
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4341
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4342
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4343
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4342
4344
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4343
4345
|
if (encrypted) {
|
|
4344
4346
|
if (!_optionalChain([options, 'optionalAccess', _102 => _102.password])) {
|
|
4345
|
-
throw new (0,
|
|
4347
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694.");
|
|
4346
4348
|
}
|
|
4347
4349
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4348
4350
|
}
|
|
@@ -4360,18 +4362,18 @@ function parseHwp5Document(buffer, options) {
|
|
|
4360
4362
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4361
4363
|
if (encrypted) {
|
|
4362
4364
|
const rawDocInfo = findStream("/DocInfo");
|
|
4363
|
-
if (!rawDocInfo) throw new (0,
|
|
4365
|
+
if (!rawDocInfo) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4364
4366
|
let docInfoData;
|
|
4365
4367
|
try {
|
|
4366
4368
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4367
4369
|
} catch (e25) {
|
|
4368
|
-
throw new (0,
|
|
4370
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
4369
4371
|
}
|
|
4370
4372
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4371
4373
|
}
|
|
4372
4374
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4373
4375
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4374
|
-
if (sections.length === 0) throw new (0,
|
|
4376
|
+
if (sections.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4375
4377
|
metadata.pageCount = sections.length;
|
|
4376
4378
|
const pageFilter = _optionalChain([options, 'optionalAccess', _103 => _103.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
|
|
4377
4379
|
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
@@ -4386,22 +4388,22 @@ function parseHwp5Document(buffer, options) {
|
|
|
4386
4388
|
const sectionData = sections[si];
|
|
4387
4389
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4388
4390
|
totalDecompressed += data.length;
|
|
4389
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4391
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4390
4392
|
const records = readRecords(data);
|
|
4391
4393
|
const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
|
|
4392
4394
|
bodyBlocks.push(...sectionBlocks);
|
|
4393
4395
|
parsedSections++;
|
|
4394
4396
|
_optionalChain([options, 'optionalAccess', _105 => _105.onProgress, 'optionalCall', _106 => _106(parsedSections, totalTarget)]);
|
|
4395
4397
|
} catch (secErr) {
|
|
4396
|
-
if (secErr instanceof
|
|
4398
|
+
if (secErr instanceof _chunkDZBMQC2Ncjs.KordocError) throw secErr;
|
|
4397
4399
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4398
4400
|
}
|
|
4399
4401
|
}
|
|
4400
4402
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4401
4403
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4402
|
-
let flatBlocks =
|
|
4404
|
+
let flatBlocks = _chunk46VU6YXFcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4403
4405
|
if (_optionalChain([options, 'optionalAccess', _107 => _107.dedupeRunningHeaders])) {
|
|
4404
|
-
const deduped =
|
|
4406
|
+
const deduped = _chunk46VU6YXFcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4405
4407
|
const removed = flatBlocks.length - deduped.length;
|
|
4406
4408
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4407
4409
|
flatBlocks = deduped;
|
|
@@ -4410,10 +4412,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4410
4412
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4411
4413
|
}
|
|
4412
4414
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4413
|
-
let markdown =
|
|
4415
|
+
let markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4414
4416
|
if (_optionalChain([options, 'optionalAccess', _108 => _108.inlineImages]) && images.length > 0) {
|
|
4415
4417
|
try {
|
|
4416
|
-
markdown =
|
|
4418
|
+
markdown = _chunk46VU6YXFcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4417
4419
|
} catch (inlineErr) {
|
|
4418
4420
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4419
4421
|
}
|
|
@@ -4477,9 +4479,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4477
4479
|
let level = 0;
|
|
4478
4480
|
if (_optionalChain([block, 'access', _113 => _113.style, 'optionalAccess', _114 => _114.fontSize]) && baseFontSize > 0) {
|
|
4479
4481
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4480
|
-
if (ratio >=
|
|
4481
|
-
else if (ratio >=
|
|
4482
|
-
else if (ratio >=
|
|
4482
|
+
if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H1) level = 1;
|
|
4483
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H2) level = 2;
|
|
4484
|
+
else if (ratio >= _chunkURTDBXV6cjs.HEADING_RATIO_H3) level = 3;
|
|
4483
4485
|
}
|
|
4484
4486
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4485
4487
|
if (level === 0) level = 2;
|
|
@@ -4573,7 +4575,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4573
4575
|
if (!raw) break;
|
|
4574
4576
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4575
4577
|
totalDecompressed += content.length;
|
|
4576
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4578
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4577
4579
|
sections.push({ idx: i, content });
|
|
4578
4580
|
}
|
|
4579
4581
|
if (sections.length === 0) {
|
|
@@ -4585,7 +4587,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4585
4587
|
if (raw) {
|
|
4586
4588
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4587
4589
|
totalDecompressed += content.length;
|
|
4588
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4590
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4589
4591
|
sections.push({ idx, content });
|
|
4590
4592
|
}
|
|
4591
4593
|
}
|
|
@@ -4602,7 +4604,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4602
4604
|
try {
|
|
4603
4605
|
const content = decryptViewText(raw, compressed);
|
|
4604
4606
|
totalDecompressed += content.length;
|
|
4605
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4607
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4606
4608
|
sections.push({ idx: i, content });
|
|
4607
4609
|
} catch (e30) {
|
|
4608
4610
|
break;
|
|
@@ -4705,7 +4707,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4705
4707
|
const ctrl = ctrls[r.ctrlIdx];
|
|
4706
4708
|
if (!_optionalChain([ctrl, 'optionalAccess', _121 => _121.href]) || r.end <= r.start) continue;
|
|
4707
4709
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
4708
|
-
const href =
|
|
4710
|
+
const href = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, ctrl.href);
|
|
4709
4711
|
if (!href) continue;
|
|
4710
4712
|
const anchor = text.slice(r.start, r.end);
|
|
4711
4713
|
if (!anchor.trim()) continue;
|
|
@@ -4945,8 +4947,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4945
4947
|
let tableIdx = -1;
|
|
4946
4948
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4947
4949
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4948
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4949
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
4950
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunk46VU6YXFcjs.MAX_ROWS);
|
|
4951
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunk46VU6YXFcjs.MAX_COLS);
|
|
4950
4952
|
tableIdx = i2;
|
|
4951
4953
|
break;
|
|
4952
4954
|
}
|
|
@@ -4995,7 +4997,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4995
4997
|
return table3;
|
|
4996
4998
|
}
|
|
4997
4999
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
4998
|
-
const table2 =
|
|
5000
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
4999
5001
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5000
5002
|
return table2.rows > 0 ? table2 : null;
|
|
5001
5003
|
}
|
|
@@ -5012,8 +5014,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5012
5014
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5013
5015
|
const cs = rec.data.readUInt16LE(12);
|
|
5014
5016
|
const rs = rec.data.readUInt16LE(14);
|
|
5015
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5016
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5017
|
+
if (cs > 0) colSpan = Math.min(cs, _chunk46VU6YXFcjs.MAX_COLS);
|
|
5018
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
5017
5019
|
}
|
|
5018
5020
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5019
5021
|
const parts = [];
|
|
@@ -5023,7 +5025,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5023
5025
|
parts.push(``);
|
|
5024
5026
|
hasStructure = true;
|
|
5025
5027
|
} else if (b.type === "table" && b.table) {
|
|
5026
|
-
const flat =
|
|
5028
|
+
const flat = _chunk46VU6YXFcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5027
5029
|
if (flat) parts.push(flat);
|
|
5028
5030
|
hasStructure = true;
|
|
5029
5031
|
} else if (b.text) {
|
|
@@ -17298,25 +17300,25 @@ function desEcbDecrypt(data, key) {
|
|
|
17298
17300
|
}
|
|
17299
17301
|
function readLayout(data) {
|
|
17300
17302
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17301
|
-
throw new (0,
|
|
17303
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17302
17304
|
}
|
|
17303
17305
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17304
17306
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17305
17307
|
if (payloadOffset >= data.length) {
|
|
17306
|
-
throw new (0,
|
|
17308
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17307
17309
|
}
|
|
17308
17310
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17309
17311
|
}
|
|
17310
17312
|
function decryptHwp3Document(input, password) {
|
|
17311
17313
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17312
17314
|
if (!compressed) {
|
|
17313
|
-
throw new (0,
|
|
17315
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP3 \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4 (\uC555\uCD95\uB418\uC9C0 \uC54A\uC740 \uC554\uD638 \uBCF8\uBB38)");
|
|
17314
17316
|
}
|
|
17315
17317
|
const source = Buffer.from(input);
|
|
17316
17318
|
const payload = source.subarray(payloadOffset);
|
|
17317
17319
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17318
17320
|
if (aligned.length === 0) {
|
|
17319
|
-
throw new (0,
|
|
17321
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17320
17322
|
}
|
|
17321
17323
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17322
17324
|
let inflated;
|
|
@@ -17324,14 +17326,14 @@ function decryptHwp3Document(input, password) {
|
|
|
17324
17326
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17325
17327
|
} catch (err) {
|
|
17326
17328
|
if (_optionalChain([err, 'optionalAccess', _134 => _134.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17327
|
-
throw new (0,
|
|
17329
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
17328
17330
|
`HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
|
|
17329
17331
|
);
|
|
17330
17332
|
}
|
|
17331
|
-
throw new (0,
|
|
17333
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
17332
17334
|
}
|
|
17333
17335
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17334
|
-
throw new (0,
|
|
17336
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
17335
17337
|
}
|
|
17336
17338
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17337
17339
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17366,7 +17368,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
17366
17368
|
let source = Buffer.from(buffer);
|
|
17367
17369
|
if (isEncryptedHwp3(source)) {
|
|
17368
17370
|
if (!_optionalChain([options, 'optionalAccess', _135 => _135.password])) {
|
|
17369
|
-
throw new (0,
|
|
17371
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
17370
17372
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
17371
17373
|
);
|
|
17372
17374
|
}
|
|
@@ -17383,10 +17385,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
17383
17385
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17384
17386
|
} catch (err) {
|
|
17385
17387
|
if (_optionalChain([err, 'optionalAccess', _136 => _136.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17386
|
-
throw new (0,
|
|
17388
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
|
|
17387
17389
|
}
|
|
17388
17390
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17389
|
-
throw new (0,
|
|
17391
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17390
17392
|
}
|
|
17391
17393
|
} else {
|
|
17392
17394
|
body = tail;
|
|
@@ -17628,7 +17630,7 @@ function getTextContent(el) {
|
|
|
17628
17630
|
return _nullishCoalesce(_optionalChain([el, 'access', _139 => _139.textContent, 'optionalAccess', _140 => _140.trim, 'call', _141 => _141()]), () => ( ""));
|
|
17629
17631
|
}
|
|
17630
17632
|
function parseXml(text) {
|
|
17631
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17633
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, text), "text/xml");
|
|
17632
17634
|
}
|
|
17633
17635
|
function collectRichText(root) {
|
|
17634
17636
|
let out = "";
|
|
@@ -17863,7 +17865,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17863
17865
|
cellRows.push(row);
|
|
17864
17866
|
}
|
|
17865
17867
|
if (cellRows.length > 0) {
|
|
17866
|
-
const table2 =
|
|
17868
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
17867
17869
|
if (table2.rows > 0) {
|
|
17868
17870
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17869
17871
|
}
|
|
@@ -17871,12 +17873,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17871
17873
|
return blocks;
|
|
17872
17874
|
}
|
|
17873
17875
|
async function parseXlsxDocument(buffer, options) {
|
|
17874
|
-
|
|
17876
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
17875
17877
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
17876
17878
|
const warnings = [];
|
|
17877
17879
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
17878
17880
|
if (!workbookFile) {
|
|
17879
|
-
throw new (0,
|
|
17881
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17880
17882
|
}
|
|
17881
17883
|
let sharedStrings = [];
|
|
17882
17884
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -17885,7 +17887,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17885
17887
|
}
|
|
17886
17888
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
17887
17889
|
if (sheets.length === 0) {
|
|
17888
|
-
throw new (0,
|
|
17890
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17889
17891
|
}
|
|
17890
17892
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
17891
17893
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -17969,7 +17971,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17969
17971
|
} catch (e32) {
|
|
17970
17972
|
}
|
|
17971
17973
|
}
|
|
17972
|
-
const markdown =
|
|
17974
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
17973
17975
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
17974
17976
|
}
|
|
17975
17977
|
|
|
@@ -18420,11 +18422,11 @@ function processGlobals(records) {
|
|
|
18420
18422
|
const xfFmtIds = [];
|
|
18421
18423
|
const firstBof = records[0];
|
|
18422
18424
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18423
|
-
throw new (0,
|
|
18425
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18424
18426
|
}
|
|
18425
18427
|
const bof = decodeBof(firstBof.data);
|
|
18426
18428
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18427
|
-
throw new (0,
|
|
18429
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18428
18430
|
}
|
|
18429
18431
|
let i = 1;
|
|
18430
18432
|
while (i < records.length) {
|
|
@@ -18559,7 +18561,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18559
18561
|
cellRows.push(row);
|
|
18560
18562
|
}
|
|
18561
18563
|
if (cellRows.length > 0) {
|
|
18562
|
-
const table2 =
|
|
18564
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18563
18565
|
if (table2.rows > 0) {
|
|
18564
18566
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18565
18567
|
}
|
|
@@ -18572,28 +18574,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18572
18574
|
try {
|
|
18573
18575
|
cfb = parseLenientCfb(buf);
|
|
18574
18576
|
} catch (e) {
|
|
18575
|
-
throw new (0,
|
|
18577
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
18576
18578
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18577
18579
|
);
|
|
18578
18580
|
}
|
|
18579
18581
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18580
18582
|
if (!wb) {
|
|
18581
|
-
throw new (0,
|
|
18583
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18582
18584
|
}
|
|
18583
18585
|
const records = readRecords2(wb);
|
|
18584
18586
|
if (records.length === 0) {
|
|
18585
|
-
throw new (0,
|
|
18587
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18586
18588
|
}
|
|
18587
18589
|
const firstBof = decodeBof(records[0].data);
|
|
18588
18590
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18589
|
-
throw new (0,
|
|
18591
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
18590
18592
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18591
18593
|
);
|
|
18592
18594
|
}
|
|
18593
18595
|
const globals = processGlobals(records);
|
|
18594
18596
|
const warnings = [];
|
|
18595
18597
|
if (globals.encrypted) {
|
|
18596
|
-
throw new (0,
|
|
18598
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18597
18599
|
}
|
|
18598
18600
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18599
18601
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18644,7 +18646,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18644
18646
|
pageCount: totalSheets
|
|
18645
18647
|
};
|
|
18646
18648
|
return {
|
|
18647
|
-
markdown:
|
|
18649
|
+
markdown: _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18648
18650
|
blocks: allBlocks,
|
|
18649
18651
|
metadata,
|
|
18650
18652
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19072,7 +19074,7 @@ function getAttr(el, localName2) {
|
|
|
19072
19074
|
return null;
|
|
19073
19075
|
}
|
|
19074
19076
|
function parseXml2(text) {
|
|
19075
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19077
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkDZBMQC2Ncjs.stripDtd.call(void 0, text), "text/xml");
|
|
19076
19078
|
}
|
|
19077
19079
|
function parseStyles(xml) {
|
|
19078
19080
|
const doc = parseXml2(xml);
|
|
@@ -19230,7 +19232,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19230
19232
|
function makeLink(text, rawHref) {
|
|
19231
19233
|
if (!text) return "";
|
|
19232
19234
|
if (!rawHref) return text;
|
|
19233
|
-
const href =
|
|
19235
|
+
const href = _chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, rawHref);
|
|
19234
19236
|
return href ? `[${text}](${href})` : text;
|
|
19235
19237
|
}
|
|
19236
19238
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19424,7 +19426,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19424
19426
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19425
19427
|
})
|
|
19426
19428
|
);
|
|
19427
|
-
const table2 =
|
|
19429
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19428
19430
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19429
19431
|
return { type: "table", table: table2 };
|
|
19430
19432
|
}
|
|
@@ -19526,12 +19528,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19526
19528
|
}
|
|
19527
19529
|
}
|
|
19528
19530
|
async function parseDocxDocument(buffer, options) {
|
|
19529
|
-
|
|
19531
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19530
19532
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19531
19533
|
const warnings = [];
|
|
19532
19534
|
const docFile = zip.file("word/document.xml");
|
|
19533
19535
|
if (!docFile) {
|
|
19534
|
-
throw new (0,
|
|
19536
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19535
19537
|
}
|
|
19536
19538
|
let rels = /* @__PURE__ */ new Map();
|
|
19537
19539
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19578,7 +19580,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19578
19580
|
const doc = parseXml2(docXml);
|
|
19579
19581
|
const body = findElements(doc, "body");
|
|
19580
19582
|
if (body.length === 0) {
|
|
19581
|
-
throw new (0,
|
|
19583
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19582
19584
|
}
|
|
19583
19585
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19584
19586
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19629,7 +19631,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19629
19631
|
}
|
|
19630
19632
|
}
|
|
19631
19633
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19632
|
-
const markdown =
|
|
19634
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19633
19635
|
return {
|
|
19634
19636
|
markdown,
|
|
19635
19637
|
blocks,
|
|
@@ -19647,11 +19649,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19647
19649
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19648
19650
|
function parseHwpmlDocument(buffer, options) {
|
|
19649
19651
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19650
|
-
throw new (0,
|
|
19652
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19651
19653
|
}
|
|
19652
19654
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19653
19655
|
const normalized = text.replace(/ /g, " ");
|
|
19654
|
-
const xml =
|
|
19656
|
+
const xml = _chunkDZBMQC2Ncjs.stripDtd.call(void 0, normalized);
|
|
19655
19657
|
const warnings = [];
|
|
19656
19658
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19657
19659
|
onError: (_level, msg2) => {
|
|
@@ -19691,7 +19693,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19691
19693
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _185 => _185.keepTrailingEmptyCols]), () => ( false)));
|
|
19692
19694
|
}
|
|
19693
19695
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
19694
|
-
const markdown =
|
|
19696
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19695
19697
|
return {
|
|
19696
19698
|
markdown,
|
|
19697
19699
|
blocks,
|
|
@@ -19856,7 +19858,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
19856
19858
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
19857
19859
|
cellRows[r].push(cell2);
|
|
19858
19860
|
}
|
|
19859
|
-
const table2 =
|
|
19861
|
+
const table2 = _chunk46VU6YXFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
19860
19862
|
if (structured.length > 0) {
|
|
19861
19863
|
const claimed = /* @__PURE__ */ new Set();
|
|
19862
19864
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -21367,7 +21369,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21367
21369
|
};
|
|
21368
21370
|
}
|
|
21369
21371
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21370
|
-
|
|
21372
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21371
21373
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21372
21374
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21373
21375
|
const fields = [];
|
|
@@ -21415,19 +21417,19 @@ function parseCentralDirectory(buf) {
|
|
|
21415
21417
|
}
|
|
21416
21418
|
}
|
|
21417
21419
|
}
|
|
21418
|
-
if (eocdOffset < 0) throw new (0,
|
|
21420
|
+
if (eocdOffset < 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21419
21421
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21420
21422
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21421
21423
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21422
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21424
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21423
21425
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21424
|
-
throw new (0,
|
|
21426
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21425
21427
|
}
|
|
21426
21428
|
const decoder = new TextDecoder("utf-8");
|
|
21427
21429
|
const entries = [];
|
|
21428
21430
|
let pos = cdOffset;
|
|
21429
21431
|
for (let i = 0; i < totalEntries; i++) {
|
|
21430
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21432
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21431
21433
|
const flags = view.getUint16(pos + 8, true);
|
|
21432
21434
|
const method = view.getUint16(pos + 10, true);
|
|
21433
21435
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21438,7 +21440,7 @@ function parseCentralDirectory(buf) {
|
|
|
21438
21440
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21439
21441
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21440
21442
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21441
|
-
throw new (0,
|
|
21443
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21442
21444
|
}
|
|
21443
21445
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21444
21446
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21467,11 +21469,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21467
21469
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21468
21470
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21469
21471
|
for (const name of replacements.keys()) {
|
|
21470
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21472
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21471
21473
|
}
|
|
21472
21474
|
if (additions) {
|
|
21473
21475
|
for (const name of additions.keys()) {
|
|
21474
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21476
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21475
21477
|
}
|
|
21476
21478
|
}
|
|
21477
21479
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21490,7 +21492,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21490
21492
|
offset += seg.length;
|
|
21491
21493
|
continue;
|
|
21492
21494
|
}
|
|
21493
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21495
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21494
21496
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21495
21497
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21496
21498
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21498,7 +21500,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21498
21500
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21499
21501
|
const method = e.method;
|
|
21500
21502
|
if (method !== 0 && method !== 8) {
|
|
21501
|
-
throw new (0,
|
|
21503
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
|
|
21502
21504
|
}
|
|
21503
21505
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21504
21506
|
const crc = crc32(newData);
|
|
@@ -21596,11 +21598,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21596
21598
|
// src/form/filler-hwpx.ts
|
|
21597
21599
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21598
21600
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21599
|
-
|
|
21601
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21600
21602
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21601
21603
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21602
21604
|
if (sectionPaths.length === 0) {
|
|
21603
|
-
throw new (0,
|
|
21605
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21604
21606
|
}
|
|
21605
21607
|
const warnings = [];
|
|
21606
21608
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -22342,7 +22344,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22342
22344
|
}
|
|
22343
22345
|
function assertFiniteRange(name, value, min, max) {
|
|
22344
22346
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22345
|
-
throw new (0,
|
|
22347
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22346
22348
|
}
|
|
22347
22349
|
}
|
|
22348
22350
|
function validateGongmunOptions(opts) {
|
|
@@ -22357,10 +22359,10 @@ function validateGongmunOptions(opts) {
|
|
|
22357
22359
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22358
22360
|
}
|
|
22359
22361
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22360
|
-
throw new (0,
|
|
22362
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22361
22363
|
}
|
|
22362
22364
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22363
|
-
throw new (0,
|
|
22365
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22364
22366
|
}
|
|
22365
22367
|
}
|
|
22366
22368
|
if (opts.sizes) {
|
|
@@ -22369,7 +22371,7 @@ function validateGongmunOptions(opts) {
|
|
|
22369
22371
|
}
|
|
22370
22372
|
}
|
|
22371
22373
|
if (opts.approval && opts.approval.length > 6) {
|
|
22372
|
-
throw new (0,
|
|
22374
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("approval must contain at most 6 labels");
|
|
22373
22375
|
}
|
|
22374
22376
|
}
|
|
22375
22377
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22907,7 +22909,7 @@ function parseInlineMarkdown(text) {
|
|
|
22907
22909
|
else spans.push(...emphasisSpans(m[0]));
|
|
22908
22910
|
} else {
|
|
22909
22911
|
const anchor = m[2] || m[3];
|
|
22910
|
-
const href = _nullishCoalesce(
|
|
22912
|
+
const href = _nullishCoalesce(_chunkDZBMQC2Ncjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
22911
22913
|
const sub = emphasisSpans(anchor);
|
|
22912
22914
|
if (href) for (const s of sub) s.href = href;
|
|
22913
22915
|
spans.push(...sub);
|
|
@@ -23121,7 +23123,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23121
23123
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23122
23124
|
const got = m ? Number(m[1]) : NaN;
|
|
23123
23125
|
if (got !== startId + i) {
|
|
23124
|
-
throw new (0,
|
|
23126
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
23125
23127
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
23126
23128
|
);
|
|
23127
23129
|
}
|
|
@@ -23205,7 +23207,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23205
23207
|
}
|
|
23206
23208
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23207
23209
|
if (rows.length !== expectedBase) {
|
|
23208
|
-
throw new (0,
|
|
23210
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
23209
23211
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
23210
23212
|
);
|
|
23211
23213
|
}
|
|
@@ -24101,7 +24103,7 @@ function escapeGfm(text) {
|
|
|
24101
24103
|
}
|
|
24102
24104
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24103
24105
|
function sanitizeText(text) {
|
|
24104
|
-
let result =
|
|
24106
|
+
let result = _chunk46VU6YXFcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24105
24107
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24106
24108
|
const tokens = result.split(" ");
|
|
24107
24109
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24273,7 +24275,7 @@ function parseHtmlTable(raw) {
|
|
|
24273
24275
|
const cs = parseInt(_optionalChain([attrs, 'access', _310 => _310.match, 'call', _311 => _311(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _312 => _312[1]]) || "1", 10);
|
|
24274
24276
|
const rs = parseInt(_optionalChain([attrs, 'access', _313 => _313.match, 'call', _314 => _314(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _315 => _315[1]]) || "1", 10);
|
|
24275
24277
|
cellStart = m.index + m[0].length;
|
|
24276
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24278
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk46VU6YXFcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk46VU6YXFcjs.MAX_ROWS) };
|
|
24277
24279
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24278
24280
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24279
24281
|
cellStart = -1;
|
|
@@ -25015,8 +25017,8 @@ function layoutHtmlRows(rows) {
|
|
|
25015
25017
|
let c = 0;
|
|
25016
25018
|
for (const cell2 of rows[r].cells) {
|
|
25017
25019
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25018
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25019
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25020
|
+
const colSpan = clampSpan(cell2.colSpan, _chunk46VU6YXFcjs.MAX_COLS);
|
|
25021
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunk46VU6YXFcjs.MAX_ROWS);
|
|
25020
25022
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25021
25023
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25022
25024
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -26327,7 +26329,7 @@ function builtinTemplateDir() {
|
|
|
26327
26329
|
for (const c of candidates) {
|
|
26328
26330
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26329
26331
|
}
|
|
26330
|
-
throw new (0,
|
|
26332
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uB0B4\uC7A5 templates \uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (\uD328\uD0A4\uC9C0 \uC124\uCE58\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4)");
|
|
26331
26333
|
}
|
|
26332
26334
|
function readBuiltinTemplate(t) {
|
|
26333
26335
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -26670,12 +26672,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
26670
26672
|
return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
|
|
26671
26673
|
}
|
|
26672
26674
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
26673
|
-
if (ops.length === 0) throw new (0,
|
|
26675
|
+
if (ops.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26674
26676
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
26675
|
-
|
|
26677
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
26676
26678
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
26677
26679
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _428 => _428.match, 'call', _429 => _429(/(\d+)\.xml$/i), 'optionalAccess', _430 => _430[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _431 => _431.match, 'call', _432 => _432(/(\d+)\.xml$/i), 'optionalAccess', _433 => _433[1]]), () => ( 0))));
|
|
26678
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
26680
|
+
if (sectionPaths.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26679
26681
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
26680
26682
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
26681
26683
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -26716,11 +26718,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26716
26718
|
const manifestItems = [];
|
|
26717
26719
|
const placed = [];
|
|
26718
26720
|
for (const op of ops) {
|
|
26719
|
-
if (!op.anchor) throw new (0,
|
|
26720
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
26721
|
+
if (!op.anchor) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26722
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26721
26723
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
26722
|
-
if (!MIME[ext]) throw new (0,
|
|
26723
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
26724
|
+
if (!MIME[ext]) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
26725
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
26724
26726
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
26725
26727
|
let found = null;
|
|
26726
26728
|
let total = 0;
|
|
@@ -26753,7 +26755,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26753
26755
|
}
|
|
26754
26756
|
}
|
|
26755
26757
|
}
|
|
26756
|
-
throw new (0,
|
|
26758
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
26757
26759
|
`place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
|
|
26758
26760
|
);
|
|
26759
26761
|
}
|
|
@@ -26761,7 +26763,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26761
26763
|
const xml = sectionXmls[si];
|
|
26762
26764
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26763
26765
|
if (!run) {
|
|
26764
|
-
throw new (0,
|
|
26766
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26765
26767
|
}
|
|
26766
26768
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _434 => _434.charPr, 'access', _435 => _435.get, 'call', _436 => _436(run.charPr), 'optionalAccess', _437 => _437.height]), () => ( 1e3));
|
|
26767
26769
|
const fontPt = charPrHeight / 100;
|
|
@@ -27039,7 +27041,7 @@ function pick(map, keys) {
|
|
|
27039
27041
|
return out;
|
|
27040
27042
|
}
|
|
27041
27043
|
async function hwpxToProfile(input) {
|
|
27042
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27044
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
27043
27045
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27044
27046
|
const parser = createXmlParser();
|
|
27045
27047
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _459 => _459.file, 'call', _460 => _460(/[Hh]eader\.xml$/), 'optionalAccess', _461 => _461[0]])));
|
|
@@ -27970,7 +27972,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27970
27972
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27971
27973
|
if (paths.length > 0) return paths;
|
|
27972
27974
|
}
|
|
27973
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
27975
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
27974
27976
|
}
|
|
27975
27977
|
function sectionPathsFromManifest(xml) {
|
|
27976
27978
|
const attr = (tag, name) => {
|
|
@@ -27980,7 +27982,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27980
27982
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27981
27983
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27982
27984
|
const id = attr(m[1], "id");
|
|
27983
|
-
const href =
|
|
27985
|
+
const href = _chunkDZBMQC2Ncjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27984
27986
|
if (id && href) idToHref.set(id, href);
|
|
27985
27987
|
}
|
|
27986
27988
|
const ordered = [];
|
|
@@ -27989,7 +27991,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27989
27991
|
if (href) ordered.push(href);
|
|
27990
27992
|
}
|
|
27991
27993
|
if (ordered.length > 0) return ordered;
|
|
27992
|
-
return Array.from(idToHref.values()).sort(
|
|
27994
|
+
return Array.from(idToHref.values()).sort(_chunkDZBMQC2Ncjs.compareSectionPaths);
|
|
27993
27995
|
}
|
|
27994
27996
|
|
|
27995
27997
|
// src/roundtrip/patcher.ts
|
|
@@ -28100,9 +28102,9 @@ function buildOrigUnits(blocks) {
|
|
|
28100
28102
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28101
28103
|
const next = blocks[i + 1];
|
|
28102
28104
|
if (_optionalChain([next, 'optionalAccess', _494 => _494.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28103
|
-
chunk =
|
|
28105
|
+
chunk = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28104
28106
|
} else {
|
|
28105
|
-
chunk =
|
|
28107
|
+
chunk = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28106
28108
|
}
|
|
28107
28109
|
if (chunk) {
|
|
28108
28110
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -29722,12 +29724,12 @@ function blocksToChunks(blocks, options) {
|
|
|
29722
29724
|
let run = null;
|
|
29723
29725
|
const flushRun = () => {
|
|
29724
29726
|
if (!run) return;
|
|
29725
|
-
push("text", run.breadcrumb,
|
|
29727
|
+
push("text", run.breadcrumb, _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
29726
29728
|
run = null;
|
|
29727
29729
|
};
|
|
29728
29730
|
for (let i = 0; i < blocks.length; i++) {
|
|
29729
29731
|
const block = blocks[i];
|
|
29730
|
-
const md2 =
|
|
29732
|
+
const md2 = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, [block]);
|
|
29731
29733
|
if (!md2) continue;
|
|
29732
29734
|
if (block.type === "heading") {
|
|
29733
29735
|
flushRun();
|
|
@@ -30197,13 +30199,13 @@ async function htmlToPdf(html, options) {
|
|
|
30197
30199
|
try {
|
|
30198
30200
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30199
30201
|
} catch (e37) {
|
|
30200
|
-
throw new (0,
|
|
30202
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
30201
30203
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30202
30204
|
);
|
|
30203
30205
|
}
|
|
30204
30206
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30205
30207
|
if (!executablePath) {
|
|
30206
|
-
throw new (0,
|
|
30208
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)(
|
|
30207
30209
|
"Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
30208
30210
|
);
|
|
30209
30211
|
}
|
|
@@ -30262,7 +30264,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30262
30264
|
return htmlToPdf(html, options);
|
|
30263
30265
|
}
|
|
30264
30266
|
async function blocksToPdf(blocks, options) {
|
|
30265
|
-
const markdown =
|
|
30267
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30266
30268
|
return markdownToPdf(markdown, options);
|
|
30267
30269
|
}
|
|
30268
30270
|
|
|
@@ -31160,15 +31162,15 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31160
31162
|
async function renderHwpxToSvg(input, options) {
|
|
31161
31163
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _591 => _591.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31162
31164
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31163
|
-
|
|
31165
|
+
_chunkDZBMQC2Ncjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31164
31166
|
let zip;
|
|
31165
31167
|
try {
|
|
31166
31168
|
zip = await _jszip2.default.loadAsync(input);
|
|
31167
31169
|
} catch (e38) {
|
|
31168
|
-
throw new (0,
|
|
31170
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31169
31171
|
}
|
|
31170
31172
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31171
|
-
if (secFiles.length === 0) throw new (0,
|
|
31173
|
+
if (secFiles.length === 0) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31172
31174
|
const warnings = [];
|
|
31173
31175
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31174
31176
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31176,7 +31178,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31176
31178
|
const secXmls = [];
|
|
31177
31179
|
for (const f of secFiles) {
|
|
31178
31180
|
const xml = await f.async("string");
|
|
31179
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31181
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31180
31182
|
secXmls.push(xml);
|
|
31181
31183
|
}
|
|
31182
31184
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31249,9 +31251,9 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31249
31251
|
}
|
|
31250
31252
|
if (rendered.length === 0) {
|
|
31251
31253
|
if (noCacheSkipped) {
|
|
31252
|
-
throw new (0,
|
|
31254
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
|
|
31253
31255
|
}
|
|
31254
|
-
throw new (0,
|
|
31256
|
+
throw new (0, _chunkDZBMQC2Ncjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31255
31257
|
}
|
|
31256
31258
|
const GAP = 2400;
|
|
31257
31259
|
const clipDefs = [];
|
|
@@ -31287,13 +31289,13 @@ async function parse(input, options) {
|
|
|
31287
31289
|
if (typeof input === "string") {
|
|
31288
31290
|
try {
|
|
31289
31291
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31290
|
-
buffer =
|
|
31292
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, buf);
|
|
31291
31293
|
} catch (err) {
|
|
31292
31294
|
const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
|
|
31293
31295
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31294
31296
|
}
|
|
31295
31297
|
} else if (Buffer.isBuffer(input)) {
|
|
31296
|
-
buffer =
|
|
31298
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
31297
31299
|
} else {
|
|
31298
31300
|
buffer = input;
|
|
31299
31301
|
}
|
|
@@ -31327,18 +31329,18 @@ async function parse(input, options) {
|
|
|
31327
31329
|
}
|
|
31328
31330
|
async function parseImage(buffer, options) {
|
|
31329
31331
|
try {
|
|
31330
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31332
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-PRI2JKDW.cjs")));
|
|
31331
31333
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31332
31334
|
return {
|
|
31333
31335
|
success: true,
|
|
31334
31336
|
fileType: "image",
|
|
31335
|
-
markdown:
|
|
31337
|
+
markdown: _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31336
31338
|
blocks,
|
|
31337
31339
|
warnings: warnings.length ? warnings : void 0,
|
|
31338
31340
|
pageCount: 1
|
|
31339
31341
|
};
|
|
31340
31342
|
} catch (err) {
|
|
31341
|
-
return { success: false, fileType: "image", error:
|
|
31343
|
+
return { success: false, fileType: "image", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31342
31344
|
}
|
|
31343
31345
|
}
|
|
31344
31346
|
async function parseHwp3(buffer, options) {
|
|
@@ -31346,7 +31348,7 @@ async function parseHwp3(buffer, options) {
|
|
|
31346
31348
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31347
31349
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _598 => _598.pageCount]) };
|
|
31348
31350
|
} catch (err) {
|
|
31349
|
-
return { success: false, fileType: "hwp3", error:
|
|
31351
|
+
return { success: false, fileType: "hwp3", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31350
31352
|
}
|
|
31351
31353
|
}
|
|
31352
31354
|
async function parseHwpx(buffer, options) {
|
|
@@ -31354,7 +31356,7 @@ async function parseHwpx(buffer, options) {
|
|
|
31354
31356
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31355
31357
|
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _599 => _599.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _600 => _600.pageCount]) };
|
|
31356
31358
|
} catch (err) {
|
|
31357
|
-
return { success: false, fileType: "hwpx", error:
|
|
31359
|
+
return { success: false, fileType: "hwpx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31358
31360
|
}
|
|
31359
31361
|
}
|
|
31360
31362
|
async function parseHwp(buffer, options) {
|
|
@@ -31380,13 +31382,13 @@ async function parseHwp(buffer, options) {
|
|
|
31380
31382
|
}
|
|
31381
31383
|
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _602 => _602.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _603 => _603.pageCount]) };
|
|
31382
31384
|
} catch (err) {
|
|
31383
|
-
return { success: false, fileType: "hwp", error:
|
|
31385
|
+
return { success: false, fileType: "hwp", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31384
31386
|
}
|
|
31385
31387
|
}
|
|
31386
31388
|
async function parsePdf(buffer, options) {
|
|
31387
31389
|
let parsePdfDocument;
|
|
31388
31390
|
try {
|
|
31389
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
31391
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-SCQ7NJUJ.cjs")));
|
|
31390
31392
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31391
31393
|
} catch (e40) {
|
|
31392
31394
|
return {
|
|
@@ -31401,7 +31403,7 @@ async function parsePdf(buffer, options) {
|
|
|
31401
31403
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _604 => _604.pageCount]) };
|
|
31402
31404
|
} catch (err) {
|
|
31403
31405
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31404
|
-
return { success: false, fileType: "pdf", error:
|
|
31406
|
+
return { success: false, fileType: "pdf", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err), isImageBased };
|
|
31405
31407
|
}
|
|
31406
31408
|
}
|
|
31407
31409
|
async function parseXlsx(buffer, options) {
|
|
@@ -31409,7 +31411,7 @@ async function parseXlsx(buffer, options) {
|
|
|
31409
31411
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31410
31412
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _605 => _605.pageCount]) };
|
|
31411
31413
|
} catch (err) {
|
|
31412
|
-
return { success: false, fileType: "xlsx", error:
|
|
31414
|
+
return { success: false, fileType: "xlsx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31413
31415
|
}
|
|
31414
31416
|
}
|
|
31415
31417
|
async function parseXls(buffer, options) {
|
|
@@ -31417,7 +31419,7 @@ async function parseXls(buffer, options) {
|
|
|
31417
31419
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31418
31420
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _606 => _606.pageCount]) };
|
|
31419
31421
|
} catch (err) {
|
|
31420
|
-
return { success: false, fileType: "xls", error:
|
|
31422
|
+
return { success: false, fileType: "xls", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31421
31423
|
}
|
|
31422
31424
|
}
|
|
31423
31425
|
async function parseDocx(buffer, options) {
|
|
@@ -31425,7 +31427,7 @@ async function parseDocx(buffer, options) {
|
|
|
31425
31427
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31426
31428
|
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31427
31429
|
} catch (err) {
|
|
31428
|
-
return { success: false, fileType: "docx", error:
|
|
31430
|
+
return { success: false, fileType: "docx", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31429
31431
|
}
|
|
31430
31432
|
}
|
|
31431
31433
|
async function parseHwpml(buffer, options) {
|
|
@@ -31433,16 +31435,16 @@ async function parseHwpml(buffer, options) {
|
|
|
31433
31435
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31434
31436
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _609 => _609.pageCount]) };
|
|
31435
31437
|
} catch (err) {
|
|
31436
|
-
return { success: false, fileType: "hwpml", error:
|
|
31438
|
+
return { success: false, fileType: "hwpml", error: _chunkDZBMQC2Ncjs.sanitizeError.call(void 0, err), code: _chunkDZBMQC2Ncjs.classifyError.call(void 0, err) };
|
|
31437
31439
|
}
|
|
31438
31440
|
}
|
|
31439
31441
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31440
31442
|
let buffer;
|
|
31441
31443
|
if (typeof input === "string") {
|
|
31442
31444
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31443
|
-
buffer =
|
|
31445
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, buf);
|
|
31444
31446
|
} else if (Buffer.isBuffer(input)) {
|
|
31445
|
-
buffer =
|
|
31447
|
+
buffer = _chunkDZBMQC2Ncjs.toArrayBuffer.call(void 0, input);
|
|
31446
31448
|
} else {
|
|
31447
31449
|
buffer = input;
|
|
31448
31450
|
}
|
|
@@ -31468,7 +31470,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31468
31470
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31469
31471
|
}
|
|
31470
31472
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31471
|
-
const markdown =
|
|
31473
|
+
const markdown = _chunk46VU6YXFcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31472
31474
|
if (outputFormat === "hwpx") {
|
|
31473
31475
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31474
31476
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31547,5 +31549,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31547
31549
|
|
|
31548
31550
|
|
|
31549
31551
|
|
|
31550
|
-
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
31552
|
+
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkDZBMQC2Ncjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk46VU6YXFcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
31551
31553
|
//# sourceMappingURL=index.cjs.map
|