kordoc 4.12.2 → 4.12.3
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 +12 -1
- package/dist/{-EZH6NKTE.js → -FWGDIOV4.js} +8 -8
- package/dist/{chunk-OEYECZGV.js → chunk-2DAFWDV2.js} +9 -5
- package/dist/chunk-2DAFWDV2.js.map +1 -0
- package/dist/{chunk-5RPYBC2Q.js → chunk-3KQOI6R6.js} +27 -2
- package/dist/chunk-3KQOI6R6.js.map +1 -0
- package/dist/{chunk-DBGEUDBY.js → chunk-6L3B44DH.js} +2 -2
- package/dist/{chunk-ONNAHSPV.cjs → chunk-7BIXTQZ3.cjs} +14 -10
- package/dist/chunk-7BIXTQZ3.cjs.map +1 -0
- package/dist/{chunk-IOJX4Q63.js → chunk-B63QEHYL.js} +3 -3
- package/dist/{chunk-JCMBQC5N.js → chunk-BAZMKQZW.js} +2 -2
- package/dist/{chunk-V5BUPZ6I.cjs → chunk-BOATAEXU.cjs} +7 -4
- package/dist/chunk-BOATAEXU.cjs.map +1 -0
- package/dist/{chunk-KX7IYCCZ.js → chunk-CKYDP34A.js} +3 -3
- package/dist/{chunk-7XUXSDH5.js → chunk-DUGUCM7K.js} +9 -5
- package/dist/chunk-DUGUCM7K.js.map +1 -0
- package/dist/{chunk-2LKYJ4G3.cjs → chunk-FFITS3NY.cjs} +6 -6
- package/dist/{chunk-2LKYJ4G3.cjs.map → chunk-FFITS3NY.cjs.map} +1 -1
- package/dist/{chunk-2B7OIEJJ.js → chunk-HB56YANA.js} +5 -2
- package/dist/chunk-HB56YANA.js.map +1 -0
- package/dist/{chunk-2HBYWA5X.js → chunk-IC6HHXFL.js} +2 -2
- package/dist/{chunk-LD2K4K5V.js → chunk-INFYDSZL.js} +111 -22
- package/dist/chunk-INFYDSZL.js.map +1 -0
- package/dist/{chunk-62IU4NV3.cjs → chunk-ISCI5LKN.cjs} +2 -2
- package/dist/{chunk-62IU4NV3.cjs.map → chunk-ISCI5LKN.cjs.map} +1 -1
- package/dist/{chunk-XXDZ2KTW.js → chunk-KLO6RHX2.js} +2 -2
- package/dist/{chunk-MUYU4JI5.js → chunk-KRE2SREV.js} +2 -2
- package/dist/{chunk-QBCMFNHS.js → chunk-OJDMMZ5Z.js} +2 -2
- package/dist/{chunk-UL2MDA5C.js → chunk-PL4V523B.js} +3 -3
- package/dist/{chunk-FBLMVHDK.js → chunk-PUZZFYLV.js} +2 -2
- package/dist/{chunk-2LO525TL.js → chunk-SJEPQOVW.js} +2 -2
- package/dist/{chunk-QM2RSJ2S.js → chunk-TWKXX343.js} +3 -3
- package/dist/{chunk-2LPBIW2B.cjs → chunk-W3H2H55O.cjs} +3 -3
- package/dist/{chunk-2LPBIW2B.cjs.map → chunk-W3H2H55O.cjs.map} +1 -1
- package/dist/{chunk-FVBR7SC3.js → chunk-YBZJMAE2.js} +2 -2
- package/dist/{chunk-Q6ETEJFK.js → chunk-ZASGH5EN.js} +5 -2
- package/dist/chunk-ZASGH5EN.js.map +1 -0
- package/dist/chunks-VICNQMNE.js +10 -0
- package/dist/cli.js +30 -23
- package/dist/cli.js.map +1 -1
- package/dist/{formula-NW33S4TA.js → formula-R7IWAAYR.js} +3 -3
- package/dist/{formula-6RQX4NMJ.js → formula-YJWKEPUK.js} +4 -4
- package/dist/{formula-NBEO6CFC.cjs → formula-ZYHUXTK5.cjs} +9 -9
- package/dist/{formula-NBEO6CFC.cjs.map → formula-ZYHUXTK5.cjs.map} +1 -1
- package/dist/{image-ocr-V4KY373B.cjs → image-ocr-6O6ZXKUD.cjs} +11 -11
- package/dist/{image-ocr-V4KY373B.cjs.map → image-ocr-6O6ZXKUD.cjs.map} +1 -1
- package/dist/{image-ocr-SO56VETS.js → image-ocr-G4JVF2UH.js} +7 -7
- package/dist/{image-ocr-CAVU2TNZ.js → image-ocr-OLTSKQWD.js} +5 -5
- package/dist/index.cjs +455 -366
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +107 -18
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +20 -17
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-EIJF34DR.js → model-bundle-IFD2D5CW.js} +5 -5
- package/dist/{models-6V4CPQXC.js → models-FJ3IUNTB.js} +5 -5
- package/dist/{parser-OBHNXEQM.js → parser-I7TC35V6.js} +31 -10
- package/dist/parser-I7TC35V6.js.map +1 -0
- package/dist/{parser-GIREMEPD.js → parser-JRT3B6OK.js} +31 -10
- package/dist/parser-JRT3B6OK.js.map +1 -0
- package/dist/{parser-OMT25WH2.cjs → parser-YLLIYOIZ.cjs} +59 -38
- package/dist/parser-YLLIYOIZ.cjs.map +1 -0
- package/dist/pdf-ocr-ADUP2LPU.cjs +14 -0
- package/dist/{pdf-ocr-TFYVK4FI.cjs.map → pdf-ocr-ADUP2LPU.cjs.map} +1 -1
- package/dist/pdf-ocr-ATJTB2B3.js +13 -0
- package/dist/pdf-ocr-P75KSZFV.js +16 -0
- package/dist/{profile-io-PZVMM66V.js → profile-io-BPJQQZLQ.js} +3 -3
- package/dist/{rasterize-NRWP2C6L.js → rasterize-ALCNU53T.js} +2 -2
- package/dist/render-MDLTQUUV.js +10 -0
- package/dist/seal-K4K3KPE3.js +10 -0
- package/dist/{setup-V55AJP6H.js → setup-O2DALZKF.js} +3 -3
- package/dist/{watch-7CQSMDDP.js → watch-GPWYJAS2.js} +9 -9
- package/package.json +1 -1
- package/dist/chunk-2B7OIEJJ.js.map +0 -1
- package/dist/chunk-5RPYBC2Q.js.map +0 -1
- package/dist/chunk-7XUXSDH5.js.map +0 -1
- package/dist/chunk-LD2K4K5V.js.map +0 -1
- package/dist/chunk-OEYECZGV.js.map +0 -1
- package/dist/chunk-ONNAHSPV.cjs.map +0 -1
- package/dist/chunk-Q6ETEJFK.js.map +0 -1
- package/dist/chunk-V5BUPZ6I.cjs.map +0 -1
- package/dist/chunks-TT7ZE5QQ.js +0 -10
- package/dist/parser-GIREMEPD.js.map +0 -1
- package/dist/parser-OBHNXEQM.js.map +0 -1
- package/dist/parser-OMT25WH2.cjs.map +0 -1
- package/dist/pdf-ocr-IRXQ5GBM.js +0 -13
- package/dist/pdf-ocr-SL4GCOGS.js +0 -16
- package/dist/pdf-ocr-TFYVK4FI.cjs +0 -14
- package/dist/render-V5ZPTZQ7.js +0 -10
- package/dist/seal-LVG2DGAB.js +0 -10
- /package/dist/{-EZH6NKTE.js.map → -FWGDIOV4.js.map} +0 -0
- /package/dist/{chunk-DBGEUDBY.js.map → chunk-6L3B44DH.js.map} +0 -0
- /package/dist/{chunk-IOJX4Q63.js.map → chunk-B63QEHYL.js.map} +0 -0
- /package/dist/{chunk-JCMBQC5N.js.map → chunk-BAZMKQZW.js.map} +0 -0
- /package/dist/{chunk-KX7IYCCZ.js.map → chunk-CKYDP34A.js.map} +0 -0
- /package/dist/{chunk-2HBYWA5X.js.map → chunk-IC6HHXFL.js.map} +0 -0
- /package/dist/{chunk-XXDZ2KTW.js.map → chunk-KLO6RHX2.js.map} +0 -0
- /package/dist/{chunk-MUYU4JI5.js.map → chunk-KRE2SREV.js.map} +0 -0
- /package/dist/{chunk-QBCMFNHS.js.map → chunk-OJDMMZ5Z.js.map} +0 -0
- /package/dist/{chunk-UL2MDA5C.js.map → chunk-PL4V523B.js.map} +0 -0
- /package/dist/{chunk-FBLMVHDK.js.map → chunk-PUZZFYLV.js.map} +0 -0
- /package/dist/{chunk-2LO525TL.js.map → chunk-SJEPQOVW.js.map} +0 -0
- /package/dist/{chunk-QM2RSJ2S.js.map → chunk-TWKXX343.js.map} +0 -0
- /package/dist/{chunk-FVBR7SC3.js.map → chunk-YBZJMAE2.js.map} +0 -0
- /package/dist/{chunks-TT7ZE5QQ.js.map → chunks-VICNQMNE.js.map} +0 -0
- /package/dist/{formula-NW33S4TA.js.map → formula-R7IWAAYR.js.map} +0 -0
- /package/dist/{formula-6RQX4NMJ.js.map → formula-YJWKEPUK.js.map} +0 -0
- /package/dist/{image-ocr-SO56VETS.js.map → image-ocr-G4JVF2UH.js.map} +0 -0
- /package/dist/{image-ocr-CAVU2TNZ.js.map → image-ocr-OLTSKQWD.js.map} +0 -0
- /package/dist/{model-bundle-EIJF34DR.js.map → model-bundle-IFD2D5CW.js.map} +0 -0
- /package/dist/{models-6V4CPQXC.js.map → models-FJ3IUNTB.js.map} +0 -0
- /package/dist/{pdf-ocr-IRXQ5GBM.js.map → pdf-ocr-ATJTB2B3.js.map} +0 -0
- /package/dist/{pdf-ocr-SL4GCOGS.js.map → pdf-ocr-P75KSZFV.js.map} +0 -0
- /package/dist/{profile-io-PZVMM66V.js.map → profile-io-BPJQQZLQ.js.map} +0 -0
- /package/dist/{rasterize-NRWP2C6L.js.map → rasterize-ALCNU53T.js.map} +0 -0
- /package/dist/{render-V5ZPTZQ7.js.map → render-MDLTQUUV.js.map} +0 -0
- /package/dist/{seal-LVG2DGAB.js.map → seal-K4K3KPE3.js.map} +0 -0
- /package/dist/{setup-V55AJP6H.js.map → setup-O2DALZKF.js.map} +0 -0
- /package/dist/{watch-7CQSMDDP.js.map → watch-GPWYJAS2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkBOATAEXUcjs = require('./chunk-BOATAEXU.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -29,7 +29,7 @@ var _chunkT7GRHAIWcjs = require('./chunk-T7GRHAIW.cjs');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkISCI5LKNcjs = require('./chunk-ISCI5LKN.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 _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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 plain2 = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
595
595
|
if (!plain2) {
|
|
596
|
-
throw new (0,
|
|
596
|
+
throw new (0, _chunkISCI5LKNcjs.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: plain2 });
|
|
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, _chunkISCI5LKNcjs.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(_chunkISCI5LKNcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
648
648
|
if (!doc.documentElement) continue;
|
|
649
649
|
const domDoc = doc;
|
|
650
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1428,7 +1428,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1428
1428
|
|
|
1429
1429
|
// src/hwpx/table-build.ts
|
|
1430
1430
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1431
|
-
const table2 =
|
|
1431
|
+
const table2 = _chunkBOATAEXUcjs.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 = _chunkBOATAEXUcjs.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(_chunkISCI5LKNcjs.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, _chunkBOATAEXUcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkBOATAEXUcjs.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 = _chunkBOATAEXUcjs.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 = _chunkISCI5LKNcjs.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 = _chunkISCI5LKNcjs.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, _chunkISCI5LKNcjs.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,
|
|
@@ -2788,8 +2788,9 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2788
2788
|
case CHAR_PARA:
|
|
2789
2789
|
break;
|
|
2790
2790
|
// 문단 끝
|
|
2791
|
+
// 하이픈(24)은 한컴이 그리지 않는다 — 한컴 PDF·rhwp export-hwpx 모두 "60g/㎡"(licbyl2 17855137,
|
|
2792
|
+
// 전 코퍼스 유일 출현). 실렌더가 진실이므로 방출하지 않는다 (v4.12.3, 종전 "-")
|
|
2791
2793
|
case CHAR_HYPHEN:
|
|
2792
|
-
result += "-";
|
|
2793
2794
|
break;
|
|
2794
2795
|
case CHAR_NBSP:
|
|
2795
2796
|
result += "\xA0";
|
|
@@ -3087,13 +3088,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3087
3088
|
}
|
|
3088
3089
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3089
3090
|
for (const path of allCandidates) {
|
|
3090
|
-
if (
|
|
3091
|
+
if (_chunkISCI5LKNcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3091
3092
|
const file = zip.file(path);
|
|
3092
3093
|
if (!file) continue;
|
|
3093
3094
|
try {
|
|
3094
3095
|
const data = await file.async("uint8array");
|
|
3095
3096
|
decompressed.total += data.length;
|
|
3096
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3097
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3097
3098
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3098
3099
|
const mimeType = imageExtToMime(ext);
|
|
3099
3100
|
imageIndex++;
|
|
@@ -3103,7 +3104,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3103
3104
|
usedPaths.add(path);
|
|
3104
3105
|
break;
|
|
3105
3106
|
} catch (err) {
|
|
3106
|
-
if (err instanceof
|
|
3107
|
+
if (err instanceof _chunkISCI5LKNcjs.KordocError) throw err;
|
|
3107
3108
|
}
|
|
3108
3109
|
}
|
|
3109
3110
|
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" })]);
|
|
@@ -3123,11 +3124,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3123
3124
|
if (sweepUnreferenced) {
|
|
3124
3125
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3125
3126
|
for (const file of binEntries) {
|
|
3126
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3127
|
+
if (file.dir || usedPaths.has(file.name) || _chunkISCI5LKNcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3127
3128
|
try {
|
|
3128
3129
|
const data = await file.async("uint8array");
|
|
3129
3130
|
decompressed.total += data.length;
|
|
3130
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3131
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3131
3132
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3132
3133
|
let mimeType = imageExtToMime(ext);
|
|
3133
3134
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3141,7 +3142,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3141
3142
|
images.push(img);
|
|
3142
3143
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3143
3144
|
} catch (err) {
|
|
3144
|
-
if (err instanceof
|
|
3145
|
+
if (err instanceof _chunkISCI5LKNcjs.KordocError) throw err;
|
|
3145
3146
|
_optionalChain([warnings, 'optionalAccess', _86 => _86.push, 'call', _87 => _87({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3146
3147
|
}
|
|
3147
3148
|
}
|
|
@@ -3192,7 +3193,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3192
3193
|
}
|
|
3193
3194
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3194
3195
|
const name = new TextDecoder().decode(nameBytes);
|
|
3195
|
-
if (
|
|
3196
|
+
if (_chunkISCI5LKNcjs.isPathTraversal.call(void 0, name)) {
|
|
3196
3197
|
pos = fileStart + compSize;
|
|
3197
3198
|
continue;
|
|
3198
3199
|
}
|
|
@@ -3210,7 +3211,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3210
3211
|
continue;
|
|
3211
3212
|
}
|
|
3212
3213
|
totalDecompressed += content.length * 2;
|
|
3213
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3214
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3214
3215
|
sectionNum++;
|
|
3215
3216
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3216
3217
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3219,9 +3220,9 @@ function extractFromBrokenZip(buffer) {
|
|
|
3219
3220
|
continue;
|
|
3220
3221
|
}
|
|
3221
3222
|
}
|
|
3222
|
-
if (blocks.length === 0) throw new (0,
|
|
3223
|
+
if (blocks.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3223
3224
|
applyPageText(blocks, shared);
|
|
3224
|
-
const markdown =
|
|
3225
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3225
3226
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3226
3227
|
}
|
|
3227
3228
|
async function readKordocLayout(zip) {
|
|
@@ -3246,18 +3247,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3246
3247
|
if (paths.length > 0) return paths;
|
|
3247
3248
|
}
|
|
3248
3249
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3249
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3250
|
+
return sectionFiles.map((f) => f.name).sort(_chunkISCI5LKNcjs.compareSectionPaths);
|
|
3250
3251
|
}
|
|
3251
3252
|
function parseSectionPathsFromManifest(xml) {
|
|
3252
3253
|
const parser = createXmlParser();
|
|
3253
|
-
const doc = parser.parseFromString(
|
|
3254
|
+
const doc = parser.parseFromString(_chunkISCI5LKNcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3254
3255
|
const items = doc.getElementsByTagName("opf:item");
|
|
3255
3256
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3256
3257
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3257
3258
|
for (let i = 0; i < items.length; i++) {
|
|
3258
3259
|
const item = items[i];
|
|
3259
3260
|
const id = item.getAttribute("id") || "";
|
|
3260
|
-
const href =
|
|
3261
|
+
const href = _chunkISCI5LKNcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3261
3262
|
if (id && href) idToHref.set(id, href);
|
|
3262
3263
|
}
|
|
3263
3264
|
if (spine.length > 0) {
|
|
@@ -3268,7 +3269,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3268
3269
|
}
|
|
3269
3270
|
if (ordered.length > 0) return ordered;
|
|
3270
3271
|
}
|
|
3271
|
-
return Array.from(idToHref.values()).sort(
|
|
3272
|
+
return Array.from(idToHref.values()).sort(_chunkISCI5LKNcjs.compareSectionPaths);
|
|
3272
3273
|
}
|
|
3273
3274
|
|
|
3274
3275
|
// src/hwpx/metadata.ts
|
|
@@ -3281,7 +3282,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3281
3282
|
const xml = await file.async("text");
|
|
3282
3283
|
if (decompressed) {
|
|
3283
3284
|
decompressed.total += xml.length * 2;
|
|
3284
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3285
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3285
3286
|
}
|
|
3286
3287
|
parseDublinCoreMetadata(xml, metadata);
|
|
3287
3288
|
if (metadata.title || metadata.author) return;
|
|
@@ -3291,7 +3292,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3291
3292
|
}
|
|
3292
3293
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3293
3294
|
const parser = createXmlParser();
|
|
3294
|
-
const doc = parser.parseFromString(
|
|
3295
|
+
const doc = parser.parseFromString(_chunkISCI5LKNcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3295
3296
|
if (!doc.documentElement) return;
|
|
3296
3297
|
const getText = (tagNames) => {
|
|
3297
3298
|
for (const tag of tagNames) {
|
|
@@ -3316,7 +3317,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3316
3317
|
|
|
3317
3318
|
// src/hwpx/parser.ts
|
|
3318
3319
|
async function parseHwpxDocument(buffer, options) {
|
|
3319
|
-
|
|
3320
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3320
3321
|
let zip;
|
|
3321
3322
|
try {
|
|
3322
3323
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3325,7 +3326,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3325
3326
|
}
|
|
3326
3327
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3327
3328
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3328
|
-
throw new (0,
|
|
3329
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3329
3330
|
}
|
|
3330
3331
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3331
3332
|
if (manifestFile) {
|
|
@@ -3340,7 +3341,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3340
3341
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3341
3342
|
}
|
|
3342
3343
|
}
|
|
3343
|
-
throw new (0,
|
|
3344
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
3344
3345
|
"\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."
|
|
3345
3346
|
);
|
|
3346
3347
|
}
|
|
@@ -3352,7 +3353,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3352
3353
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3353
3354
|
const warnings = [];
|
|
3354
3355
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3355
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3356
|
+
if (sectionPaths.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3356
3357
|
let allBlocks = [];
|
|
3357
3358
|
const shared = createSectionShared();
|
|
3358
3359
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -3397,7 +3398,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3397
3398
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _102 => _102.pages]));
|
|
3398
3399
|
detectHwpxHeadings(blocks, styleMap);
|
|
3399
3400
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3400
|
-
const markdown =
|
|
3401
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3401
3402
|
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 };
|
|
3402
3403
|
}
|
|
3403
3404
|
|
|
@@ -4397,7 +4398,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4397
4398
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4398
4399
|
var TAG_ID_MAPPINGS = 17;
|
|
4399
4400
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4400
|
-
const wrong = () => new (0,
|
|
4401
|
+
const wrong = () => new (0, _chunkISCI5LKNcjs.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.");
|
|
4401
4402
|
let records;
|
|
4402
4403
|
try {
|
|
4403
4404
|
records = readRecords3(data);
|
|
@@ -4409,7 +4410,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4409
4410
|
}
|
|
4410
4411
|
function assertSupportedEncryptVersion(version) {
|
|
4411
4412
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4412
|
-
throw new (0,
|
|
4413
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
4413
4414
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4414
4415
|
);
|
|
4415
4416
|
}
|
|
@@ -4598,7 +4599,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4598
4599
|
lenientCfb = parseLenientCfb(buffer);
|
|
4599
4600
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4600
4601
|
} catch (e24) {
|
|
4601
|
-
throw new (0,
|
|
4602
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4602
4603
|
}
|
|
4603
4604
|
}
|
|
4604
4605
|
const readRawStream = (path) => {
|
|
@@ -4609,14 +4610,14 @@ function parseHwp5Document(buffer, options) {
|
|
|
4609
4610
|
return lenientCfb.findStream(path);
|
|
4610
4611
|
};
|
|
4611
4612
|
const headerData = readRawStream("/FileHeader");
|
|
4612
|
-
if (!headerData) throw new (0,
|
|
4613
|
+
if (!headerData) throw new (0, _chunkISCI5LKNcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4613
4614
|
const header = parseFileHeader(headerData);
|
|
4614
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4615
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4615
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkISCI5LKNcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4616
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkISCI5LKNcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4616
4617
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4617
4618
|
if (encrypted) {
|
|
4618
4619
|
if (!_optionalChain([options, 'optionalAccess', _106 => _106.password])) {
|
|
4619
|
-
throw new (0,
|
|
4620
|
+
throw new (0, _chunkISCI5LKNcjs.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.");
|
|
4620
4621
|
}
|
|
4621
4622
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4622
4623
|
}
|
|
@@ -4634,18 +4635,18 @@ function parseHwp5Document(buffer, options) {
|
|
|
4634
4635
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4635
4636
|
if (encrypted) {
|
|
4636
4637
|
const rawDocInfo = findStream("/DocInfo");
|
|
4637
|
-
if (!rawDocInfo) throw new (0,
|
|
4638
|
+
if (!rawDocInfo) throw new (0, _chunkISCI5LKNcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4638
4639
|
let docInfoData;
|
|
4639
4640
|
try {
|
|
4640
4641
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4641
4642
|
} catch (e25) {
|
|
4642
|
-
throw new (0,
|
|
4643
|
+
throw new (0, _chunkISCI5LKNcjs.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.");
|
|
4643
4644
|
}
|
|
4644
4645
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4645
4646
|
}
|
|
4646
4647
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4647
4648
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4648
|
-
if (sections.length === 0) throw new (0,
|
|
4649
|
+
if (sections.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4649
4650
|
const sectionRecords = [];
|
|
4650
4651
|
const sectionDetects = [];
|
|
4651
4652
|
let totalDecompressed = 0;
|
|
@@ -4653,12 +4654,12 @@ function parseHwp5Document(buffer, options) {
|
|
|
4653
4654
|
try {
|
|
4654
4655
|
const data = !distribution && compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
4655
4656
|
totalDecompressed += data.length;
|
|
4656
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4657
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4657
4658
|
const records = readRecords(data);
|
|
4658
4659
|
sectionRecords.push(records);
|
|
4659
4660
|
sectionDetects.push(detectHwp5SectionPages(records));
|
|
4660
4661
|
} catch (secErr) {
|
|
4661
|
-
if (secErr instanceof
|
|
4662
|
+
if (secErr instanceof _chunkISCI5LKNcjs.KordocError) throw secErr;
|
|
4662
4663
|
sectionRecords.push(null);
|
|
4663
4664
|
sectionDetects.push(null);
|
|
4664
4665
|
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" });
|
|
@@ -4694,7 +4695,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4694
4695
|
parsedSections++;
|
|
4695
4696
|
_optionalChain([options, 'optionalAccess', _110 => _110.onProgress, 'optionalCall', _111 => _111(parsedSections, sections.length)]);
|
|
4696
4697
|
} catch (secErr) {
|
|
4697
|
-
if (secErr instanceof
|
|
4698
|
+
if (secErr instanceof _chunkISCI5LKNcjs.KordocError) throw secErr;
|
|
4698
4699
|
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" });
|
|
4699
4700
|
} finally {
|
|
4700
4701
|
pageBase += detect.pages;
|
|
@@ -4705,9 +4706,9 @@ function parseHwp5Document(buffer, options) {
|
|
|
4705
4706
|
}
|
|
4706
4707
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4707
4708
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4708
|
-
let flatBlocks =
|
|
4709
|
+
let flatBlocks = _chunkBOATAEXUcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4709
4710
|
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4710
|
-
const deduped =
|
|
4711
|
+
const deduped = _chunkBOATAEXUcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4711
4712
|
const removed = flatBlocks.length - deduped.length;
|
|
4712
4713
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4713
4714
|
flatBlocks = deduped;
|
|
@@ -4716,10 +4717,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4716
4717
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4717
4718
|
}
|
|
4718
4719
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4719
|
-
let markdown =
|
|
4720
|
+
let markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4720
4721
|
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4721
4722
|
try {
|
|
4722
|
-
markdown =
|
|
4723
|
+
markdown = _chunkBOATAEXUcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4723
4724
|
} catch (inlineErr) {
|
|
4724
4725
|
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" });
|
|
4725
4726
|
}
|
|
@@ -4879,7 +4880,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4879
4880
|
if (!raw) break;
|
|
4880
4881
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4881
4882
|
totalDecompressed += content.length;
|
|
4882
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4883
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4883
4884
|
sections.push({ idx: i, content });
|
|
4884
4885
|
}
|
|
4885
4886
|
if (sections.length === 0) {
|
|
@@ -4891,7 +4892,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4891
4892
|
if (raw) {
|
|
4892
4893
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4893
4894
|
totalDecompressed += content.length;
|
|
4894
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4895
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4895
4896
|
sections.push({ idx, content });
|
|
4896
4897
|
}
|
|
4897
4898
|
}
|
|
@@ -4908,7 +4909,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4908
4909
|
try {
|
|
4909
4910
|
const content = decryptViewText(raw, compressed);
|
|
4910
4911
|
totalDecompressed += content.length;
|
|
4911
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4912
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4912
4913
|
sections.push({ idx: i, content });
|
|
4913
4914
|
} catch (e30) {
|
|
4914
4915
|
break;
|
|
@@ -5025,7 +5026,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5025
5026
|
const ctrl = ctrls[r.ctrlIdx];
|
|
5026
5027
|
if (!_optionalChain([ctrl, 'optionalAccess', _126 => _126.href]) || r.end <= r.start) continue;
|
|
5027
5028
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
5028
|
-
const href =
|
|
5029
|
+
const href = _chunkISCI5LKNcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5029
5030
|
if (!href) continue;
|
|
5030
5031
|
const anchor = text.slice(r.start, r.end);
|
|
5031
5032
|
if (!anchor.trim()) continue;
|
|
@@ -5265,8 +5266,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5265
5266
|
let tableIdx = -1;
|
|
5266
5267
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5267
5268
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
5268
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5269
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5269
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkBOATAEXUcjs.MAX_ROWS);
|
|
5270
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkBOATAEXUcjs.MAX_COLS);
|
|
5270
5271
|
tableIdx = i2;
|
|
5271
5272
|
break;
|
|
5272
5273
|
}
|
|
@@ -5315,7 +5316,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5315
5316
|
return table3;
|
|
5316
5317
|
}
|
|
5317
5318
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5318
|
-
const table2 =
|
|
5319
|
+
const table2 = _chunkBOATAEXUcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5319
5320
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5320
5321
|
return table2.rows > 0 ? table2 : null;
|
|
5321
5322
|
}
|
|
@@ -5332,8 +5333,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5332
5333
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5333
5334
|
const cs = rec.data.readUInt16LE(12);
|
|
5334
5335
|
const rs = rec.data.readUInt16LE(14);
|
|
5335
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5336
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5336
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkBOATAEXUcjs.MAX_COLS);
|
|
5337
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkBOATAEXUcjs.MAX_ROWS);
|
|
5337
5338
|
}
|
|
5338
5339
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5339
5340
|
const parts = [];
|
|
@@ -5343,7 +5344,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5343
5344
|
parts.push(``);
|
|
5344
5345
|
hasStructure = true;
|
|
5345
5346
|
} else if (b.type === "table" && b.table) {
|
|
5346
|
-
const flat =
|
|
5347
|
+
const flat = _chunkBOATAEXUcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5347
5348
|
if (flat) parts.push(flat);
|
|
5348
5349
|
hasStructure = true;
|
|
5349
5350
|
} else if (b.text) {
|
|
@@ -17919,25 +17920,25 @@ function desEcbDecrypt(data, key) {
|
|
|
17919
17920
|
}
|
|
17920
17921
|
function readLayout(data) {
|
|
17921
17922
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17922
|
-
throw new (0,
|
|
17923
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17923
17924
|
}
|
|
17924
17925
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17925
17926
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17926
17927
|
if (payloadOffset >= data.length) {
|
|
17927
|
-
throw new (0,
|
|
17928
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17928
17929
|
}
|
|
17929
17930
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17930
17931
|
}
|
|
17931
17932
|
function decryptHwp3Document(input, password) {
|
|
17932
17933
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17933
17934
|
if (!compressed) {
|
|
17934
|
-
throw new (0,
|
|
17935
|
+
throw new (0, _chunkISCI5LKNcjs.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)");
|
|
17935
17936
|
}
|
|
17936
17937
|
const source = Buffer.from(input);
|
|
17937
17938
|
const payload = source.subarray(payloadOffset);
|
|
17938
17939
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17939
17940
|
if (aligned.length === 0) {
|
|
17940
|
-
throw new (0,
|
|
17941
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17941
17942
|
}
|
|
17942
17943
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17943
17944
|
let inflated;
|
|
@@ -17945,14 +17946,14 @@ function decryptHwp3Document(input, password) {
|
|
|
17945
17946
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17946
17947
|
} catch (err) {
|
|
17947
17948
|
if (_optionalChain([err, 'optionalAccess', _139 => _139.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17948
|
-
throw new (0,
|
|
17949
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
17949
17950
|
`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`
|
|
17950
17951
|
);
|
|
17951
17952
|
}
|
|
17952
|
-
throw new (0,
|
|
17953
|
+
throw new (0, _chunkISCI5LKNcjs.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.");
|
|
17953
17954
|
}
|
|
17954
17955
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17955
|
-
throw new (0,
|
|
17956
|
+
throw new (0, _chunkISCI5LKNcjs.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.");
|
|
17956
17957
|
}
|
|
17957
17958
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17958
17959
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17991,7 +17992,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
17991
17992
|
let source = Buffer.from(buffer);
|
|
17992
17993
|
if (isEncryptedHwp3(source)) {
|
|
17993
17994
|
if (!_optionalChain([options, 'optionalAccess', _140 => _140.password])) {
|
|
17994
|
-
throw new (0,
|
|
17995
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
17995
17996
|
"\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."
|
|
17996
17997
|
);
|
|
17997
17998
|
}
|
|
@@ -18008,10 +18009,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
18008
18009
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
18009
18010
|
} catch (err) {
|
|
18010
18011
|
if (_optionalChain([err, 'optionalAccess', _141 => _141.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18011
|
-
throw new (0,
|
|
18012
|
+
throw new (0, _chunkISCI5LKNcjs.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`);
|
|
18012
18013
|
}
|
|
18013
18014
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
18014
|
-
throw new (0,
|
|
18015
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
18015
18016
|
}
|
|
18016
18017
|
} else {
|
|
18017
18018
|
body = tail;
|
|
@@ -18278,7 +18279,7 @@ function getTextContent(el) {
|
|
|
18278
18279
|
return _nullishCoalesce(_optionalChain([el, 'access', _144 => _144.textContent, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
18279
18280
|
}
|
|
18280
18281
|
function parseXml(text) {
|
|
18281
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
18282
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkISCI5LKNcjs.stripDtd.call(void 0, text), "text/xml");
|
|
18282
18283
|
}
|
|
18283
18284
|
function collectRichText(root) {
|
|
18284
18285
|
let out = "";
|
|
@@ -18513,7 +18514,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18513
18514
|
cellRows.push(row);
|
|
18514
18515
|
}
|
|
18515
18516
|
if (cellRows.length > 0) {
|
|
18516
|
-
const table2 =
|
|
18517
|
+
const table2 = _chunkBOATAEXUcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18517
18518
|
if (table2.rows > 0) {
|
|
18518
18519
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18519
18520
|
}
|
|
@@ -18521,12 +18522,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
18521
18522
|
return blocks;
|
|
18522
18523
|
}
|
|
18523
18524
|
async function parseXlsxDocument(buffer, options) {
|
|
18524
|
-
|
|
18525
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
18525
18526
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
18526
18527
|
const warnings = [];
|
|
18527
18528
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
18528
18529
|
if (!workbookFile) {
|
|
18529
|
-
throw new (0,
|
|
18530
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18530
18531
|
}
|
|
18531
18532
|
let sharedStrings = [];
|
|
18532
18533
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -18535,7 +18536,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18535
18536
|
}
|
|
18536
18537
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
18537
18538
|
if (sheets.length === 0) {
|
|
18538
|
-
throw new (0,
|
|
18539
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18539
18540
|
}
|
|
18540
18541
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
18541
18542
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -18619,7 +18620,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
18619
18620
|
} catch (e33) {
|
|
18620
18621
|
}
|
|
18621
18622
|
}
|
|
18622
|
-
const markdown =
|
|
18623
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
18623
18624
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
18624
18625
|
}
|
|
18625
18626
|
|
|
@@ -19070,11 +19071,11 @@ function processGlobals(records) {
|
|
|
19070
19071
|
const xfFmtIds = [];
|
|
19071
19072
|
const firstBof = records[0];
|
|
19072
19073
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
19073
|
-
throw new (0,
|
|
19074
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
19074
19075
|
}
|
|
19075
19076
|
const bof = decodeBof(firstBof.data);
|
|
19076
19077
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
19077
|
-
throw new (0,
|
|
19078
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
19078
19079
|
}
|
|
19079
19080
|
let i = 1;
|
|
19080
19081
|
while (i < records.length) {
|
|
@@ -19209,7 +19210,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
19209
19210
|
cellRows.push(row);
|
|
19210
19211
|
}
|
|
19211
19212
|
if (cellRows.length > 0) {
|
|
19212
|
-
const table2 =
|
|
19213
|
+
const table2 = _chunkBOATAEXUcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
19213
19214
|
if (table2.rows > 0) {
|
|
19214
19215
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19215
19216
|
}
|
|
@@ -19222,28 +19223,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19222
19223
|
try {
|
|
19223
19224
|
cfb = parseLenientCfb(buf);
|
|
19224
19225
|
} catch (e) {
|
|
19225
|
-
throw new (0,
|
|
19226
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
19226
19227
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
19227
19228
|
);
|
|
19228
19229
|
}
|
|
19229
19230
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
19230
19231
|
if (!wb) {
|
|
19231
|
-
throw new (0,
|
|
19232
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
19232
19233
|
}
|
|
19233
19234
|
const records = readRecords2(wb);
|
|
19234
19235
|
if (records.length === 0) {
|
|
19235
|
-
throw new (0,
|
|
19236
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
19236
19237
|
}
|
|
19237
19238
|
const firstBof = decodeBof(records[0].data);
|
|
19238
19239
|
if (firstBof && firstBof.vers !== 1536) {
|
|
19239
|
-
throw new (0,
|
|
19240
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
19240
19241
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
19241
19242
|
);
|
|
19242
19243
|
}
|
|
19243
19244
|
const globals = processGlobals(records);
|
|
19244
19245
|
const warnings = [];
|
|
19245
19246
|
if (globals.encrypted) {
|
|
19246
|
-
throw new (0,
|
|
19247
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19247
19248
|
}
|
|
19248
19249
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
19249
19250
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -19294,7 +19295,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
19294
19295
|
pageCount: totalSheets
|
|
19295
19296
|
};
|
|
19296
19297
|
return {
|
|
19297
|
-
markdown:
|
|
19298
|
+
markdown: _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
19298
19299
|
blocks: allBlocks,
|
|
19299
19300
|
metadata,
|
|
19300
19301
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19722,7 +19723,7 @@ function getAttr(el, localName3) {
|
|
|
19722
19723
|
return null;
|
|
19723
19724
|
}
|
|
19724
19725
|
function parseXml2(text) {
|
|
19725
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19726
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkISCI5LKNcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19726
19727
|
}
|
|
19727
19728
|
function parseStyles(xml) {
|
|
19728
19729
|
const doc = parseXml2(xml);
|
|
@@ -19880,7 +19881,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19880
19881
|
function makeLink(text, rawHref) {
|
|
19881
19882
|
if (!text) return "";
|
|
19882
19883
|
if (!rawHref) return text;
|
|
19883
|
-
const href =
|
|
19884
|
+
const href = _chunkISCI5LKNcjs.sanitizeHref.call(void 0, rawHref);
|
|
19884
19885
|
return href ? `[${text}](${href})` : text;
|
|
19885
19886
|
}
|
|
19886
19887
|
function collectInline(p, footnotes, rels) {
|
|
@@ -20074,7 +20075,7 @@ ${cell2.text}` : cell2.text;
|
|
|
20074
20075
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
20075
20076
|
})
|
|
20076
20077
|
);
|
|
20077
|
-
const table2 =
|
|
20078
|
+
const table2 = _chunkBOATAEXUcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
20078
20079
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
20079
20080
|
return { type: "table", table: table2 };
|
|
20080
20081
|
}
|
|
@@ -20180,12 +20181,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
20180
20181
|
}
|
|
20181
20182
|
}
|
|
20182
20183
|
async function parseDocxDocument(buffer, options) {
|
|
20183
|
-
|
|
20184
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
20184
20185
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
20185
20186
|
const warnings = [];
|
|
20186
20187
|
const docFile = zip.file("word/document.xml");
|
|
20187
20188
|
if (!docFile) {
|
|
20188
|
-
throw new (0,
|
|
20189
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20189
20190
|
}
|
|
20190
20191
|
let rels = /* @__PURE__ */ new Map();
|
|
20191
20192
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -20232,7 +20233,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
20232
20233
|
const doc = parseXml2(docXml);
|
|
20233
20234
|
const body = findElements(doc, "body");
|
|
20234
20235
|
if (body.length === 0) {
|
|
20235
|
-
throw new (0,
|
|
20236
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20236
20237
|
}
|
|
20237
20238
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
20238
20239
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -20283,7 +20284,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
20283
20284
|
}
|
|
20284
20285
|
}
|
|
20285
20286
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
20286
|
-
const markdown =
|
|
20287
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20287
20288
|
return {
|
|
20288
20289
|
markdown,
|
|
20289
20290
|
blocks,
|
|
@@ -20301,11 +20302,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
20301
20302
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
20302
20303
|
function parseHwpmlDocument(buffer, options) {
|
|
20303
20304
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
20304
|
-
throw new (0,
|
|
20305
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
20305
20306
|
}
|
|
20306
20307
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
20307
20308
|
const normalized = text.replace(/ /g, " ");
|
|
20308
|
-
const xml =
|
|
20309
|
+
const xml = _chunkISCI5LKNcjs.stripDtd.call(void 0, normalized);
|
|
20309
20310
|
const warnings = [];
|
|
20310
20311
|
const parser = new (0, _xmldom.DOMParser)({
|
|
20311
20312
|
onError: (_level, msg2) => {
|
|
@@ -20345,7 +20346,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
20345
20346
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _190 => _190.keepTrailingEmptyCols]), () => ( false)));
|
|
20346
20347
|
}
|
|
20347
20348
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
20348
|
-
const markdown =
|
|
20349
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
20349
20350
|
return {
|
|
20350
20351
|
markdown,
|
|
20351
20352
|
blocks,
|
|
@@ -20510,7 +20511,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
20510
20511
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
20511
20512
|
cellRows[r].push(cell2);
|
|
20512
20513
|
}
|
|
20513
|
-
const table2 =
|
|
20514
|
+
const table2 = _chunkBOATAEXUcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
20514
20515
|
if (structured.length > 0) {
|
|
20515
20516
|
const claimed = /* @__PURE__ */ new Set();
|
|
20516
20517
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -22031,7 +22032,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
22031
22032
|
};
|
|
22032
22033
|
}
|
|
22033
22034
|
async function extractClickHereFields(hwpxBuffer) {
|
|
22034
|
-
|
|
22035
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
22035
22036
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
22036
22037
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
22037
22038
|
const fields = [];
|
|
@@ -22079,19 +22080,19 @@ function parseCentralDirectory(buf) {
|
|
|
22079
22080
|
}
|
|
22080
22081
|
}
|
|
22081
22082
|
}
|
|
22082
|
-
if (eocdOffset < 0) throw new (0,
|
|
22083
|
+
if (eocdOffset < 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
22083
22084
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
22084
22085
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
22085
22086
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
22086
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
22087
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
22087
22088
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
22088
|
-
throw new (0,
|
|
22089
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
22089
22090
|
}
|
|
22090
22091
|
const decoder = new TextDecoder("utf-8");
|
|
22091
22092
|
const entries = [];
|
|
22092
22093
|
let pos = cdOffset;
|
|
22093
22094
|
for (let i = 0; i < totalEntries; i++) {
|
|
22094
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
22095
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
22095
22096
|
const flags = view.getUint16(pos + 8, true);
|
|
22096
22097
|
const method = view.getUint16(pos + 10, true);
|
|
22097
22098
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -22102,7 +22103,7 @@ function parseCentralDirectory(buf) {
|
|
|
22102
22103
|
const commentLen = view.getUint16(pos + 32, true);
|
|
22103
22104
|
const localOffset = view.getUint32(pos + 42, true);
|
|
22104
22105
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
22105
|
-
throw new (0,
|
|
22106
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
22106
22107
|
}
|
|
22107
22108
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
22108
22109
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -22131,11 +22132,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
22131
22132
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
22132
22133
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
22133
22134
|
for (const name of replacements.keys()) {
|
|
22134
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
22135
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkISCI5LKNcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
22135
22136
|
}
|
|
22136
22137
|
if (additions) {
|
|
22137
22138
|
for (const name of additions.keys()) {
|
|
22138
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
22139
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkISCI5LKNcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
22139
22140
|
}
|
|
22140
22141
|
}
|
|
22141
22142
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -22154,7 +22155,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
22154
22155
|
offset += seg.length;
|
|
22155
22156
|
continue;
|
|
22156
22157
|
}
|
|
22157
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
22158
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkISCI5LKNcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
22158
22159
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
22159
22160
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
22160
22161
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -22162,7 +22163,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
22162
22163
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
22163
22164
|
const method = e.method;
|
|
22164
22165
|
if (method !== 0 && method !== 8) {
|
|
22165
|
-
throw new (0,
|
|
22166
|
+
throw new (0, _chunkISCI5LKNcjs.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`);
|
|
22166
22167
|
}
|
|
22167
22168
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
22168
22169
|
const crc = crc32(newData);
|
|
@@ -22260,11 +22261,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
22260
22261
|
// src/form/filler-hwpx.ts
|
|
22261
22262
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
22262
22263
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
22263
|
-
|
|
22264
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
22264
22265
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
22265
22266
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
22266
22267
|
if (sectionPaths.length === 0) {
|
|
22267
|
-
throw new (0,
|
|
22268
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
22268
22269
|
}
|
|
22269
22270
|
const warnings = [];
|
|
22270
22271
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -22577,7 +22578,7 @@ function blocksToPages(blocks) {
|
|
|
22577
22578
|
const pages = [];
|
|
22578
22579
|
for (let pageNumber = min; pageNumber <= max; pageNumber++) {
|
|
22579
22580
|
const pageBlocks = byPage.get(pageNumber);
|
|
22580
|
-
pages.push({ pageNumber, markdown: pageBlocks ?
|
|
22581
|
+
pages.push({ pageNumber, markdown: pageBlocks ? _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, pageBlocks) : "" });
|
|
22581
22582
|
}
|
|
22582
22583
|
return pages;
|
|
22583
22584
|
}
|
|
@@ -23029,7 +23030,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
23029
23030
|
}
|
|
23030
23031
|
function assertFiniteRange(name, value, min, max) {
|
|
23031
23032
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
23032
|
-
throw new (0,
|
|
23033
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
23033
23034
|
}
|
|
23034
23035
|
}
|
|
23035
23036
|
function validateGongmunOptions(opts) {
|
|
@@ -23044,10 +23045,10 @@ function validateGongmunOptions(opts) {
|
|
|
23044
23045
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
23045
23046
|
}
|
|
23046
23047
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
23047
|
-
throw new (0,
|
|
23048
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
23048
23049
|
}
|
|
23049
23050
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
23050
|
-
throw new (0,
|
|
23051
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
23051
23052
|
}
|
|
23052
23053
|
}
|
|
23053
23054
|
if (opts.sizes) {
|
|
@@ -23056,8 +23057,38 @@ function validateGongmunOptions(opts) {
|
|
|
23056
23057
|
}
|
|
23057
23058
|
}
|
|
23058
23059
|
if (opts.approval && opts.approval.length > 6) {
|
|
23059
|
-
throw new (0,
|
|
23060
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("approval must contain at most 6 labels");
|
|
23060
23061
|
}
|
|
23062
|
+
if (opts.levels) {
|
|
23063
|
+
for (const [key, st] of Object.entries(opts.levels)) {
|
|
23064
|
+
const depth = Number(key);
|
|
23065
|
+
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
23066
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
23067
|
+
}
|
|
23068
|
+
if (!st || typeof st !== "object") throw new (0, _chunkISCI5LKNcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
23069
|
+
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
23070
|
+
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
23071
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
23072
|
+
}
|
|
23073
|
+
}
|
|
23074
|
+
}
|
|
23075
|
+
}
|
|
23076
|
+
var GONGMUN_LEVEL_COUNT = 8;
|
|
23077
|
+
function resolveLevels(levels, bodyHeight) {
|
|
23078
|
+
if (!levels) return null;
|
|
23079
|
+
const out = {};
|
|
23080
|
+
for (const [key, st] of Object.entries(levels)) {
|
|
23081
|
+
if (st.font === void 0 && st.pt === void 0 && st.bold === void 0) continue;
|
|
23082
|
+
out[Number(key)] = {
|
|
23083
|
+
font: _optionalChain([st, 'access', _281 => _281.font, 'optionalAccess', _282 => _282.trim, 'call', _283 => _283()]) || null,
|
|
23084
|
+
height: st.pt !== void 0 ? Math.round(st.pt * 100) : bodyHeight,
|
|
23085
|
+
bold: !!st.bold
|
|
23086
|
+
};
|
|
23087
|
+
}
|
|
23088
|
+
return Object.keys(out).length > 0 ? out : null;
|
|
23089
|
+
}
|
|
23090
|
+
function levelMarkerHeight(g, depth) {
|
|
23091
|
+
return _nullishCoalesce(_optionalChain([g, 'access', _284 => _284.levels, 'optionalAccess', _285 => _285[depth], 'optionalAccess', _286 => _286.height]), () => ( g.bodyHeight));
|
|
23061
23092
|
}
|
|
23062
23093
|
function incompatibleGongmunWarnings(opts) {
|
|
23063
23094
|
const warns = [];
|
|
@@ -23102,6 +23133,7 @@ function resolveGongmun(opts) {
|
|
|
23102
23133
|
toc: preset !== "press" && (_nullishCoalesce(opts.toc, () => ( gaejosik))),
|
|
23103
23134
|
fonts: _nullishCoalesce(opts.fonts, () => ( {})),
|
|
23104
23135
|
sizes: _nullishCoalesce(opts.sizes, () => ( {})),
|
|
23136
|
+
levels: resolveLevels(opts.levels, Math.round(bodyPt * 100)),
|
|
23105
23137
|
// 쪽번호 — 보고서 계열 관행(실측: 2_보고서 양식·추진계획·공고문 전부 하단 중앙)
|
|
23106
23138
|
pageNumbers: _nullishCoalesce(opts.pageNumbers, () => ( (gaejosik || preset === "report" || preset === "plan"))),
|
|
23107
23139
|
// 머리말·꼬리말 — 실측: 보고서 계열 15mm(GT3·t2·춘천·브라더), 공고·보도 10mm,
|
|
@@ -23120,7 +23152,7 @@ function resolveGongmun(opts) {
|
|
|
23120
23152
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
23121
23153
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
23122
23154
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
23123
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
23155
|
+
reportInfo: _optionalChain([opts, 'access', _287 => _287.reportInfo, 'optionalAccess', _288 => _288.trim, 'call', _289 => _289()]) || null,
|
|
23124
23156
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
23125
23157
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
23126
23158
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -23160,10 +23192,10 @@ function markerWidth(marker, bodyHeight) {
|
|
|
23160
23192
|
for (const c of marker) em += charWidthEm1000(c.codePointAt(0));
|
|
23161
23193
|
return Math.round(em / 1e3 * bodyHeight);
|
|
23162
23194
|
}
|
|
23163
|
-
function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB", asteriskThird = false) {
|
|
23195
|
+
function levelIndent(depth, bodyHeight, numbering, sizes = {}, bullet2 = "\u25CB", asteriskThird = false, markerHeight = bodyHeight) {
|
|
23164
23196
|
if (numbering === "gaejosik") return gaejosikLevelIndent(depth, bodyHeight, sizes, bullet2);
|
|
23165
23197
|
const marker = numbering === "report" ? reportMarker(depth, bullet2, asteriskThird) : standardMarker(depth, 0);
|
|
23166
|
-
return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker,
|
|
23198
|
+
return { left: Math.round(depth * bodyHeight), indent: -markerWidth(marker, markerHeight) };
|
|
23167
23199
|
}
|
|
23168
23200
|
function computeSuppression(depths) {
|
|
23169
23201
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -23229,16 +23261,16 @@ var PARA_LIST = 7;
|
|
|
23229
23261
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
23230
23262
|
function resolveTheme(theme) {
|
|
23231
23263
|
return {
|
|
23232
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23233
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23234
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23235
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23236
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23237
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23264
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _290 => _290.headingColors, 'optionalAccess', _291 => _291[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
23265
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _292 => _292.headingColors, 'optionalAccess', _293 => _293[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
23266
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _294 => _294.headingColors, 'optionalAccess', _295 => _295[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
23267
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _296 => _296.headingColors, 'optionalAccess', _297 => _297[4]]), () => ( _optionalChain([theme, 'optionalAccess', _298 => _298.headingColors, 'optionalAccess', _299 => _299[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
23268
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _300 => _300.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
23269
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _301 => _301.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
23238
23270
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
23239
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
23240
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
23241
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
23271
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _302 => _302.quoteColor]) !== void 0,
|
|
23272
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _303 => _303.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _304 => _304.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
23273
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _305 => _305.tableHeaderBold])
|
|
23242
23274
|
};
|
|
23243
23275
|
}
|
|
23244
23276
|
function escapeXml(text) {
|
|
@@ -23256,13 +23288,13 @@ function headingCharPrId(level) {
|
|
|
23256
23288
|
if (level === 3) return CHAR_H3;
|
|
23257
23289
|
return CHAR_H4;
|
|
23258
23290
|
}
|
|
23259
|
-
function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR, ratioPct = 100) {
|
|
23291
|
+
function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_COLOR, ratioPct = 100, restFont = fontId) {
|
|
23260
23292
|
const boldAttr = bold ? ` bold="1"` : "";
|
|
23261
23293
|
const italicAttr = italic ? ` italic="1"` : "";
|
|
23262
23294
|
const effFont = fontId;
|
|
23263
23295
|
const boldEl = bold ? `<hh:bold/>` : "";
|
|
23264
23296
|
return ` <hh:charPr id="${id}" height="${height}" textColor="${escapeXml(textColor)}" shadeColor="none" useFontSpace="0" useKerning="0" symMark="NONE" borderFillIDRef="1"${boldAttr}${italicAttr}>
|
|
23265
|
-
<hh:fontRef hangul="${effFont}" latin="${effFont}" hanja="${
|
|
23297
|
+
<hh:fontRef hangul="${effFont}" latin="${effFont}" hanja="${restFont}" japanese="${restFont}" other="${restFont}" symbol="${restFont}" user="${restFont}"/>
|
|
23266
23298
|
<hh:ratio hangul="${ratioPct}" latin="${ratioPct}" hanja="${ratioPct}" japanese="100" other="100" symbol="100" user="100"/>
|
|
23267
23299
|
<hh:spacing hangul="0" latin="0" hanja="0" japanese="0" other="0" symbol="0" user="0"/>
|
|
23268
23300
|
<hh:relSz hangul="100" latin="100" hanja="100" japanese="100" other="100" symbol="100" user="100"/>
|
|
@@ -23618,7 +23650,7 @@ function parseInlineMarkdown(text) {
|
|
|
23618
23650
|
else spans.push(...emphasisSpans(m[0]));
|
|
23619
23651
|
} else {
|
|
23620
23652
|
const anchor = m[2] || m[3];
|
|
23621
|
-
const href = _nullishCoalesce(
|
|
23653
|
+
const href = _nullishCoalesce(_chunkISCI5LKNcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
23622
23654
|
const sub = emphasisSpans(anchor);
|
|
23623
23655
|
if (href) for (const s of sub) s.href = href;
|
|
23624
23656
|
spans.push(...sub);
|
|
@@ -23784,8 +23816,8 @@ function resolvePage(opts) {
|
|
|
23784
23816
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
23785
23817
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
23786
23818
|
columns: cols,
|
|
23787
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
23788
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
23819
|
+
header: _optionalChain([header, 'optionalAccess', _306 => _306.trim, 'call', _307 => _307()]) ? header.trim() : null,
|
|
23820
|
+
footer: _optionalChain([footer, 'optionalAccess', _308 => _308.trim, 'call', _309 => _309()]) ? footer.trim() : null
|
|
23789
23821
|
};
|
|
23790
23822
|
}
|
|
23791
23823
|
function columnColPrXml(columns) {
|
|
@@ -23832,7 +23864,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23832
23864
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23833
23865
|
const got = m ? Number(m[1]) : NaN;
|
|
23834
23866
|
if (got !== startId + i) {
|
|
23835
|
-
throw new (0,
|
|
23867
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
23836
23868
|
`\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)`
|
|
23837
23869
|
);
|
|
23838
23870
|
}
|
|
@@ -23923,7 +23955,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23923
23955
|
}
|
|
23924
23956
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23925
23957
|
if (rows.length !== expectedBase) {
|
|
23926
|
-
throw new (0,
|
|
23958
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
23927
23959
|
`\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`
|
|
23928
23960
|
);
|
|
23929
23961
|
}
|
|
@@ -23978,7 +24010,7 @@ ${base2.join("\n")}
|
|
|
23978
24010
|
];
|
|
23979
24011
|
const listAlign = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? "LEFT" : "JUSTIFY";
|
|
23980
24012
|
for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
|
|
23981
|
-
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
24013
|
+
const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset), levelMarkerHeight(gongmun, d));
|
|
23982
24014
|
const sectionGap = gongmun.numbering === "gaejosik" || gongmun.numbering === "report" ? gaejosikSpaceBefore(d, gongmun.bodyHeight) : 0;
|
|
23983
24015
|
const keepNext = (gongmun.numbering === "gaejosik" || gongmun.numbering === "report") && d === 0;
|
|
23984
24016
|
base.push(paraPr(GONGMUN_LIST_BASE + d, { align: listAlign, lineSpacing: ls, left, indent, spaceBefore: sectionGap, keepWord: true, keepWithNext: keepNext }));
|
|
@@ -24157,7 +24189,7 @@ function buildStyles(gongmun) {
|
|
|
24157
24189
|
</hh:styles>`;
|
|
24158
24190
|
}
|
|
24159
24191
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
24160
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
24192
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _310 => _310.fonts, 'access', _311 => _311.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _312 => _312.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
24161
24193
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
24162
24194
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
24163
24195
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -24286,8 +24318,8 @@ function parseChartFence(text) {
|
|
|
24286
24318
|
const spec = chartSpec(type);
|
|
24287
24319
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
24288
24320
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
24289
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
24290
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
24321
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _313 => _313.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
24322
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _314 => _314[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
24291
24323
|
if (!spec.scatter) {
|
|
24292
24324
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
24293
24325
|
}
|
|
@@ -24329,7 +24361,7 @@ function serSpPr(color, stroke) {
|
|
|
24329
24361
|
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>`;
|
|
24330
24362
|
}
|
|
24331
24363
|
function dPtXml(pointColors, pie) {
|
|
24332
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
24364
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _315 => _315.length])) return "";
|
|
24333
24365
|
return pointColors.map((col, i) => {
|
|
24334
24366
|
const f = chartColorFill(col);
|
|
24335
24367
|
if (!f) return "";
|
|
@@ -24407,6 +24439,7 @@ function computeGongmunFitPlan(blocks, gongmun, gongmunList) {
|
|
|
24407
24439
|
if (block.type === "list_item" && gongmunList.items.has(i)) {
|
|
24408
24440
|
const { marker, depth, indentVariant } = gongmunList.items.get(i);
|
|
24409
24441
|
if (gongmun.numbering === "gaejosik" && (depth === 0 || (block.text || "").trimStart().startsWith("\u203B"))) continue;
|
|
24442
|
+
if (_optionalChain([gongmun, 'access', _316 => _316.levels, 'optionalAccess', _317 => _317[depth]])) continue;
|
|
24410
24443
|
const content = plainRenderText(block.text || "");
|
|
24411
24444
|
text = marker ? `${marker} ${content}` : content;
|
|
24412
24445
|
const li = levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset));
|
|
@@ -24472,8 +24505,9 @@ function precomputeGongmunList(blocks, gongmun) {
|
|
|
24472
24505
|
const variantIdx = /* @__PURE__ */ new Map();
|
|
24473
24506
|
const variantOf = (marker, depth) => {
|
|
24474
24507
|
if (!marker || gongmun.numbering !== "standard") return void 0;
|
|
24475
|
-
const
|
|
24476
|
-
const
|
|
24508
|
+
const h = levelMarkerHeight(gongmun, depth);
|
|
24509
|
+
const w = markerWidth(marker, h);
|
|
24510
|
+
const rep = -levelIndent(depth, gongmun.bodyHeight, gongmun.numbering, gongmun.sizes, gongmun.bullet2, usesAsteriskThird(gongmun.preset), h).indent;
|
|
24477
24511
|
if (w === rep) return void 0;
|
|
24478
24512
|
const key = `${depth}:${w}`;
|
|
24479
24513
|
let vi = variantIdx.get(key);
|
|
@@ -24568,8 +24602,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
24568
24602
|
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 });
|
|
24569
24603
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
24570
24604
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
24571
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24572
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24605
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _318 => _318.cover, 'optionalAccess', _319 => _319.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
24606
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _320 => _320.cover, 'optionalAccess', _321 => _321.org]), () => ( ""));
|
|
24573
24607
|
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>`;
|
|
24574
24608
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
24575
24609
|
return [
|
|
@@ -24825,7 +24859,7 @@ function escapeGfm(text) {
|
|
|
24825
24859
|
}
|
|
24826
24860
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24827
24861
|
function sanitizeText(text) {
|
|
24828
|
-
let result =
|
|
24862
|
+
let result = _chunkBOATAEXUcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24829
24863
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24830
24864
|
const tokens = result.split(" ");
|
|
24831
24865
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24855,7 +24889,7 @@ function replicateGfmTable(table2) {
|
|
|
24855
24889
|
for (let r = 0; r < numRows; r++) {
|
|
24856
24890
|
for (let c = 0; c < numCols; c++) {
|
|
24857
24891
|
if (skip.has(`${r},${c}`)) continue;
|
|
24858
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24892
|
+
const cell2 = _optionalChain([cells, 'access', _322 => _322[r], 'optionalAccess', _323 => _323[c]]);
|
|
24859
24893
|
if (!cell2) continue;
|
|
24860
24894
|
display[r][c] = {
|
|
24861
24895
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -24909,7 +24943,7 @@ function unescapeGfmCell(text) {
|
|
|
24909
24943
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
24910
24944
|
}
|
|
24911
24945
|
function replicateCellInnerHtml(cell2) {
|
|
24912
|
-
if (_optionalChain([cell2, 'access',
|
|
24946
|
+
if (_optionalChain([cell2, 'access', _324 => _324.blocks, 'optionalAccess', _325 => _325.length])) {
|
|
24913
24947
|
return cell2.blocks.map((b) => {
|
|
24914
24948
|
if (b.type === "table" && b.table) {
|
|
24915
24949
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -24948,7 +24982,7 @@ function replicateHtmlTable(table2) {
|
|
|
24948
24982
|
const rowCells = [];
|
|
24949
24983
|
for (let c = 0; c < numCols; c++) {
|
|
24950
24984
|
if (skip.has(`${r},${c}`)) continue;
|
|
24951
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24985
|
+
const cell2 = _optionalChain([cells, 'access', _326 => _326[r], 'optionalAccess', _327 => _327[c]]);
|
|
24952
24986
|
if (!cell2) continue;
|
|
24953
24987
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
24954
24988
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -24994,10 +25028,10 @@ function parseHtmlTable(raw) {
|
|
|
24994
25028
|
}
|
|
24995
25029
|
} else {
|
|
24996
25030
|
if (!isClose) {
|
|
24997
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
24998
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
25031
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _328 => _328.match, 'call', _329 => _329(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _330 => _330[1]]) || "1", 10);
|
|
25032
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _331 => _331.match, 'call', _332 => _332(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _333 => _333[1]]) || "1", 10);
|
|
24999
25033
|
cellStart = m.index + m[0].length;
|
|
25000
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
25034
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkBOATAEXUcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkBOATAEXUcjs.MAX_ROWS) };
|
|
25001
25035
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
25002
25036
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
25003
25037
|
cellStart = -1;
|
|
@@ -25021,7 +25055,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
25021
25055
|
hadNonText = true;
|
|
25022
25056
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
25023
25057
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
25024
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
25058
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _334 => _334[1]]), () => ( _optionalChain([m, 'optionalAccess', _335 => _335[2]])));
|
|
25025
25059
|
if (src) imgSrcs.push(src);
|
|
25026
25060
|
return "";
|
|
25027
25061
|
});
|
|
@@ -25164,7 +25198,7 @@ function edgeXml(tag, d) {
|
|
|
25164
25198
|
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"/>`;
|
|
25165
25199
|
}
|
|
25166
25200
|
function borderFillDefToXml(id, def) {
|
|
25167
|
-
const fill = _optionalChain([def, 'access',
|
|
25201
|
+
const fill = _optionalChain([def, 'access', _336 => _336.fill, 'optionalAccess', _337 => _337.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
25168
25202
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
25169
25203
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
25170
25204
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -25480,7 +25514,7 @@ var ImageRegistry = (_class5 = class {
|
|
|
25480
25514
|
}
|
|
25481
25515
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
25482
25516
|
takeReal(url) {
|
|
25483
|
-
let bytes = _optionalChain([this, 'access',
|
|
25517
|
+
let bytes = _optionalChain([this, 'access', _338 => _338.supplied, 'optionalAccess', _339 => _339.get, 'call', _340 => _340(url)]);
|
|
25484
25518
|
if (!bytes && url.startsWith("data:")) {
|
|
25485
25519
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
25486
25520
|
if (m) {
|
|
@@ -25655,11 +25689,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
25655
25689
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
25656
25690
|
const rowCnt = rows.length;
|
|
25657
25691
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
25658
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25692
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _341 => _341.bfRegistry]), () => ( null));
|
|
25659
25693
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
25660
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25694
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _342 => _342.charHeight]), () => ( 1e3));
|
|
25661
25695
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
25662
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
25696
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _343 => _343[0], 'optionalAccess', _344 => _344[0]]), () => ( ""))), seq, rowAnchor);
|
|
25663
25697
|
const colMax = Array(colCnt).fill(0);
|
|
25664
25698
|
const colMaxBody = Array(colCnt).fill(0);
|
|
25665
25699
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -25687,7 +25721,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25687
25721
|
const k = `${rowIdx},${colIdx}`;
|
|
25688
25722
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
25689
25723
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
25690
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25724
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _345 => _345.cellChar, 'access', _346 => _346.get, 'call', _347 => _347(k)]), () => ( defaultCharPr));
|
|
25691
25725
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
25692
25726
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25693
25727
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -25705,11 +25739,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25705
25739
|
}
|
|
25706
25740
|
}
|
|
25707
25741
|
}
|
|
25708
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
25742
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _348 => _348.cellChar, 'access', _349 => _349.has, 'call', _350 => _350(k)]) ? void 0 : mapId);
|
|
25709
25743
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
25710
25744
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
25711
25745
|
}).join("");
|
|
25712
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25746
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _351 => _351.cellBf, 'access', _352 => _352.get, 'call', _353 => _353(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25713
25747
|
row: rowIdx,
|
|
25714
25748
|
rowEnd: rowIdx,
|
|
25715
25749
|
col: colIdx,
|
|
@@ -25719,7 +25753,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25719
25753
|
headerRows: 1,
|
|
25720
25754
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
25721
25755
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
25722
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25756
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _354 => _354.cellH, 'access', _355 => _355.get, 'call', _356 => _356(k)]), () => ( cellH));
|
|
25723
25757
|
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>`;
|
|
25724
25758
|
}).join("");
|
|
25725
25759
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -25728,7 +25762,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25728
25762
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
25729
25763
|
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;
|
|
25730
25764
|
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>`;
|
|
25731
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
25765
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _357 => _357.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
25732
25766
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
25733
25767
|
}
|
|
25734
25768
|
function layoutHtmlRows(rows) {
|
|
@@ -25739,8 +25773,8 @@ function layoutHtmlRows(rows) {
|
|
|
25739
25773
|
let c = 0;
|
|
25740
25774
|
for (const cell2 of rows[r].cells) {
|
|
25741
25775
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25742
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25743
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25776
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkBOATAEXUcjs.MAX_COLS);
|
|
25777
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkBOATAEXUcjs.MAX_ROWS);
|
|
25744
25778
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25745
25779
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25746
25780
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25768,7 +25802,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25768
25802
|
if (!rows || rows.length === 0) return null;
|
|
25769
25803
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
25770
25804
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
25771
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25805
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _358 => _358.charHeight]), () => ( 1e3));
|
|
25772
25806
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
25773
25807
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
25774
25808
|
for (const cell2 of placed) {
|
|
@@ -25797,7 +25831,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25797
25831
|
const tblId = nextTableId();
|
|
25798
25832
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
25799
25833
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
25800
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25834
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _359 => _359.bfRegistry]), () => ( null));
|
|
25801
25835
|
let htmlHeaderRows = 0;
|
|
25802
25836
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
25803
25837
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -25811,7 +25845,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25811
25845
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
25812
25846
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
25813
25847
|
if (nestedXml) {
|
|
25814
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
25848
|
+
const szH = _optionalChain([nestedXml, 'access', _360 => _360.match, 'call', _361 => _361(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _362 => _362[1]]);
|
|
25815
25849
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
25816
25850
|
}
|
|
25817
25851
|
return nestedXml;
|
|
@@ -25822,7 +25856,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25822
25856
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
25823
25857
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
25824
25858
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
25825
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25859
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _363 => _363.cellH, 'access', _364 => _364.get, 'call', _365 => _365(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
25826
25860
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
25827
25861
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
25828
25862
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -25833,7 +25867,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25833
25867
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
25834
25868
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
25835
25869
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
25836
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25870
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _366 => _366.cellChar, 'access', _367 => _367.get, 'call', _368 => _368(k)]), () => ( defaultCharPr));
|
|
25837
25871
|
const centered = isHeader || colCentered[cell2.c];
|
|
25838
25872
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25839
25873
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -25873,7 +25907,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25873
25907
|
let cellHeight = 0;
|
|
25874
25908
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
25875
25909
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
25876
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25910
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _369 => _369.cellBf, 'access', _370 => _370.get, 'call', _371 => _371(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25877
25911
|
row: cell2.r,
|
|
25878
25912
|
rowEnd,
|
|
25879
25913
|
col: cell2.c,
|
|
@@ -26002,7 +26036,7 @@ function isInternalApproval(to) {
|
|
|
26002
26036
|
function buildDocFoot(g, ids) {
|
|
26003
26037
|
const f = g.docFoot;
|
|
26004
26038
|
const out = [blank()];
|
|
26005
|
-
if (f.sender && !isInternalApproval(_optionalChain([g, 'access',
|
|
26039
|
+
if (f.sender && !isInternalApproval(_optionalChain([g, 'access', _372 => _372.docHead, 'optionalAccess', _373 => _373.to]))) {
|
|
26006
26040
|
out.push(para(f.sender, GONGMUN_CENTER, ids.sender), blank());
|
|
26007
26041
|
}
|
|
26008
26042
|
const foot = (text) => para(text, GONGMUN_TBL_LEFT, ids.foot);
|
|
@@ -26046,7 +26080,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
26046
26080
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
26047
26081
|
}
|
|
26048
26082
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
26049
|
-
const c = _optionalChain([g, 'access',
|
|
26083
|
+
const c = _optionalChain([g, 'access', _374 => _374.press, 'optionalAccess', _375 => _375.contact]);
|
|
26050
26084
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
26051
26085
|
const w = bodyWidth - 280;
|
|
26052
26086
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -26425,10 +26459,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
26425
26459
|
m.header = gongmun.headerFooter;
|
|
26426
26460
|
m.footer = gongmun.headerFooter;
|
|
26427
26461
|
}
|
|
26428
|
-
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',
|
|
26429
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
26430
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
26431
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
26462
|
+
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', _376 => _376.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _377 => _377.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _378 => _378.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>`;
|
|
26463
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _379 => _379.columns]), () => ( 1)));
|
|
26464
|
+
const hf = (_optionalChain([page, 'optionalAccess', _380 => _380.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _381 => _381.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
26465
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _382 => _382.pageNumbers]) ? pageNumCtrl() : "");
|
|
26432
26466
|
}
|
|
26433
26467
|
var SectionOpener = (_class6 = class {
|
|
26434
26468
|
constructor(gongmun, page = null) {;_class6.prototype.__init13.call(this);
|
|
@@ -26468,19 +26502,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
26468
26502
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
26469
26503
|
const preamble = [];
|
|
26470
26504
|
let hasFrontPages = false;
|
|
26471
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26505
|
+
if (_optionalChain([gongmun, 'optionalAccess', _383 => _383.reportInfo]) && dfIds) {
|
|
26472
26506
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
26473
26507
|
}
|
|
26474
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26508
|
+
if (_optionalChain([gongmun, 'optionalAccess', _384 => _384.approval]) && bfReg) {
|
|
26475
26509
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
26476
26510
|
}
|
|
26477
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26511
|
+
if (_optionalChain([gongmun, 'optionalAccess', _385 => _385.docHead]) && dfIds) {
|
|
26478
26512
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
26479
26513
|
}
|
|
26480
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26514
|
+
if (_optionalChain([gongmun, 'optionalAccess', _386 => _386.noticeHead]) && dfIds) {
|
|
26481
26515
|
preamble.push(...buildNoticeHead(gongmun));
|
|
26482
26516
|
}
|
|
26483
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26517
|
+
if (_optionalChain([gongmun, 'optionalAccess', _387 => _387.press]) && dfIds && bfReg && tableStyle) {
|
|
26484
26518
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
26485
26519
|
}
|
|
26486
26520
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -26509,7 +26543,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
26509
26543
|
}
|
|
26510
26544
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
26511
26545
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
26512
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
26546
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _388 => _388.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
26513
26547
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
26514
26548
|
}
|
|
26515
26549
|
if (preamble.length > 0) {
|
|
@@ -26524,7 +26558,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
26524
26558
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
26525
26559
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
26526
26560
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
26527
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
26561
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _389 => _389.press, 'optionalAccess', _390 => _390.sub]), () => ( []))) {
|
|
26528
26562
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
26529
26563
|
}
|
|
26530
26564
|
return parts.join("\n ");
|
|
@@ -26628,8 +26662,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
26628
26662
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
26629
26663
|
if (gongmun && gongmunList) {
|
|
26630
26664
|
const info = gongmunList.items.get(blockIdx);
|
|
26631
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26632
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26665
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _391 => _391.depth]), () => ( 0));
|
|
26666
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _392 => _392.marker]), () => ( ""));
|
|
26633
26667
|
const content = block.text || "";
|
|
26634
26668
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
26635
26669
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -26638,7 +26672,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
26638
26672
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
26639
26673
|
}
|
|
26640
26674
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
26641
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
26675
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _393 => _393.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
26642
26676
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
26643
26677
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
26644
26678
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -26652,6 +26686,11 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
26652
26686
|
mapId = void 0;
|
|
26653
26687
|
}
|
|
26654
26688
|
}
|
|
26689
|
+
const lv = _optionalChain([ctx, 'access', _394 => _394.levelIds, 'optionalAccess', _395 => _395[depth]]);
|
|
26690
|
+
if (lv) {
|
|
26691
|
+
listCharPr = lv.normal;
|
|
26692
|
+
mapId = (id) => id === CHAR_BOLD ? lv.bold : id === CHAR_NORMAL ? lv.normal : id;
|
|
26693
|
+
}
|
|
26655
26694
|
return generateParagraph(text, listParaPr, listCharPr, mapId);
|
|
26656
26695
|
}
|
|
26657
26696
|
const indent = block.indent || 0;
|
|
@@ -26697,22 +26736,22 @@ function renderHtmlTable(block, ctx) {
|
|
|
26697
26736
|
}
|
|
26698
26737
|
function appendPostamble(blocks, ctx) {
|
|
26699
26738
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
26700
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26739
|
+
if (_optionalChain([gongmun, 'optionalAccess', _396 => _396.noticeHead]) && dfIds) {
|
|
26701
26740
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
26702
26741
|
}
|
|
26703
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26704
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
26742
|
+
if (_optionalChain([gongmun, 'optionalAccess', _397 => _397.endMark]) && paraXmls.length > 0) {
|
|
26743
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _398 => _398.rows, 'optionalAccess', _399 => _399.length]));
|
|
26705
26744
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
26706
26745
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
26707
26746
|
}
|
|
26708
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26747
|
+
if (_optionalChain([gongmun, 'optionalAccess', _400 => _400.docFoot]) && dfIds) {
|
|
26709
26748
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
26710
26749
|
}
|
|
26711
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26750
|
+
if (_optionalChain([gongmun, 'optionalAccess', _401 => _401.press]) && dfIds && bfReg && tableStyle) {
|
|
26712
26751
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
26713
26752
|
}
|
|
26714
26753
|
}
|
|
26715
|
-
function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null, dfIds = null, images = null, page = null) {
|
|
26754
|
+
function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null, fit = null, chartParts = null, bfReg = null, remap = null, dfIds = null, images = null, page = null, levelIds = null) {
|
|
26716
26755
|
resetTableIds();
|
|
26717
26756
|
resetGjTableIds();
|
|
26718
26757
|
resetExtraTableIds();
|
|
@@ -26728,7 +26767,8 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26728
26767
|
remap,
|
|
26729
26768
|
dfIds,
|
|
26730
26769
|
images,
|
|
26731
|
-
|
|
26770
|
+
levelIds,
|
|
26771
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _402 => _402.preset]) === "gaejosik",
|
|
26732
26772
|
measured,
|
|
26733
26773
|
richAssets,
|
|
26734
26774
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -26832,11 +26872,46 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26832
26872
|
</hs:sec>`;
|
|
26833
26873
|
}
|
|
26834
26874
|
|
|
26875
|
+
// src/hwpx/gen-levels.ts
|
|
26876
|
+
function levelDepths(g) {
|
|
26877
|
+
return g.levels ? Object.keys(g.levels).map(Number).sort((a, b) => a - b) : [];
|
|
26878
|
+
}
|
|
26879
|
+
function levelFontFaces(g) {
|
|
26880
|
+
const out = [];
|
|
26881
|
+
for (const d of levelDepths(g)) {
|
|
26882
|
+
const f = g.levels[d].font;
|
|
26883
|
+
if (f && !out.includes(f)) out.push(f);
|
|
26884
|
+
}
|
|
26885
|
+
return out;
|
|
26886
|
+
}
|
|
26887
|
+
function levelCharIds(g, base) {
|
|
26888
|
+
const depths = levelDepths(g);
|
|
26889
|
+
if (depths.length === 0) return null;
|
|
26890
|
+
const ids = {};
|
|
26891
|
+
depths.forEach((d, i) => {
|
|
26892
|
+
ids[d] = { normal: base + i * 2, bold: base + i * 2 + 1 };
|
|
26893
|
+
});
|
|
26894
|
+
return ids;
|
|
26895
|
+
}
|
|
26896
|
+
function levelCharPrXmls(g, base, fontBase, bodyFontId) {
|
|
26897
|
+
const ids = levelCharIds(g, base);
|
|
26898
|
+
if (!ids) return [];
|
|
26899
|
+
const faces = levelFontFaces(g);
|
|
26900
|
+
const out = [];
|
|
26901
|
+
for (const d of levelDepths(g)) {
|
|
26902
|
+
const st = g.levels[d];
|
|
26903
|
+
const fontId = st.font ? fontBase + faces.indexOf(st.font) : bodyFontId;
|
|
26904
|
+
out.push(charPr(ids[d].normal, st.height, st.bold, false, fontId, void 0, GONGMUN_BODY_RATIO, bodyFontId));
|
|
26905
|
+
out.push(charPr(ids[d].bold, st.height, true, false, fontId, void 0, GONGMUN_BODY_RATIO, bodyFontId));
|
|
26906
|
+
}
|
|
26907
|
+
return out;
|
|
26908
|
+
}
|
|
26909
|
+
|
|
26835
26910
|
// src/hwpx/generator.ts
|
|
26836
26911
|
async function markdownToHwpx(markdown, options) {
|
|
26837
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
26838
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
26839
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
26912
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _403 => _403.theme]));
|
|
26913
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _404 => _404.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
26914
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _405 => _405.page]));
|
|
26840
26915
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
26841
26916
|
beginInlineDoc(defs);
|
|
26842
26917
|
try {
|
|
@@ -26846,22 +26921,27 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26846
26921
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
26847
26922
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
26848
26923
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
26849
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
26850
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26924
|
+
const remap = _optionalChain([options, 'optionalAccess', _406 => _406.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _407 => _407.variants, 'optionalAccess', _408 => _408.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
26925
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _409 => _409.borderFillXmls, 'access', _410 => _410.length]), () => ( 0)))) : null;
|
|
26851
26926
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
26852
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26927
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _411 => _411.variants, 'optionalAccess', _412 => _412.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _413 => _413.charPrXmls, 'access', _414 => _414.length]), () => ( 0)));
|
|
26853
26928
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
26929
|
+
const dfXmls = dfActive ? docframeCharPrXmls(dfBase, richAssets) : [];
|
|
26930
|
+
const lvBase = dfBase + dfXmls.length;
|
|
26931
|
+
const lvIds = gongmun ? levelCharIds(gongmun, lvBase) : null;
|
|
26932
|
+
const lvFonts = gongmun ? levelFontFaces(gongmun) : [];
|
|
26933
|
+
const lvXmls = gongmun ? levelCharPrXmls(gongmun, lvBase, staticFontNext(gongmun) + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _415 => _415.fontFaces, 'access', _416 => _416.length]), () => ( 0))), richAssets ? 4 : 0) : [];
|
|
26854
26934
|
const chartParts = [];
|
|
26855
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
26935
|
+
const supplied = _optionalChain([options, 'optionalAccess', _417 => _417.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
26856
26936
|
const images = new ImageRegistry(supplied);
|
|
26857
|
-
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page);
|
|
26937
|
+
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page, lvIds);
|
|
26858
26938
|
if (remap && remap.tables.length > 0) {
|
|
26859
26939
|
const unused = remap.tables.filter((t) => !t.used).length;
|
|
26860
26940
|
if (unused === remap.tables.length) {
|
|
26861
26941
|
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)`);
|
|
26862
26942
|
}
|
|
26863
26943
|
}
|
|
26864
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26944
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _418 => _418.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _419 => _419.emit, 'call', _420 => _420()]), () => ( []))];
|
|
26865
26945
|
const zip = new (0, _jszip2.default)();
|
|
26866
26946
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
26867
26947
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -26870,11 +26950,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26870
26950
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
26871
26951
|
theme,
|
|
26872
26952
|
gongmun,
|
|
26873
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26953
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _421 => _421.variants]), () => ( [])),
|
|
26874
26954
|
extraBorderFills,
|
|
26875
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26876
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
26877
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26955
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _422 => _422.charPrXmls]), () => ( [])), ...dfXmls, ...lvXmls],
|
|
26956
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _423 => _423.indentVariants]), () => ( [])),
|
|
26957
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _424 => _424.fontFaces]), () => ( [])), ...lvFonts]
|
|
26878
26958
|
));
|
|
26879
26959
|
zip.file("Contents/section0.xml", sectionXml);
|
|
26880
26960
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -26928,7 +27008,7 @@ function alignBlocks(a, b) {
|
|
|
26928
27008
|
const m = a.length, n = b.length;
|
|
26929
27009
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
26930
27010
|
const lenOf = (blk) => {
|
|
26931
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
27011
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _425 => _425.text]), () => ( ""))).join(" ") : "";
|
|
26932
27012
|
return t.replace(/\s+/g, " ").trim().length;
|
|
26933
27013
|
};
|
|
26934
27014
|
const aLen = a.map(lenOf);
|
|
@@ -27001,8 +27081,8 @@ function blockSimilarity(a, b) {
|
|
|
27001
27081
|
}
|
|
27002
27082
|
function tableSimilarity(a, b) {
|
|
27003
27083
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
27004
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
27005
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
27084
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _426 => _426.text]), () => ( ""))).join(" ");
|
|
27085
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _427 => _427.text]), () => ( ""))).join(" ");
|
|
27006
27086
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
27007
27087
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
27008
27088
|
}
|
|
@@ -27013,8 +27093,8 @@ function diffTableCells(a, b) {
|
|
|
27013
27093
|
for (let r = 0; r < maxRows; r++) {
|
|
27014
27094
|
const row = [];
|
|
27015
27095
|
for (let c = 0; c < maxCols; c++) {
|
|
27016
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
27017
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
27096
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _428 => _428.cells, 'access', _429 => _429[r], 'optionalAccess', _430 => _430[c], 'optionalAccess', _431 => _431.text]) : void 0;
|
|
27097
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _432 => _432.cells, 'access', _433 => _433[r], 'optionalAccess', _434 => _434[c], 'optionalAccess', _435 => _435.text]) : void 0;
|
|
27018
27098
|
let type;
|
|
27019
27099
|
if (cellA === void 0) type = "added";
|
|
27020
27100
|
else if (cellB === void 0) type = "removed";
|
|
@@ -27064,7 +27144,7 @@ function builtinTemplateDir() {
|
|
|
27064
27144
|
for (const c of candidates) {
|
|
27065
27145
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
27066
27146
|
}
|
|
27067
|
-
throw new (0,
|
|
27147
|
+
throw new (0, _chunkISCI5LKNcjs.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)");
|
|
27068
27148
|
}
|
|
27069
27149
|
function readBuiltinTemplate(t) {
|
|
27070
27150
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -27227,7 +27307,7 @@ function parseRenderStyles(headXml) {
|
|
|
27227
27307
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
27228
27308
|
const textColor = el.getAttribute("textColor");
|
|
27229
27309
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
27230
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
27310
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _436 => _436.getAttribute, 'call', _437 => _437("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _438 => _438.getAttribute, 'call', _439 => _439("latin")])));
|
|
27231
27311
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
27232
27312
|
styles.charPr.set(id, {
|
|
27233
27313
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -27235,8 +27315,8 @@ function parseRenderStyles(headXml) {
|
|
|
27235
27315
|
italic: findChildByLocalName(el, "italic") != null,
|
|
27236
27316
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
27237
27317
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
27238
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
27239
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
27318
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _440 => _440.getAttribute, 'call', _441 => _441("hangul")])) || 100,
|
|
27319
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _442 => _442.getAttribute, 'call', _443 => _443("hangul")])) || 0,
|
|
27240
27320
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
27241
27321
|
face
|
|
27242
27322
|
});
|
|
@@ -27245,7 +27325,7 @@ function parseRenderStyles(headXml) {
|
|
|
27245
27325
|
const id = el.getAttribute("id");
|
|
27246
27326
|
if (id != null) {
|
|
27247
27327
|
const align = findChildByLocalName(el, "align");
|
|
27248
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
27328
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _444 => _444.getAttribute, 'call', _445 => _445("horizontal")]) || "JUSTIFY");
|
|
27249
27329
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
27250
27330
|
}
|
|
27251
27331
|
} else if (tag === "borderFill") {
|
|
@@ -27259,7 +27339,7 @@ function parseRenderStyles(headXml) {
|
|
|
27259
27339
|
};
|
|
27260
27340
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
27261
27341
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
27262
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
27342
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _446 => _446.getAttribute, 'call', _447 => _447("faceColor")]);
|
|
27263
27343
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
27264
27344
|
styles.borderFill.set(id, bf);
|
|
27265
27345
|
}
|
|
@@ -27331,7 +27411,7 @@ function collectSites(scan) {
|
|
|
27331
27411
|
}
|
|
27332
27412
|
function attrOf3(openTag, name) {
|
|
27333
27413
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
27334
|
-
return _optionalChain([m, 'optionalAccess',
|
|
27414
|
+
return _optionalChain([m, 'optionalAccess', _448 => _448[1]]);
|
|
27335
27415
|
}
|
|
27336
27416
|
function paraOpenTag(xml, para2) {
|
|
27337
27417
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -27346,7 +27426,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
27346
27426
|
if (!tr) return null;
|
|
27347
27427
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
27348
27428
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
27349
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
27429
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _449 => _449[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
27350
27430
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
27351
27431
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
27352
27432
|
if (close === -1) return null;
|
|
@@ -27373,7 +27453,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
27373
27453
|
if (width === null) return null;
|
|
27374
27454
|
let content = width;
|
|
27375
27455
|
const win = cellAddrWindow(xml, cell2);
|
|
27376
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
27456
|
+
const mg = _optionalChain([win, 'optionalAccess', _450 => _450.match, 'call', _451 => _451(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
27377
27457
|
if (mg) {
|
|
27378
27458
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
27379
27459
|
}
|
|
@@ -27407,12 +27487,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
27407
27487
|
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>`;
|
|
27408
27488
|
}
|
|
27409
27489
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
27410
|
-
if (ops.length === 0) throw new (0,
|
|
27490
|
+
if (ops.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27411
27491
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
27412
|
-
|
|
27492
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
27413
27493
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
27414
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27415
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
27494
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _452 => _452.match, 'call', _453 => _453(/(\d+)\.xml$/i), 'optionalAccess', _454 => _454[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _455 => _455.match, 'call', _456 => _456(/(\d+)\.xml$/i), 'optionalAccess', _457 => _457[1]]), () => ( 0))));
|
|
27495
|
+
if (sectionPaths.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
27416
27496
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
27417
27497
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
27418
27498
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -27453,11 +27533,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27453
27533
|
const manifestItems = [];
|
|
27454
27534
|
const placed = [];
|
|
27455
27535
|
for (const op of ops) {
|
|
27456
|
-
if (!op.anchor) throw new (0,
|
|
27457
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27536
|
+
if (!op.anchor) throw new (0, _chunkISCI5LKNcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27537
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27458
27538
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
27459
|
-
if (!MIME[ext]) throw new (0,
|
|
27460
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27539
|
+
if (!MIME[ext]) throw new (0, _chunkISCI5LKNcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27540
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkISCI5LKNcjs.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)`);
|
|
27461
27541
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
27462
27542
|
let found = null;
|
|
27463
27543
|
let total = 0;
|
|
@@ -27490,7 +27570,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27490
27570
|
}
|
|
27491
27571
|
}
|
|
27492
27572
|
}
|
|
27493
|
-
throw new (0,
|
|
27573
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
27494
27574
|
`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)})`
|
|
27495
27575
|
);
|
|
27496
27576
|
}
|
|
@@ -27498,9 +27578,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27498
27578
|
const xml = sectionXmls[si];
|
|
27499
27579
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
27500
27580
|
if (!run) {
|
|
27501
|
-
throw new (0,
|
|
27581
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
27502
27582
|
}
|
|
27503
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
27583
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _458 => _458.charPr, 'access', _459 => _459.get, 'call', _460 => _460(run.charPr), 'optionalAccess', _461 => _461.height]), () => ( 1e3));
|
|
27504
27584
|
const fontPt = charPrHeight / 100;
|
|
27505
27585
|
const emMm = fontPt * 25.4 / 72;
|
|
27506
27586
|
const lineHMm = emMm;
|
|
@@ -27509,7 +27589,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
27509
27589
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
27510
27590
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
27511
27591
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
27512
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
27592
|
+
const align = _optionalChain([styles, 'optionalAccess', _462 => _462.paraAlign, 'access', _463 => _463.get, 'call', _464 => _464(paraPrId)]);
|
|
27513
27593
|
let alignShiftMm = 0;
|
|
27514
27594
|
if (align === "CENTER" || align === "RIGHT") {
|
|
27515
27595
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -27605,7 +27685,7 @@ function parseBorderFills(headerDoc) {
|
|
|
27605
27685
|
};
|
|
27606
27686
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
27607
27687
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
27608
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
27688
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _465 => _465.getAttribute, 'call', _466 => _466("faceColor")]);
|
|
27609
27689
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
27610
27690
|
map.set(id, def);
|
|
27611
27691
|
}
|
|
@@ -27637,7 +27717,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
27637
27717
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
27638
27718
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
27639
27719
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
27640
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
27720
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _467 => _467.getAttribute, 'call', _468 => _468("hangul")]);
|
|
27641
27721
|
if (hangul) {
|
|
27642
27722
|
def.fontRef_hangul = hangul;
|
|
27643
27723
|
const face = hangulFonts.get(hangul);
|
|
@@ -27665,7 +27745,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
27665
27745
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
27666
27746
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
27667
27747
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
27668
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
27748
|
+
const width = _optionalChain([sz, 'optionalAccess', _469 => _469.getAttribute, 'call', _470 => _470("width")]) || void 0;
|
|
27669
27749
|
const cells = [];
|
|
27670
27750
|
const usedBf = /* @__PURE__ */ new Set();
|
|
27671
27751
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -27678,17 +27758,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
27678
27758
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
27679
27759
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
27680
27760
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
27681
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27682
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27761
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _471 => _471.getAttribute, 'call', _472 => _472("rowAddr")])), () => ( 0));
|
|
27762
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _473 => _473.getAttribute, 'call', _474 => _474("colAddr")])), () => ( 0));
|
|
27683
27763
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
27684
27764
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
27685
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27686
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27765
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _475 => _475.getAttribute, 'call', _476 => _476("colSpan")])), () => ( 1));
|
|
27766
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _477 => _477.getAttribute, 'call', _478 => _478("rowSpan")])), () => ( 1));
|
|
27687
27767
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
27688
27768
|
const cpId = firstRunCharPr(tc2);
|
|
27689
27769
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
27690
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
27691
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
27770
|
+
const w = _optionalChain([csz, 'optionalAccess', _479 => _479.getAttribute, 'call', _480 => _480("width")]);
|
|
27771
|
+
const hh = _optionalChain([csz, 'optionalAccess', _481 => _481.getAttribute, 'call', _482 => _482("height")]);
|
|
27692
27772
|
if (w) cell2.width_hwpunit = w;
|
|
27693
27773
|
if (hh) cell2.height_hwpunit = hh;
|
|
27694
27774
|
if (bfId) {
|
|
@@ -27776,16 +27856,16 @@ function pick(map, keys) {
|
|
|
27776
27856
|
return out;
|
|
27777
27857
|
}
|
|
27778
27858
|
async function hwpxToProfile(input) {
|
|
27779
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27859
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkISCI5LKNcjs.toArrayBuffer.call(void 0, input);
|
|
27780
27860
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27781
27861
|
const parser = createXmlParser();
|
|
27782
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
27862
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _483 => _483.file, 'call', _484 => _484(/[Hh]eader\.xml$/), 'optionalAccess', _485 => _485[0]])));
|
|
27783
27863
|
let headerXml = "<root/>";
|
|
27784
27864
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
27785
27865
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
27786
27866
|
const borderFills = parseBorderFills(headerDoc);
|
|
27787
27867
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
27788
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27868
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _486 => _486.name, 'access', _487 => _487.match, 'call', _488 => _488(/(\d+)\.xml$/), 'optionalAccess', _489 => _489[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _490 => _490.name, 'access', _491 => _491.match, 'call', _492 => _492(/(\d+)\.xml$/), 'optionalAccess', _493 => _493[1]]), () => ( null))), () => ( 0))));
|
|
27789
27869
|
const tables = [];
|
|
27790
27870
|
let tableIndex = 0;
|
|
27791
27871
|
for (const f of sectionFiles) {
|
|
@@ -28026,10 +28106,12 @@ var DISCRIM_FIXES = [
|
|
|
28026
28106
|
var DISCRIM_RE = new RegExp(DISCRIM_FIXES.map(([w]) => w).sort((a, b) => b.length - a.length).join("|"), "g");
|
|
28027
28107
|
var RULES = [
|
|
28028
28108
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
28109
|
+
// 법령 연혁 표기 `<개정 2012.2.14>`·`삭제 <2016.2.29.>`·`[시행일:2017.9.8.]` 는 법제처 정본 형식(별지서식 표제) —
|
|
28110
|
+
// 편람 날짜 규칙 대상이 아니다 (v4.12.3: 서식 595건 DATE 156건 전부 이 꼴, 기안문 0건)
|
|
28029
28111
|
{
|
|
28030
28112
|
code: "DATE_NO_SPACE",
|
|
28031
28113
|
severity: "error",
|
|
28032
|
-
pattern:
|
|
28114
|
+
pattern: /(?<!<(?:개정|신설|전문개정|전부개정|일부개정|제정)\s*)(?<!삭제\s*<)(?<!시행일\s*:\s*)\b\d{4}\.\d{1,2}\.\d{1,2}\.?/g,
|
|
28033
28115
|
message: "\uB0A0\uC9DC \uC628\uC810 \uB4A4\uC5D0 \uD55C \uCE78\uC529 \uB744\uC6CC\uC57C \uD568",
|
|
28034
28116
|
suggest: "\uC608) 2025. 1. 6."
|
|
28035
28117
|
},
|
|
@@ -28115,10 +28197,15 @@ var RULES = [
|
|
|
28115
28197
|
suggest: "\uC608) \uC5C5\uBB34 \uD611\uC57D(MOU)"
|
|
28116
28198
|
},
|
|
28117
28199
|
// 쌍점 — URL(https:// 등)·시각(13:20)은 제외
|
|
28200
|
+
// 편람: 쌍점은 앞말에 붙이고 뒤는 1타(원장: 김갑동). 표 셀은 제외(skipTable) — 법정 별지서식
|
|
28201
|
+
// 자체가 "성 명 :"·"주 소 :" 라벨 셀을 쓰므로 서식 라벨은 이 규칙의 대상이 아니다(v4.12.3 실측:
|
|
28202
|
+
// 서식 595건의 표 셀 801건 전부 라벨, 기안문 206건은 본문 414건이 "일 시 : 값" 꼴 — 편람상 위반).
|
|
28203
|
+
// 뒤 글자에서 `<`(HTML 태그)·`*`·`_`(마크다운 강조 닫힘)는 제외 — "성명:</td>"·"과정:** 붙임" 오탐
|
|
28118
28204
|
{
|
|
28119
28205
|
code: "COLON_SPACE",
|
|
28120
28206
|
severity: "warning",
|
|
28121
|
-
|
|
28207
|
+
skipTable: true,
|
|
28208
|
+
pattern: /\S\s+:(?!\/\/)|\S:(?!\/\/)[^\s\d<*_]/g,
|
|
28122
28209
|
message: "\uC30D\uC810\uC740 \uC55E\uB9D0\uC5D0 \uBD99\uC774\uACE0 \uB4A4\uB294 \uD55C \uCE78 \uB744\uC6C0",
|
|
28123
28210
|
suggest: "\uC608) \uC6D0\uC7A5: \uAE40\uAC11\uB3D9"
|
|
28124
28211
|
},
|
|
@@ -28198,7 +28285,9 @@ function lintGongmunText(text, opts) {
|
|
|
28198
28285
|
continue;
|
|
28199
28286
|
}
|
|
28200
28287
|
if (fenceMarker !== null) continue;
|
|
28288
|
+
const tableLine = /^\s*\|/.test(line) || /<t[dhr][\s>]/i.test(line);
|
|
28201
28289
|
for (const r of RULES) {
|
|
28290
|
+
if (r.skipTable && tableLine) continue;
|
|
28202
28291
|
r.pattern.lastIndex = 0;
|
|
28203
28292
|
for (const m of line.matchAll(r.pattern)) {
|
|
28204
28293
|
findings.push({
|
|
@@ -28212,7 +28301,7 @@ function lintGongmunText(text, opts) {
|
|
|
28212
28301
|
}
|
|
28213
28302
|
}
|
|
28214
28303
|
}
|
|
28215
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
28304
|
+
if (_optionalChain([opts, 'optionalAccess', _494 => _494.document]) && /^\s*붙\s*임(?![가-힣])/m.test(text) && !/끝\.\s*$/m.test(text)) {
|
|
28216
28305
|
findings.push({
|
|
28217
28306
|
line: lines.length,
|
|
28218
28307
|
match: "\uBD99\uC784",
|
|
@@ -28474,7 +28563,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
28474
28563
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
28475
28564
|
function patchTableRows(input) {
|
|
28476
28565
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
28477
|
-
const xml = _optionalChain([ctx, 'access',
|
|
28566
|
+
const xml = _optionalChain([ctx, 'access', _495 => _495.scans, 'access', _496 => _496[scanTable.sectionIndex], 'optionalAccess', _497 => _497.xml]);
|
|
28478
28567
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
28479
28568
|
const numRows = table2.rows;
|
|
28480
28569
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -28641,7 +28730,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
28641
28730
|
const rr = scanTable.rowRanges[template];
|
|
28642
28731
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
28643
28732
|
const scan = scanSectionXml(wrapped, 0);
|
|
28644
|
-
const row = _optionalChain([scan, 'access',
|
|
28733
|
+
const row = _optionalChain([scan, 'access', _498 => _498.tables, 'access', _499 => _499[0], 'optionalAccess', _500 => _500.rows, 'access', _501 => _501[0]]);
|
|
28645
28734
|
if (!row || row.length !== cells.length) return null;
|
|
28646
28735
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
28647
28736
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -28684,7 +28773,7 @@ function rowHeightOf(fragment) {
|
|
|
28684
28773
|
}
|
|
28685
28774
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
28686
28775
|
const from = scanTable.start + tblOpenLen;
|
|
28687
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
28776
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _502 => _502.rowRanges, 'access', _503 => _503[0], 'optionalAccess', _504 => _504.start]), () => ( from));
|
|
28688
28777
|
const slice = xml.slice(from, to);
|
|
28689
28778
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
28690
28779
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -28873,9 +28962,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
28873
28962
|
});
|
|
28874
28963
|
}
|
|
28875
28964
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
28876
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28965
|
+
const irCell = _optionalChain([table2, 'access', _505 => _505.cells, 'access', _506 => _506[oc.gridR], 'optionalAccess', _507 => _507[oc.gridC]]);
|
|
28877
28966
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
28878
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
28967
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _508 => _508.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
28879
28968
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
28880
28969
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
28881
28970
|
}
|
|
@@ -28943,7 +29032,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
28943
29032
|
};
|
|
28944
29033
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
28945
29034
|
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)");
|
|
28946
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29035
|
+
const irCell = _optionalChain([table2, 'access', _509 => _509.cells, 'access', _510 => _510[gridR], 'optionalAccess', _511 => _511[gridC]]);
|
|
28947
29036
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
28948
29037
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
28949
29038
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -28967,7 +29056,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
28967
29056
|
const target = cell2.paragraphs[0];
|
|
28968
29057
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
28969
29058
|
const value = newLines.join(" ");
|
|
28970
|
-
const xml = _optionalChain([ctx, 'access',
|
|
29059
|
+
const xml = _optionalChain([ctx, 'access', _512 => _512.scans, 'access', _513 => _513[target.sectionIndex], 'optionalAccess', _514 => _514.xml]);
|
|
28971
29060
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
28972
29061
|
let sp;
|
|
28973
29062
|
if (xml && rawT === null) {
|
|
@@ -29001,7 +29090,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
29001
29090
|
}
|
|
29002
29091
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
29003
29092
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
29004
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
29093
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _515 => _515.scans, 'access', _516 => _516[nonEmpty[i].sectionIndex], 'optionalAccess', _517 => _517.xml]));
|
|
29005
29094
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
29006
29095
|
splices.push(...sp);
|
|
29007
29096
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -29082,7 +29171,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
29082
29171
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
29083
29172
|
if (paths.length > 0) return paths;
|
|
29084
29173
|
}
|
|
29085
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
29174
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkISCI5LKNcjs.compareSectionPaths);
|
|
29086
29175
|
}
|
|
29087
29176
|
function sectionPathsFromManifest(xml) {
|
|
29088
29177
|
const attr = (tag, name) => {
|
|
@@ -29092,7 +29181,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
29092
29181
|
const idToHref = /* @__PURE__ */ new Map();
|
|
29093
29182
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
29094
29183
|
const id = attr(m[1], "id");
|
|
29095
|
-
const href =
|
|
29184
|
+
const href = _chunkISCI5LKNcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
29096
29185
|
if (id && href) idToHref.set(id, href);
|
|
29097
29186
|
}
|
|
29098
29187
|
const ordered = [];
|
|
@@ -29101,7 +29190,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
29101
29190
|
if (href) ordered.push(href);
|
|
29102
29191
|
}
|
|
29103
29192
|
if (ordered.length > 0) return ordered;
|
|
29104
|
-
return Array.from(idToHref.values()).sort(
|
|
29193
|
+
return Array.from(idToHref.values()).sort(_chunkISCI5LKNcjs.compareSectionPaths);
|
|
29105
29194
|
}
|
|
29106
29195
|
|
|
29107
29196
|
// src/roundtrip/patcher.ts
|
|
@@ -29193,7 +29282,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
29193
29282
|
}
|
|
29194
29283
|
}
|
|
29195
29284
|
let verification;
|
|
29196
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29285
|
+
if (_optionalChain([options, 'optionalAccess', _518 => _518.verify]) !== false) {
|
|
29197
29286
|
try {
|
|
29198
29287
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
29199
29288
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -29211,17 +29300,17 @@ function buildOrigUnits(blocks) {
|
|
|
29211
29300
|
let chunk;
|
|
29212
29301
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
29213
29302
|
const next = blocks[i + 1];
|
|
29214
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
29215
|
-
chunk =
|
|
29303
|
+
if (_optionalChain([next, 'optionalAccess', _519 => _519.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
29304
|
+
chunk = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
29216
29305
|
} else {
|
|
29217
|
-
chunk =
|
|
29306
|
+
chunk = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, [block]);
|
|
29218
29307
|
}
|
|
29219
29308
|
if (chunk) {
|
|
29220
29309
|
const subUnits = splitMarkdownUnits(chunk);
|
|
29221
29310
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
29222
29311
|
for (let s = 0; s < subUnits.length; s++) {
|
|
29223
29312
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
29224
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
29313
|
+
if (block.type === "table" && _optionalChain([block, 'access', _520 => _520.table, 'optionalAccess', _521 => _521.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
29225
29314
|
u.role = "caption";
|
|
29226
29315
|
}
|
|
29227
29316
|
units.push(u);
|
|
@@ -29332,7 +29421,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
29332
29421
|
const ti = ctx.tableInsert;
|
|
29333
29422
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
29334
29423
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29335
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29424
|
+
if (!_optionalChain([mapping, 'optionalAccess', _522 => _522.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");
|
|
29336
29425
|
const para2 = mapping.para;
|
|
29337
29426
|
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");
|
|
29338
29427
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -29360,7 +29449,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
29360
29449
|
}
|
|
29361
29450
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
29362
29451
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29363
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29452
|
+
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)");
|
|
29364
29453
|
if (block.text && block.text.includes("\n")) {
|
|
29365
29454
|
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)");
|
|
29366
29455
|
}
|
|
@@ -29391,7 +29480,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
29391
29480
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
29392
29481
|
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");
|
|
29393
29482
|
}
|
|
29394
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
29483
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _524 => _524.scans, 'access', _525 => _525[mapping.para.sectionIndex], 'optionalAccess', _526 => _526.xml]));
|
|
29395
29484
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
29396
29485
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
29397
29486
|
return 1;
|
|
@@ -29583,7 +29672,7 @@ var Surgeon = (_class7 = class {
|
|
|
29583
29672
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
29584
29673
|
findEntry(path) {
|
|
29585
29674
|
const parts = path.replace(/^\//, "").split("/");
|
|
29586
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
29675
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _527 => _527.entries, 'access', _528 => _528[0], 'optionalAccess', _529 => _529.child]), () => ( -1));
|
|
29587
29676
|
let current;
|
|
29588
29677
|
for (const part of parts) {
|
|
29589
29678
|
const search = (idx) => {
|
|
@@ -29836,8 +29925,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
29836
29925
|
parts.push(header, data);
|
|
29837
29926
|
};
|
|
29838
29927
|
for (let i = 0; i < recs.length; i++) {
|
|
29839
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
29840
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
29928
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _530 => _530.get, 'call', _531 => _531(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
29929
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _532 => _532.get, 'call', _533 => _533(i)]), () => ( recs[i].data)));
|
|
29841
29930
|
}
|
|
29842
29931
|
return Buffer.concat(parts);
|
|
29843
29932
|
}
|
|
@@ -29955,7 +30044,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29955
30044
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
29956
30045
|
}
|
|
29957
30046
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
29958
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
30047
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _534 => _534.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
29959
30048
|
let flags;
|
|
29960
30049
|
try {
|
|
29961
30050
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -29977,7 +30066,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
29977
30066
|
const scans = [];
|
|
29978
30067
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
29979
30068
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
29980
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
30069
|
+
if (!_optionalChain([entry, 'optionalAccess', _535 => _535.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
29981
30070
|
let stream;
|
|
29982
30071
|
try {
|
|
29983
30072
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -30028,7 +30117,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
30028
30117
|
}
|
|
30029
30118
|
}
|
|
30030
30119
|
let verification;
|
|
30031
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30120
|
+
if (_optionalChain([options, 'optionalAccess', _536 => _536.verify]) !== false) {
|
|
30032
30121
|
try {
|
|
30033
30122
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
30034
30123
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -30118,7 +30207,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
30118
30207
|
for (const [key, scanCell] of scanTable.cells) {
|
|
30119
30208
|
const comma = key.indexOf(",");
|
|
30120
30209
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
30121
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
30210
|
+
const irCell = _optionalChain([irTable, 'access', _537 => _537.cells, 'access', _538 => _538[r], 'optionalAccess', _539 => _539[c]]);
|
|
30122
30211
|
if (!irCell) continue;
|
|
30123
30212
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
30124
30213
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -30154,7 +30243,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
30154
30243
|
}
|
|
30155
30244
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
30156
30245
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
30157
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
30246
|
+
if (!_optionalChain([mapping, 'optionalAccess', _540 => _540.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)");
|
|
30158
30247
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
30159
30248
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
30160
30249
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -30353,7 +30442,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
30353
30442
|
};
|
|
30354
30443
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
30355
30444
|
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)");
|
|
30356
|
-
const irCell = _optionalChain([table2, 'access',
|
|
30445
|
+
const irCell = _optionalChain([table2, 'access', _541 => _541.cells, 'access', _542 => _542[gridR], 'optionalAccess', _543 => _543[gridC]]);
|
|
30357
30446
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
30358
30447
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
30359
30448
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -30789,11 +30878,11 @@ var RULES2 = {
|
|
|
30789
30878
|
}
|
|
30790
30879
|
};
|
|
30791
30880
|
function redactText(text, options) {
|
|
30792
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30881
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _544 => _544.maskChar]), () => ( "\u25CF"));
|
|
30793
30882
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
30794
30883
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
30795
30884
|
}
|
|
30796
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30885
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _545 => _545.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
30797
30886
|
const hits = [];
|
|
30798
30887
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
30799
30888
|
const occupied = [];
|
|
@@ -30848,8 +30937,8 @@ function sameBreadcrumb(a, b) {
|
|
|
30848
30937
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
30849
30938
|
}
|
|
30850
30939
|
function blocksToChunks(blocks, options) {
|
|
30851
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30852
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30940
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _546 => _546.granularity]), () => ( "section"));
|
|
30941
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _547 => _547.includeTableCells]), () => ( false));
|
|
30853
30942
|
const chunks = [];
|
|
30854
30943
|
const headingStack = [];
|
|
30855
30944
|
const listStack = [];
|
|
@@ -30863,12 +30952,12 @@ function blocksToChunks(blocks, options) {
|
|
|
30863
30952
|
let run = null;
|
|
30864
30953
|
const flushRun = () => {
|
|
30865
30954
|
if (!run) return;
|
|
30866
|
-
push("text", run.breadcrumb,
|
|
30955
|
+
push("text", run.breadcrumb, _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
30867
30956
|
run = null;
|
|
30868
30957
|
};
|
|
30869
30958
|
for (let i = 0; i < blocks.length; i++) {
|
|
30870
30959
|
const block = blocks[i];
|
|
30871
|
-
const md2 =
|
|
30960
|
+
const md2 = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, [block]);
|
|
30872
30961
|
if (!md2) continue;
|
|
30873
30962
|
if (block.type === "heading") {
|
|
30874
30963
|
flushRun();
|
|
@@ -30984,7 +31073,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30984
31073
|
const block = st.blocks[blockIndex];
|
|
30985
31074
|
if (!block) return void 0;
|
|
30986
31075
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
30987
|
-
const para2 = _optionalChain([st, 'access',
|
|
31076
|
+
const para2 = _optionalChain([st, 'access', _548 => _548.paraMap, 'access', _549 => _549.get, 'call', _550 => _550(blockIndex), 'optionalAccess', _551 => _551.para]);
|
|
30988
31077
|
if (!para2) return void 0;
|
|
30989
31078
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
30990
31079
|
}
|
|
@@ -31009,7 +31098,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31009
31098
|
if (block.text && block.text.includes("\n")) {
|
|
31010
31099
|
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)" };
|
|
31011
31100
|
}
|
|
31012
|
-
if (!_optionalChain([st, 'access',
|
|
31101
|
+
if (!_optionalChain([st, 'access', _552 => _552.paraMap, 'access', _553 => _553.get, 'call', _554 => _554(blockIndex), 'optionalAccess', _555 => _555.para])) {
|
|
31013
31102
|
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)" };
|
|
31014
31103
|
}
|
|
31015
31104
|
return { capability: "text" };
|
|
@@ -31075,7 +31164,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31075
31164
|
continue;
|
|
31076
31165
|
}
|
|
31077
31166
|
if (block.type === "table" && block.table) {
|
|
31078
|
-
if (!_optionalChain([edit, 'access',
|
|
31167
|
+
if (!_optionalChain([edit, 'access', _556 => _556.cells, 'optionalAccess', _557 => _557.length])) {
|
|
31079
31168
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
31080
31169
|
continue;
|
|
31081
31170
|
}
|
|
@@ -31095,7 +31184,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31095
31184
|
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) });
|
|
31096
31185
|
continue;
|
|
31097
31186
|
}
|
|
31098
|
-
const irCell = _optionalChain([block, 'access',
|
|
31187
|
+
const irCell = _optionalChain([block, 'access', _558 => _558.table, 'access', _559 => _559.cells, 'access', _560 => _560[cellEdit.row], 'optionalAccess', _561 => _561[cellEdit.col]]);
|
|
31099
31188
|
if (!irCell) {
|
|
31100
31189
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
31101
31190
|
continue;
|
|
@@ -31151,7 +31240,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31151
31240
|
}
|
|
31152
31241
|
if (replacements.size === 0) {
|
|
31153
31242
|
let changes2;
|
|
31154
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
31243
|
+
if (_optionalChain([options, 'optionalAccess', _562 => _562.verify]) !== false) {
|
|
31155
31244
|
const units = splitMarkdownUnits(st.markdown);
|
|
31156
31245
|
changes2 = diffUnitLists(units, units);
|
|
31157
31246
|
}
|
|
@@ -31172,7 +31261,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31172
31261
|
}
|
|
31173
31262
|
this.state = newState;
|
|
31174
31263
|
let changes;
|
|
31175
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
31264
|
+
if (_optionalChain([options, 'optionalAccess', _563 => _563.verify]) !== false) {
|
|
31176
31265
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
31177
31266
|
}
|
|
31178
31267
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -31192,7 +31281,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31192
31281
|
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)");
|
|
31193
31282
|
}
|
|
31194
31283
|
const mapping = st.paraMap.get(blockIndex);
|
|
31195
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
31284
|
+
if (!_optionalChain([mapping, 'optionalAccess', _564 => _564.para])) {
|
|
31196
31285
|
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)");
|
|
31197
31286
|
}
|
|
31198
31287
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -31212,14 +31301,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
31212
31301
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
31213
31302
|
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");
|
|
31214
31303
|
}
|
|
31215
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
31304
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _565 => _565.scans, 'access', _566 => _566[mapping.para.sectionIndex], 'optionalAccess', _567 => _567.xml]));
|
|
31216
31305
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
31217
31306
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
31218
31307
|
return 1;
|
|
31219
31308
|
}
|
|
31220
31309
|
}, _class8);
|
|
31221
31310
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
31222
|
-
const irCell = _optionalChain([table2, 'access',
|
|
31311
|
+
const irCell = _optionalChain([table2, 'access', _568 => _568.cells, 'access', _569 => _569[r], 'optionalAccess', _570 => _570[c]]);
|
|
31223
31312
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
31224
31313
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
31225
31314
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -31303,11 +31392,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
31303
31392
|
breaks: false
|
|
31304
31393
|
});
|
|
31305
31394
|
function renderHtml(markdown, options) {
|
|
31306
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31307
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31395
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _571 => _571.preset]), () => ( "default"));
|
|
31396
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _572 => _572.extraCss]), () => ( "")));
|
|
31308
31397
|
const body = md.render(markdown);
|
|
31309
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
31310
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
31398
|
+
const watermark = _optionalChain([options, 'optionalAccess', _573 => _573.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
31399
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _574 => _574.watermark]) ? `
|
|
31311
31400
|
.watermark {
|
|
31312
31401
|
position: fixed;
|
|
31313
31402
|
top: 50%; left: 50%;
|
|
@@ -31338,13 +31427,13 @@ async function htmlToPdf(html, options) {
|
|
|
31338
31427
|
try {
|
|
31339
31428
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
31340
31429
|
} catch (e38) {
|
|
31341
|
-
throw new (0,
|
|
31430
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
31342
31431
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
31343
31432
|
);
|
|
31344
31433
|
}
|
|
31345
31434
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
31346
31435
|
if (!executablePath) {
|
|
31347
|
-
throw new (0,
|
|
31436
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)(
|
|
31348
31437
|
"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."
|
|
31349
31438
|
);
|
|
31350
31439
|
}
|
|
@@ -31356,10 +31445,10 @@ async function htmlToPdf(html, options) {
|
|
|
31356
31445
|
try {
|
|
31357
31446
|
const page = await browser.newPage();
|
|
31358
31447
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
31359
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
31448
|
+
const margin = _optionalChain([options, 'optionalAccess', _575 => _575.margin]);
|
|
31360
31449
|
const pdf = await page.pdf({
|
|
31361
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31362
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
31450
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _576 => _576.pageSize]), () => ( "A4")),
|
|
31451
|
+
landscape: _optionalChain([options, 'optionalAccess', _577 => _577.orientation]) === "landscape",
|
|
31363
31452
|
printBackground: true,
|
|
31364
31453
|
margin: margin ? {
|
|
31365
31454
|
top: toCss(margin.top),
|
|
@@ -31367,9 +31456,9 @@ async function htmlToPdf(html, options) {
|
|
|
31367
31456
|
bottom: toCss(margin.bottom),
|
|
31368
31457
|
left: toCss(margin.left)
|
|
31369
31458
|
} : void 0,
|
|
31370
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
31371
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31372
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31459
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _578 => _578.header]) || _optionalChain([options, 'optionalAccess', _579 => _579.footer])),
|
|
31460
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _580 => _580.header]), () => ( "<div></div>")),
|
|
31461
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _581 => _581.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
31373
31462
|
});
|
|
31374
31463
|
return Buffer.from(pdf);
|
|
31375
31464
|
} finally {
|
|
@@ -31403,7 +31492,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
31403
31492
|
return htmlToPdf(html, options);
|
|
31404
31493
|
}
|
|
31405
31494
|
async function blocksToPdf(blocks, options) {
|
|
31406
|
-
const markdown =
|
|
31495
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks);
|
|
31407
31496
|
return markdownToPdf(markdown, options);
|
|
31408
31497
|
}
|
|
31409
31498
|
|
|
@@ -31582,7 +31671,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
31582
31671
|
}
|
|
31583
31672
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
31584
31673
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
31585
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
31674
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _582 => _582.getAttribute, 'call', _583 => _583("vertRelTo")]), () => ( "PARA"));
|
|
31586
31675
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
31587
31676
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
31588
31677
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -31643,7 +31732,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
31643
31732
|
if (ln(p) !== "p") continue;
|
|
31644
31733
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
31645
31734
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
31646
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
31735
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _584 => _584.spaceBefore]), () => ( 0)));
|
|
31647
31736
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
31648
31737
|
if (!res) {
|
|
31649
31738
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -31656,7 +31745,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
31656
31745
|
}
|
|
31657
31746
|
if (Number.isFinite(bottom)) {
|
|
31658
31747
|
cursorV = bottom;
|
|
31659
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
31748
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _585 => _585.spaceAfter]), () => ( 0));
|
|
31660
31749
|
}
|
|
31661
31750
|
}
|
|
31662
31751
|
continue;
|
|
@@ -31763,7 +31852,7 @@ function buildPara(p) {
|
|
|
31763
31852
|
const pos = findChildByLocalName(ch, "pos");
|
|
31764
31853
|
const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
|
|
31765
31854
|
const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
|
|
31766
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
31855
|
+
const inline = _optionalChain([pos, 'optionalAccess', _586 => _586.getAttribute, 'call', _587 => _587("treatAsChar")]) === "1";
|
|
31767
31856
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
31768
31857
|
objs.push({
|
|
31769
31858
|
el: ch,
|
|
@@ -32023,15 +32112,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
32023
32112
|
const sx = ow > 0 ? w / ow : 1;
|
|
32024
32113
|
const sy = oh > 0 ? h / oh : 1;
|
|
32025
32114
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
32026
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
32027
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
32115
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _588 => _588.getAttribute, 'call', _589 => _589("style")]), () => ( "SOLID"));
|
|
32116
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _590 => _590.getAttribute, 'call', _591 => _591("color")]) || "#000000";
|
|
32028
32117
|
const hasStroke = lstyle !== "NONE";
|
|
32029
32118
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
32030
32119
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
32031
32120
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
32032
32121
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
32033
32122
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
32034
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
32123
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _592 => _592.getAttribute, 'call', _593 => _593("faceColor")]);
|
|
32035
32124
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
32036
32125
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
32037
32126
|
if (o.tag === "rect") {
|
|
@@ -32058,14 +32147,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
32058
32147
|
}
|
|
32059
32148
|
function cellContentExtent(cell2, memo) {
|
|
32060
32149
|
if (!cell2.sub) return 0;
|
|
32061
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
32150
|
+
const hit = _optionalChain([memo, 'optionalAccess', _594 => _594.cell, 'access', _595 => _595.get, 'call', _596 => _596(cell2.el)]);
|
|
32062
32151
|
if (hit !== void 0) return hit;
|
|
32063
32152
|
let ext = 0;
|
|
32064
32153
|
for (const p of elements2(cell2.sub)) {
|
|
32065
32154
|
if (ln2(p) !== "p") continue;
|
|
32066
32155
|
const m = buildPara(p);
|
|
32067
32156
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
32068
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
32157
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _597 => _597.segs, 'access', _598 => _598[0], 'optionalAccess', _599 => _599.vertpos]), () => ( 0));
|
|
32069
32158
|
for (const o of m.objs) {
|
|
32070
32159
|
if (o.inline) {
|
|
32071
32160
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -32073,14 +32162,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
32073
32162
|
continue;
|
|
32074
32163
|
}
|
|
32075
32164
|
const pos = findChildByLocalName(o.el, "pos");
|
|
32076
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
32165
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _600 => _600.getAttribute, 'call', _601 => _601("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
32077
32166
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
32078
32167
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
32079
32168
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
32080
32169
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
32081
32170
|
}
|
|
32082
32171
|
}
|
|
32083
|
-
_optionalChain([memo, 'optionalAccess',
|
|
32172
|
+
_optionalChain([memo, 'optionalAccess', _602 => _602.cell, 'access', _603 => _603.set, 'call', _604 => _604(cell2.el, ext)]);
|
|
32084
32173
|
return ext;
|
|
32085
32174
|
}
|
|
32086
32175
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -32122,7 +32211,7 @@ function collectCells(tbl2) {
|
|
|
32122
32211
|
return cells;
|
|
32123
32212
|
}
|
|
32124
32213
|
function measureTableHeight(tbl2, memo) {
|
|
32125
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
32214
|
+
const hit = _optionalChain([memo, 'optionalAccess', _605 => _605.table, 'access', _606 => _606.get, 'call', _607 => _607(tbl2)]);
|
|
32126
32215
|
if (hit !== void 0) return hit;
|
|
32127
32216
|
const cells = collectCells(tbl2);
|
|
32128
32217
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -32133,7 +32222,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
32133
32222
|
);
|
|
32134
32223
|
let sum = 0;
|
|
32135
32224
|
for (const h of rowH) sum += h;
|
|
32136
|
-
_optionalChain([memo, 'optionalAccess',
|
|
32225
|
+
_optionalChain([memo, 'optionalAccess', _608 => _608.table, 'access', _609 => _609.set, 'call', _610 => _610(tbl2, sum)]);
|
|
32137
32226
|
return sum;
|
|
32138
32227
|
}
|
|
32139
32228
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -32164,7 +32253,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
32164
32253
|
}));
|
|
32165
32254
|
for (const g of geom) {
|
|
32166
32255
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
32167
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
32256
|
+
if (_optionalChain([bf, 'optionalAccess', _611 => _611.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
32168
32257
|
}
|
|
32169
32258
|
for (const g of geom) {
|
|
32170
32259
|
const { c } = g;
|
|
@@ -32202,7 +32291,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
32202
32291
|
const sz = findChildByLocalName(pic, "sz");
|
|
32203
32292
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
32204
32293
|
const img = findFirst(pic, "img");
|
|
32205
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
32294
|
+
const ref = _optionalChain([img, 'optionalAccess', _612 => _612.getAttribute, 'call', _613 => _613("binaryItemIDRef")]);
|
|
32206
32295
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
32207
32296
|
if (!loaded) {
|
|
32208
32297
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -32242,7 +32331,7 @@ function readSectionGeom(root) {
|
|
|
32242
32331
|
const pagePr = findFirst(root, "pagePr");
|
|
32243
32332
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
32244
32333
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
32245
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
32334
|
+
if (_optionalChain([pagePr, 'optionalAccess', _614 => _614.getAttribute, 'call', _615 => _615("landscape")]) === "NARROWLY" && PW < PH) {
|
|
32246
32335
|
const t = PW;
|
|
32247
32336
|
PW = PH;
|
|
32248
32337
|
PH = t;
|
|
@@ -32300,17 +32389,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
32300
32389
|
return { pages: ctx.pages, pageH };
|
|
32301
32390
|
}
|
|
32302
32391
|
async function renderHwpxToSvg(input, options) {
|
|
32303
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
32392
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _616 => _616.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
32304
32393
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
32305
|
-
|
|
32394
|
+
_chunkISCI5LKNcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
32306
32395
|
let zip;
|
|
32307
32396
|
try {
|
|
32308
32397
|
zip = await _jszip2.default.loadAsync(input);
|
|
32309
32398
|
} catch (e39) {
|
|
32310
|
-
throw new (0,
|
|
32399
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
32311
32400
|
}
|
|
32312
32401
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
32313
|
-
if (secFiles.length === 0) throw new (0,
|
|
32402
|
+
if (secFiles.length === 0) throw new (0, _chunkISCI5LKNcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
32314
32403
|
const warnings = [];
|
|
32315
32404
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
32316
32405
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -32318,7 +32407,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
32318
32407
|
const secXmls = [];
|
|
32319
32408
|
for (const f of secFiles) {
|
|
32320
32409
|
const xml = await f.async("string");
|
|
32321
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
32410
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkISCI5LKNcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
32322
32411
|
secXmls.push(xml);
|
|
32323
32412
|
}
|
|
32324
32413
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -32342,7 +32431,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
32342
32431
|
let href = binmap.get(ref);
|
|
32343
32432
|
if (!href) {
|
|
32344
32433
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
32345
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
32434
|
+
href = _optionalChain([cand, 'optionalAccess', _617 => _617.name]);
|
|
32346
32435
|
}
|
|
32347
32436
|
if (!href) continue;
|
|
32348
32437
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -32363,7 +32452,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
32363
32452
|
styles,
|
|
32364
32453
|
images,
|
|
32365
32454
|
defs: [],
|
|
32366
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
32455
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _618 => _618.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
32367
32456
|
warnings,
|
|
32368
32457
|
warned: /* @__PURE__ */ new Set(),
|
|
32369
32458
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -32374,7 +32463,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
32374
32463
|
for (let si = 0; si < secXmls.length; si++) {
|
|
32375
32464
|
const secXml = secXmls[si];
|
|
32376
32465
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
32377
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
32466
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _619 => _619.reflow])) {
|
|
32378
32467
|
noCacheSkipped = true;
|
|
32379
32468
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
32380
32469
|
continue;
|
|
@@ -32386,14 +32475,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
32386
32475
|
continue;
|
|
32387
32476
|
}
|
|
32388
32477
|
const geom = readSectionGeom(root);
|
|
32389
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
32478
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _620 => _620.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _621 => _621.reflowMode]), () => ( "keep")));
|
|
32390
32479
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
32391
32480
|
}
|
|
32392
32481
|
if (rendered.length === 0) {
|
|
32393
32482
|
if (noCacheSkipped) {
|
|
32394
|
-
throw new (0,
|
|
32483
|
+
throw new (0, _chunkISCI5LKNcjs.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)");
|
|
32395
32484
|
}
|
|
32396
|
-
throw new (0,
|
|
32485
|
+
throw new (0, _chunkISCI5LKNcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
32397
32486
|
}
|
|
32398
32487
|
const GAP = 2400;
|
|
32399
32488
|
const clipDefs = [];
|
|
@@ -32425,17 +32514,17 @@ ${groups.join("\n")}
|
|
|
32425
32514
|
// src/index.ts
|
|
32426
32515
|
async function parse(input, options) {
|
|
32427
32516
|
let buffer;
|
|
32428
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
32517
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _622 => _622.filePath]) ? { ...options, filePath: input } : options;
|
|
32429
32518
|
if (typeof input === "string") {
|
|
32430
32519
|
try {
|
|
32431
32520
|
const buf = await _promises.readFile.call(void 0, input);
|
|
32432
|
-
buffer =
|
|
32521
|
+
buffer = _chunkISCI5LKNcjs.toArrayBuffer.call(void 0, buf);
|
|
32433
32522
|
} catch (err) {
|
|
32434
32523
|
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}`;
|
|
32435
32524
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
32436
32525
|
}
|
|
32437
32526
|
} else if (Buffer.isBuffer(input)) {
|
|
32438
|
-
buffer =
|
|
32527
|
+
buffer = _chunkISCI5LKNcjs.toArrayBuffer.call(void 0, input);
|
|
32439
32528
|
} else {
|
|
32440
32529
|
buffer = input;
|
|
32441
32530
|
}
|
|
@@ -32477,40 +32566,40 @@ async function dispatch(format, buffer, opts) {
|
|
|
32477
32566
|
}
|
|
32478
32567
|
async function parseImage(buffer, options) {
|
|
32479
32568
|
try {
|
|
32480
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
32569
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-6O6ZXKUD.cjs")));
|
|
32481
32570
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
32482
32571
|
return {
|
|
32483
32572
|
success: true,
|
|
32484
32573
|
fileType: "image",
|
|
32485
|
-
markdown:
|
|
32574
|
+
markdown: _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, blocks),
|
|
32486
32575
|
blocks,
|
|
32487
32576
|
warnings: warnings.length ? warnings : void 0,
|
|
32488
32577
|
pageCount: 1
|
|
32489
32578
|
};
|
|
32490
32579
|
} catch (err) {
|
|
32491
|
-
return { success: false, fileType: "image", error:
|
|
32580
|
+
return { success: false, fileType: "image", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32492
32581
|
}
|
|
32493
32582
|
}
|
|
32494
32583
|
async function parseHwp3(buffer, options) {
|
|
32495
32584
|
try {
|
|
32496
32585
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
32497
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
32586
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _623 => _623.pageCount]) };
|
|
32498
32587
|
} catch (err) {
|
|
32499
|
-
return { success: false, fileType: "hwp3", error:
|
|
32588
|
+
return { success: false, fileType: "hwp3", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32500
32589
|
}
|
|
32501
32590
|
}
|
|
32502
32591
|
async function parseHwpx(buffer, options) {
|
|
32503
32592
|
try {
|
|
32504
32593
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
32505
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
32594
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _624 => _624.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _625 => _625.pageCount]) };
|
|
32506
32595
|
} catch (err) {
|
|
32507
|
-
return { success: false, fileType: "hwpx", error:
|
|
32596
|
+
return { success: false, fileType: "hwpx", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32508
32597
|
}
|
|
32509
32598
|
}
|
|
32510
32599
|
async function parseHwp(buffer, options) {
|
|
32511
32600
|
try {
|
|
32512
32601
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
32513
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
32602
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _626 => _626.filePath])) {
|
|
32514
32603
|
try {
|
|
32515
32604
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
32516
32605
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -32528,15 +32617,15 @@ async function parseHwp(buffer, options) {
|
|
|
32528
32617
|
} catch (e40) {
|
|
32529
32618
|
}
|
|
32530
32619
|
}
|
|
32531
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
32620
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _627 => _627.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _628 => _628.pageCount]) };
|
|
32532
32621
|
} catch (err) {
|
|
32533
|
-
return { success: false, fileType: "hwp", error:
|
|
32622
|
+
return { success: false, fileType: "hwp", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32534
32623
|
}
|
|
32535
32624
|
}
|
|
32536
32625
|
async function parsePdf(buffer, options) {
|
|
32537
32626
|
let parsePdfDocument;
|
|
32538
32627
|
try {
|
|
32539
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
32628
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-YLLIYOIZ.cjs")));
|
|
32540
32629
|
parsePdfDocument = mod.parsePdfDocument;
|
|
32541
32630
|
} catch (e41) {
|
|
32542
32631
|
return {
|
|
@@ -32548,51 +32637,51 @@ async function parsePdf(buffer, options) {
|
|
|
32548
32637
|
}
|
|
32549
32638
|
try {
|
|
32550
32639
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
|
|
32551
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
32640
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _629 => _629.pageCount]) };
|
|
32552
32641
|
} catch (err) {
|
|
32553
32642
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
32554
|
-
return { success: false, fileType: "pdf", error:
|
|
32643
|
+
return { success: false, fileType: "pdf", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err), isImageBased };
|
|
32555
32644
|
}
|
|
32556
32645
|
}
|
|
32557
32646
|
async function parseXlsx(buffer, options) {
|
|
32558
32647
|
try {
|
|
32559
32648
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
32560
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
32649
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _630 => _630.pageCount]) };
|
|
32561
32650
|
} catch (err) {
|
|
32562
|
-
return { success: false, fileType: "xlsx", error:
|
|
32651
|
+
return { success: false, fileType: "xlsx", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32563
32652
|
}
|
|
32564
32653
|
}
|
|
32565
32654
|
async function parseXls(buffer, options) {
|
|
32566
32655
|
try {
|
|
32567
32656
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
32568
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
32657
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _631 => _631.pageCount]) };
|
|
32569
32658
|
} catch (err) {
|
|
32570
|
-
return { success: false, fileType: "xls", error:
|
|
32659
|
+
return { success: false, fileType: "xls", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32571
32660
|
}
|
|
32572
32661
|
}
|
|
32573
32662
|
async function parseDocx(buffer, options) {
|
|
32574
32663
|
try {
|
|
32575
32664
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
32576
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
32665
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _632 => _632.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _633 => _633.pageCount]) };
|
|
32577
32666
|
} catch (err) {
|
|
32578
|
-
return { success: false, fileType: "docx", error:
|
|
32667
|
+
return { success: false, fileType: "docx", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32579
32668
|
}
|
|
32580
32669
|
}
|
|
32581
32670
|
async function parseHwpml(buffer, options) {
|
|
32582
32671
|
try {
|
|
32583
32672
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
32584
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
32673
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _634 => _634.pageCount]) };
|
|
32585
32674
|
} catch (err) {
|
|
32586
|
-
return { success: false, fileType: "hwpml", error:
|
|
32675
|
+
return { success: false, fileType: "hwpml", error: _chunkISCI5LKNcjs.sanitizeError.call(void 0, err), code: _chunkISCI5LKNcjs.classifyError.call(void 0, err) };
|
|
32587
32676
|
}
|
|
32588
32677
|
}
|
|
32589
32678
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
32590
32679
|
let buffer;
|
|
32591
32680
|
if (typeof input === "string") {
|
|
32592
32681
|
const buf = await _promises.readFile.call(void 0, input);
|
|
32593
|
-
buffer =
|
|
32682
|
+
buffer = _chunkISCI5LKNcjs.toArrayBuffer.call(void 0, buf);
|
|
32594
32683
|
} else if (Buffer.isBuffer(input)) {
|
|
32595
|
-
buffer =
|
|
32684
|
+
buffer = _chunkISCI5LKNcjs.toArrayBuffer.call(void 0, input);
|
|
32596
32685
|
} else {
|
|
32597
32686
|
buffer = input;
|
|
32598
32687
|
}
|
|
@@ -32618,7 +32707,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
32618
32707
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
32619
32708
|
}
|
|
32620
32709
|
const fill = fillFormFields(parsed.blocks, values);
|
|
32621
|
-
const markdown =
|
|
32710
|
+
const markdown = _chunkBOATAEXUcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
32622
32711
|
if (outputFormat === "hwpx") {
|
|
32623
32712
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
32624
32713
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -32701,5 +32790,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
32701
32790
|
|
|
32702
32791
|
|
|
32703
32792
|
|
|
32704
|
-
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 =
|
|
32793
|
+
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 = _chunkISCI5LKNcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkBOATAEXUcjs.blocksToMarkdown; exports.blocksToPages = blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
32705
32794
|
//# sourceMappingURL=index.cjs.map
|