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.
Files changed (128) hide show
  1. package/README.md +12 -5
  2. package/dist/{-FYKHW5G6.js → -AOWV7MNY.js} +11 -11
  3. package/dist/{chunk-QH4B3PL7.js → chunk-24YLYR6Q.js} +4 -4
  4. package/dist/{chunk-OSFB5SQS.cjs → chunk-2BCQVQO2.cjs} +3 -3
  5. package/dist/{chunk-OSFB5SQS.cjs.map → chunk-2BCQVQO2.cjs.map} +1 -1
  6. package/dist/{chunk-5VBAHUGC.js → chunk-3ANXRVI2.js} +3 -3
  7. package/dist/{chunk-IB5TO2CO.js → chunk-3H2IEU4V.js} +2 -2
  8. package/dist/{chunk-MDS3GH43.js → chunk-4NQ4EZEE.js} +14 -4
  9. package/dist/chunk-4NQ4EZEE.js.map +1 -0
  10. package/dist/{chunk-7FASIFQP.js → chunk-6LIBF2ZB.js} +2 -2
  11. package/dist/{chunk-5SVJU22Z.js → chunk-6QBBGZST.js} +2 -2
  12. package/dist/{chunk-YE4IN3D7.js → chunk-7XITVUAK.js} +11 -11
  13. package/dist/{chunk-M4JC7TXG.js → chunk-AXX5AQT4.js} +4 -4
  14. package/dist/{chunk-AIAIBNIB.js → chunk-BS2XWGT5.js} +2 -2
  15. package/dist/{chunk-TSZQ4LMV.js → chunk-DKJ2RNDG.js} +2 -2
  16. package/dist/{chunk-7RND4SNB.js → chunk-FDFXL7VJ.js} +3 -3
  17. package/dist/{chunk-3SPOIAST.js → chunk-IRNWAHHZ.js} +2 -2
  18. package/dist/{chunk-SMPK5TUQ.js → chunk-J5PYESLX.js} +14 -4
  19. package/dist/chunk-J5PYESLX.js.map +1 -0
  20. package/dist/{chunk-5FD3LAKC.js → chunk-KBGNPGVY.js} +2 -2
  21. package/dist/{chunk-DOBJ7BW5.js → chunk-M2X766AY.js} +2 -2
  22. package/dist/{chunk-ME4NQSLE.js → chunk-MEIQ476H.js} +2 -2
  23. package/dist/{chunk-M2CBEXHN.cjs → chunk-MI655NV5.cjs} +2 -2
  24. package/dist/{chunk-M2CBEXHN.cjs.map → chunk-MI655NV5.cjs.map} +1 -1
  25. package/dist/{chunk-EXVTF6XE.cjs → chunk-NJEMRAIF.cjs} +24 -24
  26. package/dist/{chunk-EXVTF6XE.cjs.map → chunk-NJEMRAIF.cjs.map} +1 -1
  27. package/dist/{chunk-ZECSXHYP.cjs → chunk-NLGOMLGU.cjs} +188 -166
  28. package/dist/{chunk-ZECSXHYP.cjs.map → chunk-NLGOMLGU.cjs.map} +1 -1
  29. package/dist/{chunk-B35C5HJK.cjs → chunk-O3OS6FAW.cjs} +3 -3
  30. package/dist/{chunk-B35C5HJK.cjs.map → chunk-O3OS6FAW.cjs.map} +1 -1
  31. package/dist/{chunk-3H5QG6I2.js → chunk-O5E25RHU.js} +2 -2
  32. package/dist/{chunk-MGJYVNDX.js → chunk-OIF5HRVP.js} +29 -7
  33. package/dist/{chunk-JHHXTNZQ.js.map → chunk-OIF5HRVP.js.map} +1 -1
  34. package/dist/{chunk-RO7AORMO.cjs → chunk-SJ5OZXEL.cjs} +23 -13
  35. package/dist/chunk-SJ5OZXEL.cjs.map +1 -0
  36. package/dist/{chunk-JHHXTNZQ.js → chunk-SKRWKVVW.js} +28 -6
  37. package/dist/chunk-SKRWKVVW.js.map +1 -0
  38. package/dist/{chunk-LHO7E3RW.js → chunk-UCLDUUBX.js} +2 -2
  39. package/dist/{chunk-IK4W2M4P.js → chunk-VJCQOSMT.js} +2 -2
  40. package/dist/{chunk-ATODI25J.js → chunk-X45Q7EAC.js} +2 -2
  41. package/dist/{chunk-R37TFXMP.js → chunk-YOGMCRM7.js} +108 -29
  42. package/dist/chunk-YOGMCRM7.js.map +1 -0
  43. package/dist/chunks-7KXTS7IV.js +10 -0
  44. package/dist/cli.js +30 -30
  45. package/dist/{formula-PYDSQGLS.cjs → formula-5V2WG4BH.cjs} +9 -9
  46. package/dist/{formula-PYDSQGLS.cjs.map → formula-5V2WG4BH.cjs.map} +1 -1
  47. package/dist/{formula-RUS4SF3O.js → formula-C26FMMGO.js} +3 -3
  48. package/dist/{formula-JBTYYSKB.js → formula-W4OL33YQ.js} +4 -4
  49. package/dist/{image-ocr-PLNNCEOR.cjs → image-ocr-BELHEWPX.cjs} +17 -17
  50. package/dist/{image-ocr-PLNNCEOR.cjs.map → image-ocr-BELHEWPX.cjs.map} +1 -1
  51. package/dist/{image-ocr-QJT4EIQU.js → image-ocr-NSQ34Y6T.js} +9 -9
  52. package/dist/{image-ocr-VA6WV6E4.js → image-ocr-T72HMX2W.js} +6 -6
  53. package/dist/index.cjs +507 -428
  54. package/dist/index.cjs.map +1 -1
  55. package/dist/index.js +108 -29
  56. package/dist/index.js.map +1 -1
  57. package/dist/mcp.js +22 -22
  58. package/dist/{model-bundle-U2YY7ATC.js → model-bundle-34T2LJB4.js} +5 -5
  59. package/dist/{models-BOJ2SFCR.js → models-TQH5EM6V.js} +5 -5
  60. package/dist/{parse-worker-v2-ZHMFK3U3.js → parse-worker-v2-YEYLILGJ.js} +12 -12
  61. package/dist/{parser-A2EWLK2J.js → parser-E6BG3ECD.js} +133 -27
  62. package/dist/parser-E6BG3ECD.js.map +1 -0
  63. package/dist/{parser-6337Z4U2.cjs → parser-OAXCXVQ4.cjs} +383 -277
  64. package/dist/parser-OAXCXVQ4.cjs.map +1 -0
  65. package/dist/{parser-HM6N7J4R.js → parser-SJHCBL7T.js} +136 -30
  66. package/dist/parser-SJHCBL7T.js.map +1 -0
  67. package/dist/{pdf-ocr-JDER5BHI.js → pdf-ocr-LGPSJM22.js} +6 -6
  68. package/dist/pdf-ocr-RKXDY3ZA.cjs +31 -0
  69. package/dist/{pdf-ocr-PGXNUFU7.cjs.map → pdf-ocr-RKXDY3ZA.cjs.map} +1 -1
  70. package/dist/{pdf-ocr-MEVC6HXG.js → pdf-ocr-T5ASSUKK.js} +9 -9
  71. package/dist/{profile-io-OJ23SPYO.js → profile-io-KMCAFTMG.js} +3 -3
  72. package/dist/{rasterize-76CWCLSU.js → rasterize-M52AKY7R.js} +3 -3
  73. package/dist/{redact-doc-EZQIHRVT.js → redact-doc-SWJC27LL.js} +11 -11
  74. package/dist/{render-JZFJPFWK.js → render-45AB5YZR.js} +7 -7
  75. package/dist/seal-7KWG6VHS.js +10 -0
  76. package/dist/{setup-RIVS74JN.js → setup-5PBMUI6M.js} +3 -3
  77. package/dist/visual-OMJNXLNZ.js +21 -0
  78. package/dist/{watch-WMH222E5.js → watch-QOGKV52T.js} +12 -12
  79. package/package.json +1 -1
  80. package/dist/chunk-MDS3GH43.js.map +0 -1
  81. package/dist/chunk-MGJYVNDX.js.map +0 -1
  82. package/dist/chunk-R37TFXMP.js.map +0 -1
  83. package/dist/chunk-RO7AORMO.cjs.map +0 -1
  84. package/dist/chunk-SMPK5TUQ.js.map +0 -1
  85. package/dist/chunks-4XIAEJEX.js +0 -10
  86. package/dist/parser-6337Z4U2.cjs.map +0 -1
  87. package/dist/parser-A2EWLK2J.js.map +0 -1
  88. package/dist/parser-HM6N7J4R.js.map +0 -1
  89. package/dist/pdf-ocr-PGXNUFU7.cjs +0 -31
  90. package/dist/seal-P2NOP4LC.js +0 -10
  91. package/dist/visual-R5GGZBTU.js +0 -21
  92. /package/dist/{-FYKHW5G6.js.map → -AOWV7MNY.js.map} +0 -0
  93. /package/dist/{chunk-QH4B3PL7.js.map → chunk-24YLYR6Q.js.map} +0 -0
  94. /package/dist/{chunk-5VBAHUGC.js.map → chunk-3ANXRVI2.js.map} +0 -0
  95. /package/dist/{chunk-IB5TO2CO.js.map → chunk-3H2IEU4V.js.map} +0 -0
  96. /package/dist/{chunk-7FASIFQP.js.map → chunk-6LIBF2ZB.js.map} +0 -0
  97. /package/dist/{chunk-5SVJU22Z.js.map → chunk-6QBBGZST.js.map} +0 -0
  98. /package/dist/{chunk-YE4IN3D7.js.map → chunk-7XITVUAK.js.map} +0 -0
  99. /package/dist/{chunk-M4JC7TXG.js.map → chunk-AXX5AQT4.js.map} +0 -0
  100. /package/dist/{chunk-AIAIBNIB.js.map → chunk-BS2XWGT5.js.map} +0 -0
  101. /package/dist/{chunk-TSZQ4LMV.js.map → chunk-DKJ2RNDG.js.map} +0 -0
  102. /package/dist/{chunk-7RND4SNB.js.map → chunk-FDFXL7VJ.js.map} +0 -0
  103. /package/dist/{chunk-3SPOIAST.js.map → chunk-IRNWAHHZ.js.map} +0 -0
  104. /package/dist/{chunk-5FD3LAKC.js.map → chunk-KBGNPGVY.js.map} +0 -0
  105. /package/dist/{chunk-DOBJ7BW5.js.map → chunk-M2X766AY.js.map} +0 -0
  106. /package/dist/{chunk-ME4NQSLE.js.map → chunk-MEIQ476H.js.map} +0 -0
  107. /package/dist/{chunk-3H5QG6I2.js.map → chunk-O5E25RHU.js.map} +0 -0
  108. /package/dist/{chunk-LHO7E3RW.js.map → chunk-UCLDUUBX.js.map} +0 -0
  109. /package/dist/{chunk-IK4W2M4P.js.map → chunk-VJCQOSMT.js.map} +0 -0
  110. /package/dist/{chunk-ATODI25J.js.map → chunk-X45Q7EAC.js.map} +0 -0
  111. /package/dist/{chunks-4XIAEJEX.js.map → chunks-7KXTS7IV.js.map} +0 -0
  112. /package/dist/{formula-RUS4SF3O.js.map → formula-C26FMMGO.js.map} +0 -0
  113. /package/dist/{formula-JBTYYSKB.js.map → formula-W4OL33YQ.js.map} +0 -0
  114. /package/dist/{image-ocr-QJT4EIQU.js.map → image-ocr-NSQ34Y6T.js.map} +0 -0
  115. /package/dist/{image-ocr-VA6WV6E4.js.map → image-ocr-T72HMX2W.js.map} +0 -0
  116. /package/dist/{model-bundle-U2YY7ATC.js.map → model-bundle-34T2LJB4.js.map} +0 -0
  117. /package/dist/{models-BOJ2SFCR.js.map → models-TQH5EM6V.js.map} +0 -0
  118. /package/dist/{parse-worker-v2-ZHMFK3U3.js.map → parse-worker-v2-YEYLILGJ.js.map} +0 -0
  119. /package/dist/{pdf-ocr-JDER5BHI.js.map → pdf-ocr-LGPSJM22.js.map} +0 -0
  120. /package/dist/{pdf-ocr-MEVC6HXG.js.map → pdf-ocr-T5ASSUKK.js.map} +0 -0
  121. /package/dist/{profile-io-OJ23SPYO.js.map → profile-io-KMCAFTMG.js.map} +0 -0
  122. /package/dist/{rasterize-76CWCLSU.js.map → rasterize-M52AKY7R.js.map} +0 -0
  123. /package/dist/{redact-doc-EZQIHRVT.js.map → redact-doc-SWJC27LL.js.map} +0 -0
  124. /package/dist/{render-JZFJPFWK.js.map → render-45AB5YZR.js.map} +0 -0
  125. /package/dist/{seal-P2NOP4LC.js.map → seal-7KWG6VHS.js.map} +0 -0
  126. /package/dist/{setup-RIVS74JN.js.map → setup-5PBMUI6M.js.map} +0 -0
  127. /package/dist/{visual-R5GGZBTU.js.map → visual-OMJNXLNZ.js.map} +0 -0
  128. /package/dist/{watch-WMH222E5.js.map → watch-QOGKV52T.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  KordocError,
4
4
  unzipLimitBytes
5
- } from "./chunk-TSZQ4LMV.js";
5
+ } from "./chunk-DKJ2RNDG.js";
6
6
 
7
7
  // src/hwpx/parser-shared.ts
8
8
  import { DOMParser } from "@xmldom/xmldom";
@@ -492,4 +492,4 @@ export {
492
492
  hwpFaceToCssStack,
493
493
  parseRenderStyles
494
494
  };
495
- //# sourceMappingURL=chunk-LHO7E3RW.js.map
495
+ //# sourceMappingURL=chunk-UCLDUUBX.js.map
@@ -3,7 +3,7 @@ import {
3
3
  ensureModelsIn,
4
4
  getModelStatusIn,
5
5
  getModelsDir
6
- } from "./chunk-DOBJ7BW5.js";
6
+ } from "./chunk-M2X766AY.js";
7
7
 
8
8
  // src/ocr/models.ts
9
9
  import { join } from "path";
@@ -153,4 +153,4 @@ export {
153
153
  parseCharacterDict,
154
154
  ocrModelPath
155
155
  };
156
- //# sourceMappingURL=chunk-IK4W2M4P.js.map
156
+ //# sourceMappingURL=chunk-VJCQOSMT.js.map
@@ -1,5 +1,5 @@
1
1
  // src/utils.ts
2
- var VERSION = true ? "4.22.1" : "0.0.0-dev";
2
+ var VERSION = true ? "4.22.3" : "0.0.0-dev";
3
3
  function toArrayBuffer(buf) {
4
4
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
5
5
  return buf.buffer;
@@ -161,4 +161,4 @@ export {
161
161
  classifyError,
162
162
  partExtension
163
163
  };
164
- //# sourceMappingURL=chunk-ATODI25J.js.map
164
+ //# sourceMappingURL=chunk-X45Q7EAC.js.map
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  loadSharp,
4
4
  rasterizePageSvg
5
- } from "./chunk-5SVJU22Z.js";
5
+ } from "./chunk-6QBBGZST.js";
6
6
  import {
7
7
  inlineImagesIntoMarkdown
8
8
  } from "./chunk-VKVDMH7X.js";
@@ -16,7 +16,7 @@ import {
16
16
  HEADING_RATIO_H3,
17
17
  tidyScriptTags,
18
18
  unframeLayoutTables
19
- } from "./chunk-MDS3GH43.js";
19
+ } from "./chunk-4NQ4EZEE.js";
20
20
  import {
21
21
  MAX_COLS,
22
22
  MAX_ROWS,
@@ -27,7 +27,7 @@ import {
27
27
  flattenLayoutTables,
28
28
  mapPuaText,
29
29
  markNonLayoutTable
30
- } from "./chunk-AIAIBNIB.js";
30
+ } from "./chunk-BS2XWGT5.js";
31
31
  import {
32
32
  DEFAULT_CHAR,
33
33
  DEFAULT_PARA_GEOM,
@@ -41,7 +41,7 @@ import {
41
41
  hwpxAppMajor,
42
42
  parseRenderStyles,
43
43
  readZipEntry
44
- } from "./chunk-LHO7E3RW.js";
44
+ } from "./chunk-UCLDUUBX.js";
45
45
  import {
46
46
  KordocError,
47
47
  compareSectionPaths,
@@ -49,7 +49,7 @@ import {
49
49
  precheckZipSize,
50
50
  sanitizeHref,
51
51
  toArrayBuffer
52
- } from "./chunk-TSZQ4LMV.js";
52
+ } from "./chunk-DKJ2RNDG.js";
53
53
 
54
54
  // src/render/svg-render.ts
55
55
  import JSZip from "jszip";
@@ -10714,21 +10714,22 @@ var FORBID_START = /* @__PURE__ */ new Set([..."!%),.:;?]}\xA2\xB0\u2032\u2033\u
10714
10714
  var FORBID_END = /* @__PURE__ */ new Set([..."$([{\xA3\xA5\u3008\u300A\u300C\u300E\u3010\u3014$([{\u20A9"]);
10715
10715
  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"]);
10716
10716
  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))]);
10717
+ var isWrapSpace = (ch) => ch === " " || ch === "\u2005";
10717
10718
  function prepareWrap(text, mode, opts) {
10718
10719
  const widthEm = widthFnOf(opts?.faceClass), spaceEm = opts?.spaceEm ?? SPACE_EM_FIXED;
10719
10720
  const advances = [], steps = [];
10720
10721
  let i = 0;
10721
10722
  for (const ch of text) {
10722
10723
  const cp = ch.codePointAt(0);
10723
- advances[i] = isSpaceCp(cp) ? spaceEm : widthEm(cp);
10724
+ advances[i] = cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp);
10724
10725
  steps[i] = ch.length;
10725
10726
  i += ch.length;
10726
10727
  }
10727
10728
  return { units: splitWrapUnits(text, mode), advances, steps };
10728
10729
  }
10729
10730
  function splitWrapUnits(text, mode, latinBreak = false) {
10730
- if (latinBreak) return text.match(mode === "keep" ? / +|[\x21-\x7e]|[^ \x21-\x7e]+/gu : / +|[^ ](?:\u00a0[^ \u00a0]?)*/gu) ?? [];
10731
- return text.match(mode === "keep" ? / +|\ufdd0+(?=[^ \ufdd0])|[^ ]+/gu : / +|\u2060*(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ ])(?:\u00a0(?:[\x21-\x7e\u00a1-\u024f\u2018-\u201f]+|[^ \u00a0])?)*/gu) ?? [];
10731
+ if (latinBreak) return text.match(mode === "keep" ? /[ \u2005]+|[\x21-\x7e]|[^ \u2005\x21-\x7e]+/gu : /[ \u2005]+|[^ \u2005](?:\u00a0[^ \u2005\u00a0]?)*/gu) ?? [];
10732
+ 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) ?? [];
10732
10733
  }
10733
10734
  function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "keep", opts) {
10734
10735
  if (!opts?.prepared && text.includes("\n")) {
@@ -10775,7 +10776,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
10775
10776
  if (unitW) return (unitW[i] ?? 0) + (ch.length === 2 ? unitW[i + 1] ?? 0 : 0);
10776
10777
  if (prepared) return prepared.advances[i] * (1 + spacing / 100) * k;
10777
10778
  const cp = ch.codePointAt(0);
10778
- return (isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
10779
+ return (cp === 8197 ? 250 : isSpaceCp(cp) ? spaceEm : widthEm(cp)) * (1 + spacing / 100) * k;
10779
10780
  };
10780
10781
  const rangeW = (from, to) => {
10781
10782
  let w = 0;
@@ -10808,11 +10809,11 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
10808
10809
  const u = text[unitPos];
10809
10810
  const prevStart = (end) => end - (end >= 2 && /[\uDC00-\uDFFF]/.test(text[end - 1]) && /[\uD800-\uDBFF]/.test(text[end - 2]) ? 2 : 1);
10810
10811
  const old = opts?.before2024;
10811
- const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && u !== " " && text[bp - 1] !== " ";
10812
+ const splitIn = opts?.kinsoku === "hancom" && split && u !== void 0 && !isWrapSpace(u) && !isWrapSpace(text[bp - 1]);
10812
10813
  const inWord = old && splitIn;
10813
- if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && text[bp - 1] !== " ") {
10814
+ if (!splitIn && u !== void 0 && forbidStart.has(u) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) {
10814
10815
  bp = prevStart(bp);
10815
- if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && text[bp - 1] !== " ") bp = prevStart(bp);
10816
+ if (old && forbidStart.has(text[bp]) && prevStart(bp) > lineStart() && !isWrapSpace(text[bp - 1])) bp = prevStart(bp);
10816
10817
  }
10817
10818
  while (!inWord && bp - 1 >= lineStart() && forbidEnd.has(text[bp - 1])) bp--;
10818
10819
  if (bp <= lineStart()) bp = unitPos;
@@ -10823,8 +10824,8 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
10823
10824
  lineEnded = false;
10824
10825
  placed = unitPos > bp ? 1 : 0;
10825
10826
  for (let i = bp; i < unitPos; i++) {
10826
- if (text[i] !== " ") realSeen = true;
10827
- else if (condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
10827
+ if (!isWrapSpace(text[i])) realSeen = true;
10828
+ else if (text[i] === " " && condense > 0 && (realSeen || !hancom)) spaceW += rangeW(i, i + 1) - (spAt?.[i] ?? 0);
10828
10829
  }
10829
10830
  lineW = rangeW(bp, unitPos) + w;
10830
10831
  };
@@ -10838,16 +10839,16 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
10838
10839
  lineW = leadW;
10839
10840
  };
10840
10841
  for (const u of units) {
10841
- if (u[0] === " ") {
10842
+ if (isWrapSpace(u[0])) {
10842
10843
  if (hancom) {
10843
10844
  let k2 = 0;
10844
10845
  for (; k2 < u.length; k2++) {
10845
10846
  if (!lineEnded && lineW >= avail) lineEnded = true;
10846
- if (lineEnded && k2 >= 2 && pos + k2 > lineStart()) break;
10847
+ if (lineEnded && (k2 >= 2 || u[k2] === "\u2005") && pos + k2 > lineStart()) break;
10847
10848
  if (!lineEnded) {
10848
10849
  const sw2 = rangeW(pos + k2, pos + k2 + 1);
10849
10850
  lineW += sw2;
10850
- if (realSeen) spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
10851
+ if (realSeen && u[k2] === " ") spaceW += sw2 - (spAt?.[pos + k2] ?? 0);
10851
10852
  }
10852
10853
  }
10853
10854
  if (k2 < u.length) breakAt(pos + k2, rangeW(pos + k2, pos + u.length));
@@ -10856,7 +10857,7 @@ function simulateWrap(text, firstWidth, contWidth, height, ratioPct, mode = "kee
10856
10857
  }
10857
10858
  const sw = rangeW(pos, pos + u.length);
10858
10859
  lineW += sw;
10859
- spaceW += sw;
10860
+ for (let k2 = 0; k2 < u.length; k2++) if (u[k2] === " ") spaceW += rangeW(pos + k2, pos + k2 + 1);
10860
10861
  pos += u.length;
10861
10862
  continue;
10862
10863
  }
@@ -11132,7 +11133,7 @@ function findFirst(el, name, depth = 0) {
11132
11133
  }
11133
11134
  var FORM_TAGS = /* @__PURE__ */ new Set(["checkBtn", "radioBtn", "btn", "comboBox", "listBox", "edit", "scrollBar"]);
11134
11135
  var OBJ_TAGS = /* @__PURE__ */ new Set(["tbl", "pic", "container", "equation", "rect", "ellipse", "polygon", "curv", "curve", "line", "arc", "ole", "textart", ...FORM_TAGS]);
11135
- var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "nbSpace", "fwSpace"]);
11136
+ var CHAR_CTRL_1SLOT = /* @__PURE__ */ new Set(["lineBreak", "hyphen", "hypen", "nbSpace", "fwSpace"]);
11136
11137
  var noteFmtCache = /* @__PURE__ */ new WeakMap();
11137
11138
  function sectionNoteFormats(p) {
11138
11139
  const root = p.ownerDocument?.documentElement;
@@ -11877,6 +11878,60 @@ function nextParaNumber(counters, geom) {
11877
11878
  });
11878
11879
  }
11879
11880
 
11881
+ // src/render/reflow-cache.ts
11882
+ function cachedParagraphBottom(lsa, bodyFlow) {
11883
+ let bottom = Number.NEGATIVE_INFINITY, previousV = Number.NEGATIVE_INFINITY;
11884
+ for (let i = 0; i < lsa.childNodes.length; i++) {
11885
+ const seg = lsa.childNodes[i];
11886
+ if (seg.nodeType !== 1 || seg.localName !== "lineseg") continue;
11887
+ const num3 = (name, fallback = 0) => toInt32(seg.getAttribute(name) ?? void 0, fallback);
11888
+ const v = num3("vertpos");
11889
+ if (bodyFlow && v < previousV) bottom = Number.NEGATIVE_INFINITY;
11890
+ bottom = Math.max(bottom, v + Math.max(num3("vertsize", 1e3), num3("textheight", 1e3)) + num3("spacing"));
11891
+ previousV = v;
11892
+ }
11893
+ return bottom;
11894
+ }
11895
+
11896
+ // src/render/reflow-fragments.ts
11897
+ function appendNarrowLineFragments(parent, seg, free, box, flow) {
11898
+ if (!free || !box) return false;
11899
+ const parts = free.filter(([a, b]) => b - a >= 1440);
11900
+ if (parts.length < 2 || parts.at(-1)[0] !== box[0] || parts.at(-1)[1] - box[0] !== box[1]) return false;
11901
+ const { text, widths, spacings, slots, start, end } = flow;
11902
+ if (/[\t\n\u00a0\u2005\ufdd0\ufffc]/.test(text.slice(start, end))) return false;
11903
+ let ink = start;
11904
+ while (ink < end && (text[ink] === " " || text[ink] === "\u2060" && widths[ink] === 0)) ink++;
11905
+ if (text.slice(ink, end).includes("\u2060")) return false;
11906
+ if (ink === end || parts.slice(0, -1).some(([a, b]) => (widths[ink] ?? 0) - (spacings[ink] ?? 0) <= b - a)) return false;
11907
+ const fragments = [];
11908
+ let cursor = start;
11909
+ for (const [a, b] of parts.slice(0, -1)) {
11910
+ const offset = cursor;
11911
+ let w = 0;
11912
+ while (cursor < ink && w + widths[cursor] <= b - a) w += widths[cursor++];
11913
+ fragments.push({ offset, x: a, width: b - a });
11914
+ }
11915
+ let rest = 0;
11916
+ for (let i = cursor; i < end; i++) rest += widths[i];
11917
+ let last = end - 1;
11918
+ if (last > cursor && /[\uDC00-\uDFFF]/.test(text[last])) last--;
11919
+ rest -= spacings[last] ?? 0;
11920
+ if (rest > box[1] + 0.5) return false;
11921
+ let next = end;
11922
+ while (next < text.length && text[next] === " ") next++;
11923
+ if (next < text.length && rest + (widths[next] ?? 0) - (spacings[next] ?? 0) <= box[1] + 0.5) return false;
11924
+ fragments.push({ offset: cursor, x: box[0], width: box[1] });
11925
+ fragments.forEach((f, i) => {
11926
+ const part = seg.cloneNode(false);
11927
+ if (i > 0) part.setAttribute("textpos", String(slots[f.offset]));
11928
+ part.setAttribute("horzpos", String(f.x));
11929
+ part.setAttribute("horzsize", String(f.width));
11930
+ parent.appendChild(part);
11931
+ });
11932
+ return true;
11933
+ }
11934
+
11880
11935
  // src/render/reflow.ts
11881
11936
  var geomMemo = (styles) => ({ cell: /* @__PURE__ */ new WeakMap(), table: /* @__PURE__ */ new WeakMap(), paraGeom: styles.paraGeom });
11882
11937
  var LINESEG_FLAGS = "393216";
@@ -12198,10 +12253,11 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12198
12253
  }
12199
12254
  const lineBox = [];
12200
12255
  const lineParts = [];
12256
+ const collisionHeights = [];
12201
12257
  const boxAt = (i) => {
12202
12258
  if (!zones.length) return void 0;
12203
12259
  if (i in lineBox) return lineBox[i];
12204
- const y0 = textStartV + i * pitch, y1 = y0 + height;
12260
+ const y0 = textStartV + i * pitch, y1 = y0 + Math.max(height, collisionHeights[i] ?? 0);
12205
12261
  let free = [[marginL, marginL + avail]], hit = false, flow = "BOTH_SIDES";
12206
12262
  for (const z of zones) {
12207
12263
  if (!(y1 > z.top && y0 < z.bottom)) continue;
@@ -12261,7 +12317,26 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12261
12317
  lineParts.length = 0;
12262
12318
  }
12263
12319
  }
12264
- const wrap = 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 });
12320
+ 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 });
12321
+ let wrap = wrapLines();
12322
+ if (zones.length) for (let pass = 0; pass < text.length; pass++) {
12323
+ let changed = false;
12324
+ for (const o of m.objs) if (o.inline) {
12325
+ const k = realIdx.indexOf(o.index), om = findChildByLocalName(o.el, "outMargin");
12326
+ if (k < 0) continue;
12327
+ let li = 0;
12328
+ for (let j = 1; j < wrap.starts.length; j++) if (wrap.starts[j] <= k) li = j;
12329
+ const h = num2(om, "top") + effHOf(o) + num2(om, "bottom");
12330
+ if (h > Math.max(height, collisionHeights[li] ?? 0)) {
12331
+ collisionHeights[li] = h;
12332
+ changed = true;
12333
+ }
12334
+ }
12335
+ if (!changed) break;
12336
+ lineBox.length = 0;
12337
+ lineParts.length = 0;
12338
+ wrap = wrapLines();
12339
+ }
12265
12340
  const lineObjH = new Array(wrap.starts.length).fill(0);
12266
12341
  const lineObjAsc = new Array(wrap.starts.length).fill(0);
12267
12342
  const lineObjLs = new Array(wrap.starts.length).fill(false);
@@ -12275,6 +12350,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12275
12350
  const om = findChildByLocalName(o.el, "outMargin");
12276
12351
  const li = lineOf(o.index);
12277
12352
  const h = num2(om, "top") + effHOf(o) + num2(om, "bottom");
12353
+ 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);
12278
12354
  lineObjH[li] = Math.max(lineObjH[li], h);
12279
12355
  if (findChildByLocalName(o.el, "pos")?.getAttribute("affectLSpacing") === "1") lineObjLs[li] = true;
12280
12356
  const bl = o.tag === "equation" ? Number(o.el.getAttribute("baseLine")) : NaN;
@@ -12352,12 +12428,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12352
12428
  }
12353
12429
  }
12354
12430
  const vertpos = v;
12431
+ const occupiedH = Math.max(lineH, collisionHeights[li] ?? 0);
12355
12432
  v += lineH + spacing;
12356
12433
  const isFirst = li === 0;
12357
12434
  const seg = doc.createElement("hp:lineseg");
12358
12435
  seg.setAttribute("textpos", String(textpos));
12359
12436
  seg.setAttribute("vertpos", String(vertpos));
12360
- seg.setAttribute("vertsize", String(lineH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : lineH));
12437
+ seg.setAttribute("vertsize", String(occupiedH === textH && boxAll > textH0 ? Math.max(textH0, boxTop) : occupiedH));
12361
12438
  seg.setAttribute("textheight", String(lineH));
12362
12439
  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])));
12363
12440
  seg.setAttribute("spacing", String(spacing));
@@ -12368,6 +12445,13 @@ function reflowPara(p, doc, styles, areaW, startV, mode, zones = [], nums = /* @
12368
12445
  seg.setAttribute("horzpos", String(box ? box[0] : isFirst ? marginL : contHorz));
12369
12446
  seg.setAttribute("horzsize", String(box ? box[1] : isFirst ? firstWidth : contSegWidth));
12370
12447
  seg.setAttribute("flags", LINESEG_FLAGS);
12448
+ if (paraMode === "charAll" && !inlineAt.size && !geom.marginIntent && !bulletW && !condenseUse && appendNarrowLineFragments(
12449
+ lsa,
12450
+ seg,
12451
+ lineParts[li],
12452
+ box,
12453
+ { text, widths, spacings, slots: realIdx, start: wrap.starts[li], end: wrap.starts[li + 1] ?? text.length }
12454
+ )) continue;
12371
12455
  lsa.appendChild(seg);
12372
12456
  for (const [a, b] of parts?.slice(1) ?? []) {
12373
12457
  const more = seg.cloneNode(false);
@@ -12540,12 +12624,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
12540
12624
  if (!res) {
12541
12625
  const lsa = findChildByLocalName(p, "linesegarray");
12542
12626
  if (lsa) {
12543
- let bottom = Number.NEGATIVE_INFINITY;
12544
- for (const seg of elements2(lsa)) {
12545
- if (ln2(seg) !== "lineseg") continue;
12546
- const th = Math.max(num2(seg, "vertsize", 1e3), num2(seg, "textheight", 1e3));
12547
- bottom = Math.max(bottom, num2(seg, "vertpos") + th + num2(seg, "spacing"));
12548
- }
12627
+ const bottom = cachedParagraphBottom(lsa, bodyFlow);
12549
12628
  if (Number.isFinite(bottom)) {
12550
12629
  cursorV = bottom;
12551
12630
  prevSpaceAfter = g?.spaceAfter ?? 0;
@@ -19593,4 +19672,4 @@ export {
19593
19672
  cropRect,
19594
19673
  extractRenderedRegions
19595
19674
  };
19596
- //# sourceMappingURL=chunk-R37TFXMP.js.map
19675
+ //# sourceMappingURL=chunk-YOGMCRM7.js.map