kordoc 4.18.3 → 4.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{-WOKB25R2.js → -DDAVBMHD.js} +11 -11
- package/dist/{chunk-BGOR5GCF.js → chunk-274ZPMHK.js} +2 -2
- package/dist/{chunk-2ZBLQVAS.cjs → chunk-3WLZOJIE.cjs} +6 -6
- package/dist/chunk-3WLZOJIE.cjs.map +1 -0
- package/dist/{chunk-SHRRD2TD.cjs → chunk-3XSP7V5P.cjs} +2 -2
- package/dist/chunk-3XSP7V5P.cjs.map +1 -0
- package/dist/{chunk-6GLTGOP6.js → chunk-4IBY5LTJ.js} +2 -2
- package/dist/chunk-6H25SXDI.js +11 -0
- package/dist/chunk-6H25SXDI.js.map +1 -0
- package/dist/{chunk-CAN5P6N6.js → chunk-7GR2GCJF.js} +2 -2
- package/dist/{chunk-HZV52V2X.cjs → chunk-AVIZ55NQ.cjs} +3 -3
- package/dist/chunk-AVIZ55NQ.cjs.map +1 -0
- package/dist/chunk-DC6CTQTK.js +9 -0
- package/dist/chunk-DC6CTQTK.js.map +1 -0
- package/dist/{chunk-NES5U4JK.js → chunk-DUV7Y6IQ.js} +3 -3
- package/dist/{chunk-WN5YLP7H.cjs → chunk-E2644XCO.cjs} +693 -187
- package/dist/chunk-E2644XCO.cjs.map +1 -0
- package/dist/{chunk-3FZGL3IL.js → chunk-ELOPDQES.js} +2 -2
- package/dist/{chunk-2I2RTJJ5.js → chunk-F2GDLA45.js} +25 -35
- package/dist/chunk-F2GDLA45.js.map +1 -0
- package/dist/{chunk-VGDTONTB.js → chunk-F5YVCJVF.js} +2 -2
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-RDBTOE5X.js → chunk-HRJJDNRD.js} +2 -2
- package/dist/{chunk-KSJ7GKNQ.js → chunk-IAXGGQGD.js} +2 -2
- package/dist/{chunk-IXX3WHIE.js → chunk-IBQCK4F3.js} +7 -3
- package/dist/chunk-IBQCK4F3.js.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-J2A46VCA.js → chunk-KUUSP6OS.js} +576 -70
- package/dist/chunk-KUUSP6OS.js.map +1 -0
- package/dist/{chunk-RSDUH4XF.js → chunk-LGF2IO66.js} +2 -2
- package/dist/{chunk-BJ6RYYXV.js → chunk-MXA6YW2W.js} +577 -71
- package/dist/chunk-MXA6YW2W.js.map +1 -0
- package/dist/{chunk-ZD5WNQNC.cjs → chunk-OIUSF2VA.cjs} +16 -12
- package/dist/chunk-OIUSF2VA.cjs.map +1 -0
- package/dist/{chunk-AZQWESRH.js → chunk-QVCHFCT2.js} +2 -2
- package/dist/{chunk-W7P4GPOV.js → chunk-RCI7LY4N.js} +8 -4
- package/dist/chunk-RCI7LY4N.js.map +1 -0
- package/dist/{chunk-V4BKT65D.cjs → chunk-SVNBZEL6.cjs} +3 -3
- package/dist/chunk-SVNBZEL6.cjs.map +1 -0
- package/dist/{chunk-OOX2GZZ4.js → chunk-T2BJPT6D.js} +3 -3
- package/dist/{chunk-OOX2GZZ4.js.map → chunk-T2BJPT6D.js.map} +1 -1
- package/dist/chunk-TK3FDAEE.cjs +9 -0
- package/dist/chunk-TK3FDAEE.cjs.map +1 -0
- package/dist/{chunk-UVUKT3IQ.js → chunk-TMJVD6FW.js} +2 -2
- package/dist/{chunk-ZN3LHNJG.js → chunk-V5X4LLVM.js} +28 -27
- package/dist/chunk-V5X4LLVM.js.map +1 -0
- package/dist/{chunk-W3RADOLO.js → chunk-VTVK2JMI.js} +2 -2
- package/dist/{chunk-PSJLB3SZ.js → chunk-XG4SYOZL.js} +2 -2
- package/dist/{chunk-RRURZDEK.js → chunk-YCY2R4FM.js} +2 -2
- package/dist/{chunk-5X7XWYR2.js → chunk-Z2PPDQK2.js} +2 -2
- package/dist/chunks-5QTTAT5T.js +10 -0
- package/dist/cli.js +154 -115
- package/dist/cli.js.map +1 -1
- package/dist/{formula-QZAOKPBX.js → formula-7ZOZ5QJ6.js} +8 -4
- package/dist/{formula-QZAOKPBX.js.map → formula-7ZOZ5QJ6.js.map} +1 -1
- package/dist/{formula-GPCOJJXN.js → formula-HQFZEXFF.js} +7 -3
- package/dist/{formula-GPCOJJXN.js.map → formula-HQFZEXFF.js.map} +1 -1
- package/dist/{formula-BQ5RW5XD.cjs → formula-YYJQBKEN.cjs} +13 -9
- package/dist/formula-YYJQBKEN.cjs.map +1 -0
- package/dist/{image-ocr-POCME5I4.js → image-ocr-4BGX2EJJ.js} +7 -6
- package/dist/{image-ocr-POCME5I4.js.map → image-ocr-4BGX2EJJ.js.map} +1 -1
- package/dist/{image-ocr-VKIUBLBX.cjs → image-ocr-CC26Q5KG.cjs} +16 -15
- package/dist/image-ocr-CC26Q5KG.cjs.map +1 -0
- package/dist/{image-ocr-TWNNVTZS.js → image-ocr-RK3HJVCI.js} +10 -9
- package/dist/{image-ocr-TWNNVTZS.js.map → image-ocr-RK3HJVCI.js.map} +1 -1
- package/dist/index.cjs +338 -347
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -51
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-THYUL7GG.js → model-bundle-VHRXG63R.js} +5 -5
- package/dist/{models-U22N4RXX.js → models-G3WA24SY.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-JOMFOZLH.cjs → parser-BGORCLIU.cjs} +449 -244
- package/dist/parser-BGORCLIU.cjs.map +1 -0
- package/dist/{parser-SCXRLOW7.js → parser-GFDGAVLV.js} +242 -37
- package/dist/parser-GFDGAVLV.js.map +1 -0
- package/dist/{parser-NKP2NCSV.js → parser-SOWTUOMK.js} +245 -40
- package/dist/parser-SOWTUOMK.js.map +1 -0
- package/dist/pdf-ocr-7IOOVR2I.js +20 -0
- package/dist/pdf-ocr-EJ2HNZN6.cjs +17 -0
- package/dist/pdf-ocr-EJ2HNZN6.cjs.map +1 -0
- package/dist/pdf-ocr-RACAZU3N.js +16 -0
- package/dist/{profile-io-UI3TZBYH.js → profile-io-Q2T47RVH.js} +3 -3
- package/dist/{rasterize-XMBV5H2I.js → rasterize-OAVMUTE6.js} +3 -3
- package/dist/{redact-doc-7ZZMHDBO.js → redact-doc-ECFOVR4X.js} +11 -11
- package/dist/{render-SWRTUDAV.js → render-NSKWZVTD.js} +7 -7
- package/dist/seal-A4MG7MPQ.js +10 -0
- package/dist/{setup-43JJEEU7.js → setup-REH2KZP2.js} +3 -3
- package/dist/visual-B56WQAGW.js +20 -0
- package/dist/{watch-NRATQ472.js → watch-JXDUZYBY.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-2I2RTJJ5.js.map +0 -1
- package/dist/chunk-2ZBLQVAS.cjs.map +0 -1
- package/dist/chunk-BJ6RYYXV.js.map +0 -1
- package/dist/chunk-HZV52V2X.cjs.map +0 -1
- package/dist/chunk-IXX3WHIE.js.map +0 -1
- package/dist/chunk-J2A46VCA.js.map +0 -1
- package/dist/chunk-SHRRD2TD.cjs.map +0 -1
- package/dist/chunk-V4BKT65D.cjs.map +0 -1
- package/dist/chunk-W7P4GPOV.js.map +0 -1
- package/dist/chunk-WN5YLP7H.cjs.map +0 -1
- package/dist/chunk-ZD5WNQNC.cjs.map +0 -1
- package/dist/chunk-ZN3LHNJG.js.map +0 -1
- package/dist/chunks-OQDRDICD.js +0 -10
- package/dist/formula-BQ5RW5XD.cjs.map +0 -1
- package/dist/image-ocr-VKIUBLBX.cjs.map +0 -1
- package/dist/parser-JOMFOZLH.cjs.map +0 -1
- package/dist/parser-NKP2NCSV.js.map +0 -1
- package/dist/parser-SCXRLOW7.js.map +0 -1
- package/dist/pdf-ocr-NF4AY5MI.cjs +0 -16
- package/dist/pdf-ocr-NF4AY5MI.cjs.map +0 -1
- package/dist/pdf-ocr-OLII3WAG.js +0 -15
- package/dist/pdf-ocr-VJL7ON2Q.js +0 -19
- package/dist/seal-UKKJZHKE.js +0 -10
- package/dist/visual-D2563HCJ.js +0 -20
- /package/dist/{-WOKB25R2.js.map → -DDAVBMHD.js.map} +0 -0
- /package/dist/{chunk-BGOR5GCF.js.map → chunk-274ZPMHK.js.map} +0 -0
- /package/dist/{chunk-6GLTGOP6.js.map → chunk-4IBY5LTJ.js.map} +0 -0
- /package/dist/{chunk-CAN5P6N6.js.map → chunk-7GR2GCJF.js.map} +0 -0
- /package/dist/{chunk-NES5U4JK.js.map → chunk-DUV7Y6IQ.js.map} +0 -0
- /package/dist/{chunk-3FZGL3IL.js.map → chunk-ELOPDQES.js.map} +0 -0
- /package/dist/{chunk-VGDTONTB.js.map → chunk-F5YVCJVF.js.map} +0 -0
- /package/dist/{chunk-RDBTOE5X.js.map → chunk-HRJJDNRD.js.map} +0 -0
- /package/dist/{chunk-KSJ7GKNQ.js.map → chunk-IAXGGQGD.js.map} +0 -0
- /package/dist/{chunk-RSDUH4XF.js.map → chunk-LGF2IO66.js.map} +0 -0
- /package/dist/{chunk-AZQWESRH.js.map → chunk-QVCHFCT2.js.map} +0 -0
- /package/dist/{chunk-UVUKT3IQ.js.map → chunk-TMJVD6FW.js.map} +0 -0
- /package/dist/{chunk-W3RADOLO.js.map → chunk-VTVK2JMI.js.map} +0 -0
- /package/dist/{chunk-PSJLB3SZ.js.map → chunk-XG4SYOZL.js.map} +0 -0
- /package/dist/{chunk-RRURZDEK.js.map → chunk-YCY2R4FM.js.map} +0 -0
- /package/dist/{chunk-5X7XWYR2.js.map → chunk-Z2PPDQK2.js.map} +0 -0
- /package/dist/{chunks-OQDRDICD.js.map → chunks-5QTTAT5T.js.map} +0 -0
- /package/dist/{model-bundle-THYUL7GG.js.map → model-bundle-VHRXG63R.js.map} +0 -0
- /package/dist/{models-U22N4RXX.js.map → models-G3WA24SY.js.map} +0 -0
- /package/dist/{pdf-ocr-OLII3WAG.js.map → pdf-ocr-7IOOVR2I.js.map} +0 -0
- /package/dist/{pdf-ocr-VJL7ON2Q.js.map → pdf-ocr-RACAZU3N.js.map} +0 -0
- /package/dist/{profile-io-UI3TZBYH.js.map → profile-io-Q2T47RVH.js.map} +0 -0
- /package/dist/{rasterize-XMBV5H2I.js.map → rasterize-OAVMUTE6.js.map} +0 -0
- /package/dist/{redact-doc-7ZZMHDBO.js.map → redact-doc-ECFOVR4X.js.map} +0 -0
- /package/dist/{render-SWRTUDAV.js.map → render-NSKWZVTD.js.map} +0 -0
- /package/dist/{seal-UKKJZHKE.js.map → seal-A4MG7MPQ.js.map} +0 -0
- /package/dist/{setup-43JJEEU7.js.map → setup-REH2KZP2.js.map} +0 -0
- /package/dist/{visual-D2563HCJ.js.map → visual-B56WQAGW.js.map} +0 -0
- /package/dist/{watch-NRATQ472.js.map → watch-JXDUZYBY.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
blocksToPages,
|
|
3
3
|
inlineImagesIntoMarkdown
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-274ZPMHK.js";
|
|
5
5
|
import {
|
|
6
6
|
parsePageRange
|
|
7
7
|
} from "./chunk-V4BH5SRQ.js";
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
tidyScriptTags,
|
|
32
32
|
unframeLayoutTables,
|
|
33
33
|
wrapScript
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-XG4SYOZL.js";
|
|
35
35
|
import {
|
|
36
36
|
KordocError,
|
|
37
37
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
toArrayBuffer,
|
|
50
50
|
unescapeHtml,
|
|
51
51
|
unzipLimitBytes
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-7GR2GCJF.js";
|
|
53
53
|
|
|
54
54
|
// src/plain-markdown.ts
|
|
55
55
|
function toPlainMarkdown(md2) {
|
|
@@ -3469,7 +3469,7 @@ function resolveImageBlocks(binDataMap, blocks, warnings, sweepUnreferenced) {
|
|
|
3469
3469
|
resolveImageSentinels(blocks, renamed);
|
|
3470
3470
|
return images;
|
|
3471
3471
|
}
|
|
3472
|
-
function collectHwp5BinData(fileIndex) {
|
|
3472
|
+
function collectHwp5BinData(fileIndex, readStream) {
|
|
3473
3473
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
3474
3474
|
if (fileIndex) {
|
|
3475
3475
|
for (const entry of fileIndex) {
|
|
@@ -3477,35 +3477,37 @@ function collectHwp5BinData(fileIndex) {
|
|
|
3477
3477
|
const match = entry.name.match(BIN_ENTRY_RE);
|
|
3478
3478
|
if (!match) continue;
|
|
3479
3479
|
const idx = parseInt(match[1], 16);
|
|
3480
|
-
const
|
|
3480
|
+
const raw = readStream ? readStream(`/BinData/${entry.name}`) : Buffer.from(entry.content);
|
|
3481
|
+
if (!raw) continue;
|
|
3482
|
+
const data = normalizeBinPayload(raw);
|
|
3481
3483
|
binDataMap.set(idx, { data, name: entry.name });
|
|
3482
3484
|
}
|
|
3483
3485
|
}
|
|
3484
3486
|
return binDataMap;
|
|
3485
3487
|
}
|
|
3486
|
-
function collectHwp5BinDataLenient(lcfb) {
|
|
3488
|
+
function collectHwp5BinDataLenient(lcfb, readStream = lcfb.findStream) {
|
|
3487
3489
|
const binDataMap = /* @__PURE__ */ new Map();
|
|
3488
3490
|
const binRe = /^BIN([0-9A-Fa-f]{4,8})(?:\.|$)/;
|
|
3489
3491
|
for (const e of lcfb.entries()) {
|
|
3490
3492
|
const match = e.name.match(binRe);
|
|
3491
3493
|
if (!match) continue;
|
|
3492
3494
|
const idx = parseInt(match[1], 16);
|
|
3493
|
-
const raw =
|
|
3495
|
+
const raw = readStream(e.name);
|
|
3494
3496
|
if (!raw) continue;
|
|
3495
3497
|
binDataMap.set(idx, { data: normalizeBinPayload(raw), name: e.name });
|
|
3496
3498
|
}
|
|
3497
3499
|
return binDataMap;
|
|
3498
3500
|
}
|
|
3499
|
-
function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
|
|
3500
|
-
const binDataMap = collectHwp5BinData(fileIndex);
|
|
3501
|
+
function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced, readStream) {
|
|
3502
|
+
const binDataMap = collectHwp5BinData(fileIndex, readStream);
|
|
3501
3503
|
if (binDataMap.size === 0) {
|
|
3502
3504
|
resolveImageSentinels(blocks, /* @__PURE__ */ new Map());
|
|
3503
3505
|
return [];
|
|
3504
3506
|
}
|
|
3505
3507
|
return resolveImageBlocks(binDataMap, blocks, warnings, sweepUnreferenced);
|
|
3506
3508
|
}
|
|
3507
|
-
function extractHwp5ImagesLenient(lcfb, blocks, warnings, sweepUnreferenced) {
|
|
3508
|
-
const binDataMap = collectHwp5BinDataLenient(lcfb);
|
|
3509
|
+
function extractHwp5ImagesLenient(lcfb, blocks, warnings, sweepUnreferenced, readStream) {
|
|
3510
|
+
const binDataMap = collectHwp5BinDataLenient(lcfb, readStream);
|
|
3509
3511
|
if (binDataMap.size === 0) {
|
|
3510
3512
|
resolveImageSentinels(blocks, /* @__PURE__ */ new Map());
|
|
3511
3513
|
return [];
|
|
@@ -3762,8 +3764,11 @@ async function resolveSectionPaths(zip) {
|
|
|
3762
3764
|
function parseSectionPathsFromManifest(xml) {
|
|
3763
3765
|
const parser = createXmlParser();
|
|
3764
3766
|
const doc = parser.parseFromString(stripDtd(xml), "text/xml");
|
|
3765
|
-
const
|
|
3766
|
-
const
|
|
3767
|
+
const opf = "http://www.idpf.org/2007/opf/";
|
|
3768
|
+
const namespacedItems = doc.getElementsByTagNameNS(opf, "item");
|
|
3769
|
+
const namespacedSpine = doc.getElementsByTagNameNS(opf, "itemref");
|
|
3770
|
+
const items = namespacedItems.length ? namespacedItems : doc.getElementsByTagName("opf:item");
|
|
3771
|
+
const spine = namespacedSpine.length ? namespacedSpine : doc.getElementsByTagName("opf:itemref");
|
|
3767
3772
|
const idToHref = /* @__PURE__ */ new Map();
|
|
3768
3773
|
for (let i = 0; i < items.length; i++) {
|
|
3769
3774
|
const item = items[i];
|
|
@@ -5993,7 +5998,7 @@ function readHwp5DocInfoRecords(c) {
|
|
|
5993
5998
|
}
|
|
5994
5999
|
}
|
|
5995
6000
|
function readHwp5SectionStreams(c) {
|
|
5996
|
-
return c.distribution ? c.cfb ? findViewTextSections(c.cfb, c.compressed) : findViewTextSectionsLenient(c.lenientCfb, c.compressed) : c.encrypted ? findSectionsVia(c.findStream) : c.cfb ? findSections(c.cfb) : findSectionsLenient(c.lenientCfb
|
|
6001
|
+
return c.distribution ? c.cfb ? findViewTextSections(c.cfb, c.compressed) : findViewTextSectionsLenient(c.lenientCfb, c.compressed) : c.encrypted ? findSectionsVia(c.findStream) : c.cfb ? findSections(c.cfb) : findSectionsLenient(c.lenientCfb);
|
|
5997
6002
|
}
|
|
5998
6003
|
function readHwp5SectionRecords(c, sections, warnings) {
|
|
5999
6004
|
const out = [];
|
|
@@ -6013,7 +6018,8 @@ function readHwp5SectionRecords(c, sections, warnings) {
|
|
|
6013
6018
|
return out;
|
|
6014
6019
|
}
|
|
6015
6020
|
function readHwp5BinData(c) {
|
|
6016
|
-
|
|
6021
|
+
const readStream = c.encrypted ? c.findStream : void 0;
|
|
6022
|
+
return c.cfb ? collectHwp5BinData(c.cfb.FileIndex, readStream) : collectHwp5BinDataLenient(c.lenientCfb, readStream);
|
|
6017
6023
|
}
|
|
6018
6024
|
function parseHwp5Document(buffer, options) {
|
|
6019
6025
|
const c = openHwp5Container(buffer, options);
|
|
@@ -6078,7 +6084,7 @@ function parseHwp5Document(buffer, options) {
|
|
|
6078
6084
|
bodyBlocks = bodyBlocks.filter((b) => b.pageNumber != null && pageFilter.has(b.pageNumber));
|
|
6079
6085
|
}
|
|
6080
6086
|
const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
|
|
6081
|
-
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
|
|
6087
|
+
const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter, encrypted ? findStream : void 0) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter, encrypted ? findStream : void 0);
|
|
6082
6088
|
let flatBlocks = flattenLayoutTables(blocks);
|
|
6083
6089
|
if (options?.layoutTables !== "keep") flatBlocks = unframeLayoutTables(flatBlocks, !!options?.keepTrailingEmptyCols);
|
|
6084
6090
|
if (options?.dedupeRunningHeaders) {
|
|
@@ -6285,16 +6291,15 @@ function findSections(cfb) {
|
|
|
6285
6291
|
}
|
|
6286
6292
|
return sections.sort((a, b) => a.idx - b.idx).map((s) => s.content);
|
|
6287
6293
|
}
|
|
6288
|
-
function findSectionsLenient(lcfb
|
|
6294
|
+
function findSectionsLenient(lcfb) {
|
|
6289
6295
|
const sections = [];
|
|
6290
|
-
let
|
|
6296
|
+
let totalBytes = 0;
|
|
6291
6297
|
for (let i = 0; i < MAX_SECTIONS; i++) {
|
|
6292
6298
|
const raw = lcfb.findStream(`/BodyText/Section${i}`) ?? lcfb.findStream(`Section${i}`);
|
|
6293
6299
|
if (!raw) break;
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
sections.push({ idx: i, content });
|
|
6300
|
+
totalBytes += raw.length;
|
|
6301
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new KordocError("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6302
|
+
sections.push({ idx: i, content: raw });
|
|
6298
6303
|
}
|
|
6299
6304
|
if (sections.length === 0) {
|
|
6300
6305
|
for (const e of lcfb.entries()) {
|
|
@@ -6303,10 +6308,9 @@ function findSectionsLenient(lcfb, compressed) {
|
|
|
6303
6308
|
const idx = parseInt(e.name.replace("Section", ""), 10) || 0;
|
|
6304
6309
|
const raw = lcfb.findStream(e.name);
|
|
6305
6310
|
if (raw) {
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
sections.push({ idx, content });
|
|
6311
|
+
totalBytes += raw.length;
|
|
6312
|
+
if (totalBytes > MAX_TOTAL_DECOMPRESS) throw new KordocError("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
|
|
6313
|
+
sections.push({ idx, content: raw });
|
|
6310
6314
|
}
|
|
6311
6315
|
}
|
|
6312
6316
|
}
|
|
@@ -29308,6 +29312,7 @@ var ImageRegistry = class {
|
|
|
29308
29312
|
supplied;
|
|
29309
29313
|
byUrl = /* @__PURE__ */ new Map();
|
|
29310
29314
|
ids = /* @__PURE__ */ new Set();
|
|
29315
|
+
names = /* @__PURE__ */ new Set();
|
|
29311
29316
|
parts = [];
|
|
29312
29317
|
picSeq = 0;
|
|
29313
29318
|
binSeq = 0;
|
|
@@ -29328,8 +29333,12 @@ var ImageRegistry = class {
|
|
|
29328
29333
|
let n = 1;
|
|
29329
29334
|
while (this.ids.has(itemId)) itemId = `${m[1].replace(/[^A-Za-z0-9_]/g, "_")}_${n++}`;
|
|
29330
29335
|
this.ids.add(itemId);
|
|
29336
|
+
let name = `BinData/${url}`;
|
|
29337
|
+
let suffix = 1;
|
|
29338
|
+
while (this.names.has(name)) name = `BinData/${m[1]}_${suffix++}.${m[2]}`;
|
|
29339
|
+
this.names.add(name);
|
|
29331
29340
|
part = {
|
|
29332
|
-
name
|
|
29341
|
+
name,
|
|
29333
29342
|
itemId,
|
|
29334
29343
|
mime,
|
|
29335
29344
|
data: m[2].toLowerCase() === "bmp" ? PLACEHOLDER_BMP : PLACEHOLDER_PNG
|
|
@@ -29358,8 +29367,9 @@ var ImageRegistry = class {
|
|
|
29358
29367
|
const base = safe && !url.includes("..") ? safe[1] : `image${++this.binSeq}`;
|
|
29359
29368
|
let itemId = base.replace(/[^A-Za-z0-9_]/g, "_");
|
|
29360
29369
|
let n = 1;
|
|
29361
|
-
while (this.ids.has(itemId)) itemId = `${base.replace(/[^A-Za-z0-9_]/g, "_")}_${n++}`;
|
|
29370
|
+
while (this.ids.has(itemId) || this.names.has(`BinData/${itemId}.${sniffed.ext}`)) itemId = `${base.replace(/[^A-Za-z0-9_]/g, "_")}_${n++}`;
|
|
29362
29371
|
this.ids.add(itemId);
|
|
29372
|
+
this.names.add(`BinData/${itemId}.${sniffed.ext}`);
|
|
29363
29373
|
const dim = probeImageSize(bytes);
|
|
29364
29374
|
let wHU, hHU;
|
|
29365
29375
|
if (dim && dim.w > 0 && dim.h > 0) {
|
|
@@ -34335,30 +34345,11 @@ async function resolveSectionEntryNames(zip) {
|
|
|
34335
34345
|
const f = zip.file(mp);
|
|
34336
34346
|
if (!f) continue;
|
|
34337
34347
|
const xml = await f.async("text");
|
|
34338
|
-
const paths =
|
|
34348
|
+
const paths = parseSectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
|
|
34339
34349
|
if (paths.length > 0) return paths;
|
|
34340
34350
|
}
|
|
34341
34351
|
return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(compareSectionPaths);
|
|
34342
34352
|
}
|
|
34343
|
-
function sectionPathsFromManifest(xml) {
|
|
34344
|
-
const attr = (tag, name) => {
|
|
34345
|
-
const m = tag.match(new RegExp(`(?:^|\\s)${name}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`));
|
|
34346
|
-
return m ? m[1] ?? m[2] : "";
|
|
34347
|
-
};
|
|
34348
|
-
const idToHref = /* @__PURE__ */ new Map();
|
|
34349
|
-
for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
34350
|
-
const id = attr(m[1], "id");
|
|
34351
|
-
const href = normalizeSectionHref(attr(m[1], "href"));
|
|
34352
|
-
if (id && href) idToHref.set(id, href);
|
|
34353
|
-
}
|
|
34354
|
-
const ordered = [];
|
|
34355
|
-
for (const m of xml.matchAll(/<opf:itemref(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
|
|
34356
|
-
const href = idToHref.get(attr(m[1], "idref"));
|
|
34357
|
-
if (href) ordered.push(href);
|
|
34358
|
-
}
|
|
34359
|
-
if (ordered.length > 0) return ordered;
|
|
34360
|
-
return Array.from(idToHref.values()).sort(compareSectionPaths);
|
|
34361
|
-
}
|
|
34362
34353
|
|
|
34363
34354
|
// src/roundtrip/hwp5-patch.ts
|
|
34364
34355
|
import { deflateRawSync as deflateRawSync2 } from "zlib";
|
|
@@ -41489,7 +41480,7 @@ async function parse(input, options) {
|
|
|
41489
41480
|
buffer = toArrayBuffer(buf);
|
|
41490
41481
|
} catch (err) {
|
|
41491
41482
|
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}`;
|
|
41492
|
-
return { success: false, fileType: "unknown", error: msg2, code:
|
|
41483
|
+
return { success: false, fileType: "unknown", error: msg2, code: classifyError(err) };
|
|
41493
41484
|
}
|
|
41494
41485
|
} else if (Buffer.isBuffer(input)) {
|
|
41495
41486
|
buffer = toArrayBuffer(input);
|
|
@@ -41564,7 +41555,7 @@ function scriptsOff(r, off) {
|
|
|
41564
41555
|
}
|
|
41565
41556
|
async function parseImage(buffer, options) {
|
|
41566
41557
|
try {
|
|
41567
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
41558
|
+
const { parseImageDocument } = await import("./image-ocr-4BGX2EJJ.js");
|
|
41568
41559
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
41569
41560
|
stripScriptTags({ blocks });
|
|
41570
41561
|
return {
|
|
@@ -41624,7 +41615,7 @@ async function parseHwp(buffer, options) {
|
|
|
41624
41615
|
async function parsePdf(buffer, options) {
|
|
41625
41616
|
let parsePdfDocument;
|
|
41626
41617
|
try {
|
|
41627
|
-
const mod = await import("./parser-
|
|
41618
|
+
const mod = await import("./parser-GFDGAVLV.js");
|
|
41628
41619
|
parsePdfDocument = mod.parsePdfDocument;
|
|
41629
41620
|
} catch {
|
|
41630
41621
|
return {
|