kordoc 4.2.1 → 4.2.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 (97) hide show
  1. package/README.md +19 -2
  2. package/dist/{-BSO3CDQQ.js → -GJYDKVQD.js} +9 -9
  3. package/dist/{chunk-LSXXGUWA.cjs → chunk-5AXGFJQO.cjs} +8 -6
  4. package/dist/chunk-5AXGFJQO.cjs.map +1 -0
  5. package/dist/{chunk-R22KDUKW.cjs → chunk-AA6UPPZF.cjs} +9 -9
  6. package/dist/{chunk-R22KDUKW.cjs.map → chunk-AA6UPPZF.cjs.map} +1 -1
  7. package/dist/{chunk-WJSGYVFD.js → chunk-CGFWS3BQ.js} +3 -3
  8. package/dist/{chunk-RBUBZ2TA.cjs → chunk-CWP56BRC.cjs} +3 -3
  9. package/dist/chunk-CWP56BRC.cjs.map +1 -0
  10. package/dist/{chunk-QSB2RTX5.js → chunk-DE6FORIP.js} +6 -4
  11. package/dist/chunk-DE6FORIP.js.map +1 -0
  12. package/dist/{chunk-F5ECB53I.js → chunk-ELRVXOMP.js} +2 -2
  13. package/dist/{chunk-35U3MVA2.cjs → chunk-FF5QNEKZ.cjs} +3 -3
  14. package/dist/{chunk-35U3MVA2.cjs.map → chunk-FF5QNEKZ.cjs.map} +1 -1
  15. package/dist/{chunk-54WVWWT4.js → chunk-GJO3ORFW.js} +1 -1
  16. package/dist/chunk-GJO3ORFW.js.map +1 -0
  17. package/dist/{chunk-7IMNZ2BL.js → chunk-K5LGSH5T.js} +6 -4
  18. package/dist/chunk-K5LGSH5T.js.map +1 -0
  19. package/dist/{chunk-BKBYTPSL.js → chunk-LMNSIPWZ.js} +2 -2
  20. package/dist/{chunk-EZHWPKCH.js → chunk-LPWP4FWU.js} +2 -2
  21. package/dist/{chunk-QOC7S5VE.js → chunk-NIPPOAT6.js} +2 -2
  22. package/dist/{chunk-KRAYUNFM.js → chunk-NOMNOG74.js} +2 -2
  23. package/dist/{chunk-HTCKGSSW.js → chunk-QNVZAKUQ.js} +3 -3
  24. package/dist/chunk-QNVZAKUQ.js.map +1 -0
  25. package/dist/{chunk-Z6LPEWIX.js → chunk-RAS3HM4X.js} +3 -3
  26. package/dist/chunk-RAS3HM4X.js.map +1 -0
  27. package/dist/{chunk-L5JWKIOT.js → chunk-U6XYOV32.js} +3 -3
  28. package/dist/{chunk-PLTG6ZRF.js → chunk-WTJIRGPN.js} +3 -3
  29. package/dist/{chunk-WWYAYZ5U.js → chunk-WX75LYAS.js} +128 -35
  30. package/dist/chunk-WX75LYAS.js.map +1 -0
  31. package/dist/{chunk-BHILWIE6.js → chunk-X634MXVJ.js} +3 -3
  32. package/dist/chunk-X634MXVJ.js.map +1 -0
  33. package/dist/chunks-JOGD2KUK.js +10 -0
  34. package/dist/cli.js +18 -18
  35. package/dist/{image-ocr-SLUEM3FA.js → image-ocr-O3YQ3KEN.js} +5 -5
  36. package/dist/{image-ocr-DALT7PFQ.js → image-ocr-PLTV4NOK.js} +4 -4
  37. package/dist/{image-ocr-N5Z32R4U.cjs → image-ocr-TCJLNMTG.cjs} +9 -9
  38. package/dist/{image-ocr-N5Z32R4U.cjs.map → image-ocr-TCJLNMTG.cjs.map} +1 -1
  39. package/dist/index.cjs +545 -452
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +10 -2
  42. package/dist/index.d.ts +10 -2
  43. package/dist/index.js +124 -31
  44. package/dist/index.js.map +1 -1
  45. package/dist/mcp.js +15 -15
  46. package/dist/{parser-F5KY3YSD.js → parser-UX5T6KTZ.js} +6 -6
  47. package/dist/{parser-R4CXIXRN.cjs → parser-VQIJPCI5.cjs} +24 -24
  48. package/dist/{parser-R4CXIXRN.cjs.map → parser-VQIJPCI5.cjs.map} +1 -1
  49. package/dist/{parser-33TK5SMH.js → parser-Y2X4JMAK.js} +5 -5
  50. package/dist/{pdf-ocr-BXQZKU3N.js → pdf-ocr-DOPZP6QS.js} +5 -5
  51. package/dist/pdf-ocr-I3Y6YF5K.js +12 -0
  52. package/dist/pdf-ocr-XMDJ2IF5.cjs +13 -0
  53. package/dist/{pdf-ocr-WGWZDHMV.cjs.map → pdf-ocr-XMDJ2IF5.cjs.map} +1 -1
  54. package/dist/{profile-io-CBYHKLFU.js → profile-io-EGVJAZDG.js} +3 -3
  55. package/dist/{rasterize-AWMM2CSW.js → rasterize-TH26U5E2.js} +2 -2
  56. package/dist/render-C4R3OJ45.js +10 -0
  57. package/dist/seal-JF2J4S52.js +10 -0
  58. package/dist/{setup-Q2PRE7UA.js → setup-GUQT5ELJ.js} +23 -3
  59. package/dist/setup-GUQT5ELJ.js.map +1 -0
  60. package/dist/{watch-HKXCISVO.js → watch-4SP7V6SV.js} +9 -9
  61. package/package.json +1 -1
  62. package/dist/chunk-54WVWWT4.js.map +0 -1
  63. package/dist/chunk-7IMNZ2BL.js.map +0 -1
  64. package/dist/chunk-BHILWIE6.js.map +0 -1
  65. package/dist/chunk-HTCKGSSW.js.map +0 -1
  66. package/dist/chunk-LSXXGUWA.cjs.map +0 -1
  67. package/dist/chunk-QSB2RTX5.js.map +0 -1
  68. package/dist/chunk-RBUBZ2TA.cjs.map +0 -1
  69. package/dist/chunk-WWYAYZ5U.js.map +0 -1
  70. package/dist/chunk-Z6LPEWIX.js.map +0 -1
  71. package/dist/chunks-LRFS5NJE.js +0 -10
  72. package/dist/pdf-ocr-34F5AQKK.js +0 -12
  73. package/dist/pdf-ocr-WGWZDHMV.cjs +0 -13
  74. package/dist/render-Y3IE2FIK.js +0 -10
  75. package/dist/seal-7RXFCRMT.js +0 -10
  76. package/dist/setup-Q2PRE7UA.js.map +0 -1
  77. /package/dist/{-BSO3CDQQ.js.map → -GJYDKVQD.js.map} +0 -0
  78. /package/dist/{chunk-WJSGYVFD.js.map → chunk-CGFWS3BQ.js.map} +0 -0
  79. /package/dist/{chunk-F5ECB53I.js.map → chunk-ELRVXOMP.js.map} +0 -0
  80. /package/dist/{chunk-BKBYTPSL.js.map → chunk-LMNSIPWZ.js.map} +0 -0
  81. /package/dist/{chunk-EZHWPKCH.js.map → chunk-LPWP4FWU.js.map} +0 -0
  82. /package/dist/{chunk-QOC7S5VE.js.map → chunk-NIPPOAT6.js.map} +0 -0
  83. /package/dist/{chunk-KRAYUNFM.js.map → chunk-NOMNOG74.js.map} +0 -0
  84. /package/dist/{chunk-L5JWKIOT.js.map → chunk-U6XYOV32.js.map} +0 -0
  85. /package/dist/{chunk-PLTG6ZRF.js.map → chunk-WTJIRGPN.js.map} +0 -0
  86. /package/dist/{chunks-LRFS5NJE.js.map → chunks-JOGD2KUK.js.map} +0 -0
  87. /package/dist/{image-ocr-SLUEM3FA.js.map → image-ocr-O3YQ3KEN.js.map} +0 -0
  88. /package/dist/{image-ocr-DALT7PFQ.js.map → image-ocr-PLTV4NOK.js.map} +0 -0
  89. /package/dist/{parser-F5KY3YSD.js.map → parser-UX5T6KTZ.js.map} +0 -0
  90. /package/dist/{parser-33TK5SMH.js.map → parser-Y2X4JMAK.js.map} +0 -0
  91. /package/dist/{pdf-ocr-34F5AQKK.js.map → pdf-ocr-DOPZP6QS.js.map} +0 -0
  92. /package/dist/{pdf-ocr-BXQZKU3N.js.map → pdf-ocr-I3Y6YF5K.js.map} +0 -0
  93. /package/dist/{profile-io-CBYHKLFU.js.map → profile-io-EGVJAZDG.js.map} +0 -0
  94. /package/dist/{rasterize-AWMM2CSW.js.map → rasterize-TH26U5E2.js.map} +0 -0
  95. /package/dist/{render-Y3IE2FIK.js.map → render-C4R3OJ45.js.map} +0 -0
  96. /package/dist/{seal-7RXFCRMT.js.map → seal-JF2J4S52.js.map} +0 -0
  97. /package/dist/{watch-HKXCISVO.js.map → watch-4SP7V6SV.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  HEADING_RATIO_H1,
7
7
  HEADING_RATIO_H2,
8
8
  HEADING_RATIO_H3
9
- } from "./chunk-54WVWWT4.js";
9
+ } from "./chunk-GJO3ORFW.js";
10
10
  import {
11
11
  detectFormat,
12
12
  detectOle2Format,
@@ -27,7 +27,7 @@ import {
27
27
  paraTextPureT,
28
28
  patchZipEntries,
29
29
  scanSectionXml
30
- } from "./chunk-WJSGYVFD.js";
30
+ } from "./chunk-CGFWS3BQ.js";
31
31
  import {
32
32
  MAX_COLS,
33
33
  MAX_ROWS,
@@ -37,14 +37,14 @@ import {
37
37
  dedupeRunningHeaders,
38
38
  flattenLayoutTables,
39
39
  mapPuaText
40
- } from "./chunk-QSB2RTX5.js";
40
+ } from "./chunk-DE6FORIP.js";
41
41
  import {
42
42
  SPACE_EM_FIXED,
43
43
  charWidthEm1000,
44
44
  fitRatioForFewerLines,
45
45
  measureTextWidth,
46
46
  simulateWrap
47
- } from "./chunk-PLTG6ZRF.js";
47
+ } from "./chunk-WTJIRGPN.js";
48
48
  import {
49
49
  MAX_DECOMPRESS_SIZE,
50
50
  MAX_XML_DEPTH,
@@ -56,7 +56,7 @@ import {
56
56
  createXmlParser,
57
57
  extractTextFromNode,
58
58
  findChildByLocalName
59
- } from "./chunk-BHILWIE6.js";
59
+ } from "./chunk-X634MXVJ.js";
60
60
  import {
61
61
  KordocError,
62
62
  classifyError,
@@ -68,7 +68,7 @@ import {
68
68
  sanitizeHref,
69
69
  stripDtd,
70
70
  toArrayBuffer
71
- } from "./chunk-Z6LPEWIX.js";
71
+ } from "./chunk-RAS3HM4X.js";
72
72
 
73
73
  // src/index.ts
74
74
  import { readFile } from "fs/promises";
@@ -184,6 +184,26 @@ function comResultToParseResult(pages, pageCount, warnings) {
184
184
  }
185
185
 
186
186
  // src/hwpx/styles.ts
187
+ function isRealStrikeShape(shape) {
188
+ switch (shape) {
189
+ case "SOLID":
190
+ case "DASH":
191
+ case "DOT":
192
+ case "DASH_DOT":
193
+ case "DASH_DOT_DOT":
194
+ case "LONG_DASH":
195
+ case "CIRCLE":
196
+ case "DOUBLE_SLIM":
197
+ case "SLIM_THICK":
198
+ case "THICK_SLIM":
199
+ case "SLIM_THICK_SLIM":
200
+ case "WAVE":
201
+ case "DOUBLE_WAVE":
202
+ return true;
203
+ default:
204
+ return false;
205
+ }
206
+ }
187
207
  async function extractHwpxStyles(zip, decompressed) {
188
208
  const result = {
189
209
  charProperties: /* @__PURE__ */ new Map(),
@@ -248,6 +268,10 @@ function parseCharProperties(doc, map) {
248
268
  const localTag = (k.tagName || "").replace(/^[^:]+:/, "");
249
269
  if (localTag === "bold") prop.bold = true;
250
270
  else if (localTag === "italic") prop.italic = true;
271
+ else if (localTag === "strikeout") {
272
+ const shape = k.getAttribute("shape") || "";
273
+ if (isRealStrikeShape(shape)) prop.strike = true;
274
+ }
251
275
  }
252
276
  const fontFaces = el.getElementsByTagName("*");
253
277
  for (let j = 0; j < fontFaces.length; j++) {
@@ -1552,7 +1576,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1552
1576
  }
1553
1577
  break;
1554
1578
  case "p": {
1555
- const { text: rawText, href, footnote, style } = extractParagraphInfo(el, ctx.styleMap, ctx);
1579
+ const { text: rawText, href, footnote, style, segments } = extractParagraphInfo(el, ctx.styleMap, ctx);
1556
1580
  let text = rawText;
1557
1581
  let headingLevel;
1558
1582
  const ph = resolveParaHeading(el, ctx);
@@ -1560,6 +1584,33 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1560
1584
  if (ph?.prefix) text = ph.prefix + " " + text;
1561
1585
  headingLevel = ph?.headingLevel;
1562
1586
  }
1587
+ if (segments) {
1588
+ const cell2 = tableCtx?.cell ?? null;
1589
+ if (text && cell2) cell2.text += (cell2.text ? "\n" : "") + (footnote ? `${text} (\uC8FC: ${footnote})` : text);
1590
+ const segs = [...segments];
1591
+ if (ph?.prefix) {
1592
+ const fi = segs.findIndex((s) => s);
1593
+ if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
1594
+ }
1595
+ let segIdx = 0;
1596
+ let first = true;
1597
+ const flush = () => {
1598
+ const s = segs[segIdx++];
1599
+ if (!s) return;
1600
+ const block = { type: "paragraph", text: s, pageNumber: ctx.sectionNum };
1601
+ if (first && !cell2) {
1602
+ first = false;
1603
+ if (style) block.style = style;
1604
+ if (href) block.href = href;
1605
+ if (footnote) block.footnoteText = footnote;
1606
+ }
1607
+ if (cell2) (cell2.blocks ??= []).push(block);
1608
+ else blocks.push(block);
1609
+ };
1610
+ tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1, flush);
1611
+ while (segIdx < segs.length) flush();
1612
+ break;
1613
+ }
1563
1614
  if (text) {
1564
1615
  if (tableCtx?.cell) {
1565
1616
  const cell2 = tableCtx.cell;
@@ -1778,7 +1829,7 @@ function findTopLevelTbls(el, out, depth = 0) {
1778
1829
  findTopLevelTbls(ch, out, depth + 1);
1779
1830
  }
1780
1831
  }
1781
- function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1832
+ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0, onTbl) {
1782
1833
  if (depth > MAX_XML_DEPTH) return tableCtx;
1783
1834
  const children = node.childNodes;
1784
1835
  if (!children) return tableCtx;
@@ -1792,6 +1843,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1792
1843
  const tag = el.tagName || el.localName || "";
1793
1844
  const localTag = tag.replace(/^[^:]+:/, "");
1794
1845
  if (localTag === "tbl") {
1846
+ if (onTbl && isInlineTbl(el)) onTbl();
1795
1847
  if (!tableCtx) {
1796
1848
  const chan = kordocTableChannel(el, ctx);
1797
1849
  if (chan) {
@@ -1838,6 +1890,9 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
1838
1890
  walkChildren(node, depth);
1839
1891
  return tableCtx;
1840
1892
  }
1893
+ function isInlineTbl(tbl2) {
1894
+ return findChildByLocalName(tbl2, "pos")?.getAttribute("treatAsChar") === "1";
1895
+ }
1841
1896
  function findDescendant(node, targetTag, depth = 0) {
1842
1897
  if (depth > 5) return null;
1843
1898
  const children = node.childNodes;
@@ -2011,7 +2066,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2011
2066
  ctx.warnings?.push({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" });
2012
2067
  }
2013
2068
  } else {
2014
- text += t;
2069
+ text += t.replace(/\x1E/g, "");
2015
2070
  }
2016
2071
  continue;
2017
2072
  }
@@ -2042,9 +2097,12 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2042
2097
  case "hwSpace":
2043
2098
  text += " ";
2044
2099
  break;
2100
+ // 테이블 자체는 walkSection에서 처리 — 글자취급(inline) 표만 경계 마커를 남겨
2101
+ // 표 앞뒤 텍스트를 문서 순서대로 분할 방출할 수 있게 한다 (#49/#50).
2102
+ // float·페이지 앵커 표는 텍스트 흐름 불참(reflow 모델 정합) — 종전대로 텍스트 뒤 방출
2045
2103
  case "tbl":
2104
+ if (isInlineTbl(child)) text += "";
2046
2105
  break;
2047
- // 테이블은 walkSection에서 처리
2048
2106
  // 하이퍼링크
2049
2107
  case "hyperlink": {
2050
2108
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
@@ -2139,7 +2197,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2139
2197
  for (const r of closed) {
2140
2198
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
2141
2199
  const anchor = text.slice(r.start, r.end);
2142
- if (!anchor.trim() || /[\n\x1F\[\]]/.test(anchor)) continue;
2200
+ if (!anchor.trim() || /[\n\x1F\x1E\[\]]/.test(anchor)) continue;
2143
2201
  text = text.slice(0, r.start) + `[${anchor}](${r.url})` + text.slice(r.end);
2144
2202
  applied.push([r.start, r.end]);
2145
2203
  }
@@ -2147,10 +2205,18 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2147
2205
  }
2148
2206
  const leaderIdx = text.indexOf("");
2149
2207
  if (leaderIdx >= 0) text = text.substring(0, leaderIdx);
2150
- let cleanText = text.replace(/[ \t]+/g, " ").trim();
2151
- if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(cleanText)) cleanText = "";
2152
- cleanText = cleanText.replace(/그림입니다\.?\s*원본\s*그림의\s*(이름|크기)[^\n]*(\n[^\n]*원본\s*그림의\s*(이름|크기)[^\n]*)*/g, "").trim();
2153
- cleanText = cleanText.replace(/^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|선|직선|곡선|화살표|오각형|육각형|팔각형|별|십자|구름|마름모|도넛|평행사변형|사다리꼴|개체|그리기\s?개체|묶음\s?개체|글상자|표|그림|OLE\s?개체)\s?입니다\.?$/gm, "").trim();
2208
+ const cleanParaText = (raw) => {
2209
+ let t = raw.replace(/[ \t]+/g, " ").trim();
2210
+ if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(t)) t = "";
2211
+ t = t.replace(/그림입니다\.?\s*원본\s*그림의\s*(이름|크기)[^\n]*(\n[^\n]*원본\s*그림의\s*(이름|크기)[^\n]*)*/g, "").trim();
2212
+ return t.replace(/^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|선|직선|곡선|화살표|오각형|육각형|팔각형|별|십자|구름|마름모|도넛|평행사변형|사다리꼴|개체|그리기\s?개체|묶음\s?개체|글상자|표|그림|OLE\s?개체)\s?입니다\.?$/gm, "").trim();
2213
+ };
2214
+ let segments;
2215
+ if (text.includes("")) {
2216
+ segments = text.split("").map(cleanParaText);
2217
+ text = text.replace(/\x1E/g, "");
2218
+ }
2219
+ const cleanText = cleanParaText(text);
2154
2220
  let style;
2155
2221
  if (styleMap && charPrId) {
2156
2222
  const charProp = styleMap.charProperties.get(charPrId);
@@ -2163,7 +2229,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2163
2229
  if (!style.fontSize && !style.bold && !style.italic) style = void 0;
2164
2230
  }
2165
2231
  }
2166
- return { text: cleanText, href, footnote, style };
2232
+ return { text: cleanText, href, footnote, style, segments };
2167
2233
  }
2168
2234
  var KORDOC_CHAR_CODE = "4";
2169
2235
  var KORDOC_PARA_QUOTE = "6";
@@ -2214,21 +2280,22 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2214
2280
  else {
2215
2281
  if (cp?.bold) span.bold = true;
2216
2282
  if (cp?.italic) span.italic = true;
2283
+ if (cp?.strike) span.strike = true;
2217
2284
  }
2218
- if (span.bold || span.italic || span.code) styled = true;
2285
+ if (span.bold || span.italic || span.strike || span.code) styled = true;
2219
2286
  spans.push(span);
2220
2287
  }
2221
2288
  if (!styled || spans.length === 0) return null;
2222
2289
  const merged = [];
2223
2290
  for (const s of spans) {
2224
2291
  const last = merged[merged.length - 1];
2225
- if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.code === !!s.code) {
2292
+ if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.strike === !!s.strike && !!last.code === !!s.code) {
2226
2293
  last.text += s.text;
2227
2294
  } else {
2228
2295
  merged.push(s);
2229
2296
  }
2230
2297
  }
2231
- if (requireMixed && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
2298
+ if (requireMixed && !merged.some((s) => s.strike) && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
2232
2299
  return merged;
2233
2300
  }
2234
2301
  function gongmunDepthFromIndent(para2, left, ctx) {
@@ -4647,7 +4714,10 @@ function parseParagraph(records, start, end, ctx) {
4647
4714
  if (headingLevel > 0) block.level = headingLevel;
4648
4715
  if (ctx.docInfo && charShapeIds.length > 0) {
4649
4716
  const style = resolveCharStyle(charShapeIds, ctx.docInfo);
4650
- if (style) block.style = style;
4717
+ if (style) {
4718
+ block.style = style;
4719
+ if (style.strike) block.text = headMarker ? `${headMarker} ~~${trimmed}~~` : `~~${trimmed}~~`;
4720
+ }
4651
4721
  }
4652
4722
  if (footnotes.length > 0) block.footnoteText = footnotes.join("; ");
4653
4723
  blocks.push(block);
@@ -5038,7 +5108,13 @@ function resolveCharStyle(charShapeIds, docInfo) {
5038
5108
  if (cs.fontSize > 0) style.fontSize = cs.fontSize / 10;
5039
5109
  if (cs.attrFlags & 1) style.italic = true;
5040
5110
  if (cs.attrFlags & 2) style.bold = true;
5041
- return style.fontSize || style.bold || style.italic ? style : void 0;
5111
+ if (hasRealStrike(cs.attrFlags)) style.strike = true;
5112
+ return style.fontSize || style.bold || style.italic || style.strike ? style : void 0;
5113
+ }
5114
+ function hasRealStrike(attrFlags) {
5115
+ const strikeBits = attrFlags >> 18 & 7;
5116
+ const shapeId = attrFlags >> 26 & 15;
5117
+ return strikeBits !== 0 && shapeId <= 12;
5042
5118
  }
5043
5119
 
5044
5120
  // src/hwp3/parser.ts
@@ -22403,6 +22479,18 @@ function htmlCellInnerToLines(inner) {
22403
22479
  const lines = work.split(/<br\s*\/?>/gi).map((s) => s.trim()).filter((s) => s.length > 0);
22404
22480
  return { lines, hadNonText, imgSrcs };
22405
22481
  }
22482
+ function splitCellByTopLevelTables(html) {
22483
+ const tables = extractTopLevelTables(html);
22484
+ const texts = [];
22485
+ let rest = html;
22486
+ for (const t of tables) {
22487
+ const i = rest.indexOf(t);
22488
+ texts.push(rest.slice(0, i));
22489
+ rest = rest.slice(i + t.length);
22490
+ }
22491
+ texts.push(rest);
22492
+ return { texts, tables };
22493
+ }
22406
22494
  function extractTopLevelTables(html) {
22407
22495
  const result = [];
22408
22496
  let depth = 0;
@@ -23081,17 +23169,18 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23081
23169
  const rowSpan = Math.min(cell2.rowSpan, rowCnt - cell2.r);
23082
23170
  const lines = cellLines[i];
23083
23171
  let nestedH = 0;
23084
- const nestedXmls = [];
23085
- for (const nested of extractTopLevelTables(cell2.inner)) {
23172
+ const { texts: segTexts, tables: nestedTables } = splitCellByTopLevelTables(cell2.inner);
23173
+ const nestedXmls = nestedTables.map((nested) => {
23086
23174
  const sw = spanW(cell2);
23087
23175
  const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
23088
23176
  const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
23089
23177
  if (nestedXml) {
23090
- nestedXmls.push(nestedXml);
23091
23178
  const szH = nestedXml.match(/<hp:sz [^>]*height="(\d+)"/)?.[1];
23092
23179
  nestedH += (szH ? Number(szH) : (nested.match(/<tr[\s>]/gi) ?? []).length * cellH) + 300;
23093
23180
  }
23094
- }
23181
+ return nestedXml;
23182
+ });
23183
+ const segLines = segTexts.map((t) => htmlCellInnerToLines(t).lines);
23095
23184
  const usable = Math.max(spanW(cell2) - CELL_PAD, 1e3);
23096
23185
  let wrapLines = 0;
23097
23186
  for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
@@ -23100,9 +23189,9 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23100
23189
  const cellHeight = Math.max(prof?.cellH.get(`${cell2.r},${cell2.c}`) ?? 0, contentH);
23101
23190
  const perRow = Math.ceil(cellHeight / rowSpan);
23102
23191
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
23103
- return { cell: cell2, rowSpan, lines, nestedXmls, imgSrcs: cellParsed[i].imgSrcs };
23192
+ return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
23104
23193
  });
23105
- const tcXmls = meta.map(({ cell: cell2, rowSpan, lines, nestedXmls, imgSrcs }) => {
23194
+ const tcXmls = meta.map(({ cell: cell2, rowSpan, nestedXmls, segLines, imgSrcs }) => {
23106
23195
  const k = `${cell2.r},${cell2.c}`;
23107
23196
  const isHeader = cell2.isHeader;
23108
23197
  const baseCharPr = style ? style.charPr : CHAR_NORMAL;
@@ -23113,7 +23202,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23113
23202
  const paraPrId = style ? centered ? reg ? style.tblCenterParaPr ?? style.centerParaPr : style.centerParaPr : reg ? style.tblLeftParaPr ?? PARA_NORMAL : PARA_NORMAL : PARA_NORMAL;
23114
23203
  const picUrls = images ? [...imgSrcs] : [];
23115
23204
  const paras = [];
23116
- for (const line of lines) {
23205
+ const pushTextLine = (line) => {
23117
23206
  let text = unescapeHtml(line);
23118
23207
  if (images) {
23119
23208
  const { text: rest, urls } = splitImageRefs(text);
@@ -23125,7 +23214,14 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23125
23214
  if (!images || text.trim() || picUrls.length === 0) {
23126
23215
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t>${escapeXml(text)}</hp:t></hp:run></hp:p>`);
23127
23216
  }
23128
- }
23217
+ };
23218
+ segLines.forEach((seg, si) => {
23219
+ for (const line of seg) pushTextLine(line);
23220
+ const nestedXml = nestedXmls[si];
23221
+ if (nestedXml) {
23222
+ paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${nestedXml}</hp:run></hp:p>`);
23223
+ }
23224
+ });
23129
23225
  if (images && picUrls.length > 0) {
23130
23226
  const pics = picUrls.map((u) => {
23131
23227
  const part = images.take(u);
@@ -23135,9 +23231,6 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23135
23231
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}">${pics.join("")}</hp:run></hp:p>`);
23136
23232
  }
23137
23233
  }
23138
- for (const nestedXml of nestedXmls) {
23139
- paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${nestedXml}</hp:run></hp:p>`);
23140
- }
23141
23234
  if (paras.length === 0) {
23142
23235
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t></hp:t></hp:run></hp:p>`);
23143
23236
  }
@@ -27513,7 +27606,7 @@ async function parse(input, options) {
27513
27606
  }
27514
27607
  async function parseImage(buffer, options) {
27515
27608
  try {
27516
- const { parseImageDocument } = await import("./image-ocr-SLUEM3FA.js");
27609
+ const { parseImageDocument } = await import("./image-ocr-O3YQ3KEN.js");
27517
27610
  const { blocks, warnings } = await parseImageDocument(buffer, options);
27518
27611
  return {
27519
27612
  success: true,
@@ -27571,7 +27664,7 @@ async function parseHwp(buffer, options) {
27571
27664
  async function parsePdf(buffer, options) {
27572
27665
  let parsePdfDocument;
27573
27666
  try {
27574
- const mod = await import("./parser-F5KY3YSD.js");
27667
+ const mod = await import("./parser-UX5T6KTZ.js");
27575
27668
  parsePdfDocument = mod.parsePdfDocument;
27576
27669
  } catch {
27577
27670
  return {
@@ -27705,4 +27798,4 @@ export {
27705
27798
  parseHwpml,
27706
27799
  fillForm
27707
27800
  };
27708
- //# sourceMappingURL=chunk-WWYAYZ5U.js.map
27801
+ //# sourceMappingURL=chunk-WX75LYAS.js.map