kordoc 4.22.5 → 4.22.7
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/NOTICE +23 -0
- package/README.md +12 -10
- package/dist/{-WFRWBH7T.js → -O7EP5UQ2.js} +12 -12
- package/dist/{chunk-DN55FTJP.js → chunk-5S4UCIGP.js} +2 -2
- package/dist/{chunk-63N6CEJE.js → chunk-5VCZDP2K.js} +2 -2
- package/dist/{chunk-35ZHXEJA.js → chunk-6U2O5LAV.js} +3 -3
- package/dist/{chunk-TOUJCO2P.js → chunk-BFAYABLC.js} +120 -28
- package/dist/chunk-BFAYABLC.js.map +1 -0
- package/dist/{chunk-CW67DAAH.js → chunk-BHSATDA7.js} +12 -3
- package/dist/chunk-BHSATDA7.js.map +1 -0
- package/dist/{chunk-PSORL4PA.js → chunk-BIF35Q4D.js} +21 -16
- package/dist/chunk-BIF35Q4D.js.map +1 -0
- package/dist/{chunk-BHVOY6V4.js → chunk-BYMPPVT3.js} +9 -5
- package/dist/chunk-BYMPPVT3.js.map +1 -0
- package/dist/{chunk-LE4VHWIT.js → chunk-CEOOL37E.js} +4 -4
- package/dist/{chunk-4SUB43EJ.cjs → chunk-CIDWITQN.cjs} +24 -24
- package/dist/chunk-CIDWITQN.cjs.map +1 -0
- package/dist/{chunk-RYKDIUHT.js → chunk-CRMEBMMW.js} +5 -5
- package/dist/{chunk-52HIK4C2.js → chunk-CVKSBUIO.js} +4 -3
- package/dist/chunk-CVKSBUIO.js.map +1 -0
- package/dist/{chunk-U3GUZQ54.js → chunk-D4YBFNWK.js} +35 -75
- package/dist/chunk-D4YBFNWK.js.map +1 -0
- package/dist/{chunk-4TWN7PWJ.js → chunk-DFBGN2TG.js} +2 -2
- package/dist/{chunk-HLPMC7L4.js → chunk-DLAPQKGK.js} +13 -5
- package/dist/chunk-DLAPQKGK.js.map +1 -0
- package/dist/{chunk-C3REGEQO.js → chunk-DXJRDFCT.js} +2 -2
- package/dist/{chunk-C3REGEQO.js.map → chunk-DXJRDFCT.js.map} +1 -1
- package/dist/{chunk-UCK6WGHY.cjs → chunk-F537QK7M.cjs} +3 -3
- package/dist/chunk-F537QK7M.cjs.map +1 -0
- package/dist/{chunk-AS25R4EU.cjs → chunk-FJ45NNLA.cjs} +2 -2
- package/dist/chunk-FJ45NNLA.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-3G3TLZDK.js → chunk-OTCH63U3.js} +2 -2
- package/dist/{chunk-6MQKNB6K.js → chunk-PILIRK7O.js} +3 -3
- package/dist/{chunk-CRSTBATY.js → chunk-QYFBXJGK.js} +2 -2
- package/dist/{chunk-C6B5GWN7.cjs → chunk-R3T4RTQL.cjs} +183 -175
- package/dist/chunk-R3T4RTQL.cjs.map +1 -0
- package/dist/{chunk-SETAYS6P.js → chunk-RHHRVPLL.js} +2 -2
- package/dist/{chunk-YG4GFQB7.cjs → chunk-S34OVRKD.cjs} +125 -33
- package/dist/chunk-S34OVRKD.cjs.map +1 -0
- package/dist/chunk-TK3FDAEE.cjs.map +1 -1
- package/dist/{chunk-N6KXGIIN.cjs → chunk-TN4SSNES.cjs} +3 -3
- package/dist/chunk-TN4SSNES.cjs.map +1 -0
- package/dist/{chunk-3BR7VKWL.js → chunk-V2SJJHJH.js} +112 -24
- package/dist/chunk-V2SJJHJH.js.map +1 -0
- package/dist/{chunk-6MCC2XNB.js → chunk-VYH2ATWU.js} +2 -2
- package/dist/{chunk-2L3Q7REU.js → chunk-WBR62IXV.js} +3 -3
- package/dist/{chunk-3YEL7P4L.js → chunk-YVRARYLN.js} +2 -2
- package/dist/{chunk-T7OZ7X6A.js → chunk-ZNSWN4JM.js} +2 -2
- package/dist/{chunk-CO7O3ZT6.js → chunk-ZW3RY4YT.js} +2 -2
- package/dist/chunks-MPPNEL5A.js +10 -0
- package/dist/cli.js +33 -33
- package/dist/cli.js.map +1 -1
- package/dist/{formula-QZGTF3DZ.cjs → formula-3M6U2J7S.cjs} +9 -9
- package/dist/formula-3M6U2J7S.cjs.map +1 -0
- package/dist/{formula-FSVHUQ6Y.js → formula-EQ2KQA5T.js} +4 -4
- package/dist/{formula-L625ULJP.js → formula-RH55FUJF.js} +3 -3
- package/dist/{image-ocr-AELVAU75.cjs → image-ocr-DP4YTLGN.cjs} +17 -17
- package/dist/image-ocr-DP4YTLGN.cjs.map +1 -0
- package/dist/{image-ocr-QTZNBP5V.js → image-ocr-KIKAO43E.js} +10 -10
- package/dist/{image-ocr-KE3RUS3R.js → image-ocr-LO2GZKA5.js} +6 -6
- package/dist/index.cjs +492 -522
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +41 -71
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +23 -23
- package/dist/{model-bundle-F6TU6ZAV.js → model-bundle-EAQ6LWS5.js} +5 -5
- package/dist/{models-ZHNNVH2W.js → models-ZN6JAI4Q.js} +7 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parse-worker-v2-KQRG3NQO.js → parse-worker-v2-UKFFINUH.js} +14 -14
- package/dist/parse-worker-v2-UKFFINUH.js.map +1 -0
- package/dist/{parser-WNDH2X6N.cjs → parser-CGKXEB3U.cjs} +592 -173
- package/dist/parser-CGKXEB3U.cjs.map +1 -0
- package/dist/{parser-RVMH4PUB.js → parser-DFV3VDWX.js} +452 -33
- package/dist/parser-DFV3VDWX.js.map +1 -0
- package/dist/{parser-WBKVRDPV.js → parser-TJFS44BI.js} +447 -28
- package/dist/parser-TJFS44BI.js.map +1 -0
- package/dist/{pdf-ocr-X5XLGL5J.js → pdf-ocr-CATVQJ2I.js} +6 -6
- package/dist/{pdf-ocr-ZP2CUWSO.js → pdf-ocr-EQXJAKHB.js} +10 -10
- package/dist/pdf-ocr-U5MFMNCW.cjs +31 -0
- package/dist/pdf-ocr-U5MFMNCW.cjs.map +1 -0
- package/dist/{profile-io-B4VSI4LW.js → profile-io-5IG6SSMK.js} +3 -3
- package/dist/{rasterize-Y7NVUVXU.js → rasterize-W4TJFQBT.js} +3 -3
- package/dist/{redact-doc-GIBTFWCO.js → redact-doc-LZ3PY2LX.js} +12 -12
- package/dist/{render-JVCGYRRO.js → render-N2QA335I.js} +7 -7
- package/dist/seal-FYJZMW4G.js +10 -0
- package/dist/{setup-7L7EQPMG.js → setup-5Y2UAWZG.js} +3 -3
- package/dist/visual-VQGE67RU.js +21 -0
- package/dist/{watch-VYMFGX72.js → watch-2MLCRQZQ.js} +13 -13
- package/package.json +1 -1
- package/dist/chunk-3BR7VKWL.js.map +0 -1
- package/dist/chunk-4SUB43EJ.cjs.map +0 -1
- package/dist/chunk-52HIK4C2.js.map +0 -1
- package/dist/chunk-AS25R4EU.cjs.map +0 -1
- package/dist/chunk-BHVOY6V4.js.map +0 -1
- package/dist/chunk-C6B5GWN7.cjs.map +0 -1
- package/dist/chunk-CW67DAAH.js.map +0 -1
- package/dist/chunk-HLPMC7L4.js.map +0 -1
- package/dist/chunk-N6KXGIIN.cjs.map +0 -1
- package/dist/chunk-PSORL4PA.js.map +0 -1
- package/dist/chunk-TOUJCO2P.js.map +0 -1
- package/dist/chunk-U3GUZQ54.js.map +0 -1
- package/dist/chunk-UCK6WGHY.cjs.map +0 -1
- package/dist/chunk-YG4GFQB7.cjs.map +0 -1
- package/dist/chunks-NXABWR6G.js +0 -10
- package/dist/formula-QZGTF3DZ.cjs.map +0 -1
- package/dist/image-ocr-AELVAU75.cjs.map +0 -1
- package/dist/parse-worker-v2-KQRG3NQO.js.map +0 -1
- package/dist/parser-RVMH4PUB.js.map +0 -1
- package/dist/parser-WBKVRDPV.js.map +0 -1
- package/dist/parser-WNDH2X6N.cjs.map +0 -1
- package/dist/pdf-ocr-IOUZTPPH.cjs +0 -31
- package/dist/pdf-ocr-IOUZTPPH.cjs.map +0 -1
- package/dist/seal-WNX2ZJTK.js +0 -10
- package/dist/visual-VPWPXIHN.js +0 -21
- /package/dist/{-WFRWBH7T.js.map → -O7EP5UQ2.js.map} +0 -0
- /package/dist/{chunk-DN55FTJP.js.map → chunk-5S4UCIGP.js.map} +0 -0
- /package/dist/{chunk-63N6CEJE.js.map → chunk-5VCZDP2K.js.map} +0 -0
- /package/dist/{chunk-35ZHXEJA.js.map → chunk-6U2O5LAV.js.map} +0 -0
- /package/dist/{chunk-LE4VHWIT.js.map → chunk-CEOOL37E.js.map} +0 -0
- /package/dist/{chunk-RYKDIUHT.js.map → chunk-CRMEBMMW.js.map} +0 -0
- /package/dist/{chunk-4TWN7PWJ.js.map → chunk-DFBGN2TG.js.map} +0 -0
- /package/dist/{chunk-3G3TLZDK.js.map → chunk-OTCH63U3.js.map} +0 -0
- /package/dist/{chunk-6MQKNB6K.js.map → chunk-PILIRK7O.js.map} +0 -0
- /package/dist/{chunk-CRSTBATY.js.map → chunk-QYFBXJGK.js.map} +0 -0
- /package/dist/{chunk-SETAYS6P.js.map → chunk-RHHRVPLL.js.map} +0 -0
- /package/dist/{chunk-6MCC2XNB.js.map → chunk-VYH2ATWU.js.map} +0 -0
- /package/dist/{chunk-2L3Q7REU.js.map → chunk-WBR62IXV.js.map} +0 -0
- /package/dist/{chunk-3YEL7P4L.js.map → chunk-YVRARYLN.js.map} +0 -0
- /package/dist/{chunk-T7OZ7X6A.js.map → chunk-ZNSWN4JM.js.map} +0 -0
- /package/dist/{chunk-CO7O3ZT6.js.map → chunk-ZW3RY4YT.js.map} +0 -0
- /package/dist/{chunks-NXABWR6G.js.map → chunks-MPPNEL5A.js.map} +0 -0
- /package/dist/{formula-FSVHUQ6Y.js.map → formula-EQ2KQA5T.js.map} +0 -0
- /package/dist/{formula-L625ULJP.js.map → formula-RH55FUJF.js.map} +0 -0
- /package/dist/{image-ocr-QTZNBP5V.js.map → image-ocr-KIKAO43E.js.map} +0 -0
- /package/dist/{image-ocr-KE3RUS3R.js.map → image-ocr-LO2GZKA5.js.map} +0 -0
- /package/dist/{model-bundle-F6TU6ZAV.js.map → model-bundle-EAQ6LWS5.js.map} +0 -0
- /package/dist/{models-ZHNNVH2W.js.map → models-ZN6JAI4Q.js.map} +0 -0
- /package/dist/{pdf-ocr-X5XLGL5J.js.map → pdf-ocr-CATVQJ2I.js.map} +0 -0
- /package/dist/{pdf-ocr-ZP2CUWSO.js.map → pdf-ocr-EQXJAKHB.js.map} +0 -0
- /package/dist/{profile-io-B4VSI4LW.js.map → profile-io-5IG6SSMK.js.map} +0 -0
- /package/dist/{rasterize-Y7NVUVXU.js.map → rasterize-W4TJFQBT.js.map} +0 -0
- /package/dist/{redact-doc-GIBTFWCO.js.map → redact-doc-LZ3PY2LX.js.map} +0 -0
- /package/dist/{render-JVCGYRRO.js.map → render-N2QA335I.js.map} +0 -0
- /package/dist/{seal-WNX2ZJTK.js.map → seal-FYJZMW4G.js.map} +0 -0
- /package/dist/{setup-7L7EQPMG.js.map → setup-5Y2UAWZG.js.map} +0 -0
- /package/dist/{visual-VPWPXIHN.js.map → visual-VQGE67RU.js.map} +0 -0
- /package/dist/{watch-VYMFGX72.js.map → watch-2MLCRQZQ.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkTN4SSNEScjs = require('./chunk-TN4SSNES.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
@@ -37,13 +37,13 @@ var _chunkJ55UQC5Hcjs = require('./chunk-J55UQC5H.cjs');
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
|
|
40
|
-
var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
|
|
41
40
|
|
|
42
41
|
|
|
43
42
|
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
|
|
46
|
+
var _chunkS34OVRKDcjs = require('./chunk-S34OVRKD.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -55,14 +55,20 @@ var _chunkYG4GFQB7cjs = require('./chunk-YG4GFQB7.cjs');
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
var _chunkFJ45NNLAcjs = require('./chunk-FJ45NNLA.cjs');
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
|
|
62
68
|
|
|
63
69
|
// src/plain-markdown.ts
|
|
64
70
|
function toPlainMarkdown(md2) {
|
|
65
|
-
return
|
|
71
|
+
return _chunkS34OVRKDcjs.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
72
|
}
|
|
67
73
|
|
|
68
74
|
// src/html-tables.ts
|
|
@@ -596,9 +602,9 @@ function rawTextContent(node, depth = 0) {
|
|
|
596
602
|
}
|
|
597
603
|
|
|
598
604
|
// src/hwpx/parser-shared.ts
|
|
599
|
-
var MAX_DECOMPRESS_SIZE =
|
|
605
|
+
var MAX_DECOMPRESS_SIZE = _chunkFJ45NNLAcjs.unzipLimitBytes.call(void 0, 256 * 1024 * 1024);
|
|
600
606
|
var MAX_ZIP_ENTRIES = 500;
|
|
601
|
-
var ZipBombError = class extends
|
|
607
|
+
var ZipBombError = class extends _chunkFJ45NNLAcjs.KordocError {
|
|
602
608
|
constructor(message) {
|
|
603
609
|
super(message);
|
|
604
610
|
this.name = "ZipBombError";
|
|
@@ -648,7 +654,7 @@ function createSectionShared() {
|
|
|
648
654
|
function createXmlParser(warnings) {
|
|
649
655
|
return new (0, _xmldom.DOMParser)({
|
|
650
656
|
onError(level, msg2) {
|
|
651
|
-
if (level === "fatalError") throw new (0,
|
|
657
|
+
if (level === "fatalError") throw new (0, _chunkFJ45NNLAcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
|
|
652
658
|
_optionalChain([warnings, 'optionalAccess', _5 => _5.push, 'call', _6 => _6({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
|
|
653
659
|
}
|
|
654
660
|
});
|
|
@@ -683,13 +689,13 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
683
689
|
const startKey = attrOf(inner, "start-key-generation-name");
|
|
684
690
|
const checksumType = attrOf(inner, "checksum-type");
|
|
685
691
|
if (algorithm !== AES256_CBC) {
|
|
686
|
-
throw new (0,
|
|
692
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC554\uD638\uD654 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(algorithm, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
687
693
|
}
|
|
688
694
|
if (startKey !== START_KEY_SHA256) {
|
|
689
|
-
throw new (0,
|
|
695
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uC2DC\uC791\uD0A4 \uC0DD\uC131 \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(startKey, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
690
696
|
}
|
|
691
697
|
if (!_optionalChain([checksumType, 'optionalAccess', _10 => _10.endsWith, 'call', _11 => _11(CHECKSUM_SHA256_1K)])) {
|
|
692
|
-
throw new (0,
|
|
698
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWPX \uCCB4\uD06C\uC12C \uBC29\uC2DD\uC785\uB2C8\uB2E4: ${_nullishCoalesce(checksumType, () => ( "(\uBBF8\uC0C1)"))}`);
|
|
693
699
|
}
|
|
694
700
|
const iterations = parseInt(_nullishCoalesce(attrOf(inner, "iteration-count"), () => ( "")), 10);
|
|
695
701
|
const keySize = parseInt(_nullishCoalesce(attrOf(inner, "key-size"), () => ( "")), 10);
|
|
@@ -697,10 +703,10 @@ function parseEncryptionManifest(manifestXml) {
|
|
|
697
703
|
const salt = Buffer.from(_nullishCoalesce(attrOf(inner, "salt"), () => ( "")), "base64");
|
|
698
704
|
const checksum = Buffer.from(_nullishCoalesce(attrOf(inner, "checksum"), () => ( "")), "base64");
|
|
699
705
|
if (!(iterations > 0 && iterations <= MAX_ITERATION_COUNT)) {
|
|
700
|
-
throw new (0,
|
|
706
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uBC18\uBCF5 \uD69F\uC218\uAC00 \uD5C8\uC6A9 \uBC94\uC704\uB97C \uBC97\uC5B4\uB0AC\uC2B5\uB2C8\uB2E4: ${iterations}`);
|
|
701
707
|
}
|
|
702
708
|
if (keySize !== 32 || iv.length !== 16 || salt.length === 0 || checksum.length !== 32) {
|
|
703
|
-
throw new (0,
|
|
709
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`HWPX \uC554\uD638\uD654 \uD30C\uB77C\uBBF8\uD130\uAC00 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4 (${path})`);
|
|
704
710
|
}
|
|
705
711
|
entries.push({ path, checksum, iv, salt, iterations, keySize });
|
|
706
712
|
}
|
|
@@ -734,12 +740,12 @@ async function decryptHwpxInPlace(zip, manifestXml, password) {
|
|
|
734
740
|
for (const entry of entries) {
|
|
735
741
|
const file = zip.file(entry.path);
|
|
736
742
|
if (!file) {
|
|
737
|
-
throw new (0,
|
|
743
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC554\uD638 \uBAA9\uB85D\uC5D0 \uC788\uB294 \uD30C\uC77C\uC774 \uBB38\uC11C\uC5D0 \uC5C6\uC2B5\uB2C8\uB2E4: ${entry.path}`);
|
|
738
744
|
}
|
|
739
745
|
const raw = await readZipEntry(file, "uint8array", used);
|
|
740
746
|
const plain4 = decryptEntry(Buffer.from(raw.buffer, raw.byteOffset, raw.length), entry, startKey);
|
|
741
747
|
if (!plain4) {
|
|
742
|
-
throw new (0,
|
|
748
|
+
throw new (0, _chunkFJ45NNLAcjs.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
749
|
}
|
|
744
750
|
used += plain4.length;
|
|
745
751
|
if (used > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
@@ -805,10 +811,10 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
805
811
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _12 => _12.total]));
|
|
806
812
|
if (decompressed) {
|
|
807
813
|
decompressed.total += xml.length * 2;
|
|
808
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
814
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
809
815
|
}
|
|
810
816
|
const parser = createXmlParser();
|
|
811
|
-
const doc = parser.parseFromString(
|
|
817
|
+
const doc = parser.parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
812
818
|
if (!doc.documentElement) continue;
|
|
813
819
|
const domDoc = doc;
|
|
814
820
|
parseCharProperties(domDoc, result.charProperties);
|
|
@@ -1021,9 +1027,9 @@ function detectHwpxHeadings(blocks, styleMap, tocTexts) {
|
|
|
1021
1027
|
let level = 0;
|
|
1022
1028
|
if (baseFontSize > 0 && _optionalChain([block, 'access', _21 => _21.style, 'optionalAccess', _22 => _22.fontSize])) {
|
|
1023
1029
|
const ratio = block.style.fontSize / baseFontSize;
|
|
1024
|
-
if (ratio >=
|
|
1025
|
-
else if (ratio >=
|
|
1026
|
-
else if (ratio >=
|
|
1030
|
+
if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H1) level = 1;
|
|
1031
|
+
else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H2) level = 2;
|
|
1032
|
+
else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H3) level = 3;
|
|
1027
1033
|
}
|
|
1028
1034
|
const compactText = text.replace(/\s+/g, "");
|
|
1029
1035
|
if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
|
|
@@ -1626,59 +1632,6 @@ function hmlToLatex(hmlEqStr) {
|
|
|
1626
1632
|
return out;
|
|
1627
1633
|
}
|
|
1628
1634
|
|
|
1629
|
-
// src/shared/numbering.ts
|
|
1630
|
-
var HANGUL_INITIALS = [0, 2, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 18];
|
|
1631
|
-
var HANGUL_MEDIALS = [0, 4, 8, 13, 18, 20];
|
|
1632
|
-
function hangulOrdinal(n) {
|
|
1633
|
-
const cols = HANGUL_INITIALS.length;
|
|
1634
|
-
const vowel = HANGUL_MEDIALS[Math.min(Math.floor(n / cols), HANGUL_MEDIALS.length - 1)];
|
|
1635
|
-
const init = HANGUL_INITIALS[n % cols];
|
|
1636
|
-
return String.fromCodePoint(44032 + init * 588 + vowel * 28);
|
|
1637
|
-
}
|
|
1638
|
-
function circledNumber(n) {
|
|
1639
|
-
if (n < 20) return String.fromCodePoint(9312 + n);
|
|
1640
|
-
if (n < 35) return String.fromCodePoint(12881 + (n - 20));
|
|
1641
|
-
if (n < 50) return String.fromCodePoint(12977 + (n - 35));
|
|
1642
|
-
return `(${n + 1})`;
|
|
1643
|
-
}
|
|
1644
|
-
function circledHangul(n) {
|
|
1645
|
-
return n < 14 ? String.fromCodePoint(12910 + n) : hangulOrdinal(n);
|
|
1646
|
-
}
|
|
1647
|
-
var AMOUNT_DIGITS = "\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C";
|
|
1648
|
-
var AMOUNT_SMALL = ["", "\uC2ED", "\uBC31", "\uCC9C"];
|
|
1649
|
-
var AMOUNT_BIG = ["", "\uB9CC", "\uC5B5", "\uC870", "\uACBD", "\uD574"];
|
|
1650
|
-
function hangulAmount(n) {
|
|
1651
|
-
const digits = String(n).replace(/\D/g, "").replace(/^0+(?=\d)/, "");
|
|
1652
|
-
if (!digits || digits === "0") return "\uC601";
|
|
1653
|
-
const groups = [];
|
|
1654
|
-
for (let end = digits.length; end > 0; end -= 4) groups.unshift(digits.slice(Math.max(0, end - 4), end));
|
|
1655
|
-
let out = "";
|
|
1656
|
-
groups.forEach((g3, i) => {
|
|
1657
|
-
let part = "";
|
|
1658
|
-
const padded = g3.padStart(4, "0");
|
|
1659
|
-
for (let k = 0; k < 4; k++) {
|
|
1660
|
-
const d = Number(padded[k]);
|
|
1661
|
-
if (d) part += AMOUNT_DIGITS[d] + AMOUNT_SMALL[3 - k];
|
|
1662
|
-
}
|
|
1663
|
-
if (part) out += part + (_nullishCoalesce(AMOUNT_BIG[groups.length - 1 - i], () => ( "")));
|
|
1664
|
-
});
|
|
1665
|
-
return out;
|
|
1666
|
-
}
|
|
1667
|
-
function romanNumeral(n, upper) {
|
|
1668
|
-
if (n <= 0 || n > 3999) return String(n);
|
|
1669
|
-
const values = [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1];
|
|
1670
|
-
const symbols = upper ? ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] : ["m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv", "i"];
|
|
1671
|
-
let result = "";
|
|
1672
|
-
let num4 = n;
|
|
1673
|
-
for (let i = 0; i < values.length; i++) {
|
|
1674
|
-
while (num4 >= values[i]) {
|
|
1675
|
-
result += symbols[i];
|
|
1676
|
-
num4 -= values[i];
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
return result;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
1635
|
// src/hwpx/para-heading.ts
|
|
1683
1636
|
var HANGUL_JAMO_SEQ = "\u3131\u3134\u3137\u3139\u3141\u3142\u3145\u3147\u3148\u314A\u314B\u314C\u314D\u314E";
|
|
1684
1637
|
function formatHeadNumber(n, numFormat) {
|
|
@@ -1690,11 +1643,11 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1690
1643
|
// 서수 시퀀스는 생성기(gongmun.ts)와 단일 소스 (v4.0.5) — 종전 mod-14 순환은
|
|
1691
1644
|
// 15번째 형제를 다시 '가'로 만들어 한글 실렌더(가→하→거→너 단모음 연속)와 어긋났다
|
|
1692
1645
|
case "CIRCLED_DIGIT":
|
|
1693
|
-
return n <= 50 ? circledNumber(n - 1) : `(${n})`;
|
|
1646
|
+
return n <= 50 ? _chunkS34OVRKDcjs.circledNumber.call(void 0, n - 1) : `(${n})`;
|
|
1694
1647
|
case "HANGUL_SYLLABLE":
|
|
1695
|
-
return hangulOrdinal(n - 1);
|
|
1648
|
+
return _chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1696
1649
|
case "CIRCLED_HANGUL_SYLLABLE":
|
|
1697
|
-
return n <= 14 ? circledHangul(n - 1) : hangulOrdinal(n - 1);
|
|
1650
|
+
return n <= 14 ? _chunkS34OVRKDcjs.circledHangul.call(void 0, n - 1) : _chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n - 1);
|
|
1698
1651
|
case "HANGUL_JAMO":
|
|
1699
1652
|
return HANGUL_JAMO_SEQ[(n - 1) % HANGUL_JAMO_SEQ.length];
|
|
1700
1653
|
case "CIRCLED_HANGUL_JAMO":
|
|
@@ -1708,9 +1661,9 @@ function formatHeadNumber(n, numFormat) {
|
|
|
1708
1661
|
case "CIRCLED_LATIN_SMALL":
|
|
1709
1662
|
return n <= 26 ? String.fromCodePoint(9424 + n - 1) : String.fromCharCode(97 + (n - 1) % 26);
|
|
1710
1663
|
case "ROMAN_CAPITAL":
|
|
1711
|
-
return romanNumeral(n, true);
|
|
1664
|
+
return _chunkS34OVRKDcjs.romanNumeral.call(void 0, n, true);
|
|
1712
1665
|
case "ROMAN_SMALL":
|
|
1713
|
-
return romanNumeral(n, false);
|
|
1666
|
+
return _chunkS34OVRKDcjs.romanNumeral.call(void 0, n, false);
|
|
1714
1667
|
default:
|
|
1715
1668
|
return String(n);
|
|
1716
1669
|
}
|
|
@@ -1758,7 +1711,7 @@ function resolveParaHeading(paraEl, ctx) {
|
|
|
1758
1711
|
|
|
1759
1712
|
// src/hwpx/table-build.ts
|
|
1760
1713
|
function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraphs) {
|
|
1761
|
-
const table2 =
|
|
1714
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols, keepEmptyParagraphs });
|
|
1762
1715
|
if (state.caption) table2.caption = state.caption;
|
|
1763
1716
|
if (state.sourceId) table2.sourceId = state.sourceId;
|
|
1764
1717
|
if (_optionalChain([state, 'access', _32 => _32.captionBlocks, 'optionalAccess', _33 => _33.length])) table2.captionBlocks = state.captionBlocks;
|
|
@@ -1787,7 +1740,7 @@ function buildTableWithCellMeta(state, keepAnchoredEmptyCols, keepEmptyParagraph
|
|
|
1787
1740
|
for (const src of row) {
|
|
1788
1741
|
if (!src.edges || src.rowAddr === void 0 || src.colAddr === void 0) continue;
|
|
1789
1742
|
const cand = _optionalChain([table2, 'access', _37 => _37.cells, 'access', _38 => _38[src.rowAddr], 'optionalAccess', _39 => _39[src.colAddr]]);
|
|
1790
|
-
if (cand && anchors2.includes(cand))
|
|
1743
|
+
if (cand && anchors2.includes(cand)) _chunkS34OVRKDcjs.CELL_EDGES.set(cand, src.edges);
|
|
1791
1744
|
}
|
|
1792
1745
|
}
|
|
1793
1746
|
const claimed = /* @__PURE__ */ new Set();
|
|
@@ -1837,7 +1790,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
|
|
|
1837
1790
|
const cell2 = parentTable.cell;
|
|
1838
1791
|
(cell2.blocks ??= []).push(block);
|
|
1839
1792
|
cell2.hasStructure = true;
|
|
1840
|
-
let flat =
|
|
1793
|
+
let flat = _chunkS34OVRKDcjs.convertTableToText.call(void 0, newTable.rows);
|
|
1841
1794
|
if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
|
|
1842
1795
|
if (flat) {
|
|
1843
1796
|
const inlineJoin = newTable.inline === true && cell2.lineOpen === true;
|
|
@@ -2071,7 +2024,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2071
2024
|
const tkids = rc.childNodes;
|
|
2072
2025
|
for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _47 => _47.length]), () => ( 0))); k++) {
|
|
2073
2026
|
const tk = tkids[k];
|
|
2074
|
-
if (tk.nodeType === 3 || tk.nodeType === 4) text +=
|
|
2027
|
+
if (tk.nodeType === 3 || tk.nodeType === 4) text += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, tk.textContent || ""));
|
|
2075
2028
|
else if (tk.nodeType === 1) {
|
|
2076
2029
|
const ttag = (tk.tagName || tk.localName || "").replace(/^[^:]+:/, "");
|
|
2077
2030
|
if (ttag === "tab" || ttag === "fwSpace" || ttag === "hwSpace" || ttag === "nbSpace") text += " ";
|
|
@@ -2091,7 +2044,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2091
2044
|
const span2 = { text };
|
|
2092
2045
|
if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span2.code = true;
|
|
2093
2046
|
else {
|
|
2094
|
-
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text =
|
|
2047
|
+
if (_optionalChain([cp, 'optionalAccess', _48 => _48.script])) span2.text = _chunkS34OVRKDcjs.wrapScript.call(void 0, text, cp.script);
|
|
2095
2048
|
if (_optionalChain([cp, 'optionalAccess', _49 => _49.bold])) span2.bold = true;
|
|
2096
2049
|
if (_optionalChain([cp, 'optionalAccess', _50 => _50.italic])) span2.italic = true;
|
|
2097
2050
|
if (_optionalChain([cp, 'optionalAccess', _51 => _51.strike])) span2.strike = true;
|
|
@@ -2111,7 +2064,7 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
|
|
|
2111
2064
|
}
|
|
2112
2065
|
}
|
|
2113
2066
|
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 =
|
|
2067
|
+
for (const s of merged) s.text = _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, s.text);
|
|
2115
2068
|
return merged;
|
|
2116
2069
|
}
|
|
2117
2070
|
function gongmunDepthFromIndent(para2, left, ctx) {
|
|
@@ -2138,7 +2091,7 @@ function gongmunDepthFromIndent(para2, left, ctx) {
|
|
|
2138
2091
|
// src/hwpx/section-walker.ts
|
|
2139
2092
|
function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
|
|
2140
2093
|
const parser = createXmlParser(warnings);
|
|
2141
|
-
const doc = parser.parseFromString(
|
|
2094
|
+
const doc = parser.parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
2142
2095
|
if (!doc.documentElement) return [];
|
|
2143
2096
|
const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
|
|
2144
2097
|
ctx.shared.track.deleteDepth = 0;
|
|
@@ -2239,8 +2192,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
|
|
|
2239
2192
|
const cs = isNaN(rawCs) ? 1 : rawCs;
|
|
2240
2193
|
const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
|
|
2241
2194
|
const rs = isNaN(rawRs) ? 1 : rawRs;
|
|
2242
|
-
tableCtx.cell.colSpan = clampSpan(cs,
|
|
2243
|
-
tableCtx.cell.rowSpan = clampSpan(rs,
|
|
2195
|
+
tableCtx.cell.colSpan = clampSpan(cs, _chunkS34OVRKDcjs.MAX_COLS);
|
|
2196
|
+
tableCtx.cell.rowSpan = clampSpan(rs, _chunkS34OVRKDcjs.MAX_ROWS);
|
|
2244
2197
|
}
|
|
2245
2198
|
break;
|
|
2246
2199
|
case "p": {
|
|
@@ -2563,7 +2516,7 @@ function buildSubListTable(el, ctx, depth) {
|
|
|
2563
2516
|
const sink = [];
|
|
2564
2517
|
const st = { rows: [], currentRow: [], cell: null, sourceId: _nullishCoalesce(el.getAttribute("id"), () => ( void 0)) };
|
|
2565
2518
|
walkSection(el, sink, st, [], ctx, depth + 1);
|
|
2566
|
-
let flat =
|
|
2519
|
+
let flat = _chunkS34OVRKDcjs.convertTableToText.call(void 0, st.rows);
|
|
2567
2520
|
if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
|
|
2568
2521
|
const built = [];
|
|
2569
2522
|
completeTable(st, [], built, ctx);
|
|
@@ -2727,7 +2680,7 @@ function extractHyperlinkHref(fieldBegin) {
|
|
|
2727
2680
|
let url = (ch.textContent || "").trim();
|
|
2728
2681
|
if (!url) continue;
|
|
2729
2682
|
url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
|
|
2730
|
-
const safe =
|
|
2683
|
+
const safe = _chunkFJ45NNLAcjs.sanitizeHref.call(void 0, url);
|
|
2731
2684
|
if (safe) return safe;
|
|
2732
2685
|
}
|
|
2733
2686
|
return void 0;
|
|
@@ -2883,7 +2836,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2883
2836
|
_optionalChain([ctx, 'access', _112 => _112.warnings, 'optionalAccess', _113 => _113.push, 'call', _114 => _114({ page: ctx.page, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
|
|
2884
2837
|
}
|
|
2885
2838
|
} else {
|
|
2886
|
-
text +=
|
|
2839
|
+
text += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, t.replace(/\x1E/g, "")));
|
|
2887
2840
|
}
|
|
2888
2841
|
continue;
|
|
2889
2842
|
}
|
|
@@ -2926,6 +2879,10 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2926
2879
|
case "tbl":
|
|
2927
2880
|
if (isInlineTbl(child)) text += "";
|
|
2928
2881
|
break;
|
|
2882
|
+
// 글자 겹치기 — 겹친 글은 composeText 속성에 있어 종전엔 통째로 빠졌다(법령 서식 원 번호 ⑯·⑰, 시험지 네모 번호 10)
|
|
2883
|
+
case "compose":
|
|
2884
|
+
if (!isInDeletedRange(ctx)) text += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _chunkS34OVRKDcjs.composeText.call(void 0, _nullishCoalesce(child.getAttribute("composeText"), () => ( "")), (_nullishCoalesce(child.getAttribute("circleType"), () => ( "CHAR"))) !== "CHAR")));
|
|
2885
|
+
break;
|
|
2929
2886
|
// 양식 선택 상자·라디오 단추 — 한컴이 그리는 상자 기호와 캡션 글 (종전엔 통째로 빠졌다: form-002 "원천기술형"·서울 결재 "부분공개")
|
|
2930
2887
|
// 지운 구간의 양식 단추·수식은 글처럼 내지 않는다 (최종본)
|
|
2931
2888
|
case "checkBtn":
|
|
@@ -2936,7 +2893,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
2936
2893
|
case "hyperlink": {
|
|
2937
2894
|
const url = child.getAttribute("url") || child.getAttribute("href") || "";
|
|
2938
2895
|
if (url) {
|
|
2939
|
-
const safe =
|
|
2896
|
+
const safe = _chunkFJ45NNLAcjs.sanitizeHref.call(void 0, url);
|
|
2940
2897
|
if (safe) href = safe;
|
|
2941
2898
|
}
|
|
2942
2899
|
walk(child, depth + 1);
|
|
@@ -3030,7 +2987,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3030
2987
|
walk(child, depth + 1);
|
|
3031
2988
|
if (script && linkRanges.length === nLinks && openFields.length === nOpen && runHasOnlyText(child)) {
|
|
3032
2989
|
const added = text.slice(start);
|
|
3033
|
-
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) +
|
|
2990
|
+
if (added && !/[\x1E\n$]/.test(added)) text = text.slice(0, start) + _chunkS34OVRKDcjs.wrapScript.call(void 0, added, script);
|
|
3034
2991
|
}
|
|
3035
2992
|
break;
|
|
3036
2993
|
}
|
|
@@ -3053,7 +3010,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
|
|
|
3053
3010
|
}
|
|
3054
3011
|
if (applied.length) href = void 0;
|
|
3055
3012
|
}
|
|
3056
|
-
text =
|
|
3013
|
+
text = _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, text);
|
|
3057
3014
|
const toc = takeTocLeaders(text);
|
|
3058
3015
|
text = toc.text;
|
|
3059
3016
|
const tocEntry = toc.tocEntry;
|
|
@@ -3167,7 +3124,7 @@ function decompressStream(data) {
|
|
|
3167
3124
|
return _zlib.inflateRawSync.call(void 0, data, opts);
|
|
3168
3125
|
}
|
|
3169
3126
|
function parseFileHeader(data) {
|
|
3170
|
-
if (data.length < 40) throw new (0,
|
|
3127
|
+
if (data.length < 40) throw new (0, _chunkFJ45NNLAcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
|
|
3171
3128
|
const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
|
|
3172
3129
|
return {
|
|
3173
3130
|
signature: sig,
|
|
@@ -3694,13 +3651,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3694
3651
|
}
|
|
3695
3652
|
const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
|
|
3696
3653
|
for (const path of allCandidates) {
|
|
3697
|
-
if (
|
|
3654
|
+
if (_chunkFJ45NNLAcjs.isPathTraversal.call(void 0, path)) continue;
|
|
3698
3655
|
const file = zip.file(path);
|
|
3699
3656
|
if (!file) continue;
|
|
3700
3657
|
try {
|
|
3701
3658
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3702
3659
|
decompressed.total += data.length;
|
|
3703
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3660
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3704
3661
|
const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
|
|
3705
3662
|
const extMime = imageExtToMime(ext);
|
|
3706
3663
|
const mimeType = extMime === "image/svg+xml" && /<script|\son[a-z]+\s*=|javascript:|<foreignObject/i.test(Buffer.from(data).toString("utf8")) ? "application/octet-stream" : extMime;
|
|
@@ -3711,7 +3668,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3711
3668
|
usedPaths.add(path);
|
|
3712
3669
|
break;
|
|
3713
3670
|
} catch (err) {
|
|
3714
|
-
if (err instanceof
|
|
3671
|
+
if (err instanceof _chunkFJ45NNLAcjs.KordocError) throw err;
|
|
3715
3672
|
}
|
|
3716
3673
|
}
|
|
3717
3674
|
if (!img) _optionalChain([warnings, 'optionalAccess', _128 => _128.push, 'call', _129 => _129({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
|
|
@@ -3731,13 +3688,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3731
3688
|
if (sweepUnreferenced) {
|
|
3732
3689
|
const binEntries = zip.file(/(?:^|\/)BinData\//i);
|
|
3733
3690
|
for (const file of binEntries) {
|
|
3734
|
-
if (file.dir || usedPaths.has(file.name) ||
|
|
3691
|
+
if (file.dir || usedPaths.has(file.name) || _chunkFJ45NNLAcjs.isPathTraversal.call(void 0, file.name)) continue;
|
|
3735
3692
|
const basename = file.name.slice(file.name.lastIndexOf("/") + 1);
|
|
3736
3693
|
if (_optionalChain([deletedRefs, 'optionalAccess', _130 => _130.has, 'call', _131 => _131(file.name)]) || _optionalChain([deletedRefs, 'optionalAccess', _132 => _132.has, 'call', _133 => _133(basename)]) || _optionalChain([deletedRefs, 'optionalAccess', _134 => _134.has, 'call', _135 => _135(file.name.replace(/\.[^/.]+$/, ""))]) || _optionalChain([deletedRefs, 'optionalAccess', _136 => _136.has, 'call', _137 => _137(basename.replace(/\.[^.]+$/, ""))])) continue;
|
|
3737
3694
|
try {
|
|
3738
3695
|
const data = await readZipEntry(file, "uint8array", decompressed.total);
|
|
3739
3696
|
decompressed.total += data.length;
|
|
3740
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3697
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3741
3698
|
const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
|
|
3742
3699
|
let mimeType = imageExtToMime(ext);
|
|
3743
3700
|
if (mimeType === "application/octet-stream") {
|
|
@@ -3751,7 +3708,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
|
|
|
3751
3708
|
images.push(img);
|
|
3752
3709
|
blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
|
|
3753
3710
|
} catch (err) {
|
|
3754
|
-
if (err instanceof
|
|
3711
|
+
if (err instanceof _chunkFJ45NNLAcjs.KordocError) throw err;
|
|
3755
3712
|
_optionalChain([warnings, 'optionalAccess', _138 => _138.push, 'call', _139 => _139({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
|
|
3756
3713
|
}
|
|
3757
3714
|
}
|
|
@@ -3802,7 +3759,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3802
3759
|
}
|
|
3803
3760
|
const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
|
|
3804
3761
|
const name = new TextDecoder().decode(nameBytes);
|
|
3805
|
-
if (
|
|
3762
|
+
if (_chunkFJ45NNLAcjs.isPathTraversal.call(void 0, name)) {
|
|
3806
3763
|
pos = fileStart + compSize;
|
|
3807
3764
|
continue;
|
|
3808
3765
|
}
|
|
@@ -3820,7 +3777,7 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3820
3777
|
continue;
|
|
3821
3778
|
}
|
|
3822
3779
|
totalDecompressed += content.length * 2;
|
|
3823
|
-
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3780
|
+
if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
|
|
3824
3781
|
sectionNum++;
|
|
3825
3782
|
const secBlocks = parseSectionXml(content, void 0, warnings, sectionNum, shared);
|
|
3826
3783
|
for (const b of secBlocks) b.pageNumber = sectionNum;
|
|
@@ -3829,9 +3786,9 @@ function extractFromBrokenZip(buffer, options) {
|
|
|
3829
3786
|
continue;
|
|
3830
3787
|
}
|
|
3831
3788
|
}
|
|
3832
|
-
if (blocks.length === 0) throw new (0,
|
|
3789
|
+
if (blocks.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
3833
3790
|
applyPageText(blocks, shared);
|
|
3834
|
-
const markdown =
|
|
3791
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _140 => _140.tableFormat]) });
|
|
3835
3792
|
return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
3836
3793
|
}
|
|
3837
3794
|
async function readKordocLayout(zip) {
|
|
@@ -3856,11 +3813,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3856
3813
|
if (paths.length > 0) return paths;
|
|
3857
3814
|
}
|
|
3858
3815
|
const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
|
|
3859
|
-
return sectionFiles.map((f) => f.name).sort(
|
|
3816
|
+
return sectionFiles.map((f) => f.name).sort(_chunkFJ45NNLAcjs.compareSectionPaths);
|
|
3860
3817
|
}
|
|
3861
3818
|
function parseSectionPathsFromManifest(xml) {
|
|
3862
3819
|
const parser = createXmlParser();
|
|
3863
|
-
const doc = parser.parseFromString(
|
|
3820
|
+
const doc = parser.parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3864
3821
|
const opf = "http://www.idpf.org/2007/opf/";
|
|
3865
3822
|
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3866
3823
|
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
@@ -3870,7 +3827,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3870
3827
|
for (let i = 0; i < items.length; i++) {
|
|
3871
3828
|
const item = items[i];
|
|
3872
3829
|
const id = item.getAttribute("id") || "";
|
|
3873
|
-
const href =
|
|
3830
|
+
const href = _chunkFJ45NNLAcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
|
|
3874
3831
|
if (id && href) idToHref.set(id, href);
|
|
3875
3832
|
}
|
|
3876
3833
|
if (spine.length > 0) {
|
|
@@ -3881,7 +3838,7 @@ function parseSectionPathsFromManifest(xml) {
|
|
|
3881
3838
|
}
|
|
3882
3839
|
if (ordered.length > 0) return ordered;
|
|
3883
3840
|
}
|
|
3884
|
-
return Array.from(idToHref.values()).sort(
|
|
3841
|
+
return Array.from(idToHref.values()).sort(_chunkFJ45NNLAcjs.compareSectionPaths);
|
|
3885
3842
|
}
|
|
3886
3843
|
|
|
3887
3844
|
// src/hwpx/metadata.ts
|
|
@@ -3893,7 +3850,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3893
3850
|
const xml = await readZipEntry(file, "text", _optionalChain([decompressed, 'optionalAccess', _144 => _144.total]));
|
|
3894
3851
|
if (decompressed) {
|
|
3895
3852
|
decompressed.total += xml.length * 2;
|
|
3896
|
-
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
3853
|
+
if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
3897
3854
|
}
|
|
3898
3855
|
return xml;
|
|
3899
3856
|
};
|
|
@@ -3915,7 +3872,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
|
|
|
3915
3872
|
}
|
|
3916
3873
|
}
|
|
3917
3874
|
function parseOpfMetadata(xml, metadata) {
|
|
3918
|
-
const root = createXmlParser().parseFromString(
|
|
3875
|
+
const root = createXmlParser().parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, xml), "text/xml").documentElement;
|
|
3919
3876
|
const md2 = root ? findChildByLocalName(root, "metadata") : null;
|
|
3920
3877
|
if (!md2) return;
|
|
3921
3878
|
let title;
|
|
@@ -3948,7 +3905,7 @@ function isoDate(s) {
|
|
|
3948
3905
|
}
|
|
3949
3906
|
function parseDublinCoreMetadata(xml, metadata) {
|
|
3950
3907
|
const parser = createXmlParser();
|
|
3951
|
-
const doc = parser.parseFromString(
|
|
3908
|
+
const doc = parser.parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, xml), "text/xml");
|
|
3952
3909
|
if (!doc.documentElement) return;
|
|
3953
3910
|
const getText = (tagNames) => {
|
|
3954
3911
|
for (const tag of tagNames) {
|
|
@@ -3987,7 +3944,7 @@ function assignSectionPage(block, sectionNum) {
|
|
|
3987
3944
|
}
|
|
3988
3945
|
}
|
|
3989
3946
|
async function parseHwpxDocument(buffer, options) {
|
|
3990
|
-
|
|
3947
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
3991
3948
|
let zip;
|
|
3992
3949
|
try {
|
|
3993
3950
|
zip = await _jszip2.default.loadAsync(buffer);
|
|
@@ -3996,7 +3953,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
3996
3953
|
}
|
|
3997
3954
|
const actualEntryCount = Object.keys(zip.files).length;
|
|
3998
3955
|
if (actualEntryCount > MAX_ZIP_ENTRIES) {
|
|
3999
|
-
throw new (0,
|
|
3956
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
|
|
4000
3957
|
}
|
|
4001
3958
|
const manifestFile = zip.file("META-INF/manifest.xml");
|
|
4002
3959
|
if (manifestFile) {
|
|
@@ -4016,7 +3973,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4016
3973
|
}
|
|
4017
3974
|
const hpfFile = zip.file("Contents/content.hpf");
|
|
4018
3975
|
const hpf = hpfFile ? await readZipEntry(hpfFile, "text").catch(() => "") : "";
|
|
4019
|
-
throw new (0,
|
|
3976
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
4020
3977
|
/\bdistribution="1"/.test(_nullishCoalesce(hpf, () => ( ""))) ? "\uBC30\uD3EC\uC6A9\uC73C\uB85C \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4 (\uBC30\uD3EC\uC6A9 \uBCF5\uD638\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC74C). \uD55C\uCEF4\uC624\uD53C\uC2A4\uC5D0\uC11C \uC77C\uBC18 \uBB38\uC11C\uB85C \uC800\uC7A5\uD55C \uB4A4 \uC5EC\uC138\uC694." : "\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
4021
3978
|
);
|
|
4022
3979
|
}
|
|
@@ -4028,7 +3985,7 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4028
3985
|
const styleMap = await extractHwpxStyles(zip, decompressed);
|
|
4029
3986
|
const warnings = [];
|
|
4030
3987
|
const sectionPaths = await resolveSectionPaths(zip);
|
|
4031
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
3988
|
+
if (sectionPaths.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
4032
3989
|
let allBlocks = [];
|
|
4033
3990
|
const shared = createSectionShared();
|
|
4034
3991
|
shared.kordocLayout = await readKordocLayout(zip);
|
|
@@ -4072,10 +4029,10 @@ async function parseHwpxDocument(buffer, options) {
|
|
|
4072
4029
|
const blocks = allBlocks;
|
|
4073
4030
|
applyPageText(blocks, shared);
|
|
4074
4031
|
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 :
|
|
4032
|
+
const shown = _optionalChain([options, 'optionalAccess', _174 => _174.layoutTables]) === "keep" ? blocks : _chunkS34OVRKDcjs.unframeLayoutTables.call(void 0, blocks, !!_optionalChain([options, 'optionalAccess', _175 => _175.keepTrailingEmptyCols]));
|
|
4076
4033
|
detectHwpxHeadings(shown, styleMap, shared.tocTexts);
|
|
4077
4034
|
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 =
|
|
4035
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, shown, { tableFormat: _optionalChain([options, 'optionalAccess', _176 => _176.tableFormat]) });
|
|
4079
4036
|
return { markdown, blocks: shown, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
|
|
4080
4037
|
}
|
|
4081
4038
|
|
|
@@ -4842,7 +4799,7 @@ function decryptPasswordStream(raw, password) {
|
|
|
4842
4799
|
var TAG_DOCUMENT_PROPERTIES = 16;
|
|
4843
4800
|
var TAG_ID_MAPPINGS2 = 17;
|
|
4844
4801
|
function assertDecryptedDocInfo(data, readRecords3) {
|
|
4845
|
-
const wrong = () => new (0,
|
|
4802
|
+
const wrong = () => new (0, _chunkFJ45NNLAcjs.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
4803
|
let records;
|
|
4847
4804
|
try {
|
|
4848
4805
|
records = readRecords3(data);
|
|
@@ -4854,7 +4811,7 @@ function assertDecryptedDocInfo(data, readRecords3) {
|
|
|
4854
4811
|
}
|
|
4855
4812
|
function assertSupportedEncryptVersion(version) {
|
|
4856
4813
|
if (version !== SUPPORTED_ENCRYPT_VERSION) {
|
|
4857
|
-
throw new (0,
|
|
4814
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
4858
4815
|
`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 HWP \uC554\uD638\uD654 \uBC84\uC804\uC785\uB2C8\uB2E4 (EncryptVersion=${version}, \uC9C0\uC6D0: ${SUPPORTED_ENCRYPT_VERSION})`
|
|
4859
4816
|
);
|
|
4860
4817
|
}
|
|
@@ -5103,19 +5060,19 @@ var HANJA_UNITS = ["", "\u5341", "\u767E", "\u5343", "\u842C"];
|
|
|
5103
5060
|
function formatNumber(n, fmt) {
|
|
5104
5061
|
switch (fmt) {
|
|
5105
5062
|
case "circled":
|
|
5106
|
-
return n >= 1 ? circledNumber(n - 1) : String(n);
|
|
5063
|
+
return n >= 1 ? _chunkS34OVRKDcjs.circledNumber.call(void 0, n - 1) : String(n);
|
|
5107
5064
|
case "romanUpper":
|
|
5108
|
-
return romanNumeral(n, true);
|
|
5065
|
+
return _chunkS34OVRKDcjs.romanNumeral.call(void 0, n, true);
|
|
5109
5066
|
case "romanLower":
|
|
5110
|
-
return romanNumeral(n, false);
|
|
5067
|
+
return _chunkS34OVRKDcjs.romanNumeral.call(void 0, n, false);
|
|
5111
5068
|
case "latinUpper":
|
|
5112
5069
|
return formatLatin(n, true) || String(n);
|
|
5113
5070
|
case "latinLower":
|
|
5114
5071
|
return formatLatin(n, false) || String(n);
|
|
5115
5072
|
case "ganada":
|
|
5116
|
-
return n >= 1 ? hangulOrdinal(n - 1) : String(n);
|
|
5073
|
+
return n >= 1 ? _chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n - 1) : String(n);
|
|
5117
5074
|
case "circledGanada":
|
|
5118
|
-
return n >= 1 ? circledHangul(n - 1) : String(n);
|
|
5075
|
+
return n >= 1 ? _chunkS34OVRKDcjs.circledHangul.call(void 0, n - 1) : String(n);
|
|
5119
5076
|
case "jamo":
|
|
5120
5077
|
return fromTable(n, JAMO);
|
|
5121
5078
|
case "circledJamo":
|
|
@@ -5297,7 +5254,7 @@ function emitParagraphBlocks(p) {
|
|
|
5297
5254
|
return blocks;
|
|
5298
5255
|
}
|
|
5299
5256
|
function tableFlatText(table2) {
|
|
5300
|
-
const flat =
|
|
5257
|
+
const flat = _chunkS34OVRKDcjs.convertTableToText.call(void 0, table2.cells);
|
|
5301
5258
|
return table2.caption ? table2.caption + (flat ? "\n" + flat : "") : flat;
|
|
5302
5259
|
}
|
|
5303
5260
|
function blocksPlainText(blocks, sep) {
|
|
@@ -5378,8 +5335,8 @@ ${cell2.text}` : cell2.text;
|
|
|
5378
5335
|
}
|
|
5379
5336
|
function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
5380
5337
|
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,
|
|
5338
|
+
rows = Math.max(rows, Math.min((_nullishCoalesce(c.rowAddr, () => ( 0))) + 1, _chunkS34OVRKDcjs.MAX_ROWS));
|
|
5339
|
+
cols = Math.max(cols, Math.min((_nullishCoalesce(c.colAddr, () => ( 0))) + 1, _chunkS34OVRKDcjs.MAX_COLS));
|
|
5383
5340
|
}
|
|
5384
5341
|
const placed = resolveCellOverlaps(cells, rows, cols);
|
|
5385
5342
|
const byRow = Array.from({ length: rows }, () => []);
|
|
@@ -5387,12 +5344,12 @@ function buildAddressedTable(cells, rows, cols, keepAnchoredEmptyCols) {
|
|
|
5387
5344
|
const r = _nullishCoalesce(c.rowAddr, () => ( 0));
|
|
5388
5345
|
if (r < rows && (_nullishCoalesce(c.colAddr, () => ( 0))) < cols) byRow[r].push(c);
|
|
5389
5346
|
}
|
|
5390
|
-
const table2 =
|
|
5347
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, byRow, { keepAnchoredEmptyCols });
|
|
5391
5348
|
if (table2.rows === 0) return null;
|
|
5392
5349
|
for (const c of placed) {
|
|
5393
5350
|
if (c.edges) {
|
|
5394
5351
|
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)
|
|
5352
|
+
if (at) _chunkS34OVRKDcjs.CELL_EDGES.set(at, c.edges);
|
|
5396
5353
|
}
|
|
5397
5354
|
if (!_optionalChain([c, 'access', _186 => _186.blocks, 'optionalAccess', _187 => _187.length]) && !c.isHeader) continue;
|
|
5398
5355
|
const target = _optionalChain([table2, 'access', _188 => _188.cells, 'access', _189 => _189[_nullishCoalesce(c.rowAddr, () => ( 0))], 'optionalAccess', _190 => _190[_nullishCoalesce(c.colAddr, () => ( 0))]]);
|
|
@@ -5594,7 +5551,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5594
5551
|
continue;
|
|
5595
5552
|
}
|
|
5596
5553
|
if (!ctrl.href) continue;
|
|
5597
|
-
const href =
|
|
5554
|
+
const href = _chunkFJ45NNLAcjs.sanitizeHref.call(void 0, ctrl.href);
|
|
5598
5555
|
if (!href) continue;
|
|
5599
5556
|
if (!anchor.trim() || anchor.includes(INLINE_TABLE_MARK)) continue;
|
|
5600
5557
|
text = text.slice(0, r.start) + `[${anchor}](${href})` + text.slice(r.end);
|
|
@@ -5603,7 +5560,7 @@ function parseParagraph(records, start, end, ctx) {
|
|
|
5603
5560
|
}
|
|
5604
5561
|
if (text.includes(LITERAL_DOLLAR_MARK)) text = text.replaceAll(LITERAL_DOLLAR_MARK, "\\$");
|
|
5605
5562
|
text = resolveLiteralLt(text);
|
|
5606
|
-
text =
|
|
5563
|
+
text = _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, text);
|
|
5607
5564
|
const toc = takeTocLeaders(text);
|
|
5608
5565
|
text = toc.text;
|
|
5609
5566
|
let headingLevel = 0;
|
|
@@ -5707,14 +5664,19 @@ function applyCtrlEffect(ctrl, records, ctx) {
|
|
|
5707
5664
|
ctx.warnings.push({ page: ctx.page, message: "\uC2A4\uD0B5\uB41C OLE \uAC1C\uCCB4", code: "SKIPPED_OLE" });
|
|
5708
5665
|
return;
|
|
5709
5666
|
}
|
|
5710
|
-
//
|
|
5667
|
+
// 글자 겹침 — ctrl id 뒤 글자 수(WORD)·겹친 글자(WCHAR[n])·테두리 종류(BYTE, 0 = 없음). 종전엔 건너뛰어 법령 서식 원 번호(⑯·⑰)가 빠졌다
|
|
5668
|
+
case CTRL_TCPS: {
|
|
5669
|
+
const d = ctrl.data, n = d.length >= 6 ? d.readUInt16LE(4) : 0;
|
|
5670
|
+
if (n > 0 && d.length >= 6 + 2 * n) ctrl.inlineText = _chunkS34OVRKDcjs.composeText.call(void 0, d.toString("utf16le", 6, 6 + 2 * n), (_nullishCoalesce(d[6 + 2 * n], () => ( 0))) !== 0);
|
|
5671
|
+
return;
|
|
5672
|
+
}
|
|
5673
|
+
// 숨은 설명/단 정의/쪽번호 위치/감추기/찾아보기/책갈피/덧말 — 본문 텍스트 없음 또는 의도적 스킵
|
|
5711
5674
|
case CTRL_TCMT:
|
|
5712
5675
|
case CTRL_COLD:
|
|
5713
5676
|
case CTRL_PGNP:
|
|
5714
5677
|
case CTRL_PGHD:
|
|
5715
5678
|
case CTRL_IDXM:
|
|
5716
5679
|
case CTRL_BOKM:
|
|
5717
|
-
case CTRL_TCPS:
|
|
5718
5680
|
case CTRL_TDUT:
|
|
5719
5681
|
case CTRL_FORM:
|
|
5720
5682
|
return;
|
|
@@ -5823,7 +5785,7 @@ function hyperlinkUrlFromCommand(command) {
|
|
|
5823
5785
|
}
|
|
5824
5786
|
var A4_HEIGHT = 84188;
|
|
5825
5787
|
function keepUnlessPageSpanning(table2, cells) {
|
|
5826
|
-
if (!cells.some((c) => c.pageSpanning))
|
|
5788
|
+
if (!cells.some((c) => c.pageSpanning)) _chunkS34OVRKDcjs.markNonLayoutTable.call(void 0, table2);
|
|
5827
5789
|
}
|
|
5828
5790
|
function parseTableControl(ctrl, records, ctx) {
|
|
5829
5791
|
if (ctx.depth >= MAX_NEST_DEPTH) return null;
|
|
@@ -5835,8 +5797,8 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5835
5797
|
let tableIdx = -1;
|
|
5836
5798
|
for (let i2 = childStart; i2 < childEnd; i2++) {
|
|
5837
5799
|
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),
|
|
5800
|
+
rows = Math.min(records[i2].data.readUInt16LE(4), _chunkS34OVRKDcjs.MAX_ROWS);
|
|
5801
|
+
cols = Math.min(records[i2].data.readUInt16LE(6), _chunkS34OVRKDcjs.MAX_COLS);
|
|
5840
5802
|
tableIdx = i2;
|
|
5841
5803
|
break;
|
|
5842
5804
|
}
|
|
@@ -5880,11 +5842,11 @@ function parseTableControl(ctrl, records, ctx) {
|
|
|
5880
5842
|
return table3;
|
|
5881
5843
|
}
|
|
5882
5844
|
if (rows === 0 || cols === 0) {
|
|
5883
|
-
rows = Math.min(cells.length,
|
|
5845
|
+
rows = Math.min(cells.length, _chunkS34OVRKDcjs.MAX_ROWS);
|
|
5884
5846
|
cols = 1;
|
|
5885
5847
|
}
|
|
5886
5848
|
const cellRows = arrangeCells(rows, cols, cells);
|
|
5887
|
-
const table2 =
|
|
5849
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
|
|
5888
5850
|
if (caption && table2.rows > 0) table2.caption = caption;
|
|
5889
5851
|
if (sourceId && table2.rows > 0) table2.sourceId = sourceId;
|
|
5890
5852
|
keepUnlessPageSpanning(table2, cells);
|
|
@@ -5903,8 +5865,8 @@ function parseCell(records, lhIdx, end, ctx) {
|
|
|
5903
5865
|
rowAddr = rec.data.readUInt16LE(10);
|
|
5904
5866
|
const cs = rec.data.readUInt16LE(12);
|
|
5905
5867
|
const rs = rec.data.readUInt16LE(14);
|
|
5906
|
-
if (cs > 0) colSpan = Math.min(cs,
|
|
5907
|
-
if (rs > 0) rowSpan = Math.min(rs,
|
|
5868
|
+
if (cs > 0) colSpan = Math.min(cs, _chunkS34OVRKDcjs.MAX_COLS);
|
|
5869
|
+
if (rs > 0) rowSpan = Math.min(rs, _chunkS34OVRKDcjs.MAX_ROWS);
|
|
5908
5870
|
}
|
|
5909
5871
|
const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
|
|
5910
5872
|
const { text, hasStructure } = cellTextFromBlocks(blocks);
|
|
@@ -6053,7 +6015,7 @@ function openHwp5Container(buffer, options) {
|
|
|
6053
6015
|
lenientCfb = parseLenientCfb(buffer);
|
|
6054
6016
|
warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
|
|
6055
6017
|
} catch (e24) {
|
|
6056
|
-
throw new (0,
|
|
6018
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
|
|
6057
6019
|
}
|
|
6058
6020
|
}
|
|
6059
6021
|
const readRawStream = (path) => {
|
|
@@ -6064,14 +6026,14 @@ function openHwp5Container(buffer, options) {
|
|
|
6064
6026
|
return lenientCfb.findStream(path);
|
|
6065
6027
|
};
|
|
6066
6028
|
const headerData = readRawStream("/FileHeader");
|
|
6067
|
-
if (!headerData) throw new (0,
|
|
6029
|
+
if (!headerData) throw new (0, _chunkFJ45NNLAcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6068
6030
|
const header = parseFileHeader(headerData);
|
|
6069
|
-
if (header.signature !== "HWP Document File") throw new (0,
|
|
6070
|
-
if (header.flags & FLAG_DRM) throw new (0,
|
|
6031
|
+
if (header.signature !== "HWP Document File") throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
6032
|
+
if (header.flags & FLAG_DRM) throw new (0, _chunkFJ45NNLAcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
6071
6033
|
const encrypted = (header.flags & FLAG_ENCRYPTED) !== 0;
|
|
6072
6034
|
if (encrypted) {
|
|
6073
6035
|
if (!_optionalChain([options, 'optionalAccess', _214 => _214.password])) {
|
|
6074
|
-
throw new (0,
|
|
6036
|
+
throw new (0, _chunkFJ45NNLAcjs.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
6037
|
}
|
|
6076
6038
|
assertSupportedEncryptVersion(readEncryptVersion(headerData));
|
|
6077
6039
|
}
|
|
@@ -6085,12 +6047,12 @@ function openHwp5Container(buffer, options) {
|
|
|
6085
6047
|
const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
|
|
6086
6048
|
if (encrypted) {
|
|
6087
6049
|
const rawDocInfo = findStream("/DocInfo");
|
|
6088
|
-
if (!rawDocInfo) throw new (0,
|
|
6050
|
+
if (!rawDocInfo) throw new (0, _chunkFJ45NNLAcjs.KordocError)("DocInfo \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
|
|
6089
6051
|
let docInfoData;
|
|
6090
6052
|
try {
|
|
6091
6053
|
docInfoData = compressed ? decompressStream(rawDocInfo) : rawDocInfo;
|
|
6092
6054
|
} catch (e25) {
|
|
6093
|
-
throw new (0,
|
|
6055
|
+
throw new (0, _chunkFJ45NNLAcjs.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
6056
|
}
|
|
6095
6057
|
assertDecryptedDocInfo(docInfoData, readRecords);
|
|
6096
6058
|
}
|
|
@@ -6115,10 +6077,10 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6115
6077
|
try {
|
|
6116
6078
|
const data = !c.distribution && c.compressed ? decompressStream(Buffer.from(sections[si])) : Buffer.from(sections[si]);
|
|
6117
6079
|
totalDecompressed += data.length;
|
|
6118
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6080
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6119
6081
|
out.push(readRecords(data));
|
|
6120
6082
|
} catch (secErr) {
|
|
6121
|
-
if (secErr instanceof
|
|
6083
|
+
if (secErr instanceof _chunkFJ45NNLAcjs.KordocError) throw secErr;
|
|
6122
6084
|
out.push(null);
|
|
6123
6085
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
6124
6086
|
}
|
|
@@ -6138,7 +6100,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6138
6100
|
if (cfb) extractHwp5Metadata(cfb, metadata);
|
|
6139
6101
|
const docInfo = cfb && !encrypted ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
|
|
6140
6102
|
const sections = readHwp5SectionStreams(c);
|
|
6141
|
-
if (sections.length === 0) throw new (0,
|
|
6103
|
+
if (sections.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
6142
6104
|
const sectionRecords = readHwp5SectionRecords(c, sections, warnings);
|
|
6143
6105
|
const sectionDetects = sectionRecords.map((r) => r ? detectHwp5SectionPages(r) : null);
|
|
6144
6106
|
const sectionTableIds = [];
|
|
@@ -6182,7 +6144,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6182
6144
|
parsedSections++;
|
|
6183
6145
|
_optionalChain([options, 'optionalAccess', _219 => _219.onProgress, 'optionalCall', _220 => _220(parsedSections, sections.length)]);
|
|
6184
6146
|
} catch (secErr) {
|
|
6185
|
-
if (secErr instanceof
|
|
6147
|
+
if (secErr instanceof _chunkFJ45NNLAcjs.KordocError) throw secErr;
|
|
6186
6148
|
warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
|
|
6187
6149
|
} finally {
|
|
6188
6150
|
pageBase += detect2.pages;
|
|
@@ -6193,10 +6155,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6193
6155
|
}
|
|
6194
6156
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6195
6157
|
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 =
|
|
6158
|
+
let flatBlocks = _chunkS34OVRKDcjs.flattenLayoutTables.call(void 0, blocks);
|
|
6159
|
+
if (_optionalChain([options, 'optionalAccess', _221 => _221.layoutTables]) !== "keep") flatBlocks = _chunkS34OVRKDcjs.unframeLayoutTables.call(void 0, flatBlocks, !!_optionalChain([options, 'optionalAccess', _222 => _222.keepTrailingEmptyCols]));
|
|
6198
6160
|
if (_optionalChain([options, 'optionalAccess', _223 => _223.dedupeRunningHeaders])) {
|
|
6199
|
-
const deduped =
|
|
6161
|
+
const deduped = _chunkS34OVRKDcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
|
|
6200
6162
|
const removed = flatBlocks.length - deduped.length;
|
|
6201
6163
|
if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
|
|
6202
6164
|
flatBlocks = deduped;
|
|
@@ -6205,10 +6167,10 @@ function parseHwp5Document(buffer, options) {
|
|
|
6205
6167
|
detectHwp5Headings(flatBlocks, docInfo, doc.tocTexts);
|
|
6206
6168
|
}
|
|
6207
6169
|
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 =
|
|
6170
|
+
let markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, flatBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _224 => _224.tableFormat]) });
|
|
6209
6171
|
if (_optionalChain([options, 'optionalAccess', _225 => _225.inlineImages]) && options.images !== false && images.length > 0) {
|
|
6210
6172
|
try {
|
|
6211
|
-
markdown =
|
|
6173
|
+
markdown = _chunkTN4SSNEScjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
6212
6174
|
} catch (inlineErr) {
|
|
6213
6175
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
6214
6176
|
}
|
|
@@ -6272,9 +6234,9 @@ function detectHwp5Headings(blocks, docInfo, tocTexts) {
|
|
|
6272
6234
|
let level = 0;
|
|
6273
6235
|
if (_optionalChain([block, 'access', _232 => _232.style, 'optionalAccess', _233 => _233.fontSize]) && baseFontSize > 0) {
|
|
6274
6236
|
const ratio = block.style.fontSize / baseFontSize;
|
|
6275
|
-
if (ratio >=
|
|
6276
|
-
else if (ratio >=
|
|
6277
|
-
else if (ratio >=
|
|
6237
|
+
if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H1) level = 1;
|
|
6238
|
+
else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H2) level = 2;
|
|
6239
|
+
else if (ratio >= _chunkS34OVRKDcjs.HEADING_RATIO_H3) level = 3;
|
|
6278
6240
|
}
|
|
6279
6241
|
if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
|
|
6280
6242
|
if (level === 0) level = 2;
|
|
@@ -6406,7 +6368,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6406
6368
|
const raw = _nullishCoalesce(lcfb.findStream(`/BodyText/Section${i}`), () => ( lcfb.findStream(`Section${i}`)));
|
|
6407
6369
|
if (!raw) break;
|
|
6408
6370
|
totalBytes += raw.length;
|
|
6409
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6371
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6410
6372
|
sections.push({ idx: i, content: raw });
|
|
6411
6373
|
}
|
|
6412
6374
|
if (sections.length === 0) {
|
|
@@ -6417,7 +6379,7 @@ function findSectionsLenient(lcfb) {
|
|
|
6417
6379
|
const raw = lcfb.findStream(e.name);
|
|
6418
6380
|
if (raw) {
|
|
6419
6381
|
totalBytes += raw.length;
|
|
6420
|
-
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6382
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6421
6383
|
sections.push({ idx, content: raw });
|
|
6422
6384
|
}
|
|
6423
6385
|
}
|
|
@@ -6434,7 +6396,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
|
|
|
6434
6396
|
try {
|
|
6435
6397
|
const content = decryptViewText(raw, compressed);
|
|
6436
6398
|
totalDecompressed += content.length;
|
|
6437
|
-
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0,
|
|
6399
|
+
if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6438
6400
|
sections.push({ idx: i, content });
|
|
6439
6401
|
} catch (e32) {
|
|
6440
6402
|
break;
|
|
@@ -18934,25 +18896,25 @@ function desEcbDecrypt(data, key) {
|
|
|
18934
18896
|
}
|
|
18935
18897
|
function readLayout(data) {
|
|
18936
18898
|
if (data.length < FIXED_HEADER_BYTES) {
|
|
18937
|
-
throw new (0,
|
|
18899
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uD5E4\uB354\uAC00 \uC798\uB838\uC2B5\uB2C8\uB2E4");
|
|
18938
18900
|
}
|
|
18939
18901
|
const infoBlockLength = data[INFO_BLOCK_LENGTH_OFFSET] | data[INFO_BLOCK_LENGTH_OFFSET + 1] << 8;
|
|
18940
18902
|
const payloadOffset = FIXED_HEADER_BYTES + infoBlockLength;
|
|
18941
18903
|
if (payloadOffset >= data.length) {
|
|
18942
|
-
throw new (0,
|
|
18904
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
18943
18905
|
}
|
|
18944
18906
|
return { payloadOffset, compressed: data[COMPRESSION_FLAG_OFFSET] !== 0 };
|
|
18945
18907
|
}
|
|
18946
18908
|
function decryptHwp3Document(input, password) {
|
|
18947
18909
|
const { payloadOffset, compressed } = readLayout(input);
|
|
18948
18910
|
if (!compressed) {
|
|
18949
|
-
throw new (0,
|
|
18911
|
+
throw new (0, _chunkFJ45NNLAcjs.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
18912
|
}
|
|
18951
18913
|
const source = Buffer.from(input);
|
|
18952
18914
|
const payload = source.subarray(payloadOffset);
|
|
18953
18915
|
const aligned = payload.subarray(0, payload.length - payload.length % 8);
|
|
18954
18916
|
if (aligned.length === 0) {
|
|
18955
|
-
throw new (0,
|
|
18917
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWP3 \uC554\uD638 \uBB38\uC11C: \uBCF8\uBB38\uC774 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4");
|
|
18956
18918
|
}
|
|
18957
18919
|
const decrypted = desEcbDecrypt(aligned, deriveDesKey(password));
|
|
18958
18920
|
let inflated;
|
|
@@ -18960,14 +18922,14 @@ function decryptHwp3Document(input, password) {
|
|
|
18960
18922
|
inflated = _zlib.inflateRawSync.call(void 0, decrypted, { maxOutputLength: MAX_DECOMPRESSED_BYTES });
|
|
18961
18923
|
} catch (err) {
|
|
18962
18924
|
if (_optionalChain([err, 'optionalAccess', _248 => _248.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
18963
|
-
throw new (0,
|
|
18925
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
18964
18926
|
`HWP3 \uC554\uD638 \uBCF8\uBB38\uC758 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESSED_BYTES / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`
|
|
18965
18927
|
);
|
|
18966
18928
|
}
|
|
18967
|
-
throw new (0,
|
|
18929
|
+
throw new (0, _chunkFJ45NNLAcjs.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
18930
|
}
|
|
18969
18931
|
if (inflated.length <= PASSWORD_PREFIX_BYTES) {
|
|
18970
|
-
throw new (0,
|
|
18932
|
+
throw new (0, _chunkFJ45NNLAcjs.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
18933
|
}
|
|
18972
18934
|
const body = inflated.subarray(PASSWORD_PREFIX_BYTES);
|
|
18973
18935
|
const out = Buffer.concat([source.subarray(0, payloadOffset), body]);
|
|
@@ -19024,9 +18986,9 @@ function hwp3CellGrid(info, count) {
|
|
|
19024
18986
|
const col = edgeAt(xs, g3.x), row = edgeAt(ys, g3.y);
|
|
19025
18987
|
const c2 = nextX[k] !== void 0 ? edgeAt(xs, nextX[k]) : xs.length - 1;
|
|
19026
18988
|
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),
|
|
18989
|
+
return { row, col, rowSpan: Math.min(Math.max(1, r2 - row), _chunkS34OVRKDcjs.MAX_ROWS), colSpan: Math.min(Math.max(1, c2 - col), _chunkS34OVRKDcjs.MAX_COLS) };
|
|
19028
18990
|
});
|
|
19029
|
-
return { rows: Math.min(Math.max(1, ys.length - 1),
|
|
18991
|
+
return { rows: Math.min(Math.max(1, ys.length - 1), _chunkS34OVRKDcjs.MAX_ROWS), cols: Math.min(Math.max(1, xs.length - 1), _chunkS34OVRKDcjs.MAX_COLS), cells };
|
|
19030
18992
|
}
|
|
19031
18993
|
|
|
19032
18994
|
// src/hwp3/parser.ts
|
|
@@ -19067,7 +19029,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19067
19029
|
let source = Buffer.from(buffer);
|
|
19068
19030
|
if (isEncryptedHwp3(source)) {
|
|
19069
19031
|
if (!_optionalChain([options, 'optionalAccess', _249 => _249.password])) {
|
|
19070
|
-
throw new (0,
|
|
19032
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
19071
19033
|
"\uC554\uD638\uB85C \uBCF4\uD638\uB41C HWP3 \uBB38\uC11C\uC785\uB2C8\uB2E4. password \uC635\uC158\uC5D0 \uC5F4\uAE30 \uC554\uD638\uB97C \uC9C0\uC815\uD558\uC138\uC694."
|
|
19072
19034
|
);
|
|
19073
19035
|
}
|
|
@@ -19084,10 +19046,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19084
19046
|
body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
|
|
19085
19047
|
} catch (err) {
|
|
19086
19048
|
if (_optionalChain([err, 'optionalAccess', _250 => _250.code]) === "ERR_BUFFER_TOO_LARGE") {
|
|
19087
|
-
throw new (0,
|
|
19049
|
+
throw new (0, _chunkFJ45NNLAcjs.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
19050
|
}
|
|
19089
19051
|
const msg2 = err instanceof Error ? err.message : String(err);
|
|
19090
|
-
throw new (0,
|
|
19052
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`HWP3 \uC555\uCD95 \uD574\uC81C \uC2E4\uD328: ${msg2}`);
|
|
19091
19053
|
}
|
|
19092
19054
|
} else {
|
|
19093
19055
|
body = tail;
|
|
@@ -19110,7 +19072,7 @@ function parseHwp3Document(buffer, options) {
|
|
|
19110
19072
|
const names = new Map([...ctx.picIds].map(([name, id]) => [id, name]));
|
|
19111
19073
|
dropMissingPictures(allBlocks, binData, names, warnings);
|
|
19112
19074
|
const images = resolveImageBlocks(binData, allBlocks, warnings, true);
|
|
19113
|
-
const blocks =
|
|
19075
|
+
const blocks = _chunkS34OVRKDcjs.flattenLayoutTables.call(void 0, allBlocks);
|
|
19114
19076
|
const metadata = {
|
|
19115
19077
|
title: header.title || void 0,
|
|
19116
19078
|
author: header.author || void 0,
|
|
@@ -19118,10 +19080,10 @@ function parseHwp3Document(buffer, options) {
|
|
|
19118
19080
|
createdAt: header.date || void 0,
|
|
19119
19081
|
version: "3.0"
|
|
19120
19082
|
};
|
|
19121
|
-
let markdown =
|
|
19083
|
+
let markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _251 => _251.tableFormat]) });
|
|
19122
19084
|
if (_optionalChain([options, 'optionalAccess', _252 => _252.inlineImages]) && options.images !== false && images.length > 0) {
|
|
19123
19085
|
try {
|
|
19124
|
-
markdown =
|
|
19086
|
+
markdown = _chunkTN4SSNEScjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
|
|
19125
19087
|
} catch (inlineErr) {
|
|
19126
19088
|
warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
|
|
19127
19089
|
}
|
|
@@ -19253,7 +19215,7 @@ function parseCharStream(reader, charCount, ctx, para2) {
|
|
|
19253
19215
|
continue;
|
|
19254
19216
|
}
|
|
19255
19217
|
if (ch >= 32) {
|
|
19256
|
-
para2.text +=
|
|
19218
|
+
para2.text += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(decodeJohabText(ch), () => ( ""))));
|
|
19257
19219
|
continue;
|
|
19258
19220
|
}
|
|
19259
19221
|
if (ch === 9) {
|
|
@@ -19488,7 +19450,7 @@ function isDistributionSentinel(markdown) {
|
|
|
19488
19450
|
// src/xlsx/sheet-blocks.ts
|
|
19489
19451
|
var MAX_SHEET_COLS = 16384;
|
|
19490
19452
|
function sheetRowCap(cols) {
|
|
19491
|
-
return Math.floor(
|
|
19453
|
+
return Math.floor(_chunkS34OVRKDcjs.MAX_TABLE_CELLS / Math.max(1, cols));
|
|
19492
19454
|
}
|
|
19493
19455
|
function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, keepAnchoredEmptyCols) {
|
|
19494
19456
|
const blocks = [];
|
|
@@ -19519,7 +19481,7 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19519
19481
|
if (keepRows.length > rowCap) {
|
|
19520
19482
|
warnings.push({
|
|
19521
19483
|
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 ${
|
|
19484
|
+
message: `\uC2DC\uD2B8 "${sheetName}": ${keepRows.length}\uD589 \xD7 ${keepCols.length}\uC5F4 \uC911 \uC55E ${rowCap}\uD589\uB9CC \uD45C\uB85C \uB0C8\uC2B5\uB2C8\uB2E4 (\uD45C \uCE78 \uC0C1\uD55C ${_chunkS34OVRKDcjs.MAX_TABLE_CELLS})`,
|
|
19523
19485
|
code: "TRUNCATED_TABLE"
|
|
19524
19486
|
});
|
|
19525
19487
|
keepRows.length = rowCap;
|
|
@@ -19553,14 +19515,14 @@ function sheetToBlocks(sheetName, rows, maxCol, merges, sheetIndex, warnings, ke
|
|
|
19553
19515
|
}
|
|
19554
19516
|
cellRows.push(row);
|
|
19555
19517
|
}
|
|
19556
|
-
const table2 =
|
|
19518
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols, maxRows: rowCap, maxCols: keepCols.length });
|
|
19557
19519
|
if (table2.rows > 0) blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
|
|
19558
19520
|
return blocks;
|
|
19559
19521
|
}
|
|
19560
19522
|
|
|
19561
19523
|
// src/xlsx/parser.ts
|
|
19562
19524
|
var MAX_SHEETS = 100;
|
|
19563
|
-
var MAX_DECOMPRESS_SIZE4 =
|
|
19525
|
+
var MAX_DECOMPRESS_SIZE4 = _chunkFJ45NNLAcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
19564
19526
|
var MAX_SHEET_ROWS = 1048576;
|
|
19565
19527
|
function cleanNumericValue(raw) {
|
|
19566
19528
|
if (!/^-?\d+\.\d+$/.test(raw)) return raw;
|
|
@@ -19597,7 +19559,7 @@ function getTextContent(el) {
|
|
|
19597
19559
|
return _nullishCoalesce(_optionalChain([el, 'access', _268 => _268.textContent, 'optionalAccess', _269 => _269.trim, 'call', _270 => _270()]), () => ( ""));
|
|
19598
19560
|
}
|
|
19599
19561
|
function parseXml(text) {
|
|
19600
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
19562
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, text), "text/xml");
|
|
19601
19563
|
}
|
|
19602
19564
|
function collectRichText(root) {
|
|
19603
19565
|
let out = "";
|
|
@@ -19608,7 +19570,7 @@ function collectRichText(root) {
|
|
|
19608
19570
|
const el = children[i];
|
|
19609
19571
|
const local = el.localName || _optionalChain([el, 'access', _271 => _271.tagName, 'optionalAccess', _272 => _272.replace, 'call', _273 => _273(/^[^:]+:/, "")]) || "";
|
|
19610
19572
|
if (local === "rPh") continue;
|
|
19611
|
-
if (local === "t") out +=
|
|
19573
|
+
if (local === "t") out += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
19612
19574
|
else walk(el);
|
|
19613
19575
|
}
|
|
19614
19576
|
};
|
|
@@ -19819,12 +19781,12 @@ function parseWorksheet(xml, sharedStrings, dateXfs, date1904) {
|
|
|
19819
19781
|
return { rows, merges, maxCol };
|
|
19820
19782
|
}
|
|
19821
19783
|
async function parseXlsxDocument(buffer, options) {
|
|
19822
|
-
|
|
19784
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
|
|
19823
19785
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
19824
19786
|
const warnings = [];
|
|
19825
19787
|
const workbookFile = zip.file("xl/workbook.xml");
|
|
19826
19788
|
if (!workbookFile) {
|
|
19827
|
-
throw new (0,
|
|
19789
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19828
19790
|
}
|
|
19829
19791
|
let sharedStrings = [];
|
|
19830
19792
|
const ssFile = zip.file("xl/sharedStrings.xml");
|
|
@@ -19833,7 +19795,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19833
19795
|
}
|
|
19834
19796
|
const { sheets, date1904 } = parseWorkbook(await readZipEntry(workbookFile, "text"));
|
|
19835
19797
|
if (sheets.length === 0) {
|
|
19836
|
-
throw new (0,
|
|
19798
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
19837
19799
|
}
|
|
19838
19800
|
let dateXfs = /* @__PURE__ */ new Map();
|
|
19839
19801
|
const stylesFile = zip.file("xl/styles.xml");
|
|
@@ -19917,7 +19879,7 @@ async function parseXlsxDocument(buffer, options) {
|
|
|
19917
19879
|
} catch (e35) {
|
|
19918
19880
|
}
|
|
19919
19881
|
}
|
|
19920
|
-
const markdown =
|
|
19882
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _278 => _278.tableFormat]) });
|
|
19921
19883
|
return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
|
|
19922
19884
|
}
|
|
19923
19885
|
|
|
@@ -20231,14 +20193,14 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20231
20193
|
const h = readCellHeader(rec.data);
|
|
20232
20194
|
if (h && rec.data.length >= 10) {
|
|
20233
20195
|
const isst = rec.data.readUInt32LE(6);
|
|
20234
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20196
|
+
cells.push({ row: h.row, col: h.col, value: _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(sst[isst], () => ( "")))) });
|
|
20235
20197
|
}
|
|
20236
20198
|
break;
|
|
20237
20199
|
}
|
|
20238
20200
|
case OP_LABEL: {
|
|
20239
20201
|
const h = readCellHeader(rec.data);
|
|
20240
20202
|
if (h) {
|
|
20241
|
-
cells.push({ row: h.row, col: h.col, value:
|
|
20203
|
+
cells.push({ row: h.row, col: h.col, value: _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, decodeLabelString(rec.data))) });
|
|
20242
20204
|
}
|
|
20243
20205
|
break;
|
|
20244
20206
|
}
|
|
@@ -20254,7 +20216,7 @@ function extractSheetCells(records, bofIndex, sst, convertNum) {
|
|
|
20254
20216
|
cells.push({
|
|
20255
20217
|
row: h.row,
|
|
20256
20218
|
col: h.col,
|
|
20257
|
-
value:
|
|
20219
|
+
value: _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, decodeFormulaStringRecord(next.data)))
|
|
20258
20220
|
});
|
|
20259
20221
|
i = j;
|
|
20260
20222
|
} else {
|
|
@@ -20366,11 +20328,11 @@ function processGlobals(records) {
|
|
|
20366
20328
|
const xfFmtIds = [];
|
|
20367
20329
|
const firstBof = records[0];
|
|
20368
20330
|
if (!firstBof || firstBof.opcode !== OP_BOF) {
|
|
20369
|
-
throw new (0,
|
|
20331
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
|
|
20370
20332
|
}
|
|
20371
20333
|
const bof = decodeBof(firstBof.data);
|
|
20372
20334
|
if (!bof || bof.dt !== DT_GLOBALS) {
|
|
20373
|
-
throw new (0,
|
|
20335
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
|
|
20374
20336
|
}
|
|
20375
20337
|
let i = 1;
|
|
20376
20338
|
while (i < records.length) {
|
|
@@ -20454,28 +20416,28 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20454
20416
|
try {
|
|
20455
20417
|
cfb = parseLenientCfb(buf);
|
|
20456
20418
|
} catch (e) {
|
|
20457
|
-
throw new (0,
|
|
20419
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
20458
20420
|
`XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
|
|
20459
20421
|
);
|
|
20460
20422
|
}
|
|
20461
20423
|
const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
|
|
20462
20424
|
if (!wb) {
|
|
20463
|
-
throw new (0,
|
|
20425
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
|
|
20464
20426
|
}
|
|
20465
20427
|
const records = readRecords2(wb);
|
|
20466
20428
|
if (records.length === 0) {
|
|
20467
|
-
throw new (0,
|
|
20429
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
|
|
20468
20430
|
}
|
|
20469
20431
|
const firstBof = decodeBof(records[0].data);
|
|
20470
20432
|
if (firstBof && firstBof.vers !== 1536) {
|
|
20471
|
-
throw new (0,
|
|
20433
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
20472
20434
|
`XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
|
|
20473
20435
|
);
|
|
20474
20436
|
}
|
|
20475
20437
|
const globals = processGlobals(records);
|
|
20476
20438
|
const warnings = [];
|
|
20477
20439
|
if (globals.encrypted) {
|
|
20478
|
-
throw new (0,
|
|
20440
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("XLS \uD30C\uC77C\uC774 \uC554\uD638\uD654\uB418\uC5B4 \uC788\uC5B4 \uD30C\uC2F1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
20479
20441
|
}
|
|
20480
20442
|
const convertNum = globals.dateXfs.size > 0 ? (n, ixfe) => {
|
|
20481
20443
|
const kind = globals.dateXfs.get(ixfe);
|
|
@@ -20526,7 +20488,7 @@ async function parseXlsDocument(buffer, options) {
|
|
|
20526
20488
|
pageCount: totalSheets
|
|
20527
20489
|
};
|
|
20528
20490
|
return {
|
|
20529
|
-
markdown:
|
|
20491
|
+
markdown: _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, allBlocks, { tableFormat: _optionalChain([options, 'optionalAccess', _283 => _283.tableFormat]) }),
|
|
20530
20492
|
blocks: allBlocks,
|
|
20531
20493
|
metadata,
|
|
20532
20494
|
warnings: warnings.length > 0 ? warnings : void 0
|
|
@@ -20965,7 +20927,7 @@ function isDisplayMath(el) {
|
|
|
20965
20927
|
}
|
|
20966
20928
|
|
|
20967
20929
|
// src/docx/parser.ts
|
|
20968
|
-
var MAX_DECOMPRESS_SIZE5 =
|
|
20930
|
+
var MAX_DECOMPRESS_SIZE5 = _chunkFJ45NNLAcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
20969
20931
|
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
20970
20932
|
var NEVER_READ_RE = /^word\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
20971
20933
|
function matchesLocal(el, localName3) {
|
|
@@ -21023,7 +20985,7 @@ function getAttr(el, localName3) {
|
|
|
21023
20985
|
return null;
|
|
21024
20986
|
}
|
|
21025
20987
|
function parseXml2(text) {
|
|
21026
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
20988
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21027
20989
|
}
|
|
21028
20990
|
function parseStyles(xml) {
|
|
21029
20991
|
const doc = parseXml2(xml);
|
|
@@ -21159,7 +21121,7 @@ function parseFootnotes(xml) {
|
|
|
21159
21121
|
const runs = findElements(p, "r");
|
|
21160
21122
|
for (const r of runs) {
|
|
21161
21123
|
const tElements = getChildElements(r, "t");
|
|
21162
|
-
for (const t of tElements) texts.push(
|
|
21124
|
+
for (const t of tElements) texts.push(_chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(t.textContent, () => ( "")))));
|
|
21163
21125
|
}
|
|
21164
21126
|
}
|
|
21165
21127
|
notes.set(id, texts.join("").trim());
|
|
@@ -21190,7 +21152,7 @@ function collectOmmlRoots(p) {
|
|
|
21190
21152
|
function extractRun(r) {
|
|
21191
21153
|
let text = "";
|
|
21192
21154
|
for (const el of effectiveChildElements(r)) {
|
|
21193
|
-
if (matchesLocal(el, "t")) text +=
|
|
21155
|
+
if (matchesLocal(el, "t")) text += _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, _nullishCoalesce(el.textContent, () => ( ""))));
|
|
21194
21156
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
21195
21157
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
21196
21158
|
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
@@ -21203,7 +21165,7 @@ function extractRun(r) {
|
|
|
21203
21165
|
italic = getChildElements(rPrEls[0], "i").length > 0;
|
|
21204
21166
|
const va = getChildElements(rPrEls[0], "vertAlign")[0];
|
|
21205
21167
|
const v = va ? getAttr(va, "val") : null;
|
|
21206
|
-
if (v === "superscript" || v === "subscript") text =
|
|
21168
|
+
if (v === "superscript" || v === "subscript") text = _chunkS34OVRKDcjs.wrapScript.call(void 0, text, v === "superscript" ? "sup" : "sub");
|
|
21207
21169
|
}
|
|
21208
21170
|
return { text, bold, italic };
|
|
21209
21171
|
}
|
|
@@ -21221,7 +21183,7 @@ var PAGE_FIELD_RE = /^\s*(?:PAGE|NUMPAGES|SECTIONPAGES)\b/i;
|
|
|
21221
21183
|
function makeLink(text, rawHref) {
|
|
21222
21184
|
if (!text) return "";
|
|
21223
21185
|
if (!rawHref) return text;
|
|
21224
|
-
const href =
|
|
21186
|
+
const href = _chunkFJ45NNLAcjs.sanitizeHref.call(void 0, rawHref);
|
|
21225
21187
|
return href ? `[${text}](${href})` : text;
|
|
21226
21188
|
}
|
|
21227
21189
|
function collectInline(p, footnotes, rels) {
|
|
@@ -21312,7 +21274,7 @@ function collectInline(p, footnotes, rels) {
|
|
|
21312
21274
|
const m = mathText(om);
|
|
21313
21275
|
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
21314
21276
|
}
|
|
21315
|
-
const text =
|
|
21277
|
+
const text = _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
21316
21278
|
return { text, bold, italic, footnoteText };
|
|
21317
21279
|
}
|
|
21318
21280
|
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
@@ -21437,7 +21399,7 @@ ${cell2.text}` : cell2.text;
|
|
|
21437
21399
|
return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
|
|
21438
21400
|
})
|
|
21439
21401
|
);
|
|
21440
|
-
const table2 =
|
|
21402
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21441
21403
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21442
21404
|
return { type: "table", table: table2 };
|
|
21443
21405
|
}
|
|
@@ -21486,7 +21448,7 @@ async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
|
21486
21448
|
let data = null;
|
|
21487
21449
|
if (readBytes) data = await readZipEntry(imgFile, "uint8array");
|
|
21488
21450
|
imgIdx++;
|
|
21489
|
-
const ext =
|
|
21451
|
+
const ext = _chunkFJ45NNLAcjs.partExtension.call(void 0, imgPath);
|
|
21490
21452
|
const mimeMap = {
|
|
21491
21453
|
png: "image/png",
|
|
21492
21454
|
jpg: "image/jpeg",
|
|
@@ -21585,12 +21547,12 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
21585
21547
|
}
|
|
21586
21548
|
async function parseDocxDocument(buffer, options) {
|
|
21587
21549
|
const readImages = _optionalChain([options, 'optionalAccess', _319 => _319.images]) !== false;
|
|
21588
|
-
|
|
21550
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5, void 0, { re: MEDIA_PART_RE, skip: !readImages, never: NEVER_READ_RE });
|
|
21589
21551
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21590
21552
|
const warnings = [];
|
|
21591
21553
|
const docFile = zip.file("word/document.xml");
|
|
21592
21554
|
if (!docFile) {
|
|
21593
|
-
throw new (0,
|
|
21555
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21594
21556
|
}
|
|
21595
21557
|
let rels = /* @__PURE__ */ new Map();
|
|
21596
21558
|
const relsFile = zip.file("word/_rels/document.xml.rels");
|
|
@@ -21637,7 +21599,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21637
21599
|
const doc = parseXml2(docXml);
|
|
21638
21600
|
const body = findElements(doc, "body");
|
|
21639
21601
|
if (body.length === 0) {
|
|
21640
|
-
throw new (0,
|
|
21602
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21641
21603
|
}
|
|
21642
21604
|
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
21643
21605
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
@@ -21690,7 +21652,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21690
21652
|
}
|
|
21691
21653
|
}
|
|
21692
21654
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
|
|
21693
|
-
const markdown =
|
|
21655
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _326 => _326.tableFormat]) });
|
|
21694
21656
|
return {
|
|
21695
21657
|
markdown,
|
|
21696
21658
|
blocks,
|
|
@@ -21704,7 +21666,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
21704
21666
|
// src/pptx/parser.ts
|
|
21705
21667
|
|
|
21706
21668
|
|
|
21707
|
-
var MAX_DECOMPRESS_SIZE6 =
|
|
21669
|
+
var MAX_DECOMPRESS_SIZE6 = _chunkFJ45NNLAcjs.unzipLimitBytes.call(void 0, 100 * 1024 * 1024);
|
|
21708
21670
|
var MEDIA_PART_RE2 = /^ppt\/(?:media|embeddings)\//;
|
|
21709
21671
|
var NEVER_READ_RE2 = /^ppt\/(?:embeddings\/.*|media\/.+\.(?:mp4|m4v|mov|avi|wmv|mpe?g|mkv|webm|mp3|wav|m4a|wma|aac|ogg|flac|mid|bin))$/i;
|
|
21710
21672
|
var MAX_ZIP_ENTRIES2 = 1e4;
|
|
@@ -21727,7 +21689,7 @@ var IMAGE_MIME = {
|
|
|
21727
21689
|
svg: "image/svg+xml"
|
|
21728
21690
|
};
|
|
21729
21691
|
function parseXml3(text) {
|
|
21730
|
-
return new (0, _xmldom.DOMParser)().parseFromString(
|
|
21692
|
+
return new (0, _xmldom.DOMParser)().parseFromString(_chunkFJ45NNLAcjs.stripDtd.call(void 0, text), "text/xml");
|
|
21731
21693
|
}
|
|
21732
21694
|
function getAttr2(el, name) {
|
|
21733
21695
|
const attrs = el.attributes;
|
|
@@ -21794,7 +21756,7 @@ async function slideParts(zip) {
|
|
|
21794
21756
|
names.sort((a, b) => Number(SLIDE_PART_RE.exec(a)[1]) - Number(SLIDE_PART_RE.exec(b)[1]));
|
|
21795
21757
|
ordered.push(...names);
|
|
21796
21758
|
}
|
|
21797
|
-
if (ordered.length > MAX_SLIDES) throw new (0,
|
|
21759
|
+
if (ordered.length > MAX_SLIDES) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`PPTX \uC2AC\uB77C\uC774\uB4DC \uC218 \uCD08\uACFC: ${ordered.length} (\uCD5C\uB300 ${MAX_SLIDES})`);
|
|
21798
21760
|
return ordered;
|
|
21799
21761
|
}
|
|
21800
21762
|
function paragraphText(p) {
|
|
@@ -21805,12 +21767,12 @@ function paragraphText(p) {
|
|
|
21805
21767
|
const t = findChildByLocalName(child, "t");
|
|
21806
21768
|
const rPr = findChildByLocalName(child, "rPr");
|
|
21807
21769
|
const baseline = Number(rPr ? _nullishCoalesce(getAttr2(rPr, "baseline"), () => ( 0)) : 0);
|
|
21808
|
-
if (t) text +=
|
|
21770
|
+
if (t) text += _chunkS34OVRKDcjs.wrapScript.call(void 0, _chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, _chunkS34OVRKDcjs.escapeLiteralDollar.call(void 0, rawTextContent(t))), baseline > 0 ? "sup" : baseline < 0 ? "sub" : null);
|
|
21809
21771
|
} else if (name === "br") {
|
|
21810
21772
|
text += " ";
|
|
21811
21773
|
}
|
|
21812
21774
|
}
|
|
21813
|
-
return
|
|
21775
|
+
return _chunkS34OVRKDcjs.tidyScriptTags.call(void 0, text.replace(/\s+/g, " ").trim());
|
|
21814
21776
|
}
|
|
21815
21777
|
function bodyParagraphs(txBody) {
|
|
21816
21778
|
const out = [];
|
|
@@ -21871,7 +21833,7 @@ function parseTable2(tbl2, page, keepEmptyCols) {
|
|
|
21871
21833
|
});
|
|
21872
21834
|
return cells;
|
|
21873
21835
|
});
|
|
21874
|
-
const table2 =
|
|
21836
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
|
|
21875
21837
|
if (table2.rows === 0 || table2.cols === 0) return null;
|
|
21876
21838
|
return { type: "table", table: table2, pageNumber: page };
|
|
21877
21839
|
}
|
|
@@ -21884,7 +21846,7 @@ async function pictureBlock(pic, ctx) {
|
|
|
21884
21846
|
if (!filename) {
|
|
21885
21847
|
const file = ctx.zip.file(rel.target);
|
|
21886
21848
|
if (!file) return null;
|
|
21887
|
-
const ext =
|
|
21849
|
+
const ext = _chunkFJ45NNLAcjs.partExtension.call(void 0, rel.target);
|
|
21888
21850
|
filename = `image_${String(ctx.imageNames.size + 1).padStart(3, "0")}.${ext}`;
|
|
21889
21851
|
try {
|
|
21890
21852
|
if (_optionalChain([ctx, 'access', _330 => _330.options, 'optionalAccess', _331 => _331.images]) !== false) {
|
|
@@ -21962,10 +21924,10 @@ async function notesText(zip, rels) {
|
|
|
21962
21924
|
return texts.join(" ");
|
|
21963
21925
|
}
|
|
21964
21926
|
async function parsePptxDocument(buffer, options) {
|
|
21965
|
-
|
|
21927
|
+
_chunkFJ45NNLAcjs.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
21928
|
const zip = await _jszip2.default.loadAsync(buffer);
|
|
21967
21929
|
if (!zip.file("ppt/presentation.xml")) {
|
|
21968
|
-
throw new (0,
|
|
21930
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 PPTX \uD30C\uC77C: ppt/presentation.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
21969
21931
|
}
|
|
21970
21932
|
const warnings = [];
|
|
21971
21933
|
const blocks = [];
|
|
@@ -22012,7 +21974,7 @@ async function parsePptxDocument(buffer, options) {
|
|
|
22012
21974
|
}
|
|
22013
21975
|
const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")), pageNumber: b.pageNumber }));
|
|
22014
21976
|
return {
|
|
22015
|
-
markdown:
|
|
21977
|
+
markdown: _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _336 => _336.tableFormat]) }),
|
|
22016
21978
|
blocks,
|
|
22017
21979
|
metadata,
|
|
22018
21980
|
outline: outline.length > 0 ? outline : void 0,
|
|
@@ -22028,11 +21990,11 @@ var MAX_TABLE_COLS = 500;
|
|
|
22028
21990
|
var MAX_HWPML_BYTES = 50 * 1024 * 1024;
|
|
22029
21991
|
function parseHwpmlDocument(buffer, options) {
|
|
22030
21992
|
if (buffer.byteLength > MAX_HWPML_BYTES) {
|
|
22031
|
-
throw new (0,
|
|
21993
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`HWPML \uD30C\uC77C \uD06C\uAE30 \uCD08\uACFC (${(buffer.byteLength / 1024 / 1024).toFixed(1)}MB > 50MB)`);
|
|
22032
21994
|
}
|
|
22033
21995
|
const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
|
|
22034
21996
|
const normalized = text.replace(/ /g, " ");
|
|
22035
|
-
const xml =
|
|
21997
|
+
const xml = _chunkFJ45NNLAcjs.stripDtd.call(void 0, normalized);
|
|
22036
21998
|
const warnings = [];
|
|
22037
21999
|
const parser = new (0, _xmldom.DOMParser)({
|
|
22038
22000
|
onError: (_level, msg2) => {
|
|
@@ -22072,7 +22034,7 @@ function parseHwpmlDocument(buffer, options) {
|
|
|
22072
22034
|
parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.keepTrailingEmptyCols]), () => ( false)));
|
|
22073
22035
|
}
|
|
22074
22036
|
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 =
|
|
22037
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _339 => _339.tableFormat]) });
|
|
22076
22038
|
return {
|
|
22077
22039
|
markdown,
|
|
22078
22040
|
blocks,
|
|
@@ -22179,7 +22141,7 @@ function collectCharText(node, parts, depth = 0) {
|
|
|
22179
22141
|
if (tag === "CHAR") {
|
|
22180
22142
|
for (const c of Array.from(el.childNodes)) {
|
|
22181
22143
|
const t = c.nodeType === 1 ? localName(c) === "TAB" ? " " : rawTextContent(c) : c.nodeType === 3 || c.nodeType === 4 ? _nullishCoalesce(c.nodeValue, () => ( "")) : "";
|
|
22182
|
-
if (t) parts.push(
|
|
22144
|
+
if (t) parts.push(_chunkS34OVRKDcjs.escapeLiteralTags.call(void 0, t));
|
|
22183
22145
|
}
|
|
22184
22146
|
} else if (tag === "TABLE" || tag === "PICTURE" || tag === "SHAPEOBJECT") {
|
|
22185
22147
|
} else if (tag === "AUTONUM") {
|
|
@@ -22239,7 +22201,7 @@ function buildHmlTable(el, warnings, keep, tableDepth) {
|
|
|
22239
22201
|
const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
|
|
22240
22202
|
cellRows[r].push(cell2);
|
|
22241
22203
|
}
|
|
22242
|
-
const table2 =
|
|
22204
|
+
const table2 = _chunkS34OVRKDcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
|
|
22243
22205
|
if (structured.length > 0) {
|
|
22244
22206
|
const claimed = /* @__PURE__ */ new Set();
|
|
22245
22207
|
for (const { ctx, cellBlocks } of structured) {
|
|
@@ -24002,7 +23964,7 @@ function fillClickHereInXml(xml, cursor, blockedLabels) {
|
|
|
24002
23964
|
};
|
|
24003
23965
|
}
|
|
24004
23966
|
async function extractClickHereFields(hwpxBuffer) {
|
|
24005
|
-
|
|
23967
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24006
23968
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24007
23969
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24008
23970
|
const fields = [];
|
|
@@ -24038,7 +24000,7 @@ function readZipEntries(buf) {
|
|
|
24038
24000
|
}
|
|
24039
24001
|
function localDataStart(view, localOffset) {
|
|
24040
24002
|
if (view.getUint32(localOffset, true) !== LOCAL_SIG) {
|
|
24041
|
-
throw new (0,
|
|
24003
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24042
24004
|
}
|
|
24043
24005
|
const nameLen = view.getUint16(localOffset + 26, true);
|
|
24044
24006
|
const extraLen = view.getUint16(localOffset + 28, true);
|
|
@@ -24068,19 +24030,19 @@ function parseCentralDirectory(buf) {
|
|
|
24068
24030
|
}
|
|
24069
24031
|
}
|
|
24070
24032
|
}
|
|
24071
|
-
if (eocdOffset < 0) throw new (0,
|
|
24033
|
+
if (eocdOffset < 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24072
24034
|
const totalEntries = view.getUint16(eocdOffset + 10, true);
|
|
24073
24035
|
const cdSize = view.getUint32(eocdOffset + 12, true);
|
|
24074
24036
|
const cdOffset = view.getUint32(eocdOffset + 16, true);
|
|
24075
|
-
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0,
|
|
24037
|
+
if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24076
24038
|
if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
|
|
24077
|
-
throw new (0,
|
|
24039
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24078
24040
|
}
|
|
24079
24041
|
const decoder = new TextDecoder("utf-8");
|
|
24080
24042
|
const entries = [];
|
|
24081
24043
|
let pos = cdOffset;
|
|
24082
24044
|
for (let i = 0; i < totalEntries; i++) {
|
|
24083
|
-
if (view.getUint32(pos, true) !== CD_SIG) throw new (0,
|
|
24045
|
+
if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
|
|
24084
24046
|
const flags = view.getUint16(pos + 8, true);
|
|
24085
24047
|
const method = view.getUint16(pos + 10, true);
|
|
24086
24048
|
const crc = view.getUint32(pos + 16, true);
|
|
@@ -24091,7 +24053,7 @@ function parseCentralDirectory(buf) {
|
|
|
24091
24053
|
const commentLen = view.getUint16(pos + 32, true);
|
|
24092
24054
|
const localOffset = view.getUint32(pos + 42, true);
|
|
24093
24055
|
if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
|
|
24094
|
-
throw new (0,
|
|
24056
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
|
|
24095
24057
|
}
|
|
24096
24058
|
const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
|
|
24097
24059
|
const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
|
|
@@ -24120,11 +24082,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24120
24082
|
const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
|
|
24121
24083
|
const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
|
|
24122
24084
|
for (const name of replacements.keys()) {
|
|
24123
|
-
if (!entries.some((e) => e.name === name)) throw new (0,
|
|
24085
|
+
if (!entries.some((e) => e.name === name)) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24124
24086
|
}
|
|
24125
24087
|
if (additions) {
|
|
24126
24088
|
for (const name of additions.keys()) {
|
|
24127
|
-
if (entries.some((e) => e.name === name)) throw new (0,
|
|
24089
|
+
if (entries.some((e) => e.name === name)) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
|
|
24128
24090
|
}
|
|
24129
24091
|
}
|
|
24130
24092
|
const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
|
|
@@ -24143,7 +24105,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24143
24105
|
offset += seg.length;
|
|
24144
24106
|
continue;
|
|
24145
24107
|
}
|
|
24146
|
-
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0,
|
|
24108
|
+
if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkFJ45NNLAcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
|
|
24147
24109
|
const nameLen = view.getUint16(e.localOffset + 26, true);
|
|
24148
24110
|
const extraLen = view.getUint16(e.localOffset + 28, true);
|
|
24149
24111
|
const headerLen = 30 + nameLen + extraLen;
|
|
@@ -24151,7 +24113,7 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24151
24113
|
const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
|
|
24152
24114
|
const method = e.method;
|
|
24153
24115
|
if (method !== 0 && method !== 8) {
|
|
24154
|
-
throw new (0,
|
|
24116
|
+
throw new (0, _chunkFJ45NNLAcjs.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
24117
|
}
|
|
24156
24118
|
const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
|
|
24157
24119
|
const crc = crc32(newData);
|
|
@@ -24249,11 +24211,11 @@ function patchZipEntries(original, replacements, additions) {
|
|
|
24249
24211
|
// src/form/filler-hwpx.ts
|
|
24250
24212
|
async function fillHwpx(hwpxBuffer, values, blockedLabels) {
|
|
24251
24213
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
24252
|
-
|
|
24214
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
24253
24215
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
24254
24216
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
|
|
24255
24217
|
if (sectionPaths.length === 0) {
|
|
24256
|
-
throw new (0,
|
|
24218
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
24257
24219
|
}
|
|
24258
24220
|
const warnings = [];
|
|
24259
24221
|
const normalizedValues = normalizeValues(values, warnings);
|
|
@@ -24645,7 +24607,7 @@ var MIN_SIDE = 24;
|
|
|
24645
24607
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24646
24608
|
const ocr = _optionalChain([options, 'optionalAccess', _485 => _485.ocr]);
|
|
24647
24609
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24648
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
24610
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-DP4YTLGN.cjs")));
|
|
24649
24611
|
let inserted = false, unreadable = 0;
|
|
24650
24612
|
let failed = null;
|
|
24651
24613
|
const walk = async (list, depth) => {
|
|
@@ -24686,7 +24648,7 @@ async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
|
24686
24648
|
function ocrBytes(img) {
|
|
24687
24649
|
const mime = img.mimeType.toLowerCase();
|
|
24688
24650
|
if (mime.includes("wmf") || mime.includes("emf")) return null;
|
|
24689
|
-
if (mime.includes("bmp")) return
|
|
24651
|
+
if (mime.includes("bmp")) return _chunkTN4SSNEScjs.bmpToPng.call(void 0, img.data);
|
|
24690
24652
|
return img.data;
|
|
24691
24653
|
}
|
|
24692
24654
|
async function tooSmall(bytes) {
|
|
@@ -24855,7 +24817,7 @@ function classifyTableTree(blocks) {
|
|
|
24855
24817
|
return blocks;
|
|
24856
24818
|
}
|
|
24857
24819
|
function chooseTableRepresentation(table2, opts = {}) {
|
|
24858
|
-
const structured = hasMerged(table2) ||
|
|
24820
|
+
const structured = hasMerged(table2) || _chunkS34OVRKDcjs.hasStructuredCellContent.call(void 0, table2);
|
|
24859
24821
|
if (opts.smartVisual && _optionalChain([table2, 'access', _501 => _501.classification, 'optionalAccess', _502 => _502.kind]) === "non-tabular-layout") return "visual";
|
|
24860
24822
|
return structured ? "html" : "gfm";
|
|
24861
24823
|
}
|
|
@@ -35850,7 +35812,7 @@ function findAgency(name) {
|
|
|
35850
35812
|
}
|
|
35851
35813
|
function agencyStyle(name) {
|
|
35852
35814
|
const s = findAgency(name);
|
|
35853
|
-
if (!s) throw new (0,
|
|
35815
|
+
if (!s) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`agency: \uC2E4\uCE21 \uC11C\uC2DD\uC774 \uC5C6\uB294 \uAE30\uAD00\uC785\uB2C8\uB2E4 "${name}" \u2014 ${AGENCY_COMMON_NAME} \uB610\uB294 ${agencyNames().join("\xB7")}`);
|
|
35854
35816
|
return s;
|
|
35855
35817
|
}
|
|
35856
35818
|
function applyAgency(opts, preset) {
|
|
@@ -36914,7 +36876,7 @@ function needsGaejosikAssets(gongmun) {
|
|
|
36914
36876
|
}
|
|
36915
36877
|
function assertFiniteRange(name, value, min, max) {
|
|
36916
36878
|
if (!Number.isFinite(value) || value < min || value > max) {
|
|
36917
|
-
throw new (0,
|
|
36879
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
|
|
36918
36880
|
}
|
|
36919
36881
|
}
|
|
36920
36882
|
function validateGongmunOptions(opts) {
|
|
@@ -36932,10 +36894,10 @@ function validateGongmunOptions(opts) {
|
|
|
36932
36894
|
assertFiniteRange(`margins.${side}`, value, 0, 200);
|
|
36933
36895
|
}
|
|
36934
36896
|
if (opts.margins.left + opts.margins.right >= 210) {
|
|
36935
|
-
throw new (0,
|
|
36897
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("margins.left + margins.right must be less than 210");
|
|
36936
36898
|
}
|
|
36937
36899
|
if (opts.margins.top + opts.margins.bottom >= 297) {
|
|
36938
|
-
throw new (0,
|
|
36900
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("margins.top + margins.bottom must be less than 297");
|
|
36939
36901
|
}
|
|
36940
36902
|
}
|
|
36941
36903
|
if (opts.sizes) {
|
|
@@ -36944,24 +36906,24 @@ function validateGongmunOptions(opts) {
|
|
|
36944
36906
|
}
|
|
36945
36907
|
}
|
|
36946
36908
|
if (opts.approval && opts.approval.length > 6) {
|
|
36947
|
-
throw new (0,
|
|
36909
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("approval must contain at most 6 labels");
|
|
36948
36910
|
}
|
|
36949
36911
|
if (opts.checklist && typeof opts.checklist === "object") {
|
|
36950
36912
|
const nums = [..._nullishCoalesce(opts.checklist.na, () => ( [])), ...Object.keys(_nullishCoalesce(opts.checklist.notes, () => ( {}))).map(Number)];
|
|
36951
36913
|
for (const n of nums) {
|
|
36952
|
-
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0,
|
|
36914
|
+
if (!Number.isInteger(n) || n < 1 || n > CHECKLIST_ITEMS) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`checklist: item number must be an integer between 1 and ${CHECKLIST_ITEMS} (got ${n})`);
|
|
36953
36915
|
}
|
|
36954
36916
|
}
|
|
36955
36917
|
if (opts.levels) {
|
|
36956
36918
|
for (const [key, st] of Object.entries(opts.levels)) {
|
|
36957
36919
|
const depth = Number(key);
|
|
36958
36920
|
if (!Number.isInteger(depth) || depth < 0 || depth >= GONGMUN_LEVEL_COUNT) {
|
|
36959
|
-
throw new (0,
|
|
36921
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`levels: depth must be an integer between 0 and ${GONGMUN_LEVEL_COUNT - 1} (got "${key}")`);
|
|
36960
36922
|
}
|
|
36961
|
-
if (!st || typeof st !== "object") throw new (0,
|
|
36923
|
+
if (!st || typeof st !== "object") throw new (0, _chunkFJ45NNLAcjs.KordocError)(`levels.${key} must be an object {font, pt, bold}`);
|
|
36962
36924
|
if (st.pt !== void 0) assertFiniteRange(`levels.${key}.pt`, st.pt, 6, 60);
|
|
36963
36925
|
if (st.font !== void 0 && (typeof st.font !== "string" || !st.font.trim())) {
|
|
36964
|
-
throw new (0,
|
|
36926
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`levels.${key}.font must be a non-empty string`);
|
|
36965
36927
|
}
|
|
36966
36928
|
}
|
|
36967
36929
|
}
|
|
@@ -37019,7 +36981,7 @@ function resolveChecklist(c, preset) {
|
|
|
37019
36981
|
function hexColorOption(name, value) {
|
|
37020
36982
|
if (value === void 0) return void 0;
|
|
37021
36983
|
const v = value.trim();
|
|
37022
|
-
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0,
|
|
36984
|
+
if (!/^#[0-9a-fA-F]{6}$/.test(v)) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`${name} must be a #RRGGBB color (got "${value}")`);
|
|
37023
36985
|
return v.toUpperCase();
|
|
37024
36986
|
}
|
|
37025
36987
|
function resolveGongmun(input) {
|
|
@@ -37095,21 +37057,21 @@ function standardMarker(depth, n) {
|
|
|
37095
37057
|
case 0:
|
|
37096
37058
|
return `${n + 1}.`;
|
|
37097
37059
|
case 1:
|
|
37098
|
-
return `${hangulOrdinal(n)}.`;
|
|
37060
|
+
return `${_chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n)}.`;
|
|
37099
37061
|
case 2:
|
|
37100
37062
|
return `${n + 1})`;
|
|
37101
37063
|
case 3:
|
|
37102
|
-
return `${hangulOrdinal(n)})`;
|
|
37064
|
+
return `${_chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37103
37065
|
case 4:
|
|
37104
37066
|
return `(${n + 1})`;
|
|
37105
37067
|
case 5:
|
|
37106
|
-
return `(${hangulOrdinal(n)})`;
|
|
37068
|
+
return `(${_chunkS34OVRKDcjs.hangulOrdinal.call(void 0, n)})`;
|
|
37107
37069
|
case 6:
|
|
37108
|
-
return circledNumber(n);
|
|
37070
|
+
return _chunkS34OVRKDcjs.circledNumber.call(void 0, n);
|
|
37109
37071
|
case 7:
|
|
37110
|
-
return circledHangul(n);
|
|
37072
|
+
return _chunkS34OVRKDcjs.circledHangul.call(void 0, n);
|
|
37111
37073
|
default:
|
|
37112
|
-
return circledHangul(n);
|
|
37074
|
+
return _chunkS34OVRKDcjs.circledHangul.call(void 0, n);
|
|
37113
37075
|
}
|
|
37114
37076
|
}
|
|
37115
37077
|
function reportMarker(depth, bullet2 = "\u25CB", asteriskThird = false) {
|
|
@@ -37763,7 +37725,7 @@ function parseInlineMarkdown(text) {
|
|
|
37763
37725
|
else spans.push(...emphasisSpans(m[0]));
|
|
37764
37726
|
} else {
|
|
37765
37727
|
const anchor = m[2] || m[3];
|
|
37766
|
-
const href = _nullishCoalesce(
|
|
37728
|
+
const href = _nullishCoalesce(_chunkFJ45NNLAcjs.sanitizeHref.call(void 0, m[3].trim()), () => ( void 0));
|
|
37767
37729
|
const sub = emphasisSpans(anchor);
|
|
37768
37730
|
if (href) for (const s of sub) s.href = href;
|
|
37769
37731
|
spans.push(...sub);
|
|
@@ -37984,7 +37946,7 @@ function assertSequentialIds(rows, label, startId) {
|
|
|
37984
37946
|
const m = rows[i].match(/\bid="(\d+)"/);
|
|
37985
37947
|
const got = m ? Number(m[1]) : NaN;
|
|
37986
37948
|
if (got !== startId + i) {
|
|
37987
|
-
throw new (0,
|
|
37949
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
37988
37950
|
`\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)`
|
|
37989
37951
|
);
|
|
37990
37952
|
}
|
|
@@ -38075,7 +38037,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
|
|
|
38075
38037
|
}
|
|
38076
38038
|
const expectedBase = charVariantBase(richAssets, !!gongmun);
|
|
38077
38039
|
if (rows.length !== expectedBase) {
|
|
38078
|
-
throw new (0,
|
|
38040
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
38079
38041
|
`\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`
|
|
38080
38042
|
);
|
|
38081
38043
|
}
|
|
@@ -38583,7 +38545,7 @@ function variantMapper(fit, blockIdx, base = CHAR_VARIANT_BASE) {
|
|
|
38583
38545
|
const vi = fit.variants.indexOf(r);
|
|
38584
38546
|
return (id) => id >= 0 && id <= 3 ? base + vi * 4 + id : id;
|
|
38585
38547
|
}
|
|
38586
|
-
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => hangulOrdinal(i)));
|
|
38548
|
+
var ORDINAL_SYLLABLES = new Set(Array.from({ length: 84 }, (_, i) => _chunkS34OVRKDcjs.hangulOrdinal.call(void 0, i)));
|
|
38587
38549
|
function literalMarkerDepth(text) {
|
|
38588
38550
|
const t = text.trimStart();
|
|
38589
38551
|
let m;
|
|
@@ -39084,7 +39046,7 @@ function bestSimInRange(arr, from, to, target) {
|
|
|
39084
39046
|
return best;
|
|
39085
39047
|
}
|
|
39086
39048
|
function normForMatch(text) {
|
|
39087
|
-
return
|
|
39049
|
+
return _chunkS34OVRKDcjs.sanitizeText.call(void 0, text.replace(/\\\$/g, "$").replace(/\\(?=<\/?(?:u|sup|sub)>)/g, "")).replace(/\s+/g, " ").trim();
|
|
39088
39050
|
}
|
|
39089
39051
|
function unescapeGfm(text) {
|
|
39090
39052
|
return text.replace(/\\([~*_`|#<$\\])/g, "$1");
|
|
@@ -39106,7 +39068,7 @@ function replicateGfmTable(table2) {
|
|
|
39106
39068
|
const cell2 = _optionalChain([cells, 'access', _632 => _632[r], 'optionalAccess', _633 => _633[c]]);
|
|
39107
39069
|
if (!cell2) continue;
|
|
39108
39070
|
display[r][c] = {
|
|
39109
|
-
text:
|
|
39071
|
+
text: _chunkS34OVRKDcjs.escapeGfm.call(void 0, _chunkS34OVRKDcjs.sanitizeText.call(void 0, cell2.text)).replace(/(?<!\\)\|/g, "\\|").replace(/\r\n|\r|\n/g, "<br>"),
|
|
39110
39072
|
gridR: r,
|
|
39111
39073
|
gridC: c
|
|
39112
39074
|
};
|
|
@@ -39146,16 +39108,16 @@ function replicateCellInnerHtml(cell2) {
|
|
|
39146
39108
|
if (_optionalChain([cell2, 'access', _634 => _634.blocks, 'optionalAccess', _635 => _635.length])) {
|
|
39147
39109
|
return cell2.blocks.map((b) => {
|
|
39148
39110
|
if (b.type === "table" && b.table) {
|
|
39149
|
-
const cap = b.table.caption ?
|
|
39150
|
-
return (cap ?
|
|
39111
|
+
const cap = b.table.caption ? _chunkS34OVRKDcjs.sanitizeText.call(void 0, b.table.caption) : "";
|
|
39112
|
+
return (cap ? _chunkS34OVRKDcjs.escapeHtmlCellText.call(void 0, cap) + "<br>" : "") + replicateTableToHtml(b.table);
|
|
39151
39113
|
}
|
|
39152
|
-
if (b.type === "image" && b.text) return `<img src="${
|
|
39153
|
-
const note =
|
|
39154
|
-
const t = (
|
|
39155
|
-
return ((t ?
|
|
39114
|
+
if (b.type === "image" && b.text) return `<img src="${_chunkFJ45NNLAcjs.escapeHtml.call(void 0, b.text, true)}" alt="image">`;
|
|
39115
|
+
const note = _chunkS34OVRKDcjs.noteTableHtml.call(void 0, b);
|
|
39116
|
+
const t = (_chunkS34OVRKDcjs.sanitizeText.call(void 0, _chunkS34OVRKDcjs.visibleText.call(void 0, b)) + (note ? "" : _chunkS34OVRKDcjs.noteSuffix.call(void 0, b))).trim();
|
|
39117
|
+
return ((t ? _chunkS34OVRKDcjs.escapeHtmlCellText.call(void 0, t).replace(/\n/g, "<br>") : "") + note).trim();
|
|
39156
39118
|
}).filter(Boolean).join("<br>");
|
|
39157
39119
|
}
|
|
39158
|
-
return
|
|
39120
|
+
return _chunkS34OVRKDcjs.escapeHtmlCellText.call(void 0, _chunkS34OVRKDcjs.sanitizeText.call(void 0, cell2.text)).replace(/\n/g, "<br>");
|
|
39159
39121
|
}
|
|
39160
39122
|
function replicateTableToHtml(table2) {
|
|
39161
39123
|
const rows = replicateHtmlTable(table2);
|
|
@@ -39232,7 +39194,7 @@ function parseHtmlTable(raw) {
|
|
|
39232
39194
|
const cs = parseInt(_optionalChain([attrs, 'access', _638 => _638.match, 'call', _639 => _639(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _640 => _640[1]]) || "1", 10);
|
|
39233
39195
|
const rs = parseInt(_optionalChain([attrs, 'access', _641 => _641.match, 'call', _642 => _642(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _643 => _643[1]]) || "1", 10);
|
|
39234
39196
|
cellStart = m.index + m[0].length;
|
|
39235
|
-
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs,
|
|
39197
|
+
cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkS34OVRKDcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkS34OVRKDcjs.MAX_ROWS) };
|
|
39236
39198
|
} else if (cellStart >= 0 && cellInfo && currentRow) {
|
|
39237
39199
|
currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
|
|
39238
39200
|
cellStart = -1;
|
|
@@ -39257,11 +39219,11 @@ function htmlCellInnerToLines(inner) {
|
|
|
39257
39219
|
work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
|
|
39258
39220
|
const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
|
|
39259
39221
|
const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _644 => _644[1]]), () => ( _optionalChain([m, 'optionalAccess', _645 => _645[2]])));
|
|
39260
|
-
if (src) imgSrcs.push(
|
|
39222
|
+
if (src) imgSrcs.push(_chunkFJ45NNLAcjs.unescapeHtml.call(void 0, src));
|
|
39261
39223
|
return "";
|
|
39262
39224
|
});
|
|
39263
39225
|
}
|
|
39264
|
-
const lines = work.split(/<br\s*\/?>/gi).map((s) =>
|
|
39226
|
+
const lines = work.split(/<br\s*\/?>/gi).map((s) => _chunkFJ45NNLAcjs.unescapeHtml.call(void 0, s).trim()).filter((s) => s.length > 0);
|
|
39265
39227
|
return { lines, hadNonText, imgSrcs };
|
|
39266
39228
|
}
|
|
39267
39229
|
function splitCellByTopLevelTables(html) {
|
|
@@ -40077,8 +40039,8 @@ function layoutHtmlRows(rows) {
|
|
|
40077
40039
|
let c = 0;
|
|
40078
40040
|
for (const cell2 of rows[r].cells) {
|
|
40079
40041
|
while (occupied.has(`${r},${c}`)) c++;
|
|
40080
|
-
const colSpan = clampSpan(cell2.colSpan,
|
|
40081
|
-
const rowSpan = clampSpan(cell2.rowSpan,
|
|
40042
|
+
const colSpan = clampSpan(cell2.colSpan, _chunkS34OVRKDcjs.MAX_COLS);
|
|
40043
|
+
const rowSpan = clampSpan(cell2.rowSpan, _chunkS34OVRKDcjs.MAX_ROWS);
|
|
40082
40044
|
placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
|
|
40083
40045
|
for (let dr = 0; dr < rowSpan; dr++) {
|
|
40084
40046
|
for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
|
|
@@ -41542,7 +41504,7 @@ function buildMinistryItemBand(n, text, ctx, before2) {
|
|
|
41542
41504
|
const base = { font: MINISTRY.bandFont, pt: s.pt, bold: false };
|
|
41543
41505
|
const f = fitOneLine(plain(text), MINISTRY.bandFont, s.pt, w - 1800, s.pt);
|
|
41544
41506
|
const styled = f.overflow || f.ratio === 100 && f.spacing === 0 ? base : { ...base, ratio: f.ratio, spacing: f.spacing };
|
|
41545
|
-
const runs = ministryRuns(circledNumber(n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41507
|
+
const runs = ministryRuns(_chunkS34OVRKDcjs.circledNumber.call(void 0, n - 1), text, ctx, styled, MINISTRY.blue, MINISTRY.blue);
|
|
41546
41508
|
const p = reg.para({ align: "LEFT", lineSp: 130, left: 300 });
|
|
41547
41509
|
const cell2 = tc({ bf: band, row: 0, col: 0, w, h: s.h, paras: `<hp:p paraPrIDRef="${p}" styleIDRef="0">${runs}</hp:p>`, name: "__kordoc_h5" });
|
|
41548
41510
|
return host(ftbl([cell2], w, s.h, 1, { bottomGap: 700 }), reg.para({ align: "LEFT", lineSp: 100, before: before2, keepWithNext: true }), reg.char(base));
|
|
@@ -42413,7 +42375,7 @@ function builtinTemplateDir() {
|
|
|
42413
42375
|
for (const c of candidates) {
|
|
42414
42376
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
42415
42377
|
}
|
|
42416
|
-
throw new (0,
|
|
42378
|
+
throw new (0, _chunkFJ45NNLAcjs.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)");
|
|
42417
42379
|
}
|
|
42418
42380
|
function readBuiltinTemplate(t) {
|
|
42419
42381
|
const buf = _fs.readFileSync.call(void 0, _path.join.call(void 0, builtinTemplateDir(), t.file));
|
|
@@ -42599,7 +42561,8 @@ function parseRenderStyles(headXml, opts) {
|
|
|
42599
42561
|
const before2024 = _optionalChain([opts, 'optionalAccess', _802 => _802.appMajor]) !== void 0 && opts.appMajor > 0 && opts.appMajor < 13;
|
|
42600
42562
|
const major = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _803 => _803.appMajor]), () => ( 0)), build = _nullishCoalesce(_optionalChain([opts, 'optionalAccess', _804 => _804.appBuild]), () => ( 0));
|
|
42601
42563
|
const halfQuote = major === 12 && build >= 4605 || major === 13 && build >= 3901 || major > 13;
|
|
42602
|
-
const
|
|
42564
|
+
const early2024 = major === 13 && build > 0 && build < 3622;
|
|
42565
|
+
const styles = { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map(), ...before2024 ? { before2024 } : {}, ...early2024 ? { early2024 } : {} };
|
|
42603
42566
|
const doc = createXmlParser().parseFromString(headXml, "text/xml");
|
|
42604
42567
|
const root = doc.documentElement;
|
|
42605
42568
|
if (!root) return styles;
|
|
@@ -42890,12 +42853,12 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
|
|
|
42890
42853
|
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>`;
|
|
42891
42854
|
}
|
|
42892
42855
|
async function placeSealHwpx(hwpxBuffer, ops) {
|
|
42893
|
-
if (ops.length === 0) throw new (0,
|
|
42856
|
+
if (ops.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42894
42857
|
const u8 = new Uint8Array(hwpxBuffer);
|
|
42895
|
-
|
|
42858
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, hwpxBuffer);
|
|
42896
42859
|
const zip = await _jszip2.default.loadAsync(hwpxBuffer);
|
|
42897
42860
|
const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _858 => _858.match, 'call', _859 => _859(/(\d+)\.xml$/i), 'optionalAccess', _860 => _860[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _861 => _861.match, 'call', _862 => _862(/(\d+)\.xml$/i), 'optionalAccess', _863 => _863[1]]), () => ( 0))));
|
|
42898
|
-
if (sectionPaths.length === 0) throw new (0,
|
|
42861
|
+
if (sectionPaths.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
42899
42862
|
const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
|
|
42900
42863
|
const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
|
|
42901
42864
|
const styles = headerPath ? parseRenderStyles(await readZipEntry(zip.file(headerPath), "text")) : null;
|
|
@@ -42936,11 +42899,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42936
42899
|
const manifestItems = [];
|
|
42937
42900
|
const placed = [];
|
|
42938
42901
|
for (const op of ops) {
|
|
42939
|
-
if (!op.anchor) throw new (0,
|
|
42940
|
-
if (!op.image || op.image.length === 0) throw new (0,
|
|
42902
|
+
if (!op.anchor) throw new (0, _chunkFJ45NNLAcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42903
|
+
if (!op.image || op.image.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
|
|
42941
42904
|
const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
|
|
42942
|
-
if (!MIME[ext]) throw new (0,
|
|
42943
|
-
if (!imageMagicMatches(op.image, ext)) throw new (0,
|
|
42905
|
+
if (!MIME[ext]) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
|
|
42906
|
+
if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkFJ45NNLAcjs.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)`);
|
|
42944
42907
|
const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
|
|
42945
42908
|
let found = null;
|
|
42946
42909
|
let total = 0;
|
|
@@ -42973,7 +42936,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42973
42936
|
}
|
|
42974
42937
|
}
|
|
42975
42938
|
}
|
|
42976
|
-
throw new (0,
|
|
42939
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
42977
42940
|
`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)})`
|
|
42978
42941
|
);
|
|
42979
42942
|
}
|
|
@@ -42981,7 +42944,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
|
|
|
42981
42944
|
const xml = sectionXmls[si];
|
|
42982
42945
|
const run = anchorRunInfo(xml, site.para, op.anchor);
|
|
42983
42946
|
if (!run) {
|
|
42984
|
-
throw new (0,
|
|
42947
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
|
|
42985
42948
|
}
|
|
42986
42949
|
const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _864 => _864.charPr, 'access', _865 => _865.get, 'call', _866 => _866(run.charPr), 'optionalAccess', _867 => _867.height]), () => ( 1e3));
|
|
42987
42950
|
const fontPt = charPrHeight / 100;
|
|
@@ -43259,7 +43222,7 @@ function pick(map, keys) {
|
|
|
43259
43222
|
return out;
|
|
43260
43223
|
}
|
|
43261
43224
|
async function hwpxToProfile(input) {
|
|
43262
|
-
const buf = input instanceof ArrayBuffer ? input :
|
|
43225
|
+
const buf = input instanceof ArrayBuffer ? input : _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, input);
|
|
43263
43226
|
const zip = await _jszip2.default.loadAsync(buf);
|
|
43264
43227
|
const parser = createXmlParser();
|
|
43265
43228
|
const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _892 => _892.file, 'call', _893 => _893(/[Hh]eader\.xml$/), 'optionalAccess', _894 => _894[0]])));
|
|
@@ -43561,7 +43524,7 @@ function moneyHangulCheck(m) {
|
|
|
43561
43524
|
const n = Number(m[1].replace(/,/g, ""));
|
|
43562
43525
|
const h = hangulToNumber(m[2].replace(/\s/g, ""));
|
|
43563
43526
|
if (!Number.isFinite(n) || h === null || h === n) return null;
|
|
43564
|
-
return `\uAE08${m[1]}\uC6D0(\uAE08${hangulAmount(n)}\uC6D0)`;
|
|
43527
|
+
return `\uAE08${m[1]}\uC6D0(\uAE08${_chunkS34OVRKDcjs.hangulAmount.call(void 0, n)}\uC6D0)`;
|
|
43565
43528
|
}
|
|
43566
43529
|
var RULES = [
|
|
43567
43530
|
// 날짜 ─ 온점 뒤 한 칸, 0 패딩 금지, 연도 4자리, 끝 마침표
|
|
@@ -43848,7 +43811,7 @@ function lintGongmunText(text, opts) {
|
|
|
43848
43811
|
}
|
|
43849
43812
|
function dictSuggest(code, match) {
|
|
43850
43813
|
const m = match.trim();
|
|
43851
|
-
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${hangulAmount(m)}\uC6D0)`;
|
|
43814
|
+
if (code === "MONEY_NO_HANGUL") return `${m} \u2192 ${m}(\uAE08${_chunkS34OVRKDcjs.hangulAmount.call(void 0, m)}\uC6D0)`;
|
|
43852
43815
|
if (code === "DATE_HYPHEN") {
|
|
43853
43816
|
const d = m.match(/^(\d{4})-(\d{1,2})-(\d{1,2})$/);
|
|
43854
43817
|
if (d) return `${m} \u2192 ${d[1]}. ${Number(d[2])}. ${Number(d[3])}.`;
|
|
@@ -44232,7 +44195,7 @@ function patchTableRows(input) {
|
|
|
44232
44195
|
const cells = input.editedCells(ins.ei);
|
|
44233
44196
|
if (!cells) return skip("\uC0BD\uC785 \uD589\uC5D0 \uC774\uBBF8\uC9C0/\uC911\uCCA9\uD45C \uD3EC\uD568 \u2014 \uD589 \uCD94\uAC00 \uBBF8\uC9C0\uC6D0");
|
|
44234
44197
|
for (const cell2 of cells) {
|
|
44235
|
-
const unstable = cell2.lines.find((l) =>
|
|
44198
|
+
const unstable = cell2.lines.find((l) => _chunkS34OVRKDcjs.sanitizeText.call(void 0, l) !== l);
|
|
44236
44199
|
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");
|
|
44237
44200
|
}
|
|
44238
44201
|
const tmplCells = scanTable.rows[template];
|
|
@@ -44427,14 +44390,14 @@ function buildEmbeddedLineSplices(para2, xml, newLines) {
|
|
|
44427
44390
|
}
|
|
44428
44391
|
if (text !== para2.text || !/[\r\n]/.test(text) || /<br\s*\/?\s*>/i.test(text)) return null;
|
|
44429
44392
|
const lines = text.split(/\r\n|\r|\n/);
|
|
44430
|
-
if (lines.length !== newLines.length || lines.some((line) => !line.trim() ||
|
|
44393
|
+
if (lines.length !== newLines.length || lines.some((line) => !line.trim() || _chunkS34OVRKDcjs.sanitizeText.call(void 0, line) !== line.trim())) return null;
|
|
44431
44394
|
const splices = [];
|
|
44432
44395
|
let offset = 0;
|
|
44433
44396
|
for (let i = 0; i < lines.length; i++) {
|
|
44434
44397
|
const line = lines[i];
|
|
44435
44398
|
const orig = line.trim();
|
|
44436
44399
|
const next = newLines[i];
|
|
44437
|
-
if (
|
|
44400
|
+
if (_chunkS34OVRKDcjs.sanitizeText.call(void 0, next) !== next || /[\r\n]/.test(next) || /[\uD800-\uDFFF]/u.test(next) || decodeXmlEntities(escapeXmlText(next)) !== next) return null;
|
|
44438
44401
|
let prefix = 0;
|
|
44439
44402
|
while (prefix < orig.length && prefix < next.length && orig[prefix] === next[prefix]) prefix++;
|
|
44440
44403
|
if (prefix > 0 && /[\uD800-\uDBFF]/.test(orig[prefix - 1]) && /[\uDC00-\uDFFF]/.test(_nullishCoalesce(orig[prefix], () => ( "")))) prefix--;
|
|
@@ -44834,12 +44797,12 @@ function stripCellTokens(text) {
|
|
|
44834
44797
|
}
|
|
44835
44798
|
function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
44836
44799
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
44837
|
-
const content =
|
|
44800
|
+
const content = _chunkS34OVRKDcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
44838
44801
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
44839
44802
|
const t = line.trim();
|
|
44840
44803
|
if (!t) return "";
|
|
44841
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
44842
|
-
return
|
|
44804
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkS34OVRKDcjs.escapeGfm.call(void 0, t)}**`;
|
|
44805
|
+
return _chunkS34OVRKDcjs.escapeGfm.call(void 0, t);
|
|
44843
44806
|
}).filter(Boolean);
|
|
44844
44807
|
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");
|
|
44845
44808
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -44853,7 +44816,7 @@ function patchTextChunkTable(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
44853
44816
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
44854
44817
|
const replica = [];
|
|
44855
44818
|
for (let r = 0; r < table2.rows; r++) {
|
|
44856
|
-
const line =
|
|
44819
|
+
const line = _chunkS34OVRKDcjs.escapeGfm.call(void 0, _chunkS34OVRKDcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
44857
44820
|
if (line) replica.push({ line, gridR: r });
|
|
44858
44821
|
}
|
|
44859
44822
|
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");
|
|
@@ -44907,7 +44870,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
44907
44870
|
}
|
|
44908
44871
|
const splices = [];
|
|
44909
44872
|
let sectionIndex = -1;
|
|
44910
|
-
const unstable = newLines.find((l) =>
|
|
44873
|
+
const unstable = newLines.find((l) => _chunkS34OVRKDcjs.sanitizeText.call(void 0, l) !== l);
|
|
44911
44874
|
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");
|
|
44912
44875
|
if (nonEmpty.length === 0) {
|
|
44913
44876
|
if (newLines.length === 0) return 0;
|
|
@@ -45031,7 +44994,7 @@ async function resolveSectionEntryNames(zip) {
|
|
|
45031
44994
|
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
45032
44995
|
if (paths.length > 0) return paths;
|
|
45033
44996
|
}
|
|
45034
|
-
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(
|
|
44997
|
+
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkFJ45NNLAcjs.compareSectionPaths);
|
|
45035
44998
|
}
|
|
45036
44999
|
|
|
45037
45000
|
// src/roundtrip/hwp5-patch.ts
|
|
@@ -45818,7 +45781,7 @@ function patchParagraph(block, orig, edited, ctx, skip) {
|
|
|
45818
45781
|
}
|
|
45819
45782
|
const origPlain = block.text != null ? block.text : restoreBr(textUnitToPlain(orig.raw, block));
|
|
45820
45783
|
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");
|
|
45821
|
-
if (
|
|
45784
|
+
if (_chunkS34OVRKDcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
45822
45785
|
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");
|
|
45823
45786
|
}
|
|
45824
45787
|
let origMd = restoreBr(textUnitToPlain(orig.raw, block));
|
|
@@ -45865,7 +45828,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45865
45828
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45866
45829
|
continue;
|
|
45867
45830
|
}
|
|
45868
|
-
if (afterEach.some((l) =>
|
|
45831
|
+
if (afterEach.some((l) => _chunkS34OVRKDcjs.sanitizeText.call(void 0, l) !== l)) {
|
|
45869
45832
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45870
45833
|
continue;
|
|
45871
45834
|
}
|
|
@@ -45893,7 +45856,7 @@ function patchGfmCells(scanTable, orig, edited, ctx, skip) {
|
|
|
45893
45856
|
cellSkip("\uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58 \u2014 \uC18C\uC2A4\uB9F5 \uC2E0\uB8B0 \uBD88\uAC00");
|
|
45894
45857
|
break;
|
|
45895
45858
|
}
|
|
45896
|
-
if (
|
|
45859
|
+
if (_chunkS34OVRKDcjs.sanitizeText.call(void 0, after2) !== after2) {
|
|
45897
45860
|
cellSkip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uBBF8\uC9C0\uC6D0");
|
|
45898
45861
|
break;
|
|
45899
45862
|
}
|
|
@@ -45949,12 +45912,12 @@ function patchHtmlCells5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45949
45912
|
}
|
|
45950
45913
|
function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
45951
45914
|
if (table2.rows === 1 && table2.cols === 1) {
|
|
45952
|
-
const content =
|
|
45915
|
+
const content = _chunkS34OVRKDcjs.sanitizeText.call(void 0, table2.cells[0][0].text);
|
|
45953
45916
|
const replicaLines = content.split(/\n/).map((line) => {
|
|
45954
45917
|
const t = line.trim();
|
|
45955
45918
|
if (!t) return "";
|
|
45956
|
-
if (/^\d+\.\s/.test(t)) return `**${
|
|
45957
|
-
return
|
|
45919
|
+
if (/^\d+\.\s/.test(t)) return `**${_chunkS34OVRKDcjs.escapeGfm.call(void 0, t)}**`;
|
|
45920
|
+
return _chunkS34OVRKDcjs.escapeGfm.call(void 0, t);
|
|
45958
45921
|
}).filter(Boolean);
|
|
45959
45922
|
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");
|
|
45960
45923
|
if (extractCellTokens(orig.raw) !== extractCellTokens(edited.raw)) return skip("\uC140 \uB0B4 \uC774\uBBF8\uC9C0 \uBCC0\uACBD\uC740 \uBBF8\uC9C0\uC6D0");
|
|
@@ -45968,7 +45931,7 @@ function patchTextChunk5(table2, scanTable, orig, edited, ctx, skip) {
|
|
|
45968
45931
|
if (table2.cols === 1 && table2.rows >= 2) {
|
|
45969
45932
|
const replica = [];
|
|
45970
45933
|
for (let r = 0; r < table2.rows; r++) {
|
|
45971
|
-
const line =
|
|
45934
|
+
const line = _chunkS34OVRKDcjs.escapeGfm.call(void 0, _chunkS34OVRKDcjs.sanitizeText.call(void 0, table2.cells[r][0].text)).replace(/\n/g, " ");
|
|
45972
45935
|
if (line) replica.push({ line, gridR: r });
|
|
45973
45936
|
}
|
|
45974
45937
|
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");
|
|
@@ -46009,7 +45972,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before2,
|
|
|
46009
45972
|
if (origLineCount !== void 0 && nonEmpty.length > 0 && origLineCount !== nonEmpty.length) {
|
|
46010
45973
|
return skip("\uC140 \uC904 \uACBD\uACC4 \uB9E4\uD551 \uBAA8\uD638 (\uBB38\uB2E8 \uB0B4 \uC904\uBC14\uAFC8) \u2014 \uBBF8\uC9C0\uC6D0");
|
|
46011
45974
|
}
|
|
46012
|
-
const unstable = newLines.find((l) =>
|
|
45975
|
+
const unstable = newLines.find((l) => _chunkS34OVRKDcjs.sanitizeText.call(void 0, l) !== l);
|
|
46013
45976
|
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");
|
|
46014
45977
|
const targets = nonEmpty.length > 0 ? nonEmpty : cell2.paras;
|
|
46015
45978
|
if (targets.length === 0) return skip("\uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC74C \u2014 \uBBF8\uC9C0\uC6D0");
|
|
@@ -46411,12 +46374,12 @@ function buildOrigUnits(blocks) {
|
|
|
46411
46374
|
const block = blocks[i];
|
|
46412
46375
|
let consume = 1;
|
|
46413
46376
|
let chunk;
|
|
46414
|
-
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(
|
|
46377
|
+
if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(_chunkS34OVRKDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46415
46378
|
const next = blocks[i + 1];
|
|
46416
46379
|
if (_optionalChain([next, 'optionalAccess', _969 => _969.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
|
|
46417
|
-
chunk =
|
|
46380
|
+
chunk = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
|
|
46418
46381
|
} else {
|
|
46419
|
-
chunk =
|
|
46382
|
+
chunk = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, [block]);
|
|
46420
46383
|
}
|
|
46421
46384
|
if (chunk) {
|
|
46422
46385
|
const subUnits = splitMarkdownUnits(chunk);
|
|
@@ -46700,7 +46663,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
|
|
|
46700
46663
|
}
|
|
46701
46664
|
}
|
|
46702
46665
|
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");
|
|
46703
|
-
if (
|
|
46666
|
+
if (_chunkS34OVRKDcjs.sanitizeText.call(void 0, newPlain) !== newPlain && _chunkS34OVRKDcjs.sanitizeText.call(void 0, origPlain) === origPlain) {
|
|
46704
46667
|
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");
|
|
46705
46668
|
}
|
|
46706
46669
|
const xml = _optionalChain([ctx, 'access', _981 => _981.scans, 'access', _982 => _982[mapping.para.sectionIndex], 'optionalAccess', _983 => _983.xml]);
|
|
@@ -46717,14 +46680,14 @@ function textUnitToPlain(raw, block) {
|
|
|
46717
46680
|
}
|
|
46718
46681
|
function textUnitInline(raw, block) {
|
|
46719
46682
|
let text = raw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
|
|
46720
|
-
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(
|
|
46683
|
+
if (block.type === "heading" || block.text && /^\[별표\s*\d+/.test(_chunkS34OVRKDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46721
46684
|
text = text.replace(/^#{1,6}\s+/, "");
|
|
46722
46685
|
}
|
|
46723
46686
|
if (block.href) {
|
|
46724
46687
|
const linkMatch = text.match(/^\[([\s\S]*)\]\([^)]*\)$/);
|
|
46725
46688
|
if (linkMatch) text = linkMatch[1];
|
|
46726
46689
|
}
|
|
46727
|
-
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(
|
|
46690
|
+
if (/^\*[^*][\s\S]*\*$/.test(text) && block.text && /^\([^)]*조[^)]*관련\)$/.test(_chunkS34OVRKDcjs.sanitizeText.call(void 0, block.text))) {
|
|
46728
46691
|
text = text.slice(1, -1);
|
|
46729
46692
|
}
|
|
46730
46693
|
return text;
|
|
@@ -49272,7 +49235,7 @@ function blocksToChunks(blocks, options) {
|
|
|
49272
49235
|
const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1014 => _1014.granularity]), () => ( "section"));
|
|
49273
49236
|
const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1015 => _1015.includeTableCells]), () => ( false));
|
|
49274
49237
|
const mdOptions = { tableFormat: _optionalChain([options, 'optionalAccess', _1016 => _1016.tableFormat]) };
|
|
49275
|
-
if (_optionalChain([options, 'optionalAccess', _1017 => _1017.tableFormat]) === "gfm")
|
|
49238
|
+
if (_optionalChain([options, 'optionalAccess', _1017 => _1017.tableFormat]) === "gfm") _chunkS34OVRKDcjs.assignTableIds.call(void 0, blocks);
|
|
49276
49239
|
const chunks = [];
|
|
49277
49240
|
const headingStack = [];
|
|
49278
49241
|
const listStack = [];
|
|
@@ -49286,12 +49249,12 @@ function blocksToChunks(blocks, options) {
|
|
|
49286
49249
|
let run = null;
|
|
49287
49250
|
const flushRun = () => {
|
|
49288
49251
|
if (!run) return;
|
|
49289
|
-
push("text", run.breadcrumb,
|
|
49252
|
+
push("text", run.breadcrumb, _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, run.blocks, mdOptions), [run.start, run.end], run.page);
|
|
49290
49253
|
run = null;
|
|
49291
49254
|
};
|
|
49292
49255
|
for (let i = 0; i < blocks.length; i++) {
|
|
49293
49256
|
const block = blocks[i];
|
|
49294
|
-
const md2 =
|
|
49257
|
+
const md2 = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, [block], mdOptions);
|
|
49295
49258
|
if (!md2) continue;
|
|
49296
49259
|
if (block.type === "heading") {
|
|
49297
49260
|
flushRun();
|
|
@@ -49379,7 +49342,7 @@ function u8ToArrayBuffer2(u8) {
|
|
|
49379
49342
|
return u8.buffer.slice(u8.byteOffset, u8.byteOffset + u8.byteLength);
|
|
49380
49343
|
}
|
|
49381
49344
|
function irCellLines(text) {
|
|
49382
|
-
return stripCellTokens(
|
|
49345
|
+
return stripCellTokens(_chunkS34OVRKDcjs.sanitizeText.call(void 0, text)).split("\n").map((s) => s.trim()).filter(Boolean);
|
|
49383
49346
|
}
|
|
49384
49347
|
var HwpxSession = (_class10 = class _HwpxSession {
|
|
49385
49348
|
|
|
@@ -49639,7 +49602,7 @@ var HwpxSession = (_class10 = class _HwpxSession {
|
|
|
49639
49602
|
if (newPlain === "") {
|
|
49640
49603
|
return skip("\uBE14\uB85D \uBE44\uC6B0\uAE30/\uC0AD\uC81C\uB294 \uBBF8\uC9C0\uC6D0 (v1) \u2014 \uC6D0\uBCF8 \uC720\uC9C0");
|
|
49641
49604
|
}
|
|
49642
|
-
if (
|
|
49605
|
+
if (_chunkS34OVRKDcjs.sanitizeText.call(void 0, newPlain) !== newPlain) {
|
|
49643
49606
|
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");
|
|
49644
49607
|
}
|
|
49645
49608
|
const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _1037 => _1037.scans, 'access', _1038 => _1038[mapping.para.sectionIndex], 'optionalAccess', _1039 => _1039.xml]));
|
|
@@ -49734,7 +49697,7 @@ var md = new (0, _markdownit2.default)({
|
|
|
49734
49697
|
});
|
|
49735
49698
|
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;
|
|
49736
49699
|
function sanitizeRawHtml(raw) {
|
|
49737
|
-
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag :
|
|
49700
|
+
return raw.replace(/<[^>]*>|</g, (tag) => SAFE_RAW_TAG.test(tag) ? tag : _chunkFJ45NNLAcjs.escapeHtml.call(void 0, tag));
|
|
49738
49701
|
}
|
|
49739
49702
|
md.renderer.rules.html_block = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
49740
49703
|
md.renderer.rules.html_inline = (tokens, idx) => sanitizeRawHtml(tokens[idx].content);
|
|
@@ -49742,7 +49705,7 @@ function renderHtml(markdown, options) {
|
|
|
49742
49705
|
const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1043 => _1043.preset]), () => ( "default"));
|
|
49743
49706
|
const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _1044 => _1044.extraCss]), () => ( "")));
|
|
49744
49707
|
const body = md.render(markdown);
|
|
49745
|
-
const watermark = _optionalChain([options, 'optionalAccess', _1045 => _1045.watermark]) ? `<div class="watermark">${
|
|
49708
|
+
const watermark = _optionalChain([options, 'optionalAccess', _1045 => _1045.watermark]) ? `<div class="watermark">${_chunkFJ45NNLAcjs.escapeHtml.call(void 0, options.watermark)}</div>` : "";
|
|
49746
49709
|
const watermarkCss = _optionalChain([options, 'optionalAccess', _1046 => _1046.watermark]) ? `
|
|
49747
49710
|
.watermark {
|
|
49748
49711
|
position: fixed;
|
|
@@ -49796,13 +49759,13 @@ async function htmlToPdf(html, options) {
|
|
|
49796
49759
|
try {
|
|
49797
49760
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
49798
49761
|
} catch (e42) {
|
|
49799
|
-
throw new (0,
|
|
49762
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
49800
49763
|
"PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
|
|
49801
49764
|
);
|
|
49802
49765
|
}
|
|
49803
49766
|
const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
|
|
49804
49767
|
if (!executablePath) {
|
|
49805
|
-
throw new (0,
|
|
49768
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
49806
49769
|
"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."
|
|
49807
49770
|
);
|
|
49808
49771
|
}
|
|
@@ -49857,7 +49820,7 @@ async function markdownToPdf(markdown, options) {
|
|
|
49857
49820
|
return htmlToPdf(html, options);
|
|
49858
49821
|
}
|
|
49859
49822
|
async function blocksToPdf(blocks, options) {
|
|
49860
|
-
const markdown =
|
|
49823
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks);
|
|
49861
49824
|
return markdownToPdf(markdown, options);
|
|
49862
49825
|
}
|
|
49863
49826
|
|
|
@@ -50359,13 +50322,15 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
|
|
|
50359
50322
|
const rows = measureTableRowHeights(tbl2);
|
|
50360
50323
|
if (rows.length === 0) return void 0;
|
|
50361
50324
|
const outT = num2(om, "top");
|
|
50325
|
+
const cap = captionOf(tbl2);
|
|
50326
|
+
const capTop = _optionalChain([cap, 'optionalAccess', _1097 => _1097.side]) === "TOP" ? cap.h + cap.gap : 0, capBottom = _optionalChain([cap, 'optionalAccess', _1098 => _1098.side]) === "BOTTOM" ? cap.h + cap.gap : 0;
|
|
50362
50327
|
let headH = 0;
|
|
50363
50328
|
if (tbl2.getAttribute("repeatHeader") === "1") {
|
|
50364
50329
|
const heads = /* @__PURE__ */ new Set();
|
|
50365
50330
|
for (const c of collectCells(tbl2)) if (c.el.getAttribute("header") === "1") for (let r = c.ra; r < c.ra + c.rs; r++) heads.add(r);
|
|
50366
50331
|
for (let r = 0; heads.has(r) && r < rows.length; r++) headH += rows[r];
|
|
50367
50332
|
}
|
|
50368
|
-
let y = top + outT, floor = lim, moved = false;
|
|
50333
|
+
let y = top + outT + capTop, floor = lim, moved = false;
|
|
50369
50334
|
const rowNoteLines = rows.map(() => []);
|
|
50370
50335
|
let allN = 0, allS = 0;
|
|
50371
50336
|
if (notes) for (const c of collectCells(tbl2)) for (const fn of Array.from(c.el.getElementsByTagName("hp:footNote"))) {
|
|
@@ -50388,7 +50353,8 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
|
|
|
50388
50353
|
if (mode === "CELL") {
|
|
50389
50354
|
const from = /* @__PURE__ */ new Map(), bases = /* @__PURE__ */ new Map();
|
|
50390
50355
|
while (y + h + outB > fl() && bodyH - outT - outB > 0) {
|
|
50391
|
-
const rem = cellRowRemainder(cells, r, fl() - outB - y - (moved ? 100 : 20) - 2 * sp, from, record, bases, carries, styles, bodyH - outT - outB);
|
|
50356
|
+
const rem = cellRowRemainder(cells, r, fl() - outB - y - (moved ? 100 : 20) - 2 * sp, from, record, bases, carries, styles, bodyH - outT - outB, fl() - outB - y - 101 - 2 * sp);
|
|
50357
|
+
if (rem === 0 && r === rows.length - 1) break;
|
|
50392
50358
|
if (rem === void 0 || rem + sp + (r === rows.length - 1 ? sp : 0) >= h) {
|
|
50393
50359
|
if (moved && y === outT + headH) break;
|
|
50394
50360
|
if (!moved && r === 0) splitWhole = true;
|
|
@@ -50417,25 +50383,25 @@ function splitTableRows(tbl2, top, lim, bodyH, styles, notes) {
|
|
|
50417
50383
|
if (record) rebaseSplitCells(record, carries, styles);
|
|
50418
50384
|
if (moved) splitNotesLast = { n: allN, s: Math.max(0, allS - placed) };
|
|
50419
50385
|
splitMovedLast = moved;
|
|
50420
|
-
return y + outB;
|
|
50386
|
+
return y + capBottom + outB;
|
|
50421
50387
|
}
|
|
50422
|
-
function cellRowRemainder(cells, row, avail, from, record, bases, carries, styles, contH = 0) {
|
|
50388
|
+
function cellRowRemainder(cells, row, avail, from, record, bases, carries, styles, contH = 0, piece = Infinity) {
|
|
50423
50389
|
let rem = 0, any = false, placed = false;
|
|
50424
50390
|
const cuts = [];
|
|
50425
50391
|
for (const c of cells) {
|
|
50426
50392
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
50427
|
-
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess',
|
|
50393
|
+
const off = _nullishCoalesce(from.get(c.el), () => ( 0)), base = _nullishCoalesce(_optionalChain([bases, 'optionalAccess', _1099 => _1099.get, 'call', _1100 => _1100(c.el)]), () => ( 0));
|
|
50428
50394
|
const limAbs = base + avail - c.marginB - c.marginT;
|
|
50429
50395
|
let carry = 0, carryFrom = Infinity;
|
|
50430
50396
|
let splitAt;
|
|
50431
50397
|
for (let guard = 0; guard < 16; guard++) {
|
|
50432
50398
|
const f = subFloatBottoms(c.sub).find((f2) => f2.v0 >= off && f2.lineBottom <= limAbs && f2.bottom > limAbs && f2.v0 < carryFrom);
|
|
50433
50399
|
if (!f) break;
|
|
50434
|
-
if (_optionalChain([f, 'access',
|
|
50400
|
+
if (_optionalChain([f, 'access', _1101 => _1101.rows, 'optionalAccess', _1102 => _1102.length])) {
|
|
50435
50401
|
let y = f.bottom - f.carry + f.outT, k2 = 0;
|
|
50436
50402
|
while (k2 < f.rows.length && y + f.rows[k2] <= limAbs) y += f.rows[k2++];
|
|
50437
50403
|
if (k2 === f.rows.length) break;
|
|
50438
|
-
if ((k2 > 0 || _optionalChain([f, 'access',
|
|
50404
|
+
if ((k2 > 0 || _optionalChain([f, 'access', _1103 => _1103.el, 'optionalAccess', _1104 => _1104.getAttribute, 'call', _1105 => _1105("pageBreak")]) === "CELL") && contH > 0 && f.el) {
|
|
50439
50405
|
const nested = splitTableRows(f.el, f.bottom - f.carry - base, avail - c.marginB - c.marginT, contH - c.marginT - c.marginB, styles);
|
|
50440
50406
|
const rem2 = _nullishCoalesce(nested, () => ( (k2 > 0 ? f.outT + f.rows.slice(k2).reduce((a, b) => a + b, 0) + f.outB : void 0)));
|
|
50441
50407
|
if (rem2 !== void 0) {
|
|
@@ -50481,17 +50447,18 @@ function cellRowRemainder(cells, row, avail, from, record, bases, carries, style
|
|
|
50481
50447
|
}
|
|
50482
50448
|
if (carry > 0 && cutV > carryFrom) {
|
|
50483
50449
|
nb -= carry;
|
|
50484
|
-
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
50450
|
+
const m = _nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1106 => _1106.get, 'call', _1107 => _1107(c.sub)]), () => ( /* @__PURE__ */ new Map()));
|
|
50485
50451
|
m.set(cutV, carry);
|
|
50486
|
-
_optionalChain([carries, 'optionalAccess',
|
|
50452
|
+
_optionalChain([carries, 'optionalAccess', _1108 => _1108.set, 'call', _1109 => _1109(c.sub, m)]);
|
|
50487
50453
|
}
|
|
50488
50454
|
cuts.push([c.el, base + lines[k][0], nb]);
|
|
50489
50455
|
rem = Math.max(rem, end + base - nb + c.marginT + c.marginB);
|
|
50456
|
+
if (off === 0 && /^(CENTER|BOTTOM)$/.test(_nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "")))) rem = Math.max(rem, c.h - piece);
|
|
50490
50457
|
}
|
|
50491
50458
|
if (!(any && placed)) return void 0;
|
|
50492
50459
|
for (const [el, v, nb] of cuts) {
|
|
50493
50460
|
from.set(el, v);
|
|
50494
|
-
_optionalChain([bases, 'optionalAccess',
|
|
50461
|
+
_optionalChain([bases, 'optionalAccess', _1110 => _1110.set, 'call', _1111 => _1111(el, nb)]);
|
|
50495
50462
|
}
|
|
50496
50463
|
if (record) for (const c of cells) {
|
|
50497
50464
|
if (c.ra !== row || c.rs !== 1 || !c.sub) continue;
|
|
@@ -50526,7 +50493,7 @@ function subFloatBottoms(sub) {
|
|
|
50526
50493
|
for (const o of elements(run)) {
|
|
50527
50494
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50528
50495
|
const pos = findChildByLocalName(o, "pos");
|
|
50529
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
50496
|
+
if (_optionalChain([pos, 'optionalAccess', _1112 => _1112.getAttribute, 'call', _1113 => _1113("treatAsChar")]) === "1" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1114 => _1114.getAttribute, 'call', _1115 => _1115("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
50530
50497
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50531
50498
|
const h = (ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height")) + captionExtra(o);
|
|
50532
50499
|
const vo = num2(pos, "vertOffset"), v0 = num2(seg, "vertpos"), carry = num2(om, "top") + h + num2(om, "bottom");
|
|
@@ -50546,11 +50513,11 @@ function subFloatBottoms(sub) {
|
|
|
50546
50513
|
}
|
|
50547
50514
|
function spaceAfterAt(sg, styles) {
|
|
50548
50515
|
if (!styles) return 0;
|
|
50549
|
-
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
50516
|
+
const lsa = sg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1116 => _1116.parentNode]);
|
|
50550
50517
|
if (!lsa || !p) return 0;
|
|
50551
50518
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg");
|
|
50552
50519
|
if (segs[segs.length - 1] !== sg) return 0;
|
|
50553
|
-
return _nullishCoalesce(_optionalChain([styles, 'access',
|
|
50520
|
+
return _nullishCoalesce(_optionalChain([styles, 'access', _1117 => _1117.paraGeom, 'access', _1118 => _1118.get, 'call', _1119 => _1119(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1120 => _1120.spaceAfter]), () => ( 0));
|
|
50554
50521
|
}
|
|
50555
50522
|
function rebaseSplitCells(record, carries, styles) {
|
|
50556
50523
|
for (const [sub, cuts] of record) {
|
|
@@ -50568,7 +50535,7 @@ function rebaseSplitCells(record, carries, styles) {
|
|
|
50568
50535
|
if (old[i] < c) base = Math.max(base, old[i] + num2(sg, "vertsize") + num2(sg, "spacing") + spaceAfterAt(sg, styles));
|
|
50569
50536
|
});
|
|
50570
50537
|
for (const f of floats) if (f.v0 < c && f.bottom <= c) base = Math.max(base, f.bottom);
|
|
50571
|
-
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess',
|
|
50538
|
+
return base - (_nullishCoalesce(_optionalChain([carries, 'optionalAccess', _1121 => _1121.get, 'call', _1122 => _1122(sub), 'optionalAccess', _1123 => _1123.get, 'call', _1124 => _1124(c)]), () => ( 0)));
|
|
50572
50539
|
});
|
|
50573
50540
|
segs.forEach((sg, i) => {
|
|
50574
50541
|
let j = -1;
|
|
@@ -50584,7 +50551,7 @@ function pageBottomReserve(p) {
|
|
|
50584
50551
|
for (const o of elements(run)) {
|
|
50585
50552
|
if (!OBJ_TAGS.has(ln(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
50586
50553
|
const pos = findChildByLocalName(o, "pos");
|
|
50587
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
50554
|
+
if (_optionalChain([pos, 'optionalAccess', _1125 => _1125.getAttribute, 'call', _1126 => _1126("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1127 => _1127.getAttribute, 'call', _1128 => _1128("vertRelTo")]) !== "PAGE" || _optionalChain([pos, 'optionalAccess', _1129 => _1129.getAttribute, 'call', _1130 => _1130("vertAlign")]) !== "BOTTOM") continue;
|
|
50588
50555
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
50589
50556
|
const h = ln(o) === "tbl" ? Math.max(num2(sz, "height"), measureTableHeight(o)) : num2(sz, "height");
|
|
50590
50557
|
r = Math.max(r, num2(pos, "vertOffset") + num2(om, "top") + h + num2(om, "bottom"));
|
|
@@ -50713,17 +50680,17 @@ function formatHeadNumber2(n, format2) {
|
|
|
50713
50680
|
}
|
|
50714
50681
|
}
|
|
50715
50682
|
function nextParaNumber(counters, geom) {
|
|
50716
|
-
const num4 = _optionalChain([geom, 'optionalAccess',
|
|
50683
|
+
const num4 = _optionalChain([geom, 'optionalAccess', _1131 => _1131.number]);
|
|
50717
50684
|
if (!num4) return "";
|
|
50718
50685
|
const cur = _nullishCoalesce(counters.get(num4.id), () => ( []));
|
|
50719
50686
|
const head = num4.heads.get(num4.level);
|
|
50720
|
-
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
50687
|
+
cur[num4.level] = (_nullishCoalesce(cur[num4.level], () => ( (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1132 => _1132.start]), () => ( 1))) - 1))) + 1;
|
|
50721
50688
|
cur.length = num4.level + 1;
|
|
50722
50689
|
counters.set(num4.id, cur);
|
|
50723
|
-
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess',
|
|
50690
|
+
return (_nullishCoalesce(_optionalChain([head, 'optionalAccess', _1133 => _1133.text]), () => ( ""))).replace(/\^(\d)?/g, (_m, d) => {
|
|
50724
50691
|
if (d === void 0) return "";
|
|
50725
50692
|
const lv = Number(d), h = num4.heads.get(lv);
|
|
50726
|
-
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess',
|
|
50693
|
+
return formatHeadNumber2(_nullishCoalesce(_nullishCoalesce(cur[lv], () => ( _optionalChain([h, 'optionalAccess', _1134 => _1134.start]))), () => ( 1)), _nullishCoalesce(_optionalChain([h, 'optionalAccess', _1135 => _1135.format]), () => ( "DIGIT")));
|
|
50727
50694
|
});
|
|
50728
50695
|
}
|
|
50729
50696
|
|
|
@@ -50787,7 +50754,7 @@ function lineBorderBox(model, styles, start, end) {
|
|
|
50787
50754
|
let top = 0, all = 0;
|
|
50788
50755
|
const include = (prId) => {
|
|
50789
50756
|
const st = prId != null ? styles.charPr.get(prId) : void 0;
|
|
50790
|
-
const f = _optionalChain([st, 'optionalAccess',
|
|
50757
|
+
const f = _optionalChain([st, 'optionalAccess', _1136 => _1136.borderFill]) != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
50791
50758
|
if (!f || !f.top && !f.bottom) return;
|
|
50792
50759
|
const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
|
|
50793
50760
|
const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
|
|
@@ -50859,11 +50826,11 @@ function glyphWidth(ch, st, fallback = true) {
|
|
|
50859
50826
|
let h = rel !== 100 ? mulDiv(st.height, rel, 100) : st.height;
|
|
50860
50827
|
if (!space && st.script) h = mulDiv(h, 16, 25);
|
|
50861
50828
|
const ratio = L ? L.ratio : st.ratio;
|
|
50862
|
-
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access',
|
|
50863
|
-
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50829
|
+
const spacing = space ? _nullishCoalesce(_optionalChain([st, 'access', _1137 => _1137.latin, 'optionalAccess', _1138 => _1138.spacing]), () => ( st.spacing)) : L ? L.spacing : st.spacing;
|
|
50830
|
+
const face1 = _nullishCoalesce(_optionalChain([L, 'optionalAccess', _1139 => _1139.face]), () => ( st.face));
|
|
50864
50831
|
const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
|
|
50865
50832
|
const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
|
|
50866
|
-
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',
|
|
50833
|
+
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', _1140 => _1140.face]) ? L.hft : st.hft))) ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1141 => _1141[face0], 'optionalAccess', _1142 => _1142[cp]]) : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? _optionalChain([BEFORE_2024_WIDTH, 'access', _1143 => _1143[face0], 'optionalAccess', _1144 => _1144[cp]]) : void 0;
|
|
50867
50834
|
const fc = faceClassForReflow(_nullishCoalesce(boldFace, () => ( face0)));
|
|
50868
50835
|
const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
|
|
50869
50836
|
if (fsEm !== void 0) {
|
|
@@ -50871,7 +50838,7 @@ function glyphWidth(ch, st, fallback = true) {
|
|
|
50871
50838
|
const s = spacing ? 4 * mulDiv(Math.trunc(b / 4), spacing, 100) : 0;
|
|
50872
50839
|
return { w: b + s, sp: s };
|
|
50873
50840
|
}
|
|
50874
|
-
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess',
|
|
50841
|
+
const bAdd = !space && st.bold && !boldFace ? syntheticBoldEm(_nullishCoalesce(_optionalChain([L, 'optionalAccess', _1145 => _1145.face]), () => ( st.face)), L ? L.hft : st.hft) : 0;
|
|
50875
50842
|
if (oldEm !== void 0) {
|
|
50876
50843
|
const b0 = hancomEmWidth(oldEm + bAdd, h, ratio, 0), w0 = spacing ? hancomEmWidth(oldEm + bAdd, h, ratio, spacing) : b0;
|
|
50877
50844
|
return { w: w0, sp: w0 - b0 };
|
|
@@ -51006,16 +50973,16 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51006
50973
|
const avail = Math.max(1440, Math.floor(areaW / 4) * 4 - marginL - geom.marginRight);
|
|
51007
50974
|
const firstWidth = avail;
|
|
51008
50975
|
const bu = _nullishCoalesce(geom.bullet, () => ( (numText && geom.number ? { ch: numText, ...geom.number } : void 0)));
|
|
51009
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
50976
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1146 => _1146.charPrId]) != null ? styles.charPr.get(bu.charPrId) : void 0), () => ( domChar));
|
|
51010
50977
|
let headW = 0;
|
|
51011
50978
|
if (bu) for (const ch of bu.ch) headW += glyphWidth(ch, bst, bu.useInstWidth !== false).w;
|
|
51012
50979
|
const bulletW = bu ? paraHeadAdvance(bu, height, headW) : 0;
|
|
51013
|
-
const contBullet = _optionalChain([bu, 'optionalAccess',
|
|
51014
|
-
const squeeze = _optionalChain([p, 'access',
|
|
50980
|
+
const contBullet = _optionalChain([bu, 'optionalAccess', _1147 => _1147.autoIndent]) ? bulletW : 0;
|
|
50981
|
+
const squeeze = _optionalChain([p, 'access', _1148 => _1148.parentNode, 'optionalAccess', _1149 => _1149.getAttribute, 'optionalCall', _1150 => _1150("lineWrap")]) === "SQUEEZE" || !!geom.squeeze;
|
|
51015
50982
|
const NO_WRAP = 1e9;
|
|
51016
50983
|
const intentPos = geom.marginIntent >= avail ? 0 : Math.max(0, geom.marginIntent);
|
|
51017
50984
|
const firstWrapWidth = squeeze ? NO_WRAP : Math.max(500, avail - (styles.before2024 && bulletW > 0 ? Math.max(intentPos, bulletW) : intentPos + bulletW));
|
|
51018
|
-
const condenseUse = !styles.before2024 && (geom.number || geom.bullet) ? 0 : geom.condense;
|
|
50985
|
+
const condenseUse = !styles.before2024 && !styles.early2024 && (geom.number || geom.bullet) ? 0 : geom.condense;
|
|
51019
50986
|
for (const r of rightTabFit) {
|
|
51020
50987
|
const edge = avail - bulletW;
|
|
51021
50988
|
if (r.x + widths[r.wi] + r.after > edge && edge - r.x - r.after >= 0) widths[r.wi] = edge - r.x - r.after;
|
|
@@ -51034,7 +51001,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51034
51001
|
let cellFloatBottom = 0, cellTextBelow = 0;
|
|
51035
51002
|
const spacesOnly = spacesHost(p);
|
|
51036
51003
|
const zoneStart = zones.length;
|
|
51037
|
-
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',
|
|
51004
|
+
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', _1151 => _1151(o.el, "pos"), 'optionalAccess', _1152 => _1152.getAttribute, 'call', _1153 => _1153("allowOverlap")]) === "1");
|
|
51038
51005
|
const spacesText = bodyFlow && (spacesOnly || !!OVP || bulletEmptyHost(p, geom));
|
|
51039
51006
|
const textish = m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "") || m.objs.some((o) => o.inline) || spacesText;
|
|
51040
51007
|
for (const o of m.objs) {
|
|
@@ -51044,16 +51011,17 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51044
51011
|
const outT = num3(om, "top"), outB = num3(om, "bottom");
|
|
51045
51012
|
const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
|
|
51046
51013
|
if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
|
|
51047
|
-
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51048
|
-
|
|
51014
|
+
const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1154 => _1154.getAttribute, 'call', _1155 => _1155("vertRelTo")]), () => ( "PARA"));
|
|
51015
|
+
const paperBand = wrapAttr === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1156 => _1156.getAttribute, 'call', _1157 => _1157("vertAlign")]), () => ( "TOP"))) === "TOP";
|
|
51016
|
+
if (vertRel === "PAPER" && bodyFlow && (wrapAttr !== "TOP_AND_BOTTOM" || paperBand)) {
|
|
51049
51017
|
const [oxL, oyT, paperW] = paperOrigin(p);
|
|
51050
|
-
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51018
|
+
const hRel2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1158 => _1158.getAttribute, 'call', _1159 => _1159("horzRelTo")]), () => ( "COLUMN")), hAlign2 = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1160 => _1160.getAttribute, 'call', _1161 => _1161("horzAlign")]), () => ( "LEFT"));
|
|
51051
51019
|
const ho2 = num3(pos, "horzOffset"), base2 = hRel2 === "PAPER" ? -oxL : hRel2 === "PARA" ? marginL : 0, span3 = hRel2 === "PAPER" ? paperW : hRel2 === "PARA" ? avail : areaW;
|
|
51052
51020
|
const x02 = base2 + (hAlign2 === "RIGHT" ? span3 - ho2 - o.width : hAlign2 === "CENTER" ? (span3 - o.width) / 2 + ho2 : ho2);
|
|
51053
51021
|
const vo0 = Math.max(0, num3(pos, "vertOffset")), top2 = vertRel === "PAPER" ? vo0 - oyT : vo0;
|
|
51054
51022
|
const omLx2 = num3(om, "left"), omRx2 = num3(om, "right");
|
|
51055
51023
|
const xs2 = hAlign2 === "RIGHT" ? x02 - omRx2 : hAlign2 === "CENTER" ? x02 : x02 + omLx2;
|
|
51056
|
-
zones.push({ top: top2, bottom: top2 + outT + effHOf(o) + outB, left: xs2 - omLx2, right: xs2 + o.width + omRx2, flow: _nullishCoalesce(o.el.getAttribute("textFlow"), () => ( "BOTH_SIDES")), anchor: o.index });
|
|
51024
|
+
zones.push({ top: top2, bottom: top2 + outT + effHOf(o) + outB, left: paperBand ? -1e9 : xs2 - omLx2, right: paperBand ? 1e9 : xs2 + o.width + omRx2, flow: _nullishCoalesce(o.el.getAttribute("textFlow"), () => ( "BOTH_SIDES")), anchor: o.index });
|
|
51057
51025
|
continue;
|
|
51058
51026
|
}
|
|
51059
51027
|
if (vertRel === "PAGE" || vertRel === "PAPER") continue;
|
|
@@ -51061,7 +51029,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51061
51029
|
const voRaw = num3(pos, "vertOffset"), voSigned = Math.max(0, voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw);
|
|
51062
51030
|
const effH = effHOf(o);
|
|
51063
51031
|
if (wrapAttr === "TOP_AND_BOTTOM") {
|
|
51064
|
-
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51032
|
+
const hR = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1162 => _1162.getAttribute, 'call', _1163 => _1163("horzRelTo")]), () => ( "COLUMN")), hA = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1164 => _1164.getAttribute, 'call', _1165 => _1165("horzAlign")]), () => ( "LEFT"));
|
|
51065
51033
|
const hoff = num3(pos, "horzOffset"), b0 = hR === "PARA" ? marginL : 0, sp = hR === "PARA" ? avail : areaW;
|
|
51066
51034
|
const xL = b0 + (hA === "RIGHT" ? sp - hoff - o.width : hA === "CENTER" ? (sp - o.width) / 2 + hoff : hoff);
|
|
51067
51035
|
if ((hR === "COLUMN" || hR === "PARA") && (xL >= areaW || xL + o.width <= 0)) continue;
|
|
@@ -51078,7 +51046,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51078
51046
|
else cellFloatBottom = Math.max(cellFloatBottom, voSigned + outT + effH + outB);
|
|
51079
51047
|
continue;
|
|
51080
51048
|
}
|
|
51081
|
-
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
51049
|
+
const hRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1166 => _1166.getAttribute, 'call', _1167 => _1167("horzRelTo")]), () => ( "COLUMN")), hAlign = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1168 => _1168.getAttribute, 'call', _1169 => _1169("horzAlign")]), () => ( "LEFT"));
|
|
51082
51050
|
const ho = num3(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span2 = hRel === "PARA" ? avail : areaW;
|
|
51083
51051
|
const x0 = base + (hAlign === "RIGHT" ? span2 - ho - o.width : hAlign === "CENTER" ? (span2 - o.width) / 2 + ho : ho);
|
|
51084
51052
|
const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
|
|
@@ -51088,7 +51056,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51088
51056
|
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 } : {} });
|
|
51089
51057
|
}
|
|
51090
51058
|
const hasText = textish;
|
|
51091
|
-
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
51059
|
+
const nFloat = m.objs.filter((o) => !o.inline && o.el.getAttribute("textWrap") === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1170 => _1170(o.el, "pos"), 'optionalAccess', _1171 => _1171.getAttribute, 'call', _1172 => _1172("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
51092
51060
|
const areaTop = bodyFlow ? startV - (_nullishCoalesce(geom.spaceBefore, () => ( 0))) : startV;
|
|
51093
51061
|
let floatFloor = 0;
|
|
51094
51062
|
if (!hasText && nFloat < 2) {
|
|
@@ -51215,25 +51183,25 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51215
51183
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51216
51184
|
const li = lineOf(o.index);
|
|
51217
51185
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51218
|
-
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall',
|
|
51186
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (_nullishCoalesce(_optionalChain([lineWidth, 'optionalCall', _1173 => _1173(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);
|
|
51219
51187
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51220
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51188
|
+
if (_optionalChain([findChildByLocalName, 'call', _1174 => _1174(o.el, "pos"), 'optionalAccess', _1175 => _1175.getAttribute, 'call', _1176 => _1176("affectLSpacing")]) === "1") lineObjLs[li] = true;
|
|
51221
51189
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51222
51190
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51223
51191
|
}
|
|
51224
51192
|
const lsa = doc.createElement("hp:linesegarray");
|
|
51225
51193
|
const subList = p.parentNode;
|
|
51226
|
-
const verticalCenter = _optionalChain([subList, 'optionalAccess',
|
|
51194
|
+
const verticalCenter = _optionalChain([subList, 'optionalAccess', _1177 => _1177.getAttribute, 'optionalCall', _1178 => _1178("vertAlign")]) === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(_nullishCoalesce(subList.getAttribute("textDirection"), () => ( "")));
|
|
51227
51195
|
let v = textStartV;
|
|
51228
51196
|
let firstAcc = 0;
|
|
51229
51197
|
const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
|
|
51230
|
-
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access',
|
|
51198
|
+
const heightOf = (prId) => (prId != null ? _optionalChain([styles, 'access', _1179 => _1179.charPr, 'access', _1180 => _1180.get, 'call', _1181 => _1181(prId), 'optionalAccess', _1182 => _1182.height]) : void 0) || 0;
|
|
51231
51199
|
const lineTextH = (li) => {
|
|
51232
51200
|
const s = textposOf[li], last = li === wrap.starts.length - 1, e = last ? m.chars.length : textposOf[li + 1];
|
|
51233
51201
|
let h = 0;
|
|
51234
51202
|
for (let k = s; k < e; k++) h = Math.max(h, heightOf(m.chars[k].prId));
|
|
51235
51203
|
for (const r of m.runs) if (r.at >= s && (last ? r.at <= e : r.at < e)) h = Math.max(h, heightOf(r.prId));
|
|
51236
|
-
if (li === 0 && _optionalChain([bu, 'optionalAccess',
|
|
51204
|
+
if (li === 0 && _optionalChain([bu, 'optionalAccess', _1183 => _1183.charPrId]) != null) h = Math.max(h, heightOf(bu.charPrId));
|
|
51237
51205
|
return h || height;
|
|
51238
51206
|
};
|
|
51239
51207
|
const fontLineOf = (li) => {
|
|
@@ -51283,7 +51251,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51283
51251
|
}
|
|
51284
51252
|
const vertpos = v;
|
|
51285
51253
|
const nextStart = textposOf[li + 1], nextChar = m.chars[nextStart];
|
|
51286
|
-
const boundaryH = !m.objs.length && !geom.fontLineHeight && _optionalChain([nextChar, 'optionalAccess',
|
|
51254
|
+
const boundaryH = !m.objs.length && !geom.fontLineHeight && _optionalChain([nextChar, 'optionalAccess', _1184 => _1184.ch, 'access', _1185 => _1185.trim, 'call', _1186 => _1186()]) && m.runs.some((r) => r.at === nextStart && r.prId === nextChar.prId) ? heightOf(nextChar.prId) : 0;
|
|
51287
51255
|
const occupiedH = Math.max(lineH, _nullishCoalesce(collisionHeights[li], () => ( 0)), boundaryH);
|
|
51288
51256
|
v += lineH + spacing;
|
|
51289
51257
|
const isFirst = li === 0;
|
|
@@ -51295,7 +51263,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51295
51263
|
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])));
|
|
51296
51264
|
seg.setAttribute("spacing", String(spacing));
|
|
51297
51265
|
let box = boxAt(li);
|
|
51298
|
-
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access',
|
|
51266
|
+
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? _optionalChain([lineParts, 'access', _1187 => _1187[li], 'optionalAccess', _1188 => _1188.filter, 'call', _1189 => _1189(([a, b]) => b - a >= 1440)]) : void 0;
|
|
51299
51267
|
const parts = fit && fit.length > 1 && natW <= fit[0][1] - fit[0][0] - Math.max(0, geom.marginIntent) ? fit : void 0;
|
|
51300
51268
|
if (parts) box = [parts[0][0], parts[0][1] - parts[0][0]];
|
|
51301
51269
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
@@ -51309,7 +51277,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51309
51277
|
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: _nullishCoalesce(wrap.starts[li + 1], () => ( text.length)) }
|
|
51310
51278
|
)) continue;
|
|
51311
51279
|
lsa.appendChild(seg);
|
|
51312
|
-
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess',
|
|
51280
|
+
for (const [a, b] of _nullishCoalesce(_optionalChain([parts, 'optionalAccess', _1190 => _1190.slice, 'call', _1191 => _1191(1)]), () => ( []))) {
|
|
51313
51281
|
const more = seg.cloneNode(false);
|
|
51314
51282
|
more.setAttribute("textpos", String(m.chars.length + 1));
|
|
51315
51283
|
more.setAttribute("horzpos", String(a));
|
|
@@ -51328,9 +51296,9 @@ function paperOrigin(p) {
|
|
|
51328
51296
|
const d = p.ownerDocument;
|
|
51329
51297
|
const hit = originMemo.get(d);
|
|
51330
51298
|
if (hit) return hit;
|
|
51331
|
-
const pagePr = _nullishCoalesce(_optionalChain([p, 'access',
|
|
51299
|
+
const pagePr = _nullishCoalesce(_optionalChain([p, 'access', _1192 => _1192.ownerDocument, 'optionalAccess', _1193 => _1193.getElementsByTagName, 'call', _1194 => _1194("hp:pagePr"), 'access', _1195 => _1195[0]]), () => ( null));
|
|
51332
51300
|
const mg = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
51333
|
-
const tb = _optionalChain([pagePr, 'optionalAccess',
|
|
51301
|
+
const tb = _optionalChain([pagePr, 'optionalAccess', _1196 => _1196.getAttribute, 'call', _1197 => _1197("gutterType")]) === "TOP_BOTTOM", gut = num3(mg, "gutter");
|
|
51334
51302
|
const o = [num3(mg, "left", 8504) + (tb ? 0 : gut), num3(mg, "top", 5668) + num3(mg, "header") + (tb ? gut : 0), num3(pagePr, "width", 59528)];
|
|
51335
51303
|
originMemo.set(d, o);
|
|
51336
51304
|
return o;
|
|
@@ -51347,7 +51315,7 @@ function pageTopBand(p) {
|
|
|
51347
51315
|
for (const o of elements2(run)) {
|
|
51348
51316
|
if (!OBJ_TAGS.has(ln2(o)) || o.getAttribute("textWrap") !== "TOP_AND_BOTTOM") continue;
|
|
51349
51317
|
const pos = findChildByLocalName(o, "pos");
|
|
51350
|
-
if (_optionalChain([pos, 'optionalAccess',
|
|
51318
|
+
if (_optionalChain([pos, 'optionalAccess', _1198 => _1198.getAttribute, 'call', _1199 => _1199("treatAsChar")]) === "1" || _optionalChain([pos, 'optionalAccess', _1200 => _1200.getAttribute, 'call', _1201 => _1201("vertRelTo")]) !== "PAGE" || (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1202 => _1202.getAttribute, 'call', _1203 => _1203("vertAlign")]), () => ( "TOP"))) !== "TOP") continue;
|
|
51351
51319
|
const om = findChildByLocalName(o, "outMargin"), sz = findChildByLocalName(o, "sz");
|
|
51352
51320
|
const h = ln2(o) === "tbl" ? Math.max(num3(sz, "height"), measureTableHeight(o)) : num3(sz, "height");
|
|
51353
51321
|
const vo = Math.max(0, num3(pos, "vertOffset"));
|
|
@@ -51403,7 +51371,7 @@ function footNoteHeights(p, ownOnly = false) {
|
|
|
51403
51371
|
let a = fn.parentNode, inSplit = false;
|
|
51404
51372
|
while (a && a !== p) {
|
|
51405
51373
|
const e = a;
|
|
51406
|
-
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call',
|
|
51374
|
+
if (ln2(e) === "tbl" && (e.getAttribute("pageBreak") === "CELL" || e.getAttribute("pageBreak") === "TABLE") && _optionalChain([findChildByLocalName, 'call', _1204 => _1204(e, "pos"), 'optionalAccess', _1205 => _1205.getAttribute, 'call', _1206 => _1206("treatAsChar")]) !== "1") inSplit = true;
|
|
51407
51375
|
a = a.parentNode;
|
|
51408
51376
|
}
|
|
51409
51377
|
if (inSplit) continue;
|
|
@@ -51432,7 +51400,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51432
51400
|
let prevPlaced;
|
|
51433
51401
|
const bodyFlow = areaW === counter.bodyW && bodyH > 0;
|
|
51434
51402
|
const vis = bodyH > 0 ? findFirst(container, "visibility") : null;
|
|
51435
|
-
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess',
|
|
51403
|
+
const hideFirstEmpty = _optionalChain([vis, 'optionalAccess', _1207 => _1207.getAttribute, 'call', _1208 => _1208("hideFirstEmptyLine")]) === "1";
|
|
51436
51404
|
let hidPrev = 0;
|
|
51437
51405
|
const cellW = areaW;
|
|
51438
51406
|
let cellCols = 1, cellCol = 0;
|
|
@@ -51457,7 +51425,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51457
51425
|
reflowSubListsIn(p, doc, styles, mode, counter, reflowBlockFlow, bodyFlow ? areaW : void 0);
|
|
51458
51426
|
const g3 = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
|
|
51459
51427
|
const cursorBefore = cursorV;
|
|
51460
|
-
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51428
|
+
let startV = Math.max(cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1209 => _1209.spaceBefore]), () => ( 0))), floatFloor);
|
|
51461
51429
|
floatFloor = 0;
|
|
51462
51430
|
if (bodyH > 0) {
|
|
51463
51431
|
const [top, bot] = pageTopBand(p);
|
|
@@ -51483,13 +51451,13 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51483
51451
|
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51484
51452
|
if (Number.isFinite(bottom)) {
|
|
51485
51453
|
cursorV = bottom;
|
|
51486
|
-
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51454
|
+
prevSpaceAfter = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1210 => _1210.spaceAfter]), () => ( 0));
|
|
51487
51455
|
}
|
|
51488
51456
|
}
|
|
51489
51457
|
continue;
|
|
51490
51458
|
}
|
|
51491
51459
|
const paraH = res.paraBottom - startV;
|
|
51492
|
-
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess',
|
|
51460
|
+
const explicitBreak = bodyH > 0 && startV > 0 && (p.getAttribute("pageBreak") === "1" || p.getAttribute("columnBreak") === "1" || !!_optionalChain([g3, 'optionalAccess', _1211 => _1211.pageBreakBefore]));
|
|
51493
51461
|
const lines = bodyH > 0 ? elements2(_nullishCoalesce(findChildByLocalName(p, "linesegarray"), () => ( p))).filter((e) => ln2(e) === "lineseg") : [];
|
|
51494
51462
|
const reserve = bodyH > 0 ? pageBottomReserve(p) : 0;
|
|
51495
51463
|
const fns = bodyH > 0 ? footNoteHeights(p) : [];
|
|
@@ -51524,9 +51492,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51524
51492
|
let cut = -1;
|
|
51525
51493
|
if (!explicitBreak && !firstOver && lines.length > 1) {
|
|
51526
51494
|
cut = lines.findIndex((seg, i) => i > 0 && lineBottom(seg) > limAt(i) && num3(seg, "vertsize") <= bodyH);
|
|
51527
|
-
if (cut > 0 && _optionalChain([g3, 'optionalAccess',
|
|
51495
|
+
if (cut > 0 && _optionalChain([g3, 'optionalAccess', _1212 => _1212.widowOrphan]) && lines.length >= 3 && cut === lines.length - 1) cut--;
|
|
51528
51496
|
}
|
|
51529
|
-
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess',
|
|
51497
|
+
const orphan = cut === 1 && !!_optionalChain([g3, 'optionalAccess', _1213 => _1213.widowOrphan]) || cut > 0 && !!_optionalChain([g3, 'optionalAccess', _1214 => _1214.keepLines]);
|
|
51530
51498
|
if (cut > 0 && !orphan) {
|
|
51531
51499
|
for (let i = cut; i < lines.length; i++) {
|
|
51532
51500
|
const seg = lines[i];
|
|
@@ -51541,12 +51509,14 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51541
51509
|
}
|
|
51542
51510
|
}
|
|
51543
51511
|
if (explicitBreak || firstOver || orphan || bodyH > 0 && startV > 0 && lines.length === 0 && res.paraBottom > bodyH && paraH <= bodyH) {
|
|
51544
|
-
|
|
51512
|
+
const own = zones.length > zonesBefore;
|
|
51513
|
+
zones.length = zonesBefore;
|
|
51514
|
+
if (zones.length || own) {
|
|
51545
51515
|
carryZones(zones, bodyH, areaW === counter.bodyW);
|
|
51546
51516
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51547
51517
|
if (lsa) p.removeChild(lsa);
|
|
51548
51518
|
const zb = zones.length;
|
|
51549
|
-
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51519
|
+
const sb0 = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1215 => _1215.spaceBefore]), () => ( 0));
|
|
51550
51520
|
let moveRes = reflowPara(p, doc, styles, areaW, sb0, mode, zones, new Map([...numsBefore].map(([k, v]) => [k, v.slice()])), true, bodyH);
|
|
51551
51521
|
const lsaM = findChildByLocalName(p, "linesegarray"), sM = lsaM ? elements2(lsaM).find((e) => ln2(e) === "lineseg") : void 0;
|
|
51552
51522
|
const vM = sM ? num3(sM, "vertpos") : sb0;
|
|
@@ -51566,7 +51536,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51566
51536
|
}
|
|
51567
51537
|
}
|
|
51568
51538
|
} else {
|
|
51569
|
-
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51539
|
+
const top = _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1216 => _1216.spaceBefore]), () => ( 0));
|
|
51570
51540
|
shiftParaVert(p, top - startV);
|
|
51571
51541
|
cursorV = paraH + top;
|
|
51572
51542
|
if (bodyH > 0 && (top + paraH > bodyH || squareTableOver(p, top, bodyH))) {
|
|
@@ -51578,7 +51548,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51578
51548
|
splitPage = true;
|
|
51579
51549
|
}
|
|
51580
51550
|
}
|
|
51581
|
-
if (_optionalChain([prevPlaced, 'optionalAccess',
|
|
51551
|
+
if (_optionalChain([prevPlaced, 'optionalAccess', _1217 => _1217.keepWithNext]) && prevPlaced.startV > prevPlaced.top) {
|
|
51582
51552
|
shiftParaVert(prevPlaced.p, prevPlaced.top - prevPlaced.startV);
|
|
51583
51553
|
const base = prevPlaced.top + prevPlaced.h + prevPlaced.spaceAfter;
|
|
51584
51554
|
shiftParaVert(p, base);
|
|
@@ -51588,12 +51558,12 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51588
51558
|
} else {
|
|
51589
51559
|
cursorV = (res.floatFloor > 0 && off === 0 ? res.textBottom : res.paraBottom) + off;
|
|
51590
51560
|
if (res.floatFloor > 0 && off === 0) floatFloor = res.floatFloor;
|
|
51591
|
-
const split = bodyH > 0 && off === 0 && (res.paraBottom > lim || squareTableOver(p, startV, lim)) ? splitFloatTableRemainder(p, startV, limOwn, bodyH, styles, false, { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea }) : void 0;
|
|
51561
|
+
const split = bodyH > 0 && off === 0 && (res.paraBottom > lim || squareTableOver(p, startV, lim)) ? splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1218 => _1218.spaceBefore]), () => ( 0))), limOwn, bodyH, styles, false, { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea }) : void 0;
|
|
51592
51562
|
const tEl = split !== void 0 && splitWhole ? m0Objs(p) : void 0;
|
|
51593
51563
|
const tVo = tEl ? num3(findChildByLocalName(tEl, "pos"), "vertOffset") : 0;
|
|
51594
51564
|
const tOm = tEl ? findChildByLocalName(tEl, "outMargin") : null;
|
|
51595
51565
|
if (tEl && tVo > 0 && tVo < 2 ** 31 && num3(tOm, "top") + measureTableHeight(tEl) + num3(tOm, "bottom") <= bodyH) {
|
|
51596
|
-
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51566
|
+
const tTop = startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1219 => _1219.spaceBefore]), () => ( 0))) + tVo;
|
|
51597
51567
|
zones.push({ top: tTop, bottom: Math.max(bodyH + 1, tTop + 1), left: -1e9, right: 1e9, flow: "BOTH_SIDES", carry: split });
|
|
51598
51568
|
floatFloor = 0;
|
|
51599
51569
|
cursorV = res.textBottom;
|
|
@@ -51620,9 +51590,9 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51620
51590
|
zones.length = 0;
|
|
51621
51591
|
splitPage = true;
|
|
51622
51592
|
}
|
|
51623
|
-
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51593
|
+
} else if (bodyH > 0 && off === 0 && bandTableOver(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1220 => _1220.spaceBefore]), () => ( 0))), lim)) {
|
|
51624
51594
|
const BU = BUH;
|
|
51625
|
-
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51595
|
+
const split4 = splitFloatTableRemainder(p, startV - (_nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1221 => _1221.spaceBefore]), () => ( 0))), BU ? limOwn : lim, bodyH, styles, true, BU ? { n0: pageNotes + fnsOwn.length, s0: pageFoot + ownSum, area: footArea } : void 0);
|
|
51626
51596
|
if (split4 !== void 0) {
|
|
51627
51597
|
cursorV = 0;
|
|
51628
51598
|
floatFloor = split4;
|
|
@@ -51640,7 +51610,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51640
51610
|
}
|
|
51641
51611
|
const keepCursor = hidden && !explicitBreak;
|
|
51642
51612
|
hidPrev = hidden ? hidPrev + 1 : 0;
|
|
51643
|
-
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess',
|
|
51613
|
+
prevPlaced = off === 0 && !(explicitBreak || firstOver || orphan) ? { p, startV, top: _nullishCoalesce(_optionalChain([g3, 'optionalAccess', _1222 => _1222.spaceBefore]), () => ( 0)), h: paraH, spaceAfter: res.spaceAfter, keepWithNext: !!_optionalChain([g3, 'optionalAccess', _1223 => _1223.keepWithNext]) } : void 0;
|
|
51644
51614
|
const moved = explicitBreak || firstOver || orphan || off !== 0;
|
|
51645
51615
|
pageLimit = reserve > 0 ? bodyH - reserve : moved ? bodyH : Math.min(pageLimit, reserve > 0 ? bodyH - reserve : pageLimit);
|
|
51646
51616
|
if (moved && refs.length && cut > 0 && !orphan && !explicitBreak && !firstOver) {
|
|
@@ -51740,7 +51710,7 @@ function flowEndNotes(root, bodyH) {
|
|
|
51740
51710
|
if (done.has(f) || raw0 < f.bottom) continue;
|
|
51741
51711
|
done.add(f);
|
|
51742
51712
|
if (!(base + f.lineBottom - shift <= bodyH && base + f.bottom - shift > bodyH)) continue;
|
|
51743
|
-
if (_optionalChain([f, 'access',
|
|
51713
|
+
if (_optionalChain([f, 'access', _1224 => _1224.rows, 'optionalAccess', _1225 => _1225.length]) && _optionalChain([f, 'access', _1226 => _1226.el, 'optionalAccess', _1227 => _1227.getAttribute, 'call', _1228 => _1228("pageBreak")]) === "CELL") {
|
|
51744
51714
|
let yy = base + f.bottom - f.carry - shift + f.outT, k = 0;
|
|
51745
51715
|
while (k < f.rows.length && yy + f.rows[k] <= bodyH) yy += f.rows[k++];
|
|
51746
51716
|
if (k === f.rows.length) continue;
|
|
@@ -51807,7 +51777,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51807
51777
|
const declarations = [];
|
|
51808
51778
|
const hidden = /* @__PURE__ */ new Map();
|
|
51809
51779
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51810
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
51780
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1229 => _1229.get, 'call', _1230 => _1230(p), 'optionalAccess', _1231 => _1231[0]]), () => ( 0));
|
|
51811
51781
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51812
51782
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51813
51783
|
for (const el of elements(ctrl)) {
|
|
@@ -51827,7 +51797,7 @@ function pageStories(root, masters, paraPages, pageCount, pageBase, geom) {
|
|
|
51827
51797
|
const out = [];
|
|
51828
51798
|
for (let page = 0; page < pageCount; page++) {
|
|
51829
51799
|
const n = pageBase + page + 1;
|
|
51830
|
-
const hides = (name) => _optionalChain([hidden, 'access',
|
|
51800
|
+
const hides = (name) => _optionalChain([hidden, 'access', _1232 => _1232.get, 'call', _1233 => _1233(page), 'optionalAccess', _1234 => _1234.has, 'call', _1235 => _1235(name)]) === true || page === 0 && num2(visibility, `hideFirst${name}`) !== 0;
|
|
51831
51801
|
if (!hides("MasterPage")) {
|
|
51832
51802
|
const matching = masters.filter((m) => m.getAttribute("type") === (n % 2 ? "ODD" : "EVEN"));
|
|
51833
51803
|
const both = masters.filter((m) => (m.getAttribute("type") || "BOTH") === "BOTH");
|
|
@@ -51856,7 +51826,7 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51856
51826
|
const above = num2(sp, "aboveLine", 850), below = num2(sp, "belowLine", 567), between = num2(sp, "betweenNotes", 283);
|
|
51857
51827
|
const byPage = /* @__PURE__ */ new Map();
|
|
51858
51828
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
51859
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
51829
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1236 => _1236.get, 'call', _1237 => _1237(p), 'optionalAccess', _1238 => _1238[0]]), () => ( 0));
|
|
51860
51830
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
51861
51831
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
51862
51832
|
const fn = findChildByLocalName(ctrl, "footNote");
|
|
@@ -51874,12 +51844,12 @@ function footNoteStories(root, paraPages, geom) {
|
|
|
51874
51844
|
}
|
|
51875
51845
|
}
|
|
51876
51846
|
const stories = [], rules = [];
|
|
51877
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51878
|
-
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51847
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1239 => _1239.getAttribute, 'call', _1240 => _1240("width")]), () => ( "0.12"))) || 0.12;
|
|
51848
|
+
const lineType = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1241 => _1241.getAttribute, 'call', _1242 => _1242("type")]), () => ( "SOLID"));
|
|
51879
51849
|
for (const [page, notes] of byPage) {
|
|
51880
51850
|
const area = above + below + notes.reduce((a, n) => a + n.h, 0) + between * (notes.length - 1);
|
|
51881
51851
|
const top = geom.MT + geom.BODY_H - area;
|
|
51882
|
-
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51852
|
+
if (lineType !== "NONE") rules.push({ page, x: geom.ML, y: top + above, length: lenAttr > 0 ? lenAttr : 14173, widthMm, color: _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1243 => _1243.getAttribute, 'call', _1244 => _1244("color")]), () => ( "#000000")) });
|
|
51883
51853
|
let y = top + above + below;
|
|
51884
51854
|
for (const n of notes) {
|
|
51885
51855
|
stories.push({ sub: n.sub, page, x: geom.ML, y, width: geom.BODY_W });
|
|
@@ -51915,8 +51885,8 @@ function endNoteLayout(root, paraPages, geom) {
|
|
|
51915
51885
|
let col = nCol > 1 ? Math.min(nCol - 1, Math.max(0, Math.round(num2(last.seg, "horzpos") / (colW + gap)))) : 0;
|
|
51916
51886
|
let y = num2(last.seg, "vertpos") + num2(last.seg, "vertsize") + above;
|
|
51917
51887
|
const rules = [];
|
|
51918
|
-
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51919
|
-
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
51888
|
+
const lenAttr = num2(line, "length", -1), widthMm = Number.parseFloat(_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1245 => _1245.getAttribute, 'call', _1246 => _1246("width")]), () => ( "0.12"))) || 0.12;
|
|
51889
|
+
if ((_nullishCoalesce(_optionalChain([line, 'optionalAccess', _1247 => _1247.getAttribute, 'call', _1248 => _1248("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', _1249 => _1249.getAttribute, 'call', _1250 => _1250("color")]), () => ( "#000000")) });
|
|
51920
51890
|
y += below;
|
|
51921
51891
|
const next = () => {
|
|
51922
51892
|
if (++col >= nCol) {
|
|
@@ -52010,7 +51980,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52010
51980
|
return st.length >= 2 && st.reduce((a, f) => a + f.h, 0) > h;
|
|
52011
51981
|
});
|
|
52012
51982
|
if (BODY_H <= 0 || ty + rowY[nRows] <= pageBottom + slack && !stackOver) return plain4();
|
|
52013
|
-
if (_optionalChain([findChildByLocalName, 'call',
|
|
51983
|
+
if (_optionalChain([findChildByLocalName, 'call', _1251 => _1251(tbl2, "pos"), 'optionalAccess', _1252 => _1252.getAttribute, 'call', _1253 => _1253("treatAsChar")]) === "1") {
|
|
52014
51984
|
const declared = num2(findChildByLocalName(tbl2, "sz"), "height") || rowY[nRows];
|
|
52015
51985
|
if (ty - MT < 2e3 || ty + declared <= pageBottom + slack) return plain4();
|
|
52016
51986
|
return rowH.map((h, r) => [{ page: 1, y: MT + rowY[r], h }]);
|
|
@@ -52066,7 +52036,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52066
52036
|
const b = (_nullishCoalesce(boxes.get(c.el), () => ( []))).find((x) => x.part === k);
|
|
52067
52037
|
if (!b) continue;
|
|
52068
52038
|
const f = floatSpan(b.seg, y + c.marginT);
|
|
52069
|
-
if (_optionalChain([f, 'optionalAccess',
|
|
52039
|
+
if (_optionalChain([f, 'optionalAccess', _1254 => _1254.el]) && f.pages > 0 && f.pages > lead && Math.abs(contTop + c.marginT + b.top - b.origin - f.endY) < 3e3) {
|
|
52070
52040
|
lead = f.pages;
|
|
52071
52041
|
place = /* @__PURE__ */ new Map([[f.el, y + c.marginT]]);
|
|
52072
52042
|
led.add(b.seg);
|
|
@@ -52083,8 +52053,8 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52083
52053
|
for (const c of rowCells) {
|
|
52084
52054
|
const bs = _nullishCoalesce(boxes.get(c.el), () => ( []));
|
|
52085
52055
|
const inK = bs.filter((b) => b.part === k), next = bs.find((b) => b.part > k);
|
|
52086
|
-
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access',
|
|
52087
|
-
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess',
|
|
52056
|
+
const from = _nullishCoalesce(_nullishCoalesce(_optionalChain([inK, 'access', _1255 => _1255[0], 'optionalAccess', _1256 => _1256.origin]), () => ( _optionalChain([next, 'optionalAccess', _1257 => _1257.origin]))), () => ( Number.POSITIVE_INFINITY));
|
|
52057
|
+
range.set(c.el, [from, _nullishCoalesce(_optionalChain([next, 'optionalAccess', _1258 => _1258.top]), () => ( Number.POSITIVE_INFINITY))]);
|
|
52088
52058
|
if (inK.length) ext = Math.max(ext, inK[inK.length - 1].bottom - from + c.marginT + c.marginB);
|
|
52089
52059
|
if (inK.length && next) toNext = Math.max(toNext, next.top - from + c.marginT + c.marginB);
|
|
52090
52060
|
}
|
|
@@ -52095,7 +52065,7 @@ function planTableRows(tbl2, cells, rowH, ty, MT, BODY_H, slack = 0, floatSpan,
|
|
|
52095
52065
|
if (!last) {
|
|
52096
52066
|
let span2 = 0, spanEnd = 0;
|
|
52097
52067
|
if (floatSpan) for (const c of rowCells) {
|
|
52098
|
-
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access',
|
|
52068
|
+
const bs = (_nullishCoalesce(boxes.get(c.el), () => ( []))).filter((b) => b.part === k), from = _nullishCoalesce(_optionalChain([bs, 'access', _1259 => _1259[0], 'optionalAccess', _1260 => _1260.origin]), () => ( 0));
|
|
52099
52069
|
for (const b of bs) {
|
|
52100
52070
|
if (led.has(b.seg)) continue;
|
|
52101
52071
|
const f = floatSpan(b.seg, y + c.marginT + b.top - from);
|
|
@@ -52260,7 +52230,7 @@ function objectGeometry(el, x, y, w, h, boxW = w, boxH = h) {
|
|
|
52260
52230
|
function shapeFill(el, defs, images, warn) {
|
|
52261
52231
|
const brush = findChildByLocalName(el, "fillBrush");
|
|
52262
52232
|
const win = brush && findChildByLocalName(brush, "winBrush");
|
|
52263
|
-
const face = _optionalChain([win, 'optionalAccess',
|
|
52233
|
+
const face = _optionalChain([win, 'optionalAccess', _1261 => _1261.getAttribute, 'call', _1262 => _1262("faceColor")]);
|
|
52264
52234
|
if (docColor(face)) return esc(face);
|
|
52265
52235
|
const grad = brush && findChildByLocalName(brush, "gradation");
|
|
52266
52236
|
if (grad) {
|
|
@@ -52311,8 +52281,8 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52311
52281
|
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);
|
|
52312
52282
|
const { x, y } = geometry;
|
|
52313
52283
|
const sx = ow > 0 ? w / ow : 1, sy = oh > 0 ? h / oh : 1;
|
|
52314
|
-
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess',
|
|
52315
|
-
const color = esc(docColor(_optionalChain([line, 'optionalAccess',
|
|
52284
|
+
const line = findChildByLocalName(el, "lineShape"), style = _nullishCoalesce(_optionalChain([line, 'optionalAccess', _1263 => _1263.getAttribute, 'call', _1264 => _1264("style")]), () => ( "SOLID"));
|
|
52285
|
+
const color = esc(docColor(_optionalChain([line, 'optionalAccess', _1265 => _1265.getAttribute, 'call', _1266 => _1266("color")]), "#000000"));
|
|
52316
52286
|
const strokeW = style === "NONE" ? 0 : Math.max(0.2, num2(line, "width", 33) / 100 * 2.834645);
|
|
52317
52287
|
const dash = /DASH|DOT/.test(style) ? ` stroke-dasharray="${style.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
|
|
52318
52288
|
const keepWidth = local ? ` vector-effect="non-scaling-stroke"` : "";
|
|
@@ -52579,7 +52549,7 @@ function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = fals
|
|
|
52579
52549
|
if (hrel === "PAGE") {
|
|
52580
52550
|
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52581
52551
|
} else if (hrel === "PAPER") {
|
|
52582
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52552
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (_nullishCoalesce(_optionalChain([ctx, 'access', _1267 => _1267.bodyDx, 'optionalCall', _1268 => _1268(ctx.page)]), () => ( 0)));
|
|
52583
52553
|
} else {
|
|
52584
52554
|
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52585
52555
|
}
|
|
@@ -52633,10 +52603,10 @@ function planLines(m, styles, numText = "") {
|
|
|
52633
52603
|
const align = _nullishCoalesce((m.paraPrId != null ? styles.paraAlign.get(m.paraPrId) : void 0), () => ( "JUSTIFY"));
|
|
52634
52604
|
const geom = m.paraPrId != null ? styles.paraGeom.get(m.paraPrId) : void 0;
|
|
52635
52605
|
const hang = geom && geom.marginIntent < 0 ? -geom.marginIntent : 0;
|
|
52636
|
-
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52637
|
-
const firstPr = _nullishCoalesce(_optionalChain([m, 'access',
|
|
52638
|
-
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess',
|
|
52639
|
-
const headW = _optionalChain([bu, 'optionalAccess',
|
|
52606
|
+
const bu = _nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1269 => _1269.bullet]), () => ( (numText && _optionalChain([geom, 'optionalAccess', _1270 => _1270.number]) ? { ch: numText, ...geom.number } : void 0)));
|
|
52607
|
+
const firstPr = _nullishCoalesce(_optionalChain([m, 'access', _1271 => _1271.chars, 'access', _1272 => _1272.find, 'call', _1273 => _1273((c) => c.ch !== ""), 'optionalAccess', _1274 => _1274.prId]), () => ( null));
|
|
52608
|
+
const bst = _nullishCoalesce((_optionalChain([bu, 'optionalAccess', _1275 => _1275.charPrId]) != null ? styles.charPr.get(bu.charPrId) : firstPr != null ? styles.charPr.get(firstPr) : void 0), () => ( DEFAULT_CHAR));
|
|
52609
|
+
const headW = _optionalChain([bu, 'optionalAccess', _1276 => _1276.useInstWidth]) === false ? [...bu.ch].reduce((w, ch) => w + glyphWidth(ch, bst, false).w, 0) : bu ? measureTextWidth(bu.ch, bst.height, bst.ratio, { spacingPct: bst.spacing, faceClass: faceClassOf(bst.face) }) : 0;
|
|
52640
52610
|
const bulletW = bu ? paraHeadAdvance(bu, bst.height, headW) : 0;
|
|
52641
52611
|
const plans = [];
|
|
52642
52612
|
for (let i = 0; i < m.segs.length; i++) {
|
|
@@ -52644,8 +52614,8 @@ function planLines(m, styles, numText = "") {
|
|
|
52644
52614
|
const start = seg.textpos;
|
|
52645
52615
|
const end = i + 1 < m.segs.length ? m.segs[i + 1].textpos : Math.max(m.chars.length, start);
|
|
52646
52616
|
const tabs = /* @__PURE__ */ new Map();
|
|
52647
|
-
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52648
|
-
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess',
|
|
52617
|
+
const lead = i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1277 => _1277.marginIntent]), () => ( 0)), 0) + bulletW : hang + (_optionalChain([bu, 'optionalAccess', _1278 => _1278.autoIndent]) ? bulletW : 0);
|
|
52618
|
+
let x = (i === 0 ? Math.max(_nullishCoalesce(_optionalChain([geom, 'optionalAccess', _1279 => _1279.marginIntent]), () => ( 0)), 0) : hang) + (i === 0 || _optionalChain([bu, 'optionalAccess', _1280 => _1280.autoIndent]) ? bulletW : 0);
|
|
52649
52619
|
let fixedTo = start;
|
|
52650
52620
|
let fixedW = 0;
|
|
52651
52621
|
for (let k = start; k < end && k < m.chars.length; k++) {
|
|
@@ -52741,7 +52711,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52741
52711
|
let i = plan.start;
|
|
52742
52712
|
let cursor = ox + seg.horzpos + plan.xoff;
|
|
52743
52713
|
const y = oy + seg.vertpos + seg.baseline;
|
|
52744
|
-
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access',
|
|
52714
|
+
const pva = m.paraPrId != null ? _optionalChain([ctx, 'access', _1281 => _1281.styles, 'access', _1282 => _1282.paraGeom, 'access', _1283 => _1283.get, 'call', _1284 => _1284(m.paraPrId), 'optionalAccess', _1285 => _1285.vertAlign]) : void 0;
|
|
52745
52715
|
const glyphY = (h) => y + (pva === "CENTER" ? Math.round(h * 0.35) : pva === "BOTTOM" ? -Math.round(h * 0.15) : 0);
|
|
52746
52716
|
if (plan.bullet) {
|
|
52747
52717
|
const bs = _nullishCoalesce((plan.bullet.prId != null ? ctx.styles.charPr.get(plan.bullet.prId) : void 0), () => ( DEFAULT_CHAR));
|
|
@@ -52826,7 +52796,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52826
52796
|
if (st.italic) attrs.push(`font-style="italic"`);
|
|
52827
52797
|
if (st.underline) attrs.push(`text-decoration="underline"`);
|
|
52828
52798
|
if (st.color) attrs.push(`fill="${escapeXml7(st.color)}"`);
|
|
52829
|
-
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(
|
|
52799
|
+
emit(ctx, `<text ${attrs.join(" ")}>${escapeXml7(_chunkS34OVRKDcjs.mapPuaText.call(void 0, text))}</text>`);
|
|
52830
52800
|
ctx.stats.texts++;
|
|
52831
52801
|
}
|
|
52832
52802
|
return sw;
|
|
@@ -52895,26 +52865,26 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52895
52865
|
anchorLineH = pl.seg.textheight;
|
|
52896
52866
|
}
|
|
52897
52867
|
let objBaseV = baseV;
|
|
52898
|
-
const pTop = depth === 0 ? _optionalChain([ctx, 'access',
|
|
52868
|
+
const pTop = depth === 0 ? _optionalChain([ctx, 'access', _1286 => _1286.paraTops, 'optionalAccess', _1287 => _1287.get, 'call', _1288 => _1288(p)]) : void 0;
|
|
52899
52869
|
const wrapA = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
52900
52870
|
const top0 = _nullishCoalesce(pTop, () => ( (depth > 0 && wrapA !== "TOP_AND_BOTTOM" ? cellParaTop(p, ctx.styles.paraGeom) : void 0)));
|
|
52901
52871
|
if (top0 !== void 0 && wrapA !== "TOP_AND_BOTTOM") {
|
|
52902
|
-
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52872
|
+
const start = top0 + (m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1289 => _1289.styles, 'access', _1290 => _1290.paraGeom, 'access', _1291 => _1291.get, 'call', _1292 => _1292(m.paraPrId), 'optionalAccess', _1293 => _1293.spaceBefore]), () => ( 0)) : 0);
|
|
52903
52873
|
if (baseV > start + 100) {
|
|
52904
52874
|
objBaseV = start;
|
|
52905
52875
|
if (anchorLineV === baseV) anchorLineV = start;
|
|
52906
52876
|
}
|
|
52907
52877
|
}
|
|
52908
|
-
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52878
|
+
const tbFloats = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1294 => _1294(q.el, "pos"), 'optionalAccess', _1295 => _1295.getAttribute, 'call', _1296 => _1296("vertRelTo")]), () => ( "PARA"))) === "PARA").length;
|
|
52909
52879
|
const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
52910
|
-
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
52880
|
+
const sbA = m.paraPrId != null ? _nullishCoalesce(_optionalChain([ctx, 'access', _1297 => _1297.styles, 'access', _1298 => _1298.paraGeom, 'access', _1299 => _1299.get, 'call', _1300 => _1300(m.paraPrId), 'optionalAccess', _1301 => _1301.spaceBefore]), () => ( 0)) : 0;
|
|
52911
52881
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
52912
52882
|
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);
|
|
52913
52883
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
52914
52884
|
if (!tbStack) {
|
|
52915
52885
|
tbStack = /* @__PURE__ */ new Map();
|
|
52916
52886
|
let below = 0;
|
|
52917
|
-
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52887
|
+
const stackable = m.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM" && (_nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1302 => _1302(q.el, "pos"), 'optionalAccess', _1303 => _1303.getAttribute, 'call', _1304 => _1304("vertRelTo")]), () => ( "PARA"))) === "PARA" && _optionalChain([findChildByLocalName, 'call', _1305 => _1305(q.el, "pos"), 'optionalAccess', _1306 => _1306.getAttribute, 'call', _1307 => _1307("allowOverlap")]) !== "1");
|
|
52918
52888
|
for (const q of stackable.length >= 2 ? stackable.sort((a, b) => a.index - b.index) : []) {
|
|
52919
52889
|
const omQ = findChildByLocalName(q.el, "outMargin"), raw = num2(findChildByLocalName(q.el, "pos"), "vertOffset");
|
|
52920
52890
|
const top = Math.max(below, raw >= 2 ** 31 ? raw - 2 ** 32 : raw);
|
|
@@ -52925,7 +52895,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52925
52895
|
const st = tbStack.get(o.el);
|
|
52926
52896
|
if (st !== void 0) y = oy + (_nullishCoalesce(pTop, () => ( 0))) + st;
|
|
52927
52897
|
}
|
|
52928
|
-
const moved = _optionalChain([ctx, 'access',
|
|
52898
|
+
const moved = _optionalChain([ctx, 'access', _1308 => _1308.objPlace, 'optionalAccess', _1309 => _1309.get, 'call', _1310 => _1310(o.el)]);
|
|
52929
52899
|
if (moved) {
|
|
52930
52900
|
const pg = ctx.page;
|
|
52931
52901
|
ctx.page = moved.page;
|
|
@@ -52944,7 +52914,7 @@ function cellParaTop(p, geom) {
|
|
|
52944
52914
|
const segs = lsa ? elements(lsa).filter((e) => ln(e) === "lineseg") : [];
|
|
52945
52915
|
if (!segs.length) return void 0;
|
|
52946
52916
|
const last = segs[segs.length - 1];
|
|
52947
|
-
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access',
|
|
52917
|
+
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (_nullishCoalesce(_optionalChain([geom, 'access', _1311 => _1311.get, 'call', _1312 => _1312(_nullishCoalesce(prev.getAttribute("paraPrIDRef"), () => ( ""))), 'optionalAccess', _1313 => _1313.spaceAfter]), () => ( 0)));
|
|
52948
52918
|
}
|
|
52949
52919
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
52950
52920
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
@@ -52985,7 +52955,7 @@ function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
|
52985
52955
|
drawObject(sub, x + num2(off, "x"), y + num2(off, "y"), baseV, areaW, ctx, depth + 1);
|
|
52986
52956
|
}
|
|
52987
52957
|
} else if (o.tag === "equation") {
|
|
52988
|
-
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call',
|
|
52958
|
+
const script = _nullishCoalesce(_optionalChain([findChildByLocalName, 'call', _1314 => _1314(o.el, "script"), 'optionalAccess', _1315 => _1315.textContent]), () => ( ""));
|
|
52989
52959
|
const text = script ? latexToPlain(hwpEquationToLatex(script)) : "";
|
|
52990
52960
|
if (text && o.width > 0) {
|
|
52991
52961
|
const bl = Number(o.el.getAttribute("baseLine")), size = num2(o.el, "baseUnit", 1e3);
|
|
@@ -53090,7 +53060,7 @@ function tableContPages(tbl2, ty, MT, BODY_H, memo, slack = 0, floatSpan, nested
|
|
|
53090
53060
|
}
|
|
53091
53061
|
function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
53092
53062
|
return (seg, top) => {
|
|
53093
|
-
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess',
|
|
53063
|
+
const lsa = seg.parentNode, p = _optionalChain([lsa, 'optionalAccess', _1316 => _1316.parentNode]);
|
|
53094
53064
|
if (!p || ln(p) !== "p") return void 0;
|
|
53095
53065
|
const segs = elements(lsa).filter((e) => ln(e) === "lineseg"), k = segs.indexOf(seg);
|
|
53096
53066
|
const m = buildPara(p);
|
|
@@ -53098,10 +53068,10 @@ function cellFloatSpan(MT, BODY_H, memo, slack) {
|
|
|
53098
53068
|
for (const o of m.objs) {
|
|
53099
53069
|
if (o.tag !== "tbl" || o.inline) continue;
|
|
53100
53070
|
const pos = findChildByLocalName(o.el, "pos");
|
|
53101
|
-
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53071
|
+
if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1317 => _1317.getAttribute, 'call', _1318 => _1318("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53102
53072
|
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)));
|
|
53103
53073
|
if (segK !== k) continue;
|
|
53104
|
-
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53074
|
+
const ty = top + num2(findChildByLocalName(o.el, "outMargin"), "top") + Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1319 => _1319.getAttribute, 'call', _1320 => _1320("vertOffset")]), () => ( void 0)), 0));
|
|
53105
53075
|
const span2 = tableContPages(o.el, ty, MT, BODY_H, memo, slack, cellFloatSpan(MT, BODY_H, memo, slack), true);
|
|
53106
53076
|
if (span2.pages > 0 && (!best || span2.pages > best.pages)) best = { ...span2, el: o.el };
|
|
53107
53077
|
}
|
|
@@ -53133,7 +53103,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53133
53103
|
let hdrRows = 0;
|
|
53134
53104
|
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++;
|
|
53135
53105
|
const slack = ctx.geom.PH - ctx.geom.MT - ctx.geom.BODY_H;
|
|
53136
|
-
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call',
|
|
53106
|
+
const splitHere = depth === 1 || !!ctx.splitCell && _optionalChain([findChildByLocalName, 'call', _1321 => _1321(tbl2, "pos"), 'optionalAccess', _1322 => _1322.getAttribute, 'call', _1323 => _1323("treatAsChar")]) !== "1";
|
|
53137
53107
|
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 }]);
|
|
53138
53108
|
const splitSaved = ctx.splitCell;
|
|
53139
53109
|
ctx.splitCell = false;
|
|
@@ -53155,7 +53125,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53155
53125
|
for (const g3 of geom) {
|
|
53156
53126
|
ctx.page = g3.page;
|
|
53157
53127
|
const bf = g3.c.bfId != null ? ctx.styles.borderFill.get(g3.c.bfId) : void 0;
|
|
53158
|
-
if (_optionalChain([bf, 'optionalAccess',
|
|
53128
|
+
if (_optionalChain([bf, 'optionalAccess', _1324 => _1324.fill])) emit(ctx, `<rect x="${pt2(g3.x)}" y="${pt2(g3.y)}" width="${pt2(g3.w)}" height="${pt2(g3.h)}" fill="${escapeXml7(bf.fill)}"/>`);
|
|
53159
53129
|
}
|
|
53160
53130
|
for (const g3 of geom) {
|
|
53161
53131
|
const { c } = g3;
|
|
@@ -53166,13 +53136,13 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53166
53136
|
const boxes = cellLineBoxes(c);
|
|
53167
53137
|
const contV = new Map(boxes.map((b) => [b.seg, b.top]));
|
|
53168
53138
|
const pieceOf = (v) => Math.max(0, g3.pieces.findIndex((pc) => {
|
|
53169
|
-
const r = _optionalChain([pc, 'access',
|
|
53139
|
+
const r = _optionalChain([pc, 'access', _1325 => _1325.range, 'optionalAccess', _1326 => _1326.get, 'call', _1327 => _1327(c.el)]);
|
|
53170
53140
|
return !!r && v >= r[0] && v < r[1];
|
|
53171
53141
|
}));
|
|
53172
53142
|
const va2 = _nullishCoalesce(c.sub.getAttribute("vertAlign"), () => ( "TOP"));
|
|
53173
53143
|
const pieceOff = g3.pieces.map((pc, k) => {
|
|
53174
53144
|
if (va2 === "TOP") return 0;
|
|
53175
|
-
const from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53145
|
+
const from = _nullishCoalesce(_optionalChain([pc, 'access', _1328 => _1328.range, 'optionalAccess', _1329 => _1329.get, 'call', _1330 => _1330(c.el), 'optionalAccess', _1331 => _1331[0]]), () => ( 0));
|
|
53176
53146
|
const bottoms = boxes.filter((b) => pieceOf(b.top) === k).map((b) => b.bottom - from);
|
|
53177
53147
|
if (!bottoms.length) return 0;
|
|
53178
53148
|
const free = pc.h - c.marginT - c.marginB - Math.max(...bottoms);
|
|
@@ -53185,7 +53155,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
|
|
|
53185
53155
|
const pages = segs.map((sg) => {
|
|
53186
53156
|
const v = _nullishCoalesce(contV.get(sg), () => ( num2(sg, "vertpos")));
|
|
53187
53157
|
const k = pieceOf(v);
|
|
53188
|
-
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access',
|
|
53158
|
+
const pc = g3.pieces[k], from = _nullishCoalesce(_optionalChain([pc, 'access', _1332 => _1332.range, 'optionalAccess', _1333 => _1333.get, 'call', _1334 => _1334(c.el), 'optionalAccess', _1335 => _1335[0]]), () => ( 0));
|
|
53189
53159
|
sg.setAttribute("vertpos", String(v - from + pc.y + c.marginT + pieceOff[k] - base));
|
|
53190
53160
|
return startPage + pc.page;
|
|
53191
53161
|
});
|
|
@@ -53277,7 +53247,7 @@ function drawPic(pic, x, y, ctx) {
|
|
|
53277
53247
|
}
|
|
53278
53248
|
function drawPicFrame(pic, x, y, w, h, transform, ctx) {
|
|
53279
53249
|
const img = findFirst(pic, "img");
|
|
53280
|
-
const ref = _optionalChain([img, 'optionalAccess',
|
|
53250
|
+
const ref = _optionalChain([img, 'optionalAccess', _1336 => _1336.getAttribute, 'call', _1337 => _1337("binaryItemIDRef")]);
|
|
53281
53251
|
const loaded = ref != null ? ctx.images.get(ref) : void 0;
|
|
53282
53252
|
const imgId = ctx.regions.add("image", bboxOf(ctx, x, y, w, h), { sourceId: _nullishCoalesce(ref, () => ( void 0)), parentId: parentId(ctx) });
|
|
53283
53253
|
emit(ctx, regionOpenTag(imgId, "image", pageNo(ctx)));
|
|
@@ -53323,12 +53293,12 @@ function readSectionGeom(root) {
|
|
|
53323
53293
|
const pagePr = findFirst(root, "pagePr");
|
|
53324
53294
|
const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
|
|
53325
53295
|
let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
|
|
53326
|
-
if (_optionalChain([pagePr, 'optionalAccess',
|
|
53296
|
+
if (_optionalChain([pagePr, 'optionalAccess', _1338 => _1338.getAttribute, 'call', _1339 => _1339("landscape")]) === "NARROWLY" && PW < PH) {
|
|
53327
53297
|
const t = PW;
|
|
53328
53298
|
PW = PH;
|
|
53329
53299
|
PH = t;
|
|
53330
53300
|
}
|
|
53331
|
-
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess',
|
|
53301
|
+
const gutterType = _nullishCoalesce(_optionalChain([pagePr, 'optionalAccess', _1340 => _1340.getAttribute, 'call', _1341 => _1341("gutterType")]), () => ( "LEFT_ONLY")), gutter = num2(margin, "gutter", 0);
|
|
53332
53302
|
const gL = gutterType === "TOP_BOTTOM" ? 0 : gutter, gT = gutterType === "TOP_BOTTOM" ? gutter : 0;
|
|
53333
53303
|
const ML = num2(margin, "left", 8504) + gL;
|
|
53334
53304
|
const MT = num2(margin, "top", 5668) + num2(margin, "header", 0) + gT;
|
|
@@ -53459,7 +53429,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53459
53429
|
for (const o of m0.objs) {
|
|
53460
53430
|
if (o.tag !== "tbl") continue;
|
|
53461
53431
|
const pos = findChildByLocalName(o.el, "pos"), om = findChildByLocalName(o.el, "outMargin");
|
|
53462
|
-
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53432
|
+
if (!o.inline && (_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1342 => _1342.getAttribute, 'call', _1343 => _1343("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
|
|
53463
53433
|
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)));
|
|
53464
53434
|
const segV = num2(segEls[segK], "vertpos");
|
|
53465
53435
|
const h = Math.max(o.height, measureTableHeight(o.el, ctxBase.extentMemo)), omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
@@ -53467,9 +53437,9 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53467
53437
|
const nTb = m0.objs.filter((q) => !q.inline && (_nullishCoalesce(q.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"))) === "TOP_AND_BOTTOM").length;
|
|
53468
53438
|
const stay = nTb < 2 && !m0.objs.some((q) => q.inline) && !m0.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
53469
53439
|
const wrapP = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( "TOP_AND_BOTTOM"));
|
|
53470
|
-
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access',
|
|
53440
|
+
const pTop = paraTops.get(p), sbP = m0.paraPrId != null ? _nullishCoalesce(_optionalChain([geom0, 'access', _1344 => _1344.get, 'call', _1345 => _1345(m0.paraPrId), 'optionalAccess', _1346 => _1346.spaceBefore]), () => ( 0)) : 0;
|
|
53471
53441
|
const nonPush = wrapP !== "TOP_AND_BOTTOM" && pTop !== void 0 && segV > pTop + sbP + 100 ? pTop + sbP : void 0;
|
|
53472
|
-
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess',
|
|
53442
|
+
const voP = Math.max(0, toInt32(_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _1347 => _1347.getAttribute, 'call', _1348 => _1348("vertOffset")]), () => ( void 0)), 0));
|
|
53473
53443
|
const paraStart = segK === 0 && pTop !== void 0 && pTop < segV ? pTop : segV;
|
|
53474
53444
|
const ty = o.inline ? MT + segV + omT : nonPush !== void 0 ? MT + nonPush + omT + voP : MT + (stay ? segV - sbP : pushed >= -100 ? pushed : paraStart) + omT + voP;
|
|
53475
53445
|
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));
|
|
@@ -53496,7 +53466,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53496
53466
|
for (const p of elements(root)) {
|
|
53497
53467
|
if (ln(p) !== "p") continue;
|
|
53498
53468
|
const pg = paraSegPages.get(p);
|
|
53499
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53469
|
+
if (!_optionalChain([pg, 'optionalAccess', _1349 => _1349.length])) continue;
|
|
53500
53470
|
const pm = buildPara(p);
|
|
53501
53471
|
if (pm.objs.length || pm.chars.some((c) => c.ch.trim() !== "" || !!c.ctrlText)) lastContent = Math.max(lastContent, ...pg);
|
|
53502
53472
|
}
|
|
@@ -53513,7 +53483,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53513
53483
|
for (const p of elements(root)) {
|
|
53514
53484
|
if (ln(p) !== "p") continue;
|
|
53515
53485
|
const pg = paraSegPages.get(p);
|
|
53516
|
-
if (!_optionalChain([pg, 'optionalAccess',
|
|
53486
|
+
if (!_optionalChain([pg, 'optionalAccess', _1350 => _1350.includes, 'call', _1351 => _1351(lastContent)])) continue;
|
|
53517
53487
|
const pm = buildPara(p);
|
|
53518
53488
|
pm.segs.forEach((sg, k) => {
|
|
53519
53489
|
if (pg[k] !== lastContent) return;
|
|
@@ -53533,7 +53503,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53533
53503
|
const ens = endNoteLayout(root, paraSegPages, geom);
|
|
53534
53504
|
const ctx = {
|
|
53535
53505
|
...ctxBase,
|
|
53536
|
-
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53506
|
+
pages: Array.from({ length: Math.max(nPages, _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1352 => _1352.pageCount]), () => ( 0))) }, () => []),
|
|
53537
53507
|
page: 0,
|
|
53538
53508
|
geom,
|
|
53539
53509
|
pageH,
|
|
@@ -53591,7 +53561,7 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode, masters
|
|
|
53591
53561
|
ctx.bodyDx = void 0;
|
|
53592
53562
|
wrapMirror(ctx.pages, (page) => _nullishCoalesce(bodyStart[page], () => ( 0)));
|
|
53593
53563
|
const allPages = new Map(paraSegPages);
|
|
53594
|
-
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess',
|
|
53564
|
+
for (const e of _nullishCoalesce(_optionalChain([ens, 'optionalAccess', _1353 => _1353.paras]), () => ( []))) allPages.set(e.p, e.pages);
|
|
53595
53565
|
drawPageDecor(root, allPages, ctx, localCols ? nCol : 1, colW, colGap);
|
|
53596
53566
|
drawPageNumbers(root, paraSegPages, ctx);
|
|
53597
53567
|
ctx.page = 0;
|
|
@@ -53660,7 +53630,7 @@ function drawPageNumbers(root, paraPages, ctx) {
|
|
|
53660
53630
|
let decl;
|
|
53661
53631
|
const hidden = /* @__PURE__ */ new Set();
|
|
53662
53632
|
for (const p of elements(root)) if (ln(p) === "p") {
|
|
53663
|
-
const page = _nullishCoalesce(_optionalChain([paraPages, 'access',
|
|
53633
|
+
const page = _nullishCoalesce(_optionalChain([paraPages, 'access', _1354 => _1354.get, 'call', _1355 => _1355(p), 'optionalAccess', _1356 => _1356[0]]), () => ( 0));
|
|
53664
53634
|
for (const run of elements(p)) if (ln(run) === "run") {
|
|
53665
53635
|
for (const ctrl of elements(run)) if (ln(ctrl) === "ctrl") {
|
|
53666
53636
|
const pn = findChildByLocalName(ctrl, "pageNum"), ph = findChildByLocalName(ctrl, "pageHiding");
|
|
@@ -53722,22 +53692,22 @@ function renderSectionRoots(sections, input) {
|
|
|
53722
53692
|
rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${index}` });
|
|
53723
53693
|
ctxBase.pageBase += pages.length;
|
|
53724
53694
|
}
|
|
53725
|
-
if (rendered.length === 0) throw new (0,
|
|
53695
|
+
if (rendered.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
53726
53696
|
return { sections: rendered, defs: ctxBase.defs, warnings: input.warnings, stats: ctxBase.stats, regions: ctxBase.regions.regions };
|
|
53727
53697
|
}
|
|
53728
53698
|
var SVG_FONT_FAMILY = `'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif`;
|
|
53729
53699
|
async function renderHwpxInternal(input, options) {
|
|
53730
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
53700
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1357 => _1357.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
53731
53701
|
const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
|
|
53732
|
-
|
|
53702
|
+
_chunkFJ45NNLAcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
|
|
53733
53703
|
let zip;
|
|
53734
53704
|
try {
|
|
53735
53705
|
zip = await _jszip2.default.loadAsync(input);
|
|
53736
53706
|
} catch (e43) {
|
|
53737
|
-
throw new (0,
|
|
53707
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
|
|
53738
53708
|
}
|
|
53739
|
-
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) =>
|
|
53740
|
-
if (secFiles.length === 0) throw new (0,
|
|
53709
|
+
const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => _chunkFJ45NNLAcjs.compareSectionPaths.call(void 0, a.name, b.name));
|
|
53710
|
+
if (secFiles.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
|
|
53741
53711
|
const warnings = [];
|
|
53742
53712
|
const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
|
|
53743
53713
|
const verFile = zip.file("version.xml");
|
|
@@ -53748,14 +53718,14 @@ async function renderHwpxInternal(input, options) {
|
|
|
53748
53718
|
const secXmls = [];
|
|
53749
53719
|
for (const f of secFiles) {
|
|
53750
53720
|
const xml = await readZipEntry(f, "text");
|
|
53751
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53721
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53752
53722
|
secXmls.push(xml);
|
|
53753
53723
|
}
|
|
53754
53724
|
const masterPages = /* @__PURE__ */ new Map();
|
|
53755
53725
|
const masterXmls = [];
|
|
53756
53726
|
for (const file of zip.file(/Contents\/masterpage[^/]*\.xml$/i)) {
|
|
53757
53727
|
const xml = await readZipEntry(file, "text");
|
|
53758
|
-
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0,
|
|
53728
|
+
if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uBC14\uD0D5\uCABD XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
|
|
53759
53729
|
const root = createXmlParser().parseFromString(xml, "text/xml").documentElement;
|
|
53760
53730
|
if (root && ln(root) === "masterPage") {
|
|
53761
53731
|
masterPages.set(root.getAttribute("id") || file.name.replace(/^.*\/|\.xml$/g, ""), root);
|
|
@@ -53783,7 +53753,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53783
53753
|
let href = binmap.get(ref);
|
|
53784
53754
|
if (!href) {
|
|
53785
53755
|
const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
|
|
53786
|
-
href = _optionalChain([cand, 'optionalAccess',
|
|
53756
|
+
href = _optionalChain([cand, 'optionalAccess', _1358 => _1358.name]);
|
|
53787
53757
|
}
|
|
53788
53758
|
if (!href) continue;
|
|
53789
53759
|
const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
|
|
@@ -53805,7 +53775,7 @@ async function renderHwpxInternal(input, options) {
|
|
|
53805
53775
|
for (let si = 0; si < secXmls.length; si++) {
|
|
53806
53776
|
const secXml = secXmls[si];
|
|
53807
53777
|
const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
|
|
53808
|
-
if (!hasCache && !_optionalChain([options, 'optionalAccess',
|
|
53778
|
+
if (!hasCache && !_optionalChain([options, 'optionalAccess', _1359 => _1359.reflow])) {
|
|
53809
53779
|
noCacheSkipped = true;
|
|
53810
53780
|
warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
|
|
53811
53781
|
continue;
|
|
@@ -53822,11 +53792,11 @@ async function renderHwpxInternal(input, options) {
|
|
|
53822
53792
|
}
|
|
53823
53793
|
if (roots.length === 0) {
|
|
53824
53794
|
if (noCacheSkipped) {
|
|
53825
|
-
throw new (0,
|
|
53795
|
+
throw new (0, _chunkFJ45NNLAcjs.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)");
|
|
53826
53796
|
}
|
|
53827
|
-
throw new (0,
|
|
53797
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
53828
53798
|
}
|
|
53829
|
-
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
53799
|
+
return renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1360 => _1360.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1361 => _1361.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1362 => _1362.highlights]) });
|
|
53830
53800
|
}
|
|
53831
53801
|
async function renderHwpxToSvg(input, options) {
|
|
53832
53802
|
const r = await renderHwpxInternal(input, options);
|
|
@@ -54049,7 +54019,7 @@ var FOLD_END = 42124;
|
|
|
54049
54019
|
var FOLD_SHIFT = 983040 - 40960;
|
|
54050
54020
|
function textChar(ch) {
|
|
54051
54021
|
if (ch >= FOLD_START && ch <= FOLD_END) {
|
|
54052
|
-
const mapped =
|
|
54022
|
+
const mapped = _chunkS34OVRKDcjs.mapPuaText.call(void 0, String.fromCodePoint(ch + FOLD_SHIFT));
|
|
54053
54023
|
return /[\u{F0000}-\u{FFFFF}]/u.test(mapped) ? "" : mapped;
|
|
54054
54024
|
}
|
|
54055
54025
|
if (ch === 65534 || ch === 65535 || ch >= 55296 && ch <= 57343) return "\uFFFD";
|
|
@@ -54141,7 +54111,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54141
54111
|
out += run.join("") + "</hp:run>";
|
|
54142
54112
|
run = [];
|
|
54143
54113
|
};
|
|
54144
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54114
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1363 => _1363[0], 'optionalAccess', _1364 => _1364[1]]), () => ( 0)));
|
|
54145
54115
|
let pos = 0, ctrlIdx = 0, o = 0;
|
|
54146
54116
|
const switchShape = () => {
|
|
54147
54117
|
while (shapeIdx + 1 < shapes.length && pos >= shapes[shapeIdx + 1][0]) {
|
|
@@ -54227,7 +54197,7 @@ function paragraphXml(records, i, j, level, ctx, depth) {
|
|
|
54227
54197
|
closeRun();
|
|
54228
54198
|
const rest = ctrls.filter((c) => !c.used && (c.id === CTRL_TBL3 || c.id === CTRL_GSO3 || c.id === CTRL_SECD2 || c.id === CTRL_COLD2));
|
|
54229
54199
|
if (rest.length > 0) {
|
|
54230
|
-
openRun(_nullishCoalesce(_optionalChain([shapes, 'access',
|
|
54200
|
+
openRun(_nullishCoalesce(_optionalChain([shapes, 'access', _1365 => _1365[0], 'optionalAccess', _1366 => _1366[1]]), () => ( 0)));
|
|
54231
54201
|
for (const c of rest) {
|
|
54232
54202
|
const el = ctrlElement(ctrls.indexOf(c), c.id);
|
|
54233
54203
|
run.push(el);
|
|
@@ -54393,14 +54363,14 @@ function hwp5SectionToXml(records, ctx) {
|
|
|
54393
54363
|
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>";
|
|
54394
54364
|
}
|
|
54395
54365
|
function renderHwp5Records(docInfo, styles, secRecords, binData, options, select, warnings = []) {
|
|
54396
|
-
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
54366
|
+
const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1367 => _1367.maxImageBytes]), () => ( 40 * 1024 * 1024));
|
|
54397
54367
|
const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
|
|
54398
54368
|
const images = /* @__PURE__ */ new Map();
|
|
54399
54369
|
let totalImgBytes = 0;
|
|
54400
54370
|
const imageRef = (binDataId) => {
|
|
54401
54371
|
if (binDataId <= 0) return null;
|
|
54402
|
-
const item = _optionalChain([docInfo, 'optionalAccess',
|
|
54403
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
54372
|
+
const item = _optionalChain([docInfo, 'optionalAccess', _1368 => _1368.binData, 'access', _1369 => _1369[binDataId - 1]]);
|
|
54373
|
+
if (_optionalChain([item, 'optionalAccess', _1370 => _1370.kind]) === "link") return null;
|
|
54404
54374
|
const storageId = item && item.storageId > 0 ? item.storageId : binDataId;
|
|
54405
54375
|
const ref = `bin${storageId}`;
|
|
54406
54376
|
if (images.has(ref)) return ref;
|
|
@@ -54434,8 +54404,8 @@ function renderHwp5Records(docInfo, styles, secRecords, binData, options, select
|
|
|
54434
54404
|
}
|
|
54435
54405
|
roots.push({ root, index: si });
|
|
54436
54406
|
}
|
|
54437
|
-
if (roots.length === 0) throw new (0,
|
|
54438
|
-
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess',
|
|
54407
|
+
if (roots.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP \uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
|
|
54408
|
+
const r = renderSectionRoots(roots, { styles, images, warnings, reflow: !!_optionalChain([options, 'optionalAccess', _1371 => _1371.reflow]), reflowMode: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1372 => _1372.reflowMode]), () => ( "keep")), highlights: _optionalChain([options, 'optionalAccess', _1373 => _1373.highlights]) });
|
|
54439
54409
|
return assemblePageSvgs(r, "hwp", select);
|
|
54440
54410
|
}
|
|
54441
54411
|
function renderHwp5Pages(input, options, select) {
|
|
@@ -54447,7 +54417,7 @@ function renderHwp5Pages(input, options, select) {
|
|
|
54447
54417
|
const styles = buildHwp5RenderStyles(_nullishCoalesce(docInfoRecords, () => ( [])));
|
|
54448
54418
|
const docInfo = docInfoRecords ? parseDocInfo(docInfoRecords) : null;
|
|
54449
54419
|
const sections = readHwp5SectionStreams(c);
|
|
54450
|
-
if (sections.length === 0) throw new (0,
|
|
54420
|
+
if (sections.length === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
54451
54421
|
const parseWarnings = [];
|
|
54452
54422
|
const secRecords = readHwp5SectionRecords(c, sections, parseWarnings);
|
|
54453
54423
|
for (const w of parseWarnings) warnings.push(w.message);
|
|
@@ -54533,14 +54503,14 @@ async function loadSharp() {
|
|
|
54533
54503
|
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("sharp")));
|
|
54534
54504
|
return _nullishCoalesce(mod.default, () => ( mod));
|
|
54535
54505
|
} catch (e46) {
|
|
54536
|
-
throw new (0,
|
|
54537
|
-
'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.' +
|
|
54506
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(
|
|
54507
|
+
'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.' + _chunkFJ45NNLAcjs.OPTIONAL_DEP_INSTALL_HINT
|
|
54538
54508
|
);
|
|
54539
54509
|
}
|
|
54540
54510
|
}
|
|
54541
54511
|
async function rasterizePageSvg(svg, widthPt, heightPt, options = {}) {
|
|
54542
54512
|
const sharp = await loadSharp();
|
|
54543
|
-
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0,
|
|
54513
|
+
if (!(widthPt > 0) || !(heightPt > 0)) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC798\uBABB\uB41C \uD398\uC774\uC9C0 \uD06C\uAE30: ${widthPt}x${heightPt}pt`);
|
|
54544
54514
|
const maxW = _nullishCoalesce(options.maxWidthPx, () => ( 1400));
|
|
54545
54515
|
const maxH = _nullishCoalesce(options.maxHeightPx, () => ( 4e3));
|
|
54546
54516
|
const scale2 = Math.min(maxW / widthPt, maxH / heightPt, 2);
|
|
@@ -54558,11 +54528,11 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54558
54528
|
try {
|
|
54559
54529
|
puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
|
|
54560
54530
|
} catch (e47) {
|
|
54561
|
-
throw new (0,
|
|
54531
|
+
throw new (0, _chunkFJ45NNLAcjs.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");
|
|
54562
54532
|
}
|
|
54563
54533
|
const executablePath = _nullishCoalesce(_nullishCoalesce(options.browserExecutablePath, () => ( process.env.PUPPETEER_EXECUTABLE_PATH)), () => ( findChromiumPath()));
|
|
54564
54534
|
if (!executablePath) {
|
|
54565
|
-
throw new (0,
|
|
54535
|
+
throw new (0, _chunkFJ45NNLAcjs.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");
|
|
54566
54536
|
}
|
|
54567
54537
|
const { browser, page } = await launchLockedPage(puppeteer, executablePath);
|
|
54568
54538
|
try {
|
|
@@ -54578,13 +54548,13 @@ async function renderHtmlToPdf(html, options = {}) {
|
|
|
54578
54548
|
async function loadBuffer(input) {
|
|
54579
54549
|
if (typeof input === "string") {
|
|
54580
54550
|
try {
|
|
54581
|
-
return
|
|
54551
|
+
return _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input));
|
|
54582
54552
|
} catch (err) {
|
|
54583
54553
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
54584
|
-
throw new (0,
|
|
54554
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`);
|
|
54585
54555
|
}
|
|
54586
54556
|
}
|
|
54587
|
-
if (Buffer.isBuffer(input)) return
|
|
54557
|
+
if (Buffer.isBuffer(input)) return _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, input);
|
|
54588
54558
|
if (input instanceof Uint8Array) return input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength);
|
|
54589
54559
|
return input;
|
|
54590
54560
|
}
|
|
@@ -54593,17 +54563,17 @@ async function sourceFormatOf(buffer) {
|
|
|
54593
54563
|
if (format2 === "hwpx") {
|
|
54594
54564
|
const zip = await detectZipFormat(buffer);
|
|
54595
54565
|
if (zip === "hwpx" || zip === "unknown") return "hwpx";
|
|
54596
|
-
throw new (0,
|
|
54566
|
+
throw new (0, _chunkFJ45NNLAcjs.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`);
|
|
54597
54567
|
}
|
|
54598
54568
|
if (format2 === "hwp") return "hwp";
|
|
54599
|
-
throw new (0,
|
|
54569
|
+
throw new (0, _chunkFJ45NNLAcjs.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`);
|
|
54600
54570
|
}
|
|
54601
54571
|
async function renderDocumentToScene(input, options = {}) {
|
|
54602
54572
|
const buffer = await loadBuffer(input);
|
|
54603
54573
|
const source = await sourceFormatOf(buffer);
|
|
54604
54574
|
const select = options.pages !== void 0 ? (pageCount) => {
|
|
54605
54575
|
const set = _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, options.pages, pageCount);
|
|
54606
|
-
if (set.size === 0) throw new (0,
|
|
54576
|
+
if (set.size === 0) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC120\uD0DD\uD55C \uD398\uC774\uC9C0\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 \uBB38\uC11C\uB294 ${pageCount}\uCABD (pages: ${JSON.stringify(options.pages)})`);
|
|
54607
54577
|
return set;
|
|
54608
54578
|
} : void 0;
|
|
54609
54579
|
const renderOptions = { reflow: _nullishCoalesce(options.reflow, () => ( true)), reflowMode: options.reflowMode, highlights: options.highlights, maxImageBytes: options.maxImageBytes };
|
|
@@ -54639,7 +54609,7 @@ async function renderDocument(input, options) {
|
|
|
54639
54609
|
break;
|
|
54640
54610
|
}
|
|
54641
54611
|
default:
|
|
54642
|
-
throw new (0,
|
|
54612
|
+
throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uC54C \uC218 \uC5C6\uB294 \uB80C\uB354 \uD3EC\uB9F7: ${String(options.format)} (svg|html|png|jpeg|pdf)`);
|
|
54643
54613
|
}
|
|
54644
54614
|
return { scene, assets };
|
|
54645
54615
|
}
|
|
@@ -54669,7 +54639,7 @@ async function extractRenderedRegions(input, options = {}) {
|
|
|
54669
54639
|
const out = [];
|
|
54670
54640
|
for (const [page, items] of [...byPage.entries()].sort((a, b) => a[0] - b[0])) {
|
|
54671
54641
|
const meta = scene.pages.find((p) => p.page === page);
|
|
54672
|
-
if (!meta) throw new (0,
|
|
54642
|
+
if (!meta) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uD398\uC774\uC9C0 ${page} \uBA54\uD0C0 \uC5C6\uC74C`);
|
|
54673
54643
|
const raster = await rasterizePageSvg(pageSvgs.get(page), meta.width, meta.height, { format: format2, maxWidthPx: options.maxWidthPx, quality: options.quality });
|
|
54674
54644
|
for (const { region, bbox } of items) {
|
|
54675
54645
|
const rect = cropRect(bbox, raster.scale, raster.widthPx, raster.heightPx, _nullishCoalesce(options.paddingPt, () => ( 0)));
|
|
@@ -54693,9 +54663,9 @@ function wantsCrop(kind, policy) {
|
|
|
54693
54663
|
}
|
|
54694
54664
|
async function extractTables(input, options = {}) {
|
|
54695
54665
|
const policy = _nullishCoalesce(options.policy, () => ( "non-tabular-and-uncertain"));
|
|
54696
|
-
const buffer = typeof input === "string" ?
|
|
54666
|
+
const buffer = typeof input === "string" ? _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, await _promises.readFile.call(void 0, input)) : Buffer.isBuffer(input) ? _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, input) : input;
|
|
54697
54667
|
const parsed = await parse(buffer, { classifyTables: true, layoutTables: "keep" });
|
|
54698
|
-
if (!parsed.success) throw new (0,
|
|
54668
|
+
if (!parsed.success) throw new (0, _chunkFJ45NNLAcjs.KordocError)(`\uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
54699
54669
|
const blocks = collectTableBlocks(parsed.blocks);
|
|
54700
54670
|
const out = blocks.map((b, i) => ({
|
|
54701
54671
|
id: _nullishCoalesce(b.table.sourceId, () => ( `tbl-${i + 1}`)),
|
|
@@ -54753,22 +54723,22 @@ async function extractTables(input, options = {}) {
|
|
|
54753
54723
|
// src/index.ts
|
|
54754
54724
|
async function parse(input, options) {
|
|
54755
54725
|
let buffer;
|
|
54756
|
-
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess',
|
|
54757
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
54726
|
+
const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _1374 => _1374.filePath]) ? { ...options, filePath: input } : options;
|
|
54727
|
+
if (_optionalChain([opts, 'optionalAccess', _1375 => _1375.htmlTables]) && opts.tableFormat) {
|
|
54758
54728
|
return { success: false, fileType: "unknown", error: "htmlTables \uC640 tableFormat \uC740 \uD568\uAED8 \uC4F8 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4" };
|
|
54759
54729
|
}
|
|
54760
|
-
const ocrOptionError =
|
|
54730
|
+
const ocrOptionError = _chunkS34OVRKDcjs.validateOcrOptions.call(void 0, opts);
|
|
54761
54731
|
if (ocrOptionError) return { success: false, fileType: "unknown", error: ocrOptionError };
|
|
54762
54732
|
if (typeof input === "string") {
|
|
54763
54733
|
try {
|
|
54764
54734
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54765
|
-
buffer =
|
|
54735
|
+
buffer = _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, buf);
|
|
54766
54736
|
} catch (err) {
|
|
54767
54737
|
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}`;
|
|
54768
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
54738
|
+
return { success: false, fileType: "unknown", error: msg2, code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54769
54739
|
}
|
|
54770
54740
|
} else if (Buffer.isBuffer(input)) {
|
|
54771
|
-
buffer =
|
|
54741
|
+
buffer = _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, input);
|
|
54772
54742
|
} else {
|
|
54773
54743
|
buffer = input;
|
|
54774
54744
|
}
|
|
@@ -54777,23 +54747,23 @@ async function parse(input, options) {
|
|
|
54777
54747
|
}
|
|
54778
54748
|
const format2 = detectFormat(buffer);
|
|
54779
54749
|
const result = await dispatch(format2, buffer, opts);
|
|
54780
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54750
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1376 => _1376.images]) === false) {
|
|
54781
54751
|
delete result.images;
|
|
54782
54752
|
dropImageBytes(result.blocks);
|
|
54783
54753
|
}
|
|
54784
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54754
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1377 => _1377.classifyTables])) classifyTableTree(result.blocks);
|
|
54785
54755
|
let out = result;
|
|
54786
|
-
if (result.success && _optionalChain([opts, 'optionalAccess',
|
|
54756
|
+
if (result.success && _optionalChain([opts, 'optionalAccess', _1378 => _1378.pages]) && result.pageCount && _chunkJ55UQC5Hcjs.parsePageRange.call(void 0, opts.pages, result.pageCount).size === 0) {
|
|
54787
54757
|
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` }] };
|
|
54788
54758
|
}
|
|
54789
54759
|
if (out.success && !out.pages) {
|
|
54790
|
-
const pages =
|
|
54760
|
+
const pages = _chunkTN4SSNEScjs.blocksToPages.call(void 0, out.blocks, (bs) => _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, bs, { tableFormat: _optionalChain([opts, 'optionalAccess', _1379 => _1379.tableFormat]) }));
|
|
54791
54761
|
if (pages) out = { ...out, pages };
|
|
54792
54762
|
}
|
|
54793
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54763
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1380 => _1380.plain])) {
|
|
54794
54764
|
out = { ...out, markdown: toPlainMarkdown(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toPlainMarkdown(p.markdown) })) } : {} };
|
|
54795
54765
|
}
|
|
54796
|
-
if (out.success && _optionalChain([opts, 'optionalAccess',
|
|
54766
|
+
if (out.success && _optionalChain([opts, 'optionalAccess', _1381 => _1381.htmlTables])) {
|
|
54797
54767
|
out = { ...out, markdown: toHtmlTables(out.markdown), ...out.pages ? { pages: out.pages.map((p) => ({ ...p, markdown: toHtmlTables(p.markdown) })) } : {} };
|
|
54798
54768
|
}
|
|
54799
54769
|
return out;
|
|
@@ -54838,42 +54808,42 @@ async function dispatch(format2, buffer, opts) {
|
|
|
54838
54808
|
async function withEmbeddedImageOcr(blocks, markdown, warnings, images, options) {
|
|
54839
54809
|
const list = [..._nullishCoalesce(warnings, () => ( []))];
|
|
54840
54810
|
if (!await ocrEmbeddedImages(blocks, options, list)) return { markdown, warnings: list.length ? list : void 0 };
|
|
54841
|
-
let md2 =
|
|
54842
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
54811
|
+
let md2 = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1382 => _1382.tableFormat]) });
|
|
54812
|
+
if (_optionalChain([options, 'optionalAccess', _1383 => _1383.inlineImages]) && options.images !== false && _optionalChain([images, 'optionalAccess', _1384 => _1384.length])) {
|
|
54843
54813
|
try {
|
|
54844
|
-
md2 =
|
|
54814
|
+
md2 = _chunkTN4SSNEScjs.inlineImagesIntoMarkdown.call(void 0, md2, images, { compress: true });
|
|
54845
54815
|
} catch (e48) {
|
|
54846
54816
|
}
|
|
54847
54817
|
}
|
|
54848
54818
|
return { markdown: md2, warnings: list.length ? list : void 0 };
|
|
54849
54819
|
}
|
|
54850
54820
|
function scriptsOff(r, off) {
|
|
54851
|
-
return off ?
|
|
54821
|
+
return off ? _chunkS34OVRKDcjs.stripScriptTags.call(void 0, r) : r;
|
|
54852
54822
|
}
|
|
54853
54823
|
async function parseImage(buffer, options) {
|
|
54854
54824
|
try {
|
|
54855
|
-
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-
|
|
54825
|
+
const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-DP4YTLGN.cjs")));
|
|
54856
54826
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54857
|
-
|
|
54827
|
+
_chunkS34OVRKDcjs.stripScriptTags.call(void 0, { blocks });
|
|
54858
54828
|
return {
|
|
54859
54829
|
success: true,
|
|
54860
54830
|
fileType: "image",
|
|
54861
|
-
markdown:
|
|
54831
|
+
markdown: _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, blocks, { tableFormat: _optionalChain([options, 'optionalAccess', _1385 => _1385.tableFormat]) }),
|
|
54862
54832
|
blocks,
|
|
54863
54833
|
warnings: warnings.length ? warnings : void 0,
|
|
54864
54834
|
pageCount: 1,
|
|
54865
|
-
..._optionalChain([options, 'optionalAccess',
|
|
54835
|
+
..._optionalChain([options, 'optionalAccess', _1386 => _1386.ocrLines]) ? { ocrLines: lines ? [lines] : [] } : {}
|
|
54866
54836
|
};
|
|
54867
54837
|
} catch (err) {
|
|
54868
|
-
return { success: false, fileType: "image", error:
|
|
54838
|
+
return { success: false, fileType: "image", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54869
54839
|
}
|
|
54870
54840
|
}
|
|
54871
54841
|
async function parseHwp3(buffer, options) {
|
|
54872
54842
|
try {
|
|
54873
54843
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp3Document(buffer, options);
|
|
54874
|
-
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54844
|
+
return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings, images, pageCount: _optionalChain([metadata, 'optionalAccess', _1387 => _1387.pageCount]) };
|
|
54875
54845
|
} catch (err) {
|
|
54876
|
-
return { success: false, fileType: "hwp3", error:
|
|
54846
|
+
return { success: false, fileType: "hwp3", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54877
54847
|
}
|
|
54878
54848
|
}
|
|
54879
54849
|
async function parseHwpx(buffer, options) {
|
|
@@ -54881,15 +54851,15 @@ async function parseHwpx(buffer, options) {
|
|
|
54881
54851
|
const doc = await parseHwpxDocument(buffer, options);
|
|
54882
54852
|
const { blocks, metadata, outline, images } = doc;
|
|
54883
54853
|
const { markdown, warnings } = await withEmbeddedImageOcr(blocks, doc.markdown, doc.warnings, void 0, options);
|
|
54884
|
-
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54854
|
+
return scriptsOff({ success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1388 => _1388.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1389 => _1389.pageCount]) }, _optionalChain([options, 'optionalAccess', _1390 => _1390.scriptTags]) === false);
|
|
54885
54855
|
} catch (err) {
|
|
54886
|
-
return { success: false, fileType: "hwpx", error:
|
|
54856
|
+
return { success: false, fileType: "hwpx", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54887
54857
|
}
|
|
54888
54858
|
}
|
|
54889
54859
|
async function parseHwp(buffer, options) {
|
|
54890
54860
|
try {
|
|
54891
54861
|
const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
|
|
54892
|
-
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess',
|
|
54862
|
+
if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _1391 => _1391.filePath])) {
|
|
54893
54863
|
try {
|
|
54894
54864
|
const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
|
|
54895
54865
|
if (pages.some((p) => p && p.trim().length > 0)) {
|
|
@@ -54908,15 +54878,15 @@ async function parseHwp(buffer, options) {
|
|
|
54908
54878
|
}
|
|
54909
54879
|
}
|
|
54910
54880
|
const ocred = await withEmbeddedImageOcr(blocks, markdown, warnings, images, options);
|
|
54911
|
-
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54881
|
+
return scriptsOff({ success: true, fileType: "hwp", markdown: ocred.markdown, blocks, metadata, outline, warnings: ocred.warnings, images: _optionalChain([images, 'optionalAccess', _1392 => _1392.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1393 => _1393.pageCount]) }, _optionalChain([options, 'optionalAccess', _1394 => _1394.scriptTags]) === false);
|
|
54912
54882
|
} catch (err) {
|
|
54913
|
-
return { success: false, fileType: "hwp", error:
|
|
54883
|
+
return { success: false, fileType: "hwp", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54914
54884
|
}
|
|
54915
54885
|
}
|
|
54916
54886
|
async function parsePdf(buffer, options) {
|
|
54917
54887
|
let parsePdfDocument;
|
|
54918
54888
|
try {
|
|
54919
|
-
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-
|
|
54889
|
+
const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-CGKXEB3U.cjs")));
|
|
54920
54890
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54921
54891
|
} catch (e50) {
|
|
54922
54892
|
return {
|
|
@@ -54928,59 +54898,59 @@ async function parsePdf(buffer, options) {
|
|
|
54928
54898
|
}
|
|
54929
54899
|
try {
|
|
54930
54900
|
const { markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, ocrLines } = await parsePdfDocument(buffer, options);
|
|
54931
|
-
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54901
|
+
return scriptsOff({ success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images, pages, pageCount: _optionalChain([metadata, 'optionalAccess', _1395 => _1395.pageCount]), ...ocrLines ? { ocrLines } : {} }, _optionalChain([options, 'optionalAccess', _1396 => _1396.scriptTags]) !== true);
|
|
54932
54902
|
} catch (err) {
|
|
54933
54903
|
const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
|
|
54934
|
-
return { success: false, fileType: "pdf", error:
|
|
54904
|
+
return { success: false, fileType: "pdf", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err), isImageBased };
|
|
54935
54905
|
}
|
|
54936
54906
|
}
|
|
54937
54907
|
async function parseXlsx(buffer, options) {
|
|
54938
54908
|
try {
|
|
54939
54909
|
const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
|
|
54940
|
-
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54910
|
+
return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1397 => _1397.pageCount]) };
|
|
54941
54911
|
} catch (err) {
|
|
54942
|
-
return { success: false, fileType: "xlsx", error:
|
|
54912
|
+
return { success: false, fileType: "xlsx", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54943
54913
|
}
|
|
54944
54914
|
}
|
|
54945
54915
|
async function parseXls(buffer, options) {
|
|
54946
54916
|
try {
|
|
54947
54917
|
const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
|
|
54948
|
-
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54918
|
+
return { success: true, fileType: "xls", markdown, blocks, metadata, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1398 => _1398.pageCount]) };
|
|
54949
54919
|
} catch (err) {
|
|
54950
|
-
return { success: false, fileType: "xls", error:
|
|
54920
|
+
return { success: false, fileType: "xls", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54951
54921
|
}
|
|
54952
54922
|
}
|
|
54953
54923
|
async function parseDocx(buffer, options) {
|
|
54954
54924
|
try {
|
|
54955
54925
|
const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
|
|
54956
|
-
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54926
|
+
return scriptsOff({ success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1399 => _1399.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1400 => _1400.pageCount]) }, _optionalChain([options, 'optionalAccess', _1401 => _1401.scriptTags]) === false);
|
|
54957
54927
|
} catch (err) {
|
|
54958
|
-
return { success: false, fileType: "docx", error:
|
|
54928
|
+
return { success: false, fileType: "docx", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54959
54929
|
}
|
|
54960
54930
|
}
|
|
54961
54931
|
async function parsePptx(buffer, options) {
|
|
54962
54932
|
try {
|
|
54963
54933
|
const { markdown, blocks, metadata, outline, warnings, images } = await parsePptxDocument(buffer, options);
|
|
54964
|
-
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess',
|
|
54934
|
+
return scriptsOff({ success: true, fileType: "pptx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _1402 => _1402.length]) ? images : void 0, pageCount: _optionalChain([metadata, 'optionalAccess', _1403 => _1403.pageCount]) }, _optionalChain([options, 'optionalAccess', _1404 => _1404.scriptTags]) === false);
|
|
54965
54935
|
} catch (err) {
|
|
54966
|
-
return { success: false, fileType: "pptx", error:
|
|
54936
|
+
return { success: false, fileType: "pptx", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54967
54937
|
}
|
|
54968
54938
|
}
|
|
54969
54939
|
async function parseHwpml(buffer, options) {
|
|
54970
54940
|
try {
|
|
54971
54941
|
const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
|
|
54972
|
-
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess',
|
|
54942
|
+
return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings, pageCount: _optionalChain([metadata, 'optionalAccess', _1405 => _1405.pageCount]) };
|
|
54973
54943
|
} catch (err) {
|
|
54974
|
-
return { success: false, fileType: "hwpml", error:
|
|
54944
|
+
return { success: false, fileType: "hwpml", error: _chunkFJ45NNLAcjs.sanitizeError.call(void 0, err), code: _chunkFJ45NNLAcjs.classifyError.call(void 0, err) };
|
|
54975
54945
|
}
|
|
54976
54946
|
}
|
|
54977
54947
|
async function fillForm(input, values, outputFormat = "markdown") {
|
|
54978
54948
|
let buffer;
|
|
54979
54949
|
if (typeof input === "string") {
|
|
54980
54950
|
const buf = await _promises.readFile.call(void 0, input);
|
|
54981
|
-
buffer =
|
|
54951
|
+
buffer = _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, buf);
|
|
54982
54952
|
} else if (Buffer.isBuffer(input)) {
|
|
54983
|
-
buffer =
|
|
54953
|
+
buffer = _chunkFJ45NNLAcjs.toArrayBuffer.call(void 0, input);
|
|
54984
54954
|
} else {
|
|
54985
54955
|
buffer = input;
|
|
54986
54956
|
}
|
|
@@ -55006,7 +54976,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55006
54976
|
throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
|
|
55007
54977
|
}
|
|
55008
54978
|
const fill = fillFormFields(parsed.blocks, values);
|
|
55009
|
-
const markdown =
|
|
54979
|
+
const markdown = _chunkS34OVRKDcjs.blocksToMarkdown.call(void 0, fill.blocks);
|
|
55010
54980
|
if (outputFormat === "hwpx") {
|
|
55011
54981
|
const hwpxBuffer = await markdownToHwpx(markdown);
|
|
55012
54982
|
return { output: hwpxBuffer, format: "hwpx", fill };
|
|
@@ -55105,5 +55075,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
55105
55075
|
|
|
55106
55076
|
|
|
55107
55077
|
|
|
55108
|
-
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 =
|
|
55078
|
+
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 = _chunkFJ45NNLAcjs.VERSION; exports.ValueCursor = ValueCursor; exports.agencyNames = agencyNames; exports.agencyStyle = agencyStyle; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkS34OVRKDcjs.blocksToMarkdown; exports.blocksToPages = _chunkTN4SSNEScjs.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 = _chunkS34OVRKDcjs.flattenLayoutTables; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hasStructuredCellContent = _chunkS34OVRKDcjs.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;
|
|
55109
55079
|
//# sourceMappingURL=index.cjs.map
|