kordoc 4.7.1 → 4.7.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 +19 -1
- package/dist/{-O42BMYNX.js → -WYNJOQ6P.js} +9 -9
- package/dist/{chunk-PLEGO474.js → chunk-3NKSSL44.js} +3 -3
- package/dist/{chunk-UZB3UGC5.js → chunk-3P5YCJQE.js} +2 -2
- package/dist/{chunk-IZEUWEEY.js → chunk-46F5RMU7.js} +3 -11
- package/dist/chunk-46F5RMU7.js.map +1 -0
- package/dist/{chunk-UAFSPWU7.js → chunk-4HZN7EZZ.js} +8 -1
- package/dist/chunk-4HZN7EZZ.js.map +1 -0
- package/dist/{chunk-4VNUQYUE.js → chunk-4KGGVCYX.js} +1 -1
- package/dist/chunk-4KGGVCYX.js.map +1 -0
- package/dist/{chunk-AFX6ZXER.js → chunk-CGJDCZA3.js} +2 -2
- package/dist/{chunk-DJKLOLBT.cjs → chunk-E6DONLTM.cjs} +3 -11
- package/dist/chunk-E6DONLTM.cjs.map +1 -0
- package/dist/chunk-EV53YE3W.cjs +11 -0
- package/dist/chunk-EV53YE3W.cjs.map +1 -0
- package/dist/{chunk-3H5X63BQ.js → chunk-HJV4BVQI.js} +27 -1
- package/dist/chunk-HJV4BVQI.js.map +1 -0
- package/dist/{chunk-J3W6Q3AX.js → chunk-IMFIACHP.js} +2 -2
- package/dist/{chunk-BQENBAUC.js → chunk-JKJEBDP7.js} +3 -3
- package/dist/{chunk-ZDWP3LLY.cjs → chunk-KE6DLZAW.cjs} +12 -10
- package/dist/chunk-KE6DLZAW.cjs.map +1 -0
- package/dist/{chunk-YWDN5PQC.js → chunk-KEGAEHWO.js} +2 -2
- package/dist/chunk-KSATSTC5.js +11 -0
- package/dist/chunk-KSATSTC5.js.map +1 -0
- package/dist/{chunk-3UIT4PPQ.js → chunk-LMHVMGEC.js} +5 -3
- package/dist/{chunk-3UIT4PPQ.js.map → chunk-LMHVMGEC.js.map} +1 -1
- package/dist/{chunk-VECVLIWE.js → chunk-NYLYIN55.js} +3 -3
- package/dist/{chunk-IMEMTJ76.js → chunk-P663PYWV.js} +2 -2
- package/dist/{chunk-ZV5OKQ3Z.cjs → chunk-QETZP25M.cjs} +28 -2
- package/dist/chunk-QETZP25M.cjs.map +1 -0
- package/dist/{chunk-TZ3WCAJZ.cjs → chunk-QGATKC4R.cjs} +6 -6
- package/dist/{chunk-TZ3WCAJZ.cjs.map → chunk-QGATKC4R.cjs.map} +1 -1
- package/dist/{chunk-USGC3ZKU.cjs → chunk-R4LXZRYP.cjs} +4 -4
- package/dist/{chunk-USGC3ZKU.cjs.map → chunk-R4LXZRYP.cjs.map} +1 -1
- package/dist/chunk-RQVFFSAO.js +52 -0
- package/dist/chunk-RQVFFSAO.js.map +1 -0
- package/dist/{chunk-GZDOWYJM.js → chunk-TXQQ7URG.js} +2 -2
- package/dist/{chunk-7ZIOZ6PU.js → chunk-VZ3AQVBN.js} +8 -3
- package/dist/chunk-VZ3AQVBN.js.map +1 -0
- package/dist/{chunk-5KPNXBNR.js → chunk-W5NZYPRQ.js} +386 -80
- package/dist/chunk-W5NZYPRQ.js.map +1 -0
- package/dist/{chunk-JEX5P66D.js → chunk-XOO6YEZE.js} +3 -3
- package/dist/{chunk-6663UXPE.js → chunk-Y7T5Z4DC.js} +3 -3
- package/dist/chunks-LWAOHTK2.js +10 -0
- package/dist/cli.js +57 -21
- package/dist/cli.js.map +1 -1
- package/dist/{formula-JLYS73QL.js → formula-IFKZZPD2.js} +4 -2
- package/dist/{formula-LIVQSCMM.js.map → formula-IFKZZPD2.js.map} +1 -1
- package/dist/{formula-CG4S7TWO.cjs → formula-PDMZMBIP.cjs} +9 -8
- package/dist/formula-PDMZMBIP.cjs.map +1 -0
- package/dist/{formula-LIVQSCMM.js → formula-V6EAYHMF.js} +3 -2
- package/dist/{image-ocr-MKD6MKWO.cjs → image-ocr-75WGMVU6.cjs} +12 -11
- package/dist/image-ocr-75WGMVU6.cjs.map +1 -0
- package/dist/{image-ocr-5QRZBNOF.js → image-ocr-B7TMIG3F.js} +10 -9
- package/dist/{image-ocr-5QRZBNOF.js.map → image-ocr-B7TMIG3F.js.map} +1 -1
- package/dist/{image-ocr-TAJHRZ5T.js → image-ocr-XHBZONFZ.js} +6 -5
- package/dist/{image-ocr-TAJHRZ5T.js.map → image-ocr-XHBZONFZ.js.map} +1 -1
- package/dist/index.cjs +865 -552
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +390 -77
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +36 -18
- package/dist/mcp.js.map +1 -1
- package/dist/model-bundle-Q4HQXJQG.js +104 -0
- package/dist/model-bundle-Q4HQXJQG.js.map +1 -0
- package/dist/{models-6SIKLKRH.js → models-QQA7OQHY.js} +5 -3
- package/dist/{parser-SWY4RKGD.cjs → parser-4CBOPTVY.cjs} +28 -27
- package/dist/parser-4CBOPTVY.cjs.map +1 -0
- package/dist/{parser-UMFBJG2D.js → parser-HT7GZOF2.js} +8 -8
- package/dist/{parser-RCEHB2EV.js.map → parser-HT7GZOF2.js.map} +1 -1
- package/dist/{parser-RCEHB2EV.js → parser-Z36MZUHS.js} +8 -7
- package/dist/{parser-UMFBJG2D.js.map → parser-Z36MZUHS.js.map} +1 -1
- package/dist/pdf-ocr-6ZNGDVC6.cjs +14 -0
- package/dist/pdf-ocr-6ZNGDVC6.cjs.map +1 -0
- package/dist/pdf-ocr-NTXRJI4T.js +13 -0
- package/dist/pdf-ocr-TYMCEUPH.js +16 -0
- package/dist/{profile-io-HT62OAEU.js → profile-io-ACYRLCSR.js} +3 -3
- package/dist/{rasterize-GL67HQC7.js → rasterize-QYCLEH2J.js} +2 -2
- package/dist/render-5Y2US4IM.js +10 -0
- package/dist/seal-VU6JS2QD.js +10 -0
- package/dist/{setup-GUQT5ELJ.js → setup-MG3YYKXU.js} +30 -7
- package/dist/setup-MG3YYKXU.js.map +1 -0
- package/dist/{watch-5ST75Q7Q.js → watch-AZIY6AWC.js} +13 -9
- package/dist/watch-AZIY6AWC.js.map +1 -0
- package/package.json +7 -3
- package/dist/chunk-3H5X63BQ.js.map +0 -1
- package/dist/chunk-4VNUQYUE.js.map +0 -1
- package/dist/chunk-5KPNXBNR.js.map +0 -1
- package/dist/chunk-7ZIOZ6PU.js.map +0 -1
- package/dist/chunk-DJKLOLBT.cjs.map +0 -1
- package/dist/chunk-IZEUWEEY.js.map +0 -1
- package/dist/chunk-UAFSPWU7.js.map +0 -1
- package/dist/chunk-ZDWP3LLY.cjs.map +0 -1
- package/dist/chunk-ZV5OKQ3Z.cjs.map +0 -1
- package/dist/chunks-C7DJL4RE.js +0 -10
- package/dist/formula-CG4S7TWO.cjs.map +0 -1
- package/dist/image-ocr-MKD6MKWO.cjs.map +0 -1
- package/dist/parser-SWY4RKGD.cjs.map +0 -1
- package/dist/pdf-ocr-3NTV3MYP.js +0 -12
- package/dist/pdf-ocr-7BOO4JA7.js +0 -15
- package/dist/pdf-ocr-JDHELYBY.cjs +0 -13
- package/dist/pdf-ocr-JDHELYBY.cjs.map +0 -1
- package/dist/render-IQ4IZLY4.js +0 -10
- package/dist/seal-AGSZ6MUR.js +0 -10
- package/dist/setup-GUQT5ELJ.js.map +0 -1
- package/dist/watch-5ST75Q7Q.js.map +0 -1
- /package/dist/{-O42BMYNX.js.map → -WYNJOQ6P.js.map} +0 -0
- /package/dist/{chunk-PLEGO474.js.map → chunk-3NKSSL44.js.map} +0 -0
- /package/dist/{chunk-UZB3UGC5.js.map → chunk-3P5YCJQE.js.map} +0 -0
- /package/dist/{chunk-AFX6ZXER.js.map → chunk-CGJDCZA3.js.map} +0 -0
- /package/dist/{chunk-J3W6Q3AX.js.map → chunk-IMFIACHP.js.map} +0 -0
- /package/dist/{chunk-BQENBAUC.js.map → chunk-JKJEBDP7.js.map} +0 -0
- /package/dist/{chunk-YWDN5PQC.js.map → chunk-KEGAEHWO.js.map} +0 -0
- /package/dist/{chunk-VECVLIWE.js.map → chunk-NYLYIN55.js.map} +0 -0
- /package/dist/{chunk-IMEMTJ76.js.map → chunk-P663PYWV.js.map} +0 -0
- /package/dist/{chunk-GZDOWYJM.js.map → chunk-TXQQ7URG.js.map} +0 -0
- /package/dist/{chunk-JEX5P66D.js.map → chunk-XOO6YEZE.js.map} +0 -0
- /package/dist/{chunk-6663UXPE.js.map → chunk-Y7T5Z4DC.js.map} +0 -0
- /package/dist/{chunks-C7DJL4RE.js.map → chunks-LWAOHTK2.js.map} +0 -0
- /package/dist/{formula-JLYS73QL.js.map → formula-V6EAYHMF.js.map} +0 -0
- /package/dist/{models-6SIKLKRH.js.map → models-QQA7OQHY.js.map} +0 -0
- /package/dist/{pdf-ocr-3NTV3MYP.js.map → pdf-ocr-NTXRJI4T.js.map} +0 -0
- /package/dist/{pdf-ocr-7BOO4JA7.js.map → pdf-ocr-TYMCEUPH.js.map} +0 -0
- /package/dist/{profile-io-HT62OAEU.js.map → profile-io-ACYRLCSR.js.map} +0 -0
- /package/dist/{rasterize-GL67HQC7.js.map → rasterize-QYCLEH2J.js.map} +0 -0
- /package/dist/{render-IQ4IZLY4.js.map → render-5Y2US4IM.js.map} +0 -0
- /package/dist/{seal-AGSZ6MUR.js.map → seal-VU6JS2QD.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkR4LXZRYPcjs = require('./chunk-R4LXZRYP.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
@@ -16,6 +16,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
var _chunkEV53YE3Wcjs = require('./chunk-EV53YE3W.cjs');
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
|
|
@@ -27,7 +28,8 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
var _chunkE6DONLTMcjs = require('./chunk-E6DONLTM.cjs');
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
@@ -396,7 +398,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
|
|
|
396
398
|
}
|
|
397
399
|
}
|
|
398
400
|
const markdown = lines.join("\n\n");
|
|
399
|
-
const metadata = { pageCount };
|
|
401
|
+
const metadata = { pageCount, pageMode: "layout" };
|
|
400
402
|
warnings.push({
|
|
401
403
|
message: "DRM \uBB38\uC11C: \uD55C\uCEF4 COM API\uB85C \uD14D\uC2A4\uD2B8 \uCD94\uCD9C (\uC11C\uC2DD/\uD45C \uC815\uBCF4 \uC81C\uD55C\uC801)",
|
|
402
404
|
code: "DRM_COM_FALLBACK"
|
|
@@ -482,7 +484,7 @@ function rawTextContent(node, depth = 0) {
|
|
|
482
484
|
// src/hwpx/parser-shared.ts
|
|
483
485
|
var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
|
|
484
486
|
var MAX_ZIP_ENTRIES = 500;
|
|
485
|
-
var ZipBombError = class extends
|
|
487
|
+
var ZipBombError = class extends _chunkE6DONLTMcjs.KordocError {
|
|
486
488
|
constructor(message) {
|
|
487
489
|
super(message);
|
|
488
490
|
this.name = "ZipBombError";
|
|
@@ -492,12 +494,17 @@ function clampSpan(val, max) {
|
|
|
492
494
|
return Math.max(1, Math.min(val, max));
|
|
493
495
|
}
|
|
494
496
|
function createSectionShared() {
|
|
495
|
-
return {
|
|
497
|
+
return {
|
|
498
|
+
numState: /* @__PURE__ */ new Map(),
|
|
499
|
+
pageText: { headers: [], footers: [] },
|
|
500
|
+
track: { deleteDepth: 0, warned: false },
|
|
501
|
+
pageState: { base: 0, allUsable: true }
|
|
502
|
+
};
|
|
496
503
|
}
|
|
497
504
|
function createXmlParser(warnings) {
|
|
498
505
|
return new (0, _xmldom.DOMParser)({
|
|
499
506
|
onError(level, msg2) {
|
|
500
|
-
if (level === "fatalError") throw new (0,
|
|
507
|
+
if (level === "fatalError") throw new (0, _chunkE6DONLTMcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
501
508
|
_optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
502
509
|
}
|
|
503
510
|
});
|
|
@@ -532,13 +539,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
532
539
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
533
540
|
const checksumType = attrOf(inner, "checksum-type");
|
|
534
541
|
if (algorithm !== AES256_CBC) {
|
|
535
|
-
throw new (0,
|
|
542
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
536
543
|
}
|
|
537
544
|
if (startKey !== START_KEY_SHA256) {
|
|
538
|
-
throw new (0,
|
|
545
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
539
546
|
}
|
|
540
547
|
if (!_optionalChain([checksumType, 'optionalAccess', _8 => _8.endsWith, 'call', _9 => _9(CHECKSUM_SHA256_1K)])) {
|
|
541
|
-
throw new (0,
|
|
548
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
542
549
|
}
|
|
543
550
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
544
551
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -546,10 +553,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
546
553
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
547
554
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
548
555
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
549
|
-
throw new (0,
|
|
556
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
550
557
|
}
|
|
551
558
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
552
|
-
throw new (0,
|
|
559
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
553
560
|
}
|
|
554
561
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
555
562
|
}
|
|
@@ -582,11 +589,11 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
582
589
|
for (const entry of entries) {
|
|
583
590
|
const file = zip.file(entry.path);
|
|
584
591
|
if (!file) {
|
|
585
|
-
throw new (0,
|
|
592
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
586
593
|
}
|
|
587
594
|
const plain = decryptEntry(await file.async("nodebuffer"), entry, startKey);
|
|
588
595
|
if (!plain) {
|
|
589
|
-
throw new (0,
|
|
596
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
590
597
|
}
|
|
591
598
|
decrypted.push({ path: entry.path, plain });
|
|
592
599
|
}
|
|
@@ -634,10 +641,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
634
641
|
const xml = await file.async("text");
|
|
635
642
|
if (decompressed) {
|
|
636
643
|
decompressed.total += xml.length * 2;
|
|
637
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
644
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
638
645
|
}
|
|
639
646
|
const parser = createXmlParser();
|
|
640
|
-
const doc = parser.parseFromString(
|
|
647
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
641
648
|
if (!doc.documentElement) continue;
|
|
642
649
|
const domDoc = doc;
|
|
643
650
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -826,9 +833,9 @@ function detectHwpxHeadings(blocks, styleMap) {
|
|
|
826
833
|
let level = 0;
|
|
827
834
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _16 => _16.style, 'optionalAccess', _17 => _17.fontSize])) {
|
|
828
835
|
const ratio = block.style.fontSize / baseFontSize;
|
|
829
|
-
if (ratio >=
|
|
830
|
-
else if (ratio >=
|
|
831
|
-
else if (ratio >=
|
|
836
|
+
if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H1) level = 1;
|
|
837
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H2) level = 2;
|
|
838
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H3) level = 3;
|
|
832
839
|
}
|
|
833
840
|
const compactText = text.replace(/\s+/g, "");
|
|
834
841
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1421,7 +1428,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1421
1428
|
|
|
1422
1429
|
// src/hwpx/table-build.ts
|
|
1423
1430
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1424
|
-
const table2 =
|
|
1431
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1425
1432
|
if (state.caption) table2.caption = state.caption;
|
|
1426
1433
|
if (_optionalChain([state, 'access', _21 => _21.captionBlocks, 'optionalAccess', _22 => _22.length])) table2.captionBlocks = state.captionBlocks;
|
|
1427
1434
|
const anchors = [];
|
|
@@ -1483,16 +1490,16 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1483
1490
|
function completeTable(newTable, tableStack, blocks, ctx) {
|
|
1484
1491
|
const parentTable = tableStack.length > 0 ? tableStack.pop() : null;
|
|
1485
1492
|
if (newTable.rows.length === 0) {
|
|
1486
|
-
if (newTable.caption) blocks.push({ type: "paragraph", text: newTable.caption, pageNumber: ctx.
|
|
1493
|
+
if (newTable.caption) blocks.push({ type: "paragraph", text: newTable.caption, pageNumber: ctx.page });
|
|
1487
1494
|
return parentTable;
|
|
1488
1495
|
}
|
|
1489
1496
|
const ir = buildTableWithCellMeta(newTable, ctx.shared.keepTrailingEmptyCols, ctx.shared.keepEmptyParagraphs);
|
|
1490
|
-
const block = { type: "table", table: ir, pageNumber: ctx.
|
|
1497
|
+
const block = { type: "table", table: ir, pageNumber: ctx.page };
|
|
1491
1498
|
if (_optionalChain([parentTable, 'optionalAccess', _29 => _29.cell])) {
|
|
1492
1499
|
const cell2 = parentTable.cell;
|
|
1493
1500
|
(cell2.blocks ??= []).push(block);
|
|
1494
1501
|
cell2.hasStructure = true;
|
|
1495
|
-
let flat =
|
|
1502
|
+
let flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1496
1503
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1497
1504
|
if (flat) {
|
|
1498
1505
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -1505,13 +1512,147 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1505
1512
|
return parentTable;
|
|
1506
1513
|
}
|
|
1507
1514
|
|
|
1515
|
+
// src/hwpx/page-boundary.ts
|
|
1516
|
+
var MIDPAGE_V = 2e3;
|
|
1517
|
+
var localName2 = (el) => {
|
|
1518
|
+
const n = el.nodeName;
|
|
1519
|
+
const i = n.indexOf(":");
|
|
1520
|
+
return i >= 0 ? n.slice(i + 1) : n;
|
|
1521
|
+
};
|
|
1522
|
+
var childElements = (parent) => {
|
|
1523
|
+
const out = [];
|
|
1524
|
+
for (let c = parent.firstChild; c; c = c.nextSibling) {
|
|
1525
|
+
if (c.nodeType === 1) out.push(c);
|
|
1526
|
+
}
|
|
1527
|
+
return out;
|
|
1528
|
+
};
|
|
1529
|
+
var numAttr = (el, name) => {
|
|
1530
|
+
const v = el.getAttribute(name);
|
|
1531
|
+
const n = v == null ? NaN : Number(v);
|
|
1532
|
+
return Number.isFinite(n) ? n : 0;
|
|
1533
|
+
};
|
|
1534
|
+
var findDescendant = (root, local, maxDepth = 8) => {
|
|
1535
|
+
if (maxDepth < 0) return null;
|
|
1536
|
+
for (const c of childElements(root)) {
|
|
1537
|
+
if (localName2(c) === local) return c;
|
|
1538
|
+
const found = findDescendant(c, local, maxDepth - 1);
|
|
1539
|
+
if (found) return found;
|
|
1540
|
+
}
|
|
1541
|
+
return null;
|
|
1542
|
+
};
|
|
1543
|
+
function linesegsOf(p) {
|
|
1544
|
+
const lsa = childElements(p).find((c) => localName2(c) === "linesegarray");
|
|
1545
|
+
return lsa ? childElements(lsa).filter((s) => localName2(s) === "lineseg") : [];
|
|
1546
|
+
}
|
|
1547
|
+
function cellFlowResets(subList) {
|
|
1548
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
1549
|
+
let resets = 0;
|
|
1550
|
+
for (const p of childElements(subList)) {
|
|
1551
|
+
if (localName2(p) !== "p") continue;
|
|
1552
|
+
for (const s of linesegsOf(p)) {
|
|
1553
|
+
const v = numAttr(s, "vertpos");
|
|
1554
|
+
if (v < prevV) resets++;
|
|
1555
|
+
prevV = v;
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
return resets;
|
|
1559
|
+
}
|
|
1560
|
+
function tableIntraBreaks(tbl2) {
|
|
1561
|
+
const rowMax = /* @__PURE__ */ new Map();
|
|
1562
|
+
for (const tr of childElements(tbl2)) {
|
|
1563
|
+
if (localName2(tr) !== "tr") continue;
|
|
1564
|
+
for (const tc2 of childElements(tr)) {
|
|
1565
|
+
if (localName2(tc2) !== "tc") continue;
|
|
1566
|
+
const addr = childElements(tc2).find((e) => localName2(e) === "cellAddr");
|
|
1567
|
+
const row = addr ? numAttr(addr, "rowAddr") : 0;
|
|
1568
|
+
const sub = childElements(tc2).find((e) => localName2(e) === "subList");
|
|
1569
|
+
if (!sub) continue;
|
|
1570
|
+
const r = cellFlowResets(sub);
|
|
1571
|
+
rowMax.set(row, Math.max(_nullishCoalesce(rowMax.get(row), () => ( 0)), r));
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
let sum = 0;
|
|
1575
|
+
for (const v of rowMax.values()) sum += v;
|
|
1576
|
+
return sum;
|
|
1577
|
+
}
|
|
1578
|
+
function detectHwpxSectionPages(root) {
|
|
1579
|
+
const colPr = findDescendant(root, "colPr");
|
|
1580
|
+
const multiCol = colPr ? numAttr(colPr, "colCount") > 1 : false;
|
|
1581
|
+
const paraPage = /* @__PURE__ */ new Map();
|
|
1582
|
+
let cur = 0;
|
|
1583
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
1584
|
+
let prevH = Number.NEGATIVE_INFINITY;
|
|
1585
|
+
let first = true;
|
|
1586
|
+
let suppressMidReset = false;
|
|
1587
|
+
let topParas = 0;
|
|
1588
|
+
let parasWithSegs = 0;
|
|
1589
|
+
for (const p of childElements(root)) {
|
|
1590
|
+
if (localName2(p) !== "p") continue;
|
|
1591
|
+
topParas++;
|
|
1592
|
+
const explicit = p.getAttribute("pageBreak") === "1";
|
|
1593
|
+
let brokeByExplicit = false;
|
|
1594
|
+
if (explicit && !first) {
|
|
1595
|
+
cur++;
|
|
1596
|
+
brokeByExplicit = true;
|
|
1597
|
+
suppressMidReset = false;
|
|
1598
|
+
}
|
|
1599
|
+
const segs = linesegsOf(p);
|
|
1600
|
+
if (segs.length > 0) parasWithSegs++;
|
|
1601
|
+
let paraFirst = true;
|
|
1602
|
+
let startPage = cur;
|
|
1603
|
+
for (const s of segs) {
|
|
1604
|
+
const v = numAttr(s, "vertpos");
|
|
1605
|
+
const h = numAttr(s, "horzpos");
|
|
1606
|
+
const brk = v < prevV ? !multiCol || h <= prevH : paraFirst && v === prevV && h <= prevH;
|
|
1607
|
+
if (brk && !(paraFirst && brokeByExplicit)) {
|
|
1608
|
+
if (paraFirst && suppressMidReset && v >= MIDPAGE_V) {
|
|
1609
|
+
} else {
|
|
1610
|
+
cur++;
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
if (paraFirst) {
|
|
1614
|
+
suppressMidReset = false;
|
|
1615
|
+
startPage = cur;
|
|
1616
|
+
}
|
|
1617
|
+
paraFirst = false;
|
|
1618
|
+
prevV = v;
|
|
1619
|
+
prevH = h;
|
|
1620
|
+
}
|
|
1621
|
+
paraPage.set(p, startPage);
|
|
1622
|
+
first = false;
|
|
1623
|
+
let add = 0;
|
|
1624
|
+
for (const r of childElements(p)) {
|
|
1625
|
+
if (localName2(r) !== "run") continue;
|
|
1626
|
+
for (const t of childElements(r)) {
|
|
1627
|
+
if (localName2(t) === "tbl") add += tableIntraBreaks(t);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
if (add > 0) {
|
|
1631
|
+
cur += add;
|
|
1632
|
+
suppressMidReset = true;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
return {
|
|
1636
|
+
paraPage,
|
|
1637
|
+
pages: cur + 1,
|
|
1638
|
+
usable: topParas > 0 && parasWithSegs === topParas
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1508
1642
|
// src/hwpx/section-walker.ts
|
|
1509
1643
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
1510
1644
|
const parser = createXmlParser(warnings);
|
|
1511
|
-
const doc = parser.parseFromString(
|
|
1645
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
1512
1646
|
if (!doc.documentElement) return [];
|
|
1513
1647
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
1514
1648
|
ctx.shared.track.deleteDepth = 0;
|
|
1649
|
+
const detect = detectHwpxSectionPages(doc.documentElement);
|
|
1650
|
+
const ps = ctx.shared.pageState;
|
|
1651
|
+
if (!detect.usable) ps.allUsable = false;
|
|
1652
|
+
ctx.paraPage = detect.paraPage;
|
|
1653
|
+
ctx.pageBase = ps.base;
|
|
1654
|
+
ctx.page = ps.base + 1;
|
|
1655
|
+
ps.base += detect.pages;
|
|
1515
1656
|
for (const tagName of ["hp:secPr", "secPr"]) {
|
|
1516
1657
|
const els = doc.getElementsByTagName(tagName);
|
|
1517
1658
|
if (els.length > 0) {
|
|
@@ -1558,7 +1699,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1558
1699
|
const chan = kordocTableChannel(el, ctx);
|
|
1559
1700
|
if (chan) {
|
|
1560
1701
|
if (chan.kind === "heading" && chan.text) {
|
|
1561
|
-
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.
|
|
1702
|
+
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.page });
|
|
1562
1703
|
}
|
|
1563
1704
|
break;
|
|
1564
1705
|
}
|
|
@@ -1577,7 +1718,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1577
1718
|
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
1578
1719
|
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
1579
1720
|
} else {
|
|
1580
|
-
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.
|
|
1721
|
+
blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.page });
|
|
1581
1722
|
}
|
|
1582
1723
|
}
|
|
1583
1724
|
break;
|
|
@@ -1615,24 +1756,26 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1615
1756
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
1616
1757
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
1617
1758
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
1618
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
1619
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
1759
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
1760
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
1620
1761
|
}
|
|
1621
1762
|
break;
|
|
1622
1763
|
case "p": {
|
|
1764
|
+
const paraPg = _optionalChain([ctx, 'access', _32 => _32.paraPage, 'optionalAccess', _33 => _33.get, 'call', _34 => _34(el)]);
|
|
1765
|
+
if (paraPg !== void 0 && ctx.pageBase !== void 0) ctx.page = ctx.pageBase + paraPg + 1;
|
|
1623
1766
|
const { text: rawText, href, footnote, style, segments } = extractParagraphInfo(el, ctx.styleMap, ctx);
|
|
1624
1767
|
let text = rawText;
|
|
1625
1768
|
let headingLevel;
|
|
1626
1769
|
const ph = resolveParaHeading(el, ctx);
|
|
1627
1770
|
if (text) {
|
|
1628
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
1629
|
-
headingLevel = _optionalChain([ph, 'optionalAccess',
|
|
1771
|
+
if (_optionalChain([ph, 'optionalAccess', _35 => _35.prefix])) text = ph.prefix + " " + text;
|
|
1772
|
+
headingLevel = _optionalChain([ph, 'optionalAccess', _36 => _36.headingLevel]);
|
|
1630
1773
|
}
|
|
1631
1774
|
if (segments) {
|
|
1632
|
-
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess',
|
|
1775
|
+
const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _37 => _37.cell]), () => ( null));
|
|
1633
1776
|
if (cell2) cell2.lineOpen = false;
|
|
1634
1777
|
const segs = [...segments];
|
|
1635
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
1778
|
+
if (_optionalChain([ph, 'optionalAccess', _38 => _38.prefix])) {
|
|
1636
1779
|
const fi = segs.findIndex((s) => s);
|
|
1637
1780
|
if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
|
|
1638
1781
|
}
|
|
@@ -1641,7 +1784,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1641
1784
|
const flush = () => {
|
|
1642
1785
|
const s = segs[segIdx++];
|
|
1643
1786
|
if (!s) return;
|
|
1644
|
-
const block = { type: "paragraph", text: s, pageNumber: ctx.
|
|
1787
|
+
const block = { type: "paragraph", text: s, pageNumber: ctx.page };
|
|
1645
1788
|
if (first && !cell2) {
|
|
1646
1789
|
first = false;
|
|
1647
1790
|
if (style) block.style = style;
|
|
@@ -1660,14 +1803,14 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1660
1803
|
break;
|
|
1661
1804
|
}
|
|
1662
1805
|
if (text) {
|
|
1663
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1806
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _39 => _39.cell])) {
|
|
1664
1807
|
const cell2 = tableCtx.cell;
|
|
1665
1808
|
if (footnote) text += ` (\uC8FC: ${footnote})`;
|
|
1666
1809
|
cell2.text += (cell2.text || cell2.paraSeen ? "\n" : "") + text;
|
|
1667
1810
|
cell2.paraSeen = true;
|
|
1668
|
-
const cellBlock = { type: "paragraph", text, pageNumber: ctx.
|
|
1811
|
+
const cellBlock = { type: "paragraph", text, pageNumber: ctx.page };
|
|
1669
1812
|
const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
1670
|
-
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess',
|
|
1813
|
+
if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _40 => _40.prefix])) {
|
|
1671
1814
|
const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
|
|
1672
1815
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
1673
1816
|
cellBlock.spans = spans;
|
|
@@ -1677,16 +1820,16 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1677
1820
|
(cell2.blocks ??= []).push(cellBlock);
|
|
1678
1821
|
} else if (!tableCtx) {
|
|
1679
1822
|
if (ctx.shared.kordocLayout && /^─{10,}$/.test(text)) {
|
|
1680
|
-
blocks.push({ type: "separator", pageNumber: ctx.
|
|
1823
|
+
blocks.push({ type: "separator", pageNumber: ctx.page });
|
|
1681
1824
|
tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1);
|
|
1682
1825
|
break;
|
|
1683
1826
|
}
|
|
1684
|
-
const block = { type: headingLevel ? "heading" : "paragraph", text, pageNumber: ctx.
|
|
1827
|
+
const block = { type: headingLevel ? "heading" : "paragraph", text, pageNumber: ctx.page };
|
|
1685
1828
|
if (headingLevel) block.level = headingLevel;
|
|
1686
1829
|
if (style) block.style = style;
|
|
1687
1830
|
if (href) block.href = href;
|
|
1688
1831
|
if (footnote) block.footnoteText = footnote;
|
|
1689
|
-
const ind = _optionalChain([ctx, 'access',
|
|
1832
|
+
const ind = _optionalChain([ctx, 'access', _41 => _41.styleMap, 'optionalAccess', _42 => _42.paraIndents, 'access', _43 => _43.get, 'call', _44 => _44(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
|
|
1690
1833
|
if (ind) {
|
|
1691
1834
|
const eff = ind.left + Math.max(0, ind.intent);
|
|
1692
1835
|
if (eff > 0) block.indent = eff;
|
|
@@ -1697,7 +1840,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1697
1840
|
}
|
|
1698
1841
|
const spanMode = spanModeOf(ctx.shared.kordocLayout);
|
|
1699
1842
|
if (!headingLevel && spanMode) {
|
|
1700
|
-
if (!_optionalChain([ph, 'optionalAccess',
|
|
1843
|
+
if (!_optionalChain([ph, 'optionalAccess', _45 => _45.prefix])) {
|
|
1701
1844
|
const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
|
|
1702
1845
|
if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
|
|
1703
1846
|
block.spans = spans;
|
|
@@ -1707,17 +1850,17 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1707
1850
|
}
|
|
1708
1851
|
blocks.push(block);
|
|
1709
1852
|
} else {
|
|
1710
|
-
blocks.push({ type: "paragraph", text, pageNumber: ctx.
|
|
1853
|
+
blocks.push({ type: "paragraph", text, pageNumber: ctx.page });
|
|
1711
1854
|
}
|
|
1712
1855
|
} else if (ctx.shared.keepEmptyParagraphs && !hasObjectDescendant(el)) {
|
|
1713
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1856
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _46 => _46.cell])) {
|
|
1714
1857
|
const cell2 = tableCtx.cell;
|
|
1715
1858
|
if (cell2.text || cell2.paraSeen) cell2.text += "\n";
|
|
1716
1859
|
cell2.paraSeen = true;
|
|
1717
1860
|
cell2.lineOpen = false;
|
|
1718
|
-
(cell2.blocks ??= []).push({ type: "paragraph", text: "", pageNumber: ctx.
|
|
1861
|
+
(cell2.blocks ??= []).push({ type: "paragraph", text: "", pageNumber: ctx.page });
|
|
1719
1862
|
} else if (!tableCtx) {
|
|
1720
|
-
blocks.push({ type: "paragraph", text: "", pageNumber: ctx.
|
|
1863
|
+
blocks.push({ type: "paragraph", text: "", pageNumber: ctx.page });
|
|
1721
1864
|
}
|
|
1722
1865
|
}
|
|
1723
1866
|
tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1);
|
|
@@ -1727,7 +1870,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1727
1870
|
case "pic":
|
|
1728
1871
|
case "shape":
|
|
1729
1872
|
case "drawingObject": {
|
|
1730
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
1873
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) {
|
|
1731
1874
|
const sink = [];
|
|
1732
1875
|
handleShape(el, sink, ctx);
|
|
1733
1876
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1740,7 +1883,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1740
1883
|
case "memogroup":
|
|
1741
1884
|
case "memo": {
|
|
1742
1885
|
if (ctx.warnings && extractTextFromNode(el)) {
|
|
1743
|
-
ctx.warnings.push({ page: ctx.
|
|
1886
|
+
ctx.warnings.push({ page: ctx.page, message: "\uBA54\uBAA8 \uD14D\uC2A4\uD2B8 \uBCF8\uBB38 \uC81C\uC678: memogroup", code: "HIDDEN_TEXT_FILTERED" });
|
|
1744
1887
|
}
|
|
1745
1888
|
break;
|
|
1746
1889
|
}
|
|
@@ -1752,9 +1895,9 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
1752
1895
|
}
|
|
1753
1896
|
function handleShape(el, sink, ctx) {
|
|
1754
1897
|
const imgRef = extractImageRef(el);
|
|
1755
|
-
const drawTextChild =
|
|
1898
|
+
const drawTextChild = findDescendant2(el, "drawText");
|
|
1756
1899
|
if (imgRef) {
|
|
1757
|
-
const block = { type: "image", text: imgRef, pageNumber: ctx.
|
|
1900
|
+
const block = { type: "image", text: imgRef, pageNumber: ctx.page };
|
|
1758
1901
|
const alt = userShapeComment(el);
|
|
1759
1902
|
if (alt) block.footnoteText = alt;
|
|
1760
1903
|
sink.push(block);
|
|
@@ -1765,11 +1908,11 @@ function handleShape(el, sink, ctx) {
|
|
|
1765
1908
|
const capEl = findChildByLocalName(el, "caption");
|
|
1766
1909
|
if (capEl) {
|
|
1767
1910
|
const capText = collectSubListText(capEl, ctx);
|
|
1768
|
-
if (capText) sink.push({ type: "paragraph", text: capText, pageNumber: ctx.
|
|
1911
|
+
if (capText) sink.push({ type: "paragraph", text: capText, pageNumber: ctx.page });
|
|
1769
1912
|
}
|
|
1770
1913
|
if (!imgRef && !drawTextChild && ctx.warnings && ctx.sectionNum) {
|
|
1771
1914
|
const localTag = (el.tagName || el.localName || "").replace(/^[^:]+:/, "");
|
|
1772
|
-
ctx.warnings.push({ page: ctx.
|
|
1915
|
+
ctx.warnings.push({ page: ctx.page, message: `\uC2A4\uD0B5\uB41C \uC694\uC18C: ${localTag}`, code: "SKIPPED_IMAGE" });
|
|
1773
1916
|
}
|
|
1774
1917
|
}
|
|
1775
1918
|
function userShapeComment(el) {
|
|
@@ -1832,7 +1975,7 @@ function hasPageAutoNum(el, depth = 0) {
|
|
|
1832
1975
|
const ch = children[i];
|
|
1833
1976
|
if (ch.nodeType !== 1) continue;
|
|
1834
1977
|
const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
|
|
1835
|
-
if (tag === "autoNum" && _optionalChain([ch, 'access',
|
|
1978
|
+
if (tag === "autoNum" && _optionalChain([ch, 'access', _48 => _48.getAttribute, 'optionalCall', _49 => _49("numType")]) === "PAGE") return true;
|
|
1836
1979
|
if (hasPageAutoNum(ch, depth + 1)) return true;
|
|
1837
1980
|
}
|
|
1838
1981
|
return false;
|
|
@@ -1854,7 +1997,7 @@ function collectSubListContent(el, ctx, depth = 0) {
|
|
|
1854
1997
|
const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
|
|
1855
1998
|
if (t) {
|
|
1856
1999
|
parts.push(t);
|
|
1857
|
-
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.
|
|
2000
|
+
out.blocks.push({ type: "paragraph", text: t, pageNumber: ctx.page });
|
|
1858
2001
|
}
|
|
1859
2002
|
const tbls = [];
|
|
1860
2003
|
findTopLevelTbls(ch, tbls);
|
|
@@ -1887,7 +2030,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
1887
2030
|
const sink = [];
|
|
1888
2031
|
const st = { rows: [], currentRow: [], cell: null };
|
|
1889
2032
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
1890
|
-
let flat =
|
|
2033
|
+
let flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, st.rows);
|
|
1891
2034
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
1892
2035
|
const built = [];
|
|
1893
2036
|
completeTable(st, [], built, ctx);
|
|
@@ -1927,7 +2070,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1927
2070
|
const chan = kordocTableChannel(el, ctx);
|
|
1928
2071
|
if (chan) {
|
|
1929
2072
|
if (chan.kind === "heading" && chan.text) {
|
|
1930
|
-
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.
|
|
2073
|
+
blocks.push({ type: "heading", level: chan.level, text: chan.text, pageNumber: ctx.page });
|
|
1931
2074
|
}
|
|
1932
2075
|
continue;
|
|
1933
2076
|
}
|
|
@@ -1939,14 +2082,14 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1939
2082
|
} else if (localTag === "caption" && !inShape) {
|
|
1940
2083
|
const cap = collectSubListContent(el, ctx);
|
|
1941
2084
|
if (cap.text) {
|
|
1942
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2085
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _50 => _50.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: cap.text, pageNumber: ctx.page }]);
|
|
1943
2086
|
else if (tableCtx) {
|
|
1944
2087
|
tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + cap.text;
|
|
1945
2088
|
if (cap.hasStructure) (tableCtx.captionBlocks ??= []).push(...cap.blocks);
|
|
1946
|
-
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.
|
|
2089
|
+
} else blocks.push({ type: "paragraph", text: cap.text, pageNumber: ctx.page });
|
|
1947
2090
|
}
|
|
1948
2091
|
} else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
|
|
1949
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2092
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _51 => _51.cell])) {
|
|
1950
2093
|
const sink = [];
|
|
1951
2094
|
handleShape(el, sink, ctx);
|
|
1952
2095
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1954,7 +2097,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
|
|
|
1954
2097
|
handleShape(el, blocks, ctx);
|
|
1955
2098
|
}
|
|
1956
2099
|
} else if (localTag === "drawText") {
|
|
1957
|
-
if (_optionalChain([tableCtx, 'optionalAccess',
|
|
2100
|
+
if (_optionalChain([tableCtx, 'optionalAccess', _52 => _52.cell])) {
|
|
1958
2101
|
const sink = [];
|
|
1959
2102
|
extractDrawTextBlocks(el, sink, ctx);
|
|
1960
2103
|
mergeBlocksIntoCell(tableCtx.cell, sink);
|
|
@@ -1986,9 +2129,9 @@ function hasObjectDescendant(node, depth = 0) {
|
|
|
1986
2129
|
return false;
|
|
1987
2130
|
}
|
|
1988
2131
|
function isInlineTbl(tbl2) {
|
|
1989
|
-
return _optionalChain([findChildByLocalName, 'call',
|
|
2132
|
+
return _optionalChain([findChildByLocalName, 'call', _53 => _53(tbl2, "pos"), 'optionalAccess', _54 => _54.getAttribute, 'call', _55 => _55("treatAsChar")]) === "1";
|
|
1990
2133
|
}
|
|
1991
|
-
function
|
|
2134
|
+
function findDescendant2(node, targetTag, depth = 0) {
|
|
1992
2135
|
if (depth > 5) return null;
|
|
1993
2136
|
const children = node.childNodes;
|
|
1994
2137
|
if (!children) return null;
|
|
@@ -1997,7 +2140,7 @@ function findDescendant(node, targetTag, depth = 0) {
|
|
|
1997
2140
|
if (child.nodeType !== 1) continue;
|
|
1998
2141
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
1999
2142
|
if (tag === targetTag) return child;
|
|
2000
|
-
const found =
|
|
2143
|
+
const found = findDescendant2(child, targetTag, depth + 1);
|
|
2001
2144
|
if (found) return found;
|
|
2002
2145
|
}
|
|
2003
2146
|
return null;
|
|
@@ -2017,8 +2160,8 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
|
|
|
2017
2160
|
let text = info.text.trim();
|
|
2018
2161
|
const ph = resolveParaHeading(child, ctx);
|
|
2019
2162
|
if (text) {
|
|
2020
|
-
if (_optionalChain([ph, 'optionalAccess',
|
|
2021
|
-
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.
|
|
2163
|
+
if (_optionalChain([ph, 'optionalAccess', _56 => _56.prefix])) text = ph.prefix + " " + text;
|
|
2164
|
+
const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.page };
|
|
2022
2165
|
if (info.href) block.href = info.href;
|
|
2023
2166
|
if (info.footnote) block.footnoteText = info.footnote;
|
|
2024
2167
|
blocks.push(block);
|
|
@@ -2042,13 +2185,13 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2042
2185
|
let url = (ch.textContent || "").trim();
|
|
2043
2186
|
if (!url) continue;
|
|
2044
2187
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2045
|
-
const safe =
|
|
2188
|
+
const safe = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, url);
|
|
2046
2189
|
if (safe) return safe;
|
|
2047
2190
|
}
|
|
2048
2191
|
return void 0;
|
|
2049
2192
|
}
|
|
2050
2193
|
function isInDeletedRange(ctx) {
|
|
2051
|
-
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess',
|
|
2194
|
+
return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _57 => _57.shared, 'access', _58 => _58.track, 'access', _59 => _59.deleteDepth]), () => ( 0))) > 0;
|
|
2052
2195
|
}
|
|
2053
2196
|
function extractParagraphInfo(para2, styleMap, ctx) {
|
|
2054
2197
|
let text = "";
|
|
@@ -2069,7 +2212,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2069
2212
|
};
|
|
2070
2213
|
const onFieldEnd = () => {
|
|
2071
2214
|
const open = openFields.pop();
|
|
2072
|
-
if (_optionalChain([open, 'optionalAccess',
|
|
2215
|
+
if (_optionalChain([open, 'optionalAccess', _60 => _60.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
|
|
2073
2216
|
};
|
|
2074
2217
|
const handleCtrl = (ctrlEl) => {
|
|
2075
2218
|
const kids = ctrlEl.childNodes;
|
|
@@ -2120,8 +2263,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2120
2263
|
// 삽입분은 최종본에 포함
|
|
2121
2264
|
// 숨은 설명 — 본문 혼입 차단
|
|
2122
2265
|
case "hiddenComment": {
|
|
2123
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2124
|
-
ctx.warnings.push({ page: ctx.
|
|
2266
|
+
if (_optionalChain([ctx, 'optionalAccess', _61 => _61.warnings]) && extractTextFromNode(k)) {
|
|
2267
|
+
ctx.warnings.push({ page: ctx.page, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
|
|
2125
2268
|
}
|
|
2126
2269
|
break;
|
|
2127
2270
|
}
|
|
@@ -2140,8 +2283,8 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2140
2283
|
break;
|
|
2141
2284
|
// 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
|
|
2142
2285
|
default: {
|
|
2143
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2144
|
-
ctx.warnings.push({ page: ctx.
|
|
2286
|
+
if (_optionalChain([ctx, 'optionalAccess', _62 => _62.warnings]) && extractTextFromNode(k)) {
|
|
2287
|
+
ctx.warnings.push({ page: ctx.page, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
|
|
2145
2288
|
}
|
|
2146
2289
|
}
|
|
2147
2290
|
}
|
|
@@ -2158,7 +2301,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2158
2301
|
if (isInDeletedRange(ctx)) {
|
|
2159
2302
|
if (t && ctx && !ctx.shared.track.warned) {
|
|
2160
2303
|
ctx.shared.track.warned = true;
|
|
2161
|
-
_optionalChain([ctx, 'access',
|
|
2304
|
+
_optionalChain([ctx, 'access', _63 => _63.warnings, 'optionalAccess', _64 => _64.push, 'call', _65 => _65({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2162
2305
|
}
|
|
2163
2306
|
} else {
|
|
2164
2307
|
text += t.replace(/\x1E/g, "");
|
|
@@ -2202,7 +2345,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2202
2345
|
case "hyperlink": {
|
|
2203
2346
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2204
2347
|
if (url) {
|
|
2205
|
-
const safe =
|
|
2348
|
+
const safe = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, url);
|
|
2206
2349
|
if (safe) href = safe;
|
|
2207
2350
|
}
|
|
2208
2351
|
walk(child, depth + 1);
|
|
@@ -2268,9 +2411,9 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2268
2411
|
const latex = hmlToLatex(raw).trim();
|
|
2269
2412
|
if (latex) text += " $" + latex + "$ ";
|
|
2270
2413
|
} catch (e13) {
|
|
2271
|
-
if (_optionalChain([ctx, 'optionalAccess',
|
|
2414
|
+
if (_optionalChain([ctx, 'optionalAccess', _66 => _66.warnings])) {
|
|
2272
2415
|
ctx.warnings.push({
|
|
2273
|
-
page: ctx.
|
|
2416
|
+
page: ctx.page,
|
|
2274
2417
|
message: `\uC218\uC2DD LaTeX \uBCC0\uD658 \uC2E4\uD328 \u2014 \uC218\uC2DD \uD14D\uC2A4\uD2B8 \uC81C\uC678: ${raw.trim().slice(0, 40)}`,
|
|
2275
2418
|
code: "PARTIAL_PARSE"
|
|
2276
2419
|
});
|
|
@@ -2356,13 +2499,13 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2356
2499
|
if (tag !== "run" && tag !== "r") return null;
|
|
2357
2500
|
let text = "";
|
|
2358
2501
|
const rkids = child.childNodes;
|
|
2359
|
-
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess',
|
|
2502
|
+
for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _67 => _67.length]), () => ( 0))); j++) {
|
|
2360
2503
|
const rc = rkids[j];
|
|
2361
2504
|
if (rc.nodeType !== 1) continue;
|
|
2362
2505
|
const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
|
|
2363
2506
|
if (rtag === "t") {
|
|
2364
2507
|
const tkids = rc.childNodes;
|
|
2365
|
-
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess',
|
|
2508
|
+
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _68 => _68.length]), () => ( 0))); k++) {
|
|
2366
2509
|
const tk = tkids[k];
|
|
2367
2510
|
if (tk.nodeType === 3 || tk.nodeType === 4) text += tk.textContent || "";
|
|
2368
2511
|
else if (tk.nodeType === 1) return null;
|
|
@@ -2380,10 +2523,10 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2380
2523
|
const span = { text };
|
|
2381
2524
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
|
|
2382
2525
|
else {
|
|
2383
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2384
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2385
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2386
|
-
if (_optionalChain([cp, 'optionalAccess',
|
|
2526
|
+
if (_optionalChain([cp, 'optionalAccess', _69 => _69.bold])) span.bold = true;
|
|
2527
|
+
if (_optionalChain([cp, 'optionalAccess', _70 => _70.italic])) span.italic = true;
|
|
2528
|
+
if (_optionalChain([cp, 'optionalAccess', _71 => _71.strike])) span.strike = true;
|
|
2529
|
+
if (_optionalChain([cp, 'optionalAccess', _72 => _72.underline])) span.underline = true;
|
|
2387
2530
|
}
|
|
2388
2531
|
if (span.bold || span.italic || span.strike || span.underline || span.code) styled = true;
|
|
2389
2532
|
spans.push(span);
|
|
@@ -2406,12 +2549,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2406
2549
|
if (!styleMap) return null;
|
|
2407
2550
|
let unit = 0;
|
|
2408
2551
|
const kids = para2.childNodes;
|
|
2409
|
-
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess',
|
|
2552
|
+
for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids, 'optionalAccess', _73 => _73.length]), () => ( 0))); i++) {
|
|
2410
2553
|
const child = kids[i];
|
|
2411
2554
|
if (child.nodeType !== 1) continue;
|
|
2412
2555
|
const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
|
|
2413
2556
|
if (tag !== "run" && tag !== "r") continue;
|
|
2414
|
-
const size = _optionalChain([styleMap, 'access',
|
|
2557
|
+
const size = _optionalChain([styleMap, 'access', _74 => _74.charProperties, 'access', _75 => _75.get, 'call', _76 => _76(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _77 => _77.fontSize]);
|
|
2415
2558
|
if (size) unit = size * 100;
|
|
2416
2559
|
break;
|
|
2417
2560
|
}
|
|
@@ -2427,6 +2570,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2427
2570
|
var TAG_PARA_HEADER = 66;
|
|
2428
2571
|
var TAG_PARA_TEXT = 67;
|
|
2429
2572
|
var TAG_CHAR_SHAPE = 68;
|
|
2573
|
+
var TAG_PARA_LINE_SEG = 69;
|
|
2430
2574
|
var TAG_CTRL_HEADER = 71;
|
|
2431
2575
|
var TAG_LIST_HEADER = 72;
|
|
2432
2576
|
var TAG_TABLE = 77;
|
|
@@ -2484,7 +2628,7 @@ function decompressStream(data) {
|
|
|
2484
2628
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
2485
2629
|
}
|
|
2486
2630
|
function parseFileHeader(data) {
|
|
2487
|
-
if (data.length < 40) throw new (0,
|
|
2631
|
+
if (data.length < 40) throw new (0, _chunkE6DONLTMcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
2488
2632
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
2489
2633
|
return {
|
|
2490
2634
|
signature: sig,
|
|
@@ -2617,7 +2761,7 @@ function appendParaText(state, data, resolveControl) {
|
|
|
2617
2761
|
const resolveAt = (byteOffset, extended) => {
|
|
2618
2762
|
const ctrlId = data.readUInt32LE(byteOffset);
|
|
2619
2763
|
const idx = extended ? state.ctrlIdx : -1;
|
|
2620
|
-
const replacement = _optionalChain([resolveControl, 'optionalCall',
|
|
2764
|
+
const replacement = _optionalChain([resolveControl, 'optionalCall', _78 => _78(idx, ctrlId)]);
|
|
2621
2765
|
if (replacement) result += replacement;
|
|
2622
2766
|
if (extended) state.ctrlIdx++;
|
|
2623
2767
|
};
|
|
@@ -2821,7 +2965,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
|
2821
2965
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
2822
2966
|
if (fileIndex) {
|
|
2823
2967
|
for (const entry of fileIndex) {
|
|
2824
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
2968
|
+
if (!_optionalChain([entry, 'optionalAccess', _79 => _79.name]) || !entry.content) continue;
|
|
2825
2969
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
2826
2970
|
if (!match) continue;
|
|
2827
2971
|
const idx = parseInt(match[1], 16);
|
|
@@ -2897,11 +3041,11 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
|
|
|
2897
3041
|
} else if (block.type === "table" && block.table) {
|
|
2898
3042
|
for (const row of block.table.cells) {
|
|
2899
3043
|
for (const cell2 of row) {
|
|
2900
|
-
if (_optionalChain([cell2, 'access',
|
|
3044
|
+
if (_optionalChain([cell2, 'access', _80 => _80.blocks, 'optionalAccess', _81 => _81.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
|
|
2901
3045
|
}
|
|
2902
3046
|
}
|
|
2903
3047
|
}
|
|
2904
|
-
if (_optionalChain([block, 'access',
|
|
3048
|
+
if (_optionalChain([block, 'access', _82 => _82.children, 'optionalAccess', _83 => _83.length])) collectImageBlocks2(block.children, out, ownerCell, depth + 1);
|
|
2905
3049
|
}
|
|
2906
3050
|
}
|
|
2907
3051
|
async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUnreferenced) {
|
|
@@ -2936,13 +3080,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2936
3080
|
}
|
|
2937
3081
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
2938
3082
|
for (const path of allCandidates) {
|
|
2939
|
-
if (
|
|
3083
|
+
if (_chunkE6DONLTMcjs.isPathTraversal.call(void 0, path)) continue;
|
|
2940
3084
|
const file = zip.file(path);
|
|
2941
3085
|
if (!file) continue;
|
|
2942
3086
|
try {
|
|
2943
3087
|
const data = await file.async("uint8array");
|
|
2944
3088
|
decompressed.total += data.length;
|
|
2945
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3089
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2946
3090
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
2947
3091
|
const mimeType = imageExtToMime(ext);
|
|
2948
3092
|
imageIndex++;
|
|
@@ -2952,10 +3096,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2952
3096
|
usedPaths.add(path);
|
|
2953
3097
|
break;
|
|
2954
3098
|
} catch (err) {
|
|
2955
|
-
if (err instanceof
|
|
3099
|
+
if (err instanceof _chunkE6DONLTMcjs.KordocError) throw err;
|
|
2956
3100
|
}
|
|
2957
3101
|
}
|
|
2958
|
-
if (!img) _optionalChain([warnings, 'optionalAccess',
|
|
3102
|
+
if (!img) _optionalChain([warnings, 'optionalAccess', _84 => _84.push, 'call', _85 => _85({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
2959
3103
|
resolved.set(ref, img);
|
|
2960
3104
|
}
|
|
2961
3105
|
if (!img) {
|
|
@@ -2972,11 +3116,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2972
3116
|
if (sweepUnreferenced) {
|
|
2973
3117
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
2974
3118
|
for (const file of binEntries) {
|
|
2975
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3119
|
+
if (file.dir || usedPaths.has(file.name) || _chunkE6DONLTMcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
2976
3120
|
try {
|
|
2977
3121
|
const data = await file.async("uint8array");
|
|
2978
3122
|
decompressed.total += data.length;
|
|
2979
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3123
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
2980
3124
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
2981
3125
|
let mimeType = imageExtToMime(ext);
|
|
2982
3126
|
if (mimeType === "application/octet-stream") {
|
|
@@ -2990,8 +3134,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
2990
3134
|
images.push(img);
|
|
2991
3135
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
2992
3136
|
} catch (err) {
|
|
2993
|
-
if (err instanceof
|
|
2994
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
3137
|
+
if (err instanceof _chunkE6DONLTMcjs.KordocError) throw err;
|
|
3138
|
+
_optionalChain([warnings, 'optionalAccess', _86 => _86.push, 'call', _87 => _87({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
2995
3139
|
}
|
|
2996
3140
|
}
|
|
2997
3141
|
}
|
|
@@ -3041,7 +3185,7 @@ function extractFromBrokenZip(buffer) {
|
|
|
3041
3185
|
}
|
|
3042
3186
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3043
3187
|
const name = new TextDecoder().decode(nameBytes);
|
|
3044
|
-
if (
|
|
3188
|
+
if (_chunkE6DONLTMcjs.isPathTraversal.call(void 0, name)) {
|
|
3045
3189
|
pos = fileStart + compSize;
|
|
3046
3190
|
continue;
|
|
3047
3191
|
}
|
|
@@ -3059,16 +3203,18 @@ function extractFromBrokenZip(buffer) {
|
|
|
3059
3203
|
continue;
|
|
3060
3204
|
}
|
|
3061
3205
|
totalDecompressed += content.length * 2;
|
|
3062
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3206
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3063
3207
|
sectionNum++;
|
|
3064
|
-
|
|
3208
|
+
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3209
|
+
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
3210
|
+
blocks.push(...secBlocks);
|
|
3065
3211
|
} catch (e17) {
|
|
3066
3212
|
continue;
|
|
3067
3213
|
}
|
|
3068
3214
|
}
|
|
3069
|
-
if (blocks.length === 0) throw new (0,
|
|
3215
|
+
if (blocks.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3070
3216
|
applyPageText(blocks, shared);
|
|
3071
|
-
const markdown =
|
|
3217
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3072
3218
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3073
3219
|
}
|
|
3074
3220
|
async function readKordocLayout(zip) {
|
|
@@ -3077,7 +3223,7 @@ async function readKordocLayout(zip) {
|
|
|
3077
3223
|
try {
|
|
3078
3224
|
const xml = await file.async("text");
|
|
3079
3225
|
if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
|
|
3080
|
-
return _nullishCoalesce(_optionalChain([xml, 'access',
|
|
3226
|
+
return _nullishCoalesce(_optionalChain([xml, 'access', _88 => _88.match, 'call', _89 => _89(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _90 => _90[1]]), () => ( null));
|
|
3081
3227
|
} catch (e18) {
|
|
3082
3228
|
return null;
|
|
3083
3229
|
}
|
|
@@ -3093,18 +3239,18 @@ async function resolveSectionPaths(zip) {
|
|
|
3093
3239
|
if (paths.length > 0) return paths;
|
|
3094
3240
|
}
|
|
3095
3241
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3096
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3242
|
+
return sectionFiles.map((f) => f.name).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
3097
3243
|
}
|
|
3098
3244
|
function parseSectionPathsFromManifest(xml) {
|
|
3099
3245
|
const parser = createXmlParser();
|
|
3100
|
-
const doc = parser.parseFromString(
|
|
3246
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3101
3247
|
const items = doc.getElementsByTagName("opf:item");
|
|
3102
3248
|
const spine = doc.getElementsByTagName("opf:itemref");
|
|
3103
3249
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3104
3250
|
for (let i = 0; i < items.length; i++) {
|
|
3105
3251
|
const item = items[i];
|
|
3106
3252
|
const id = item.getAttribute("id") || "";
|
|
3107
|
-
const href =
|
|
3253
|
+
const href = _chunkE6DONLTMcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3108
3254
|
if (id && href) idToHref.set(id, href);
|
|
3109
3255
|
}
|
|
3110
3256
|
if (spine.length > 0) {
|
|
@@ -3115,7 +3261,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3115
3261
|
}
|
|
3116
3262
|
if (ordered.length > 0) return ordered;
|
|
3117
3263
|
}
|
|
3118
|
-
return Array.from(idToHref.values()).sort(
|
|
3264
|
+
return Array.from(idToHref.values()).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
3119
3265
|
}
|
|
3120
3266
|
|
|
3121
3267
|
// src/hwpx/metadata.ts
|
|
@@ -3128,7 +3274,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3128
3274
|
const xml = await file.async("text");
|
|
3129
3275
|
if (decompressed) {
|
|
3130
3276
|
decompressed.total += xml.length * 2;
|
|
3131
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3277
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3132
3278
|
}
|
|
3133
3279
|
parseDublinCoreMetadata(xml, metadata);
|
|
3134
3280
|
if (metadata.title || metadata.author) return;
|
|
@@ -3138,13 +3284,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3138
3284
|
}
|
|
3139
3285
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3140
3286
|
const parser = createXmlParser();
|
|
3141
|
-
const doc = parser.parseFromString(
|
|
3287
|
+
const doc = parser.parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3142
3288
|
if (!doc.documentElement) return;
|
|
3143
3289
|
const getText = (tagNames) => {
|
|
3144
3290
|
for (const tag of tagNames) {
|
|
3145
3291
|
const els = doc.getElementsByTagName(tag);
|
|
3146
3292
|
if (els.length > 0) {
|
|
3147
|
-
const text = _optionalChain([els, 'access',
|
|
3293
|
+
const text = _optionalChain([els, 'access', _91 => _91[0], 'access', _92 => _92.textContent, 'optionalAccess', _93 => _93.trim, 'call', _94 => _94()]);
|
|
3148
3294
|
if (text) return text;
|
|
3149
3295
|
}
|
|
3150
3296
|
}
|
|
@@ -3163,7 +3309,7 @@ function parseDublinCoreMetadata(xml, metadata) {
|
|
|
3163
3309
|
|
|
3164
3310
|
// src/hwpx/parser.ts
|
|
3165
3311
|
async function parseHwpxDocument(buffer, options) {
|
|
3166
|
-
|
|
3312
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3167
3313
|
let zip;
|
|
3168
3314
|
try {
|
|
3169
3315
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3172,22 +3318,22 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3172
3318
|
}
|
|
3173
3319
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3174
3320
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3175
|
-
throw new (0,
|
|
3321
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3176
3322
|
}
|
|
3177
3323
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3178
3324
|
if (manifestFile) {
|
|
3179
3325
|
const manifestXml = await manifestFile.async("text");
|
|
3180
3326
|
if (isEncryptedHwpx(manifestXml)) {
|
|
3181
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
3327
|
+
if (_optionalChain([options, 'optionalAccess', _95 => _95.password])) {
|
|
3182
3328
|
await decryptHwpxInPlace(zip, manifestXml, options.password);
|
|
3183
3329
|
} else {
|
|
3184
|
-
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
3330
|
+
if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _96 => _96.filePath])) {
|
|
3185
3331
|
const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
|
|
3186
3332
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
3187
3333
|
return comResultToParseResult(pages, pageCount, warnings2);
|
|
3188
3334
|
}
|
|
3189
3335
|
}
|
|
3190
|
-
throw new (0,
|
|
3336
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
3191
3337
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
3192
3338
|
);
|
|
3193
3339
|
}
|
|
@@ -3199,37 +3345,52 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3199
3345
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3200
3346
|
const warnings = [];
|
|
3201
3347
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3202
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3203
|
-
|
|
3204
|
-
const pageFilter = _optionalChain([options, 'optionalAccess', _94 => _94.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
|
|
3205
|
-
const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
|
|
3206
|
-
const blocks = [];
|
|
3348
|
+
if (sectionPaths.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3349
|
+
let allBlocks = [];
|
|
3207
3350
|
const shared = createSectionShared();
|
|
3208
3351
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
3209
|
-
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess',
|
|
3210
|
-
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess',
|
|
3352
|
+
shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _97 => _97.keepTrailingEmptyCols]);
|
|
3353
|
+
shared.keepEmptyParagraphs = _optionalChain([options, 'optionalAccess', _98 => _98.keepEmptyParagraphs]);
|
|
3354
|
+
const sectionRanges = [];
|
|
3211
3355
|
let parsedSections = 0;
|
|
3212
3356
|
for (let si = 0; si < sectionPaths.length; si++) {
|
|
3213
|
-
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
3214
3357
|
const file = zip.file(sectionPaths[si]);
|
|
3215
3358
|
if (!file) continue;
|
|
3216
3359
|
try {
|
|
3217
3360
|
const xml = await file.async("text");
|
|
3218
3361
|
decompressed.total += xml.length * 2;
|
|
3219
3362
|
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3220
|
-
|
|
3363
|
+
const start = allBlocks.length;
|
|
3364
|
+
allBlocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
|
|
3365
|
+
sectionRanges.push({ sectionNum: si + 1, start, end: allBlocks.length });
|
|
3221
3366
|
parsedSections++;
|
|
3222
|
-
_optionalChain([options, 'optionalAccess',
|
|
3367
|
+
_optionalChain([options, 'optionalAccess', _99 => _99.onProgress, 'optionalCall', _100 => _100(parsedSections, sectionPaths.length)]);
|
|
3223
3368
|
} catch (secErr) {
|
|
3224
3369
|
if (secErr instanceof ZipBombError) throw secErr;
|
|
3225
3370
|
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" });
|
|
3226
3371
|
}
|
|
3227
3372
|
}
|
|
3373
|
+
const layoutPages = shared.pageState.allUsable && parsedSections > 0;
|
|
3374
|
+
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
3375
|
+
metadata.pageCount = layoutPages ? Math.max(shared.pageState.base, 1) : sectionPaths.length;
|
|
3376
|
+
if (!layoutPages) {
|
|
3377
|
+
for (const r of sectionRanges) {
|
|
3378
|
+
for (let b = r.start; b < r.end; b++) allBlocks[b].pageNumber = r.sectionNum;
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
if (_optionalChain([options, 'optionalAccess', _101 => _101.pages])) {
|
|
3382
|
+
const pageFilter = _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount);
|
|
3383
|
+
allBlocks = allBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
3384
|
+
if (!layoutPages) {
|
|
3385
|
+
warnings.push({ code: "PAGE_BOUNDARY_APPROXIMATE", message: "\uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uC5B4 pages \uD544\uD130\uB97C \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC\uB85C \uC801\uC6A9\uD588\uC2B5\uB2C8\uB2E4" });
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
const blocks = allBlocks;
|
|
3228
3389
|
applyPageText(blocks, shared);
|
|
3229
|
-
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !
|
|
3390
|
+
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _102 => _102.pages]));
|
|
3230
3391
|
detectHwpxHeadings(blocks, styleMap);
|
|
3231
3392
|
const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
3232
|
-
const markdown =
|
|
3393
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
3233
3394
|
return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
3234
3395
|
}
|
|
3235
3396
|
|
|
@@ -4229,24 +4390,130 @@ function decryptPasswordStream(raw, password) {
|
|
|
4229
4390
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4230
4391
|
var TAG_ID_MAPPINGS = 17;
|
|
4231
4392
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4232
|
-
const wrong = () => new (0,
|
|
4393
|
+
const wrong = () => new (0, _chunkE6DONLTMcjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
4233
4394
|
let records;
|
|
4234
4395
|
try {
|
|
4235
4396
|
records = readRecords3(data);
|
|
4236
4397
|
} catch (e22) {
|
|
4237
4398
|
throw wrong();
|
|
4238
4399
|
}
|
|
4239
|
-
if (_optionalChain([records, 'access',
|
|
4400
|
+
if (_optionalChain([records, 'access', _103 => _103[0], 'optionalAccess', _104 => _104.tagId]) !== TAG_DOCUMENT_PROPERTIES) throw wrong();
|
|
4240
4401
|
if (!records.some((r) => r.tagId === TAG_ID_MAPPINGS)) throw wrong();
|
|
4241
4402
|
}
|
|
4242
4403
|
function assertSupportedEncryptVersion(version) {
|
|
4243
4404
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4244
|
-
throw new (0,
|
|
4405
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
4245
4406
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4246
4407
|
);
|
|
4247
4408
|
}
|
|
4248
4409
|
}
|
|
4249
4410
|
|
|
4411
|
+
// src/hwp5/page-boundary.ts
|
|
4412
|
+
var MIDPAGE_V2 = 2e3;
|
|
4413
|
+
var CTRL_ID_TBL = 1952607264;
|
|
4414
|
+
function tableIntraBreaks2(records, start, end) {
|
|
4415
|
+
const rowMax = /* @__PURE__ */ new Map();
|
|
4416
|
+
let curRow = -1;
|
|
4417
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
4418
|
+
let resets = 0;
|
|
4419
|
+
const flush = () => {
|
|
4420
|
+
if (curRow >= 0) rowMax.set(curRow, Math.max(_nullishCoalesce(rowMax.get(curRow), () => ( 0)), resets));
|
|
4421
|
+
resets = 0;
|
|
4422
|
+
prevV = Number.NEGATIVE_INFINITY;
|
|
4423
|
+
};
|
|
4424
|
+
for (let i = start; i < end; i++) {
|
|
4425
|
+
const rec = records[i];
|
|
4426
|
+
if (rec.tagId === TAG_LIST_HEADER && rec.level === 2 && rec.data.length >= 12) {
|
|
4427
|
+
flush();
|
|
4428
|
+
curRow = rec.data.readUInt16LE(10);
|
|
4429
|
+
} else if (rec.tagId === TAG_PARA_LINE_SEG && rec.level === 3 && curRow >= 0) {
|
|
4430
|
+
for (let off = 0; off + 36 <= rec.data.length; off += 36) {
|
|
4431
|
+
const v = rec.data.readInt32LE(off + 4);
|
|
4432
|
+
if (v < prevV) resets++;
|
|
4433
|
+
prevV = v;
|
|
4434
|
+
}
|
|
4435
|
+
}
|
|
4436
|
+
}
|
|
4437
|
+
flush();
|
|
4438
|
+
let sum = 0;
|
|
4439
|
+
for (const v of rowMax.values()) sum += v;
|
|
4440
|
+
return sum;
|
|
4441
|
+
}
|
|
4442
|
+
function detectHwp5SectionPages(records) {
|
|
4443
|
+
const pageAtPara = [];
|
|
4444
|
+
let cur = 0;
|
|
4445
|
+
let prevV = Number.NEGATIVE_INFINITY;
|
|
4446
|
+
let prevH = Number.NEGATIVE_INFINITY;
|
|
4447
|
+
let first = true;
|
|
4448
|
+
let suppressMidReset = false;
|
|
4449
|
+
let parasWithSegs = 0;
|
|
4450
|
+
let i = 0;
|
|
4451
|
+
while (i < records.length) {
|
|
4452
|
+
const rec = records[i];
|
|
4453
|
+
if (rec.tagId !== TAG_PARA_HEADER || rec.level !== 0) {
|
|
4454
|
+
i++;
|
|
4455
|
+
continue;
|
|
4456
|
+
}
|
|
4457
|
+
let j = i + 1;
|
|
4458
|
+
while (j < records.length && records[j].level > 0) j++;
|
|
4459
|
+
const divideSort = rec.data.length >= 12 ? rec.data.readUInt8(11) : 0;
|
|
4460
|
+
const explicit = (divideSort & 4) !== 0;
|
|
4461
|
+
let brokeByExplicit = false;
|
|
4462
|
+
if (explicit && !first) {
|
|
4463
|
+
cur++;
|
|
4464
|
+
brokeByExplicit = true;
|
|
4465
|
+
suppressMidReset = false;
|
|
4466
|
+
}
|
|
4467
|
+
let paraFirst = true;
|
|
4468
|
+
let startPage = cur;
|
|
4469
|
+
let hadSegs = false;
|
|
4470
|
+
let intraAdd = 0;
|
|
4471
|
+
for (let k = i + 1; k < j; k++) {
|
|
4472
|
+
const r = records[k];
|
|
4473
|
+
if (r.tagId === TAG_PARA_LINE_SEG && r.level === 1) {
|
|
4474
|
+
hadSegs = true;
|
|
4475
|
+
for (let off = 0; off + 36 <= r.data.length; off += 36) {
|
|
4476
|
+
const v = r.data.readInt32LE(off + 4);
|
|
4477
|
+
const h = r.data.readInt32LE(off + 24);
|
|
4478
|
+
const brk = v < prevV || paraFirst && v === prevV && h <= prevH;
|
|
4479
|
+
if (brk && !(paraFirst && brokeByExplicit)) {
|
|
4480
|
+
if (paraFirst && suppressMidReset && v >= MIDPAGE_V2) {
|
|
4481
|
+
} else {
|
|
4482
|
+
cur++;
|
|
4483
|
+
}
|
|
4484
|
+
}
|
|
4485
|
+
if (paraFirst) {
|
|
4486
|
+
suppressMidReset = false;
|
|
4487
|
+
startPage = cur;
|
|
4488
|
+
}
|
|
4489
|
+
paraFirst = false;
|
|
4490
|
+
prevV = v;
|
|
4491
|
+
prevH = h;
|
|
4492
|
+
}
|
|
4493
|
+
}
|
|
4494
|
+
if (r.tagId === TAG_CTRL_HEADER && r.level === 1 && r.data.length >= 4 && r.data.readUInt32LE(0) === CTRL_ID_TBL) {
|
|
4495
|
+
let ce = k + 1;
|
|
4496
|
+
while (ce < j && records[ce].level > 1) ce++;
|
|
4497
|
+
intraAdd += tableIntraBreaks2(records, k + 1, ce);
|
|
4498
|
+
k = ce - 1;
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
4501
|
+
if (hadSegs) parasWithSegs++;
|
|
4502
|
+
pageAtPara.push(startPage);
|
|
4503
|
+
first = false;
|
|
4504
|
+
if (intraAdd > 0) {
|
|
4505
|
+
cur += intraAdd;
|
|
4506
|
+
suppressMidReset = true;
|
|
4507
|
+
}
|
|
4508
|
+
i = j;
|
|
4509
|
+
}
|
|
4510
|
+
return {
|
|
4511
|
+
pageAtPara,
|
|
4512
|
+
pages: cur + 1,
|
|
4513
|
+
usable: pageAtPara.length > 0 && parasWithSegs === pageAtPara.length
|
|
4514
|
+
};
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4250
4517
|
// src/hwp5/parser.ts
|
|
4251
4518
|
var _module = require('module');
|
|
4252
4519
|
var require2 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
|
|
@@ -4324,25 +4591,25 @@ function parseHwp5Document(buffer, options) {
|
|
|
4324
4591
|
lenientCfb = parseLenientCfb(buffer);
|
|
4325
4592
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
4326
4593
|
} catch (e24) {
|
|
4327
|
-
throw new (0,
|
|
4594
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
4328
4595
|
}
|
|
4329
4596
|
}
|
|
4330
4597
|
const readRawStream = (path) => {
|
|
4331
4598
|
if (cfb) {
|
|
4332
4599
|
const entry = CFB.find(cfb, path);
|
|
4333
|
-
return _optionalChain([entry, 'optionalAccess',
|
|
4600
|
+
return _optionalChain([entry, 'optionalAccess', _105 => _105.content]) ? Buffer.from(entry.content) : null;
|
|
4334
4601
|
}
|
|
4335
4602
|
return lenientCfb.findStream(path);
|
|
4336
4603
|
};
|
|
4337
4604
|
const headerData = readRawStream("/FileHeader");
|
|
4338
|
-
if (!headerData) throw new (0,
|
|
4605
|
+
if (!headerData) throw new (0, _chunkE6DONLTMcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4339
4606
|
const header = parseFileHeader(headerData);
|
|
4340
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
4341
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
4607
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
4608
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkE6DONLTMcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
4342
4609
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
4343
4610
|
if (encrypted) {
|
|
4344
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
4345
|
-
throw new (0,
|
|
4611
|
+
if (!_optionalChain([options, 'optionalAccess', _106 => _106.password])) {
|
|
4612
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694.");
|
|
4346
4613
|
}
|
|
4347
4614
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
4348
4615
|
}
|
|
@@ -4360,48 +4627,80 @@ function parseHwp5Document(buffer, options) {
|
|
|
4360
4627
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
4361
4628
|
if (encrypted) {
|
|
4362
4629
|
const rawDocInfo = findStream("/DocInfo");
|
|
4363
|
-
if (!rawDocInfo) throw new (0,
|
|
4630
|
+
if (!rawDocInfo) throw new (0, _chunkE6DONLTMcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
4364
4631
|
let docInfoData;
|
|
4365
4632
|
try {
|
|
4366
4633
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
4367
4634
|
} catch (e25) {
|
|
4368
|
-
throw new (0,
|
|
4635
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
4369
4636
|
}
|
|
4370
4637
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
4371
4638
|
}
|
|
4372
4639
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
4373
4640
|
const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : encrypted ? findSectionsVia(findStream) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
|
|
4374
|
-
if (sections.length === 0) throw new (0,
|
|
4375
|
-
|
|
4376
|
-
const
|
|
4377
|
-
const totalTarget = pageFilter ? pageFilter.size : sections.length;
|
|
4378
|
-
const bodyBlocks = [];
|
|
4379
|
-
const doc = createHwp5DocState();
|
|
4380
|
-
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _104 => _104.keepTrailingEmptyCols]);
|
|
4641
|
+
if (sections.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4642
|
+
const sectionRecords = [];
|
|
4643
|
+
const sectionDetects = [];
|
|
4381
4644
|
let totalDecompressed = 0;
|
|
4382
|
-
let parsedSections = 0;
|
|
4383
4645
|
for (let si = 0; si < sections.length; si++) {
|
|
4384
|
-
if (pageFilter && !pageFilter.has(si + 1)) continue;
|
|
4385
4646
|
try {
|
|
4386
|
-
const
|
|
4387
|
-
const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
|
|
4647
|
+
const data = !distribution && compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
4388
4648
|
totalDecompressed += data.length;
|
|
4389
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4649
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4390
4650
|
const records = readRecords(data);
|
|
4391
|
-
|
|
4651
|
+
sectionRecords.push(records);
|
|
4652
|
+
sectionDetects.push(detectHwp5SectionPages(records));
|
|
4653
|
+
} catch (secErr) {
|
|
4654
|
+
if (secErr instanceof _chunkE6DONLTMcjs.KordocError) throw secErr;
|
|
4655
|
+
sectionRecords.push(null);
|
|
4656
|
+
sectionDetects.push(null);
|
|
4657
|
+
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
const layoutPages = sectionDetects.length > 0 && sectionDetects.every((d) => d != null && d.usable);
|
|
4661
|
+
metadata.pageMode = layoutPages ? "layout" : "section";
|
|
4662
|
+
metadata.pageCount = layoutPages ? Math.max(sectionDetects.reduce((sum, d) => sum + (_nullishCoalesce(_optionalChain([d, 'optionalAccess', _107 => _107.pages]), () => ( 0))), 0), 1) : sections.length;
|
|
4663
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _108 => _108.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, metadata.pageCount) : null;
|
|
4664
|
+
if (pageFilter && !layoutPages) {
|
|
4665
|
+
warnings.push({ code: "PAGE_BOUNDARY_APPROXIMATE", message: "\uC870\uD310 \uCE90\uC2DC\uAC00 \uC5C6\uC5B4 pages \uD544\uD130\uB97C \uC139\uC158 \uB2E8\uC704 \uADFC\uC0AC\uB85C \uC801\uC6A9\uD588\uC2B5\uB2C8\uB2E4" });
|
|
4666
|
+
}
|
|
4667
|
+
let bodyBlocks = [];
|
|
4668
|
+
const doc = createHwp5DocState();
|
|
4669
|
+
doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _109 => _109.keepTrailingEmptyCols]);
|
|
4670
|
+
let parsedSections = 0;
|
|
4671
|
+
let pageBase = 0;
|
|
4672
|
+
for (let si = 0; si < sections.length; si++) {
|
|
4673
|
+
const records = sectionRecords[si];
|
|
4674
|
+
if (!records) continue;
|
|
4675
|
+
const detect = sectionDetects[si];
|
|
4676
|
+
if (!layoutPages && pageFilter && !pageFilter.has(si + 1)) continue;
|
|
4677
|
+
try {
|
|
4678
|
+
const sectionBlocks = parseSection(
|
|
4679
|
+
records,
|
|
4680
|
+
docInfo,
|
|
4681
|
+
warnings,
|
|
4682
|
+
si + 1,
|
|
4683
|
+
doc,
|
|
4684
|
+
layoutPages ? { base: pageBase, pageAtPara: detect.pageAtPara } : void 0
|
|
4685
|
+
);
|
|
4392
4686
|
bodyBlocks.push(...sectionBlocks);
|
|
4393
4687
|
parsedSections++;
|
|
4394
|
-
_optionalChain([options, 'optionalAccess',
|
|
4688
|
+
_optionalChain([options, 'optionalAccess', _110 => _110.onProgress, 'optionalCall', _111 => _111(parsedSections, sections.length)]);
|
|
4395
4689
|
} catch (secErr) {
|
|
4396
|
-
if (secErr instanceof
|
|
4690
|
+
if (secErr instanceof _chunkE6DONLTMcjs.KordocError) throw secErr;
|
|
4397
4691
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
4692
|
+
} finally {
|
|
4693
|
+
pageBase += detect.pages;
|
|
4398
4694
|
}
|
|
4399
4695
|
}
|
|
4696
|
+
if (pageFilter && layoutPages) {
|
|
4697
|
+
bodyBlocks = bodyBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
4698
|
+
}
|
|
4400
4699
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
4401
4700
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
4402
|
-
let flatBlocks =
|
|
4403
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4404
|
-
const deduped =
|
|
4701
|
+
let flatBlocks = _chunkR4LXZRYPcjs.flattenLayoutTables.call(void 0, blocks);
|
|
4702
|
+
if (_optionalChain([options, 'optionalAccess', _112 => _112.dedupeRunningHeaders])) {
|
|
4703
|
+
const deduped = _chunkR4LXZRYPcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
4405
4704
|
const removed = flatBlocks.length - deduped.length;
|
|
4406
4705
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
4407
4706
|
flatBlocks = deduped;
|
|
@@ -4410,10 +4709,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
4410
4709
|
detectHwp5Headings(flatBlocks, docInfo);
|
|
4411
4710
|
}
|
|
4412
4711
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4413
|
-
let markdown =
|
|
4414
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
4712
|
+
let markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, flatBlocks);
|
|
4713
|
+
if (_optionalChain([options, 'optionalAccess', _113 => _113.inlineImages]) && images.length > 0) {
|
|
4415
4714
|
try {
|
|
4416
|
-
markdown =
|
|
4715
|
+
markdown = _chunkR4LXZRYPcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
4417
4716
|
} catch (inlineErr) {
|
|
4418
4717
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
4419
4718
|
}
|
|
@@ -4423,7 +4722,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
4423
4722
|
function parseDocInfoStream(cfb, compressed) {
|
|
4424
4723
|
try {
|
|
4425
4724
|
const entry = CFB.find(cfb, "/DocInfo");
|
|
4426
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4725
|
+
if (!_optionalChain([entry, 'optionalAccess', _114 => _114.content])) return null;
|
|
4427
4726
|
const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
4428
4727
|
const records = readRecords(data);
|
|
4429
4728
|
return parseDocInfo(records);
|
|
@@ -4444,7 +4743,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4444
4743
|
let baseFontSize = 0;
|
|
4445
4744
|
const sizeFreq = /* @__PURE__ */ new Map();
|
|
4446
4745
|
for (const b of blocks) {
|
|
4447
|
-
if (_optionalChain([b, 'access',
|
|
4746
|
+
if (_optionalChain([b, 'access', _115 => _115.style, 'optionalAccess', _116 => _116.fontSize]) && b.text) {
|
|
4448
4747
|
sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
|
|
4449
4748
|
}
|
|
4450
4749
|
}
|
|
@@ -4460,7 +4759,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4460
4759
|
const name = (style.nameKo || style.name).toLowerCase();
|
|
4461
4760
|
if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
|
|
4462
4761
|
const cs = docInfo.charShapes[style.charShapeId];
|
|
4463
|
-
if (_optionalChain([cs, 'optionalAccess',
|
|
4762
|
+
if (_optionalChain([cs, 'optionalAccess', _117 => _117.fontSize]) > 0) {
|
|
4464
4763
|
baseFontSize = cs.fontSize / 10;
|
|
4465
4764
|
break;
|
|
4466
4765
|
}
|
|
@@ -4475,11 +4774,11 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4475
4774
|
if (text.length === 0 || text.length > 200) continue;
|
|
4476
4775
|
if (/^\d+$/.test(text)) continue;
|
|
4477
4776
|
let level = 0;
|
|
4478
|
-
if (_optionalChain([block, 'access',
|
|
4777
|
+
if (_optionalChain([block, 'access', _118 => _118.style, 'optionalAccess', _119 => _119.fontSize]) && baseFontSize > 0) {
|
|
4479
4778
|
const ratio = block.style.fontSize / baseFontSize;
|
|
4480
|
-
if (ratio >=
|
|
4481
|
-
else if (ratio >=
|
|
4482
|
-
else if (ratio >=
|
|
4779
|
+
if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H1) level = 1;
|
|
4780
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H2) level = 2;
|
|
4781
|
+
else if (ratio >= _chunkEV53YE3Wcjs.HEADING_RATIO_H3) level = 3;
|
|
4483
4782
|
}
|
|
4484
4783
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
4485
4784
|
if (level === 0) level = 2;
|
|
@@ -4495,7 +4794,7 @@ function detectHwp5Headings(blocks, docInfo) {
|
|
|
4495
4794
|
function extractHwp5Metadata(cfb, metadata) {
|
|
4496
4795
|
try {
|
|
4497
4796
|
const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
|
|
4498
|
-
if (!_optionalChain([summaryEntry, 'optionalAccess',
|
|
4797
|
+
if (!_optionalChain([summaryEntry, 'optionalAccess', _120 => _120.content])) return;
|
|
4499
4798
|
const data = Buffer.from(summaryEntry.content);
|
|
4500
4799
|
if (data.length < 48) return;
|
|
4501
4800
|
const numSets = data.readUInt32LE(24);
|
|
@@ -4528,7 +4827,7 @@ function findViewTextSections(cfb, compressed) {
|
|
|
4528
4827
|
const sections = [];
|
|
4529
4828
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4530
4829
|
const entry = CFB.find(cfb, `/ViewText/Section${i}`);
|
|
4531
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4830
|
+
if (!_optionalChain([entry, 'optionalAccess', _121 => _121.content])) break;
|
|
4532
4831
|
try {
|
|
4533
4832
|
const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
|
|
4534
4833
|
sections.push({ idx: i, content: decrypted });
|
|
@@ -4551,13 +4850,13 @@ function findSections(cfb) {
|
|
|
4551
4850
|
const sections = [];
|
|
4552
4851
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
4553
4852
|
const entry = CFB.find(cfb, `/BodyText/Section${i}`);
|
|
4554
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
4853
|
+
if (!_optionalChain([entry, 'optionalAccess', _122 => _122.content])) break;
|
|
4555
4854
|
sections.push({ idx: i, content: Buffer.from(entry.content) });
|
|
4556
4855
|
}
|
|
4557
4856
|
if (sections.length === 0 && cfb.FileIndex) {
|
|
4558
4857
|
for (const entry of cfb.FileIndex) {
|
|
4559
4858
|
if (sections.length >= MAX_SECTIONS) break;
|
|
4560
|
-
if (_optionalChain([entry, 'access',
|
|
4859
|
+
if (_optionalChain([entry, 'access', _123 => _123.name, 'optionalAccess', _124 => _124.startsWith, 'call', _125 => _125("Section")]) && entry.content) {
|
|
4561
4860
|
const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
|
|
4562
4861
|
sections.push({ idx, content: Buffer.from(entry.content) });
|
|
4563
4862
|
}
|
|
@@ -4573,7 +4872,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4573
4872
|
if (!raw) break;
|
|
4574
4873
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4575
4874
|
totalDecompressed += content.length;
|
|
4576
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4875
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4577
4876
|
sections.push({ idx: i, content });
|
|
4578
4877
|
}
|
|
4579
4878
|
if (sections.length === 0) {
|
|
@@ -4585,7 +4884,7 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
4585
4884
|
if (raw) {
|
|
4586
4885
|
const content = compressed ? decompressStream(raw) : raw;
|
|
4587
4886
|
totalDecompressed += content.length;
|
|
4588
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4887
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4589
4888
|
sections.push({ idx, content });
|
|
4590
4889
|
}
|
|
4591
4890
|
}
|
|
@@ -4602,7 +4901,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
4602
4901
|
try {
|
|
4603
4902
|
const content = decryptViewText(raw, compressed);
|
|
4604
4903
|
totalDecompressed += content.length;
|
|
4605
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
4904
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
4606
4905
|
sections.push({ idx: i, content });
|
|
4607
4906
|
} catch (e30) {
|
|
4608
4907
|
break;
|
|
@@ -4633,8 +4932,17 @@ function createHwp5DocState() {
|
|
|
4633
4932
|
footerBlocks: []
|
|
4634
4933
|
};
|
|
4635
4934
|
}
|
|
4636
|
-
function parseSection(records, docInfo, warnings, sectionNum, doc) {
|
|
4637
|
-
const ctx = {
|
|
4935
|
+
function parseSection(records, docInfo, warnings, sectionNum, doc, pageMap) {
|
|
4936
|
+
const ctx = {
|
|
4937
|
+
docInfo,
|
|
4938
|
+
warnings,
|
|
4939
|
+
sectionNum,
|
|
4940
|
+
doc: _nullishCoalesce(doc, () => ( createHwp5DocState())),
|
|
4941
|
+
depth: 0,
|
|
4942
|
+
page: pageMap ? pageMap.base + 1 : sectionNum,
|
|
4943
|
+
pageMap,
|
|
4944
|
+
topOrdinal: 0
|
|
4945
|
+
};
|
|
4638
4946
|
return parseParagraphList(records, 0, records.length, ctx);
|
|
4639
4947
|
}
|
|
4640
4948
|
function parseParagraphList(records, start, end, ctx) {
|
|
@@ -4643,6 +4951,11 @@ function parseParagraphList(records, start, end, ctx) {
|
|
|
4643
4951
|
while (i < end) {
|
|
4644
4952
|
if (records[i].tagId === TAG_PARA_HEADER) {
|
|
4645
4953
|
const baseLevel = records[i].level;
|
|
4954
|
+
if (baseLevel === 0 && ctx.depth === 0 && ctx.pageMap) {
|
|
4955
|
+
const pg = ctx.pageMap.pageAtPara[ctx.topOrdinal];
|
|
4956
|
+
if (pg !== void 0) ctx.page = ctx.pageMap.base + pg + 1;
|
|
4957
|
+
ctx.topOrdinal++;
|
|
4958
|
+
}
|
|
4646
4959
|
let j = i + 1;
|
|
4647
4960
|
while (j < end && records[j].level > baseLevel) j++;
|
|
4648
4961
|
blocks.push(...parseParagraph(records, i, j, ctx));
|
|
@@ -4703,9 +5016,9 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4703
5016
|
const applied = [];
|
|
4704
5017
|
for (const r of ranges) {
|
|
4705
5018
|
const ctrl = ctrls[r.ctrlIdx];
|
|
4706
|
-
if (!_optionalChain([ctrl, 'optionalAccess',
|
|
5019
|
+
if (!_optionalChain([ctrl, 'optionalAccess', _126 => _126.href]) || r.end <= r.start) continue;
|
|
4707
5020
|
if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
|
|
4708
|
-
const href =
|
|
5021
|
+
const href = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
4709
5022
|
if (!href) continue;
|
|
4710
5023
|
const anchor = text.slice(r.start, r.end);
|
|
4711
5024
|
if (!anchor.trim()) continue;
|
|
@@ -4723,7 +5036,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4723
5036
|
}
|
|
4724
5037
|
if (ps.headType === 1 || ps.headType === 2) {
|
|
4725
5038
|
const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
|
|
4726
|
-
const numbering = nid >= 1 ? _optionalChain([ctx, 'access',
|
|
5039
|
+
const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _127 => _127.docInfo, 'optionalAccess', _128 => _128.numberings, 'access', _129 => _129[nid - 1]]) : void 0;
|
|
4727
5040
|
if (numbering) {
|
|
4728
5041
|
const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
|
|
4729
5042
|
const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
|
|
@@ -4733,7 +5046,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4733
5046
|
}
|
|
4734
5047
|
}
|
|
4735
5048
|
} else if (ps.headType === 3) {
|
|
4736
|
-
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access',
|
|
5049
|
+
const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _130 => _130.docInfo, 'optionalAccess', _131 => _131.bullets, 'access', _132 => _132[ps.numberingId - 1]]) : void 0;
|
|
4737
5050
|
if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
|
|
4738
5051
|
}
|
|
4739
5052
|
}
|
|
@@ -4743,7 +5056,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4743
5056
|
const block = {
|
|
4744
5057
|
type: headingLevel > 0 ? "heading" : "paragraph",
|
|
4745
5058
|
text: headMarker ? `${headMarker} ${trimmed}` : trimmed,
|
|
4746
|
-
pageNumber: ctx.
|
|
5059
|
+
pageNumber: ctx.page
|
|
4747
5060
|
};
|
|
4748
5061
|
if (headingLevel > 0) block.level = headingLevel;
|
|
4749
5062
|
if (ctx.docInfo && charShapeIds.length > 0) {
|
|
@@ -4760,7 +5073,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
4760
5073
|
if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
|
|
4761
5074
|
blocks.push(block);
|
|
4762
5075
|
} else if (footnotes.length > 0) {
|
|
4763
|
-
blocks.push({ type: "paragraph", text: `(\uC8FC: ${footnotes.join("; ")})`, pageNumber: ctx.
|
|
5076
|
+
blocks.push({ type: "paragraph", text: `(\uC8FC: ${footnotes.join("; ")})`, pageNumber: ctx.page });
|
|
4764
5077
|
}
|
|
4765
5078
|
for (const ctrl of ctrls) {
|
|
4766
5079
|
if (ctrl.afterBlocks) blocks.push(...ctrl.afterBlocks);
|
|
@@ -4771,7 +5084,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
4771
5084
|
switch (ctrl.id) {
|
|
4772
5085
|
case CTRL_TBL: {
|
|
4773
5086
|
const table2 = parseTableControl(ctrl, records, ctx);
|
|
4774
|
-
if (table2) ctrl.afterBlocks = [{ type: "table", table: table2, pageNumber: ctx.
|
|
5087
|
+
if (table2) ctrl.afterBlocks = [{ type: "table", table: table2, pageNumber: ctx.page }];
|
|
4775
5088
|
return;
|
|
4776
5089
|
}
|
|
4777
5090
|
case CTRL_GSO: {
|
|
@@ -4823,7 +5136,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
4823
5136
|
return;
|
|
4824
5137
|
}
|
|
4825
5138
|
case CTRL_OLE: {
|
|
4826
|
-
ctx.warnings.push({ page: ctx.
|
|
5139
|
+
ctx.warnings.push({ page: ctx.page, message: "\uC2A4\uD0B5\uB41C OLE \uAC1C\uCCB4", code: "SKIPPED_OLE" });
|
|
4827
5140
|
return;
|
|
4828
5141
|
}
|
|
4829
5142
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/글자겹침/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -4900,7 +5213,7 @@ function applyHeaderFooterEffect(ctrl, records, ctx, isHeader) {
|
|
|
4900
5213
|
const key = (isHeader ? "h:" : "f:") + text;
|
|
4901
5214
|
if (ctx.doc.headerTexts.has(key)) return;
|
|
4902
5215
|
ctx.doc.headerTexts.add(key);
|
|
4903
|
-
const block = { type: "paragraph", text, pageNumber: ctx.
|
|
5216
|
+
const block = { type: "paragraph", text, pageNumber: ctx.page };
|
|
4904
5217
|
if (isHeader) ctx.doc.headerBlocks.push(block);
|
|
4905
5218
|
else ctx.doc.footerBlocks.push(block);
|
|
4906
5219
|
}
|
|
@@ -4945,8 +5258,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4945
5258
|
let tableIdx = -1;
|
|
4946
5259
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
4947
5260
|
if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
|
|
4948
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
4949
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5261
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
5262
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkR4LXZRYPcjs.MAX_COLS);
|
|
4950
5263
|
tableIdx = i2;
|
|
4951
5264
|
break;
|
|
4952
5265
|
}
|
|
@@ -4986,7 +5299,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4986
5299
|
const cellRows2 = arrangeCells(rows, cols, cells);
|
|
4987
5300
|
const irCells = cellRows2.map((row) => row.map((c) => {
|
|
4988
5301
|
const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
|
|
4989
|
-
if (_optionalChain([c, 'access',
|
|
5302
|
+
if (_optionalChain([c, 'access', _133 => _133.blocks, 'optionalAccess', _134 => _134.length])) ir.blocks = c.blocks;
|
|
4990
5303
|
if (c.isHeader) ir.isHeader = true;
|
|
4991
5304
|
return ir;
|
|
4992
5305
|
}));
|
|
@@ -4995,7 +5308,7 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
4995
5308
|
return table3;
|
|
4996
5309
|
}
|
|
4997
5310
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
4998
|
-
const table2 =
|
|
5311
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
4999
5312
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5000
5313
|
return table2.rows > 0 ? table2 : null;
|
|
5001
5314
|
}
|
|
@@ -5012,8 +5325,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5012
5325
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5013
5326
|
const cs = rec.data.readUInt16LE(12);
|
|
5014
5327
|
const rs = rec.data.readUInt16LE(14);
|
|
5015
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5016
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5328
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
5329
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
5017
5330
|
}
|
|
5018
5331
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5019
5332
|
const parts = [];
|
|
@@ -5023,7 +5336,7 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5023
5336
|
parts.push(``);
|
|
5024
5337
|
hasStructure = true;
|
|
5025
5338
|
} else if (b.type === "table" && b.table) {
|
|
5026
|
-
const flat =
|
|
5339
|
+
const flat = _chunkR4LXZRYPcjs.convertTableToText.call(void 0, b.table.cells);
|
|
5027
5340
|
if (flat) parts.push(flat);
|
|
5028
5341
|
hasStructure = true;
|
|
5029
5342
|
} else if (b.text) {
|
|
@@ -5120,13 +5433,13 @@ function pictureToImageBlock(data, ctx) {
|
|
|
5120
5433
|
if (data.length < 73) return null;
|
|
5121
5434
|
const binDataId = data.readUInt16LE(71);
|
|
5122
5435
|
if (binDataId === 0) return null;
|
|
5123
|
-
const item = _optionalChain([ctx, 'access',
|
|
5124
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
5125
|
-
ctx.warnings.push({ page: ctx.
|
|
5436
|
+
const item = _optionalChain([ctx, 'access', _135 => _135.docInfo, 'optionalAccess', _136 => _136.binData, 'access', _137 => _137[binDataId - 1]]);
|
|
5437
|
+
if (_optionalChain([item, 'optionalAccess', _138 => _138.kind]) === "link") {
|
|
5438
|
+
ctx.warnings.push({ page: ctx.page, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
|
|
5126
5439
|
return null;
|
|
5127
5440
|
}
|
|
5128
5441
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
5129
|
-
return { type: "image", text: String(storageId), pageNumber: ctx.
|
|
5442
|
+
return { type: "image", text: String(storageId), pageNumber: ctx.page };
|
|
5130
5443
|
}
|
|
5131
5444
|
function resolveCharStyle(charShapeIds, docInfo) {
|
|
5132
5445
|
if (charShapeIds.length === 0 || docInfo.charShapes.length === 0) return void 0;
|
|
@@ -17298,40 +17611,40 @@ function desEcbDecrypt(data, key) {
|
|
|
17298
17611
|
}
|
|
17299
17612
|
function readLayout(data) {
|
|
17300
17613
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
17301
|
-
throw new (0,
|
|
17614
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
17302
17615
|
}
|
|
17303
17616
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
17304
17617
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
17305
17618
|
if (payloadOffset >= data.length) {
|
|
17306
|
-
throw new (0,
|
|
17619
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17307
17620
|
}
|
|
17308
17621
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
17309
17622
|
}
|
|
17310
17623
|
function decryptHwp3Document(input, password) {
|
|
17311
17624
|
const { payloadOffset, compressed } = readLayout(input);
|
|
17312
17625
|
if (!compressed) {
|
|
17313
|
-
throw new (0,
|
|
17626
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP3 \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4 (\uC555\uCD95\uB418\uC9C0 \uC54A\uC740 \uC554\uD638 \uBCF8\uBB38)");
|
|
17314
17627
|
}
|
|
17315
17628
|
const source = Buffer.from(input);
|
|
17316
17629
|
const payload = source.subarray(payloadOffset);
|
|
17317
17630
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
17318
17631
|
if (aligned.length === 0) {
|
|
17319
|
-
throw new (0,
|
|
17632
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
17320
17633
|
}
|
|
17321
17634
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
17322
17635
|
let inflated;
|
|
17323
17636
|
try {
|
|
17324
17637
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
17325
17638
|
} catch (err) {
|
|
17326
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17327
|
-
throw new (0,
|
|
17639
|
+
if (_optionalChain([err, 'optionalAccess', _139 => _139.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17640
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
17328
17641
|
`HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
|
|
17329
17642
|
);
|
|
17330
17643
|
}
|
|
17331
|
-
throw new (0,
|
|
17644
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
17332
17645
|
}
|
|
17333
17646
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
17334
|
-
throw new (0,
|
|
17647
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uBE44\uBC00\uBC88\uD638\uAC00 \uC77C\uCE58\uD558\uC9C0 \uC54A\uAC70\uB098 \uC554\uD638\uD654 \uB370\uC774\uD130\uAC00 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
|
|
17335
17648
|
}
|
|
17336
17649
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
17337
17650
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -17365,8 +17678,8 @@ var SIMPLE_CTRL = /* @__PURE__ */ new Map([
|
|
|
17365
17678
|
function parseHwp3Document(buffer, options) {
|
|
17366
17679
|
let source = Buffer.from(buffer);
|
|
17367
17680
|
if (isEncryptedHwp3(source)) {
|
|
17368
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
17369
|
-
throw new (0,
|
|
17681
|
+
if (!_optionalChain([options, 'optionalAccess', _140 => _140.password])) {
|
|
17682
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
17370
17683
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
17371
17684
|
);
|
|
17372
17685
|
}
|
|
@@ -17382,11 +17695,11 @@ function parseHwp3Document(buffer, options) {
|
|
|
17382
17695
|
try {
|
|
17383
17696
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
17384
17697
|
} catch (err) {
|
|
17385
|
-
if (_optionalChain([err, 'optionalAccess',
|
|
17386
|
-
throw new (0,
|
|
17698
|
+
if (_optionalChain([err, 'optionalAccess', _141 => _141.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
17699
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
|
|
17387
17700
|
}
|
|
17388
17701
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
17389
|
-
throw new (0,
|
|
17702
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
17390
17703
|
}
|
|
17391
17704
|
} else {
|
|
17392
17705
|
body = tail;
|
|
@@ -17620,15 +17933,15 @@ function getElements(parent, tagName) {
|
|
|
17620
17933
|
const result = [];
|
|
17621
17934
|
for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
|
|
17622
17935
|
if (result.length > 0) return result;
|
|
17623
|
-
const nsNodes = _optionalChain([parent, 'access',
|
|
17936
|
+
const nsNodes = _optionalChain([parent, 'access', _142 => _142.getElementsByTagNameNS, 'optionalCall', _143 => _143("*", tagName)]);
|
|
17624
17937
|
if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
|
|
17625
17938
|
return result;
|
|
17626
17939
|
}
|
|
17627
17940
|
function getTextContent(el) {
|
|
17628
|
-
return _nullishCoalesce(_optionalChain([el, 'access',
|
|
17941
|
+
return _nullishCoalesce(_optionalChain([el, 'access', _144 => _144.textContent, 'optionalAccess', _145 => _145.trim, 'call', _146 => _146()]), () => ( ""));
|
|
17629
17942
|
}
|
|
17630
17943
|
function parseXml(text) {
|
|
17631
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
17944
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, text), "text/xml");
|
|
17632
17945
|
}
|
|
17633
17946
|
function collectRichText(root) {
|
|
17634
17947
|
let out = "";
|
|
@@ -17637,7 +17950,7 @@ function collectRichText(root) {
|
|
|
17637
17950
|
for (let i = 0; i < children.length; i++) {
|
|
17638
17951
|
if (children[i].nodeType !== 1) continue;
|
|
17639
17952
|
const el = children[i];
|
|
17640
|
-
const local = el.localName || _optionalChain([el, 'access',
|
|
17953
|
+
const local = el.localName || _optionalChain([el, 'access', _147 => _147.tagName, 'optionalAccess', _148 => _148.replace, 'call', _149 => _149(/^[^:]+:/, "")]) || "";
|
|
17641
17954
|
if (local === "rPh") continue;
|
|
17642
17955
|
if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
|
|
17643
17956
|
else walk(el);
|
|
@@ -17856,14 +18169,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17856
18169
|
const merge = mergeMap.get(key);
|
|
17857
18170
|
row.push({
|
|
17858
18171
|
text,
|
|
17859
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
17860
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18172
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _150 => _150.colSpan]), () => ( 1)),
|
|
18173
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _151 => _151.rowSpan]), () => ( 1))
|
|
17861
18174
|
});
|
|
17862
18175
|
}
|
|
17863
18176
|
cellRows.push(row);
|
|
17864
18177
|
}
|
|
17865
18178
|
if (cellRows.length > 0) {
|
|
17866
|
-
const table2 =
|
|
18179
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
17867
18180
|
if (table2.rows > 0) {
|
|
17868
18181
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
17869
18182
|
}
|
|
@@ -17871,12 +18184,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
|
|
|
17871
18184
|
return blocks;
|
|
17872
18185
|
}
|
|
17873
18186
|
async function parseXlsxDocument(buffer, options) {
|
|
17874
|
-
|
|
18187
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
17875
18188
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
17876
18189
|
const warnings = [];
|
|
17877
18190
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
17878
18191
|
if (!workbookFile) {
|
|
17879
|
-
throw new (0,
|
|
18192
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17880
18193
|
}
|
|
17881
18194
|
let sharedStrings = [];
|
|
17882
18195
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -17885,7 +18198,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17885
18198
|
}
|
|
17886
18199
|
const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
|
|
17887
18200
|
if (sheets.length === 0) {
|
|
17888
|
-
throw new (0,
|
|
18201
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17889
18202
|
}
|
|
17890
18203
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
17891
18204
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -17905,7 +18218,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17905
18218
|
relsMap = parseRels(await relsFile.async("text"));
|
|
17906
18219
|
}
|
|
17907
18220
|
let pageFilter = null;
|
|
17908
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18221
|
+
if (_optionalChain([options, 'optionalAccess', _152 => _152.pages])) {
|
|
17909
18222
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
17910
18223
|
pageFilter = parsePageRange2(options.pages, sheets.length);
|
|
17911
18224
|
}
|
|
@@ -17914,7 +18227,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17914
18227
|
for (let i = 0; i < processedSheets; i++) {
|
|
17915
18228
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
17916
18229
|
const sheet = sheets[i];
|
|
17917
|
-
_optionalChain([options, 'optionalAccess',
|
|
18230
|
+
_optionalChain([options, 'optionalAccess', _153 => _153.onProgress, 'optionalCall', _154 => _154(i + 1, processedSheets)]);
|
|
17918
18231
|
let sheetPath = relsMap.get(sheet.rId);
|
|
17919
18232
|
if (sheetPath) {
|
|
17920
18233
|
if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
|
|
@@ -17937,7 +18250,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17937
18250
|
try {
|
|
17938
18251
|
const sheetXml = await sheetFile.async("text");
|
|
17939
18252
|
const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
|
|
17940
|
-
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess',
|
|
18253
|
+
const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _155 => _155.keepTrailingEmptyCols]));
|
|
17941
18254
|
blocks.push(...sheetBlocks);
|
|
17942
18255
|
} catch (err) {
|
|
17943
18256
|
warnings.push({
|
|
@@ -17969,7 +18282,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
17969
18282
|
} catch (e32) {
|
|
17970
18283
|
}
|
|
17971
18284
|
}
|
|
17972
|
-
const markdown =
|
|
18285
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
17973
18286
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
17974
18287
|
}
|
|
17975
18288
|
|
|
@@ -18420,11 +18733,11 @@ function processGlobals(records) {
|
|
|
18420
18733
|
const xfFmtIds = [];
|
|
18421
18734
|
const firstBof = records[0];
|
|
18422
18735
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
18423
|
-
throw new (0,
|
|
18736
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
18424
18737
|
}
|
|
18425
18738
|
const bof = decodeBof(firstBof.data);
|
|
18426
18739
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
18427
|
-
throw new (0,
|
|
18740
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
18428
18741
|
}
|
|
18429
18742
|
let i = 1;
|
|
18430
18743
|
while (i < records.length) {
|
|
@@ -18552,14 +18865,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
|
|
|
18552
18865
|
const merge = mergeMap.get(key);
|
|
18553
18866
|
row.push({
|
|
18554
18867
|
text: grid[r][c],
|
|
18555
|
-
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18556
|
-
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess',
|
|
18868
|
+
colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _156 => _156.colSpan]), () => ( 1)),
|
|
18869
|
+
rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _157 => _157.rowSpan]), () => ( 1))
|
|
18557
18870
|
});
|
|
18558
18871
|
}
|
|
18559
18872
|
cellRows.push(row);
|
|
18560
18873
|
}
|
|
18561
18874
|
if (cellRows.length > 0) {
|
|
18562
|
-
const table2 =
|
|
18875
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
|
|
18563
18876
|
if (table2.rows > 0) {
|
|
18564
18877
|
blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
18565
18878
|
}
|
|
@@ -18572,28 +18885,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18572
18885
|
try {
|
|
18573
18886
|
cfb = parseLenientCfb(buf);
|
|
18574
18887
|
} catch (e) {
|
|
18575
|
-
throw new (0,
|
|
18888
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
18576
18889
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
18577
18890
|
);
|
|
18578
18891
|
}
|
|
18579
18892
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
18580
18893
|
if (!wb) {
|
|
18581
|
-
throw new (0,
|
|
18894
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
18582
18895
|
}
|
|
18583
18896
|
const records = readRecords2(wb);
|
|
18584
18897
|
if (records.length === 0) {
|
|
18585
|
-
throw new (0,
|
|
18898
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
18586
18899
|
}
|
|
18587
18900
|
const firstBof = decodeBof(records[0].data);
|
|
18588
18901
|
if (firstBof && firstBof.vers !== 1536) {
|
|
18589
|
-
throw new (0,
|
|
18902
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
18590
18903
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
18591
18904
|
);
|
|
18592
18905
|
}
|
|
18593
18906
|
const globals = processGlobals(records);
|
|
18594
18907
|
const warnings = [];
|
|
18595
18908
|
if (globals.encrypted) {
|
|
18596
|
-
throw new (0,
|
|
18909
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18597
18910
|
}
|
|
18598
18911
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
18599
18912
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -18605,7 +18918,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18605
18918
|
} : void 0;
|
|
18606
18919
|
const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
|
|
18607
18920
|
let pageFilter = null;
|
|
18608
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
18921
|
+
if (_optionalChain([options, 'optionalAccess', _158 => _158.pages])) {
|
|
18609
18922
|
const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
|
|
18610
18923
|
pageFilter = parsePageRange2(options.pages, totalSheets);
|
|
18611
18924
|
}
|
|
@@ -18614,7 +18927,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18614
18927
|
if (pageFilter && !pageFilter.has(i + 1)) continue;
|
|
18615
18928
|
const meta = globals.sheets[i];
|
|
18616
18929
|
if (meta.dt !== 0) continue;
|
|
18617
|
-
_optionalChain([options, 'optionalAccess',
|
|
18930
|
+
_optionalChain([options, 'optionalAccess', _159 => _159.onProgress, 'optionalCall', _160 => _160(i + 1, totalSheets)]);
|
|
18618
18931
|
const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
|
|
18619
18932
|
if (bofIdx < 0) {
|
|
18620
18933
|
warnings.push({
|
|
@@ -18630,7 +18943,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18630
18943
|
}
|
|
18631
18944
|
try {
|
|
18632
18945
|
const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
|
|
18633
|
-
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess',
|
|
18946
|
+
const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _161 => _161.keepTrailingEmptyCols]));
|
|
18634
18947
|
allBlocks.push(...blocks);
|
|
18635
18948
|
} catch (e) {
|
|
18636
18949
|
warnings.push({
|
|
@@ -18644,7 +18957,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
18644
18957
|
pageCount: totalSheets
|
|
18645
18958
|
};
|
|
18646
18959
|
return {
|
|
18647
|
-
markdown:
|
|
18960
|
+
markdown: _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, allBlocks),
|
|
18648
18961
|
blocks: allBlocks,
|
|
18649
18962
|
metadata,
|
|
18650
18963
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -19017,8 +19330,8 @@ function isDisplayMath(el) {
|
|
|
19017
19330
|
|
|
19018
19331
|
// src/docx/parser.ts
|
|
19019
19332
|
var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
|
|
19020
|
-
function matchesLocal(el,
|
|
19021
|
-
return el.localName ===
|
|
19333
|
+
function matchesLocal(el, localName3) {
|
|
19334
|
+
return el.localName === localName3 || (_nullishCoalesce(_optionalChain([el, 'access', _162 => _162.tagName, 'optionalAccess', _163 => _163.endsWith, 'call', _164 => _164(`:${localName3}`)]), () => ( false)));
|
|
19022
19335
|
}
|
|
19023
19336
|
function effectiveChildElements(parent) {
|
|
19024
19337
|
const result = [];
|
|
@@ -19042,10 +19355,10 @@ function effectiveChildElements(parent) {
|
|
|
19042
19355
|
}
|
|
19043
19356
|
return result;
|
|
19044
19357
|
}
|
|
19045
|
-
function getChildElements(parent,
|
|
19046
|
-
return effectiveChildElements(parent).filter((el) => matchesLocal(el,
|
|
19358
|
+
function getChildElements(parent, localName3) {
|
|
19359
|
+
return effectiveChildElements(parent).filter((el) => matchesLocal(el, localName3));
|
|
19047
19360
|
}
|
|
19048
|
-
function findElements(parent,
|
|
19361
|
+
function findElements(parent, localName3) {
|
|
19049
19362
|
const result = [];
|
|
19050
19363
|
const walk = (node) => {
|
|
19051
19364
|
const children = node.childNodes;
|
|
@@ -19053,7 +19366,7 @@ function findElements(parent, localName2) {
|
|
|
19053
19366
|
const child = children[i];
|
|
19054
19367
|
if (child.nodeType === 1) {
|
|
19055
19368
|
const el = child;
|
|
19056
|
-
if (el.localName ===
|
|
19369
|
+
if (el.localName === localName3 || _optionalChain([el, 'access', _165 => _165.tagName, 'optionalAccess', _166 => _166.endsWith, 'call', _167 => _167(`:${localName3}`)])) {
|
|
19057
19370
|
result.push(el);
|
|
19058
19371
|
}
|
|
19059
19372
|
walk(el);
|
|
@@ -19063,16 +19376,16 @@ function findElements(parent, localName2) {
|
|
|
19063
19376
|
walk(parent);
|
|
19064
19377
|
return result;
|
|
19065
19378
|
}
|
|
19066
|
-
function getAttr(el,
|
|
19379
|
+
function getAttr(el, localName3) {
|
|
19067
19380
|
const attrs = el.attributes;
|
|
19068
19381
|
for (let i = 0; i < attrs.length; i++) {
|
|
19069
19382
|
const attr = attrs[i];
|
|
19070
|
-
if (attr.localName ===
|
|
19383
|
+
if (attr.localName === localName3 || attr.name === localName3) return attr.value;
|
|
19071
19384
|
}
|
|
19072
19385
|
return null;
|
|
19073
19386
|
}
|
|
19074
19387
|
function parseXml2(text) {
|
|
19075
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19388
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkE6DONLTMcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19076
19389
|
}
|
|
19077
19390
|
function parseStyles(xml) {
|
|
19078
19391
|
const doc = parseXml2(xml);
|
|
@@ -19189,7 +19502,7 @@ function collectOmmlRoots(p) {
|
|
|
19189
19502
|
const child = children[i];
|
|
19190
19503
|
if (child.nodeType !== 1) continue;
|
|
19191
19504
|
const el = child;
|
|
19192
|
-
const tag = el.localName || _optionalChain([el, 'access',
|
|
19505
|
+
const tag = el.localName || _optionalChain([el, 'access', _168 => _168.tagName, 'optionalAccess', _169 => _169.replace, 'call', _170 => _170(/^[^:]+:/, "")]) || "";
|
|
19193
19506
|
if (tag === "oMath" || tag === "oMathPara") {
|
|
19194
19507
|
out.push(el);
|
|
19195
19508
|
} else if (tag === "txbxContent" || tag === "Fallback") {
|
|
@@ -19230,7 +19543,7 @@ function fieldUrlFromInstr(instr) {
|
|
|
19230
19543
|
function makeLink(text, rawHref) {
|
|
19231
19544
|
if (!text) return "";
|
|
19232
19545
|
if (!rawHref) return text;
|
|
19233
|
-
const href =
|
|
19546
|
+
const href = _chunkE6DONLTMcjs.sanitizeHref.call(void 0, rawHref);
|
|
19234
19547
|
return href ? `[${text}](${href})` : text;
|
|
19235
19548
|
}
|
|
19236
19549
|
function collectInline(p, footnotes, rels) {
|
|
@@ -19332,7 +19645,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19332
19645
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
19333
19646
|
if (!text) return null;
|
|
19334
19647
|
const style = styles.get(styleId);
|
|
19335
|
-
if (_optionalChain([style, 'optionalAccess',
|
|
19648
|
+
if (_optionalChain([style, 'optionalAccess', _171 => _171.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
19336
19649
|
return {
|
|
19337
19650
|
type: "heading",
|
|
19338
19651
|
text,
|
|
@@ -19341,8 +19654,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
|
|
|
19341
19654
|
}
|
|
19342
19655
|
if (numId && numId !== "0") {
|
|
19343
19656
|
const numDef = numbering.get(numId);
|
|
19344
|
-
const levelInfo = _optionalChain([numDef, 'optionalAccess',
|
|
19345
|
-
const listType = _optionalChain([levelInfo, 'optionalAccess',
|
|
19657
|
+
const levelInfo = _optionalChain([numDef, 'optionalAccess', _172 => _172.get, 'call', _173 => _173(ilvl)]);
|
|
19658
|
+
const listType = _optionalChain([levelInfo, 'optionalAccess', _174 => _174.numFmt]) === "bullet" ? "unordered" : "ordered";
|
|
19346
19659
|
return { type: "list", text, listType };
|
|
19347
19660
|
}
|
|
19348
19661
|
const block = { type: "paragraph", text };
|
|
@@ -19424,7 +19737,7 @@ ${cell2.text}` : cell2.text;
|
|
|
19424
19737
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
19425
19738
|
})
|
|
19426
19739
|
);
|
|
19427
|
-
const table2 =
|
|
19740
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
19428
19741
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
19429
19742
|
return { type: "table", table: table2 };
|
|
19430
19743
|
}
|
|
@@ -19434,10 +19747,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
19434
19747
|
for (const el of effectiveChildElements(tc2)) {
|
|
19435
19748
|
if (matchesLocal(el, "p")) {
|
|
19436
19749
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19437
|
-
if (_optionalChain([block, 'optionalAccess',
|
|
19750
|
+
if (_optionalChain([block, 'optionalAccess', _175 => _175.text])) parts.push(block.text);
|
|
19438
19751
|
for (const tp of collectTextboxParagraphs(el)) {
|
|
19439
19752
|
const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
|
|
19440
|
-
if (_optionalChain([tb, 'optionalAccess',
|
|
19753
|
+
if (_optionalChain([tb, 'optionalAccess', _176 => _176.text])) parts.push(tb.text);
|
|
19441
19754
|
}
|
|
19442
19755
|
} else if (matchesLocal(el, "tbl")) {
|
|
19443
19756
|
for (const tr of getChildElements(el, "tr")) {
|
|
@@ -19472,7 +19785,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
19472
19785
|
try {
|
|
19473
19786
|
const data = await imgFile.async("uint8array");
|
|
19474
19787
|
imgIdx++;
|
|
19475
|
-
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access',
|
|
19788
|
+
const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _177 => _177.split, 'call', _178 => _178("."), 'access', _179 => _179.pop, 'call', _180 => _180(), 'optionalAccess', _181 => _181.toLowerCase, 'call', _182 => _182()]), () => ( "png"));
|
|
19476
19789
|
const mimeMap = {
|
|
19477
19790
|
png: "image/png",
|
|
19478
19791
|
jpg: "image/jpeg",
|
|
@@ -19526,12 +19839,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
|
|
|
19526
19839
|
}
|
|
19527
19840
|
}
|
|
19528
19841
|
async function parseDocxDocument(buffer, options) {
|
|
19529
|
-
|
|
19842
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
|
|
19530
19843
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19531
19844
|
const warnings = [];
|
|
19532
19845
|
const docFile = zip.file("word/document.xml");
|
|
19533
19846
|
if (!docFile) {
|
|
19534
|
-
throw new (0,
|
|
19847
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19535
19848
|
}
|
|
19536
19849
|
let rels = /* @__PURE__ */ new Map();
|
|
19537
19850
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -19578,7 +19891,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19578
19891
|
const doc = parseXml2(docXml);
|
|
19579
19892
|
const body = findElements(doc, "body");
|
|
19580
19893
|
if (body.length === 0) {
|
|
19581
|
-
throw new (0,
|
|
19894
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19582
19895
|
}
|
|
19583
19896
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
19584
19897
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -19586,8 +19899,8 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19586
19899
|
const bodyEl = body[0];
|
|
19587
19900
|
const topLevel = effectiveChildElements(bodyEl);
|
|
19588
19901
|
for (const el of topLevel) {
|
|
19589
|
-
const
|
|
19590
|
-
if (
|
|
19902
|
+
const localName3 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _183 => _183.tagName, 'optionalAccess', _184 => _184.split, 'call', _185 => _185(":"), 'access', _186 => _186.pop, 'call', _187 => _187()])));
|
|
19903
|
+
if (localName3 === "p") {
|
|
19591
19904
|
const block = parseParagraph2(el, styles, numbering, footnotes, rels);
|
|
19592
19905
|
if (block) blocks.push(block);
|
|
19593
19906
|
if (imageMap.size > 0) emitParagraphImages(el, imageMap, linkedImages, blocks);
|
|
@@ -19596,8 +19909,8 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19596
19909
|
if (tb) blocks.push(tb);
|
|
19597
19910
|
if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
|
|
19598
19911
|
}
|
|
19599
|
-
} else if (
|
|
19600
|
-
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess',
|
|
19912
|
+
} else if (localName3 === "tbl") {
|
|
19913
|
+
const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _188 => _188.keepTrailingEmptyCols]));
|
|
19601
19914
|
if (block) blocks.push(block);
|
|
19602
19915
|
}
|
|
19603
19916
|
}
|
|
@@ -19629,7 +19942,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
19629
19942
|
}
|
|
19630
19943
|
}
|
|
19631
19944
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
19632
|
-
const markdown =
|
|
19945
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19633
19946
|
return {
|
|
19634
19947
|
markdown,
|
|
19635
19948
|
blocks,
|
|
@@ -19647,11 +19960,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
19647
19960
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
19648
19961
|
function parseHwpmlDocument(buffer, options) {
|
|
19649
19962
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
19650
|
-
throw new (0,
|
|
19963
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
19651
19964
|
}
|
|
19652
19965
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
19653
19966
|
const normalized = text.replace(/ /g, " ");
|
|
19654
|
-
const xml =
|
|
19967
|
+
const xml = _chunkE6DONLTMcjs.stripDtd.call(void 0, normalized);
|
|
19655
19968
|
const warnings = [];
|
|
19656
19969
|
const parser = new (0, _xmldom.DOMParser)({
|
|
19657
19970
|
onError: (_level, msg2) => {
|
|
@@ -19679,7 +19992,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19679
19992
|
return { markdown: "", blocks: [], metadata, warnings };
|
|
19680
19993
|
}
|
|
19681
19994
|
const blocks = [];
|
|
19682
|
-
const pageFilter = _optionalChain([options, 'optionalAccess',
|
|
19995
|
+
const pageFilter = _optionalChain([options, 'optionalAccess', _189 => _189.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
|
|
19683
19996
|
let sectionIdx = 0;
|
|
19684
19997
|
const children = body.childNodes;
|
|
19685
19998
|
for (let i = 0; i < children.length; i++) {
|
|
@@ -19688,10 +20001,10 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
19688
20001
|
if (localName(el) !== "SECTION") continue;
|
|
19689
20002
|
sectionIdx++;
|
|
19690
20003
|
if (pageFilter && !pageFilter.has(sectionIdx)) continue;
|
|
19691
|
-
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
20004
|
+
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _190 => _190.keepTrailingEmptyCols]), () => ( false)));
|
|
19692
20005
|
}
|
|
19693
20006
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
19694
|
-
const markdown =
|
|
20007
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
19695
20008
|
return {
|
|
19696
20009
|
markdown,
|
|
19697
20010
|
blocks,
|
|
@@ -19777,7 +20090,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
|
|
|
19777
20090
|
const shapeInfo = paraShapeMap.get(paraShapeId);
|
|
19778
20091
|
const text = extractParagraphText(el);
|
|
19779
20092
|
if (!text) return;
|
|
19780
|
-
if (_optionalChain([shapeInfo, 'optionalAccess',
|
|
20093
|
+
if (_optionalChain([shapeInfo, 'optionalAccess', _191 => _191.headingLevel]) != null) {
|
|
19781
20094
|
blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
|
|
19782
20095
|
} else {
|
|
19783
20096
|
blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
|
|
@@ -19856,11 +20169,11 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
19856
20169
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
19857
20170
|
cellRows[r].push(cell2);
|
|
19858
20171
|
}
|
|
19859
|
-
const table2 =
|
|
20172
|
+
const table2 = _chunkR4LXZRYPcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
19860
20173
|
if (structured.length > 0) {
|
|
19861
20174
|
const claimed = /* @__PURE__ */ new Set();
|
|
19862
20175
|
for (const { ctx, cellBlocks } of structured) {
|
|
19863
|
-
let target = _optionalChain([table2, 'access',
|
|
20176
|
+
let target = _optionalChain([table2, 'access', _192 => _192.cells, 'access', _193 => _193[_nullishCoalesce(ctx.rowAddr, () => ( -1))], 'optionalAccess', _194 => _194[_nullishCoalesce(ctx.colAddr, () => ( -1))]]);
|
|
19864
20177
|
if (!target || claimed.has(target) || target.text !== ctx.text) {
|
|
19865
20178
|
target = void 0;
|
|
19866
20179
|
outer: for (const irRow of table2.cells) {
|
|
@@ -20164,7 +20477,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
|
|
|
20164
20477
|
(match, prefix, suffix) => {
|
|
20165
20478
|
const label = prefix + suffix;
|
|
20166
20479
|
const normalizedLabel = normalizeLabel(label);
|
|
20167
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20480
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _195 => _195.has, 'call', _196 => _196(normalizedLabel)])) return match;
|
|
20168
20481
|
const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
|
|
20169
20482
|
if (matchKey === void 0) return match;
|
|
20170
20483
|
const newValue = values.consume(matchKey);
|
|
@@ -20243,17 +20556,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
|
|
|
20243
20556
|
const nlabel = normalizeLabel(seg.label);
|
|
20244
20557
|
if (seg.extLabel !== void 0) {
|
|
20245
20558
|
const nExt = normalizeLabel(seg.extLabel);
|
|
20246
|
-
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess',
|
|
20559
|
+
if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _197 => _197.has, 'call', _198 => _198(nExt)]) && values.has(nExt)) {
|
|
20247
20560
|
return { key: nExt, label: seg.extLabel, viaExt: true };
|
|
20248
20561
|
}
|
|
20249
20562
|
}
|
|
20250
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20563
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _199 => _199.has, 'call', _200 => _200(nlabel)])) return void 0;
|
|
20251
20564
|
const key = findMatchingKey(nlabel, values);
|
|
20252
20565
|
return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
|
|
20253
20566
|
}
|
|
20254
20567
|
function clampSegmentEnd(text, seg, next, nextViaExt) {
|
|
20255
20568
|
let ve = seg.valueEnd;
|
|
20256
|
-
if (nextViaExt && _optionalChain([next, 'optionalAccess',
|
|
20569
|
+
if (nextViaExt && _optionalChain([next, 'optionalAccess', _201 => _201.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
|
|
20257
20570
|
while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
|
|
20258
20571
|
return ve;
|
|
20259
20572
|
}
|
|
@@ -20268,7 +20581,7 @@ function normalizeValues(values, warnings) {
|
|
|
20268
20581
|
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
20269
20582
|
const key = normalizeLabel(label);
|
|
20270
20583
|
if (map.has(key)) {
|
|
20271
|
-
_optionalChain([warnings, 'optionalAccess',
|
|
20584
|
+
_optionalChain([warnings, 'optionalAccess', _202 => _202.push, 'call', _203 => _203(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
|
|
20272
20585
|
}
|
|
20273
20586
|
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
|
|
20274
20587
|
}
|
|
@@ -20445,8 +20758,8 @@ function extractFromTable(table2) {
|
|
|
20445
20758
|
if (table2.cols >= 2) {
|
|
20446
20759
|
for (let r = 0; r < table2.rows; r++) {
|
|
20447
20760
|
for (let c = 0; c < table2.cols - 1; c++) {
|
|
20448
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20449
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
20761
|
+
const labelCell = _optionalChain([table2, 'access', _204 => _204.cells, 'access', _205 => _205[r], 'optionalAccess', _206 => _206[c]]);
|
|
20762
|
+
const valueCell = _optionalChain([table2, 'access', _207 => _207.cells, 'access', _208 => _208[r], 'optionalAccess', _209 => _209[c + 1]]);
|
|
20450
20763
|
if (!labelCell || !valueCell) continue;
|
|
20451
20764
|
if (isLabelCell(labelCell.text)) {
|
|
20452
20765
|
fields.push({
|
|
@@ -20461,15 +20774,15 @@ function extractFromTable(table2) {
|
|
|
20461
20774
|
}
|
|
20462
20775
|
if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
|
|
20463
20776
|
const headerRow = table2.cells[0];
|
|
20464
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20465
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20777
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _210 => _210.every, 'call', _211 => _211((cell2) => {
|
|
20778
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _212 => _212.text, 'access', _213 => _213.trim, 'call', _214 => _214()]), () => ( ""));
|
|
20466
20779
|
return t.length > 0 && t.length <= 20;
|
|
20467
20780
|
})]), () => ( false));
|
|
20468
20781
|
if (allLabels) {
|
|
20469
20782
|
for (let r = 1; r < table2.rows; r++) {
|
|
20470
20783
|
for (let c = 0; c < table2.cols; c++) {
|
|
20471
|
-
const label = _nullishCoalesce(_optionalChain([headerRow, 'access',
|
|
20472
|
-
const value = _nullishCoalesce(_optionalChain([table2, 'access',
|
|
20784
|
+
const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _215 => _215[c], 'optionalAccess', _216 => _216.text, 'access', _217 => _217.trim, 'call', _218 => _218()]), () => ( ""));
|
|
20785
|
+
const value = _nullishCoalesce(_optionalChain([table2, 'access', _219 => _219.cells, 'access', _220 => _220[r], 'optionalAccess', _221 => _221[c], 'optionalAccess', _222 => _222.text, 'access', _223 => _223.trim, 'call', _224 => _224()]), () => ( ""));
|
|
20473
20786
|
if (label && value) {
|
|
20474
20787
|
fields.push({ label, value, row: r, col: c });
|
|
20475
20788
|
}
|
|
@@ -20563,7 +20876,7 @@ function fillFormFields(blocks, values, blockedLabels) {
|
|
|
20563
20876
|
for (const table2 of allTables) {
|
|
20564
20877
|
for (let r = 0; r < table2.rows; r++) {
|
|
20565
20878
|
for (let c = 0; c < table2.cols; c++) {
|
|
20566
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20879
|
+
const cell2 = _optionalChain([table2, 'access', _225 => _225.cells, 'access', _226 => _226[r], 'optionalAccess', _227 => _227[c]]);
|
|
20567
20880
|
if (!cell2) continue;
|
|
20568
20881
|
const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
|
|
20569
20882
|
if (result) {
|
|
@@ -20595,7 +20908,7 @@ function collectIRTables(blocks, depth) {
|
|
|
20595
20908
|
out.push(block.table);
|
|
20596
20909
|
for (const row of block.table.cells) {
|
|
20597
20910
|
for (const cell2 of row) {
|
|
20598
|
-
if (_optionalChain([cell2, 'optionalAccess',
|
|
20911
|
+
if (_optionalChain([cell2, 'optionalAccess', _228 => _228.blocks, 'optionalAccess', _229 => _229.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
|
|
20599
20912
|
}
|
|
20600
20913
|
}
|
|
20601
20914
|
}
|
|
@@ -20606,7 +20919,7 @@ function coveredPositions(table2) {
|
|
|
20606
20919
|
for (let r = 0; r < table2.rows; r++) {
|
|
20607
20920
|
for (let c = 0; c < table2.cols; c++) {
|
|
20608
20921
|
if (covered.has(`${r},${c}`)) continue;
|
|
20609
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20922
|
+
const cell2 = _optionalChain([table2, 'access', _230 => _230.cells, 'access', _231 => _231[r], 'optionalAccess', _232 => _232[c]]);
|
|
20610
20923
|
if (!cell2) continue;
|
|
20611
20924
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
20612
20925
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -20622,15 +20935,15 @@ function coveredPositions(table2) {
|
|
|
20622
20935
|
function isHeaderDataTable(table2, covered) {
|
|
20623
20936
|
if (table2.rows < 2) return false;
|
|
20624
20937
|
const headerRow = table2.cells[0];
|
|
20625
|
-
if (!_optionalChain([headerRow, 'optionalAccess',
|
|
20938
|
+
if (!_optionalChain([headerRow, 'optionalAccess', _233 => _233.length])) return false;
|
|
20626
20939
|
const allLabels = headerRow.every((cell2) => {
|
|
20627
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20940
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _234 => _234.text, 'access', _235 => _235.trim, 'call', _236 => _236()]), () => ( ""));
|
|
20628
20941
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20629
20942
|
});
|
|
20630
20943
|
if (!allLabels) return false;
|
|
20631
20944
|
for (let c = 0; c < table2.cols; c++) {
|
|
20632
20945
|
if (covered.has(`1,${c}`)) continue;
|
|
20633
|
-
const cell2 = _optionalChain([table2, 'access',
|
|
20946
|
+
const cell2 = _optionalChain([table2, 'access', _237 => _237.cells, 'access', _238 => _238[1], 'optionalAccess', _239 => _239[c]]);
|
|
20634
20947
|
if (!cell2) break;
|
|
20635
20948
|
return !isLabelCell(cell2.text);
|
|
20636
20949
|
}
|
|
@@ -20643,7 +20956,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20643
20956
|
for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
|
|
20644
20957
|
for (let c = 0; c < table2.cols; c++) {
|
|
20645
20958
|
if (covered.has(`${r},${c}`)) continue;
|
|
20646
|
-
const labelCell = _optionalChain([table2, 'access',
|
|
20959
|
+
const labelCell = _optionalChain([table2, 'access', _240 => _240.cells, 'access', _241 => _241[r], 'optionalAccess', _242 => _242[c]]);
|
|
20647
20960
|
if (!labelCell) continue;
|
|
20648
20961
|
if (!isLabelCell(labelCell.text)) continue;
|
|
20649
20962
|
let vc = c + labelCell.colSpan;
|
|
@@ -20654,12 +20967,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20654
20967
|
if (isKeywordLabel(valueCell.text)) continue;
|
|
20655
20968
|
const normalizedCellLabel = normalizeLabel(labelCell.text);
|
|
20656
20969
|
if (!normalizedCellLabel) continue;
|
|
20657
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
20970
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _243 => _243.has, 'call', _244 => _244(normalizedCellLabel)])) continue;
|
|
20658
20971
|
const matchKey = findMatchingKey(normalizedCellLabel, values);
|
|
20659
20972
|
if (matchKey === void 0) continue;
|
|
20660
20973
|
const newValue = values.consume(matchKey);
|
|
20661
20974
|
if (newValue === void 0) continue;
|
|
20662
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
20975
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _245 => _245.has, 'call', _246 => _246(valueCell)])) {
|
|
20663
20976
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20664
20977
|
} else {
|
|
20665
20978
|
valueCell.text = newValue;
|
|
@@ -20676,8 +20989,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20676
20989
|
}
|
|
20677
20990
|
if (table2.rows >= 2 && table2.cols >= 2) {
|
|
20678
20991
|
const headerRow = table2.cells[0];
|
|
20679
|
-
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess',
|
|
20680
|
-
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess',
|
|
20992
|
+
const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _247 => _247.every, 'call', _248 => _248((cell2) => {
|
|
20993
|
+
const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _249 => _249.text, 'access', _250 => _250.trim, 'call', _251 => _251()]), () => ( ""));
|
|
20681
20994
|
return t.length > 0 && t.length <= 20 && isLabelCell(t);
|
|
20682
20995
|
})]), () => ( false));
|
|
20683
20996
|
if (!allLabels) return;
|
|
@@ -20685,16 +20998,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
|
|
|
20685
20998
|
for (let c = 0; c < table2.cols; c++) {
|
|
20686
20999
|
if (covered.has(`${r},${c}`)) continue;
|
|
20687
21000
|
const headerCell = headerRow[c];
|
|
20688
|
-
const valueCell = _optionalChain([table2, 'access',
|
|
21001
|
+
const valueCell = _optionalChain([table2, 'access', _252 => _252.cells, 'access', _253 => _253[r], 'optionalAccess', _254 => _254[c]]);
|
|
20689
21002
|
if (!headerCell || !valueCell) continue;
|
|
20690
21003
|
const headerLabel = normalizeLabel(headerCell.text);
|
|
20691
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
21004
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _255 => _255.has, 'call', _256 => _256(headerLabel)])) continue;
|
|
20692
21005
|
const matchKey = findMatchingKey(headerLabel, values);
|
|
20693
21006
|
if (matchKey === void 0) continue;
|
|
20694
21007
|
if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
20695
21008
|
const newValue = values.consume(matchKey);
|
|
20696
21009
|
if (newValue === void 0) continue;
|
|
20697
|
-
if (_optionalChain([patternFilledCells, 'optionalAccess',
|
|
21010
|
+
if (_optionalChain([patternFilledCells, 'optionalAccess', _257 => _257.has, 'call', _258 => _258(valueCell)])) {
|
|
20698
21011
|
valueCell.text = newValue + " " + valueCell.text;
|
|
20699
21012
|
} else {
|
|
20700
21013
|
valueCell.text = newValue;
|
|
@@ -20726,7 +21039,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
|
|
|
20726
21039
|
if (newValue === void 0) continue;
|
|
20727
21040
|
matchedLabels.add(matchKey);
|
|
20728
21041
|
filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
|
|
20729
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
21042
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _259 => _259[i + 1], 'optionalAccess', _260 => _260.viaExt]), () => ( false)));
|
|
20730
21043
|
out += text.slice(pos, seg.valueStart);
|
|
20731
21044
|
out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
20732
21045
|
pos = ve;
|
|
@@ -21349,7 +21662,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21349
21662
|
const splices = [];
|
|
21350
21663
|
for (const region of scanClickHereRegions(xml)) {
|
|
21351
21664
|
const key = normalizeLabel(region.name);
|
|
21352
|
-
if (!key || _optionalChain([blockedLabels, 'optionalAccess',
|
|
21665
|
+
if (!key || _optionalChain([blockedLabels, 'optionalAccess', _261 => _261.has, 'call', _262 => _262(key)])) continue;
|
|
21353
21666
|
if (!cursor.has(key)) continue;
|
|
21354
21667
|
const value = cursor.consume(key);
|
|
21355
21668
|
if (value === void 0) continue;
|
|
@@ -21367,7 +21680,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
21367
21680
|
};
|
|
21368
21681
|
}
|
|
21369
21682
|
async function extractClickHereFields(hwpxBuffer) {
|
|
21370
|
-
|
|
21683
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21371
21684
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21372
21685
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21373
21686
|
const fields = [];
|
|
@@ -21415,19 +21728,19 @@ function parseCentralDirectory(buf) {
|
|
|
21415
21728
|
}
|
|
21416
21729
|
}
|
|
21417
21730
|
}
|
|
21418
|
-
if (eocdOffset < 0) throw new (0,
|
|
21731
|
+
if (eocdOffset < 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21419
21732
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
21420
21733
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
21421
21734
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
21422
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
21735
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21423
21736
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
21424
|
-
throw new (0,
|
|
21737
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21425
21738
|
}
|
|
21426
21739
|
const decoder = new TextDecoder("utf-8");
|
|
21427
21740
|
const entries = [];
|
|
21428
21741
|
let pos = cdOffset;
|
|
21429
21742
|
for (let i = 0; i < totalEntries; i++) {
|
|
21430
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
21743
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
21431
21744
|
const flags = view.getUint16(pos + 8, true);
|
|
21432
21745
|
const method = view.getUint16(pos + 10, true);
|
|
21433
21746
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -21438,7 +21751,7 @@ function parseCentralDirectory(buf) {
|
|
|
21438
21751
|
const commentLen = view.getUint16(pos + 32, true);
|
|
21439
21752
|
const localOffset = view.getUint32(pos + 42, true);
|
|
21440
21753
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
21441
|
-
throw new (0,
|
|
21754
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
21442
21755
|
}
|
|
21443
21756
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
21444
21757
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -21467,11 +21780,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21467
21780
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
21468
21781
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
21469
21782
|
for (const name of replacements.keys()) {
|
|
21470
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
21783
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkE6DONLTMcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21471
21784
|
}
|
|
21472
21785
|
if (additions) {
|
|
21473
21786
|
for (const name of additions.keys()) {
|
|
21474
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
21787
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkE6DONLTMcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
21475
21788
|
}
|
|
21476
21789
|
}
|
|
21477
21790
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -21490,7 +21803,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21490
21803
|
offset += seg.length;
|
|
21491
21804
|
continue;
|
|
21492
21805
|
}
|
|
21493
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
21806
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkE6DONLTMcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
21494
21807
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
21495
21808
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
21496
21809
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -21498,7 +21811,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21498
21811
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
21499
21812
|
const method = e.method;
|
|
21500
21813
|
if (method !== 0 && method !== 8) {
|
|
21501
|
-
throw new (0,
|
|
21814
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
|
|
21502
21815
|
}
|
|
21503
21816
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
21504
21817
|
const crc = crc32(newData);
|
|
@@ -21596,11 +21909,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
21596
21909
|
// src/form/filler-hwpx.ts
|
|
21597
21910
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
21598
21911
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
21599
|
-
|
|
21912
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
21600
21913
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
21601
21914
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
21602
21915
|
if (sectionPaths.length === 0) {
|
|
21603
|
-
throw new (0,
|
|
21916
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21604
21917
|
}
|
|
21605
21918
|
const warnings = [];
|
|
21606
21919
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -21699,7 +22012,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21699
22012
|
if (isKeywordLabel(cellLabelText(valueCell))) continue;
|
|
21700
22013
|
const normalizedCellLabel = normalizeLabel(labelText);
|
|
21701
22014
|
if (!normalizedCellLabel) continue;
|
|
21702
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22015
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _263 => _263.has, 'call', _264 => _264(normalizedCellLabel)])) continue;
|
|
21703
22016
|
const matchKey = findMatchingKey(normalizedCellLabel, cursor);
|
|
21704
22017
|
if (matchKey === void 0) continue;
|
|
21705
22018
|
if (patternApplied.has(valueCell)) {
|
|
@@ -21757,7 +22070,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21757
22070
|
const dataCells = table2.rows[rowIdx];
|
|
21758
22071
|
for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
|
|
21759
22072
|
const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
|
|
21760
|
-
if (_optionalChain([blockedLabels, 'optionalAccess',
|
|
22073
|
+
if (_optionalChain([blockedLabels, 'optionalAccess', _265 => _265.has, 'call', _266 => _266(headerLabel)])) continue;
|
|
21761
22074
|
const matchKey = findMatchingKey(headerLabel, cursor);
|
|
21762
22075
|
if (matchKey === void 0) continue;
|
|
21763
22076
|
if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
|
|
@@ -21811,7 +22124,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21811
22124
|
}
|
|
21812
22125
|
for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
|
|
21813
22126
|
const existing = ledger.get(para2);
|
|
21814
|
-
if (_optionalChain([existing, 'optionalAccess',
|
|
22127
|
+
if (_optionalChain([existing, 'optionalAccess', _267 => _267.fullText]) !== void 0) continue;
|
|
21815
22128
|
const text = matchText(para2);
|
|
21816
22129
|
const segments = scanInlineSegments(text);
|
|
21817
22130
|
const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
|
|
@@ -21822,7 +22135,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
|
21822
22135
|
const matchKey = matched.key;
|
|
21823
22136
|
const newValue = cursor.consume(matchKey);
|
|
21824
22137
|
if (newValue === void 0) continue;
|
|
21825
|
-
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access',
|
|
22138
|
+
const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _268 => _268[i + 1], 'optionalAccess', _269 => _269.viaExt]), () => ( false)));
|
|
21826
22139
|
const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
|
|
21827
22140
|
const l = led(para2);
|
|
21828
22141
|
l.ranges.push({ start: seg.valueStart, end: ve, replacement });
|
|
@@ -22063,9 +22376,9 @@ function fixedPitchWidthEm1000(cp) {
|
|
|
22063
22376
|
return cp < 128 ? 500 : 1e3;
|
|
22064
22377
|
}
|
|
22065
22378
|
function measureTextWidth(text, height, ratioPct, opts) {
|
|
22066
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22067
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22068
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22379
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _270 => _270.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22380
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _271 => _271.spacingPct]), () => ( 0));
|
|
22381
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _272 => _272.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22069
22382
|
let em = 0;
|
|
22070
22383
|
for (const ch of text) {
|
|
22071
22384
|
const cp = ch.codePointAt(0);
|
|
@@ -22078,9 +22391,9 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
22078
22391
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
22079
22392
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
22080
22393
|
const EPS = 0.5;
|
|
22081
|
-
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22082
|
-
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess',
|
|
22083
|
-
const widthEm = _optionalChain([opts, 'optionalAccess',
|
|
22394
|
+
const spaceEm = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _273 => _273.spaceEm]), () => ( SPACE_EM_FIXED));
|
|
22395
|
+
const spacing = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _274 => _274.spacingPct]), () => ( 0));
|
|
22396
|
+
const widthEm = _optionalChain([opts, 'optionalAccess', _275 => _275.faceClass]) === "fixedPitch" ? fixedPitchWidthEm1000 : charWidthEm1000;
|
|
22084
22397
|
const k = height * ratioPct / 100 / 1e3;
|
|
22085
22398
|
const cwCp = (cp) => (cp === 32 ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
22086
22399
|
const charW2 = (ch) => cwCp(ch.codePointAt(0));
|
|
@@ -22342,7 +22655,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
22342
22655
|
}
|
|
22343
22656
|
function assertFiniteRange(name, value, min, max) {
|
|
22344
22657
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
22345
|
-
throw new (0,
|
|
22658
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
22346
22659
|
}
|
|
22347
22660
|
}
|
|
22348
22661
|
function validateGongmunOptions(opts) {
|
|
@@ -22357,10 +22670,10 @@ function validateGongmunOptions(opts) {
|
|
|
22357
22670
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
22358
22671
|
}
|
|
22359
22672
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
22360
|
-
throw new (0,
|
|
22673
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
22361
22674
|
}
|
|
22362
22675
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
22363
|
-
throw new (0,
|
|
22676
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
22364
22677
|
}
|
|
22365
22678
|
}
|
|
22366
22679
|
if (opts.sizes) {
|
|
@@ -22369,7 +22682,7 @@ function validateGongmunOptions(opts) {
|
|
|
22369
22682
|
}
|
|
22370
22683
|
}
|
|
22371
22684
|
if (opts.approval && opts.approval.length > 6) {
|
|
22372
|
-
throw new (0,
|
|
22685
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("approval must contain at most 6 labels");
|
|
22373
22686
|
}
|
|
22374
22687
|
}
|
|
22375
22688
|
function incompatibleGongmunWarnings(opts) {
|
|
@@ -22433,7 +22746,7 @@ function resolveGongmun(opts) {
|
|
|
22433
22746
|
suppressSingle: _nullishCoalesce(opts.suppressSingle, () => ( false)),
|
|
22434
22747
|
docHead: preset === "official" && opts.docHead ? opts.docHead : null,
|
|
22435
22748
|
docFoot: preset === "official" && opts.docFoot ? opts.docFoot : null,
|
|
22436
|
-
reportInfo: _optionalChain([opts, 'access',
|
|
22749
|
+
reportInfo: _optionalChain([opts, 'access', _276 => _276.reportInfo, 'optionalAccess', _277 => _277.trim, 'call', _278 => _278()]) || null,
|
|
22437
22750
|
noticeHead: preset === "notice" && opts.noticeHead ? opts.noticeHead : null,
|
|
22438
22751
|
// 보도자료 머리박스는 프리셋 자체가 요구 — 옵션 미지정이어도 빈 객체
|
|
22439
22752
|
press: preset === "press" ? _nullishCoalesce(opts.press, () => ( {})) : null
|
|
@@ -22542,16 +22855,16 @@ var PARA_LIST = 7;
|
|
|
22542
22855
|
var DEFAULT_TEXT_COLOR = "#000000";
|
|
22543
22856
|
function resolveTheme(theme) {
|
|
22544
22857
|
return {
|
|
22545
|
-
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22546
|
-
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22547
|
-
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22548
|
-
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22549
|
-
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22550
|
-
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22858
|
+
h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _279 => _279.headingColors, 'optionalAccess', _280 => _280[1]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22859
|
+
h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _281 => _281.headingColors, 'optionalAccess', _282 => _282[2]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22860
|
+
h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _283 => _283.headingColors, 'optionalAccess', _284 => _284[3]]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22861
|
+
h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _285 => _285.headingColors, 'optionalAccess', _286 => _286[4]]), () => ( _optionalChain([theme, 'optionalAccess', _287 => _287.headingColors, 'optionalAccess', _288 => _288[3]]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22862
|
+
body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _289 => _289.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22863
|
+
quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _290 => _290.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
|
|
22551
22864
|
/** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
|
|
22552
|
-
hasQuoteOption: _optionalChain([theme, 'optionalAccess',
|
|
22553
|
-
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess',
|
|
22554
|
-
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess',
|
|
22865
|
+
hasQuoteOption: _optionalChain([theme, 'optionalAccess', _291 => _291.quoteColor]) !== void 0,
|
|
22866
|
+
tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _292 => _292.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _293 => _293.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
|
|
22867
|
+
tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _294 => _294.tableHeaderBold])
|
|
22555
22868
|
};
|
|
22556
22869
|
}
|
|
22557
22870
|
function escapeXml(text) {
|
|
@@ -22907,7 +23220,7 @@ function parseInlineMarkdown(text) {
|
|
|
22907
23220
|
else spans.push(...emphasisSpans(m[0]));
|
|
22908
23221
|
} else {
|
|
22909
23222
|
const anchor = m[2] || m[3];
|
|
22910
|
-
const href = _nullishCoalesce(
|
|
23223
|
+
const href = _nullishCoalesce(_chunkE6DONLTMcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
22911
23224
|
const sub = emphasisSpans(anchor);
|
|
22912
23225
|
if (href) for (const s of sub) s.href = href;
|
|
22913
23226
|
spans.push(...sub);
|
|
@@ -23073,8 +23386,8 @@ function resolvePage(opts) {
|
|
|
23073
23386
|
// 실측: 용지 치수는 방향과 무관하게 유지, 방향은 landscape 속성만 바뀐다
|
|
23074
23387
|
landscape: orientation === "landscape" ? "NARROWLY" : "WIDELY",
|
|
23075
23388
|
columns: cols,
|
|
23076
|
-
header: _optionalChain([header, 'optionalAccess',
|
|
23077
|
-
footer: _optionalChain([footer, 'optionalAccess',
|
|
23389
|
+
header: _optionalChain([header, 'optionalAccess', _295 => _295.trim, 'call', _296 => _296()]) ? header.trim() : null,
|
|
23390
|
+
footer: _optionalChain([footer, 'optionalAccess', _297 => _297.trim, 'call', _298 => _298()]) ? footer.trim() : null
|
|
23078
23391
|
};
|
|
23079
23392
|
}
|
|
23080
23393
|
function columnColPrXml(columns) {
|
|
@@ -23121,7 +23434,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
23121
23434
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
23122
23435
|
const got = m ? Number(m[1]) : NaN;
|
|
23123
23436
|
if (got !== startId + i) {
|
|
23124
|
-
throw new (0,
|
|
23437
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
23125
23438
|
`\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
|
|
23126
23439
|
);
|
|
23127
23440
|
}
|
|
@@ -23205,7 +23518,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
23205
23518
|
}
|
|
23206
23519
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
23207
23520
|
if (rows.length !== expectedBase) {
|
|
23208
|
-
throw new (0,
|
|
23521
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
23209
23522
|
`\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
|
|
23210
23523
|
);
|
|
23211
23524
|
}
|
|
@@ -23433,7 +23746,7 @@ function buildStyles(gongmun) {
|
|
|
23433
23746
|
</hh:styles>`;
|
|
23434
23747
|
}
|
|
23435
23748
|
function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
|
|
23436
|
-
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess',
|
|
23749
|
+
const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _299 => _299.fonts, 'access', _300 => _300.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _301 => _301.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
|
|
23437
23750
|
const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
|
|
23438
23751
|
const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
|
|
23439
23752
|
return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
|
@@ -23562,8 +23875,8 @@ function parseChartFence(text) {
|
|
|
23562
23875
|
const spec = chartSpec(type);
|
|
23563
23876
|
let finalSeries = spec.pie ? [series[0]] : series;
|
|
23564
23877
|
finalSeries = finalSeries.map((s) => ({ ...s }));
|
|
23565
|
-
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23566
|
-
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess',
|
|
23878
|
+
const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _302 => _302.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
|
|
23879
|
+
const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _303 => _303[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
|
|
23567
23880
|
if (!spec.scatter) {
|
|
23568
23881
|
finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
|
|
23569
23882
|
}
|
|
@@ -23605,7 +23918,7 @@ function serSpPr(color, stroke) {
|
|
|
23605
23918
|
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>`;
|
|
23606
23919
|
}
|
|
23607
23920
|
function dPtXml(pointColors, pie) {
|
|
23608
|
-
if (!_optionalChain([pointColors, 'optionalAccess',
|
|
23921
|
+
if (!_optionalChain([pointColors, 'optionalAccess', _304 => _304.length])) return "";
|
|
23609
23922
|
return pointColors.map((col, i) => {
|
|
23610
23923
|
const f = chartColorFill(col);
|
|
23611
23924
|
if (!f) return "";
|
|
@@ -23844,8 +24157,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
|
|
|
23844
24157
|
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 });
|
|
23845
24158
|
const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
|
|
23846
24159
|
const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
|
|
23847
|
-
const date = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
23848
|
-
const org = _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
24160
|
+
const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _305 => _305.cover, 'optionalAccess', _306 => _306.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
|
|
24161
|
+
const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _307 => _307.cover, 'optionalAccess', _308 => _308.org]), () => ( ""));
|
|
23849
24162
|
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>`;
|
|
23850
24163
|
const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
|
|
23851
24164
|
return [
|
|
@@ -24101,7 +24414,7 @@ function escapeGfm(text) {
|
|
|
24101
24414
|
}
|
|
24102
24415
|
var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
|
|
24103
24416
|
function sanitizeText(text) {
|
|
24104
|
-
let result =
|
|
24417
|
+
let result = _chunkR4LXZRYPcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
|
|
24105
24418
|
if (result.length <= 30 && result.includes(" ")) {
|
|
24106
24419
|
const tokens = result.split(" ");
|
|
24107
24420
|
const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-ㄱ-ㆎ]/.test(t)).length;
|
|
@@ -24131,7 +24444,7 @@ function replicateGfmTable(table2) {
|
|
|
24131
24444
|
for (let r = 0; r < numRows; r++) {
|
|
24132
24445
|
for (let c = 0; c < numCols; c++) {
|
|
24133
24446
|
if (skip.has(`${r},${c}`)) continue;
|
|
24134
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24447
|
+
const cell2 = _optionalChain([cells, 'access', _309 => _309[r], 'optionalAccess', _310 => _310[c]]);
|
|
24135
24448
|
if (!cell2) continue;
|
|
24136
24449
|
display[r][c] = {
|
|
24137
24450
|
text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
|
|
@@ -24185,7 +24498,7 @@ function unescapeGfmCell(text) {
|
|
|
24185
24498
|
return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
|
|
24186
24499
|
}
|
|
24187
24500
|
function replicateCellInnerHtml(cell2) {
|
|
24188
|
-
if (_optionalChain([cell2, 'access',
|
|
24501
|
+
if (_optionalChain([cell2, 'access', _311 => _311.blocks, 'optionalAccess', _312 => _312.length])) {
|
|
24189
24502
|
return cell2.blocks.map((b) => {
|
|
24190
24503
|
if (b.type === "table" && b.table) {
|
|
24191
24504
|
const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
|
|
@@ -24224,7 +24537,7 @@ function replicateHtmlTable(table2) {
|
|
|
24224
24537
|
const rowCells = [];
|
|
24225
24538
|
for (let c = 0; c < numCols; c++) {
|
|
24226
24539
|
if (skip.has(`${r},${c}`)) continue;
|
|
24227
|
-
const cell2 = _optionalChain([cells, 'access',
|
|
24540
|
+
const cell2 = _optionalChain([cells, 'access', _313 => _313[r], 'optionalAccess', _314 => _314[c]]);
|
|
24228
24541
|
if (!cell2) continue;
|
|
24229
24542
|
for (let dr = 0; dr < cell2.rowSpan; dr++) {
|
|
24230
24543
|
for (let dc = 0; dc < cell2.colSpan; dc++) {
|
|
@@ -24270,10 +24583,10 @@ function parseHtmlTable(raw) {
|
|
|
24270
24583
|
}
|
|
24271
24584
|
} else {
|
|
24272
24585
|
if (!isClose) {
|
|
24273
|
-
const cs = parseInt(_optionalChain([attrs, 'access',
|
|
24274
|
-
const rs = parseInt(_optionalChain([attrs, 'access',
|
|
24586
|
+
const cs = parseInt(_optionalChain([attrs, 'access', _315 => _315.match, 'call', _316 => _316(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _317 => _317[1]]) || "1", 10);
|
|
24587
|
+
const rs = parseInt(_optionalChain([attrs, 'access', _318 => _318.match, 'call', _319 => _319(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _320 => _320[1]]) || "1", 10);
|
|
24275
24588
|
cellStart = m.index + m[0].length;
|
|
24276
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
24589
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkR4LXZRYPcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkR4LXZRYPcjs.MAX_ROWS) };
|
|
24277
24590
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
24278
24591
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
24279
24592
|
cellStart = -1;
|
|
@@ -24297,7 +24610,7 @@ function htmlCellInnerToLines(inner) {
|
|
|
24297
24610
|
hadNonText = true;
|
|
24298
24611
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
24299
24612
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
24300
|
-
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess',
|
|
24613
|
+
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _321 => _321[1]]), () => ( _optionalChain([m, 'optionalAccess', _322 => _322[2]])));
|
|
24301
24614
|
if (src) imgSrcs.push(src);
|
|
24302
24615
|
return "";
|
|
24303
24616
|
});
|
|
@@ -24440,7 +24753,7 @@ function edgeXml(tag, d) {
|
|
|
24440
24753
|
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"/>`;
|
|
24441
24754
|
}
|
|
24442
24755
|
function borderFillDefToXml(id, def) {
|
|
24443
|
-
const fill = _optionalChain([def, 'access',
|
|
24756
|
+
const fill = _optionalChain([def, 'access', _323 => _323.fill, 'optionalAccess', _324 => _324.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
|
|
24444
24757
|
return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
|
|
24445
24758
|
<hh:slash type="NONE" Crooked="0" isCounter="0"/>
|
|
24446
24759
|
<hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
|
|
@@ -24756,7 +25069,7 @@ var ImageRegistry = (_class5 = class {
|
|
|
24756
25069
|
}
|
|
24757
25070
|
/** 실데이터 등록 — images 맵 바이트·data: URI. 포맷 미상(webp 등)은 null → placeholder 폴백 */
|
|
24758
25071
|
takeReal(url) {
|
|
24759
|
-
let bytes = _optionalChain([this, 'access',
|
|
25072
|
+
let bytes = _optionalChain([this, 'access', _325 => _325.supplied, 'optionalAccess', _326 => _326.get, 'call', _327 => _327(url)]);
|
|
24760
25073
|
if (!bytes && url.startsWith("data:")) {
|
|
24761
25074
|
const m = /^data:image\/[a-z+]+;base64,([A-Za-z0-9+/=\s]+)$/i.exec(url);
|
|
24762
25075
|
if (m) {
|
|
@@ -24931,11 +25244,11 @@ function estimateRowHeight(cells, widths, charHeight) {
|
|
|
24931
25244
|
function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
|
|
24932
25245
|
const rowCnt = rows.length;
|
|
24933
25246
|
const colCnt = Math.max(...rows.map((r) => r.length), 1);
|
|
24934
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25247
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _328 => _328.bfRegistry]), () => ( null));
|
|
24935
25248
|
const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
|
|
24936
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25249
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _329 => _329.charHeight]), () => ( 1e3));
|
|
24937
25250
|
const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
|
|
24938
|
-
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access',
|
|
25251
|
+
const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _330 => _330[0], 'optionalAccess', _331 => _331[0]]), () => ( ""))), seq, rowAnchor);
|
|
24939
25252
|
const colMax = Array(colCnt).fill(0);
|
|
24940
25253
|
const colMaxBody = Array(colCnt).fill(0);
|
|
24941
25254
|
const colMinWord = Array(colCnt).fill(0);
|
|
@@ -24963,7 +25276,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24963
25276
|
const k = `${rowIdx},${colIdx}`;
|
|
24964
25277
|
const isLabelCell2 = labelCol0 && colIdx === 0;
|
|
24965
25278
|
const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
|
|
24966
|
-
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25279
|
+
const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _332 => _332.cellChar, 'access', _333 => _333.get, 'call', _334 => _334(k)]), () => ( defaultCharPr));
|
|
24967
25280
|
const centered = isHeaderRow || colCentered[colIdx];
|
|
24968
25281
|
const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
24969
25282
|
const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
|
|
@@ -24981,11 +25294,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24981
25294
|
}
|
|
24982
25295
|
}
|
|
24983
25296
|
}
|
|
24984
|
-
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess',
|
|
25297
|
+
const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _335 => _335.cellChar, 'access', _336 => _336.has, 'call', _337 => _337(k)]) ? void 0 : mapId);
|
|
24985
25298
|
const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
|
|
24986
25299
|
return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
|
|
24987
25300
|
}).join("");
|
|
24988
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25301
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _338 => _338.cellBf, 'access', _339 => _339.get, 'call', _340 => _340(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
24989
25302
|
row: rowIdx,
|
|
24990
25303
|
rowEnd: rowIdx,
|
|
24991
25304
|
col: colIdx,
|
|
@@ -24995,7 +25308,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
24995
25308
|
headerRows: 1,
|
|
24996
25309
|
fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
|
|
24997
25310
|
})) : style && isHeaderRow ? style.headerBf : 2)));
|
|
24998
|
-
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25311
|
+
const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _341 => _341.cellH, 'access', _342 => _342.get, 'call', _343 => _343(k)]), () => ( cellH));
|
|
24999
25312
|
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>`;
|
|
25000
25313
|
}).join("");
|
|
25001
25314
|
return `<hp:tr>${tdElements}</hp:tr>`;
|
|
@@ -25004,7 +25317,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
|
|
|
25004
25317
|
const tblH = rowHeights.reduce((a, b) => a + b, 0);
|
|
25005
25318
|
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;
|
|
25006
25319
|
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>`;
|
|
25007
|
-
const hostPr = reg && _optionalChain([style, 'optionalAccess',
|
|
25320
|
+
const hostPr = reg && _optionalChain([style, 'optionalAccess', _344 => _344.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
|
|
25008
25321
|
return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
|
|
25009
25322
|
}
|
|
25010
25323
|
function layoutHtmlRows(rows) {
|
|
@@ -25015,8 +25328,8 @@ function layoutHtmlRows(rows) {
|
|
|
25015
25328
|
let c = 0;
|
|
25016
25329
|
for (const cell2 of rows[r].cells) {
|
|
25017
25330
|
while (occupied.has(`${r},${c}`)) c++;
|
|
25018
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
25019
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
25331
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkR4LXZRYPcjs.MAX_COLS);
|
|
25332
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkR4LXZRYPcjs.MAX_ROWS);
|
|
25020
25333
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
25021
25334
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
25022
25335
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -25044,7 +25357,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25044
25357
|
if (!rows || rows.length === 0) return null;
|
|
25045
25358
|
const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
|
|
25046
25359
|
if (rowCnt === 0 || colCnt === 0) return null;
|
|
25047
|
-
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25360
|
+
const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _345 => _345.charHeight]), () => ( 1e3));
|
|
25048
25361
|
const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
|
|
25049
25362
|
const row0 = Array.from({ length: colCnt }, () => "");
|
|
25050
25363
|
for (const cell2 of placed) {
|
|
@@ -25073,7 +25386,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25073
25386
|
const tblId = nextTableId();
|
|
25074
25387
|
const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
|
|
25075
25388
|
const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
|
|
25076
|
-
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess',
|
|
25389
|
+
const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _346 => _346.bfRegistry]), () => ( null));
|
|
25077
25390
|
let htmlHeaderRows = 0;
|
|
25078
25391
|
while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
|
|
25079
25392
|
const tableRowHeights = Array(rowCnt).fill(cellH);
|
|
@@ -25087,7 +25400,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25087
25400
|
const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
|
|
25088
25401
|
const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
|
|
25089
25402
|
if (nestedXml) {
|
|
25090
|
-
const szH = _optionalChain([nestedXml, 'access',
|
|
25403
|
+
const szH = _optionalChain([nestedXml, 'access', _347 => _347.match, 'call', _348 => _348(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _349 => _349[1]]);
|
|
25091
25404
|
nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
|
|
25092
25405
|
}
|
|
25093
25406
|
return nestedXml;
|
|
@@ -25098,7 +25411,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25098
25411
|
for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
|
|
25099
25412
|
const lineH = style ? Math.round(measureH * 1.6) : 800;
|
|
25100
25413
|
const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
|
|
25101
|
-
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25414
|
+
const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _350 => _350.cellH, 'access', _351 => _351.get, 'call', _352 => _352(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
|
|
25102
25415
|
const perRow = Math.ceil(cellHeight / rowSpan);
|
|
25103
25416
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
|
|
25104
25417
|
return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
|
|
@@ -25109,7 +25422,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25109
25422
|
const baseCharPr = style ? style.charPr : CHAR_NORMAL;
|
|
25110
25423
|
const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
|
|
25111
25424
|
const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
|
|
25112
|
-
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25425
|
+
const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _353 => _353.cellChar, 'access', _354 => _354.get, 'call', _355 => _355(k)]), () => ( defaultCharPr));
|
|
25113
25426
|
const centered = isHeader || colCentered[cell2.c];
|
|
25114
25427
|
const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
|
|
25115
25428
|
const picUrls = images ? [...imgSrcs] : [];
|
|
@@ -25149,7 +25462,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
|
|
|
25149
25462
|
let cellHeight = 0;
|
|
25150
25463
|
for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
|
|
25151
25464
|
const rowEnd = cell2.r + rowSpan - 1;
|
|
25152
|
-
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess',
|
|
25465
|
+
const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _356 => _356.cellBf, 'access', _357 => _357.get, 'call', _358 => _358(k)]), () => ( (reg ? reg.get(dataCellSpec({
|
|
25153
25466
|
row: cell2.r,
|
|
25154
25467
|
rowEnd,
|
|
25155
25468
|
col: cell2.c,
|
|
@@ -25319,7 +25632,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
|
|
|
25319
25632
|
return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
|
|
25320
25633
|
}
|
|
25321
25634
|
function buildPressContact(g, ids, bodyWidth, reg) {
|
|
25322
|
-
const c = _optionalChain([g, 'access',
|
|
25635
|
+
const c = _optionalChain([g, 'access', _359 => _359.press, 'optionalAccess', _360 => _360.contact]);
|
|
25323
25636
|
if (!c || !c.dept && !c.manager && !c.phone) return [];
|
|
25324
25637
|
const w = bodyWidth - 280;
|
|
25325
25638
|
const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
|
|
@@ -25698,10 +26011,10 @@ function generateSecPr(gongmun, page = null) {
|
|
|
25698
26011
|
m.header = gongmun.headerFooter;
|
|
25699
26012
|
m.footer = gongmun.headerFooter;
|
|
25700
26013
|
}
|
|
25701
|
-
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',
|
|
25702
|
-
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess',
|
|
25703
|
-
const hf = (_optionalChain([page, 'optionalAccess',
|
|
25704
|
-
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess',
|
|
26014
|
+
const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _361 => _361.landscape]), () => ( "WIDELY"))}" width="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _362 => _362.widthHU]), () => ( A4_W_HU))}" height="${_nullishCoalesce(_optionalChain([page, 'optionalAccess', _363 => _363.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>`;
|
|
26015
|
+
const colPr = columnColPrXml(_nullishCoalesce(_optionalChain([page, 'optionalAccess', _364 => _364.columns]), () => ( 1)));
|
|
26016
|
+
const hf = (_optionalChain([page, 'optionalAccess', _365 => _365.header]) ? headerFooterCtrl("header", page.header, 1) : "") + (_optionalChain([page, 'optionalAccess', _366 => _366.footer]) ? headerFooterCtrl("footer", page.footer, 2) : "");
|
|
26017
|
+
return secPr + colPr + hf + (_optionalChain([gongmun, 'optionalAccess', _367 => _367.pageNumbers]) ? pageNumCtrl() : "");
|
|
25705
26018
|
}
|
|
25706
26019
|
var SectionOpener = (_class6 = class {
|
|
25707
26020
|
constructor(gongmun, page = null) {;_class6.prototype.__init13.call(this);
|
|
@@ -25741,19 +26054,19 @@ function buildPreamble(blocks, ctx) {
|
|
|
25741
26054
|
const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
|
|
25742
26055
|
const preamble = [];
|
|
25743
26056
|
let hasFrontPages = false;
|
|
25744
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26057
|
+
if (_optionalChain([gongmun, 'optionalAccess', _368 => _368.reportInfo]) && dfIds) {
|
|
25745
26058
|
preamble.push(buildReportInfo(gongmun, dfIds));
|
|
25746
26059
|
}
|
|
25747
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26060
|
+
if (_optionalChain([gongmun, 'optionalAccess', _369 => _369.approval]) && bfReg) {
|
|
25748
26061
|
preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
|
|
25749
26062
|
}
|
|
25750
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26063
|
+
if (_optionalChain([gongmun, 'optionalAccess', _370 => _370.docHead]) && dfIds) {
|
|
25751
26064
|
preamble.push(...buildDocHead(gongmun, dfIds));
|
|
25752
26065
|
}
|
|
25753
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26066
|
+
if (_optionalChain([gongmun, 'optionalAccess', _371 => _371.noticeHead]) && dfIds) {
|
|
25754
26067
|
preamble.push(...buildNoticeHead(gongmun));
|
|
25755
26068
|
}
|
|
25756
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26069
|
+
if (_optionalChain([gongmun, 'optionalAccess', _372 => _372.press]) && dfIds && bfReg && tableStyle) {
|
|
25757
26070
|
preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25758
26071
|
}
|
|
25759
26072
|
if (gongmun && (gongmun.cover || gongmun.toc)) {
|
|
@@ -25782,7 +26095,7 @@ function buildPreamble(blocks, ctx) {
|
|
|
25782
26095
|
}
|
|
25783
26096
|
if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
|
|
25784
26097
|
ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25785
|
-
} else if (_optionalChain([gongmun, 'optionalAccess',
|
|
26098
|
+
} else if (_optionalChain([gongmun, 'optionalAccess', _373 => _373.press]) && ctx.coverH1Idx < 0 && dfIds) {
|
|
25786
26099
|
ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
|
|
25787
26100
|
}
|
|
25788
26101
|
if (preamble.length > 0) {
|
|
@@ -25797,7 +26110,7 @@ function renderHeading(block, blockIdx, ctx) {
|
|
|
25797
26110
|
if (gongmun && blockIdx === ctx.coverH1Idx) return "";
|
|
25798
26111
|
if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
|
|
25799
26112
|
const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
|
|
25800
|
-
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access',
|
|
26113
|
+
for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _374 => _374.press, 'optionalAccess', _375 => _375.sub]), () => ( []))) {
|
|
25801
26114
|
parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
|
|
25802
26115
|
}
|
|
25803
26116
|
return parts.join("\n ");
|
|
@@ -25891,8 +26204,8 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25891
26204
|
const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
|
|
25892
26205
|
if (gongmun && gongmunList) {
|
|
25893
26206
|
const info = gongmunList.items.get(blockIdx);
|
|
25894
|
-
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
25895
|
-
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess',
|
|
26207
|
+
const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _376 => _376.depth]), () => ( 0));
|
|
26208
|
+
const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _377 => _377.marker]), () => ( ""));
|
|
25896
26209
|
const content = block.text || "";
|
|
25897
26210
|
if (measured && content.trimStart().startsWith("\u203B")) {
|
|
25898
26211
|
return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
@@ -25901,7 +26214,7 @@ function renderListItem(block, blockIdx, ctx) {
|
|
|
25901
26214
|
return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
|
|
25902
26215
|
}
|
|
25903
26216
|
const text = marker2 ? `${marker2} ${content}` : content;
|
|
25904
|
-
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess',
|
|
26217
|
+
const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _378 => _378.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
|
|
25905
26218
|
let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
|
|
25906
26219
|
let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
|
|
25907
26220
|
if (measured && depth === 0 && gongmun.numbering !== "standard") {
|
|
@@ -25960,18 +26273,18 @@ function renderHtmlTable(block, ctx) {
|
|
|
25960
26273
|
}
|
|
25961
26274
|
function appendPostamble(blocks, ctx) {
|
|
25962
26275
|
const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
|
|
25963
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26276
|
+
if (_optionalChain([gongmun, 'optionalAccess', _379 => _379.noticeHead]) && dfIds) {
|
|
25964
26277
|
paraXmls.push(...buildNoticeFoot(gongmun));
|
|
25965
26278
|
}
|
|
25966
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
25967
|
-
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access',
|
|
26279
|
+
if (_optionalChain([gongmun, 'optionalAccess', _380 => _380.endMark]) && paraXmls.length > 0) {
|
|
26280
|
+
const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _381 => _381.rows, 'optionalAccess', _382 => _382.length]));
|
|
25968
26281
|
const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
|
|
25969
26282
|
if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
|
|
25970
26283
|
}
|
|
25971
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26284
|
+
if (_optionalChain([gongmun, 'optionalAccess', _383 => _383.docFoot]) && dfIds) {
|
|
25972
26285
|
paraXmls.push(...buildDocFoot(gongmun, dfIds));
|
|
25973
26286
|
}
|
|
25974
|
-
if (_optionalChain([gongmun, 'optionalAccess',
|
|
26287
|
+
if (_optionalChain([gongmun, 'optionalAccess', _384 => _384.press]) && dfIds && bfReg && tableStyle) {
|
|
25975
26288
|
paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
|
|
25976
26289
|
}
|
|
25977
26290
|
}
|
|
@@ -25991,7 +26304,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
25991
26304
|
remap,
|
|
25992
26305
|
dfIds,
|
|
25993
26306
|
images,
|
|
25994
|
-
gaejosik: _optionalChain([gongmun, 'optionalAccess',
|
|
26307
|
+
gaejosik: _optionalChain([gongmun, 'optionalAccess', _385 => _385.preset]) === "gaejosik",
|
|
25995
26308
|
measured,
|
|
25996
26309
|
richAssets,
|
|
25997
26310
|
vBase: charVariantBase(richAssets, !!gongmun),
|
|
@@ -26097,9 +26410,9 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
|
|
|
26097
26410
|
|
|
26098
26411
|
// src/hwpx/generator.ts
|
|
26099
26412
|
async function markdownToHwpx(markdown, options) {
|
|
26100
|
-
const theme = resolveTheme(_optionalChain([options, 'optionalAccess',
|
|
26101
|
-
const gongmun = _optionalChain([options, 'optionalAccess',
|
|
26102
|
-
const page = resolvePage(_optionalChain([options, 'optionalAccess',
|
|
26413
|
+
const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _386 => _386.theme]));
|
|
26414
|
+
const gongmun = _optionalChain([options, 'optionalAccess', _387 => _387.gongmun]) ? resolveGongmun(options.gongmun) : null;
|
|
26415
|
+
const page = resolvePage(_optionalChain([options, 'optionalAccess', _388 => _388.page]));
|
|
26103
26416
|
const { md: md2, defs } = extractFootnoteDefs(markdown);
|
|
26104
26417
|
beginInlineDoc(defs);
|
|
26105
26418
|
try {
|
|
@@ -26109,13 +26422,13 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26109
26422
|
const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
|
|
26110
26423
|
const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
|
|
26111
26424
|
const staticBfEnd = staticBorderFillNext(gongmun);
|
|
26112
|
-
const remap = _optionalChain([options, 'optionalAccess',
|
|
26113
|
-
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26425
|
+
const remap = _optionalChain([options, 'optionalAccess', _389 => _389.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _390 => _390.variants, 'optionalAccess', _391 => _391.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
|
|
26426
|
+
const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _392 => _392.borderFillXmls, 'access', _393 => _393.length]), () => ( 0)))) : null;
|
|
26114
26427
|
const dfActive = !!gongmun && docframeActive(gongmun);
|
|
26115
|
-
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26428
|
+
const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _394 => _394.variants, 'optionalAccess', _395 => _395.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _396 => _396.charPrXmls, 'access', _397 => _397.length]), () => ( 0)));
|
|
26116
26429
|
const dfIds = dfActive ? docframeIds(dfBase) : null;
|
|
26117
26430
|
const chartParts = [];
|
|
26118
|
-
const supplied = _optionalChain([options, 'optionalAccess',
|
|
26431
|
+
const supplied = _optionalChain([options, 'optionalAccess', _398 => _398.images]) ? new Map(Object.entries(options.images).map(([k, v]) => [k, v instanceof Uint8Array ? v : new Uint8Array(v)])) : void 0;
|
|
26119
26432
|
const images = new ImageRegistry(supplied);
|
|
26120
26433
|
const sectionXml = blocksToSectionXml(blocks, theme, gongmun, gongmunList, fit, chartParts, bfReg, remap, dfIds, images, page);
|
|
26121
26434
|
if (remap && remap.tables.length > 0) {
|
|
@@ -26124,7 +26437,7 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26124
26437
|
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)`);
|
|
26125
26438
|
}
|
|
26126
26439
|
}
|
|
26127
|
-
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26440
|
+
const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _399 => _399.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _400 => _400.emit, 'call', _401 => _401()]), () => ( []))];
|
|
26128
26441
|
const zip = new (0, _jszip2.default)();
|
|
26129
26442
|
zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
|
|
26130
26443
|
zip.file("META-INF/container.xml", generateContainerXml());
|
|
@@ -26133,11 +26446,11 @@ async function markdownToHwpx(markdown, options) {
|
|
|
26133
26446
|
zip.file("Contents/header.xml", generateHeaderXml(
|
|
26134
26447
|
theme,
|
|
26135
26448
|
gongmun,
|
|
26136
|
-
_nullishCoalesce(_optionalChain([fit, 'optionalAccess',
|
|
26449
|
+
_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _402 => _402.variants]), () => ( [])),
|
|
26137
26450
|
extraBorderFills,
|
|
26138
|
-
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26139
|
-
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess',
|
|
26140
|
-
_nullishCoalesce(_optionalChain([remap, 'optionalAccess',
|
|
26451
|
+
[..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _403 => _403.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
|
|
26452
|
+
_nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _404 => _404.indentVariants]), () => ( [])),
|
|
26453
|
+
_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _405 => _405.fontFaces]), () => ( []))
|
|
26141
26454
|
));
|
|
26142
26455
|
zip.file("Contents/section0.xml", sectionXml);
|
|
26143
26456
|
for (const part of chartParts) zip.file(part.name, part.xml);
|
|
@@ -26191,7 +26504,7 @@ function alignBlocks(a, b) {
|
|
|
26191
26504
|
const m = a.length, n = b.length;
|
|
26192
26505
|
if (m * n > 1e7) return fallbackAlign(a, b);
|
|
26193
26506
|
const lenOf = (blk) => {
|
|
26194
|
-
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26507
|
+
const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _406 => _406.text]), () => ( ""))).join(" ") : "";
|
|
26195
26508
|
return t.replace(/\s+/g, " ").trim().length;
|
|
26196
26509
|
};
|
|
26197
26510
|
const aLen = a.map(lenOf);
|
|
@@ -26264,8 +26577,8 @@ function blockSimilarity(a, b) {
|
|
|
26264
26577
|
}
|
|
26265
26578
|
function tableSimilarity(a, b) {
|
|
26266
26579
|
const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
|
|
26267
|
-
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26268
|
-
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess',
|
|
26580
|
+
const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _407 => _407.text]), () => ( ""))).join(" ");
|
|
26581
|
+
const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _408 => _408.text]), () => ( ""))).join(" ");
|
|
26269
26582
|
const contentSim = normalizedSimilarity(textsA, textsB);
|
|
26270
26583
|
return dimSim * 0.3 + contentSim * 0.7;
|
|
26271
26584
|
}
|
|
@@ -26276,8 +26589,8 @@ function diffTableCells(a, b) {
|
|
|
26276
26589
|
for (let r = 0; r < maxRows; r++) {
|
|
26277
26590
|
const row = [];
|
|
26278
26591
|
for (let c = 0; c < maxCols; c++) {
|
|
26279
|
-
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access',
|
|
26280
|
-
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access',
|
|
26592
|
+
const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _409 => _409.cells, 'access', _410 => _410[r], 'optionalAccess', _411 => _411[c], 'optionalAccess', _412 => _412.text]) : void 0;
|
|
26593
|
+
const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _413 => _413.cells, 'access', _414 => _414[r], 'optionalAccess', _415 => _415[c], 'optionalAccess', _416 => _416.text]) : void 0;
|
|
26281
26594
|
let type;
|
|
26282
26595
|
if (cellA === void 0) type = "added";
|
|
26283
26596
|
else if (cellB === void 0) type = "removed";
|
|
@@ -26327,7 +26640,7 @@ function builtinTemplateDir() {
|
|
|
26327
26640
|
for (const c of candidates) {
|
|
26328
26641
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
26329
26642
|
}
|
|
26330
|
-
throw new (0,
|
|
26643
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uB0B4\uC7A5 templates \uB514\uB809\uD1A0\uB9AC\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 (\uD328\uD0A4\uC9C0 \uC124\uCE58\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4)");
|
|
26331
26644
|
}
|
|
26332
26645
|
function readBuiltinTemplate(t) {
|
|
26333
26646
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -26490,7 +26803,7 @@ function parseRenderStyles(headXml) {
|
|
|
26490
26803
|
const underlineEl = findChildByLocalName(el, "underline");
|
|
26491
26804
|
const textColor = el.getAttribute("textColor");
|
|
26492
26805
|
const fontRef = findChildByLocalName(el, "fontRef");
|
|
26493
|
-
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess',
|
|
26806
|
+
const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _417 => _417.getAttribute, 'call', _418 => _418("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _419 => _419.getAttribute, 'call', _420 => _420("latin")])));
|
|
26494
26807
|
const face = fontId != null ? hangulFonts.get(fontId) : void 0;
|
|
26495
26808
|
styles.charPr.set(id, {
|
|
26496
26809
|
height: Number(el.getAttribute("height")) || 1e3,
|
|
@@ -26498,8 +26811,8 @@ function parseRenderStyles(headXml) {
|
|
|
26498
26811
|
italic: findChildByLocalName(el, "italic") != null,
|
|
26499
26812
|
underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
|
|
26500
26813
|
color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
|
|
26501
|
-
ratio: Number(_optionalChain([ratioEl, 'optionalAccess',
|
|
26502
|
-
spacing: Number(_optionalChain([spacingEl, 'optionalAccess',
|
|
26814
|
+
ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _421 => _421.getAttribute, 'call', _422 => _422("hangul")])) || 100,
|
|
26815
|
+
spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _423 => _423.getAttribute, 'call', _424 => _424("hangul")])) || 0,
|
|
26503
26816
|
fontFamily: face ? hwpFaceToCssStack(face) : void 0,
|
|
26504
26817
|
face
|
|
26505
26818
|
});
|
|
@@ -26508,7 +26821,7 @@ function parseRenderStyles(headXml) {
|
|
|
26508
26821
|
const id = el.getAttribute("id");
|
|
26509
26822
|
if (id != null) {
|
|
26510
26823
|
const align = findChildByLocalName(el, "align");
|
|
26511
|
-
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess',
|
|
26824
|
+
styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _425 => _425.getAttribute, 'call', _426 => _426("horizontal")]) || "JUSTIFY");
|
|
26512
26825
|
styles.paraGeom.set(id, parseParaGeom(el));
|
|
26513
26826
|
}
|
|
26514
26827
|
} else if (tag === "borderFill") {
|
|
@@ -26522,7 +26835,7 @@ function parseRenderStyles(headXml) {
|
|
|
26522
26835
|
};
|
|
26523
26836
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
26524
26837
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26525
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
26838
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _427 => _427.getAttribute, 'call', _428 => _428("faceColor")]);
|
|
26526
26839
|
if (face && face.toLowerCase() !== "none") bf.fill = face;
|
|
26527
26840
|
styles.borderFill.set(id, bf);
|
|
26528
26841
|
}
|
|
@@ -26594,7 +26907,7 @@ function collectSites(scan) {
|
|
|
26594
26907
|
}
|
|
26595
26908
|
function attrOf3(openTag, name) {
|
|
26596
26909
|
const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
|
|
26597
|
-
return _optionalChain([m, 'optionalAccess',
|
|
26910
|
+
return _optionalChain([m, 'optionalAccess', _429 => _429[1]]);
|
|
26598
26911
|
}
|
|
26599
26912
|
function paraOpenTag(xml, para2) {
|
|
26600
26913
|
const end = xml.indexOf(">", para2.start);
|
|
@@ -26609,7 +26922,7 @@ function anchorRunInfo(xml, para2, anchor) {
|
|
|
26609
26922
|
if (!tr) return null;
|
|
26610
26923
|
const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
|
|
26611
26924
|
const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
|
|
26612
|
-
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess',
|
|
26925
|
+
const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _430 => _430[1]]), () => ( tr.prefix)), () => ( "hp"));
|
|
26613
26926
|
const charPr2 = runOpen && attrOf3(runOpen[0], "charPrIDRef") || "0";
|
|
26614
26927
|
const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
|
|
26615
26928
|
if (close === -1) return null;
|
|
@@ -26636,7 +26949,7 @@ function cellContentWidthMm(xml, cell2) {
|
|
|
26636
26949
|
if (width === null) return null;
|
|
26637
26950
|
let content = width;
|
|
26638
26951
|
const win = cellAddrWindow(xml, cell2);
|
|
26639
|
-
const mg = _optionalChain([win, 'optionalAccess',
|
|
26952
|
+
const mg = _optionalChain([win, 'optionalAccess', _431 => _431.match, 'call', _432 => _432(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
|
|
26640
26953
|
if (mg) {
|
|
26641
26954
|
content -= Number(_nullishCoalesce(attrOf3(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf3(mg[0], "right"), () => ( 0)));
|
|
26642
26955
|
}
|
|
@@ -26670,12 +26983,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
26670
26983
|
return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
|
|
26671
26984
|
}
|
|
26672
26985
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
26673
|
-
if (ops.length === 0) throw new (0,
|
|
26986
|
+
if (ops.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26674
26987
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
26675
|
-
|
|
26988
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
26676
26989
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
26677
|
-
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access',
|
|
26678
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
26990
|
+
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _433 => _433.match, 'call', _434 => _434(/(\d+)\.xml$/i), 'optionalAccess', _435 => _435[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _436 => _436.match, 'call', _437 => _437(/(\d+)\.xml$/i), 'optionalAccess', _438 => _438[1]]), () => ( 0))));
|
|
26991
|
+
if (sectionPaths.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
26679
26992
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
26680
26993
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
26681
26994
|
const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
|
|
@@ -26716,11 +27029,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26716
27029
|
const manifestItems = [];
|
|
26717
27030
|
const placed = [];
|
|
26718
27031
|
for (const op of ops) {
|
|
26719
|
-
if (!op.anchor) throw new (0,
|
|
26720
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
27032
|
+
if (!op.anchor) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
27033
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
26721
27034
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
26722
|
-
if (!MIME[ext]) throw new (0,
|
|
26723
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
27035
|
+
if (!MIME[ext]) throw new (0, _chunkE6DONLTMcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
27036
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkE6DONLTMcjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
|
|
26724
27037
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
26725
27038
|
let found = null;
|
|
26726
27039
|
let total = 0;
|
|
@@ -26753,7 +27066,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26753
27066
|
}
|
|
26754
27067
|
}
|
|
26755
27068
|
}
|
|
26756
|
-
throw new (0,
|
|
27069
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
26757
27070
|
`place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
|
|
26758
27071
|
);
|
|
26759
27072
|
}
|
|
@@ -26761,9 +27074,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26761
27074
|
const xml = sectionXmls[si];
|
|
26762
27075
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
26763
27076
|
if (!run) {
|
|
26764
|
-
throw new (0,
|
|
27077
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
26765
27078
|
}
|
|
26766
|
-
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess',
|
|
27079
|
+
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _439 => _439.charPr, 'access', _440 => _440.get, 'call', _441 => _441(run.charPr), 'optionalAccess', _442 => _442.height]), () => ( 1e3));
|
|
26767
27080
|
const fontPt = charPrHeight / 100;
|
|
26768
27081
|
const emMm = fontPt * 25.4 / 72;
|
|
26769
27082
|
const lineHMm = emMm;
|
|
@@ -26772,7 +27085,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
26772
27085
|
const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
|
|
26773
27086
|
const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
|
|
26774
27087
|
const paraPrId = _nullishCoalesce(attrOf3(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
|
|
26775
|
-
const align = _optionalChain([styles, 'optionalAccess',
|
|
27088
|
+
const align = _optionalChain([styles, 'optionalAccess', _443 => _443.paraAlign, 'access', _444 => _444.get, 'call', _445 => _445(paraPrId)]);
|
|
26776
27089
|
let alignShiftMm = 0;
|
|
26777
27090
|
if (align === "CENTER" || align === "RIGHT") {
|
|
26778
27091
|
const paraWMm = measureMm(site.para.text, emMm);
|
|
@@ -26868,7 +27181,7 @@ function parseBorderFills(headerDoc) {
|
|
|
26868
27181
|
};
|
|
26869
27182
|
const fillBrush = findChildByLocalName(bf, "fillBrush");
|
|
26870
27183
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
26871
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
27184
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _446 => _446.getAttribute, 'call', _447 => _447("faceColor")]);
|
|
26872
27185
|
if (face && face !== "none") def.fill = { faceColor: face };
|
|
26873
27186
|
map.set(id, def);
|
|
26874
27187
|
}
|
|
@@ -26900,7 +27213,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
|
|
|
26900
27213
|
if (cp.getAttribute("italic") === "1") def.italic = true;
|
|
26901
27214
|
if (findChildByLocalName(cp, "underline")) def.underline = true;
|
|
26902
27215
|
const fontRef = findChildByLocalName(cp, "fontRef");
|
|
26903
|
-
const hangul = _optionalChain([fontRef, 'optionalAccess',
|
|
27216
|
+
const hangul = _optionalChain([fontRef, 'optionalAccess', _448 => _448.getAttribute, 'call', _449 => _449("hangul")]);
|
|
26904
27217
|
if (hangul) {
|
|
26905
27218
|
def.fontRef_hangul = hangul;
|
|
26906
27219
|
const face = hangulFonts.get(hangul);
|
|
@@ -26928,7 +27241,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26928
27241
|
const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
|
|
26929
27242
|
const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
|
|
26930
27243
|
const sz = findChildByLocalName(tbl2, "sz");
|
|
26931
|
-
const width = _optionalChain([sz, 'optionalAccess',
|
|
27244
|
+
const width = _optionalChain([sz, 'optionalAccess', _450 => _450.getAttribute, 'call', _451 => _451("width")]) || void 0;
|
|
26932
27245
|
const cells = [];
|
|
26933
27246
|
const usedBf = /* @__PURE__ */ new Set();
|
|
26934
27247
|
const usedCp = /* @__PURE__ */ new Set();
|
|
@@ -26941,17 +27254,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
|
|
|
26941
27254
|
const addr = findChildByLocalName(tc2, "cellAddr");
|
|
26942
27255
|
const span = findChildByLocalName(tc2, "cellSpan");
|
|
26943
27256
|
const csz = findChildByLocalName(tc2, "cellSz");
|
|
26944
|
-
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
26945
|
-
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess',
|
|
27257
|
+
const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _452 => _452.getAttribute, 'call', _453 => _453("rowAddr")])), () => ( 0));
|
|
27258
|
+
const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _454 => _454.getAttribute, 'call', _455 => _455("colAddr")])), () => ( 0));
|
|
26946
27259
|
if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
|
|
26947
27260
|
if (row === 0) row0Texts.set(col, directCellText(tc2));
|
|
26948
|
-
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
26949
|
-
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess',
|
|
27261
|
+
const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _456 => _456.getAttribute, 'call', _457 => _457("colSpan")])), () => ( 1));
|
|
27262
|
+
const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _458 => _458.getAttribute, 'call', _459 => _459("rowSpan")])), () => ( 1));
|
|
26950
27263
|
const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
|
|
26951
27264
|
const cpId = firstRunCharPr(tc2);
|
|
26952
27265
|
const cell2 = { row, col, rowSpan, colSpan };
|
|
26953
|
-
const w = _optionalChain([csz, 'optionalAccess',
|
|
26954
|
-
const hh = _optionalChain([csz, 'optionalAccess',
|
|
27266
|
+
const w = _optionalChain([csz, 'optionalAccess', _460 => _460.getAttribute, 'call', _461 => _461("width")]);
|
|
27267
|
+
const hh = _optionalChain([csz, 'optionalAccess', _462 => _462.getAttribute, 'call', _463 => _463("height")]);
|
|
26955
27268
|
if (w) cell2.width_hwpunit = w;
|
|
26956
27269
|
if (hh) cell2.height_hwpunit = hh;
|
|
26957
27270
|
if (bfId) {
|
|
@@ -27039,16 +27352,16 @@ function pick(map, keys) {
|
|
|
27039
27352
|
return out;
|
|
27040
27353
|
}
|
|
27041
27354
|
async function hwpxToProfile(input) {
|
|
27042
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
27355
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
27043
27356
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
27044
27357
|
const parser = createXmlParser();
|
|
27045
|
-
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access',
|
|
27358
|
+
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _464 => _464.file, 'call', _465 => _465(/[Hh]eader\.xml$/), 'optionalAccess', _466 => _466[0]])));
|
|
27046
27359
|
let headerXml = "<root/>";
|
|
27047
27360
|
if (headerFile) headerXml = await headerFile.async("text");
|
|
27048
27361
|
const headerDoc = parser.parseFromString(headerXml, "text/xml");
|
|
27049
27362
|
const borderFills = parseBorderFills(headerDoc);
|
|
27050
27363
|
const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
|
|
27051
|
-
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access',
|
|
27364
|
+
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _467 => _467.name, 'access', _468 => _468.match, 'call', _469 => _469(/(\d+)\.xml$/), 'optionalAccess', _470 => _470[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _471 => _471.name, 'access', _472 => _472.match, 'call', _473 => _473(/(\d+)\.xml$/), 'optionalAccess', _474 => _474[1]]), () => ( null))), () => ( 0))));
|
|
27052
27365
|
const tables = [];
|
|
27053
27366
|
let tableIndex = 0;
|
|
27054
27367
|
for (const f of sectionFiles) {
|
|
@@ -27362,7 +27675,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
|
|
|
27362
27675
|
var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
|
|
27363
27676
|
function patchTableRows(input) {
|
|
27364
27677
|
const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
|
|
27365
|
-
const xml = _optionalChain([ctx, 'access',
|
|
27678
|
+
const xml = _optionalChain([ctx, 'access', _475 => _475.scans, 'access', _476 => _476[scanTable.sectionIndex], 'optionalAccess', _477 => _477.xml]);
|
|
27366
27679
|
if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
|
|
27367
27680
|
const numRows = table2.rows;
|
|
27368
27681
|
if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
|
|
@@ -27529,7 +27842,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
|
|
|
27529
27842
|
const rr = scanTable.rowRanges[template];
|
|
27530
27843
|
const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
|
|
27531
27844
|
const scan = scanSectionXml(wrapped, 0);
|
|
27532
|
-
const row = _optionalChain([scan, 'access',
|
|
27845
|
+
const row = _optionalChain([scan, 'access', _478 => _478.tables, 'access', _479 => _479[0], 'optionalAccess', _480 => _480.rows, 'access', _481 => _481[0]]);
|
|
27533
27846
|
if (!row || row.length !== cells.length) return null;
|
|
27534
27847
|
const splices = allLinesegRemovalSplices(wrapped);
|
|
27535
27848
|
for (let i = 0; i < cells.length; i++) {
|
|
@@ -27572,7 +27885,7 @@ function rowHeightOf(fragment) {
|
|
|
27572
27885
|
}
|
|
27573
27886
|
function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
|
|
27574
27887
|
const from = scanTable.start + tblOpenLen;
|
|
27575
|
-
const to = _nullishCoalesce(_optionalChain([scanTable, 'access',
|
|
27888
|
+
const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _482 => _482.rowRanges, 'access', _483 => _483[0], 'optionalAccess', _484 => _484.start]), () => ( from));
|
|
27576
27889
|
const slice = xml.slice(from, to);
|
|
27577
27890
|
const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
|
|
27578
27891
|
if (!szM || szM.index === void 0) return null;
|
|
@@ -27761,9 +28074,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
|
|
|
27761
28074
|
});
|
|
27762
28075
|
}
|
|
27763
28076
|
function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
|
|
27764
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28077
|
+
const irCell = _optionalChain([table2, 'access', _485 => _485.cells, 'access', _486 => _486[oc.gridR], 'optionalAccess', _487 => _487[oc.gridC]]);
|
|
27765
28078
|
const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
|
|
27766
|
-
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess',
|
|
28079
|
+
const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _488 => _488.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
|
|
27767
28080
|
if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
|
|
27768
28081
|
return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
|
|
27769
28082
|
}
|
|
@@ -27831,7 +28144,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27831
28144
|
};
|
|
27832
28145
|
const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
|
|
27833
28146
|
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)");
|
|
27834
|
-
const irCell = _optionalChain([table2, 'access',
|
|
28147
|
+
const irCell = _optionalChain([table2, 'access', _489 => _489.cells, 'access', _490 => _490[gridR], 'optionalAccess', _491 => _491[gridC]]);
|
|
27835
28148
|
const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
|
|
27836
28149
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
27837
28150
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -27855,7 +28168,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27855
28168
|
const target = cell2.paragraphs[0];
|
|
27856
28169
|
if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
|
|
27857
28170
|
const value = newLines.join(" ");
|
|
27858
|
-
const xml = _optionalChain([ctx, 'access',
|
|
28171
|
+
const xml = _optionalChain([ctx, 'access', _492 => _492.scans, 'access', _493 => _493[target.sectionIndex], 'optionalAccess', _494 => _494.xml]);
|
|
27859
28172
|
const rawT = xml ? paraTText(target, xml) : null;
|
|
27860
28173
|
let sp;
|
|
27861
28174
|
if (xml && rawT === null) {
|
|
@@ -27889,7 +28202,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
|
|
|
27889
28202
|
}
|
|
27890
28203
|
for (let i = 0; i < nonEmpty.length; i++) {
|
|
27891
28204
|
if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
|
|
27892
|
-
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access',
|
|
28205
|
+
const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _495 => _495.scans, 'access', _496 => _496[nonEmpty[i].sectionIndex], 'optionalAccess', _497 => _497.xml]));
|
|
27893
28206
|
if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
27894
28207
|
splices.push(...sp);
|
|
27895
28208
|
sectionIndex = nonEmpty[i].sectionIndex;
|
|
@@ -27970,7 +28283,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
27970
28283
|
const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
27971
28284
|
if (paths.length > 0) return paths;
|
|
27972
28285
|
}
|
|
27973
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
28286
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
27974
28287
|
}
|
|
27975
28288
|
function sectionPathsFromManifest(xml) {
|
|
27976
28289
|
const attr = (tag, name) => {
|
|
@@ -27980,7 +28293,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27980
28293
|
const idToHref = /* @__PURE__ */ new Map();
|
|
27981
28294
|
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
27982
28295
|
const id = attr(m[1], "id");
|
|
27983
|
-
const href =
|
|
28296
|
+
const href = _chunkE6DONLTMcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
|
|
27984
28297
|
if (id && href) idToHref.set(id, href);
|
|
27985
28298
|
}
|
|
27986
28299
|
const ordered = [];
|
|
@@ -27989,7 +28302,7 @@ function sectionPathsFromManifest(xml) {
|
|
|
27989
28302
|
if (href) ordered.push(href);
|
|
27990
28303
|
}
|
|
27991
28304
|
if (ordered.length > 0) return ordered;
|
|
27992
|
-
return Array.from(idToHref.values()).sort(
|
|
28305
|
+
return Array.from(idToHref.values()).sort(_chunkE6DONLTMcjs.compareSectionPaths);
|
|
27993
28306
|
}
|
|
27994
28307
|
|
|
27995
28308
|
// src/roundtrip/patcher.ts
|
|
@@ -28081,7 +28394,7 @@ async function patchHwpx(original, editedMarkdown, options) {
|
|
|
28081
28394
|
}
|
|
28082
28395
|
}
|
|
28083
28396
|
let verification;
|
|
28084
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
28397
|
+
if (_optionalChain([options, 'optionalAccess', _498 => _498.verify]) !== false) {
|
|
28085
28398
|
try {
|
|
28086
28399
|
const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
|
|
28087
28400
|
verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
|
|
@@ -28099,17 +28412,17 @@ function buildOrigUnits(blocks) {
|
|
|
28099
28412
|
let chunk;
|
|
28100
28413
|
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
|
|
28101
28414
|
const next = blocks[i + 1];
|
|
28102
|
-
if (_optionalChain([next, 'optionalAccess',
|
|
28103
|
-
chunk =
|
|
28415
|
+
if (_optionalChain([next, 'optionalAccess', _499 => _499.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
28416
|
+
chunk = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
28104
28417
|
} else {
|
|
28105
|
-
chunk =
|
|
28418
|
+
chunk = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, [block]);
|
|
28106
28419
|
}
|
|
28107
28420
|
if (chunk) {
|
|
28108
28421
|
const subUnits = splitMarkdownUnits(chunk);
|
|
28109
28422
|
const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
|
|
28110
28423
|
for (let s = 0; s < subUnits.length; s++) {
|
|
28111
28424
|
const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
|
|
28112
|
-
if (block.type === "table" && _optionalChain([block, 'access',
|
|
28425
|
+
if (block.type === "table" && _optionalChain([block, 'access', _500 => _500.table, 'optionalAccess', _501 => _501.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
|
|
28113
28426
|
u.role = "caption";
|
|
28114
28427
|
}
|
|
28115
28428
|
units.push(u);
|
|
@@ -28220,7 +28533,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28220
28533
|
const ti = ctx.tableInsert;
|
|
28221
28534
|
if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
|
|
28222
28535
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28223
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28536
|
+
if (!_optionalChain([mapping, 'optionalAccess', _502 => _502.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");
|
|
28224
28537
|
const para2 = mapping.para;
|
|
28225
28538
|
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");
|
|
28226
28539
|
const scan = ctx.scans[para2.sectionIndex];
|
|
@@ -28248,7 +28561,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
|
|
|
28248
28561
|
}
|
|
28249
28562
|
function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
28250
28563
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
28251
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
28564
|
+
if (!_optionalChain([mapping, 'optionalAccess', _503 => _503.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)");
|
|
28252
28565
|
if (block.text && block.text.includes("\n")) {
|
|
28253
28566
|
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)");
|
|
28254
28567
|
}
|
|
@@ -28279,7 +28592,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
28279
28592
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
28280
28593
|
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");
|
|
28281
28594
|
}
|
|
28282
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access',
|
|
28595
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _504 => _504.scans, 'access', _505 => _505[mapping.para.sectionIndex], 'optionalAccess', _506 => _506.xml]));
|
|
28283
28596
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
28284
28597
|
ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
28285
28598
|
return 1;
|
|
@@ -28471,7 +28784,7 @@ var Surgeon = (_class7 = class {
|
|
|
28471
28784
|
/** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
|
|
28472
28785
|
findEntry(path) {
|
|
28473
28786
|
const parts = path.replace(/^\//, "").split("/");
|
|
28474
|
-
let scope = _nullishCoalesce(_optionalChain([this, 'access',
|
|
28787
|
+
let scope = _nullishCoalesce(_optionalChain([this, 'access', _507 => _507.entries, 'access', _508 => _508[0], 'optionalAccess', _509 => _509.child]), () => ( -1));
|
|
28475
28788
|
let current;
|
|
28476
28789
|
for (const part of parts) {
|
|
28477
28790
|
const search = (idx) => {
|
|
@@ -28679,7 +28992,7 @@ var Surgeon = (_class7 = class {
|
|
|
28679
28992
|
// src/roundtrip/hwp5-patch.ts
|
|
28680
28993
|
var require3 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
|
|
28681
28994
|
var CFB2 = require3("cfb");
|
|
28682
|
-
var
|
|
28995
|
+
var TAG_PARA_LINE_SEG2 = 69;
|
|
28683
28996
|
function cid2(s) {
|
|
28684
28997
|
return (s.charCodeAt(0) << 24 | s.charCodeAt(1) << 16 | s.charCodeAt(2) << 8 | s.charCodeAt(3)) >>> 0;
|
|
28685
28998
|
}
|
|
@@ -28724,8 +29037,8 @@ function serializeRecords(recs, repl, inserts) {
|
|
|
28724
29037
|
parts.push(header, data);
|
|
28725
29038
|
};
|
|
28726
29039
|
for (let i = 0; i < recs.length; i++) {
|
|
28727
|
-
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess',
|
|
28728
|
-
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess',
|
|
29040
|
+
for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _510 => _510.get, 'call', _511 => _511(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
|
|
29041
|
+
push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _512 => _512.get, 'call', _513 => _513(i)]), () => ( recs[i].data)));
|
|
28729
29042
|
}
|
|
28730
29043
|
return Buffer.concat(parts);
|
|
28731
29044
|
}
|
|
@@ -28760,7 +29073,7 @@ function scanSection(stream, sectionIndex, compressed) {
|
|
|
28760
29073
|
textIdx = textIdx === -1 ? j : -2;
|
|
28761
29074
|
appendParaText(state, records[j].data);
|
|
28762
29075
|
} else if (t === TAG_CHAR_SHAPE && charShapeIdx === -1) charShapeIdx = j;
|
|
28763
|
-
else if (t ===
|
|
29076
|
+
else if (t === TAG_PARA_LINE_SEG2 && lineSegIdx === -1) lineSegIdx = j;
|
|
28764
29077
|
}
|
|
28765
29078
|
let ctrlSeen = false, nonGso = false;
|
|
28766
29079
|
for (let a = parent[i]; a >= 0; a = parent[a]) {
|
|
@@ -28843,7 +29156,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28843
29156
|
return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
|
|
28844
29157
|
}
|
|
28845
29158
|
const fhEntry = CFB2.find(cfb, "/FileHeader");
|
|
28846
|
-
if (!_optionalChain([fhEntry, 'optionalAccess',
|
|
29159
|
+
if (!_optionalChain([fhEntry, 'optionalAccess', _514 => _514.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
|
|
28847
29160
|
let flags;
|
|
28848
29161
|
try {
|
|
28849
29162
|
flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
|
|
@@ -28865,7 +29178,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28865
29178
|
const scans = [];
|
|
28866
29179
|
for (let i = 0; i < sectionPaths.length; i++) {
|
|
28867
29180
|
const entry = CFB2.find(cfb, sectionPaths[i]);
|
|
28868
|
-
if (!_optionalChain([entry, 'optionalAccess',
|
|
29181
|
+
if (!_optionalChain([entry, 'optionalAccess', _515 => _515.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
|
|
28869
29182
|
let stream;
|
|
28870
29183
|
try {
|
|
28871
29184
|
stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
|
|
@@ -28916,7 +29229,7 @@ async function patchHwp(original, editedMarkdown, options) {
|
|
|
28916
29229
|
}
|
|
28917
29230
|
}
|
|
28918
29231
|
let verification;
|
|
28919
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
29232
|
+
if (_optionalChain([options, 'optionalAccess', _516 => _516.verify]) !== false) {
|
|
28920
29233
|
try {
|
|
28921
29234
|
const reparsed = parseHwp5Document(Buffer.from(data));
|
|
28922
29235
|
const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
|
|
@@ -29006,7 +29319,7 @@ function tableContentScore(irTable, scanTable) {
|
|
|
29006
29319
|
for (const [key, scanCell] of scanTable.cells) {
|
|
29007
29320
|
const comma = key.indexOf(",");
|
|
29008
29321
|
const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
|
|
29009
|
-
const irCell = _optionalChain([irTable, 'access',
|
|
29322
|
+
const irCell = _optionalChain([irTable, 'access', _517 => _517.cells, 'access', _518 => _518[r], 'optionalAccess', _519 => _519[c]]);
|
|
29010
29323
|
if (!irCell) continue;
|
|
29011
29324
|
const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
|
|
29012
29325
|
const b = normForMatch(stripCellTokens(irCell.text));
|
|
@@ -29042,7 +29355,7 @@ function handleModified(orig, edited, ctx) {
|
|
|
29042
29355
|
}
|
|
29043
29356
|
function patchParagraph(block, orig, edited, ctx, skip) {
|
|
29044
29357
|
const mapping = ctx.paraMap.get(orig.blockIdx);
|
|
29045
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
29358
|
+
if (!_optionalChain([mapping, 'optionalAccess', _520 => _520.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)");
|
|
29046
29359
|
const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
|
|
29047
29360
|
let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
|
|
29048
29361
|
if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
|
|
@@ -29241,7 +29554,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
|
|
|
29241
29554
|
};
|
|
29242
29555
|
const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
|
|
29243
29556
|
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)");
|
|
29244
|
-
const irCell = _optionalChain([table2, 'access',
|
|
29557
|
+
const irCell = _optionalChain([table2, 'access', _521 => _521.cells, 'access', _522 => _522[gridR], 'optionalAccess', _523 => _523[gridC]]);
|
|
29245
29558
|
const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
|
|
29246
29559
|
if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
|
|
29247
29560
|
if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
|
|
@@ -29648,11 +29961,11 @@ var RULES2 = {
|
|
|
29648
29961
|
}
|
|
29649
29962
|
};
|
|
29650
29963
|
function redactText(text, options) {
|
|
29651
|
-
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29964
|
+
const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _524 => _524.maskChar]), () => ( "\u25CF"));
|
|
29652
29965
|
if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
|
|
29653
29966
|
throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
|
|
29654
29967
|
}
|
|
29655
|
-
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29968
|
+
const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _525 => _525.rules]), () => ( DEFAULT_REDACT_RULES));
|
|
29656
29969
|
const hits = [];
|
|
29657
29970
|
if (text === "" || enabled.length === 0) return { text, hits };
|
|
29658
29971
|
const occupied = [];
|
|
@@ -29707,8 +30020,8 @@ function sameBreadcrumb(a, b) {
|
|
|
29707
30020
|
return a.length === b.length && a.every((v, i) => v === b[i]);
|
|
29708
30021
|
}
|
|
29709
30022
|
function blocksToChunks(blocks, options) {
|
|
29710
|
-
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
29711
|
-
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30023
|
+
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _526 => _526.granularity]), () => ( "section"));
|
|
30024
|
+
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _527 => _527.includeTableCells]), () => ( false));
|
|
29712
30025
|
const chunks = [];
|
|
29713
30026
|
const headingStack = [];
|
|
29714
30027
|
const listStack = [];
|
|
@@ -29722,12 +30035,12 @@ function blocksToChunks(blocks, options) {
|
|
|
29722
30035
|
let run = null;
|
|
29723
30036
|
const flushRun = () => {
|
|
29724
30037
|
if (!run) return;
|
|
29725
|
-
push("text", run.breadcrumb,
|
|
30038
|
+
push("text", run.breadcrumb, _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
|
|
29726
30039
|
run = null;
|
|
29727
30040
|
};
|
|
29728
30041
|
for (let i = 0; i < blocks.length; i++) {
|
|
29729
30042
|
const block = blocks[i];
|
|
29730
|
-
const md2 =
|
|
30043
|
+
const md2 = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, [block]);
|
|
29731
30044
|
if (!md2) continue;
|
|
29732
30045
|
if (block.type === "heading") {
|
|
29733
30046
|
flushRun();
|
|
@@ -29843,7 +30156,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29843
30156
|
const block = st.blocks[blockIndex];
|
|
29844
30157
|
if (!block) return void 0;
|
|
29845
30158
|
if (block.type === "paragraph" || block.type === "heading") {
|
|
29846
|
-
const para2 = _optionalChain([st, 'access',
|
|
30159
|
+
const para2 = _optionalChain([st, 'access', _528 => _528.paraMap, 'access', _529 => _529.get, 'call', _530 => _530(blockIndex), 'optionalAccess', _531 => _531.para]);
|
|
29847
30160
|
if (!para2) return void 0;
|
|
29848
30161
|
return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
|
|
29849
30162
|
}
|
|
@@ -29868,7 +30181,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29868
30181
|
if (block.text && block.text.includes("\n")) {
|
|
29869
30182
|
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)" };
|
|
29870
30183
|
}
|
|
29871
|
-
if (!_optionalChain([st, 'access',
|
|
30184
|
+
if (!_optionalChain([st, 'access', _532 => _532.paraMap, 'access', _533 => _533.get, 'call', _534 => _534(blockIndex), 'optionalAccess', _535 => _535.para])) {
|
|
29872
30185
|
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)" };
|
|
29873
30186
|
}
|
|
29874
30187
|
return { capability: "text" };
|
|
@@ -29934,7 +30247,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29934
30247
|
continue;
|
|
29935
30248
|
}
|
|
29936
30249
|
if (block.type === "table" && block.table) {
|
|
29937
|
-
if (!_optionalChain([edit, 'access',
|
|
30250
|
+
if (!_optionalChain([edit, 'access', _536 => _536.cells, 'optionalAccess', _537 => _537.length])) {
|
|
29938
30251
|
skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
|
|
29939
30252
|
continue;
|
|
29940
30253
|
}
|
|
@@ -29954,7 +30267,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
29954
30267
|
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) });
|
|
29955
30268
|
continue;
|
|
29956
30269
|
}
|
|
29957
|
-
const irCell = _optionalChain([block, 'access',
|
|
30270
|
+
const irCell = _optionalChain([block, 'access', _538 => _538.table, 'access', _539 => _539.cells, 'access', _540 => _540[cellEdit.row], 'optionalAccess', _541 => _541[cellEdit.col]]);
|
|
29958
30271
|
if (!irCell) {
|
|
29959
30272
|
skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
|
|
29960
30273
|
continue;
|
|
@@ -30010,7 +30323,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30010
30323
|
}
|
|
30011
30324
|
if (replacements.size === 0) {
|
|
30012
30325
|
let changes2;
|
|
30013
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30326
|
+
if (_optionalChain([options, 'optionalAccess', _542 => _542.verify]) !== false) {
|
|
30014
30327
|
const units = splitMarkdownUnits(st.markdown);
|
|
30015
30328
|
changes2 = diffUnitLists(units, units);
|
|
30016
30329
|
}
|
|
@@ -30031,7 +30344,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30031
30344
|
}
|
|
30032
30345
|
this.state = newState;
|
|
30033
30346
|
let changes;
|
|
30034
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
30347
|
+
if (_optionalChain([options, 'optionalAccess', _543 => _543.verify]) !== false) {
|
|
30035
30348
|
changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
|
|
30036
30349
|
}
|
|
30037
30350
|
return { success: true, data: new Uint8Array(data), applied, skipped, changes };
|
|
@@ -30051,7 +30364,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30051
30364
|
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)");
|
|
30052
30365
|
}
|
|
30053
30366
|
const mapping = st.paraMap.get(blockIndex);
|
|
30054
|
-
if (!_optionalChain([mapping, 'optionalAccess',
|
|
30367
|
+
if (!_optionalChain([mapping, 'optionalAccess', _544 => _544.para])) {
|
|
30055
30368
|
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)");
|
|
30056
30369
|
}
|
|
30057
30370
|
let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
@@ -30071,14 +30384,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
|
|
|
30071
30384
|
if (sanitizeText(newPlain) !== newPlain) {
|
|
30072
30385
|
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");
|
|
30073
30386
|
}
|
|
30074
|
-
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access',
|
|
30387
|
+
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _545 => _545.scans, 'access', _546 => _546[mapping.para.sectionIndex], 'optionalAccess', _547 => _547.xml]));
|
|
30075
30388
|
if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
|
|
30076
30389
|
sectionSplices[mapping.para.sectionIndex].push(...splices);
|
|
30077
30390
|
return 1;
|
|
30078
30391
|
}
|
|
30079
30392
|
}, _class8);
|
|
30080
30393
|
function cellStaticCheck(table2, scanTable, r, c) {
|
|
30081
|
-
const irCell = _optionalChain([table2, 'access',
|
|
30394
|
+
const irCell = _optionalChain([table2, 'access', _548 => _548.cells, 'access', _549 => _549[r], 'optionalAccess', _550 => _550[c]]);
|
|
30082
30395
|
if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
|
|
30083
30396
|
const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
|
|
30084
30397
|
if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
|
|
@@ -30162,11 +30475,11 @@ var md = new (0, _markdownit2.default)({
|
|
|
30162
30475
|
breaks: false
|
|
30163
30476
|
});
|
|
30164
30477
|
function renderHtml(markdown, options) {
|
|
30165
|
-
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30166
|
-
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30478
|
+
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _551 => _551.preset]), () => ( "default"));
|
|
30479
|
+
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _552 => _552.extraCss]), () => ( "")));
|
|
30167
30480
|
const body = md.render(markdown);
|
|
30168
|
-
const watermark = _optionalChain([options, 'optionalAccess',
|
|
30169
|
-
const watermarkCss = _optionalChain([options, 'optionalAccess',
|
|
30481
|
+
const watermark = _optionalChain([options, 'optionalAccess', _553 => _553.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
|
|
30482
|
+
const watermarkCss = _optionalChain([options, 'optionalAccess', _554 => _554.watermark]) ? `
|
|
30170
30483
|
.watermark {
|
|
30171
30484
|
position: fixed;
|
|
30172
30485
|
top: 50%; left: 50%;
|
|
@@ -30197,13 +30510,13 @@ async function htmlToPdf(html, options) {
|
|
|
30197
30510
|
try {
|
|
30198
30511
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
30199
30512
|
} catch (e37) {
|
|
30200
|
-
throw new (0,
|
|
30513
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
30201
30514
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
30202
30515
|
);
|
|
30203
30516
|
}
|
|
30204
30517
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
30205
30518
|
if (!executablePath) {
|
|
30206
|
-
throw new (0,
|
|
30519
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)(
|
|
30207
30520
|
"Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
|
|
30208
30521
|
);
|
|
30209
30522
|
}
|
|
@@ -30215,10 +30528,10 @@ async function htmlToPdf(html, options) {
|
|
|
30215
30528
|
try {
|
|
30216
30529
|
const page = await browser.newPage();
|
|
30217
30530
|
await page.setContent(html, { waitUntil: "networkidle0" });
|
|
30218
|
-
const margin = _optionalChain([options, 'optionalAccess',
|
|
30531
|
+
const margin = _optionalChain([options, 'optionalAccess', _555 => _555.margin]);
|
|
30219
30532
|
const pdf = await page.pdf({
|
|
30220
|
-
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30221
|
-
landscape: _optionalChain([options, 'optionalAccess',
|
|
30533
|
+
format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _556 => _556.pageSize]), () => ( "A4")),
|
|
30534
|
+
landscape: _optionalChain([options, 'optionalAccess', _557 => _557.orientation]) === "landscape",
|
|
30222
30535
|
printBackground: true,
|
|
30223
30536
|
margin: margin ? {
|
|
30224
30537
|
top: toCss(margin.top),
|
|
@@ -30226,9 +30539,9 @@ async function htmlToPdf(html, options) {
|
|
|
30226
30539
|
bottom: toCss(margin.bottom),
|
|
30227
30540
|
left: toCss(margin.left)
|
|
30228
30541
|
} : void 0,
|
|
30229
|
-
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess',
|
|
30230
|
-
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30231
|
-
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
30542
|
+
displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _558 => _558.header]) || _optionalChain([options, 'optionalAccess', _559 => _559.footer])),
|
|
30543
|
+
headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _560 => _560.header]), () => ( "<div></div>")),
|
|
30544
|
+
footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _561 => _561.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
|
|
30232
30545
|
});
|
|
30233
30546
|
return Buffer.from(pdf);
|
|
30234
30547
|
} finally {
|
|
@@ -30262,7 +30575,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
30262
30575
|
return htmlToPdf(html, options);
|
|
30263
30576
|
}
|
|
30264
30577
|
async function blocksToPdf(blocks, options) {
|
|
30265
|
-
const markdown =
|
|
30578
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks);
|
|
30266
30579
|
return markdownToPdf(markdown, options);
|
|
30267
30580
|
}
|
|
30268
30581
|
|
|
@@ -30441,7 +30754,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
|
|
|
30441
30754
|
}
|
|
30442
30755
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
30443
30756
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
30444
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
30757
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _562 => _562.getAttribute, 'call', _563 => _563("vertRelTo")]), () => ( "PARA"));
|
|
30445
30758
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
30446
30759
|
const vo = Math.max(0, num2(pos, "vertOffset"));
|
|
30447
30760
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
@@ -30502,7 +30815,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30502
30815
|
if (ln(p) !== "p") continue;
|
|
30503
30816
|
reflowTablesIn(p, doc, styles, mode, counter);
|
|
30504
30817
|
const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
30505
|
-
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30818
|
+
const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _564 => _564.spaceBefore]), () => ( 0)));
|
|
30506
30819
|
const res = reflowPara(p, doc, styles, areaW, startV, mode);
|
|
30507
30820
|
if (!res) {
|
|
30508
30821
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
@@ -30515,7 +30828,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
30515
30828
|
}
|
|
30516
30829
|
if (Number.isFinite(bottom)) {
|
|
30517
30830
|
cursorV = bottom;
|
|
30518
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess',
|
|
30831
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _565 => _565.spaceAfter]), () => ( 0));
|
|
30519
30832
|
}
|
|
30520
30833
|
}
|
|
30521
30834
|
continue;
|
|
@@ -30621,7 +30934,7 @@ function buildPara(p) {
|
|
|
30621
30934
|
const pos = findChildByLocalName(ch, "pos");
|
|
30622
30935
|
const w = num3(sz, "width") || num3(findChildByLocalName(ch, "curSz"), "width") || num3(findChildByLocalName(ch, "orgSz"), "width");
|
|
30623
30936
|
const h = num3(sz, "height") || num3(findChildByLocalName(ch, "curSz"), "height") || num3(findChildByLocalName(ch, "orgSz"), "height");
|
|
30624
|
-
const inline = _optionalChain([pos, 'optionalAccess',
|
|
30937
|
+
const inline = _optionalChain([pos, 'optionalAccess', _566 => _566.getAttribute, 'call', _567 => _567("treatAsChar")]) === "1";
|
|
30625
30938
|
const om = inline && cn === "tbl" ? findChildByLocalName(ch, "outMargin") : null;
|
|
30626
30939
|
objs.push({
|
|
30627
30940
|
el: ch,
|
|
@@ -30881,15 +31194,15 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30881
31194
|
const sx = ow > 0 ? w / ow : 1;
|
|
30882
31195
|
const sy = oh > 0 ? h / oh : 1;
|
|
30883
31196
|
const lineShape = findChildByLocalName(el, "lineShape");
|
|
30884
|
-
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess',
|
|
30885
|
-
const strokeCol = _optionalChain([lineShape, 'optionalAccess',
|
|
31197
|
+
const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _568 => _568.getAttribute, 'call', _569 => _569("style")]), () => ( "SOLID"));
|
|
31198
|
+
const strokeCol = _optionalChain([lineShape, 'optionalAccess', _570 => _570.getAttribute, 'call', _571 => _571("color")]) || "#000000";
|
|
30886
31199
|
const hasStroke = lstyle !== "NONE";
|
|
30887
31200
|
const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
|
|
30888
31201
|
const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
30889
31202
|
const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
|
|
30890
31203
|
const fillBrush = findChildByLocalName(el, "fillBrush");
|
|
30891
31204
|
const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
|
|
30892
|
-
const face = _optionalChain([winBrush, 'optionalAccess',
|
|
31205
|
+
const face = _optionalChain([winBrush, 'optionalAccess', _572 => _572.getAttribute, 'call', _573 => _573("faceColor")]);
|
|
30893
31206
|
const fill = face && face.toLowerCase() !== "none" ? face : "none";
|
|
30894
31207
|
const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
|
|
30895
31208
|
if (o.tag === "rect") {
|
|
@@ -30916,14 +31229,14 @@ function drawShape(o, x, y, ctx, depth) {
|
|
|
30916
31229
|
}
|
|
30917
31230
|
function cellContentExtent(cell2, memo) {
|
|
30918
31231
|
if (!cell2.sub) return 0;
|
|
30919
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31232
|
+
const hit = _optionalChain([memo, 'optionalAccess', _574 => _574.cell, 'access', _575 => _575.get, 'call', _576 => _576(cell2.el)]);
|
|
30920
31233
|
if (hit !== void 0) return hit;
|
|
30921
31234
|
let ext = 0;
|
|
30922
31235
|
for (const p of elements2(cell2.sub)) {
|
|
30923
31236
|
if (ln2(p) !== "p") continue;
|
|
30924
31237
|
const m = buildPara(p);
|
|
30925
31238
|
for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
|
|
30926
|
-
const baseV = _nullishCoalesce(_optionalChain([m, 'access',
|
|
31239
|
+
const baseV = _nullishCoalesce(_optionalChain([m, 'access', _577 => _577.segs, 'access', _578 => _578[0], 'optionalAccess', _579 => _579.vertpos]), () => ( 0));
|
|
30927
31240
|
for (const o of m.objs) {
|
|
30928
31241
|
if (o.inline) {
|
|
30929
31242
|
const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
@@ -30931,14 +31244,14 @@ function cellContentExtent(cell2, memo) {
|
|
|
30931
31244
|
continue;
|
|
30932
31245
|
}
|
|
30933
31246
|
const pos = findChildByLocalName(o.el, "pos");
|
|
30934
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
31247
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _580 => _580.getAttribute, 'call', _581 => _581("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
30935
31248
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
30936
31249
|
const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
|
|
30937
31250
|
const anchor = pushed >= -100 ? pushed : baseV;
|
|
30938
31251
|
ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
|
|
30939
31252
|
}
|
|
30940
31253
|
}
|
|
30941
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31254
|
+
_optionalChain([memo, 'optionalAccess', _582 => _582.cell, 'access', _583 => _583.set, 'call', _584 => _584(cell2.el, ext)]);
|
|
30942
31255
|
return ext;
|
|
30943
31256
|
}
|
|
30944
31257
|
function edgeLine(x1, y1, x2, y2, e) {
|
|
@@ -30980,7 +31293,7 @@ function collectCells(tbl2) {
|
|
|
30980
31293
|
return cells;
|
|
30981
31294
|
}
|
|
30982
31295
|
function measureTableHeight(tbl2, memo) {
|
|
30983
|
-
const hit = _optionalChain([memo, 'optionalAccess',
|
|
31296
|
+
const hit = _optionalChain([memo, 'optionalAccess', _585 => _585.table, 'access', _586 => _586.get, 'call', _587 => _587(tbl2)]);
|
|
30984
31297
|
if (hit !== void 0) return hit;
|
|
30985
31298
|
const cells = collectCells(tbl2);
|
|
30986
31299
|
if (cells.length === 0 || cells.length > 4096) return 0;
|
|
@@ -30991,7 +31304,7 @@ function measureTableHeight(tbl2, memo) {
|
|
|
30991
31304
|
);
|
|
30992
31305
|
let sum = 0;
|
|
30993
31306
|
for (const h of rowH) sum += h;
|
|
30994
|
-
_optionalChain([memo, 'optionalAccess',
|
|
31307
|
+
_optionalChain([memo, 'optionalAccess', _588 => _588.table, 'access', _589 => _589.set, 'call', _590 => _590(tbl2, sum)]);
|
|
30995
31308
|
return sum;
|
|
30996
31309
|
}
|
|
30997
31310
|
function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
@@ -31022,7 +31335,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
31022
31335
|
}));
|
|
31023
31336
|
for (const g of geom) {
|
|
31024
31337
|
const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
|
|
31025
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
31338
|
+
if (_optionalChain([bf, 'optionalAccess', _591 => _591.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
|
|
31026
31339
|
}
|
|
31027
31340
|
for (const g of geom) {
|
|
31028
31341
|
const { c } = g;
|
|
@@ -31060,7 +31373,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
31060
31373
|
const sz = findChildByLocalName(pic, "sz");
|
|
31061
31374
|
const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
|
|
31062
31375
|
const img = findFirst(pic, "img");
|
|
31063
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
31376
|
+
const ref = _optionalChain([img, 'optionalAccess', _592 => _592.getAttribute, 'call', _593 => _593("binaryItemIDRef")]);
|
|
31064
31377
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
31065
31378
|
if (!loaded) {
|
|
31066
31379
|
emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
|
|
@@ -31100,7 +31413,7 @@ function readSectionGeom(root) {
|
|
|
31100
31413
|
const pagePr = findFirst(root, "pagePr");
|
|
31101
31414
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
31102
31415
|
let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
|
|
31103
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
31416
|
+
if (_optionalChain([pagePr, 'optionalAccess', _594 => _594.getAttribute, 'call', _595 => _595("landscape")]) === "NARROWLY" && PW < PH) {
|
|
31104
31417
|
const t = PW;
|
|
31105
31418
|
PW = PH;
|
|
31106
31419
|
PH = t;
|
|
@@ -31158,17 +31471,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
|
|
|
31158
31471
|
return { pages: ctx.pages, pageH };
|
|
31159
31472
|
}
|
|
31160
31473
|
async function renderHwpxToSvg(input, options) {
|
|
31161
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31474
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _596 => _596.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
31162
31475
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
31163
|
-
|
|
31476
|
+
_chunkE6DONLTMcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
31164
31477
|
let zip;
|
|
31165
31478
|
try {
|
|
31166
31479
|
zip = await _jszip2.default.loadAsync(input);
|
|
31167
31480
|
} catch (e38) {
|
|
31168
|
-
throw new (0,
|
|
31481
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
31169
31482
|
}
|
|
31170
31483
|
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
|
|
31171
|
-
if (secFiles.length === 0) throw new (0,
|
|
31484
|
+
if (secFiles.length === 0) throw new (0, _chunkE6DONLTMcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
31172
31485
|
const warnings = [];
|
|
31173
31486
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
31174
31487
|
const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
|
|
@@ -31176,7 +31489,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31176
31489
|
const secXmls = [];
|
|
31177
31490
|
for (const f of secFiles) {
|
|
31178
31491
|
const xml = await f.async("string");
|
|
31179
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
31492
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
31180
31493
|
secXmls.push(xml);
|
|
31181
31494
|
}
|
|
31182
31495
|
const binmap = /* @__PURE__ */ new Map();
|
|
@@ -31200,7 +31513,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31200
31513
|
let href = binmap.get(ref);
|
|
31201
31514
|
if (!href) {
|
|
31202
31515
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
31203
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
31516
|
+
href = _optionalChain([cand, 'optionalAccess', _597 => _597.name]);
|
|
31204
31517
|
}
|
|
31205
31518
|
if (!href) continue;
|
|
31206
31519
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -31221,7 +31534,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31221
31534
|
styles,
|
|
31222
31535
|
images,
|
|
31223
31536
|
defs: [],
|
|
31224
|
-
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
31537
|
+
highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _598 => _598.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
|
|
31225
31538
|
warnings,
|
|
31226
31539
|
warned: /* @__PURE__ */ new Set(),
|
|
31227
31540
|
stats: { texts: 0, images: 0, tables: 0 },
|
|
@@ -31232,7 +31545,7 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31232
31545
|
for (let si = 0; si < secXmls.length; si++) {
|
|
31233
31546
|
const secXml = secXmls[si];
|
|
31234
31547
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
31235
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
31548
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _599 => _599.reflow])) {
|
|
31236
31549
|
noCacheSkipped = true;
|
|
31237
31550
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
31238
31551
|
continue;
|
|
@@ -31244,14 +31557,14 @@ async function renderHwpxToSvg(input, options) {
|
|
|
31244
31557
|
continue;
|
|
31245
31558
|
}
|
|
31246
31559
|
const geom = readSectionGeom(root);
|
|
31247
|
-
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess',
|
|
31560
|
+
const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _600 => _600.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _601 => _601.reflowMode]), () => ( "keep")));
|
|
31248
31561
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
|
|
31249
31562
|
}
|
|
31250
31563
|
if (rendered.length === 0) {
|
|
31251
31564
|
if (noCacheSkipped) {
|
|
31252
|
-
throw new (0,
|
|
31565
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
|
|
31253
31566
|
}
|
|
31254
|
-
throw new (0,
|
|
31567
|
+
throw new (0, _chunkE6DONLTMcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
31255
31568
|
}
|
|
31256
31569
|
const GAP = 2400;
|
|
31257
31570
|
const clipDefs = [];
|
|
@@ -31283,17 +31596,17 @@ ${groups.join("\n")}
|
|
|
31283
31596
|
// src/index.ts
|
|
31284
31597
|
async function parse(input, options) {
|
|
31285
31598
|
let buffer;
|
|
31286
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
31599
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _602 => _602.filePath]) ? { ...options, filePath: input } : options;
|
|
31287
31600
|
if (typeof input === "string") {
|
|
31288
31601
|
try {
|
|
31289
31602
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31290
|
-
buffer =
|
|
31603
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, buf);
|
|
31291
31604
|
} catch (err) {
|
|
31292
31605
|
const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
|
|
31293
31606
|
return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
|
|
31294
31607
|
}
|
|
31295
31608
|
} else if (Buffer.isBuffer(input)) {
|
|
31296
|
-
buffer =
|
|
31609
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
31297
31610
|
} else {
|
|
31298
31611
|
buffer = input;
|
|
31299
31612
|
}
|
|
@@ -31327,40 +31640,40 @@ async function parse(input, options) {
|
|
|
31327
31640
|
}
|
|
31328
31641
|
async function parseImage(buffer, options) {
|
|
31329
31642
|
try {
|
|
31330
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
31643
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-75WGMVU6.cjs")));
|
|
31331
31644
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
31332
31645
|
return {
|
|
31333
31646
|
success: true,
|
|
31334
31647
|
fileType: "image",
|
|
31335
|
-
markdown:
|
|
31648
|
+
markdown: _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, blocks),
|
|
31336
31649
|
blocks,
|
|
31337
31650
|
warnings: warnings.length ? warnings : void 0,
|
|
31338
31651
|
pageCount: 1
|
|
31339
31652
|
};
|
|
31340
31653
|
} catch (err) {
|
|
31341
|
-
return { success: false, fileType: "image", error:
|
|
31654
|
+
return { success: false, fileType: "image", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31342
31655
|
}
|
|
31343
31656
|
}
|
|
31344
31657
|
async function parseHwp3(buffer, options) {
|
|
31345
31658
|
try {
|
|
31346
31659
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
31347
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31660
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _603 => _603.pageCount]) };
|
|
31348
31661
|
} catch (err) {
|
|
31349
|
-
return { success: false, fileType: "hwp3", error:
|
|
31662
|
+
return { success: false, fileType: "hwp3", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31350
31663
|
}
|
|
31351
31664
|
}
|
|
31352
31665
|
async function parseHwpx(buffer, options) {
|
|
31353
31666
|
try {
|
|
31354
31667
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
|
|
31355
|
-
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31668
|
+
return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _604 => _604.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _605 => _605.pageCount]) };
|
|
31356
31669
|
} catch (err) {
|
|
31357
|
-
return { success: false, fileType: "hwpx", error:
|
|
31670
|
+
return { success: false, fileType: "hwpx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31358
31671
|
}
|
|
31359
31672
|
}
|
|
31360
31673
|
async function parseHwp(buffer, options) {
|
|
31361
31674
|
try {
|
|
31362
31675
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
31363
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
31676
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _606 => _606.filePath])) {
|
|
31364
31677
|
try {
|
|
31365
31678
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
31366
31679
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -31378,15 +31691,15 @@ async function parseHwp(buffer, options) {
|
|
|
31378
31691
|
} catch (e39) {
|
|
31379
31692
|
}
|
|
31380
31693
|
}
|
|
31381
|
-
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31694
|
+
return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _607 => _607.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _608 => _608.pageCount]) };
|
|
31382
31695
|
} catch (err) {
|
|
31383
|
-
return { success: false, fileType: "hwp", error:
|
|
31696
|
+
return { success: false, fileType: "hwp", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31384
31697
|
}
|
|
31385
31698
|
}
|
|
31386
31699
|
async function parsePdf(buffer, options) {
|
|
31387
31700
|
let parsePdfDocument;
|
|
31388
31701
|
try {
|
|
31389
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
31702
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-4CBOPTVY.cjs")));
|
|
31390
31703
|
parsePdfDocument = mod.parsePdfDocument;
|
|
31391
31704
|
} catch (e40) {
|
|
31392
31705
|
return {
|
|
@@ -31398,51 +31711,51 @@ async function parsePdf(buffer, options) {
|
|
|
31398
31711
|
}
|
|
31399
31712
|
try {
|
|
31400
31713
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images } = await parsePdfDocument(buffer, options);
|
|
31401
|
-
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31714
|
+
return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pageCount: _optionalChain([metadata, 'optionalAccess', _609 => _609.pageCount]) };
|
|
31402
31715
|
} catch (err) {
|
|
31403
31716
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
31404
|
-
return { success: false, fileType: "pdf", error:
|
|
31717
|
+
return { success: false, fileType: "pdf", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err), isImageBased };
|
|
31405
31718
|
}
|
|
31406
31719
|
}
|
|
31407
31720
|
async function parseXlsx(buffer, options) {
|
|
31408
31721
|
try {
|
|
31409
31722
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
31410
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31723
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _610 => _610.pageCount]) };
|
|
31411
31724
|
} catch (err) {
|
|
31412
|
-
return { success: false, fileType: "xlsx", error:
|
|
31725
|
+
return { success: false, fileType: "xlsx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31413
31726
|
}
|
|
31414
31727
|
}
|
|
31415
31728
|
async function parseXls(buffer, options) {
|
|
31416
31729
|
try {
|
|
31417
31730
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
31418
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31731
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _611 => _611.pageCount]) };
|
|
31419
31732
|
} catch (err) {
|
|
31420
|
-
return { success: false, fileType: "xls", error:
|
|
31733
|
+
return { success: false, fileType: "xls", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31421
31734
|
}
|
|
31422
31735
|
}
|
|
31423
31736
|
async function parseDocx(buffer, options) {
|
|
31424
31737
|
try {
|
|
31425
31738
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
31426
|
-
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
31739
|
+
return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _612 => _612.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _613 => _613.pageCount]) };
|
|
31427
31740
|
} catch (err) {
|
|
31428
|
-
return { success: false, fileType: "docx", error:
|
|
31741
|
+
return { success: false, fileType: "docx", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31429
31742
|
}
|
|
31430
31743
|
}
|
|
31431
31744
|
async function parseHwpml(buffer, options) {
|
|
31432
31745
|
try {
|
|
31433
31746
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
31434
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
31747
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _614 => _614.pageCount]) };
|
|
31435
31748
|
} catch (err) {
|
|
31436
|
-
return { success: false, fileType: "hwpml", error:
|
|
31749
|
+
return { success: false, fileType: "hwpml", error: _chunkE6DONLTMcjs.sanitizeError.call(void 0, err), code: _chunkE6DONLTMcjs.classifyError.call(void 0, err) };
|
|
31437
31750
|
}
|
|
31438
31751
|
}
|
|
31439
31752
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
31440
31753
|
let buffer;
|
|
31441
31754
|
if (typeof input === "string") {
|
|
31442
31755
|
const buf = await _promises.readFile.call(void 0, input);
|
|
31443
|
-
buffer =
|
|
31756
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, buf);
|
|
31444
31757
|
} else if (Buffer.isBuffer(input)) {
|
|
31445
|
-
buffer =
|
|
31758
|
+
buffer = _chunkE6DONLTMcjs.toArrayBuffer.call(void 0, input);
|
|
31446
31759
|
} else {
|
|
31447
31760
|
buffer = input;
|
|
31448
31761
|
}
|
|
@@ -31468,7 +31781,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31468
31781
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
31469
31782
|
}
|
|
31470
31783
|
const fill = fillFormFields(parsed.blocks, values);
|
|
31471
|
-
const markdown =
|
|
31784
|
+
const markdown = _chunkR4LXZRYPcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
31472
31785
|
if (outputFormat === "hwpx") {
|
|
31473
31786
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
31474
31787
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -31547,5 +31860,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
31547
31860
|
|
|
31548
31861
|
|
|
31549
31862
|
|
|
31550
|
-
exports.BUILTIN_TEMPLATES = BUILTIN_TEMPLATES; exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION =
|
|
31863
|
+
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 = _chunkE6DONLTMcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkR4LXZRYPcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractClickHereFields = extractClickHereFields; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.readBuiltinTemplate = readBuiltinTemplate; exports.readBuiltinTemplateSample = readBuiltinTemplateSample; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
|
|
31551
31864
|
//# sourceMappingURL=index.cjs.map
|