kordoc 4.22.11 → 4.22.13
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 +6 -4
- package/dist/{-HVSX4WBM.js → -WQIGIQTE.js} +11 -11
- package/dist/{chunk-ZXNKMDBN.js → chunk-3FXLQRWO.js} +4 -4
- package/dist/{chunk-JBPCRB4H.js → chunk-47NQ362T.js} +2 -2
- package/dist/{chunk-K6EG6ACM.js → chunk-6VNSISFI.js} +104 -29
- package/dist/chunk-6VNSISFI.js.map +1 -0
- package/dist/{chunk-PFDAVLZT.js → chunk-AEDBCPFA.js} +11 -11
- package/dist/{chunk-A4UUVU43.cjs → chunk-AXKG24PC.cjs} +3 -3
- package/dist/{chunk-A4UUVU43.cjs.map → chunk-AXKG24PC.cjs.map} +1 -1
- package/dist/{chunk-MDMCZUDP.js → chunk-DO3TPBBJ.js} +2 -2
- package/dist/{chunk-KINTYLL4.js → chunk-DUTPIML6.js} +2 -2
- package/dist/{chunk-Z6EA67XV.js → chunk-EMEEVTP2.js} +2 -2
- package/dist/{chunk-QLDKBCAG.js → chunk-EQNLV4YH.js} +2 -2
- package/dist/{chunk-JX3QPTMU.js → chunk-FKMKZ3CV.js} +2 -2
- package/dist/{chunk-NK3WCKJA.js → chunk-FVHGH6DG.js} +3 -3
- package/dist/{chunk-LP6D54PI.js → chunk-GBJNTGVV.js} +2 -2
- package/dist/{chunk-DRBOO4F2.cjs → chunk-GDLEO7SO.cjs} +23 -23
- package/dist/{chunk-DRBOO4F2.cjs.map → chunk-GDLEO7SO.cjs.map} +1 -1
- package/dist/{chunk-SOHPBZHR.cjs → chunk-GZEVDQ7S.cjs} +3 -3
- package/dist/{chunk-SOHPBZHR.cjs.map → chunk-GZEVDQ7S.cjs.map} +1 -1
- package/dist/{chunk-PJHRL7UZ.cjs → chunk-JOHVSCHT.cjs} +2 -2
- package/dist/{chunk-PJHRL7UZ.cjs.map → chunk-JOHVSCHT.cjs.map} +1 -1
- package/dist/{chunk-YP5T2EZ7.js → chunk-KGO5RHY2.js} +2 -2
- package/dist/{chunk-RWWUQMLO.cjs → chunk-KMYZ2SBN.cjs} +24 -24
- package/dist/{chunk-RWWUQMLO.cjs.map → chunk-KMYZ2SBN.cjs.map} +1 -1
- package/dist/{chunk-ZYKZS3F6.js → chunk-LKHXRJX2.js} +2 -2
- package/dist/{chunk-WTJ7NVIJ.js → chunk-M3YLZLHF.js} +3 -3
- package/dist/{chunk-7HTGSGIV.js → chunk-MKRVPDDJ.js} +2 -2
- package/dist/{chunk-SWY3AIPF.js → chunk-PE3PGTLM.js} +2 -2
- package/dist/{chunk-NCP7M4N2.js → chunk-Q7BAXRRK.js} +3 -3
- package/dist/{chunk-RLMAOBWN.js → chunk-RQII7NRF.js} +2 -2
- package/dist/{chunk-4ZUR6QAO.js → chunk-T2BVIFDL.js} +4 -4
- package/dist/{chunk-GMBWB4OU.js → chunk-T4JZ7DGA.js} +2 -2
- package/dist/{chunk-XWTXCBXT.js → chunk-W5B45M7Z.js} +4 -4
- package/dist/{chunk-4YZMZMSL.js → chunk-YD4TF6JI.js} +2 -2
- package/dist/{chunk-PGIFLIT5.js → chunk-YLCNGVXU.js} +2 -2
- package/dist/{chunk-QJRRJB6Z.cjs → chunk-ZEVEVTRG.cjs} +6 -6
- package/dist/{chunk-QJRRJB6Z.cjs.map → chunk-ZEVEVTRG.cjs.map} +1 -1
- package/dist/chunks-FBC25VC6.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-MO5QV2WU.cjs → formula-DZA6DTBT.cjs} +9 -9
- package/dist/{formula-MO5QV2WU.cjs.map → formula-DZA6DTBT.cjs.map} +1 -1
- package/dist/{formula-67MKCQ44.js → formula-GAW4HYPK.js} +4 -4
- package/dist/{formula-N3GX3SO2.js → formula-Q5O27Q3L.js} +3 -3
- package/dist/{image-ocr-65B7BSUH.js → image-ocr-SKLXAVIR.js} +9 -9
- package/dist/{image-ocr-PQ2Q55I2.js → image-ocr-WHMF24OA.js} +6 -6
- package/dist/{image-ocr-7GIT7REG.cjs → image-ocr-YUVG57VO.cjs} +17 -17
- package/dist/{image-ocr-7GIT7REG.cjs.map → image-ocr-YUVG57VO.cjs.map} +1 -1
- package/dist/index.cjs +484 -409
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +104 -29
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-AH3WIGOE.js → model-bundle-PHYAMJXE.js} +5 -5
- package/dist/{models-YFEVC3DI.js → models-B7DEVMPD.js} +5 -5
- package/dist/{parse-worker-v2-7NT2ZMYZ.js → parse-worker-v2-C7VA7D6M.js} +12 -12
- package/dist/{parser-REXFNEES.js → parser-4L4HI6KN.js} +9 -9
- package/dist/{parser-DIA2JXPE.cjs → parser-IBWL5DO6.cjs} +157 -157
- package/dist/{parser-DIA2JXPE.cjs.map → parser-IBWL5DO6.cjs.map} +1 -1
- package/dist/{parser-OZI6POE7.js → parser-SCRC6YOP.js} +12 -12
- package/dist/{pdf-ocr-U2XEMTFR.js → pdf-ocr-7JVAWHAF.js} +9 -9
- package/dist/pdf-ocr-BEXABEIP.cjs +31 -0
- package/dist/{pdf-ocr-3K5LAKGL.cjs.map → pdf-ocr-BEXABEIP.cjs.map} +1 -1
- package/dist/{pdf-ocr-EUJDEV4Z.js → pdf-ocr-Z62E4OGV.js} +6 -6
- package/dist/{profile-io-OIFR5XXG.js → profile-io-T4O5ZOSF.js} +3 -3
- package/dist/{rasterize-7QURJJZB.js → rasterize-2WOVCKGY.js} +3 -3
- package/dist/{redact-doc-OIHZYWVF.js → redact-doc-BS5KXZJU.js} +11 -11
- package/dist/{render-ZAJ4L4QM.js → render-EWFXTGYC.js} +7 -7
- package/dist/seal-B2FGIQ5C.js +10 -0
- package/dist/{setup-MWFDDT5X.js → setup-LRMO3ZKM.js} +3 -3
- package/dist/visual-UZQZUJIA.js +21 -0
- package/dist/{watch-7K2NBGMZ.js → watch-SOK25KLD.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-K6EG6ACM.js.map +0 -1
- package/dist/chunks-OZGUNAAZ.js +0 -10
- package/dist/pdf-ocr-3K5LAKGL.cjs +0 -31
- package/dist/seal-XVZFHFMG.js +0 -10
- package/dist/visual-QZVCWEG2.js +0 -21
- /package/dist/{-HVSX4WBM.js.map → -WQIGIQTE.js.map} +0 -0
- /package/dist/{chunk-ZXNKMDBN.js.map → chunk-3FXLQRWO.js.map} +0 -0
- /package/dist/{chunk-JBPCRB4H.js.map → chunk-47NQ362T.js.map} +0 -0
- /package/dist/{chunk-PFDAVLZT.js.map → chunk-AEDBCPFA.js.map} +0 -0
- /package/dist/{chunk-MDMCZUDP.js.map → chunk-DO3TPBBJ.js.map} +0 -0
- /package/dist/{chunk-KINTYLL4.js.map → chunk-DUTPIML6.js.map} +0 -0
- /package/dist/{chunk-Z6EA67XV.js.map → chunk-EMEEVTP2.js.map} +0 -0
- /package/dist/{chunk-QLDKBCAG.js.map → chunk-EQNLV4YH.js.map} +0 -0
- /package/dist/{chunk-JX3QPTMU.js.map → chunk-FKMKZ3CV.js.map} +0 -0
- /package/dist/{chunk-NK3WCKJA.js.map → chunk-FVHGH6DG.js.map} +0 -0
- /package/dist/{chunk-LP6D54PI.js.map → chunk-GBJNTGVV.js.map} +0 -0
- /package/dist/{chunk-YP5T2EZ7.js.map → chunk-KGO5RHY2.js.map} +0 -0
- /package/dist/{chunk-ZYKZS3F6.js.map → chunk-LKHXRJX2.js.map} +0 -0
- /package/dist/{chunk-WTJ7NVIJ.js.map → chunk-M3YLZLHF.js.map} +0 -0
- /package/dist/{chunk-7HTGSGIV.js.map → chunk-MKRVPDDJ.js.map} +0 -0
- /package/dist/{chunk-SWY3AIPF.js.map → chunk-PE3PGTLM.js.map} +0 -0
- /package/dist/{chunk-NCP7M4N2.js.map → chunk-Q7BAXRRK.js.map} +0 -0
- /package/dist/{chunk-RLMAOBWN.js.map → chunk-RQII7NRF.js.map} +0 -0
- /package/dist/{chunk-4ZUR6QAO.js.map → chunk-T2BVIFDL.js.map} +0 -0
- /package/dist/{chunk-GMBWB4OU.js.map → chunk-T4JZ7DGA.js.map} +0 -0
- /package/dist/{chunk-XWTXCBXT.js.map → chunk-W5B45M7Z.js.map} +0 -0
- /package/dist/{chunk-4YZMZMSL.js.map → chunk-YD4TF6JI.js.map} +0 -0
- /package/dist/{chunk-PGIFLIT5.js.map → chunk-YLCNGVXU.js.map} +0 -0
- /package/dist/{chunks-OZGUNAAZ.js.map → chunks-FBC25VC6.js.map} +0 -0
- /package/dist/{formula-67MKCQ44.js.map → formula-GAW4HYPK.js.map} +0 -0
- /package/dist/{formula-N3GX3SO2.js.map → formula-Q5O27Q3L.js.map} +0 -0
- /package/dist/{image-ocr-65B7BSUH.js.map → image-ocr-SKLXAVIR.js.map} +0 -0
- /package/dist/{image-ocr-PQ2Q55I2.js.map → image-ocr-WHMF24OA.js.map} +0 -0
- /package/dist/{model-bundle-AH3WIGOE.js.map → model-bundle-PHYAMJXE.js.map} +0 -0
- /package/dist/{models-YFEVC3DI.js.map → models-B7DEVMPD.js.map} +0 -0
- /package/dist/{parse-worker-v2-7NT2ZMYZ.js.map → parse-worker-v2-C7VA7D6M.js.map} +0 -0
- /package/dist/{parser-REXFNEES.js.map → parser-4L4HI6KN.js.map} +0 -0
- /package/dist/{parser-OZI6POE7.js.map → parser-SCRC6YOP.js.map} +0 -0
- /package/dist/{pdf-ocr-EUJDEV4Z.js.map → pdf-ocr-7JVAWHAF.js.map} +0 -0
- /package/dist/{pdf-ocr-U2XEMTFR.js.map → pdf-ocr-Z62E4OGV.js.map} +0 -0
- /package/dist/{profile-io-OIFR5XXG.js.map → profile-io-T4O5ZOSF.js.map} +0 -0
- /package/dist/{rasterize-7QURJJZB.js.map → rasterize-2WOVCKGY.js.map} +0 -0
- /package/dist/{redact-doc-OIHZYWVF.js.map → redact-doc-BS5KXZJU.js.map} +0 -0
- /package/dist/{render-ZAJ4L4QM.js.map → render-EWFXTGYC.js.map} +0 -0
- /package/dist/{seal-XVZFHFMG.js.map → seal-B2FGIQ5C.js.map} +0 -0
- /package/dist/{setup-MWFDDT5X.js.map → setup-LRMO3ZKM.js.map} +0 -0
- /package/dist/{visual-QZVCWEG2.js.map → visual-UZQZUJIA.js.map} +0 -0
- /package/dist/{watch-7K2NBGMZ.js.map → watch-SOK25KLD.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkGZEVDQ7Scjs = require('./chunk-GZEVDQ7S.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -43,7 +43,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkZEVEVTRGcjs = require('./chunk-ZEVEVTRG.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -61,14 +61,14 @@ var _chunkQJRRJB6Zcjs = require('./chunk-QJRRJB6Z.cjs');
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
var
|
|
64
|
+
var _chunkJOHVSCHTcjs = require('./chunk-JOHVSCHT.cjs');
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
68
68
|
|
|
69
69
|
// src/plain-markdown.ts
|
|
70
70
|
function toPlainMarkdown(md2) {
|
|
71
|
-
return
|
|
71
|
+
return _chunkZEVEVTRGcjs.plainScripts.call(void 0, md2).replace(/!\[[^\]\n]*\]\([^)\n]*\)/g, "").replace(/<img\b[^>]*>/gi, "").replace(/(?<!!)\[([^\]\n]*)\]\((?:https?|mailto|ftp):[^)\s]*\)/g, "$1").replace(/(?<!\\)<\/?u>/g, "").replace(/(?<!\\)\*\*(?=\S)([^\n]*?\S)(?<!\\)\*\*/g, "$1").replace(/(<br>)+(?=<\/t[dh]>)/g, "").replace(/[ \t]+$/gm, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/html-tables.ts
|
|
@@ -602,9 +602,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
602
602
|
}
|
|
603
603
|
|
|
604
604
|
// src/hwpx/parser-shared.ts
|
|
605
|
-
var MAX_DECOMPRESS_SIZE =
|
|
605
|
+
var MAX_DECOMPRESS_SIZE = _chunkJOHVSCHTcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
606
606
|
var MAX_ZIP_ENTRIES = 500;
|
|
607
|
-
var ZipBombError = class extends
|
|
607
|
+
var ZipBombError = class extends _chunkJOHVSCHTcjs.KordocError {
|
|
608
608
|
constructor(message) {
|
|
609
609
|
super(message);
|
|
610
610
|
this.name = "ZipBombError";
|
|
@@ -654,7 +654,7 @@ function createSectionShared() {
|
|
|
654
654
|
function createXmlParser(warnings) {
|
|
655
655
|
return new (0, _xmldom.DOMParser)({
|
|
656
656
|
onError(level, msg2) {
|
|
657
|
-
if (level === "fatalError") throw new (0,
|
|
657
|
+
if (level === "fatalError") throw new (0, _chunkJOHVSCHTcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
658
658
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
659
659
|
}
|
|
660
660
|
});
|
|
@@ -689,13 +689,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
689
689
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
690
690
|
const checksumType = attrOf(inner, "checksum-type");
|
|
691
691
|
if (algorithm !== AES256_CBC) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
if (startKey !== START_KEY_SHA256) {
|
|
695
|
-
throw new (0,
|
|
695
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
696
696
|
}
|
|
697
697
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
698
|
-
throw new (0,
|
|
698
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
699
699
|
}
|
|
700
700
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
701
701
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -703,10 +703,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
703
703
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
704
704
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
705
705
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
706
|
-
throw new (0,
|
|
706
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
707
707
|
}
|
|
708
708
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
709
|
-
throw new (0,
|
|
709
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
710
710
|
}
|
|
711
711
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
712
712
|
}
|
|
@@ -740,12 +740,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
740
740
|
for (const entry of entries) {
|
|
741
741
|
const file = zip.file(entry.path);
|
|
742
742
|
if (!file) {
|
|
743
|
-
throw new (0,
|
|
743
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
744
744
|
}
|
|
745
745
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
746
746
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
747
747
|
if (!plain4) {
|
|
748
|
-
throw new (0,
|
|
748
|
+
throw new (0, _chunkJOHVSCHTcjs.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.");
|
|
749
749
|
}
|
|
750
750
|
used += plain4.length;
|
|
751
751
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -811,10 +811,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
811
811
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
812
812
|
if (decompressed) {
|
|
813
813
|
decompressed.total += xml.length * 2;
|
|
814
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
814
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
815
815
|
}
|
|
816
816
|
const parser = createXmlParser();
|
|
817
|
-
const doc = parser.parseFromString(
|
|
817
|
+
const doc = parser.parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
818
818
|
if (!doc.documentElement) continue;
|
|
819
819
|
const domDoc = doc;
|
|
820
820
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1027,9 +1027,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1027
1027
|
let level = 0;
|
|
1028
1028
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1029
1029
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1030
|
-
if (ratio >=
|
|
1031
|
-
else if (ratio >=
|
|
1032
|
-
else if (ratio >=
|
|
1030
|
+
if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H1) level = 1;
|
|
1031
|
+
else if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H2) level = 2;
|
|
1032
|
+
else if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H3) level = 3;
|
|
1033
1033
|
}
|
|
1034
1034
|
const compactText = text.replace(/\s+/g, "");
|
|
1035
1035
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1643,11 +1643,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1643
1643
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1644
1644
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1645
1645
|
case "CIRCLED_DIGIT":
|
|
1646
|
-
return n <= 50 ?
|
|
1646
|
+
return n <= 50 ? _chunkZEVEVTRGcjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1647
1647
|
case "HANGUL_SYLLABLE":
|
|
1648
|
-
return
|
|
1648
|
+
return _chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1649
1649
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1650
|
-
return n <= 14 ?
|
|
1650
|
+
return n <= 14 ? _chunkZEVEVTRGcjs.circledHangul.call(void 0, n - 1) : _chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1651
1651
|
case "HANGUL_JAMO":
|
|
1652
1652
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1653
1653
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1661,9 +1661,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1661
1661
|
case "CIRCLED_LATIN_SMALL":
|
|
1662
1662
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1663
1663
|
case "ROMAN_CAPITAL":
|
|
1664
|
-
return
|
|
1664
|
+
return _chunkZEVEVTRGcjs.romanNumeral.call(void 0, n, true);
|
|
1665
1665
|
case "ROMAN_SMALL":
|
|
1666
|
-
return
|
|
1666
|
+
return _chunkZEVEVTRGcjs.romanNumeral.call(void 0, n, false);
|
|
1667
1667
|
default:
|
|
1668
1668
|
return String(n);
|
|
1669
1669
|
}
|
|
@@ -1711,7 +1711,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1711
1711
|
|
|
1712
1712
|
// src/hwpx/table-build.ts
|
|
1713
1713
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1714
|
-
const table2 =
|
|
1714
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1715
1715
|
if (state.caption) table2.caption = state.caption;
|
|
1716
1716
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1717
1717
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1740,7 +1740,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1740
1740
|
for (const src of row) {
|
|
1741
1741
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1742
1742
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1743
|
-
if (cand && anchors2.includes(cand))
|
|
1743
|
+
if (cand && anchors2.includes(cand)) _chunkZEVEVTRGcjs.CELL_EDGES.set(cand, src.edges);
|
|
1744
1744
|
}
|
|
1745
1745
|
}
|
|
1746
1746
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1790,7 +1790,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1790
1790
|
const cell2 = parentTable.cell;
|
|
1791
1791
|
(cell2.blocks ??= []).push(block);
|
|
1792
1792
|
cell2.hasStructure = true;
|
|
1793
|
-
let flat =
|
|
1793
|
+
let flat = _chunkZEVEVTRGcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1794
1794
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1795
1795
|
if (flat) {
|
|
1796
1796
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2024,7 +2024,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2024
2024
|
const tkids = rc.childNodes;
|
|
2025
2025
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2026
2026
|
const tk = tkids[k];
|
|
2027
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2027
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2028
2028
|
else if (tk.nodeType === 1) {
|
|
2029
2029
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2030
2030
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2044,7 +2044,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2044
2044
|
const span2 = { text };
|
|
2045
2045
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2046
2046
|
else {
|
|
2047
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2047
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkZEVEVTRGcjs.wrapScript.call(void 0, text, cp.script);
|
|
2048
2048
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2049
2049
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2050
2050
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2064,7 +2064,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
}
|
|
2066
2066
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2067
|
-
for (const s of merged) s.text =
|
|
2067
|
+
for (const s of merged) s.text = _chunkZEVEVTRGcjs.tidyScriptTags.call(void 0, s.text);
|
|
2068
2068
|
return merged;
|
|
2069
2069
|
}
|
|
2070
2070
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2091,7 +2091,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2091
2091
|
// src/hwpx/section-walker.ts
|
|
2092
2092
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2093
2093
|
const parser = createXmlParser(warnings);
|
|
2094
|
-
const doc = parser.parseFromString(
|
|
2094
|
+
const doc = parser.parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2095
2095
|
if (!doc.documentElement) return [];
|
|
2096
2096
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2097
2097
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2192,8 +2192,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2192
2192
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2193
2193
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2194
2194
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2195
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2196
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2195
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkZEVEVTRGcjs.MAX_COLS);
|
|
2196
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkZEVEVTRGcjs.MAX_ROWS);
|
|
2197
2197
|
}
|
|
2198
2198
|
break;
|
|
2199
2199
|
case "p": {
|
|
@@ -2516,7 +2516,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2516
2516
|
const sink = [];
|
|
2517
2517
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2518
2518
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2519
|
-
let flat =
|
|
2519
|
+
let flat = _chunkZEVEVTRGcjs.convertTableToText.call(void 0, st.rows);
|
|
2520
2520
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2521
2521
|
const built = [];
|
|
2522
2522
|
completeTable(st, [], built, ctx);
|
|
@@ -2680,7 +2680,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2680
2680
|
let url = (ch.textContent || "").trim();
|
|
2681
2681
|
if (!url) continue;
|
|
2682
2682
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2683
|
-
const safe =
|
|
2683
|
+
const safe = _chunkJOHVSCHTcjs.sanitizeHref.call(void 0, url);
|
|
2684
2684
|
if (safe) return safe;
|
|
2685
2685
|
}
|
|
2686
2686
|
return void 0;
|
|
@@ -2836,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2836
2836
|
_optionalChain([ctx, 'access', _112 => _112.warnings, 'optionalAccess', _113 => _113.push, 'call', _114 => _114({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2837
2837
|
}
|
|
2838
2838
|
} else {
|
|
2839
|
-
text +=
|
|
2839
|
+
text += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2840
2840
|
}
|
|
2841
2841
|
continue;
|
|
2842
2842
|
}
|
|
@@ -2881,7 +2881,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2881
2881
|
break;
|
|
2882
2882
|
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2883
2883
|
case "compose":
|
|
2884
|
-
if (!isInDeletedRange(ctx)) text +=
|
|
2884
|
+
if (!isInDeletedRange(ctx)) text += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _chunkZEVEVTRGcjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2885
2885
|
break;
|
|
2886
2886
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2887
2887
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
@@ -2893,7 +2893,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2893
2893
|
case "hyperlink": {
|
|
2894
2894
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2895
2895
|
if (url) {
|
|
2896
|
-
const safe =
|
|
2896
|
+
const safe = _chunkJOHVSCHTcjs.sanitizeHref.call(void 0, url);
|
|
2897
2897
|
if (safe) href = safe;
|
|
2898
2898
|
}
|
|
2899
2899
|
walk(child, depth + 1);
|
|
@@ -2987,7 +2987,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2987
2987
|
walk(child, depth + 1);
|
|
2988
2988
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
2989
2989
|
const added = text.slice(start);
|
|
2990
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2990
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkZEVEVTRGcjs.wrapScript.call(void 0, added, script);
|
|
2991
2991
|
}
|
|
2992
2992
|
break;
|
|
2993
2993
|
}
|
|
@@ -3010,7 +3010,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3010
3010
|
}
|
|
3011
3011
|
if (applied.length) href = void 0;
|
|
3012
3012
|
}
|
|
3013
|
-
text =
|
|
3013
|
+
text = _chunkZEVEVTRGcjs.tidyScriptTags.call(void 0, text);
|
|
3014
3014
|
const toc = takeTocLeaders(text);
|
|
3015
3015
|
text = toc.text;
|
|
3016
3016
|
const tocEntry = toc.tocEntry;
|
|
@@ -3124,7 +3124,7 @@ function decompressStream(data) {
|
|
|
3124
3124
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3125
3125
|
}
|
|
3126
3126
|
function parseFileHeader(data) {
|
|
3127
|
-
if (data.length < 40) throw new (0,
|
|
3127
|
+
if (data.length < 40) throw new (0, _chunkJOHVSCHTcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3128
3128
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3129
3129
|
return {
|
|
3130
3130
|
signature: sig,
|
|
@@ -3651,13 +3651,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3651
3651
|
}
|
|
3652
3652
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3653
3653
|
for (const path of allCandidates) {
|
|
3654
|
-
if (
|
|
3654
|
+
if (_chunkJOHVSCHTcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3655
3655
|
const file = zip.file(path);
|
|
3656
3656
|
if (!file) continue;
|
|
3657
3657
|
try {
|
|
3658
3658
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3659
3659
|
decompressed.total += data.length;
|
|
3660
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3660
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3661
3661
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3662
3662
|
const extMime = imageExtToMime(ext);
|
|
3663
3663
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3668,7 +3668,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3668
3668
|
usedPaths.add(path);
|
|
3669
3669
|
break;
|
|
3670
3670
|
} catch (err) {
|
|
3671
|
-
if (err instanceof
|
|
3671
|
+
if (err instanceof _chunkJOHVSCHTcjs.KordocError) throw err;
|
|
3672
3672
|
}
|
|
3673
3673
|
}
|
|
3674
3674
|
if (!img) _optionalChain([warnings, 'optionalAccess', _128 => _128.push, 'call', _129 => _129({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3688,13 +3688,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3688
3688
|
if (sweepUnreferenced) {
|
|
3689
3689
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3690
3690
|
for (const file of binEntries) {
|
|
3691
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3691
|
+
if (file.dir || usedPaths.has(file.name) || _chunkJOHVSCHTcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3692
3692
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3693
3693
|
if (_optionalChain([deletedRefs, 'optionalAccess', _130 => _130.has, 'call', _131 => _131(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _132 => _132.has, 'call', _133 => _133(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _134 => _134.has, 'call', _135 => _135(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _136 => _136.has, 'call', _137 => _137(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3694
3694
|
try {
|
|
3695
3695
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3696
3696
|
decompressed.total += data.length;
|
|
3697
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3697
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3698
3698
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3699
3699
|
let mimeType = imageExtToMime(ext);
|
|
3700
3700
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3708,7 +3708,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3708
3708
|
images.push(img);
|
|
3709
3709
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3710
3710
|
} catch (err) {
|
|
3711
|
-
if (err instanceof
|
|
3711
|
+
if (err instanceof _chunkJOHVSCHTcjs.KordocError) throw err;
|
|
3712
3712
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3713
3713
|
}
|
|
3714
3714
|
}
|
|
@@ -3759,7 +3759,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3759
3759
|
}
|
|
3760
3760
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3761
3761
|
const name = new TextDecoder().decode(nameBytes);
|
|
3762
|
-
if (
|
|
3762
|
+
if (_chunkJOHVSCHTcjs.isPathTraversal.call(void 0, name)) {
|
|
3763
3763
|
pos = fileStart + compSize;
|
|
3764
3764
|
continue;
|
|
3765
3765
|
}
|
|
@@ -3777,7 +3777,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3777
3777
|
continue;
|
|
3778
3778
|
}
|
|
3779
3779
|
totalDecompressed += content.length * 2;
|
|
3780
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3780
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3781
3781
|
sectionNum++;
|
|
3782
3782
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3783
3783
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3786,9 +3786,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3786
3786
|
continue;
|
|
3787
3787
|
}
|
|
3788
3788
|
}
|
|
3789
|
-
if (blocks.length === 0) throw new (0,
|
|
3789
|
+
if (blocks.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3790
3790
|
applyPageText(blocks, shared);
|
|
3791
|
-
const markdown =
|
|
3791
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3792
3792
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3793
3793
|
}
|
|
3794
3794
|
async function readKordocLayout(zip) {
|
|
@@ -3813,11 +3813,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3813
3813
|
if (paths.length > 0) return paths;
|
|
3814
3814
|
}
|
|
3815
3815
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3816
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3816
|
+
return sectionFiles.map((f) => f.name).sort(_chunkJOHVSCHTcjs.compareSectionPaths);
|
|
3817
3817
|
}
|
|
3818
3818
|
function parseSectionPathsFromManifest(xml) {
|
|
3819
3819
|
const parser = createXmlParser();
|
|
3820
|
-
const doc = parser.parseFromString(
|
|
3820
|
+
const doc = parser.parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3821
3821
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3822
3822
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3823
3823
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3827,7 +3827,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3827
3827
|
for (let i = 0; i < items.length; i++) {
|
|
3828
3828
|
const item = items[i];
|
|
3829
3829
|
const id = item.getAttribute("id") || "";
|
|
3830
|
-
const href =
|
|
3830
|
+
const href = _chunkJOHVSCHTcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3831
3831
|
if (id && href) idToHref.set(id, href);
|
|
3832
3832
|
}
|
|
3833
3833
|
if (spine.length > 0) {
|
|
@@ -3838,7 +3838,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3838
3838
|
}
|
|
3839
3839
|
if (ordered.length > 0) return ordered;
|
|
3840
3840
|
}
|
|
3841
|
-
return Array.from(idToHref.values()).sort(
|
|
3841
|
+
return Array.from(idToHref.values()).sort(_chunkJOHVSCHTcjs.compareSectionPaths);
|
|
3842
3842
|
}
|
|
3843
3843
|
|
|
3844
3844
|
// src/hwpx/metadata.ts
|
|
@@ -3850,7 +3850,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3850
3850
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3851
3851
|
if (decompressed) {
|
|
3852
3852
|
decompressed.total += xml.length * 2;
|
|
3853
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3853
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3854
3854
|
}
|
|
3855
3855
|
return xml;
|
|
3856
3856
|
};
|
|
@@ -3872,7 +3872,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3872
3872
|
}
|
|
3873
3873
|
}
|
|
3874
3874
|
function parseOpfMetadata(xml, metadata) {
|
|
3875
|
-
const root = createXmlParser().parseFromString(
|
|
3875
|
+
const root = createXmlParser().parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3876
3876
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3877
3877
|
if (!md2) return;
|
|
3878
3878
|
let title;
|
|
@@ -3905,7 +3905,7 @@ function isoDate(s) {
|
|
|
3905
3905
|
}
|
|
3906
3906
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3907
3907
|
const parser = createXmlParser();
|
|
3908
|
-
const doc = parser.parseFromString(
|
|
3908
|
+
const doc = parser.parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3909
3909
|
if (!doc.documentElement) return;
|
|
3910
3910
|
const getText = (tagNames) => {
|
|
3911
3911
|
for (const tag of tagNames) {
|
|
@@ -3944,7 +3944,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3944
3944
|
}
|
|
3945
3945
|
}
|
|
3946
3946
|
async function parseHwpxDocument(buffer, options) {
|
|
3947
|
-
|
|
3947
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3948
3948
|
let zip;
|
|
3949
3949
|
try {
|
|
3950
3950
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3953,7 +3953,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3953
3953
|
}
|
|
3954
3954
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3955
3955
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3956
|
-
throw new (0,
|
|
3956
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3957
3957
|
}
|
|
3958
3958
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
3959
3959
|
if (manifestFile) {
|
|
@@ -3973,7 +3973,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3973
3973
|
}
|
|
3974
3974
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
3975
3975
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
3976
|
-
throw new (0,
|
|
3976
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
3977
3977
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\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."
|
|
3978
3978
|
);
|
|
3979
3979
|
}
|
|
@@ -3985,7 +3985,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3985
3985
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
3986
3986
|
const warnings = [];
|
|
3987
3987
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
3988
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3988
|
+
if (sectionPaths.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3989
3989
|
let allBlocks = [];
|
|
3990
3990
|
const shared = createSectionShared();
|
|
3991
3991
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4029,10 +4029,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4029
4029
|
const blocks = allBlocks;
|
|
4030
4030
|
applyPageText(blocks, shared);
|
|
4031
4031
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4032
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4032
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkZEVEVTRGcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4033
4033
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4034
4034
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4035
|
-
const markdown =
|
|
4035
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4036
4036
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
4037
4037
|
}
|
|
4038
4038
|
|
|
@@ -4799,7 +4799,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4799
4799
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4800
4800
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4801
4801
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4802
|
-
const wrong = () => new (0,
|
|
4802
|
+
const wrong = () => new (0, _chunkJOHVSCHTcjs.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.");
|
|
4803
4803
|
let records;
|
|
4804
4804
|
try {
|
|
4805
4805
|
records = readRecords3(data);
|
|
@@ -4811,7 +4811,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4811
4811
|
}
|
|
4812
4812
|
function assertSupportedEncryptVersion(version) {
|
|
4813
4813
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4814
|
-
throw new (0,
|
|
4814
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
4815
4815
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4816
4816
|
);
|
|
4817
4817
|
}
|
|
@@ -5060,19 +5060,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5060
5060
|
function formatNumber(n, fmt) {
|
|
5061
5061
|
switch (fmt) {
|
|
5062
5062
|
case "circled":
|
|
5063
|
-
return n >= 1 ?
|
|
5063
|
+
return n >= 1 ? _chunkZEVEVTRGcjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5064
5064
|
case "romanUpper":
|
|
5065
|
-
return
|
|
5065
|
+
return _chunkZEVEVTRGcjs.romanNumeral.call(void 0, n, true);
|
|
5066
5066
|
case "romanLower":
|
|
5067
|
-
return
|
|
5067
|
+
return _chunkZEVEVTRGcjs.romanNumeral.call(void 0, n, false);
|
|
5068
5068
|
case "latinUpper":
|
|
5069
5069
|
return formatLatin(n, true) || String(n);
|
|
5070
5070
|
case "latinLower":
|
|
5071
5071
|
return formatLatin(n, false) || String(n);
|
|
5072
5072
|
case "ganada":
|
|
5073
|
-
return n >= 1 ?
|
|
5073
|
+
return n >= 1 ? _chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5074
5074
|
case "circledGanada":
|
|
5075
|
-
return n >= 1 ?
|
|
5075
|
+
return n >= 1 ? _chunkZEVEVTRGcjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5076
5076
|
case "jamo":
|
|
5077
5077
|
return fromTable(n, JAMO);
|
|
5078
5078
|
case "circledJamo":
|
|
@@ -5254,7 +5254,7 @@ function emitParagraphBlocks(p) {
|
|
|
5254
5254
|
return blocks;
|
|
5255
5255
|
}
|
|
5256
5256
|
function tableFlatText(table2) {
|
|
5257
|
-
const flat =
|
|
5257
|
+
const flat = _chunkZEVEVTRGcjs.convertTableToText.call(void 0, table2.cells);
|
|
5258
5258
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5259
5259
|
}
|
|
5260
5260
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5335,8 +5335,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5335
5335
|
}
|
|
5336
5336
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5337
5337
|
for (const c of cells) {
|
|
5338
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5339
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5338
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkZEVEVTRGcjs.MAX_ROWS));
|
|
5339
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkZEVEVTRGcjs.MAX_COLS));
|
|
5340
5340
|
}
|
|
5341
5341
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5342
5342
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5344,12 +5344,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5344
5344
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5345
5345
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5346
5346
|
}
|
|
5347
|
-
const table2 =
|
|
5347
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5348
5348
|
if (table2.rows === 0) return null;
|
|
5349
5349
|
for (const c of placed) {
|
|
5350
5350
|
if (c.edges) {
|
|
5351
5351
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5352
|
-
if (at)
|
|
5352
|
+
if (at) _chunkZEVEVTRGcjs.CELL_EDGES.set(at, c.edges);
|
|
5353
5353
|
}
|
|
5354
5354
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5355
5355
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5551,7 +5551,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5551
5551
|
continue;
|
|
5552
5552
|
}
|
|
5553
5553
|
if (!ctrl.href) continue;
|
|
5554
|
-
const href =
|
|
5554
|
+
const href = _chunkJOHVSCHTcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5555
5555
|
if (!href) continue;
|
|
5556
5556
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5557
5557
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5560,7 +5560,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5560
5560
|
}
|
|
5561
5561
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5562
5562
|
text = resolveLiteralLt(text);
|
|
5563
|
-
text =
|
|
5563
|
+
text = _chunkZEVEVTRGcjs.tidyScriptTags.call(void 0, text);
|
|
5564
5564
|
const toc = takeTocLeaders(text);
|
|
5565
5565
|
text = toc.text;
|
|
5566
5566
|
let headingLevel = 0;
|
|
@@ -5667,7 +5667,7 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5667
5667
|
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5668
5668
|
case CTRL_TCPS: {
|
|
5669
5669
|
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5670
|
-
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText =
|
|
5670
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunkZEVEVTRGcjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5671
5671
|
return;
|
|
5672
5672
|
}
|
|
5673
5673
|
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
@@ -5785,7 +5785,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5785
5785
|
}
|
|
5786
5786
|
var A4_HEIGHT = 84188;
|
|
5787
5787
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5788
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5788
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkZEVEVTRGcjs.markNonLayoutTable.call(void 0, table2);
|
|
5789
5789
|
}
|
|
5790
5790
|
function parseTableControl(ctrl, records, ctx) {
|
|
5791
5791
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5797,8 +5797,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5797
5797
|
let tableIdx = -1;
|
|
5798
5798
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5799
5799
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5800
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5801
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5800
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkZEVEVTRGcjs.MAX_ROWS);
|
|
5801
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkZEVEVTRGcjs.MAX_COLS);
|
|
5802
5802
|
tableIdx = i2;
|
|
5803
5803
|
break;
|
|
5804
5804
|
}
|
|
@@ -5842,11 +5842,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5842
5842
|
return table3;
|
|
5843
5843
|
}
|
|
5844
5844
|
if (rows === 0 || cols === 0) {
|
|
5845
|
-
rows = Math.min(cells.length,
|
|
5845
|
+
rows = Math.min(cells.length, _chunkZEVEVTRGcjs.MAX_ROWS);
|
|
5846
5846
|
cols = 1;
|
|
5847
5847
|
}
|
|
5848
5848
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5849
|
-
const table2 =
|
|
5849
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5850
5850
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5851
5851
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5852
5852
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5865,8 +5865,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5865
5865
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5866
5866
|
const cs = rec.data.readUInt16LE(12);
|
|
5867
5867
|
const rs = rec.data.readUInt16LE(14);
|
|
5868
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5869
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5868
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkZEVEVTRGcjs.MAX_COLS);
|
|
5869
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkZEVEVTRGcjs.MAX_ROWS);
|
|
5870
5870
|
}
|
|
5871
5871
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5872
5872
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6015,7 +6015,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6015
6015
|
lenientCfb = parseLenientCfb(buffer);
|
|
6016
6016
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6017
6017
|
} catch (e24) {
|
|
6018
|
-
throw new (0,
|
|
6018
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6019
6019
|
}
|
|
6020
6020
|
}
|
|
6021
6021
|
const readRawStream = (path) => {
|
|
@@ -6026,14 +6026,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6026
6026
|
return lenientCfb.findStream(path);
|
|
6027
6027
|
};
|
|
6028
6028
|
const headerData = readRawStream("/FileHeader");
|
|
6029
|
-
if (!headerData) throw new (0,
|
|
6029
|
+
if (!headerData) throw new (0, _chunkJOHVSCHTcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6030
6030
|
const header = parseFileHeader(headerData);
|
|
6031
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6032
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6031
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6032
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkJOHVSCHTcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6033
6033
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6034
6034
|
if (encrypted) {
|
|
6035
6035
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6036
|
-
throw new (0,
|
|
6036
|
+
throw new (0, _chunkJOHVSCHTcjs.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.");
|
|
6037
6037
|
}
|
|
6038
6038
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6039
6039
|
}
|
|
@@ -6047,12 +6047,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6047
6047
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6048
6048
|
if (encrypted) {
|
|
6049
6049
|
const rawDocInfo = findStream("/DocInfo");
|
|
6050
|
-
if (!rawDocInfo) throw new (0,
|
|
6050
|
+
if (!rawDocInfo) throw new (0, _chunkJOHVSCHTcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6051
6051
|
let docInfoData;
|
|
6052
6052
|
try {
|
|
6053
6053
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6054
6054
|
} catch (e25) {
|
|
6055
|
-
throw new (0,
|
|
6055
|
+
throw new (0, _chunkJOHVSCHTcjs.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.");
|
|
6056
6056
|
}
|
|
6057
6057
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6058
6058
|
}
|
|
@@ -6077,10 +6077,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6077
6077
|
try {
|
|
6078
6078
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6079
6079
|
totalDecompressed += data.length;
|
|
6080
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6080
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6081
6081
|
out.push(readRecords(data));
|
|
6082
6082
|
} catch (secErr) {
|
|
6083
|
-
if (secErr instanceof
|
|
6083
|
+
if (secErr instanceof _chunkJOHVSCHTcjs.KordocError) throw secErr;
|
|
6084
6084
|
out.push(null);
|
|
6085
6085
|
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" });
|
|
6086
6086
|
}
|
|
@@ -6100,7 +6100,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6100
6100
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6101
6101
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6102
6102
|
const sections = readHwp5SectionStreams(c);
|
|
6103
|
-
if (sections.length === 0) throw new (0,
|
|
6103
|
+
if (sections.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6104
6104
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6105
6105
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6106
6106
|
const sectionTableIds = [];
|
|
@@ -6144,7 +6144,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6144
6144
|
parsedSections++;
|
|
6145
6145
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6146
6146
|
} catch (secErr) {
|
|
6147
|
-
if (secErr instanceof
|
|
6147
|
+
if (secErr instanceof _chunkJOHVSCHTcjs.KordocError) throw secErr;
|
|
6148
6148
|
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" });
|
|
6149
6149
|
} finally {
|
|
6150
6150
|
pageBase += detect2.pages;
|
|
@@ -6155,10 +6155,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6155
6155
|
}
|
|
6156
6156
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6157
6157
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6158
|
-
let flatBlocks =
|
|
6159
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6158
|
+
let flatBlocks = _chunkZEVEVTRGcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6159
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkZEVEVTRGcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6160
6160
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6161
|
-
const deduped =
|
|
6161
|
+
const deduped = _chunkZEVEVTRGcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6162
6162
|
const removed = flatBlocks.length - deduped.length;
|
|
6163
6163
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6164
6164
|
flatBlocks = deduped;
|
|
@@ -6167,10 +6167,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6167
6167
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6168
6168
|
}
|
|
6169
6169
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6170
|
-
let markdown =
|
|
6170
|
+
let markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6171
6171
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6172
6172
|
try {
|
|
6173
|
-
markdown =
|
|
6173
|
+
markdown = _chunkGZEVDQ7Scjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6174
6174
|
} catch (inlineErr) {
|
|
6175
6175
|
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" });
|
|
6176
6176
|
}
|
|
@@ -6234,9 +6234,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6234
6234
|
let level = 0;
|
|
6235
6235
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6236
6236
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6237
|
-
if (ratio >=
|
|
6238
|
-
else if (ratio >=
|
|
6239
|
-
else if (ratio >=
|
|
6237
|
+
if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H1) level = 1;
|
|
6238
|
+
else if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H2) level = 2;
|
|
6239
|
+
else if (ratio >= _chunkZEVEVTRGcjs.HEADING_RATIO_H3) level = 3;
|
|
6240
6240
|
}
|
|
6241
6241
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6242
6242
|
if (level === 0) level = 2;
|
|
@@ -6368,7 +6368,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6368
6368
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6369
6369
|
if (!raw) break;
|
|
6370
6370
|
totalBytes += raw.length;
|
|
6371
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6371
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6372
6372
|
sections.push({ idx: i, content: raw });
|
|
6373
6373
|
}
|
|
6374
6374
|
if (sections.length === 0) {
|
|
@@ -6379,7 +6379,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6379
6379
|
const raw = lcfb.findStream(e.name);
|
|
6380
6380
|
if (raw) {
|
|
6381
6381
|
totalBytes += raw.length;
|
|
6382
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6382
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6383
6383
|
sections.push({ idx, content: raw });
|
|
6384
6384
|
}
|
|
6385
6385
|
}
|
|
@@ -6396,7 +6396,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6396
6396
|
try {
|
|
6397
6397
|
const content = decryptViewText(raw, compressed);
|
|
6398
6398
|
totalDecompressed += content.length;
|
|
6399
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6399
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6400
6400
|
sections.push({ idx: i, content });
|
|
6401
6401
|
} catch (e32) {
|
|
6402
6402
|
break;
|
|
@@ -18896,25 +18896,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18896
18896
|
}
|
|
18897
18897
|
function readLayout(data) {
|
|
18898
18898
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18899
|
-
throw new (0,
|
|
18899
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18900
18900
|
}
|
|
18901
18901
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18902
18902
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18903
18903
|
if (payloadOffset >= data.length) {
|
|
18904
|
-
throw new (0,
|
|
18904
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18905
18905
|
}
|
|
18906
18906
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18907
18907
|
}
|
|
18908
18908
|
function decryptHwp3Document(input, password) {
|
|
18909
18909
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18910
18910
|
if (!compressed) {
|
|
18911
|
-
throw new (0,
|
|
18911
|
+
throw new (0, _chunkJOHVSCHTcjs.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)");
|
|
18912
18912
|
}
|
|
18913
18913
|
const source = Buffer.from(input);
|
|
18914
18914
|
const payload = source.subarray(payloadOffset);
|
|
18915
18915
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18916
18916
|
if (aligned.length === 0) {
|
|
18917
|
-
throw new (0,
|
|
18917
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18918
18918
|
}
|
|
18919
18919
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18920
18920
|
let inflated;
|
|
@@ -18922,14 +18922,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18922
18922
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18923
18923
|
} catch (err) {
|
|
18924
18924
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18925
|
-
throw new (0,
|
|
18925
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
18926
18926
|
`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`
|
|
18927
18927
|
);
|
|
18928
18928
|
}
|
|
18929
|
-
throw new (0,
|
|
18929
|
+
throw new (0, _chunkJOHVSCHTcjs.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.");
|
|
18930
18930
|
}
|
|
18931
18931
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18932
|
-
throw new (0,
|
|
18932
|
+
throw new (0, _chunkJOHVSCHTcjs.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.");
|
|
18933
18933
|
}
|
|
18934
18934
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18935
18935
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -18986,9 +18986,9 @@ function hwp3CellGrid(info, count) {
|
|
|
18986
18986
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
18987
18987
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
18988
18988
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
18989
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
18989
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkZEVEVTRGcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkZEVEVTRGcjs.MAX_COLS) };
|
|
18990
18990
|
});
|
|
18991
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18991
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkZEVEVTRGcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkZEVEVTRGcjs.MAX_COLS), cells };
|
|
18992
18992
|
}
|
|
18993
18993
|
|
|
18994
18994
|
// src/hwp3/parser.ts
|
|
@@ -19029,7 +19029,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19029
19029
|
let source = Buffer.from(buffer);
|
|
19030
19030
|
if (isEncryptedHwp3(source)) {
|
|
19031
19031
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19032
|
-
throw new (0,
|
|
19032
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
19033
19033
|
"\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."
|
|
19034
19034
|
);
|
|
19035
19035
|
}
|
|
@@ -19046,10 +19046,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19046
19046
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19047
19047
|
} catch (err) {
|
|
19048
19048
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19049
|
-
throw new (0,
|
|
19049
|
+
throw new (0, _chunkJOHVSCHTcjs.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`);
|
|
19050
19050
|
}
|
|
19051
19051
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19052
|
-
throw new (0,
|
|
19052
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19053
19053
|
}
|
|
19054
19054
|
} else {
|
|
19055
19055
|
body = tail;
|
|
@@ -19072,7 +19072,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19072
19072
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19073
19073
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19074
19074
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19075
|
-
const blocks =
|
|
19075
|
+
const blocks = _chunkZEVEVTRGcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19076
19076
|
const metadata = {
|
|
19077
19077
|
title: header.title || void 0,
|
|
19078
19078
|
author: header.author || void 0,
|
|
@@ -19080,10 +19080,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19080
19080
|
createdAt: header.date || void 0,
|
|
19081
19081
|
version: "3.0"
|
|
19082
19082
|
};
|
|
19083
|
-
let markdown =
|
|
19083
|
+
let markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19084
19084
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19085
19085
|
try {
|
|
19086
|
-
markdown =
|
|
19086
|
+
markdown = _chunkGZEVDQ7Scjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19087
19087
|
} catch (inlineErr) {
|
|
19088
19088
|
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" });
|
|
19089
19089
|
}
|
|
@@ -19215,7 +19215,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19215
19215
|
continue;
|
|
19216
19216
|
}
|
|
19217
19217
|
if (ch >= 32) {
|
|
19218
|
-
para2.text +=
|
|
19218
|
+
para2.text += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19219
19219
|
continue;
|
|
19220
19220
|
}
|
|
19221
19221
|
if (ch === 9) {
|
|
@@ -19450,7 +19450,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19450
19450
|
// src/xlsx/sheet-blocks.ts
|
|
19451
19451
|
var MAX_SHEET_COLS = 16384;
|
|
19452
19452
|
function sheetRowCap(cols) {
|
|
19453
|
-
return Math.floor(
|
|
19453
|
+
return Math.floor(_chunkZEVEVTRGcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19454
19454
|
}
|
|
19455
19455
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19456
19456
|
const blocks = [];
|
|
@@ -19481,7 +19481,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19481
19481
|
if (keepRows.length > rowCap) {
|
|
19482
19482
|
warnings.push({
|
|
19483
19483
|
page: sheetIndex + 1,
|
|
19484
|
-
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${
|
|
19484
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunkZEVEVTRGcjs.MAX_TABLE_CELLS})`,
|
|
19485
19485
|
code: "TRUNCATED_TABLE"
|
|
19486
19486
|
});
|
|
19487
19487
|
keepRows.length = rowCap;
|
|
@@ -19515,14 +19515,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19515
19515
|
}
|
|
19516
19516
|
cellRows.push(row);
|
|
19517
19517
|
}
|
|
19518
|
-
const table2 =
|
|
19518
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19519
19519
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19520
19520
|
return blocks;
|
|
19521
19521
|
}
|
|
19522
19522
|
|
|
19523
19523
|
// src/xlsx/parser.ts
|
|
19524
19524
|
var MAX_SHEETS = 100;
|
|
19525
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19525
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkJOHVSCHTcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19526
19526
|
var MAX_SHEET_ROWS = 1048576;
|
|
19527
19527
|
function cleanNumericValue(raw) {
|
|
19528
19528
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19559,7 +19559,7 @@ function getTextContent(el) {
|
|
|
19559
19559
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19560
19560
|
}
|
|
19561
19561
|
function parseXml(text) {
|
|
19562
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19562
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19563
19563
|
}
|
|
19564
19564
|
function collectRichText(root) {
|
|
19565
19565
|
let out = "";
|
|
@@ -19570,7 +19570,7 @@ function collectRichText(root) {
|
|
|
19570
19570
|
const el = children[i];
|
|
19571
19571
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19572
19572
|
if (local === "rPh") continue;
|
|
19573
|
-
if (local === "t") out +=
|
|
19573
|
+
if (local === "t") out += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19574
19574
|
else walk(el);
|
|
19575
19575
|
}
|
|
19576
19576
|
};
|
|
@@ -19781,12 +19781,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19781
19781
|
return { rows, merges, maxCol };
|
|
19782
19782
|
}
|
|
19783
19783
|
async function parseXlsxDocument(buffer, options) {
|
|
19784
|
-
|
|
19784
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19785
19785
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19786
19786
|
const warnings = [];
|
|
19787
19787
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19788
19788
|
if (!workbookFile) {
|
|
19789
|
-
throw new (0,
|
|
19789
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19790
19790
|
}
|
|
19791
19791
|
let sharedStrings = [];
|
|
19792
19792
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19795,7 +19795,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19795
19795
|
}
|
|
19796
19796
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19797
19797
|
if (sheets.length === 0) {
|
|
19798
|
-
throw new (0,
|
|
19798
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19799
19799
|
}
|
|
19800
19800
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19801
19801
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19879,7 +19879,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19879
19879
|
} catch (e35) {
|
|
19880
19880
|
}
|
|
19881
19881
|
}
|
|
19882
|
-
const markdown =
|
|
19882
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19883
19883
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19884
19884
|
}
|
|
19885
19885
|
|
|
@@ -20193,14 +20193,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20193
20193
|
const h = readCellHeader(rec.data);
|
|
20194
20194
|
if (h && rec.data.length >= 10) {
|
|
20195
20195
|
const isst = rec.data.readUInt32LE(6);
|
|
20196
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20196
|
+
cells.push({ row: h.row, col: h.col, value: _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20197
20197
|
}
|
|
20198
20198
|
break;
|
|
20199
20199
|
}
|
|
20200
20200
|
case OP_LABEL: {
|
|
20201
20201
|
const h = readCellHeader(rec.data);
|
|
20202
20202
|
if (h) {
|
|
20203
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20203
|
+
cells.push({ row: h.row, col: h.col, value: _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20204
20204
|
}
|
|
20205
20205
|
break;
|
|
20206
20206
|
}
|
|
@@ -20216,7 +20216,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20216
20216
|
cells.push({
|
|
20217
20217
|
row: h.row,
|
|
20218
20218
|
col: h.col,
|
|
20219
|
-
value:
|
|
20219
|
+
value: _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20220
20220
|
});
|
|
20221
20221
|
i = j;
|
|
20222
20222
|
} else {
|
|
@@ -20328,11 +20328,11 @@ function processGlobals(records) {
|
|
|
20328
20328
|
const xfFmtIds = [];
|
|
20329
20329
|
const firstBof = records[0];
|
|
20330
20330
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20331
|
-
throw new (0,
|
|
20331
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20332
20332
|
}
|
|
20333
20333
|
const bof = decodeBof(firstBof.data);
|
|
20334
20334
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20335
|
-
throw new (0,
|
|
20335
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20336
20336
|
}
|
|
20337
20337
|
let i = 1;
|
|
20338
20338
|
while (i < records.length) {
|
|
@@ -20416,28 +20416,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20416
20416
|
try {
|
|
20417
20417
|
cfb = parseLenientCfb(buf);
|
|
20418
20418
|
} catch (e) {
|
|
20419
|
-
throw new (0,
|
|
20419
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
20420
20420
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20421
20421
|
);
|
|
20422
20422
|
}
|
|
20423
20423
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20424
20424
|
if (!wb) {
|
|
20425
|
-
throw new (0,
|
|
20425
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20426
20426
|
}
|
|
20427
20427
|
const records = readRecords2(wb);
|
|
20428
20428
|
if (records.length === 0) {
|
|
20429
|
-
throw new (0,
|
|
20429
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20430
20430
|
}
|
|
20431
20431
|
const firstBof = decodeBof(records[0].data);
|
|
20432
20432
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20433
|
-
throw new (0,
|
|
20433
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
20434
20434
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20435
20435
|
);
|
|
20436
20436
|
}
|
|
20437
20437
|
const globals = processGlobals(records);
|
|
20438
20438
|
const warnings = [];
|
|
20439
20439
|
if (globals.encrypted) {
|
|
20440
|
-
throw new (0,
|
|
20440
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20441
20441
|
}
|
|
20442
20442
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20443
20443
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20488,7 +20488,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20488
20488
|
pageCount: totalSheets
|
|
20489
20489
|
};
|
|
20490
20490
|
return {
|
|
20491
|
-
markdown:
|
|
20491
|
+
markdown: _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20492
20492
|
blocks: allBlocks,
|
|
20493
20493
|
metadata,
|
|
20494
20494
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20927,7 +20927,7 @@ function isDisplayMath(el) {
|
|
|
20927
20927
|
}
|
|
20928
20928
|
|
|
20929
20929
|
// src/docx/parser.ts
|
|
20930
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20930
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkJOHVSCHTcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20931
20931
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20932
20932
|
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
20933
20933
|
function matchesLocal(el, localName3) {
|
|
@@ -20985,7 +20985,7 @@ function getAttr(el, localName3) {
|
|
|
20985
20985
|
return null;
|
|
20986
20986
|
}
|
|
20987
20987
|
function parseXml2(text) {
|
|
20988
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20988
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, text), "text/xml");
|
|
20989
20989
|
}
|
|
20990
20990
|
function parseStyles(xml) {
|
|
20991
20991
|
const doc = parseXml2(xml);
|
|
@@ -21121,7 +21121,7 @@ function parseFootnotes(xml) {
|
|
|
21121
21121
|
const runs = findElements(p, "r");
|
|
21122
21122
|
for (const r of runs) {
|
|
21123
21123
|
const tElements = getChildElements(r, "t");
|
|
21124
|
-
for (const t of tElements) texts.push(
|
|
21124
|
+
for (const t of tElements) texts.push(_chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21125
21125
|
}
|
|
21126
21126
|
}
|
|
21127
21127
|
notes.set(id, texts.join("").trim());
|
|
@@ -21152,7 +21152,7 @@ function collectOmmlRoots(p) {
|
|
|
21152
21152
|
function extractRun(r) {
|
|
21153
21153
|
let text = "";
|
|
21154
21154
|
for (const el of effectiveChildElements(r)) {
|
|
21155
|
-
if (matchesLocal(el, "t")) text +=
|
|
21155
|
+
if (matchesLocal(el, "t")) text += _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21156
21156
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21157
21157
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21158
21158
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21165,7 +21165,7 @@ function extractRun(r) {
|
|
|
21165
21165
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21166
21166
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21167
21167
|
const v = va ? getAttr(va, "val") : null;
|
|
21168
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21168
|
+
if (v === "superscript" || v === "subscript") text = _chunkZEVEVTRGcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21169
21169
|
}
|
|
21170
21170
|
return { text, bold, italic };
|
|
21171
21171
|
}
|
|
@@ -21183,7 +21183,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21183
21183
|
function makeLink(text, rawHref) {
|
|
21184
21184
|
if (!text) return "";
|
|
21185
21185
|
if (!rawHref) return text;
|
|
21186
|
-
const href =
|
|
21186
|
+
const href = _chunkJOHVSCHTcjs.sanitizeHref.call(void 0, rawHref);
|
|
21187
21187
|
return href ? `[${text}](${href})` : text;
|
|
21188
21188
|
}
|
|
21189
21189
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21274,7 +21274,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21274
21274
|
const m = mathText(om);
|
|
21275
21275
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21276
21276
|
}
|
|
21277
|
-
const text =
|
|
21277
|
+
const text = _chunkZEVEVTRGcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21278
21278
|
return { text, bold, italic, footnoteText };
|
|
21279
21279
|
}
|
|
21280
21280
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21399,7 +21399,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21399
21399
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21400
21400
|
})
|
|
21401
21401
|
);
|
|
21402
|
-
const table2 =
|
|
21402
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21403
21403
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21404
21404
|
return { type: "table", table: table2 };
|
|
21405
21405
|
}
|
|
@@ -21448,7 +21448,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21448
21448
|
let data = null;
|
|
21449
21449
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21450
21450
|
imgIdx++;
|
|
21451
|
-
const ext =
|
|
21451
|
+
const ext = _chunkJOHVSCHTcjs.partExtension.call(void 0, imgPath);
|
|
21452
21452
|
const mimeMap = {
|
|
21453
21453
|
png: "image/png",
|
|
21454
21454
|
jpg: "image/jpeg",
|
|
@@ -21547,12 +21547,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21547
21547
|
}
|
|
21548
21548
|
async function parseDocxDocument(buffer, options) {
|
|
21549
21549
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21550
|
-
|
|
21550
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21551
21551
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21552
21552
|
const warnings = [];
|
|
21553
21553
|
const docFile = zip.file("word/document.xml");
|
|
21554
21554
|
if (!docFile) {
|
|
21555
|
-
throw new (0,
|
|
21555
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21556
21556
|
}
|
|
21557
21557
|
let rels = /* @__PURE__ */ new Map();
|
|
21558
21558
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21599,7 +21599,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21599
21599
|
const doc = parseXml2(docXml);
|
|
21600
21600
|
const body = findElements(doc, "body");
|
|
21601
21601
|
if (body.length === 0) {
|
|
21602
|
-
throw new (0,
|
|
21602
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21603
21603
|
}
|
|
21604
21604
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21605
21605
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21652,7 +21652,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21652
21652
|
}
|
|
21653
21653
|
}
|
|
21654
21654
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21655
|
-
const markdown =
|
|
21655
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21656
21656
|
return {
|
|
21657
21657
|
markdown,
|
|
21658
21658
|
blocks,
|
|
@@ -21666,7 +21666,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21666
21666
|
// src/pptx/parser.ts
|
|
21667
21667
|
|
|
21668
21668
|
|
|
21669
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21669
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkJOHVSCHTcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21670
21670
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21671
21671
|
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
21672
21672
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21689,7 +21689,7 @@ var IMAGE_MIME = {
|
|
|
21689
21689
|
svg: "image/svg+xml"
|
|
21690
21690
|
};
|
|
21691
21691
|
function parseXml3(text) {
|
|
21692
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21692
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkJOHVSCHTcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21693
21693
|
}
|
|
21694
21694
|
function getAttr2(el, name) {
|
|
21695
21695
|
const attrs = el.attributes;
|
|
@@ -21756,7 +21756,7 @@ async function slideParts(zip) {
|
|
|
21756
21756
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21757
21757
|
ordered.push(...names);
|
|
21758
21758
|
}
|
|
21759
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21759
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21760
21760
|
return ordered;
|
|
21761
21761
|
}
|
|
21762
21762
|
function paragraphText(p) {
|
|
@@ -21767,12 +21767,12 @@ function paragraphText(p) {
|
|
|
21767
21767
|
const t = findChildByLocalName(child, "t");
|
|
21768
21768
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21769
21769
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21770
|
-
if (t) text +=
|
|
21770
|
+
if (t) text += _chunkZEVEVTRGcjs.wrapScript.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, _chunkZEVEVTRGcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21771
21771
|
} else if (name === "br") {
|
|
21772
21772
|
text += " ";
|
|
21773
21773
|
}
|
|
21774
21774
|
}
|
|
21775
|
-
return
|
|
21775
|
+
return _chunkZEVEVTRGcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21776
21776
|
}
|
|
21777
21777
|
function bodyParagraphs(txBody) {
|
|
21778
21778
|
const out = [];
|
|
@@ -21833,7 +21833,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21833
21833
|
});
|
|
21834
21834
|
return cells;
|
|
21835
21835
|
});
|
|
21836
|
-
const table2 =
|
|
21836
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21837
21837
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21838
21838
|
return { type: "table", table: table2, pageNumber: page };
|
|
21839
21839
|
}
|
|
@@ -21846,7 +21846,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21846
21846
|
if (!filename) {
|
|
21847
21847
|
const file = ctx.zip.file(rel.target);
|
|
21848
21848
|
if (!file) return null;
|
|
21849
|
-
const ext =
|
|
21849
|
+
const ext = _chunkJOHVSCHTcjs.partExtension.call(void 0, rel.target);
|
|
21850
21850
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21851
21851
|
try {
|
|
21852
21852
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21924,10 +21924,10 @@ async function notesText(zip, rels) {
|
|
|
21924
21924
|
return texts.join(" ");
|
|
21925
21925
|
}
|
|
21926
21926
|
async function parsePptxDocument(buffer, options) {
|
|
21927
|
-
|
|
21927
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE6, MAX_ZIP_ENTRIES2, { re: MEDIA_PART_RE2, skip: _optionalChain([options, 'optionalAccess', _334 => _334.images]) === false, never: NEVER_READ_RE2 });
|
|
21928
21928
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21929
21929
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21930
|
-
throw new (0,
|
|
21930
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21931
21931
|
}
|
|
21932
21932
|
const warnings = [];
|
|
21933
21933
|
const blocks = [];
|
|
@@ -21974,7 +21974,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
21974
21974
|
}
|
|
21975
21975
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
21976
21976
|
return {
|
|
21977
|
-
markdown:
|
|
21977
|
+
markdown: _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
21978
21978
|
blocks,
|
|
21979
21979
|
metadata,
|
|
21980
21980
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -21990,11 +21990,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
21990
21990
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
21991
21991
|
function parseHwpmlDocument(buffer, options) {
|
|
21992
21992
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
21993
|
-
throw new (0,
|
|
21993
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
21994
21994
|
}
|
|
21995
21995
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
21996
21996
|
const normalized = text.replace(/ /g, " ");
|
|
21997
|
-
const xml =
|
|
21997
|
+
const xml = _chunkJOHVSCHTcjs.stripDtd.call(void 0, normalized);
|
|
21998
21998
|
const warnings = [];
|
|
21999
21999
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22000
22000
|
onError: (_level, msg2) => {
|
|
@@ -22034,7 +22034,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22034
22034
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22035
22035
|
}
|
|
22036
22036
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22037
|
-
const markdown =
|
|
22037
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22038
22038
|
return {
|
|
22039
22039
|
markdown,
|
|
22040
22040
|
blocks,
|
|
@@ -22141,7 +22141,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22141
22141
|
if (tag === "CHAR") {
|
|
22142
22142
|
for (const c of Array.from(el.childNodes)) {
|
|
22143
22143
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22144
|
-
if (t) parts.push(
|
|
22144
|
+
if (t) parts.push(_chunkZEVEVTRGcjs.escapeLiteralTags.call(void 0, t));
|
|
22145
22145
|
}
|
|
22146
22146
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22147
22147
|
} else if (tag === "AUTONUM") {
|
|
@@ -22201,7 +22201,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22201
22201
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22202
22202
|
cellRows[r].push(cell2);
|
|
22203
22203
|
}
|
|
22204
|
-
const table2 =
|
|
22204
|
+
const table2 = _chunkZEVEVTRGcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22205
22205
|
if (structured.length > 0) {
|
|
22206
22206
|
const claimed = /* @__PURE__ */ new Set();
|
|
22207
22207
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -23964,7 +23964,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
23964
23964
|
};
|
|
23965
23965
|
}
|
|
23966
23966
|
async function extractClickHereFields(hwpxBuffer) {
|
|
23967
|
-
|
|
23967
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
23968
23968
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
23969
23969
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
23970
23970
|
const fields = [];
|
|
@@ -24000,7 +24000,7 @@ function readZipEntries(buf) {
|
|
|
24000
24000
|
}
|
|
24001
24001
|
function localDataStart(view, localOffset) {
|
|
24002
24002
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24003
|
-
throw new (0,
|
|
24003
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24004
24004
|
}
|
|
24005
24005
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24006
24006
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24030,19 +24030,19 @@ function parseCentralDirectory(buf) {
|
|
|
24030
24030
|
}
|
|
24031
24031
|
}
|
|
24032
24032
|
}
|
|
24033
|
-
if (eocdOffset < 0) throw new (0,
|
|
24033
|
+
if (eocdOffset < 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24034
24034
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24035
24035
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24036
24036
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24037
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24037
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24038
24038
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24039
|
-
throw new (0,
|
|
24039
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24040
24040
|
}
|
|
24041
24041
|
const decoder = new TextDecoder("utf-8");
|
|
24042
24042
|
const entries = [];
|
|
24043
24043
|
let pos = cdOffset;
|
|
24044
24044
|
for (let i = 0; i < totalEntries; i++) {
|
|
24045
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24045
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24046
24046
|
const flags = view.getUint16(pos + 8, true);
|
|
24047
24047
|
const method = view.getUint16(pos + 10, true);
|
|
24048
24048
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24053,7 +24053,7 @@ function parseCentralDirectory(buf) {
|
|
|
24053
24053
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24054
24054
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24055
24055
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24056
|
-
throw new (0,
|
|
24056
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24057
24057
|
}
|
|
24058
24058
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24059
24059
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24082,11 +24082,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24082
24082
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24083
24083
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24084
24084
|
for (const name of replacements.keys()) {
|
|
24085
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24085
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24086
24086
|
}
|
|
24087
24087
|
if (additions) {
|
|
24088
24088
|
for (const name of additions.keys()) {
|
|
24089
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24089
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24090
24090
|
}
|
|
24091
24091
|
}
|
|
24092
24092
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24105,7 +24105,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24105
24105
|
offset += seg.length;
|
|
24106
24106
|
continue;
|
|
24107
24107
|
}
|
|
24108
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24108
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkJOHVSCHTcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24109
24109
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24110
24110
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24111
24111
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24113,7 +24113,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24113
24113
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24114
24114
|
const method = e.method;
|
|
24115
24115
|
if (method !== 0 && method !== 8) {
|
|
24116
|
-
throw new (0,
|
|
24116
|
+
throw new (0, _chunkJOHVSCHTcjs.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`);
|
|
24117
24117
|
}
|
|
24118
24118
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24119
24119
|
const crc = crc32(newData);
|
|
@@ -24211,11 +24211,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24211
24211
|
// src/form/filler-hwpx.ts
|
|
24212
24212
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24213
24213
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24214
|
-
|
|
24214
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24215
24215
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24216
24216
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24217
24217
|
if (sectionPaths.length === 0) {
|
|
24218
|
-
throw new (0,
|
|
24218
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24219
24219
|
}
|
|
24220
24220
|
const warnings = [];
|
|
24221
24221
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24607,7 +24607,7 @@ var MIN_SIDE = 24;
|
|
|
24607
24607
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24608
24608
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24609
24609
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24610
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24610
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-YUVG57VO.cjs")));
|
|
24611
24611
|
let inserted = false, unreadable = 0;
|
|
24612
24612
|
let failed = null;
|
|
24613
24613
|
const walk = async (list, depth) => {
|
|
@@ -24648,7 +24648,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24648
24648
|
function ocrBytes(img) {
|
|
24649
24649
|
const mime = img.mimeType.toLowerCase();
|
|
24650
24650
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24651
|
-
if (mime.includes("bmp")) return
|
|
24651
|
+
if (mime.includes("bmp")) return _chunkGZEVDQ7Scjs.bmpToPng.call(void 0, img.data);
|
|
24652
24652
|
return img.data;
|
|
24653
24653
|
}
|
|
24654
24654
|
async function tooSmall(bytes) {
|
|
@@ -24817,7 +24817,7 @@ function classifyTableTree(blocks) {
|
|
|
24817
24817
|
return blocks;
|
|
24818
24818
|
}
|
|
24819
24819
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24820
|
-
const structured = hasMerged(table2) ||
|
|
24820
|
+
const structured = hasMerged(table2) || _chunkZEVEVTRGcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24821
24821
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24822
24822
|
return structured ? "html" : "gfm";
|
|
24823
24823
|
}
|
|
@@ -35903,7 +35903,7 @@ function findAgency(name) {
|
|
|
35903
35903
|
}
|
|
35904
35904
|
function agencyStyle(name) {
|
|
35905
35905
|
const s = findAgency(name);
|
|
35906
|
-
if (!s) throw new (0,
|
|
35906
|
+
if (!s) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35907
35907
|
return s;
|
|
35908
35908
|
}
|
|
35909
35909
|
function applyAgency(opts, preset) {
|
|
@@ -36967,7 +36967,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36967
36967
|
}
|
|
36968
36968
|
function assertFiniteRange(name, value, min, max) {
|
|
36969
36969
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36970
|
-
throw new (0,
|
|
36970
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36971
36971
|
}
|
|
36972
36972
|
}
|
|
36973
36973
|
function validateGongmunOptions(opts) {
|
|
@@ -36985,10 +36985,10 @@ function validateGongmunOptions(opts) {
|
|
|
36985
36985
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36986
36986
|
}
|
|
36987
36987
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36988
|
-
throw new (0,
|
|
36988
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36989
36989
|
}
|
|
36990
36990
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36991
|
-
throw new (0,
|
|
36991
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36992
36992
|
}
|
|
36993
36993
|
}
|
|
36994
36994
|
if (opts.sizes) {
|
|
@@ -36997,24 +36997,24 @@ function validateGongmunOptions(opts) {
|
|
|
36997
36997
|
}
|
|
36998
36998
|
}
|
|
36999
36999
|
if (opts.approval && opts.approval.length > 6) {
|
|
37000
|
-
throw new (0,
|
|
37000
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("approval must contain at most 6 labels");
|
|
37001
37001
|
}
|
|
37002
37002
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
37003
37003
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
37004
37004
|
for (const n of nums) {
|
|
37005
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
37005
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
37006
37006
|
}
|
|
37007
37007
|
}
|
|
37008
37008
|
if (opts.levels) {
|
|
37009
37009
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
37010
37010
|
const depth = Number(key);
|
|
37011
37011
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
37012
|
-
throw new (0,
|
|
37012
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
37013
37013
|
}
|
|
37014
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
37014
|
+
if (!st || typeof st !== "object") throw new (0, _chunkJOHVSCHTcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
37015
37015
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
37016
37016
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
37017
|
-
throw new (0,
|
|
37017
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
37018
37018
|
}
|
|
37019
37019
|
}
|
|
37020
37020
|
}
|
|
@@ -37072,7 +37072,7 @@ function resolveChecklist(c, preset) {
|
|
|
37072
37072
|
function hexColorOption(name, value) {
|
|
37073
37073
|
if (value === void 0) return void 0;
|
|
37074
37074
|
const v = value.trim();
|
|
37075
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37075
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37076
37076
|
return v.toUpperCase();
|
|
37077
37077
|
}
|
|
37078
37078
|
function resolveGongmun(input) {
|
|
@@ -37148,21 +37148,21 @@ function standardMarker(depth, n) {
|
|
|
37148
37148
|
case 0:
|
|
37149
37149
|
return `${n + 1}.`;
|
|
37150
37150
|
case 1:
|
|
37151
|
-
return `${
|
|
37151
|
+
return `${_chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37152
37152
|
case 2:
|
|
37153
37153
|
return `${n + 1})`;
|
|
37154
37154
|
case 3:
|
|
37155
|
-
return `${
|
|
37155
|
+
return `${_chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37156
37156
|
case 4:
|
|
37157
37157
|
return `(${n + 1})`;
|
|
37158
37158
|
case 5:
|
|
37159
|
-
return `(${
|
|
37159
|
+
return `(${_chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37160
37160
|
case 6:
|
|
37161
|
-
return
|
|
37161
|
+
return _chunkZEVEVTRGcjs.circledNumber.call(void 0, n);
|
|
37162
37162
|
case 7:
|
|
37163
|
-
return
|
|
37163
|
+
return _chunkZEVEVTRGcjs.circledHangul.call(void 0, n);
|
|
37164
37164
|
default:
|
|
37165
|
-
return
|
|
37165
|
+
return _chunkZEVEVTRGcjs.circledHangul.call(void 0, n);
|
|
37166
37166
|
}
|
|
37167
37167
|
}
|
|
37168
37168
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37816,7 +37816,7 @@ function parseInlineMarkdown(text) {
|
|
|
37816
37816
|
else spans.push(...emphasisSpans(m[0]));
|
|
37817
37817
|
} else {
|
|
37818
37818
|
const anchor = m[2] || m[3];
|
|
37819
|
-
const href = _nullishCoalesce(
|
|
37819
|
+
const href = _nullishCoalesce(_chunkJOHVSCHTcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37820
37820
|
const sub = emphasisSpans(anchor);
|
|
37821
37821
|
if (href) for (const s of sub) s.href = href;
|
|
37822
37822
|
spans.push(...sub);
|
|
@@ -38037,7 +38037,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
38037
38037
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
38038
38038
|
const got = m ? Number(m[1]) : NaN;
|
|
38039
38039
|
if (got !== startId + i) {
|
|
38040
|
-
throw new (0,
|
|
38040
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
38041
38041
|
`\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)`
|
|
38042
38042
|
);
|
|
38043
38043
|
}
|
|
@@ -38128,7 +38128,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38128
38128
|
}
|
|
38129
38129
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38130
38130
|
if (rows.length !== expectedBase) {
|
|
38131
|
-
throw new (0,
|
|
38131
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
38132
38132
|
`\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`
|
|
38133
38133
|
);
|
|
38134
38134
|
}
|
|
@@ -38636,7 +38636,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38636
38636
|
const vi = fit.variants.indexOf(r);
|
|
38637
38637
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38638
38638
|
}
|
|
38639
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) =>
|
|
38639
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunkZEVEVTRGcjs.hangulOrdinal.call(void 0, i)));
|
|
38640
38640
|
function literalMarkerDepth(text) {
|
|
38641
38641
|
const t = text.trimStart();
|
|
38642
38642
|
let m;
|
|
@@ -39137,7 +39137,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39137
39137
|
return best;
|
|
39138
39138
|
}
|
|
39139
39139
|
function normForMatch(text) {
|
|
39140
|
-
return
|
|
39140
|
+
return _chunkZEVEVTRGcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39141
39141
|
}
|
|
39142
39142
|
function unescapeGfm(text) {
|
|
39143
39143
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39159,7 +39159,7 @@ function replicateGfmTable(table2) {
|
|
|
39159
39159
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39160
39160
|
if (!cell2) continue;
|
|
39161
39161
|
display[r][c] = {
|
|
39162
|
-
text:
|
|
39162
|
+
text: _chunkZEVEVTRGcjs.escapeGfm.call(void 0, _chunkZEVEVTRGcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39163
39163
|
gridR: r,
|
|
39164
39164
|
gridC: c
|
|
39165
39165
|
};
|
|
@@ -39199,16 +39199,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39199
39199
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39200
39200
|
return cell2.blocks.map((b) => {
|
|
39201
39201
|
if (b.type === "table" && b.table) {
|
|
39202
|
-
const cap = b.table.caption ?
|
|
39203
|
-
return (cap ?
|
|
39202
|
+
const cap = b.table.caption ? _chunkZEVEVTRGcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39203
|
+
return (cap ? _chunkZEVEVTRGcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39204
39204
|
}
|
|
39205
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39206
|
-
const note =
|
|
39207
|
-
const t = (
|
|
39208
|
-
return ((t ?
|
|
39205
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkJOHVSCHTcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39206
|
+
const note = _chunkZEVEVTRGcjs.noteTableHtml.call(void 0, b);
|
|
39207
|
+
const t = (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, _chunkZEVEVTRGcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkZEVEVTRGcjs.noteSuffix.call(void 0, b))).trim();
|
|
39208
|
+
return ((t ? _chunkZEVEVTRGcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39209
39209
|
}).filter(Boolean).join("<br>");
|
|
39210
39210
|
}
|
|
39211
|
-
return
|
|
39211
|
+
return _chunkZEVEVTRGcjs.escapeHtmlCellText.call(void 0, _chunkZEVEVTRGcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39212
39212
|
}
|
|
39213
39213
|
function replicateTableToHtml(table2) {
|
|
39214
39214
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39285,7 +39285,7 @@ function parseHtmlTable(raw) {
|
|
|
39285
39285
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39286
39286
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39287
39287
|
cellStart = m.index + m[0].length;
|
|
39288
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39288
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkZEVEVTRGcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkZEVEVTRGcjs.MAX_ROWS) };
|
|
39289
39289
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39290
39290
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39291
39291
|
cellStart = -1;
|
|
@@ -39310,11 +39310,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39310
39310
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39311
39311
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39312
39312
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39313
|
-
if (src) imgSrcs.push(
|
|
39313
|
+
if (src) imgSrcs.push(_chunkJOHVSCHTcjs.unescapeHtml.call(void 0, src));
|
|
39314
39314
|
return "";
|
|
39315
39315
|
});
|
|
39316
39316
|
}
|
|
39317
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39317
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkJOHVSCHTcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39318
39318
|
return { lines, hadNonText, imgSrcs };
|
|
39319
39319
|
}
|
|
39320
39320
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40130,8 +40130,8 @@ function layoutHtmlRows(rows) {
|
|
|
40130
40130
|
let c = 0;
|
|
40131
40131
|
for (const cell2 of rows[r].cells) {
|
|
40132
40132
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40133
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40134
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40133
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkZEVEVTRGcjs.MAX_COLS);
|
|
40134
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkZEVEVTRGcjs.MAX_ROWS);
|
|
40135
40135
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40136
40136
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40137
40137
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41595,7 +41595,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41595
41595
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41596
41596
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41597
41597
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41598
|
-
const runs = ministryRuns(
|
|
41598
|
+
const runs = ministryRuns(_chunkZEVEVTRGcjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41599
41599
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41600
41600
|
const cell2 = tc({ bf: band, row: 0, col: 0, w, h: s.h, paras: `<hp:p paraPrIDRef="${p}" styleIDRef="0">${runs}</hp:p>`, name: "__kordoc_h5" });
|
|
41601
41601
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42466,7 +42466,7 @@ function builtinTemplateDir() {
|
|
|
42466
42466
|
for (const c of candidates) {
|
|
42467
42467
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42468
42468
|
}
|
|
42469
|
-
throw new (0,
|
|
42469
|
+
throw new (0, _chunkJOHVSCHTcjs.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)");
|
|
42470
42470
|
}
|
|
42471
42471
|
function readBuiltinTemplate(t) {
|
|
42472
42472
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42944,12 +42944,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42944
42944
|
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>`;
|
|
42945
42945
|
}
|
|
42946
42946
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42947
|
-
if (ops.length === 0) throw new (0,
|
|
42947
|
+
if (ops.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42948
42948
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42949
|
-
|
|
42949
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42950
42950
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42951
42951
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _858 => _858.match, 'call', _859 => _859(/(\d+)\.xml$/i), 'optionalAccess', _860 => _860[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _861 => _861.match, 'call', _862 => _862(/(\d+)\.xml$/i), 'optionalAccess', _863 => _863[1]]), () => ( 0))));
|
|
42952
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42952
|
+
if (sectionPaths.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42953
42953
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42954
42954
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42955
42955
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42990,11 +42990,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42990
42990
|
const manifestItems = [];
|
|
42991
42991
|
const placed = [];
|
|
42992
42992
|
for (const op of ops) {
|
|
42993
|
-
if (!op.anchor) throw new (0,
|
|
42994
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42993
|
+
if (!op.anchor) throw new (0, _chunkJOHVSCHTcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42994
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42995
42995
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42996
|
-
if (!MIME[ext]) throw new (0,
|
|
42997
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42996
|
+
if (!MIME[ext]) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42997
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkJOHVSCHTcjs.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)`);
|
|
42998
42998
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42999
42999
|
let found = null;
|
|
43000
43000
|
let total = 0;
|
|
@@ -43027,7 +43027,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
43027
43027
|
}
|
|
43028
43028
|
}
|
|
43029
43029
|
}
|
|
43030
|
-
throw new (0,
|
|
43030
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
43031
43031
|
`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)})`
|
|
43032
43032
|
);
|
|
43033
43033
|
}
|
|
@@ -43035,7 +43035,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
43035
43035
|
const xml = sectionXmls[si];
|
|
43036
43036
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
43037
43037
|
if (!run) {
|
|
43038
|
-
throw new (0,
|
|
43038
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
43039
43039
|
}
|
|
43040
43040
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _864 => _864.charPr, 'access', _865 => _865.get, 'call', _866 => _866(run.charPr), 'optionalAccess', _867 => _867.height]), () => ( 1e3));
|
|
43041
43041
|
const fontPt = charPrHeight / 100;
|
|
@@ -43313,7 +43313,7 @@ function pick(map, keys) {
|
|
|
43313
43313
|
return out;
|
|
43314
43314
|
}
|
|
43315
43315
|
async function hwpxToProfile(input) {
|
|
43316
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43316
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, input);
|
|
43317
43317
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43318
43318
|
const parser = createXmlParser();
|
|
43319
43319
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _892 => _892.file, 'call', _893 => _893(/[Hh]eader\.xml$/), 'optionalAccess', _894 => _894[0]])));
|
|
@@ -43615,7 +43615,7 @@ function moneyHangulCheck(m) {
|
|
|
43615
43615
|
const n = Number(m[1].replace(/,/g, ""));
|
|
43616
43616
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
43617
43617
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
43618
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${
|
|
43618
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunkZEVEVTRGcjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
43619
43619
|
}
|
|
43620
43620
|
var RULES = [
|
|
43621
43621
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -43902,7 +43902,7 @@ function lintGongmunText(text, opts) {
|
|
|
43902
43902
|
}
|
|
43903
43903
|
function dictSuggest(code, match) {
|
|
43904
43904
|
const m = match.trim();
|
|
43905
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${
|
|
43905
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunkZEVEVTRGcjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
43906
43906
|
if (code === "DATE_HYPHEN") {
|
|
43907
43907
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
43908
43908
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -44286,7 +44286,7 @@ function patchTableRows(input) {
|
|
|
44286
44286
|
const cells = input.editedCells(ins.ei);
|
|
44287
44287
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44288
44288
|
for (const cell2 of cells) {
|
|
44289
|
-
const unstable = cell2.lines.find((l) =>
|
|
44289
|
+
const unstable = cell2.lines.find((l) => _chunkZEVEVTRGcjs.sanitizeText.call(void 0, l) !== l);
|
|
44290
44290
|
if (unstable !== void 0) return skip("\uC0BD\uC785 \uD589\uC5D0 \uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
44291
44291
|
}
|
|
44292
44292
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44481,14 +44481,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44481
44481
|
}
|
|
44482
44482
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44483
44483
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44484
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44484
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkZEVEVTRGcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44485
44485
|
const splices = [];
|
|
44486
44486
|
let offset = 0;
|
|
44487
44487
|
for (let i = 0; i < lines.length; i++) {
|
|
44488
44488
|
const line = lines[i];
|
|
44489
44489
|
const orig = line.trim();
|
|
44490
44490
|
const next = newLines[i];
|
|
44491
|
-
if (
|
|
44491
|
+
if (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44492
44492
|
let prefix = 0;
|
|
44493
44493
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44494
44494
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44888,12 +44888,12 @@ function stripCellTokens(text) {
|
|
|
44888
44888
|
}
|
|
44889
44889
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44890
44890
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44891
|
-
const content =
|
|
44891
|
+
const content = _chunkZEVEVTRGcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44892
44892
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44893
44893
|
const t = line.trim();
|
|
44894
44894
|
if (!t) return "";
|
|
44895
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44896
|
-
return
|
|
44895
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkZEVEVTRGcjs.escapeGfm.call(void 0, t)}**`;
|
|
44896
|
+
return _chunkZEVEVTRGcjs.escapeGfm.call(void 0, t);
|
|
44897
44897
|
}).filter(Boolean);
|
|
44898
44898
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
44899
44899
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44907,7 +44907,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44907
44907
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44908
44908
|
const replica = [];
|
|
44909
44909
|
for (let r = 0; r < table2.rows; r++) {
|
|
44910
|
-
const line =
|
|
44910
|
+
const line = _chunkZEVEVTRGcjs.escapeGfm.call(void 0, _chunkZEVEVTRGcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44911
44911
|
if (line) replica.push({ line, gridR: r });
|
|
44912
44912
|
}
|
|
44913
44913
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -44961,7 +44961,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44961
44961
|
}
|
|
44962
44962
|
const splices = [];
|
|
44963
44963
|
let sectionIndex = -1;
|
|
44964
|
-
const unstable = newLines.find((l) =>
|
|
44964
|
+
const unstable = newLines.find((l) => _chunkZEVEVTRGcjs.sanitizeText.call(void 0, l) !== l);
|
|
44965
44965
|
if (unstable !== void 0) 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");
|
|
44966
44966
|
if (nonEmpty.length === 0) {
|
|
44967
44967
|
if (newLines.length === 0) return 0;
|
|
@@ -45085,7 +45085,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45085
45085
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45086
45086
|
if (paths.length > 0) return paths;
|
|
45087
45087
|
}
|
|
45088
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45088
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkJOHVSCHTcjs.compareSectionPaths);
|
|
45089
45089
|
}
|
|
45090
45090
|
|
|
45091
45091
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45872,7 +45872,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45872
45872
|
}
|
|
45873
45873
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45874
45874
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
45875
|
-
if (
|
|
45875
|
+
if (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45876
45876
|
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");
|
|
45877
45877
|
}
|
|
45878
45878
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45919,7 +45919,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45919
45919
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45920
45920
|
continue;
|
|
45921
45921
|
}
|
|
45922
|
-
if (afterEach.some((l) =>
|
|
45922
|
+
if (afterEach.some((l) => _chunkZEVEVTRGcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45923
45923
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45924
45924
|
continue;
|
|
45925
45925
|
}
|
|
@@ -45947,7 +45947,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45947
45947
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45948
45948
|
break;
|
|
45949
45949
|
}
|
|
45950
|
-
if (
|
|
45950
|
+
if (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45951
45951
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45952
45952
|
break;
|
|
45953
45953
|
}
|
|
@@ -46003,12 +46003,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
46003
46003
|
}
|
|
46004
46004
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
46005
46005
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
46006
|
-
const content =
|
|
46006
|
+
const content = _chunkZEVEVTRGcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
46007
46007
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
46008
46008
|
const t = line.trim();
|
|
46009
46009
|
if (!t) return "";
|
|
46010
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
46011
|
-
return
|
|
46010
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkZEVEVTRGcjs.escapeGfm.call(void 0, t)}**`;
|
|
46011
|
+
return _chunkZEVEVTRGcjs.escapeGfm.call(void 0, t);
|
|
46012
46012
|
}).filter(Boolean);
|
|
46013
46013
|
if (replicaLines.join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
46014
46014
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46022,7 +46022,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
46022
46022
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
46023
46023
|
const replica = [];
|
|
46024
46024
|
for (let r = 0; r < table2.rows; r++) {
|
|
46025
|
-
const line =
|
|
46025
|
+
const line = _chunkZEVEVTRGcjs.escapeGfm.call(void 0, _chunkZEVEVTRGcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
46026
46026
|
if (line) replica.push({ line, gridR: r });
|
|
46027
46027
|
}
|
|
46028
46028
|
if (replica.map((x) => x.line).join("\n") !== orig.lines.join("\n")) return skip("\uD45C \uC88C\uD45C \uC7AC\uD604 \uBD88\uC77C\uCE58 \u2014 \uB9E4\uD551 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
@@ -46063,7 +46063,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46063
46063
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46064
46064
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46065
46065
|
}
|
|
46066
|
-
const unstable = newLines.find((l) =>
|
|
46066
|
+
const unstable = newLines.find((l) => _chunkZEVEVTRGcjs.sanitizeText.call(void 0, l) !== l);
|
|
46067
46067
|
if (unstable !== void 0) 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");
|
|
46068
46068
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46069
46069
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46465,12 +46465,12 @@ function buildOrigUnits(blocks) {
|
|
|
46465
46465
|
const block = blocks[i];
|
|
46466
46466
|
let consume = 1;
|
|
46467
46467
|
let chunk;
|
|
46468
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46468
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkZEVEVTRGcjs.sanitizeText.call(void 0, block.text))) {
|
|
46469
46469
|
const next = blocks[i + 1];
|
|
46470
46470
|
if (_optionalChain([next, 'optionalAccess', _969 => _969.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46471
|
-
chunk =
|
|
46471
|
+
chunk = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46472
46472
|
} else {
|
|
46473
|
-
chunk =
|
|
46473
|
+
chunk = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, [block]);
|
|
46474
46474
|
}
|
|
46475
46475
|
if (chunk) {
|
|
46476
46476
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -46754,7 +46754,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46754
46754
|
}
|
|
46755
46755
|
}
|
|
46756
46756
|
if (newPlain === origPlain) return skip("\uD14D\uC2A4\uD2B8 \uC678 \uBCC0\uACBD(\uD5E4\uB529 \uB808\uBCA8/\uC11C\uC2DD)\uB9CC \uAC10\uC9C0 \u2014 \uC2A4\uD0C0\uC77C \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
46757
|
-
if (
|
|
46757
|
+
if (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkZEVEVTRGcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46758
46758
|
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");
|
|
46759
46759
|
}
|
|
46760
46760
|
const xml = _optionalChain([ctx, 'access', _981 => _981.scans, 'access', _982 => _982[mapping.para.sectionIndex], 'optionalAccess', _983 => _983.xml]);
|
|
@@ -46771,14 +46771,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46771
46771
|
}
|
|
46772
46772
|
function textUnitInline(raw, block) {
|
|
46773
46773
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46774
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46774
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkZEVEVTRGcjs.sanitizeText.call(void 0, block.text))) {
|
|
46775
46775
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46776
46776
|
}
|
|
46777
46777
|
if (block.href) {
|
|
46778
46778
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46779
46779
|
if (linkMatch) text = linkMatch[1];
|
|
46780
46780
|
}
|
|
46781
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46781
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkZEVEVTRGcjs.sanitizeText.call(void 0, block.text))) {
|
|
46782
46782
|
text = text.slice(1, -1);
|
|
46783
46783
|
}
|
|
46784
46784
|
return text;
|
|
@@ -49326,7 +49326,7 @@ function blocksToChunks(blocks, options) {
|
|
|
49326
49326
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1014 => _1014.granularity]), () => ( "section"));
|
|
49327
49327
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1015 => _1015.includeTableCells]), () => ( false));
|
|
49328
49328
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1016 => _1016.tableFormat]) };
|
|
49329
|
-
if (_optionalChain([options, 'optionalAccess', _1017 => _1017.tableFormat]) === "gfm")
|
|
49329
|
+
if (_optionalChain([options, 'optionalAccess', _1017 => _1017.tableFormat]) === "gfm") _chunkZEVEVTRGcjs.assignTableIds.call(void 0, blocks);
|
|
49330
49330
|
const chunks = [];
|
|
49331
49331
|
const headingStack = [];
|
|
49332
49332
|
const listStack = [];
|
|
@@ -49340,12 +49340,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49340
49340
|
let run = null;
|
|
49341
49341
|
const flushRun = () => {
|
|
49342
49342
|
if (!run) return;
|
|
49343
|
-
push("text", run.breadcrumb,
|
|
49343
|
+
push("text", run.breadcrumb, _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49344
49344
|
run = null;
|
|
49345
49345
|
};
|
|
49346
49346
|
for (let i = 0; i < blocks.length; i++) {
|
|
49347
49347
|
const block = blocks[i];
|
|
49348
|
-
const md2 =
|
|
49348
|
+
const md2 = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49349
49349
|
if (!md2) continue;
|
|
49350
49350
|
if (block.type === "heading") {
|
|
49351
49351
|
flushRun();
|
|
@@ -49433,7 +49433,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49433
49433
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49434
49434
|
}
|
|
49435
49435
|
function irCellLines(text) {
|
|
49436
|
-
return stripCellTokens(
|
|
49436
|
+
return stripCellTokens(_chunkZEVEVTRGcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49437
49437
|
}
|
|
49438
49438
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49439
49439
|
|
|
@@ -49693,7 +49693,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49693
49693
|
if (newPlain === "") {
|
|
49694
49694
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49695
49695
|
}
|
|
49696
|
-
if (
|
|
49696
|
+
if (_chunkZEVEVTRGcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49697
49697
|
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");
|
|
49698
49698
|
}
|
|
49699
49699
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1037 => _1037.scans, 'access', _1038 => _1038[mapping.para.sectionIndex], 'optionalAccess', _1039 => _1039.xml]));
|
|
@@ -49788,7 +49788,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
49788
49788
|
});
|
|
49789
49789
|
var SAFE_RAW_TAG = /^(?:<\/?(?:table|thead|tbody|tfoot|tr|th|td|u)>|<br\s*\/?>|<(?:th|td)(?: (?:colspan|rowspan)="[1-9]\d*"){1,2}>|<img src="(?:images\/(?:[^"'<>\/\s]+\/)?)?image_\d+\.(?:png|jpe?g|gif|webp|bmp)" alt="image">)$/i;
|
|
49790
49790
|
function sanitizeRawHtml(raw) {
|
|
49791
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49791
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkJOHVSCHTcjs.escapeHtml.call(void 0, tag));
|
|
49792
49792
|
}
|
|
49793
49793
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49794
49794
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -49796,7 +49796,7 @@ function renderHtml(markdown, options) {
|
|
|
49796
49796
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1043 => _1043.preset]), () => ( "default"));
|
|
49797
49797
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1044 => _1044.extraCss]), () => ( "")));
|
|
49798
49798
|
const body = md.render(markdown);
|
|
49799
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1045 => _1045.watermark]) ? `<div class="watermark">${
|
|
49799
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1045 => _1045.watermark]) ? `<div class="watermark">${_chunkJOHVSCHTcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49800
49800
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1046 => _1046.watermark]) ? `
|
|
49801
49801
|
.watermark {
|
|
49802
49802
|
position: fixed;
|
|
@@ -49850,13 +49850,13 @@ async function htmlToPdf(html, options) {
|
|
|
49850
49850
|
try {
|
|
49851
49851
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49852
49852
|
} catch (e42) {
|
|
49853
|
-
throw new (0,
|
|
49853
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
49854
49854
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49855
49855
|
);
|
|
49856
49856
|
}
|
|
49857
49857
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49858
49858
|
if (!executablePath) {
|
|
49859
|
-
throw new (0,
|
|
49859
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
49860
49860
|
"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."
|
|
49861
49861
|
);
|
|
49862
49862
|
}
|
|
@@ -49911,7 +49911,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49911
49911
|
return htmlToPdf(html, options);
|
|
49912
49912
|
}
|
|
49913
49913
|
async function blocksToPdf(blocks, options) {
|
|
49914
|
-
const markdown =
|
|
49914
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks);
|
|
49915
49915
|
return markdownToPdf(markdown, options);
|
|
49916
49916
|
}
|
|
49917
49917
|
|
|
@@ -49983,11 +49983,11 @@ function longestPathBoundaries(constraints, count) {
|
|
|
49983
49983
|
}
|
|
49984
49984
|
return { x, tight: x.map((v, k) => Math.abs(v + y[k] - x[count]) <= 2) };
|
|
49985
49985
|
}
|
|
49986
|
-
function tableColumnBoundaries(constraints, count, total) {
|
|
49986
|
+
function tableColumnBoundaries(constraints, count, total, noExactRow = false) {
|
|
49987
49987
|
const prop = solveBoundaries(constraints, count, total);
|
|
49988
49988
|
if (!total || total <= 0) return prop;
|
|
49989
49989
|
const lp = longestPathBoundaries(constraints, count);
|
|
49990
|
-
return lp && Math.abs(lp.x[count] - total) <= 2 && lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k]) ? lp.x : prop;
|
|
49990
|
+
return lp && Math.abs(lp.x[count] - total) <= 2 && (noExactRow || lp.x.every((v, k) => Math.abs(v - prop[k]) <= 2 || lp.tight[k])) ? lp.x : prop;
|
|
49991
49991
|
}
|
|
49992
49992
|
function solveRowHeights(cells, rowCount, maxTotal = Number.POSITIVE_INFINITY) {
|
|
49993
49993
|
const h = new Array(rowCount).fill(0);
|
|
@@ -50174,8 +50174,11 @@ function buildPara(p) {
|
|
|
50174
50174
|
} else if (OBJ_TAGS.has(cn)) {
|
|
50175
50175
|
const sz = findChildByLocalName(ch, "sz");
|
|
50176
50176
|
const pos = findChildByLocalName(ch, "pos");
|
|
50177
|
-
const
|
|
50178
|
-
const
|
|
50177
|
+
const cur = findChildByLocalName(ch, "curSz");
|
|
50178
|
+
const rot = num2(findChildByLocalName(ch, "rotationInfo"), "angle") % 360;
|
|
50179
|
+
const box = findChildByLocalName(ch, "drawText") && !rot && num2(cur, "width") > 0 && num2(cur, "height") > 0 && num2(cur, "height") < 2 ** 31;
|
|
50180
|
+
const w = box ? num2(cur, "width") : num2(sz, "width") || num2(cur, "width") || num2(findChildByLocalName(ch, "orgSz"), "width");
|
|
50181
|
+
const h = box ? num2(cur, "height") : num2(sz, "height") || num2(cur, "height") || num2(findChildByLocalName(ch, "orgSz"), "height");
|
|
50179
50182
|
const inline = _optionalChain([pos, 'optionalAccess', _1058 => _1058.getAttribute, 'call', _1059 => _1059("treatAsChar")]) === "1";
|
|
50180
50183
|
const om = inline ? findChildByLocalName(ch, "outMargin") : null;
|
|
50181
50184
|
if (!deleted) objs.push({
|
|
@@ -50291,7 +50294,8 @@ function cellContentExtent(cell2, memo) {
|
|
|
50291
50294
|
const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
|
|
50292
50295
|
const anchor = pushed >= -100 ? pushed : baseV - (_nullishCoalesce(_optionalChain([memo, 'optionalAccess', _1069 => _1069.paraGeom, 'optionalAccess', _1070 => _1070.get, 'call', _1071 => _1071(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1072 => _1072.spaceBefore]), () => ( 0)));
|
|
50293
50296
|
const vo = num2(pos, "vertOffset");
|
|
50294
|
-
|
|
50297
|
+
const oh = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
|
|
50298
|
+
ext = Math.max(ext, anchor + num2(om, "top") + Math.max(0, vo) + oh);
|
|
50295
50299
|
}
|
|
50296
50300
|
}
|
|
50297
50301
|
_optionalChain([memo, 'optionalAccess', _1073 => _1073.cell, 'access', _1074 => _1074.set, 'call', _1075 => _1075(cell2.el, ext)]);
|
|
@@ -50714,7 +50718,7 @@ function reflowSubListsIn(p, doc, styles, mode, counter, flow, noteW = counter.b
|
|
|
50714
50718
|
}
|
|
50715
50719
|
if (t === "drawText" || t === "caption") {
|
|
50716
50720
|
const sub = findChildByLocalName(ch, "subList"), tm = findChildByLocalName(ch, "textMargin");
|
|
50717
|
-
const textW2 = num2(ch, "lastWidth") || (t === "caption" ? num2(ch, "width") :
|
|
50721
|
+
const textW2 = num2(ch, "lastWidth") || (t === "caption" ? num2(ch, "width") : num2(findChildByLocalName(el, "sz"), "width"));
|
|
50718
50722
|
const w = textW2 - num2(tm, "left") - num2(tm, "right");
|
|
50719
50723
|
if (sub && w > 0) flow(sub, doc, styles, w, mode, counter, 0);
|
|
50720
50724
|
continue;
|
|
@@ -50936,6 +50940,7 @@ var isJamoV = (cp) => cp >= 4448 && cp <= 4519 || cp >= 55216 && cp <= 55238;
|
|
|
50936
50940
|
var isJamoT = (cp) => cp >= 4520 && cp <= 4607 || cp >= 55243 && cp <= 55291;
|
|
50937
50941
|
var isJamoLV = (cp) => isJamoL(cp) || isJamoV(cp);
|
|
50938
50942
|
var isJamoVT = (cp) => isJamoV(cp) || isJamoT(cp);
|
|
50943
|
+
var joinsJamo = (prevCp, cp) => isJamoVT(cp) && isJamoLV(prevCp);
|
|
50939
50944
|
var isLatinCp = (cp) => cp < 592 || cp >= 7680 && cp < 8192 || cp >= 8216 && cp < 8224;
|
|
50940
50945
|
function hancomLangOf(cp) {
|
|
50941
50946
|
if (isLatinCp(cp)) return "latin";
|
|
@@ -51066,7 +51071,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51066
51071
|
if (c.ch === "") continue;
|
|
51067
51072
|
const st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
51068
51073
|
const cp = c.ch.codePointAt(0);
|
|
51069
|
-
const joins =
|
|
51074
|
+
const joins = joinsJamo(_nullishCoalesce(text.codePointAt(text.length - 1), () => ( 0)), cp);
|
|
51070
51075
|
const { w, sp } = joins ? { w: 0, sp: 0 } : glyphWidth(c.ch, st);
|
|
51071
51076
|
for (let u = 0; u < c.ch.length; u++) {
|
|
51072
51077
|
realIdx.push(i);
|
|
@@ -52117,6 +52122,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52117
52122
|
const st = stackedFloats(rc[0]);
|
|
52118
52123
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52119
52124
|
});
|
|
52125
|
+
if (slack > 0 && ty + rowY[nRows] > pageBottom && ty + rowY[nRows] <= pageBottom + slack && cells.some((c) => cellLineBoxes(c).some((b) => b.part > 0))) slack = 0;
|
|
52120
52126
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52121
52127
|
if (_optionalChain([findChildByLocalName, 'call', _1254 => _1254(tbl2, "pos"), 'optionalAccess', _1255 => _1255.getAttribute, 'call', _1256 => _1256("treatAsChar")]) === "1") {
|
|
52122
52128
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
@@ -52167,6 +52173,14 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52167
52173
|
const boxes = splittable ? new Map(rowCells.map((c) => [c.el, cellLineBoxes(c)])) : void 0;
|
|
52168
52174
|
const hParts = boxes ? Math.max(0, ...[...boxes.values()].flatMap((bs) => bs.map((b) => b.part))) : 0;
|
|
52169
52175
|
if (boxes && hParts > 0) {
|
|
52176
|
+
if (!first && rowCells.some((c) => {
|
|
52177
|
+
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === 0);
|
|
52178
|
+
return !!b && c.marginT + b.bottom - b.origin > pageBottom - y - c.marginB;
|
|
52179
|
+
})) {
|
|
52180
|
+
page++;
|
|
52181
|
+
y = contTop;
|
|
52182
|
+
first = true;
|
|
52183
|
+
}
|
|
52170
52184
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height");
|
|
52171
52185
|
const led = /* @__PURE__ */ new Set();
|
|
52172
52186
|
let firstPh = 0;
|
|
@@ -52241,6 +52255,29 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52241
52255
|
first = false;
|
|
52242
52256
|
continue;
|
|
52243
52257
|
}
|
|
52258
|
+
if (boxes && floatSpan) {
|
|
52259
|
+
let span2 = 0, spanEnd = 0, mB = 0;
|
|
52260
|
+
for (const c of rowCells) for (const b of _nullishCoalesce(boxes.get(c.el), () => ( []))) {
|
|
52261
|
+
const f = floatSpan(b.seg, y + c.marginT + b.top, contTop + c.marginT);
|
|
52262
|
+
if (f && f.pages > span2) {
|
|
52263
|
+
span2 = f.pages;
|
|
52264
|
+
spanEnd = f.endY;
|
|
52265
|
+
mB = c.marginB;
|
|
52266
|
+
}
|
|
52267
|
+
}
|
|
52268
|
+
if (span2 > 0) {
|
|
52269
|
+
const none = new Map(rowCells.map((c) => [c.el, [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY]]));
|
|
52270
|
+
pieces.push({ page, y, h: pageBottom - y, range: new Map(rowCells.map((c) => [c.el, [0, Number.POSITIVE_INFINITY]])), fill: true });
|
|
52271
|
+
for (let e = 1; e < span2; e++) pieces.push({ page: page + e, y: contTop, h: pageBottom - contTop, range: none, fill: true });
|
|
52272
|
+
page += span2;
|
|
52273
|
+
const endH = Math.max(0, spanEnd - contTop) + mB;
|
|
52274
|
+
pieces.push({ page, y: contTop, h: endH, range: none });
|
|
52275
|
+
out.push(pieces);
|
|
52276
|
+
y = contTop + endH;
|
|
52277
|
+
first = false;
|
|
52278
|
+
continue;
|
|
52279
|
+
}
|
|
52280
|
+
}
|
|
52244
52281
|
if (splittable && y + h > pageBottom) {
|
|
52245
52282
|
const from = /* @__PURE__ */ new Map();
|
|
52246
52283
|
const lines = new Map(rowCells.map((c) => [c.el, cellLines(c)]));
|
|
@@ -52738,16 +52775,20 @@ function warnOnce(ctx, key, msg2) {
|
|
|
52738
52775
|
ctx.warned.add(key);
|
|
52739
52776
|
ctx.warnings.push(msg2);
|
|
52740
52777
|
}
|
|
52741
|
-
function charW(c, styles) {
|
|
52778
|
+
function charW(c, styles, prev) {
|
|
52742
52779
|
const st = _nullishCoalesce((c.prId != null ? styles.charPr.get(c.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
52743
52780
|
if (c.ch === "" && c.ctrlText) return measureTextWidth(c.ctrlText, c.ctrlSup ? Math.round(st.height * 3 / 4) : st.height, st.ratio, { spacingPct: st.spacing, faceClass: faceClassOf(st.face) });
|
|
52744
|
-
let w = 0;
|
|
52745
|
-
for (const ch of c.ch)
|
|
52781
|
+
let w = 0, last = _optionalChain([prev, 'optionalAccess', _1278 => _1278.ch]) ? _nullishCoalesce(prev.ch.codePointAt(prev.ch.length - 1), () => ( 0)) : 0;
|
|
52782
|
+
for (const ch of c.ch) {
|
|
52783
|
+
const cp = ch.codePointAt(0);
|
|
52784
|
+
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
52785
|
+
last = cp;
|
|
52786
|
+
}
|
|
52746
52787
|
return w;
|
|
52747
52788
|
}
|
|
52748
52789
|
function lineNaturalWidth(m, styles, start, end) {
|
|
52749
52790
|
let text = 0;
|
|
52750
|
-
for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles);
|
|
52791
|
+
for (let i = start; i < end && i < m.chars.length; i++) text += charW(m.chars[i], styles, m.chars[i - 1]);
|
|
52751
52792
|
let obj = 0;
|
|
52752
52793
|
for (const o of m.objs) if (o.inline && o.index >= start && o.index < end) obj += o.omL + o.width + o.omR;
|
|
52753
52794
|
return { text, obj };
|
|
@@ -52756,10 +52797,10 @@ function planLines(m, styles, numText = "") {
|
|
|
52756
52797
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52757
52798
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52758
52799
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
52759
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52760
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
52761
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
52762
|
-
const headW = _optionalChain([bu, 'optionalAccess',
|
|
52800
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1279 => _1279.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1280 => _1280.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
52801
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1281 => _1281.chars, 'access', _1282 => _1282.find, 'call', _1283 => _1283((c) => c.ch !== ""), 'optionalAccess', _1284 => _1284.prId]), () => ( null));
|
|
52802
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1285 => _1285.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
52803
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1286 => _1286.useInstWidth]) === false ? [...bu.ch].reduce((w, ch) => w + glyphWidth(ch, bst, false).w, 0) : bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) : 0;
|
|
52763
52804
|
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
52764
52805
|
const plans = [];
|
|
52765
52806
|
const inlineW = /* @__PURE__ */ new Map();
|
|
@@ -52769,8 +52810,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52769
52810
|
const start = seg.textpos;
|
|
52770
52811
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52771
52812
|
const tabs = /* @__PURE__ */ new Map();
|
|
52772
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52773
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52813
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1287 => _1287.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1288 => _1288.autoIndent]) ? bulletW : 0);
|
|
52814
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1289 => _1289.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1290 => _1290.autoIndent]) ? bulletW : 0);
|
|
52774
52815
|
let fixedTo = start;
|
|
52775
52816
|
let fixedW = 0;
|
|
52776
52817
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52781,7 +52822,7 @@ function planLines(m, styles, numText = "") {
|
|
|
52781
52822
|
continue;
|
|
52782
52823
|
}
|
|
52783
52824
|
if (!c.tab) {
|
|
52784
|
-
x += charW(c, styles);
|
|
52825
|
+
x += charW(c, styles, m.chars[k - 1]);
|
|
52785
52826
|
continue;
|
|
52786
52827
|
}
|
|
52787
52828
|
const adv = tabAdvance(x, i === 0, geom, c.tabW);
|
|
@@ -52827,7 +52868,7 @@ function planLines(m, styles, numText = "") {
|
|
|
52827
52868
|
function advanceTo(m, styles, plan, upto) {
|
|
52828
52869
|
let x = 0;
|
|
52829
52870
|
for (let i = plan.start; i < upto && i < m.chars.length; i++) {
|
|
52830
|
-
x += m.chars[i].tab ? _nullishCoalesce(plan.tabs.get(i), () => ( 0)) : charW(m.chars[i], styles) * (i < plan.fixedTo ? 1 : plan.scale) + (i >= plan.spFrom && i < plan.textEnd && m.chars[i].ch === " " ? plan.spaceAdd : 0);
|
|
52871
|
+
x += m.chars[i].tab ? _nullishCoalesce(plan.tabs.get(i), () => ( 0)) : charW(m.chars[i], styles, m.chars[i - 1]) * (i < plan.fixedTo ? 1 : plan.scale) + (i >= plan.spFrom && i < plan.textEnd && m.chars[i].ch === " " ? plan.spaceAdd : 0);
|
|
52831
52872
|
}
|
|
52832
52873
|
for (const o of m.objs) if (o.inline && o.index >= plan.start && o.index < upto) x += o.omL + o.width + o.omR;
|
|
52833
52874
|
return x;
|
|
@@ -52871,7 +52912,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52871
52912
|
let i = plan.start;
|
|
52872
52913
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52873
52914
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52874
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
52915
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1291 => _1291.styles, 'access', _1292 => _1292.paraGeom, 'access', _1293 => _1293.get, 'call', _1294 => _1294(m.paraPrId), 'optionalAccess', _1295 => _1295.vertAlign]) : void 0;
|
|
52875
52916
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52876
52917
|
if (plan.bullet) {
|
|
52877
52918
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -52927,8 +52968,12 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52927
52968
|
const fh = st.script ? Math.round(st.height * 16 / 25) : st.height;
|
|
52928
52969
|
const raise = st.script === "sup" ? Math.round(st.height * 0.44) : 0;
|
|
52929
52970
|
const measure = (text) => {
|
|
52930
|
-
let w = 0;
|
|
52931
|
-
for (const ch of text)
|
|
52971
|
+
let w = 0, last = 0;
|
|
52972
|
+
for (const ch of text) {
|
|
52973
|
+
const cp = ch.codePointAt(0);
|
|
52974
|
+
if (!joinsJamo(last, cp)) w += glyphWidth(ch, st).w;
|
|
52975
|
+
last = cp;
|
|
52976
|
+
}
|
|
52932
52977
|
return w;
|
|
52933
52978
|
};
|
|
52934
52979
|
const skipLead = Math.max(0, plan.spFrom - i);
|
|
@@ -52956,7 +53001,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52956
53001
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52957
53002
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52958
53003
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52959
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
53004
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkZEVEVTRGcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52960
53005
|
ctx.stats.texts++;
|
|
52961
53006
|
}
|
|
52962
53007
|
return sw;
|
|
@@ -53025,27 +53070,27 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53025
53070
|
anchorLineH = pl.seg.textheight;
|
|
53026
53071
|
}
|
|
53027
53072
|
let objBaseV = baseV;
|
|
53028
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
53073
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1296 => _1296.paraTops, 'optionalAccess', _1297 => _1297.get, 'call', _1298 => _1298(p)]) : void 0;
|
|
53029
53074
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53030
53075
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
53031
53076
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
53032
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
53077
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1299 => _1299.styles, 'access', _1300 => _1300.paraGeom, 'access', _1301 => _1301.get, 'call', _1302 => _1302(m.paraPrId), 'optionalAccess', _1303 => _1303.spaceBefore]), () => ( 0)) : 0);
|
|
53033
53078
|
if (baseV > start + 100) {
|
|
53034
53079
|
objBaseV = start;
|
|
53035
53080
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
53036
53081
|
}
|
|
53037
53082
|
}
|
|
53038
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53083
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1304 => _1304(q.el, "pos"), 'optionalAccess', _1305 => _1305.getAttribute, 'call', _1306 => _1306("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
53039
53084
|
let stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53040
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
53041
|
-
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), pTop)) stay = false;
|
|
53085
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1307 => _1307.styles, 'access', _1308 => _1308.paraGeom, 'access', _1309 => _1309.get, 'call', _1310 => _1310(m.paraPrId), 'optionalAccess', _1311 => _1311.spaceBefore]), () => ( 0)) : 0;
|
|
53086
|
+
if (stay && wrapA === "TOP_AND_BOTTOM" && linePushedBy(o, _nullishCoalesce(anchorLineV, () => ( baseV)), _nullishCoalesce(pTop, () => ( (depth > 0 ? cellParaTop(p, ctx.styles.paraGeom) : void 0))))) stay = false;
|
|
53042
53087
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
53043
53088
|
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
53044
53089
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
53045
53090
|
if (!tbStack) {
|
|
53046
53091
|
tbStack = /* @__PURE__ */ new Map();
|
|
53047
53092
|
let below = 0;
|
|
53048
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53093
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1312 => _1312(q.el, "pos"), 'optionalAccess', _1313 => _1313.getAttribute, 'call', _1314 => _1314("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1315 => _1315(q.el, "pos"), 'optionalAccess', _1316 => _1316.getAttribute, 'call', _1317 => _1317("allowOverlap")]) !== "1");
|
|
53049
53094
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
53050
53095
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
53051
53096
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -53056,7 +53101,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
53056
53101
|
const st = tbStack.get(o.el);
|
|
53057
53102
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
53058
53103
|
}
|
|
53059
|
-
const moved = _optionalChain([ctx, 'access',
|
|
53104
|
+
const moved = _optionalChain([ctx, 'access', _1318 => _1318.objPlace, 'optionalAccess', _1319 => _1319.get, 'call', _1320 => _1320(o.el)]);
|
|
53060
53105
|
if (moved) {
|
|
53061
53106
|
const pg = ctx.page;
|
|
53062
53107
|
ctx.page = moved.page;
|
|
@@ -53075,7 +53120,7 @@ function cellParaTop(p, geom) {
|
|
|
53075
53120
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
53076
53121
|
if (!segs.length) return void 0;
|
|
53077
53122
|
const last = segs[segs.length - 1];
|
|
53078
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
53123
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1321 => _1321.get, 'call', _1322 => _1322(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1323 => _1323.spaceAfter]), () => ( 0)));
|
|
53079
53124
|
}
|
|
53080
53125
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
53081
53126
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -53116,7 +53161,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
53116
53161
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
53117
53162
|
}
|
|
53118
53163
|
} else if (o.tag === "equation") {
|
|
53119
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
53164
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1324 => _1324(o.el, "script"), 'optionalAccess', _1325 => _1325.textContent]), () => ( ""));
|
|
53120
53165
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
53121
53166
|
if (text && o.width > 0) {
|
|
53122
53167
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53221,7 +53266,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53221
53266
|
}
|
|
53222
53267
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53223
53268
|
return (seg, top, contMT) => {
|
|
53224
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53269
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1326 => _1326.parentNode]);
|
|
53225
53270
|
if (!p || ln(p) !== "p") return void 0;
|
|
53226
53271
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53227
53272
|
const m = buildPara(p);
|
|
@@ -53229,10 +53274,12 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53229
53274
|
for (const o of m.objs) {
|
|
53230
53275
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53231
53276
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53232
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53277
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1327 => _1327.getAttribute, 'call', _1328 => _1328("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53233
53278
|
const segK = Math.max(0, m.segs.findIndex((sg, i) => sg.textpos <= o.index && (i === m.segs.length - 1 || m.segs[i + 1].textpos > o.index)));
|
|
53234
53279
|
if (segK !== k) continue;
|
|
53235
|
-
const
|
|
53280
|
+
const segV = num2(seg, "vertpos"), pTop = cellParaTop(p, _nullishCoalesce(memo.paraGeom, () => ( /* @__PURE__ */ new Map())));
|
|
53281
|
+
const start = linePushedBy(o, segV, pTop) ? top - (segV - (_nullishCoalesce(pTop, () => ( segV)))) : top;
|
|
53282
|
+
const ty = start + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1329 => _1329.getAttribute, 'call', _1330 => _1330("vertOffset")]), () => ( void 0)), 0));
|
|
53236
53283
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true, contMT);
|
|
53237
53284
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53238
53285
|
}
|
|
@@ -53251,7 +53298,16 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53251
53298
|
const nCols = Math.max(...cells.map((c) => c.ca + c.cs));
|
|
53252
53299
|
const nRows = Math.max(...cells.map((c) => c.ra + c.rs));
|
|
53253
53300
|
const colCons = cells.map((c) => ({ a: c.ca, b: c.ca + c.cs, size: c.w }));
|
|
53254
|
-
const
|
|
53301
|
+
const tblW = num2(tblSz, "width");
|
|
53302
|
+
const rowSum = /* @__PURE__ */ new Map();
|
|
53303
|
+
for (const c of cells) {
|
|
53304
|
+
const r = _nullishCoalesce(rowSum.get(c.ra), () => ( { cover: 0, w: 0 }));
|
|
53305
|
+
r.cover += c.cs;
|
|
53306
|
+
r.w += c.w;
|
|
53307
|
+
rowSum.set(c.ra, r);
|
|
53308
|
+
}
|
|
53309
|
+
const noExactRow = ![...rowSum.values()].some((r) => r.cover === nCols && Math.abs(r.w - tblW) <= 2);
|
|
53310
|
+
const colX = tableColumnBoundaries(colCons, nCols, tblW || void 0, noExactRow);
|
|
53255
53311
|
const rowH = measureTableRowHeights(tbl2, ctx.extentMemo);
|
|
53256
53312
|
const rowY = [0];
|
|
53257
53313
|
for (let r = 0; r < nRows; r++) rowY.push(rowY[r] + rowH[r]);
|
|
@@ -53264,7 +53320,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53264
53320
|
let hdrRows = 0;
|
|
53265
53321
|
if (tbl2.getAttribute("repeatHeader") === "1") while (hdrRows < nRows && cells.some((c) => c.ra === hdrRows) && cells.filter((c) => c.ra === hdrRows).every((c) => c.el.getAttribute("header") === "1")) hdrRows++;
|
|
53266
53322
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53267
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53323
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1331 => _1331(tbl2, "pos"), 'optionalAccess', _1332 => _1332.getAttribute, 'call', _1333 => _1333("treatAsChar")]) !== "1";
|
|
53268
53324
|
const plan = splitHere ? planTableRows(tbl2, cells, rowH, ty, ctx.geom.MT, ctx.geom.BODY_H, slack, cellFloatSpan(ctx.geom.MT, ctx.geom.BODY_H, ctx.extentMemo, slack), depth !== 1, depth !== 1 && ctx.splitContMT !== void 0 ? ctx.splitContMT : ctx.geom.MT) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
53269
53325
|
const splitSaved = ctx.splitCell;
|
|
53270
53326
|
ctx.splitCell = false;
|
|
@@ -53286,7 +53342,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53286
53342
|
for (const g3 of geom) {
|
|
53287
53343
|
ctx.page = g3.page;
|
|
53288
53344
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53289
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53345
|
+
if (_optionalChain([bf, 'optionalAccess', _1334 => _1334.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
53290
53346
|
}
|
|
53291
53347
|
for (const g3 of geom) {
|
|
53292
53348
|
const { c } = g3;
|
|
@@ -53297,14 +53353,14 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53297
53353
|
const boxes = cellLineBoxes(c);
|
|
53298
53354
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53299
53355
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53300
|
-
const r = _optionalChain([pc, 'access',
|
|
53356
|
+
const r = _optionalChain([pc, 'access', _1335 => _1335.range, 'optionalAccess', _1336 => _1336.get, 'call', _1337 => _1337(c.el)]);
|
|
53301
53357
|
return !!r && v >= r[0] && v < r[1];
|
|
53302
53358
|
}));
|
|
53303
53359
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53304
53360
|
const lastK = g3.pieces.length - 1;
|
|
53305
53361
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53306
|
-
if (va2 === "TOP" || k > 0 && k < lastK) return 0;
|
|
53307
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53362
|
+
if (va2 === "TOP" || k > 0 && k < lastK || pc.fill) return 0;
|
|
53363
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1338 => _1338.range, 'optionalAccess', _1339 => _1339.get, 'call', _1340 => _1340(c.el), 'optionalAccess', _1341 => _1341[0]]), () => ( 0));
|
|
53308
53364
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53309
53365
|
if (k > 0) for (const f of subFloatBottoms(c.sub)) {
|
|
53310
53366
|
const b = boxes.find((x) => x.seg === f.seg);
|
|
@@ -53321,7 +53377,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53321
53377
|
const pages = segs.map((sg) => {
|
|
53322
53378
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53323
53379
|
const k = pieceOf(v);
|
|
53324
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53380
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1342 => _1342.range, 'optionalAccess', _1343 => _1343.get, 'call', _1344 => _1344(c.el), 'optionalAccess', _1345 => _1345[0]]), () => ( 0));
|
|
53325
53381
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53326
53382
|
return startPage + pc.page;
|
|
53327
53383
|
});
|
|
@@ -53416,7 +53472,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53416
53472
|
}
|
|
53417
53473
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53418
53474
|
const img = findFirst(pic, "img");
|
|
53419
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53475
|
+
const ref = _optionalChain([img, 'optionalAccess', _1346 => _1346.getAttribute, 'call', _1347 => _1347("binaryItemIDRef")]);
|
|
53420
53476
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53421
53477
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53422
53478
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53462,12 +53518,12 @@ function readSectionGeom(root) {
|
|
|
53462
53518
|
const pagePr = findFirst(root, "pagePr");
|
|
53463
53519
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53464
53520
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53465
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53521
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1348 => _1348.getAttribute, 'call', _1349 => _1349("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53466
53522
|
const t = PW;
|
|
53467
53523
|
PW = PH;
|
|
53468
53524
|
PH = t;
|
|
53469
53525
|
}
|
|
53470
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53526
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1350 => _1350.getAttribute, 'call', _1351 => _1351("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53471
53527
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53472
53528
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53473
53529
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53497,6 +53553,20 @@ function staleTopCache(root, BODY_H) {
|
|
|
53497
53553
|
}
|
|
53498
53554
|
return false;
|
|
53499
53555
|
}
|
|
53556
|
+
function absoluteTopCache(root, ML, BODY_W) {
|
|
53557
|
+
let tot = 0, over = 0;
|
|
53558
|
+
for (const p of elements(root)) {
|
|
53559
|
+
if (ln(p) !== "p") continue;
|
|
53560
|
+
const lsa = findChildByLocalName(p, "linesegarray");
|
|
53561
|
+
for (const sg of lsa ? elements(lsa) : []) {
|
|
53562
|
+
if (ln(sg) !== "lineseg" || num2(sg, "horzsize") <= 0) continue;
|
|
53563
|
+
tot++;
|
|
53564
|
+
const hp = num2(sg, "horzpos");
|
|
53565
|
+
if (hp >= ML - 500 && hp + num2(sg, "horzsize") > BODY_W + 500) over++;
|
|
53566
|
+
}
|
|
53567
|
+
}
|
|
53568
|
+
return over >= 3 && over * 5 >= tot;
|
|
53569
|
+
}
|
|
53500
53570
|
function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters = [], hasDeletionMarkers = true, lastSection = true) {
|
|
53501
53571
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
|
|
53502
53572
|
if (hasDeletionMarkers) prepareDeletedRanges(root);
|
|
@@ -53508,8 +53578,13 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53508
53578
|
}
|
|
53509
53579
|
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uB9DE\uC9C0 \uC54A\uC544(\uCD5C\uC0C1\uC704 \uBB38\uB2E8\uC774 \uBAA8\uB450 \uAC19\uC740 \uC790\uB9AC) \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
53510
53580
|
}
|
|
53511
|
-
const
|
|
53512
|
-
if (
|
|
53581
|
+
const absolute = !degenerate && absoluteTopCache(root, ML, BODY_W);
|
|
53582
|
+
if (absolute) {
|
|
53583
|
+
for (const lsa of Array.from(root.getElementsByTagName("*")).filter((e) => ln(e) === "linesegarray")) _optionalChain([lsa, 'access', _1352 => _1352.parentNode, 'optionalAccess', _1353 => _1353.removeChild, 'call', _1354 => _1354(lsa)]);
|
|
53584
|
+
ctxBase.warnings.push("\uC870\uD310 \uCE90\uC2DC\uAC00 \uCABD \uAE30\uC900 \uC88C\uD45C\uB85C \uC801\uD600 \uC788\uC5B4 \uB2E4\uC2DC \uC870\uD310\uD574 \uB80C\uB354");
|
|
53585
|
+
}
|
|
53586
|
+
const mixed = !doReflow && !degenerate && !absolute && Array.from(root.getElementsByTagName("*")).some((p) => ln(p) === "p" && !findChildByLocalName(p, "linesegarray"));
|
|
53587
|
+
if (doReflow || degenerate || absolute || mixed) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
|
|
53513
53588
|
const colPr = findFirst(root, "colPr");
|
|
53514
53589
|
const multiCol = num2(colPr, "colCount", 1) > 1;
|
|
53515
53590
|
const nCol = multiCol ? num2(colPr, "colCount", 1) : 1, colGap = multiCol ? num2(colPr, "sameGap", 0) : 0;
|
|
@@ -53564,7 +53639,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53564
53639
|
pendingEnd = 0;
|
|
53565
53640
|
} else {
|
|
53566
53641
|
const brk = v < prevV ? !multiCol || h <= prevH : v === prevV && h <= prevH && prevEnd > v && v < BODY_H / 2;
|
|
53567
|
-
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && v < BODY_H / 2;
|
|
53642
|
+
const pbrk = !brk && paraFirst && prevV !== Number.NEGATIVE_INFINITY && p.getAttribute("pageBreak") === "1" && (v < BODY_H / 2 || buildPara(p).objs.some((o) => !o.inline && (_nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1355 => _1355(o.el, "pos"), 'optionalAccess', _1356 => _1356.getAttribute, 'call', _1357 => _1357("vertRelTo")]), () => ( "PARA"))) === "PARA" && linePushedBy(o, v, 0)));
|
|
53568
53643
|
const obrk = !brk && !pbrk && !multiCol && paraFirst && v > prevV && v < prevEnd - 100 && prevEnd + num2(s, "vertsize") > BODY_H && v < BODY_H / 2;
|
|
53569
53644
|
if (brk || pbrk || obrk) cur++;
|
|
53570
53645
|
if (brk && prevSeg && prevV + prevSeg.vs > BODY_H && v === prevSeg.vs + prevSeg.sp && prevSeg.pages[prevSeg.idx] === cur - 1) {
|
|
@@ -53598,17 +53673,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53598
53673
|
for (const o of m0.objs) {
|
|
53599
53674
|
if (o.tag !== "tbl") continue;
|
|
53600
53675
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53601
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53676
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1358 => _1358.getAttribute, 'call', _1359 => _1359("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53602
53677
|
const segK = Math.max(0, m0.segs.findIndex((sg, k) => sg.textpos <= o.index && (k === m0.segs.length - 1 || m0.segs[k + 1].textpos > o.index)));
|
|
53603
53678
|
const segV = num2(segEls[segK], "vertpos");
|
|
53604
53679
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
53605
53680
|
const pushed = segV - (omT + h + omB);
|
|
53606
53681
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53607
53682
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53608
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
53683
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1360 => _1360.get, 'call', _1361 => _1361(m0.paraPrId), 'optionalAccess', _1362 => _1362.spaceBefore]), () => ( 0)) : 0;
|
|
53609
53684
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") && !(!o.inline && wrapP === "TOP_AND_BOTTOM" && linePushedBy(o, segV, pTop));
|
|
53610
53685
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
53611
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53686
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1363 => _1363.getAttribute, 'call', _1364 => _1364("vertOffset")]), () => ( void 0)), 0));
|
|
53612
53687
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53613
53688
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
|
|
53614
53689
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H, cellFloatSpan(MT, BODY_H, ctxBase.extentMemo, PH - MT - BODY_H));
|
|
@@ -53635,7 +53710,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53635
53710
|
for (const p of elements(root)) {
|
|
53636
53711
|
if (ln(p) !== "p") continue;
|
|
53637
53712
|
const pg = paraSegPages.get(p);
|
|
53638
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53713
|
+
if (!_optionalChain([pg, 'optionalAccess', _1365 => _1365.length])) continue;
|
|
53639
53714
|
const pm = buildPara(p);
|
|
53640
53715
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53641
53716
|
}
|
|
@@ -53652,7 +53727,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53652
53727
|
for (const p of elements(root)) {
|
|
53653
53728
|
if (ln(p) !== "p") continue;
|
|
53654
53729
|
const pg = paraSegPages.get(p);
|
|
53655
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53730
|
+
if (!_optionalChain([pg, 'optionalAccess', _1366 => _1366.includes, 'call', _1367 => _1367(lastContent)])) continue;
|
|
53656
53731
|
const pm = buildPara(p);
|
|
53657
53732
|
pm.segs.forEach((sg, k) => {
|
|
53658
53733
|
if (pg[k] !== lastContent) return;
|
|
@@ -53672,7 +53747,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53672
53747
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53673
53748
|
const ctx = {
|
|
53674
53749
|
...ctxBase,
|
|
53675
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53750
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1368 => _1368.pageCount]), () => ( 0))) }, () => []),
|
|
53676
53751
|
page: 0,
|
|
53677
53752
|
geom,
|
|
53678
53753
|
pageH,
|
|
@@ -53730,7 +53805,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53730
53805
|
ctx.bodyDx = void 0;
|
|
53731
53806
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53732
53807
|
const allPages = new Map(paraSegPages);
|
|
53733
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53808
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1369 => _1369.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53734
53809
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53735
53810
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53736
53811
|
ctx.page = 0;
|
|
@@ -53799,7 +53874,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53799
53874
|
let decl;
|
|
53800
53875
|
const hidden = /* @__PURE__ */ new Set();
|
|
53801
53876
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53802
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
53877
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1370 => _1370.get, 'call', _1371 => _1371(p), 'optionalAccess', _1372 => _1372[0]]), () => ( 0));
|
|
53803
53878
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53804
53879
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53805
53880
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53823,7 +53898,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53823
53898
|
const text = side ? `${side} ${formatHeadNumber2(n, _nullishCoalesce(decl.el.getAttribute("formatType"), () => ( "DIGIT")))} ${side}` : formatHeadNumber2(n, _nullishCoalesce(decl.el.getAttribute("formatType"), () => ( "DIGIT")));
|
|
53824
53899
|
const w = measureTextWidth(text, h, 100, { faceClass: faceClassOf(st.face) });
|
|
53825
53900
|
const x = /LEFT/.test(pos) ? ML : /RIGHT/.test(pos) ? ML + BODY_W - w : (PW - w) / 2;
|
|
53826
|
-
const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : PH - num2(margin, "bottom", 4252) - 225;
|
|
53901
|
+
const y = /^TOP/.test(pos) ? num2(margin, "top", 5668) - 225 : num2(margin, "footer", 0) > 0 ? PH - num2(margin, "bottom", 4252) - 225 : PH - Math.round(num2(margin, "bottom", 4252) / 2) - 243;
|
|
53827
53902
|
const attrs = [`x="${pt2(x)}"`, `y="${pt2(y)}"`, `font-size="${pt2(h)}"`];
|
|
53828
53903
|
if (st.fontFamily) attrs.push(`font-family="${escapeXml7(st.fontFamily)}"`);
|
|
53829
53904
|
ctx.page = page;
|
|
@@ -53861,22 +53936,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53861
53936
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53862
53937
|
ctxBase.pageBase += pages.length;
|
|
53863
53938
|
}
|
|
53864
|
-
if (rendered.length === 0) throw new (0,
|
|
53939
|
+
if (rendered.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53865
53940
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53866
53941
|
}
|
|
53867
53942
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53868
53943
|
async function renderHwpxInternal(input, options) {
|
|
53869
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
53944
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1373 => _1373.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53870
53945
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53871
|
-
|
|
53946
|
+
_chunkJOHVSCHTcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53872
53947
|
let zip;
|
|
53873
53948
|
try {
|
|
53874
53949
|
zip = await _jszip2.default.loadAsync(input);
|
|
53875
53950
|
} catch (e43) {
|
|
53876
|
-
throw new (0,
|
|
53951
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53877
53952
|
}
|
|
53878
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53879
|
-
if (secFiles.length === 0) throw new (0,
|
|
53953
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkJOHVSCHTcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53954
|
+
if (secFiles.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53880
53955
|
const warnings = [];
|
|
53881
53956
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53882
53957
|
const verFile = zip.file("version.xml");
|
|
@@ -53887,14 +53962,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53887
53962
|
const secXmls = [];
|
|
53888
53963
|
for (const f of secFiles) {
|
|
53889
53964
|
const xml = await readZipEntry(f, "text");
|
|
53890
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53965
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53891
53966
|
secXmls.push(xml);
|
|
53892
53967
|
}
|
|
53893
53968
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53894
53969
|
const masterXmls = [];
|
|
53895
53970
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53896
53971
|
const xml = await readZipEntry(file, "text");
|
|
53897
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53972
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53898
53973
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53899
53974
|
if (root && ln(root) === "masterPage") {
|
|
53900
53975
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53922,7 +53997,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53922
53997
|
let href = binmap.get(ref);
|
|
53923
53998
|
if (!href) {
|
|
53924
53999
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
53925
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
54000
|
+
href = _optionalChain([cand, 'optionalAccess', _1374 => _1374.name]);
|
|
53926
54001
|
}
|
|
53927
54002
|
if (!href) continue;
|
|
53928
54003
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -53944,7 +54019,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53944
54019
|
for (let si = 0; si < secXmls.length; si++) {
|
|
53945
54020
|
const secXml = secXmls[si];
|
|
53946
54021
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
53947
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
54022
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1375 => _1375.reflow])) {
|
|
53948
54023
|
noCacheSkipped = true;
|
|
53949
54024
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
53950
54025
|
continue;
|
|
@@ -53961,11 +54036,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
53961
54036
|
}
|
|
53962
54037
|
if (roots.length === 0) {
|
|
53963
54038
|
if (noCacheSkipped) {
|
|
53964
|
-
throw new (0,
|
|
54039
|
+
throw new (0, _chunkJOHVSCHTcjs.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)");
|
|
53965
54040
|
}
|
|
53966
|
-
throw new (0,
|
|
54041
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
53967
54042
|
}
|
|
53968
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54043
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1376 => _1376.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1377 => _1377.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1378 => _1378.highlights]) });
|
|
53969
54044
|
}
|
|
53970
54045
|
async function renderHwpxToSvg(input, options) {
|
|
53971
54046
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -54188,7 +54263,7 @@ var FOLD_END = 42124;
|
|
|
54188
54263
|
var FOLD_SHIFT = 983040 - 40960;
|
|
54189
54264
|
function textChar(ch) {
|
|
54190
54265
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
54191
|
-
const mapped =
|
|
54266
|
+
const mapped = _chunkZEVEVTRGcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
54192
54267
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
54193
54268
|
}
|
|
54194
54269
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54280,7 +54355,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54280
54355
|
out += run.join("") + "</hp:run>";
|
|
54281
54356
|
run = [];
|
|
54282
54357
|
};
|
|
54283
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54358
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1379 => _1379[0], 'optionalAccess', _1380 => _1380[1]]), () => ( 0)));
|
|
54284
54359
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54285
54360
|
const switchShape = () => {
|
|
54286
54361
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54366,7 +54441,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54366
54441
|
closeRun();
|
|
54367
54442
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54368
54443
|
if (rest.length > 0) {
|
|
54369
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54444
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1381 => _1381[0], 'optionalAccess', _1382 => _1382[1]]), () => ( 0)));
|
|
54370
54445
|
for (const c of rest) {
|
|
54371
54446
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54372
54447
|
run.push(el);
|
|
@@ -54532,14 +54607,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54532
54607
|
return `<hs:sec xmlns:hs="http://www.hancom.co.kr/hwpml/2011/section" xmlns:hp="http://www.hancom.co.kr/hwpml/2011/paragraph" xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core">` + paragraphsXml(records, 0, records.length, 0, ctx, 0) + "</hs:sec>";
|
|
54533
54608
|
}
|
|
54534
54609
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54535
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54610
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1383 => _1383.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54536
54611
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54537
54612
|
const images = /* @__PURE__ */ new Map();
|
|
54538
54613
|
let totalImgBytes = 0;
|
|
54539
54614
|
const imageRef = (binDataId) => {
|
|
54540
54615
|
if (binDataId <= 0) return null;
|
|
54541
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54542
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
54616
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1384 => _1384.binData, 'access', _1385 => _1385[binDataId - 1]]);
|
|
54617
|
+
if (_optionalChain([item, 'optionalAccess', _1386 => _1386.kind]) === "link") return null;
|
|
54543
54618
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54544
54619
|
const ref = `bin${storageId}`;
|
|
54545
54620
|
if (images.has(ref)) return ref;
|
|
@@ -54573,8 +54648,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54573
54648
|
}
|
|
54574
54649
|
roots.push({ root, index: si });
|
|
54575
54650
|
}
|
|
54576
|
-
if (roots.length === 0) throw new (0,
|
|
54577
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54651
|
+
if (roots.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54652
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1387 => _1387.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1388 => _1388.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1389 => _1389.highlights]) });
|
|
54578
54653
|
return assemblePageSvgs(r, "hwp", select);
|
|
54579
54654
|
}
|
|
54580
54655
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54586,7 +54661,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54586
54661
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54587
54662
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54588
54663
|
const sections = readHwp5SectionStreams(c);
|
|
54589
|
-
if (sections.length === 0) throw new (0,
|
|
54664
|
+
if (sections.length === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54590
54665
|
const parseWarnings = [];
|
|
54591
54666
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54592
54667
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54672,14 +54747,14 @@ async function loadSharp() {
|
|
|
54672
54747
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54673
54748
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54674
54749
|
} catch (e46) {
|
|
54675
|
-
throw new (0,
|
|
54676
|
-
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' +
|
|
54750
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(
|
|
54751
|
+
'PNG \uB798\uC2A4\uD130\uC5D0\uB294 sharp\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install sharp). sharp \uC5C6\uC774 \uC4F0\uB824\uBA74 format: "svg" + output_path\uB85C SVG \uD30C\uC77C \uC800\uC7A5\uC744 \uC0AC\uC6A9\uD558\uC138\uC694.' + _chunkJOHVSCHTcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54677
54752
|
);
|
|
54678
54753
|
}
|
|
54679
54754
|
}
|
|
54680
54755
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54681
54756
|
const sharp = await loadSharp();
|
|
54682
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54757
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54683
54758
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54684
54759
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54685
54760
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54697,11 +54772,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54697
54772
|
try {
|
|
54698
54773
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54699
54774
|
} catch (e47) {
|
|
54700
|
-
throw new (0,
|
|
54775
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("PDF \uB80C\uB354\uC5D0\uB294 puppeteer-core \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (npm install puppeteer-core). SVG/HTML/PNG \uB294 Chromium \uC5C6\uC774 \uB429\uB2C8\uB2E4");
|
|
54701
54776
|
}
|
|
54702
54777
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54703
54778
|
if (!executablePath) {
|
|
54704
|
-
throw new (0,
|
|
54779
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)("Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 browserExecutablePath \uC635\uC158 \uB610\uB294 PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC9C0\uC815\uD558\uC138\uC694");
|
|
54705
54780
|
}
|
|
54706
54781
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54707
54782
|
try {
|
|
@@ -54717,13 +54792,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54717
54792
|
async function loadBuffer(input) {
|
|
54718
54793
|
if (typeof input === "string") {
|
|
54719
54794
|
try {
|
|
54720
|
-
return
|
|
54795
|
+
return _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54721
54796
|
} catch (err) {
|
|
54722
54797
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54723
|
-
throw new (0,
|
|
54798
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54724
54799
|
}
|
|
54725
54800
|
}
|
|
54726
|
-
if (Buffer.isBuffer(input)) return
|
|
54801
|
+
if (Buffer.isBuffer(input)) return _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, input);
|
|
54727
54802
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54728
54803
|
return input;
|
|
54729
54804
|
}
|
|
@@ -54732,17 +54807,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54732
54807
|
if (format2 === "hwpx") {
|
|
54733
54808
|
const zip = await detectZipFormat(buffer);
|
|
54734
54809
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54735
|
-
throw new (0,
|
|
54810
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${zip}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
54736
54811
|
}
|
|
54737
54812
|
if (format2 === "hwp") return "hwp";
|
|
54738
|
-
throw new (0,
|
|
54813
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uB80C\uB354 \uBBF8\uC9C0\uC6D0 \uD615\uC2DD(${format2}) \u2014 \uB808\uC774\uC544\uC6C3 \uB80C\uB354\uB294 HWPX\xB7HWP \uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4`);
|
|
54739
54814
|
}
|
|
54740
54815
|
async function renderDocumentToScene(input, options = {}) {
|
|
54741
54816
|
const buffer = await loadBuffer(input);
|
|
54742
54817
|
const source = await sourceFormatOf(buffer);
|
|
54743
54818
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54744
54819
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54745
|
-
if (set.size === 0) throw new (0,
|
|
54820
|
+
if (set.size === 0) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54746
54821
|
return set;
|
|
54747
54822
|
} : void 0;
|
|
54748
54823
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54778,7 +54853,7 @@ async function renderDocument(input, options) {
|
|
|
54778
54853
|
break;
|
|
54779
54854
|
}
|
|
54780
54855
|
default:
|
|
54781
|
-
throw new (0,
|
|
54856
|
+
throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54782
54857
|
}
|
|
54783
54858
|
return { scene, assets };
|
|
54784
54859
|
}
|
|
@@ -54808,7 +54883,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54808
54883
|
const out = [];
|
|
54809
54884
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54810
54885
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54811
|
-
if (!meta) throw new (0,
|
|
54886
|
+
if (!meta) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54812
54887
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54813
54888
|
for (const { region, bbox } of items) {
|
|
54814
54889
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54832,9 +54907,9 @@ function wantsCrop(kind, policy) {
|
|
|
54832
54907
|
}
|
|
54833
54908
|
async function extractTables(input, options = {}) {
|
|
54834
54909
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54835
|
-
const buffer = typeof input === "string" ?
|
|
54910
|
+
const buffer = typeof input === "string" ? _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, input) : input;
|
|
54836
54911
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54837
|
-
if (!parsed.success) throw new (0,
|
|
54912
|
+
if (!parsed.success) throw new (0, _chunkJOHVSCHTcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54838
54913
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54839
54914
|
const out = blocks.map((b, i) => ({
|
|
54840
54915
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54892,22 +54967,22 @@ async function extractTables(input, options = {}) {
|
|
|
54892
54967
|
// src/index.ts
|
|
54893
54968
|
async function parse(input, options) {
|
|
54894
54969
|
let buffer;
|
|
54895
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54896
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
54970
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1390 => _1390.filePath]) ? { ...options, filePath: input } : options;
|
|
54971
|
+
if (_optionalChain([opts, 'optionalAccess', _1391 => _1391.htmlTables]) && opts.tableFormat) {
|
|
54897
54972
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54898
54973
|
}
|
|
54899
|
-
const ocrOptionError =
|
|
54974
|
+
const ocrOptionError = _chunkZEVEVTRGcjs.validateOcrOptions.call(void 0, opts);
|
|
54900
54975
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54901
54976
|
if (typeof input === "string") {
|
|
54902
54977
|
try {
|
|
54903
54978
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54904
|
-
buffer =
|
|
54979
|
+
buffer = _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, buf);
|
|
54905
54980
|
} catch (err) {
|
|
54906
54981
|
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}`;
|
|
54907
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
54982
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
54908
54983
|
}
|
|
54909
54984
|
} else if (Buffer.isBuffer(input)) {
|
|
54910
|
-
buffer =
|
|
54985
|
+
buffer = _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, input);
|
|
54911
54986
|
} else {
|
|
54912
54987
|
buffer = input;
|
|
54913
54988
|
}
|
|
@@ -54916,23 +54991,23 @@ async function parse(input, options) {
|
|
|
54916
54991
|
}
|
|
54917
54992
|
const format2 = detectFormat(buffer);
|
|
54918
54993
|
const result = await dispatch(format2, buffer, opts);
|
|
54919
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54994
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1392 => _1392.images]) === false) {
|
|
54920
54995
|
delete result.images;
|
|
54921
54996
|
dropImageBytes(result.blocks);
|
|
54922
54997
|
}
|
|
54923
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54998
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1393 => _1393.classifyTables])) classifyTableTree(result.blocks);
|
|
54924
54999
|
let out = result;
|
|
54925
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
55000
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1394 => _1394.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
54926
55001
|
out = { ...result, warnings: [..._nullishCoalesce(result.warnings, () => ( [])), { code: "PARTIAL_PARSE", message: `\uC694\uCCAD\uD55C \uCABD \uBC94\uC704(${opts.pages})\uAC00 \uBB38\uC11C \uCABD(1~${result.pageCount})\uACFC \uACB9\uCE58\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4` }] };
|
|
54927
55002
|
}
|
|
54928
55003
|
if (out.success && !out.pages) {
|
|
54929
|
-
const pages =
|
|
55004
|
+
const pages = _chunkGZEVDQ7Scjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1395 => _1395.tableFormat]) }));
|
|
54930
55005
|
if (pages) out = { ...out, pages };
|
|
54931
55006
|
}
|
|
54932
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
55007
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1396 => _1396.plain])) {
|
|
54933
55008
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
54934
55009
|
}
|
|
54935
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
55010
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1397 => _1397.htmlTables])) {
|
|
54936
55011
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
54937
55012
|
}
|
|
54938
55013
|
return out;
|
|
@@ -54977,42 +55052,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54977
55052
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54978
55053
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54979
55054
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54980
|
-
let md2 =
|
|
54981
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
55055
|
+
let md2 = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1398 => _1398.tableFormat]) });
|
|
55056
|
+
if (_optionalChain([options, 'optionalAccess', _1399 => _1399.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1400 => _1400.length])) {
|
|
54982
55057
|
try {
|
|
54983
|
-
md2 =
|
|
55058
|
+
md2 = _chunkGZEVDQ7Scjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54984
55059
|
} catch (e48) {
|
|
54985
55060
|
}
|
|
54986
55061
|
}
|
|
54987
55062
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54988
55063
|
}
|
|
54989
55064
|
function scriptsOff(r, off) {
|
|
54990
|
-
return off ?
|
|
55065
|
+
return off ? _chunkZEVEVTRGcjs.stripScriptTags.call(void 0, r) : r;
|
|
54991
55066
|
}
|
|
54992
55067
|
async function parseImage(buffer, options) {
|
|
54993
55068
|
try {
|
|
54994
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
55069
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-YUVG57VO.cjs")));
|
|
54995
55070
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54996
|
-
|
|
55071
|
+
_chunkZEVEVTRGcjs.stripScriptTags.call(void 0, { blocks });
|
|
54997
55072
|
return {
|
|
54998
55073
|
success: true,
|
|
54999
55074
|
fileType: "image",
|
|
55000
|
-
markdown:
|
|
55075
|
+
markdown: _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1401 => _1401.tableFormat]) }),
|
|
55001
55076
|
blocks,
|
|
55002
55077
|
warnings: warnings.length ? warnings : void 0,
|
|
55003
55078
|
pageCount: 1,
|
|
55004
|
-
..._optionalChain([options, 'optionalAccess',
|
|
55079
|
+
..._optionalChain([options, 'optionalAccess', _1402 => _1402.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
55005
55080
|
};
|
|
55006
55081
|
} catch (err) {
|
|
55007
|
-
return { success: false, fileType: "image", error:
|
|
55082
|
+
return { success: false, fileType: "image", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55008
55083
|
}
|
|
55009
55084
|
}
|
|
55010
55085
|
async function parseHwp3(buffer, options) {
|
|
55011
55086
|
try {
|
|
55012
55087
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
55013
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55088
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1403 => _1403.pageCount]) };
|
|
55014
55089
|
} catch (err) {
|
|
55015
|
-
return { success: false, fileType: "hwp3", error:
|
|
55090
|
+
return { success: false, fileType: "hwp3", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55016
55091
|
}
|
|
55017
55092
|
}
|
|
55018
55093
|
async function parseHwpx(buffer, options) {
|
|
@@ -55020,15 +55095,15 @@ async function parseHwpx(buffer, options) {
|
|
|
55020
55095
|
const doc = await parseHwpxDocument(buffer, options);
|
|
55021
55096
|
const { blocks, metadata, outline, images } = doc;
|
|
55022
55097
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
55023
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55098
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1404 => _1404.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1405 => _1405.pageCount]) }, _optionalChain([options, 'optionalAccess', _1406 => _1406.scriptTags]) === false);
|
|
55024
55099
|
} catch (err) {
|
|
55025
|
-
return { success: false, fileType: "hwpx", error:
|
|
55100
|
+
return { success: false, fileType: "hwpx", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55026
55101
|
}
|
|
55027
55102
|
}
|
|
55028
55103
|
async function parseHwp(buffer, options) {
|
|
55029
55104
|
try {
|
|
55030
55105
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
55031
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
55106
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1407 => _1407.filePath])) {
|
|
55032
55107
|
try {
|
|
55033
55108
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
55034
55109
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -55047,15 +55122,15 @@ async function parseHwp(buffer, options) {
|
|
|
55047
55122
|
}
|
|
55048
55123
|
}
|
|
55049
55124
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
55050
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55125
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1408 => _1408.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1409 => _1409.pageCount]) }, _optionalChain([options, 'optionalAccess', _1410 => _1410.scriptTags]) === false);
|
|
55051
55126
|
} catch (err) {
|
|
55052
|
-
return { success: false, fileType: "hwp", error:
|
|
55127
|
+
return { success: false, fileType: "hwp", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55053
55128
|
}
|
|
55054
55129
|
}
|
|
55055
55130
|
async function parsePdf(buffer, options) {
|
|
55056
55131
|
let parsePdfDocument;
|
|
55057
55132
|
try {
|
|
55058
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
55133
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-IBWL5DO6.cjs")));
|
|
55059
55134
|
parsePdfDocument = mod.parsePdfDocument;
|
|
55060
55135
|
} catch (e50) {
|
|
55061
55136
|
return {
|
|
@@ -55067,59 +55142,59 @@ async function parsePdf(buffer, options) {
|
|
|
55067
55142
|
}
|
|
55068
55143
|
try {
|
|
55069
55144
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
55070
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55145
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1411 => _1411.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1412 => _1412.scriptTags]) !== true);
|
|
55071
55146
|
} catch (err) {
|
|
55072
55147
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
55073
|
-
return { success: false, fileType: "pdf", error:
|
|
55148
|
+
return { success: false, fileType: "pdf", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err), isImageBased };
|
|
55074
55149
|
}
|
|
55075
55150
|
}
|
|
55076
55151
|
async function parseXlsx(buffer, options) {
|
|
55077
55152
|
try {
|
|
55078
55153
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
55079
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55154
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1413 => _1413.pageCount]) };
|
|
55080
55155
|
} catch (err) {
|
|
55081
|
-
return { success: false, fileType: "xlsx", error:
|
|
55156
|
+
return { success: false, fileType: "xlsx", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55082
55157
|
}
|
|
55083
55158
|
}
|
|
55084
55159
|
async function parseXls(buffer, options) {
|
|
55085
55160
|
try {
|
|
55086
55161
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
55087
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55162
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1414 => _1414.pageCount]) };
|
|
55088
55163
|
} catch (err) {
|
|
55089
|
-
return { success: false, fileType: "xls", error:
|
|
55164
|
+
return { success: false, fileType: "xls", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55090
55165
|
}
|
|
55091
55166
|
}
|
|
55092
55167
|
async function parseDocx(buffer, options) {
|
|
55093
55168
|
try {
|
|
55094
55169
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
55095
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55170
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1415 => _1415.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1416 => _1416.pageCount]) }, _optionalChain([options, 'optionalAccess', _1417 => _1417.scriptTags]) === false);
|
|
55096
55171
|
} catch (err) {
|
|
55097
|
-
return { success: false, fileType: "docx", error:
|
|
55172
|
+
return { success: false, fileType: "docx", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55098
55173
|
}
|
|
55099
55174
|
}
|
|
55100
55175
|
async function parsePptx(buffer, options) {
|
|
55101
55176
|
try {
|
|
55102
55177
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
55103
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
55178
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1418 => _1418.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1419 => _1419.pageCount]) }, _optionalChain([options, 'optionalAccess', _1420 => _1420.scriptTags]) === false);
|
|
55104
55179
|
} catch (err) {
|
|
55105
|
-
return { success: false, fileType: "pptx", error:
|
|
55180
|
+
return { success: false, fileType: "pptx", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55106
55181
|
}
|
|
55107
55182
|
}
|
|
55108
55183
|
async function parseHwpml(buffer, options) {
|
|
55109
55184
|
try {
|
|
55110
55185
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
55111
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
55186
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1421 => _1421.pageCount]) };
|
|
55112
55187
|
} catch (err) {
|
|
55113
|
-
return { success: false, fileType: "hwpml", error:
|
|
55188
|
+
return { success: false, fileType: "hwpml", error: _chunkJOHVSCHTcjs.sanitizeError.call(void 0, err), code: _chunkJOHVSCHTcjs.classifyError.call(void 0, err) };
|
|
55114
55189
|
}
|
|
55115
55190
|
}
|
|
55116
55191
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
55117
55192
|
let buffer;
|
|
55118
55193
|
if (typeof input === "string") {
|
|
55119
55194
|
const buf = await _promises.readFile.call(void 0, input);
|
|
55120
|
-
buffer =
|
|
55195
|
+
buffer = _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, buf);
|
|
55121
55196
|
} else if (Buffer.isBuffer(input)) {
|
|
55122
|
-
buffer =
|
|
55197
|
+
buffer = _chunkJOHVSCHTcjs.toArrayBuffer.call(void 0, input);
|
|
55123
55198
|
} else {
|
|
55124
55199
|
buffer = input;
|
|
55125
55200
|
}
|
|
@@ -55145,7 +55220,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55145
55220
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
55146
55221
|
}
|
|
55147
55222
|
const fill = fillFormFields(parsed.blocks, values);
|
|
55148
|
-
const markdown =
|
|
55223
|
+
const markdown = _chunkZEVEVTRGcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
55149
55224
|
if (outputFormat === "hwpx") {
|
|
55150
55225
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
55151
55226
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55244,5 +55319,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55244
55319
|
|
|
55245
55320
|
|
|
55246
55321
|
|
|
55247
|
-
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 =
|
|
55322
|
+
exports.AGENCY_COMMON_NAME = AGENCY_COMMON_NAME; 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 = _chunkJOHVSCHTcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkZEVEVTRGcjs.blocksToMarkdown; exports.blocksToPages = _chunkGZEVDQ7Scjs.blocksToPages; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.chooseTableRepresentation = chooseTableRepresentation; exports.classifyTable = classifyTable; exports.classifyTableTree = classifyTableTree; exports.collectTableBlocks = collectTableBlocks; 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.extractRenderedRegions = extractRenderedRegions; exports.extractTables = extractTables; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.flattenLayoutTables = _chunkZEVEVTRGcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkZEVEVTRGcjs.hasStructuredCellContent; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.lintMuncheText = lintMuncheText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.muncheLintWarnings = muncheLintWarnings; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parsePptx = parsePptx; 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.renderDocument = renderDocument; exports.renderDocumentToScene = renderDocumentToScene; exports.renderHtml = renderHtml; exports.renderHwp5Pages = renderHwp5Pages; exports.renderHwpxToSvg = renderHwpxToSvg; exports.renderSceneToHtml = renderSceneToHtml; exports.resolveBuiltinTemplate = resolveBuiltinTemplate; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.usesGaejosikMunche = usesGaejosikMunche; exports.validateHwpx = validateHwpx;
|
|
55248
55323
|
//# sourceMappingURL=index.cjs.map
|