kordoc 4.22.2 → 4.22.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -6
- package/dist/{-C437ZARA.js → -HAK3YFWW.js} +11 -11
- package/dist/{chunk-UV2G6XFA.js → chunk-36DK6AOX.js} +2 -2
- package/dist/{chunk-CNMUT5YW.js → chunk-3TUJ34V7.js} +2 -2
- package/dist/{chunk-I4BS4BXE.cjs → chunk-4X7AR4EH.cjs} +34 -28
- package/dist/chunk-4X7AR4EH.cjs.map +1 -0
- package/dist/{chunk-4BJZGXNM.js → chunk-5ARHF54C.js} +2 -2
- package/dist/{chunk-56GBOIOE.js → chunk-A3SKXHAN.js} +2 -2
- package/dist/{chunk-GVBQVXXB.js → chunk-AYV5VRHL.js} +14 -4
- package/dist/chunk-AYV5VRHL.js.map +1 -0
- package/dist/{chunk-3LJ6QO53.js → chunk-C5J5LDWM.js} +14 -8
- package/dist/{chunk-3LJ6QO53.js.map → chunk-C5J5LDWM.js.map} +1 -1
- package/dist/{chunk-IRP6QS3K.js → chunk-CWBH66IQ.js} +3 -3
- package/dist/{chunk-YTEMFVZB.js → chunk-DEFT7Z3B.js} +2 -2
- package/dist/{chunk-L6N4OMKR.js → chunk-EVL6HZQL.js} +128 -70
- package/dist/chunk-EVL6HZQL.js.map +1 -0
- package/dist/{chunk-ZLFUZM7H.cjs → chunk-EYQLJ57Y.cjs} +3 -3
- package/dist/{chunk-ZLFUZM7H.cjs.map → chunk-EYQLJ57Y.cjs.map} +1 -1
- package/dist/{chunk-GFQIKYBV.js → chunk-F3AWNFMO.js} +3 -3
- package/dist/{chunk-S4KQUVBV.js → chunk-FAFSBCU2.js} +4 -4
- package/dist/{chunk-AXR7OKQY.js → chunk-G2325K2F.js} +2 -2
- package/dist/{chunk-FPUBEM3F.js → chunk-G4KNI7EO.js} +11 -11
- package/dist/{chunk-NGDMJICC.js → chunk-HN3QMHTT.js} +15 -9
- package/dist/{chunk-NGDMJICC.js.map → chunk-HN3QMHTT.js.map} +1 -1
- package/dist/{chunk-MED2MR6O.cjs → chunk-K2NWHLCD.cjs} +23 -13
- package/dist/chunk-K2NWHLCD.cjs.map +1 -0
- package/dist/{chunk-UMNKY2EZ.js → chunk-LVVSMYG4.js} +4 -4
- package/dist/{chunk-AUWO57ED.cjs → chunk-MJSHXESK.cjs} +2 -2
- package/dist/{chunk-AUWO57ED.cjs.map → chunk-MJSHXESK.cjs.map} +1 -1
- package/dist/{chunk-L6PFPBTK.js → chunk-MYTMZSQO.js} +2 -2
- package/dist/{chunk-DQXP3ELP.js → chunk-Q65HT2BL.js} +2 -2
- package/dist/{chunk-U3TZVR7A.js → chunk-Q6SVCBMK.js} +2 -2
- package/dist/{chunk-2X64TI7I.js → chunk-RPSILMQY.js} +2 -2
- package/dist/{chunk-ENV25MPM.cjs → chunk-S45M7IQH.cjs} +24 -24
- package/dist/{chunk-ENV25MPM.cjs.map → chunk-S45M7IQH.cjs.map} +1 -1
- package/dist/{chunk-4GCS7WJJ.js → chunk-SSL3TKJY.js} +2 -2
- package/dist/{chunk-QFJCEHY7.js → chunk-UJVVL6BI.js} +14 -4
- package/dist/chunk-UJVVL6BI.js.map +1 -0
- package/dist/{chunk-EKKZNKJD.cjs → chunk-VXQWAPC6.cjs} +3 -3
- package/dist/{chunk-EKKZNKJD.cjs.map → chunk-VXQWAPC6.cjs.map} +1 -1
- package/dist/{chunk-VUC4JJUM.js → chunk-WCTC3LSV.js} +2 -2
- package/dist/{chunk-YOFKJ7IM.js → chunk-WNW77CAY.js} +2 -2
- package/dist/chunks-3N7OFSA4.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-3TVRNJ66.cjs → formula-JGFYGFYX.cjs} +9 -9
- package/dist/{formula-3TVRNJ66.cjs.map → formula-JGFYGFYX.cjs.map} +1 -1
- package/dist/{formula-HUENRCPJ.js → formula-KSTY73DQ.js} +3 -3
- package/dist/{formula-43QBPAL5.js → formula-PWAUR5PF.js} +4 -4
- package/dist/{image-ocr-BAHDLDV5.js → image-ocr-RASJHOAK.js} +6 -6
- package/dist/{image-ocr-HYAKWJGE.js → image-ocr-RPBPO3VT.js} +9 -9
- package/dist/{image-ocr-OC3TCXMV.cjs → image-ocr-UULNAC5Y.cjs} +17 -17
- package/dist/{image-ocr-OC3TCXMV.cjs.map → image-ocr-UULNAC5Y.cjs.map} +1 -1
- package/dist/index.cjs +536 -478
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +128 -70
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-23WBSECG.js → model-bundle-ZPQ4IFT7.js} +5 -5
- package/dist/{models-NRZQY45P.js → models-YJQ5VHOR.js} +5 -5
- package/dist/{parse-worker-v2-DPNXGJ73.js → parse-worker-v2-7PNZYASF.js} +12 -12
- package/dist/{parser-XNOLC3MZ.js → parser-DR6ZHYEB.js} +121 -12
- package/dist/parser-DR6ZHYEB.js.map +1 -0
- package/dist/{parser-FNUQW2F3.js → parser-ER3VLB37.js} +124 -15
- package/dist/parser-ER3VLB37.js.map +1 -0
- package/dist/{parser-OKAQRZKM.cjs → parser-ZFXVZZKQ.cjs} +376 -267
- package/dist/parser-ZFXVZZKQ.cjs.map +1 -0
- package/dist/{pdf-ocr-FAGA3O6B.js → pdf-ocr-BYT7XVID.js} +6 -6
- package/dist/{pdf-ocr-N5LYC5LA.js → pdf-ocr-DRQN5BXA.js} +9 -9
- package/dist/pdf-ocr-QWTGWYQT.cjs +31 -0
- package/dist/{pdf-ocr-6UXBIQE6.cjs.map → pdf-ocr-QWTGWYQT.cjs.map} +1 -1
- package/dist/{profile-io-HC6FMYX4.js → profile-io-3QYTSPNH.js} +3 -3
- package/dist/{rasterize-QLTROEV2.js → rasterize-LPLWCBXV.js} +3 -3
- package/dist/{redact-doc-V4KMM2QV.js → redact-doc-HDA6ZG3N.js} +11 -11
- package/dist/{render-V4S3QLTR.js → render-MYZGD3SB.js} +7 -7
- package/dist/seal-XA5V6A6V.js +10 -0
- package/dist/{setup-HU7ZOQNM.js → setup-EF5TQVAI.js} +3 -3
- package/dist/visual-DB7NJOID.js +21 -0
- package/dist/{watch-NPIZ6DSJ.js → watch-PM5PRSFW.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-GVBQVXXB.js.map +0 -1
- package/dist/chunk-I4BS4BXE.cjs.map +0 -1
- package/dist/chunk-L6N4OMKR.js.map +0 -1
- package/dist/chunk-MED2MR6O.cjs.map +0 -1
- package/dist/chunk-QFJCEHY7.js.map +0 -1
- package/dist/chunks-MPOOHZVO.js +0 -10
- package/dist/parser-FNUQW2F3.js.map +0 -1
- package/dist/parser-OKAQRZKM.cjs.map +0 -1
- package/dist/parser-XNOLC3MZ.js.map +0 -1
- package/dist/pdf-ocr-6UXBIQE6.cjs +0 -31
- package/dist/seal-MQ5TB5YZ.js +0 -10
- package/dist/visual-RLIFC4XC.js +0 -21
- /package/dist/{-C437ZARA.js.map → -HAK3YFWW.js.map} +0 -0
- /package/dist/{chunk-UV2G6XFA.js.map → chunk-36DK6AOX.js.map} +0 -0
- /package/dist/{chunk-CNMUT5YW.js.map → chunk-3TUJ34V7.js.map} +0 -0
- /package/dist/{chunk-4BJZGXNM.js.map → chunk-5ARHF54C.js.map} +0 -0
- /package/dist/{chunk-56GBOIOE.js.map → chunk-A3SKXHAN.js.map} +0 -0
- /package/dist/{chunk-IRP6QS3K.js.map → chunk-CWBH66IQ.js.map} +0 -0
- /package/dist/{chunk-YTEMFVZB.js.map → chunk-DEFT7Z3B.js.map} +0 -0
- /package/dist/{chunk-GFQIKYBV.js.map → chunk-F3AWNFMO.js.map} +0 -0
- /package/dist/{chunk-S4KQUVBV.js.map → chunk-FAFSBCU2.js.map} +0 -0
- /package/dist/{chunk-AXR7OKQY.js.map → chunk-G2325K2F.js.map} +0 -0
- /package/dist/{chunk-FPUBEM3F.js.map → chunk-G4KNI7EO.js.map} +0 -0
- /package/dist/{chunk-UMNKY2EZ.js.map → chunk-LVVSMYG4.js.map} +0 -0
- /package/dist/{chunk-L6PFPBTK.js.map → chunk-MYTMZSQO.js.map} +0 -0
- /package/dist/{chunk-DQXP3ELP.js.map → chunk-Q65HT2BL.js.map} +0 -0
- /package/dist/{chunk-U3TZVR7A.js.map → chunk-Q6SVCBMK.js.map} +0 -0
- /package/dist/{chunk-2X64TI7I.js.map → chunk-RPSILMQY.js.map} +0 -0
- /package/dist/{chunk-4GCS7WJJ.js.map → chunk-SSL3TKJY.js.map} +0 -0
- /package/dist/{chunk-VUC4JJUM.js.map → chunk-WCTC3LSV.js.map} +0 -0
- /package/dist/{chunk-YOFKJ7IM.js.map → chunk-WNW77CAY.js.map} +0 -0
- /package/dist/{chunks-MPOOHZVO.js.map → chunks-3N7OFSA4.js.map} +0 -0
- /package/dist/{formula-HUENRCPJ.js.map → formula-KSTY73DQ.js.map} +0 -0
- /package/dist/{formula-43QBPAL5.js.map → formula-PWAUR5PF.js.map} +0 -0
- /package/dist/{image-ocr-BAHDLDV5.js.map → image-ocr-RASJHOAK.js.map} +0 -0
- /package/dist/{image-ocr-HYAKWJGE.js.map → image-ocr-RPBPO3VT.js.map} +0 -0
- /package/dist/{model-bundle-23WBSECG.js.map → model-bundle-ZPQ4IFT7.js.map} +0 -0
- /package/dist/{models-NRZQY45P.js.map → models-YJQ5VHOR.js.map} +0 -0
- /package/dist/{parse-worker-v2-DPNXGJ73.js.map → parse-worker-v2-7PNZYASF.js.map} +0 -0
- /package/dist/{pdf-ocr-FAGA3O6B.js.map → pdf-ocr-BYT7XVID.js.map} +0 -0
- /package/dist/{pdf-ocr-N5LYC5LA.js.map → pdf-ocr-DRQN5BXA.js.map} +0 -0
- /package/dist/{profile-io-HC6FMYX4.js.map → profile-io-3QYTSPNH.js.map} +0 -0
- /package/dist/{rasterize-QLTROEV2.js.map → rasterize-LPLWCBXV.js.map} +0 -0
- /package/dist/{redact-doc-V4KMM2QV.js.map → redact-doc-HDA6ZG3N.js.map} +0 -0
- /package/dist/{render-V4S3QLTR.js.map → render-MYZGD3SB.js.map} +0 -0
- /package/dist/{seal-MQ5TB5YZ.js.map → seal-XA5V6A6V.js.map} +0 -0
- /package/dist/{setup-HU7ZOQNM.js.map → setup-EF5TQVAI.js.map} +0 -0
- /package/dist/{visual-RLIFC4XC.js.map → visual-DB7NJOID.js.map} +0 -0
- /package/dist/{watch-NPIZ6DSJ.js.map → watch-PM5PRSFW.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
blocksToPages,
|
|
3
3
|
bmpToPng,
|
|
4
4
|
inlineImagesIntoMarkdown
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WNW77CAY.js";
|
|
6
6
|
import {
|
|
7
7
|
parsePageRange
|
|
8
8
|
} from "./chunk-V4BH5SRQ.js";
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
validateOcrOptions,
|
|
38
38
|
visibleText,
|
|
39
39
|
wrapScript
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-UJVVL6BI.js";
|
|
41
41
|
import {
|
|
42
42
|
KordocError,
|
|
43
43
|
OPTIONAL_DEP_INSTALL_HINT,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
toArrayBuffer,
|
|
56
56
|
unescapeHtml,
|
|
57
57
|
unzipLimitBytes
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-Q65HT2BL.js";
|
|
59
59
|
|
|
60
60
|
// src/plain-markdown.ts
|
|
61
61
|
function toPlainMarkdown(md2) {
|
|
@@ -24642,7 +24642,7 @@ var MIN_SIDE = 24;
|
|
|
24642
24642
|
async function ocrEmbeddedImages(blocks, options, warnings) {
|
|
24643
24643
|
const ocr = options?.ocr;
|
|
24644
24644
|
if (ocr !== true && ocr !== "force" && typeof ocr !== "function") return false;
|
|
24645
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
24645
|
+
const { parseImageDocument } = await import("./image-ocr-RASJHOAK.js");
|
|
24646
24646
|
let inserted = false, unreadable = 0;
|
|
24647
24647
|
let failed = null;
|
|
24648
24648
|
const walk = async (list, depth) => {
|
|
@@ -27965,6 +27965,8 @@ var FACE_SPACE = {
|
|
|
27965
27965
|
"KoPubWorld\uB3CB\uC6C0\uCCB4 Light": 290
|
|
27966
27966
|
};
|
|
27967
27967
|
var BEFORE_2024_WIDTH = {
|
|
27968
|
+
// TTF 신명조의 대체 큰따옴표 — 원본 PDF의 Haansoft Batang /W 370. 한양신명조 HFT와 별개다.
|
|
27969
|
+
"\uC2E0\uBA85\uC870": { 8220: 370, 8221: 370 },
|
|
27968
27970
|
"\uD734\uBA3C\uBA85\uC870": {
|
|
27969
27971
|
183: 1e3,
|
|
27970
27972
|
8211: 430,
|
|
@@ -49974,7 +49976,7 @@ function findFirst(el, name, depth = 0) {
|
|
|
49974
49976
|
}
|
|
49975
49977
|
var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
|
|
49976
49978
|
var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "curve", "line", "arc", "ole", "textart", ...FORM_TAGS]);
|
|
49977
|
-
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace", "fwSpace"]);
|
|
49979
|
+
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
49978
49980
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
49979
49981
|
function sectionNoteFormats2(p) {
|
|
49980
49982
|
const root = p.ownerDocument?.documentElement;
|
|
@@ -50734,6 +50736,63 @@ function cachedParagraphBottom(lsa, bodyFlow) {
|
|
|
50734
50736
|
return bottom;
|
|
50735
50737
|
}
|
|
50736
50738
|
|
|
50739
|
+
// src/render/reflow-fragments.ts
|
|
50740
|
+
function appendNarrowLineFragments(parent, seg, free, box, flow) {
|
|
50741
|
+
if (!free || !box) return false;
|
|
50742
|
+
const parts = free.filter(([a, b]) => b - a >= 1440);
|
|
50743
|
+
if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
|
|
50744
|
+
const { text, widths, spacings, slots, start, end } = flow;
|
|
50745
|
+
if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
|
|
50746
|
+
let ink = start;
|
|
50747
|
+
while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
|
|
50748
|
+
if (text.slice(ink, end).includes("\u2060")) return false;
|
|
50749
|
+
if (ink === end || parts.slice(0, -1).some(([a, b]) => (widths[ink] ?? 0) - (spacings[ink] ?? 0) <= b - a)) return false;
|
|
50750
|
+
const fragments = [];
|
|
50751
|
+
let cursor = start;
|
|
50752
|
+
for (const [a, b] of parts.slice(0, -1)) {
|
|
50753
|
+
const offset = cursor;
|
|
50754
|
+
let w = 0;
|
|
50755
|
+
while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
|
|
50756
|
+
fragments.push({ offset, x: a, width: b - a });
|
|
50757
|
+
}
|
|
50758
|
+
let rest = 0;
|
|
50759
|
+
for (let i = cursor; i < end; i++) rest += widths[i];
|
|
50760
|
+
let last = end - 1;
|
|
50761
|
+
if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
|
|
50762
|
+
rest -= spacings[last] ?? 0;
|
|
50763
|
+
if (rest > box[1] + 0.5) return false;
|
|
50764
|
+
let next = end;
|
|
50765
|
+
while (next < text.length && text[next] === " ") next++;
|
|
50766
|
+
if (next < text.length && rest + (widths[next] ?? 0) - (spacings[next] ?? 0) <= box[1] + 0.5) return false;
|
|
50767
|
+
fragments.push({ offset: cursor, x: box[0], width: box[1] });
|
|
50768
|
+
fragments.forEach((f, i) => {
|
|
50769
|
+
const part = seg.cloneNode(false);
|
|
50770
|
+
if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
|
|
50771
|
+
part.setAttribute("horzpos", String(f.x));
|
|
50772
|
+
part.setAttribute("horzsize", String(f.width));
|
|
50773
|
+
parent.appendChild(part);
|
|
50774
|
+
});
|
|
50775
|
+
return true;
|
|
50776
|
+
}
|
|
50777
|
+
|
|
50778
|
+
// src/render/reflow-borders.ts
|
|
50779
|
+
function lineBorderBox(model, styles, start, end) {
|
|
50780
|
+
const empty = model.chars.length === 0 && model.objs.length === 0;
|
|
50781
|
+
let top = 0, all = 0;
|
|
50782
|
+
const include = (prId) => {
|
|
50783
|
+
const st = prId != null ? styles.charPr.get(prId) : void 0;
|
|
50784
|
+
const f = st?.borderFill != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
50785
|
+
if (!f || !f.top && !f.bottom) return;
|
|
50786
|
+
const width = (pt3) => empty ? 2 * Math.trunc(pt3 * 50) : Math.trunc(pt3 * 100);
|
|
50787
|
+
const t = f.top ? width(f.top.widthPt) : 0, b = f.bottom ? width(f.bottom.widthPt) : 0;
|
|
50788
|
+
top = Math.max(top, st.height + t);
|
|
50789
|
+
all = Math.max(all, st.height + t + b);
|
|
50790
|
+
};
|
|
50791
|
+
if (empty) for (const run of model.runs) include(run.prId);
|
|
50792
|
+
else for (let i = start; i < end; i++) if (model.chars[i].ch) include(model.chars[i].prId);
|
|
50793
|
+
return [top, all, empty && all > 0];
|
|
50794
|
+
}
|
|
50795
|
+
|
|
50737
50796
|
// src/render/reflow.ts
|
|
50738
50797
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50739
50798
|
var LINESEG_FLAGS = "393216";
|
|
@@ -50798,7 +50857,7 @@ function glyphWidth(ch, st) {
|
|
|
50798
50857
|
const face1 = L?.face ?? st.face;
|
|
50799
50858
|
const face0 = face1 === "Batang" ? st.before2024 ? "\uBC14\uD0D5" : "\uD55C\uCEF4\uBC14\uD0D5" : face1;
|
|
50800
50859
|
const boldFace = !space && st.bold && (L ? L.hft : st.hft) && face0 && fontHasGlyph(`${face0} Bold`, cp) ? `${face0} Bold` : void 0;
|
|
50801
|
-
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 ? BEFORE_2024_WIDTH[face0]?.[cp] : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? BEFORE_2024_WIDTH[face0]?.[cp] : void 0;
|
|
50860
|
+
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 || (L?.face ? L.hft : st.hft))) ? BEFORE_2024_WIDTH[face0]?.[cp] : !st.halfQuote && face0 === "\uD734\uBA3C\uBA85\uC870" && cp === 8231 ? BEFORE_2024_WIDTH[face0]?.[cp] : void 0;
|
|
50802
50861
|
const fc = faceClassForReflow(boldFace ?? face0);
|
|
50803
50862
|
const fsEm = space && st.fontSpace ? fontSpaceEm(st.face) : void 0;
|
|
50804
50863
|
if (fsEm !== void 0) {
|
|
@@ -51018,7 +51077,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51018
51077
|
const hRel = pos?.getAttribute("horzRelTo") ?? "COLUMN", hAlign = pos?.getAttribute("horzAlign") ?? "LEFT";
|
|
51019
51078
|
const ho = num3(pos, "horzOffset"), base = hRel === "PARA" ? marginL : 0, span2 = hRel === "PARA" ? avail : areaW;
|
|
51020
51079
|
const x0 = base + (hAlign === "RIGHT" ? span2 - ho - o.width : hAlign === "CENTER" ? (span2 - o.width) / 2 + ho : ho);
|
|
51021
|
-
const top = startV + vo;
|
|
51080
|
+
const top = startV - (bodyFlow && vertRel === "PARA" && wrapAttr === "SQUARE" ? geom.spaceBefore : 0) + vo;
|
|
51022
51081
|
const omLx = num3(om, "left"), omRx = num3(om, "right");
|
|
51023
51082
|
const xs = hAlign === "RIGHT" ? x0 - omRx : hAlign === "CENTER" ? x0 : x0 + omLx;
|
|
51024
51083
|
const nextPage = pageH > 0 && top + effH + outB > pageH;
|
|
@@ -51152,12 +51211,15 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51152
51211
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51153
51212
|
const li = lineOf(o.index);
|
|
51154
51213
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51214
|
+
if (o.tag === "tbl" && li > 0 && o.omL + o.width + o.omR > (lineWidth?.(li - 1) ?? (li === 1 ? firstWrapWidth : contWidth)) && /^[\u2060\ufdd0]+$/.test(text.slice(wrap.starts[li - 1], wrap.starts[li]))) collisionHeights[li - 1] = Math.max(collisionHeights[li - 1] ?? 0, h);
|
|
51155
51215
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51156
51216
|
if (findChildByLocalName(o.el, "pos")?.getAttribute("affectLSpacing") === "1") lineObjLs[li] = true;
|
|
51157
51217
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
51158
51218
|
lineObjAsc[li] = Math.max(lineObjAsc[li], Math.round(h * (Number.isFinite(bl) ? bl / 100 : BASELINE_RATIO)));
|
|
51159
51219
|
}
|
|
51160
51220
|
const lsa = doc.createElement("hp:linesegarray");
|
|
51221
|
+
const subList = p.parentNode;
|
|
51222
|
+
const verticalCenter = subList?.getAttribute?.("vertAlign") === "CENTER" && ["VERTICAL", "VERTICALALL"].includes(subList.getAttribute("textDirection") ?? "");
|
|
51161
51223
|
let v = textStartV;
|
|
51162
51224
|
let firstAcc = 0;
|
|
51163
51225
|
const textposOf = wrap.starts.map((startReal, li) => li === 0 ? 0 : startReal < realIdx.length ? realIdx[startReal] : realIdx.length ? m.chars.length : 0);
|
|
@@ -51173,40 +51235,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51173
51235
|
const fontLineOf = (li) => {
|
|
51174
51236
|
if (!geom.fontLineHeight) return void 0;
|
|
51175
51237
|
const s = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
|
|
51238
|
+
if (!m.chars.slice(s, e).some((c) => c.ch && c.ch !== " ")) return void 0;
|
|
51176
51239
|
let h = 0, b = 0, any = false;
|
|
51177
51240
|
for (let k = s; k < e; k++) {
|
|
51178
51241
|
const c = m.chars[k];
|
|
51179
|
-
if (!c.ch
|
|
51242
|
+
if (!c.ch) continue;
|
|
51180
51243
|
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51181
51244
|
if (!st) continue;
|
|
51182
51245
|
const cp = c.ch.codePointAt(0);
|
|
51183
|
-
const fm = fontLineMetrics(st.latin && isLatinCp(cp) ? st.latin.face : st.face);
|
|
51246
|
+
const fm = fontLineMetrics(c.ch !== " " && st.latin && isLatinCp(cp) ? st.latin.face : st.face);
|
|
51184
51247
|
any = true;
|
|
51185
51248
|
h = Math.max(h, fm ? Math.round(st.height * fm[0]) + (fm[2] ? Math.round : Math.trunc)(st.height * fm[1]) : st.height);
|
|
51186
51249
|
b = Math.max(b, fm ? Math.round(st.height * fm[0]) : Math.round(st.height * BASELINE_RATIO));
|
|
51187
51250
|
}
|
|
51188
51251
|
return any ? [h, b] : void 0;
|
|
51189
51252
|
};
|
|
51190
|
-
const lineBorderBox = (li) => {
|
|
51191
|
-
const s0 = textposOf[li], e = li === wrap.starts.length - 1 ? m.chars.length : textposOf[li + 1];
|
|
51192
|
-
let top = 0, all = 0;
|
|
51193
|
-
for (let k = s0; k < e; k++) {
|
|
51194
|
-
const c = m.chars[k];
|
|
51195
|
-
if (!c.ch) continue;
|
|
51196
|
-
const st = c.prId != null ? styles.charPr.get(c.prId) : void 0;
|
|
51197
|
-
const f = st?.borderFill != null ? styles.borderFill.get(st.borderFill) : void 0;
|
|
51198
|
-
if (!f || !f.top && !f.bottom) continue;
|
|
51199
|
-
const t = f.top ? Math.trunc(f.top.widthPt * 100) : 0, b = f.bottom ? Math.trunc(f.bottom.widthPt * 100) : 0;
|
|
51200
|
-
top = Math.max(top, st.height + t);
|
|
51201
|
-
all = Math.max(all, st.height + t + b);
|
|
51202
|
-
}
|
|
51203
|
-
return [top, all];
|
|
51204
|
-
};
|
|
51205
51253
|
const natW = widths.reduce((a, w) => a + w, 0) + spacings.reduce((a, w) => a + w, 0);
|
|
51206
51254
|
for (let li = 0; li < wrap.starts.length; li++) {
|
|
51207
51255
|
const textpos = textposOf[li];
|
|
51208
51256
|
const fl = fontLineOf(li);
|
|
51209
|
-
const [boxTop, boxAll] = lineBorderBox(li);
|
|
51257
|
+
const [boxTop, boxAll, emptyBorder] = lineBorderBox(m, styles, textposOf[li], textposOf[li + 1] ?? m.chars.length);
|
|
51210
51258
|
const textH0 = fl ? Math.max(fl[0], lineTextH(li)) : lineTextH(li);
|
|
51211
51259
|
const textH = Math.max(textH0, boxAll);
|
|
51212
51260
|
const objOnly = lineObjH[li] > 0 && lineObjH[li] < textH && (() => {
|
|
@@ -51235,9 +51283,9 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51235
51283
|
const seg = doc.createElement("hp:lineseg");
|
|
51236
51284
|
seg.setAttribute("textpos", String(textpos));
|
|
51237
51285
|
seg.setAttribute("vertpos", String(vertpos));
|
|
51238
|
-
seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51286
|
+
seg.setAttribute("vertsize", String(emptyBorder ? textH0 : occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51239
51287
|
seg.setAttribute("textheight", String(lineH));
|
|
51240
|
-
seg.setAttribute("baseline", String(geom.vertAlign === "TOP" ? 0 : geom.vertAlign === "CENTER" ? Math.floor(lineH / 2) : geom.vertAlign === "BOTTOM" ? lineH : Math.max(fl ? fl[1] : Math.round(textH0 * BASELINE_RATIO), lineObjAsc[li])));
|
|
51288
|
+
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])));
|
|
51241
51289
|
seg.setAttribute("spacing", String(spacing));
|
|
51242
51290
|
let box = boxAt(li);
|
|
51243
51291
|
const fit = wrap.starts.length === 1 && lineObjH[li] === 0 ? lineParts[li]?.filter(([a, b]) => b - a >= 1440) : void 0;
|
|
@@ -51246,6 +51294,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51246
51294
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
51247
51295
|
seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
|
|
51248
51296
|
seg.setAttribute("flags", LINESEG_FLAGS);
|
|
51297
|
+
if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
|
|
51298
|
+
lsa,
|
|
51299
|
+
seg,
|
|
51300
|
+
lineParts[li],
|
|
51301
|
+
box,
|
|
51302
|
+
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: wrap.starts[li + 1] ?? text.length }
|
|
51303
|
+
)) continue;
|
|
51249
51304
|
lsa.appendChild(seg);
|
|
51250
51305
|
for (const [a, b] of parts?.slice(1) ?? []) {
|
|
51251
51306
|
const more = seg.cloneNode(false);
|
|
@@ -52481,6 +52536,49 @@ function shapeGeometry(o, boxX, boxY, defs, images, warn, local = false) {
|
|
|
52481
52536
|
return { ...geometry, svg };
|
|
52482
52537
|
}
|
|
52483
52538
|
|
|
52539
|
+
// src/render/object-anchor.ts
|
|
52540
|
+
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52541
|
+
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
52542
|
+
const pos = findChildByLocalName(o.el, "pos");
|
|
52543
|
+
const om = findChildByLocalName(o.el, "outMargin");
|
|
52544
|
+
const omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
52545
|
+
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
52546
|
+
if (!pos) return { x: ox, y: oy + baseV };
|
|
52547
|
+
const voRaw = num2(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
52548
|
+
const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
|
|
52549
|
+
const ho = num2(pos, "horzOffset");
|
|
52550
|
+
const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
|
|
52551
|
+
const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
|
|
52552
|
+
const va = pos.getAttribute("vertAlign") ?? "TOP";
|
|
52553
|
+
const ha = pos.getAttribute("horzAlign") ?? "LEFT";
|
|
52554
|
+
const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
52555
|
+
let y;
|
|
52556
|
+
if (vrel === "PAPER") {
|
|
52557
|
+
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
52558
|
+
} else if (vrel === "PAGE") {
|
|
52559
|
+
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
52560
|
+
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
52561
|
+
const lineV = anchorLineV ?? baseV;
|
|
52562
|
+
const pushed = lineV - (omT + h + omB);
|
|
52563
|
+
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
52564
|
+
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
52565
|
+
y = oy + anchor + omT + vo;
|
|
52566
|
+
} else {
|
|
52567
|
+
const origin = vrel === "PARA" && wrap === "SQUARE" ? paraStartV ?? baseV : baseV;
|
|
52568
|
+
y = oy + Math.max(origin + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
52569
|
+
}
|
|
52570
|
+
let x;
|
|
52571
|
+
const omL = num2(om, "left"), omR = num2(om, "right");
|
|
52572
|
+
if (hrel === "PAGE") {
|
|
52573
|
+
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52574
|
+
} else if (hrel === "PAPER") {
|
|
52575
|
+
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
|
|
52576
|
+
} else {
|
|
52577
|
+
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52578
|
+
}
|
|
52579
|
+
return { x, y };
|
|
52580
|
+
}
|
|
52581
|
+
|
|
52484
52582
|
// src/render/svg-render.ts
|
|
52485
52583
|
function escapeXml7(s) {
|
|
52486
52584
|
return s.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F]/g, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
@@ -52803,7 +52901,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
|
|
|
52803
52901
|
const stay = tbFloats < 2 && !m.objs.some((q) => q.inline) && !m.chars.some((c) => c.ch !== "" && !c.nb && c.ch.trim() !== "");
|
|
52804
52902
|
const sbA = m.paraPrId != null ? ctx.styles.paraGeom.get(m.paraPrId)?.spaceBefore ?? 0 : 0;
|
|
52805
52903
|
const firstLine = anchorLineV === void 0 || anchorLineV === baseV;
|
|
52806
|
-
let { x, y } = anchorObject(o, ax, oy, objBaseV, aw, ctx, anchorLineV, stay ? sbA : false, firstLine && pTop !== void 0 && pTop < baseV ? pTop : void 0, firstLine ? void 0 : anchorLineH);
|
|
52904
|
+
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);
|
|
52807
52905
|
if (depth === 0 && tbFloats >= 2 && wrapA === "TOP_AND_BOTTOM") {
|
|
52808
52906
|
if (!tbStack) {
|
|
52809
52907
|
tbStack = /* @__PURE__ */ new Map();
|
|
@@ -52840,46 +52938,6 @@ function cellParaTop(p, geom) {
|
|
|
52840
52938
|
const last = segs[segs.length - 1];
|
|
52841
52939
|
return num2(last, "vertpos") + num2(last, "vertsize") + num2(last, "spacing") + (geom.get(prev.getAttribute("paraPrIDRef") ?? "")?.spaceAfter ?? 0);
|
|
52842
52940
|
}
|
|
52843
|
-
function anchorObject(o, ox, oy, baseV, areaW, ctx, anchorLineV, stayLine = false, paraStartV, laterLineH) {
|
|
52844
|
-
const { PW, PH, ML, MT, BODY_W, BODY_H } = ctx.geom;
|
|
52845
|
-
const pos = findChildByLocalName(o.el, "pos");
|
|
52846
|
-
const om = findChildByLocalName(o.el, "outMargin");
|
|
52847
|
-
const omT = num2(om, "top"), omB = num2(om, "bottom");
|
|
52848
|
-
const w = o.width, h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, ctx.extentMemo)) : o.height;
|
|
52849
|
-
if (!pos) return { x: ox, y: oy + baseV };
|
|
52850
|
-
const voRaw = num2(pos, "vertOffset"), voS = voRaw >= 2 ** 31 ? voRaw - 2 ** 32 : voRaw;
|
|
52851
|
-
const vo = (pos.getAttribute("vertRelTo") ?? "PARA") === "PARA" ? Math.max(0, voS) : voS;
|
|
52852
|
-
const ho = num2(pos, "horzOffset");
|
|
52853
|
-
const vrel = pos.getAttribute("vertRelTo") ?? "PARA";
|
|
52854
|
-
const hrel = pos.getAttribute("horzRelTo") ?? "PARA";
|
|
52855
|
-
const va = pos.getAttribute("vertAlign") ?? "TOP";
|
|
52856
|
-
const ha = pos.getAttribute("horzAlign") ?? "LEFT";
|
|
52857
|
-
const wrap = o.el.getAttribute("textWrap") ?? "TOP_AND_BOTTOM";
|
|
52858
|
-
let y;
|
|
52859
|
-
if (vrel === "PAPER") {
|
|
52860
|
-
y = va === "BOTTOM" ? PH - h - vo - omB : va === "CENTER" ? (PH - h) / 2 + vo : vo + omT;
|
|
52861
|
-
} else if (vrel === "PAGE") {
|
|
52862
|
-
y = va === "BOTTOM" ? MT + BODY_H - h - vo : va === "CENTER" ? MT + (BODY_H - h) / 2 + vo : MT + vo;
|
|
52863
|
-
} else if (wrap === "TOP_AND_BOTTOM") {
|
|
52864
|
-
const lineV = anchorLineV ?? baseV;
|
|
52865
|
-
const pushed = lineV - (omT + h + omB);
|
|
52866
|
-
const below = laterLineH !== void 0 && vo + omT >= laterLineH;
|
|
52867
|
-
const anchor = below ? lineV : stayLine !== false ? lineV - stayLine : pushed >= -100 ? pushed : paraStartV !== void 0 ? paraStartV : lineV;
|
|
52868
|
-
y = oy + anchor + omT + vo;
|
|
52869
|
-
} else {
|
|
52870
|
-
y = oy + Math.max(baseV + vo, wrap === "SQUARE" && anchorLineV !== void 0 ? anchorLineV : -Infinity) + omT;
|
|
52871
|
-
}
|
|
52872
|
-
let x;
|
|
52873
|
-
const omL = num2(om, "left"), omR = num2(om, "right");
|
|
52874
|
-
if (hrel === "PAGE") {
|
|
52875
|
-
x = ha === "RIGHT" ? ML + BODY_W - w - ho - omR : ha === "CENTER" ? ML + (BODY_W - w) / 2 + ho : ML + ho + omL;
|
|
52876
|
-
} else if (hrel === "PAPER") {
|
|
52877
|
-
x = (ha === "RIGHT" ? PW - w - ho - omR : ha === "CENTER" ? (PW - w) / 2 + ho : ho + omL) - (ctx.bodyDx?.(ctx.page) ?? 0);
|
|
52878
|
-
} else {
|
|
52879
|
-
x = ha === "RIGHT" ? ox + areaW - w - ho - omR : ha === "CENTER" ? ox + (areaW - w) / 2 + ho : ox + ho + omL;
|
|
52880
|
-
}
|
|
52881
|
-
return { x, y };
|
|
52882
|
-
}
|
|
52883
52941
|
function drawObject(o, x, y, baseV, areaW, ctx, depth) {
|
|
52884
52942
|
if (!o.inline && depth === 0 && ctx.paintJobs) {
|
|
52885
52943
|
const wrap = o.el.getAttribute("textWrap");
|
|
@@ -54783,7 +54841,7 @@ function scriptsOff(r, off) {
|
|
|
54783
54841
|
}
|
|
54784
54842
|
async function parseImage(buffer, options) {
|
|
54785
54843
|
try {
|
|
54786
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
54844
|
+
const { parseImageDocument } = await import("./image-ocr-RASJHOAK.js");
|
|
54787
54845
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54788
54846
|
stripScriptTags({ blocks });
|
|
54789
54847
|
return {
|
|
@@ -54847,7 +54905,7 @@ async function parseHwp(buffer, options) {
|
|
|
54847
54905
|
async function parsePdf(buffer, options) {
|
|
54848
54906
|
let parsePdfDocument;
|
|
54849
54907
|
try {
|
|
54850
|
-
const mod = await import("./parser-
|
|
54908
|
+
const mod = await import("./parser-DR6ZHYEB.js");
|
|
54851
54909
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54852
54910
|
} catch {
|
|
54853
54911
|
return {
|