kordoc 4.22.2 → 4.22.4
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 +11 -6
- package/dist/{-C437ZARA.js → -HAK3YFWW.js} +11 -11
- package/dist/{chunk-UV2G6XFA.js → chunk-36DK6AOX.js} +2 -2
- package/dist/{chunk-CNMUT5YW.js → chunk-3TUJ34V7.js} +2 -2
- package/dist/{chunk-I4BS4BXE.cjs → chunk-4X7AR4EH.cjs} +34 -28
- package/dist/chunk-4X7AR4EH.cjs.map +1 -0
- package/dist/{chunk-4BJZGXNM.js → chunk-5ARHF54C.js} +2 -2
- package/dist/{chunk-56GBOIOE.js → chunk-A3SKXHAN.js} +2 -2
- package/dist/{chunk-GVBQVXXB.js → chunk-AYV5VRHL.js} +14 -4
- package/dist/chunk-AYV5VRHL.js.map +1 -0
- package/dist/{chunk-3LJ6QO53.js → chunk-C5J5LDWM.js} +14 -8
- package/dist/{chunk-3LJ6QO53.js.map → chunk-C5J5LDWM.js.map} +1 -1
- package/dist/{chunk-IRP6QS3K.js → chunk-CWBH66IQ.js} +3 -3
- package/dist/{chunk-YTEMFVZB.js → chunk-DEFT7Z3B.js} +2 -2
- package/dist/{chunk-L6N4OMKR.js → chunk-EVL6HZQL.js} +128 -70
- package/dist/chunk-EVL6HZQL.js.map +1 -0
- package/dist/{chunk-ZLFUZM7H.cjs → chunk-EYQLJ57Y.cjs} +3 -3
- package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
- package/dist/{chunk-GFQIKYBV.js → chunk-F3AWNFMO.js} +3 -3
- package/dist/{chunk-S4KQUVBV.js → chunk-FAFSBCU2.js} +4 -4
- package/dist/{chunk-AXR7OKQY.js → chunk-G2325K2F.js} +2 -2
- package/dist/{chunk-FPUBEM3F.js → chunk-G4KNI7EO.js} +11 -11
- package/dist/{chunk-NGDMJICC.js → chunk-HN3QMHTT.js} +15 -9
- package/dist/{chunk-NGDMJICC.js.map → chunk-HN3QMHTT.js.map} +1 -1
- package/dist/{chunk-MED2MR6O.cjs → chunk-K2NWHLCD.cjs} +23 -13
- package/dist/chunk-K2NWHLCD.cjs.map +1 -0
- package/dist/{chunk-UMNKY2EZ.js → chunk-LVVSMYG4.js} +4 -4
- package/dist/{chunk-AUWO57ED.cjs → chunk-MJSHXESK.cjs} +2 -2
- package/dist/{chunk-AUWO57ED.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
- package/dist/{chunk-L6PFPBTK.js → chunk-MYTMZSQO.js} +2 -2
- package/dist/{chunk-DQXP3ELP.js → chunk-Q65HT2BL.js} +2 -2
- package/dist/{chunk-U3TZVR7A.js → chunk-Q6SVCBMK.js} +2 -2
- package/dist/{chunk-2X64TI7I.js → chunk-RPSILMQY.js} +2 -2
- package/dist/{chunk-ENV25MPM.cjs → chunk-S45M7IQH.cjs} +24 -24
- package/dist/{chunk-ENV25MPM.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
- package/dist/{chunk-4GCS7WJJ.js → chunk-SSL3TKJY.js} +2 -2
- package/dist/{chunk-QFJCEHY7.js → chunk-UJVVL6BI.js} +14 -4
- package/dist/chunk-UJVVL6BI.js.map +1 -0
- package/dist/{chunk-EKKZNKJD.cjs → chunk-VXQWAPC6.cjs} +3 -3
- package/dist/{chunk-EKKZNKJD.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
- package/dist/{chunk-VUC4JJUM.js → chunk-WCTC3LSV.js} +2 -2
- package/dist/{chunk-YOFKJ7IM.js → chunk-WNW77CAY.js} +2 -2
- package/dist/chunks-3N7OFSA4.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-3TVRNJ66.cjs → formula-JGFYGFYX.cjs} +9 -9
- package/dist/{formula-3TVRNJ66.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
- package/dist/{formula-HUENRCPJ.js → formula-KSTY73DQ.js} +3 -3
- package/dist/{formula-43QBPAL5.js → formula-PWAUR5PF.js} +4 -4
- package/dist/{image-ocr-BAHDLDV5.js → image-ocr-RASJHOAK.js} +6 -6
- package/dist/{image-ocr-HYAKWJGE.js → image-ocr-RPBPO3VT.js} +9 -9
- package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
- package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
- package/dist/index.cjs +536 -478
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +128 -70
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-23WBSECG.js → model-bundle-ZPQ4IFT7.js} +5 -5
- package/dist/{models-NRZQY45P.js → models-YJQ5VHOR.js} +5 -5
- package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-7PNZYASF.js} +12 -12
- package/dist/{parser-XNOLC3MZ.js → parser-DR6ZHYEB.js} +121 -12
- package/dist/parser-DR6ZHYEB.js.map +1 -0
- package/dist/{parser-FNUQW2F3.js → parser-ER3VLB37.js} +124 -15
- package/dist/parser-ER3VLB37.js.map +1 -0
- package/dist/{parser-OKAQRZKM.cjs → parser-ZFXVZZKQ.cjs} +376 -267
- package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
- package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-BYT7XVID.js} +6 -6
- package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-DRQN5BXA.js} +9 -9
- package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
- package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
- package/dist/{profile-io-HC6FMYX4.js → profile-io-3QYTSPNH.js} +3 -3
- package/dist/{rasterize-QLTROEV2.js → rasterize-LPLWCBXV.js} +3 -3
- package/dist/{redact-doc-V4KMM2QV.js → redact-doc-HDA6ZG3N.js} +11 -11
- package/dist/{render-V4S3QLTR.js → render-MYZGD3SB.js} +7 -7
- package/dist/seal-XA5V6A6V.js +10 -0
- package/dist/{setup-HU7ZOQNM.js → setup-EF5TQVAI.js} +3 -3
- package/dist/visual-DB7NJOID.js +21 -0
- package/dist/{watch-NPIZ6DSJ.js → watch-PM5PRSFW.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GVBQVXXB.js.map +0 -1
- package/dist/chunk-I4BS4BXE.cjs.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 → -HAK3YFWW.js.map} +0 -0
- /package/dist/{chunk-UV2G6XFA.js.map → chunk-36DK6AOX.js.map} +0 -0
- /package/dist/{chunk-CNMUT5YW.js.map → chunk-3TUJ34V7.js.map} +0 -0
- /package/dist/{chunk-4BJZGXNM.js.map → chunk-5ARHF54C.js.map} +0 -0
- /package/dist/{chunk-56GBOIOE.js.map → chunk-A3SKXHAN.js.map} +0 -0
- /package/dist/{chunk-IRP6QS3K.js.map → chunk-CWBH66IQ.js.map} +0 -0
- /package/dist/{chunk-YTEMFVZB.js.map → chunk-DEFT7Z3B.js.map} +0 -0
- /package/dist/{chunk-GFQIKYBV.js.map → chunk-F3AWNFMO.js.map} +0 -0
- /package/dist/{chunk-S4KQUVBV.js.map → chunk-FAFSBCU2.js.map} +0 -0
- /package/dist/{chunk-AXR7OKQY.js.map → chunk-G2325K2F.js.map} +0 -0
- /package/dist/{chunk-FPUBEM3F.js.map → chunk-G4KNI7EO.js.map} +0 -0
- /package/dist/{chunk-UMNKY2EZ.js.map → chunk-LVVSMYG4.js.map} +0 -0
- /package/dist/{chunk-L6PFPBTK.js.map → chunk-MYTMZSQO.js.map} +0 -0
- /package/dist/{chunk-DQXP3ELP.js.map → chunk-Q65HT2BL.js.map} +0 -0
- /package/dist/{chunk-U3TZVR7A.js.map → chunk-Q6SVCBMK.js.map} +0 -0
- /package/dist/{chunk-2X64TI7I.js.map → chunk-RPSILMQY.js.map} +0 -0
- /package/dist/{chunk-4GCS7WJJ.js.map → chunk-SSL3TKJY.js.map} +0 -0
- /package/dist/{chunk-VUC4JJUM.js.map → chunk-WCTC3LSV.js.map} +0 -0
- /package/dist/{chunk-YOFKJ7IM.js.map → chunk-WNW77CAY.js.map} +0 -0
- /package/dist/{chunks-MPOOHZVO.js.map → chunks-3N7OFSA4.js.map} +0 -0
- /package/dist/{formula-HUENRCPJ.js.map → formula-KSTY73DQ.js.map} +0 -0
- /package/dist/{formula-43QBPAL5.js.map → formula-PWAUR5PF.js.map} +0 -0
- /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-RASJHOAK.js.map} +0 -0
- /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
- /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
- /package/dist/{models-NRZQY45P.js.map → models-YJQ5VHOR.js.map} +0 -0
- /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
- /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
- /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
- /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-3QYTSPNH.js.map} +0 -0
- /package/dist/{rasterize-QLTROEV2.js.map → rasterize-LPLWCBXV.js.map} +0 -0
- /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
- /package/dist/{render-V4S3QLTR.js.map → render-MYZGD3SB.js.map} +0 -0
- /package/dist/{seal-MQ5TB5YZ.js.map → seal-XA5V6A6V.js.map} +0 -0
- /package/dist/{setup-HU7ZOQNM.js.map → setup-EF5TQVAI.js.map} +0 -0
- /package/dist/{visual-RLIFC4XC.js.map → visual-DB7NJOID.js.map} +0 -0
- /package/dist/{watch-NPIZ6DSJ.js.map → watch-PM5PRSFW.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkVXQWAPC6cjs = require('./chunk-VXQWAPC6.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 _chunkK2NWHLCDcjs = require('./chunk-K2NWHLCD.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 _chunkMJSHXESKcjs = require('./chunk-MJSHXESK.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 _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
600
600
|
var MAX_ZIP_ENTRIES = 500;
|
|
601
|
-
var ZipBombError = class extends
|
|
601
|
+
var ZipBombError = class extends _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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 >= _chunkK2NWHLCDcjs.HEADING_RATIO_H1) level = 1;
|
|
1025
|
+
else if (ratio >= _chunkK2NWHLCDcjs.HEADING_RATIO_H2) level = 2;
|
|
1026
|
+
else if (ratio >= _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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)) _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 += _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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(_chunkMJSHXESKcjs.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, _chunkK2NWHLCDcjs.MAX_COLS);
|
|
2243
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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 += _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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) + _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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 (_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 _chunkMJSHXESKcjs.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) || _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 _chunkMJSHXESKcjs.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 (_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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(_chunkMJSHXESKcjs.compareSectionPaths);
|
|
3860
3860
|
}
|
|
3861
3861
|
function parseSectionPathsFromManifest(xml) {
|
|
3862
3862
|
const parser = createXmlParser();
|
|
3863
|
-
const doc = parser.parseFromString(
|
|
3863
|
+
const doc = parser.parseFromString(_chunkMJSHXESKcjs.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 = _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 : _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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, _chunkK2NWHLCDcjs.MAX_ROWS));
|
|
5382
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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) _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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)) _chunkK2NWHLCDcjs.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), _chunkK2NWHLCDcjs.MAX_ROWS);
|
|
5839
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkK2NWHLCDcjs.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, _chunkK2NWHLCDcjs.MAX_ROWS);
|
|
5884
5884
|
cols = 1;
|
|
5885
5885
|
}
|
|
5886
5886
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5887
|
-
const table2 =
|
|
5887
|
+
const table2 = _chunkK2NWHLCDcjs.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, _chunkK2NWHLCDcjs.MAX_COLS);
|
|
5907
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6070
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6197
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkVXQWAPC6cjs.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 >= _chunkK2NWHLCDcjs.HEADING_RATIO_H1) level = 1;
|
|
6276
|
+
else if (ratio >= _chunkK2NWHLCDcjs.HEADING_RATIO_H2) level = 2;
|
|
6277
|
+
else if (ratio >= _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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), _chunkK2NWHLCDcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkK2NWHLCDcjs.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), _chunkK2NWHLCDcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkVXQWAPC6cjs.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 += _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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(_chunkK2NWHLCDcjs.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 ${_chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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 += _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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: _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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: _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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: _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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: _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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(_chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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 += _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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(_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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 += _chunkK2NWHLCDcjs.wrapScript.call(void 0, _chunkK2NWHLCDcjs.escapeLiteralTags.call(void 0, _chunkK2NWHLCDcjs.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 _chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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 = _chunkMJSHXESKcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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: _chunkK2NWHLCDcjs.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, _chunkMJSHXESKcjs.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 = _chunkMJSHXESKcjs.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 = _chunkK2NWHLCDcjs.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(_chunkK2NWHLCDcjs.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 = _chunkK2NWHLCDcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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
|
+
_chunkMJSHXESKcjs.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, _chunkMJSHXESKcjs.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-UULNAC5Y.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 _chunkVXQWAPC6cjs.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) || _chunkK2NWHLCDcjs.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
|
}
|
|
@@ -27968,6 +27968,8 @@ var FACE_SPACE = {
|
|
|
27968
27968
|
"KoPubWorld\uB3CB\uC6C0\uCCB4 Light": 290
|
|
27969
27969
|
};
|
|
27970
27970
|
var BEFORE_2024_WIDTH = {
|
|
27971
|
+
// TTF 신명조의 대체 큰따옴표 — 원본 PDF의 Haansoft Batang /W 370. 한양신명조 HFT와 별개다.
|
|
27972
|
+
"\uC2E0\uBA85\uC870": { 8220: 370, 8221: 370 },
|
|
27971
27973
|
"\uD734\uBA3C\uBA85\uC870": {
|
|
27972
27974
|
183: 1e3,
|
|
27973
27975
|
8211: 430,
|
|
@@ -35848,7 +35850,7 @@ function findAgency(name) {
|
|
|
35848
35850
|
}
|
|
35849
35851
|
function agencyStyle(name) {
|
|
35850
35852
|
const s = findAgency(name);
|
|
35851
|
-
if (!s) throw new (0,
|
|
35853
|
+
if (!s) throw new (0, _chunkMJSHXESKcjs.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
35854
|
return s;
|
|
35853
35855
|
}
|
|
35854
35856
|
function applyAgency(opts, preset) {
|
|
@@ -36912,7 +36914,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36912
36914
|
}
|
|
36913
36915
|
function assertFiniteRange(name, value, min, max) {
|
|
36914
36916
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36915
|
-
throw new (0,
|
|
36917
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36916
36918
|
}
|
|
36917
36919
|
}
|
|
36918
36920
|
function validateGongmunOptions(opts) {
|
|
@@ -36930,10 +36932,10 @@ function validateGongmunOptions(opts) {
|
|
|
36930
36932
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36931
36933
|
}
|
|
36932
36934
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36933
|
-
throw new (0,
|
|
36935
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36934
36936
|
}
|
|
36935
36937
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36936
|
-
throw new (0,
|
|
36938
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36937
36939
|
}
|
|
36938
36940
|
}
|
|
36939
36941
|
if (opts.sizes) {
|
|
@@ -36942,24 +36944,24 @@ function validateGongmunOptions(opts) {
|
|
|
36942
36944
|
}
|
|
36943
36945
|
}
|
|
36944
36946
|
if (opts.approval && opts.approval.length > 6) {
|
|
36945
|
-
throw new (0,
|
|
36947
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)("approval must contain at most 6 labels");
|
|
36946
36948
|
}
|
|
36947
36949
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
36948
36950
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
36949
36951
|
for (const n of nums) {
|
|
36950
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
36952
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkMJSHXESKcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
36951
36953
|
}
|
|
36952
36954
|
}
|
|
36953
36955
|
if (opts.levels) {
|
|
36954
36956
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
36955
36957
|
const depth = Number(key);
|
|
36956
36958
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
36957
|
-
throw new (0,
|
|
36959
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
36958
36960
|
}
|
|
36959
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
36961
|
+
if (!st || typeof st !== "object") throw new (0, _chunkMJSHXESKcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
36960
36962
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
36961
36963
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
36962
|
-
throw new (0,
|
|
36964
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
36963
36965
|
}
|
|
36964
36966
|
}
|
|
36965
36967
|
}
|
|
@@ -37017,7 +37019,7 @@ function resolveChecklist(c, preset) {
|
|
|
37017
37019
|
function hexColorOption(name, value) {
|
|
37018
37020
|
if (value === void 0) return void 0;
|
|
37019
37021
|
const v = value.trim();
|
|
37020
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
37022
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkMJSHXESKcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37021
37023
|
return v.toUpperCase();
|
|
37022
37024
|
}
|
|
37023
37025
|
function resolveGongmun(input) {
|
|
@@ -37761,7 +37763,7 @@ function parseInlineMarkdown(text) {
|
|
|
37761
37763
|
else spans.push(...emphasisSpans(m[0]));
|
|
37762
37764
|
} else {
|
|
37763
37765
|
const anchor = m[2] || m[3];
|
|
37764
|
-
const href = _nullishCoalesce(
|
|
37766
|
+
const href = _nullishCoalesce(_chunkMJSHXESKcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37765
37767
|
const sub = emphasisSpans(anchor);
|
|
37766
37768
|
if (href) for (const s of sub) s.href = href;
|
|
37767
37769
|
spans.push(...sub);
|
|
@@ -37982,7 +37984,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
37982
37984
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
37983
37985
|
const got = m ? Number(m[1]) : NaN;
|
|
37984
37986
|
if (got !== startId + i) {
|
|
37985
|
-
throw new (0,
|
|
37987
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
37986
37988
|
`\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
37989
|
);
|
|
37988
37990
|
}
|
|
@@ -38073,7 +38075,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38073
38075
|
}
|
|
38074
38076
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38075
38077
|
if (rows.length !== expectedBase) {
|
|
38076
|
-
throw new (0,
|
|
38078
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
38077
38079
|
`\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
38080
|
);
|
|
38079
38081
|
}
|
|
@@ -39082,7 +39084,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39082
39084
|
return best;
|
|
39083
39085
|
}
|
|
39084
39086
|
function normForMatch(text) {
|
|
39085
|
-
return
|
|
39087
|
+
return _chunkK2NWHLCDcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39086
39088
|
}
|
|
39087
39089
|
function unescapeGfm(text) {
|
|
39088
39090
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39104,7 +39106,7 @@ function replicateGfmTable(table2) {
|
|
|
39104
39106
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39105
39107
|
if (!cell2) continue;
|
|
39106
39108
|
display[r][c] = {
|
|
39107
|
-
text:
|
|
39109
|
+
text: _chunkK2NWHLCDcjs.escapeGfm.call(void 0, _chunkK2NWHLCDcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39108
39110
|
gridR: r,
|
|
39109
39111
|
gridC: c
|
|
39110
39112
|
};
|
|
@@ -39144,16 +39146,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39144
39146
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39145
39147
|
return cell2.blocks.map((b) => {
|
|
39146
39148
|
if (b.type === "table" && b.table) {
|
|
39147
|
-
const cap = b.table.caption ?
|
|
39148
|
-
return (cap ?
|
|
39149
|
+
const cap = b.table.caption ? _chunkK2NWHLCDcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39150
|
+
return (cap ? _chunkK2NWHLCDcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39149
39151
|
}
|
|
39150
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39151
|
-
const note =
|
|
39152
|
-
const t = (
|
|
39153
|
-
return ((t ?
|
|
39152
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkMJSHXESKcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39153
|
+
const note = _chunkK2NWHLCDcjs.noteTableHtml.call(void 0, b);
|
|
39154
|
+
const t = (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, _chunkK2NWHLCDcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkK2NWHLCDcjs.noteSuffix.call(void 0, b))).trim();
|
|
39155
|
+
return ((t ? _chunkK2NWHLCDcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39154
39156
|
}).filter(Boolean).join("<br>");
|
|
39155
39157
|
}
|
|
39156
|
-
return
|
|
39158
|
+
return _chunkK2NWHLCDcjs.escapeHtmlCellText.call(void 0, _chunkK2NWHLCDcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39157
39159
|
}
|
|
39158
39160
|
function replicateTableToHtml(table2) {
|
|
39159
39161
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39230,7 +39232,7 @@ function parseHtmlTable(raw) {
|
|
|
39230
39232
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39231
39233
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39232
39234
|
cellStart = m.index + m[0].length;
|
|
39233
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39235
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkK2NWHLCDcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkK2NWHLCDcjs.MAX_ROWS) };
|
|
39234
39236
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39235
39237
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39236
39238
|
cellStart = -1;
|
|
@@ -39255,11 +39257,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39255
39257
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39256
39258
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39257
39259
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39258
|
-
if (src) imgSrcs.push(
|
|
39260
|
+
if (src) imgSrcs.push(_chunkMJSHXESKcjs.unescapeHtml.call(void 0, src));
|
|
39259
39261
|
return "";
|
|
39260
39262
|
});
|
|
39261
39263
|
}
|
|
39262
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39264
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkMJSHXESKcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39263
39265
|
return { lines, hadNonText, imgSrcs };
|
|
39264
39266
|
}
|
|
39265
39267
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40075,8 +40077,8 @@ function layoutHtmlRows(rows) {
|
|
|
40075
40077
|
let c = 0;
|
|
40076
40078
|
for (const cell2 of rows[r].cells) {
|
|
40077
40079
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40078
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40079
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40080
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkK2NWHLCDcjs.MAX_COLS);
|
|
40081
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkK2NWHLCDcjs.MAX_ROWS);
|
|
40080
40082
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40081
40083
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40082
40084
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -42411,7 +42413,7 @@ function builtinTemplateDir() {
|
|
|
42411
42413
|
for (const c of candidates) {
|
|
42412
42414
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42413
42415
|
}
|
|
42414
|
-
throw new (0,
|
|
42416
|
+
throw new (0, _chunkMJSHXESKcjs.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
42417
|
}
|
|
42416
42418
|
function readBuiltinTemplate(t) {
|
|
42417
42419
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42887,12 +42889,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42887
42889
|
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
42890
|
}
|
|
42889
42891
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42890
|
-
if (ops.length === 0) throw new (0,
|
|
42892
|
+
if (ops.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42891
42893
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42892
|
-
|
|
42894
|
+
_chunkMJSHXESKcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42893
42895
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42894
42896
|
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,
|
|
42897
|
+
if (sectionPaths.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42896
42898
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42897
42899
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42898
42900
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42933,11 +42935,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42933
42935
|
const manifestItems = [];
|
|
42934
42936
|
const placed = [];
|
|
42935
42937
|
for (const op of ops) {
|
|
42936
|
-
if (!op.anchor) throw new (0,
|
|
42937
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42938
|
+
if (!op.anchor) throw new (0, _chunkMJSHXESKcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42939
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42938
42940
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42939
|
-
if (!MIME[ext]) throw new (0,
|
|
42940
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42941
|
+
if (!MIME[ext]) throw new (0, _chunkMJSHXESKcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42942
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkMJSHXESKcjs.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
42943
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42942
42944
|
let found = null;
|
|
42943
42945
|
let total = 0;
|
|
@@ -42970,7 +42972,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42970
42972
|
}
|
|
42971
42973
|
}
|
|
42972
42974
|
}
|
|
42973
|
-
throw new (0,
|
|
42975
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
42974
42976
|
`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
42977
|
);
|
|
42976
42978
|
}
|
|
@@ -42978,7 +42980,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42978
42980
|
const xml = sectionXmls[si];
|
|
42979
42981
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
42980
42982
|
if (!run) {
|
|
42981
|
-
throw new (0,
|
|
42983
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
42982
42984
|
}
|
|
42983
42985
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _862 => _862.charPr, 'access', _863 => _863.get, 'call', _864 => _864(run.charPr), 'optionalAccess', _865 => _865.height]), () => ( 1e3));
|
|
42984
42986
|
const fontPt = charPrHeight / 100;
|
|
@@ -43256,7 +43258,7 @@ function pick(map, keys) {
|
|
|
43256
43258
|
return out;
|
|
43257
43259
|
}
|
|
43258
43260
|
async function hwpxToProfile(input) {
|
|
43259
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43261
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, input);
|
|
43260
43262
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43261
43263
|
const parser = createXmlParser();
|
|
43262
43264
|
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 +44231,7 @@ function patchTableRows(input) {
|
|
|
44229
44231
|
const cells = input.editedCells(ins.ei);
|
|
44230
44232
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44231
44233
|
for (const cell2 of cells) {
|
|
44232
|
-
const unstable = cell2.lines.find((l) =>
|
|
44234
|
+
const unstable = cell2.lines.find((l) => _chunkK2NWHLCDcjs.sanitizeText.call(void 0, l) !== l);
|
|
44233
44235
|
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
44236
|
}
|
|
44235
44237
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44424,14 +44426,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44424
44426
|
}
|
|
44425
44427
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44426
44428
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44427
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44429
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkK2NWHLCDcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44428
44430
|
const splices = [];
|
|
44429
44431
|
let offset = 0;
|
|
44430
44432
|
for (let i = 0; i < lines.length; i++) {
|
|
44431
44433
|
const line = lines[i];
|
|
44432
44434
|
const orig = line.trim();
|
|
44433
44435
|
const next = newLines[i];
|
|
44434
|
-
if (
|
|
44436
|
+
if (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44435
44437
|
let prefix = 0;
|
|
44436
44438
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44437
44439
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44831,12 +44833,12 @@ function stripCellTokens(text) {
|
|
|
44831
44833
|
}
|
|
44832
44834
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44833
44835
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44834
|
-
const content =
|
|
44836
|
+
const content = _chunkK2NWHLCDcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44835
44837
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44836
44838
|
const t = line.trim();
|
|
44837
44839
|
if (!t) return "";
|
|
44838
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44839
|
-
return
|
|
44840
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkK2NWHLCDcjs.escapeGfm.call(void 0, t)}**`;
|
|
44841
|
+
return _chunkK2NWHLCDcjs.escapeGfm.call(void 0, t);
|
|
44840
44842
|
}).filter(Boolean);
|
|
44841
44843
|
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
44844
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44850,7 +44852,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44850
44852
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44851
44853
|
const replica = [];
|
|
44852
44854
|
for (let r = 0; r < table2.rows; r++) {
|
|
44853
|
-
const line =
|
|
44855
|
+
const line = _chunkK2NWHLCDcjs.escapeGfm.call(void 0, _chunkK2NWHLCDcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44854
44856
|
if (line) replica.push({ line, gridR: r });
|
|
44855
44857
|
}
|
|
44856
44858
|
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 +44906,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44904
44906
|
}
|
|
44905
44907
|
const splices = [];
|
|
44906
44908
|
let sectionIndex = -1;
|
|
44907
|
-
const unstable = newLines.find((l) =>
|
|
44909
|
+
const unstable = newLines.find((l) => _chunkK2NWHLCDcjs.sanitizeText.call(void 0, l) !== l);
|
|
44908
44910
|
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
44911
|
if (nonEmpty.length === 0) {
|
|
44910
44912
|
if (newLines.length === 0) return 0;
|
|
@@ -45028,7 +45030,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45028
45030
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45029
45031
|
if (paths.length > 0) return paths;
|
|
45030
45032
|
}
|
|
45031
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
45033
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkMJSHXESKcjs.compareSectionPaths);
|
|
45032
45034
|
}
|
|
45033
45035
|
|
|
45034
45036
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45815,7 +45817,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45815
45817
|
}
|
|
45816
45818
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45817
45819
|
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 (
|
|
45820
|
+
if (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45819
45821
|
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
45822
|
}
|
|
45821
45823
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45862,7 +45864,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45862
45864
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45863
45865
|
continue;
|
|
45864
45866
|
}
|
|
45865
|
-
if (afterEach.some((l) =>
|
|
45867
|
+
if (afterEach.some((l) => _chunkK2NWHLCDcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45866
45868
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45867
45869
|
continue;
|
|
45868
45870
|
}
|
|
@@ -45890,7 +45892,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45890
45892
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45891
45893
|
break;
|
|
45892
45894
|
}
|
|
45893
|
-
if (
|
|
45895
|
+
if (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45894
45896
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45895
45897
|
break;
|
|
45896
45898
|
}
|
|
@@ -45946,12 +45948,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45946
45948
|
}
|
|
45947
45949
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
45948
45950
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
45949
|
-
const content =
|
|
45951
|
+
const content = _chunkK2NWHLCDcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
45950
45952
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
45951
45953
|
const t = line.trim();
|
|
45952
45954
|
if (!t) return "";
|
|
45953
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
45954
|
-
return
|
|
45955
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkK2NWHLCDcjs.escapeGfm.call(void 0, t)}**`;
|
|
45956
|
+
return _chunkK2NWHLCDcjs.escapeGfm.call(void 0, t);
|
|
45955
45957
|
}).filter(Boolean);
|
|
45956
45958
|
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
45959
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -45965,7 +45967,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45965
45967
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
45966
45968
|
const replica = [];
|
|
45967
45969
|
for (let r = 0; r < table2.rows; r++) {
|
|
45968
|
-
const line =
|
|
45970
|
+
const line = _chunkK2NWHLCDcjs.escapeGfm.call(void 0, _chunkK2NWHLCDcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
45969
45971
|
if (line) replica.push({ line, gridR: r });
|
|
45970
45972
|
}
|
|
45971
45973
|
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 +46008,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46006
46008
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46007
46009
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46008
46010
|
}
|
|
46009
|
-
const unstable = newLines.find((l) =>
|
|
46011
|
+
const unstable = newLines.find((l) => _chunkK2NWHLCDcjs.sanitizeText.call(void 0, l) !== l);
|
|
46010
46012
|
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
46013
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46012
46014
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46408,12 +46410,12 @@ function buildOrigUnits(blocks) {
|
|
|
46408
46410
|
const block = blocks[i];
|
|
46409
46411
|
let consume = 1;
|
|
46410
46412
|
let chunk;
|
|
46411
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46413
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkK2NWHLCDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46412
46414
|
const next = blocks[i + 1];
|
|
46413
46415
|
if (_optionalChain([next, 'optionalAccess', _967 => _967.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46414
|
-
chunk =
|
|
46416
|
+
chunk = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46415
46417
|
} else {
|
|
46416
|
-
chunk =
|
|
46418
|
+
chunk = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, [block]);
|
|
46417
46419
|
}
|
|
46418
46420
|
if (chunk) {
|
|
46419
46421
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -46697,7 +46699,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46697
46699
|
}
|
|
46698
46700
|
}
|
|
46699
46701
|
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 (
|
|
46702
|
+
if (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkK2NWHLCDcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46701
46703
|
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
46704
|
}
|
|
46703
46705
|
const xml = _optionalChain([ctx, 'access', _979 => _979.scans, 'access', _980 => _980[mapping.para.sectionIndex], 'optionalAccess', _981 => _981.xml]);
|
|
@@ -46714,14 +46716,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46714
46716
|
}
|
|
46715
46717
|
function textUnitInline(raw, block) {
|
|
46716
46718
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46717
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46719
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkK2NWHLCDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46718
46720
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46719
46721
|
}
|
|
46720
46722
|
if (block.href) {
|
|
46721
46723
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46722
46724
|
if (linkMatch) text = linkMatch[1];
|
|
46723
46725
|
}
|
|
46724
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46726
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkK2NWHLCDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46725
46727
|
text = text.slice(1, -1);
|
|
46726
46728
|
}
|
|
46727
46729
|
return text;
|
|
@@ -49269,7 +49271,7 @@ function blocksToChunks(blocks, options) {
|
|
|
49269
49271
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1012 => _1012.granularity]), () => ( "section"));
|
|
49270
49272
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1013 => _1013.includeTableCells]), () => ( false));
|
|
49271
49273
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1014 => _1014.tableFormat]) };
|
|
49272
|
-
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm")
|
|
49274
|
+
if (_optionalChain([options, 'optionalAccess', _1015 => _1015.tableFormat]) === "gfm") _chunkK2NWHLCDcjs.assignTableIds.call(void 0, blocks);
|
|
49273
49275
|
const chunks = [];
|
|
49274
49276
|
const headingStack = [];
|
|
49275
49277
|
const listStack = [];
|
|
@@ -49283,12 +49285,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49283
49285
|
let run = null;
|
|
49284
49286
|
const flushRun = () => {
|
|
49285
49287
|
if (!run) return;
|
|
49286
|
-
push("text", run.breadcrumb,
|
|
49288
|
+
push("text", run.breadcrumb, _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49287
49289
|
run = null;
|
|
49288
49290
|
};
|
|
49289
49291
|
for (let i = 0; i < blocks.length; i++) {
|
|
49290
49292
|
const block = blocks[i];
|
|
49291
|
-
const md2 =
|
|
49293
|
+
const md2 = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49292
49294
|
if (!md2) continue;
|
|
49293
49295
|
if (block.type === "heading") {
|
|
49294
49296
|
flushRun();
|
|
@@ -49376,7 +49378,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49376
49378
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49377
49379
|
}
|
|
49378
49380
|
function irCellLines(text) {
|
|
49379
|
-
return stripCellTokens(
|
|
49381
|
+
return stripCellTokens(_chunkK2NWHLCDcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49380
49382
|
}
|
|
49381
49383
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49382
49384
|
|
|
@@ -49636,7 +49638,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49636
49638
|
if (newPlain === "") {
|
|
49637
49639
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49638
49640
|
}
|
|
49639
|
-
if (
|
|
49641
|
+
if (_chunkK2NWHLCDcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49640
49642
|
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
49643
|
}
|
|
49642
49644
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1035 => _1035.scans, 'access', _1036 => _1036[mapping.para.sectionIndex], 'optionalAccess', _1037 => _1037.xml]));
|
|
@@ -49731,7 +49733,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
49731
49733
|
});
|
|
49732
49734
|
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
49735
|
function sanitizeRawHtml(raw) {
|
|
49734
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49736
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkMJSHXESKcjs.escapeHtml.call(void 0, tag));
|
|
49735
49737
|
}
|
|
49736
49738
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49737
49739
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -49739,7 +49741,7 @@ function renderHtml(markdown, options) {
|
|
|
49739
49741
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1041 => _1041.preset]), () => ( "default"));
|
|
49740
49742
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1042 => _1042.extraCss]), () => ( "")));
|
|
49741
49743
|
const body = md.render(markdown);
|
|
49742
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${
|
|
49744
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1043 => _1043.watermark]) ? `<div class="watermark">${_chunkMJSHXESKcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49743
49745
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1044 => _1044.watermark]) ? `
|
|
49744
49746
|
.watermark {
|
|
49745
49747
|
position: fixed;
|
|
@@ -49793,13 +49795,13 @@ async function htmlToPdf(html, options) {
|
|
|
49793
49795
|
try {
|
|
49794
49796
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49795
49797
|
} catch (e42) {
|
|
49796
|
-
throw new (0,
|
|
49798
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
49797
49799
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49798
49800
|
);
|
|
49799
49801
|
}
|
|
49800
49802
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49801
49803
|
if (!executablePath) {
|
|
49802
|
-
throw new (0,
|
|
49804
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
49803
49805
|
"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
49806
|
);
|
|
49805
49807
|
}
|
|
@@ -49854,7 +49856,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49854
49856
|
return htmlToPdf(html, options);
|
|
49855
49857
|
}
|
|
49856
49858
|
async function blocksToPdf(blocks, options) {
|
|
49857
|
-
const markdown =
|
|
49859
|
+
const markdown = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, blocks);
|
|
49858
49860
|
return markdownToPdf(markdown, options);
|
|
49859
49861
|
}
|
|
49860
49862
|
|
|
@@ -49977,7 +49979,7 @@ function findFirst(el, name, depth = 0) {
|
|
|
49977
49979
|
}
|
|
49978
49980
|
var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
|
|
49979
49981
|
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"]);
|
|
49982
|
+
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
49981
49983
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
49982
49984
|
function sectionNoteFormats2(p) {
|
|
49983
49985
|
const root = _optionalChain([p, 'access', _1054 => _1054.ownerDocument, 'optionalAccess', _1055 => _1055.documentElement]);
|
|
@@ -50737,6 +50739,63 @@ function cachedParagraphBottom(lsa, bodyFlow) {
|
|
|
50737
50739
|
return bottom;
|
|
50738
50740
|
}
|
|
50739
50741
|
|
|
50742
|
+
// src/render/reflow-fragments.ts
|
|
50743
|
+
function appendNarrowLineFragments(parent, seg, free, box, flow) {
|
|
50744
|
+
if (!free || !box) return false;
|
|
50745
|
+
const parts = free.filter(([a, b]) => b - a >= 1440);
|
|
50746
|
+
if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
|
|
50747
|
+
const { text, widths, spacings, slots, start, end } = flow;
|
|
50748
|
+
if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
|
|
50749
|
+
let ink = start;
|
|
50750
|
+
while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
|
|
50751
|
+
if (text.slice(ink, end).includes("\u2060")) return false;
|
|
50752
|
+
if (ink === end || parts.slice(0, -1).some(([a, b]) => (_nullishCoalesce(widths[ink], () => ( 0))) - (_nullishCoalesce(spacings[ink], () => ( 0))) <= b - a)) return false;
|
|
50753
|
+
const fragments = [];
|
|
50754
|
+
let cursor = start;
|
|
50755
|
+
for (const [a, b] of parts.slice(0, -1)) {
|
|
50756
|
+
const offset = cursor;
|
|
50757
|
+
let w = 0;
|
|
50758
|
+
while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
|
|
50759
|
+
fragments.push({ offset, x: a, width: b - a });
|
|
50760
|
+
}
|
|
50761
|
+
let rest = 0;
|
|
50762
|
+
for (let i = cursor; i < end; i++) rest += widths[i];
|
|
50763
|
+
let last = end - 1;
|
|
50764
|
+
if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
|
|
50765
|
+
rest -= _nullishCoalesce(spacings[last], () => ( 0));
|
|
50766
|
+
if (rest > box[1] + 0.5) return false;
|
|
50767
|
+
let next = end;
|
|
50768
|
+
while (next < text.length && text[next] === " ") next++;
|
|
50769
|
+
if (next < text.length && rest + (_nullishCoalesce(widths[next], () => ( 0))) - (_nullishCoalesce(spacings[next], () => ( 0))) <= box[1] + 0.5) return false;
|
|
50770
|
+
fragments.push({ offset: cursor, x: box[0], width: box[1] });
|
|
50771
|
+
fragments.forEach((f, i) => {
|
|
50772
|
+
const part = seg.cloneNode(false);
|
|
50773
|
+
if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
|
|
50774
|
+
part.setAttribute("horzpos", String(f.x));
|
|
50775
|
+
part.setAttribute("horzsize", String(f.width));
|
|
50776
|
+
parent.appendChild(part);
|
|
50777
|
+
});
|
|
50778
|
+
return true;
|
|
50779
|
+
}
|
|
50780
|
+
|
|
50781
|
+
// src/render/reflow-borders.ts
|
|
50782
|
+
function lineBorderBox(model, styles, start, end) {
|
|
50783
|
+
const empty = model.chars.length === 0 && model.objs.length === 0;
|
|
50784
|
+
let top = 0, all = 0;
|
|
50785
|
+
const include = (prId) => {
|
|
50786
|
+
const st = prId != null ? styles.charPr.get(prId) : void 0;
|
|
50787
|
+
const f = _optionalChain([st, 'optionalAccess', _1132 => _1132.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
50788
|
+
if (!f || !f.top && !f.bottom) return;
|
|
50789
|
+
const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
|
|
50790
|
+
const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
|
|
50791
|
+
top = Math.max(top, st.height + t);
|
|
50792
|
+
all = Math.max(all, st.height + t + b);
|
|
50793
|
+
};
|
|
50794
|
+
if (empty) for (const run of model.runs) include(run.prId);
|
|
50795
|
+
else for (let i = start; i < end; i++) if (model.chars[i].ch) include(model.chars[i].prId);
|
|
50796
|
+
return [top, all, empty && all > 0];
|
|
50797
|
+
}
|
|
50798
|
+
|
|
50740
50799
|
// src/render/reflow.ts
|
|
50741
50800
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50742
50801
|
var LINESEG_FLAGS = "393216";
|
|
@@ -50797,11 +50856,11 @@ function glyphWidth(ch, st) {
|
|
|
50797
50856
|
let h = rel !== 100 ? mulDiv(st.height, rel, 100) : st.height;
|
|
50798
50857
|
if (!space && st.script) h = mulDiv(h, 16, 25);
|
|
50799
50858
|
const ratio = L ? L.ratio : st.ratio;
|
|
50800
|
-
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access',
|
|
50801
|
-
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50859
|
+
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access', _1133 => _1133.latin, 'optionalAccess', _1134 => _1134.spacing]), () => ( st.spacing)) : L ? L.spacing : st.spacing;
|
|
50860
|
+
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess', _1135 => _1135.face]), () => ( st.face));
|
|
50802
50861
|
const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
|
|
50803
50862
|
const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
|
|
50804
|
-
const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 ? _optionalChain([BEFORE_2024_WIDTH, 'access',
|
|
50863
|
+
const oldEm = st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8220 || cp === 8221) ? 500 : st.halfQuote && !st.before2024 && face0 === "\uD734\uBA3C\uBA85\uC870" && (cp === 8216 || cp === 8217) ? 312 : st.before2024 && face0 && !(face0 === "\uC2E0\uBA85\uC870" && (st.halfQuote || (_optionalChain([L, 'optionalAccess', _1136 => _1136.face]) ? L.hft : st.hft))) ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1137 => _1137[face0], 'optionalAccess', _1138 => _1138[cp]]) : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1139 => _1139[face0], 'optionalAccess', _1140 => _1140[cp]]) : void 0;
|
|
50805
50864
|
const fc = faceClassForReflow(_nullishCoalesce(boldFace, () => ( face0)));
|
|
50806
50865
|
const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
|
|
50807
50866
|
if (fsEm !== void 0) {
|
|
@@ -50809,7 +50868,7 @@ function glyphWidth(ch, st) {
|
|
|
50809
50868
|
const s = spacing ? 4 * mulDiv(Math.trunc(b / 4), spacing, 100) : 0;
|
|
50810
50869
|
return { w: b + s, sp: s };
|
|
50811
50870
|
}
|
|
50812
|
-
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50871
|
+
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess', _1141 => _1141.face]), () => ( st.face)), L ? L.hft : st.hft) : 0;
|
|
50813
50872
|
if (oldEm !== void 0) {
|
|
50814
50873
|
const b0 = hancomEmWidth(oldEm + bAdd, h, ratio, 0), w0 = spacing ? hancomEmWidth(oldEm + bAdd, h, ratio, spacing) : b0;
|
|
50815
50874
|
return { w: w0, sp: w0 - b0 };
|
|
@@ -50950,8 +51009,8 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
50950
51009
|
for (const ch of bu.ch) headW += glyphWidth(ch, bst).w;
|
|
50951
51010
|
}
|
|
50952
51011
|
const bulletW = bu ? headW + (bu.offsetPct ? Math.trunc(height * bu.offset / 100) : bu.offset) : 0;
|
|
50953
|
-
const contBullet = _optionalChain([bu, 'optionalAccess',
|
|
50954
|
-
const squeeze = _optionalChain([p, 'access',
|
|
51012
|
+
const contBullet = _optionalChain([bu, 'optionalAccess', _1142 => _1142.autoIndent]) ? bulletW : 0;
|
|
51013
|
+
const squeeze = _optionalChain([p, 'access', _1143 => _1143.parentNode, 'optionalAccess', _1144 => _1144.getAttribute, 'optionalCall', _1145 => _1145("lineWrap")]) === "SQUEEZE" || !!geom.squeeze;
|
|
50955
51014
|
const NO_WRAP = 1e9;
|
|
50956
51015
|
const intentPos = geom.marginIntent >= avail ? 0 : Math.max(0, geom.marginIntent);
|
|
50957
51016
|
const firstWrapWidth = squeeze ? NO_WRAP : Math.max(500, avail - (styles.before2024 && bulletW > 0 ? Math.max(intentPos, bulletW) : intentPos + bulletW));
|
|
@@ -50974,7 +51033,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
50974
51033
|
let cellFloatBottom = 0, cellTextBelow = 0;
|
|
50975
51034
|
const spacesOnly = spacesHost(p);
|
|
50976
51035
|
const zoneStart = zones.length;
|
|
50977
|
-
const OVP = bodyFlow && m.objs.length > 0 && !m.chars.some((c) => c.ch !== "" && c.ch.trim() !== "") && m.objs.every((o) => !o.inline && o.tag === "pic" && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && _optionalChain([findChildByLocalName, 'call',
|
|
51036
|
+
const OVP = bodyFlow && m.objs.length > 0 && !m.chars.some((c) => c.ch !== "" && c.ch.trim() !== "") && m.objs.every((o) => !o.inline && o.tag === "pic" && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && _optionalChain([findChildByLocalName, 'call', _1146 => _1146(o.el, "pos"), 'optionalAccess', _1147 => _1147.getAttribute, 'call', _1148 => _1148("allowOverlap")]) === "1");
|
|
50978
51037
|
const spacesText = bodyFlow && (spacesOnly || !!OVP || bulletEmptyHost(p, geom));
|
|
50979
51038
|
const textish = m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") || m.objs.some((o) => o.inline) || spacesText;
|
|
50980
51039
|
for (const o of m.objs) {
|
|
@@ -50984,10 +51043,10 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
50984
51043
|
const outT = num3(om, "top"), outB = num3(om, "bottom");
|
|
50985
51044
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
50986
51045
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
50987
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51046
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1149 => _1149.getAttribute, 'call', _1150 => _1150("vertRelTo")]), () => ( "PARA"));
|
|
50988
51047
|
if (vertRel === "PAPER" && bodyFlow && wrapAttr !== "TOP_AND_BOTTOM") {
|
|
50989
51048
|
const [oxL, oyT, paperW] = paperOrigin(p);
|
|
50990
|
-
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51049
|
+
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1151 => _1151.getAttribute, 'call', _1152 => _1152("horzRelTo")]), () => ( "COLUMN")), hAlign2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1153 => _1153.getAttribute, 'call', _1154 => _1154("horzAlign")]), () => ( "LEFT"));
|
|
50991
51050
|
const ho2 = num3(pos, "horzOffset"), base2 = hRel2 === "PAPER" ? -oxL : hRel2 === "PARA" ? marginL : 0, span3 = hRel2 === "PAPER" ? paperW : hRel2 === "PARA" ? avail : areaW;
|
|
50992
51051
|
const x02 = base2 + (hAlign2 === "RIGHT" ? span3 - ho2 - o.width : hAlign2 === "CENTER" ? (span3 - o.width) / 2 + ho2 : ho2);
|
|
50993
51052
|
const vo0 = Math.max(0, num3(pos, "vertOffset")), top2 = vertRel === "PAPER" ? vo0 - oyT : vo0;
|
|
@@ -51001,7 +51060,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51001
51060
|
const voRaw = num3(pos, "vertOffset"), voSigned = Math.max(0, voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw);
|
|
51002
51061
|
const effH = effHOf(o);
|
|
51003
51062
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
51004
|
-
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51063
|
+
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1155 => _1155.getAttribute, 'call', _1156 => _1156("horzRelTo")]), () => ( "COLUMN")), hA = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1157 => _1157.getAttribute, 'call', _1158 => _1158("horzAlign")]), () => ( "LEFT"));
|
|
51005
51064
|
const hoff = num3(pos, "horzOffset"), b0 = hR === "PARA" ? marginL : 0, sp = hR === "PARA" ? avail : areaW;
|
|
51006
51065
|
const xL = b0 + (hA === "RIGHT" ? sp - hoff - o.width : hA === "CENTER" ? (sp - o.width) / 2 + hoff : hoff);
|
|
51007
51066
|
if ((hR === "COLUMN" || hR === "PARA") && (xL >= areaW || xL + o.width <= 0)) continue;
|
|
@@ -51018,17 +51077,17 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51018
51077
|
else cellFloatBottom = Math.max(cellFloatBottom, voSigned + outT + effH + outB);
|
|
51019
51078
|
continue;
|
|
51020
51079
|
}
|
|
51021
|
-
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51080
|
+
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1159 => _1159.getAttribute, 'call', _1160 => _1160("horzRelTo")]), () => ( "COLUMN")), hAlign = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1161 => _1161.getAttribute, 'call', _1162 => _1162("horzAlign")]), () => ( "LEFT"));
|
|
51022
51081
|
const ho = num3(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span2 = hRel === "PARA" ? avail : areaW;
|
|
51023
51082
|
const x0 = base + (hAlign === "RIGHT" ? span2 - ho - o.width : hAlign === "CENTER" ? (span2 - o.width) / 2 + ho : ho);
|
|
51024
|
-
const top = startV + vo;
|
|
51083
|
+
const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
|
|
51025
51084
|
const omLx = num3(om, "left"), omRx = num3(om, "right");
|
|
51026
51085
|
const xs = hAlign === "RIGHT" ? x0 - omRx : hAlign === "CENTER" ? x0 : x0 + omLx;
|
|
51027
51086
|
const nextPage = pageH > 0 && top + effH + outB > pageH;
|
|
51028
51087
|
zones.push({ top: nextPage ? -1 : top, bottom: nextPage ? -1 : top + effH + outB, left: xs - omLx, right: xs + o.width + omRx, flow: _nullishCoalesce(o.el.getAttribute("textFlow"), () => ( "BOTH_SIDES")), anchor: nextPage ? void 0 : o.index, carry: outT + effH + outB, ...nextPage ? { nextPage } : {} });
|
|
51029
51088
|
}
|
|
51030
51089
|
const hasText = textish;
|
|
51031
|
-
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
51090
|
+
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1163 => _1163(o.el, "pos"), 'optionalAccess', _1164 => _1164.getAttribute, 'call', _1165 => _1165("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
51032
51091
|
const areaTop = bodyFlow ? startV - (_nullishCoalesce(geom.spaceBefore, () => ( 0))) : startV;
|
|
51033
51092
|
let floatFloor = 0;
|
|
51034
51093
|
if (!hasText && nFloat < 2) {
|
|
@@ -51155,61 +51214,50 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51155
51214
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51156
51215
|
const li = lineOf(o.index);
|
|
51157
51216
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51217
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall', _1166 => _1166(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
51218
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51159
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51219
|
+
if (_optionalChain([findChildByLocalName, 'call', _1167 => _1167(o.el, "pos"), 'optionalAccess', _1168 => _1168.getAttribute, 'call', _1169 => _1169("affectLSpacing")]) === "1") lineObjLs[li] = true;
|
|
51160
51220
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51161
51221
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51162
51222
|
}
|
|
51163
51223
|
const lsa = doc.createElement("hp:linesegarray");
|
|
51224
|
+
const subList = p.parentNode;
|
|
51225
|
+
const verticalCenter = _optionalChain([subList, 'optionalAccess', _1170 => _1170.getAttribute, 'optionalCall', _1171 => _1171("vertAlign")]) === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(_nullishCoalesce(subList.getAttribute("textDirection"), () => ( "")));
|
|
51164
51226
|
let v = textStartV;
|
|
51165
51227
|
let firstAcc = 0;
|
|
51166
51228
|
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',
|
|
51229
|
+
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access', _1172 => _1172.charPr, 'access', _1173 => _1173.get, 'call', _1174 => _1174(prId), 'optionalAccess', _1175 => _1175.height]) : void 0) || 0;
|
|
51168
51230
|
const lineTextH = (li) => {
|
|
51169
51231
|
const s = textposOf[li], last = li === wrap.starts.length - 1, e = last ? m.chars.length : textposOf[li + 1];
|
|
51170
51232
|
let h = 0;
|
|
51171
51233
|
for (let k = s; k < e; k++) h = Math.max(h, heightOf(m.chars[k].prId));
|
|
51172
51234
|
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',
|
|
51235
|
+
if (li === 0 && _optionalChain([bu, 'optionalAccess', _1176 => _1176.charPrId]) != null) h = Math.max(h, heightOf(bu.charPrId));
|
|
51174
51236
|
return h || height;
|
|
51175
51237
|
};
|
|
51176
51238
|
const fontLineOf = (li) => {
|
|
51177
51239
|
if (!geom.fontLineHeight) return void 0;
|
|
51178
51240
|
const s = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
|
|
51241
|
+
if (!m.chars.slice(s, e).some((c) => c.ch && c.ch !== " ")) return void 0;
|
|
51179
51242
|
let h = 0, b = 0, any = false;
|
|
51180
51243
|
for (let k = s; k < e; k++) {
|
|
51181
51244
|
const c = m.chars[k];
|
|
51182
|
-
if (!c.ch
|
|
51245
|
+
if (!c.ch) continue;
|
|
51183
51246
|
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51184
51247
|
if (!st) continue;
|
|
51185
51248
|
const cp = c.ch.codePointAt(0);
|
|
51186
|
-
const fm = fontLineMetrics(st.latin && isLatinCp(cp) ? st.latin.face : st.face);
|
|
51249
|
+
const fm = fontLineMetrics(c.ch !== " " && st.latin && isLatinCp(cp) ? st.latin.face : st.face);
|
|
51187
51250
|
any = true;
|
|
51188
51251
|
h = Math.max(h, fm ? Math.round(st.height * fm[0]) + (fm[2] ? Math.round : Math.trunc)(st.height * fm[1]) : st.height);
|
|
51189
51252
|
b = Math.max(b, fm ? Math.round(st.height * fm[0]) : Math.round(st.height * BASELINE_RATIO));
|
|
51190
51253
|
}
|
|
51191
51254
|
return any ? [h, b] : void 0;
|
|
51192
51255
|
};
|
|
51193
|
-
const lineBorderBox = (li) => {
|
|
51194
|
-
const s0 = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
|
|
51195
|
-
let top = 0, all = 0;
|
|
51196
|
-
for (let k = s0; k < e; k++) {
|
|
51197
|
-
const c = m.chars[k];
|
|
51198
|
-
if (!c.ch) continue;
|
|
51199
|
-
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51200
|
-
const f = _optionalChain([st, 'optionalAccess', _1172 => _1172.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
51201
|
-
if (!f || !f.top && !f.bottom) continue;
|
|
51202
|
-
const t = f.top ? Math.trunc(f.top.widthPt * 100) : 0, b = f.bottom ? Math.trunc(f.bottom.widthPt * 100) : 0;
|
|
51203
|
-
top = Math.max(top, st.height + t);
|
|
51204
|
-
all = Math.max(all, st.height + t + b);
|
|
51205
|
-
}
|
|
51206
|
-
return [top, all];
|
|
51207
|
-
};
|
|
51208
51256
|
const natW = widths.reduce((a, w) => a + w, 0) + spacings.reduce((a, w) => a + w, 0);
|
|
51209
51257
|
for (let li = 0; li < wrap.starts.length; li++) {
|
|
51210
51258
|
const textpos = textposOf[li];
|
|
51211
51259
|
const fl = fontLineOf(li);
|
|
51212
|
-
const [boxTop, boxAll] = lineBorderBox(li);
|
|
51260
|
+
const [boxTop, boxAll, emptyBorder] = lineBorderBox(m, styles, textposOf[li], _nullishCoalesce(textposOf[li + 1], () => ( m.chars.length)));
|
|
51213
51261
|
const textH0 = fl ? Math.max(fl[0], lineTextH(li)) : lineTextH(li);
|
|
51214
51262
|
const textH = Math.max(textH0, boxAll);
|
|
51215
51263
|
const objOnly = lineObjH[li] > 0 && lineObjH[li] < textH && (() => {
|
|
@@ -51238,19 +51286,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51238
51286
|
const seg = doc.createElement("hp:lineseg");
|
|
51239
51287
|
seg.setAttribute("textpos", String(textpos));
|
|
51240
51288
|
seg.setAttribute("vertpos", String(vertpos));
|
|
51241
|
-
seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51289
|
+
seg.setAttribute("vertsize", String(emptyBorder ? textH0 : occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51242
51290
|
seg.setAttribute("textheight", String(lineH));
|
|
51243
|
-
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])));
|
|
51291
|
+
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" || verticalCenter && (!geom.vertAlign || geom.vertAlign === "BASELINE") ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), boxTop > textH0 ? Math.round(boxTop * BASELINE_RATIO) : 0, lineObjAsc[li])));
|
|
51244
51292
|
seg.setAttribute("spacing", String(spacing));
|
|
51245
51293
|
let box = boxAt(li);
|
|
51246
|
-
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access',
|
|
51294
|
+
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access', _1177 => _1177[li], 'optionalAccess', _1178 => _1178.filter, 'call', _1179 => _1179(([a, b]) => b - a >= 1440)]) : void 0;
|
|
51247
51295
|
const parts = fit && fit.length > 1 && natW <= fit[0][1] - fit[0][0] - Math.max(0, geom.marginIntent) ? fit : void 0;
|
|
51248
51296
|
if (parts) box = [parts[0][0], parts[0][1] - parts[0][0]];
|
|
51249
51297
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
51250
51298
|
seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
|
|
51251
51299
|
seg.setAttribute("flags", LINESEG_FLAGS);
|
|
51300
|
+
if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
|
|
51301
|
+
lsa,
|
|
51302
|
+
seg,
|
|
51303
|
+
lineParts[li],
|
|
51304
|
+
box,
|
|
51305
|
+
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: _nullishCoalesce(wrap.starts[li + 1], () => ( text.length)) }
|
|
51306
|
+
)) continue;
|
|
51252
51307
|
lsa.appendChild(seg);
|
|
51253
|
-
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
51308
|
+
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _1180 => _1180.slice, 'call', _1181 => _1181(1)]), () => ( []))) {
|
|
51254
51309
|
const more = seg.cloneNode(false);
|
|
51255
51310
|
more.setAttribute("textpos", String(m.chars.length + 1));
|
|
51256
51311
|
more.setAttribute("horzpos", String(a));
|
|
@@ -51269,9 +51324,9 @@ function paperOrigin(p) {
|
|
|
51269
51324
|
const d = p.ownerDocument;
|
|
51270
51325
|
const hit = originMemo.get(d);
|
|
51271
51326
|
if (hit) return hit;
|
|
51272
|
-
const pagePr = _nullishCoalesce(_optionalChain([p, 'access',
|
|
51327
|
+
const pagePr = _nullishCoalesce(_optionalChain([p, 'access', _1182 => _1182.ownerDocument, 'optionalAccess', _1183 => _1183.getElementsByTagName, 'call', _1184 => _1184("hp:pagePr"), 'access', _1185 => _1185[0]]), () => ( null));
|
|
51273
51328
|
const mg = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
51274
|
-
const tb = _optionalChain([pagePr, 'optionalAccess',
|
|
51329
|
+
const tb = _optionalChain([pagePr, 'optionalAccess', _1186 => _1186.getAttribute, 'call', _1187 => _1187("gutterType")]) === "TOP_BOTTOM", gut = num3(mg, "gutter");
|
|
51275
51330
|
const o = [num3(mg, "left", 8504) + (tb ? 0 : gut), num3(mg, "top", 5668) + num3(mg, "header") + (tb ? gut : 0), num3(pagePr, "width", 59528)];
|
|
51276
51331
|
originMemo.set(d, o);
|
|
51277
51332
|
return o;
|
|
@@ -51288,7 +51343,7 @@ function pageTopBand(p) {
|
|
|
51288
51343
|
for (const o of elements2(run)) {
|
|
51289
51344
|
if (!OBJ_TAGS.has(ln2(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
51290
51345
|
const pos = findChildByLocalName(o, "pos");
|
|
51291
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51346
|
+
if (_optionalChain([pos, 'optionalAccess', _1188 => _1188.getAttribute, 'call', _1189 => _1189("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1190 => _1190.getAttribute, 'call', _1191 => _1191("vertRelTo")]) !== "PAGE" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1192 => _1192.getAttribute, 'call', _1193 => _1193("vertAlign")]), () => ( "TOP"))) !== "TOP") continue;
|
|
51292
51347
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
51293
51348
|
const h = ln2(o) === "tbl" ? Math.max(num3(sz, "height"), measureTableHeight(o)) : num3(sz, "height");
|
|
51294
51349
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
@@ -51344,7 +51399,7 @@ function footNoteHeights(p, ownOnly = false) {
|
|
|
51344
51399
|
let a = fn.parentNode, inSplit = false;
|
|
51345
51400
|
while (a && a !== p) {
|
|
51346
51401
|
const e = a;
|
|
51347
|
-
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call',
|
|
51402
|
+
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call', _1194 => _1194(e, "pos"), 'optionalAccess', _1195 => _1195.getAttribute, 'call', _1196 => _1196("treatAsChar")]) !== "1") inSplit = true;
|
|
51348
51403
|
a = a.parentNode;
|
|
51349
51404
|
}
|
|
51350
51405
|
if (inSplit) continue;
|
|
@@ -51373,7 +51428,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51373
51428
|
let prevPlaced;
|
|
51374
51429
|
const bodyFlow = areaW === counter.bodyW && bodyH > 0;
|
|
51375
51430
|
const vis = bodyH > 0 ? findFirst(container, "visibility") : null;
|
|
51376
|
-
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess',
|
|
51431
|
+
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess', _1197 => _1197.getAttribute, 'call', _1198 => _1198("hideFirstEmptyLine")]) === "1";
|
|
51377
51432
|
let hidPrev = 0;
|
|
51378
51433
|
const cellW = areaW;
|
|
51379
51434
|
let cellCols = 1, cellCol = 0;
|
|
@@ -51398,7 +51453,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51398
51453
|
reflowSubListsIn(p, doc, styles, mode, counter, reflowBlockFlow, bodyFlow ? areaW : void 0);
|
|
51399
51454
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
51400
51455
|
const cursorBefore = cursorV;
|
|
51401
|
-
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51456
|
+
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1199 => _1199.spaceBefore]), () => ( 0))), floatFloor);
|
|
51402
51457
|
floatFloor = 0;
|
|
51403
51458
|
if (bodyH > 0) {
|
|
51404
51459
|
const [top, bot] = pageTopBand(p);
|
|
@@ -51424,13 +51479,13 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51424
51479
|
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51425
51480
|
if (Number.isFinite(bottom)) {
|
|
51426
51481
|
cursorV = bottom;
|
|
51427
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51482
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1200 => _1200.spaceAfter]), () => ( 0));
|
|
51428
51483
|
}
|
|
51429
51484
|
}
|
|
51430
51485
|
continue;
|
|
51431
51486
|
}
|
|
51432
51487
|
const paraH = res.paraBottom - startV;
|
|
51433
|
-
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess',
|
|
51488
|
+
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess', _1201 => _1201.pageBreakBefore]));
|
|
51434
51489
|
const lines = bodyH > 0 ? elements2(_nullishCoalesce(findChildByLocalName(p, "linesegarray"), () => ( p))).filter((e) => ln2(e) === "lineseg") : [];
|
|
51435
51490
|
const reserve = bodyH > 0 ? pageBottomReserve(p) : 0;
|
|
51436
51491
|
const fns = bodyH > 0 ? footNoteHeights(p) : [];
|
|
@@ -51465,9 +51520,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51465
51520
|
let cut = -1;
|
|
51466
51521
|
if (!explicitBreak && !firstOver && lines.length > 1) {
|
|
51467
51522
|
cut = lines.findIndex((seg, i) => i > 0 && lineBottom(seg) > limAt(i) && num3(seg, "vertsize") <= bodyH);
|
|
51468
|
-
if (cut > 0 && _optionalChain([g3, 'optionalAccess',
|
|
51523
|
+
if (cut > 0 && _optionalChain([g3, 'optionalAccess', _1202 => _1202.widowOrphan]) && lines.length >= 3 && cut === lines.length - 1) cut--;
|
|
51469
51524
|
}
|
|
51470
|
-
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess',
|
|
51525
|
+
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess', _1203 => _1203.widowOrphan]) || cut > 0 && !!_optionalChain([g3, 'optionalAccess', _1204 => _1204.keepLines]);
|
|
51471
51526
|
if (cut > 0 && !orphan) {
|
|
51472
51527
|
for (let i = cut; i < lines.length; i++) {
|
|
51473
51528
|
const seg = lines[i];
|
|
@@ -51487,7 +51542,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51487
51542
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51488
51543
|
if (lsa) p.removeChild(lsa);
|
|
51489
51544
|
const zb = zones.length;
|
|
51490
|
-
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51545
|
+
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1205 => _1205.spaceBefore]), () => ( 0));
|
|
51491
51546
|
let moveRes = reflowPara(p, doc, styles, areaW, sb0, mode, zones, new Map([...numsBefore].map(([k, v]) => [k, v.slice()])), true, bodyH);
|
|
51492
51547
|
const lsaM = findChildByLocalName(p, "linesegarray"), sM = lsaM ? elements2(lsaM).find((e) => ln2(e) === "lineseg") : void 0;
|
|
51493
51548
|
const vM = sM ? num3(sM, "vertpos") : sb0;
|
|
@@ -51507,7 +51562,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51507
51562
|
}
|
|
51508
51563
|
}
|
|
51509
51564
|
} else {
|
|
51510
|
-
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51565
|
+
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1206 => _1206.spaceBefore]), () => ( 0));
|
|
51511
51566
|
shiftParaVert(p, top - startV);
|
|
51512
51567
|
cursorV = paraH + top;
|
|
51513
51568
|
if (bodyH > 0 && (top + paraH > bodyH || squareTableOver(p, top, bodyH))) {
|
|
@@ -51519,7 +51574,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51519
51574
|
splitPage = true;
|
|
51520
51575
|
}
|
|
51521
51576
|
}
|
|
51522
|
-
if (_optionalChain([prevPlaced, 'optionalAccess',
|
|
51577
|
+
if (_optionalChain([prevPlaced, 'optionalAccess', _1207 => _1207.keepWithNext]) && prevPlaced.startV > prevPlaced.top) {
|
|
51523
51578
|
shiftParaVert(prevPlaced.p, prevPlaced.top - prevPlaced.startV);
|
|
51524
51579
|
const base = prevPlaced.top + prevPlaced.h + prevPlaced.spaceAfter;
|
|
51525
51580
|
shiftParaVert(p, base);
|
|
@@ -51534,7 +51589,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51534
51589
|
const tVo = tEl ? num3(findChildByLocalName(tEl, "pos"), "vertOffset") : 0;
|
|
51535
51590
|
const tOm = tEl ? findChildByLocalName(tEl, "outMargin") : null;
|
|
51536
51591
|
if (tEl && tVo > 0 && tVo < 2 ** 31 && num3(tOm, "top") + measureTableHeight(tEl) + num3(tOm, "bottom") <= bodyH) {
|
|
51537
|
-
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51592
|
+
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1208 => _1208.spaceBefore]), () => ( 0))) + tVo;
|
|
51538
51593
|
zones.push({ top: tTop, bottom: Math.max(bodyH + 1, tTop + 1), left: -1e9, right: 1e9, flow: "BOTH_SIDES", carry: split });
|
|
51539
51594
|
floatFloor = 0;
|
|
51540
51595
|
cursorV = res.textBottom;
|
|
@@ -51561,9 +51616,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51561
51616
|
zones.length = 0;
|
|
51562
51617
|
splitPage = true;
|
|
51563
51618
|
}
|
|
51564
|
-
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51619
|
+
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1209 => _1209.spaceBefore]), () => ( 0))), lim)) {
|
|
51565
51620
|
const BU = BUH;
|
|
51566
|
-
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51621
|
+
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1210 => _1210.spaceBefore]), () => ( 0))), BU ? limOwn : lim, bodyH, styles, true, BU ? { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea } : void 0);
|
|
51567
51622
|
if (split4 !== void 0) {
|
|
51568
51623
|
cursorV = 0;
|
|
51569
51624
|
floatFloor = split4;
|
|
@@ -51581,7 +51636,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51581
51636
|
}
|
|
51582
51637
|
const keepCursor = hidden && !explicitBreak;
|
|
51583
51638
|
hidPrev = hidden ? hidPrev + 1 : 0;
|
|
51584
|
-
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51639
|
+
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1211 => _1211.spaceBefore]), () => ( 0)), h: paraH, spaceAfter: res.spaceAfter, keepWithNext: !!_optionalChain([g3, 'optionalAccess', _1212 => _1212.keepWithNext]) } : void 0;
|
|
51585
51640
|
const moved = explicitBreak || firstOver || orphan || off !== 0;
|
|
51586
51641
|
pageLimit = reserve > 0 ? bodyH - reserve : moved ? bodyH : Math.min(pageLimit, reserve > 0 ? bodyH - reserve : pageLimit);
|
|
51587
51642
|
if (moved && refs.length && cut > 0 && !orphan && !explicitBreak && !firstOver) {
|
|
@@ -51681,7 +51736,7 @@ function flowEndNotes(root, bodyH) {
|
|
|
51681
51736
|
if (done.has(f) || raw0 < f.bottom) continue;
|
|
51682
51737
|
done.add(f);
|
|
51683
51738
|
if (!(base + f.lineBottom - shift <= bodyH && base + f.bottom - shift > bodyH)) continue;
|
|
51684
|
-
if (_optionalChain([f, 'access',
|
|
51739
|
+
if (_optionalChain([f, 'access', _1213 => _1213.rows, 'optionalAccess', _1214 => _1214.length]) && _optionalChain([f, 'access', _1215 => _1215.el, 'optionalAccess', _1216 => _1216.getAttribute, 'call', _1217 => _1217("pageBreak")]) === "CELL") {
|
|
51685
51740
|
let yy = base + f.bottom - f.carry - shift + f.outT, k = 0;
|
|
51686
51741
|
while (k < f.rows.length && yy + f.rows[k] <= bodyH) yy += f.rows[k++];
|
|
51687
51742
|
if (k === f.rows.length) continue;
|
|
@@ -51947,7 +52002,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51947
52002
|
const declarations = [];
|
|
51948
52003
|
const hidden = /* @__PURE__ */ new Map();
|
|
51949
52004
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51950
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
52005
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1218 => _1218.get, 'call', _1219 => _1219(p), 'optionalAccess', _1220 => _1220[0]]), () => ( 0));
|
|
51951
52006
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51952
52007
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51953
52008
|
for (const el of elements(ctrl)) {
|
|
@@ -51967,7 +52022,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51967
52022
|
const out = [];
|
|
51968
52023
|
for (let page = 0; page < pageCount; page++) {
|
|
51969
52024
|
const n = pageBase + page + 1;
|
|
51970
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
52025
|
+
const hides = (name) => _optionalChain([hidden, 'access', _1221 => _1221.get, 'call', _1222 => _1222(page), 'optionalAccess', _1223 => _1223.has, 'call', _1224 => _1224(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
51971
52026
|
if (!hides("MasterPage")) {
|
|
51972
52027
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
51973
52028
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -51996,7 +52051,7 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51996
52051
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
51997
52052
|
const byPage = /* @__PURE__ */ new Map();
|
|
51998
52053
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51999
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
52054
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1225 => _1225.get, 'call', _1226 => _1226(p), 'optionalAccess', _1227 => _1227[0]]), () => ( 0));
|
|
52000
52055
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
52001
52056
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
52002
52057
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
@@ -52014,12 +52069,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
52014
52069
|
}
|
|
52015
52070
|
}
|
|
52016
52071
|
const stories = [], rules = [];
|
|
52017
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52018
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52072
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1228 => _1228.getAttribute, 'call', _1229 => _1229("width")]), () => ( "0.12"))) || 0.12;
|
|
52073
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1230 => _1230.getAttribute, 'call', _1231 => _1231("type")]), () => ( "SOLID"));
|
|
52019
52074
|
for (const [page, notes] of byPage) {
|
|
52020
52075
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
52021
52076
|
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',
|
|
52077
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1232 => _1232.getAttribute, 'call', _1233 => _1233("color")]), () => ( "#000000")) });
|
|
52023
52078
|
let y = top + above + below;
|
|
52024
52079
|
for (const n of notes) {
|
|
52025
52080
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -52055,8 +52110,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
52055
52110
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
52056
52111
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
52057
52112
|
const rules = [];
|
|
52058
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52059
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52113
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1234 => _1234.getAttribute, 'call', _1235 => _1235("width")]), () => ( "0.12"))) || 0.12;
|
|
52114
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1236 => _1236.getAttribute, 'call', _1237 => _1237("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', _1238 => _1238.getAttribute, 'call', _1239 => _1239("color")]), () => ( "#000000")) });
|
|
52060
52115
|
y += below;
|
|
52061
52116
|
const next = () => {
|
|
52062
52117
|
if (++col >= nCol) {
|
|
@@ -52150,7 +52205,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52150
52205
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52151
52206
|
});
|
|
52152
52207
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52153
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
52208
|
+
if (_optionalChain([findChildByLocalName, 'call', _1240 => _1240(tbl2, "pos"), 'optionalAccess', _1241 => _1241.getAttribute, 'call', _1242 => _1242("treatAsChar")]) === "1") {
|
|
52154
52209
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
52155
52210
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
52156
52211
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -52206,7 +52261,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52206
52261
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
52207
52262
|
if (!b) continue;
|
|
52208
52263
|
const f = floatSpan(b.seg, y + c.marginT);
|
|
52209
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
52264
|
+
if (_optionalChain([f, 'optionalAccess', _1243 => _1243.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
52210
52265
|
lead = f.pages;
|
|
52211
52266
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
52212
52267
|
led.add(b.seg);
|
|
@@ -52223,8 +52278,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52223
52278
|
for (const c of rowCells) {
|
|
52224
52279
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
52225
52280
|
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',
|
|
52281
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1244 => _1244[0], 'optionalAccess', _1245 => _1245.origin]), () => ( _optionalChain([next, 'optionalAccess', _1246 => _1246.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
52282
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1247 => _1247.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
52228
52283
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
52229
52284
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
52230
52285
|
}
|
|
@@ -52235,7 +52290,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52235
52290
|
if (!last) {
|
|
52236
52291
|
let span2 = 0, spanEnd = 0;
|
|
52237
52292
|
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',
|
|
52293
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1248 => _1248[0], 'optionalAccess', _1249 => _1249.origin]), () => ( 0));
|
|
52239
52294
|
for (const b of bs) {
|
|
52240
52295
|
if (led.has(b.seg)) continue;
|
|
52241
52296
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from);
|
|
@@ -52400,7 +52455,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
52400
52455
|
function shapeFill(el, defs, images, warn) {
|
|
52401
52456
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
52402
52457
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
52403
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
52458
|
+
const face = _optionalChain([win, 'optionalAccess', _1250 => _1250.getAttribute, 'call', _1251 => _1251("faceColor")]);
|
|
52404
52459
|
if (docColor(face)) return esc(face);
|
|
52405
52460
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
52406
52461
|
if (grad) {
|
|
@@ -52451,8 +52506,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52451
52506
|
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
52507
|
const { x, y } = geometry;
|
|
52453
52508
|
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',
|
|
52509
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1252 => _1252.getAttribute, 'call', _1253 => _1253("style")]), () => ( "SOLID"));
|
|
52510
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1254 => _1254.getAttribute, 'call', _1255 => _1255("color")]), "#000000"));
|
|
52456
52511
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
52457
52512
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
52458
52513
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -52484,6 +52539,49 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52484
52539
|
return { ...geometry, svg };
|
|
52485
52540
|
}
|
|
52486
52541
|
|
|
52542
|
+
// src/render/object-anchor.ts
|
|
52543
|
+
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52544
|
+
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
52545
|
+
const pos = findChildByLocalName(o.el, "pos");
|
|
52546
|
+
const om = findChildByLocalName(o.el, "outMargin");
|
|
52547
|
+
const omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
52548
|
+
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
52549
|
+
if (!pos) return { x: ox, y: oy + baseV };
|
|
52550
|
+
const voRaw = num2(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
52551
|
+
const vo = (_nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"))) === "PARA" ? Math.max(0, voS) : voS;
|
|
52552
|
+
const ho = num2(pos, "horzOffset");
|
|
52553
|
+
const vrel = _nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"));
|
|
52554
|
+
const hrel = _nullishCoalesce(pos.getAttribute("horzRelTo"), () => ( "PARA"));
|
|
52555
|
+
const va = _nullishCoalesce(pos.getAttribute("vertAlign"), () => ( "TOP"));
|
|
52556
|
+
const ha = _nullishCoalesce(pos.getAttribute("horzAlign"), () => ( "LEFT"));
|
|
52557
|
+
const wrap = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52558
|
+
let y;
|
|
52559
|
+
if (vrel === "PAPER") {
|
|
52560
|
+
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
52561
|
+
} else if (vrel === "PAGE") {
|
|
52562
|
+
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
52563
|
+
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
52564
|
+
const lineV = _nullishCoalesce(anchorLineV, () => ( baseV));
|
|
52565
|
+
const pushed = lineV - (omT + h + omB);
|
|
52566
|
+
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
52567
|
+
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
52568
|
+
y = oy + anchor + omT + vo;
|
|
52569
|
+
} else {
|
|
52570
|
+
const origin = vrel === "PARA" && wrap === "SQUARE" ? _nullishCoalesce(paraStartV, () => ( baseV)) : baseV;
|
|
52571
|
+
y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
52572
|
+
}
|
|
52573
|
+
let x;
|
|
52574
|
+
const omL = num2(om, "left"), omR = num2(om, "right");
|
|
52575
|
+
if (hrel === "PAGE") {
|
|
52576
|
+
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52577
|
+
} else if (hrel === "PAPER") {
|
|
52578
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1256 => _1256.bodyDx, 'optionalCall', _1257 => _1257(ctx.page)]), () => ( 0)));
|
|
52579
|
+
} else {
|
|
52580
|
+
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52581
|
+
}
|
|
52582
|
+
return { x, y };
|
|
52583
|
+
}
|
|
52584
|
+
|
|
52487
52585
|
// src/render/svg-render.ts
|
|
52488
52586
|
function escapeXml7(s) {
|
|
52489
52587
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -52531,9 +52629,9 @@ function planLines(m, styles, numText = "") {
|
|
|
52531
52629
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52532
52630
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52533
52631
|
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',
|
|
52632
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1258 => _1258.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1259 => _1259.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
52633
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1260 => _1260.chars, 'access', _1261 => _1261.find, 'call', _1262 => _1262((c) => c.ch !== ""), 'optionalAccess', _1263 => _1263.prId]), () => ( null));
|
|
52634
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1264 => _1264.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
52537
52635
|
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
52636
|
const plans = [];
|
|
52539
52637
|
for (let i = 0; i < m.segs.length; i++) {
|
|
@@ -52541,8 +52639,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52541
52639
|
const start = seg.textpos;
|
|
52542
52640
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52543
52641
|
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',
|
|
52642
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1265 => _1265.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1266 => _1266.autoIndent]) ? bulletW : 0);
|
|
52643
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1267 => _1267.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1268 => _1268.autoIndent]) ? bulletW : 0);
|
|
52546
52644
|
let fixedTo = start;
|
|
52547
52645
|
let fixedW = 0;
|
|
52548
52646
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52638,7 +52736,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52638
52736
|
let i = plan.start;
|
|
52639
52737
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52640
52738
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52641
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
52739
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1269 => _1269.styles, 'access', _1270 => _1270.paraGeom, 'access', _1271 => _1271.get, 'call', _1272 => _1272(m.paraPrId), 'optionalAccess', _1273 => _1273.vertAlign]) : void 0;
|
|
52642
52740
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52643
52741
|
if (plan.bullet) {
|
|
52644
52742
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -52723,7 +52821,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52723
52821
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52724
52822
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52725
52823
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52726
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
52824
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkK2NWHLCDcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52727
52825
|
ctx.stats.texts++;
|
|
52728
52826
|
}
|
|
52729
52827
|
return sw;
|
|
@@ -52792,26 +52890,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52792
52890
|
anchorLineH = pl.seg.textheight;
|
|
52793
52891
|
}
|
|
52794
52892
|
let objBaseV = baseV;
|
|
52795
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
52893
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1274 => _1274.paraTops, 'optionalAccess', _1275 => _1275.get, 'call', _1276 => _1276(p)]) : void 0;
|
|
52796
52894
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52797
52895
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
52798
52896
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
52799
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52897
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1277 => _1277.styles, 'access', _1278 => _1278.paraGeom, 'access', _1279 => _1279.get, 'call', _1280 => _1280(m.paraPrId), 'optionalAccess', _1281 => _1281.spaceBefore]), () => ( 0)) : 0);
|
|
52800
52898
|
if (baseV > start + 100) {
|
|
52801
52899
|
objBaseV = start;
|
|
52802
52900
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
52803
52901
|
}
|
|
52804
52902
|
}
|
|
52805
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52903
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1282 => _1282(q.el, "pos"), 'optionalAccess', _1283 => _1283.getAttribute, 'call', _1284 => _1284("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
52806
52904
|
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',
|
|
52905
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1285 => _1285.styles, 'access', _1286 => _1286.paraGeom, 'access', _1287 => _1287.get, 'call', _1288 => _1288(m.paraPrId), 'optionalAccess', _1289 => _1289.spaceBefore]), () => ( 0)) : 0;
|
|
52808
52906
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
52809
|
-
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);
|
|
52907
|
+
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, (firstLine || wrapA === "SQUARE") && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
52810
52908
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
52811
52909
|
if (!tbStack) {
|
|
52812
52910
|
tbStack = /* @__PURE__ */ new Map();
|
|
52813
52911
|
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',
|
|
52912
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1290 => _1290(q.el, "pos"), 'optionalAccess', _1291 => _1291.getAttribute, 'call', _1292 => _1292("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1293 => _1293(q.el, "pos"), 'optionalAccess', _1294 => _1294.getAttribute, 'call', _1295 => _1295("allowOverlap")]) !== "1");
|
|
52815
52913
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
52816
52914
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
52817
52915
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -52822,7 +52920,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52822
52920
|
const st = tbStack.get(o.el);
|
|
52823
52921
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
52824
52922
|
}
|
|
52825
|
-
const moved = _optionalChain([ctx, 'access',
|
|
52923
|
+
const moved = _optionalChain([ctx, 'access', _1296 => _1296.objPlace, 'optionalAccess', _1297 => _1297.get, 'call', _1298 => _1298(o.el)]);
|
|
52826
52924
|
if (moved) {
|
|
52827
52925
|
const pg = ctx.page;
|
|
52828
52926
|
ctx.page = moved.page;
|
|
@@ -52841,47 +52939,7 @@ function cellParaTop(p, geom) {
|
|
|
52841
52939
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
52842
52940
|
if (!segs.length) return void 0;
|
|
52843
52941
|
const last = segs[segs.length - 1];
|
|
52844
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
52845
|
-
}
|
|
52846
|
-
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52847
|
-
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
52848
|
-
const pos = findChildByLocalName(o.el, "pos");
|
|
52849
|
-
const om = findChildByLocalName(o.el, "outMargin");
|
|
52850
|
-
const omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
52851
|
-
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
52852
|
-
if (!pos) return { x: ox, y: oy + baseV };
|
|
52853
|
-
const voRaw = num2(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
52854
|
-
const vo = (_nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"))) === "PARA" ? Math.max(0, voS) : voS;
|
|
52855
|
-
const ho = num2(pos, "horzOffset");
|
|
52856
|
-
const vrel = _nullishCoalesce(pos.getAttribute("vertRelTo"), () => ( "PARA"));
|
|
52857
|
-
const hrel = _nullishCoalesce(pos.getAttribute("horzRelTo"), () => ( "PARA"));
|
|
52858
|
-
const va = _nullishCoalesce(pos.getAttribute("vertAlign"), () => ( "TOP"));
|
|
52859
|
-
const ha = _nullishCoalesce(pos.getAttribute("horzAlign"), () => ( "LEFT"));
|
|
52860
|
-
const wrap = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52861
|
-
let y;
|
|
52862
|
-
if (vrel === "PAPER") {
|
|
52863
|
-
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
52864
|
-
} else if (vrel === "PAGE") {
|
|
52865
|
-
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
52866
|
-
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
52867
|
-
const lineV = _nullishCoalesce(anchorLineV, () => ( baseV));
|
|
52868
|
-
const pushed = lineV - (omT + h + omB);
|
|
52869
|
-
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
52870
|
-
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
52871
|
-
y = oy + anchor + omT + vo;
|
|
52872
|
-
} else {
|
|
52873
|
-
y = oy + Math.max(baseV + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
52874
|
-
}
|
|
52875
|
-
let x;
|
|
52876
|
-
const omL = num2(om, "left"), omR = num2(om, "right");
|
|
52877
|
-
if (hrel === "PAGE") {
|
|
52878
|
-
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52879
|
-
} else if (hrel === "PAPER") {
|
|
52880
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1296 => _1296.bodyDx, 'optionalCall', _1297 => _1297(ctx.page)]), () => ( 0)));
|
|
52881
|
-
} else {
|
|
52882
|
-
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52883
|
-
}
|
|
52884
|
-
return { x, y };
|
|
52942
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1299 => _1299.get, 'call', _1300 => _1300(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1301 => _1301.spaceAfter]), () => ( 0)));
|
|
52885
52943
|
}
|
|
52886
52944
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
52887
52945
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -52922,7 +52980,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52922
52980
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
52923
52981
|
}
|
|
52924
52982
|
} else if (o.tag === "equation") {
|
|
52925
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52983
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1302 => _1302(o.el, "script"), 'optionalAccess', _1303 => _1303.textContent]), () => ( ""));
|
|
52926
52984
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
52927
52985
|
if (text && o.width > 0) {
|
|
52928
52986
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53025,7 +53083,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53025
53083
|
}
|
|
53026
53084
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53027
53085
|
return (seg, top) => {
|
|
53028
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53086
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1304 => _1304.parentNode]);
|
|
53029
53087
|
if (!p || ln(p) !== "p") return void 0;
|
|
53030
53088
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53031
53089
|
const m = buildPara(p);
|
|
@@ -53033,10 +53091,10 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53033
53091
|
for (const o of m.objs) {
|
|
53034
53092
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53035
53093
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53036
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53094
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1305 => _1305.getAttribute, 'call', _1306 => _1306("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53037
53095
|
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
53096
|
if (segK !== k) continue;
|
|
53039
|
-
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53097
|
+
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1307 => _1307.getAttribute, 'call', _1308 => _1308("vertOffset")]), () => ( void 0)), 0));
|
|
53040
53098
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
|
|
53041
53099
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53042
53100
|
}
|
|
@@ -53068,7 +53126,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53068
53126
|
let hdrRows = 0;
|
|
53069
53127
|
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
53128
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53071
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53129
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1309 => _1309(tbl2, "pos"), 'optionalAccess', _1310 => _1310.getAttribute, 'call', _1311 => _1311("treatAsChar")]) !== "1";
|
|
53072
53130
|
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
53131
|
const splitSaved = ctx.splitCell;
|
|
53074
53132
|
ctx.splitCell = false;
|
|
@@ -53090,7 +53148,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53090
53148
|
for (const g3 of geom) {
|
|
53091
53149
|
ctx.page = g3.page;
|
|
53092
53150
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53093
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53151
|
+
if (_optionalChain([bf, 'optionalAccess', _1312 => _1312.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
53152
|
}
|
|
53095
53153
|
for (const g3 of geom) {
|
|
53096
53154
|
const { c } = g3;
|
|
@@ -53101,13 +53159,13 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53101
53159
|
const boxes = cellLineBoxes(c);
|
|
53102
53160
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53103
53161
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53104
|
-
const r = _optionalChain([pc, 'access',
|
|
53162
|
+
const r = _optionalChain([pc, 'access', _1313 => _1313.range, 'optionalAccess', _1314 => _1314.get, 'call', _1315 => _1315(c.el)]);
|
|
53105
53163
|
return !!r && v >= r[0] && v < r[1];
|
|
53106
53164
|
}));
|
|
53107
53165
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53108
53166
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53109
53167
|
if (va2 === "TOP") return 0;
|
|
53110
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53168
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1316 => _1316.range, 'optionalAccess', _1317 => _1317.get, 'call', _1318 => _1318(c.el), 'optionalAccess', _1319 => _1319[0]]), () => ( 0));
|
|
53111
53169
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53112
53170
|
if (!bottoms.length) return 0;
|
|
53113
53171
|
const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
|
|
@@ -53120,7 +53178,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53120
53178
|
const pages = segs.map((sg) => {
|
|
53121
53179
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53122
53180
|
const k = pieceOf(v);
|
|
53123
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53181
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1320 => _1320.range, 'optionalAccess', _1321 => _1321.get, 'call', _1322 => _1322(c.el), 'optionalAccess', _1323 => _1323[0]]), () => ( 0));
|
|
53124
53182
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53125
53183
|
return startPage + pc.page;
|
|
53126
53184
|
});
|
|
@@ -53212,7 +53270,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53212
53270
|
}
|
|
53213
53271
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53214
53272
|
const img = findFirst(pic, "img");
|
|
53215
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53273
|
+
const ref = _optionalChain([img, 'optionalAccess', _1324 => _1324.getAttribute, 'call', _1325 => _1325("binaryItemIDRef")]);
|
|
53216
53274
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53217
53275
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53218
53276
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53258,12 +53316,12 @@ function readSectionGeom(root) {
|
|
|
53258
53316
|
const pagePr = findFirst(root, "pagePr");
|
|
53259
53317
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53260
53318
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53261
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53319
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1326 => _1326.getAttribute, 'call', _1327 => _1327("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53262
53320
|
const t = PW;
|
|
53263
53321
|
PW = PH;
|
|
53264
53322
|
PH = t;
|
|
53265
53323
|
}
|
|
53266
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53324
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1328 => _1328.getAttribute, 'call', _1329 => _1329("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53267
53325
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53268
53326
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53269
53327
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53394,7 +53452,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53394
53452
|
for (const o of m0.objs) {
|
|
53395
53453
|
if (o.tag !== "tbl") continue;
|
|
53396
53454
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53397
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53455
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1330 => _1330.getAttribute, 'call', _1331 => _1331("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53398
53456
|
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
53457
|
const segV = num2(segEls[segK], "vertpos");
|
|
53400
53458
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -53402,9 +53460,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53402
53460
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53403
53461
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53404
53462
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53405
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
53463
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1332 => _1332.get, 'call', _1333 => _1333(m0.paraPrId), 'optionalAccess', _1334 => _1334.spaceBefore]), () => ( 0)) : 0;
|
|
53406
53464
|
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',
|
|
53465
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1335 => _1335.getAttribute, 'call', _1336 => _1336("vertOffset")]), () => ( void 0)), 0));
|
|
53408
53466
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53409
53467
|
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
53468
|
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 +53489,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53431
53489
|
for (const p of elements(root)) {
|
|
53432
53490
|
if (ln(p) !== "p") continue;
|
|
53433
53491
|
const pg = paraSegPages.get(p);
|
|
53434
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53492
|
+
if (!_optionalChain([pg, 'optionalAccess', _1337 => _1337.length])) continue;
|
|
53435
53493
|
const pm = buildPara(p);
|
|
53436
53494
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53437
53495
|
}
|
|
@@ -53448,7 +53506,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53448
53506
|
for (const p of elements(root)) {
|
|
53449
53507
|
if (ln(p) !== "p") continue;
|
|
53450
53508
|
const pg = paraSegPages.get(p);
|
|
53451
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53509
|
+
if (!_optionalChain([pg, 'optionalAccess', _1338 => _1338.includes, 'call', _1339 => _1339(lastContent)])) continue;
|
|
53452
53510
|
const pm = buildPara(p);
|
|
53453
53511
|
pm.segs.forEach((sg, k) => {
|
|
53454
53512
|
if (pg[k] !== lastContent) return;
|
|
@@ -53468,7 +53526,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53468
53526
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53469
53527
|
const ctx = {
|
|
53470
53528
|
...ctxBase,
|
|
53471
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53529
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1340 => _1340.pageCount]), () => ( 0))) }, () => []),
|
|
53472
53530
|
page: 0,
|
|
53473
53531
|
geom,
|
|
53474
53532
|
pageH,
|
|
@@ -53526,7 +53584,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53526
53584
|
ctx.bodyDx = void 0;
|
|
53527
53585
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53528
53586
|
const allPages = new Map(paraSegPages);
|
|
53529
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53587
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1341 => _1341.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53530
53588
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53531
53589
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53532
53590
|
ctx.page = 0;
|
|
@@ -53595,7 +53653,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53595
53653
|
let decl;
|
|
53596
53654
|
const hidden = /* @__PURE__ */ new Set();
|
|
53597
53655
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53598
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
53656
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1342 => _1342.get, 'call', _1343 => _1343(p), 'optionalAccess', _1344 => _1344[0]]), () => ( 0));
|
|
53599
53657
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53600
53658
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53601
53659
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53656,22 +53714,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53656
53714
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53657
53715
|
ctxBase.pageBase += pages.length;
|
|
53658
53716
|
}
|
|
53659
|
-
if (rendered.length === 0) throw new (0,
|
|
53717
|
+
if (rendered.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53660
53718
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53661
53719
|
}
|
|
53662
53720
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53663
53721
|
async function renderHwpxInternal(input, options) {
|
|
53664
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
53722
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1345 => _1345.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53665
53723
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53666
|
-
|
|
53724
|
+
_chunkMJSHXESKcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53667
53725
|
let zip;
|
|
53668
53726
|
try {
|
|
53669
53727
|
zip = await _jszip2.default.loadAsync(input);
|
|
53670
53728
|
} catch (e43) {
|
|
53671
|
-
throw new (0,
|
|
53729
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53672
53730
|
}
|
|
53673
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53674
|
-
if (secFiles.length === 0) throw new (0,
|
|
53731
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkMJSHXESKcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53732
|
+
if (secFiles.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53675
53733
|
const warnings = [];
|
|
53676
53734
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53677
53735
|
const verFile = zip.file("version.xml");
|
|
@@ -53682,14 +53740,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53682
53740
|
const secXmls = [];
|
|
53683
53741
|
for (const f of secFiles) {
|
|
53684
53742
|
const xml = await readZipEntry(f, "text");
|
|
53685
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53743
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53686
53744
|
secXmls.push(xml);
|
|
53687
53745
|
}
|
|
53688
53746
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53689
53747
|
const masterXmls = [];
|
|
53690
53748
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53691
53749
|
const xml = await readZipEntry(file, "text");
|
|
53692
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53750
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53693
53751
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53694
53752
|
if (root && ln(root) === "masterPage") {
|
|
53695
53753
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53717,7 +53775,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53717
53775
|
let href = binmap.get(ref);
|
|
53718
53776
|
if (!href) {
|
|
53719
53777
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
53720
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
53778
|
+
href = _optionalChain([cand, 'optionalAccess', _1346 => _1346.name]);
|
|
53721
53779
|
}
|
|
53722
53780
|
if (!href) continue;
|
|
53723
53781
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -53739,7 +53797,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53739
53797
|
for (let si = 0; si < secXmls.length; si++) {
|
|
53740
53798
|
const secXml = secXmls[si];
|
|
53741
53799
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
53742
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
53800
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1347 => _1347.reflow])) {
|
|
53743
53801
|
noCacheSkipped = true;
|
|
53744
53802
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
53745
53803
|
continue;
|
|
@@ -53756,11 +53814,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
53756
53814
|
}
|
|
53757
53815
|
if (roots.length === 0) {
|
|
53758
53816
|
if (noCacheSkipped) {
|
|
53759
|
-
throw new (0,
|
|
53817
|
+
throw new (0, _chunkMJSHXESKcjs.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
53818
|
}
|
|
53761
|
-
throw new (0,
|
|
53819
|
+
throw new (0, _chunkMJSHXESKcjs.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
53820
|
}
|
|
53763
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
53821
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1348 => _1348.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1349 => _1349.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1350 => _1350.highlights]) });
|
|
53764
53822
|
}
|
|
53765
53823
|
async function renderHwpxToSvg(input, options) {
|
|
53766
53824
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -53983,7 +54041,7 @@ var FOLD_END = 42124;
|
|
|
53983
54041
|
var FOLD_SHIFT = 983040 - 40960;
|
|
53984
54042
|
function textChar(ch) {
|
|
53985
54043
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
53986
|
-
const mapped =
|
|
54044
|
+
const mapped = _chunkK2NWHLCDcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
53987
54045
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
53988
54046
|
}
|
|
53989
54047
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54075,7 +54133,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54075
54133
|
out += run.join("") + "</hp:run>";
|
|
54076
54134
|
run = [];
|
|
54077
54135
|
};
|
|
54078
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54136
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1351 => _1351[0], 'optionalAccess', _1352 => _1352[1]]), () => ( 0)));
|
|
54079
54137
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54080
54138
|
const switchShape = () => {
|
|
54081
54139
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54161,7 +54219,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54161
54219
|
closeRun();
|
|
54162
54220
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54163
54221
|
if (rest.length > 0) {
|
|
54164
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54222
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1353 => _1353[0], 'optionalAccess', _1354 => _1354[1]]), () => ( 0)));
|
|
54165
54223
|
for (const c of rest) {
|
|
54166
54224
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54167
54225
|
run.push(el);
|
|
@@ -54327,14 +54385,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54327
54385
|
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
54386
|
}
|
|
54329
54387
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54330
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54388
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1355 => _1355.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54331
54389
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54332
54390
|
const images = /* @__PURE__ */ new Map();
|
|
54333
54391
|
let totalImgBytes = 0;
|
|
54334
54392
|
const imageRef = (binDataId) => {
|
|
54335
54393
|
if (binDataId <= 0) return null;
|
|
54336
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54337
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
54394
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1356 => _1356.binData, 'access', _1357 => _1357[binDataId - 1]]);
|
|
54395
|
+
if (_optionalChain([item, 'optionalAccess', _1358 => _1358.kind]) === "link") return null;
|
|
54338
54396
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54339
54397
|
const ref = `bin${storageId}`;
|
|
54340
54398
|
if (images.has(ref)) return ref;
|
|
@@ -54368,8 +54426,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54368
54426
|
}
|
|
54369
54427
|
roots.push({ root, index: si });
|
|
54370
54428
|
}
|
|
54371
|
-
if (roots.length === 0) throw new (0,
|
|
54372
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54429
|
+
if (roots.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54430
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1359 => _1359.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1360 => _1360.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1361 => _1361.highlights]) });
|
|
54373
54431
|
return assemblePageSvgs(r, "hwp", select);
|
|
54374
54432
|
}
|
|
54375
54433
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54381,7 +54439,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54381
54439
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54382
54440
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54383
54441
|
const sections = readHwp5SectionStreams(c);
|
|
54384
|
-
if (sections.length === 0) throw new (0,
|
|
54442
|
+
if (sections.length === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54385
54443
|
const parseWarnings = [];
|
|
54386
54444
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54387
54445
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54467,14 +54525,14 @@ async function loadSharp() {
|
|
|
54467
54525
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54468
54526
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54469
54527
|
} 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.' +
|
|
54528
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(
|
|
54529
|
+
'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.' + _chunkMJSHXESKcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54472
54530
|
);
|
|
54473
54531
|
}
|
|
54474
54532
|
}
|
|
54475
54533
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54476
54534
|
const sharp = await loadSharp();
|
|
54477
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54535
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkMJSHXESKcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54478
54536
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54479
54537
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54480
54538
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54492,11 +54550,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54492
54550
|
try {
|
|
54493
54551
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54494
54552
|
} catch (e47) {
|
|
54495
|
-
throw new (0,
|
|
54553
|
+
throw new (0, _chunkMJSHXESKcjs.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
54554
|
}
|
|
54497
54555
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54498
54556
|
if (!executablePath) {
|
|
54499
|
-
throw new (0,
|
|
54557
|
+
throw new (0, _chunkMJSHXESKcjs.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
54558
|
}
|
|
54501
54559
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54502
54560
|
try {
|
|
@@ -54512,13 +54570,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54512
54570
|
async function loadBuffer(input) {
|
|
54513
54571
|
if (typeof input === "string") {
|
|
54514
54572
|
try {
|
|
54515
|
-
return
|
|
54573
|
+
return _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54516
54574
|
} catch (err) {
|
|
54517
54575
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54518
|
-
throw new (0,
|
|
54576
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54519
54577
|
}
|
|
54520
54578
|
}
|
|
54521
|
-
if (Buffer.isBuffer(input)) return
|
|
54579
|
+
if (Buffer.isBuffer(input)) return _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, input);
|
|
54522
54580
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54523
54581
|
return input;
|
|
54524
54582
|
}
|
|
@@ -54527,17 +54585,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54527
54585
|
if (format2 === "hwpx") {
|
|
54528
54586
|
const zip = await detectZipFormat(buffer);
|
|
54529
54587
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54530
|
-
throw new (0,
|
|
54588
|
+
throw new (0, _chunkMJSHXESKcjs.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
54589
|
}
|
|
54532
54590
|
if (format2 === "hwp") return "hwp";
|
|
54533
|
-
throw new (0,
|
|
54591
|
+
throw new (0, _chunkMJSHXESKcjs.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
54592
|
}
|
|
54535
54593
|
async function renderDocumentToScene(input, options = {}) {
|
|
54536
54594
|
const buffer = await loadBuffer(input);
|
|
54537
54595
|
const source = await sourceFormatOf(buffer);
|
|
54538
54596
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54539
54597
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54540
|
-
if (set.size === 0) throw new (0,
|
|
54598
|
+
if (set.size === 0) throw new (0, _chunkMJSHXESKcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54541
54599
|
return set;
|
|
54542
54600
|
} : void 0;
|
|
54543
54601
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54573,7 +54631,7 @@ async function renderDocument(input, options) {
|
|
|
54573
54631
|
break;
|
|
54574
54632
|
}
|
|
54575
54633
|
default:
|
|
54576
|
-
throw new (0,
|
|
54634
|
+
throw new (0, _chunkMJSHXESKcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54577
54635
|
}
|
|
54578
54636
|
return { scene, assets };
|
|
54579
54637
|
}
|
|
@@ -54603,7 +54661,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54603
54661
|
const out = [];
|
|
54604
54662
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54605
54663
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54606
|
-
if (!meta) throw new (0,
|
|
54664
|
+
if (!meta) throw new (0, _chunkMJSHXESKcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54607
54665
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54608
54666
|
for (const { region, bbox } of items) {
|
|
54609
54667
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54627,9 +54685,9 @@ function wantsCrop(kind, policy) {
|
|
|
54627
54685
|
}
|
|
54628
54686
|
async function extractTables(input, options = {}) {
|
|
54629
54687
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54630
|
-
const buffer = typeof input === "string" ?
|
|
54688
|
+
const buffer = typeof input === "string" ? _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, input) : input;
|
|
54631
54689
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54632
|
-
if (!parsed.success) throw new (0,
|
|
54690
|
+
if (!parsed.success) throw new (0, _chunkMJSHXESKcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54633
54691
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54634
54692
|
const out = blocks.map((b, i) => ({
|
|
54635
54693
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54687,22 +54745,22 @@ async function extractTables(input, options = {}) {
|
|
|
54687
54745
|
// src/index.ts
|
|
54688
54746
|
async function parse(input, options) {
|
|
54689
54747
|
let buffer;
|
|
54690
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54691
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
54748
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1362 => _1362.filePath]) ? { ...options, filePath: input } : options;
|
|
54749
|
+
if (_optionalChain([opts, 'optionalAccess', _1363 => _1363.htmlTables]) && opts.tableFormat) {
|
|
54692
54750
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54693
54751
|
}
|
|
54694
|
-
const ocrOptionError =
|
|
54752
|
+
const ocrOptionError = _chunkK2NWHLCDcjs.validateOcrOptions.call(void 0, opts);
|
|
54695
54753
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54696
54754
|
if (typeof input === "string") {
|
|
54697
54755
|
try {
|
|
54698
54756
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54699
|
-
buffer =
|
|
54757
|
+
buffer = _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, buf);
|
|
54700
54758
|
} catch (err) {
|
|
54701
54759
|
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:
|
|
54760
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54703
54761
|
}
|
|
54704
54762
|
} else if (Buffer.isBuffer(input)) {
|
|
54705
|
-
buffer =
|
|
54763
|
+
buffer = _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, input);
|
|
54706
54764
|
} else {
|
|
54707
54765
|
buffer = input;
|
|
54708
54766
|
}
|
|
@@ -54711,23 +54769,23 @@ async function parse(input, options) {
|
|
|
54711
54769
|
}
|
|
54712
54770
|
const format2 = detectFormat(buffer);
|
|
54713
54771
|
const result = await dispatch(format2, buffer, opts);
|
|
54714
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54772
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1364 => _1364.images]) === false) {
|
|
54715
54773
|
delete result.images;
|
|
54716
54774
|
dropImageBytes(result.blocks);
|
|
54717
54775
|
}
|
|
54718
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54776
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1365 => _1365.classifyTables])) classifyTableTree(result.blocks);
|
|
54719
54777
|
let out = result;
|
|
54720
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54778
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1366 => _1366.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
54721
54779
|
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
54780
|
}
|
|
54723
54781
|
if (out.success && !out.pages) {
|
|
54724
|
-
const pages =
|
|
54782
|
+
const pages = _chunkVXQWAPC6cjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1367 => _1367.tableFormat]) }));
|
|
54725
54783
|
if (pages) out = { ...out, pages };
|
|
54726
54784
|
}
|
|
54727
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54785
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1368 => _1368.plain])) {
|
|
54728
54786
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
54729
54787
|
}
|
|
54730
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54788
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1369 => _1369.htmlTables])) {
|
|
54731
54789
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
54732
54790
|
}
|
|
54733
54791
|
return out;
|
|
@@ -54772,42 +54830,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54772
54830
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54773
54831
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54774
54832
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54775
|
-
let md2 =
|
|
54776
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
54833
|
+
let md2 = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1370 => _1370.tableFormat]) });
|
|
54834
|
+
if (_optionalChain([options, 'optionalAccess', _1371 => _1371.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1372 => _1372.length])) {
|
|
54777
54835
|
try {
|
|
54778
|
-
md2 =
|
|
54836
|
+
md2 = _chunkVXQWAPC6cjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54779
54837
|
} catch (e48) {
|
|
54780
54838
|
}
|
|
54781
54839
|
}
|
|
54782
54840
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54783
54841
|
}
|
|
54784
54842
|
function scriptsOff(r, off) {
|
|
54785
|
-
return off ?
|
|
54843
|
+
return off ? _chunkK2NWHLCDcjs.stripScriptTags.call(void 0, r) : r;
|
|
54786
54844
|
}
|
|
54787
54845
|
async function parseImage(buffer, options) {
|
|
54788
54846
|
try {
|
|
54789
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
54847
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-UULNAC5Y.cjs")));
|
|
54790
54848
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54791
|
-
|
|
54849
|
+
_chunkK2NWHLCDcjs.stripScriptTags.call(void 0, { blocks });
|
|
54792
54850
|
return {
|
|
54793
54851
|
success: true,
|
|
54794
54852
|
fileType: "image",
|
|
54795
|
-
markdown:
|
|
54853
|
+
markdown: _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1373 => _1373.tableFormat]) }),
|
|
54796
54854
|
blocks,
|
|
54797
54855
|
warnings: warnings.length ? warnings : void 0,
|
|
54798
54856
|
pageCount: 1,
|
|
54799
|
-
..._optionalChain([options, 'optionalAccess',
|
|
54857
|
+
..._optionalChain([options, 'optionalAccess', _1374 => _1374.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
54800
54858
|
};
|
|
54801
54859
|
} catch (err) {
|
|
54802
|
-
return { success: false, fileType: "image", error:
|
|
54860
|
+
return { success: false, fileType: "image", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54803
54861
|
}
|
|
54804
54862
|
}
|
|
54805
54863
|
async function parseHwp3(buffer, options) {
|
|
54806
54864
|
try {
|
|
54807
54865
|
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',
|
|
54866
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1375 => _1375.pageCount]) };
|
|
54809
54867
|
} catch (err) {
|
|
54810
|
-
return { success: false, fileType: "hwp3", error:
|
|
54868
|
+
return { success: false, fileType: "hwp3", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54811
54869
|
}
|
|
54812
54870
|
}
|
|
54813
54871
|
async function parseHwpx(buffer, options) {
|
|
@@ -54815,15 +54873,15 @@ async function parseHwpx(buffer, options) {
|
|
|
54815
54873
|
const doc = await parseHwpxDocument(buffer, options);
|
|
54816
54874
|
const { blocks, metadata, outline, images } = doc;
|
|
54817
54875
|
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',
|
|
54876
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1376 => _1376.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1377 => _1377.pageCount]) }, _optionalChain([options, 'optionalAccess', _1378 => _1378.scriptTags]) === false);
|
|
54819
54877
|
} catch (err) {
|
|
54820
|
-
return { success: false, fileType: "hwpx", error:
|
|
54878
|
+
return { success: false, fileType: "hwpx", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54821
54879
|
}
|
|
54822
54880
|
}
|
|
54823
54881
|
async function parseHwp(buffer, options) {
|
|
54824
54882
|
try {
|
|
54825
54883
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
54826
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
54884
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1379 => _1379.filePath])) {
|
|
54827
54885
|
try {
|
|
54828
54886
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
54829
54887
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -54842,15 +54900,15 @@ async function parseHwp(buffer, options) {
|
|
|
54842
54900
|
}
|
|
54843
54901
|
}
|
|
54844
54902
|
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',
|
|
54903
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1380 => _1380.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1381 => _1381.pageCount]) }, _optionalChain([options, 'optionalAccess', _1382 => _1382.scriptTags]) === false);
|
|
54846
54904
|
} catch (err) {
|
|
54847
|
-
return { success: false, fileType: "hwp", error:
|
|
54905
|
+
return { success: false, fileType: "hwp", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54848
54906
|
}
|
|
54849
54907
|
}
|
|
54850
54908
|
async function parsePdf(buffer, options) {
|
|
54851
54909
|
let parsePdfDocument;
|
|
54852
54910
|
try {
|
|
54853
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
54911
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-ZFXVZZKQ.cjs")));
|
|
54854
54912
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54855
54913
|
} catch (e50) {
|
|
54856
54914
|
return {
|
|
@@ -54862,59 +54920,59 @@ async function parsePdf(buffer, options) {
|
|
|
54862
54920
|
}
|
|
54863
54921
|
try {
|
|
54864
54922
|
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',
|
|
54923
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1383 => _1383.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1384 => _1384.scriptTags]) !== true);
|
|
54866
54924
|
} catch (err) {
|
|
54867
54925
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
54868
|
-
return { success: false, fileType: "pdf", error:
|
|
54926
|
+
return { success: false, fileType: "pdf", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err), isImageBased };
|
|
54869
54927
|
}
|
|
54870
54928
|
}
|
|
54871
54929
|
async function parseXlsx(buffer, options) {
|
|
54872
54930
|
try {
|
|
54873
54931
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
54874
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54932
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1385 => _1385.pageCount]) };
|
|
54875
54933
|
} catch (err) {
|
|
54876
|
-
return { success: false, fileType: "xlsx", error:
|
|
54934
|
+
return { success: false, fileType: "xlsx", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54877
54935
|
}
|
|
54878
54936
|
}
|
|
54879
54937
|
async function parseXls(buffer, options) {
|
|
54880
54938
|
try {
|
|
54881
54939
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
54882
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54940
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1386 => _1386.pageCount]) };
|
|
54883
54941
|
} catch (err) {
|
|
54884
|
-
return { success: false, fileType: "xls", error:
|
|
54942
|
+
return { success: false, fileType: "xls", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54885
54943
|
}
|
|
54886
54944
|
}
|
|
54887
54945
|
async function parseDocx(buffer, options) {
|
|
54888
54946
|
try {
|
|
54889
54947
|
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',
|
|
54948
|
+
return scriptsOff({ success: true, fileType: "docx", 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);
|
|
54891
54949
|
} catch (err) {
|
|
54892
|
-
return { success: false, fileType: "docx", error:
|
|
54950
|
+
return { success: false, fileType: "docx", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54893
54951
|
}
|
|
54894
54952
|
}
|
|
54895
54953
|
async function parsePptx(buffer, options) {
|
|
54896
54954
|
try {
|
|
54897
54955
|
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',
|
|
54956
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1390 => _1390.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1391 => _1391.pageCount]) }, _optionalChain([options, 'optionalAccess', _1392 => _1392.scriptTags]) === false);
|
|
54899
54957
|
} catch (err) {
|
|
54900
|
-
return { success: false, fileType: "pptx", error:
|
|
54958
|
+
return { success: false, fileType: "pptx", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54901
54959
|
}
|
|
54902
54960
|
}
|
|
54903
54961
|
async function parseHwpml(buffer, options) {
|
|
54904
54962
|
try {
|
|
54905
54963
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
54906
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54964
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1393 => _1393.pageCount]) };
|
|
54907
54965
|
} catch (err) {
|
|
54908
|
-
return { success: false, fileType: "hwpml", error:
|
|
54966
|
+
return { success: false, fileType: "hwpml", error: _chunkMJSHXESKcjs.sanitizeError.call(void 0, err), code: _chunkMJSHXESKcjs.classifyError.call(void 0, err) };
|
|
54909
54967
|
}
|
|
54910
54968
|
}
|
|
54911
54969
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
54912
54970
|
let buffer;
|
|
54913
54971
|
if (typeof input === "string") {
|
|
54914
54972
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54915
|
-
buffer =
|
|
54973
|
+
buffer = _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, buf);
|
|
54916
54974
|
} else if (Buffer.isBuffer(input)) {
|
|
54917
|
-
buffer =
|
|
54975
|
+
buffer = _chunkMJSHXESKcjs.toArrayBuffer.call(void 0, input);
|
|
54918
54976
|
} else {
|
|
54919
54977
|
buffer = input;
|
|
54920
54978
|
}
|
|
@@ -54940,7 +54998,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
54940
54998
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54941
54999
|
}
|
|
54942
55000
|
const fill = fillFormFields(parsed.blocks, values);
|
|
54943
|
-
const markdown =
|
|
55001
|
+
const markdown = _chunkK2NWHLCDcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
54944
55002
|
if (outputFormat === "hwpx") {
|
|
54945
55003
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
54946
55004
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55039,5 +55097,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55039
55097
|
|
|
55040
55098
|
|
|
55041
55099
|
|
|
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 =
|
|
55100
|
+
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 = _chunkMJSHXESKcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkK2NWHLCDcjs.blocksToMarkdown; exports.blocksToPages = _chunkVXQWAPC6cjs.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 = _chunkK2NWHLCDcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkK2NWHLCDcjs.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
55101
|
//# sourceMappingURL=index.cjs.map
|