kordoc 4.15.7 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -10
- package/dist/{-H6WNRHK6.js → -VQNLLLPE.js} +11 -11
- package/dist/{chunk-YFHV4QP3.js → chunk-3JWMDL3S.js} +5 -4
- package/dist/chunk-3JWMDL3S.js.map +1 -0
- package/dist/{chunk-WMLGS5QL.js → chunk-43FKGDDO.js} +200 -105
- package/dist/chunk-43FKGDDO.js.map +1 -0
- package/dist/{chunk-O5SDUPB2.js → chunk-46DZF3RK.js} +2 -2
- package/dist/{chunk-C572DIHX.js → chunk-476OYHGZ.js} +13 -6
- package/dist/{chunk-C572DIHX.js.map → chunk-476OYHGZ.js.map} +1 -1
- package/dist/{chunk-UGSRP7E2.js → chunk-6LMKQM7I.js} +3 -3
- package/dist/{chunk-IHCQ4IE7.js → chunk-A3QDRMVD.js} +2 -2
- package/dist/{chunk-ZXAH4AFS.cjs → chunk-B5NEGP65.cjs} +18 -71
- package/dist/chunk-B5NEGP65.cjs.map +1 -0
- package/dist/{chunk-TRB6OYMU.js → chunk-C75WE52C.js} +2 -2
- package/dist/{chunk-S7PEBTU3.js → chunk-CB5XDCSL.js} +134 -46
- package/dist/chunk-CB5XDCSL.js.map +1 -0
- package/dist/{chunk-OE6XLTMC.cjs → chunk-DRY3L5KQ.cjs} +9 -8
- package/dist/chunk-DRY3L5KQ.cjs.map +1 -0
- package/dist/{chunk-AWXXLLIG.js → chunk-DYENR3PX.js} +2 -2
- package/dist/{chunk-WQWXQVOQ.js → chunk-GOQBON77.js} +4 -2
- package/dist/{chunk-F5FHYJKJ.js.map → chunk-GOQBON77.js.map} +1 -1
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-R45AG5K6.cjs → chunk-H6KMTYYZ.cjs} +3 -3
- package/dist/chunk-H6KMTYYZ.cjs.map +1 -0
- package/dist/{chunk-X3PBLSV5.js → chunk-HIVK5V27.js} +274 -98
- package/dist/chunk-HIVK5V27.js.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-6ULM2YCN.js → chunk-JB5X5NNL.js} +7 -7
- package/dist/chunk-JB5X5NNL.js.map +1 -0
- package/dist/{chunk-4ANWGSUT.cjs → chunk-MH6MAL64.cjs} +320 -144
- package/dist/chunk-MH6MAL64.cjs.map +1 -0
- package/dist/{chunk-KJSD2WNF.js → chunk-N6TPODYL.js} +15 -2
- package/dist/chunk-N6TPODYL.js.map +1 -0
- package/dist/{chunk-NZMPU24H.js → chunk-NNYF2AGC.js} +5 -4
- package/dist/chunk-NNYF2AGC.js.map +1 -0
- package/dist/{chunk-J6ZU7AIR.cjs → chunk-NWODPYBD.cjs} +5 -3
- package/dist/chunk-NWODPYBD.cjs.map +1 -0
- package/dist/{chunk-L5MDTA6T.js → chunk-PIMB2YNO.js} +2 -2
- package/dist/{chunk-ZWPRA2SE.js → chunk-PQRP4NSF.js} +2 -2
- package/dist/{chunk-W2UTB3RG.js → chunk-QJERJZJ6.js} +1 -1
- package/dist/{chunk-YNJLZVEO.cjs.map → chunk-QJERJZJ6.js.map} +1 -1
- package/dist/{chunk-F5FHYJKJ.js → chunk-RC4C7Q33.js} +4 -2
- package/dist/{chunk-WQWXQVOQ.js.map → chunk-RC4C7Q33.js.map} +1 -1
- package/dist/{chunk-WHZUJH2O.js → chunk-TGD7UFHD.js} +5 -4
- package/dist/{chunk-WHZUJH2O.js.map → chunk-TGD7UFHD.js.map} +1 -1
- package/dist/{chunk-ORMMGTNK.js → chunk-UDX7TSOC.js} +2 -2
- package/dist/{chunk-NVG2GQNA.js → chunk-UQ6TZDW6.js} +1 -1
- package/dist/chunk-UQ6TZDW6.js.map +1 -0
- package/dist/{chunk-ZYJY44BT.js → chunk-XHOZB2WP.js} +16 -66
- package/dist/chunk-XHOZB2WP.js.map +1 -0
- package/dist/{chunk-YNJLZVEO.cjs → chunk-ZY5K3LPM.cjs} +1 -1
- package/dist/chunk-ZY5K3LPM.cjs.map +1 -0
- package/dist/chunks-JD25E5PM.js +10 -0
- package/dist/cli.js +35 -33
- package/dist/cli.js.map +1 -1
- package/dist/{formula-CUSB5R3P.js → formula-5775PTP2.js} +4 -4
- package/dist/{formula-UKLCJINT.js → formula-FNQYHMIY.js} +3 -3
- package/dist/{formula-YJIUNSWW.cjs → formula-VEFKYXPB.cjs} +9 -9
- package/dist/formula-VEFKYXPB.cjs.map +1 -0
- package/dist/{image-ocr-BMCOWLLB.cjs → image-ocr-6JZR734G.cjs} +17 -15
- package/dist/image-ocr-6JZR734G.cjs.map +1 -0
- package/dist/{image-ocr-OEEGTGDU.js → image-ocr-PYZU4TO7.js} +14 -9
- package/dist/image-ocr-PYZU4TO7.js.map +1 -0
- package/dist/{image-ocr-S5OLK6WH.js → image-ocr-YA2MQBRP.js} +9 -11
- package/dist/image-ocr-YA2MQBRP.js.map +1 -0
- package/dist/index.cjs +726 -630
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +152 -56
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +60 -49
- package/dist/mcp.js.map +1 -1
- package/dist/{model-bundle-A6QPDJZ3.js → model-bundle-O6J7ORVC.js} +5 -5
- package/dist/{models-GAP4U6WU.js → models-YMOKZGCI.js} +7 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-MRTO7R2Y.js → parser-3B6I2XL7.js} +344 -23
- package/dist/parser-3B6I2XL7.js.map +1 -0
- package/dist/{parser-BCN3SZZC.js → parser-PXATL5DM.js} +340 -22
- package/dist/parser-PXATL5DM.js.map +1 -0
- package/dist/{parser-DZMXH4V5.cjs → parser-YAQV7FBO.cjs} +454 -136
- package/dist/parser-YAQV7FBO.cjs.map +1 -0
- package/dist/pdf-ocr-2TTO5PX2.js +15 -0
- package/dist/pdf-ocr-T2JXQATA.cjs +16 -0
- package/dist/pdf-ocr-T2JXQATA.cjs.map +1 -0
- package/dist/pdf-ocr-WF2NQA6X.js +18 -0
- package/dist/{profile-io-XAZ2MDXD.js → profile-io-ZTV2MKRT.js} +3 -3
- package/dist/{rasterize-2YKKVEIR.js → rasterize-MMUZ537K.js} +3 -3
- package/dist/{redact-doc-XPV546P6.js → redact-doc-S42XGV5D.js} +11 -11
- package/dist/{render-ASDQSRPX.js → render-WCWPZKJ7.js} +7 -7
- package/dist/seal-WHK4GOHR.js +10 -0
- package/dist/{setup-M3MH2DHU.js → setup-D35LKZCH.js} +3 -3
- package/dist/visual-WL4TDE5B.js +20 -0
- package/dist/{watch-3DB2LMAP.js → watch-AX64CIMN.js} +41 -19
- package/dist/watch-AX64CIMN.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4ANWGSUT.cjs.map +0 -1
- package/dist/chunk-6ULM2YCN.js.map +0 -1
- package/dist/chunk-J6ZU7AIR.cjs.map +0 -1
- package/dist/chunk-KJSD2WNF.js.map +0 -1
- package/dist/chunk-NVG2GQNA.js.map +0 -1
- package/dist/chunk-NZMPU24H.js.map +0 -1
- package/dist/chunk-OE6XLTMC.cjs.map +0 -1
- package/dist/chunk-R45AG5K6.cjs.map +0 -1
- package/dist/chunk-S7PEBTU3.js.map +0 -1
- package/dist/chunk-W2UTB3RG.js.map +0 -1
- package/dist/chunk-WMLGS5QL.js.map +0 -1
- package/dist/chunk-X3PBLSV5.js.map +0 -1
- package/dist/chunk-YFHV4QP3.js.map +0 -1
- package/dist/chunk-ZXAH4AFS.cjs.map +0 -1
- package/dist/chunk-ZYJY44BT.js.map +0 -1
- package/dist/chunks-PPHEGDUD.js +0 -10
- package/dist/formula-YJIUNSWW.cjs.map +0 -1
- package/dist/image-ocr-BMCOWLLB.cjs.map +0 -1
- package/dist/image-ocr-OEEGTGDU.js.map +0 -1
- package/dist/image-ocr-S5OLK6WH.js.map +0 -1
- package/dist/parser-BCN3SZZC.js.map +0 -1
- package/dist/parser-DZMXH4V5.cjs.map +0 -1
- package/dist/parser-MRTO7R2Y.js.map +0 -1
- package/dist/pdf-ocr-4V7U52JI.js +0 -18
- package/dist/pdf-ocr-A3Q4YMCG.js +0 -15
- package/dist/pdf-ocr-CZDODSMI.cjs +0 -16
- package/dist/pdf-ocr-CZDODSMI.cjs.map +0 -1
- package/dist/seal-3XWSKD6C.js +0 -10
- package/dist/visual-Z6BCNJMU.js +0 -20
- package/dist/watch-3DB2LMAP.js.map +0 -1
- /package/dist/{-H6WNRHK6.js.map → -VQNLLLPE.js.map} +0 -0
- /package/dist/{chunk-O5SDUPB2.js.map → chunk-46DZF3RK.js.map} +0 -0
- /package/dist/{chunk-UGSRP7E2.js.map → chunk-6LMKQM7I.js.map} +0 -0
- /package/dist/{chunk-IHCQ4IE7.js.map → chunk-A3QDRMVD.js.map} +0 -0
- /package/dist/{chunk-TRB6OYMU.js.map → chunk-C75WE52C.js.map} +0 -0
- /package/dist/{chunk-AWXXLLIG.js.map → chunk-DYENR3PX.js.map} +0 -0
- /package/dist/{chunk-L5MDTA6T.js.map → chunk-PIMB2YNO.js.map} +0 -0
- /package/dist/{chunk-ZWPRA2SE.js.map → chunk-PQRP4NSF.js.map} +0 -0
- /package/dist/{chunk-ORMMGTNK.js.map → chunk-UDX7TSOC.js.map} +0 -0
- /package/dist/{chunks-PPHEGDUD.js.map → chunks-JD25E5PM.js.map} +0 -0
- /package/dist/{formula-CUSB5R3P.js.map → formula-5775PTP2.js.map} +0 -0
- /package/dist/{formula-UKLCJINT.js.map → formula-FNQYHMIY.js.map} +0 -0
- /package/dist/{model-bundle-A6QPDJZ3.js.map → model-bundle-O6J7ORVC.js.map} +0 -0
- /package/dist/{models-GAP4U6WU.js.map → models-YMOKZGCI.js.map} +0 -0
- /package/dist/{pdf-ocr-4V7U52JI.js.map → pdf-ocr-2TTO5PX2.js.map} +0 -0
- /package/dist/{pdf-ocr-A3Q4YMCG.js.map → pdf-ocr-WF2NQA6X.js.map} +0 -0
- /package/dist/{profile-io-XAZ2MDXD.js.map → profile-io-ZTV2MKRT.js.map} +0 -0
- /package/dist/{rasterize-2YKKVEIR.js.map → rasterize-MMUZ537K.js.map} +0 -0
- /package/dist/{redact-doc-XPV546P6.js.map → redact-doc-S42XGV5D.js.map} +0 -0
- /package/dist/{render-ASDQSRPX.js.map → render-WCWPZKJ7.js.map} +0 -0
- /package/dist/{seal-3XWSKD6C.js.map → seal-WHK4GOHR.js.map} +0 -0
- /package/dist/{setup-M3MH2DHU.js.map → setup-D35LKZCH.js.map} +0 -0
- /package/dist/{visual-Z6BCNJMU.js.map → visual-WL4TDE5B.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
KordocError
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-RC4C7Q33.js";
|
|
5
5
|
|
|
6
6
|
// src/shared/offline.ts
|
|
7
7
|
import { realpathSync } from "fs";
|
|
@@ -49,4 +49,4 @@ export {
|
|
|
49
49
|
getAccessRoot,
|
|
50
50
|
assertWithinRoot
|
|
51
51
|
};
|
|
52
|
-
//# sourceMappingURL=chunk-
|
|
52
|
+
//# sourceMappingURL=chunk-C75WE52C.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DYENR3PX.js";
|
|
5
5
|
import {
|
|
6
6
|
allLinesegRemovalSplices,
|
|
7
7
|
applySplices,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
paraTextPureT,
|
|
16
16
|
patchZipEntries,
|
|
17
17
|
scanSectionXml
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-6LMKQM7I.js";
|
|
19
19
|
import {
|
|
20
20
|
CONVERT_MAP,
|
|
21
21
|
FLAG_COMPRESSED,
|
|
@@ -61,12 +61,12 @@ import {
|
|
|
61
61
|
renderDocumentToScene,
|
|
62
62
|
romanNumeral,
|
|
63
63
|
simulateWrap
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-476OYHGZ.js";
|
|
65
65
|
import {
|
|
66
66
|
HEADING_RATIO_H1,
|
|
67
67
|
HEADING_RATIO_H2,
|
|
68
68
|
HEADING_RATIO_H3
|
|
69
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-UQ6TZDW6.js";
|
|
70
70
|
import {
|
|
71
71
|
parsePageRange
|
|
72
72
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
findChildByLocalName,
|
|
86
86
|
localName,
|
|
87
87
|
rawTextContent
|
|
88
|
-
} from "./chunk-
|
|
88
|
+
} from "./chunk-46DZF3RK.js";
|
|
89
89
|
import {
|
|
90
90
|
MAX_COLS,
|
|
91
91
|
MAX_ROWS,
|
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
hasStructuredCellContent,
|
|
101
101
|
mapPuaText,
|
|
102
102
|
noteSuffix
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-TGD7UFHD.js";
|
|
104
104
|
import {
|
|
105
105
|
KordocError,
|
|
106
106
|
classifyError,
|
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
toArrayBuffer,
|
|
116
116
|
unescapeHtml,
|
|
117
117
|
unzipLimitBytes
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-RC4C7Q33.js";
|
|
119
119
|
|
|
120
120
|
// src/table/visual.ts
|
|
121
121
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -16519,6 +16519,48 @@ async function parseXlsDocument(buffer, options) {
|
|
|
16519
16519
|
|
|
16520
16520
|
// src/docx/parser.ts
|
|
16521
16521
|
import JSZip4 from "jszip";
|
|
16522
|
+
|
|
16523
|
+
// src/docx/numbering.ts
|
|
16524
|
+
var FMT = {
|
|
16525
|
+
upperRoman: "romanUpper",
|
|
16526
|
+
lowerRoman: "romanLower",
|
|
16527
|
+
upperLetter: "latinUpper",
|
|
16528
|
+
lowerLetter: "latinLower",
|
|
16529
|
+
ganada: "ganada",
|
|
16530
|
+
chosung: "jamo",
|
|
16531
|
+
decimalEnclosedCircle: "circled",
|
|
16532
|
+
koreanDigital: "hangulNum",
|
|
16533
|
+
ideographDigital: "hanjaNum"
|
|
16534
|
+
};
|
|
16535
|
+
function format(n, numFmt) {
|
|
16536
|
+
if (numFmt === "decimalZero") return n < 10 ? `0${n}` : String(n);
|
|
16537
|
+
return formatNumber(n, FMT[numFmt] ?? "digit");
|
|
16538
|
+
}
|
|
16539
|
+
var ListCounter = class {
|
|
16540
|
+
counts = /* @__PURE__ */ new Map();
|
|
16541
|
+
used = /* @__PURE__ */ new Set();
|
|
16542
|
+
/** numId·ilvl 문단 하나를 세고 라벨을 낸다 — 글머리표(bullet)는 null, 번호 없는 수준(none·빈 lvlText)은 "" */
|
|
16543
|
+
next(numId, ilvl, levels) {
|
|
16544
|
+
const lv = levels.get(ilvl);
|
|
16545
|
+
if (lv?.numFmt === "bullet") return null;
|
|
16546
|
+
const key = [...levels.values()].find((l) => l.list !== void 0)?.list ?? numId;
|
|
16547
|
+
const c = this.counts.get(key) ?? [];
|
|
16548
|
+
if (!this.used.has(numId)) {
|
|
16549
|
+
this.used.add(numId);
|
|
16550
|
+
for (const [k, l] of levels) if (l.restart) c[k] = void 0;
|
|
16551
|
+
}
|
|
16552
|
+
c[ilvl] = (c[ilvl] ?? (lv?.start ?? 1) - 1) + 1;
|
|
16553
|
+
for (let k = ilvl + 1; k < c.length; k++) c[k] = void 0;
|
|
16554
|
+
this.counts.set(key, c);
|
|
16555
|
+
if (!lv || lv.numFmt === "none") return "";
|
|
16556
|
+
return lv.lvlText.replace(/%([1-9])/g, (_m, d) => {
|
|
16557
|
+
const k = Number(d) - 1;
|
|
16558
|
+
return format(c[k] ?? levels.get(k)?.start ?? 1, levels.get(k)?.numFmt ?? "decimal");
|
|
16559
|
+
}).trim();
|
|
16560
|
+
}
|
|
16561
|
+
};
|
|
16562
|
+
|
|
16563
|
+
// src/docx/parser.ts
|
|
16522
16564
|
import { DOMParser as DOMParser2 } from "@xmldom/xmldom";
|
|
16523
16565
|
|
|
16524
16566
|
// src/docx/equation.ts
|
|
@@ -16953,18 +16995,25 @@ function parseStyles(xml) {
|
|
|
16953
16995
|
const basedOn = basedOnEls.length > 0 ? getAttr(basedOnEls[0], "val") ?? void 0 : void 0;
|
|
16954
16996
|
const pPrEls = getChildElements(el, "pPr");
|
|
16955
16997
|
let outlineLevel;
|
|
16998
|
+
let numId, ilvl;
|
|
16956
16999
|
if (pPrEls.length > 0) {
|
|
16957
17000
|
const outlineEls = getChildElements(pPrEls[0], "outlineLvl");
|
|
16958
17001
|
if (outlineEls.length > 0) {
|
|
16959
17002
|
const val = getAttr(outlineEls[0], "val");
|
|
16960
17003
|
if (val !== null) outlineLevel = parseInt(val, 10);
|
|
16961
17004
|
}
|
|
17005
|
+
const numPrEls = getChildElements(pPrEls[0], "numPr");
|
|
17006
|
+
if (numPrEls.length > 0) {
|
|
17007
|
+
const idEls = getChildElements(numPrEls[0], "numId"), lvEls = getChildElements(numPrEls[0], "ilvl");
|
|
17008
|
+
numId = idEls.length > 0 ? getAttr(idEls[0], "val") ?? void 0 : void 0;
|
|
17009
|
+
ilvl = lvEls.length > 0 ? parseInt(getAttr(lvEls[0], "val") ?? "0", 10) : void 0;
|
|
17010
|
+
}
|
|
16962
17011
|
}
|
|
16963
17012
|
if (outlineLevel === void 0) {
|
|
16964
17013
|
const headingMatch = name.match(/^(?:heading|Heading)\s*(\d+)$/i);
|
|
16965
17014
|
if (headingMatch) outlineLevel = parseInt(headingMatch[1], 10) - 1;
|
|
16966
17015
|
}
|
|
16967
|
-
styles.set(styleId, { name, basedOn, outlineLevel });
|
|
17016
|
+
styles.set(styleId, { name, basedOn, outlineLevel, numId, ilvl });
|
|
16968
17017
|
}
|
|
16969
17018
|
for (const [styleId, info] of styles) {
|
|
16970
17019
|
if (info.outlineLevel !== void 0) continue;
|
|
@@ -16981,6 +17030,17 @@ function parseStyles(xml) {
|
|
|
16981
17030
|
cur = parent.basedOn;
|
|
16982
17031
|
}
|
|
16983
17032
|
}
|
|
17033
|
+
for (const [styleId, info] of styles) {
|
|
17034
|
+
const seen = /* @__PURE__ */ new Set([styleId]);
|
|
17035
|
+
for (let cur = info.basedOn; info.numId === void 0 && cur && !seen.has(cur); cur = styles.get(cur)?.basedOn) {
|
|
17036
|
+
seen.add(cur);
|
|
17037
|
+
const parent = styles.get(cur);
|
|
17038
|
+
if (parent?.numId !== void 0) {
|
|
17039
|
+
info.numId = parent.numId;
|
|
17040
|
+
info.ilvl ??= parent.ilvl;
|
|
17041
|
+
}
|
|
17042
|
+
}
|
|
17043
|
+
}
|
|
16984
17044
|
return styles;
|
|
16985
17045
|
}
|
|
16986
17046
|
function parseNumbering(xml) {
|
|
@@ -16996,7 +17056,17 @@ function parseNumbering(xml) {
|
|
|
16996
17056
|
const ilvl = parseInt(getAttr(lvl, "ilvl") ?? "0", 10);
|
|
16997
17057
|
const numFmtEls = getChildElements(lvl, "numFmt");
|
|
16998
17058
|
const numFmt = numFmtEls.length > 0 ? getAttr(numFmtEls[0], "val") ?? "bullet" : "bullet";
|
|
16999
|
-
|
|
17059
|
+
const lvlTextEls = getChildElements(lvl, "lvlText");
|
|
17060
|
+
const startEls = getChildElements(lvl, "start");
|
|
17061
|
+
const pStyleEls = getChildElements(lvl, "pStyle");
|
|
17062
|
+
levels.set(ilvl, {
|
|
17063
|
+
pStyle: pStyleEls.length > 0 ? getAttr(pStyleEls[0], "val") ?? void 0 : void 0,
|
|
17064
|
+
numFmt,
|
|
17065
|
+
level: ilvl,
|
|
17066
|
+
lvlText: lvlTextEls.length > 0 ? getAttr(lvlTextEls[0], "val") ?? "" : `%${ilvl + 1}.`,
|
|
17067
|
+
start: startEls.length > 0 ? parseInt(getAttr(startEls[0], "val") ?? "0", 10) || 0 : 0,
|
|
17068
|
+
list: abstractNumId
|
|
17069
|
+
});
|
|
17000
17070
|
}
|
|
17001
17071
|
abstractNums.set(abstractNumId, levels);
|
|
17002
17072
|
}
|
|
@@ -17009,7 +17079,14 @@ function parseNumbering(xml) {
|
|
|
17009
17079
|
if (abstractRefs.length > 0) {
|
|
17010
17080
|
const ref = getAttr(abstractRefs[0], "val");
|
|
17011
17081
|
if (ref && abstractNums.has(ref)) {
|
|
17012
|
-
|
|
17082
|
+
const levels = new Map(abstractNums.get(ref));
|
|
17083
|
+
for (const ov of getChildElements(el, "lvlOverride")) {
|
|
17084
|
+
const ilvl = parseInt(getAttr(ov, "ilvl") ?? "0", 10);
|
|
17085
|
+
const so = getChildElements(ov, "startOverride");
|
|
17086
|
+
const base = levels.get(ilvl);
|
|
17087
|
+
if (so.length > 0 && base) levels.set(ilvl, { ...base, start: parseInt(getAttr(so[0], "val") ?? "0", 10) || 0, restart: true });
|
|
17088
|
+
}
|
|
17089
|
+
nums.set(numId, levels);
|
|
17013
17090
|
}
|
|
17014
17091
|
}
|
|
17015
17092
|
}
|
|
@@ -17180,6 +17257,12 @@ function collectInline(p, footnotes, rels) {
|
|
|
17180
17257
|
const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
|
|
17181
17258
|
return { text, bold, italic, footnoteText };
|
|
17182
17259
|
}
|
|
17260
|
+
var COUNTERS = /* @__PURE__ */ new WeakMap();
|
|
17261
|
+
function counterOf(numbering) {
|
|
17262
|
+
let c = COUNTERS.get(numbering);
|
|
17263
|
+
if (!c) COUNTERS.set(numbering, c = new ListCounter());
|
|
17264
|
+
return c;
|
|
17265
|
+
}
|
|
17183
17266
|
function parseParagraph(p, styles, numbering, footnotes, rels) {
|
|
17184
17267
|
const pPrEls = getChildElements(p, "pPr");
|
|
17185
17268
|
let styleId = "";
|
|
@@ -17197,20 +17280,25 @@ function parseParagraph(p, styles, numbering, footnotes, rels) {
|
|
|
17197
17280
|
}
|
|
17198
17281
|
}
|
|
17199
17282
|
const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
|
|
17200
|
-
if (!text) return null;
|
|
17201
17283
|
const style = styles.get(styleId);
|
|
17284
|
+
if (!numId && style?.numId) {
|
|
17285
|
+
numId = style.numId;
|
|
17286
|
+
ilvl = style.ilvl ?? [...numbering.get(numId)?.values() ?? []].find((l) => l.pStyle === styleId)?.level ?? ilvl;
|
|
17287
|
+
}
|
|
17288
|
+
const numDef = numId && numId !== "0" ? numbering.get(numId) : void 0;
|
|
17289
|
+
const label = numDef ? counterOf(numbering).next(numId, ilvl, numDef) : void 0;
|
|
17290
|
+
if (!text) return null;
|
|
17202
17291
|
if (style?.outlineLevel !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
|
|
17203
17292
|
return {
|
|
17204
17293
|
type: "heading",
|
|
17205
|
-
text,
|
|
17294
|
+
text: label ? `${label} ${text}` : text,
|
|
17206
17295
|
level: style.outlineLevel + 1
|
|
17207
17296
|
};
|
|
17208
17297
|
}
|
|
17209
|
-
if (numId && numId !== "0") {
|
|
17210
|
-
const
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
return { type: "list", text, listType };
|
|
17298
|
+
if (numId && numId !== "0" && label !== "") {
|
|
17299
|
+
const block2 = label == null ? { type: "list", text, listType: "unordered" } : { type: "list", text: `${label} ${text}`, listType: /^\d+\.$/.test(label) ? "ordered" : "unordered" };
|
|
17300
|
+
if (footnoteText) block2.footnoteText = footnoteText;
|
|
17301
|
+
return block2;
|
|
17214
17302
|
}
|
|
17215
17303
|
const block = { type: "paragraph", text };
|
|
17216
17304
|
if (hasBold || hasItalic) {
|
|
@@ -17978,11 +18066,11 @@ function fmtRRN(v, style) {
|
|
|
17978
18066
|
return `${d.slice(0, 6)}-${d.slice(6)}`;
|
|
17979
18067
|
}
|
|
17980
18068
|
}
|
|
17981
|
-
function formatFillValue(value,
|
|
17982
|
-
if (!
|
|
17983
|
-
const ci =
|
|
17984
|
-
const kind = ci >= 0 ?
|
|
17985
|
-
const style = ci >= 0 ?
|
|
18069
|
+
function formatFillValue(value, format2) {
|
|
18070
|
+
if (!format2) return value;
|
|
18071
|
+
const ci = format2.indexOf(":");
|
|
18072
|
+
const kind = ci >= 0 ? format2.slice(0, ci) : format2;
|
|
18073
|
+
const style = ci >= 0 ? format2.slice(ci + 1) : "";
|
|
17986
18074
|
if (kind === "date") return fmtDate(value, style);
|
|
17987
18075
|
if (kind === "phone") return fmtPhone(value, style);
|
|
17988
18076
|
if (kind === "rrn") return fmtRRN(value, style);
|
|
@@ -17994,8 +18082,8 @@ function formatFillValue(value, format) {
|
|
|
17994
18082
|
if (kind === "upper") return value.toUpperCase();
|
|
17995
18083
|
if (kind === "lower") return value.toLowerCase();
|
|
17996
18084
|
if (kind === "nospace") return value.replace(/\s+/g, "");
|
|
17997
|
-
if (
|
|
17998
|
-
if (/(yyyy|yy|mm|dd)/.test(
|
|
18085
|
+
if (format2.includes("#")) return maskDigits(value, format2);
|
|
18086
|
+
if (/(yyyy|yy|mm|dd)/.test(format2)) return fmtDate(value, format2);
|
|
17999
18087
|
return value;
|
|
18000
18088
|
}
|
|
18001
18089
|
var ValueCursor = class {
|
|
@@ -18177,12 +18265,12 @@ function padInsertion(text, pos, value) {
|
|
|
18177
18265
|
function normalizeValues(values, warnings) {
|
|
18178
18266
|
const map = /* @__PURE__ */ new Map();
|
|
18179
18267
|
for (const [label, raw] of Object.entries(values)) {
|
|
18180
|
-
const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
18268
|
+
const { value, format: format2 } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
|
|
18181
18269
|
const key = normalizeLabel(label);
|
|
18182
18270
|
if (map.has(key)) {
|
|
18183
18271
|
warnings?.push(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`);
|
|
18184
18272
|
}
|
|
18185
|
-
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v,
|
|
18273
|
+
map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format2)) : formatFillValue(value, format2));
|
|
18186
18274
|
}
|
|
18187
18275
|
return map;
|
|
18188
18276
|
}
|
|
@@ -20197,7 +20285,7 @@ function footnoteXml(note, mapCharId) {
|
|
|
20197
20285
|
} finally {
|
|
20198
20286
|
d.inNote = false;
|
|
20199
20287
|
}
|
|
20200
|
-
return `<hp:ctrl><hp:footNote number="${n}" suffixChar="41" instId="${FOOTNOTE_INST_BASE + n}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="TOP" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0"><hp:p paraPrIDRef="0" styleIDRef="0">${body}</hp:p></hp:subList></hp:footNote></hp:ctrl>`;
|
|
20288
|
+
return `<hp:ctrl><hp:footNote number="${n}" suffixChar="41" instId="${FOOTNOTE_INST_BASE + n}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="TOP" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0"><hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="${mapCharId ? mapCharId(CHAR_NORMAL) : CHAR_NORMAL}"><hp:ctrl><hp:autoNum num="${n}" numType="FOOTNOTE"><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/></hp:autoNum></hp:ctrl><hp:t> </hp:t></hp:run>${body}</hp:p></hp:subList></hp:footNote></hp:ctrl>`;
|
|
20201
20289
|
}
|
|
20202
20290
|
function generateRuns(text, defaultCharPr = CHAR_NORMAL, mapCharId) {
|
|
20203
20291
|
const spans = parseInlineMarkdown(text);
|
|
@@ -27990,10 +28078,10 @@ function stageParaPatch(scan, para2, newPlain, skip) {
|
|
|
27990
28078
|
async function patchHwpx(original, editedMarkdown, options) {
|
|
27991
28079
|
const skipped = [];
|
|
27992
28080
|
let applied = 0;
|
|
27993
|
-
const
|
|
27994
|
-
if (
|
|
27995
|
-
if (
|
|
27996
|
-
return { success: false, applied: 0, skipped, error: `\uC11C\uC2DD \uBCF4\uC874 \uD328\uCE58\uB294 HWPX\xB7HWP 5.x \uBB38\uC11C\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${
|
|
28081
|
+
const format2 = detectFormat(new Uint8Array(original.subarray(0, 512)).buffer);
|
|
28082
|
+
if (format2 === "hwp") return patchHwp(original, editedMarkdown, options);
|
|
28083
|
+
if (format2 !== "hwpx") {
|
|
28084
|
+
return { success: false, applied: 0, skipped, error: `\uC11C\uC2DD \uBCF4\uC874 \uD328\uCE58\uB294 HWPX\xB7HWP 5.x \uBB38\uC11C\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${format2})` };
|
|
27997
28085
|
}
|
|
27998
28086
|
let origBlocks;
|
|
27999
28087
|
try {
|
|
@@ -28537,8 +28625,8 @@ async function validateHwpx(buffer) {
|
|
|
28537
28625
|
// src/roundtrip/session.ts
|
|
28538
28626
|
import JSZip11 from "jszip";
|
|
28539
28627
|
async function buildState(bytes) {
|
|
28540
|
-
const
|
|
28541
|
-
if (
|
|
28628
|
+
const format2 = detectFormat(new Uint8Array(bytes.subarray(0, 512)).buffer);
|
|
28629
|
+
if (format2 !== "hwpx") throw new Error(`HWPX \uC138\uC158\uC740 HWPX \uBB38\uC11C\uB9CC \uC5FD\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${format2}) \u2014 HWP 5.x \uB294 patchHwp \uB85C \uD328\uCE58\uD558\uC138\uC694`);
|
|
28542
28630
|
const parsed = await parseHwpxDocument(u8ToArrayBuffer2(bytes));
|
|
28543
28631
|
const zip = await JSZip11.loadAsync(bytes);
|
|
28544
28632
|
const sectionPaths = await resolveSectionEntryNames(zip);
|
|
@@ -28906,8 +28994,8 @@ async function parse(input, options) {
|
|
|
28906
28994
|
if (!buffer || buffer.byteLength === 0) {
|
|
28907
28995
|
return { success: false, fileType: "unknown", error: "\uBE48 \uBC84\uD37C\uC774\uAC70\uB098 \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC785\uB825\uC785\uB2C8\uB2E4.", code: "EMPTY_INPUT" };
|
|
28908
28996
|
}
|
|
28909
|
-
const
|
|
28910
|
-
const result = await dispatch(
|
|
28997
|
+
const format2 = detectFormat(buffer);
|
|
28998
|
+
const result = await dispatch(format2, buffer, opts);
|
|
28911
28999
|
if (result.success && opts?.images === false) {
|
|
28912
29000
|
delete result.images;
|
|
28913
29001
|
dropImageBytes(result.blocks);
|
|
@@ -28937,8 +29025,8 @@ function dropImageBytes(blocks, depth = 0) {
|
|
|
28937
29025
|
}
|
|
28938
29026
|
}
|
|
28939
29027
|
}
|
|
28940
|
-
async function dispatch(
|
|
28941
|
-
switch (
|
|
29028
|
+
async function dispatch(format2, buffer, opts) {
|
|
29029
|
+
switch (format2) {
|
|
28942
29030
|
case "hwpx": {
|
|
28943
29031
|
const zipFormat = await detectZipFormat(buffer);
|
|
28944
29032
|
if (zipFormat === "xlsx") return parseXlsx(buffer, opts);
|
|
@@ -28967,7 +29055,7 @@ async function dispatch(format, buffer, opts) {
|
|
|
28967
29055
|
}
|
|
28968
29056
|
async function parseImage(buffer, options) {
|
|
28969
29057
|
try {
|
|
28970
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
29058
|
+
const { parseImageDocument } = await import("./image-ocr-PYZU4TO7.js");
|
|
28971
29059
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
28972
29060
|
return {
|
|
28973
29061
|
success: true,
|
|
@@ -29026,7 +29114,7 @@ async function parseHwp(buffer, options) {
|
|
|
29026
29114
|
async function parsePdf(buffer, options) {
|
|
29027
29115
|
let parsePdfDocument;
|
|
29028
29116
|
try {
|
|
29029
|
-
const mod = await import("./parser-
|
|
29117
|
+
const mod = await import("./parser-3B6I2XL7.js");
|
|
29030
29118
|
parsePdfDocument = mod.parsePdfDocument;
|
|
29031
29119
|
} catch {
|
|
29032
29120
|
return {
|
|
@@ -29087,14 +29175,14 @@ async function fillForm(input, values, outputFormat = "markdown") {
|
|
|
29087
29175
|
buffer = input;
|
|
29088
29176
|
}
|
|
29089
29177
|
if (outputFormat === "hwpx-preserve") {
|
|
29090
|
-
const
|
|
29091
|
-
if (
|
|
29178
|
+
const format2 = detectFormat(buffer);
|
|
29179
|
+
if (format2 === "hwpx") {
|
|
29092
29180
|
const zipFormat = await detectZipFormat(buffer);
|
|
29093
29181
|
if (zipFormat !== "hwpx") {
|
|
29094
29182
|
throw new Error(`hwpx-preserve \uD3EC\uB9F7\uC740 HWPX \uC785\uB825\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${zipFormat})`);
|
|
29095
29183
|
}
|
|
29096
29184
|
} else {
|
|
29097
|
-
throw new Error(`hwpx-preserve \uD3EC\uB9F7\uC740 HWPX \uC785\uB825\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${
|
|
29185
|
+
throw new Error(`hwpx-preserve \uD3EC\uB9F7\uC740 HWPX \uC785\uB825\uB9CC \uC9C0\uC6D0\uD569\uB2C8\uB2E4 (\uAC10\uC9C0\uB41C \uD3EC\uB9F7: ${format2})`);
|
|
29098
29186
|
}
|
|
29099
29187
|
const hwpxResult = await fillHwpx(buffer, values);
|
|
29100
29188
|
return {
|
|
@@ -29140,9 +29228,9 @@ async function extractTables(input, options = {}) {
|
|
|
29140
29228
|
warnings: []
|
|
29141
29229
|
}));
|
|
29142
29230
|
if (out.length === 0) return out;
|
|
29143
|
-
const
|
|
29144
|
-
if (
|
|
29145
|
-
for (const t of out) t.warnings.push(`${
|
|
29231
|
+
const format2 = detectFormat(buffer);
|
|
29232
|
+
if (format2 !== "hwpx" && format2 !== "hwp") {
|
|
29233
|
+
for (const t of out) t.warnings.push(`${format2} \uC740 \uB80C\uB354 \uBBF8\uC9C0\uC6D0 \u2014 region\xB7crop \uC5C6\uC74C`);
|
|
29146
29234
|
return out;
|
|
29147
29235
|
}
|
|
29148
29236
|
let scene;
|
|
@@ -29238,4 +29326,4 @@ export {
|
|
|
29238
29326
|
parseHwpml,
|
|
29239
29327
|
fillForm
|
|
29240
29328
|
};
|
|
29241
|
-
//# sourceMappingURL=chunk-
|
|
29329
|
+
//# sourceMappingURL=chunk-CB5XDCSL.js.map
|