kordoc 4.17.0 → 4.17.2
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 +6 -3
- package/dist/{-PRAKO6M4.js → -2UA2JHVA.js} +11 -11
- package/dist/{chunk-I5DJOP62.js → chunk-2XHXABCX.js} +2 -2
- package/dist/{chunk-4XVNQAK5.js → chunk-3N272C5L.js} +244 -115
- package/dist/chunk-3N272C5L.js.map +1 -0
- package/dist/{chunk-6RGGYQQC.js → chunk-4HRJISJF.js} +3 -3
- package/dist/{chunk-WN6OD2CQ.js → chunk-4TSYMJDL.js} +243 -114
- package/dist/chunk-4TSYMJDL.js.map +1 -0
- package/dist/{chunk-EFO6JZY6.js → chunk-5JZEY5IL.js} +119 -77
- package/dist/chunk-5JZEY5IL.js.map +1 -0
- package/dist/{chunk-WYON5ANU.cjs → chunk-6DOCSYEM.cjs} +113 -71
- package/dist/chunk-6DOCSYEM.cjs.map +1 -0
- package/dist/{chunk-BZG7K44Z.js → chunk-6OCKAXIS.js} +2 -2
- package/dist/{chunk-ZF6KHPB7.js → chunk-A2W2JQ3S.js} +11 -5
- package/dist/chunk-A2W2JQ3S.js.map +1 -0
- package/dist/{chunk-N6V7LQBL.js → chunk-C4MVZXB5.js} +2 -2
- package/dist/{chunk-4GSF2R7T.js → chunk-FGL4IGOT.js} +4 -4
- package/dist/{chunk-R2BUANHQ.cjs → chunk-GPC72VSF.cjs} +6 -6
- package/dist/chunk-GPC72VSF.cjs.map +1 -0
- package/dist/chunk-GS7T56RP.cjs.map +1 -1
- package/dist/{chunk-TDQ6XDB3.js → chunk-GYTL6WT3.js} +3 -3
- package/dist/{chunk-O7OUX6NU.cjs → chunk-HAW2VL62.cjs} +12 -12
- package/dist/chunk-HAW2VL62.cjs.map +1 -0
- package/dist/chunk-J55UQC5H.cjs.map +1 -1
- package/dist/{chunk-QJWVMPB6.js → chunk-JY2NBFIG.js} +15 -13
- package/dist/chunk-JY2NBFIG.js.map +1 -0
- package/dist/{chunk-A55JGNKD.js → chunk-KQIYC2ZU.js} +2 -2
- package/dist/{chunk-QNJLLF4J.cjs → chunk-KZVQK5NS.cjs} +11 -5
- package/dist/chunk-KZVQK5NS.cjs.map +1 -0
- package/dist/{chunk-PHID6WNG.js → chunk-MDCTITUG.js} +2 -2
- package/dist/{chunk-2KF5WZCR.js → chunk-O4CB7D2Q.js} +2 -2
- package/dist/{chunk-YZ5HHS6A.js → chunk-SDRKHEVT.js} +2 -2
- package/dist/{chunk-MJBCXW5R.js → chunk-UX3HHAWH.js} +1 -1
- package/dist/{chunk-MJBCXW5R.js.map → chunk-UX3HHAWH.js.map} +1 -1
- package/dist/{chunk-K2VYABZ3.js → chunk-VU26WGE5.js} +102 -38
- package/dist/chunk-VU26WGE5.js.map +1 -0
- package/dist/{chunk-BFT5IM2R.js → chunk-WJLICIYV.js} +2 -2
- package/dist/{chunk-5CDUL6PH.js → chunk-WL3BWROT.js} +1 -1
- package/dist/{chunk-5CDUL6PH.js.map → chunk-WL3BWROT.js.map} +1 -1
- package/dist/{chunk-XEPKOC2O.cjs → chunk-WWMKIHF7.cjs} +344 -215
- package/dist/chunk-WWMKIHF7.cjs.map +1 -0
- package/dist/{chunk-BLPR4HRF.js → chunk-XZA6X34R.js} +121 -77
- package/dist/chunk-XZA6X34R.js.map +1 -0
- package/dist/{chunk-ML4NHUR7.js → chunk-YGKC6E6A.js} +11 -5
- package/dist/chunk-YGKC6E6A.js.map +1 -0
- package/dist/{chunk-AKB72TEH.cjs → chunk-YIANW5QX.cjs} +1 -1
- package/dist/chunk-YIANW5QX.cjs.map +1 -0
- package/dist/{chunk-WY5JAR4O.js → chunk-ZDX5PIWR.js} +2 -2
- package/dist/chunks-EBWJR55V.js +10 -0
- package/dist/cli.js +26 -26
- package/dist/{formula-ECNOZT36.cjs → formula-5RETDCIC.cjs} +9 -9
- package/dist/formula-5RETDCIC.cjs.map +1 -0
- package/dist/{formula-7MMFBRGJ.js → formula-MBLN2DG4.js} +4 -4
- package/dist/{formula-SHBXRXOJ.js → formula-QZZDW5GW.js} +3 -3
- package/dist/{image-ocr-P6ECJCT2.js → image-ocr-CJSO3QSR.js} +8 -8
- package/dist/{image-ocr-QCT3A7X5.js → image-ocr-EREKAS47.js} +6 -6
- package/dist/{image-ocr-VUDSP2B4.cjs → image-ocr-PSPVRLB5.cjs} +15 -15
- package/dist/image-ocr-PSPVRLB5.cjs.map +1 -0
- package/dist/index.cjs +688 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +106 -40
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-OUHGCEZY.js → model-bundle-MA4MMCRJ.js} +5 -5
- package/dist/{models-6D6LMOTH.js → models-SEJ7LNSN.js} +5 -5
- package/dist/page-range-QHHFTL7X.cjs.map +1 -1
- package/dist/{parser-ZPRQ3SSU.js → parser-M5WHRX25.js} +41 -23
- package/dist/parser-M5WHRX25.js.map +1 -0
- package/dist/{parser-RQ4PJRTJ.cjs → parser-QILYPWSI.cjs} +215 -197
- package/dist/parser-QILYPWSI.cjs.map +1 -0
- package/dist/{parser-CTRB7PKD.js → parser-VH3F4EQU.js} +38 -20
- package/dist/parser-VH3F4EQU.js.map +1 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs +16 -0
- package/dist/pdf-ocr-3SZUM3CN.cjs.map +1 -0
- package/dist/pdf-ocr-QB2TB5W5.js +18 -0
- package/dist/pdf-ocr-XC33L43D.js +15 -0
- package/dist/{profile-io-YZUW6MAN.js → profile-io-5YB627EO.js} +3 -3
- package/dist/{rasterize-OUR2QJXX.js → rasterize-V2XHHS2I.js} +3 -3
- package/dist/{redact-doc-4OQKG4SM.js → redact-doc-5MK5L5IQ.js} +11 -11
- package/dist/{render-XNO6PZJO.js → render-SYZMHYK6.js} +7 -7
- package/dist/seal-IPKIQHYB.js +10 -0
- package/dist/{setup-UU3EIHNI.js → setup-ZPLJENSK.js} +3 -3
- package/dist/visual-RTTGNOAE.js +20 -0
- package/dist/{watch-SR6Q5SQN.js → watch-FNWHVKK3.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-4XVNQAK5.js.map +0 -1
- package/dist/chunk-AKB72TEH.cjs.map +0 -1
- package/dist/chunk-BLPR4HRF.js.map +0 -1
- package/dist/chunk-EFO6JZY6.js.map +0 -1
- package/dist/chunk-K2VYABZ3.js.map +0 -1
- package/dist/chunk-ML4NHUR7.js.map +0 -1
- package/dist/chunk-O7OUX6NU.cjs.map +0 -1
- package/dist/chunk-QJWVMPB6.js.map +0 -1
- package/dist/chunk-QNJLLF4J.cjs.map +0 -1
- package/dist/chunk-R2BUANHQ.cjs.map +0 -1
- package/dist/chunk-WN6OD2CQ.js.map +0 -1
- package/dist/chunk-WYON5ANU.cjs.map +0 -1
- package/dist/chunk-XEPKOC2O.cjs.map +0 -1
- package/dist/chunk-ZF6KHPB7.js.map +0 -1
- package/dist/chunks-YBFBLJ4G.js +0 -10
- package/dist/formula-ECNOZT36.cjs.map +0 -1
- package/dist/image-ocr-VUDSP2B4.cjs.map +0 -1
- package/dist/parser-CTRB7PKD.js.map +0 -1
- package/dist/parser-RQ4PJRTJ.cjs.map +0 -1
- package/dist/parser-ZPRQ3SSU.js.map +0 -1
- package/dist/pdf-ocr-462ZFSHX.js +0 -15
- package/dist/pdf-ocr-L35FQYGP.js +0 -18
- package/dist/pdf-ocr-STK5EQFF.cjs +0 -16
- package/dist/pdf-ocr-STK5EQFF.cjs.map +0 -1
- package/dist/seal-CJ7C44JN.js +0 -10
- package/dist/visual-QRMRFPUK.js +0 -20
- /package/dist/{-PRAKO6M4.js.map → -2UA2JHVA.js.map} +0 -0
- /package/dist/{chunk-I5DJOP62.js.map → chunk-2XHXABCX.js.map} +0 -0
- /package/dist/{chunk-6RGGYQQC.js.map → chunk-4HRJISJF.js.map} +0 -0
- /package/dist/{chunk-BZG7K44Z.js.map → chunk-6OCKAXIS.js.map} +0 -0
- /package/dist/{chunk-N6V7LQBL.js.map → chunk-C4MVZXB5.js.map} +0 -0
- /package/dist/{chunk-4GSF2R7T.js.map → chunk-FGL4IGOT.js.map} +0 -0
- /package/dist/{chunk-TDQ6XDB3.js.map → chunk-GYTL6WT3.js.map} +0 -0
- /package/dist/{chunk-A55JGNKD.js.map → chunk-KQIYC2ZU.js.map} +0 -0
- /package/dist/{chunk-PHID6WNG.js.map → chunk-MDCTITUG.js.map} +0 -0
- /package/dist/{chunk-2KF5WZCR.js.map → chunk-O4CB7D2Q.js.map} +0 -0
- /package/dist/{chunk-YZ5HHS6A.js.map → chunk-SDRKHEVT.js.map} +0 -0
- /package/dist/{chunk-BFT5IM2R.js.map → chunk-WJLICIYV.js.map} +0 -0
- /package/dist/{chunk-WY5JAR4O.js.map → chunk-ZDX5PIWR.js.map} +0 -0
- /package/dist/{chunks-YBFBLJ4G.js.map → chunks-EBWJR55V.js.map} +0 -0
- /package/dist/{formula-7MMFBRGJ.js.map → formula-MBLN2DG4.js.map} +0 -0
- /package/dist/{formula-SHBXRXOJ.js.map → formula-QZZDW5GW.js.map} +0 -0
- /package/dist/{image-ocr-P6ECJCT2.js.map → image-ocr-CJSO3QSR.js.map} +0 -0
- /package/dist/{image-ocr-QCT3A7X5.js.map → image-ocr-EREKAS47.js.map} +0 -0
- /package/dist/{model-bundle-OUHGCEZY.js.map → model-bundle-MA4MMCRJ.js.map} +0 -0
- /package/dist/{models-6D6LMOTH.js.map → models-SEJ7LNSN.js.map} +0 -0
- /package/dist/{pdf-ocr-462ZFSHX.js.map → pdf-ocr-QB2TB5W5.js.map} +0 -0
- /package/dist/{pdf-ocr-L35FQYGP.js.map → pdf-ocr-XC33L43D.js.map} +0 -0
- /package/dist/{profile-io-YZUW6MAN.js.map → profile-io-5YB627EO.js.map} +0 -0
- /package/dist/{rasterize-OUR2QJXX.js.map → rasterize-V2XHHS2I.js.map} +0 -0
- /package/dist/{redact-doc-4OQKG4SM.js.map → redact-doc-5MK5L5IQ.js.map} +0 -0
- /package/dist/{render-XNO6PZJO.js.map → render-SYZMHYK6.js.map} +0 -0
- /package/dist/{seal-CJ7C44JN.js.map → seal-IPKIQHYB.js.map} +0 -0
- /package/dist/{setup-UU3EIHNI.js.map → setup-ZPLJENSK.js.map} +0 -0
- /package/dist/{visual-QRMRFPUK.js.map → visual-RTTGNOAE.js.map} +0 -0
- /package/dist/{watch-SR6Q5SQN.js.map → watch-FNWHVKK3.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
blocksToPages
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-O4CB7D2Q.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-4HRJISJF.js";
|
|
19
19
|
import {
|
|
20
20
|
CONVERT_MAP,
|
|
21
21
|
FLAG_COMPRESSED,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
renderDocumentToScene,
|
|
62
62
|
romanNumeral,
|
|
63
63
|
simulateWrap
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-JY2NBFIG.js";
|
|
65
65
|
import {
|
|
66
66
|
CELL_EDGES,
|
|
67
67
|
HEADING_RATIO_H1,
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
tidyScriptTags,
|
|
73
73
|
unframeLayoutTables,
|
|
74
74
|
wrapScript
|
|
75
|
-
} from "./chunk-
|
|
75
|
+
} from "./chunk-WL3BWROT.js";
|
|
76
76
|
import {
|
|
77
77
|
parsePageRange
|
|
78
78
|
} from "./chunk-VQFA55IC.js";
|
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
findChildByLocalName,
|
|
92
92
|
localName,
|
|
93
93
|
rawTextContent
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-2XHXABCX.js";
|
|
95
95
|
import {
|
|
96
96
|
MAX_COLS,
|
|
97
97
|
MAX_ROWS,
|
|
@@ -106,7 +106,7 @@ import {
|
|
|
106
106
|
hasStructuredCellContent,
|
|
107
107
|
mapPuaText,
|
|
108
108
|
noteSuffix
|
|
109
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-WJLICIYV.js";
|
|
110
110
|
import {
|
|
111
111
|
KordocError,
|
|
112
112
|
classifyError,
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
toArrayBuffer,
|
|
122
122
|
unescapeHtml,
|
|
123
123
|
unzipLimitBytes
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-A2W2JQ3S.js";
|
|
125
125
|
|
|
126
126
|
// src/table/visual.ts
|
|
127
127
|
import { readFile as readFile2 } from "fs/promises";
|
|
@@ -452,6 +452,7 @@ async function extractHwpxStyles(zip, decompressed) {
|
|
|
452
452
|
continue;
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
+
if (result.borderEdges.size > 0 && !result.borderEdges.has("0")) result.borderEdges.set("0", { t: false, b: false, l: false, r: false });
|
|
455
456
|
return result;
|
|
456
457
|
}
|
|
457
458
|
function parseCharProperties(doc, map) {
|
|
@@ -16612,6 +16613,21 @@ var ListCounter = class {
|
|
|
16612
16613
|
}
|
|
16613
16614
|
};
|
|
16614
16615
|
|
|
16616
|
+
// src/docx/symbol-font.ts
|
|
16617
|
+
var SYMBOL_LO = " !\u2200#\u2203%&\u220B()\u2217+,\u2212./0123456789:;<=>?\u2245\u0391\u0392\u03A7\u0394\u0395\u03A6\u0393\u0397\u0399\u03D1\u039A\u039B\u039C\u039D\u039F\u03A0\u0398\u03A1\u03A3\u03A4\u03A5\u03C2\u03A9\u039E\u03A8\u0396[\u2234]\u22A5_\0\u03B1\u03B2\u03C7\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03D5\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03B8\u03C1\u03C3\u03C4\u03C5\u03D6\u03C9\u03BE\u03C8\u03B6{|}\u223C";
|
|
16618
|
+
var SYMBOL_HI = "\u20AC\u03D2\u2032\u2264\u2044\u221E\u0192\u2663\u2666\u2665\u2660\u2194\u2190\u2191\u2192\u2193\xB0\xB1\u2033\u2265\xD7\u221D\u2202\u2022\xF7\u2260\u2261\u2248\u2026\u23D0\u23AF\u21B5\u2135\u2111\u211C\u2118\u2297\u2295\u2205\u2229\u222A\u2283\u2287\u2284\u2282\u2286\u2208\u2209\u2220\u2207\xAE\xA9\u2122\u220F\u221A\u22C5\xAC\u2227\u2228\u21D4\u21D0\u21D1\u21D2\u21D3\u25CA\u27E8\xAE\xA9\u2122\u2211\u239B\u239C\u239D\u23A1\u23A2\u23A3\u23A7\u23A8\u23A9\u23AA\0\u27E9\u222B\u2320\u23AE\u2321\u239E\u239F\u23A0\u23A4\u23A5\u23A6\u23AB\u23AC\u23AD";
|
|
16619
|
+
var DINGBAT_FONT_RE = /^\s*(?:wingdings|webdings|marlett|zapf\s*dingbats)/i;
|
|
16620
|
+
function symbolChar(font, char) {
|
|
16621
|
+
const code = parseInt(char ?? "", 16);
|
|
16622
|
+
if (!(code >= 32 && code <= 65535) || DINGBAT_FONT_RE.test(font ?? "")) return "";
|
|
16623
|
+
if (/^\s*symbol\s*$/i.test(font ?? "")) {
|
|
16624
|
+
const lo = code & 255;
|
|
16625
|
+
const c = lo >= 32 && lo <= 126 ? SYMBOL_LO[lo - 32] : lo >= 160 && lo <= 254 ? SYMBOL_HI[lo - 160] : "";
|
|
16626
|
+
return c === "\0" ? "" : c;
|
|
16627
|
+
}
|
|
16628
|
+
return code >= 61440 && code <= 61695 ? "" : String.fromCharCode(code);
|
|
16629
|
+
}
|
|
16630
|
+
|
|
16615
16631
|
// src/docx/parser.ts
|
|
16616
16632
|
import { DOMParser as DOMParser2 } from "@xmldom/xmldom";
|
|
16617
16633
|
|
|
@@ -16619,8 +16635,12 @@ import { DOMParser as DOMParser2 } from "@xmldom/xmldom";
|
|
|
16619
16635
|
function runToLatex(r) {
|
|
16620
16636
|
let out = "";
|
|
16621
16637
|
for (const t of childrenByLocalName(r, "t")) out += t.textContent ?? "";
|
|
16622
|
-
return out;
|
|
16638
|
+
return out.replace(/[#%]/g, "\\$&");
|
|
16623
16639
|
}
|
|
16640
|
+
function join(a, b) {
|
|
16641
|
+
return /\\[A-Za-z]+$/.test(a) && /^[A-Za-z]/.test(b) ? a + " " + b : a + b;
|
|
16642
|
+
}
|
|
16643
|
+
var EQ_NUMBER_RE = /\s*\\#\s*(?:\\left\((.+)\\right\)|\(([^()]*)\))\s*$/;
|
|
16624
16644
|
var FUNC_NAMES = /* @__PURE__ */ new Set([
|
|
16625
16645
|
"sin",
|
|
16626
16646
|
"cos",
|
|
@@ -16740,7 +16760,7 @@ function grp(body) {
|
|
|
16740
16760
|
function childrenToLatex(parent) {
|
|
16741
16761
|
let out = "";
|
|
16742
16762
|
for (const ch of elementChildren(parent)) {
|
|
16743
|
-
out
|
|
16763
|
+
out = join(out, nodeToLatex(ch));
|
|
16744
16764
|
}
|
|
16745
16765
|
return out;
|
|
16746
16766
|
}
|
|
@@ -16865,7 +16885,7 @@ function nodeToLatex(el) {
|
|
|
16865
16885
|
}
|
|
16866
16886
|
const items = childrenByLocalName(el, "e").map(childrenToLatex);
|
|
16867
16887
|
const body = items.join(sep);
|
|
16868
|
-
return "\\left" + mapDelim(beg, true)
|
|
16888
|
+
return join("\\left" + mapDelim(beg, true), body) + "\\right" + mapDelim(end, false);
|
|
16869
16889
|
}
|
|
16870
16890
|
// 행렬
|
|
16871
16891
|
case "m": {
|
|
@@ -16934,10 +16954,16 @@ function nodeToLatex(el) {
|
|
|
16934
16954
|
// group character (over/underset 비슷)
|
|
16935
16955
|
case "groupChr":
|
|
16936
16956
|
return childrenToLatex(findChildByLocalName(el, "e") ?? el);
|
|
16937
|
-
//
|
|
16957
|
+
// 수식 배열 — 한 줄짜리 끝의 수식 번호 `#(43)` 는 \tag{43} (#106). 여러 줄은 종전대로 이어 붙인다
|
|
16958
|
+
case "eqArr": {
|
|
16959
|
+
const rows = childrenByLocalName(el, "e");
|
|
16960
|
+
const one = rows.length === 1 ? childrenToLatex(rows[0]) : "";
|
|
16961
|
+
const m = one.match(EQ_NUMBER_RE);
|
|
16962
|
+
return m ? one.slice(0, m.index) + " \\tag{" + (m[1] ?? m[2]).trim() + "}" : childrenToLatex(el);
|
|
16963
|
+
}
|
|
16964
|
+
// box/borderBox/phantom/… 는 자식 본문만 유지
|
|
16938
16965
|
case "borderBox":
|
|
16939
16966
|
case "phant":
|
|
16940
|
-
case "eqArr":
|
|
16941
16967
|
return childrenToLatex(el);
|
|
16942
16968
|
// 최상위 컨테이너
|
|
16943
16969
|
case "oMath":
|
|
@@ -16977,6 +17003,7 @@ function isDisplayMath(el) {
|
|
|
16977
17003
|
|
|
16978
17004
|
// src/docx/parser.ts
|
|
16979
17005
|
var MAX_DECOMPRESS_SIZE4 = unzipLimitBytes(100 * 1024 * 1024);
|
|
17006
|
+
var MEDIA_PART_RE = /^word\/(?:media|embeddings)\//;
|
|
16980
17007
|
function matchesLocal(el, localName3) {
|
|
16981
17008
|
return el.localName === localName3 || (el.tagName?.endsWith(`:${localName3}`) ?? false);
|
|
16982
17009
|
}
|
|
@@ -16994,7 +17021,7 @@ function effectiveChildElements(parent) {
|
|
|
16994
17021
|
result.push(...effectiveChildElements(c));
|
|
16995
17022
|
}
|
|
16996
17023
|
}
|
|
16997
|
-
} else if (matchesLocal(el, "ins") || matchesLocal(el, "smartTag")) {
|
|
17024
|
+
} else if (matchesLocal(el, "ins") || matchesLocal(el, "smartTag") || matchesLocal(el, "dir") || matchesLocal(el, "bdo")) {
|
|
16998
17025
|
result.push(...effectiveChildElements(el));
|
|
16999
17026
|
} else {
|
|
17000
17027
|
result.push(el);
|
|
@@ -17202,6 +17229,7 @@ function extractRun(r) {
|
|
|
17202
17229
|
if (matchesLocal(el, "t")) text += el.textContent ?? "";
|
|
17203
17230
|
else if (matchesLocal(el, "br") || matchesLocal(el, "cr")) text += "\n";
|
|
17204
17231
|
else if (matchesLocal(el, "tab")) text += " ";
|
|
17232
|
+
else if (matchesLocal(el, "sym")) text += symbolChar(getAttr(el, "font"), getAttr(el, "char"));
|
|
17205
17233
|
}
|
|
17206
17234
|
let bold = false;
|
|
17207
17235
|
let italic = false;
|
|
@@ -17252,7 +17280,19 @@ function collectInline(p, footnotes, rels) {
|
|
|
17252
17280
|
fieldInstr = "";
|
|
17253
17281
|
fieldDisplay = "";
|
|
17254
17282
|
};
|
|
17283
|
+
const placedMath = /* @__PURE__ */ new Set();
|
|
17284
|
+
const mathText = (om) => {
|
|
17285
|
+
const latex = ommlElementToLatex(om);
|
|
17286
|
+
return !latex ? "" : isDisplayMath(om) ? " $$" + latex + "$$ " : "$" + latex + "$";
|
|
17287
|
+
};
|
|
17255
17288
|
for (const el of effectiveChildElements(p)) {
|
|
17289
|
+
if (matchesLocal(el, "oMath") || matchesLocal(el, "oMathPara")) {
|
|
17290
|
+
placedMath.add(el);
|
|
17291
|
+
const m = mathText(el);
|
|
17292
|
+
if (fieldActive && fieldStage === "display") fieldDisplay += m;
|
|
17293
|
+
else parts.push(m);
|
|
17294
|
+
continue;
|
|
17295
|
+
}
|
|
17256
17296
|
if (matchesLocal(el, "hyperlink")) {
|
|
17257
17297
|
const rId = getAttr(el, "id");
|
|
17258
17298
|
const anchor = getAttr(el, "anchor");
|
|
@@ -17304,10 +17344,9 @@ function collectInline(p, footnotes, rels) {
|
|
|
17304
17344
|
}
|
|
17305
17345
|
flushField();
|
|
17306
17346
|
for (const om of collectOmmlRoots(p)) {
|
|
17307
|
-
|
|
17308
|
-
|
|
17309
|
-
if (
|
|
17310
|
-
else parts.push(" $" + latex + "$ ");
|
|
17347
|
+
if (placedMath.has(om)) continue;
|
|
17348
|
+
const m = mathText(om);
|
|
17349
|
+
if (m) parts.push(isDisplayMath(om) ? m : " " + m + " ");
|
|
17311
17350
|
}
|
|
17312
17351
|
const text = tidyScriptTags(parts.join("")).replace(/[ \t]{2,}/g, " ").trim();
|
|
17313
17352
|
return { text, bold, italic, footnoteText };
|
|
@@ -17459,7 +17498,7 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
|
|
|
17459
17498
|
}
|
|
17460
17499
|
return parts;
|
|
17461
17500
|
}
|
|
17462
|
-
async function buildImageMap(zip, rels, doc, warnings) {
|
|
17501
|
+
async function buildImageMap(zip, rels, doc, warnings, readBytes) {
|
|
17463
17502
|
const imageMap = /* @__PURE__ */ new Map();
|
|
17464
17503
|
const images = [];
|
|
17465
17504
|
let imgIdx = 0;
|
|
@@ -17480,7 +17519,8 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
17480
17519
|
const imgFile = zip.file(imgPath);
|
|
17481
17520
|
if (!imgFile) continue;
|
|
17482
17521
|
try {
|
|
17483
|
-
|
|
17522
|
+
let data = null;
|
|
17523
|
+
if (readBytes) data = await imgFile.async("uint8array");
|
|
17484
17524
|
imgIdx++;
|
|
17485
17525
|
const ext = imgPath.split(".").pop()?.toLowerCase() ?? "png";
|
|
17486
17526
|
const mimeMap = {
|
|
@@ -17496,8 +17536,10 @@ async function buildImageMap(zip, rels, doc, warnings) {
|
|
|
17496
17536
|
svg: "image/svg+xml"
|
|
17497
17537
|
};
|
|
17498
17538
|
const filename = `image_${String(imgIdx).padStart(3, "0")}.${ext}`;
|
|
17499
|
-
|
|
17500
|
-
|
|
17539
|
+
if (data) {
|
|
17540
|
+
const mimeType = mimeMap[ext] ?? detectImageMime(data) ?? "application/octet-stream";
|
|
17541
|
+
images.push({ filename, data, mimeType, source: imgPath });
|
|
17542
|
+
}
|
|
17501
17543
|
imageMap.set(embedId, filename);
|
|
17502
17544
|
} catch (err) {
|
|
17503
17545
|
warnings.push({
|
|
@@ -17578,7 +17620,8 @@ async function parseHeaderFooterBlocks(zip, doc, rels, kind, styles, numbering,
|
|
|
17578
17620
|
return out;
|
|
17579
17621
|
}
|
|
17580
17622
|
async function parseDocxDocument(buffer, options) {
|
|
17581
|
-
|
|
17623
|
+
const readImages = options?.images !== false;
|
|
17624
|
+
precheckZipSize(buffer, MAX_DECOMPRESS_SIZE4, void 0, { re: MEDIA_PART_RE, skip: !readImages });
|
|
17582
17625
|
const zip = await JSZip4.loadAsync(buffer);
|
|
17583
17626
|
const warnings = [];
|
|
17584
17627
|
const docFile = zip.file("word/document.xml");
|
|
@@ -17632,7 +17675,7 @@ async function parseDocxDocument(buffer, options) {
|
|
|
17632
17675
|
if (body.length === 0) {
|
|
17633
17676
|
throw new KordocError("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
|
|
17634
17677
|
}
|
|
17635
|
-
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
|
|
17678
|
+
const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings, readImages);
|
|
17636
17679
|
const linkedImages = /* @__PURE__ */ new Set();
|
|
17637
17680
|
const blocks = [];
|
|
17638
17681
|
const bodyEl = body[0];
|
|
@@ -19833,28 +19876,49 @@ function fitParagraph(text, font, pt, firstW, contW, minRatio = 88, orphanRatio
|
|
|
19833
19876
|
const ladder = [[100, 0], ...SQUEEZE.filter(([r]) => r >= minRatio)];
|
|
19834
19877
|
const base = simulateWrap(text, f, c, h, 100, "keep", { faceClass });
|
|
19835
19878
|
if (base.lines < 2) return null;
|
|
19879
|
+
const wraps = /* @__PURE__ */ new Map([["100:0", base]]);
|
|
19880
|
+
const looseness = /* @__PURE__ */ new Map();
|
|
19881
|
+
const wrap = (r, sp) => {
|
|
19882
|
+
const key = `${r}:${sp}`;
|
|
19883
|
+
let w = wraps.get(key);
|
|
19884
|
+
if (!w) {
|
|
19885
|
+
w = simulateWrap(text, f, c, h, r, "keep", { faceClass, spacingPct: sp });
|
|
19886
|
+
wraps.set(key, w);
|
|
19887
|
+
}
|
|
19888
|
+
return w;
|
|
19889
|
+
};
|
|
19890
|
+
const looseAt = (r, sp, w) => {
|
|
19891
|
+
const key = `${r}:${sp}`;
|
|
19892
|
+
let loose = looseness.get(key);
|
|
19893
|
+
if (loose === void 0) {
|
|
19894
|
+
loose = worstLooseness(text, w.starts, f, c, h, r, sp, faceClass);
|
|
19895
|
+
looseness.set(key, loose);
|
|
19896
|
+
}
|
|
19897
|
+
return loose;
|
|
19898
|
+
};
|
|
19836
19899
|
if (base.lastLineWidth <= c * PULL_TAIL) {
|
|
19837
19900
|
let pull = null;
|
|
19838
19901
|
for (const [r, sp] of ladder) {
|
|
19839
19902
|
const amt = squeezeOf(r, sp);
|
|
19840
19903
|
if (amt > PULL_MAX + 1e-9 || pull && amt >= pull.amt - 1e-9) continue;
|
|
19841
|
-
const w =
|
|
19842
|
-
if (w.lines < base.lines &&
|
|
19904
|
+
const w = wrap(r, sp);
|
|
19905
|
+
if (w.lines < base.lines && looseAt(r, sp, w) <= LOOSE_LIMIT) pull = { r, sp, amt };
|
|
19843
19906
|
}
|
|
19844
19907
|
if (pull) return { ratio: pull.r, spacing: pull.sp };
|
|
19845
19908
|
}
|
|
19846
19909
|
let baseLines = 0;
|
|
19847
19910
|
let best = null;
|
|
19848
19911
|
for (const [r, sp] of ladder) {
|
|
19849
|
-
const w =
|
|
19912
|
+
const w = wrap(r, sp);
|
|
19850
19913
|
if (!best) {
|
|
19851
19914
|
if (w.lines < 2) return null;
|
|
19852
19915
|
baseLines = w.lines;
|
|
19853
19916
|
}
|
|
19854
19917
|
if (w.lines > baseLines) continue;
|
|
19855
19918
|
const orphan = w.lines > 1 && w.lastLineWidth <= contW * orphanRatio;
|
|
19856
|
-
const loose =
|
|
19919
|
+
const loose = looseAt(r, sp, w);
|
|
19857
19920
|
const cost = Math.max(0, loose - LOOSE_LIMIT) + (orphan ? ORPHAN_COST : 0) + squeezeOf(r, sp) * COMPRESS_COST;
|
|
19921
|
+
if (r === 100 && sp === 0 && cost === 0) return null;
|
|
19858
19922
|
if (!best || cost < best.cost - 1e-9) best = { r, sp, cost };
|
|
19859
19923
|
}
|
|
19860
19924
|
return best && (best.r !== 100 || best.sp !== 0) ? { ratio: best.r, spacing: best.sp } : null;
|
|
@@ -24558,7 +24622,7 @@ function legalMarkerDepth(marker) {
|
|
|
24558
24622
|
return 7;
|
|
24559
24623
|
}
|
|
24560
24624
|
function parseLeadingMarker(text, keepMarkers = false) {
|
|
24561
|
-
const t = text.replace(/^[\s ]+/, "").replace(
|
|
24625
|
+
const t = text.replace(/^[\s ]+/, "").replace(/^(\*\*|__)([□■ㅇ○◦●❍◎▸※-])\1(?=\s|$)/u, "$2").replace(/^(\*\*|__)([□■ㅇ○◦●❍◎▸※-])\s*(?=\S)/u, "$2 $1");
|
|
24562
24626
|
const ref = REF_RE.exec(t);
|
|
24563
24627
|
if (ref) return { kind: "ref", depth: 0, marker: ref[1], rest: t.slice(ref[0].length).trim() };
|
|
24564
24628
|
if (keepMarkers) {
|
|
@@ -25028,7 +25092,7 @@ function chapterLabel(index, style) {
|
|
|
25028
25092
|
return style === "roman" ? `${ROMAN[(index - 1) % 12]}.` : `${index}.`;
|
|
25029
25093
|
}
|
|
25030
25094
|
function plain2(text) {
|
|
25031
|
-
return text
|
|
25095
|
+
return parseInlineMarkdown(text).map((span) => span.text).join("");
|
|
25032
25096
|
}
|
|
25033
25097
|
function buildGongmunSectionV5(blocks, gongmun, deps, theme) {
|
|
25034
25098
|
resetTableIds();
|
|
@@ -25764,7 +25828,7 @@ function diffTableCells(a, b) {
|
|
|
25764
25828
|
// src/form/templates.ts
|
|
25765
25829
|
import { existsSync, readFileSync } from "fs";
|
|
25766
25830
|
import { fileURLToPath } from "url";
|
|
25767
|
-
import { dirname, join } from "path";
|
|
25831
|
+
import { dirname, join as join2 } from "path";
|
|
25768
25832
|
var BUILTIN_TEMPLATES = [
|
|
25769
25833
|
{
|
|
25770
25834
|
id: "gian",
|
|
@@ -25790,22 +25854,22 @@ function resolveBuiltinTemplate(name) {
|
|
|
25790
25854
|
function builtinTemplateDir() {
|
|
25791
25855
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
25792
25856
|
const candidates = [
|
|
25793
|
-
|
|
25857
|
+
join2(here, "..", "..", "templates"),
|
|
25794
25858
|
// src/form/templates.ts → 패키지 루트
|
|
25795
|
-
|
|
25859
|
+
join2(here, "..", "templates")
|
|
25796
25860
|
// dist/*.js (tsup 번들) → 패키지 루트
|
|
25797
25861
|
];
|
|
25798
25862
|
for (const c of candidates) {
|
|
25799
|
-
if (existsSync(
|
|
25863
|
+
if (existsSync(join2(c, BUILTIN_TEMPLATES[0].file))) return c;
|
|
25800
25864
|
}
|
|
25801
25865
|
throw new 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)");
|
|
25802
25866
|
}
|
|
25803
25867
|
function readBuiltinTemplate(t) {
|
|
25804
|
-
const buf = readFileSync(
|
|
25868
|
+
const buf = readFileSync(join2(builtinTemplateDir(), t.file));
|
|
25805
25869
|
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength);
|
|
25806
25870
|
}
|
|
25807
25871
|
function readBuiltinTemplateSample(t) {
|
|
25808
|
-
return JSON.parse(readFileSync(
|
|
25872
|
+
return JSON.parse(readFileSync(join2(builtinTemplateDir(), t.sampleFile), "utf-8"));
|
|
25809
25873
|
}
|
|
25810
25874
|
|
|
25811
25875
|
// src/hwpx/extract-profile.ts
|
|
@@ -29562,7 +29626,7 @@ function scriptsOff(r, off) {
|
|
|
29562
29626
|
}
|
|
29563
29627
|
async function parseImage(buffer, options) {
|
|
29564
29628
|
try {
|
|
29565
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
29629
|
+
const { parseImageDocument } = await import("./image-ocr-CJSO3QSR.js");
|
|
29566
29630
|
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
29567
29631
|
stripScriptTags({ blocks });
|
|
29568
29632
|
return {
|
|
@@ -29622,7 +29686,7 @@ async function parseHwp(buffer, options) {
|
|
|
29622
29686
|
async function parsePdf(buffer, options) {
|
|
29623
29687
|
let parsePdfDocument;
|
|
29624
29688
|
try {
|
|
29625
|
-
const mod = await import("./parser-
|
|
29689
|
+
const mod = await import("./parser-M5WHRX25.js");
|
|
29626
29690
|
parsePdfDocument = mod.parsePdfDocument;
|
|
29627
29691
|
} catch {
|
|
29628
29692
|
return {
|
|
@@ -29834,4 +29898,4 @@ export {
|
|
|
29834
29898
|
parseHwpml,
|
|
29835
29899
|
fillForm
|
|
29836
29900
|
};
|
|
29837
|
-
//# sourceMappingURL=chunk-
|
|
29901
|
+
//# sourceMappingURL=chunk-VU26WGE5.js.map
|