kordoc 4.22.1 → 4.22.3
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 +12 -5
- package/dist/{-FYKHW5G6.js → -AOWV7MNY.js} +11 -11
- package/dist/{chunk-QH4B3PL7.js → chunk-24YLYR6Q.js} +4 -4
- package/dist/{chunk-OSFB5SQS.cjs → chunk-2BCQVQO2.cjs} +3 -3
- package/dist/{chunk-OSFB5SQS.cjs.map → chunk-2BCQVQO2.cjs.map} +1 -1
- package/dist/{chunk-5VBAHUGC.js → chunk-3ANXRVI2.js} +3 -3
- package/dist/{chunk-IB5TO2CO.js → chunk-3H2IEU4V.js} +2 -2
- package/dist/{chunk-MDS3GH43.js → chunk-4NQ4EZEE.js} +14 -4
- package/dist/chunk-4NQ4EZEE.js.map +1 -0
- package/dist/{chunk-7FASIFQP.js → chunk-6LIBF2ZB.js} +2 -2
- package/dist/{chunk-5SVJU22Z.js → chunk-6QBBGZST.js} +2 -2
- package/dist/{chunk-YE4IN3D7.js → chunk-7XITVUAK.js} +11 -11
- package/dist/{chunk-M4JC7TXG.js → chunk-AXX5AQT4.js} +4 -4
- package/dist/{chunk-AIAIBNIB.js → chunk-BS2XWGT5.js} +2 -2
- package/dist/{chunk-TSZQ4LMV.js → chunk-DKJ2RNDG.js} +2 -2
- package/dist/{chunk-7RND4SNB.js → chunk-FDFXL7VJ.js} +3 -3
- package/dist/{chunk-3SPOIAST.js → chunk-IRNWAHHZ.js} +2 -2
- package/dist/{chunk-SMPK5TUQ.js → chunk-J5PYESLX.js} +14 -4
- package/dist/chunk-J5PYESLX.js.map +1 -0
- package/dist/{chunk-5FD3LAKC.js → chunk-KBGNPGVY.js} +2 -2
- package/dist/{chunk-DOBJ7BW5.js → chunk-M2X766AY.js} +2 -2
- package/dist/{chunk-ME4NQSLE.js → chunk-MEIQ476H.js} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs → chunk-MI655NV5.cjs} +2 -2
- package/dist/{chunk-M2CBEXHN.cjs.map → chunk-MI655NV5.cjs.map} +1 -1
- package/dist/{chunk-EXVTF6XE.cjs → chunk-NJEMRAIF.cjs} +24 -24
- package/dist/{chunk-EXVTF6XE.cjs.map → chunk-NJEMRAIF.cjs.map} +1 -1
- package/dist/{chunk-ZECSXHYP.cjs → chunk-NLGOMLGU.cjs} +188 -166
- package/dist/{chunk-ZECSXHYP.cjs.map → chunk-NLGOMLGU.cjs.map} +1 -1
- package/dist/{chunk-B35C5HJK.cjs → chunk-O3OS6FAW.cjs} +3 -3
- package/dist/{chunk-B35C5HJK.cjs.map → chunk-O3OS6FAW.cjs.map} +1 -1
- package/dist/{chunk-3H5QG6I2.js → chunk-O5E25RHU.js} +2 -2
- package/dist/{chunk-MGJYVNDX.js → chunk-OIF5HRVP.js} +29 -7
- package/dist/{chunk-JHHXTNZQ.js.map → chunk-OIF5HRVP.js.map} +1 -1
- package/dist/{chunk-RO7AORMO.cjs → chunk-SJ5OZXEL.cjs} +23 -13
- package/dist/chunk-SJ5OZXEL.cjs.map +1 -0
- package/dist/{chunk-JHHXTNZQ.js → chunk-SKRWKVVW.js} +28 -6
- package/dist/chunk-SKRWKVVW.js.map +1 -0
- package/dist/{chunk-LHO7E3RW.js → chunk-UCLDUUBX.js} +2 -2
- package/dist/{chunk-IK4W2M4P.js → chunk-VJCQOSMT.js} +2 -2
- package/dist/{chunk-ATODI25J.js → chunk-X45Q7EAC.js} +2 -2
- package/dist/{chunk-R37TFXMP.js → chunk-YOGMCRM7.js} +108 -29
- package/dist/chunk-YOGMCRM7.js.map +1 -0
- package/dist/chunks-7KXTS7IV.js +10 -0
- package/dist/cli.js +30 -30
- package/dist/{formula-PYDSQGLS.cjs → formula-5V2WG4BH.cjs} +9 -9
- package/dist/{formula-PYDSQGLS.cjs.map → formula-5V2WG4BH.cjs.map} +1 -1
- package/dist/{formula-RUS4SF3O.js → formula-C26FMMGO.js} +3 -3
- package/dist/{formula-JBTYYSKB.js → formula-W4OL33YQ.js} +4 -4
- package/dist/{image-ocr-PLNNCEOR.cjs → image-ocr-BELHEWPX.cjs} +17 -17
- package/dist/{image-ocr-PLNNCEOR.cjs.map → image-ocr-BELHEWPX.cjs.map} +1 -1
- package/dist/{image-ocr-QJT4EIQU.js → image-ocr-NSQ34Y6T.js} +9 -9
- package/dist/{image-ocr-VA6WV6E4.js → image-ocr-T72HMX2W.js} +6 -6
- package/dist/index.cjs +507 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +108 -29
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +22 -22
- package/dist/{model-bundle-U2YY7ATC.js → model-bundle-34T2LJB4.js} +5 -5
- package/dist/{models-BOJ2SFCR.js → models-TQH5EM6V.js} +5 -5
- package/dist/{parse-worker-v2-ZHMFK3U3.js → parse-worker-v2-YEYLILGJ.js} +12 -12
- package/dist/{parser-A2EWLK2J.js → parser-E6BG3ECD.js} +133 -27
- package/dist/parser-E6BG3ECD.js.map +1 -0
- package/dist/{parser-6337Z4U2.cjs → parser-OAXCXVQ4.cjs} +383 -277
- package/dist/parser-OAXCXVQ4.cjs.map +1 -0
- package/dist/{parser-HM6N7J4R.js → parser-SJHCBL7T.js} +136 -30
- package/dist/parser-SJHCBL7T.js.map +1 -0
- package/dist/{pdf-ocr-JDER5BHI.js → pdf-ocr-LGPSJM22.js} +6 -6
- package/dist/pdf-ocr-RKXDY3ZA.cjs +31 -0
- package/dist/{pdf-ocr-PGXNUFU7.cjs.map → pdf-ocr-RKXDY3ZA.cjs.map} +1 -1
- package/dist/{pdf-ocr-MEVC6HXG.js → pdf-ocr-T5ASSUKK.js} +9 -9
- package/dist/{profile-io-OJ23SPYO.js → profile-io-KMCAFTMG.js} +3 -3
- package/dist/{rasterize-76CWCLSU.js → rasterize-M52AKY7R.js} +3 -3
- package/dist/{redact-doc-EZQIHRVT.js → redact-doc-SWJC27LL.js} +11 -11
- package/dist/{render-JZFJPFWK.js → render-45AB5YZR.js} +7 -7
- package/dist/seal-7KWG6VHS.js +10 -0
- package/dist/{setup-RIVS74JN.js → setup-5PBMUI6M.js} +3 -3
- package/dist/visual-OMJNXLNZ.js +21 -0
- package/dist/{watch-WMH222E5.js → watch-QOGKV52T.js} +12 -12
- package/package.json +1 -1
- package/dist/chunk-MDS3GH43.js.map +0 -1
- package/dist/chunk-MGJYVNDX.js.map +0 -1
- package/dist/chunk-R37TFXMP.js.map +0 -1
- package/dist/chunk-RO7AORMO.cjs.map +0 -1
- package/dist/chunk-SMPK5TUQ.js.map +0 -1
- package/dist/chunks-4XIAEJEX.js +0 -10
- package/dist/parser-6337Z4U2.cjs.map +0 -1
- package/dist/parser-A2EWLK2J.js.map +0 -1
- package/dist/parser-HM6N7J4R.js.map +0 -1
- package/dist/pdf-ocr-PGXNUFU7.cjs +0 -31
- package/dist/seal-P2NOP4LC.js +0 -10
- package/dist/visual-R5GGZBTU.js +0 -21
- /package/dist/{-FYKHW5G6.js.map → -AOWV7MNY.js.map} +0 -0
- /package/dist/{chunk-QH4B3PL7.js.map → chunk-24YLYR6Q.js.map} +0 -0
- /package/dist/{chunk-5VBAHUGC.js.map → chunk-3ANXRVI2.js.map} +0 -0
- /package/dist/{chunk-IB5TO2CO.js.map → chunk-3H2IEU4V.js.map} +0 -0
- /package/dist/{chunk-7FASIFQP.js.map → chunk-6LIBF2ZB.js.map} +0 -0
- /package/dist/{chunk-5SVJU22Z.js.map → chunk-6QBBGZST.js.map} +0 -0
- /package/dist/{chunk-YE4IN3D7.js.map → chunk-7XITVUAK.js.map} +0 -0
- /package/dist/{chunk-M4JC7TXG.js.map → chunk-AXX5AQT4.js.map} +0 -0
- /package/dist/{chunk-AIAIBNIB.js.map → chunk-BS2XWGT5.js.map} +0 -0
- /package/dist/{chunk-TSZQ4LMV.js.map → chunk-DKJ2RNDG.js.map} +0 -0
- /package/dist/{chunk-7RND4SNB.js.map → chunk-FDFXL7VJ.js.map} +0 -0
- /package/dist/{chunk-3SPOIAST.js.map → chunk-IRNWAHHZ.js.map} +0 -0
- /package/dist/{chunk-5FD3LAKC.js.map → chunk-KBGNPGVY.js.map} +0 -0
- /package/dist/{chunk-DOBJ7BW5.js.map → chunk-M2X766AY.js.map} +0 -0
- /package/dist/{chunk-ME4NQSLE.js.map → chunk-MEIQ476H.js.map} +0 -0
- /package/dist/{chunk-3H5QG6I2.js.map → chunk-O5E25RHU.js.map} +0 -0
- /package/dist/{chunk-LHO7E3RW.js.map → chunk-UCLDUUBX.js.map} +0 -0
- /package/dist/{chunk-IK4W2M4P.js.map → chunk-VJCQOSMT.js.map} +0 -0
- /package/dist/{chunk-ATODI25J.js.map → chunk-X45Q7EAC.js.map} +0 -0
- /package/dist/{chunks-4XIAEJEX.js.map → chunks-7KXTS7IV.js.map} +0 -0
- /package/dist/{formula-RUS4SF3O.js.map → formula-C26FMMGO.js.map} +0 -0
- /package/dist/{formula-JBTYYSKB.js.map → formula-W4OL33YQ.js.map} +0 -0
- /package/dist/{image-ocr-QJT4EIQU.js.map → image-ocr-NSQ34Y6T.js.map} +0 -0
- /package/dist/{image-ocr-VA6WV6E4.js.map → image-ocr-T72HMX2W.js.map} +0 -0
- /package/dist/{model-bundle-U2YY7ATC.js.map → model-bundle-34T2LJB4.js.map} +0 -0
- /package/dist/{models-BOJ2SFCR.js.map → models-TQH5EM6V.js.map} +0 -0
- /package/dist/{parse-worker-v2-ZHMFK3U3.js.map → parse-worker-v2-YEYLILGJ.js.map} +0 -0
- /package/dist/{pdf-ocr-JDER5BHI.js.map → pdf-ocr-LGPSJM22.js.map} +0 -0
- /package/dist/{pdf-ocr-MEVC6HXG.js.map → pdf-ocr-T5ASSUKK.js.map} +0 -0
- /package/dist/{profile-io-OJ23SPYO.js.map → profile-io-KMCAFTMG.js.map} +0 -0
- /package/dist/{rasterize-76CWCLSU.js.map → rasterize-M52AKY7R.js.map} +0 -0
- /package/dist/{redact-doc-EZQIHRVT.js.map → redact-doc-SWJC27LL.js.map} +0 -0
- /package/dist/{render-JZFJPFWK.js.map → render-45AB5YZR.js.map} +0 -0
- /package/dist/{seal-P2NOP4LC.js.map → seal-7KWG6VHS.js.map} +0 -0
- /package/dist/{setup-RIVS74JN.js.map → setup-5PBMUI6M.js.map} +0 -0
- /package/dist/{visual-R5GGZBTU.js.map → visual-OMJNXLNZ.js.map} +0 -0
- /package/dist/{watch-WMH222E5.js.map → watch-QOGKV52T.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-IRNWAHHZ.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-J5PYESLX.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-X45Q7EAC.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-T72HMX2W.js");
|
|
24646
24646
|
let inserted = false, unreadable = 0;
|
|
24647
24647
|
let failed = null;
|
|
24648
24648
|
const walk = async (list, depth) => {
|
|
@@ -35431,21 +35431,22 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
|
|
|
35431
35431
|
var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
|
|
35432
35432
|
var HANCOM_FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;>?]^`}~\xB0\xB7\u3009\u300B\u300D\u300F\u3011\u3015\u3017\u3019\u301B\u30FB\uFF01\uFF05\uFF09\uFF0C\uFF0E\uFF1A\uFF1B\uFF1E\uFF1F\uFF3D\uFF3E\uFF40\uFF5D\uFF5E\uFF65\u3041\u3043\u3045\u3047\u3049\u3063\u3083\u3085\u3087\u308E\u30A1\u30A3\u30A5\u30A7\u30A9\u30C3\u30E3\u30E5\u30E7\u30EE\u30F5\u30F6\u3001\u3002\u3003\u3005\u30FC\u309B\u309C\u309D\u309E\u30FD\u30FE\u2019\u201D\u2024\u2025\u2026\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u2037\u2103\u2109"]);
|
|
35433
35433
|
var HANCOM_FORBID_END = /* @__PURE__ */ new Set([..."(<[\\{\xA7\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\u3016\u3018\u301A\uFF04\uFF08\uFF1C\uFF3B\uFF3C\uFF5B\uFFE0\uFFE1\uFFE5\uFFE6$\xA2\xA3\xA4\xA5\u09F2\u09F3\u0E3F", ...Array.from({ length: 13 }, (_, i) => String.fromCharCode(8352 + i))]);
|
|
35434
|
+
var isWrapSpace = (ch) => ch === " " || ch === "\u2005";
|
|
35434
35435
|
function prepareWrap(text, mode, opts) {
|
|
35435
35436
|
const widthEm = widthFnOf(opts?.faceClass), spaceEm = opts?.spaceEm ?? SPACE_EM_FIXED;
|
|
35436
35437
|
const advances = [], steps = [];
|
|
35437
35438
|
let i = 0;
|
|
35438
35439
|
for (const ch of text) {
|
|
35439
35440
|
const cp = ch.codePointAt(0);
|
|
35440
|
-
advances[i] = isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35441
|
+
advances[i] = cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp);
|
|
35441
35442
|
steps[i] = ch.length;
|
|
35442
35443
|
i += ch.length;
|
|
35443
35444
|
}
|
|
35444
35445
|
return { units: splitWrapUnits(text, mode), advances, steps };
|
|
35445
35446
|
}
|
|
35446
35447
|
function splitWrapUnits(text, mode, latinBreak = false) {
|
|
35447
|
-
if (latinBreak) return text.match(mode === "keep" ? / +|[\x21-\x7e]|[^ \x21-\x7e]+/gu : / +|[^ ](?:\u00a0[^ \u00a0]?)*/gu) ?? [];
|
|
35448
|
-
return text.match(mode === "keep" ? / +|\ufdd0+(?=[^ \ufdd0])|[^ ]+/gu : / +|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ ])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u00a0])?)*/gu) ?? [];
|
|
35448
|
+
if (latinBreak) return text.match(mode === "keep" ? /[ \u2005]+|[\x21-\x7e]|[^ \u2005\x21-\x7e]+/gu : /[ \u2005]+|[^ \u2005](?:\u00a0[^ \u2005\u00a0]?)*/gu) ?? [];
|
|
35449
|
+
return text.match(mode === "keep" ? /[ \u2005]+|\ufdd0+(?=[^ \u2005\ufdd0])|[^ \u2005]+/gu : /[ \u2005]+|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u2005\u00a0])?)*/gu) ?? [];
|
|
35449
35450
|
}
|
|
35450
35451
|
function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
|
|
35451
35452
|
if (!opts?.prepared && text.includes("\n")) {
|
|
@@ -35492,7 +35493,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35492
35493
|
if (unitW) return (unitW[i] ?? 0) + (ch.length === 2 ? unitW[i + 1] ?? 0 : 0);
|
|
35493
35494
|
if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
|
|
35494
35495
|
const cp = ch.codePointAt(0);
|
|
35495
|
-
return (isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35496
|
+
return (cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
|
|
35496
35497
|
};
|
|
35497
35498
|
const rangeW = (from, to) => {
|
|
35498
35499
|
let w = 0;
|
|
@@ -35525,11 +35526,11 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35525
35526
|
const u = text[unitPos];
|
|
35526
35527
|
const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
|
|
35527
35528
|
const old = opts?.before2024;
|
|
35528
|
-
const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && u
|
|
35529
|
+
const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && !isWrapSpace(u) && !isWrapSpace(text[bp - 1]);
|
|
35529
35530
|
const inWord = old && splitIn;
|
|
35530
|
-
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35531
|
+
if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) {
|
|
35531
35532
|
bp = prevStart(bp);
|
|
35532
|
-
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && text[bp - 1]
|
|
35533
|
+
if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) bp = prevStart(bp);
|
|
35533
35534
|
}
|
|
35534
35535
|
while (!inWord && bp - 1 >= lineStart() && forbidEnd.has(text[bp - 1])) bp--;
|
|
35535
35536
|
if (bp <= lineStart()) bp = unitPos;
|
|
@@ -35540,8 +35541,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35540
35541
|
lineEnded = false;
|
|
35541
35542
|
placed = unitPos > bp ? 1 : 0;
|
|
35542
35543
|
for (let i = bp; i < unitPos; i++) {
|
|
35543
|
-
if (text[i]
|
|
35544
|
-
else if (condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
|
|
35544
|
+
if (!isWrapSpace(text[i])) realSeen = true;
|
|
35545
|
+
else if (text[i] === " " && condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
|
|
35545
35546
|
}
|
|
35546
35547
|
lineW = rangeW(bp, unitPos) + w;
|
|
35547
35548
|
};
|
|
@@ -35555,16 +35556,16 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35555
35556
|
lineW = leadW;
|
|
35556
35557
|
};
|
|
35557
35558
|
for (const u of units) {
|
|
35558
|
-
if (u[0]
|
|
35559
|
+
if (isWrapSpace(u[0])) {
|
|
35559
35560
|
if (hancom) {
|
|
35560
35561
|
let k2 = 0;
|
|
35561
35562
|
for (; k2 < u.length; k2++) {
|
|
35562
35563
|
if (!lineEnded && lineW >= avail) lineEnded = true;
|
|
35563
|
-
if (lineEnded && k2 >= 2 && pos + k2 > lineStart()) break;
|
|
35564
|
+
if (lineEnded && (k2 >= 2 || u[k2] === "\u2005") && pos + k2 > lineStart()) break;
|
|
35564
35565
|
if (!lineEnded) {
|
|
35565
35566
|
const sw2 = rangeW(pos + k2, pos + k2 + 1);
|
|
35566
35567
|
lineW += sw2;
|
|
35567
|
-
if (realSeen) spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
|
|
35568
|
+
if (realSeen && u[k2] === " ") spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
|
|
35568
35569
|
}
|
|
35569
35570
|
}
|
|
35570
35571
|
if (k2 < u.length) breakAt(pos + k2, rangeW(pos + k2, pos + u.length));
|
|
@@ -35573,7 +35574,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
|
|
|
35573
35574
|
}
|
|
35574
35575
|
const sw = rangeW(pos, pos + u.length);
|
|
35575
35576
|
lineW += sw;
|
|
35576
|
-
spaceW +=
|
|
35577
|
+
for (let k2 = 0; k2 < u.length; k2++) if (u[k2] === " ") spaceW += rangeW(pos + k2, pos + k2 + 1);
|
|
35577
35578
|
pos += u.length;
|
|
35578
35579
|
continue;
|
|
35579
35580
|
}
|
|
@@ -49973,7 +49974,7 @@ function findFirst(el, name, depth = 0) {
|
|
|
49973
49974
|
}
|
|
49974
49975
|
var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
|
|
49975
49976
|
var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "curve", "line", "arc", "ole", "textart", ...FORM_TAGS]);
|
|
49976
|
-
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace", "fwSpace"]);
|
|
49977
|
+
var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
|
|
49977
49978
|
var noteFmtCache = /* @__PURE__ */ new WeakMap();
|
|
49978
49979
|
function sectionNoteFormats2(p) {
|
|
49979
49980
|
const root = p.ownerDocument?.documentElement;
|
|
@@ -50718,6 +50719,60 @@ function nextParaNumber(counters, geom) {
|
|
|
50718
50719
|
});
|
|
50719
50720
|
}
|
|
50720
50721
|
|
|
50722
|
+
// src/render/reflow-cache.ts
|
|
50723
|
+
function cachedParagraphBottom(lsa, bodyFlow) {
|
|
50724
|
+
let bottom = Number.NEGATIVE_INFINITY, previousV = Number.NEGATIVE_INFINITY;
|
|
50725
|
+
for (let i = 0; i < lsa.childNodes.length; i++) {
|
|
50726
|
+
const seg = lsa.childNodes[i];
|
|
50727
|
+
if (seg.nodeType !== 1 || seg.localName !== "lineseg") continue;
|
|
50728
|
+
const num4 = (name, fallback = 0) => toInt32(seg.getAttribute(name) ?? void 0, fallback);
|
|
50729
|
+
const v = num4("vertpos");
|
|
50730
|
+
if (bodyFlow && v < previousV) bottom = Number.NEGATIVE_INFINITY;
|
|
50731
|
+
bottom = Math.max(bottom, v + Math.max(num4("vertsize", 1e3), num4("textheight", 1e3)) + num4("spacing"));
|
|
50732
|
+
previousV = v;
|
|
50733
|
+
}
|
|
50734
|
+
return bottom;
|
|
50735
|
+
}
|
|
50736
|
+
|
|
50737
|
+
// src/render/reflow-fragments.ts
|
|
50738
|
+
function appendNarrowLineFragments(parent, seg, free, box, flow) {
|
|
50739
|
+
if (!free || !box) return false;
|
|
50740
|
+
const parts = free.filter(([a, b]) => b - a >= 1440);
|
|
50741
|
+
if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
|
|
50742
|
+
const { text, widths, spacings, slots, start, end } = flow;
|
|
50743
|
+
if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
|
|
50744
|
+
let ink = start;
|
|
50745
|
+
while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
|
|
50746
|
+
if (text.slice(ink, end).includes("\u2060")) return false;
|
|
50747
|
+
if (ink === end || parts.slice(0, -1).some(([a, b]) => (widths[ink] ?? 0) - (spacings[ink] ?? 0) <= b - a)) return false;
|
|
50748
|
+
const fragments = [];
|
|
50749
|
+
let cursor = start;
|
|
50750
|
+
for (const [a, b] of parts.slice(0, -1)) {
|
|
50751
|
+
const offset = cursor;
|
|
50752
|
+
let w = 0;
|
|
50753
|
+
while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
|
|
50754
|
+
fragments.push({ offset, x: a, width: b - a });
|
|
50755
|
+
}
|
|
50756
|
+
let rest = 0;
|
|
50757
|
+
for (let i = cursor; i < end; i++) rest += widths[i];
|
|
50758
|
+
let last = end - 1;
|
|
50759
|
+
if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
|
|
50760
|
+
rest -= spacings[last] ?? 0;
|
|
50761
|
+
if (rest > box[1] + 0.5) return false;
|
|
50762
|
+
let next = end;
|
|
50763
|
+
while (next < text.length && text[next] === " ") next++;
|
|
50764
|
+
if (next < text.length && rest + (widths[next] ?? 0) - (spacings[next] ?? 0) <= box[1] + 0.5) return false;
|
|
50765
|
+
fragments.push({ offset: cursor, x: box[0], width: box[1] });
|
|
50766
|
+
fragments.forEach((f, i) => {
|
|
50767
|
+
const part = seg.cloneNode(false);
|
|
50768
|
+
if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
|
|
50769
|
+
part.setAttribute("horzpos", String(f.x));
|
|
50770
|
+
part.setAttribute("horzsize", String(f.width));
|
|
50771
|
+
parent.appendChild(part);
|
|
50772
|
+
});
|
|
50773
|
+
return true;
|
|
50774
|
+
}
|
|
50775
|
+
|
|
50721
50776
|
// src/render/reflow.ts
|
|
50722
50777
|
var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
|
|
50723
50778
|
var LINESEG_FLAGS = "393216";
|
|
@@ -51039,10 +51094,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51039
51094
|
}
|
|
51040
51095
|
const lineBox = [];
|
|
51041
51096
|
const lineParts = [];
|
|
51097
|
+
const collisionHeights = [];
|
|
51042
51098
|
const boxAt = (i) => {
|
|
51043
51099
|
if (!zones.length) return void 0;
|
|
51044
51100
|
if (i in lineBox) return lineBox[i];
|
|
51045
|
-
const y0 = textStartV + i * pitch, y1 = y0 + height;
|
|
51101
|
+
const y0 = textStartV + i * pitch, y1 = y0 + Math.max(height, collisionHeights[i] ?? 0);
|
|
51046
51102
|
let free = [[marginL, marginL + avail]], hit = false, flow = "BOTH_SIDES";
|
|
51047
51103
|
for (const z of zones) {
|
|
51048
51104
|
if (!(y1 > z.top && y0 < z.bottom)) continue;
|
|
@@ -51102,7 +51158,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51102
51158
|
lineParts.length = 0;
|
|
51103
51159
|
}
|
|
51104
51160
|
}
|
|
51105
|
-
const
|
|
51161
|
+
const wrapLines = () => text.length === 0 ? { lines: 1, starts: [0], lastLineWidth: 0 } : simulateWrap(text, firstWrapWidth, contWidth, height, 100, paraMode, { widths, spacings, condensePct: condenseUse, kinsoku: "hancom", before2024: styles.before2024, lineWidth, latinBreak: geom.latinBreak, rightTabs });
|
|
51162
|
+
let wrap = wrapLines();
|
|
51163
|
+
if (zones.length) for (let pass = 0; pass < text.length; pass++) {
|
|
51164
|
+
let changed = false;
|
|
51165
|
+
for (const o of m.objs) if (o.inline) {
|
|
51166
|
+
const k = realIdx.indexOf(o.index), om = findChildByLocalName(o.el, "outMargin");
|
|
51167
|
+
if (k < 0) continue;
|
|
51168
|
+
let li = 0;
|
|
51169
|
+
for (let j = 1; j < wrap.starts.length; j++) if (wrap.starts[j] <= k) li = j;
|
|
51170
|
+
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51171
|
+
if (h > Math.max(height, collisionHeights[li] ?? 0)) {
|
|
51172
|
+
collisionHeights[li] = h;
|
|
51173
|
+
changed = true;
|
|
51174
|
+
}
|
|
51175
|
+
}
|
|
51176
|
+
if (!changed) break;
|
|
51177
|
+
lineBox.length = 0;
|
|
51178
|
+
lineParts.length = 0;
|
|
51179
|
+
wrap = wrapLines();
|
|
51180
|
+
}
|
|
51106
51181
|
const lineObjH = new Array(wrap.starts.length).fill(0);
|
|
51107
51182
|
const lineObjAsc = new Array(wrap.starts.length).fill(0);
|
|
51108
51183
|
const lineObjLs = new Array(wrap.starts.length).fill(false);
|
|
@@ -51116,6 +51191,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51116
51191
|
const om = findChildByLocalName(o.el, "outMargin");
|
|
51117
51192
|
const li = lineOf(o.index);
|
|
51118
51193
|
const h = num3(om, "top") + effHOf(o) + num3(om, "bottom");
|
|
51194
|
+
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);
|
|
51119
51195
|
lineObjH[li] = Math.max(lineObjH[li], h);
|
|
51120
51196
|
if (findChildByLocalName(o.el, "pos")?.getAttribute("affectLSpacing") === "1") lineObjLs[li] = true;
|
|
51121
51197
|
const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
|
|
@@ -51193,12 +51269,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51193
51269
|
}
|
|
51194
51270
|
}
|
|
51195
51271
|
const vertpos = v;
|
|
51272
|
+
const occupiedH = Math.max(lineH, collisionHeights[li] ?? 0);
|
|
51196
51273
|
v += lineH + spacing;
|
|
51197
51274
|
const isFirst = li === 0;
|
|
51198
51275
|
const seg = doc.createElement("hp:lineseg");
|
|
51199
51276
|
seg.setAttribute("textpos", String(textpos));
|
|
51200
51277
|
seg.setAttribute("vertpos", String(vertpos));
|
|
51201
|
-
seg.setAttribute("vertsize", String(
|
|
51278
|
+
seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
|
|
51202
51279
|
seg.setAttribute("textheight", String(lineH));
|
|
51203
51280
|
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])));
|
|
51204
51281
|
seg.setAttribute("spacing", String(spacing));
|
|
@@ -51209,6 +51286,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
|
|
|
51209
51286
|
seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
|
|
51210
51287
|
seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
|
|
51211
51288
|
seg.setAttribute("flags", LINESEG_FLAGS);
|
|
51289
|
+
if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
|
|
51290
|
+
lsa,
|
|
51291
|
+
seg,
|
|
51292
|
+
lineParts[li],
|
|
51293
|
+
box,
|
|
51294
|
+
{ text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: wrap.starts[li + 1] ?? text.length }
|
|
51295
|
+
)) continue;
|
|
51212
51296
|
lsa.appendChild(seg);
|
|
51213
51297
|
for (const [a, b] of parts?.slice(1) ?? []) {
|
|
51214
51298
|
const more = seg.cloneNode(false);
|
|
@@ -51381,12 +51465,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
|
|
|
51381
51465
|
if (!res) {
|
|
51382
51466
|
const lsa = findChildByLocalName(p, "linesegarray");
|
|
51383
51467
|
if (lsa) {
|
|
51384
|
-
|
|
51385
|
-
for (const seg of elements2(lsa)) {
|
|
51386
|
-
if (ln2(seg) !== "lineseg") continue;
|
|
51387
|
-
const th = Math.max(num3(seg, "vertsize", 1e3), num3(seg, "textheight", 1e3));
|
|
51388
|
-
bottom = Math.max(bottom, num3(seg, "vertpos") + th + num3(seg, "spacing"));
|
|
51389
|
-
}
|
|
51468
|
+
const bottom = cachedParagraphBottom(lsa, bodyFlow);
|
|
51390
51469
|
if (Number.isFinite(bottom)) {
|
|
51391
51470
|
cursorV = bottom;
|
|
51392
51471
|
prevSpaceAfter = g3?.spaceAfter ?? 0;
|
|
@@ -54751,7 +54830,7 @@ function scriptsOff(r, off) {
|
|
|
54751
54830
|
}
|
|
54752
54831
|
async function parseImage(buffer, options) {
|
|
54753
54832
|
try {
|
|
54754
|
-
const { parseImageDocument } = await import("./image-ocr-
|
|
54833
|
+
const { parseImageDocument } = await import("./image-ocr-T72HMX2W.js");
|
|
54755
54834
|
const { blocks, warnings, lines } = await parseImageDocument(buffer, options);
|
|
54756
54835
|
stripScriptTags({ blocks });
|
|
54757
54836
|
return {
|
|
@@ -54815,7 +54894,7 @@ async function parseHwp(buffer, options) {
|
|
|
54815
54894
|
async function parsePdf(buffer, options) {
|
|
54816
54895
|
let parsePdfDocument;
|
|
54817
54896
|
try {
|
|
54818
|
-
const mod = await import("./parser-
|
|
54897
|
+
const mod = await import("./parser-E6BG3ECD.js");
|
|
54819
54898
|
parsePdfDocument = mod.parsePdfDocument;
|
|
54820
54899
|
} catch {
|
|
54821
54900
|
return {
|