kordoc 4.7.3 → 4.8.0
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 +19 -1
- package/dist/{-WYNJOQ6P.js → -URO5XBEB.js} +11 -9
- package/dist/{chunk-TXQQ7URG.js → chunk-2ANLGAUG.js} +2 -2
- package/dist/{chunk-LMHVMGEC.js → chunk-37SAM3LH.js} +3 -3
- package/dist/{chunk-W5NZYPRQ.js → chunk-3CBHCDYD.js} +41 -9
- package/dist/chunk-3CBHCDYD.js.map +1 -0
- package/dist/{chunk-QETZP25M.cjs → chunk-5IRX3TQP.cjs} +3 -3
- package/dist/{chunk-QETZP25M.cjs.map → chunk-5IRX3TQP.cjs.map} +1 -1
- package/dist/{chunk-3P5YCJQE.js → chunk-7OHDTS5Q.js} +2 -2
- package/dist/{chunk-KSATSTC5.js → chunk-BN33O25L.js} +1 -1
- package/dist/{chunk-4KGGVCYX.js.map → chunk-BN33O25L.js.map} +1 -1
- package/dist/{chunk-KE6DLZAW.cjs → chunk-CX2LRBC5.cjs} +11 -11
- package/dist/{chunk-KE6DLZAW.cjs.map → chunk-CX2LRBC5.cjs.map} +1 -1
- package/dist/{chunk-HJV4BVQI.js → chunk-E6OJKTYS.js} +2 -2
- package/dist/{chunk-NYLYIN55.js → chunk-F7RZZI5P.js} +3 -3
- package/dist/{chunk-R4LXZRYP.cjs → chunk-GGZ5PSJO.cjs} +4 -4
- package/dist/{chunk-R4LXZRYP.cjs.map → chunk-GGZ5PSJO.cjs.map} +1 -1
- package/dist/{chunk-JKJEBDP7.js → chunk-HFVMCUXF.js} +3 -3
- package/dist/{chunk-RQVFFSAO.js → chunk-HS4762CD.js} +2 -2
- package/dist/{chunk-E6DONLTM.cjs → chunk-J7DBL77B.cjs} +2 -2
- package/dist/{chunk-E6DONLTM.cjs.map → chunk-J7DBL77B.cjs.map} +1 -1
- package/dist/{chunk-IMFIACHP.js → chunk-L2Q3NLHX.js} +2 -2
- package/dist/{chunk-EV53YE3W.cjs → chunk-L5CDTOC3.cjs} +1 -1
- package/dist/chunk-L5CDTOC3.cjs.map +1 -0
- package/dist/{chunk-P663PYWV.js → chunk-NFCQ5XNT.js} +2 -2
- package/dist/{chunk-KEGAEHWO.js → chunk-OKE6G67G.js} +2 -2
- package/dist/{chunk-QGATKC4R.cjs → chunk-OKISH2NK.cjs} +6 -6
- package/dist/{chunk-QGATKC4R.cjs.map → chunk-OKISH2NK.cjs.map} +1 -1
- package/dist/{chunk-46F5RMU7.js → chunk-S4SMUQAT.js} +2 -2
- package/dist/{chunk-CGJDCZA3.js → chunk-TXRTH5BV.js} +2 -2
- package/dist/{chunk-XOO6YEZE.js → chunk-VPAYFTMH.js} +3 -3
- package/dist/{chunk-4HZN7EZZ.js → chunk-WG473BIB.js} +2 -2
- package/dist/{chunk-Y7T5Z4DC.js → chunk-WXC4HKSD.js} +3 -3
- package/dist/{chunk-4KGGVCYX.js → chunk-XINP35F4.js} +1 -1
- package/dist/{chunk-KSATSTC5.js.map → chunk-XINP35F4.js.map} +1 -1
- package/dist/{chunk-3NKSSL44.js → chunk-YB2TYOYY.js} +3 -3
- package/dist/{chunk-VZ3AQVBN.js → chunk-ZEQPTIWN.js} +2 -2
- package/dist/chunks-M64IY7AK.js +10 -0
- package/dist/cli.js +21 -21
- package/dist/{formula-PDMZMBIP.cjs → formula-3K5KC3VV.cjs} +9 -9
- package/dist/{formula-PDMZMBIP.cjs.map → formula-3K5KC3VV.cjs.map} +1 -1
- package/dist/{formula-V6EAYHMF.js → formula-7BNCJ55B.js} +3 -3
- package/dist/{formula-IFKZZPD2.js → formula-YRMQ7BTI.js} +4 -4
- package/dist/{image-ocr-75WGMVU6.cjs → image-ocr-CBMJIJTQ.cjs} +12 -12
- package/dist/{image-ocr-75WGMVU6.cjs.map → image-ocr-CBMJIJTQ.cjs.map} +1 -1
- package/dist/{image-ocr-B7TMIG3F.js → image-ocr-O7TKPDTY.js} +8 -8
- package/dist/{image-ocr-XHBZONFZ.js → image-ocr-XRVXVYKO.js} +6 -6
- package/dist/index.cjs +396 -364
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +16 -16
- package/dist/{model-bundle-Q4HQXJQG.js → model-bundle-GNDUKNME.js} +5 -5
- package/dist/{models-QQA7OQHY.js → models-TJ45RB2Z.js} +5 -5
- package/dist/{parser-Z36MZUHS.js → parser-5MLJHSRX.js} +7 -7
- package/dist/{parser-4CBOPTVY.cjs → parser-GIVQWVKJ.cjs} +27 -27
- package/dist/{parser-4CBOPTVY.cjs.map → parser-GIVQWVKJ.cjs.map} +1 -1
- package/dist/{parser-HT7GZOF2.js → parser-U3SMCGRK.js} +7 -7
- package/dist/pdf-ocr-BUBZA4EE.cjs +14 -0
- package/dist/{pdf-ocr-6ZNGDVC6.cjs.map → pdf-ocr-BUBZA4EE.cjs.map} +1 -1
- package/dist/pdf-ocr-HITVPJLV.js +13 -0
- package/dist/pdf-ocr-K4WOCJGJ.js +16 -0
- package/dist/{profile-io-ACYRLCSR.js → profile-io-VATWYLZX.js} +3 -3
- package/dist/{rasterize-QYCLEH2J.js → rasterize-PNRXMSL2.js} +2 -2
- package/dist/render-YY5RKZEB.js +10 -0
- package/dist/seal-5ZNJXOOQ.js +10 -0
- package/dist/{setup-MG3YYKXU.js → setup-OEUDZ4BT.js} +3 -3
- package/dist/{watch-AZIY6AWC.js → watch-USNQJXQC.js} +10 -10
- package/package.json +2 -2
- package/dist/chunk-EV53YE3W.cjs.map +0 -1
- package/dist/chunk-W5NZYPRQ.js.map +0 -1
- package/dist/chunks-LWAOHTK2.js +0 -10
- package/dist/pdf-ocr-6ZNGDVC6.cjs +0 -14
- package/dist/pdf-ocr-NTXRJI4T.js +0 -13
- package/dist/pdf-ocr-TYMCEUPH.js +0 -16
- package/dist/render-5Y2US4IM.js +0 -10
- package/dist/seal-VU6JS2QD.js +0 -10
- /package/dist/{-WYNJOQ6P.js.map → -URO5XBEB.js.map} +0 -0
- /package/dist/{chunk-TXQQ7URG.js.map → chunk-2ANLGAUG.js.map} +0 -0
- /package/dist/{chunk-LMHVMGEC.js.map → chunk-37SAM3LH.js.map} +0 -0
- /package/dist/{chunk-3P5YCJQE.js.map → chunk-7OHDTS5Q.js.map} +0 -0
- /package/dist/{chunk-HJV4BVQI.js.map → chunk-E6OJKTYS.js.map} +0 -0
- /package/dist/{chunk-NYLYIN55.js.map → chunk-F7RZZI5P.js.map} +0 -0
- /package/dist/{chunk-JKJEBDP7.js.map → chunk-HFVMCUXF.js.map} +0 -0
- /package/dist/{chunk-RQVFFSAO.js.map → chunk-HS4762CD.js.map} +0 -0
- /package/dist/{chunk-IMFIACHP.js.map → chunk-L2Q3NLHX.js.map} +0 -0
- /package/dist/{chunk-P663PYWV.js.map → chunk-NFCQ5XNT.js.map} +0 -0
- /package/dist/{chunk-KEGAEHWO.js.map → chunk-OKE6G67G.js.map} +0 -0
- /package/dist/{chunk-46F5RMU7.js.map → chunk-S4SMUQAT.js.map} +0 -0
- /package/dist/{chunk-CGJDCZA3.js.map → chunk-TXRTH5BV.js.map} +0 -0
- /package/dist/{chunk-XOO6YEZE.js.map → chunk-VPAYFTMH.js.map} +0 -0
- /package/dist/{chunk-4HZN7EZZ.js.map → chunk-WG473BIB.js.map} +0 -0
- /package/dist/{chunk-Y7T5Z4DC.js.map → chunk-WXC4HKSD.js.map} +0 -0
- /package/dist/{chunk-3NKSSL44.js.map → chunk-YB2TYOYY.js.map} +0 -0
- /package/dist/{chunk-VZ3AQVBN.js.map → chunk-ZEQPTIWN.js.map} +0 -0
- /package/dist/{chunks-LWAOHTK2.js.map → chunks-M64IY7AK.js.map} +0 -0
- /package/dist/{formula-V6EAYHMF.js.map → formula-7BNCJ55B.js.map} +0 -0
- /package/dist/{formula-IFKZZPD2.js.map → formula-YRMQ7BTI.js.map} +0 -0
- /package/dist/{image-ocr-B7TMIG3F.js.map → image-ocr-O7TKPDTY.js.map} +0 -0
- /package/dist/{image-ocr-XHBZONFZ.js.map → image-ocr-XRVXVYKO.js.map} +0 -0
- /package/dist/{model-bundle-Q4HQXJQG.js.map → model-bundle-GNDUKNME.js.map} +0 -0
- /package/dist/{models-QQA7OQHY.js.map → models-TJ45RB2Z.js.map} +0 -0
- /package/dist/{parser-Z36MZUHS.js.map → parser-5MLJHSRX.js.map} +0 -0
- /package/dist/{parser-HT7GZOF2.js.map → parser-U3SMCGRK.js.map} +0 -0
- /package/dist/{pdf-ocr-NTXRJI4T.js.map → pdf-ocr-HITVPJLV.js.map} +0 -0
- /package/dist/{pdf-ocr-TYMCEUPH.js.map → pdf-ocr-K4WOCJGJ.js.map} +0 -0
- /package/dist/{profile-io-ACYRLCSR.js.map → profile-io-VATWYLZX.js.map} +0 -0
- /package/dist/{rasterize-QYCLEH2J.js.map → rasterize-PNRXMSL2.js.map} +0 -0
- /package/dist/{render-5Y2US4IM.js.map → render-YY5RKZEB.js.map} +0 -0
- /package/dist/{seal-VU6JS2QD.js.map → seal-5ZNJXOOQ.js.map} +0 -0
- /package/dist/{setup-MG3YYKXU.js.map → setup-OEUDZ4BT.js.map} +0 -0
- /package/dist/{watch-AZIY6AWC.js.map → watch-USNQJXQC.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkGGZ5PSJOcjs = require('./chunk-GGZ5PSJO.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,7 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkL5CDTOC3cjs = require('./chunk-L5CDTOC3.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ var _chunkEV53YE3Wcjs = require('./chunk-EV53YE3W.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkJ7DBL77Bcjs = require('./chunk-J7DBL77B.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 _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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
|
}
|
|
@@ -589,11 +589,11 @@ 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, _chunkJ7DBL77Bcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
593
593
|
}
|
|
594
594
|
const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
595
595
|
if (!plain) {
|
|
596
|
-
throw new (0,
|
|
596
|
+
throw new (0, _chunkJ7DBL77Bcjs.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
598
|
decrypted.push({ path: entry.path, plain });
|
|
599
599
|
}
|
|
@@ -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, _chunkJ7DBL77Bcjs.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(_chunkJ7DBL77Bcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
648
648
|
if (!doc.documentElement) continue;
|
|
649
649
|
const domDoc = doc;
|
|
650
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -833,9 +833,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
833
833
|
let level = 0;
|
|
834
834
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
835
835
|
const ratio = block.style.fontSize / baseFontSize;
|
|
836
|
-
if (ratio >=
|
|
837
|
-
else if (ratio >=
|
|
838
|
-
else if (ratio >=
|
|
836
|
+
if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H1) level = 1;
|
|
837
|
+
else if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H2) level = 2;
|
|
838
|
+
else if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H3) level = 3;
|
|
839
839
|
}
|
|
840
840
|
const compactText = text.replace(/\s+/g, "");
|
|
841
841
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -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 = _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.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(_chunkJ7DBL77Bcjs.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, _chunkGGZ5PSJOcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.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 = _chunkJ7DBL77Bcjs.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 = _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 (_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 _chunkJ7DBL77Bcjs.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) || _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 _chunkJ7DBL77Bcjs.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 (_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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(_chunkJ7DBL77Bcjs.compareSectionPaths);
|
|
3243
3243
|
}
|
|
3244
3244
|
function parseSectionPathsFromManifest(xml) {
|
|
3245
3245
|
const parser = createXmlParser();
|
|
3246
|
-
const doc = parser.parseFromString(
|
|
3246
|
+
const doc = parser.parseFromString(_chunkJ7DBL77Bcjs.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 = _chunkJ7DBL77Bcjs.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(_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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(_chunkJ7DBL77Bcjs.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
|
+
_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4608
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 _chunkJ7DBL77Bcjs.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 _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4702
4702
|
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4703
|
-
const deduped =
|
|
4703
|
+
const deduped = _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4713
4713
|
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4714
4714
|
try {
|
|
4715
|
-
markdown =
|
|
4715
|
+
markdown = _chunkGGZ5PSJOcjs.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
|
}
|
|
@@ -4776,9 +4776,9 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4776
4776
|
let level = 0;
|
|
4777
4777
|
if (_optionalChain([block, 'access', _118 => _118.style, 'optionalAccess', _119 => _119.fontSize]) && baseFontSize > 0) {
|
|
4778
4778
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4779
|
-
if (ratio >=
|
|
4780
|
-
else if (ratio >=
|
|
4781
|
-
else if (ratio >=
|
|
4779
|
+
if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H1) level = 1;
|
|
4780
|
+
else if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H2) level = 2;
|
|
4781
|
+
else if (ratio >= _chunkL5CDTOC3cjs.HEADING_RATIO_H3) level = 3;
|
|
4782
4782
|
}
|
|
4783
4783
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4784
4784
|
if (level === 0) level = 2;
|
|
@@ -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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkJ7DBL77Bcjs.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), _chunkGGZ5PSJOcjs.MAX_ROWS);
|
|
5262
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkGGZ5PSJOcjs.MAX_COLS);
|
|
5329
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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(_chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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
|
+
_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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: _chunkGGZ5PSJOcjs.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(_chunkJ7DBL77Bcjs.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 = _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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
|
+
_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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, _chunkJ7DBL77Bcjs.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 = _chunkJ7DBL77Bcjs.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 = _chunkGGZ5PSJOcjs.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 = _chunkGGZ5PSJOcjs.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
|
+
_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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
|
+
_chunkJ7DBL77Bcjs.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, _chunkJ7DBL77Bcjs.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);
|
|
@@ -22208,6 +22208,29 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
22208
22208
|
};
|
|
22209
22209
|
}
|
|
22210
22210
|
|
|
22211
|
+
// src/page-markdown.ts
|
|
22212
|
+
function blocksToPages(blocks) {
|
|
22213
|
+
const firstNumbered = _optionalChain([blocks, 'access', _270 => _270.find, 'call', _271 => _271((b) => typeof b.pageNumber === "number"), 'optionalAccess', _272 => _272.pageNumber]);
|
|
22214
|
+
if (firstNumbered === void 0) return void 0;
|
|
22215
|
+
const byPage = /* @__PURE__ */ new Map();
|
|
22216
|
+
let current = firstNumbered;
|
|
22217
|
+
for (const block of blocks) {
|
|
22218
|
+
if (typeof block.pageNumber === "number") current = block.pageNumber;
|
|
22219
|
+
const bucket = byPage.get(current);
|
|
22220
|
+
if (bucket) bucket.push(block);
|
|
22221
|
+
else byPage.set(current, [block]);
|
|
22222
|
+
}
|
|
22223
|
+
const numbers = [...byPage.keys()];
|
|
22224
|
+
const min = Math.min(...numbers);
|
|
22225
|
+
const max = Math.max(...numbers);
|
|
22226
|
+
const pages = [];
|
|
22227
|
+
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
22228
|
+
const pageBlocks = byPage.get(pageNumber);
|
|
22229
|
+
pages.push({ pageNumber, markdown: pageBlocks ? _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, pageBlocks) : "" });
|
|
22230
|
+
}
|
|
22231
|
+
return pages;
|
|
22232
|
+
}
|
|
22233
|
+
|
|
22211
22234
|
// src/hwpx/generator.ts
|
|
22212
22235
|
|
|
22213
22236
|
|
|
@@ -22376,9 +22399,9 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
22376
22399
|
return cp < 128 ? 500 : 1e3;
|
|
22377
22400
|
}
|
|
22378
22401
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
22379
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22380
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22381
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22402
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _273 => _273.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22403
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _274 => _274.spacingPct]), () => ( 0));
|
|
22404
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _275 => _275.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22382
22405
|
let em = 0;
|
|
22383
22406
|
for (const ch of text) {
|
|
22384
22407
|
const cp = ch.codePointAt(0);
|
|
@@ -22391,9 +22414,9 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
22391
22414
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
22392
22415
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
22393
22416
|
const EPS = 0.5;
|
|
22394
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22395
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22396
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22417
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _276 => _276.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22418
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _277 => _277.spacingPct]), () => ( 0));
|
|
22419
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _278 => _278.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22397
22420
|
const k = height * ratioPct / 100 / 1e3;
|
|
22398
22421
|
const cwCp = (cp) => (cp === 32 ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
22399
22422
|
const charW2 = (ch) => cwCp(ch.codePointAt(0));
|
|
@@ -22655,7 +22678,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22655
22678
|
}
|
|
22656
22679
|
function assertFiniteRange(name, value, min, max) {
|
|
22657
22680
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22658
|
-
throw new (0,
|
|
22681
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22659
22682
|
}
|
|
22660
22683
|
}
|
|
22661
22684
|
function validateGongmunOptions(opts) {
|
|
@@ -22670,10 +22693,10 @@ function validateGongmunOptions(opts) {
|
|
|
22670
22693
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22671
22694
|
}
|
|
22672
22695
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22673
|
-
throw new (0,
|
|
22696
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22674
22697
|
}
|
|
22675
22698
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22676
|
-
throw new (0,
|
|
22699
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22677
22700
|
}
|
|
22678
22701
|
}
|
|
22679
22702
|
if (opts.sizes) {
|
|
@@ -22682,7 +22705,7 @@ function validateGongmunOptions(opts) {
|
|
|
22682
22705
|
}
|
|
22683
22706
|
}
|
|
22684
22707
|
if (opts.approval && opts.approval.length > 6) {
|
|
22685
|
-
throw new (0,
|
|
22708
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)("approval must contain at most 6 labels");
|
|
22686
22709
|
}
|
|
22687
22710
|
}
|
|
22688
22711
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22746,7 +22769,7 @@ function resolveGongmun(opts) {
|
|
|
22746
22769
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
22747
22770
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
22748
22771
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
22749
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
22772
|
+
reportInfo: _optionalChain([opts, 'access', _279 => _279.reportInfo, 'optionalAccess', _280 => _280.trim, 'call', _281 => _281()]) || null,
|
|
22750
22773
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
22751
22774
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
22752
22775
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -22855,16 +22878,16 @@ var PARA_LIST = 7;
|
|
|
22855
22878
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
22856
22879
|
function resolveTheme(theme) {
|
|
22857
22880
|
return {
|
|
22858
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22859
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22860
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22861
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22862
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22863
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22881
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _282 => _282.headingColors, 'optionalAccess', _283 => _283[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22882
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _284 => _284.headingColors, 'optionalAccess', _285 => _285[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22883
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _286 => _286.headingColors, 'optionalAccess', _287 => _287[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22884
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _288 => _288.headingColors, 'optionalAccess', _289 => _289[4]]), () => ( _optionalChain([theme, 'optionalAccess', _290 => _290.headingColors, 'optionalAccess', _291 => _291[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22885
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _292 => _292.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22886
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _293 => _293.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22864
22887
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
22865
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
22866
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22867
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22888
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _294 => _294.quoteColor]) !== void 0,
|
|
22889
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _295 => _295.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _296 => _296.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22890
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _297 => _297.tableHeaderBold])
|
|
22868
22891
|
};
|
|
22869
22892
|
}
|
|
22870
22893
|
function escapeXml(text) {
|
|
@@ -23220,7 +23243,7 @@ function parseInlineMarkdown(text) {
|
|
|
23220
23243
|
else spans.push(...emphasisSpans(m[0]));
|
|
23221
23244
|
} else {
|
|
23222
23245
|
const anchor = m[2] || m[3];
|
|
23223
|
-
const href = _nullishCoalesce(
|
|
23246
|
+
const href = _nullishCoalesce(_chunkJ7DBL77Bcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
23224
23247
|
const sub = emphasisSpans(anchor);
|
|
23225
23248
|
if (href) for (const s of sub) s.href = href;
|
|
23226
23249
|
spans.push(...sub);
|
|
@@ -23386,8 +23409,8 @@ function resolvePage(opts) {
|
|
|
23386
23409
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
23387
23410
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
23388
23411
|
columns: cols,
|
|
23389
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
23390
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
23412
|
+
header: _optionalChain([header, 'optionalAccess', _298 => _298.trim, 'call', _299 => _299()]) ? header.trim() : null,
|
|
23413
|
+
footer: _optionalChain([footer, 'optionalAccess', _300 => _300.trim, 'call', _301 => _301()]) ? footer.trim() : null
|
|
23391
23414
|
};
|
|
23392
23415
|
}
|
|
23393
23416
|
function columnColPrXml(columns) {
|
|
@@ -23434,7 +23457,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23434
23457
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23435
23458
|
const got = m ? Number(m[1]) : NaN;
|
|
23436
23459
|
if (got !== startId + i) {
|
|
23437
|
-
throw new (0,
|
|
23460
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(
|
|
23438
23461
|
`\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)`
|
|
23439
23462
|
);
|
|
23440
23463
|
}
|
|
@@ -23518,7 +23541,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23518
23541
|
}
|
|
23519
23542
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23520
23543
|
if (rows.length !== expectedBase) {
|
|
23521
|
-
throw new (0,
|
|
23544
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(
|
|
23522
23545
|
`\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`
|
|
23523
23546
|
);
|
|
23524
23547
|
}
|
|
@@ -23746,7 +23769,7 @@ function buildStyles(gongmun) {
|
|
|
23746
23769
|
</hh:styles>`;
|
|
23747
23770
|
}
|
|
23748
23771
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
23749
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
23772
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _302 => _302.fonts, 'access', _303 => _303.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _304 => _304.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
23750
23773
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
23751
23774
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
23752
23775
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -23875,8 +23898,8 @@ function parseChartFence(text) {
|
|
|
23875
23898
|
const spec = chartSpec(type);
|
|
23876
23899
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
23877
23900
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
23878
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23879
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23901
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _305 => _305.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
23902
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _306 => _306[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
23880
23903
|
if (!spec.scatter) {
|
|
23881
23904
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
23882
23905
|
}
|
|
@@ -23918,7 +23941,7 @@ function serSpPr(color, stroke) {
|
|
|
23918
23941
|
return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
|
|
23919
23942
|
}
|
|
23920
23943
|
function dPtXml(pointColors, pie) {
|
|
23921
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
23944
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _307 => _307.length])) return "";
|
|
23922
23945
|
return pointColors.map((col, i) => {
|
|
23923
23946
|
const f = chartColorFill(col);
|
|
23924
23947
|
if (!f) return "";
|
|
@@ -24157,8 +24180,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
24157
24180
|
const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
|
|
24158
24181
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
24159
24182
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
24160
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24161
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24183
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _308 => _308.cover, 'optionalAccess', _309 => _309.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
24184
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _310 => _310.cover, 'optionalAccess', _311 => _311.org]), () => ( ""));
|
|
24162
24185
|
const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
|
|
24163
24186
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
24164
24187
|
return [
|
|
@@ -24414,7 +24437,7 @@ function escapeGfm(text) {
|
|
|
24414
24437
|
}
|
|
24415
24438
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24416
24439
|
function sanitizeText(text) {
|
|
24417
|
-
let result =
|
|
24440
|
+
let result = _chunkGGZ5PSJOcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24418
24441
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24419
24442
|
const tokens = result.split(" ");
|
|
24420
24443
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24444,7 +24467,7 @@ function replicateGfmTable(table2) {
|
|
|
24444
24467
|
for (let r = 0; r < numRows; r++) {
|
|
24445
24468
|
for (let c = 0; c < numCols; c++) {
|
|
24446
24469
|
if (skip.has(`${r},${c}`)) continue;
|
|
24447
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24470
|
+
const cell2 = _optionalChain([cells, 'access', _312 => _312[r], 'optionalAccess', _313 => _313[c]]);
|
|
24448
24471
|
if (!cell2) continue;
|
|
24449
24472
|
display[r][c] = {
|
|
24450
24473
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -24498,7 +24521,7 @@ function unescapeGfmCell(text) {
|
|
|
24498
24521
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
24499
24522
|
}
|
|
24500
24523
|
function replicateCellInnerHtml(cell2) {
|
|
24501
|
-
if (_optionalChain([cell2, 'access',
|
|
24524
|
+
if (_optionalChain([cell2, 'access', _314 => _314.blocks, 'optionalAccess', _315 => _315.length])) {
|
|
24502
24525
|
return cell2.blocks.map((b) => {
|
|
24503
24526
|
if (b.type === "table" && b.table) {
|
|
24504
24527
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -24537,7 +24560,7 @@ function replicateHtmlTable(table2) {
|
|
|
24537
24560
|
const rowCells = [];
|
|
24538
24561
|
for (let c = 0; c < numCols; c++) {
|
|
24539
24562
|
if (skip.has(`${r},${c}`)) continue;
|
|
24540
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24563
|
+
const cell2 = _optionalChain([cells, 'access', _316 => _316[r], 'optionalAccess', _317 => _317[c]]);
|
|
24541
24564
|
if (!cell2) continue;
|
|
24542
24565
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
24543
24566
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -24583,10 +24606,10 @@ function parseHtmlTable(raw) {
|
|
|
24583
24606
|
}
|
|
24584
24607
|
} else {
|
|
24585
24608
|
if (!isClose) {
|
|
24586
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
24587
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
24609
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _318 => _318.match, 'call', _319 => _319(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _320 => _320[1]]) || "1", 10);
|
|
24610
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _321 => _321.match, 'call', _322 => _322(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _323 => _323[1]]) || "1", 10);
|
|
24588
24611
|
cellStart = m.index + m[0].length;
|
|
24589
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24612
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkGGZ5PSJOcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkGGZ5PSJOcjs.MAX_ROWS) };
|
|
24590
24613
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24591
24614
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24592
24615
|
cellStart = -1;
|
|
@@ -24610,7 +24633,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
24610
24633
|
hadNonText = true;
|
|
24611
24634
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
24612
24635
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
24613
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
24636
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _324 => _324[1]]), () => ( _optionalChain([m, 'optionalAccess', _325 => _325[2]])));
|
|
24614
24637
|
if (src) imgSrcs.push(src);
|
|
24615
24638
|
return "";
|
|
24616
24639
|
});
|
|
@@ -24753,7 +24776,7 @@ function edgeXml(tag, d) {
|
|
|
24753
24776
|
return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
|
|
24754
24777
|
}
|
|
24755
24778
|
function borderFillDefToXml(id, def) {
|
|
24756
|
-
const fill = _optionalChain([def, 'access',
|
|
24779
|
+
const fill = _optionalChain([def, 'access', _326 => _326.fill, 'optionalAccess', _327 => _327.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
24757
24780
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
24758
24781
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
24759
24782
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -25069,7 +25092,7 @@ var ImageRegistry = (_class5 = class {
|
|
|
25069
25092
|
}
|
|
25070
25093
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
25071
25094
|
takeReal(url) {
|
|
25072
|
-
let bytes = _optionalChain([this, 'access',
|
|
25095
|
+
let bytes = _optionalChain([this, 'access', _328 => _328.supplied, 'optionalAccess', _329 => _329.get, 'call', _330 => _330(url)]);
|
|
25073
25096
|
if (!bytes && url.startsWith("data:")) {
|
|
25074
25097
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
25075
25098
|
if (m) {
|
|
@@ -25244,11 +25267,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
25244
25267
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
25245
25268
|
const rowCnt = rows.length;
|
|
25246
25269
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
25247
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25270
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _331 => _331.bfRegistry]), () => ( null));
|
|
25248
25271
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
25249
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25272
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _332 => _332.charHeight]), () => ( 1e3));
|
|
25250
25273
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
25251
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
25274
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _333 => _333[0], 'optionalAccess', _334 => _334[0]]), () => ( ""))), seq, rowAnchor);
|
|
25252
25275
|
const colMax = Array(colCnt).fill(0);
|
|
25253
25276
|
const colMaxBody = Array(colCnt).fill(0);
|
|
25254
25277
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -25276,7 +25299,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25276
25299
|
const k = `${rowIdx},${colIdx}`;
|
|
25277
25300
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
25278
25301
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
25279
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25302
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _335 => _335.cellChar, 'access', _336 => _336.get, 'call', _337 => _337(k)]), () => ( defaultCharPr));
|
|
25280
25303
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
25281
25304
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25282
25305
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -25294,11 +25317,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25294
25317
|
}
|
|
25295
25318
|
}
|
|
25296
25319
|
}
|
|
25297
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
25320
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _338 => _338.cellChar, 'access', _339 => _339.has, 'call', _340 => _340(k)]) ? void 0 : mapId);
|
|
25298
25321
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
25299
25322
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
25300
25323
|
}).join("");
|
|
25301
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25324
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _341 => _341.cellBf, 'access', _342 => _342.get, 'call', _343 => _343(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25302
25325
|
row: rowIdx,
|
|
25303
25326
|
rowEnd: rowIdx,
|
|
25304
25327
|
col: colIdx,
|
|
@@ -25308,7 +25331,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25308
25331
|
headerRows: 1,
|
|
25309
25332
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
25310
25333
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
25311
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25334
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _344 => _344.cellH, 'access', _345 => _345.get, 'call', _346 => _346(k)]), () => ( cellH));
|
|
25312
25335
|
return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
|
|
25313
25336
|
}).join("");
|
|
25314
25337
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -25317,7 +25340,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25317
25340
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
25318
25341
|
const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
|
|
25319
25342
|
const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
|
|
25320
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
25343
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _347 => _347.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
25321
25344
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
25322
25345
|
}
|
|
25323
25346
|
function layoutHtmlRows(rows) {
|
|
@@ -25328,8 +25351,8 @@ function layoutHtmlRows(rows) {
|
|
|
25328
25351
|
let c = 0;
|
|
25329
25352
|
for (const cell2 of rows[r].cells) {
|
|
25330
25353
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25331
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25332
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25354
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkGGZ5PSJOcjs.MAX_COLS);
|
|
25355
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkGGZ5PSJOcjs.MAX_ROWS);
|
|
25333
25356
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25334
25357
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25335
25358
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25357,7 +25380,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25357
25380
|
if (!rows || rows.length === 0) return null;
|
|
25358
25381
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
25359
25382
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
25360
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25383
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _348 => _348.charHeight]), () => ( 1e3));
|
|
25361
25384
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
25362
25385
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
25363
25386
|
for (const cell2 of placed) {
|
|
@@ -25386,7 +25409,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25386
25409
|
const tblId = nextTableId();
|
|
25387
25410
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
25388
25411
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
25389
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25412
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _349 => _349.bfRegistry]), () => ( null));
|
|
25390
25413
|
let htmlHeaderRows = 0;
|
|
25391
25414
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
25392
25415
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -25400,7 +25423,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25400
25423
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
25401
25424
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
25402
25425
|
if (nestedXml) {
|
|
25403
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
25426
|
+
const szH = _optionalChain([nestedXml, 'access', _350 => _350.match, 'call', _351 => _351(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _352 => _352[1]]);
|
|
25404
25427
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
25405
25428
|
}
|
|
25406
25429
|
return nestedXml;
|
|
@@ -25411,7 +25434,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25411
25434
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
25412
25435
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
25413
25436
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
25414
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25437
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _353 => _353.cellH, 'access', _354 => _354.get, 'call', _355 => _355(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
25415
25438
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
25416
25439
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
25417
25440
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -25422,7 +25445,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25422
25445
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
25423
25446
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
25424
25447
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
25425
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25448
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _356 => _356.cellChar, 'access', _357 => _357.get, 'call', _358 => _358(k)]), () => ( defaultCharPr));
|
|
25426
25449
|
const centered = isHeader || colCentered[cell2.c];
|
|
25427
25450
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25428
25451
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -25462,7 +25485,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25462
25485
|
let cellHeight = 0;
|
|
25463
25486
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
25464
25487
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
25465
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25488
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _359 => _359.cellBf, 'access', _360 => _360.get, 'call', _361 => _361(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25466
25489
|
row: cell2.r,
|
|
25467
25490
|
rowEnd,
|
|
25468
25491
|
col: cell2.c,
|
|
@@ -25632,7 +25655,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
25632
25655
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
25633
25656
|
}
|
|
25634
25657
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
25635
|
-
const c = _optionalChain([g, 'access',
|
|
25658
|
+
const c = _optionalChain([g, 'access', _362 => _362.press, 'optionalAccess', _363 => _363.contact]);
|
|
25636
25659
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
25637
25660
|
const w = bodyWidth - 280;
|
|
25638
25661
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -26011,10 +26034,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
26011
26034
|
m.header = gongmun.headerFooter;
|
|
26012
26035
|
m.footer = gongmun.headerFooter;
|
|
26013
26036
|
}
|
|
26014
|
-
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
26015
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
26016
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
26017
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
26037
|
+
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _364 => _364.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _365 => _365.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _366 => _366.heightHU]), () => ( A4_H_HU))}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
|
|
26038
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _367 => _367.columns]), () => ( 1)));
|
|
26039
|
+
const hf = (_optionalChain([page, 'optionalAccess', _368 => _368.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _369 => _369.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
26040
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _370 => _370.pageNumbers]) ? pageNumCtrl() : "");
|
|
26018
26041
|
}
|
|
26019
26042
|
var SectionOpener = (_class6 = class {
|
|
26020
26043
|
constructor(gongmun, page = null) {;_class6.prototype.__init13.call(this);
|
|
@@ -26054,19 +26077,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
26054
26077
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
26055
26078
|
const preamble = [];
|
|
26056
26079
|
let hasFrontPages = false;
|
|
26057
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26080
|
+
if (_optionalChain([gongmun, 'optionalAccess', _371 => _371.reportInfo]) && dfIds) {
|
|
26058
26081
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
26059
26082
|
}
|
|
26060
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26083
|
+
if (_optionalChain([gongmun, 'optionalAccess', _372 => _372.approval]) && bfReg) {
|
|
26061
26084
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
26062
26085
|
}
|
|
26063
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26086
|
+
if (_optionalChain([gongmun, 'optionalAccess', _373 => _373.docHead]) && dfIds) {
|
|
26064
26087
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
26065
26088
|
}
|
|
26066
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26089
|
+
if (_optionalChain([gongmun, 'optionalAccess', _374 => _374.noticeHead]) && dfIds) {
|
|
26067
26090
|
preamble.push(...buildNoticeHead(gongmun));
|
|
26068
26091
|
}
|
|
26069
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26092
|
+
if (_optionalChain([gongmun, 'optionalAccess', _375 => _375.press]) && dfIds && bfReg && tableStyle) {
|
|
26070
26093
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
26071
26094
|
}
|
|
26072
26095
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -26095,7 +26118,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
26095
26118
|
}
|
|
26096
26119
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
26097
26120
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
26098
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
26121
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _376 => _376.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
26099
26122
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
26100
26123
|
}
|
|
26101
26124
|
if (preamble.length > 0) {
|
|
@@ -26110,7 +26133,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
26110
26133
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
26111
26134
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
26112
26135
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
26113
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
26136
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _377 => _377.press, 'optionalAccess', _378 => _378.sub]), () => ( []))) {
|
|
26114
26137
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
26115
26138
|
}
|
|
26116
26139
|
return parts.join("\n ");
|
|
@@ -26204,8 +26227,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
26204
26227
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
26205
26228
|
if (gongmun && gongmunList) {
|
|
26206
26229
|
const info = gongmunList.items.get(blockIdx);
|
|
26207
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26208
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26230
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _379 => _379.depth]), () => ( 0));
|
|
26231
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _380 => _380.marker]), () => ( ""));
|
|
26209
26232
|
const content = block.text || "";
|
|
26210
26233
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
26211
26234
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -26214,7 +26237,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
26214
26237
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
26215
26238
|
}
|
|
26216
26239
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
26217
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
26240
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _381 => _381.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
26218
26241
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
26219
26242
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
26220
26243
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -26273,18 +26296,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
26273
26296
|
}
|
|
26274
26297
|
function appendPostamble(blocks, ctx) {
|
|
26275
26298
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
26276
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26299
|
+
if (_optionalChain([gongmun, 'optionalAccess', _382 => _382.noticeHead]) && dfIds) {
|
|
26277
26300
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
26278
26301
|
}
|
|
26279
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26280
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
26302
|
+
if (_optionalChain([gongmun, 'optionalAccess', _383 => _383.endMark]) && paraXmls.length > 0) {
|
|
26303
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _384 => _384.rows, 'optionalAccess', _385 => _385.length]));
|
|
26281
26304
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
26282
26305
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
26283
26306
|
}
|
|
26284
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26307
|
+
if (_optionalChain([gongmun, 'optionalAccess', _386 => _386.docFoot]) && dfIds) {
|
|
26285
26308
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
26286
26309
|
}
|
|
26287
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26310
|
+
if (_optionalChain([gongmun, 'optionalAccess', _387 => _387.press]) && dfIds && bfReg && tableStyle) {
|
|
26288
26311
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
26289
26312
|
}
|
|
26290
26313
|
}
|
|
@@ -26304,7 +26327,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26304
26327
|
remap,
|
|
26305
26328
|
dfIds,
|
|
26306
26329
|
images,
|
|
26307
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
26330
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _388 => _388.preset]) === "gaejosik",
|
|
26308
26331
|
measured,
|
|
26309
26332
|
richAssets,
|
|
26310
26333
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -26410,9 +26433,9 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26410
26433
|
|
|
26411
26434
|
// src/hwpx/generator.ts
|
|
26412
26435
|
async function markdownToHwpx(markdown, options) {
|
|
26413
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
26414
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
26415
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
26436
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _389 => _389.theme]));
|
|
26437
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _390 => _390.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
26438
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _391 => _391.page]));
|
|
26416
26439
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
26417
26440
|
beginInlineDoc(defs);
|
|
26418
26441
|
try {
|
|
@@ -26422,13 +26445,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26422
26445
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
26423
26446
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
26424
26447
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
26425
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
26426
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26448
|
+
const remap = _optionalChain([options, 'optionalAccess', _392 => _392.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _393 => _393.variants, 'optionalAccess', _394 => _394.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
26449
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _395 => _395.borderFillXmls, 'access', _396 => _396.length]), () => ( 0)))) : null;
|
|
26427
26450
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
26428
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26451
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _397 => _397.variants, 'optionalAccess', _398 => _398.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _399 => _399.charPrXmls, 'access', _400 => _400.length]), () => ( 0)));
|
|
26429
26452
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
26430
26453
|
const chartParts = [];
|
|
26431
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
26454
|
+
const supplied = _optionalChain([options, 'optionalAccess', _401 => _401.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
26432
26455
|
const images = new ImageRegistry(supplied);
|
|
26433
26456
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page);
|
|
26434
26457
|
if (remap && remap.tables.length > 0) {
|
|
@@ -26437,7 +26460,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26437
26460
|
console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
26438
26461
|
}
|
|
26439
26462
|
}
|
|
26440
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26463
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _402 => _402.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _403 => _403.emit, 'call', _404 => _404()]), () => ( []))];
|
|
26441
26464
|
const zip = new (0, _jszip2.default)();
|
|
26442
26465
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
26443
26466
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -26446,11 +26469,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26446
26469
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
26447
26470
|
theme,
|
|
26448
26471
|
gongmun,
|
|
26449
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26472
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _405 => _405.variants]), () => ( [])),
|
|
26450
26473
|
extraBorderFills,
|
|
26451
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26452
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
26453
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26474
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _406 => _406.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
26475
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _407 => _407.indentVariants]), () => ( [])),
|
|
26476
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _408 => _408.fontFaces]), () => ( []))
|
|
26454
26477
|
));
|
|
26455
26478
|
zip.file("Contents/section0.xml", sectionXml);
|
|
26456
26479
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -26504,7 +26527,7 @@ function alignBlocks(a, b) {
|
|
|
26504
26527
|
const m = a.length, n = b.length;
|
|
26505
26528
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
26506
26529
|
const lenOf = (blk) => {
|
|
26507
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26530
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _409 => _409.text]), () => ( ""))).join(" ") : "";
|
|
26508
26531
|
return t.replace(/\s+/g, " ").trim().length;
|
|
26509
26532
|
};
|
|
26510
26533
|
const aLen = a.map(lenOf);
|
|
@@ -26577,8 +26600,8 @@ function blockSimilarity(a, b) {
|
|
|
26577
26600
|
}
|
|
26578
26601
|
function tableSimilarity(a, b) {
|
|
26579
26602
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
26580
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26581
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26603
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _410 => _410.text]), () => ( ""))).join(" ");
|
|
26604
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _411 => _411.text]), () => ( ""))).join(" ");
|
|
26582
26605
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
26583
26606
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
26584
26607
|
}
|
|
@@ -26589,8 +26612,8 @@ function diffTableCells(a, b) {
|
|
|
26589
26612
|
for (let r = 0; r < maxRows; r++) {
|
|
26590
26613
|
const row = [];
|
|
26591
26614
|
for (let c = 0; c < maxCols; c++) {
|
|
26592
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
26593
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
26615
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _412 => _412.cells, 'access', _413 => _413[r], 'optionalAccess', _414 => _414[c], 'optionalAccess', _415 => _415.text]) : void 0;
|
|
26616
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _416 => _416.cells, 'access', _417 => _417[r], 'optionalAccess', _418 => _418[c], 'optionalAccess', _419 => _419.text]) : void 0;
|
|
26594
26617
|
let type;
|
|
26595
26618
|
if (cellA === void 0) type = "added";
|
|
26596
26619
|
else if (cellB === void 0) type = "removed";
|
|
@@ -26640,7 +26663,7 @@ function builtinTemplateDir() {
|
|
|
26640
26663
|
for (const c of candidates) {
|
|
26641
26664
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26642
26665
|
}
|
|
26643
|
-
throw new (0,
|
|
26666
|
+
throw new (0, _chunkJ7DBL77Bcjs.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)");
|
|
26644
26667
|
}
|
|
26645
26668
|
function readBuiltinTemplate(t) {
|
|
26646
26669
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -26803,7 +26826,7 @@ function parseRenderStyles(headXml) {
|
|
|
26803
26826
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
26804
26827
|
const textColor = el.getAttribute("textColor");
|
|
26805
26828
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
26806
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
26829
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _420 => _420.getAttribute, 'call', _421 => _421("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _422 => _422.getAttribute, 'call', _423 => _423("latin")])));
|
|
26807
26830
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
26808
26831
|
styles.charPr.set(id, {
|
|
26809
26832
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -26811,8 +26834,8 @@ function parseRenderStyles(headXml) {
|
|
|
26811
26834
|
italic: findChildByLocalName(el, "italic") != null,
|
|
26812
26835
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
26813
26836
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
26814
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
26815
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
26837
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _424 => _424.getAttribute, 'call', _425 => _425("hangul")])) || 100,
|
|
26838
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _426 => _426.getAttribute, 'call', _427 => _427("hangul")])) || 0,
|
|
26816
26839
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
26817
26840
|
face
|
|
26818
26841
|
});
|
|
@@ -26821,7 +26844,7 @@ function parseRenderStyles(headXml) {
|
|
|
26821
26844
|
const id = el.getAttribute("id");
|
|
26822
26845
|
if (id != null) {
|
|
26823
26846
|
const align = findChildByLocalName(el, "align");
|
|
26824
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
26847
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _428 => _428.getAttribute, 'call', _429 => _429("horizontal")]) || "JUSTIFY");
|
|
26825
26848
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
26826
26849
|
}
|
|
26827
26850
|
} else if (tag === "borderFill") {
|
|
@@ -26835,7 +26858,7 @@ function parseRenderStyles(headXml) {
|
|
|
26835
26858
|
};
|
|
26836
26859
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
26837
26860
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26838
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26861
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _430 => _430.getAttribute, 'call', _431 => _431("faceColor")]);
|
|
26839
26862
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
26840
26863
|
styles.borderFill.set(id, bf);
|
|
26841
26864
|
}
|
|
@@ -26907,7 +26930,7 @@ function collectSites(scan) {
|
|
|
26907
26930
|
}
|
|
26908
26931
|
function attrOf3(openTag, name) {
|
|
26909
26932
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
26910
|
-
return _optionalChain([m, 'optionalAccess',
|
|
26933
|
+
return _optionalChain([m, 'optionalAccess', _432 => _432[1]]);
|
|
26911
26934
|
}
|
|
26912
26935
|
function paraOpenTag(xml, para2) {
|
|
26913
26936
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -26922,7 +26945,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
26922
26945
|
if (!tr) return null;
|
|
26923
26946
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
26924
26947
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
26925
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
26948
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _433 => _433[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
26926
26949
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
26927
26950
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
26928
26951
|
if (close === -1) return null;
|
|
@@ -26949,7 +26972,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
26949
26972
|
if (width === null) return null;
|
|
26950
26973
|
let content = width;
|
|
26951
26974
|
const win = cellAddrWindow(xml, cell2);
|
|
26952
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
26975
|
+
const mg = _optionalChain([win, 'optionalAccess', _434 => _434.match, 'call', _435 => _435(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
26953
26976
|
if (mg) {
|
|
26954
26977
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
26955
26978
|
}
|
|
@@ -26983,12 +27006,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
26983
27006
|
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>`;
|
|
26984
27007
|
}
|
|
26985
27008
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
26986
|
-
if (ops.length === 0) throw new (0,
|
|
27009
|
+
if (ops.length === 0) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26987
27010
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
26988
|
-
|
|
27011
|
+
_chunkJ7DBL77Bcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
26989
27012
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
26990
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26991
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
27013
|
+
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, _chunkJ7DBL77Bcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26992
27015
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
26993
27016
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
26994
27017
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -27029,11 +27052,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27029
27052
|
const manifestItems = [];
|
|
27030
27053
|
const placed = [];
|
|
27031
27054
|
for (const op of ops) {
|
|
27032
|
-
if (!op.anchor) throw new (0,
|
|
27033
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27055
|
+
if (!op.anchor) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27056
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27034
27057
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
27035
|
-
if (!MIME[ext]) throw new (0,
|
|
27036
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27058
|
+
if (!MIME[ext]) throw new (0, _chunkJ7DBL77Bcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27059
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkJ7DBL77Bcjs.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)`);
|
|
27037
27060
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
27038
27061
|
let found = null;
|
|
27039
27062
|
let total = 0;
|
|
@@ -27066,7 +27089,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27066
27089
|
}
|
|
27067
27090
|
}
|
|
27068
27091
|
}
|
|
27069
|
-
throw new (0,
|
|
27092
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(
|
|
27070
27093
|
`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)})`
|
|
27071
27094
|
);
|
|
27072
27095
|
}
|
|
@@ -27074,9 +27097,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27074
27097
|
const xml = sectionXmls[si];
|
|
27075
27098
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
27076
27099
|
if (!run) {
|
|
27077
|
-
throw new (0,
|
|
27100
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
27078
27101
|
}
|
|
27079
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
27102
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _442 => _442.charPr, 'access', _443 => _443.get, 'call', _444 => _444(run.charPr), 'optionalAccess', _445 => _445.height]), () => ( 1e3));
|
|
27080
27103
|
const fontPt = charPrHeight / 100;
|
|
27081
27104
|
const emMm = fontPt * 25.4 / 72;
|
|
27082
27105
|
const lineHMm = emMm;
|
|
@@ -27085,7 +27108,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27085
27108
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
27086
27109
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
27087
27110
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
27088
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
27111
|
+
const align = _optionalChain([styles, 'optionalAccess', _446 => _446.paraAlign, 'access', _447 => _447.get, 'call', _448 => _448(paraPrId)]);
|
|
27089
27112
|
let alignShiftMm = 0;
|
|
27090
27113
|
if (align === "CENTER" || align === "RIGHT") {
|
|
27091
27114
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -27181,7 +27204,7 @@ function parseBorderFills(headerDoc) {
|
|
|
27181
27204
|
};
|
|
27182
27205
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
27183
27206
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
27184
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
27207
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _449 => _449.getAttribute, 'call', _450 => _450("faceColor")]);
|
|
27185
27208
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
27186
27209
|
map.set(id, def);
|
|
27187
27210
|
}
|
|
@@ -27213,7 +27236,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
27213
27236
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
27214
27237
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
27215
27238
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
27216
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
27239
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _451 => _451.getAttribute, 'call', _452 => _452("hangul")]);
|
|
27217
27240
|
if (hangul) {
|
|
27218
27241
|
def.fontRef_hangul = hangul;
|
|
27219
27242
|
const face = hangulFonts.get(hangul);
|
|
@@ -27241,7 +27264,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
27241
27264
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
27242
27265
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
27243
27266
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
27244
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
27267
|
+
const width = _optionalChain([sz, 'optionalAccess', _453 => _453.getAttribute, 'call', _454 => _454("width")]) || void 0;
|
|
27245
27268
|
const cells = [];
|
|
27246
27269
|
const usedBf = /* @__PURE__ */ new Set();
|
|
27247
27270
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -27254,17 +27277,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
27254
27277
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
27255
27278
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
27256
27279
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
27257
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27258
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27280
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _455 => _455.getAttribute, 'call', _456 => _456("rowAddr")])), () => ( 0));
|
|
27281
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _457 => _457.getAttribute, 'call', _458 => _458("colAddr")])), () => ( 0));
|
|
27259
27282
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
27260
27283
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
27261
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27262
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27284
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _459 => _459.getAttribute, 'call', _460 => _460("colSpan")])), () => ( 1));
|
|
27285
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _461 => _461.getAttribute, 'call', _462 => _462("rowSpan")])), () => ( 1));
|
|
27263
27286
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
27264
27287
|
const cpId = firstRunCharPr(tc2);
|
|
27265
27288
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
27266
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
27267
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
27289
|
+
const w = _optionalChain([csz, 'optionalAccess', _463 => _463.getAttribute, 'call', _464 => _464("width")]);
|
|
27290
|
+
const hh = _optionalChain([csz, 'optionalAccess', _465 => _465.getAttribute, 'call', _466 => _466("height")]);
|
|
27268
27291
|
if (w) cell2.width_hwpunit = w;
|
|
27269
27292
|
if (hh) cell2.height_hwpunit = hh;
|
|
27270
27293
|
if (bfId) {
|
|
@@ -27352,16 +27375,16 @@ function pick(map, keys) {
|
|
|
27352
27375
|
return out;
|
|
27353
27376
|
}
|
|
27354
27377
|
async function hwpxToProfile(input) {
|
|
27355
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27378
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkJ7DBL77Bcjs.toArrayBuffer.call(void 0, input);
|
|
27356
27379
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27357
27380
|
const parser = createXmlParser();
|
|
27358
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
27381
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _467 => _467.file, 'call', _468 => _468(/[Hh]eader\.xml$/), 'optionalAccess', _469 => _469[0]])));
|
|
27359
27382
|
let headerXml = "<root/>";
|
|
27360
27383
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
27361
27384
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
27362
27385
|
const borderFills = parseBorderFills(headerDoc);
|
|
27363
27386
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
27364
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27387
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _470 => _470.name, 'access', _471 => _471.match, 'call', _472 => _472(/(\d+)\.xml$/), 'optionalAccess', _473 => _473[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _474 => _474.name, 'access', _475 => _475.match, 'call', _476 => _476(/(\d+)\.xml$/), 'optionalAccess', _477 => _477[1]]), () => ( null))), () => ( 0))));
|
|
27365
27388
|
const tables = [];
|
|
27366
27389
|
let tableIndex = 0;
|
|
27367
27390
|
for (const f of sectionFiles) {
|
|
@@ -27675,7 +27698,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
27675
27698
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
27676
27699
|
function patchTableRows(input) {
|
|
27677
27700
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
27678
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27701
|
+
const xml = _optionalChain([ctx, 'access', _478 => _478.scans, 'access', _479 => _479[scanTable.sectionIndex], 'optionalAccess', _480 => _480.xml]);
|
|
27679
27702
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
27680
27703
|
const numRows = table2.rows;
|
|
27681
27704
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -27842,7 +27865,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
27842
27865
|
const rr = scanTable.rowRanges[template];
|
|
27843
27866
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
27844
27867
|
const scan = scanSectionXml(wrapped, 0);
|
|
27845
|
-
const row = _optionalChain([scan, 'access',
|
|
27868
|
+
const row = _optionalChain([scan, 'access', _481 => _481.tables, 'access', _482 => _482[0], 'optionalAccess', _483 => _483.rows, 'access', _484 => _484[0]]);
|
|
27846
27869
|
if (!row || row.length !== cells.length) return null;
|
|
27847
27870
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
27848
27871
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -27885,7 +27908,7 @@ function rowHeightOf(fragment) {
|
|
|
27885
27908
|
}
|
|
27886
27909
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
27887
27910
|
const from = scanTable.start + tblOpenLen;
|
|
27888
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
27911
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _485 => _485.rowRanges, 'access', _486 => _486[0], 'optionalAccess', _487 => _487.start]), () => ( from));
|
|
27889
27912
|
const slice = xml.slice(from, to);
|
|
27890
27913
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
27891
27914
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -28074,9 +28097,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
28074
28097
|
});
|
|
28075
28098
|
}
|
|
28076
28099
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
28077
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28100
|
+
const irCell = _optionalChain([table2, 'access', _488 => _488.cells, 'access', _489 => _489[oc.gridR], 'optionalAccess', _490 => _490[oc.gridC]]);
|
|
28078
28101
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
28079
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
28102
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _491 => _491.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
28080
28103
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
28081
28104
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
28082
28105
|
}
|
|
@@ -28144,7 +28167,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
28144
28167
|
};
|
|
28145
28168
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
28146
28169
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
28147
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28170
|
+
const irCell = _optionalChain([table2, 'access', _492 => _492.cells, 'access', _493 => _493[gridR], 'optionalAccess', _494 => _494[gridC]]);
|
|
28148
28171
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
28149
28172
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
28150
28173
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -28168,7 +28191,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
28168
28191
|
const target = cell2.paragraphs[0];
|
|
28169
28192
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
28170
28193
|
const value = newLines.join(" ");
|
|
28171
|
-
const xml = _optionalChain([ctx, 'access',
|
|
28194
|
+
const xml = _optionalChain([ctx, 'access', _495 => _495.scans, 'access', _496 => _496[target.sectionIndex], 'optionalAccess', _497 => _497.xml]);
|
|
28172
28195
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
28173
28196
|
let sp;
|
|
28174
28197
|
if (xml && rawT === null) {
|
|
@@ -28202,7 +28225,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
28202
28225
|
}
|
|
28203
28226
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
28204
28227
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
28205
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
28228
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _498 => _498.scans, 'access', _499 => _499[nonEmpty[i].sectionIndex], 'optionalAccess', _500 => _500.xml]));
|
|
28206
28229
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
28207
28230
|
splices.push(...sp);
|
|
28208
28231
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -28283,7 +28306,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
28283
28306
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
28284
28307
|
if (paths.length > 0) return paths;
|
|
28285
28308
|
}
|
|
28286
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
28309
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkJ7DBL77Bcjs.compareSectionPaths);
|
|
28287
28310
|
}
|
|
28288
28311
|
function sectionPathsFromManifest(xml) {
|
|
28289
28312
|
const attr = (tag, name) => {
|
|
@@ -28293,7 +28316,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28293
28316
|
const idToHref = /* @__PURE__ */ new Map();
|
|
28294
28317
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
28295
28318
|
const id = attr(m[1], "id");
|
|
28296
|
-
const href =
|
|
28319
|
+
const href = _chunkJ7DBL77Bcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
28297
28320
|
if (id && href) idToHref.set(id, href);
|
|
28298
28321
|
}
|
|
28299
28322
|
const ordered = [];
|
|
@@ -28302,7 +28325,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
28302
28325
|
if (href) ordered.push(href);
|
|
28303
28326
|
}
|
|
28304
28327
|
if (ordered.length > 0) return ordered;
|
|
28305
|
-
return Array.from(idToHref.values()).sort(
|
|
28328
|
+
return Array.from(idToHref.values()).sort(_chunkJ7DBL77Bcjs.compareSectionPaths);
|
|
28306
28329
|
}
|
|
28307
28330
|
|
|
28308
28331
|
// src/roundtrip/patcher.ts
|
|
@@ -28394,7 +28417,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
28394
28417
|
}
|
|
28395
28418
|
}
|
|
28396
28419
|
let verification;
|
|
28397
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28420
|
+
if (_optionalChain([options, 'optionalAccess', _501 => _501.verify]) !== false) {
|
|
28398
28421
|
try {
|
|
28399
28422
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
28400
28423
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -28412,17 +28435,17 @@ function buildOrigUnits(blocks) {
|
|
|
28412
28435
|
let chunk;
|
|
28413
28436
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28414
28437
|
const next = blocks[i + 1];
|
|
28415
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
28416
|
-
chunk =
|
|
28438
|
+
if (_optionalChain([next, 'optionalAccess', _502 => _502.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28439
|
+
chunk = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28417
28440
|
} else {
|
|
28418
|
-
chunk =
|
|
28441
|
+
chunk = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28419
28442
|
}
|
|
28420
28443
|
if (chunk) {
|
|
28421
28444
|
const subUnits = splitMarkdownUnits(chunk);
|
|
28422
28445
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
28423
28446
|
for (let s = 0; s < subUnits.length; s++) {
|
|
28424
28447
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
28425
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
28448
|
+
if (block.type === "table" && _optionalChain([block, 'access', _503 => _503.table, 'optionalAccess', _504 => _504.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
28426
28449
|
u.role = "caption";
|
|
28427
28450
|
}
|
|
28428
28451
|
units.push(u);
|
|
@@ -28533,7 +28556,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28533
28556
|
const ti = ctx.tableInsert;
|
|
28534
28557
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
28535
28558
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28536
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28559
|
+
if (!_optionalChain([mapping, 'optionalAccess', _505 => _505.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
|
|
28537
28560
|
const para2 = mapping.para;
|
|
28538
28561
|
if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
|
|
28539
28562
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -28561,7 +28584,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28561
28584
|
}
|
|
28562
28585
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
28563
28586
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28564
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28587
|
+
if (!_optionalChain([mapping, 'optionalAccess', _506 => _506.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
28565
28588
|
if (block.text && block.text.includes("\n")) {
|
|
28566
28589
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
28567
28590
|
}
|
|
@@ -28592,7 +28615,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
28592
28615
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
28593
28616
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
28594
28617
|
}
|
|
28595
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
28618
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _507 => _507.scans, 'access', _508 => _508[mapping.para.sectionIndex], 'optionalAccess', _509 => _509.xml]));
|
|
28596
28619
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
28597
28620
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
28598
28621
|
return 1;
|
|
@@ -28784,7 +28807,7 @@ var Surgeon = (_class7 = class {
|
|
|
28784
28807
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
28785
28808
|
findEntry(path) {
|
|
28786
28809
|
const parts = path.replace(/^\//, "").split("/");
|
|
28787
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
28810
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _510 => _510.entries, 'access', _511 => _511[0], 'optionalAccess', _512 => _512.child]), () => ( -1));
|
|
28788
28811
|
let current;
|
|
28789
28812
|
for (const part of parts) {
|
|
28790
28813
|
const search = (idx) => {
|
|
@@ -29037,8 +29060,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
29037
29060
|
parts.push(header, data);
|
|
29038
29061
|
};
|
|
29039
29062
|
for (let i = 0; i < recs.length; i++) {
|
|
29040
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
29041
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
29063
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _513 => _513.get, 'call', _514 => _514(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
29064
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _515 => _515.get, 'call', _516 => _516(i)]), () => ( recs[i].data)));
|
|
29042
29065
|
}
|
|
29043
29066
|
return Buffer.concat(parts);
|
|
29044
29067
|
}
|
|
@@ -29156,7 +29179,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29156
29179
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
29157
29180
|
}
|
|
29158
29181
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
29159
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
29182
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _517 => _517.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
29160
29183
|
let flags;
|
|
29161
29184
|
try {
|
|
29162
29185
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -29178,7 +29201,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29178
29201
|
const scans = [];
|
|
29179
29202
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
29180
29203
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
29181
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
29204
|
+
if (!_optionalChain([entry, 'optionalAccess', _518 => _518.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
29182
29205
|
let stream;
|
|
29183
29206
|
try {
|
|
29184
29207
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -29229,7 +29252,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29229
29252
|
}
|
|
29230
29253
|
}
|
|
29231
29254
|
let verification;
|
|
29232
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29255
|
+
if (_optionalChain([options, 'optionalAccess', _519 => _519.verify]) !== false) {
|
|
29233
29256
|
try {
|
|
29234
29257
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
29235
29258
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -29319,7 +29342,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
29319
29342
|
for (const [key, scanCell] of scanTable.cells) {
|
|
29320
29343
|
const comma = key.indexOf(",");
|
|
29321
29344
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
29322
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
29345
|
+
const irCell = _optionalChain([irTable, 'access', _520 => _520.cells, 'access', _521 => _521[r], 'optionalAccess', _522 => _522[c]]);
|
|
29323
29346
|
if (!irCell) continue;
|
|
29324
29347
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
29325
29348
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -29355,7 +29378,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
29355
29378
|
}
|
|
29356
29379
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
29357
29380
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29358
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29381
|
+
if (!_optionalChain([mapping, 'optionalAccess', _523 => _523.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
29359
29382
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
29360
29383
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
29361
29384
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -29554,7 +29577,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
29554
29577
|
};
|
|
29555
29578
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
29556
29579
|
if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
|
|
29557
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29580
|
+
const irCell = _optionalChain([table2, 'access', _524 => _524.cells, 'access', _525 => _525[gridR], 'optionalAccess', _526 => _526[gridC]]);
|
|
29558
29581
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
29559
29582
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
29560
29583
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -29961,11 +29984,11 @@ var RULES2 = {
|
|
|
29961
29984
|
}
|
|
29962
29985
|
};
|
|
29963
29986
|
function redactText(text, options) {
|
|
29964
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29987
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _527 => _527.maskChar]), () => ( "\u25CF"));
|
|
29965
29988
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
29966
29989
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
29967
29990
|
}
|
|
29968
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29991
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _528 => _528.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
29969
29992
|
const hits = [];
|
|
29970
29993
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
29971
29994
|
const occupied = [];
|
|
@@ -30020,8 +30043,8 @@ function sameBreadcrumb(a, b) {
|
|
|
30020
30043
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
30021
30044
|
}
|
|
30022
30045
|
function blocksToChunks(blocks, options) {
|
|
30023
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30024
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30046
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _529 => _529.granularity]), () => ( "section"));
|
|
30047
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _530 => _530.includeTableCells]), () => ( false));
|
|
30025
30048
|
const chunks = [];
|
|
30026
30049
|
const headingStack = [];
|
|
30027
30050
|
const listStack = [];
|
|
@@ -30035,12 +30058,12 @@ function blocksToChunks(blocks, options) {
|
|
|
30035
30058
|
let run = null;
|
|
30036
30059
|
const flushRun = () => {
|
|
30037
30060
|
if (!run) return;
|
|
30038
|
-
push("text", run.breadcrumb,
|
|
30061
|
+
push("text", run.breadcrumb, _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
30039
30062
|
run = null;
|
|
30040
30063
|
};
|
|
30041
30064
|
for (let i = 0; i < blocks.length; i++) {
|
|
30042
30065
|
const block = blocks[i];
|
|
30043
|
-
const md2 =
|
|
30066
|
+
const md2 = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, [block]);
|
|
30044
30067
|
if (!md2) continue;
|
|
30045
30068
|
if (block.type === "heading") {
|
|
30046
30069
|
flushRun();
|
|
@@ -30156,7 +30179,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30156
30179
|
const block = st.blocks[blockIndex];
|
|
30157
30180
|
if (!block) return void 0;
|
|
30158
30181
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
30159
|
-
const para2 = _optionalChain([st, 'access',
|
|
30182
|
+
const para2 = _optionalChain([st, 'access', _531 => _531.paraMap, 'access', _532 => _532.get, 'call', _533 => _533(blockIndex), 'optionalAccess', _534 => _534.para]);
|
|
30160
30183
|
if (!para2) return void 0;
|
|
30161
30184
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
30162
30185
|
}
|
|
@@ -30181,7 +30204,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30181
30204
|
if (block.text && block.text.includes("\n")) {
|
|
30182
30205
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
|
|
30183
30206
|
}
|
|
30184
|
-
if (!_optionalChain([st, 'access',
|
|
30207
|
+
if (!_optionalChain([st, 'access', _535 => _535.paraMap, 'access', _536 => _536.get, 'call', _537 => _537(blockIndex), 'optionalAccess', _538 => _538.para])) {
|
|
30185
30208
|
return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
|
|
30186
30209
|
}
|
|
30187
30210
|
return { capability: "text" };
|
|
@@ -30247,7 +30270,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30247
30270
|
continue;
|
|
30248
30271
|
}
|
|
30249
30272
|
if (block.type === "table" && block.table) {
|
|
30250
|
-
if (!_optionalChain([edit, 'access',
|
|
30273
|
+
if (!_optionalChain([edit, 'access', _539 => _539.cells, 'optionalAccess', _540 => _540.length])) {
|
|
30251
30274
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
30252
30275
|
continue;
|
|
30253
30276
|
}
|
|
@@ -30267,7 +30290,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30267
30290
|
skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
|
|
30268
30291
|
continue;
|
|
30269
30292
|
}
|
|
30270
|
-
const irCell = _optionalChain([block, 'access',
|
|
30293
|
+
const irCell = _optionalChain([block, 'access', _541 => _541.table, 'access', _542 => _542.cells, 'access', _543 => _543[cellEdit.row], 'optionalAccess', _544 => _544[cellEdit.col]]);
|
|
30271
30294
|
if (!irCell) {
|
|
30272
30295
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
30273
30296
|
continue;
|
|
@@ -30323,7 +30346,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30323
30346
|
}
|
|
30324
30347
|
if (replacements.size === 0) {
|
|
30325
30348
|
let changes2;
|
|
30326
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30349
|
+
if (_optionalChain([options, 'optionalAccess', _545 => _545.verify]) !== false) {
|
|
30327
30350
|
const units = splitMarkdownUnits(st.markdown);
|
|
30328
30351
|
changes2 = diffUnitLists(units, units);
|
|
30329
30352
|
}
|
|
@@ -30344,7 +30367,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30344
30367
|
}
|
|
30345
30368
|
this.state = newState;
|
|
30346
30369
|
let changes;
|
|
30347
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30370
|
+
if (_optionalChain([options, 'optionalAccess', _546 => _546.verify]) !== false) {
|
|
30348
30371
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
30349
30372
|
}
|
|
30350
30373
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -30364,7 +30387,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30364
30387
|
return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
|
|
30365
30388
|
}
|
|
30366
30389
|
const mapping = st.paraMap.get(blockIndex);
|
|
30367
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
30390
|
+
if (!_optionalChain([mapping, 'optionalAccess', _547 => _547.para])) {
|
|
30368
30391
|
return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
|
|
30369
30392
|
}
|
|
30370
30393
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -30384,14 +30407,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30384
30407
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
30385
30408
|
return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
|
|
30386
30409
|
}
|
|
30387
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
30410
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _548 => _548.scans, 'access', _549 => _549[mapping.para.sectionIndex], 'optionalAccess', _550 => _550.xml]));
|
|
30388
30411
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
30389
30412
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
30390
30413
|
return 1;
|
|
30391
30414
|
}
|
|
30392
30415
|
}, _class8);
|
|
30393
30416
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
30394
|
-
const irCell = _optionalChain([table2, 'access',
|
|
30417
|
+
const irCell = _optionalChain([table2, 'access', _551 => _551.cells, 'access', _552 => _552[r], 'optionalAccess', _553 => _553[c]]);
|
|
30395
30418
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
30396
30419
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
30397
30420
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -30475,11 +30498,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
30475
30498
|
breaks: false
|
|
30476
30499
|
});
|
|
30477
30500
|
function renderHtml(markdown, options) {
|
|
30478
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30479
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30501
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _554 => _554.preset]), () => ( "default"));
|
|
30502
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _555 => _555.extraCss]), () => ( "")));
|
|
30480
30503
|
const body = md.render(markdown);
|
|
30481
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
30482
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
30504
|
+
const watermark = _optionalChain([options, 'optionalAccess', _556 => _556.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
30505
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _557 => _557.watermark]) ? `
|
|
30483
30506
|
.watermark {
|
|
30484
30507
|
position: fixed;
|
|
30485
30508
|
top: 50%; left: 50%;
|
|
@@ -30510,13 +30533,13 @@ async function htmlToPdf(html, options) {
|
|
|
30510
30533
|
try {
|
|
30511
30534
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30512
30535
|
} catch (e37) {
|
|
30513
|
-
throw new (0,
|
|
30536
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(
|
|
30514
30537
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30515
30538
|
);
|
|
30516
30539
|
}
|
|
30517
30540
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30518
30541
|
if (!executablePath) {
|
|
30519
|
-
throw new (0,
|
|
30542
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)(
|
|
30520
30543
|
"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."
|
|
30521
30544
|
);
|
|
30522
30545
|
}
|
|
@@ -30528,10 +30551,10 @@ async function htmlToPdf(html, options) {
|
|
|
30528
30551
|
try {
|
|
30529
30552
|
const page = await browser.newPage();
|
|
30530
30553
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
30531
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
30554
|
+
const margin = _optionalChain([options, 'optionalAccess', _558 => _558.margin]);
|
|
30532
30555
|
const pdf = await page.pdf({
|
|
30533
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30534
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
30556
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _559 => _559.pageSize]), () => ( "A4")),
|
|
30557
|
+
landscape: _optionalChain([options, 'optionalAccess', _560 => _560.orientation]) === "landscape",
|
|
30535
30558
|
printBackground: true,
|
|
30536
30559
|
margin: margin ? {
|
|
30537
30560
|
top: toCss(margin.top),
|
|
@@ -30539,9 +30562,9 @@ async function htmlToPdf(html, options) {
|
|
|
30539
30562
|
bottom: toCss(margin.bottom),
|
|
30540
30563
|
left: toCss(margin.left)
|
|
30541
30564
|
} : void 0,
|
|
30542
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
30543
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30544
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30565
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _561 => _561.header]) || _optionalChain([options, 'optionalAccess', _562 => _562.footer])),
|
|
30566
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _563 => _563.header]), () => ( "<div></div>")),
|
|
30567
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _564 => _564.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
30545
30568
|
});
|
|
30546
30569
|
return Buffer.from(pdf);
|
|
30547
30570
|
} finally {
|
|
@@ -30575,7 +30598,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30575
30598
|
return htmlToPdf(html, options);
|
|
30576
30599
|
}
|
|
30577
30600
|
async function blocksToPdf(blocks, options) {
|
|
30578
|
-
const markdown =
|
|
30601
|
+
const markdown = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30579
30602
|
return markdownToPdf(markdown, options);
|
|
30580
30603
|
}
|
|
30581
30604
|
|
|
@@ -30754,7 +30777,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
30754
30777
|
}
|
|
30755
30778
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
30756
30779
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
30757
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30780
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _565 => _565.getAttribute, 'call', _566 => _566("vertRelTo")]), () => ( "PARA"));
|
|
30758
30781
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
30759
30782
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
30760
30783
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -30815,7 +30838,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30815
30838
|
if (ln(p) !== "p") continue;
|
|
30816
30839
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
30817
30840
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
30818
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30841
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _567 => _567.spaceBefore]), () => ( 0)));
|
|
30819
30842
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
30820
30843
|
if (!res) {
|
|
30821
30844
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -30828,7 +30851,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30828
30851
|
}
|
|
30829
30852
|
if (Number.isFinite(bottom)) {
|
|
30830
30853
|
cursorV = bottom;
|
|
30831
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30854
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _568 => _568.spaceAfter]), () => ( 0));
|
|
30832
30855
|
}
|
|
30833
30856
|
}
|
|
30834
30857
|
continue;
|
|
@@ -30934,7 +30957,7 @@ function buildPara(p) {
|
|
|
30934
30957
|
const pos = findChildByLocalName(ch, "pos");
|
|
30935
30958
|
const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
|
|
30936
30959
|
const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
|
|
30937
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
30960
|
+
const inline = _optionalChain([pos, 'optionalAccess', _569 => _569.getAttribute, 'call', _570 => _570("treatAsChar")]) === "1";
|
|
30938
30961
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
30939
30962
|
objs.push({
|
|
30940
30963
|
el: ch,
|
|
@@ -31194,15 +31217,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
31194
31217
|
const sx = ow > 0 ? w / ow : 1;
|
|
31195
31218
|
const sy = oh > 0 ? h / oh : 1;
|
|
31196
31219
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
31197
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
31198
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
31220
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _571 => _571.getAttribute, 'call', _572 => _572("style")]), () => ( "SOLID"));
|
|
31221
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _573 => _573.getAttribute, 'call', _574 => _574("color")]) || "#000000";
|
|
31199
31222
|
const hasStroke = lstyle !== "NONE";
|
|
31200
31223
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
31201
31224
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
31202
31225
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
31203
31226
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
31204
31227
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
31205
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
31228
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _575 => _575.getAttribute, 'call', _576 => _576("faceColor")]);
|
|
31206
31229
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
31207
31230
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
31208
31231
|
if (o.tag === "rect") {
|
|
@@ -31229,14 +31252,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
31229
31252
|
}
|
|
31230
31253
|
function cellContentExtent(cell2, memo) {
|
|
31231
31254
|
if (!cell2.sub) return 0;
|
|
31232
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31255
|
+
const hit = _optionalChain([memo, 'optionalAccess', _577 => _577.cell, 'access', _578 => _578.get, 'call', _579 => _579(cell2.el)]);
|
|
31233
31256
|
if (hit !== void 0) return hit;
|
|
31234
31257
|
let ext = 0;
|
|
31235
31258
|
for (const p of elements2(cell2.sub)) {
|
|
31236
31259
|
if (ln2(p) !== "p") continue;
|
|
31237
31260
|
const m = buildPara(p);
|
|
31238
31261
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
31239
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
31262
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _580 => _580.segs, 'access', _581 => _581[0], 'optionalAccess', _582 => _582.vertpos]), () => ( 0));
|
|
31240
31263
|
for (const o of m.objs) {
|
|
31241
31264
|
if (o.inline) {
|
|
31242
31265
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -31244,14 +31267,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
31244
31267
|
continue;
|
|
31245
31268
|
}
|
|
31246
31269
|
const pos = findChildByLocalName(o.el, "pos");
|
|
31247
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
31270
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _583 => _583.getAttribute, 'call', _584 => _584("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
31248
31271
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
31249
31272
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
31250
31273
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
31251
31274
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
31252
31275
|
}
|
|
31253
31276
|
}
|
|
31254
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31277
|
+
_optionalChain([memo, 'optionalAccess', _585 => _585.cell, 'access', _586 => _586.set, 'call', _587 => _587(cell2.el, ext)]);
|
|
31255
31278
|
return ext;
|
|
31256
31279
|
}
|
|
31257
31280
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -31293,7 +31316,7 @@ function collectCells(tbl2) {
|
|
|
31293
31316
|
return cells;
|
|
31294
31317
|
}
|
|
31295
31318
|
function measureTableHeight(tbl2, memo) {
|
|
31296
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31319
|
+
const hit = _optionalChain([memo, 'optionalAccess', _588 => _588.table, 'access', _589 => _589.get, 'call', _590 => _590(tbl2)]);
|
|
31297
31320
|
if (hit !== void 0) return hit;
|
|
31298
31321
|
const cells = collectCells(tbl2);
|
|
31299
31322
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -31304,7 +31327,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
31304
31327
|
);
|
|
31305
31328
|
let sum = 0;
|
|
31306
31329
|
for (const h of rowH) sum += h;
|
|
31307
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31330
|
+
_optionalChain([memo, 'optionalAccess', _591 => _591.table, 'access', _592 => _592.set, 'call', _593 => _593(tbl2, sum)]);
|
|
31308
31331
|
return sum;
|
|
31309
31332
|
}
|
|
31310
31333
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -31335,7 +31358,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
31335
31358
|
}));
|
|
31336
31359
|
for (const g of geom) {
|
|
31337
31360
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
31338
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
31361
|
+
if (_optionalChain([bf, 'optionalAccess', _594 => _594.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
31339
31362
|
}
|
|
31340
31363
|
for (const g of geom) {
|
|
31341
31364
|
const { c } = g;
|
|
@@ -31373,7 +31396,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
31373
31396
|
const sz = findChildByLocalName(pic, "sz");
|
|
31374
31397
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
31375
31398
|
const img = findFirst(pic, "img");
|
|
31376
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
31399
|
+
const ref = _optionalChain([img, 'optionalAccess', _595 => _595.getAttribute, 'call', _596 => _596("binaryItemIDRef")]);
|
|
31377
31400
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
31378
31401
|
if (!loaded) {
|
|
31379
31402
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -31413,7 +31436,7 @@ function readSectionGeom(root) {
|
|
|
31413
31436
|
const pagePr = findFirst(root, "pagePr");
|
|
31414
31437
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
31415
31438
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
31416
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
31439
|
+
if (_optionalChain([pagePr, 'optionalAccess', _597 => _597.getAttribute, 'call', _598 => _598("landscape")]) === "NARROWLY" && PW < PH) {
|
|
31417
31440
|
const t = PW;
|
|
31418
31441
|
PW = PH;
|
|
31419
31442
|
PH = t;
|
|
@@ -31471,17 +31494,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31471
31494
|
return { pages: ctx.pages, pageH };
|
|
31472
31495
|
}
|
|
31473
31496
|
async function renderHwpxToSvg(input, options) {
|
|
31474
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31497
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _599 => _599.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31475
31498
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31476
|
-
|
|
31499
|
+
_chunkJ7DBL77Bcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31477
31500
|
let zip;
|
|
31478
31501
|
try {
|
|
31479
31502
|
zip = await _jszip2.default.loadAsync(input);
|
|
31480
31503
|
} catch (e38) {
|
|
31481
|
-
throw new (0,
|
|
31504
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31482
31505
|
}
|
|
31483
31506
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31484
|
-
if (secFiles.length === 0) throw new (0,
|
|
31507
|
+
if (secFiles.length === 0) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31485
31508
|
const warnings = [];
|
|
31486
31509
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31487
31510
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31489,7 +31512,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31489
31512
|
const secXmls = [];
|
|
31490
31513
|
for (const f of secFiles) {
|
|
31491
31514
|
const xml = await f.async("string");
|
|
31492
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31515
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJ7DBL77Bcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31493
31516
|
secXmls.push(xml);
|
|
31494
31517
|
}
|
|
31495
31518
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31513,7 +31536,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31513
31536
|
let href = binmap.get(ref);
|
|
31514
31537
|
if (!href) {
|
|
31515
31538
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
31516
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
31539
|
+
href = _optionalChain([cand, 'optionalAccess', _600 => _600.name]);
|
|
31517
31540
|
}
|
|
31518
31541
|
if (!href) continue;
|
|
31519
31542
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -31534,7 +31557,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31534
31557
|
styles,
|
|
31535
31558
|
images,
|
|
31536
31559
|
defs: [],
|
|
31537
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31560
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _601 => _601.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
31538
31561
|
warnings,
|
|
31539
31562
|
warned: /* @__PURE__ */ new Set(),
|
|
31540
31563
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -31545,7 +31568,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31545
31568
|
for (let si = 0; si < secXmls.length; si++) {
|
|
31546
31569
|
const secXml = secXmls[si];
|
|
31547
31570
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
31548
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
31571
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _602 => _602.reflow])) {
|
|
31549
31572
|
noCacheSkipped = true;
|
|
31550
31573
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
31551
31574
|
continue;
|
|
@@ -31557,14 +31580,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31557
31580
|
continue;
|
|
31558
31581
|
}
|
|
31559
31582
|
const geom = readSectionGeom(root);
|
|
31560
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
31583
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _603 => _603.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _604 => _604.reflowMode]), () => ( "keep")));
|
|
31561
31584
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
31562
31585
|
}
|
|
31563
31586
|
if (rendered.length === 0) {
|
|
31564
31587
|
if (noCacheSkipped) {
|
|
31565
|
-
throw new (0,
|
|
31588
|
+
throw new (0, _chunkJ7DBL77Bcjs.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)");
|
|
31566
31589
|
}
|
|
31567
|
-
throw new (0,
|
|
31590
|
+
throw new (0, _chunkJ7DBL77Bcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31568
31591
|
}
|
|
31569
31592
|
const GAP = 2400;
|
|
31570
31593
|
const clipDefs = [];
|
|
@@ -31596,17 +31619,17 @@ ${groups.join("\n")}
|
|
|
31596
31619
|
// src/index.ts
|
|
31597
31620
|
async function parse(input, options) {
|
|
31598
31621
|
let buffer;
|
|
31599
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
31622
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _605 => _605.filePath]) ? { ...options, filePath: input } : options;
|
|
31600
31623
|
if (typeof input === "string") {
|
|
31601
31624
|
try {
|
|
31602
31625
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31603
|
-
buffer =
|
|
31626
|
+
buffer = _chunkJ7DBL77Bcjs.toArrayBuffer.call(void 0, buf);
|
|
31604
31627
|
} catch (err) {
|
|
31605
31628
|
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}`;
|
|
31606
31629
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31607
31630
|
}
|
|
31608
31631
|
} else if (Buffer.isBuffer(input)) {
|
|
31609
|
-
buffer =
|
|
31632
|
+
buffer = _chunkJ7DBL77Bcjs.toArrayBuffer.call(void 0, input);
|
|
31610
31633
|
} else {
|
|
31611
31634
|
buffer = input;
|
|
31612
31635
|
}
|
|
@@ -31614,6 +31637,14 @@ async function parse(input, options) {
|
|
|
31614
31637
|
return { success: false, fileType: "unknown", error: "\uBE48 \uBC84\uD37C\uC774\uAC70\uB098 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC785\uB825\uC785\uB2C8\uB2E4.", code: "EMPTY_INPUT" };
|
|
31615
31638
|
}
|
|
31616
31639
|
const format = detectFormat(buffer);
|
|
31640
|
+
const result = await dispatch(format, buffer, opts);
|
|
31641
|
+
if (result.success && !result.pages) {
|
|
31642
|
+
const pages = blocksToPages(result.blocks);
|
|
31643
|
+
if (pages) return { ...result, pages };
|
|
31644
|
+
}
|
|
31645
|
+
return result;
|
|
31646
|
+
}
|
|
31647
|
+
async function dispatch(format, buffer, opts) {
|
|
31617
31648
|
switch (format) {
|
|
31618
31649
|
case "hwpx": {
|
|
31619
31650
|
const zipFormat = await detectZipFormat(buffer);
|
|
@@ -31640,40 +31671,40 @@ async function parse(input, options) {
|
|
|
31640
31671
|
}
|
|
31641
31672
|
async function parseImage(buffer, options) {
|
|
31642
31673
|
try {
|
|
31643
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31674
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-CBMJIJTQ.cjs")));
|
|
31644
31675
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31645
31676
|
return {
|
|
31646
31677
|
success: true,
|
|
31647
31678
|
fileType: "image",
|
|
31648
|
-
markdown:
|
|
31679
|
+
markdown: _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31649
31680
|
blocks,
|
|
31650
31681
|
warnings: warnings.length ? warnings : void 0,
|
|
31651
31682
|
pageCount: 1
|
|
31652
31683
|
};
|
|
31653
31684
|
} catch (err) {
|
|
31654
|
-
return { success: false, fileType: "image", error:
|
|
31685
|
+
return { success: false, fileType: "image", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31655
31686
|
}
|
|
31656
31687
|
}
|
|
31657
31688
|
async function parseHwp3(buffer, options) {
|
|
31658
31689
|
try {
|
|
31659
31690
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31660
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31691
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _606 => _606.pageCount]) };
|
|
31661
31692
|
} catch (err) {
|
|
31662
|
-
return { success: false, fileType: "hwp3", error:
|
|
31693
|
+
return { success: false, fileType: "hwp3", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31663
31694
|
}
|
|
31664
31695
|
}
|
|
31665
31696
|
async function parseHwpx(buffer, options) {
|
|
31666
31697
|
try {
|
|
31667
31698
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31668
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31699
|
+
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]) };
|
|
31669
31700
|
} catch (err) {
|
|
31670
|
-
return { success: false, fileType: "hwpx", error:
|
|
31701
|
+
return { success: false, fileType: "hwpx", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31671
31702
|
}
|
|
31672
31703
|
}
|
|
31673
31704
|
async function parseHwp(buffer, options) {
|
|
31674
31705
|
try {
|
|
31675
31706
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
31676
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
31707
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _609 => _609.filePath])) {
|
|
31677
31708
|
try {
|
|
31678
31709
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
31679
31710
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -31691,15 +31722,15 @@ async function parseHwp(buffer, options) {
|
|
|
31691
31722
|
} catch (e39) {
|
|
31692
31723
|
}
|
|
31693
31724
|
}
|
|
31694
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31725
|
+
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]) };
|
|
31695
31726
|
} catch (err) {
|
|
31696
|
-
return { success: false, fileType: "hwp", error:
|
|
31727
|
+
return { success: false, fileType: "hwp", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31697
31728
|
}
|
|
31698
31729
|
}
|
|
31699
31730
|
async function parsePdf(buffer, options) {
|
|
31700
31731
|
let parsePdfDocument;
|
|
31701
31732
|
try {
|
|
31702
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
31733
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-GIVQWVKJ.cjs")));
|
|
31703
31734
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31704
31735
|
} catch (e40) {
|
|
31705
31736
|
return {
|
|
@@ -31711,51 +31742,51 @@ async function parsePdf(buffer, options) {
|
|
|
31711
31742
|
}
|
|
31712
31743
|
try {
|
|
31713
31744
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
|
|
31714
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31745
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _612 => _612.pageCount]) };
|
|
31715
31746
|
} catch (err) {
|
|
31716
31747
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31717
|
-
return { success: false, fileType: "pdf", error:
|
|
31748
|
+
return { success: false, fileType: "pdf", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err), isImageBased };
|
|
31718
31749
|
}
|
|
31719
31750
|
}
|
|
31720
31751
|
async function parseXlsx(buffer, options) {
|
|
31721
31752
|
try {
|
|
31722
31753
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31723
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31754
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _613 => _613.pageCount]) };
|
|
31724
31755
|
} catch (err) {
|
|
31725
|
-
return { success: false, fileType: "xlsx", error:
|
|
31756
|
+
return { success: false, fileType: "xlsx", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31726
31757
|
}
|
|
31727
31758
|
}
|
|
31728
31759
|
async function parseXls(buffer, options) {
|
|
31729
31760
|
try {
|
|
31730
31761
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31731
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31762
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _614 => _614.pageCount]) };
|
|
31732
31763
|
} catch (err) {
|
|
31733
|
-
return { success: false, fileType: "xls", error:
|
|
31764
|
+
return { success: false, fileType: "xls", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31734
31765
|
}
|
|
31735
31766
|
}
|
|
31736
31767
|
async function parseDocx(buffer, options) {
|
|
31737
31768
|
try {
|
|
31738
31769
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31739
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31770
|
+
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]) };
|
|
31740
31771
|
} catch (err) {
|
|
31741
|
-
return { success: false, fileType: "docx", error:
|
|
31772
|
+
return { success: false, fileType: "docx", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31742
31773
|
}
|
|
31743
31774
|
}
|
|
31744
31775
|
async function parseHwpml(buffer, options) {
|
|
31745
31776
|
try {
|
|
31746
31777
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31747
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31778
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _617 => _617.pageCount]) };
|
|
31748
31779
|
} catch (err) {
|
|
31749
|
-
return { success: false, fileType: "hwpml", error:
|
|
31780
|
+
return { success: false, fileType: "hwpml", error: _chunkJ7DBL77Bcjs.sanitizeError.call(void 0, err), code: _chunkJ7DBL77Bcjs.classifyError.call(void 0, err) };
|
|
31750
31781
|
}
|
|
31751
31782
|
}
|
|
31752
31783
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31753
31784
|
let buffer;
|
|
31754
31785
|
if (typeof input === "string") {
|
|
31755
31786
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31756
|
-
buffer =
|
|
31787
|
+
buffer = _chunkJ7DBL77Bcjs.toArrayBuffer.call(void 0, buf);
|
|
31757
31788
|
} else if (Buffer.isBuffer(input)) {
|
|
31758
|
-
buffer =
|
|
31789
|
+
buffer = _chunkJ7DBL77Bcjs.toArrayBuffer.call(void 0, input);
|
|
31759
31790
|
} else {
|
|
31760
31791
|
buffer = input;
|
|
31761
31792
|
}
|
|
@@ -31781,7 +31812,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31781
31812
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31782
31813
|
}
|
|
31783
31814
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31784
|
-
const markdown =
|
|
31815
|
+
const markdown = _chunkGGZ5PSJOcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31785
31816
|
if (outputFormat === "hwpx") {
|
|
31786
31817
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31787
31818
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31860,5 +31891,6 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31860
31891
|
|
|
31861
31892
|
|
|
31862
31893
|
|
|
31863
|
-
|
|
31894
|
+
|
|
31895
|
+
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 = _chunkJ7DBL77Bcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkGGZ5PSJOcjs.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.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
31864
31896
|
//# sourceMappingURL=index.cjs.map
|