kordoc 4.22.2 → 4.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/dist/{-C437ZARA.js → -AOWV7MNY.js} +11 -11
- package/dist/{chunk-UMNKY2EZ.js → chunk-24YLYR6Q.js} +4 -4
- package/dist/{chunk-EKKZNKJD.cjs → chunk-2BCQVQO2.cjs} +3 -3
- package/dist/{chunk-EKKZNKJD.cjs.map → chunk-2BCQVQO2.cjs.map} +1 -1
- package/dist/{chunk-GFQIKYBV.js → chunk-3ANXRVI2.js} +3 -3
- package/dist/{chunk-CNMUT5YW.js → chunk-3H2IEU4V.js} +2 -2
- package/dist/{chunk-GVBQVXXB.js → chunk-4NQ4EZEE.js} +14 -4
- package/dist/chunk-4NQ4EZEE.js.map +1 -0
- package/dist/{chunk-56GBOIOE.js → chunk-6LIBF2ZB.js} +2 -2
- package/dist/{chunk-2X64TI7I.js → chunk-6QBBGZST.js} +2 -2
- package/dist/{chunk-FPUBEM3F.js → chunk-7XITVUAK.js} +11 -11
- package/dist/{chunk-S4KQUVBV.js → chunk-AXX5AQT4.js} +4 -4
- package/dist/{chunk-U3TZVR7A.js → chunk-BS2XWGT5.js} +2 -2
- package/dist/{chunk-4BJZGXNM.js → chunk-DKJ2RNDG.js} +2 -2
- package/dist/{chunk-IRP6QS3K.js → chunk-FDFXL7VJ.js} +3 -3
- package/dist/{chunk-YOFKJ7IM.js → chunk-IRNWAHHZ.js} +2 -2
- package/dist/{chunk-QFJCEHY7.js → chunk-J5PYESLX.js} +14 -4
- package/dist/chunk-J5PYESLX.js.map +1 -0
- package/dist/{chunk-AXR7OKQY.js → chunk-KBGNPGVY.js} +2 -2
- package/dist/{chunk-UV2G6XFA.js → chunk-M2X766AY.js} +2 -2
- package/dist/{chunk-YTEMFVZB.js → chunk-MEIQ476H.js} +2 -2
- package/dist/{chunk-AUWO57ED.cjs → chunk-MI655NV5.cjs} +2 -2
- package/dist/{chunk-AUWO57ED.cjs.map → chunk-MI655NV5.cjs.map} +1 -1
- package/dist/{chunk-ENV25MPM.cjs → chunk-NJEMRAIF.cjs} +24 -24
- package/dist/{chunk-ENV25MPM.cjs.map → chunk-NJEMRAIF.cjs.map} +1 -1
- package/dist/{chunk-I4BS4BXE.cjs → chunk-NLGOMLGU.cjs} +23 -23
- package/dist/{chunk-I4BS4BXE.cjs.map → chunk-NLGOMLGU.cjs.map} +1 -1
- package/dist/{chunk-ZLFUZM7H.cjs → chunk-O3OS6FAW.cjs} +3 -3
- package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-O3OS6FAW.cjs.map} +1 -1
- package/dist/{chunk-4GCS7WJJ.js → chunk-O5E25RHU.js} +2 -2
- package/dist/{chunk-NGDMJICC.js → chunk-OIF5HRVP.js} +4 -4
- package/dist/{chunk-MED2MR6O.cjs → chunk-SJ5OZXEL.cjs} +23 -13
- package/dist/chunk-SJ5OZXEL.cjs.map +1 -0
- package/dist/{chunk-3LJ6QO53.js → chunk-SKRWKVVW.js} +3 -3
- package/dist/{chunk-VUC4JJUM.js → chunk-UCLDUUBX.js} +2 -2
- package/dist/{chunk-L6PFPBTK.js → chunk-VJCQOSMT.js} +2 -2
- package/dist/{chunk-DQXP3ELP.js → chunk-X45Q7EAC.js} +2 -2
- package/dist/{chunk-L6N4OMKR.js → chunk-YOGMCRM7.js} +54 -7
- package/dist/chunk-YOGMCRM7.js.map +1 -0
- package/dist/chunks-7KXTS7IV.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-3TVRNJ66.cjs → formula-5V2WG4BH.cjs} +9 -9
- package/dist/{formula-3TVRNJ66.cjs.map → formula-5V2WG4BH.cjs.map} +1 -1
- package/dist/{formula-HUENRCPJ.js → formula-C26FMMGO.js} +3 -3
- package/dist/{formula-43QBPAL5.js → formula-W4OL33YQ.js} +4 -4
- package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-BELHEWPX.cjs} +17 -17
- package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-BELHEWPX.cjs.map} +1 -1
- package/dist/{image-ocr-HYAKWJGE.js → image-ocr-NSQ34Y6T.js} +9 -9
- package/dist/{image-ocr-BAHDLDV5.js → image-ocr-T72HMX2W.js} +6 -6
- package/dist/index.cjs +453 -406
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-23WBSECG.js → model-bundle-34T2LJB4.js} +5 -5
- package/dist/{models-NRZQY45P.js → models-TQH5EM6V.js} +5 -5
- package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-YEYLILGJ.js} +12 -12
- package/dist/{parser-XNOLC3MZ.js → parser-E6BG3ECD.js} +72 -12
- package/dist/parser-E6BG3ECD.js.map +1 -0
- package/dist/{parser-OKAQRZKM.cjs → parser-OAXCXVQ4.cjs} +327 -267
- package/dist/parser-OAXCXVQ4.cjs.map +1 -0
- package/dist/{parser-FNUQW2F3.js → parser-SJHCBL7T.js} +75 -15
- package/dist/parser-SJHCBL7T.js.map +1 -0
- package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-LGPSJM22.js} +6 -6
- package/dist/pdf-ocr-RKXDY3ZA.cjs +31 -0
- package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-RKXDY3ZA.cjs.map} +1 -1
- package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-T5ASSUKK.js} +9 -9
- package/dist/{profile-io-HC6FMYX4.js → profile-io-KMCAFTMG.js} +3 -3
- package/dist/{rasterize-QLTROEV2.js → rasterize-M52AKY7R.js} +3 -3
- package/dist/{redact-doc-V4KMM2QV.js → redact-doc-SWJC27LL.js} +11 -11
- package/dist/{render-V4S3QLTR.js → render-45AB5YZR.js} +7 -7
- package/dist/seal-7KWG6VHS.js +10 -0
- package/dist/{setup-HU7ZOQNM.js → setup-5PBMUI6M.js} +3 -3
- package/dist/visual-OMJNXLNZ.js +21 -0
- package/dist/{watch-NPIZ6DSJ.js → watch-QOGKV52T.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GVBQVXXB.js.map +0 -1
- package/dist/chunk-L6N4OMKR.js.map +0 -1
- package/dist/chunk-MED2MR6O.cjs.map +0 -1
- package/dist/chunk-QFJCEHY7.js.map +0 -1
- package/dist/chunks-MPOOHZVO.js +0 -10
- package/dist/parser-FNUQW2F3.js.map +0 -1
- package/dist/parser-OKAQRZKM.cjs.map +0 -1
- package/dist/parser-XNOLC3MZ.js.map +0 -1
- package/dist/pdf-ocr-6UXBIQE6.cjs +0 -31
- package/dist/seal-MQ5TB5YZ.js +0 -10
- package/dist/visual-RLIFC4XC.js +0 -21
- /package/dist/{-C437ZARA.js.map → -AOWV7MNY.js.map} +0 -0
- /package/dist/{chunk-UMNKY2EZ.js.map → chunk-24YLYR6Q.js.map} +0 -0
- /package/dist/{chunk-GFQIKYBV.js.map → chunk-3ANXRVI2.js.map} +0 -0
- /package/dist/{chunk-CNMUT5YW.js.map → chunk-3H2IEU4V.js.map} +0 -0
- /package/dist/{chunk-56GBOIOE.js.map → chunk-6LIBF2ZB.js.map} +0 -0
- /package/dist/{chunk-2X64TI7I.js.map → chunk-6QBBGZST.js.map} +0 -0
- /package/dist/{chunk-FPUBEM3F.js.map → chunk-7XITVUAK.js.map} +0 -0
- /package/dist/{chunk-S4KQUVBV.js.map → chunk-AXX5AQT4.js.map} +0 -0
- /package/dist/{chunk-U3TZVR7A.js.map → chunk-BS2XWGT5.js.map} +0 -0
- /package/dist/{chunk-4BJZGXNM.js.map → chunk-DKJ2RNDG.js.map} +0 -0
- /package/dist/{chunk-IRP6QS3K.js.map → chunk-FDFXL7VJ.js.map} +0 -0
- /package/dist/{chunk-YOFKJ7IM.js.map → chunk-IRNWAHHZ.js.map} +0 -0
- /package/dist/{chunk-AXR7OKQY.js.map → chunk-KBGNPGVY.js.map} +0 -0
- /package/dist/{chunk-UV2G6XFA.js.map → chunk-M2X766AY.js.map} +0 -0
- /package/dist/{chunk-YTEMFVZB.js.map → chunk-MEIQ476H.js.map} +0 -0
- /package/dist/{chunk-4GCS7WJJ.js.map → chunk-O5E25RHU.js.map} +0 -0
- /package/dist/{chunk-NGDMJICC.js.map → chunk-OIF5HRVP.js.map} +0 -0
- /package/dist/{chunk-3LJ6QO53.js.map → chunk-SKRWKVVW.js.map} +0 -0
- /package/dist/{chunk-VUC4JJUM.js.map → chunk-UCLDUUBX.js.map} +0 -0
- /package/dist/{chunk-L6PFPBTK.js.map → chunk-VJCQOSMT.js.map} +0 -0
- /package/dist/{chunk-DQXP3ELP.js.map → chunk-X45Q7EAC.js.map} +0 -0
- /package/dist/{chunks-MPOOHZVO.js.map → chunks-7KXTS7IV.js.map} +0 -0
- /package/dist/{formula-HUENRCPJ.js.map → formula-C26FMMGO.js.map} +0 -0
- /package/dist/{formula-43QBPAL5.js.map → formula-W4OL33YQ.js.map} +0 -0
- /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-NSQ34Y6T.js.map} +0 -0
- /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-T72HMX2W.js.map} +0 -0
- /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-34T2LJB4.js.map} +0 -0
- /package/dist/{models-NRZQY45P.js.map → models-TQH5EM6V.js.map} +0 -0
- /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-YEYLILGJ.js.map} +0 -0
- /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-LGPSJM22.js.map} +0 -0
- /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-T5ASSUKK.js.map} +0 -0
- /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-KMCAFTMG.js.map} +0 -0
- /package/dist/{rasterize-QLTROEV2.js.map → rasterize-M52AKY7R.js.map} +0 -0
- /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-SWJC27LL.js.map} +0 -0
- /package/dist/{render-V4S3QLTR.js.map → render-45AB5YZR.js.map} +0 -0
- /package/dist/{seal-MQ5TB5YZ.js.map → seal-7KWG6VHS.js.map} +0 -0
- /package/dist/{setup-HU7ZOQNM.js.map → setup-5PBMUI6M.js.map} +0 -0
- /package/dist/{visual-RLIFC4XC.js.map → visual-OMJNXLNZ.js.map} +0 -0
- /package/dist/{watch-NPIZ6DSJ.js.map → watch-QOGKV52T.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk2BCQVQO2cjs = require('./chunk-2BCQVQO2.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -37,7 +37,7 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _chunkSJ5OZXELcjs = require('./chunk-SJ5OZXEL.cjs');
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
|
|
@@ -55,14 +55,14 @@ var _chunkMED2MR6Ocjs = require('./chunk-MED2MR6O.cjs');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
var
|
|
58
|
+
var _chunkMI655NV5cjs = require('./chunk-MI655NV5.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
62
62
|
|
|
63
63
|
// src/plain-markdown.ts
|
|
64
64
|
function toPlainMarkdown(md2) {
|
|
65
|
-
return
|
|
65
|
+
return _chunkSJ5OZXELcjs.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();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// src/html-tables.ts
|
|
@@ -596,9 +596,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// src/hwpx/parser-shared.ts
|
|
599
|
-
var MAX_DECOMPRESS_SIZE =
|
|
599
|
+
var MAX_DECOMPRESS_SIZE = _chunkMI655NV5cjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
600
600
|
var MAX_ZIP_ENTRIES = 500;
|
|
601
|
-
var ZipBombError = class extends
|
|
601
|
+
var ZipBombError = class extends _chunkMI655NV5cjs.KordocError {
|
|
602
602
|
constructor(message) {
|
|
603
603
|
super(message);
|
|
604
604
|
this.name = "ZipBombError";
|
|
@@ -648,7 +648,7 @@ function createSectionShared() {
|
|
|
648
648
|
function createXmlParser(warnings) {
|
|
649
649
|
return new (0, _xmldom.DOMParser)({
|
|
650
650
|
onError(level, msg2) {
|
|
651
|
-
if (level === "fatalError") throw new (0,
|
|
651
|
+
if (level === "fatalError") throw new (0, _chunkMI655NV5cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
652
652
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
653
653
|
}
|
|
654
654
|
});
|
|
@@ -683,13 +683,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
683
683
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
684
684
|
const checksumType = attrOf(inner, "checksum-type");
|
|
685
685
|
if (algorithm !== AES256_CBC) {
|
|
686
|
-
throw new (0,
|
|
686
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
687
687
|
}
|
|
688
688
|
if (startKey !== START_KEY_SHA256) {
|
|
689
|
-
throw new (0,
|
|
689
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
690
690
|
}
|
|
691
691
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
692
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
693
|
}
|
|
694
694
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
695
695
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -697,10 +697,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
697
697
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
698
698
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
699
699
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
700
|
-
throw new (0,
|
|
700
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
701
701
|
}
|
|
702
702
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
703
|
-
throw new (0,
|
|
703
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
704
704
|
}
|
|
705
705
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
706
706
|
}
|
|
@@ -734,12 +734,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
734
734
|
for (const entry of entries) {
|
|
735
735
|
const file = zip.file(entry.path);
|
|
736
736
|
if (!file) {
|
|
737
|
-
throw new (0,
|
|
737
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
738
738
|
}
|
|
739
739
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
740
740
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
741
741
|
if (!plain4) {
|
|
742
|
-
throw new (0,
|
|
742
|
+
throw new (0, _chunkMI655NV5cjs.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.");
|
|
743
743
|
}
|
|
744
744
|
used += plain4.length;
|
|
745
745
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -805,10 +805,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
805
805
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
806
806
|
if (decompressed) {
|
|
807
807
|
decompressed.total += xml.length * 2;
|
|
808
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
808
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
809
809
|
}
|
|
810
810
|
const parser = createXmlParser();
|
|
811
|
-
const doc = parser.parseFromString(
|
|
811
|
+
const doc = parser.parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
812
812
|
if (!doc.documentElement) continue;
|
|
813
813
|
const domDoc = doc;
|
|
814
814
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1021,9 +1021,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1021
1021
|
let level = 0;
|
|
1022
1022
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1023
1023
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1024
|
-
if (ratio >=
|
|
1025
|
-
else if (ratio >=
|
|
1026
|
-
else if (ratio >=
|
|
1024
|
+
if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H1) level = 1;
|
|
1025
|
+
else if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H2) level = 2;
|
|
1026
|
+
else if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H3) level = 3;
|
|
1027
1027
|
}
|
|
1028
1028
|
const compactText = text.replace(/\s+/g, "");
|
|
1029
1029
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1758,7 +1758,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1758
1758
|
|
|
1759
1759
|
// src/hwpx/table-build.ts
|
|
1760
1760
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1761
|
-
const table2 =
|
|
1761
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1762
1762
|
if (state.caption) table2.caption = state.caption;
|
|
1763
1763
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1764
1764
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1787,7 +1787,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1787
1787
|
for (const src of row) {
|
|
1788
1788
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1789
1789
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1790
|
-
if (cand && anchors2.includes(cand))
|
|
1790
|
+
if (cand && anchors2.includes(cand)) _chunkSJ5OZXELcjs.CELL_EDGES.set(cand, src.edges);
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
1793
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1837,7 +1837,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1837
1837
|
const cell2 = parentTable.cell;
|
|
1838
1838
|
(cell2.blocks ??= []).push(block);
|
|
1839
1839
|
cell2.hasStructure = true;
|
|
1840
|
-
let flat =
|
|
1840
|
+
let flat = _chunkSJ5OZXELcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1841
1841
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1842
1842
|
if (flat) {
|
|
1843
1843
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2071,7 +2071,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2071
2071
|
const tkids = rc.childNodes;
|
|
2072
2072
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2073
2073
|
const tk = tkids[k];
|
|
2074
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2074
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2075
2075
|
else if (tk.nodeType === 1) {
|
|
2076
2076
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2077
2077
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2091,7 +2091,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2091
2091
|
const span2 = { text };
|
|
2092
2092
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2093
2093
|
else {
|
|
2094
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2094
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkSJ5OZXELcjs.wrapScript.call(void 0, text, cp.script);
|
|
2095
2095
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2096
2096
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2097
2097
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2111,7 +2111,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
if (requireMixed && !merged.some((s) => s.strike || s.underline) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
|
|
2114
|
-
for (const s of merged) s.text =
|
|
2114
|
+
for (const s of merged) s.text = _chunkSJ5OZXELcjs.tidyScriptTags.call(void 0, s.text);
|
|
2115
2115
|
return merged;
|
|
2116
2116
|
}
|
|
2117
2117
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2138,7 +2138,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2138
2138
|
// src/hwpx/section-walker.ts
|
|
2139
2139
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2140
2140
|
const parser = createXmlParser(warnings);
|
|
2141
|
-
const doc = parser.parseFromString(
|
|
2141
|
+
const doc = parser.parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2142
2142
|
if (!doc.documentElement) return [];
|
|
2143
2143
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2144
2144
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2239,8 +2239,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2239
2239
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2240
2240
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2241
2241
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2242
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2243
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2242
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkSJ5OZXELcjs.MAX_COLS);
|
|
2243
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkSJ5OZXELcjs.MAX_ROWS);
|
|
2244
2244
|
}
|
|
2245
2245
|
break;
|
|
2246
2246
|
case "p": {
|
|
@@ -2563,7 +2563,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2563
2563
|
const sink = [];
|
|
2564
2564
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2565
2565
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2566
|
-
let flat =
|
|
2566
|
+
let flat = _chunkSJ5OZXELcjs.convertTableToText.call(void 0, st.rows);
|
|
2567
2567
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2568
2568
|
const built = [];
|
|
2569
2569
|
completeTable(st, [], built, ctx);
|
|
@@ -2727,7 +2727,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2727
2727
|
let url = (ch.textContent || "").trim();
|
|
2728
2728
|
if (!url) continue;
|
|
2729
2729
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2730
|
-
const safe =
|
|
2730
|
+
const safe = _chunkMI655NV5cjs.sanitizeHref.call(void 0, url);
|
|
2731
2731
|
if (safe) return safe;
|
|
2732
2732
|
}
|
|
2733
2733
|
return void 0;
|
|
@@ -2883,7 +2883,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2883
2883
|
_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" })]);
|
|
2884
2884
|
}
|
|
2885
2885
|
} else {
|
|
2886
|
-
text +=
|
|
2886
|
+
text += _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2887
2887
|
}
|
|
2888
2888
|
continue;
|
|
2889
2889
|
}
|
|
@@ -2936,7 +2936,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2936
2936
|
case "hyperlink": {
|
|
2937
2937
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2938
2938
|
if (url) {
|
|
2939
|
-
const safe =
|
|
2939
|
+
const safe = _chunkMI655NV5cjs.sanitizeHref.call(void 0, url);
|
|
2940
2940
|
if (safe) href = safe;
|
|
2941
2941
|
}
|
|
2942
2942
|
walk(child, depth + 1);
|
|
@@ -3030,7 +3030,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3030
3030
|
walk(child, depth + 1);
|
|
3031
3031
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
3032
3032
|
const added = text.slice(start);
|
|
3033
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
3033
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkSJ5OZXELcjs.wrapScript.call(void 0, added, script);
|
|
3034
3034
|
}
|
|
3035
3035
|
break;
|
|
3036
3036
|
}
|
|
@@ -3053,7 +3053,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3053
3053
|
}
|
|
3054
3054
|
if (applied.length) href = void 0;
|
|
3055
3055
|
}
|
|
3056
|
-
text =
|
|
3056
|
+
text = _chunkSJ5OZXELcjs.tidyScriptTags.call(void 0, text);
|
|
3057
3057
|
const toc = takeTocLeaders(text);
|
|
3058
3058
|
text = toc.text;
|
|
3059
3059
|
const tocEntry = toc.tocEntry;
|
|
@@ -3167,7 +3167,7 @@ function decompressStream(data) {
|
|
|
3167
3167
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3168
3168
|
}
|
|
3169
3169
|
function parseFileHeader(data) {
|
|
3170
|
-
if (data.length < 40) throw new (0,
|
|
3170
|
+
if (data.length < 40) throw new (0, _chunkMI655NV5cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3171
3171
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3172
3172
|
return {
|
|
3173
3173
|
signature: sig,
|
|
@@ -3694,13 +3694,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3694
3694
|
}
|
|
3695
3695
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3696
3696
|
for (const path of allCandidates) {
|
|
3697
|
-
if (
|
|
3697
|
+
if (_chunkMI655NV5cjs.isPathTraversal.call(void 0, path)) continue;
|
|
3698
3698
|
const file = zip.file(path);
|
|
3699
3699
|
if (!file) continue;
|
|
3700
3700
|
try {
|
|
3701
3701
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3702
3702
|
decompressed.total += data.length;
|
|
3703
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3703
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3704
3704
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3705
3705
|
const extMime = imageExtToMime(ext);
|
|
3706
3706
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3711,7 +3711,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3711
3711
|
usedPaths.add(path);
|
|
3712
3712
|
break;
|
|
3713
3713
|
} catch (err) {
|
|
3714
|
-
if (err instanceof
|
|
3714
|
+
if (err instanceof _chunkMI655NV5cjs.KordocError) throw err;
|
|
3715
3715
|
}
|
|
3716
3716
|
}
|
|
3717
3717
|
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" })]);
|
|
@@ -3731,13 +3731,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3731
3731
|
if (sweepUnreferenced) {
|
|
3732
3732
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3733
3733
|
for (const file of binEntries) {
|
|
3734
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3734
|
+
if (file.dir || usedPaths.has(file.name) || _chunkMI655NV5cjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3735
3735
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3736
3736
|
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;
|
|
3737
3737
|
try {
|
|
3738
3738
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3739
3739
|
decompressed.total += data.length;
|
|
3740
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3740
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3741
3741
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3742
3742
|
let mimeType = imageExtToMime(ext);
|
|
3743
3743
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3751,7 +3751,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3751
3751
|
images.push(img);
|
|
3752
3752
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3753
3753
|
} catch (err) {
|
|
3754
|
-
if (err instanceof
|
|
3754
|
+
if (err instanceof _chunkMI655NV5cjs.KordocError) throw err;
|
|
3755
3755
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3756
3756
|
}
|
|
3757
3757
|
}
|
|
@@ -3802,7 +3802,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3802
3802
|
}
|
|
3803
3803
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3804
3804
|
const name = new TextDecoder().decode(nameBytes);
|
|
3805
|
-
if (
|
|
3805
|
+
if (_chunkMI655NV5cjs.isPathTraversal.call(void 0, name)) {
|
|
3806
3806
|
pos = fileStart + compSize;
|
|
3807
3807
|
continue;
|
|
3808
3808
|
}
|
|
@@ -3820,7 +3820,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3820
3820
|
continue;
|
|
3821
3821
|
}
|
|
3822
3822
|
totalDecompressed += content.length * 2;
|
|
3823
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3823
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3824
3824
|
sectionNum++;
|
|
3825
3825
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3826
3826
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3829,9 +3829,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3829
3829
|
continue;
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
|
-
if (blocks.length === 0) throw new (0,
|
|
3832
|
+
if (blocks.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3833
3833
|
applyPageText(blocks, shared);
|
|
3834
|
-
const markdown =
|
|
3834
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3835
3835
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3836
3836
|
}
|
|
3837
3837
|
async function readKordocLayout(zip) {
|
|
@@ -3856,11 +3856,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3856
3856
|
if (paths.length > 0) return paths;
|
|
3857
3857
|
}
|
|
3858
3858
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3859
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3859
|
+
return sectionFiles.map((f) => f.name).sort(_chunkMI655NV5cjs.compareSectionPaths);
|
|
3860
3860
|
}
|
|
3861
3861
|
function parseSectionPathsFromManifest(xml) {
|
|
3862
3862
|
const parser = createXmlParser();
|
|
3863
|
-
const doc = parser.parseFromString(
|
|
3863
|
+
const doc = parser.parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3864
3864
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3865
3865
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3866
3866
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3870,7 +3870,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3870
3870
|
for (let i = 0; i < items.length; i++) {
|
|
3871
3871
|
const item = items[i];
|
|
3872
3872
|
const id = item.getAttribute("id") || "";
|
|
3873
|
-
const href =
|
|
3873
|
+
const href = _chunkMI655NV5cjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3874
3874
|
if (id && href) idToHref.set(id, href);
|
|
3875
3875
|
}
|
|
3876
3876
|
if (spine.length > 0) {
|
|
@@ -3881,7 +3881,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
if (ordered.length > 0) return ordered;
|
|
3883
3883
|
}
|
|
3884
|
-
return Array.from(idToHref.values()).sort(
|
|
3884
|
+
return Array.from(idToHref.values()).sort(_chunkMI655NV5cjs.compareSectionPaths);
|
|
3885
3885
|
}
|
|
3886
3886
|
|
|
3887
3887
|
// src/hwpx/metadata.ts
|
|
@@ -3893,7 +3893,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3893
3893
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3894
3894
|
if (decompressed) {
|
|
3895
3895
|
decompressed.total += xml.length * 2;
|
|
3896
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3896
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3897
3897
|
}
|
|
3898
3898
|
return xml;
|
|
3899
3899
|
};
|
|
@@ -3915,7 +3915,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
3917
|
function parseOpfMetadata(xml, metadata) {
|
|
3918
|
-
const root = createXmlParser().parseFromString(
|
|
3918
|
+
const root = createXmlParser().parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3919
3919
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3920
3920
|
if (!md2) return;
|
|
3921
3921
|
let title;
|
|
@@ -3948,7 +3948,7 @@ function isoDate(s) {
|
|
|
3948
3948
|
}
|
|
3949
3949
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3950
3950
|
const parser = createXmlParser();
|
|
3951
|
-
const doc = parser.parseFromString(
|
|
3951
|
+
const doc = parser.parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3952
3952
|
if (!doc.documentElement) return;
|
|
3953
3953
|
const getText = (tagNames) => {
|
|
3954
3954
|
for (const tag of tagNames) {
|
|
@@ -3987,7 +3987,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3987
3987
|
}
|
|
3988
3988
|
}
|
|
3989
3989
|
async function parseHwpxDocument(buffer, options) {
|
|
3990
|
-
|
|
3990
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3991
3991
|
let zip;
|
|
3992
3992
|
try {
|
|
3993
3993
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3996,7 +3996,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3996
3996
|
}
|
|
3997
3997
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3998
3998
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3999
|
-
throw new (0,
|
|
3999
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
4000
4000
|
}
|
|
4001
4001
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
4002
4002
|
if (manifestFile) {
|
|
@@ -4016,7 +4016,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4016
4016
|
}
|
|
4017
4017
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
4018
4018
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
4019
|
-
throw new (0,
|
|
4019
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
4020
4020
|
/\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."
|
|
4021
4021
|
);
|
|
4022
4022
|
}
|
|
@@ -4028,7 +4028,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4028
4028
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
4029
4029
|
const warnings = [];
|
|
4030
4030
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
4031
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
4031
|
+
if (sectionPaths.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4032
4032
|
let allBlocks = [];
|
|
4033
4033
|
const shared = createSectionShared();
|
|
4034
4034
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4072,10 +4072,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4072
4072
|
const blocks = allBlocks;
|
|
4073
4073
|
applyPageText(blocks, shared);
|
|
4074
4074
|
const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !_optionalChain([options, 'optionalAccess', _173 => _173.pages]), shared.track.deletedImageRefs);
|
|
4075
|
-
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks :
|
|
4075
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkSJ5OZXELcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4076
4076
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4077
4077
|
const outline = shown.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
4078
|
-
const markdown =
|
|
4078
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4079
4079
|
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 };
|
|
4080
4080
|
}
|
|
4081
4081
|
|
|
@@ -4842,7 +4842,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4842
4842
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4843
4843
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4844
4844
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4845
|
-
const wrong = () => new (0,
|
|
4845
|
+
const wrong = () => new (0, _chunkMI655NV5cjs.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.");
|
|
4846
4846
|
let records;
|
|
4847
4847
|
try {
|
|
4848
4848
|
records = readRecords3(data);
|
|
@@ -4854,7 +4854,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4854
4854
|
}
|
|
4855
4855
|
function assertSupportedEncryptVersion(version) {
|
|
4856
4856
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4857
|
-
throw new (0,
|
|
4857
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
4858
4858
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4859
4859
|
);
|
|
4860
4860
|
}
|
|
@@ -5297,7 +5297,7 @@ function emitParagraphBlocks(p) {
|
|
|
5297
5297
|
return blocks;
|
|
5298
5298
|
}
|
|
5299
5299
|
function tableFlatText(table2) {
|
|
5300
|
-
const flat =
|
|
5300
|
+
const flat = _chunkSJ5OZXELcjs.convertTableToText.call(void 0, table2.cells);
|
|
5301
5301
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5302
5302
|
}
|
|
5303
5303
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5378,8 +5378,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5378
5378
|
}
|
|
5379
5379
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5380
5380
|
for (const c of cells) {
|
|
5381
|
-
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1,
|
|
5382
|
-
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1,
|
|
5381
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkSJ5OZXELcjs.MAX_ROWS));
|
|
5382
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkSJ5OZXELcjs.MAX_COLS));
|
|
5383
5383
|
}
|
|
5384
5384
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5385
5385
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5387,12 +5387,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5387
5387
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5388
5388
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5389
5389
|
}
|
|
5390
|
-
const table2 =
|
|
5390
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5391
5391
|
if (table2.rows === 0) return null;
|
|
5392
5392
|
for (const c of placed) {
|
|
5393
5393
|
if (c.edges) {
|
|
5394
5394
|
const at = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _185 => _185[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
5395
|
-
if (at)
|
|
5395
|
+
if (at) _chunkSJ5OZXELcjs.CELL_EDGES.set(at, c.edges);
|
|
5396
5396
|
}
|
|
5397
5397
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5398
5398
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5594,7 +5594,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5594
5594
|
continue;
|
|
5595
5595
|
}
|
|
5596
5596
|
if (!ctrl.href) continue;
|
|
5597
|
-
const href =
|
|
5597
|
+
const href = _chunkMI655NV5cjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5598
5598
|
if (!href) continue;
|
|
5599
5599
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5600
5600
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5603,7 +5603,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5603
5603
|
}
|
|
5604
5604
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5605
5605
|
text = resolveLiteralLt(text);
|
|
5606
|
-
text =
|
|
5606
|
+
text = _chunkSJ5OZXELcjs.tidyScriptTags.call(void 0, text);
|
|
5607
5607
|
const toc = takeTocLeaders(text);
|
|
5608
5608
|
text = toc.text;
|
|
5609
5609
|
let headingLevel = 0;
|
|
@@ -5823,7 +5823,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5823
5823
|
}
|
|
5824
5824
|
var A4_HEIGHT = 84188;
|
|
5825
5825
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5826
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5826
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkSJ5OZXELcjs.markNonLayoutTable.call(void 0, table2);
|
|
5827
5827
|
}
|
|
5828
5828
|
function parseTableControl(ctrl, records, ctx) {
|
|
5829
5829
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5835,8 +5835,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5835
5835
|
let tableIdx = -1;
|
|
5836
5836
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5837
5837
|
if (records[i2].tagId === TAG_TABLE && records[i2].level === directLevel && records[i2].data.length >= 8) {
|
|
5838
|
-
rows = Math.min(records[i2].data.readUInt16LE(4),
|
|
5839
|
-
cols = Math.min(records[i2].data.readUInt16LE(6),
|
|
5838
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkSJ5OZXELcjs.MAX_ROWS);
|
|
5839
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkSJ5OZXELcjs.MAX_COLS);
|
|
5840
5840
|
tableIdx = i2;
|
|
5841
5841
|
break;
|
|
5842
5842
|
}
|
|
@@ -5880,11 +5880,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5880
5880
|
return table3;
|
|
5881
5881
|
}
|
|
5882
5882
|
if (rows === 0 || cols === 0) {
|
|
5883
|
-
rows = Math.min(cells.length,
|
|
5883
|
+
rows = Math.min(cells.length, _chunkSJ5OZXELcjs.MAX_ROWS);
|
|
5884
5884
|
cols = 1;
|
|
5885
5885
|
}
|
|
5886
5886
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5887
|
-
const table2 =
|
|
5887
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5888
5888
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5889
5889
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5890
5890
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5903,8 +5903,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5903
5903
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5904
5904
|
const cs = rec.data.readUInt16LE(12);
|
|
5905
5905
|
const rs = rec.data.readUInt16LE(14);
|
|
5906
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5907
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5906
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkSJ5OZXELcjs.MAX_COLS);
|
|
5907
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkSJ5OZXELcjs.MAX_ROWS);
|
|
5908
5908
|
}
|
|
5909
5909
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5910
5910
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6053,7 +6053,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6053
6053
|
lenientCfb = parseLenientCfb(buffer);
|
|
6054
6054
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6055
6055
|
} catch (e24) {
|
|
6056
|
-
throw new (0,
|
|
6056
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6057
6057
|
}
|
|
6058
6058
|
}
|
|
6059
6059
|
const readRawStream = (path) => {
|
|
@@ -6064,14 +6064,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6064
6064
|
return lenientCfb.findStream(path);
|
|
6065
6065
|
};
|
|
6066
6066
|
const headerData = readRawStream("/FileHeader");
|
|
6067
|
-
if (!headerData) throw new (0,
|
|
6067
|
+
if (!headerData) throw new (0, _chunkMI655NV5cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6068
6068
|
const header = parseFileHeader(headerData);
|
|
6069
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6070
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6069
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkMI655NV5cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6070
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkMI655NV5cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6071
6071
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6072
6072
|
if (encrypted) {
|
|
6073
6073
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6074
|
-
throw new (0,
|
|
6074
|
+
throw new (0, _chunkMI655NV5cjs.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.");
|
|
6075
6075
|
}
|
|
6076
6076
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6077
6077
|
}
|
|
@@ -6085,12 +6085,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6085
6085
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6086
6086
|
if (encrypted) {
|
|
6087
6087
|
const rawDocInfo = findStream("/DocInfo");
|
|
6088
|
-
if (!rawDocInfo) throw new (0,
|
|
6088
|
+
if (!rawDocInfo) throw new (0, _chunkMI655NV5cjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6089
6089
|
let docInfoData;
|
|
6090
6090
|
try {
|
|
6091
6091
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6092
6092
|
} catch (e25) {
|
|
6093
|
-
throw new (0,
|
|
6093
|
+
throw new (0, _chunkMI655NV5cjs.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.");
|
|
6094
6094
|
}
|
|
6095
6095
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6096
6096
|
}
|
|
@@ -6115,10 +6115,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6115
6115
|
try {
|
|
6116
6116
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6117
6117
|
totalDecompressed += data.length;
|
|
6118
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6118
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkMI655NV5cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6119
6119
|
out.push(readRecords(data));
|
|
6120
6120
|
} catch (secErr) {
|
|
6121
|
-
if (secErr instanceof
|
|
6121
|
+
if (secErr instanceof _chunkMI655NV5cjs.KordocError) throw secErr;
|
|
6122
6122
|
out.push(null);
|
|
6123
6123
|
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" });
|
|
6124
6124
|
}
|
|
@@ -6138,7 +6138,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6138
6138
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6139
6139
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6140
6140
|
const sections = readHwp5SectionStreams(c);
|
|
6141
|
-
if (sections.length === 0) throw new (0,
|
|
6141
|
+
if (sections.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6142
6142
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6143
6143
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6144
6144
|
const sectionTableIds = [];
|
|
@@ -6182,7 +6182,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6182
6182
|
parsedSections++;
|
|
6183
6183
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6184
6184
|
} catch (secErr) {
|
|
6185
|
-
if (secErr instanceof
|
|
6185
|
+
if (secErr instanceof _chunkMI655NV5cjs.KordocError) throw secErr;
|
|
6186
6186
|
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" });
|
|
6187
6187
|
} finally {
|
|
6188
6188
|
pageBase += detect2.pages;
|
|
@@ -6193,10 +6193,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6193
6193
|
}
|
|
6194
6194
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6195
6195
|
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6196
|
-
let flatBlocks =
|
|
6197
|
-
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks =
|
|
6196
|
+
let flatBlocks = _chunkSJ5OZXELcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6197
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkSJ5OZXELcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6198
6198
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6199
|
-
const deduped =
|
|
6199
|
+
const deduped = _chunkSJ5OZXELcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6200
6200
|
const removed = flatBlocks.length - deduped.length;
|
|
6201
6201
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6202
6202
|
flatBlocks = deduped;
|
|
@@ -6205,10 +6205,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6205
6205
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6206
6206
|
}
|
|
6207
6207
|
const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
|
|
6208
|
-
let markdown =
|
|
6208
|
+
let markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6209
6209
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6210
6210
|
try {
|
|
6211
|
-
markdown =
|
|
6211
|
+
markdown = _chunk2BCQVQO2cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6212
6212
|
} catch (inlineErr) {
|
|
6213
6213
|
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" });
|
|
6214
6214
|
}
|
|
@@ -6272,9 +6272,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6272
6272
|
let level = 0;
|
|
6273
6273
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6274
6274
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6275
|
-
if (ratio >=
|
|
6276
|
-
else if (ratio >=
|
|
6277
|
-
else if (ratio >=
|
|
6275
|
+
if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H1) level = 1;
|
|
6276
|
+
else if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H2) level = 2;
|
|
6277
|
+
else if (ratio >= _chunkSJ5OZXELcjs.HEADING_RATIO_H3) level = 3;
|
|
6278
6278
|
}
|
|
6279
6279
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6280
6280
|
if (level === 0) level = 2;
|
|
@@ -6406,7 +6406,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6406
6406
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6407
6407
|
if (!raw) break;
|
|
6408
6408
|
totalBytes += raw.length;
|
|
6409
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6409
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkMI655NV5cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6410
6410
|
sections.push({ idx: i, content: raw });
|
|
6411
6411
|
}
|
|
6412
6412
|
if (sections.length === 0) {
|
|
@@ -6417,7 +6417,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6417
6417
|
const raw = lcfb.findStream(e.name);
|
|
6418
6418
|
if (raw) {
|
|
6419
6419
|
totalBytes += raw.length;
|
|
6420
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6420
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkMI655NV5cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6421
6421
|
sections.push({ idx, content: raw });
|
|
6422
6422
|
}
|
|
6423
6423
|
}
|
|
@@ -6434,7 +6434,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6434
6434
|
try {
|
|
6435
6435
|
const content = decryptViewText(raw, compressed);
|
|
6436
6436
|
totalDecompressed += content.length;
|
|
6437
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6437
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkMI655NV5cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6438
6438
|
sections.push({ idx: i, content });
|
|
6439
6439
|
} catch (e32) {
|
|
6440
6440
|
break;
|
|
@@ -18934,25 +18934,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18934
18934
|
}
|
|
18935
18935
|
function readLayout(data) {
|
|
18936
18936
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18937
|
-
throw new (0,
|
|
18937
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18938
18938
|
}
|
|
18939
18939
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18940
18940
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18941
18941
|
if (payloadOffset >= data.length) {
|
|
18942
|
-
throw new (0,
|
|
18942
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18943
18943
|
}
|
|
18944
18944
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18945
18945
|
}
|
|
18946
18946
|
function decryptHwp3Document(input, password) {
|
|
18947
18947
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18948
18948
|
if (!compressed) {
|
|
18949
|
-
throw new (0,
|
|
18949
|
+
throw new (0, _chunkMI655NV5cjs.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)");
|
|
18950
18950
|
}
|
|
18951
18951
|
const source = Buffer.from(input);
|
|
18952
18952
|
const payload = source.subarray(payloadOffset);
|
|
18953
18953
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18954
18954
|
if (aligned.length === 0) {
|
|
18955
|
-
throw new (0,
|
|
18955
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18956
18956
|
}
|
|
18957
18957
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18958
18958
|
let inflated;
|
|
@@ -18960,14 +18960,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18960
18960
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18961
18961
|
} catch (err) {
|
|
18962
18962
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18963
|
-
throw new (0,
|
|
18963
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
18964
18964
|
`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`
|
|
18965
18965
|
);
|
|
18966
18966
|
}
|
|
18967
|
-
throw new (0,
|
|
18967
|
+
throw new (0, _chunkMI655NV5cjs.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.");
|
|
18968
18968
|
}
|
|
18969
18969
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18970
|
-
throw new (0,
|
|
18970
|
+
throw new (0, _chunkMI655NV5cjs.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.");
|
|
18971
18971
|
}
|
|
18972
18972
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18973
18973
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -19024,9 +19024,9 @@ function hwp3CellGrid(info, count) {
|
|
|
19024
19024
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19025
19025
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19026
19026
|
const r2 = nextY[k] !== void 0 ? edgeAt(ys, nextY[k]) : ys.length - 1;
|
|
19027
|
-
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row),
|
|
19027
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkSJ5OZXELcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkSJ5OZXELcjs.MAX_COLS) };
|
|
19028
19028
|
});
|
|
19029
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
19029
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkSJ5OZXELcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkSJ5OZXELcjs.MAX_COLS), cells };
|
|
19030
19030
|
}
|
|
19031
19031
|
|
|
19032
19032
|
// src/hwp3/parser.ts
|
|
@@ -19067,7 +19067,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19067
19067
|
let source = Buffer.from(buffer);
|
|
19068
19068
|
if (isEncryptedHwp3(source)) {
|
|
19069
19069
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19070
|
-
throw new (0,
|
|
19070
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
19071
19071
|
"\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."
|
|
19072
19072
|
);
|
|
19073
19073
|
}
|
|
@@ -19084,10 +19084,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19084
19084
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19085
19085
|
} catch (err) {
|
|
19086
19086
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19087
|
-
throw new (0,
|
|
19087
|
+
throw new (0, _chunkMI655NV5cjs.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`);
|
|
19088
19088
|
}
|
|
19089
19089
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19090
|
-
throw new (0,
|
|
19090
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19091
19091
|
}
|
|
19092
19092
|
} else {
|
|
19093
19093
|
body = tail;
|
|
@@ -19110,7 +19110,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19110
19110
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19111
19111
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19112
19112
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19113
|
-
const blocks =
|
|
19113
|
+
const blocks = _chunkSJ5OZXELcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19114
19114
|
const metadata = {
|
|
19115
19115
|
title: header.title || void 0,
|
|
19116
19116
|
author: header.author || void 0,
|
|
@@ -19118,10 +19118,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19118
19118
|
createdAt: header.date || void 0,
|
|
19119
19119
|
version: "3.0"
|
|
19120
19120
|
};
|
|
19121
|
-
let markdown =
|
|
19121
|
+
let markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19122
19122
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19123
19123
|
try {
|
|
19124
|
-
markdown =
|
|
19124
|
+
markdown = _chunk2BCQVQO2cjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19125
19125
|
} catch (inlineErr) {
|
|
19126
19126
|
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" });
|
|
19127
19127
|
}
|
|
@@ -19253,7 +19253,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19253
19253
|
continue;
|
|
19254
19254
|
}
|
|
19255
19255
|
if (ch >= 32) {
|
|
19256
|
-
para2.text +=
|
|
19256
|
+
para2.text += _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19257
19257
|
continue;
|
|
19258
19258
|
}
|
|
19259
19259
|
if (ch === 9) {
|
|
@@ -19488,7 +19488,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19488
19488
|
// src/xlsx/sheet-blocks.ts
|
|
19489
19489
|
var MAX_SHEET_COLS = 16384;
|
|
19490
19490
|
function sheetRowCap(cols) {
|
|
19491
|
-
return Math.floor(
|
|
19491
|
+
return Math.floor(_chunkSJ5OZXELcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19492
19492
|
}
|
|
19493
19493
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19494
19494
|
const blocks = [];
|
|
@@ -19519,7 +19519,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19519
19519
|
if (keepRows.length > rowCap) {
|
|
19520
19520
|
warnings.push({
|
|
19521
19521
|
page: sheetIndex + 1,
|
|
19522
|
-
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 ${
|
|
19522
|
+
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 ${_chunkSJ5OZXELcjs.MAX_TABLE_CELLS})`,
|
|
19523
19523
|
code: "TRUNCATED_TABLE"
|
|
19524
19524
|
});
|
|
19525
19525
|
keepRows.length = rowCap;
|
|
@@ -19553,14 +19553,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19553
19553
|
}
|
|
19554
19554
|
cellRows.push(row);
|
|
19555
19555
|
}
|
|
19556
|
-
const table2 =
|
|
19556
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19557
19557
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19558
19558
|
return blocks;
|
|
19559
19559
|
}
|
|
19560
19560
|
|
|
19561
19561
|
// src/xlsx/parser.ts
|
|
19562
19562
|
var MAX_SHEETS = 100;
|
|
19563
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19563
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkMI655NV5cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19564
19564
|
var MAX_SHEET_ROWS = 1048576;
|
|
19565
19565
|
function cleanNumericValue(raw) {
|
|
19566
19566
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19597,7 +19597,7 @@ function getTextContent(el) {
|
|
|
19597
19597
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19598
19598
|
}
|
|
19599
19599
|
function parseXml(text) {
|
|
19600
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19600
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, text), "text/xml");
|
|
19601
19601
|
}
|
|
19602
19602
|
function collectRichText(root) {
|
|
19603
19603
|
let out = "";
|
|
@@ -19608,7 +19608,7 @@ function collectRichText(root) {
|
|
|
19608
19608
|
const el = children[i];
|
|
19609
19609
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19610
19610
|
if (local === "rPh") continue;
|
|
19611
|
-
if (local === "t") out +=
|
|
19611
|
+
if (local === "t") out += _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19612
19612
|
else walk(el);
|
|
19613
19613
|
}
|
|
19614
19614
|
};
|
|
@@ -19819,12 +19819,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19819
19819
|
return { rows, merges, maxCol };
|
|
19820
19820
|
}
|
|
19821
19821
|
async function parseXlsxDocument(buffer, options) {
|
|
19822
|
-
|
|
19822
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19823
19823
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19824
19824
|
const warnings = [];
|
|
19825
19825
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19826
19826
|
if (!workbookFile) {
|
|
19827
|
-
throw new (0,
|
|
19827
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19828
19828
|
}
|
|
19829
19829
|
let sharedStrings = [];
|
|
19830
19830
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19833,7 +19833,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19833
19833
|
}
|
|
19834
19834
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19835
19835
|
if (sheets.length === 0) {
|
|
19836
|
-
throw new (0,
|
|
19836
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19837
19837
|
}
|
|
19838
19838
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19839
19839
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19917,7 +19917,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19917
19917
|
} catch (e35) {
|
|
19918
19918
|
}
|
|
19919
19919
|
}
|
|
19920
|
-
const markdown =
|
|
19920
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19921
19921
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19922
19922
|
}
|
|
19923
19923
|
|
|
@@ -20231,14 +20231,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20231
20231
|
const h = readCellHeader(rec.data);
|
|
20232
20232
|
if (h && rec.data.length >= 10) {
|
|
20233
20233
|
const isst = rec.data.readUInt32LE(6);
|
|
20234
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20234
|
+
cells.push({ row: h.row, col: h.col, value: _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20235
20235
|
}
|
|
20236
20236
|
break;
|
|
20237
20237
|
}
|
|
20238
20238
|
case OP_LABEL: {
|
|
20239
20239
|
const h = readCellHeader(rec.data);
|
|
20240
20240
|
if (h) {
|
|
20241
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20241
|
+
cells.push({ row: h.row, col: h.col, value: _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20242
20242
|
}
|
|
20243
20243
|
break;
|
|
20244
20244
|
}
|
|
@@ -20254,7 +20254,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20254
20254
|
cells.push({
|
|
20255
20255
|
row: h.row,
|
|
20256
20256
|
col: h.col,
|
|
20257
|
-
value:
|
|
20257
|
+
value: _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20258
20258
|
});
|
|
20259
20259
|
i = j;
|
|
20260
20260
|
} else {
|
|
@@ -20366,11 +20366,11 @@ function processGlobals(records) {
|
|
|
20366
20366
|
const xfFmtIds = [];
|
|
20367
20367
|
const firstBof = records[0];
|
|
20368
20368
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20369
|
-
throw new (0,
|
|
20369
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20370
20370
|
}
|
|
20371
20371
|
const bof = decodeBof(firstBof.data);
|
|
20372
20372
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20373
|
-
throw new (0,
|
|
20373
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20374
20374
|
}
|
|
20375
20375
|
let i = 1;
|
|
20376
20376
|
while (i < records.length) {
|
|
@@ -20454,28 +20454,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20454
20454
|
try {
|
|
20455
20455
|
cfb = parseLenientCfb(buf);
|
|
20456
20456
|
} catch (e) {
|
|
20457
|
-
throw new (0,
|
|
20457
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
20458
20458
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20459
20459
|
);
|
|
20460
20460
|
}
|
|
20461
20461
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20462
20462
|
if (!wb) {
|
|
20463
|
-
throw new (0,
|
|
20463
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20464
20464
|
}
|
|
20465
20465
|
const records = readRecords2(wb);
|
|
20466
20466
|
if (records.length === 0) {
|
|
20467
|
-
throw new (0,
|
|
20467
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20468
20468
|
}
|
|
20469
20469
|
const firstBof = decodeBof(records[0].data);
|
|
20470
20470
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20471
|
-
throw new (0,
|
|
20471
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
20472
20472
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20473
20473
|
);
|
|
20474
20474
|
}
|
|
20475
20475
|
const globals = processGlobals(records);
|
|
20476
20476
|
const warnings = [];
|
|
20477
20477
|
if (globals.encrypted) {
|
|
20478
|
-
throw new (0,
|
|
20478
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20479
20479
|
}
|
|
20480
20480
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20481
20481
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20526,7 +20526,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20526
20526
|
pageCount: totalSheets
|
|
20527
20527
|
};
|
|
20528
20528
|
return {
|
|
20529
|
-
markdown:
|
|
20529
|
+
markdown: _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20530
20530
|
blocks: allBlocks,
|
|
20531
20531
|
metadata,
|
|
20532
20532
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20965,7 +20965,7 @@ function isDisplayMath(el) {
|
|
|
20965
20965
|
}
|
|
20966
20966
|
|
|
20967
20967
|
// src/docx/parser.ts
|
|
20968
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20968
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkMI655NV5cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20969
20969
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20970
20970
|
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;
|
|
20971
20971
|
function matchesLocal(el, localName3) {
|
|
@@ -21023,7 +21023,7 @@ function getAttr(el, localName3) {
|
|
|
21023
21023
|
return null;
|
|
21024
21024
|
}
|
|
21025
21025
|
function parseXml2(text) {
|
|
21026
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21026
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, text), "text/xml");
|
|
21027
21027
|
}
|
|
21028
21028
|
function parseStyles(xml) {
|
|
21029
21029
|
const doc = parseXml2(xml);
|
|
@@ -21159,7 +21159,7 @@ function parseFootnotes(xml) {
|
|
|
21159
21159
|
const runs = findElements(p, "r");
|
|
21160
21160
|
for (const r of runs) {
|
|
21161
21161
|
const tElements = getChildElements(r, "t");
|
|
21162
|
-
for (const t of tElements) texts.push(
|
|
21162
|
+
for (const t of tElements) texts.push(_chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21163
21163
|
}
|
|
21164
21164
|
}
|
|
21165
21165
|
notes.set(id, texts.join("").trim());
|
|
@@ -21190,7 +21190,7 @@ function collectOmmlRoots(p) {
|
|
|
21190
21190
|
function extractRun(r) {
|
|
21191
21191
|
let text = "";
|
|
21192
21192
|
for (const el of effectiveChildElements(r)) {
|
|
21193
|
-
if (matchesLocal(el, "t")) text +=
|
|
21193
|
+
if (matchesLocal(el, "t")) text += _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21194
21194
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21195
21195
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21196
21196
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21203,7 +21203,7 @@ function extractRun(r) {
|
|
|
21203
21203
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21204
21204
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21205
21205
|
const v = va ? getAttr(va, "val") : null;
|
|
21206
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21206
|
+
if (v === "superscript" || v === "subscript") text = _chunkSJ5OZXELcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21207
21207
|
}
|
|
21208
21208
|
return { text, bold, italic };
|
|
21209
21209
|
}
|
|
@@ -21221,7 +21221,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21221
21221
|
function makeLink(text, rawHref) {
|
|
21222
21222
|
if (!text) return "";
|
|
21223
21223
|
if (!rawHref) return text;
|
|
21224
|
-
const href =
|
|
21224
|
+
const href = _chunkMI655NV5cjs.sanitizeHref.call(void 0, rawHref);
|
|
21225
21225
|
return href ? `[${text}](${href})` : text;
|
|
21226
21226
|
}
|
|
21227
21227
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21312,7 +21312,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21312
21312
|
const m = mathText(om);
|
|
21313
21313
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21314
21314
|
}
|
|
21315
|
-
const text =
|
|
21315
|
+
const text = _chunkSJ5OZXELcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21316
21316
|
return { text, bold, italic, footnoteText };
|
|
21317
21317
|
}
|
|
21318
21318
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21437,7 +21437,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21437
21437
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21438
21438
|
})
|
|
21439
21439
|
);
|
|
21440
|
-
const table2 =
|
|
21440
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21441
21441
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21442
21442
|
return { type: "table", table: table2 };
|
|
21443
21443
|
}
|
|
@@ -21486,7 +21486,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21486
21486
|
let data = null;
|
|
21487
21487
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21488
21488
|
imgIdx++;
|
|
21489
|
-
const ext =
|
|
21489
|
+
const ext = _chunkMI655NV5cjs.partExtension.call(void 0, imgPath);
|
|
21490
21490
|
const mimeMap = {
|
|
21491
21491
|
png: "image/png",
|
|
21492
21492
|
jpg: "image/jpeg",
|
|
@@ -21585,12 +21585,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21585
21585
|
}
|
|
21586
21586
|
async function parseDocxDocument(buffer, options) {
|
|
21587
21587
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21588
|
-
|
|
21588
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21589
21589
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21590
21590
|
const warnings = [];
|
|
21591
21591
|
const docFile = zip.file("word/document.xml");
|
|
21592
21592
|
if (!docFile) {
|
|
21593
|
-
throw new (0,
|
|
21593
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21594
21594
|
}
|
|
21595
21595
|
let rels = /* @__PURE__ */ new Map();
|
|
21596
21596
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21637,7 +21637,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21637
21637
|
const doc = parseXml2(docXml);
|
|
21638
21638
|
const body = findElements(doc, "body");
|
|
21639
21639
|
if (body.length === 0) {
|
|
21640
|
-
throw new (0,
|
|
21640
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21641
21641
|
}
|
|
21642
21642
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21643
21643
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21690,7 +21690,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21690
21690
|
}
|
|
21691
21691
|
}
|
|
21692
21692
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21693
|
-
const markdown =
|
|
21693
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21694
21694
|
return {
|
|
21695
21695
|
markdown,
|
|
21696
21696
|
blocks,
|
|
@@ -21704,7 +21704,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21704
21704
|
// src/pptx/parser.ts
|
|
21705
21705
|
|
|
21706
21706
|
|
|
21707
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21707
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkMI655NV5cjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21708
21708
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21709
21709
|
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;
|
|
21710
21710
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21727,7 +21727,7 @@ var IMAGE_MIME = {
|
|
|
21727
21727
|
svg: "image/svg+xml"
|
|
21728
21728
|
};
|
|
21729
21729
|
function parseXml3(text) {
|
|
21730
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21730
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkMI655NV5cjs.stripDtd.call(void 0, text), "text/xml");
|
|
21731
21731
|
}
|
|
21732
21732
|
function getAttr2(el, name) {
|
|
21733
21733
|
const attrs = el.attributes;
|
|
@@ -21794,7 +21794,7 @@ async function slideParts(zip) {
|
|
|
21794
21794
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21795
21795
|
ordered.push(...names);
|
|
21796
21796
|
}
|
|
21797
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21797
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkMI655NV5cjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21798
21798
|
return ordered;
|
|
21799
21799
|
}
|
|
21800
21800
|
function paragraphText(p) {
|
|
@@ -21805,12 +21805,12 @@ function paragraphText(p) {
|
|
|
21805
21805
|
const t = findChildByLocalName(child, "t");
|
|
21806
21806
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21807
21807
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21808
|
-
if (t) text +=
|
|
21808
|
+
if (t) text += _chunkSJ5OZXELcjs.wrapScript.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, _chunkSJ5OZXELcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21809
21809
|
} else if (name === "br") {
|
|
21810
21810
|
text += " ";
|
|
21811
21811
|
}
|
|
21812
21812
|
}
|
|
21813
|
-
return
|
|
21813
|
+
return _chunkSJ5OZXELcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21814
21814
|
}
|
|
21815
21815
|
function bodyParagraphs(txBody) {
|
|
21816
21816
|
const out = [];
|
|
@@ -21871,7 +21871,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21871
21871
|
});
|
|
21872
21872
|
return cells;
|
|
21873
21873
|
});
|
|
21874
|
-
const table2 =
|
|
21874
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21875
21875
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21876
21876
|
return { type: "table", table: table2, pageNumber: page };
|
|
21877
21877
|
}
|
|
@@ -21884,7 +21884,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21884
21884
|
if (!filename) {
|
|
21885
21885
|
const file = ctx.zip.file(rel.target);
|
|
21886
21886
|
if (!file) return null;
|
|
21887
|
-
const ext =
|
|
21887
|
+
const ext = _chunkMI655NV5cjs.partExtension.call(void 0, rel.target);
|
|
21888
21888
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21889
21889
|
try {
|
|
21890
21890
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21962,10 +21962,10 @@ async function notesText(zip, rels) {
|
|
|
21962
21962
|
return texts.join(" ");
|
|
21963
21963
|
}
|
|
21964
21964
|
async function parsePptxDocument(buffer, options) {
|
|
21965
|
-
|
|
21965
|
+
_chunkMI655NV5cjs.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 });
|
|
21966
21966
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21967
21967
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21968
|
-
throw new (0,
|
|
21968
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21969
21969
|
}
|
|
21970
21970
|
const warnings = [];
|
|
21971
21971
|
const blocks = [];
|
|
@@ -22012,7 +22012,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
22012
22012
|
}
|
|
22013
22013
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
22014
22014
|
return {
|
|
22015
|
-
markdown:
|
|
22015
|
+
markdown: _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
22016
22016
|
blocks,
|
|
22017
22017
|
metadata,
|
|
22018
22018
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22028,11 +22028,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22028
22028
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22029
22029
|
function parseHwpmlDocument(buffer, options) {
|
|
22030
22030
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22031
|
-
throw new (0,
|
|
22031
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22032
22032
|
}
|
|
22033
22033
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22034
22034
|
const normalized = text.replace(/ /g, " ");
|
|
22035
|
-
const xml =
|
|
22035
|
+
const xml = _chunkMI655NV5cjs.stripDtd.call(void 0, normalized);
|
|
22036
22036
|
const warnings = [];
|
|
22037
22037
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22038
22038
|
onError: (_level, msg2) => {
|
|
@@ -22072,7 +22072,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22072
22072
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22073
22073
|
}
|
|
22074
22074
|
const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
|
|
22075
|
-
const markdown =
|
|
22075
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22076
22076
|
return {
|
|
22077
22077
|
markdown,
|
|
22078
22078
|
blocks,
|
|
@@ -22179,7 +22179,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22179
22179
|
if (tag === "CHAR") {
|
|
22180
22180
|
for (const c of Array.from(el.childNodes)) {
|
|
22181
22181
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22182
|
-
if (t) parts.push(
|
|
22182
|
+
if (t) parts.push(_chunkSJ5OZXELcjs.escapeLiteralTags.call(void 0, t));
|
|
22183
22183
|
}
|
|
22184
22184
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22185
22185
|
} else if (tag === "AUTONUM") {
|
|
@@ -22239,7 +22239,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22239
22239
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22240
22240
|
cellRows[r].push(cell2);
|
|
22241
22241
|
}
|
|
22242
|
-
const table2 =
|
|
22242
|
+
const table2 = _chunkSJ5OZXELcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22243
22243
|
if (structured.length > 0) {
|
|
22244
22244
|
const claimed = /* @__PURE__ */ new Set();
|
|
22245
22245
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24002,7 +24002,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24002
24002
|
};
|
|
24003
24003
|
}
|
|
24004
24004
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24005
|
-
|
|
24005
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24006
24006
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24007
24007
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24008
24008
|
const fields = [];
|
|
@@ -24038,7 +24038,7 @@ function readZipEntries(buf) {
|
|
|
24038
24038
|
}
|
|
24039
24039
|
function localDataStart(view, localOffset) {
|
|
24040
24040
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24041
|
-
throw new (0,
|
|
24041
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24042
24042
|
}
|
|
24043
24043
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24044
24044
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24068,19 +24068,19 @@ function parseCentralDirectory(buf) {
|
|
|
24068
24068
|
}
|
|
24069
24069
|
}
|
|
24070
24070
|
}
|
|
24071
|
-
if (eocdOffset < 0) throw new (0,
|
|
24071
|
+
if (eocdOffset < 0) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24072
24072
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24073
24073
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24074
24074
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24075
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24075
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24076
24076
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24077
|
-
throw new (0,
|
|
24077
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24078
24078
|
}
|
|
24079
24079
|
const decoder = new TextDecoder("utf-8");
|
|
24080
24080
|
const entries = [];
|
|
24081
24081
|
let pos = cdOffset;
|
|
24082
24082
|
for (let i = 0; i < totalEntries; i++) {
|
|
24083
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24083
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24084
24084
|
const flags = view.getUint16(pos + 8, true);
|
|
24085
24085
|
const method = view.getUint16(pos + 10, true);
|
|
24086
24086
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24091,7 +24091,7 @@ function parseCentralDirectory(buf) {
|
|
|
24091
24091
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24092
24092
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24093
24093
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24094
|
-
throw new (0,
|
|
24094
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24095
24095
|
}
|
|
24096
24096
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24097
24097
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24120,11 +24120,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24120
24120
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24121
24121
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24122
24122
|
for (const name of replacements.keys()) {
|
|
24123
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24123
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkMI655NV5cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24124
24124
|
}
|
|
24125
24125
|
if (additions) {
|
|
24126
24126
|
for (const name of additions.keys()) {
|
|
24127
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24127
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkMI655NV5cjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24128
24128
|
}
|
|
24129
24129
|
}
|
|
24130
24130
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24143,7 +24143,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24143
24143
|
offset += seg.length;
|
|
24144
24144
|
continue;
|
|
24145
24145
|
}
|
|
24146
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24146
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkMI655NV5cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24147
24147
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24148
24148
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24149
24149
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24151,7 +24151,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24151
24151
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24152
24152
|
const method = e.method;
|
|
24153
24153
|
if (method !== 0 && method !== 8) {
|
|
24154
|
-
throw new (0,
|
|
24154
|
+
throw new (0, _chunkMI655NV5cjs.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`);
|
|
24155
24155
|
}
|
|
24156
24156
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24157
24157
|
const crc = crc32(newData);
|
|
@@ -24249,11 +24249,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24249
24249
|
// src/form/filler-hwpx.ts
|
|
24250
24250
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24251
24251
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24252
|
-
|
|
24252
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24253
24253
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24254
24254
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24255
24255
|
if (sectionPaths.length === 0) {
|
|
24256
|
-
throw new (0,
|
|
24256
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24257
24257
|
}
|
|
24258
24258
|
const warnings = [];
|
|
24259
24259
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24645,7 +24645,7 @@ var MIN_SIDE = 24;
|
|
|
24645
24645
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24646
24646
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24647
24647
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24648
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24648
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-BELHEWPX.cjs")));
|
|
24649
24649
|
let inserted = false, unreadable = 0;
|
|
24650
24650
|
let failed = null;
|
|
24651
24651
|
const walk = async (list, depth) => {
|
|
@@ -24686,7 +24686,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24686
24686
|
function ocrBytes(img) {
|
|
24687
24687
|
const mime = img.mimeType.toLowerCase();
|
|
24688
24688
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24689
|
-
if (mime.includes("bmp")) return
|
|
24689
|
+
if (mime.includes("bmp")) return _chunk2BCQVQO2cjs.bmpToPng.call(void 0, img.data);
|
|
24690
24690
|
return img.data;
|
|
24691
24691
|
}
|
|
24692
24692
|
async function tooSmall(bytes) {
|
|
@@ -24855,7 +24855,7 @@ function classifyTableTree(blocks) {
|
|
|
24855
24855
|
return blocks;
|
|
24856
24856
|
}
|
|
24857
24857
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24858
|
-
const structured = hasMerged(table2) ||
|
|
24858
|
+
const structured = hasMerged(table2) || _chunkSJ5OZXELcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24859
24859
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24860
24860
|
return structured ? "html" : "gfm";
|
|
24861
24861
|
}
|
|
@@ -35848,7 +35848,7 @@ function findAgency(name) {
|
|
|
35848
35848
|
}
|
|
35849
35849
|
function agencyStyle(name) {
|
|
35850
35850
|
const s = findAgency(name);
|
|
35851
|
-
if (!s) throw new (0,
|
|
35851
|
+
if (!s) throw new (0, _chunkMI655NV5cjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35852
35852
|
return s;
|
|
35853
35853
|
}
|
|
35854
35854
|
function applyAgency(opts, preset) {
|
|
@@ -36912,7 +36912,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36912
36912
|
}
|
|
36913
36913
|
function assertFiniteRange(name, value, min, max) {
|
|
36914
36914
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36915
|
-
throw new (0,
|
|
36915
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36916
36916
|
}
|
|
36917
36917
|
}
|
|
36918
36918
|
function validateGongmunOptions(opts) {
|
|
@@ -36930,10 +36930,10 @@ function validateGongmunOptions(opts) {
|
|
|
36930
36930
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36931
36931
|
}
|
|
36932
36932
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36933
|
-
throw new (0,
|
|
36933
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36934
36934
|
}
|
|
36935
36935
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36936
|
-
throw new (0,
|
|
36936
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36937
36937
|
}
|
|
36938
36938
|
}
|
|
36939
36939
|
if (opts.sizes) {
|
|
@@ -36942,24 +36942,24 @@ function validateGongmunOptions(opts) {
|
|
|
36942
36942
|
}
|
|
36943
36943
|
}
|
|
36944
36944
|
if (opts.approval && opts.approval.length > 6) {
|
|
36945
|
-
throw new (0,
|
|
36945
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("approval must contain at most 6 labels");
|
|
36946
36946
|
}
|
|
36947
36947
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
36948
36948
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
36949
36949
|
for (const n of nums) {
|
|
36950
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
36950
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkMI655NV5cjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
36951
36951
|
}
|
|
36952
36952
|
}
|
|
36953
36953
|
if (opts.levels) {
|
|
36954
36954
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
36955
36955
|
const depth = Number(key);
|
|
36956
36956
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
36957
|
-
throw new (0,
|
|
36957
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
36958
36958
|
}
|
|
36959
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
36959
|
+
if (!st || typeof st !== "object") throw new (0, _chunkMI655NV5cjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
36960
36960
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
36961
36961
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
36962
|
-
throw new (0,
|
|
36962
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
36963
36963
|
}
|
|
36964
36964
|
}
|
|
36965
36965
|
}
|
|
@@ -37017,7 +37017,7 @@ function resolveChecklist(c, preset) {
|
|
|
37017
37017
|
function hexColorOption(name, value) {
|
|
37018
37018
|
if (value === void 0) return void 0;
|
|
37019
37019
|
const v = value.trim();
|
|
37020
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37020
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkMI655NV5cjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37021
37021
|
return v.toUpperCase();
|
|
37022
37022
|
}
|
|
37023
37023
|
function resolveGongmun(input) {
|
|
@@ -37761,7 +37761,7 @@ function parseInlineMarkdown(text) {
|
|
|
37761
37761
|
else spans.push(...emphasisSpans(m[0]));
|
|
37762
37762
|
} else {
|
|
37763
37763
|
const anchor = m[2] || m[3];
|
|
37764
|
-
const href = _nullishCoalesce(
|
|
37764
|
+
const href = _nullishCoalesce(_chunkMI655NV5cjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37765
37765
|
const sub = emphasisSpans(anchor);
|
|
37766
37766
|
if (href) for (const s of sub) s.href = href;
|
|
37767
37767
|
spans.push(...sub);
|
|
@@ -37982,7 +37982,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
37982
37982
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
37983
37983
|
const got = m ? Number(m[1]) : NaN;
|
|
37984
37984
|
if (got !== startId + i) {
|
|
37985
|
-
throw new (0,
|
|
37985
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
37986
37986
|
`\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)`
|
|
37987
37987
|
);
|
|
37988
37988
|
}
|
|
@@ -38073,7 +38073,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38073
38073
|
}
|
|
38074
38074
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38075
38075
|
if (rows.length !== expectedBase) {
|
|
38076
|
-
throw new (0,
|
|
38076
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
38077
38077
|
`\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`
|
|
38078
38078
|
);
|
|
38079
38079
|
}
|
|
@@ -39082,7 +39082,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39082
39082
|
return best;
|
|
39083
39083
|
}
|
|
39084
39084
|
function normForMatch(text) {
|
|
39085
|
-
return
|
|
39085
|
+
return _chunkSJ5OZXELcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39086
39086
|
}
|
|
39087
39087
|
function unescapeGfm(text) {
|
|
39088
39088
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39104,7 +39104,7 @@ function replicateGfmTable(table2) {
|
|
|
39104
39104
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39105
39105
|
if (!cell2) continue;
|
|
39106
39106
|
display[r][c] = {
|
|
39107
|
-
text:
|
|
39107
|
+
text: _chunkSJ5OZXELcjs.escapeGfm.call(void 0, _chunkSJ5OZXELcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39108
39108
|
gridR: r,
|
|
39109
39109
|
gridC: c
|
|
39110
39110
|
};
|
|
@@ -39144,16 +39144,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39144
39144
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39145
39145
|
return cell2.blocks.map((b) => {
|
|
39146
39146
|
if (b.type === "table" && b.table) {
|
|
39147
|
-
const cap = b.table.caption ?
|
|
39148
|
-
return (cap ?
|
|
39147
|
+
const cap = b.table.caption ? _chunkSJ5OZXELcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39148
|
+
return (cap ? _chunkSJ5OZXELcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39149
39149
|
}
|
|
39150
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39151
|
-
const note =
|
|
39152
|
-
const t = (
|
|
39153
|
-
return ((t ?
|
|
39150
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkMI655NV5cjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39151
|
+
const note = _chunkSJ5OZXELcjs.noteTableHtml.call(void 0, b);
|
|
39152
|
+
const t = (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, _chunkSJ5OZXELcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkSJ5OZXELcjs.noteSuffix.call(void 0, b))).trim();
|
|
39153
|
+
return ((t ? _chunkSJ5OZXELcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39154
39154
|
}).filter(Boolean).join("<br>");
|
|
39155
39155
|
}
|
|
39156
|
-
return
|
|
39156
|
+
return _chunkSJ5OZXELcjs.escapeHtmlCellText.call(void 0, _chunkSJ5OZXELcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39157
39157
|
}
|
|
39158
39158
|
function replicateTableToHtml(table2) {
|
|
39159
39159
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39230,7 +39230,7 @@ function parseHtmlTable(raw) {
|
|
|
39230
39230
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39231
39231
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39232
39232
|
cellStart = m.index + m[0].length;
|
|
39233
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39233
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkSJ5OZXELcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkSJ5OZXELcjs.MAX_ROWS) };
|
|
39234
39234
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39235
39235
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39236
39236
|
cellStart = -1;
|
|
@@ -39255,11 +39255,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39255
39255
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39256
39256
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39257
39257
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39258
|
-
if (src) imgSrcs.push(
|
|
39258
|
+
if (src) imgSrcs.push(_chunkMI655NV5cjs.unescapeHtml.call(void 0, src));
|
|
39259
39259
|
return "";
|
|
39260
39260
|
});
|
|
39261
39261
|
}
|
|
39262
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39262
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkMI655NV5cjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39263
39263
|
return { lines, hadNonText, imgSrcs };
|
|
39264
39264
|
}
|
|
39265
39265
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40075,8 +40075,8 @@ function layoutHtmlRows(rows) {
|
|
|
40075
40075
|
let c = 0;
|
|
40076
40076
|
for (const cell2 of rows[r].cells) {
|
|
40077
40077
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40078
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40079
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40078
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkSJ5OZXELcjs.MAX_COLS);
|
|
40079
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkSJ5OZXELcjs.MAX_ROWS);
|
|
40080
40080
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40081
40081
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40082
40082
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -42411,7 +42411,7 @@ function builtinTemplateDir() {
|
|
|
42411
42411
|
for (const c of candidates) {
|
|
42412
42412
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42413
42413
|
}
|
|
42414
|
-
throw new (0,
|
|
42414
|
+
throw new (0, _chunkMI655NV5cjs.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)");
|
|
42415
42415
|
}
|
|
42416
42416
|
function readBuiltinTemplate(t) {
|
|
42417
42417
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42887,12 +42887,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42887
42887
|
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>`;
|
|
42888
42888
|
}
|
|
42889
42889
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42890
|
-
if (ops.length === 0) throw new (0,
|
|
42890
|
+
if (ops.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42891
42891
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42892
|
-
|
|
42892
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42893
42893
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42894
42894
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _856 => _856.match, 'call', _857 => _857(/(\d+)\.xml$/i), 'optionalAccess', _858 => _858[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _859 => _859.match, 'call', _860 => _860(/(\d+)\.xml$/i), 'optionalAccess', _861 => _861[1]]), () => ( 0))));
|
|
42895
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42895
|
+
if (sectionPaths.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42896
42896
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42897
42897
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42898
42898
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42933,11 +42933,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42933
42933
|
const manifestItems = [];
|
|
42934
42934
|
const placed = [];
|
|
42935
42935
|
for (const op of ops) {
|
|
42936
|
-
if (!op.anchor) throw new (0,
|
|
42937
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42936
|
+
if (!op.anchor) throw new (0, _chunkMI655NV5cjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42937
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42938
42938
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42939
|
-
if (!MIME[ext]) throw new (0,
|
|
42940
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42939
|
+
if (!MIME[ext]) throw new (0, _chunkMI655NV5cjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42940
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkMI655NV5cjs.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)`);
|
|
42941
42941
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42942
42942
|
let found = null;
|
|
42943
42943
|
let total = 0;
|
|
@@ -42970,7 +42970,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42970
42970
|
}
|
|
42971
42971
|
}
|
|
42972
42972
|
}
|
|
42973
|
-
throw new (0,
|
|
42973
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
42974
42974
|
`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)})`
|
|
42975
42975
|
);
|
|
42976
42976
|
}
|
|
@@ -42978,7 +42978,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42978
42978
|
const xml = sectionXmls[si];
|
|
42979
42979
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
42980
42980
|
if (!run) {
|
|
42981
|
-
throw new (0,
|
|
42981
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
42982
42982
|
}
|
|
42983
42983
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _862 => _862.charPr, 'access', _863 => _863.get, 'call', _864 => _864(run.charPr), 'optionalAccess', _865 => _865.height]), () => ( 1e3));
|
|
42984
42984
|
const fontPt = charPrHeight / 100;
|
|
@@ -43256,7 +43256,7 @@ function pick(map, keys) {
|
|
|
43256
43256
|
return out;
|
|
43257
43257
|
}
|
|
43258
43258
|
async function hwpxToProfile(input) {
|
|
43259
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43259
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkMI655NV5cjs.toArrayBuffer.call(void 0, input);
|
|
43260
43260
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43261
43261
|
const parser = createXmlParser();
|
|
43262
43262
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _890 => _890.file, 'call', _891 => _891(/[Hh]eader\.xml$/), 'optionalAccess', _892 => _892[0]])));
|
|
@@ -44229,7 +44229,7 @@ function patchTableRows(input) {
|
|
|
44229
44229
|
const cells = input.editedCells(ins.ei);
|
|
44230
44230
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44231
44231
|
for (const cell2 of cells) {
|
|
44232
|
-
const unstable = cell2.lines.find((l) =>
|
|
44232
|
+
const unstable = cell2.lines.find((l) => _chunkSJ5OZXELcjs.sanitizeText.call(void 0, l) !== l);
|
|
44233
44233
|
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");
|
|
44234
44234
|
}
|
|
44235
44235
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44424,14 +44424,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44424
44424
|
}
|
|
44425
44425
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44426
44426
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44427
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44427
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkSJ5OZXELcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44428
44428
|
const splices = [];
|
|
44429
44429
|
let offset = 0;
|
|
44430
44430
|
for (let i = 0; i < lines.length; i++) {
|
|
44431
44431
|
const line = lines[i];
|
|
44432
44432
|
const orig = line.trim();
|
|
44433
44433
|
const next = newLines[i];
|
|
44434
|
-
if (
|
|
44434
|
+
if (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44435
44435
|
let prefix = 0;
|
|
44436
44436
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44437
44437
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44831,12 +44831,12 @@ function stripCellTokens(text) {
|
|
|
44831
44831
|
}
|
|
44832
44832
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44833
44833
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44834
|
-
const content =
|
|
44834
|
+
const content = _chunkSJ5OZXELcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44835
44835
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44836
44836
|
const t = line.trim();
|
|
44837
44837
|
if (!t) return "";
|
|
44838
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44839
|
-
return
|
|
44838
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkSJ5OZXELcjs.escapeGfm.call(void 0, t)}**`;
|
|
44839
|
+
return _chunkSJ5OZXELcjs.escapeGfm.call(void 0, t);
|
|
44840
44840
|
}).filter(Boolean);
|
|
44841
44841
|
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");
|
|
44842
44842
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44850,7 +44850,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44850
44850
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44851
44851
|
const replica = [];
|
|
44852
44852
|
for (let r = 0; r < table2.rows; r++) {
|
|
44853
|
-
const line =
|
|
44853
|
+
const line = _chunkSJ5OZXELcjs.escapeGfm.call(void 0, _chunkSJ5OZXELcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44854
44854
|
if (line) replica.push({ line, gridR: r });
|
|
44855
44855
|
}
|
|
44856
44856
|
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");
|
|
@@ -44904,7 +44904,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44904
44904
|
}
|
|
44905
44905
|
const splices = [];
|
|
44906
44906
|
let sectionIndex = -1;
|
|
44907
|
-
const unstable = newLines.find((l) =>
|
|
44907
|
+
const unstable = newLines.find((l) => _chunkSJ5OZXELcjs.sanitizeText.call(void 0, l) !== l);
|
|
44908
44908
|
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");
|
|
44909
44909
|
if (nonEmpty.length === 0) {
|
|
44910
44910
|
if (newLines.length === 0) return 0;
|
|
@@ -45028,7 +45028,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45028
45028
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45029
45029
|
if (paths.length > 0) return paths;
|
|
45030
45030
|
}
|
|
45031
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45031
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkMI655NV5cjs.compareSectionPaths);
|
|
45032
45032
|
}
|
|
45033
45033
|
|
|
45034
45034
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45815,7 +45815,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45815
45815
|
}
|
|
45816
45816
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45817
45817
|
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");
|
|
45818
|
-
if (
|
|
45818
|
+
if (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45819
45819
|
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");
|
|
45820
45820
|
}
|
|
45821
45821
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45862,7 +45862,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45862
45862
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45863
45863
|
continue;
|
|
45864
45864
|
}
|
|
45865
|
-
if (afterEach.some((l) =>
|
|
45865
|
+
if (afterEach.some((l) => _chunkSJ5OZXELcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45866
45866
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45867
45867
|
continue;
|
|
45868
45868
|
}
|
|
@@ -45890,7 +45890,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45890
45890
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45891
45891
|
break;
|
|
45892
45892
|
}
|
|
45893
|
-
if (
|
|
45893
|
+
if (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45894
45894
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45895
45895
|
break;
|
|
45896
45896
|
}
|
|
@@ -45946,12 +45946,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45946
45946
|
}
|
|
45947
45947
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
45948
45948
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
45949
|
-
const content =
|
|
45949
|
+
const content = _chunkSJ5OZXELcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
45950
45950
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
45951
45951
|
const t = line.trim();
|
|
45952
45952
|
if (!t) return "";
|
|
45953
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
45954
|
-
return
|
|
45953
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkSJ5OZXELcjs.escapeGfm.call(void 0, t)}**`;
|
|
45954
|
+
return _chunkSJ5OZXELcjs.escapeGfm.call(void 0, t);
|
|
45955
45955
|
}).filter(Boolean);
|
|
45956
45956
|
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");
|
|
45957
45957
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -45965,7 +45965,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45965
45965
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
45966
45966
|
const replica = [];
|
|
45967
45967
|
for (let r = 0; r < table2.rows; r++) {
|
|
45968
|
-
const line =
|
|
45968
|
+
const line = _chunkSJ5OZXELcjs.escapeGfm.call(void 0, _chunkSJ5OZXELcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
45969
45969
|
if (line) replica.push({ line, gridR: r });
|
|
45970
45970
|
}
|
|
45971
45971
|
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");
|
|
@@ -46006,7 +46006,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46006
46006
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46007
46007
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46008
46008
|
}
|
|
46009
|
-
const unstable = newLines.find((l) =>
|
|
46009
|
+
const unstable = newLines.find((l) => _chunkSJ5OZXELcjs.sanitizeText.call(void 0, l) !== l);
|
|
46010
46010
|
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");
|
|
46011
46011
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46012
46012
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46408,12 +46408,12 @@ function buildOrigUnits(blocks) {
|
|
|
46408
46408
|
const block = blocks[i];
|
|
46409
46409
|
let consume = 1;
|
|
46410
46410
|
let chunk;
|
|
46411
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46411
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkSJ5OZXELcjs.sanitizeText.call(void 0, block.text))) {
|
|
46412
46412
|
const next = blocks[i + 1];
|
|
46413
46413
|
if (_optionalChain([next, 'optionalAccess', _967 => _967.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46414
|
-
chunk =
|
|
46414
|
+
chunk = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46415
46415
|
} else {
|
|
46416
|
-
chunk =
|
|
46416
|
+
chunk = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, [block]);
|
|
46417
46417
|
}
|
|
46418
46418
|
if (chunk) {
|
|
46419
46419
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -46697,7 +46697,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46697
46697
|
}
|
|
46698
46698
|
}
|
|
46699
46699
|
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");
|
|
46700
|
-
if (
|
|
46700
|
+
if (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkSJ5OZXELcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46701
46701
|
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");
|
|
46702
46702
|
}
|
|
46703
46703
|
const xml = _optionalChain([ctx, 'access', _979 => _979.scans, 'access', _980 => _980[mapping.para.sectionIndex], 'optionalAccess', _981 => _981.xml]);
|
|
@@ -46714,14 +46714,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46714
46714
|
}
|
|
46715
46715
|
function textUnitInline(raw, block) {
|
|
46716
46716
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46717
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46717
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkSJ5OZXELcjs.sanitizeText.call(void 0, block.text))) {
|
|
46718
46718
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46719
46719
|
}
|
|
46720
46720
|
if (block.href) {
|
|
46721
46721
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46722
46722
|
if (linkMatch) text = linkMatch[1];
|
|
46723
46723
|
}
|
|
46724
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46724
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkSJ5OZXELcjs.sanitizeText.call(void 0, block.text))) {
|
|
46725
46725
|
text = text.slice(1, -1);
|
|
46726
46726
|
}
|
|
46727
46727
|
return text;
|
|
@@ -49269,7 +49269,7 @@ function blocksToChunks(blocks, options) {
|
|
|
49269
49269
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1012 => _1012.granularity]), () => ( "section"));
|
|
49270
49270
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1013 => _1013.includeTableCells]), () => ( false));
|
|
49271
49271
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1014 => _1014.tableFormat]) };
|
|
49272
|
-
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm")
|
|
49272
|
+
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm") _chunkSJ5OZXELcjs.assignTableIds.call(void 0, blocks);
|
|
49273
49273
|
const chunks = [];
|
|
49274
49274
|
const headingStack = [];
|
|
49275
49275
|
const listStack = [];
|
|
@@ -49283,12 +49283,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49283
49283
|
let run = null;
|
|
49284
49284
|
const flushRun = () => {
|
|
49285
49285
|
if (!run) return;
|
|
49286
|
-
push("text", run.breadcrumb,
|
|
49286
|
+
push("text", run.breadcrumb, _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49287
49287
|
run = null;
|
|
49288
49288
|
};
|
|
49289
49289
|
for (let i = 0; i < blocks.length; i++) {
|
|
49290
49290
|
const block = blocks[i];
|
|
49291
|
-
const md2 =
|
|
49291
|
+
const md2 = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49292
49292
|
if (!md2) continue;
|
|
49293
49293
|
if (block.type === "heading") {
|
|
49294
49294
|
flushRun();
|
|
@@ -49376,7 +49376,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49376
49376
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49377
49377
|
}
|
|
49378
49378
|
function irCellLines(text) {
|
|
49379
|
-
return stripCellTokens(
|
|
49379
|
+
return stripCellTokens(_chunkSJ5OZXELcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49380
49380
|
}
|
|
49381
49381
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49382
49382
|
|
|
@@ -49636,7 +49636,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49636
49636
|
if (newPlain === "") {
|
|
49637
49637
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49638
49638
|
}
|
|
49639
|
-
if (
|
|
49639
|
+
if (_chunkSJ5OZXELcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49640
49640
|
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");
|
|
49641
49641
|
}
|
|
49642
49642
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1035 => _1035.scans, 'access', _1036 => _1036[mapping.para.sectionIndex], 'optionalAccess', _1037 => _1037.xml]));
|
|
@@ -49731,7 +49731,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
49731
49731
|
});
|
|
49732
49732
|
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;
|
|
49733
49733
|
function sanitizeRawHtml(raw) {
|
|
49734
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49734
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkMI655NV5cjs.escapeHtml.call(void 0, tag));
|
|
49735
49735
|
}
|
|
49736
49736
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49737
49737
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -49739,7 +49739,7 @@ function renderHtml(markdown, options) {
|
|
|
49739
49739
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1041 => _1041.preset]), () => ( "default"));
|
|
49740
49740
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1042 => _1042.extraCss]), () => ( "")));
|
|
49741
49741
|
const body = md.render(markdown);
|
|
49742
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${
|
|
49742
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${_chunkMI655NV5cjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49743
49743
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1044 => _1044.watermark]) ? `
|
|
49744
49744
|
.watermark {
|
|
49745
49745
|
position: fixed;
|
|
@@ -49793,13 +49793,13 @@ async function htmlToPdf(html, options) {
|
|
|
49793
49793
|
try {
|
|
49794
49794
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49795
49795
|
} catch (e42) {
|
|
49796
|
-
throw new (0,
|
|
49796
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
49797
49797
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49798
49798
|
);
|
|
49799
49799
|
}
|
|
49800
49800
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49801
49801
|
if (!executablePath) {
|
|
49802
|
-
throw new (0,
|
|
49802
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
49803
49803
|
"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."
|
|
49804
49804
|
);
|
|
49805
49805
|
}
|
|
@@ -49854,7 +49854,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49854
49854
|
return htmlToPdf(html, options);
|
|
49855
49855
|
}
|
|
49856
49856
|
async function blocksToPdf(blocks, options) {
|
|
49857
|
-
const markdown =
|
|
49857
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks);
|
|
49858
49858
|
return markdownToPdf(markdown, options);
|
|
49859
49859
|
}
|
|
49860
49860
|
|
|
@@ -49977,7 +49977,7 @@ function findFirst(el, name, depth = 0) {
|
|
|
49977
49977
|
}
|
|
49978
49978
|
var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
|
|
49979
49979
|
var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "curve", "line", "arc", "ole", "textart", ...FORM_TAGS]);
|
|
49980
|
-
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace", "fwSpace"]);
|
|
49980
|
+
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
49981
49981
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
49982
49982
|
function sectionNoteFormats2(p) {
|
|
49983
49983
|
const root = _optionalChain([p, 'access', _1054 => _1054.ownerDocument, 'optionalAccess', _1055 => _1055.documentElement]);
|
|
@@ -50737,6 +50737,45 @@ function cachedParagraphBottom(lsa, bodyFlow) {
|
|
|
50737
50737
|
return bottom;
|
|
50738
50738
|
}
|
|
50739
50739
|
|
|
50740
|
+
// src/render/reflow-fragments.ts
|
|
50741
|
+
function appendNarrowLineFragments(parent, seg, free, box, flow) {
|
|
50742
|
+
if (!free || !box) return false;
|
|
50743
|
+
const parts = free.filter(([a, b]) => b - a >= 1440);
|
|
50744
|
+
if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
|
|
50745
|
+
const { text, widths, spacings, slots, start, end } = flow;
|
|
50746
|
+
if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
|
|
50747
|
+
let ink = start;
|
|
50748
|
+
while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
|
|
50749
|
+
if (text.slice(ink, end).includes("\u2060")) return false;
|
|
50750
|
+
if (ink === end || parts.slice(0, -1).some(([a, b]) => (_nullishCoalesce(widths[ink], () => ( 0))) - (_nullishCoalesce(spacings[ink], () => ( 0))) <= b - a)) return false;
|
|
50751
|
+
const fragments = [];
|
|
50752
|
+
let cursor = start;
|
|
50753
|
+
for (const [a, b] of parts.slice(0, -1)) {
|
|
50754
|
+
const offset = cursor;
|
|
50755
|
+
let w = 0;
|
|
50756
|
+
while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
|
|
50757
|
+
fragments.push({ offset, x: a, width: b - a });
|
|
50758
|
+
}
|
|
50759
|
+
let rest = 0;
|
|
50760
|
+
for (let i = cursor; i < end; i++) rest += widths[i];
|
|
50761
|
+
let last = end - 1;
|
|
50762
|
+
if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
|
|
50763
|
+
rest -= _nullishCoalesce(spacings[last], () => ( 0));
|
|
50764
|
+
if (rest > box[1] + 0.5) return false;
|
|
50765
|
+
let next = end;
|
|
50766
|
+
while (next < text.length && text[next] === " ") next++;
|
|
50767
|
+
if (next < text.length && rest + (_nullishCoalesce(widths[next], () => ( 0))) - (_nullishCoalesce(spacings[next], () => ( 0))) <= box[1] + 0.5) return false;
|
|
50768
|
+
fragments.push({ offset: cursor, x: box[0], width: box[1] });
|
|
50769
|
+
fragments.forEach((f, i) => {
|
|
50770
|
+
const part = seg.cloneNode(false);
|
|
50771
|
+
if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
|
|
50772
|
+
part.setAttribute("horzpos", String(f.x));
|
|
50773
|
+
part.setAttribute("horzsize", String(f.width));
|
|
50774
|
+
parent.appendChild(part);
|
|
50775
|
+
});
|
|
50776
|
+
return true;
|
|
50777
|
+
}
|
|
50778
|
+
|
|
50740
50779
|
// src/render/reflow.ts
|
|
50741
50780
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50742
50781
|
var LINESEG_FLAGS = "393216";
|
|
@@ -51155,8 +51194,9 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51155
51194
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51156
51195
|
const li = lineOf(o.index);
|
|
51157
51196
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51197
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall', _1164 => _1164(li - 1)]), () => ( (li === 1 ? firstWrapWidth : contWidth)))) && /^[\u2060\ufdd0]+$/.test(text.slice(wrap.starts[li - 1], wrap.starts[li]))) collisionHeights[li - 1] = Math.max(_nullishCoalesce(collisionHeights[li - 1], () => ( 0)), h);
|
|
51158
51198
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51159
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51199
|
+
if (_optionalChain([findChildByLocalName, 'call', _1165 => _1165(o.el, "pos"), 'optionalAccess', _1166 => _1166.getAttribute, 'call', _1167 => _1167("affectLSpacing")]) === "1") lineObjLs[li] = true;
|
|
51160
51200
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51161
51201
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51162
51202
|
}
|
|
@@ -51164,13 +51204,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51164
51204
|
let v = textStartV;
|
|
51165
51205
|
let firstAcc = 0;
|
|
51166
51206
|
const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
|
|
51167
|
-
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access',
|
|
51207
|
+
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access', _1168 => _1168.charPr, 'access', _1169 => _1169.get, 'call', _1170 => _1170(prId), 'optionalAccess', _1171 => _1171.height]) : void 0) || 0;
|
|
51168
51208
|
const lineTextH = (li) => {
|
|
51169
51209
|
const s = textposOf[li], last = li === wrap.starts.length - 1, e = last ? m.chars.length : textposOf[li + 1];
|
|
51170
51210
|
let h = 0;
|
|
51171
51211
|
for (let k = s; k < e; k++) h = Math.max(h, heightOf(m.chars[k].prId));
|
|
51172
51212
|
for (const r of m.runs) if (r.at >= s && (last ? r.at <= e : r.at < e)) h = Math.max(h, heightOf(r.prId));
|
|
51173
|
-
if (li === 0 && _optionalChain([bu, 'optionalAccess',
|
|
51213
|
+
if (li === 0 && _optionalChain([bu, 'optionalAccess', _1172 => _1172.charPrId]) != null) h = Math.max(h, heightOf(bu.charPrId));
|
|
51174
51214
|
return h || height;
|
|
51175
51215
|
};
|
|
51176
51216
|
const fontLineOf = (li) => {
|
|
@@ -51197,7 +51237,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51197
51237
|
const c = m.chars[k];
|
|
51198
51238
|
if (!c.ch) continue;
|
|
51199
51239
|
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51200
|
-
const f = _optionalChain([st, 'optionalAccess',
|
|
51240
|
+
const f = _optionalChain([st, 'optionalAccess', _1173 => _1173.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
51201
51241
|
if (!f || !f.top && !f.bottom) continue;
|
|
51202
51242
|
const t = f.top ? Math.trunc(f.top.widthPt * 100) : 0, b = f.bottom ? Math.trunc(f.bottom.widthPt * 100) : 0;
|
|
51203
51243
|
top = Math.max(top, st.height + t);
|
|
@@ -51243,14 +51283,21 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51243
51283
|
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), lineObjAsc[li])));
|
|
51244
51284
|
seg.setAttribute("spacing", String(spacing));
|
|
51245
51285
|
let box = boxAt(li);
|
|
51246
|
-
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access',
|
|
51286
|
+
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access', _1174 => _1174[li], 'optionalAccess', _1175 => _1175.filter, 'call', _1176 => _1176(([a, b]) => b - a >= 1440)]) : void 0;
|
|
51247
51287
|
const parts = fit && fit.length > 1 && natW <= fit[0][1] - fit[0][0] - Math.max(0, geom.marginIntent) ? fit : void 0;
|
|
51248
51288
|
if (parts) box = [parts[0][0], parts[0][1] - parts[0][0]];
|
|
51249
51289
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
51250
51290
|
seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
|
|
51251
51291
|
seg.setAttribute("flags", LINESEG_FLAGS);
|
|
51292
|
+
if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
|
|
51293
|
+
lsa,
|
|
51294
|
+
seg,
|
|
51295
|
+
lineParts[li],
|
|
51296
|
+
box,
|
|
51297
|
+
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: _nullishCoalesce(wrap.starts[li + 1], () => ( text.length)) }
|
|
51298
|
+
)) continue;
|
|
51252
51299
|
lsa.appendChild(seg);
|
|
51253
|
-
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
51300
|
+
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _1177 => _1177.slice, 'call', _1178 => _1178(1)]), () => ( []))) {
|
|
51254
51301
|
const more = seg.cloneNode(false);
|
|
51255
51302
|
more.setAttribute("textpos", String(m.chars.length + 1));
|
|
51256
51303
|
more.setAttribute("horzpos", String(a));
|
|
@@ -51269,9 +51316,9 @@ function paperOrigin(p) {
|
|
|
51269
51316
|
const d = p.ownerDocument;
|
|
51270
51317
|
const hit = originMemo.get(d);
|
|
51271
51318
|
if (hit) return hit;
|
|
51272
|
-
const pagePr = _nullishCoalesce(_optionalChain([p, 'access',
|
|
51319
|
+
const pagePr = _nullishCoalesce(_optionalChain([p, 'access', _1179 => _1179.ownerDocument, 'optionalAccess', _1180 => _1180.getElementsByTagName, 'call', _1181 => _1181("hp:pagePr"), 'access', _1182 => _1182[0]]), () => ( null));
|
|
51273
51320
|
const mg = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
51274
|
-
const tb = _optionalChain([pagePr, 'optionalAccess',
|
|
51321
|
+
const tb = _optionalChain([pagePr, 'optionalAccess', _1183 => _1183.getAttribute, 'call', _1184 => _1184("gutterType")]) === "TOP_BOTTOM", gut = num3(mg, "gutter");
|
|
51275
51322
|
const o = [num3(mg, "left", 8504) + (tb ? 0 : gut), num3(mg, "top", 5668) + num3(mg, "header") + (tb ? gut : 0), num3(pagePr, "width", 59528)];
|
|
51276
51323
|
originMemo.set(d, o);
|
|
51277
51324
|
return o;
|
|
@@ -51288,7 +51335,7 @@ function pageTopBand(p) {
|
|
|
51288
51335
|
for (const o of elements2(run)) {
|
|
51289
51336
|
if (!OBJ_TAGS.has(ln2(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
51290
51337
|
const pos = findChildByLocalName(o, "pos");
|
|
51291
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51338
|
+
if (_optionalChain([pos, 'optionalAccess', _1185 => _1185.getAttribute, 'call', _1186 => _1186("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1187 => _1187.getAttribute, 'call', _1188 => _1188("vertRelTo")]) !== "PAGE" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1189 => _1189.getAttribute, 'call', _1190 => _1190("vertAlign")]), () => ( "TOP"))) !== "TOP") continue;
|
|
51292
51339
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
51293
51340
|
const h = ln2(o) === "tbl" ? Math.max(num3(sz, "height"), measureTableHeight(o)) : num3(sz, "height");
|
|
51294
51341
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
@@ -51344,7 +51391,7 @@ function footNoteHeights(p, ownOnly = false) {
|
|
|
51344
51391
|
let a = fn.parentNode, inSplit = false;
|
|
51345
51392
|
while (a && a !== p) {
|
|
51346
51393
|
const e = a;
|
|
51347
|
-
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call',
|
|
51394
|
+
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call', _1191 => _1191(e, "pos"), 'optionalAccess', _1192 => _1192.getAttribute, 'call', _1193 => _1193("treatAsChar")]) !== "1") inSplit = true;
|
|
51348
51395
|
a = a.parentNode;
|
|
51349
51396
|
}
|
|
51350
51397
|
if (inSplit) continue;
|
|
@@ -51373,7 +51420,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51373
51420
|
let prevPlaced;
|
|
51374
51421
|
const bodyFlow = areaW === counter.bodyW && bodyH > 0;
|
|
51375
51422
|
const vis = bodyH > 0 ? findFirst(container, "visibility") : null;
|
|
51376
|
-
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess',
|
|
51423
|
+
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess', _1194 => _1194.getAttribute, 'call', _1195 => _1195("hideFirstEmptyLine")]) === "1";
|
|
51377
51424
|
let hidPrev = 0;
|
|
51378
51425
|
const cellW = areaW;
|
|
51379
51426
|
let cellCols = 1, cellCol = 0;
|
|
@@ -51398,7 +51445,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51398
51445
|
reflowSubListsIn(p, doc, styles, mode, counter, reflowBlockFlow, bodyFlow ? areaW : void 0);
|
|
51399
51446
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
51400
51447
|
const cursorBefore = cursorV;
|
|
51401
|
-
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51448
|
+
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1196 => _1196.spaceBefore]), () => ( 0))), floatFloor);
|
|
51402
51449
|
floatFloor = 0;
|
|
51403
51450
|
if (bodyH > 0) {
|
|
51404
51451
|
const [top, bot] = pageTopBand(p);
|
|
@@ -51424,13 +51471,13 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51424
51471
|
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51425
51472
|
if (Number.isFinite(bottom)) {
|
|
51426
51473
|
cursorV = bottom;
|
|
51427
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51474
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1197 => _1197.spaceAfter]), () => ( 0));
|
|
51428
51475
|
}
|
|
51429
51476
|
}
|
|
51430
51477
|
continue;
|
|
51431
51478
|
}
|
|
51432
51479
|
const paraH = res.paraBottom - startV;
|
|
51433
|
-
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess',
|
|
51480
|
+
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess', _1198 => _1198.pageBreakBefore]));
|
|
51434
51481
|
const lines = bodyH > 0 ? elements2(_nullishCoalesce(findChildByLocalName(p, "linesegarray"), () => ( p))).filter((e) => ln2(e) === "lineseg") : [];
|
|
51435
51482
|
const reserve = bodyH > 0 ? pageBottomReserve(p) : 0;
|
|
51436
51483
|
const fns = bodyH > 0 ? footNoteHeights(p) : [];
|
|
@@ -51465,9 +51512,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51465
51512
|
let cut = -1;
|
|
51466
51513
|
if (!explicitBreak && !firstOver && lines.length > 1) {
|
|
51467
51514
|
cut = lines.findIndex((seg, i) => i > 0 && lineBottom(seg) > limAt(i) && num3(seg, "vertsize") <= bodyH);
|
|
51468
|
-
if (cut > 0 && _optionalChain([g3, 'optionalAccess',
|
|
51515
|
+
if (cut > 0 && _optionalChain([g3, 'optionalAccess', _1199 => _1199.widowOrphan]) && lines.length >= 3 && cut === lines.length - 1) cut--;
|
|
51469
51516
|
}
|
|
51470
|
-
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess',
|
|
51517
|
+
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess', _1200 => _1200.widowOrphan]) || cut > 0 && !!_optionalChain([g3, 'optionalAccess', _1201 => _1201.keepLines]);
|
|
51471
51518
|
if (cut > 0 && !orphan) {
|
|
51472
51519
|
for (let i = cut; i < lines.length; i++) {
|
|
51473
51520
|
const seg = lines[i];
|
|
@@ -51487,7 +51534,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51487
51534
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51488
51535
|
if (lsa) p.removeChild(lsa);
|
|
51489
51536
|
const zb = zones.length;
|
|
51490
|
-
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51537
|
+
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1202 => _1202.spaceBefore]), () => ( 0));
|
|
51491
51538
|
let moveRes = reflowPara(p, doc, styles, areaW, sb0, mode, zones, new Map([...numsBefore].map(([k, v]) => [k, v.slice()])), true, bodyH);
|
|
51492
51539
|
const lsaM = findChildByLocalName(p, "linesegarray"), sM = lsaM ? elements2(lsaM).find((e) => ln2(e) === "lineseg") : void 0;
|
|
51493
51540
|
const vM = sM ? num3(sM, "vertpos") : sb0;
|
|
@@ -51507,7 +51554,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51507
51554
|
}
|
|
51508
51555
|
}
|
|
51509
51556
|
} else {
|
|
51510
|
-
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51557
|
+
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1203 => _1203.spaceBefore]), () => ( 0));
|
|
51511
51558
|
shiftParaVert(p, top - startV);
|
|
51512
51559
|
cursorV = paraH + top;
|
|
51513
51560
|
if (bodyH > 0 && (top + paraH > bodyH || squareTableOver(p, top, bodyH))) {
|
|
@@ -51519,7 +51566,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51519
51566
|
splitPage = true;
|
|
51520
51567
|
}
|
|
51521
51568
|
}
|
|
51522
|
-
if (_optionalChain([prevPlaced, 'optionalAccess',
|
|
51569
|
+
if (_optionalChain([prevPlaced, 'optionalAccess', _1204 => _1204.keepWithNext]) && prevPlaced.startV > prevPlaced.top) {
|
|
51523
51570
|
shiftParaVert(prevPlaced.p, prevPlaced.top - prevPlaced.startV);
|
|
51524
51571
|
const base = prevPlaced.top + prevPlaced.h + prevPlaced.spaceAfter;
|
|
51525
51572
|
shiftParaVert(p, base);
|
|
@@ -51534,7 +51581,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51534
51581
|
const tVo = tEl ? num3(findChildByLocalName(tEl, "pos"), "vertOffset") : 0;
|
|
51535
51582
|
const tOm = tEl ? findChildByLocalName(tEl, "outMargin") : null;
|
|
51536
51583
|
if (tEl && tVo > 0 && tVo < 2 ** 31 && num3(tOm, "top") + measureTableHeight(tEl) + num3(tOm, "bottom") <= bodyH) {
|
|
51537
|
-
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51584
|
+
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1205 => _1205.spaceBefore]), () => ( 0))) + tVo;
|
|
51538
51585
|
zones.push({ top: tTop, bottom: Math.max(bodyH + 1, tTop + 1), left: -1e9, right: 1e9, flow: "BOTH_SIDES", carry: split });
|
|
51539
51586
|
floatFloor = 0;
|
|
51540
51587
|
cursorV = res.textBottom;
|
|
@@ -51561,9 +51608,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51561
51608
|
zones.length = 0;
|
|
51562
51609
|
splitPage = true;
|
|
51563
51610
|
}
|
|
51564
|
-
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51611
|
+
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1206 => _1206.spaceBefore]), () => ( 0))), lim)) {
|
|
51565
51612
|
const BU = BUH;
|
|
51566
|
-
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51613
|
+
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1207 => _1207.spaceBefore]), () => ( 0))), BU ? limOwn : lim, bodyH, styles, true, BU ? { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea } : void 0);
|
|
51567
51614
|
if (split4 !== void 0) {
|
|
51568
51615
|
cursorV = 0;
|
|
51569
51616
|
floatFloor = split4;
|
|
@@ -51581,7 +51628,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51581
51628
|
}
|
|
51582
51629
|
const keepCursor = hidden && !explicitBreak;
|
|
51583
51630
|
hidPrev = hidden ? hidPrev + 1 : 0;
|
|
51584
|
-
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51631
|
+
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1208 => _1208.spaceBefore]), () => ( 0)), h: paraH, spaceAfter: res.spaceAfter, keepWithNext: !!_optionalChain([g3, 'optionalAccess', _1209 => _1209.keepWithNext]) } : void 0;
|
|
51585
51632
|
const moved = explicitBreak || firstOver || orphan || off !== 0;
|
|
51586
51633
|
pageLimit = reserve > 0 ? bodyH - reserve : moved ? bodyH : Math.min(pageLimit, reserve > 0 ? bodyH - reserve : pageLimit);
|
|
51587
51634
|
if (moved && refs.length && cut > 0 && !orphan && !explicitBreak && !firstOver) {
|
|
@@ -51681,7 +51728,7 @@ function flowEndNotes(root, bodyH) {
|
|
|
51681
51728
|
if (done.has(f) || raw0 < f.bottom) continue;
|
|
51682
51729
|
done.add(f);
|
|
51683
51730
|
if (!(base + f.lineBottom - shift <= bodyH && base + f.bottom - shift > bodyH)) continue;
|
|
51684
|
-
if (_optionalChain([f, 'access',
|
|
51731
|
+
if (_optionalChain([f, 'access', _1210 => _1210.rows, 'optionalAccess', _1211 => _1211.length]) && _optionalChain([f, 'access', _1212 => _1212.el, 'optionalAccess', _1213 => _1213.getAttribute, 'call', _1214 => _1214("pageBreak")]) === "CELL") {
|
|
51685
51732
|
let yy = base + f.bottom - f.carry - shift + f.outT, k = 0;
|
|
51686
51733
|
while (k < f.rows.length && yy + f.rows[k] <= bodyH) yy += f.rows[k++];
|
|
51687
51734
|
if (k === f.rows.length) continue;
|
|
@@ -51947,7 +51994,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51947
51994
|
const declarations = [];
|
|
51948
51995
|
const hidden = /* @__PURE__ */ new Map();
|
|
51949
51996
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51950
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
51997
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1215 => _1215.get, 'call', _1216 => _1216(p), 'optionalAccess', _1217 => _1217[0]]), () => ( 0));
|
|
51951
51998
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51952
51999
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51953
52000
|
for (const el of elements(ctrl)) {
|
|
@@ -51967,7 +52014,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51967
52014
|
const out = [];
|
|
51968
52015
|
for (let page = 0; page < pageCount; page++) {
|
|
51969
52016
|
const n = pageBase + page + 1;
|
|
51970
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
52017
|
+
const hides = (name) => _optionalChain([hidden, 'access', _1218 => _1218.get, 'call', _1219 => _1219(page), 'optionalAccess', _1220 => _1220.has, 'call', _1221 => _1221(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
51971
52018
|
if (!hides("MasterPage")) {
|
|
51972
52019
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
51973
52020
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -51996,7 +52043,7 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51996
52043
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
51997
52044
|
const byPage = /* @__PURE__ */ new Map();
|
|
51998
52045
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51999
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
52046
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1222 => _1222.get, 'call', _1223 => _1223(p), 'optionalAccess', _1224 => _1224[0]]), () => ( 0));
|
|
52000
52047
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
52001
52048
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
52002
52049
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
@@ -52014,12 +52061,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
52014
52061
|
}
|
|
52015
52062
|
}
|
|
52016
52063
|
const stories = [], rules = [];
|
|
52017
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52018
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52064
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1225 => _1225.getAttribute, 'call', _1226 => _1226("width")]), () => ( "0.12"))) || 0.12;
|
|
52065
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1227 => _1227.getAttribute, 'call', _1228 => _1228("type")]), () => ( "SOLID"));
|
|
52019
52066
|
for (const [page, notes] of byPage) {
|
|
52020
52067
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
52021
52068
|
const top = geom.MT + geom.BODY_H - area;
|
|
52022
|
-
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52069
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1229 => _1229.getAttribute, 'call', _1230 => _1230("color")]), () => ( "#000000")) });
|
|
52023
52070
|
let y = top + above + below;
|
|
52024
52071
|
for (const n of notes) {
|
|
52025
52072
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -52055,8 +52102,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
52055
52102
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
52056
52103
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
52057
52104
|
const rules = [];
|
|
52058
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52059
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52105
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1231 => _1231.getAttribute, 'call', _1232 => _1232("width")]), () => ( "0.12"))) || 0.12;
|
|
52106
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1233 => _1233.getAttribute, 'call', _1234 => _1234("type")]), () => ( "SOLID"))) !== "NONE") rules.push({ page, x: geom.ML + col * (colW + gap), y: geom.MT + y, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1235 => _1235.getAttribute, 'call', _1236 => _1236("color")]), () => ( "#000000")) });
|
|
52060
52107
|
y += below;
|
|
52061
52108
|
const next = () => {
|
|
52062
52109
|
if (++col >= nCol) {
|
|
@@ -52150,7 +52197,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52150
52197
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52151
52198
|
});
|
|
52152
52199
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52153
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
52200
|
+
if (_optionalChain([findChildByLocalName, 'call', _1237 => _1237(tbl2, "pos"), 'optionalAccess', _1238 => _1238.getAttribute, 'call', _1239 => _1239("treatAsChar")]) === "1") {
|
|
52154
52201
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
52155
52202
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
52156
52203
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -52206,7 +52253,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52206
52253
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
52207
52254
|
if (!b) continue;
|
|
52208
52255
|
const f = floatSpan(b.seg, y + c.marginT);
|
|
52209
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
52256
|
+
if (_optionalChain([f, 'optionalAccess', _1240 => _1240.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
52210
52257
|
lead = f.pages;
|
|
52211
52258
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
52212
52259
|
led.add(b.seg);
|
|
@@ -52223,8 +52270,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52223
52270
|
for (const c of rowCells) {
|
|
52224
52271
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
52225
52272
|
const inK = bs.filter((b) => b.part === k), next = bs.find((b) => b.part > k);
|
|
52226
|
-
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access',
|
|
52227
|
-
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
52273
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1241 => _1241[0], 'optionalAccess', _1242 => _1242.origin]), () => ( _optionalChain([next, 'optionalAccess', _1243 => _1243.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
52274
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1244 => _1244.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
52228
52275
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
52229
52276
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
52230
52277
|
}
|
|
@@ -52235,7 +52282,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52235
52282
|
if (!last) {
|
|
52236
52283
|
let span2 = 0, spanEnd = 0;
|
|
52237
52284
|
if (floatSpan) for (const c of rowCells) {
|
|
52238
|
-
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access',
|
|
52285
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1245 => _1245[0], 'optionalAccess', _1246 => _1246.origin]), () => ( 0));
|
|
52239
52286
|
for (const b of bs) {
|
|
52240
52287
|
if (led.has(b.seg)) continue;
|
|
52241
52288
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from);
|
|
@@ -52400,7 +52447,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
52400
52447
|
function shapeFill(el, defs, images, warn) {
|
|
52401
52448
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
52402
52449
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
52403
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
52450
|
+
const face = _optionalChain([win, 'optionalAccess', _1247 => _1247.getAttribute, 'call', _1248 => _1248("faceColor")]);
|
|
52404
52451
|
if (docColor(face)) return esc(face);
|
|
52405
52452
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
52406
52453
|
if (grad) {
|
|
@@ -52451,8 +52498,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52451
52498
|
const geometry = local ? { x: boxX, y: boxY, w, h, bbox: { x: boxX, y: boxY, w, h }, transform: "" } : objectGeometry(el, boxX, boxY, w, h, o.width || w, o.height || h);
|
|
52452
52499
|
const { x, y } = geometry;
|
|
52453
52500
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
52454
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52455
|
-
const color = esc(docColor(_optionalChain([line, 'optionalAccess',
|
|
52501
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1249 => _1249.getAttribute, 'call', _1250 => _1250("style")]), () => ( "SOLID"));
|
|
52502
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1251 => _1251.getAttribute, 'call', _1252 => _1252("color")]), "#000000"));
|
|
52456
52503
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
52457
52504
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
52458
52505
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -52531,9 +52578,9 @@ function planLines(m, styles, numText = "") {
|
|
|
52531
52578
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52532
52579
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52533
52580
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
52534
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52535
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
52536
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
52581
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1253 => _1253.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1254 => _1254.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
52582
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1255 => _1255.chars, 'access', _1256 => _1256.find, 'call', _1257 => _1257((c) => c.ch !== ""), 'optionalAccess', _1258 => _1258.prId]), () => ( null));
|
|
52583
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1259 => _1259.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
52537
52584
|
const bulletW = bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) + (bu.offsetPct ? Math.trunc(bst.height * bu.offset / 100) : bu.offset) : 0;
|
|
52538
52585
|
const plans = [];
|
|
52539
52586
|
for (let i = 0; i < m.segs.length; i++) {
|
|
@@ -52541,8 +52588,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52541
52588
|
const start = seg.textpos;
|
|
52542
52589
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52543
52590
|
const tabs = /* @__PURE__ */ new Map();
|
|
52544
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52545
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52591
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1260 => _1260.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1261 => _1261.autoIndent]) ? bulletW : 0);
|
|
52592
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1262 => _1262.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1263 => _1263.autoIndent]) ? bulletW : 0);
|
|
52546
52593
|
let fixedTo = start;
|
|
52547
52594
|
let fixedW = 0;
|
|
52548
52595
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52638,7 +52685,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52638
52685
|
let i = plan.start;
|
|
52639
52686
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52640
52687
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52641
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
52688
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1264 => _1264.styles, 'access', _1265 => _1265.paraGeom, 'access', _1266 => _1266.get, 'call', _1267 => _1267(m.paraPrId), 'optionalAccess', _1268 => _1268.vertAlign]) : void 0;
|
|
52642
52689
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52643
52690
|
if (plan.bullet) {
|
|
52644
52691
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -52723,7 +52770,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52723
52770
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52724
52771
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52725
52772
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52726
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
52773
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkSJ5OZXELcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52727
52774
|
ctx.stats.texts++;
|
|
52728
52775
|
}
|
|
52729
52776
|
return sw;
|
|
@@ -52792,26 +52839,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52792
52839
|
anchorLineH = pl.seg.textheight;
|
|
52793
52840
|
}
|
|
52794
52841
|
let objBaseV = baseV;
|
|
52795
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
52842
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1269 => _1269.paraTops, 'optionalAccess', _1270 => _1270.get, 'call', _1271 => _1271(p)]) : void 0;
|
|
52796
52843
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52797
52844
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
52798
52845
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
52799
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52846
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1272 => _1272.styles, 'access', _1273 => _1273.paraGeom, 'access', _1274 => _1274.get, 'call', _1275 => _1275(m.paraPrId), 'optionalAccess', _1276 => _1276.spaceBefore]), () => ( 0)) : 0);
|
|
52800
52847
|
if (baseV > start + 100) {
|
|
52801
52848
|
objBaseV = start;
|
|
52802
52849
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
52803
52850
|
}
|
|
52804
52851
|
}
|
|
52805
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52852
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1277 => _1277(q.el, "pos"), 'optionalAccess', _1278 => _1278.getAttribute, 'call', _1279 => _1279("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
52806
52853
|
const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
52807
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52854
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1280 => _1280.styles, 'access', _1281 => _1281.paraGeom, 'access', _1282 => _1282.get, 'call', _1283 => _1283(m.paraPrId), 'optionalAccess', _1284 => _1284.spaceBefore]), () => ( 0)) : 0;
|
|
52808
52855
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
52809
52856
|
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, firstLine && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
52810
52857
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
52811
52858
|
if (!tbStack) {
|
|
52812
52859
|
tbStack = /* @__PURE__ */ new Map();
|
|
52813
52860
|
let below = 0;
|
|
52814
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52861
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1285 => _1285(q.el, "pos"), 'optionalAccess', _1286 => _1286.getAttribute, 'call', _1287 => _1287("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1288 => _1288(q.el, "pos"), 'optionalAccess', _1289 => _1289.getAttribute, 'call', _1290 => _1290("allowOverlap")]) !== "1");
|
|
52815
52862
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
52816
52863
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
52817
52864
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -52822,7 +52869,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52822
52869
|
const st = tbStack.get(o.el);
|
|
52823
52870
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
52824
52871
|
}
|
|
52825
|
-
const moved = _optionalChain([ctx, 'access',
|
|
52872
|
+
const moved = _optionalChain([ctx, 'access', _1291 => _1291.objPlace, 'optionalAccess', _1292 => _1292.get, 'call', _1293 => _1293(o.el)]);
|
|
52826
52873
|
if (moved) {
|
|
52827
52874
|
const pg = ctx.page;
|
|
52828
52875
|
ctx.page = moved.page;
|
|
@@ -52841,7 +52888,7 @@ function cellParaTop(p, geom) {
|
|
|
52841
52888
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
52842
52889
|
if (!segs.length) return void 0;
|
|
52843
52890
|
const last = segs[segs.length - 1];
|
|
52844
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
52891
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1294 => _1294.get, 'call', _1295 => _1295(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1296 => _1296.spaceAfter]), () => ( 0)));
|
|
52845
52892
|
}
|
|
52846
52893
|
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52847
52894
|
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
@@ -52877,7 +52924,7 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
52877
52924
|
if (hrel === "PAGE") {
|
|
52878
52925
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52879
52926
|
} else if (hrel === "PAPER") {
|
|
52880
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52927
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1297 => _1297.bodyDx, 'optionalCall', _1298 => _1298(ctx.page)]), () => ( 0)));
|
|
52881
52928
|
} else {
|
|
52882
52929
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52883
52930
|
}
|
|
@@ -52922,7 +52969,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52922
52969
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
52923
52970
|
}
|
|
52924
52971
|
} else if (o.tag === "equation") {
|
|
52925
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52972
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1299 => _1299(o.el, "script"), 'optionalAccess', _1300 => _1300.textContent]), () => ( ""));
|
|
52926
52973
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
52927
52974
|
if (text && o.width > 0) {
|
|
52928
52975
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53025,7 +53072,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53025
53072
|
}
|
|
53026
53073
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53027
53074
|
return (seg, top) => {
|
|
53028
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53075
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1301 => _1301.parentNode]);
|
|
53029
53076
|
if (!p || ln(p) !== "p") return void 0;
|
|
53030
53077
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53031
53078
|
const m = buildPara(p);
|
|
@@ -53033,10 +53080,10 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53033
53080
|
for (const o of m.objs) {
|
|
53034
53081
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53035
53082
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53036
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53083
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1302 => _1302.getAttribute, 'call', _1303 => _1303("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53037
53084
|
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)));
|
|
53038
53085
|
if (segK !== k) continue;
|
|
53039
|
-
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53086
|
+
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1304 => _1304.getAttribute, 'call', _1305 => _1305("vertOffset")]), () => ( void 0)), 0));
|
|
53040
53087
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
|
|
53041
53088
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53042
53089
|
}
|
|
@@ -53068,7 +53115,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53068
53115
|
let hdrRows = 0;
|
|
53069
53116
|
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++;
|
|
53070
53117
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53071
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53118
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1306 => _1306(tbl2, "pos"), 'optionalAccess', _1307 => _1307.getAttribute, 'call', _1308 => _1308("treatAsChar")]) !== "1";
|
|
53072
53119
|
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) : rowH.map((h, r) => [{ page: 0, y: ty + rowY[r], h }]);
|
|
53073
53120
|
const splitSaved = ctx.splitCell;
|
|
53074
53121
|
ctx.splitCell = false;
|
|
@@ -53090,7 +53137,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53090
53137
|
for (const g3 of geom) {
|
|
53091
53138
|
ctx.page = g3.page;
|
|
53092
53139
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53093
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53140
|
+
if (_optionalChain([bf, 'optionalAccess', _1309 => _1309.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
53094
53141
|
}
|
|
53095
53142
|
for (const g3 of geom) {
|
|
53096
53143
|
const { c } = g3;
|
|
@@ -53101,13 +53148,13 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53101
53148
|
const boxes = cellLineBoxes(c);
|
|
53102
53149
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53103
53150
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53104
|
-
const r = _optionalChain([pc, 'access',
|
|
53151
|
+
const r = _optionalChain([pc, 'access', _1310 => _1310.range, 'optionalAccess', _1311 => _1311.get, 'call', _1312 => _1312(c.el)]);
|
|
53105
53152
|
return !!r && v >= r[0] && v < r[1];
|
|
53106
53153
|
}));
|
|
53107
53154
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53108
53155
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53109
53156
|
if (va2 === "TOP") return 0;
|
|
53110
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53157
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1313 => _1313.range, 'optionalAccess', _1314 => _1314.get, 'call', _1315 => _1315(c.el), 'optionalAccess', _1316 => _1316[0]]), () => ( 0));
|
|
53111
53158
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53112
53159
|
if (!bottoms.length) return 0;
|
|
53113
53160
|
const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
|
|
@@ -53120,7 +53167,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53120
53167
|
const pages = segs.map((sg) => {
|
|
53121
53168
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53122
53169
|
const k = pieceOf(v);
|
|
53123
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53170
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1317 => _1317.range, 'optionalAccess', _1318 => _1318.get, 'call', _1319 => _1319(c.el), 'optionalAccess', _1320 => _1320[0]]), () => ( 0));
|
|
53124
53171
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53125
53172
|
return startPage + pc.page;
|
|
53126
53173
|
});
|
|
@@ -53212,7 +53259,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53212
53259
|
}
|
|
53213
53260
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53214
53261
|
const img = findFirst(pic, "img");
|
|
53215
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53262
|
+
const ref = _optionalChain([img, 'optionalAccess', _1321 => _1321.getAttribute, 'call', _1322 => _1322("binaryItemIDRef")]);
|
|
53216
53263
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53217
53264
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53218
53265
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53258,12 +53305,12 @@ function readSectionGeom(root) {
|
|
|
53258
53305
|
const pagePr = findFirst(root, "pagePr");
|
|
53259
53306
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53260
53307
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53261
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53308
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1323 => _1323.getAttribute, 'call', _1324 => _1324("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53262
53309
|
const t = PW;
|
|
53263
53310
|
PW = PH;
|
|
53264
53311
|
PH = t;
|
|
53265
53312
|
}
|
|
53266
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53313
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1325 => _1325.getAttribute, 'call', _1326 => _1326("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53267
53314
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53268
53315
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53269
53316
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53394,7 +53441,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53394
53441
|
for (const o of m0.objs) {
|
|
53395
53442
|
if (o.tag !== "tbl") continue;
|
|
53396
53443
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53397
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53444
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1327 => _1327.getAttribute, 'call', _1328 => _1328("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53398
53445
|
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)));
|
|
53399
53446
|
const segV = num2(segEls[segK], "vertpos");
|
|
53400
53447
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -53402,9 +53449,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53402
53449
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53403
53450
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53404
53451
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53405
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
53452
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1329 => _1329.get, 'call', _1330 => _1330(m0.paraPrId), 'optionalAccess', _1331 => _1331.spaceBefore]), () => ( 0)) : 0;
|
|
53406
53453
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
53407
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53454
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1332 => _1332.getAttribute, 'call', _1333 => _1333("vertOffset")]), () => ( void 0)), 0));
|
|
53408
53455
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53409
53456
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
|
|
53410
53457
|
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));
|
|
@@ -53431,7 +53478,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53431
53478
|
for (const p of elements(root)) {
|
|
53432
53479
|
if (ln(p) !== "p") continue;
|
|
53433
53480
|
const pg = paraSegPages.get(p);
|
|
53434
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53481
|
+
if (!_optionalChain([pg, 'optionalAccess', _1334 => _1334.length])) continue;
|
|
53435
53482
|
const pm = buildPara(p);
|
|
53436
53483
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53437
53484
|
}
|
|
@@ -53448,7 +53495,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53448
53495
|
for (const p of elements(root)) {
|
|
53449
53496
|
if (ln(p) !== "p") continue;
|
|
53450
53497
|
const pg = paraSegPages.get(p);
|
|
53451
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53498
|
+
if (!_optionalChain([pg, 'optionalAccess', _1335 => _1335.includes, 'call', _1336 => _1336(lastContent)])) continue;
|
|
53452
53499
|
const pm = buildPara(p);
|
|
53453
53500
|
pm.segs.forEach((sg, k) => {
|
|
53454
53501
|
if (pg[k] !== lastContent) return;
|
|
@@ -53468,7 +53515,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53468
53515
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53469
53516
|
const ctx = {
|
|
53470
53517
|
...ctxBase,
|
|
53471
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53518
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1337 => _1337.pageCount]), () => ( 0))) }, () => []),
|
|
53472
53519
|
page: 0,
|
|
53473
53520
|
geom,
|
|
53474
53521
|
pageH,
|
|
@@ -53526,7 +53573,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53526
53573
|
ctx.bodyDx = void 0;
|
|
53527
53574
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53528
53575
|
const allPages = new Map(paraSegPages);
|
|
53529
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53576
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1338 => _1338.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53530
53577
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53531
53578
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53532
53579
|
ctx.page = 0;
|
|
@@ -53595,7 +53642,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53595
53642
|
let decl;
|
|
53596
53643
|
const hidden = /* @__PURE__ */ new Set();
|
|
53597
53644
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53598
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
53645
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1339 => _1339.get, 'call', _1340 => _1340(p), 'optionalAccess', _1341 => _1341[0]]), () => ( 0));
|
|
53599
53646
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53600
53647
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53601
53648
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53656,22 +53703,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53656
53703
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53657
53704
|
ctxBase.pageBase += pages.length;
|
|
53658
53705
|
}
|
|
53659
|
-
if (rendered.length === 0) throw new (0,
|
|
53706
|
+
if (rendered.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53660
53707
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53661
53708
|
}
|
|
53662
53709
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53663
53710
|
async function renderHwpxInternal(input, options) {
|
|
53664
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
53711
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1342 => _1342.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53665
53712
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53666
|
-
|
|
53713
|
+
_chunkMI655NV5cjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53667
53714
|
let zip;
|
|
53668
53715
|
try {
|
|
53669
53716
|
zip = await _jszip2.default.loadAsync(input);
|
|
53670
53717
|
} catch (e43) {
|
|
53671
|
-
throw new (0,
|
|
53718
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53672
53719
|
}
|
|
53673
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53674
|
-
if (secFiles.length === 0) throw new (0,
|
|
53720
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkMI655NV5cjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53721
|
+
if (secFiles.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53675
53722
|
const warnings = [];
|
|
53676
53723
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53677
53724
|
const verFile = zip.file("version.xml");
|
|
@@ -53682,14 +53729,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53682
53729
|
const secXmls = [];
|
|
53683
53730
|
for (const f of secFiles) {
|
|
53684
53731
|
const xml = await readZipEntry(f, "text");
|
|
53685
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53732
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53686
53733
|
secXmls.push(xml);
|
|
53687
53734
|
}
|
|
53688
53735
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53689
53736
|
const masterXmls = [];
|
|
53690
53737
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53691
53738
|
const xml = await readZipEntry(file, "text");
|
|
53692
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53739
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMI655NV5cjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53693
53740
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53694
53741
|
if (root && ln(root) === "masterPage") {
|
|
53695
53742
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53717,7 +53764,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53717
53764
|
let href = binmap.get(ref);
|
|
53718
53765
|
if (!href) {
|
|
53719
53766
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
53720
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
53767
|
+
href = _optionalChain([cand, 'optionalAccess', _1343 => _1343.name]);
|
|
53721
53768
|
}
|
|
53722
53769
|
if (!href) continue;
|
|
53723
53770
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -53739,7 +53786,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53739
53786
|
for (let si = 0; si < secXmls.length; si++) {
|
|
53740
53787
|
const secXml = secXmls[si];
|
|
53741
53788
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
53742
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
53789
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1344 => _1344.reflow])) {
|
|
53743
53790
|
noCacheSkipped = true;
|
|
53744
53791
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
53745
53792
|
continue;
|
|
@@ -53756,11 +53803,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
53756
53803
|
}
|
|
53757
53804
|
if (roots.length === 0) {
|
|
53758
53805
|
if (noCacheSkipped) {
|
|
53759
|
-
throw new (0,
|
|
53806
|
+
throw new (0, _chunkMI655NV5cjs.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)");
|
|
53760
53807
|
}
|
|
53761
|
-
throw new (0,
|
|
53808
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
53762
53809
|
}
|
|
53763
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
53810
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1345 => _1345.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1346 => _1346.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1347 => _1347.highlights]) });
|
|
53764
53811
|
}
|
|
53765
53812
|
async function renderHwpxToSvg(input, options) {
|
|
53766
53813
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -53983,7 +54030,7 @@ var FOLD_END = 42124;
|
|
|
53983
54030
|
var FOLD_SHIFT = 983040 - 40960;
|
|
53984
54031
|
function textChar(ch) {
|
|
53985
54032
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
53986
|
-
const mapped =
|
|
54033
|
+
const mapped = _chunkSJ5OZXELcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
53987
54034
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
53988
54035
|
}
|
|
53989
54036
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54075,7 +54122,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54075
54122
|
out += run.join("") + "</hp:run>";
|
|
54076
54123
|
run = [];
|
|
54077
54124
|
};
|
|
54078
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54125
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1348 => _1348[0], 'optionalAccess', _1349 => _1349[1]]), () => ( 0)));
|
|
54079
54126
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54080
54127
|
const switchShape = () => {
|
|
54081
54128
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54161,7 +54208,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54161
54208
|
closeRun();
|
|
54162
54209
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54163
54210
|
if (rest.length > 0) {
|
|
54164
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54211
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1350 => _1350[0], 'optionalAccess', _1351 => _1351[1]]), () => ( 0)));
|
|
54165
54212
|
for (const c of rest) {
|
|
54166
54213
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54167
54214
|
run.push(el);
|
|
@@ -54327,14 +54374,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54327
54374
|
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>";
|
|
54328
54375
|
}
|
|
54329
54376
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54330
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54377
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1352 => _1352.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54331
54378
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54332
54379
|
const images = /* @__PURE__ */ new Map();
|
|
54333
54380
|
let totalImgBytes = 0;
|
|
54334
54381
|
const imageRef = (binDataId) => {
|
|
54335
54382
|
if (binDataId <= 0) return null;
|
|
54336
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54337
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
54383
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1353 => _1353.binData, 'access', _1354 => _1354[binDataId - 1]]);
|
|
54384
|
+
if (_optionalChain([item, 'optionalAccess', _1355 => _1355.kind]) === "link") return null;
|
|
54338
54385
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54339
54386
|
const ref = `bin${storageId}`;
|
|
54340
54387
|
if (images.has(ref)) return ref;
|
|
@@ -54368,8 +54415,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54368
54415
|
}
|
|
54369
54416
|
roots.push({ root, index: si });
|
|
54370
54417
|
}
|
|
54371
|
-
if (roots.length === 0) throw new (0,
|
|
54372
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54418
|
+
if (roots.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54419
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1356 => _1356.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1357 => _1357.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1358 => _1358.highlights]) });
|
|
54373
54420
|
return assemblePageSvgs(r, "hwp", select);
|
|
54374
54421
|
}
|
|
54375
54422
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54381,7 +54428,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54381
54428
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54382
54429
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54383
54430
|
const sections = readHwp5SectionStreams(c);
|
|
54384
|
-
if (sections.length === 0) throw new (0,
|
|
54431
|
+
if (sections.length === 0) throw new (0, _chunkMI655NV5cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54385
54432
|
const parseWarnings = [];
|
|
54386
54433
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54387
54434
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54467,14 +54514,14 @@ async function loadSharp() {
|
|
|
54467
54514
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54468
54515
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54469
54516
|
} catch (e46) {
|
|
54470
|
-
throw new (0,
|
|
54471
|
-
'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.' +
|
|
54517
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(
|
|
54518
|
+
'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.' + _chunkMI655NV5cjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54472
54519
|
);
|
|
54473
54520
|
}
|
|
54474
54521
|
}
|
|
54475
54522
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54476
54523
|
const sharp = await loadSharp();
|
|
54477
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54524
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54478
54525
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54479
54526
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54480
54527
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54492,11 +54539,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54492
54539
|
try {
|
|
54493
54540
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54494
54541
|
} catch (e47) {
|
|
54495
|
-
throw new (0,
|
|
54542
|
+
throw new (0, _chunkMI655NV5cjs.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");
|
|
54496
54543
|
}
|
|
54497
54544
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54498
54545
|
if (!executablePath) {
|
|
54499
|
-
throw new (0,
|
|
54546
|
+
throw new (0, _chunkMI655NV5cjs.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");
|
|
54500
54547
|
}
|
|
54501
54548
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54502
54549
|
try {
|
|
@@ -54512,13 +54559,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54512
54559
|
async function loadBuffer(input) {
|
|
54513
54560
|
if (typeof input === "string") {
|
|
54514
54561
|
try {
|
|
54515
|
-
return
|
|
54562
|
+
return _chunkMI655NV5cjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54516
54563
|
} catch (err) {
|
|
54517
54564
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54518
|
-
throw new (0,
|
|
54565
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54519
54566
|
}
|
|
54520
54567
|
}
|
|
54521
|
-
if (Buffer.isBuffer(input)) return
|
|
54568
|
+
if (Buffer.isBuffer(input)) return _chunkMI655NV5cjs.toArrayBuffer.call(void 0, input);
|
|
54522
54569
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54523
54570
|
return input;
|
|
54524
54571
|
}
|
|
@@ -54527,17 +54574,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54527
54574
|
if (format2 === "hwpx") {
|
|
54528
54575
|
const zip = await detectZipFormat(buffer);
|
|
54529
54576
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54530
|
-
throw new (0,
|
|
54577
|
+
throw new (0, _chunkMI655NV5cjs.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`);
|
|
54531
54578
|
}
|
|
54532
54579
|
if (format2 === "hwp") return "hwp";
|
|
54533
|
-
throw new (0,
|
|
54580
|
+
throw new (0, _chunkMI655NV5cjs.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`);
|
|
54534
54581
|
}
|
|
54535
54582
|
async function renderDocumentToScene(input, options = {}) {
|
|
54536
54583
|
const buffer = await loadBuffer(input);
|
|
54537
54584
|
const source = await sourceFormatOf(buffer);
|
|
54538
54585
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54539
54586
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54540
|
-
if (set.size === 0) throw new (0,
|
|
54587
|
+
if (set.size === 0) throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54541
54588
|
return set;
|
|
54542
54589
|
} : void 0;
|
|
54543
54590
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54573,7 +54620,7 @@ async function renderDocument(input, options) {
|
|
|
54573
54620
|
break;
|
|
54574
54621
|
}
|
|
54575
54622
|
default:
|
|
54576
|
-
throw new (0,
|
|
54623
|
+
throw new (0, _chunkMI655NV5cjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54577
54624
|
}
|
|
54578
54625
|
return { scene, assets };
|
|
54579
54626
|
}
|
|
@@ -54603,7 +54650,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54603
54650
|
const out = [];
|
|
54604
54651
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54605
54652
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54606
|
-
if (!meta) throw new (0,
|
|
54653
|
+
if (!meta) throw new (0, _chunkMI655NV5cjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54607
54654
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54608
54655
|
for (const { region, bbox } of items) {
|
|
54609
54656
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54627,9 +54674,9 @@ function wantsCrop(kind, policy) {
|
|
|
54627
54674
|
}
|
|
54628
54675
|
async function extractTables(input, options = {}) {
|
|
54629
54676
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54630
|
-
const buffer = typeof input === "string" ?
|
|
54677
|
+
const buffer = typeof input === "string" ? _chunkMI655NV5cjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkMI655NV5cjs.toArrayBuffer.call(void 0, input) : input;
|
|
54631
54678
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54632
|
-
if (!parsed.success) throw new (0,
|
|
54679
|
+
if (!parsed.success) throw new (0, _chunkMI655NV5cjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54633
54680
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54634
54681
|
const out = blocks.map((b, i) => ({
|
|
54635
54682
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54687,22 +54734,22 @@ async function extractTables(input, options = {}) {
|
|
|
54687
54734
|
// src/index.ts
|
|
54688
54735
|
async function parse(input, options) {
|
|
54689
54736
|
let buffer;
|
|
54690
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54691
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
54737
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1359 => _1359.filePath]) ? { ...options, filePath: input } : options;
|
|
54738
|
+
if (_optionalChain([opts, 'optionalAccess', _1360 => _1360.htmlTables]) && opts.tableFormat) {
|
|
54692
54739
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54693
54740
|
}
|
|
54694
|
-
const ocrOptionError =
|
|
54741
|
+
const ocrOptionError = _chunkSJ5OZXELcjs.validateOcrOptions.call(void 0, opts);
|
|
54695
54742
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54696
54743
|
if (typeof input === "string") {
|
|
54697
54744
|
try {
|
|
54698
54745
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54699
|
-
buffer =
|
|
54746
|
+
buffer = _chunkMI655NV5cjs.toArrayBuffer.call(void 0, buf);
|
|
54700
54747
|
} catch (err) {
|
|
54701
54748
|
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}`;
|
|
54702
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
54749
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54703
54750
|
}
|
|
54704
54751
|
} else if (Buffer.isBuffer(input)) {
|
|
54705
|
-
buffer =
|
|
54752
|
+
buffer = _chunkMI655NV5cjs.toArrayBuffer.call(void 0, input);
|
|
54706
54753
|
} else {
|
|
54707
54754
|
buffer = input;
|
|
54708
54755
|
}
|
|
@@ -54711,23 +54758,23 @@ async function parse(input, options) {
|
|
|
54711
54758
|
}
|
|
54712
54759
|
const format2 = detectFormat(buffer);
|
|
54713
54760
|
const result = await dispatch(format2, buffer, opts);
|
|
54714
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54761
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1361 => _1361.images]) === false) {
|
|
54715
54762
|
delete result.images;
|
|
54716
54763
|
dropImageBytes(result.blocks);
|
|
54717
54764
|
}
|
|
54718
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54765
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1362 => _1362.classifyTables])) classifyTableTree(result.blocks);
|
|
54719
54766
|
let out = result;
|
|
54720
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54767
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1363 => _1363.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
54721
54768
|
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` }] };
|
|
54722
54769
|
}
|
|
54723
54770
|
if (out.success && !out.pages) {
|
|
54724
|
-
const pages =
|
|
54771
|
+
const pages = _chunk2BCQVQO2cjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1364 => _1364.tableFormat]) }));
|
|
54725
54772
|
if (pages) out = { ...out, pages };
|
|
54726
54773
|
}
|
|
54727
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54774
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1365 => _1365.plain])) {
|
|
54728
54775
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
54729
54776
|
}
|
|
54730
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54777
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1366 => _1366.htmlTables])) {
|
|
54731
54778
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
54732
54779
|
}
|
|
54733
54780
|
return out;
|
|
@@ -54772,42 +54819,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54772
54819
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54773
54820
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54774
54821
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54775
|
-
let md2 =
|
|
54776
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
54822
|
+
let md2 = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1367 => _1367.tableFormat]) });
|
|
54823
|
+
if (_optionalChain([options, 'optionalAccess', _1368 => _1368.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1369 => _1369.length])) {
|
|
54777
54824
|
try {
|
|
54778
|
-
md2 =
|
|
54825
|
+
md2 = _chunk2BCQVQO2cjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54779
54826
|
} catch (e48) {
|
|
54780
54827
|
}
|
|
54781
54828
|
}
|
|
54782
54829
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54783
54830
|
}
|
|
54784
54831
|
function scriptsOff(r, off) {
|
|
54785
|
-
return off ?
|
|
54832
|
+
return off ? _chunkSJ5OZXELcjs.stripScriptTags.call(void 0, r) : r;
|
|
54786
54833
|
}
|
|
54787
54834
|
async function parseImage(buffer, options) {
|
|
54788
54835
|
try {
|
|
54789
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
54836
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-BELHEWPX.cjs")));
|
|
54790
54837
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54791
|
-
|
|
54838
|
+
_chunkSJ5OZXELcjs.stripScriptTags.call(void 0, { blocks });
|
|
54792
54839
|
return {
|
|
54793
54840
|
success: true,
|
|
54794
54841
|
fileType: "image",
|
|
54795
|
-
markdown:
|
|
54842
|
+
markdown: _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1370 => _1370.tableFormat]) }),
|
|
54796
54843
|
blocks,
|
|
54797
54844
|
warnings: warnings.length ? warnings : void 0,
|
|
54798
54845
|
pageCount: 1,
|
|
54799
|
-
..._optionalChain([options, 'optionalAccess',
|
|
54846
|
+
..._optionalChain([options, 'optionalAccess', _1371 => _1371.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
54800
54847
|
};
|
|
54801
54848
|
} catch (err) {
|
|
54802
|
-
return { success: false, fileType: "image", error:
|
|
54849
|
+
return { success: false, fileType: "image", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54803
54850
|
}
|
|
54804
54851
|
}
|
|
54805
54852
|
async function parseHwp3(buffer, options) {
|
|
54806
54853
|
try {
|
|
54807
54854
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
54808
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54855
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1372 => _1372.pageCount]) };
|
|
54809
54856
|
} catch (err) {
|
|
54810
|
-
return { success: false, fileType: "hwp3", error:
|
|
54857
|
+
return { success: false, fileType: "hwp3", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54811
54858
|
}
|
|
54812
54859
|
}
|
|
54813
54860
|
async function parseHwpx(buffer, options) {
|
|
@@ -54815,15 +54862,15 @@ async function parseHwpx(buffer, options) {
|
|
|
54815
54862
|
const doc = await parseHwpxDocument(buffer, options);
|
|
54816
54863
|
const { blocks, metadata, outline, images } = doc;
|
|
54817
54864
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
54818
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54865
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1373 => _1373.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1374 => _1374.pageCount]) }, _optionalChain([options, 'optionalAccess', _1375 => _1375.scriptTags]) === false);
|
|
54819
54866
|
} catch (err) {
|
|
54820
|
-
return { success: false, fileType: "hwpx", error:
|
|
54867
|
+
return { success: false, fileType: "hwpx", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54821
54868
|
}
|
|
54822
54869
|
}
|
|
54823
54870
|
async function parseHwp(buffer, options) {
|
|
54824
54871
|
try {
|
|
54825
54872
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
54826
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
54873
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1376 => _1376.filePath])) {
|
|
54827
54874
|
try {
|
|
54828
54875
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
54829
54876
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -54842,15 +54889,15 @@ async function parseHwp(buffer, options) {
|
|
|
54842
54889
|
}
|
|
54843
54890
|
}
|
|
54844
54891
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
54845
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54892
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1377 => _1377.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1378 => _1378.pageCount]) }, _optionalChain([options, 'optionalAccess', _1379 => _1379.scriptTags]) === false);
|
|
54846
54893
|
} catch (err) {
|
|
54847
|
-
return { success: false, fileType: "hwp", error:
|
|
54894
|
+
return { success: false, fileType: "hwp", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54848
54895
|
}
|
|
54849
54896
|
}
|
|
54850
54897
|
async function parsePdf(buffer, options) {
|
|
54851
54898
|
let parsePdfDocument;
|
|
54852
54899
|
try {
|
|
54853
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
54900
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-OAXCXVQ4.cjs")));
|
|
54854
54901
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54855
54902
|
} catch (e50) {
|
|
54856
54903
|
return {
|
|
@@ -54862,59 +54909,59 @@ async function parsePdf(buffer, options) {
|
|
|
54862
54909
|
}
|
|
54863
54910
|
try {
|
|
54864
54911
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
54865
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54912
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1380 => _1380.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1381 => _1381.scriptTags]) !== true);
|
|
54866
54913
|
} catch (err) {
|
|
54867
54914
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
54868
|
-
return { success: false, fileType: "pdf", error:
|
|
54915
|
+
return { success: false, fileType: "pdf", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err), isImageBased };
|
|
54869
54916
|
}
|
|
54870
54917
|
}
|
|
54871
54918
|
async function parseXlsx(buffer, options) {
|
|
54872
54919
|
try {
|
|
54873
54920
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
54874
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54921
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1382 => _1382.pageCount]) };
|
|
54875
54922
|
} catch (err) {
|
|
54876
|
-
return { success: false, fileType: "xlsx", error:
|
|
54923
|
+
return { success: false, fileType: "xlsx", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54877
54924
|
}
|
|
54878
54925
|
}
|
|
54879
54926
|
async function parseXls(buffer, options) {
|
|
54880
54927
|
try {
|
|
54881
54928
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
54882
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54929
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1383 => _1383.pageCount]) };
|
|
54883
54930
|
} catch (err) {
|
|
54884
|
-
return { success: false, fileType: "xls", error:
|
|
54931
|
+
return { success: false, fileType: "xls", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54885
54932
|
}
|
|
54886
54933
|
}
|
|
54887
54934
|
async function parseDocx(buffer, options) {
|
|
54888
54935
|
try {
|
|
54889
54936
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
54890
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54937
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1384 => _1384.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1385 => _1385.pageCount]) }, _optionalChain([options, 'optionalAccess', _1386 => _1386.scriptTags]) === false);
|
|
54891
54938
|
} catch (err) {
|
|
54892
|
-
return { success: false, fileType: "docx", error:
|
|
54939
|
+
return { success: false, fileType: "docx", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54893
54940
|
}
|
|
54894
54941
|
}
|
|
54895
54942
|
async function parsePptx(buffer, options) {
|
|
54896
54943
|
try {
|
|
54897
54944
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
54898
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54945
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1387 => _1387.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1388 => _1388.pageCount]) }, _optionalChain([options, 'optionalAccess', _1389 => _1389.scriptTags]) === false);
|
|
54899
54946
|
} catch (err) {
|
|
54900
|
-
return { success: false, fileType: "pptx", error:
|
|
54947
|
+
return { success: false, fileType: "pptx", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54901
54948
|
}
|
|
54902
54949
|
}
|
|
54903
54950
|
async function parseHwpml(buffer, options) {
|
|
54904
54951
|
try {
|
|
54905
54952
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
54906
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54953
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1390 => _1390.pageCount]) };
|
|
54907
54954
|
} catch (err) {
|
|
54908
|
-
return { success: false, fileType: "hwpml", error:
|
|
54955
|
+
return { success: false, fileType: "hwpml", error: _chunkMI655NV5cjs.sanitizeError.call(void 0, err), code: _chunkMI655NV5cjs.classifyError.call(void 0, err) };
|
|
54909
54956
|
}
|
|
54910
54957
|
}
|
|
54911
54958
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
54912
54959
|
let buffer;
|
|
54913
54960
|
if (typeof input === "string") {
|
|
54914
54961
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54915
|
-
buffer =
|
|
54962
|
+
buffer = _chunkMI655NV5cjs.toArrayBuffer.call(void 0, buf);
|
|
54916
54963
|
} else if (Buffer.isBuffer(input)) {
|
|
54917
|
-
buffer =
|
|
54964
|
+
buffer = _chunkMI655NV5cjs.toArrayBuffer.call(void 0, input);
|
|
54918
54965
|
} else {
|
|
54919
54966
|
buffer = input;
|
|
54920
54967
|
}
|
|
@@ -54940,7 +54987,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
54940
54987
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54941
54988
|
}
|
|
54942
54989
|
const fill = fillFormFields(parsed.blocks, values);
|
|
54943
|
-
const markdown =
|
|
54990
|
+
const markdown = _chunkSJ5OZXELcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
54944
54991
|
if (outputFormat === "hwpx") {
|
|
54945
54992
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
54946
54993
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55039,5 +55086,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55039
55086
|
|
|
55040
55087
|
|
|
55041
55088
|
|
|
55042
|
-
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 =
|
|
55089
|
+
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 = _chunkMI655NV5cjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkSJ5OZXELcjs.blocksToMarkdown; exports.blocksToPages = _chunk2BCQVQO2cjs.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 = _chunkSJ5OZXELcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkSJ5OZXELcjs.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;
|
|
55043
55090
|
//# sourceMappingURL=index.cjs.map
|