kordoc 4.9.0 → 4.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/{-GCDZVN36.js → -Z4LCTGQR.js} +14 -8
- package/dist/{chunk-VVMXAB5N.js → chunk-5ZPXRDS2.js} +2 -2
- package/dist/{chunk-GLVZNMMN.js → chunk-6WYMV73J.js} +304 -27
- package/dist/chunk-6WYMV73J.js.map +1 -0
- package/dist/{chunk-BANRDDJL.cjs → chunk-BAJVZXC7.cjs} +3 -3
- package/dist/chunk-BAJVZXC7.cjs.map +1 -0
- package/dist/chunk-DCZVOIEO.cjs.map +1 -1
- package/dist/{chunk-XLARMJAD.js → chunk-GL6BCNJV.js} +3 -3
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-L6VNNUV4.js → chunk-JHPEDWJX.js} +3 -3
- package/dist/{chunk-5Y7WKVVP.cjs → chunk-KATZTHWA.cjs} +2 -2
- package/dist/chunk-KATZTHWA.cjs.map +1 -0
- package/dist/chunk-L5CDTOC3.cjs.map +1 -1
- package/dist/{chunk-MQKK34ID.js → chunk-LJP3PK2S.js} +2 -2
- package/dist/{chunk-SKTYYRUD.js → chunk-LKZQ4564.js} +2 -2
- package/dist/{chunk-EPPJTZJJ.js → chunk-LREEDIEF.js} +2 -2
- package/dist/{chunk-YQ3EWPCN.js → chunk-LUY46O7O.js} +2 -2
- package/dist/{chunk-CTOIJPOZ.js → chunk-NIBRVLGS.js} +2 -2
- package/dist/{chunk-4ZHZL44G.cjs → chunk-NIQ4JCQF.cjs} +6 -6
- package/dist/chunk-NIQ4JCQF.cjs.map +1 -0
- package/dist/{chunk-THB2RO2P.js → chunk-NOEYLJGJ.js} +3 -3
- package/dist/{chunk-IJH3NEF3.js → chunk-OOT54JF2.js} +2 -2
- package/dist/{chunk-KWKYWCPR.js → chunk-OYQL3D4B.js} +2 -2
- package/dist/{chunk-MRFUIWOD.js → chunk-PIUPP3FL.js} +3 -3
- package/dist/{chunk-WBVORBGM.js → chunk-PKCDYIIJ.js} +2 -2
- package/dist/{chunk-ZL5R3O5Y.cjs → chunk-SHBVD23C.cjs} +7 -7
- package/dist/chunk-SHBVD23C.cjs.map +1 -0
- package/dist/{chunk-K4JVORUT.js → chunk-TK7WUS47.js} +2 -2
- package/dist/{chunk-BK6ZFFZO.cjs → chunk-V3Q6I2AQ.cjs} +4 -4
- package/dist/chunk-V3Q6I2AQ.cjs.map +1 -0
- package/dist/{chunk-YZWSTDT7.js → chunk-VYGNPB2X.js} +2 -2
- package/dist/{chunk-PPA3BSEX.js → chunk-WLZX2HTC.js} +2 -2
- package/dist/{chunk-4DEU3YJR.js → chunk-Y7QB4IB6.js} +2 -2
- package/dist/chunks-TRJGNO4N.js +10 -0
- package/dist/cli.js +47 -25
- package/dist/cli.js.map +1 -1
- package/dist/{formula-IIF334U5.js → formula-77TJPACH.js} +3 -3
- package/dist/{formula-W35NSRS5.cjs → formula-JVBJ6QRG.cjs} +9 -9
- package/dist/formula-JVBJ6QRG.cjs.map +1 -0
- package/dist/{formula-W6VEVOGF.js → formula-LFWZG7T7.js} +4 -4
- package/dist/{image-ocr-KCH5UMWN.js → image-ocr-6SY623KL.js} +7 -7
- package/dist/{image-ocr-ZR2HP4WG.cjs → image-ocr-YTGAUHEP.cjs} +11 -11
- package/dist/image-ocr-YTGAUHEP.cjs.map +1 -0
- package/dist/{image-ocr-4CF6B2ZP.js → image-ocr-YZ56O63S.js} +5 -5
- package/dist/index.cjs +471 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -1
- package/dist/index.d.ts +46 -1
- package/dist/index.js +300 -23
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +19 -16
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-ZIHP5ULR.js → model-bundle-W7B3BIYS.js} +5 -5
- package/dist/{models-Q7HDRZMF.js → models-FUKPEVPE.js} +5 -5
- package/dist/page-range-P7SDW6LR.cjs.map +1 -1
- package/dist/{parser-O3X37357.js → parser-6UL2HLDH.js} +6 -6
- package/dist/{parser-SPK4QG4F.js → parser-GDYZDBZI.js} +6 -6
- package/dist/{parser-7HS5FORY.cjs → parser-WIRWVN5E.cjs} +26 -26
- package/dist/parser-WIRWVN5E.cjs.map +1 -0
- package/dist/pdf-ocr-O373AAN6.cjs +14 -0
- package/dist/pdf-ocr-O373AAN6.cjs.map +1 -0
- package/dist/pdf-ocr-OHUAQQMN.js +16 -0
- package/dist/pdf-ocr-XTE234WC.js +13 -0
- package/dist/{profile-io-PQSH3EPJ.js → profile-io-4EE64K6Y.js} +3 -3
- package/dist/{rasterize-NMCA7XRR.js → rasterize-QW7SSKHB.js} +2 -2
- package/dist/render-2NID54BX.js +10 -0
- package/dist/seal-PTP4TWYR.js +10 -0
- package/dist/{setup-CQ6SMNMA.js → setup-JS7E2HFM.js} +3 -3
- package/dist/{watch-4BOS6J6K.js → watch-YISVPGW3.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-4ZHZL44G.cjs.map +0 -1
- package/dist/chunk-5Y7WKVVP.cjs.map +0 -1
- package/dist/chunk-BANRDDJL.cjs.map +0 -1
- package/dist/chunk-BK6ZFFZO.cjs.map +0 -1
- package/dist/chunk-GLVZNMMN.js.map +0 -1
- package/dist/chunk-ZL5R3O5Y.cjs.map +0 -1
- package/dist/chunks-R6PFU6OR.js +0 -10
- package/dist/formula-W35NSRS5.cjs.map +0 -1
- package/dist/image-ocr-ZR2HP4WG.cjs.map +0 -1
- package/dist/parser-7HS5FORY.cjs.map +0 -1
- package/dist/pdf-ocr-4XUES6M5.js +0 -16
- package/dist/pdf-ocr-6D7OPO2X.cjs +0 -14
- package/dist/pdf-ocr-6D7OPO2X.cjs.map +0 -1
- package/dist/pdf-ocr-NICPW5HS.js +0 -13
- package/dist/render-MMAQI7DM.js +0 -10
- package/dist/seal-GWABZNEC.js +0 -10
- /package/dist/{-GCDZVN36.js.map → -Z4LCTGQR.js.map} +0 -0
- /package/dist/{chunk-VVMXAB5N.js.map → chunk-5ZPXRDS2.js.map} +0 -0
- /package/dist/{chunk-XLARMJAD.js.map → chunk-GL6BCNJV.js.map} +0 -0
- /package/dist/{chunk-L6VNNUV4.js.map → chunk-JHPEDWJX.js.map} +0 -0
- /package/dist/{chunk-MQKK34ID.js.map → chunk-LJP3PK2S.js.map} +0 -0
- /package/dist/{chunk-SKTYYRUD.js.map → chunk-LKZQ4564.js.map} +0 -0
- /package/dist/{chunk-EPPJTZJJ.js.map → chunk-LREEDIEF.js.map} +0 -0
- /package/dist/{chunk-YQ3EWPCN.js.map → chunk-LUY46O7O.js.map} +0 -0
- /package/dist/{chunk-CTOIJPOZ.js.map → chunk-NIBRVLGS.js.map} +0 -0
- /package/dist/{chunk-THB2RO2P.js.map → chunk-NOEYLJGJ.js.map} +0 -0
- /package/dist/{chunk-IJH3NEF3.js.map → chunk-OOT54JF2.js.map} +0 -0
- /package/dist/{chunk-KWKYWCPR.js.map → chunk-OYQL3D4B.js.map} +0 -0
- /package/dist/{chunk-MRFUIWOD.js.map → chunk-PIUPP3FL.js.map} +0 -0
- /package/dist/{chunk-WBVORBGM.js.map → chunk-PKCDYIIJ.js.map} +0 -0
- /package/dist/{chunk-K4JVORUT.js.map → chunk-TK7WUS47.js.map} +0 -0
- /package/dist/{chunk-YZWSTDT7.js.map → chunk-VYGNPB2X.js.map} +0 -0
- /package/dist/{chunk-PPA3BSEX.js.map → chunk-WLZX2HTC.js.map} +0 -0
- /package/dist/{chunk-4DEU3YJR.js.map → chunk-Y7QB4IB6.js.map} +0 -0
- /package/dist/{chunks-R6PFU6OR.js.map → chunks-TRJGNO4N.js.map} +0 -0
- /package/dist/{formula-IIF334U5.js.map → formula-77TJPACH.js.map} +0 -0
- /package/dist/{formula-W6VEVOGF.js.map → formula-LFWZG7T7.js.map} +0 -0
- /package/dist/{image-ocr-KCH5UMWN.js.map → image-ocr-6SY623KL.js.map} +0 -0
- /package/dist/{image-ocr-4CF6B2ZP.js.map → image-ocr-YZ56O63S.js.map} +0 -0
- /package/dist/{model-bundle-ZIHP5ULR.js.map → model-bundle-W7B3BIYS.js.map} +0 -0
- /package/dist/{models-Q7HDRZMF.js.map → models-FUKPEVPE.js.map} +0 -0
- /package/dist/{parser-O3X37357.js.map → parser-6UL2HLDH.js.map} +0 -0
- /package/dist/{parser-SPK4QG4F.js.map → parser-GDYZDBZI.js.map} +0 -0
- /package/dist/{pdf-ocr-4XUES6M5.js.map → pdf-ocr-OHUAQQMN.js.map} +0 -0
- /package/dist/{pdf-ocr-NICPW5HS.js.map → pdf-ocr-XTE234WC.js.map} +0 -0
- /package/dist/{profile-io-PQSH3EPJ.js.map → profile-io-4EE64K6Y.js.map} +0 -0
- /package/dist/{rasterize-NMCA7XRR.js.map → rasterize-QW7SSKHB.js.map} +0 -0
- /package/dist/{render-MMAQI7DM.js.map → render-2NID54BX.js.map} +0 -0
- /package/dist/{seal-GWABZNEC.js.map → seal-PTP4TWYR.js.map} +0 -0
- /package/dist/{setup-CQ6SMNMA.js.map → setup-JS7E2HFM.js.map} +0 -0
- /package/dist/{watch-4BOS6J6K.js.map → watch-YISVPGW3.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkV3Q6I2AQcjs = require('./chunk-V3Q6I2AQ.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -29,7 +29,7 @@ var _chunkL5CDTOC3cjs = require('./chunk-L5CDTOC3.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkKATZTHWAcjs = require('./chunk-KATZTHWA.cjs');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -484,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
484
484
|
// src/hwpx/parser-shared.ts
|
|
485
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
486
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
487
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunkKATZTHWAcjs.KordocError {
|
|
488
488
|
constructor(message) {
|
|
489
489
|
super(message);
|
|
490
490
|
this.name = "ZipBombError";
|
|
@@ -504,7 +504,7 @@ function createSectionShared() {
|
|
|
504
504
|
function createXmlParser(warnings) {
|
|
505
505
|
return new (0, _xmldom.DOMParser)({
|
|
506
506
|
onError(level, msg2) {
|
|
507
|
-
if (level === "fatalError") throw new (0,
|
|
507
|
+
if (level === "fatalError") throw new (0, _chunkKATZTHWAcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
508
508
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
509
509
|
}
|
|
510
510
|
});
|
|
@@ -539,13 +539,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
539
539
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
540
540
|
const checksumType = attrOf(inner, "checksum-type");
|
|
541
541
|
if (algorithm !== AES256_CBC) {
|
|
542
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
543
543
|
}
|
|
544
544
|
if (startKey !== START_KEY_SHA256) {
|
|
545
|
-
throw new (0,
|
|
545
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
546
546
|
}
|
|
547
547
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
548
|
-
throw new (0,
|
|
548
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
549
549
|
}
|
|
550
550
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
551
551
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -553,10 +553,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
553
553
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
554
554
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
555
555
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
556
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
557
557
|
}
|
|
558
558
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
559
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
560
560
|
}
|
|
561
561
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
562
562
|
}
|
|
@@ -573,9 +573,9 @@ function decryptEntry(cipher, entry, startKey) {
|
|
|
573
573
|
const decipher = _crypto.createDecipheriv.call(void 0, "aes-256-cbc", key, entry.iv);
|
|
574
574
|
decipher.setAutoPadding(false);
|
|
575
575
|
const raw = Buffer.concat([decipher.update(cipher), decipher.final()]);
|
|
576
|
-
const
|
|
577
|
-
const sum = _crypto.createHash.call(void 0, "sha256").update(
|
|
578
|
-
if (sum.length === entry.checksum.length && _crypto.timingSafeEqual.call(void 0, sum, entry.checksum)) return
|
|
576
|
+
const plain2 = _zlib.inflateRawSync.call(void 0, raw, { maxOutputLength: MAX_DECOMPRESS_SIZE });
|
|
577
|
+
const sum = _crypto.createHash.call(void 0, "sha256").update(plain2.subarray(0, Math.min(CHECKSUM_PREFIX_BYTES, plain2.length))).digest();
|
|
578
|
+
if (sum.length === entry.checksum.length && _crypto.timingSafeEqual.call(void 0, sum, entry.checksum)) return plain2;
|
|
579
579
|
} catch (e5) {
|
|
580
580
|
}
|
|
581
581
|
}
|
|
@@ -589,15 +589,15 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
589
589
|
for (const entry of entries) {
|
|
590
590
|
const file = zip.file(entry.path);
|
|
591
591
|
if (!file) {
|
|
592
|
-
throw new (0,
|
|
592
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
593
593
|
}
|
|
594
|
-
const
|
|
595
|
-
if (!
|
|
596
|
-
throw new (0,
|
|
594
|
+
const plain2 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
595
|
+
if (!plain2) {
|
|
596
|
+
throw new (0, _chunkKATZTHWAcjs.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.");
|
|
597
597
|
}
|
|
598
|
-
decrypted.push({ path: entry.path, plain });
|
|
598
|
+
decrypted.push({ path: entry.path, plain: plain2 });
|
|
599
599
|
}
|
|
600
|
-
for (const { path, plain } of decrypted) zip.file(path,
|
|
600
|
+
for (const { path, plain: plain2 } of decrypted) zip.file(path, plain2);
|
|
601
601
|
zip.file("META-INF/manifest.xml", stripEncryptionData(manifestXml));
|
|
602
602
|
return decrypted.length;
|
|
603
603
|
}
|
|
@@ -641,10 +641,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
641
641
|
const xml = await file.async("text");
|
|
642
642
|
if (decompressed) {
|
|
643
643
|
decompressed.total += xml.length * 2;
|
|
644
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
644
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
645
645
|
}
|
|
646
646
|
const parser = createXmlParser();
|
|
647
|
-
const doc = parser.parseFromString(
|
|
647
|
+
const doc = parser.parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
648
648
|
if (!doc.documentElement) continue;
|
|
649
649
|
const domDoc = doc;
|
|
650
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1428,7 +1428,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1428
1428
|
|
|
1429
1429
|
// src/hwpx/table-build.ts
|
|
1430
1430
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1431
|
-
const table2 =
|
|
1431
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1432
1432
|
if (state.caption) table2.caption = state.caption;
|
|
1433
1433
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1434
1434
|
const anchors = [];
|
|
@@ -1499,7 +1499,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1499
1499
|
const cell2 = parentTable.cell;
|
|
1500
1500
|
(cell2.blocks ??= []).push(block);
|
|
1501
1501
|
cell2.hasStructure = true;
|
|
1502
|
-
let flat =
|
|
1502
|
+
let flat = _chunkV3Q6I2AQcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1503
1503
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1504
1504
|
if (flat) {
|
|
1505
1505
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1642,7 +1642,7 @@ function detectHwpxSectionPages(root) {
|
|
|
1642
1642
|
// src/hwpx/section-walker.ts
|
|
1643
1643
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1644
1644
|
const parser = createXmlParser(warnings);
|
|
1645
|
-
const doc = parser.parseFromString(
|
|
1645
|
+
const doc = parser.parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1646
1646
|
if (!doc.documentElement) return [];
|
|
1647
1647
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1648
1648
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -1756,8 +1756,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1756
1756
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1757
1757
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1758
1758
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1759
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1760
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1759
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkV3Q6I2AQcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkV3Q6I2AQcjs.MAX_ROWS);
|
|
1761
1761
|
}
|
|
1762
1762
|
break;
|
|
1763
1763
|
case "p": {
|
|
@@ -2030,7 +2030,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2030
2030
|
const sink = [];
|
|
2031
2031
|
const st = { rows: [], currentRow: [], cell: null };
|
|
2032
2032
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2033
|
-
let flat =
|
|
2033
|
+
let flat = _chunkV3Q6I2AQcjs.convertTableToText.call(void 0, st.rows);
|
|
2034
2034
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2035
2035
|
const built = [];
|
|
2036
2036
|
completeTable(st, [], built, ctx);
|
|
@@ -2185,7 +2185,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2185
2185
|
let url = (ch.textContent || "").trim();
|
|
2186
2186
|
if (!url) continue;
|
|
2187
2187
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2188
|
-
const safe =
|
|
2188
|
+
const safe = _chunkKATZTHWAcjs.sanitizeHref.call(void 0, url);
|
|
2189
2189
|
if (safe) return safe;
|
|
2190
2190
|
}
|
|
2191
2191
|
return void 0;
|
|
@@ -2345,7 +2345,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2345
2345
|
case "hyperlink": {
|
|
2346
2346
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2347
2347
|
if (url) {
|
|
2348
|
-
const safe =
|
|
2348
|
+
const safe = _chunkKATZTHWAcjs.sanitizeHref.call(void 0, url);
|
|
2349
2349
|
if (safe) href = safe;
|
|
2350
2350
|
}
|
|
2351
2351
|
walk(child, depth + 1);
|
|
@@ -2628,7 +2628,7 @@ function decompressStream(data) {
|
|
|
2628
2628
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2629
2629
|
}
|
|
2630
2630
|
function parseFileHeader(data) {
|
|
2631
|
-
if (data.length < 40) throw new (0,
|
|
2631
|
+
if (data.length < 40) throw new (0, _chunkKATZTHWAcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2632
2632
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2633
2633
|
return {
|
|
2634
2634
|
signature: sig,
|
|
@@ -3080,13 +3080,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3080
3080
|
}
|
|
3081
3081
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3082
3082
|
for (const path of allCandidates) {
|
|
3083
|
-
if (
|
|
3083
|
+
if (_chunkKATZTHWAcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3084
3084
|
const file = zip.file(path);
|
|
3085
3085
|
if (!file) continue;
|
|
3086
3086
|
try {
|
|
3087
3087
|
const data = await file.async("uint8array");
|
|
3088
3088
|
decompressed.total += data.length;
|
|
3089
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3089
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3090
3090
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3091
3091
|
const mimeType = imageExtToMime(ext);
|
|
3092
3092
|
imageIndex++;
|
|
@@ -3096,7 +3096,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3096
3096
|
usedPaths.add(path);
|
|
3097
3097
|
break;
|
|
3098
3098
|
} catch (err) {
|
|
3099
|
-
if (err instanceof
|
|
3099
|
+
if (err instanceof _chunkKATZTHWAcjs.KordocError) throw err;
|
|
3100
3100
|
}
|
|
3101
3101
|
}
|
|
3102
3102
|
if (!img) _optionalChain([warnings, 'optionalAccess', _84 => _84.push, 'call', _85 => _85({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3116,11 +3116,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3116
3116
|
if (sweepUnreferenced) {
|
|
3117
3117
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3118
3118
|
for (const file of binEntries) {
|
|
3119
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3119
|
+
if (file.dir || usedPaths.has(file.name) || _chunkKATZTHWAcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3120
3120
|
try {
|
|
3121
3121
|
const data = await file.async("uint8array");
|
|
3122
3122
|
decompressed.total += data.length;
|
|
3123
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3123
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3124
3124
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3125
3125
|
let mimeType = imageExtToMime(ext);
|
|
3126
3126
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3134,7 +3134,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3134
3134
|
images.push(img);
|
|
3135
3135
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3136
3136
|
} catch (err) {
|
|
3137
|
-
if (err instanceof
|
|
3137
|
+
if (err instanceof _chunkKATZTHWAcjs.KordocError) throw err;
|
|
3138
3138
|
_optionalChain([warnings, 'optionalAccess', _86 => _86.push, 'call', _87 => _87({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3139
3139
|
}
|
|
3140
3140
|
}
|
|
@@ -3185,7 +3185,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3185
3185
|
}
|
|
3186
3186
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3187
3187
|
const name = new TextDecoder().decode(nameBytes);
|
|
3188
|
-
if (
|
|
3188
|
+
if (_chunkKATZTHWAcjs.isPathTraversal.call(void 0, name)) {
|
|
3189
3189
|
pos = fileStart + compSize;
|
|
3190
3190
|
continue;
|
|
3191
3191
|
}
|
|
@@ -3203,7 +3203,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3203
3203
|
continue;
|
|
3204
3204
|
}
|
|
3205
3205
|
totalDecompressed += content.length * 2;
|
|
3206
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3206
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3207
3207
|
sectionNum++;
|
|
3208
3208
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3209
3209
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3212,9 +3212,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3212
3212
|
continue;
|
|
3213
3213
|
}
|
|
3214
3214
|
}
|
|
3215
|
-
if (blocks.length === 0) throw new (0,
|
|
3215
|
+
if (blocks.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3216
3216
|
applyPageText(blocks, shared);
|
|
3217
|
-
const markdown =
|
|
3217
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3218
3218
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3219
3219
|
}
|
|
3220
3220
|
async function readKordocLayout(zip) {
|
|
@@ -3239,18 +3239,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3239
3239
|
if (paths.length > 0) return paths;
|
|
3240
3240
|
}
|
|
3241
3241
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3242
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3242
|
+
return sectionFiles.map((f) => f.name).sort(_chunkKATZTHWAcjs.compareSectionPaths);
|
|
3243
3243
|
}
|
|
3244
3244
|
function parseSectionPathsFromManifest(xml) {
|
|
3245
3245
|
const parser = createXmlParser();
|
|
3246
|
-
const doc = parser.parseFromString(
|
|
3246
|
+
const doc = parser.parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3247
3247
|
const items = doc.getElementsByTagName("opf:item");
|
|
3248
3248
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3249
3249
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3250
3250
|
for (let i = 0; i < items.length; i++) {
|
|
3251
3251
|
const item = items[i];
|
|
3252
3252
|
const id = item.getAttribute("id") || "";
|
|
3253
|
-
const href =
|
|
3253
|
+
const href = _chunkKATZTHWAcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3254
3254
|
if (id && href) idToHref.set(id, href);
|
|
3255
3255
|
}
|
|
3256
3256
|
if (spine.length > 0) {
|
|
@@ -3261,7 +3261,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3261
3261
|
}
|
|
3262
3262
|
if (ordered.length > 0) return ordered;
|
|
3263
3263
|
}
|
|
3264
|
-
return Array.from(idToHref.values()).sort(
|
|
3264
|
+
return Array.from(idToHref.values()).sort(_chunkKATZTHWAcjs.compareSectionPaths);
|
|
3265
3265
|
}
|
|
3266
3266
|
|
|
3267
3267
|
// src/hwpx/metadata.ts
|
|
@@ -3274,7 +3274,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3274
3274
|
const xml = await file.async("text");
|
|
3275
3275
|
if (decompressed) {
|
|
3276
3276
|
decompressed.total += xml.length * 2;
|
|
3277
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3277
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3278
3278
|
}
|
|
3279
3279
|
parseDublinCoreMetadata(xml, metadata);
|
|
3280
3280
|
if (metadata.title || metadata.author) return;
|
|
@@ -3284,7 +3284,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3284
3284
|
}
|
|
3285
3285
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3286
3286
|
const parser = createXmlParser();
|
|
3287
|
-
const doc = parser.parseFromString(
|
|
3287
|
+
const doc = parser.parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3288
3288
|
if (!doc.documentElement) return;
|
|
3289
3289
|
const getText = (tagNames) => {
|
|
3290
3290
|
for (const tag of tagNames) {
|
|
@@ -3309,7 +3309,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3309
3309
|
|
|
3310
3310
|
// src/hwpx/parser.ts
|
|
3311
3311
|
async function parseHwpxDocument(buffer, options) {
|
|
3312
|
-
|
|
3312
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3313
3313
|
let zip;
|
|
3314
3314
|
try {
|
|
3315
3315
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3318,7 +3318,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3318
3318
|
}
|
|
3319
3319
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3320
3320
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3321
|
-
throw new (0,
|
|
3321
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3322
3322
|
}
|
|
3323
3323
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3324
3324
|
if (manifestFile) {
|
|
@@ -3333,7 +3333,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3333
3333
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3334
3334
|
}
|
|
3335
3335
|
}
|
|
3336
|
-
throw new (0,
|
|
3336
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
3337
3337
|
"\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."
|
|
3338
3338
|
);
|
|
3339
3339
|
}
|
|
@@ -3345,7 +3345,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3345
3345
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3346
3346
|
const warnings = [];
|
|
3347
3347
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3348
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3348
|
+
if (sectionPaths.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3349
3349
|
let allBlocks = [];
|
|
3350
3350
|
const shared = createSectionShared();
|
|
3351
3351
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3390,7 +3390,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3390
3390
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _102 => _102.pages]));
|
|
3391
3391
|
detectHwpxHeadings(blocks, styleMap);
|
|
3392
3392
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3393
|
-
const markdown =
|
|
3393
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3394
3394
|
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 };
|
|
3395
3395
|
}
|
|
3396
3396
|
|
|
@@ -4390,7 +4390,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4390
4390
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4391
4391
|
var TAG_ID_MAPPINGS = 17;
|
|
4392
4392
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4393
|
-
const wrong = () => new (0,
|
|
4393
|
+
const wrong = () => new (0, _chunkKATZTHWAcjs.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.");
|
|
4394
4394
|
let records;
|
|
4395
4395
|
try {
|
|
4396
4396
|
records = readRecords3(data);
|
|
@@ -4402,7 +4402,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4402
4402
|
}
|
|
4403
4403
|
function assertSupportedEncryptVersion(version) {
|
|
4404
4404
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4405
|
-
throw new (0,
|
|
4405
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
4406
4406
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4407
4407
|
);
|
|
4408
4408
|
}
|
|
@@ -4591,7 +4591,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4591
4591
|
lenientCfb = parseLenientCfb(buffer);
|
|
4592
4592
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4593
4593
|
} catch (e24) {
|
|
4594
|
-
throw new (0,
|
|
4594
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4595
4595
|
}
|
|
4596
4596
|
}
|
|
4597
4597
|
const readRawStream = (path) => {
|
|
@@ -4602,14 +4602,14 @@ function parseHwp5Document(buffer, options) {
|
|
|
4602
4602
|
return lenientCfb.findStream(path);
|
|
4603
4603
|
};
|
|
4604
4604
|
const headerData = readRawStream("/FileHeader");
|
|
4605
|
-
if (!headerData) throw new (0,
|
|
4605
|
+
if (!headerData) throw new (0, _chunkKATZTHWAcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4606
4606
|
const header = parseFileHeader(headerData);
|
|
4607
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4608
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4607
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkKATZTHWAcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4608
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkKATZTHWAcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4609
4609
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4610
4610
|
if (encrypted) {
|
|
4611
4611
|
if (!_optionalChain([options, 'optionalAccess', _106 => _106.password])) {
|
|
4612
|
-
throw new (0,
|
|
4612
|
+
throw new (0, _chunkKATZTHWAcjs.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.");
|
|
4613
4613
|
}
|
|
4614
4614
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4615
4615
|
}
|
|
@@ -4627,18 +4627,18 @@ function parseHwp5Document(buffer, options) {
|
|
|
4627
4627
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4628
4628
|
if (encrypted) {
|
|
4629
4629
|
const rawDocInfo = findStream("/DocInfo");
|
|
4630
|
-
if (!rawDocInfo) throw new (0,
|
|
4630
|
+
if (!rawDocInfo) throw new (0, _chunkKATZTHWAcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4631
4631
|
let docInfoData;
|
|
4632
4632
|
try {
|
|
4633
4633
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4634
4634
|
} catch (e25) {
|
|
4635
|
-
throw new (0,
|
|
4635
|
+
throw new (0, _chunkKATZTHWAcjs.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.");
|
|
4636
4636
|
}
|
|
4637
4637
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4638
4638
|
}
|
|
4639
4639
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4640
4640
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4641
|
-
if (sections.length === 0) throw new (0,
|
|
4641
|
+
if (sections.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4642
4642
|
const sectionRecords = [];
|
|
4643
4643
|
const sectionDetects = [];
|
|
4644
4644
|
let totalDecompressed = 0;
|
|
@@ -4646,12 +4646,12 @@ function parseHwp5Document(buffer, options) {
|
|
|
4646
4646
|
try {
|
|
4647
4647
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
4648
4648
|
totalDecompressed += data.length;
|
|
4649
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4649
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4650
4650
|
const records = readRecords(data);
|
|
4651
4651
|
sectionRecords.push(records);
|
|
4652
4652
|
sectionDetects.push(detectHwp5SectionPages(records));
|
|
4653
4653
|
} catch (secErr) {
|
|
4654
|
-
if (secErr instanceof
|
|
4654
|
+
if (secErr instanceof _chunkKATZTHWAcjs.KordocError) throw secErr;
|
|
4655
4655
|
sectionRecords.push(null);
|
|
4656
4656
|
sectionDetects.push(null);
|
|
4657
4657
|
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" });
|
|
@@ -4687,7 +4687,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4687
4687
|
parsedSections++;
|
|
4688
4688
|
_optionalChain([options, 'optionalAccess', _110 => _110.onProgress, 'optionalCall', _111 => _111(parsedSections, sections.length)]);
|
|
4689
4689
|
} catch (secErr) {
|
|
4690
|
-
if (secErr instanceof
|
|
4690
|
+
if (secErr instanceof _chunkKATZTHWAcjs.KordocError) throw secErr;
|
|
4691
4691
|
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" });
|
|
4692
4692
|
} finally {
|
|
4693
4693
|
pageBase += detect.pages;
|
|
@@ -4698,9 +4698,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
4698
4698
|
}
|
|
4699
4699
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4700
4700
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4701
|
-
let flatBlocks =
|
|
4701
|
+
let flatBlocks = _chunkV3Q6I2AQcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4702
4702
|
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4703
|
-
const deduped =
|
|
4703
|
+
const deduped = _chunkV3Q6I2AQcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4704
4704
|
const removed = flatBlocks.length - deduped.length;
|
|
4705
4705
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4706
4706
|
flatBlocks = deduped;
|
|
@@ -4709,10 +4709,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4709
4709
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4710
4710
|
}
|
|
4711
4711
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4712
|
-
let markdown =
|
|
4712
|
+
let markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4713
4713
|
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4714
4714
|
try {
|
|
4715
|
-
markdown =
|
|
4715
|
+
markdown = _chunkV3Q6I2AQcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4716
4716
|
} catch (inlineErr) {
|
|
4717
4717
|
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" });
|
|
4718
4718
|
}
|
|
@@ -4872,7 +4872,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4872
4872
|
if (!raw) break;
|
|
4873
4873
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4874
4874
|
totalDecompressed += content.length;
|
|
4875
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4875
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4876
4876
|
sections.push({ idx: i, content });
|
|
4877
4877
|
}
|
|
4878
4878
|
if (sections.length === 0) {
|
|
@@ -4884,7 +4884,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4884
4884
|
if (raw) {
|
|
4885
4885
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4886
4886
|
totalDecompressed += content.length;
|
|
4887
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4887
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4888
4888
|
sections.push({ idx, content });
|
|
4889
4889
|
}
|
|
4890
4890
|
}
|
|
@@ -4901,7 +4901,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4901
4901
|
try {
|
|
4902
4902
|
const content = decryptViewText(raw, compressed);
|
|
4903
4903
|
totalDecompressed += content.length;
|
|
4904
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4904
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4905
4905
|
sections.push({ idx: i, content });
|
|
4906
4906
|
} catch (e30) {
|
|
4907
4907
|
break;
|
|
@@ -5018,7 +5018,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5018
5018
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5019
5019
|
if (!_optionalChain([ctrl, 'optionalAccess', _126 => _126.href]) || r.end <= r.start) continue;
|
|
5020
5020
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5021
|
-
const href =
|
|
5021
|
+
const href = _chunkKATZTHWAcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5022
5022
|
if (!href) continue;
|
|
5023
5023
|
const anchor = text.slice(r.start, r.end);
|
|
5024
5024
|
if (!anchor.trim()) continue;
|
|
@@ -5258,8 +5258,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5258
5258
|
let tableIdx = -1;
|
|
5259
5259
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5260
5260
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5261
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5262
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5261
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkV3Q6I2AQcjs.MAX_ROWS);
|
|
5262
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkV3Q6I2AQcjs.MAX_COLS);
|
|
5263
5263
|
tableIdx = i2;
|
|
5264
5264
|
break;
|
|
5265
5265
|
}
|
|
@@ -5308,7 +5308,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5308
5308
|
return table3;
|
|
5309
5309
|
}
|
|
5310
5310
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5311
|
-
const table2 =
|
|
5311
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5312
5312
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5313
5313
|
return table2.rows > 0 ? table2 : null;
|
|
5314
5314
|
}
|
|
@@ -5325,8 +5325,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5325
5325
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5326
5326
|
const cs = rec.data.readUInt16LE(12);
|
|
5327
5327
|
const rs = rec.data.readUInt16LE(14);
|
|
5328
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5329
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5328
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkV3Q6I2AQcjs.MAX_COLS);
|
|
5329
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkV3Q6I2AQcjs.MAX_ROWS);
|
|
5330
5330
|
}
|
|
5331
5331
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5332
5332
|
const parts = [];
|
|
@@ -5336,7 +5336,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5336
5336
|
parts.push(``);
|
|
5337
5337
|
hasStructure = true;
|
|
5338
5338
|
} else if (b.type === "table" && b.table) {
|
|
5339
|
-
const flat =
|
|
5339
|
+
const flat = _chunkV3Q6I2AQcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5340
5340
|
if (flat) parts.push(flat);
|
|
5341
5341
|
hasStructure = true;
|
|
5342
5342
|
} else if (b.text) {
|
|
@@ -17611,25 +17611,25 @@ function desEcbDecrypt(data, key) {
|
|
|
17611
17611
|
}
|
|
17612
17612
|
function readLayout(data) {
|
|
17613
17613
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17614
|
-
throw new (0,
|
|
17614
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17615
17615
|
}
|
|
17616
17616
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17617
17617
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17618
17618
|
if (payloadOffset >= data.length) {
|
|
17619
|
-
throw new (0,
|
|
17619
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17620
17620
|
}
|
|
17621
17621
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17622
17622
|
}
|
|
17623
17623
|
function decryptHwp3Document(input, password) {
|
|
17624
17624
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17625
17625
|
if (!compressed) {
|
|
17626
|
-
throw new (0,
|
|
17626
|
+
throw new (0, _chunkKATZTHWAcjs.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)");
|
|
17627
17627
|
}
|
|
17628
17628
|
const source = Buffer.from(input);
|
|
17629
17629
|
const payload = source.subarray(payloadOffset);
|
|
17630
17630
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17631
17631
|
if (aligned.length === 0) {
|
|
17632
|
-
throw new (0,
|
|
17632
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17633
17633
|
}
|
|
17634
17634
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17635
17635
|
let inflated;
|
|
@@ -17637,14 +17637,14 @@ function decryptHwp3Document(input, password) {
|
|
|
17637
17637
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17638
17638
|
} catch (err) {
|
|
17639
17639
|
if (_optionalChain([err, 'optionalAccess', _139 => _139.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17640
|
-
throw new (0,
|
|
17640
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
17641
17641
|
`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`
|
|
17642
17642
|
);
|
|
17643
17643
|
}
|
|
17644
|
-
throw new (0,
|
|
17644
|
+
throw new (0, _chunkKATZTHWAcjs.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.");
|
|
17645
17645
|
}
|
|
17646
17646
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17647
|
-
throw new (0,
|
|
17647
|
+
throw new (0, _chunkKATZTHWAcjs.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.");
|
|
17648
17648
|
}
|
|
17649
17649
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17650
17650
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17679,7 +17679,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
17679
17679
|
let source = Buffer.from(buffer);
|
|
17680
17680
|
if (isEncryptedHwp3(source)) {
|
|
17681
17681
|
if (!_optionalChain([options, 'optionalAccess', _140 => _140.password])) {
|
|
17682
|
-
throw new (0,
|
|
17682
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
17683
17683
|
"\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."
|
|
17684
17684
|
);
|
|
17685
17685
|
}
|
|
@@ -17696,10 +17696,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
17696
17696
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17697
17697
|
} catch (err) {
|
|
17698
17698
|
if (_optionalChain([err, 'optionalAccess', _141 => _141.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17699
|
-
throw new (0,
|
|
17699
|
+
throw new (0, _chunkKATZTHWAcjs.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`);
|
|
17700
17700
|
}
|
|
17701
17701
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17702
|
-
throw new (0,
|
|
17702
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17703
17703
|
}
|
|
17704
17704
|
} else {
|
|
17705
17705
|
body = tail;
|
|
@@ -17941,7 +17941,7 @@ function getTextContent(el) {
|
|
|
17941
17941
|
return _nullishCoalesce(_optionalChain([el, 'access', _144 => _144.textContent, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
17942
17942
|
}
|
|
17943
17943
|
function parseXml(text) {
|
|
17944
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17944
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17945
17945
|
}
|
|
17946
17946
|
function collectRichText(root) {
|
|
17947
17947
|
let out = "";
|
|
@@ -18176,7 +18176,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18176
18176
|
cellRows.push(row);
|
|
18177
18177
|
}
|
|
18178
18178
|
if (cellRows.length > 0) {
|
|
18179
|
-
const table2 =
|
|
18179
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18180
18180
|
if (table2.rows > 0) {
|
|
18181
18181
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18182
18182
|
}
|
|
@@ -18184,12 +18184,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18184
18184
|
return blocks;
|
|
18185
18185
|
}
|
|
18186
18186
|
async function parseXlsxDocument(buffer, options) {
|
|
18187
|
-
|
|
18187
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18188
18188
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18189
18189
|
const warnings = [];
|
|
18190
18190
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18191
18191
|
if (!workbookFile) {
|
|
18192
|
-
throw new (0,
|
|
18192
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18193
18193
|
}
|
|
18194
18194
|
let sharedStrings = [];
|
|
18195
18195
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18198,7 +18198,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18198
18198
|
}
|
|
18199
18199
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18200
18200
|
if (sheets.length === 0) {
|
|
18201
|
-
throw new (0,
|
|
18201
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18202
18202
|
}
|
|
18203
18203
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18204
18204
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18282,7 +18282,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18282
18282
|
} catch (e32) {
|
|
18283
18283
|
}
|
|
18284
18284
|
}
|
|
18285
|
-
const markdown =
|
|
18285
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18286
18286
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18287
18287
|
}
|
|
18288
18288
|
|
|
@@ -18733,11 +18733,11 @@ function processGlobals(records) {
|
|
|
18733
18733
|
const xfFmtIds = [];
|
|
18734
18734
|
const firstBof = records[0];
|
|
18735
18735
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18736
|
-
throw new (0,
|
|
18736
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18737
18737
|
}
|
|
18738
18738
|
const bof = decodeBof(firstBof.data);
|
|
18739
18739
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18740
|
-
throw new (0,
|
|
18740
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18741
18741
|
}
|
|
18742
18742
|
let i = 1;
|
|
18743
18743
|
while (i < records.length) {
|
|
@@ -18872,7 +18872,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18872
18872
|
cellRows.push(row);
|
|
18873
18873
|
}
|
|
18874
18874
|
if (cellRows.length > 0) {
|
|
18875
|
-
const table2 =
|
|
18875
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18876
18876
|
if (table2.rows > 0) {
|
|
18877
18877
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18878
18878
|
}
|
|
@@ -18885,28 +18885,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18885
18885
|
try {
|
|
18886
18886
|
cfb = parseLenientCfb(buf);
|
|
18887
18887
|
} catch (e) {
|
|
18888
|
-
throw new (0,
|
|
18888
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
18889
18889
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18890
18890
|
);
|
|
18891
18891
|
}
|
|
18892
18892
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18893
18893
|
if (!wb) {
|
|
18894
|
-
throw new (0,
|
|
18894
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18895
18895
|
}
|
|
18896
18896
|
const records = readRecords2(wb);
|
|
18897
18897
|
if (records.length === 0) {
|
|
18898
|
-
throw new (0,
|
|
18898
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18899
18899
|
}
|
|
18900
18900
|
const firstBof = decodeBof(records[0].data);
|
|
18901
18901
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18902
|
-
throw new (0,
|
|
18902
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
18903
18903
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18904
18904
|
);
|
|
18905
18905
|
}
|
|
18906
18906
|
const globals = processGlobals(records);
|
|
18907
18907
|
const warnings = [];
|
|
18908
18908
|
if (globals.encrypted) {
|
|
18909
|
-
throw new (0,
|
|
18909
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18910
18910
|
}
|
|
18911
18911
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18912
18912
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18957,7 +18957,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18957
18957
|
pageCount: totalSheets
|
|
18958
18958
|
};
|
|
18959
18959
|
return {
|
|
18960
|
-
markdown:
|
|
18960
|
+
markdown: _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18961
18961
|
blocks: allBlocks,
|
|
18962
18962
|
metadata,
|
|
18963
18963
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19385,7 +19385,7 @@ function getAttr(el, localName3) {
|
|
|
19385
19385
|
return null;
|
|
19386
19386
|
}
|
|
19387
19387
|
function parseXml2(text) {
|
|
19388
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19388
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkKATZTHWAcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19389
19389
|
}
|
|
19390
19390
|
function parseStyles(xml) {
|
|
19391
19391
|
const doc = parseXml2(xml);
|
|
@@ -19543,7 +19543,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19543
19543
|
function makeLink(text, rawHref) {
|
|
19544
19544
|
if (!text) return "";
|
|
19545
19545
|
if (!rawHref) return text;
|
|
19546
|
-
const href =
|
|
19546
|
+
const href = _chunkKATZTHWAcjs.sanitizeHref.call(void 0, rawHref);
|
|
19547
19547
|
return href ? `[${text}](${href})` : text;
|
|
19548
19548
|
}
|
|
19549
19549
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19737,7 +19737,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19737
19737
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19738
19738
|
})
|
|
19739
19739
|
);
|
|
19740
|
-
const table2 =
|
|
19740
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19741
19741
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19742
19742
|
return { type: "table", table: table2 };
|
|
19743
19743
|
}
|
|
@@ -19839,12 +19839,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19839
19839
|
}
|
|
19840
19840
|
}
|
|
19841
19841
|
async function parseDocxDocument(buffer, options) {
|
|
19842
|
-
|
|
19842
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19843
19843
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19844
19844
|
const warnings = [];
|
|
19845
19845
|
const docFile = zip.file("word/document.xml");
|
|
19846
19846
|
if (!docFile) {
|
|
19847
|
-
throw new (0,
|
|
19847
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19848
19848
|
}
|
|
19849
19849
|
let rels = /* @__PURE__ */ new Map();
|
|
19850
19850
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19891,7 +19891,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19891
19891
|
const doc = parseXml2(docXml);
|
|
19892
19892
|
const body = findElements(doc, "body");
|
|
19893
19893
|
if (body.length === 0) {
|
|
19894
|
-
throw new (0,
|
|
19894
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19895
19895
|
}
|
|
19896
19896
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19897
19897
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19942,7 +19942,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19942
19942
|
}
|
|
19943
19943
|
}
|
|
19944
19944
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19945
|
-
const markdown =
|
|
19945
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19946
19946
|
return {
|
|
19947
19947
|
markdown,
|
|
19948
19948
|
blocks,
|
|
@@ -19960,11 +19960,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19960
19960
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19961
19961
|
function parseHwpmlDocument(buffer, options) {
|
|
19962
19962
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19963
|
-
throw new (0,
|
|
19963
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19964
19964
|
}
|
|
19965
19965
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19966
19966
|
const normalized = text.replace(/ /g, " ");
|
|
19967
|
-
const xml =
|
|
19967
|
+
const xml = _chunkKATZTHWAcjs.stripDtd.call(void 0, normalized);
|
|
19968
19968
|
const warnings = [];
|
|
19969
19969
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19970
19970
|
onError: (_level, msg2) => {
|
|
@@ -20004,7 +20004,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20004
20004
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _190 => _190.keepTrailingEmptyCols]), () => ( false)));
|
|
20005
20005
|
}
|
|
20006
20006
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
20007
|
-
const markdown =
|
|
20007
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20008
20008
|
return {
|
|
20009
20009
|
markdown,
|
|
20010
20010
|
blocks,
|
|
@@ -20169,7 +20169,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
20169
20169
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20170
20170
|
cellRows[r].push(cell2);
|
|
20171
20171
|
}
|
|
20172
|
-
const table2 =
|
|
20172
|
+
const table2 = _chunkV3Q6I2AQcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20173
20173
|
if (structured.length > 0) {
|
|
20174
20174
|
const claimed = /* @__PURE__ */ new Set();
|
|
20175
20175
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -21680,7 +21680,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21680
21680
|
};
|
|
21681
21681
|
}
|
|
21682
21682
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21683
|
-
|
|
21683
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21684
21684
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21685
21685
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21686
21686
|
const fields = [];
|
|
@@ -21728,19 +21728,19 @@ function parseCentralDirectory(buf) {
|
|
|
21728
21728
|
}
|
|
21729
21729
|
}
|
|
21730
21730
|
}
|
|
21731
|
-
if (eocdOffset < 0) throw new (0,
|
|
21731
|
+
if (eocdOffset < 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21732
21732
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21733
21733
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21734
21734
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21735
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21735
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21736
21736
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21737
|
-
throw new (0,
|
|
21737
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21738
21738
|
}
|
|
21739
21739
|
const decoder = new TextDecoder("utf-8");
|
|
21740
21740
|
const entries = [];
|
|
21741
21741
|
let pos = cdOffset;
|
|
21742
21742
|
for (let i = 0; i < totalEntries; i++) {
|
|
21743
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21743
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21744
21744
|
const flags = view.getUint16(pos + 8, true);
|
|
21745
21745
|
const method = view.getUint16(pos + 10, true);
|
|
21746
21746
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21751,7 +21751,7 @@ function parseCentralDirectory(buf) {
|
|
|
21751
21751
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21752
21752
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21753
21753
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21754
|
-
throw new (0,
|
|
21754
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21755
21755
|
}
|
|
21756
21756
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21757
21757
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21780,11 +21780,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21780
21780
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21781
21781
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21782
21782
|
for (const name of replacements.keys()) {
|
|
21783
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21783
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkKATZTHWAcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21784
21784
|
}
|
|
21785
21785
|
if (additions) {
|
|
21786
21786
|
for (const name of additions.keys()) {
|
|
21787
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21787
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkKATZTHWAcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21788
21788
|
}
|
|
21789
21789
|
}
|
|
21790
21790
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21803,7 +21803,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21803
21803
|
offset += seg.length;
|
|
21804
21804
|
continue;
|
|
21805
21805
|
}
|
|
21806
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21806
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkKATZTHWAcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21807
21807
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21808
21808
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21809
21809
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21811,7 +21811,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21811
21811
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21812
21812
|
const method = e.method;
|
|
21813
21813
|
if (method !== 0 && method !== 8) {
|
|
21814
|
-
throw new (0,
|
|
21814
|
+
throw new (0, _chunkKATZTHWAcjs.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`);
|
|
21815
21815
|
}
|
|
21816
21816
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21817
21817
|
const crc = crc32(newData);
|
|
@@ -21909,11 +21909,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21909
21909
|
// src/form/filler-hwpx.ts
|
|
21910
21910
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21911
21911
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21912
|
-
|
|
21912
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21913
21913
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21914
21914
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21915
21915
|
if (sectionPaths.length === 0) {
|
|
21916
|
-
throw new (0,
|
|
21916
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21917
21917
|
}
|
|
21918
21918
|
const warnings = [];
|
|
21919
21919
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -22226,7 +22226,7 @@ function blocksToPages(blocks) {
|
|
|
22226
22226
|
const pages = [];
|
|
22227
22227
|
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
22228
22228
|
const pageBlocks = byPage.get(pageNumber);
|
|
22229
|
-
pages.push({ pageNumber, markdown: pageBlocks ?
|
|
22229
|
+
pages.push({ pageNumber, markdown: pageBlocks ? _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, pageBlocks) : "" });
|
|
22230
22230
|
}
|
|
22231
22231
|
return pages;
|
|
22232
22232
|
}
|
|
@@ -22533,7 +22533,7 @@ function gaejosikSizes(bodyHeight, ov = {}) {
|
|
|
22533
22533
|
}
|
|
22534
22534
|
function gaejosikSpaceBefore(depth, bodyHeight) {
|
|
22535
22535
|
const s = bodyHeight / 1500;
|
|
22536
|
-
const ui = [
|
|
22536
|
+
const ui = [300, 0, 0, 0][Math.min(depth, 3)];
|
|
22537
22537
|
return Math.round(ui * s);
|
|
22538
22538
|
}
|
|
22539
22539
|
function gaejosikLevelIndent(depth, bodyHeight, sizes = {}, bullet2 = "\u25CB") {
|
|
@@ -22678,7 +22678,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22678
22678
|
}
|
|
22679
22679
|
function assertFiniteRange(name, value, min, max) {
|
|
22680
22680
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22681
|
-
throw new (0,
|
|
22681
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22682
22682
|
}
|
|
22683
22683
|
}
|
|
22684
22684
|
function validateGongmunOptions(opts) {
|
|
@@ -22693,10 +22693,10 @@ function validateGongmunOptions(opts) {
|
|
|
22693
22693
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22694
22694
|
}
|
|
22695
22695
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22696
|
-
throw new (0,
|
|
22696
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22697
22697
|
}
|
|
22698
22698
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22699
|
-
throw new (0,
|
|
22699
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22700
22700
|
}
|
|
22701
22701
|
}
|
|
22702
22702
|
if (opts.sizes) {
|
|
@@ -22705,7 +22705,7 @@ function validateGongmunOptions(opts) {
|
|
|
22705
22705
|
}
|
|
22706
22706
|
}
|
|
22707
22707
|
if (opts.approval && opts.approval.length > 6) {
|
|
22708
|
-
throw new (0,
|
|
22708
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("approval must contain at most 6 labels");
|
|
22709
22709
|
}
|
|
22710
22710
|
}
|
|
22711
22711
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22956,7 +22956,9 @@ var GJ_CHAR_BAR = 24;
|
|
|
22956
22956
|
var GJ_CHAR_BODY_TITLE = 25;
|
|
22957
22957
|
var GJ_CHAR_TITLE_BAR = 26;
|
|
22958
22958
|
var GJ_CHAR_APPROVAL = 27;
|
|
22959
|
-
var
|
|
22959
|
+
var GJ_CHAR_SRC = 28;
|
|
22960
|
+
var GJ_CHAR_SRC_BOLD = 29;
|
|
22961
|
+
var GJ_CHAR_COUNT = GJ_CHAR_SRC_BOLD - GJ_CHAR_DAE + 1;
|
|
22960
22962
|
var GJ_PARA_CHAM = 20;
|
|
22961
22963
|
var GJ_PARA_COVER = 21;
|
|
22962
22964
|
var GJ_PARA_TOC_ITEM = 22;
|
|
@@ -22964,7 +22966,8 @@ var GJ_PARA_CHAPTER = 23;
|
|
|
22964
22966
|
var GJ_PARA_BAR = 24;
|
|
22965
22967
|
var GONGMUN_LIST_PLAIN_BASE = 25;
|
|
22966
22968
|
var GONGMUN_PARA_APPROVAL = GONGMUN_LIST_PLAIN_BASE + GONGMUN_LIST_LEVELS;
|
|
22967
|
-
var
|
|
22969
|
+
var GONGMUN_SRC_LEFT = GONGMUN_PARA_APPROVAL + 1;
|
|
22970
|
+
var GONGMUN_LIST_VARIANT_BASE = GONGMUN_SRC_LEFT + 1;
|
|
22968
22971
|
var GJ_BF_CHAPTER_NUM = 3;
|
|
22969
22972
|
var GJ_BF_CHAPTER_GAP = 4;
|
|
22970
22973
|
var GJ_BF_CHAPTER_TITLE = 5;
|
|
@@ -23008,10 +23011,15 @@ var GONGMUN_TBL_CHAR_BOLD = 12;
|
|
|
23008
23011
|
var GONGMUN_TBL_PT = 1200;
|
|
23009
23012
|
var GONGMUN_TITLE_BAR_CHAR = 13;
|
|
23010
23013
|
var GONGMUN_APPROVAL_CHAR = 14;
|
|
23014
|
+
var GONGMUN_SRC_CHAR = 15;
|
|
23015
|
+
var GONGMUN_SRC_CHAR_BOLD = 16;
|
|
23016
|
+
function srcCaptionPt(bodyHeight) {
|
|
23017
|
+
return Math.max(bodyHeight - 300, 1e3);
|
|
23018
|
+
}
|
|
23011
23019
|
var CHAR_VARIANT_BASE = CHAR_QUOTE + 1;
|
|
23012
23020
|
function charVariantBase(richAssets, isGongmun = true) {
|
|
23013
23021
|
if (!isGongmun) return CHAR_VARIANT_BASE;
|
|
23014
|
-
return richAssets ? CHAR_VARIANT_BASE + GJ_CHAR_COUNT : CHAR_VARIANT_BASE + (
|
|
23022
|
+
return richAssets ? CHAR_VARIANT_BASE + GJ_CHAR_COUNT : CHAR_VARIANT_BASE + (GONGMUN_SRC_CHAR_BOLD - GONGMUN_TBL_CHAR + 1);
|
|
23015
23023
|
}
|
|
23016
23024
|
var GONGMUN_BODY_RATIO = 95;
|
|
23017
23025
|
|
|
@@ -23050,6 +23058,7 @@ function buildPrvText(blocks) {
|
|
|
23050
23058
|
}
|
|
23051
23059
|
return lines.join("\n").slice(0, 1024);
|
|
23052
23060
|
}
|
|
23061
|
+
var BUNIM_HEAD = /^붙\s*임(?:\s|:|$)/;
|
|
23053
23062
|
function findMathDelim(s, from) {
|
|
23054
23063
|
let i = s.indexOf("$$", from);
|
|
23055
23064
|
while (i > 0) {
|
|
@@ -23065,9 +23074,11 @@ function parseMarkdownToBlocks(md2) {
|
|
|
23065
23074
|
const blocks = [];
|
|
23066
23075
|
let i = 0;
|
|
23067
23076
|
const listStack = [];
|
|
23077
|
+
let inBunim = false;
|
|
23068
23078
|
while (i < lines.length) {
|
|
23069
23079
|
const line = lines[i];
|
|
23070
23080
|
if (!line.trim()) {
|
|
23081
|
+
inBunim = false;
|
|
23071
23082
|
i++;
|
|
23072
23083
|
continue;
|
|
23073
23084
|
}
|
|
@@ -23195,6 +23206,19 @@ function parseMarkdownToBlocks(md2) {
|
|
|
23195
23206
|
if (joined.length) blocks.push({ type: "blockquote", text: joined.join("\n") });
|
|
23196
23207
|
continue;
|
|
23197
23208
|
}
|
|
23209
|
+
if (BUNIM_HEAD.test(line.trim())) inBunim = true;
|
|
23210
|
+
if (inBunim) {
|
|
23211
|
+
if (BUNIM_HEAD.test(line.trim())) {
|
|
23212
|
+
const prevBlock = blocks[blocks.length - 1];
|
|
23213
|
+
if (blocks.length && !(prevBlock.type === "paragraph" && !prevBlock.text)) {
|
|
23214
|
+
blocks.push({ type: "paragraph", text: "" });
|
|
23215
|
+
}
|
|
23216
|
+
}
|
|
23217
|
+
blocks.push({ type: "paragraph", text: line.replace(/\s+$/, "") });
|
|
23218
|
+
listStack.length = 0;
|
|
23219
|
+
i++;
|
|
23220
|
+
continue;
|
|
23221
|
+
}
|
|
23198
23222
|
const listLine = line.replace(/^[\t ]+/, (ws) => ws.replace(/\t/g, " "));
|
|
23199
23223
|
const listMatch = listLine.match(/^(\s*)([-*+]|\d+[.)]) (.+)$/);
|
|
23200
23224
|
if (listMatch) {
|
|
@@ -23243,7 +23267,7 @@ function parseInlineMarkdown(text) {
|
|
|
23243
23267
|
else spans.push(...emphasisSpans(m[0]));
|
|
23244
23268
|
} else {
|
|
23245
23269
|
const anchor = m[2] || m[3];
|
|
23246
|
-
const href = _nullishCoalesce(
|
|
23270
|
+
const href = _nullishCoalesce(_chunkKATZTHWAcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
23247
23271
|
const sub = emphasisSpans(anchor);
|
|
23248
23272
|
if (href) for (const s of sub) s.href = href;
|
|
23249
23273
|
spans.push(...sub);
|
|
@@ -23457,7 +23481,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23457
23481
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23458
23482
|
const got = m ? Number(m[1]) : NaN;
|
|
23459
23483
|
if (got !== startId + i) {
|
|
23460
|
-
throw new (0,
|
|
23484
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
23461
23485
|
`\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)`
|
|
23462
23486
|
);
|
|
23463
23487
|
}
|
|
@@ -23497,7 +23521,10 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23497
23521
|
charPr(11, GONGMUN_TBL_PT, false, false, bodyFont, theme.body),
|
|
23498
23522
|
charPr(12, GONGMUN_TBL_PT, true, false, bodyFont, theme.body),
|
|
23499
23523
|
charPr(GONGMUN_TITLE_BAR_CHAR, 100, false, false, bodyFont, theme.body),
|
|
23500
|
-
charPr(GONGMUN_APPROVAL_CHAR, 1e3, false, false, bodyFont, theme.body)
|
|
23524
|
+
charPr(GONGMUN_APPROVAL_CHAR, 1e3, false, false, bodyFont, theme.body),
|
|
23525
|
+
// 출처행 캡션 — 본문 폰트 -3pt (실무 보고서: 표 아래 출처는 본문과 구분되는 작은 글씨)
|
|
23526
|
+
charPr(GONGMUN_SRC_CHAR, srcCaptionPt(body), false, false, bodyFont, theme.body),
|
|
23527
|
+
charPr(GONGMUN_SRC_CHAR_BOLD, srcCaptionPt(body), true, false, bodyFont, theme.body)
|
|
23501
23528
|
);
|
|
23502
23529
|
}
|
|
23503
23530
|
if (richAssets) {
|
|
@@ -23535,13 +23562,17 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23535
23562
|
// 본문 제목박스(HY헤드라인M 22pt, 실측 GT3 표④)
|
|
23536
23563
|
charPr(GJ_CHAR_TITLE_BAR, 100, false, false, 4),
|
|
23537
23564
|
// 1페이지형 제목박스 바(1pt)
|
|
23538
|
-
charPr(GJ_CHAR_APPROVAL, 1e3, false, false, 7)
|
|
23565
|
+
charPr(GJ_CHAR_APPROVAL, 1e3, false, false, 7),
|
|
23539
23566
|
// 결재란 라벨(맑은 고딕 10pt)
|
|
23567
|
+
charPr(GJ_CHAR_SRC, srcCaptionPt(body), false, false, 5),
|
|
23568
|
+
// 출처행 캡션(한양중고딕 본문-3pt)
|
|
23569
|
+
charPr(GJ_CHAR_SRC_BOLD, srcCaptionPt(body), true, false, 5)
|
|
23570
|
+
// 출처행 캡션 bold
|
|
23540
23571
|
);
|
|
23541
23572
|
}
|
|
23542
23573
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23543
23574
|
if (rows.length !== expectedBase) {
|
|
23544
|
-
throw new (0,
|
|
23575
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
23545
23576
|
`\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`
|
|
23546
23577
|
);
|
|
23547
23578
|
}
|
|
@@ -23578,13 +23609,18 @@ ${base2.join("\n")}
|
|
|
23578
23609
|
}
|
|
23579
23610
|
const ls = gongmun.lineSpacing;
|
|
23580
23611
|
const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
|
|
23581
|
-
const
|
|
23612
|
+
const h2MarkerWidth = markerWidth(gongmun.h2Marker === "box" ? "\u25A1" : "1.", 1600);
|
|
23613
|
+
const h2Geom = gongmun.h2Marker !== "none" ? { spaceBefore: Math.round(gongmun.bodyHeight * 2), spaceAfter: 0, indent: -h2MarkerWidth } : { spaceBefore: 600, spaceAfter: 150 };
|
|
23614
|
+
const h3Left = gongmun.h2Marker !== "none" ? h2MarkerWidth : 0;
|
|
23582
23615
|
const base = [
|
|
23583
23616
|
paraPr(0, { lineSpacing: ls, keepWord: true }),
|
|
23584
23617
|
paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls, keepWord: true }),
|
|
23585
23618
|
paraPr(2, { align: "LEFT", ...h2Geom, lineSpacing: ls, keepWord: true }),
|
|
23586
|
-
|
|
23587
|
-
|
|
23619
|
+
// h3·h4 소제목("가." "1)")은 h2(□) 대항목의 하위다 — 종전에는 left가 없어 h2 부호가
|
|
23620
|
+
// 내어쓰기로 왼쪽에 나간 뒤 소제목이 본문 경계에서 시작해, 실렌더상 소제목이 대항목보다
|
|
23621
|
+
// 왼쪽에 놓이며 계층이 사라졌다(실렌더 확인). h2 부호폭만큼 들여써 h2 제목 글자와 맞춘다.
|
|
23622
|
+
paraPr(3, { align: "LEFT", left: h3Left, spaceBefore: 400, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
|
|
23623
|
+
paraPr(4, { align: "LEFT", left: h3Left + Math.round(gongmun.bodyHeight / 2), spaceBefore: 300, spaceAfter: 100, lineSpacing: ls, keepWord: true }),
|
|
23588
23624
|
paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400, keepWord: true }),
|
|
23589
23625
|
paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true }),
|
|
23590
23626
|
paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600, keepWord: true })
|
|
@@ -23619,6 +23655,7 @@ ${base2.join("\n")}
|
|
|
23619
23655
|
base.push(paraPr(GONGMUN_LIST_PLAIN_BASE + d, { align: listAlign, lineSpacing: ls, left, indent: 0, spaceBefore: sectionGap, keepWord: true }));
|
|
23620
23656
|
}
|
|
23621
23657
|
base.push(paraPr(GONGMUN_PARA_APPROVAL, { align: "CENTER", lineSpacing: 100, keepWord: true }));
|
|
23658
|
+
base.push(paraPr(GONGMUN_SRC_LEFT, { align: "LEFT", lineSpacing: ls, keepWord: true }));
|
|
23622
23659
|
for (let vi = 0; vi < listIndentVariants.length; vi++) {
|
|
23623
23660
|
const { depth, widthHu } = listIndentVariants[vi];
|
|
23624
23661
|
const { left } = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
@@ -24437,7 +24474,7 @@ function escapeGfm(text) {
|
|
|
24437
24474
|
}
|
|
24438
24475
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24439
24476
|
function sanitizeText(text) {
|
|
24440
|
-
let result =
|
|
24477
|
+
let result = _chunkV3Q6I2AQcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24441
24478
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24442
24479
|
const tokens = result.split(" ");
|
|
24443
24480
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24609,7 +24646,7 @@ function parseHtmlTable(raw) {
|
|
|
24609
24646
|
const cs = parseInt(_optionalChain([attrs, 'access', _318 => _318.match, 'call', _319 => _319(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _320 => _320[1]]) || "1", 10);
|
|
24610
24647
|
const rs = parseInt(_optionalChain([attrs, 'access', _321 => _321.match, 'call', _322 => _322(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _323 => _323[1]]) || "1", 10);
|
|
24611
24648
|
cellStart = m.index + m[0].length;
|
|
24612
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24649
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkV3Q6I2AQcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkV3Q6I2AQcjs.MAX_ROWS) };
|
|
24613
24650
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24614
24651
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24615
24652
|
cellStart = -1;
|
|
@@ -25351,8 +25388,8 @@ function layoutHtmlRows(rows) {
|
|
|
25351
25388
|
let c = 0;
|
|
25352
25389
|
for (const cell2 of rows[r].cells) {
|
|
25353
25390
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25354
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25355
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25391
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkV3Q6I2AQcjs.MAX_COLS);
|
|
25392
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkV3Q6I2AQcjs.MAX_ROWS);
|
|
25356
25393
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25357
25394
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25358
25395
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -26194,7 +26231,17 @@ function renderParagraph(block, blockIdx, ctx) {
|
|
|
26194
26231
|
const ctr = gongmun && /^<center>([\s\S]*)<\/center>$/i.exec((block.text || "").trim());
|
|
26195
26232
|
const rgt = gongmun && /^<right>([\s\S]*)<\/right>$/i.exec((block.text || "").trim());
|
|
26196
26233
|
if (ctr) return generateParagraph(ctr[1].trim(), GONGMUN_CENTER);
|
|
26197
|
-
if (rgt)
|
|
26234
|
+
if (rgt) {
|
|
26235
|
+
const t = rgt[1].trim();
|
|
26236
|
+
const isSrc = /^(출처|자료)\s*[::]/.test(t);
|
|
26237
|
+
const srcChar = ctx.richAssets ? GJ_CHAR_SRC : GONGMUN_SRC_CHAR;
|
|
26238
|
+
const srcBold = ctx.richAssets ? GJ_CHAR_SRC_BOLD : GONGMUN_SRC_CHAR_BOLD;
|
|
26239
|
+
const h = isSrc ? srcCaptionPt(gongmun.bodyHeight) : gongmun.bodyHeight;
|
|
26240
|
+
const fits = measureTextWidth(t, h, isSrc ? 100 : GONGMUN_BODY_RATIO) <= ctx.gjBodyW + 0.5;
|
|
26241
|
+
const paraId = fits ? GONGMUN_RIGHT : GONGMUN_SRC_LEFT;
|
|
26242
|
+
if (!isSrc) return generateParagraph(t, paraId);
|
|
26243
|
+
return generateParagraph(t, paraId, srcChar, (id) => id === CHAR_BOLD ? srcBold : id);
|
|
26244
|
+
}
|
|
26198
26245
|
return generateParagraph(block.text || "", PARA_NORMAL, CHAR_NORMAL, fit ? variantMapper(fit, blockIdx, vBase) : void 0);
|
|
26199
26246
|
}
|
|
26200
26247
|
function renderCodeBlock(block, blockIdx, ctx) {
|
|
@@ -26291,8 +26338,8 @@ function renderHtmlTable(block, ctx) {
|
|
|
26291
26338
|
ctx.opener.emitCarrier(ctx.paraXmls);
|
|
26292
26339
|
return `<hp:p paraPrIDRef="${tableStyle && bfReg ? GONGMUN_RIGHT : 0}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
26293
26340
|
}
|
|
26294
|
-
const
|
|
26295
|
-
return
|
|
26341
|
+
const plain2 = (block.text || "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
26342
|
+
return plain2 ? generateParagraph(plain2) : "";
|
|
26296
26343
|
}
|
|
26297
26344
|
function appendPostamble(blocks, ctx) {
|
|
26298
26345
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
@@ -26663,7 +26710,7 @@ function builtinTemplateDir() {
|
|
|
26663
26710
|
for (const c of candidates) {
|
|
26664
26711
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26665
26712
|
}
|
|
26666
|
-
throw new (0,
|
|
26713
|
+
throw new (0, _chunkKATZTHWAcjs.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)");
|
|
26667
26714
|
}
|
|
26668
26715
|
function readBuiltinTemplate(t) {
|
|
26669
26716
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -27006,12 +27053,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
27006
27053
|
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>`;
|
|
27007
27054
|
}
|
|
27008
27055
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
27009
|
-
if (ops.length === 0) throw new (0,
|
|
27056
|
+
if (ops.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27010
27057
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
27011
|
-
|
|
27058
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
27012
27059
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
27013
27060
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _436 => _436.match, 'call', _437 => _437(/(\d+)\.xml$/i), 'optionalAccess', _438 => _438[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _439 => _439.match, 'call', _440 => _440(/(\d+)\.xml$/i), 'optionalAccess', _441 => _441[1]]), () => ( 0))));
|
|
27014
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
27061
|
+
if (sectionPaths.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27015
27062
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
27016
27063
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
27017
27064
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -27052,11 +27099,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27052
27099
|
const manifestItems = [];
|
|
27053
27100
|
const placed = [];
|
|
27054
27101
|
for (const op of ops) {
|
|
27055
|
-
if (!op.anchor) throw new (0,
|
|
27056
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27102
|
+
if (!op.anchor) throw new (0, _chunkKATZTHWAcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27103
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27057
27104
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
27058
|
-
if (!MIME[ext]) throw new (0,
|
|
27059
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27105
|
+
if (!MIME[ext]) throw new (0, _chunkKATZTHWAcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27106
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkKATZTHWAcjs.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)`);
|
|
27060
27107
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
27061
27108
|
let found = null;
|
|
27062
27109
|
let total = 0;
|
|
@@ -27089,7 +27136,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27089
27136
|
}
|
|
27090
27137
|
}
|
|
27091
27138
|
}
|
|
27092
|
-
throw new (0,
|
|
27139
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
27093
27140
|
`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)})`
|
|
27094
27141
|
);
|
|
27095
27142
|
}
|
|
@@ -27097,7 +27144,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27097
27144
|
const xml = sectionXmls[si];
|
|
27098
27145
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
27099
27146
|
if (!run) {
|
|
27100
|
-
throw new (0,
|
|
27147
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
27101
27148
|
}
|
|
27102
27149
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _442 => _442.charPr, 'access', _443 => _443.get, 'call', _444 => _444(run.charPr), 'optionalAccess', _445 => _445.height]), () => ( 1e3));
|
|
27103
27150
|
const fontPt = charPrHeight / 100;
|
|
@@ -27375,7 +27422,7 @@ function pick(map, keys) {
|
|
|
27375
27422
|
return out;
|
|
27376
27423
|
}
|
|
27377
27424
|
async function hwpxToProfile(input) {
|
|
27378
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27425
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkKATZTHWAcjs.toArrayBuffer.call(void 0, input);
|
|
27379
27426
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27380
27427
|
const parser = createXmlParser();
|
|
27381
27428
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _467 => _467.file, 'call', _468 => _468(/[Hh]eader\.xml$/), 'optionalAccess', _469 => _469[0]])));
|
|
@@ -27706,6 +27753,233 @@ function gongmunLintWarnings(text, limit = 10) {
|
|
|
27706
27753
|
return shown;
|
|
27707
27754
|
}
|
|
27708
27755
|
|
|
27756
|
+
// src/hwpx/munche-lint.ts
|
|
27757
|
+
function usesGaejosikMunche(preset) {
|
|
27758
|
+
const p = normalizeGongmunPreset(preset);
|
|
27759
|
+
return p === "gaejosik" || p === "report" || p === "plan";
|
|
27760
|
+
}
|
|
27761
|
+
var ITEM_MAX = 70;
|
|
27762
|
+
var CONCL_MAX = 60;
|
|
27763
|
+
var LEAD_MAX = 140;
|
|
27764
|
+
function classify(raw) {
|
|
27765
|
+
const indent = raw.length - raw.trimStart().length;
|
|
27766
|
+
const t = raw.trim();
|
|
27767
|
+
if (!t) return null;
|
|
27768
|
+
if (t.startsWith("#") || t.startsWith("|") || t.startsWith("![") || /^[-=*_]{3,}$/.test(t)) return null;
|
|
27769
|
+
if (t.startsWith(">")) return { kind: "lead", body: t.slice(1).trim() };
|
|
27770
|
+
if (/^(?:⇒|=>|➡|→)/.test(t)) return { kind: "concl", body: t.replace(/^(?:⇒|=>|➡|→)\s*/, "") };
|
|
27771
|
+
if (/^(?:※|\*\s)/.test(t)) return { kind: "note", body: t.replace(/^(?:※|\*)\s*/, "") };
|
|
27772
|
+
if (t.startsWith("\u25A1")) return { kind: "dae", body: t.slice(1).trim() };
|
|
27773
|
+
if (/^(?:○|❍|ㅇ|◦)/.test(t)) return { kind: "item", body: t.slice(1).trim() };
|
|
27774
|
+
const li = /^(?:[-•ㆍ·]|\d+[.)])\s+(.*)$/.exec(t);
|
|
27775
|
+
if (li) return { kind: indent >= 2 ? "sub" : "item", body: li[1].trim() };
|
|
27776
|
+
return { kind: "para", body: t };
|
|
27777
|
+
}
|
|
27778
|
+
function plain(s) {
|
|
27779
|
+
return s.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/(\*\*|__|~~|`)/g, "").trim();
|
|
27780
|
+
}
|
|
27781
|
+
function stripQuoted(s) {
|
|
27782
|
+
return s.replace(/[“"'‘][^”"'’]{0,80}[”"'’]/g, "").replace(/\([^)]{0,80}\)/g, "");
|
|
27783
|
+
}
|
|
27784
|
+
var DA_ENDING = /[가-힣]다\.?$/;
|
|
27785
|
+
var DEONTIC = /(?:해야|하여야|되어야|돼야|필요가 있)\s*(?:한다|함|합니다|하겠음)\.?$|할 것\.?$/;
|
|
27786
|
+
var GEOSIDA = /것(?:이다|임)\.?$/;
|
|
27787
|
+
var LEAD_ENDING = /(?:하고자|하려|고자)\s*함\.?$/;
|
|
27788
|
+
var NOT_A_BUT = /(?:아니라|아닌|아니고|아니며)\s*,?\s*([가-힣]{1,12})/g;
|
|
27789
|
+
var ABSTRACT = [
|
|
27790
|
+
"\uC0AC\uB78C",
|
|
27791
|
+
"\uB9C8\uC74C",
|
|
27792
|
+
"\uBCF8\uC9C8",
|
|
27793
|
+
"\uC804\uD658",
|
|
27794
|
+
"\uD0DC\uB3C4",
|
|
27795
|
+
"\uBB38\uD654",
|
|
27796
|
+
"\uCCA0\uD559",
|
|
27797
|
+
"\uAC00\uCE58",
|
|
27798
|
+
"\uC815\uC2E0",
|
|
27799
|
+
"\uAD00\uACC4",
|
|
27800
|
+
"\uC2E0\uB8B0",
|
|
27801
|
+
"\uACFC\uC815",
|
|
27802
|
+
"\uC9C8\uBB38",
|
|
27803
|
+
"\uC774\uC57C\uAE30",
|
|
27804
|
+
"\uACBD\uD5D8",
|
|
27805
|
+
"\uC2DC\uAC04",
|
|
27806
|
+
"\uACF5\uAC04",
|
|
27807
|
+
"\uC5F0\uACB0",
|
|
27808
|
+
"\uBCC0\uD654",
|
|
27809
|
+
"\uBBF8\uB798",
|
|
27810
|
+
"\uC2DC\uC791",
|
|
27811
|
+
"\uC6A9\uAE30",
|
|
27812
|
+
"\uC758\uC9C0",
|
|
27813
|
+
"\uBC29\uBC95",
|
|
27814
|
+
"\uC790\uC138",
|
|
27815
|
+
"\uC758\uC2DD",
|
|
27816
|
+
"\uC5ED\uB7C9"
|
|
27817
|
+
];
|
|
27818
|
+
var COUPLET = /[은는이가]\s*[^,]{2,15},\s*[^,]{2,15}[은는이가]\s*[^,]{2,15}$/;
|
|
27819
|
+
var DATE_KOREAN = /\d{4}년\s*\d{1,2}월/;
|
|
27820
|
+
function lintMuncheText(text) {
|
|
27821
|
+
const findings = [];
|
|
27822
|
+
const lines = text.split(/\r?\n/);
|
|
27823
|
+
let fenceMarker = null;
|
|
27824
|
+
let frontMatter = false;
|
|
27825
|
+
let leadBuf = [];
|
|
27826
|
+
const add = (line, kind, severity, rule, match, message, suggest) => {
|
|
27827
|
+
findings.push({ line, kind, severity, rule, match: match.slice(0, 60), message, suggest });
|
|
27828
|
+
};
|
|
27829
|
+
const flushLead = () => {
|
|
27830
|
+
if (!leadBuf.length) return;
|
|
27831
|
+
const block = leadBuf.map((l) => l.body).join(" ").trim();
|
|
27832
|
+
const at = leadBuf[0].line;
|
|
27833
|
+
leadBuf = [];
|
|
27834
|
+
if (block.length < 20) return;
|
|
27835
|
+
if (!LEAD_ENDING.test(block)) {
|
|
27836
|
+
add(
|
|
27837
|
+
at,
|
|
27838
|
+
"lead",
|
|
27839
|
+
"warning",
|
|
27840
|
+
"LEAD_ENDING",
|
|
27841
|
+
block,
|
|
27842
|
+
"\uB9AC\uB4DC\uBB38\uC740 '~\uD558\uACE0\uC790 \uD568.' \uD55C \uBB38\uC7A5",
|
|
27843
|
+
"[\uC218\uB2E8]\uD558\uACE0, [\uC218\uB2E8]\uD558\uC5EC [\uBAA9\uC801]\uD558\uACE0\uC790 \uD568."
|
|
27844
|
+
);
|
|
27845
|
+
}
|
|
27846
|
+
const sentences = (_nullishCoalesce(block.match(/\./g), () => ( []))).length;
|
|
27847
|
+
if (block.length > LEAD_MAX || sentences > 1) {
|
|
27848
|
+
add(
|
|
27849
|
+
at,
|
|
27850
|
+
"lead",
|
|
27851
|
+
"warning",
|
|
27852
|
+
"LEAD_LONG",
|
|
27853
|
+
block,
|
|
27854
|
+
`\uB9AC\uB4DC\uBB38 ${block.length}\uC790\xB7\uBB38\uC7A5 ${sentences}\uAC1C \u2014 \uC2E4\uCE21\uC740 \uD55C \uBB38\uC7A5 40~120\uC790`,
|
|
27855
|
+
"\uC218\uB2E8 \uB458\xB7\uBAA9\uC801 \uD558\uB098\uB85C \uC555\uCD95"
|
|
27856
|
+
);
|
|
27857
|
+
}
|
|
27858
|
+
};
|
|
27859
|
+
for (let i = 0; i < lines.length; i++) {
|
|
27860
|
+
const raw = lines[i];
|
|
27861
|
+
const no = i + 1;
|
|
27862
|
+
if (raw.trim() === "---" && (frontMatter || no <= 3)) {
|
|
27863
|
+
if (no <= 3 || frontMatter) frontMatter = !frontMatter;
|
|
27864
|
+
continue;
|
|
27865
|
+
}
|
|
27866
|
+
if (frontMatter) continue;
|
|
27867
|
+
const fence = raw.match(/^\s*(```+|~~~+)/);
|
|
27868
|
+
if (fence) {
|
|
27869
|
+
const kind = fence[1][0];
|
|
27870
|
+
if (fenceMarker === null) fenceMarker = kind;
|
|
27871
|
+
else if (kind === fenceMarker) fenceMarker = null;
|
|
27872
|
+
continue;
|
|
27873
|
+
}
|
|
27874
|
+
if (fenceMarker !== null) continue;
|
|
27875
|
+
const c = classify(raw);
|
|
27876
|
+
if (!c) {
|
|
27877
|
+
flushLead();
|
|
27878
|
+
continue;
|
|
27879
|
+
}
|
|
27880
|
+
if (c.kind === "lead") {
|
|
27881
|
+
leadBuf.push({ line: no, body: plain(c.body) });
|
|
27882
|
+
continue;
|
|
27883
|
+
}
|
|
27884
|
+
flushLead();
|
|
27885
|
+
const b = plain(c.body);
|
|
27886
|
+
if (!b) continue;
|
|
27887
|
+
const q = stripQuoted(b);
|
|
27888
|
+
if (c.kind === "item" || c.kind === "sub" || c.kind === "concl" || c.kind === "para") {
|
|
27889
|
+
if (DA_ENDING.test(q)) {
|
|
27890
|
+
add(
|
|
27891
|
+
no,
|
|
27892
|
+
c.kind,
|
|
27893
|
+
"error",
|
|
27894
|
+
"DA_ENDING",
|
|
27895
|
+
b,
|
|
27896
|
+
"'~\uB2E4' \uC11C\uC220\uD615 \uC885\uACB0 \u2014 \uC2E4\uCE21 0%(\uD56D\uBAA9 0/264)",
|
|
27897
|
+
"\uBA85\uC0AC\xB7\uBA85\uC0AC\uAD6C \uB610\uB294 '~\uD568/\uC788\uC74C'\uC73C\uB85C"
|
|
27898
|
+
);
|
|
27899
|
+
}
|
|
27900
|
+
if (GEOSIDA.test(q)) {
|
|
27901
|
+
add(no, c.kind, "warning", "GEOSIDA", b, "'~\uAC83\uC774\uB2E4/\uAC83\uC784' \u2014 \uC2E4\uCE21 1\uAC74\uBFD0", "\uBA85\uC0AC \uC885\uACB0\uB85C");
|
|
27902
|
+
}
|
|
27903
|
+
}
|
|
27904
|
+
if (DEONTIC.test(q)) {
|
|
27905
|
+
add(
|
|
27906
|
+
no,
|
|
27907
|
+
c.kind,
|
|
27908
|
+
"error",
|
|
27909
|
+
"DEONTIC",
|
|
27910
|
+
b,
|
|
27911
|
+
"'~\uD574\uC57C \uD55C\uB2E4' \uB2F9\uC704 \uC885\uACB0 \u2014 \uD310\uB2E8\uC740 \uBA85\uC0AC\uB85C \uB05D\uB9FA\uC74C",
|
|
27912
|
+
"\uC608) \u21D2 \uC9C0\uC5ED\uB9DE\uCDA4\uD615 \uBCF4\uAE09 \uD544\uC694"
|
|
27913
|
+
);
|
|
27914
|
+
}
|
|
27915
|
+
NOT_A_BUT.lastIndex = 0;
|
|
27916
|
+
for (const m of q.matchAll(NOT_A_BUT)) {
|
|
27917
|
+
const tail = _nullishCoalesce(m[1], () => ( ""));
|
|
27918
|
+
if (ABSTRACT.some((w) => tail.includes(w))) {
|
|
27919
|
+
add(
|
|
27920
|
+
no,
|
|
27921
|
+
c.kind,
|
|
27922
|
+
"error",
|
|
27923
|
+
"RHETORIC_CONTRAST",
|
|
27924
|
+
m[0].trim(),
|
|
27925
|
+
`'\uC544\uB2C8\uB77C ${tail}' \u2014 B\uAC00 \uCD94\uC0C1\uC5B4\xB7\uAC00\uCE58\uC5B4\uBA74 \uC218\uC0AC(\uC2E4\uCE21 0\uAC74)`,
|
|
27926
|
+
"\uB450 \uAD6C\uCCB4 \uC120\uD0DD\uC9C0\uB97C \uAC00\uB974\uB294 \uACBD\uC6B0\uB9CC \uD5C8\uC6A9"
|
|
27927
|
+
);
|
|
27928
|
+
} else {
|
|
27929
|
+
add(
|
|
27930
|
+
no,
|
|
27931
|
+
c.kind,
|
|
27932
|
+
"warning",
|
|
27933
|
+
"CONTRAST_CHECK",
|
|
27934
|
+
m[0].trim(),
|
|
27935
|
+
`'\uC544\uB2C8\uB77C ${tail}' \u2014 B\uAC00 \uAD6C\uCCB4 \uC120\uD0DD\uC9C0(\uC81C\uB3C4\xB7\uC7A5\uC18C\xB7\uC808\uCC28)\uC778\uC9C0 \uD655\uC778`
|
|
27936
|
+
);
|
|
27937
|
+
}
|
|
27938
|
+
}
|
|
27939
|
+
if (c.kind !== "note" && /[?!?!]/.test(q)) {
|
|
27940
|
+
add(no, c.kind, "error", "QUESTION_EXCLAIM", b, "\uBB3C\uC74C\uD45C\xB7\uB290\uB08C\uD45C \u2014 \uBCF8\uBB38 \uC2E4\uCE21 0\uAC74");
|
|
27941
|
+
}
|
|
27942
|
+
if ((c.kind === "item" || c.kind === "para" || c.kind === "dae") && COUPLET.test(q)) {
|
|
27943
|
+
add(no, c.kind, "warning", "COUPLET", b, "\uB300\uAD6C(\u5C0D\u53E5)\uB85C \uBCF4\uC784 \u2014 \uC2AC\uB85C\uAC74 \uBB38\uC7A5\uC740 \uC2E4\uCE21 0\uAC74", "\uBAA9\uD45C \uC218\uCE58\xB7\uBA85\uC0AC\uB85C");
|
|
27944
|
+
}
|
|
27945
|
+
if (c.kind === "item" && b.length > ITEM_MAX) {
|
|
27946
|
+
add(
|
|
27947
|
+
no,
|
|
27948
|
+
c.kind,
|
|
27949
|
+
"warning",
|
|
27950
|
+
"ITEM_LONG",
|
|
27951
|
+
b,
|
|
27952
|
+
`\uD56D\uBAA9 ${b.length}\uC790 \u2014 \uC2E4\uCE21 \uC911\uC559 31\uC790, 2\uC904 \uD55C\uACC4`,
|
|
27953
|
+
"\uADFC\uAC70\xB7\uC608\uC2DC\uB294 \uC138\uBD80(-)\uB85C \uB0B4\uB9BC"
|
|
27954
|
+
);
|
|
27955
|
+
}
|
|
27956
|
+
if (c.kind === "concl" && b.length > CONCL_MAX) {
|
|
27957
|
+
add(
|
|
27958
|
+
no,
|
|
27959
|
+
c.kind,
|
|
27960
|
+
"warning",
|
|
27961
|
+
"CONCL_LONG",
|
|
27962
|
+
b,
|
|
27963
|
+
`\uACB0\uB860 ${b.length}\uC790 \u2014 \uC2E4\uCE21 \uC911\uC559 30\uC790`,
|
|
27964
|
+
"\uD310\uB2E8 \uD558\uB098\uB9CC \uB0A8\uAE40"
|
|
27965
|
+
);
|
|
27966
|
+
}
|
|
27967
|
+
if (DATE_KOREAN.test(b)) {
|
|
27968
|
+
add(no, c.kind, "warning", "DATE_KOREAN", b, "\uC5F0\xB7\uC6D4\uC744 \uAE00\uC790\uB85C \uD45C\uAE30", "\uC608) 2026. 8. 22.");
|
|
27969
|
+
}
|
|
27970
|
+
}
|
|
27971
|
+
flushLead();
|
|
27972
|
+
return findings;
|
|
27973
|
+
}
|
|
27974
|
+
function muncheLintWarnings(text, limit = 10) {
|
|
27975
|
+
const findings = lintMuncheText(text);
|
|
27976
|
+
const shown = findings.slice(0, limit).map(
|
|
27977
|
+
(f) => `\uBB38\uCCB4 [${f.rule}] L${f.line} "${f.match}" \u2014 ${f.message}${f.suggest ? ` (${f.suggest})` : ""}`
|
|
27978
|
+
);
|
|
27979
|
+
if (findings.length > limit) shown.push(`\uBB38\uCCB4 \uACBD\uACE0 ${findings.length - limit}\uAC74 \uB354 \uC788\uC74C \u2014 kordoc lint --munche\uB85C \uC804\uCCB4 \uD655\uC778`);
|
|
27980
|
+
return shown;
|
|
27981
|
+
}
|
|
27982
|
+
|
|
27709
27983
|
// src/roundtrip/patcher.ts
|
|
27710
27984
|
|
|
27711
27985
|
|
|
@@ -28322,7 +28596,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
28322
28596
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
28323
28597
|
if (paths.length > 0) return paths;
|
|
28324
28598
|
}
|
|
28325
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
28599
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkKATZTHWAcjs.compareSectionPaths);
|
|
28326
28600
|
}
|
|
28327
28601
|
function sectionPathsFromManifest(xml) {
|
|
28328
28602
|
const attr = (tag, name) => {
|
|
@@ -28332,7 +28606,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28332
28606
|
const idToHref = /* @__PURE__ */ new Map();
|
|
28333
28607
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
28334
28608
|
const id = attr(m[1], "id");
|
|
28335
|
-
const href =
|
|
28609
|
+
const href = _chunkKATZTHWAcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
28336
28610
|
if (id && href) idToHref.set(id, href);
|
|
28337
28611
|
}
|
|
28338
28612
|
const ordered = [];
|
|
@@ -28341,7 +28615,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28341
28615
|
if (href) ordered.push(href);
|
|
28342
28616
|
}
|
|
28343
28617
|
if (ordered.length > 0) return ordered;
|
|
28344
|
-
return Array.from(idToHref.values()).sort(
|
|
28618
|
+
return Array.from(idToHref.values()).sort(_chunkKATZTHWAcjs.compareSectionPaths);
|
|
28345
28619
|
}
|
|
28346
28620
|
|
|
28347
28621
|
// src/roundtrip/patcher.ts
|
|
@@ -28452,9 +28726,9 @@ function buildOrigUnits(blocks) {
|
|
|
28452
28726
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28453
28727
|
const next = blocks[i + 1];
|
|
28454
28728
|
if (_optionalChain([next, 'optionalAccess', _502 => _502.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28455
|
-
chunk =
|
|
28729
|
+
chunk = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28456
28730
|
} else {
|
|
28457
|
-
chunk =
|
|
28731
|
+
chunk = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28458
28732
|
}
|
|
28459
28733
|
if (chunk) {
|
|
28460
28734
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -30074,12 +30348,12 @@ function blocksToChunks(blocks, options) {
|
|
|
30074
30348
|
let run = null;
|
|
30075
30349
|
const flushRun = () => {
|
|
30076
30350
|
if (!run) return;
|
|
30077
|
-
push("text", run.breadcrumb,
|
|
30351
|
+
push("text", run.breadcrumb, _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
30078
30352
|
run = null;
|
|
30079
30353
|
};
|
|
30080
30354
|
for (let i = 0; i < blocks.length; i++) {
|
|
30081
30355
|
const block = blocks[i];
|
|
30082
|
-
const md2 =
|
|
30356
|
+
const md2 = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, [block]);
|
|
30083
30357
|
if (!md2) continue;
|
|
30084
30358
|
if (block.type === "heading") {
|
|
30085
30359
|
flushRun();
|
|
@@ -30549,13 +30823,13 @@ async function htmlToPdf(html, options) {
|
|
|
30549
30823
|
try {
|
|
30550
30824
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30551
30825
|
} catch (e37) {
|
|
30552
|
-
throw new (0,
|
|
30826
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
30553
30827
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30554
30828
|
);
|
|
30555
30829
|
}
|
|
30556
30830
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30557
30831
|
if (!executablePath) {
|
|
30558
|
-
throw new (0,
|
|
30832
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)(
|
|
30559
30833
|
"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."
|
|
30560
30834
|
);
|
|
30561
30835
|
}
|
|
@@ -30614,7 +30888,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30614
30888
|
return htmlToPdf(html, options);
|
|
30615
30889
|
}
|
|
30616
30890
|
async function blocksToPdf(blocks, options) {
|
|
30617
|
-
const markdown =
|
|
30891
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30618
30892
|
return markdownToPdf(markdown, options);
|
|
30619
30893
|
}
|
|
30620
30894
|
|
|
@@ -31513,15 +31787,15 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31513
31787
|
async function renderHwpxToSvg(input, options) {
|
|
31514
31788
|
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _599 => _599.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31515
31789
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31516
|
-
|
|
31790
|
+
_chunkKATZTHWAcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31517
31791
|
let zip;
|
|
31518
31792
|
try {
|
|
31519
31793
|
zip = await _jszip2.default.loadAsync(input);
|
|
31520
31794
|
} catch (e38) {
|
|
31521
|
-
throw new (0,
|
|
31795
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31522
31796
|
}
|
|
31523
31797
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31524
|
-
if (secFiles.length === 0) throw new (0,
|
|
31798
|
+
if (secFiles.length === 0) throw new (0, _chunkKATZTHWAcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31525
31799
|
const warnings = [];
|
|
31526
31800
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31527
31801
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31529,7 +31803,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31529
31803
|
const secXmls = [];
|
|
31530
31804
|
for (const f of secFiles) {
|
|
31531
31805
|
const xml = await f.async("string");
|
|
31532
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31806
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKATZTHWAcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31533
31807
|
secXmls.push(xml);
|
|
31534
31808
|
}
|
|
31535
31809
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31602,9 +31876,9 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31602
31876
|
}
|
|
31603
31877
|
if (rendered.length === 0) {
|
|
31604
31878
|
if (noCacheSkipped) {
|
|
31605
|
-
throw new (0,
|
|
31879
|
+
throw new (0, _chunkKATZTHWAcjs.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)");
|
|
31606
31880
|
}
|
|
31607
|
-
throw new (0,
|
|
31881
|
+
throw new (0, _chunkKATZTHWAcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31608
31882
|
}
|
|
31609
31883
|
const GAP = 2400;
|
|
31610
31884
|
const clipDefs = [];
|
|
@@ -31640,13 +31914,13 @@ async function parse(input, options) {
|
|
|
31640
31914
|
if (typeof input === "string") {
|
|
31641
31915
|
try {
|
|
31642
31916
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31643
|
-
buffer =
|
|
31917
|
+
buffer = _chunkKATZTHWAcjs.toArrayBuffer.call(void 0, buf);
|
|
31644
31918
|
} catch (err) {
|
|
31645
31919
|
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}`;
|
|
31646
31920
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31647
31921
|
}
|
|
31648
31922
|
} else if (Buffer.isBuffer(input)) {
|
|
31649
|
-
buffer =
|
|
31923
|
+
buffer = _chunkKATZTHWAcjs.toArrayBuffer.call(void 0, input);
|
|
31650
31924
|
} else {
|
|
31651
31925
|
buffer = input;
|
|
31652
31926
|
}
|
|
@@ -31688,18 +31962,18 @@ async function dispatch(format, buffer, opts) {
|
|
|
31688
31962
|
}
|
|
31689
31963
|
async function parseImage(buffer, options) {
|
|
31690
31964
|
try {
|
|
31691
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31965
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-YTGAUHEP.cjs")));
|
|
31692
31966
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31693
31967
|
return {
|
|
31694
31968
|
success: true,
|
|
31695
31969
|
fileType: "image",
|
|
31696
|
-
markdown:
|
|
31970
|
+
markdown: _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31697
31971
|
blocks,
|
|
31698
31972
|
warnings: warnings.length ? warnings : void 0,
|
|
31699
31973
|
pageCount: 1
|
|
31700
31974
|
};
|
|
31701
31975
|
} catch (err) {
|
|
31702
|
-
return { success: false, fileType: "image", error:
|
|
31976
|
+
return { success: false, fileType: "image", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31703
31977
|
}
|
|
31704
31978
|
}
|
|
31705
31979
|
async function parseHwp3(buffer, options) {
|
|
@@ -31707,7 +31981,7 @@ async function parseHwp3(buffer, options) {
|
|
|
31707
31981
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31708
31982
|
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _606 => _606.pageCount]) };
|
|
31709
31983
|
} catch (err) {
|
|
31710
|
-
return { success: false, fileType: "hwp3", error:
|
|
31984
|
+
return { success: false, fileType: "hwp3", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31711
31985
|
}
|
|
31712
31986
|
}
|
|
31713
31987
|
async function parseHwpx(buffer, options) {
|
|
@@ -31715,7 +31989,7 @@ async function parseHwpx(buffer, options) {
|
|
|
31715
31989
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31716
31990
|
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31717
31991
|
} catch (err) {
|
|
31718
|
-
return { success: false, fileType: "hwpx", error:
|
|
31992
|
+
return { success: false, fileType: "hwpx", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31719
31993
|
}
|
|
31720
31994
|
}
|
|
31721
31995
|
async function parseHwp(buffer, options) {
|
|
@@ -31741,13 +32015,13 @@ async function parseHwp(buffer, options) {
|
|
|
31741
32015
|
}
|
|
31742
32016
|
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _610 => _610.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _611 => _611.pageCount]) };
|
|
31743
32017
|
} catch (err) {
|
|
31744
|
-
return { success: false, fileType: "hwp", error:
|
|
32018
|
+
return { success: false, fileType: "hwp", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31745
32019
|
}
|
|
31746
32020
|
}
|
|
31747
32021
|
async function parsePdf(buffer, options) {
|
|
31748
32022
|
let parsePdfDocument;
|
|
31749
32023
|
try {
|
|
31750
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
32024
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-WIRWVN5E.cjs")));
|
|
31751
32025
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31752
32026
|
} catch (e40) {
|
|
31753
32027
|
return {
|
|
@@ -31762,7 +32036,7 @@ async function parsePdf(buffer, options) {
|
|
|
31762
32036
|
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _612 => _612.pageCount]) };
|
|
31763
32037
|
} catch (err) {
|
|
31764
32038
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31765
|
-
return { success: false, fileType: "pdf", error:
|
|
32039
|
+
return { success: false, fileType: "pdf", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err), isImageBased };
|
|
31766
32040
|
}
|
|
31767
32041
|
}
|
|
31768
32042
|
async function parseXlsx(buffer, options) {
|
|
@@ -31770,7 +32044,7 @@ async function parseXlsx(buffer, options) {
|
|
|
31770
32044
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31771
32045
|
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _613 => _613.pageCount]) };
|
|
31772
32046
|
} catch (err) {
|
|
31773
|
-
return { success: false, fileType: "xlsx", error:
|
|
32047
|
+
return { success: false, fileType: "xlsx", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31774
32048
|
}
|
|
31775
32049
|
}
|
|
31776
32050
|
async function parseXls(buffer, options) {
|
|
@@ -31778,7 +32052,7 @@ async function parseXls(buffer, options) {
|
|
|
31778
32052
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31779
32053
|
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _614 => _614.pageCount]) };
|
|
31780
32054
|
} catch (err) {
|
|
31781
|
-
return { success: false, fileType: "xls", error:
|
|
32055
|
+
return { success: false, fileType: "xls", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31782
32056
|
}
|
|
31783
32057
|
}
|
|
31784
32058
|
async function parseDocx(buffer, options) {
|
|
@@ -31786,7 +32060,7 @@ async function parseDocx(buffer, options) {
|
|
|
31786
32060
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31787
32061
|
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _615 => _615.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _616 => _616.pageCount]) };
|
|
31788
32062
|
} catch (err) {
|
|
31789
|
-
return { success: false, fileType: "docx", error:
|
|
32063
|
+
return { success: false, fileType: "docx", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31790
32064
|
}
|
|
31791
32065
|
}
|
|
31792
32066
|
async function parseHwpml(buffer, options) {
|
|
@@ -31794,16 +32068,16 @@ async function parseHwpml(buffer, options) {
|
|
|
31794
32068
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31795
32069
|
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _617 => _617.pageCount]) };
|
|
31796
32070
|
} catch (err) {
|
|
31797
|
-
return { success: false, fileType: "hwpml", error:
|
|
32071
|
+
return { success: false, fileType: "hwpml", error: _chunkKATZTHWAcjs.sanitizeError.call(void 0, err), code: _chunkKATZTHWAcjs.classifyError.call(void 0, err) };
|
|
31798
32072
|
}
|
|
31799
32073
|
}
|
|
31800
32074
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31801
32075
|
let buffer;
|
|
31802
32076
|
if (typeof input === "string") {
|
|
31803
32077
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31804
|
-
buffer =
|
|
32078
|
+
buffer = _chunkKATZTHWAcjs.toArrayBuffer.call(void 0, buf);
|
|
31805
32079
|
} else if (Buffer.isBuffer(input)) {
|
|
31806
|
-
buffer =
|
|
32080
|
+
buffer = _chunkKATZTHWAcjs.toArrayBuffer.call(void 0, input);
|
|
31807
32081
|
} else {
|
|
31808
32082
|
buffer = input;
|
|
31809
32083
|
}
|
|
@@ -31829,7 +32103,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31829
32103
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31830
32104
|
}
|
|
31831
32105
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31832
|
-
const markdown =
|
|
32106
|
+
const markdown = _chunkV3Q6I2AQcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31833
32107
|
if (outputFormat === "hwpx") {
|
|
31834
32108
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31835
32109
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31909,5 +32183,8 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31909
32183
|
|
|
31910
32184
|
|
|
31911
32185
|
|
|
31912
|
-
|
|
32186
|
+
|
|
32187
|
+
|
|
32188
|
+
|
|
32189
|
+
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 = _chunkKATZTHWAcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkV3Q6I2AQcjs.blocksToMarkdown; exports.blocksToPages = blocksToPages; 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.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; 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.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
31913
32190
|
//# sourceMappingURL=index.cjs.map
|