kordoc 4.0.4 → 4.0.6

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 (86) hide show
  1. package/README.md +806 -800
  2. package/dist/{-Q4ZCVQFI.js → -NDU7YGSS.js} +8 -8
  3. package/dist/{chunk-DKMKJMR6.js → chunk-4C7SBZNW.js} +2 -2
  4. package/dist/chunk-4C7SBZNW.js.map +1 -0
  5. package/dist/{chunk-MEPHGCPQ.js → chunk-5CJGKKMZ.js} +1 -1
  6. package/dist/chunk-5CJGKKMZ.js.map +1 -0
  7. package/dist/{chunk-S3KGEEBQ.js → chunk-5SOZXPQY.js} +3 -3
  8. package/dist/chunk-5SOZXPQY.js.map +1 -0
  9. package/dist/{chunk-TXNRIVWA.js → chunk-63ASYC4N.js} +3 -3
  10. package/dist/chunk-63ASYC4N.js.map +1 -0
  11. package/dist/{chunk-5RPYBC2Q.js → chunk-6GBLFQMA.js} +1 -1
  12. package/dist/chunk-6GBLFQMA.js.map +1 -0
  13. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  14. package/dist/{chunk-NIW7CZYX.cjs → chunk-DQJTNXVS.cjs} +5 -4
  15. package/dist/chunk-DQJTNXVS.cjs.map +1 -0
  16. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  17. package/dist/{chunk-MLNHZN32.js → chunk-HC2SEH6I.js} +90 -17
  18. package/dist/chunk-HC2SEH6I.js.map +1 -0
  19. package/dist/{chunk-KSVLQ5BC.js → chunk-HOGJ5ALY.js} +5 -4
  20. package/dist/chunk-HOGJ5ALY.js.map +1 -0
  21. package/dist/{chunk-2RIOXYGA.js → chunk-KA4FEBS2.js} +2 -2
  22. package/dist/chunk-KA4FEBS2.js.map +1 -0
  23. package/dist/{chunk-KA5AN73R.js → chunk-L3I4TIRP.js} +2 -2
  24. package/dist/chunk-L3I4TIRP.js.map +1 -0
  25. package/dist/chunk-MOL7MDBG.js +0 -0
  26. package/dist/{chunk-ZJXR4PWY.js → chunk-UVSOSFER.js} +5 -4
  27. package/dist/chunk-UVSOSFER.js.map +1 -0
  28. package/dist/cli.js +15 -15
  29. package/dist/cli.js.map +1 -1
  30. package/dist/{detect-RI2MQ33K.js → detect-PJZMUL2Z.js} +2 -2
  31. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  32. package/dist/formula-JCNF43NE.js +0 -0
  33. package/dist/index.cjs +437 -364
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +7 -1
  36. package/dist/index.d.ts +7 -1
  37. package/dist/index.js +84 -11
  38. package/dist/index.js.map +1 -1
  39. package/dist/mcp.js +13 -13
  40. package/dist/mcp.js.map +1 -1
  41. package/dist/page-range-737B4EZW.js +0 -0
  42. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  43. package/dist/{parser-46JGSTPR.js → parser-C636QIOB.js} +72 -4
  44. package/dist/parser-C636QIOB.js.map +1 -0
  45. package/dist/{parser-TLCC67W6.js → parser-DMKHIV4E.js} +71 -3
  46. package/dist/parser-DMKHIV4E.js.map +1 -0
  47. package/dist/{parser-2ZUTCU2G.cjs → parser-VEY4B5CJ.cjs} +83 -15
  48. package/dist/parser-VEY4B5CJ.cjs.map +1 -0
  49. package/dist/{profile-io-MRVIJ5T4.js → profile-io-JYGCC6XQ.js} +3 -3
  50. package/dist/{provider-G4C2V2PD.cjs → provider-5K7O3Z2O.cjs} +1 -1
  51. package/dist/provider-5K7O3Z2O.cjs.map +1 -0
  52. package/dist/{provider-AKROB7WQ.js → provider-7H4CPZYS.js} +1 -1
  53. package/dist/provider-7H4CPZYS.js.map +1 -0
  54. package/dist/{provider-4ZJKV3DC.js → provider-H4WWSPOV.js} +1 -1
  55. package/dist/provider-H4WWSPOV.js.map +1 -0
  56. package/dist/render-ISOEOMTM.js +10 -0
  57. package/dist/seal-676ZIAZZ.js +10 -0
  58. package/dist/setup-57FB3LSP.js +0 -0
  59. package/dist/{watch-NZNVJ4YD.js → watch-ZQUFJBFR.js} +8 -8
  60. package/dist/watch-ZQUFJBFR.js.map +1 -0
  61. package/package.json +97 -97
  62. package/dist/chunk-2RIOXYGA.js.map +0 -1
  63. package/dist/chunk-5RPYBC2Q.js.map +0 -1
  64. package/dist/chunk-DKMKJMR6.js.map +0 -1
  65. package/dist/chunk-KA5AN73R.js.map +0 -1
  66. package/dist/chunk-KSVLQ5BC.js.map +0 -1
  67. package/dist/chunk-MEPHGCPQ.js.map +0 -1
  68. package/dist/chunk-MLNHZN32.js.map +0 -1
  69. package/dist/chunk-NIW7CZYX.cjs.map +0 -1
  70. package/dist/chunk-S3KGEEBQ.js.map +0 -1
  71. package/dist/chunk-TXNRIVWA.js.map +0 -1
  72. package/dist/chunk-ZJXR4PWY.js.map +0 -1
  73. package/dist/parser-2ZUTCU2G.cjs.map +0 -1
  74. package/dist/parser-46JGSTPR.js.map +0 -1
  75. package/dist/parser-TLCC67W6.js.map +0 -1
  76. package/dist/provider-4ZJKV3DC.js.map +0 -1
  77. package/dist/provider-AKROB7WQ.js.map +0 -1
  78. package/dist/provider-G4C2V2PD.cjs.map +0 -1
  79. package/dist/render-TTOG6CHW.js +0 -10
  80. package/dist/seal-NMLZ3M3K.js +0 -10
  81. package/dist/watch-NZNVJ4YD.js.map +0 -1
  82. /package/dist/{-Q4ZCVQFI.js.map → -NDU7YGSS.js.map} +0 -0
  83. /package/dist/{detect-RI2MQ33K.js.map → detect-PJZMUL2Z.js.map} +0 -0
  84. /package/dist/{profile-io-MRVIJ5T4.js.map → profile-io-JYGCC6XQ.js.map} +0 -0
  85. /package/dist/{render-TTOG6CHW.js.map → render-ISOEOMTM.js.map} +0 -0
  86. /package/dist/{seal-NMLZ3M3K.js.map → seal-676ZIAZZ.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- var _chunkNIW7CZYXcjs = require('./chunk-NIW7CZYX.cjs');
23
+ var _chunkDQJTNXVScjs = require('./chunk-DQJTNXVS.cjs');
24
24
 
25
25
 
26
26
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -406,7 +406,7 @@ function createSectionShared() {
406
406
  function createXmlParser(warnings) {
407
407
  return new (0, _xmldom.DOMParser)({
408
408
  onError(level, msg2) {
409
- if (level === "fatalError") throw new (0, _chunkNIW7CZYXcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
409
+ if (level === "fatalError") throw new (0, _chunkDQJTNXVScjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
410
410
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
411
411
  }
412
412
  });
@@ -462,10 +462,10 @@ async function extractHwpxStyles(zip, decompressed) {
462
462
  const xml = await file.async("text");
463
463
  if (decompressed) {
464
464
  decompressed.total += xml.length * 2;
465
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
465
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
466
466
  }
467
467
  const parser = createXmlParser();
468
- const doc = parser.parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, xml), "text/xml");
468
+ const doc = parser.parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, xml), "text/xml");
469
469
  if (!doc.documentElement) continue;
470
470
  const domDoc = doc;
471
471
  parseCharProperties(domDoc, result.charProperties);
@@ -648,9 +648,9 @@ function detectHwpxHeadings(blocks, styleMap) {
648
648
  let level = 0;
649
649
  if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
650
650
  const ratio = block.style.fontSize / baseFontSize;
651
- if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H1) level = 1;
652
- else if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H2) level = 2;
653
- else if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H3) level = 3;
651
+ if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H1) level = 1;
652
+ else if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H2) level = 2;
653
+ else if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H3) level = 3;
654
654
  }
655
655
  const compactText = text.replace(/\s+/g, "");
656
656
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1575,7 +1575,7 @@ function needsGaejosikAssets(gongmun) {
1575
1575
  }
1576
1576
  function assertFiniteRange(name, value, min, max) {
1577
1577
  if (!Number.isFinite(value) || value < min || value > max) {
1578
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
1578
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
1579
1579
  }
1580
1580
  }
1581
1581
  function validateGongmunOptions(opts) {
@@ -1590,10 +1590,10 @@ function validateGongmunOptions(opts) {
1590
1590
  assertFiniteRange(`margins.${side}`, value, 0, 200);
1591
1591
  }
1592
1592
  if (opts.margins.left + opts.margins.right >= 210) {
1593
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("margins.left + margins.right must be less than 210");
1593
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("margins.left + margins.right must be less than 210");
1594
1594
  }
1595
1595
  if (opts.margins.top + opts.margins.bottom >= 297) {
1596
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("margins.top + margins.bottom must be less than 297");
1596
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("margins.top + margins.bottom must be less than 297");
1597
1597
  }
1598
1598
  }
1599
1599
  if (opts.sizes) {
@@ -1602,7 +1602,7 @@ function validateGongmunOptions(opts) {
1602
1602
  }
1603
1603
  }
1604
1604
  if (opts.approval && opts.approval.length > 6) {
1605
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("approval must contain at most 6 labels");
1605
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("approval must contain at most 6 labels");
1606
1606
  }
1607
1607
  }
1608
1608
  function incompatibleGongmunWarnings(opts) {
@@ -1866,7 +1866,7 @@ function resolveParaHeading(paraEl, ctx) {
1866
1866
 
1867
1867
  // src/hwpx/table-build.ts
1868
1868
  function buildTableWithCellMeta(state) {
1869
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, state.rows);
1869
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, state.rows);
1870
1870
  if (state.caption) table2.caption = state.caption;
1871
1871
  const anchors = [];
1872
1872
  {
@@ -1936,7 +1936,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1936
1936
  const cell2 = parentTable.cell;
1937
1937
  (cell2.blocks ??= []).push(block);
1938
1938
  cell2.hasStructure = true;
1939
- let flat = _chunkNIW7CZYXcjs.convertTableToText.call(void 0, newTable.rows);
1939
+ let flat = _chunkDQJTNXVScjs.convertTableToText.call(void 0, newTable.rows);
1940
1940
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1941
1941
  if (flat) cell2.text += (cell2.text ? "\n" : "") + flat;
1942
1942
  } else {
@@ -1948,7 +1948,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1948
1948
  // src/hwpx/section-walker.ts
1949
1949
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1950
1950
  const parser = createXmlParser(warnings);
1951
- const doc = parser.parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, xml), "text/xml");
1951
+ const doc = parser.parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, xml), "text/xml");
1952
1952
  if (!doc.documentElement) return [];
1953
1953
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1954
1954
  ctx.shared.track.deleteDepth = 0;
@@ -2053,8 +2053,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2053
2053
  const cs = isNaN(rawCs) ? 1 : rawCs;
2054
2054
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
2055
2055
  const rs = isNaN(rawRs) ? 1 : rawRs;
2056
- tableCtx.cell.colSpan = clampSpan(cs, _chunkNIW7CZYXcjs.MAX_COLS);
2057
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkNIW7CZYXcjs.MAX_ROWS);
2056
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkDQJTNXVScjs.MAX_COLS);
2057
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkDQJTNXVScjs.MAX_ROWS);
2058
2058
  }
2059
2059
  break;
2060
2060
  case "p": {
@@ -2072,8 +2072,9 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2072
2072
  if (footnote) text += ` (\uC8FC: ${footnote})`;
2073
2073
  cell2.text += (cell2.text ? "\n" : "") + text;
2074
2074
  const cellBlock = { type: "paragraph", text, pageNumber: ctx.sectionNum };
2075
- if (ctx.shared.kordocLayout === "default" && !_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
2076
- const spans = extractRunSpans(el, ctx);
2075
+ const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
2076
+ if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
2077
+ const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
2077
2078
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
2078
2079
  cellBlock.spans = spans;
2079
2080
  }
@@ -2096,14 +2097,19 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2096
2097
  const eff = ind.left + Math.max(0, ind.intent);
2097
2098
  if (eff > 0) block.indent = eff;
2098
2099
  }
2099
- if (!headingLevel && ctx.shared.kordocLayout === "default") {
2100
+ if (ctx.shared.kordocLayout === "gongmun" && block.indent && /^(?:-|\d{1,3}\)) /.test(text)) {
2101
+ const depth2 = gongmunDepthFromIndent(el, block.indent, ctx);
2102
+ if (depth2) block.listDepth = depth2;
2103
+ }
2104
+ const spanMode = spanModeOf(ctx.shared.kordocLayout);
2105
+ if (!headingLevel && spanMode) {
2100
2106
  if (!_optionalChain([ph, 'optionalAccess', _42 => _42.prefix])) {
2101
- const spans = extractRunSpans(el, ctx);
2107
+ const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
2102
2108
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
2103
2109
  block.spans = spans;
2104
2110
  }
2105
2111
  }
2106
- if (el.getAttribute("paraPrIDRef") === KORDOC_PARA_QUOTE) block.quote = true;
2112
+ if (spanMode !== "foreign" && el.getAttribute("paraPrIDRef") === KORDOC_PARA_QUOTE) block.quote = true;
2107
2113
  }
2108
2114
  blocks.push(block);
2109
2115
  } else {
@@ -2226,8 +2232,15 @@ function collectSubListText(el, ctx, depth = 0) {
2226
2232
  if (tag === "p" || tag === "para") {
2227
2233
  const t = extractParagraphInfo(ch, ctx.styleMap, ctx).text;
2228
2234
  if (t) parts.push(t);
2235
+ const tbls = [];
2236
+ findTopLevelTbls(ch, tbls);
2237
+ for (const tbl2 of tbls) {
2238
+ const flat = flattenSubListTable(tbl2, ctx, depth);
2239
+ if (flat) parts.push(flat);
2240
+ }
2229
2241
  } else if (tag === "tbl") {
2230
- continue;
2242
+ const flat = flattenSubListTable(ch, ctx, depth);
2243
+ if (flat) parts.push(flat);
2231
2244
  } else {
2232
2245
  const t = collectSubListText(ch, ctx, depth + 1);
2233
2246
  if (t) parts.push(t);
@@ -2235,6 +2248,29 @@ function collectSubListText(el, ctx, depth = 0) {
2235
2248
  }
2236
2249
  return parts.join("\n").trim();
2237
2250
  }
2251
+ function flattenSubListTable(el, ctx, depth) {
2252
+ const sink = [];
2253
+ const st = { rows: [], currentRow: [], cell: null };
2254
+ walkSection(el, sink, st, [], ctx, depth + 1);
2255
+ let flat = _chunkDQJTNXVScjs.convertTableToText.call(void 0, st.rows);
2256
+ if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
2257
+ return flat;
2258
+ }
2259
+ function findTopLevelTbls(el, out, depth = 0) {
2260
+ if (depth > MAX_XML_DEPTH) return;
2261
+ const kids2 = el.childNodes;
2262
+ if (!kids2) return;
2263
+ for (let i = 0; i < kids2.length; i++) {
2264
+ const ch = kids2[i];
2265
+ if (ch.nodeType !== 1) continue;
2266
+ const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
2267
+ if (tag === "tbl") {
2268
+ out.push(ch);
2269
+ continue;
2270
+ }
2271
+ findTopLevelTbls(ch, out, depth + 1);
2272
+ }
2273
+ }
2238
2274
  function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2239
2275
  if (depth > MAX_XML_DEPTH) return tableCtx;
2240
2276
  const children = node.childNodes;
@@ -2349,7 +2385,7 @@ function extractHyperlinkHref(fieldBegin) {
2349
2385
  let url = (ch.textContent || "").trim();
2350
2386
  if (!url) continue;
2351
2387
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
2352
- const safe = _chunkNIW7CZYXcjs.sanitizeHref.call(void 0, url);
2388
+ const safe = _chunkDQJTNXVScjs.sanitizeHref.call(void 0, url);
2353
2389
  if (safe) return safe;
2354
2390
  }
2355
2391
  return void 0;
@@ -2487,7 +2523,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2487
2523
  case "hyperlink": {
2488
2524
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
2489
2525
  if (url) {
2490
- const safe = _chunkNIW7CZYXcjs.sanitizeHref.call(void 0, url);
2526
+ const safe = _chunkDQJTNXVScjs.sanitizeHref.call(void 0, url);
2491
2527
  if (safe) href = safe;
2492
2528
  }
2493
2529
  walk(child);
@@ -2593,7 +2629,13 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2593
2629
  }
2594
2630
  var KORDOC_CHAR_CODE = "4";
2595
2631
  var KORDOC_PARA_QUOTE = "6";
2596
- function extractRunSpans(para2, ctx) {
2632
+ function spanModeOf(layout) {
2633
+ if (layout === "default") return "kordoc";
2634
+ if (layout === "gongmun") return "gongmun";
2635
+ if (!layout) return "foreign";
2636
+ return null;
2637
+ }
2638
+ function extractRunSpans(para2, ctx, mode, requireMixed) {
2597
2639
  const styleMap = ctx.styleMap;
2598
2640
  if (!styleMap) return null;
2599
2641
  const spans = [];
@@ -2630,7 +2672,7 @@ function extractRunSpans(para2, ctx) {
2630
2672
  const prId = _nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""));
2631
2673
  const cp = styleMap.charProperties.get(prId);
2632
2674
  const span = { text };
2633
- if (prId === KORDOC_CHAR_CODE) span.code = true;
2675
+ if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
2634
2676
  else {
2635
2677
  if (_optionalChain([cp, 'optionalAccess', _58 => _58.bold])) span.bold = true;
2636
2678
  if (_optionalChain([cp, 'optionalAccess', _59 => _59.italic])) span.italic = true;
@@ -2638,7 +2680,38 @@ function extractRunSpans(para2, ctx) {
2638
2680
  if (span.bold || span.italic || span.code) styled = true;
2639
2681
  spans.push(span);
2640
2682
  }
2641
- return styled && spans.length > 0 ? spans : null;
2683
+ if (!styled || spans.length === 0) return null;
2684
+ const merged = [];
2685
+ for (const s of spans) {
2686
+ const last = merged[merged.length - 1];
2687
+ if (last && !!last.bold === !!s.bold && !!last.italic === !!s.italic && !!last.code === !!s.code) {
2688
+ last.text += s.text;
2689
+ } else {
2690
+ merged.push(s);
2691
+ }
2692
+ }
2693
+ if (requireMixed && !merged.some((s) => !(s.bold || s.italic || s.code))) return null;
2694
+ return merged;
2695
+ }
2696
+ function gongmunDepthFromIndent(para2, left, ctx) {
2697
+ const styleMap = ctx.styleMap;
2698
+ if (!styleMap) return null;
2699
+ let unit = 0;
2700
+ const kids2 = para2.childNodes;
2701
+ for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess', _60 => _60.length]), () => ( 0))); i++) {
2702
+ const child = kids2[i];
2703
+ if (child.nodeType !== 1) continue;
2704
+ const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
2705
+ if (tag !== "run" && tag !== "r") continue;
2706
+ const size = _optionalChain([styleMap, 'access', _61 => _61.charProperties, 'access', _62 => _62.get, 'call', _63 => _63(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _64 => _64.fontSize]);
2707
+ if (size) unit = size * 100;
2708
+ break;
2709
+ }
2710
+ if (!unit) return null;
2711
+ const r = left / unit;
2712
+ const nearInt = Math.round(r);
2713
+ const depth = Math.abs(r - nearInt) < 0.2 ? nearInt : Math.round(2 * r - 1);
2714
+ return depth >= 1 && depth < 8 ? depth : null;
2642
2715
  }
2643
2716
 
2644
2717
  // src/hwpx/images.ts
@@ -2685,7 +2758,7 @@ function collectImageBlocks(blocks, out, ownerCell, depth = 0) {
2685
2758
  } else if (block.type === "table" && block.table) {
2686
2759
  for (const row of block.table.cells) {
2687
2760
  for (const cell2 of row) {
2688
- if (_optionalChain([cell2, 'access', _60 => _60.blocks, 'optionalAccess', _61 => _61.length])) collectImageBlocks(cell2.blocks, out, cell2, depth + 1);
2761
+ if (_optionalChain([cell2, 'access', _65 => _65.blocks, 'optionalAccess', _66 => _66.length])) collectImageBlocks(cell2.blocks, out, cell2, depth + 1);
2689
2762
  }
2690
2763
  }
2691
2764
  }
@@ -2722,13 +2795,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
2722
2795
  }
2723
2796
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
2724
2797
  for (const path of allCandidates) {
2725
- if (_chunkNIW7CZYXcjs.isPathTraversal.call(void 0, path)) continue;
2798
+ if (_chunkDQJTNXVScjs.isPathTraversal.call(void 0, path)) continue;
2726
2799
  const file = zip.file(path);
2727
2800
  if (!file) continue;
2728
2801
  try {
2729
2802
  const data = await file.async("uint8array");
2730
2803
  decompressed.total += data.length;
2731
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2804
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2732
2805
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
2733
2806
  const mimeType = imageExtToMime(ext);
2734
2807
  imageIndex++;
@@ -2737,10 +2810,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
2737
2810
  images.push(img);
2738
2811
  break;
2739
2812
  } catch (err) {
2740
- if (err instanceof _chunkNIW7CZYXcjs.KordocError) throw err;
2813
+ if (err instanceof _chunkDQJTNXVScjs.KordocError) throw err;
2741
2814
  }
2742
2815
  }
2743
- if (!img) _optionalChain([warnings, 'optionalAccess', _62 => _62.push, 'call', _63 => _63({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
2816
+ if (!img) _optionalChain([warnings, 'optionalAccess', _67 => _67.push, 'call', _68 => _68({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
2744
2817
  resolved.set(ref, img);
2745
2818
  }
2746
2819
  if (!img) {
@@ -2799,7 +2872,7 @@ function extractFromBrokenZip(buffer) {
2799
2872
  }
2800
2873
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
2801
2874
  const name = new TextDecoder().decode(nameBytes);
2802
- if (_chunkNIW7CZYXcjs.isPathTraversal.call(void 0, name)) {
2875
+ if (_chunkDQJTNXVScjs.isPathTraversal.call(void 0, name)) {
2803
2876
  pos = fileStart + compSize;
2804
2877
  continue;
2805
2878
  }
@@ -2817,16 +2890,16 @@ function extractFromBrokenZip(buffer) {
2817
2890
  continue;
2818
2891
  }
2819
2892
  totalDecompressed += content.length * 2;
2820
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2893
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2821
2894
  sectionNum++;
2822
2895
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
2823
2896
  } catch (e13) {
2824
2897
  continue;
2825
2898
  }
2826
2899
  }
2827
- if (blocks.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2900
+ if (blocks.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2828
2901
  applyPageText(blocks, shared);
2829
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
2902
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
2830
2903
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
2831
2904
  }
2832
2905
  async function readKordocLayout(zip) {
@@ -2835,7 +2908,7 @@ async function readKordocLayout(zip) {
2835
2908
  try {
2836
2909
  const xml = await file.async("text");
2837
2910
  if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
2838
- return _nullishCoalesce(_optionalChain([xml, 'access', _64 => _64.match, 'call', _65 => _65(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _66 => _66[1]]), () => ( null));
2911
+ return _nullishCoalesce(_optionalChain([xml, 'access', _69 => _69.match, 'call', _70 => _70(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _71 => _71[1]]), () => ( null));
2839
2912
  } catch (e14) {
2840
2913
  return null;
2841
2914
  }
@@ -2851,18 +2924,18 @@ async function resolveSectionPaths(zip) {
2851
2924
  if (paths.length > 0) return paths;
2852
2925
  }
2853
2926
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
2854
- return sectionFiles.map((f) => f.name).sort(_chunkNIW7CZYXcjs.compareSectionPaths);
2927
+ return sectionFiles.map((f) => f.name).sort(_chunkDQJTNXVScjs.compareSectionPaths);
2855
2928
  }
2856
2929
  function parseSectionPathsFromManifest(xml) {
2857
2930
  const parser = createXmlParser();
2858
- const doc = parser.parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, xml), "text/xml");
2931
+ const doc = parser.parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, xml), "text/xml");
2859
2932
  const items = doc.getElementsByTagName("opf:item");
2860
2933
  const spine = doc.getElementsByTagName("opf:itemref");
2861
2934
  const idToHref = /* @__PURE__ */ new Map();
2862
2935
  for (let i = 0; i < items.length; i++) {
2863
2936
  const item = items[i];
2864
2937
  const id = item.getAttribute("id") || "";
2865
- const href = _chunkNIW7CZYXcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2938
+ const href = _chunkDQJTNXVScjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2866
2939
  if (id && href) idToHref.set(id, href);
2867
2940
  }
2868
2941
  if (spine.length > 0) {
@@ -2873,7 +2946,7 @@ function parseSectionPathsFromManifest(xml) {
2873
2946
  }
2874
2947
  if (ordered.length > 0) return ordered;
2875
2948
  }
2876
- return Array.from(idToHref.values()).sort(_chunkNIW7CZYXcjs.compareSectionPaths);
2949
+ return Array.from(idToHref.values()).sort(_chunkDQJTNXVScjs.compareSectionPaths);
2877
2950
  }
2878
2951
 
2879
2952
  // src/hwpx/metadata.ts
@@ -2886,7 +2959,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2886
2959
  const xml = await file.async("text");
2887
2960
  if (decompressed) {
2888
2961
  decompressed.total += xml.length * 2;
2889
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2962
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2890
2963
  }
2891
2964
  parseDublinCoreMetadata(xml, metadata);
2892
2965
  if (metadata.title || metadata.author) return;
@@ -2896,13 +2969,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2896
2969
  }
2897
2970
  function parseDublinCoreMetadata(xml, metadata) {
2898
2971
  const parser = createXmlParser();
2899
- const doc = parser.parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, xml), "text/xml");
2972
+ const doc = parser.parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, xml), "text/xml");
2900
2973
  if (!doc.documentElement) return;
2901
2974
  const getText = (tagNames) => {
2902
2975
  for (const tag of tagNames) {
2903
2976
  const els = doc.getElementsByTagName(tag);
2904
2977
  if (els.length > 0) {
2905
- const text = _optionalChain([els, 'access', _67 => _67[0], 'access', _68 => _68.textContent, 'optionalAccess', _69 => _69.trim, 'call', _70 => _70()]);
2978
+ const text = _optionalChain([els, 'access', _72 => _72[0], 'access', _73 => _73.textContent, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()]);
2906
2979
  if (text) return text;
2907
2980
  }
2908
2981
  }
@@ -2921,7 +2994,7 @@ function parseDublinCoreMetadata(xml, metadata) {
2921
2994
 
2922
2995
  // src/hwpx/parser.ts
2923
2996
  async function parseHwpxDocument(buffer, options) {
2924
- _chunkNIW7CZYXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2997
+ _chunkDQJTNXVScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2925
2998
  let zip;
2926
2999
  try {
2927
3000
  zip = await _jszip2.default.loadAsync(buffer);
@@ -2930,19 +3003,19 @@ async function parseHwpxDocument(buffer, options) {
2930
3003
  }
2931
3004
  const actualEntryCount = Object.keys(zip.files).length;
2932
3005
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
2933
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3006
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2934
3007
  }
2935
3008
  const manifestFile = zip.file("META-INF/manifest.xml");
2936
3009
  if (manifestFile) {
2937
3010
  const manifestXml = await manifestFile.async("text");
2938
3011
  if (isEncryptedHwpx(manifestXml)) {
2939
- if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _71 => _71.filePath])) {
3012
+ if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _76 => _76.filePath])) {
2940
3013
  const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
2941
3014
  if (pages.some((p) => p && p.trim().length > 0)) {
2942
3015
  return comResultToParseResult(pages, pageCount, warnings2);
2943
3016
  }
2944
3017
  }
2945
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
3018
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("DRM \uC554\uD638\uD654\uB41C HWPX \uD30C\uC77C\uC785\uB2C8\uB2E4. Windows + \uD55C\uCEF4 \uC624\uD53C\uC2A4 \uC124\uCE58 \uC2DC \uC790\uB3D9 \uCD94\uCD9C\uB429\uB2C8\uB2E4.");
2946
3019
  }
2947
3020
  }
2948
3021
  const decompressed = { total: 0 };
@@ -2951,9 +3024,9 @@ async function parseHwpxDocument(buffer, options) {
2951
3024
  const styleMap = await extractHwpxStyles(zip, decompressed);
2952
3025
  const warnings = [];
2953
3026
  const sectionPaths = await resolveSectionPaths(zip);
2954
- if (sectionPaths.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3027
+ if (sectionPaths.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2955
3028
  metadata.pageCount = sectionPaths.length;
2956
- const pageFilter = _optionalChain([options, 'optionalAccess', _72 => _72.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
3029
+ const pageFilter = _optionalChain([options, 'optionalAccess', _77 => _77.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
2957
3030
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
2958
3031
  const blocks = [];
2959
3032
  const shared = createSectionShared();
@@ -2966,12 +3039,12 @@ async function parseHwpxDocument(buffer, options) {
2966
3039
  try {
2967
3040
  const xml = await file.async("text");
2968
3041
  decompressed.total += xml.length * 2;
2969
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3042
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2970
3043
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
2971
3044
  parsedSections++;
2972
- _optionalChain([options, 'optionalAccess', _73 => _73.onProgress, 'optionalCall', _74 => _74(parsedSections, totalTarget)]);
3045
+ _optionalChain([options, 'optionalAccess', _78 => _78.onProgress, 'optionalCall', _79 => _79(parsedSections, totalTarget)]);
2973
3046
  } catch (secErr) {
2974
- if (secErr instanceof _chunkNIW7CZYXcjs.KordocError) throw secErr;
3047
+ if (secErr instanceof _chunkDQJTNXVScjs.KordocError) throw secErr;
2975
3048
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
2976
3049
  }
2977
3050
  }
@@ -2979,7 +3052,7 @@ async function parseHwpxDocument(buffer, options) {
2979
3052
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
2980
3053
  detectHwpxHeadings(blocks, styleMap);
2981
3054
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
2982
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
3055
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
2983
3056
  return { markdown, blocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
2984
3057
  }
2985
3058
 
@@ -3046,7 +3119,7 @@ function decompressStream(data) {
3046
3119
  return _zlib.inflateRawSync.call(void 0, data, opts);
3047
3120
  }
3048
3121
  function parseFileHeader(data) {
3049
- if (data.length < 40) throw new (0, _chunkNIW7CZYXcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
3122
+ if (data.length < 40) throw new (0, _chunkDQJTNXVScjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
3050
3123
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
3051
3124
  return {
3052
3125
  signature: sig,
@@ -3179,7 +3252,7 @@ function appendParaText(state, data, resolveControl) {
3179
3252
  const resolveAt = (byteOffset, extended) => {
3180
3253
  const ctrlId = data.readUInt32LE(byteOffset);
3181
3254
  const idx = extended ? state.ctrlIdx : -1;
3182
- const replacement = _optionalChain([resolveControl, 'optionalCall', _75 => _75(idx, ctrlId)]);
3255
+ const replacement = _optionalChain([resolveControl, 'optionalCall', _80 => _80(idx, ctrlId)]);
3183
3256
  if (replacement) result += replacement;
3184
3257
  if (extended) state.ctrlIdx++;
3185
3258
  };
@@ -3550,7 +3623,7 @@ function extractHwp5Images(fileIndex, blocks, warnings) {
3550
3623
  const binDataMap = /* @__PURE__ */ new Map();
3551
3624
  if (fileIndex) {
3552
3625
  for (const entry of fileIndex) {
3553
- if (!_optionalChain([entry, 'optionalAccess', _76 => _76.name]) || !entry.content) continue;
3626
+ if (!_optionalChain([entry, 'optionalAccess', _81 => _81.name]) || !entry.content) continue;
3554
3627
  const match = entry.name.match(BIN_ENTRY_RE);
3555
3628
  if (!match) continue;
3556
3629
  const idx = parseInt(match[1], 16);
@@ -3696,7 +3769,7 @@ function escapeRegExp(s) {
3696
3769
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3697
3770
  }
3698
3771
  function inlineImagesIntoMarkdown(markdown, images, opts) {
3699
- const compress = _optionalChain([opts, 'optionalAccess', _77 => _77.compress]) !== false;
3772
+ const compress = _optionalChain([opts, 'optionalAccess', _82 => _82.compress]) !== false;
3700
3773
  let out = markdown;
3701
3774
  for (const img of images) {
3702
3775
  let bytes = img.data;
@@ -4716,22 +4789,22 @@ function parseHwp5Document(buffer, options) {
4716
4789
  lenientCfb = parseLenientCfb(buffer);
4717
4790
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
4718
4791
  } catch (e22) {
4719
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4792
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4720
4793
  }
4721
4794
  }
4722
4795
  const findStream = (path) => {
4723
4796
  if (cfb) {
4724
4797
  const entry = CFB.find(cfb, path);
4725
- return _optionalChain([entry, 'optionalAccess', _78 => _78.content]) ? Buffer.from(entry.content) : null;
4798
+ return _optionalChain([entry, 'optionalAccess', _83 => _83.content]) ? Buffer.from(entry.content) : null;
4726
4799
  }
4727
4800
  return lenientCfb.findStream(path);
4728
4801
  };
4729
4802
  const headerData = findStream("/FileHeader");
4730
- if (!headerData) throw new (0, _chunkNIW7CZYXcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4803
+ if (!headerData) throw new (0, _chunkDQJTNXVScjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4731
4804
  const header = parseFileHeader(headerData);
4732
- if (header.signature !== "HWP Document File") throw new (0, _chunkNIW7CZYXcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4733
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4734
- if (header.flags & FLAG_DRM) throw new (0, _chunkNIW7CZYXcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4805
+ if (header.signature !== "HWP Document File") throw new (0, _chunkDQJTNXVScjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4806
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4807
+ if (header.flags & FLAG_DRM) throw new (0, _chunkDQJTNXVScjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4735
4808
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
4736
4809
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
4737
4810
  const metadata = {
@@ -4740,9 +4813,9 @@ function parseHwp5Document(buffer, options) {
4740
4813
  if (cfb) extractHwp5Metadata(cfb, metadata);
4741
4814
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
4742
4815
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
4743
- if (sections.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4816
+ if (sections.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4744
4817
  metadata.pageCount = sections.length;
4745
- const pageFilter = _optionalChain([options, 'optionalAccess', _79 => _79.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4818
+ const pageFilter = _optionalChain([options, 'optionalAccess', _84 => _84.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4746
4819
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
4747
4820
  const bodyBlocks = [];
4748
4821
  const doc = createHwp5DocState();
@@ -4754,22 +4827,22 @@ function parseHwp5Document(buffer, options) {
4754
4827
  const sectionData = sections[si];
4755
4828
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
4756
4829
  totalDecompressed += data.length;
4757
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4830
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4758
4831
  const records = readRecords(data);
4759
4832
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
4760
4833
  bodyBlocks.push(...sectionBlocks);
4761
4834
  parsedSections++;
4762
- _optionalChain([options, 'optionalAccess', _80 => _80.onProgress, 'optionalCall', _81 => _81(parsedSections, totalTarget)]);
4835
+ _optionalChain([options, 'optionalAccess', _85 => _85.onProgress, 'optionalCall', _86 => _86(parsedSections, totalTarget)]);
4763
4836
  } catch (secErr) {
4764
- if (secErr instanceof _chunkNIW7CZYXcjs.KordocError) throw secErr;
4837
+ if (secErr instanceof _chunkDQJTNXVScjs.KordocError) throw secErr;
4765
4838
  warnings.push({ page: si + 1, message: `\uC139\uC158 ${si + 1} \uD30C\uC2F1 \uC2E4\uD328: ${secErr instanceof Error ? secErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "PARTIAL_PARSE" });
4766
4839
  }
4767
4840
  }
4768
4841
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
4769
4842
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
4770
- let flatBlocks = _chunkNIW7CZYXcjs.flattenLayoutTables.call(void 0, blocks);
4771
- if (_optionalChain([options, 'optionalAccess', _82 => _82.dedupeRunningHeaders])) {
4772
- const deduped = _chunkNIW7CZYXcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4843
+ let flatBlocks = _chunkDQJTNXVScjs.flattenLayoutTables.call(void 0, blocks);
4844
+ if (_optionalChain([options, 'optionalAccess', _87 => _87.dedupeRunningHeaders])) {
4845
+ const deduped = _chunkDQJTNXVScjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4773
4846
  const removed = flatBlocks.length - deduped.length;
4774
4847
  if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
4775
4848
  flatBlocks = deduped;
@@ -4778,8 +4851,8 @@ function parseHwp5Document(buffer, options) {
4778
4851
  detectHwp5Headings(flatBlocks, docInfo);
4779
4852
  }
4780
4853
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
4781
- let markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, flatBlocks);
4782
- if (_optionalChain([options, 'optionalAccess', _83 => _83.inlineImages]) && images.length > 0) {
4854
+ let markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, flatBlocks);
4855
+ if (_optionalChain([options, 'optionalAccess', _88 => _88.inlineImages]) && images.length > 0) {
4783
4856
  try {
4784
4857
  markdown = inlineImagesIntoMarkdown(markdown, images, { compress: true });
4785
4858
  } catch (inlineErr) {
@@ -4791,7 +4864,7 @@ function parseHwp5Document(buffer, options) {
4791
4864
  function parseDocInfoStream(cfb, compressed) {
4792
4865
  try {
4793
4866
  const entry = CFB.find(cfb, "/DocInfo");
4794
- if (!_optionalChain([entry, 'optionalAccess', _84 => _84.content])) return null;
4867
+ if (!_optionalChain([entry, 'optionalAccess', _89 => _89.content])) return null;
4795
4868
  const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
4796
4869
  const records = readRecords(data);
4797
4870
  return parseDocInfo(records);
@@ -4812,7 +4885,7 @@ function detectHwp5Headings(blocks, docInfo) {
4812
4885
  let baseFontSize = 0;
4813
4886
  const sizeFreq = /* @__PURE__ */ new Map();
4814
4887
  for (const b of blocks) {
4815
- if (_optionalChain([b, 'access', _85 => _85.style, 'optionalAccess', _86 => _86.fontSize]) && b.text) {
4888
+ if (_optionalChain([b, 'access', _90 => _90.style, 'optionalAccess', _91 => _91.fontSize]) && b.text) {
4816
4889
  sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
4817
4890
  }
4818
4891
  }
@@ -4828,7 +4901,7 @@ function detectHwp5Headings(blocks, docInfo) {
4828
4901
  const name = (style.nameKo || style.name).toLowerCase();
4829
4902
  if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
4830
4903
  const cs = docInfo.charShapes[style.charShapeId];
4831
- if (_optionalChain([cs, 'optionalAccess', _87 => _87.fontSize]) > 0) {
4904
+ if (_optionalChain([cs, 'optionalAccess', _92 => _92.fontSize]) > 0) {
4832
4905
  baseFontSize = cs.fontSize / 10;
4833
4906
  break;
4834
4907
  }
@@ -4843,11 +4916,11 @@ function detectHwp5Headings(blocks, docInfo) {
4843
4916
  if (text.length === 0 || text.length > 200) continue;
4844
4917
  if (/^\d+$/.test(text)) continue;
4845
4918
  let level = 0;
4846
- if (_optionalChain([block, 'access', _88 => _88.style, 'optionalAccess', _89 => _89.fontSize]) && baseFontSize > 0) {
4919
+ if (_optionalChain([block, 'access', _93 => _93.style, 'optionalAccess', _94 => _94.fontSize]) && baseFontSize > 0) {
4847
4920
  const ratio = block.style.fontSize / baseFontSize;
4848
- if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H1) level = 1;
4849
- else if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H2) level = 2;
4850
- else if (ratio >= _chunkNIW7CZYXcjs.HEADING_RATIO_H3) level = 3;
4921
+ if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H1) level = 1;
4922
+ else if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H2) level = 2;
4923
+ else if (ratio >= _chunkDQJTNXVScjs.HEADING_RATIO_H3) level = 3;
4851
4924
  }
4852
4925
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
4853
4926
  if (level === 0) level = 2;
@@ -4863,7 +4936,7 @@ function detectHwp5Headings(blocks, docInfo) {
4863
4936
  function extractHwp5Metadata(cfb, metadata) {
4864
4937
  try {
4865
4938
  const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
4866
- if (!_optionalChain([summaryEntry, 'optionalAccess', _90 => _90.content])) return;
4939
+ if (!_optionalChain([summaryEntry, 'optionalAccess', _95 => _95.content])) return;
4867
4940
  const data = Buffer.from(summaryEntry.content);
4868
4941
  if (data.length < 48) return;
4869
4942
  const numSets = data.readUInt32LE(24);
@@ -4896,7 +4969,7 @@ function findViewTextSections(cfb, compressed) {
4896
4969
  const sections = [];
4897
4970
  for (let i = 0; i < MAX_SECTIONS; i++) {
4898
4971
  const entry = CFB.find(cfb, `/ViewText/Section${i}`);
4899
- if (!_optionalChain([entry, 'optionalAccess', _91 => _91.content])) break;
4972
+ if (!_optionalChain([entry, 'optionalAccess', _96 => _96.content])) break;
4900
4973
  try {
4901
4974
  const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
4902
4975
  sections.push({ idx: i, content: decrypted });
@@ -4910,13 +4983,13 @@ function findSections(cfb) {
4910
4983
  const sections = [];
4911
4984
  for (let i = 0; i < MAX_SECTIONS; i++) {
4912
4985
  const entry = CFB.find(cfb, `/BodyText/Section${i}`);
4913
- if (!_optionalChain([entry, 'optionalAccess', _92 => _92.content])) break;
4986
+ if (!_optionalChain([entry, 'optionalAccess', _97 => _97.content])) break;
4914
4987
  sections.push({ idx: i, content: Buffer.from(entry.content) });
4915
4988
  }
4916
4989
  if (sections.length === 0 && cfb.FileIndex) {
4917
4990
  for (const entry of cfb.FileIndex) {
4918
4991
  if (sections.length >= MAX_SECTIONS) break;
4919
- if (_optionalChain([entry, 'access', _93 => _93.name, 'optionalAccess', _94 => _94.startsWith, 'call', _95 => _95("Section")]) && entry.content) {
4992
+ if (_optionalChain([entry, 'access', _98 => _98.name, 'optionalAccess', _99 => _99.startsWith, 'call', _100 => _100("Section")]) && entry.content) {
4920
4993
  const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
4921
4994
  sections.push({ idx, content: Buffer.from(entry.content) });
4922
4995
  }
@@ -4932,7 +5005,7 @@ function findSectionsLenient(lcfb, compressed) {
4932
5005
  if (!raw) break;
4933
5006
  const content = compressed ? decompressStream(raw) : raw;
4934
5007
  totalDecompressed += content.length;
4935
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5008
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4936
5009
  sections.push({ idx: i, content });
4937
5010
  }
4938
5011
  if (sections.length === 0) {
@@ -4944,7 +5017,7 @@ function findSectionsLenient(lcfb, compressed) {
4944
5017
  if (raw) {
4945
5018
  const content = compressed ? decompressStream(raw) : raw;
4946
5019
  totalDecompressed += content.length;
4947
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5020
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4948
5021
  sections.push({ idx, content });
4949
5022
  }
4950
5023
  }
@@ -4961,7 +5034,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
4961
5034
  try {
4962
5035
  const content = decryptViewText(raw, compressed);
4963
5036
  totalDecompressed += content.length;
4964
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5037
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4965
5038
  sections.push({ idx: i, content });
4966
5039
  } catch (e27) {
4967
5040
  break;
@@ -5062,9 +5135,9 @@ function parseParagraph(records, start, end, ctx) {
5062
5135
  const applied = [];
5063
5136
  for (const r of ranges) {
5064
5137
  const ctrl = ctrls[r.ctrlIdx];
5065
- if (!_optionalChain([ctrl, 'optionalAccess', _96 => _96.href]) || r.end <= r.start) continue;
5138
+ if (!_optionalChain([ctrl, 'optionalAccess', _101 => _101.href]) || r.end <= r.start) continue;
5066
5139
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
5067
- const href = _chunkNIW7CZYXcjs.sanitizeHref.call(void 0, ctrl.href);
5140
+ const href = _chunkDQJTNXVScjs.sanitizeHref.call(void 0, ctrl.href);
5068
5141
  if (!href) continue;
5069
5142
  const anchor = text.slice(r.start, r.end);
5070
5143
  if (!anchor.trim()) continue;
@@ -5082,7 +5155,7 @@ function parseParagraph(records, start, end, ctx) {
5082
5155
  }
5083
5156
  if (ps.headType === 1 || ps.headType === 2) {
5084
5157
  const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
5085
- const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _97 => _97.docInfo, 'optionalAccess', _98 => _98.numberings, 'access', _99 => _99[nid - 1]]) : void 0;
5158
+ const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _102 => _102.docInfo, 'optionalAccess', _103 => _103.numberings, 'access', _104 => _104[nid - 1]]) : void 0;
5086
5159
  if (numbering) {
5087
5160
  const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
5088
5161
  const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
@@ -5092,7 +5165,7 @@ function parseParagraph(records, start, end, ctx) {
5092
5165
  }
5093
5166
  }
5094
5167
  } else if (ps.headType === 3) {
5095
- const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _100 => _100.docInfo, 'optionalAccess', _101 => _101.bullets, 'access', _102 => _102[ps.numberingId - 1]]) : void 0;
5168
+ const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _105 => _105.docInfo, 'optionalAccess', _106 => _106.bullets, 'access', _107 => _107[ps.numberingId - 1]]) : void 0;
5096
5169
  if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
5097
5170
  }
5098
5171
  }
@@ -5297,8 +5370,8 @@ function parseTableControl(ctrl, records, ctx) {
5297
5370
  let tableIdx = -1;
5298
5371
  for (let i2 = childStart; i2 < childEnd; i2++) {
5299
5372
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
5300
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkNIW7CZYXcjs.MAX_ROWS);
5301
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkNIW7CZYXcjs.MAX_COLS);
5373
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkDQJTNXVScjs.MAX_ROWS);
5374
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkDQJTNXVScjs.MAX_COLS);
5302
5375
  tableIdx = i2;
5303
5376
  break;
5304
5377
  }
@@ -5338,7 +5411,7 @@ function parseTableControl(ctrl, records, ctx) {
5338
5411
  const cellRows2 = arrangeCells(rows, cols, cells);
5339
5412
  const irCells = cellRows2.map((row) => row.map((c) => {
5340
5413
  const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
5341
- if (_optionalChain([c, 'access', _103 => _103.blocks, 'optionalAccess', _104 => _104.length])) ir.blocks = c.blocks;
5414
+ if (_optionalChain([c, 'access', _108 => _108.blocks, 'optionalAccess', _109 => _109.length])) ir.blocks = c.blocks;
5342
5415
  if (c.isHeader) ir.isHeader = true;
5343
5416
  return ir;
5344
5417
  }));
@@ -5347,7 +5420,7 @@ function parseTableControl(ctrl, records, ctx) {
5347
5420
  return table3;
5348
5421
  }
5349
5422
  const cellRows = arrangeCells(rows, cols, cells);
5350
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, cellRows);
5423
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, cellRows);
5351
5424
  if (caption && table2.rows > 0) table2.caption = caption;
5352
5425
  return table2.rows > 0 ? table2 : null;
5353
5426
  }
@@ -5364,8 +5437,8 @@ function parseCell(records, lhIdx, end, ctx) {
5364
5437
  rowAddr = rec.data.readUInt16LE(10);
5365
5438
  const cs = rec.data.readUInt16LE(12);
5366
5439
  const rs = rec.data.readUInt16LE(14);
5367
- if (cs > 0) colSpan = Math.min(cs, _chunkNIW7CZYXcjs.MAX_COLS);
5368
- if (rs > 0) rowSpan = Math.min(rs, _chunkNIW7CZYXcjs.MAX_ROWS);
5440
+ if (cs > 0) colSpan = Math.min(cs, _chunkDQJTNXVScjs.MAX_COLS);
5441
+ if (rs > 0) rowSpan = Math.min(rs, _chunkDQJTNXVScjs.MAX_ROWS);
5369
5442
  }
5370
5443
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
5371
5444
  const parts = [];
@@ -5375,7 +5448,7 @@ function parseCell(records, lhIdx, end, ctx) {
5375
5448
  parts.push(`![image](hwp5bin:${b.text})`);
5376
5449
  hasStructure = true;
5377
5450
  } else if (b.type === "table" && b.table) {
5378
- const flat = _chunkNIW7CZYXcjs.convertTableToText.call(void 0, b.table.cells);
5451
+ const flat = _chunkDQJTNXVScjs.convertTableToText.call(void 0, b.table.cells);
5379
5452
  if (flat) parts.push(flat);
5380
5453
  hasStructure = true;
5381
5454
  } else if (b.text) {
@@ -5472,8 +5545,8 @@ function pictureToImageBlock(data, ctx) {
5472
5545
  if (data.length < 73) return null;
5473
5546
  const binDataId = data.readUInt16LE(71);
5474
5547
  if (binDataId === 0) return null;
5475
- const item = _optionalChain([ctx, 'access', _105 => _105.docInfo, 'optionalAccess', _106 => _106.binData, 'access', _107 => _107[binDataId - 1]]);
5476
- if (_optionalChain([item, 'optionalAccess', _108 => _108.kind]) === "link") {
5548
+ const item = _optionalChain([ctx, 'access', _110 => _110.docInfo, 'optionalAccess', _111 => _111.binData, 'access', _112 => _112[binDataId - 1]]);
5549
+ if (_optionalChain([item, 'optionalAccess', _113 => _113.kind]) === "link") {
5477
5550
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
5478
5551
  return null;
5479
5552
  }
@@ -17804,15 +17877,15 @@ function getElements(parent, tagName) {
17804
17877
  const result = [];
17805
17878
  for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
17806
17879
  if (result.length > 0) return result;
17807
- const nsNodes = _optionalChain([parent, 'access', _109 => _109.getElementsByTagNameNS, 'optionalCall', _110 => _110("*", tagName)]);
17880
+ const nsNodes = _optionalChain([parent, 'access', _114 => _114.getElementsByTagNameNS, 'optionalCall', _115 => _115("*", tagName)]);
17808
17881
  if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
17809
17882
  return result;
17810
17883
  }
17811
17884
  function getTextContent(el) {
17812
- return _nullishCoalesce(_optionalChain([el, 'access', _111 => _111.textContent, 'optionalAccess', _112 => _112.trim, 'call', _113 => _113()]), () => ( ""));
17885
+ return _nullishCoalesce(_optionalChain([el, 'access', _116 => _116.textContent, 'optionalAccess', _117 => _117.trim, 'call', _118 => _118()]), () => ( ""));
17813
17886
  }
17814
17887
  function parseXml(text) {
17815
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, text), "text/xml");
17888
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, text), "text/xml");
17816
17889
  }
17817
17890
  function parseSharedStrings(xml) {
17818
17891
  const doc = parseXml(xml);
@@ -17949,14 +18022,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
17949
18022
  const merge = mergeMap.get(key);
17950
18023
  row.push({
17951
18024
  text,
17952
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _114 => _114.colSpan]), () => ( 1)),
17953
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _115 => _115.rowSpan]), () => ( 1))
18025
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _119 => _119.colSpan]), () => ( 1)),
18026
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _120 => _120.rowSpan]), () => ( 1))
17954
18027
  });
17955
18028
  }
17956
18029
  cellRows.push(row);
17957
18030
  }
17958
18031
  if (cellRows.length > 0) {
17959
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, cellRows);
18032
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, cellRows);
17960
18033
  if (table2.rows > 0) {
17961
18034
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
17962
18035
  }
@@ -17964,12 +18037,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
17964
18037
  return blocks;
17965
18038
  }
17966
18039
  async function parseXlsxDocument(buffer, options) {
17967
- _chunkNIW7CZYXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
18040
+ _chunkDQJTNXVScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
17968
18041
  const zip = await _jszip2.default.loadAsync(buffer);
17969
18042
  const warnings = [];
17970
18043
  const workbookFile = zip.file("xl/workbook.xml");
17971
18044
  if (!workbookFile) {
17972
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18045
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17973
18046
  }
17974
18047
  let sharedStrings = [];
17975
18048
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -17978,7 +18051,7 @@ async function parseXlsxDocument(buffer, options) {
17978
18051
  }
17979
18052
  const sheets = parseWorkbook(await workbookFile.async("text"));
17980
18053
  if (sheets.length === 0) {
17981
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
18054
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17982
18055
  }
17983
18056
  let relsMap = /* @__PURE__ */ new Map();
17984
18057
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -17986,7 +18059,7 @@ async function parseXlsxDocument(buffer, options) {
17986
18059
  relsMap = parseRels(await relsFile.async("text"));
17987
18060
  }
17988
18061
  let pageFilter = null;
17989
- if (_optionalChain([options, 'optionalAccess', _116 => _116.pages])) {
18062
+ if (_optionalChain([options, 'optionalAccess', _121 => _121.pages])) {
17990
18063
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
17991
18064
  pageFilter = parsePageRange2(options.pages, sheets.length);
17992
18065
  }
@@ -17995,7 +18068,7 @@ async function parseXlsxDocument(buffer, options) {
17995
18068
  for (let i = 0; i < processedSheets; i++) {
17996
18069
  if (pageFilter && !pageFilter.has(i + 1)) continue;
17997
18070
  const sheet = sheets[i];
17998
- _optionalChain([options, 'optionalAccess', _117 => _117.onProgress, 'optionalCall', _118 => _118(i + 1, processedSheets)]);
18071
+ _optionalChain([options, 'optionalAccess', _122 => _122.onProgress, 'optionalCall', _123 => _123(i + 1, processedSheets)]);
17999
18072
  let sheetPath = relsMap.get(sheet.rId);
18000
18073
  if (sheetPath) {
18001
18074
  if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
@@ -18050,7 +18123,7 @@ async function parseXlsxDocument(buffer, options) {
18050
18123
  } catch (e28) {
18051
18124
  }
18052
18125
  }
18053
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
18126
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
18054
18127
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
18055
18128
  }
18056
18129
 
@@ -18457,11 +18530,11 @@ function processGlobals(records) {
18457
18530
  let encrypted = false;
18458
18531
  const firstBof = records[0];
18459
18532
  if (!firstBof || firstBof.opcode !== OP_BOF) {
18460
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18533
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18461
18534
  }
18462
18535
  const bof = decodeBof(firstBof.data);
18463
18536
  if (!bof || bof.dt !== DT_GLOBALS) {
18464
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18537
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18465
18538
  }
18466
18539
  let i = 1;
18467
18540
  while (i < records.length) {
@@ -18569,14 +18642,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
18569
18642
  const merge = mergeMap.get(key);
18570
18643
  row.push({
18571
18644
  text: grid[r][c],
18572
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _119 => _119.colSpan]), () => ( 1)),
18573
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _120 => _120.rowSpan]), () => ( 1))
18645
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _124 => _124.colSpan]), () => ( 1)),
18646
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _125 => _125.rowSpan]), () => ( 1))
18574
18647
  });
18575
18648
  }
18576
18649
  cellRows.push(row);
18577
18650
  }
18578
18651
  if (cellRows.length > 0) {
18579
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, cellRows);
18652
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, cellRows);
18580
18653
  if (table2.rows > 0) {
18581
18654
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
18582
18655
  }
@@ -18589,21 +18662,21 @@ async function parseXlsDocument(buffer, options) {
18589
18662
  try {
18590
18663
  cfb = parseLenientCfb(buf);
18591
18664
  } catch (e) {
18592
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
18665
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
18593
18666
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
18594
18667
  );
18595
18668
  }
18596
18669
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
18597
18670
  if (!wb) {
18598
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18671
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18599
18672
  }
18600
18673
  const records = readRecords2(wb);
18601
18674
  if (records.length === 0) {
18602
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18675
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18603
18676
  }
18604
18677
  const firstBof = decodeBof(records[0].data);
18605
18678
  if (firstBof && firstBof.vers !== 1536) {
18606
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
18679
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
18607
18680
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
18608
18681
  );
18609
18682
  }
@@ -18624,7 +18697,7 @@ async function parseXlsDocument(buffer, options) {
18624
18697
  }
18625
18698
  const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
18626
18699
  let pageFilter = null;
18627
- if (_optionalChain([options, 'optionalAccess', _121 => _121.pages])) {
18700
+ if (_optionalChain([options, 'optionalAccess', _126 => _126.pages])) {
18628
18701
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
18629
18702
  pageFilter = parsePageRange2(options.pages, totalSheets);
18630
18703
  }
@@ -18633,7 +18706,7 @@ async function parseXlsDocument(buffer, options) {
18633
18706
  if (pageFilter && !pageFilter.has(i + 1)) continue;
18634
18707
  const meta = globals.sheets[i];
18635
18708
  if (meta.dt !== 0) continue;
18636
- _optionalChain([options, 'optionalAccess', _122 => _122.onProgress, 'optionalCall', _123 => _123(i + 1, totalSheets)]);
18709
+ _optionalChain([options, 'optionalAccess', _127 => _127.onProgress, 'optionalCall', _128 => _128(i + 1, totalSheets)]);
18637
18710
  const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
18638
18711
  if (bofIdx < 0) {
18639
18712
  warnings.push({
@@ -18663,7 +18736,7 @@ async function parseXlsDocument(buffer, options) {
18663
18736
  pageCount: totalSheets
18664
18737
  };
18665
18738
  return {
18666
- markdown: _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, allBlocks),
18739
+ markdown: _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, allBlocks),
18667
18740
  blocks: allBlocks,
18668
18741
  metadata,
18669
18742
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18676,7 +18749,7 @@ async function parseXlsDocument(buffer, options) {
18676
18749
 
18677
18750
  // src/docx/equation.ts
18678
18751
  function lname(el) {
18679
- return el.localName || _optionalChain([el, 'access', _124 => _124.tagName, 'optionalAccess', _125 => _125.replace, 'call', _126 => _126(/^[^:]+:/, "")]) || "";
18752
+ return el.localName || _optionalChain([el, 'access', _129 => _129.tagName, 'optionalAccess', _130 => _130.replace, 'call', _131 => _131(/^[^:]+:/, "")]) || "";
18680
18753
  }
18681
18754
  function kids(parent, name) {
18682
18755
  const out = [];
@@ -19049,7 +19122,7 @@ function isDisplayMath(el) {
19049
19122
  // src/docx/parser.ts
19050
19123
  var MAX_DECOMPRESS_SIZE4 = 100 * 1024 * 1024;
19051
19124
  function matchesLocal(el, localName2) {
19052
- return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _127 => _127.tagName, 'optionalAccess', _128 => _128.endsWith, 'call', _129 => _129(`:${localName2}`)]), () => ( false)));
19125
+ return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _132 => _132.tagName, 'optionalAccess', _133 => _133.endsWith, 'call', _134 => _134(`:${localName2}`)]), () => ( false)));
19053
19126
  }
19054
19127
  function effectiveChildElements(parent) {
19055
19128
  const result = [];
@@ -19082,7 +19155,7 @@ function findElements(parent, localName2) {
19082
19155
  const child = children[i];
19083
19156
  if (child.nodeType === 1) {
19084
19157
  const el = child;
19085
- if (el.localName === localName2 || _optionalChain([el, 'access', _130 => _130.tagName, 'optionalAccess', _131 => _131.endsWith, 'call', _132 => _132(`:${localName2}`)])) {
19158
+ if (el.localName === localName2 || _optionalChain([el, 'access', _135 => _135.tagName, 'optionalAccess', _136 => _136.endsWith, 'call', _137 => _137(`:${localName2}`)])) {
19086
19159
  result.push(el);
19087
19160
  }
19088
19161
  walk(el);
@@ -19101,7 +19174,7 @@ function getAttr(el, localName2) {
19101
19174
  return null;
19102
19175
  }
19103
19176
  function parseXml2(text) {
19104
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkNIW7CZYXcjs.stripDtd.call(void 0, text), "text/xml");
19177
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkDQJTNXVScjs.stripDtd.call(void 0, text), "text/xml");
19105
19178
  }
19106
19179
  function parseStyles(xml) {
19107
19180
  const doc = parseXml2(xml);
@@ -19203,7 +19276,7 @@ function collectOmmlRoots(p) {
19203
19276
  const child = children[i];
19204
19277
  if (child.nodeType !== 1) continue;
19205
19278
  const el = child;
19206
- const tag = el.localName || _optionalChain([el, 'access', _133 => _133.tagName, 'optionalAccess', _134 => _134.replace, 'call', _135 => _135(/^[^:]+:/, "")]) || "";
19279
+ const tag = el.localName || _optionalChain([el, 'access', _138 => _138.tagName, 'optionalAccess', _139 => _139.replace, 'call', _140 => _140(/^[^:]+:/, "")]) || "";
19207
19280
  if (tag === "oMath" || tag === "oMathPara") {
19208
19281
  out.push(el);
19209
19282
  } else if (tag === "txbxContent" || tag === "Fallback") {
@@ -19293,7 +19366,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19293
19366
  const text = parts.join("").replace(/[ \t]{2,}/g, " ").trim();
19294
19367
  if (!text) return null;
19295
19368
  const style = styles.get(styleId);
19296
- if (_optionalChain([style, 'optionalAccess', _136 => _136.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19369
+ if (_optionalChain([style, 'optionalAccess', _141 => _141.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19297
19370
  return {
19298
19371
  type: "heading",
19299
19372
  text,
@@ -19302,8 +19375,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19302
19375
  }
19303
19376
  if (numId && numId !== "0") {
19304
19377
  const numDef = numbering.get(numId);
19305
- const levelInfo = _optionalChain([numDef, 'optionalAccess', _137 => _137.get, 'call', _138 => _138(ilvl)]);
19306
- const listType = _optionalChain([levelInfo, 'optionalAccess', _139 => _139.numFmt]) === "bullet" ? "unordered" : "ordered";
19378
+ const levelInfo = _optionalChain([numDef, 'optionalAccess', _142 => _142.get, 'call', _143 => _143(ilvl)]);
19379
+ const listType = _optionalChain([levelInfo, 'optionalAccess', _144 => _144.numFmt]) === "bullet" ? "unordered" : "ordered";
19307
19380
  return { type: "list", text, listType };
19308
19381
  }
19309
19382
  const block = { type: "paragraph", text };
@@ -19386,7 +19459,7 @@ ${cell2.text}` : cell2.text;
19386
19459
  return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
19387
19460
  })
19388
19461
  );
19389
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, cellRows);
19462
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, cellRows);
19390
19463
  if (table2.rows === 0 || table2.cols === 0) return null;
19391
19464
  return { type: "table", table: table2 };
19392
19465
  }
@@ -19396,10 +19469,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
19396
19469
  for (const el of effectiveChildElements(tc2)) {
19397
19470
  if (matchesLocal(el, "p")) {
19398
19471
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19399
- if (_optionalChain([block, 'optionalAccess', _140 => _140.text])) parts.push(block.text);
19472
+ if (_optionalChain([block, 'optionalAccess', _145 => _145.text])) parts.push(block.text);
19400
19473
  for (const tp of collectTextboxParagraphs(el)) {
19401
19474
  const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
19402
- if (_optionalChain([tb, 'optionalAccess', _141 => _141.text])) parts.push(tb.text);
19475
+ if (_optionalChain([tb, 'optionalAccess', _146 => _146.text])) parts.push(tb.text);
19403
19476
  }
19404
19477
  } else if (matchesLocal(el, "tbl")) {
19405
19478
  for (const tr of getChildElements(el, "tr")) {
@@ -19429,7 +19502,7 @@ async function extractImages(zip, rels, doc, warnings) {
19429
19502
  try {
19430
19503
  const data = await imgFile.async("uint8array");
19431
19504
  imgIdx++;
19432
- const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _142 => _142.split, 'call', _143 => _143("."), 'access', _144 => _144.pop, 'call', _145 => _145(), 'optionalAccess', _146 => _146.toLowerCase, 'call', _147 => _147()]), () => ( "png"));
19505
+ const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _147 => _147.split, 'call', _148 => _148("."), 'access', _149 => _149.pop, 'call', _150 => _150(), 'optionalAccess', _151 => _151.toLowerCase, 'call', _152 => _152()]), () => ( "png"));
19433
19506
  const mimeMap = {
19434
19507
  png: "image/png",
19435
19508
  jpg: "image/jpeg",
@@ -19453,12 +19526,12 @@ async function extractImages(zip, rels, doc, warnings) {
19453
19526
  return { blocks, images };
19454
19527
  }
19455
19528
  async function parseDocxDocument(buffer, options) {
19456
- _chunkNIW7CZYXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
19529
+ _chunkDQJTNXVScjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
19457
19530
  const zip = await _jszip2.default.loadAsync(buffer);
19458
19531
  const warnings = [];
19459
19532
  const docFile = zip.file("word/document.xml");
19460
19533
  if (!docFile) {
19461
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19534
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19462
19535
  }
19463
19536
  let rels = /* @__PURE__ */ new Map();
19464
19537
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -19505,13 +19578,13 @@ async function parseDocxDocument(buffer, options) {
19505
19578
  const doc = parseXml2(docXml);
19506
19579
  const body = findElements(doc, "body");
19507
19580
  if (body.length === 0) {
19508
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19581
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19509
19582
  }
19510
19583
  const blocks = [];
19511
19584
  const bodyEl = body[0];
19512
19585
  const topLevel = effectiveChildElements(bodyEl);
19513
19586
  for (const el of topLevel) {
19514
- const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _148 => _148.tagName, 'optionalAccess', _149 => _149.split, 'call', _150 => _150(":"), 'access', _151 => _151.pop, 'call', _152 => _152()])));
19587
+ const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _153 => _153.tagName, 'optionalAccess', _154 => _154.split, 'call', _155 => _155(":"), 'access', _156 => _156.pop, 'call', _157 => _157()])));
19515
19588
  if (localName2 === "p") {
19516
19589
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19517
19590
  if (block) blocks.push(block);
@@ -19550,7 +19623,7 @@ async function parseDocxDocument(buffer, options) {
19550
19623
  }
19551
19624
  }
19552
19625
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
19553
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
19626
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
19554
19627
  return {
19555
19628
  markdown,
19556
19629
  blocks,
@@ -19573,7 +19646,7 @@ function parseHwpmlDocument(buffer, options) {
19573
19646
  }
19574
19647
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
19575
19648
  const normalized = text.replace(/&nbsp;/g, "&#160;");
19576
- const xml = _chunkNIW7CZYXcjs.stripDtd.call(void 0, normalized);
19649
+ const xml = _chunkDQJTNXVScjs.stripDtd.call(void 0, normalized);
19577
19650
  const warnings = [];
19578
19651
  const parser = new (0, _xmldom.DOMParser)({
19579
19652
  onError: (_level, msg2) => {
@@ -19601,7 +19674,7 @@ function parseHwpmlDocument(buffer, options) {
19601
19674
  return { markdown: "", blocks: [], metadata, warnings };
19602
19675
  }
19603
19676
  const blocks = [];
19604
- const pageFilter = _optionalChain([options, 'optionalAccess', _153 => _153.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
19677
+ const pageFilter = _optionalChain([options, 'optionalAccess', _158 => _158.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
19605
19678
  let sectionIdx = 0;
19606
19679
  const children = body.childNodes;
19607
19680
  for (let i = 0; i < children.length; i++) {
@@ -19613,7 +19686,7 @@ function parseHwpmlDocument(buffer, options) {
19613
19686
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
19614
19687
  }
19615
19688
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
19616
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
19689
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
19617
19690
  return {
19618
19691
  markdown,
19619
19692
  blocks,
@@ -19699,7 +19772,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
19699
19772
  const shapeInfo = paraShapeMap.get(paraShapeId);
19700
19773
  const text = extractParagraphText(el);
19701
19774
  if (!text) return;
19702
- if (_optionalChain([shapeInfo, 'optionalAccess', _154 => _154.headingLevel]) != null) {
19775
+ if (_optionalChain([shapeInfo, 'optionalAccess', _159 => _159.headingLevel]) != null) {
19703
19776
  blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
19704
19777
  } else {
19705
19778
  blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
@@ -19771,7 +19844,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
19771
19844
  const cellRows = grid.map(
19772
19845
  (row) => row.map((cell2) => _nullishCoalesce(cell2, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
19773
19846
  );
19774
- const table2 = _chunkNIW7CZYXcjs.buildTable.call(void 0, cellRows);
19847
+ const table2 = _chunkDQJTNXVScjs.buildTable.call(void 0, cellRows);
19775
19848
  const caption = extractShapeCaption(el);
19776
19849
  if (caption.text && caption.before) {
19777
19850
  blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
@@ -20031,7 +20104,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
20031
20104
  (match, prefix, suffix) => {
20032
20105
  const label = prefix + suffix;
20033
20106
  const normalizedLabel = normalizeLabel(label);
20034
- if (_optionalChain([blockedLabels, 'optionalAccess', _155 => _155.has, 'call', _156 => _156(normalizedLabel)])) return match;
20107
+ if (_optionalChain([blockedLabels, 'optionalAccess', _160 => _160.has, 'call', _161 => _161(normalizedLabel)])) return match;
20035
20108
  const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
20036
20109
  if (matchKey === void 0) return match;
20037
20110
  const newValue = values.consume(matchKey);
@@ -20281,8 +20354,8 @@ function extractFromTable(table2) {
20281
20354
  if (table2.cols >= 2) {
20282
20355
  for (let r = 0; r < table2.rows; r++) {
20283
20356
  for (let c = 0; c < table2.cols - 1; c++) {
20284
- const labelCell = _optionalChain([table2, 'access', _157 => _157.cells, 'access', _158 => _158[r], 'optionalAccess', _159 => _159[c]]);
20285
- const valueCell = _optionalChain([table2, 'access', _160 => _160.cells, 'access', _161 => _161[r], 'optionalAccess', _162 => _162[c + 1]]);
20357
+ const labelCell = _optionalChain([table2, 'access', _162 => _162.cells, 'access', _163 => _163[r], 'optionalAccess', _164 => _164[c]]);
20358
+ const valueCell = _optionalChain([table2, 'access', _165 => _165.cells, 'access', _166 => _166[r], 'optionalAccess', _167 => _167[c + 1]]);
20286
20359
  if (!labelCell || !valueCell) continue;
20287
20360
  if (isLabelCell(labelCell.text)) {
20288
20361
  fields.push({
@@ -20304,8 +20377,8 @@ function extractFromTable(table2) {
20304
20377
  if (allLabels) {
20305
20378
  for (let r = 1; r < table2.rows; r++) {
20306
20379
  for (let c = 0; c < table2.cols; c++) {
20307
- const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _163 => _163[c], 'optionalAccess', _164 => _164.text, 'access', _165 => _165.trim, 'call', _166 => _166()]), () => ( ""));
20308
- const value = _nullishCoalesce(_optionalChain([table2, 'access', _167 => _167.cells, 'access', _168 => _168[r], 'optionalAccess', _169 => _169[c], 'optionalAccess', _170 => _170.text, 'access', _171 => _171.trim, 'call', _172 => _172()]), () => ( ""));
20380
+ const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _168 => _168[c], 'optionalAccess', _169 => _169.text, 'access', _170 => _170.trim, 'call', _171 => _171()]), () => ( ""));
20381
+ const value = _nullishCoalesce(_optionalChain([table2, 'access', _172 => _172.cells, 'access', _173 => _173[r], 'optionalAccess', _174 => _174[c], 'optionalAccess', _175 => _175.text, 'access', _176 => _176.trim, 'call', _177 => _177()]), () => ( ""));
20309
20382
  if (label && value) {
20310
20383
  fields.push({ label, value, row: r, col: c });
20311
20384
  }
@@ -20398,7 +20471,7 @@ function fillFormFields(blocks, values, blockedLabels) {
20398
20471
  for (const table2 of allTables) {
20399
20472
  for (let r = 0; r < table2.rows; r++) {
20400
20473
  for (let c = 0; c < table2.cols; c++) {
20401
- const cell2 = _optionalChain([table2, 'access', _173 => _173.cells, 'access', _174 => _174[r], 'optionalAccess', _175 => _175[c]]);
20474
+ const cell2 = _optionalChain([table2, 'access', _178 => _178.cells, 'access', _179 => _179[r], 'optionalAccess', _180 => _180[c]]);
20402
20475
  if (!cell2) continue;
20403
20476
  const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
20404
20477
  if (result) {
@@ -20430,7 +20503,7 @@ function collectIRTables(blocks, depth) {
20430
20503
  out.push(block.table);
20431
20504
  for (const row of block.table.cells) {
20432
20505
  for (const cell2 of row) {
20433
- if (_optionalChain([cell2, 'optionalAccess', _176 => _176.blocks, 'optionalAccess', _177 => _177.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20506
+ if (_optionalChain([cell2, 'optionalAccess', _181 => _181.blocks, 'optionalAccess', _182 => _182.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20434
20507
  }
20435
20508
  }
20436
20509
  }
@@ -20441,7 +20514,7 @@ function coveredPositions(table2) {
20441
20514
  for (let r = 0; r < table2.rows; r++) {
20442
20515
  for (let c = 0; c < table2.cols; c++) {
20443
20516
  if (covered.has(`${r},${c}`)) continue;
20444
- const cell2 = _optionalChain([table2, 'access', _178 => _178.cells, 'access', _179 => _179[r], 'optionalAccess', _180 => _180[c]]);
20517
+ const cell2 = _optionalChain([table2, 'access', _183 => _183.cells, 'access', _184 => _184[r], 'optionalAccess', _185 => _185[c]]);
20445
20518
  if (!cell2) continue;
20446
20519
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
20447
20520
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -20471,12 +20544,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20471
20544
  if (isKeywordLabel(valueCell.text)) continue;
20472
20545
  const normalizedCellLabel = normalizeLabel(labelCell.text);
20473
20546
  if (!normalizedCellLabel) continue;
20474
- if (_optionalChain([blockedLabels, 'optionalAccess', _181 => _181.has, 'call', _182 => _182(normalizedCellLabel)])) continue;
20547
+ if (_optionalChain([blockedLabels, 'optionalAccess', _186 => _186.has, 'call', _187 => _187(normalizedCellLabel)])) continue;
20475
20548
  const matchKey = findMatchingKey(normalizedCellLabel, values);
20476
20549
  if (matchKey === void 0) continue;
20477
20550
  const newValue = values.consume(matchKey);
20478
20551
  if (newValue === void 0) continue;
20479
- if (_optionalChain([patternFilledCells, 'optionalAccess', _183 => _183.has, 'call', _184 => _184(valueCell)])) {
20552
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _188 => _188.has, 'call', _189 => _189(valueCell)])) {
20480
20553
  valueCell.text = newValue + " " + valueCell.text;
20481
20554
  } else {
20482
20555
  valueCell.text = newValue;
@@ -20502,10 +20575,10 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20502
20575
  for (let c = 0; c < table2.cols; c++) {
20503
20576
  if (covered.has(`${r},${c}`)) continue;
20504
20577
  const headerCell = headerRow[c];
20505
- const valueCell = _optionalChain([table2, 'access', _185 => _185.cells, 'access', _186 => _186[r], 'optionalAccess', _187 => _187[c]]);
20578
+ const valueCell = _optionalChain([table2, 'access', _190 => _190.cells, 'access', _191 => _191[r], 'optionalAccess', _192 => _192[c]]);
20506
20579
  if (!headerCell || !valueCell) continue;
20507
20580
  const headerLabel = normalizeLabel(headerCell.text);
20508
- if (_optionalChain([blockedLabels, 'optionalAccess', _188 => _188.has, 'call', _189 => _189(headerLabel)])) continue;
20581
+ if (_optionalChain([blockedLabels, 'optionalAccess', _193 => _193.has, 'call', _194 => _194(headerLabel)])) continue;
20509
20582
  const matchKey = findMatchingKey(headerLabel, values);
20510
20583
  if (matchKey === void 0) continue;
20511
20584
  if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
@@ -20531,7 +20604,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
20531
20604
  let pos = 0;
20532
20605
  for (const seg of segments) {
20533
20606
  const nlabel = normalizeLabel(seg.label);
20534
- if (_optionalChain([blockedLabels, 'optionalAccess', _190 => _190.has, 'call', _191 => _191(nlabel)])) continue;
20607
+ if (_optionalChain([blockedLabels, 'optionalAccess', _195 => _195.has, 'call', _196 => _196(nlabel)])) continue;
20535
20608
  const matchKey = findMatchingKey(nlabel, values);
20536
20609
  if (matchKey === void 0) continue;
20537
20610
  const newValue = values.consume(matchKey);
@@ -21099,19 +21172,19 @@ function parseCentralDirectory(buf) {
21099
21172
  }
21100
21173
  }
21101
21174
  }
21102
- if (eocdOffset < 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21175
+ if (eocdOffset < 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21103
21176
  const totalEntries = view.getUint16(eocdOffset + 10, true);
21104
21177
  const cdSize = view.getUint32(eocdOffset + 12, true);
21105
21178
  const cdOffset = view.getUint32(eocdOffset + 16, true);
21106
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21179
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21107
21180
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
21108
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21181
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21109
21182
  }
21110
21183
  const decoder = new TextDecoder("utf-8");
21111
21184
  const entries = [];
21112
21185
  let pos = cdOffset;
21113
21186
  for (let i = 0; i < totalEntries; i++) {
21114
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21187
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21115
21188
  const flags = view.getUint16(pos + 8, true);
21116
21189
  const method = view.getUint16(pos + 10, true);
21117
21190
  const crc = view.getUint32(pos + 16, true);
@@ -21122,7 +21195,7 @@ function parseCentralDirectory(buf) {
21122
21195
  const commentLen = view.getUint16(pos + 32, true);
21123
21196
  const localOffset = view.getUint32(pos + 42, true);
21124
21197
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
21125
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21198
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21126
21199
  }
21127
21200
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
21128
21201
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -21151,11 +21224,11 @@ function patchZipEntries(original, replacements, additions) {
21151
21224
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
21152
21225
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
21153
21226
  for (const name of replacements.keys()) {
21154
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkNIW7CZYXcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21227
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkDQJTNXVScjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21155
21228
  }
21156
21229
  if (additions) {
21157
21230
  for (const name of additions.keys()) {
21158
- if (entries.some((e) => e.name === name)) throw new (0, _chunkNIW7CZYXcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21231
+ if (entries.some((e) => e.name === name)) throw new (0, _chunkDQJTNXVScjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21159
21232
  }
21160
21233
  }
21161
21234
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
@@ -21174,7 +21247,7 @@ function patchZipEntries(original, replacements, additions) {
21174
21247
  offset += seg.length;
21175
21248
  continue;
21176
21249
  }
21177
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkNIW7CZYXcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21250
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkDQJTNXVScjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21178
21251
  const nameLen = view.getUint16(e.localOffset + 26, true);
21179
21252
  const extraLen = view.getUint16(e.localOffset + 28, true);
21180
21253
  const headerLen = 30 + nameLen + extraLen;
@@ -21280,7 +21353,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21280
21353
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
21281
21354
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
21282
21355
  if (sectionPaths.length === 0) {
21283
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21356
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21284
21357
  }
21285
21358
  const normalizedValues = normalizeValues(values);
21286
21359
  const cursor = new ValueCursor(normalizedValues);
@@ -21353,7 +21426,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21353
21426
  if (isKeywordLabel(cellLabelText(valueCell))) continue;
21354
21427
  const normalizedCellLabel = normalizeLabel(labelText);
21355
21428
  if (!normalizedCellLabel) continue;
21356
- if (_optionalChain([blockedLabels, 'optionalAccess', _192 => _192.has, 'call', _193 => _193(normalizedCellLabel)])) continue;
21429
+ if (_optionalChain([blockedLabels, 'optionalAccess', _197 => _197.has, 'call', _198 => _198(normalizedCellLabel)])) continue;
21357
21430
  const matchKey = findMatchingKey(normalizedCellLabel, cursor);
21358
21431
  if (matchKey === void 0) continue;
21359
21432
  if (patternApplied.has(valueCell)) {
@@ -21411,7 +21484,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21411
21484
  const dataCells = table2.rows[rowIdx];
21412
21485
  for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
21413
21486
  const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
21414
- if (_optionalChain([blockedLabels, 'optionalAccess', _194 => _194.has, 'call', _195 => _195(headerLabel)])) continue;
21487
+ if (_optionalChain([blockedLabels, 'optionalAccess', _199 => _199.has, 'call', _200 => _200(headerLabel)])) continue;
21415
21488
  const matchKey = findMatchingKey(headerLabel, cursor);
21416
21489
  if (matchKey === void 0) continue;
21417
21490
  if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
@@ -21444,11 +21517,11 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21444
21517
  }
21445
21518
  for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
21446
21519
  const existing = ledger.get(para2);
21447
- if (_optionalChain([existing, 'optionalAccess', _196 => _196.fullText]) !== void 0) continue;
21520
+ if (_optionalChain([existing, 'optionalAccess', _201 => _201.fullText]) !== void 0) continue;
21448
21521
  const text = matchText(para2);
21449
21522
  for (const seg of scanInlineSegments(text)) {
21450
21523
  const nlabel = normalizeLabel(seg.label);
21451
- if (_optionalChain([blockedLabels, 'optionalAccess', _197 => _197.has, 'call', _198 => _198(nlabel)])) continue;
21524
+ if (_optionalChain([blockedLabels, 'optionalAccess', _202 => _202.has, 'call', _203 => _203(nlabel)])) continue;
21452
21525
  const matchKey = findMatchingKey(nlabel, cursor);
21453
21526
  if (matchKey === void 0) continue;
21454
21527
  const newValue = cursor.consume(matchKey);
@@ -21557,16 +21630,16 @@ var PARA_LIST = 7;
21557
21630
  var DEFAULT_TEXT_COLOR = "#000000";
21558
21631
  function resolveTheme(theme) {
21559
21632
  return {
21560
- h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _199 => _199.headingColors, 'optionalAccess', _200 => _200[1]]), () => ( DEFAULT_TEXT_COLOR)),
21561
- h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _201 => _201.headingColors, 'optionalAccess', _202 => _202[2]]), () => ( DEFAULT_TEXT_COLOR)),
21562
- h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _203 => _203.headingColors, 'optionalAccess', _204 => _204[3]]), () => ( DEFAULT_TEXT_COLOR)),
21563
- h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _205 => _205.headingColors, 'optionalAccess', _206 => _206[4]]), () => ( _optionalChain([theme, 'optionalAccess', _207 => _207.headingColors, 'optionalAccess', _208 => _208[3]]))), () => ( DEFAULT_TEXT_COLOR)),
21564
- body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _209 => _209.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
21565
- quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _210 => _210.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
21633
+ h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _204 => _204.headingColors, 'optionalAccess', _205 => _205[1]]), () => ( DEFAULT_TEXT_COLOR)),
21634
+ h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _206 => _206.headingColors, 'optionalAccess', _207 => _207[2]]), () => ( DEFAULT_TEXT_COLOR)),
21635
+ h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _208 => _208.headingColors, 'optionalAccess', _209 => _209[3]]), () => ( DEFAULT_TEXT_COLOR)),
21636
+ h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _210 => _210.headingColors, 'optionalAccess', _211 => _211[4]]), () => ( _optionalChain([theme, 'optionalAccess', _212 => _212.headingColors, 'optionalAccess', _213 => _213[3]]))), () => ( DEFAULT_TEXT_COLOR)),
21637
+ body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _214 => _214.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
21638
+ quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _215 => _215.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
21566
21639
  /** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
21567
- hasQuoteOption: _optionalChain([theme, 'optionalAccess', _211 => _211.quoteColor]) !== void 0,
21568
- tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _212 => _212.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _213 => _213.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
21569
- tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _214 => _214.tableHeaderBold])
21640
+ hasQuoteOption: _optionalChain([theme, 'optionalAccess', _216 => _216.quoteColor]) !== void 0,
21641
+ tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _217 => _217.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _218 => _218.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
21642
+ tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _219 => _219.tableHeaderBold])
21570
21643
  };
21571
21644
  }
21572
21645
  function escapeXml(text) {
@@ -21969,7 +22042,7 @@ function assertSequentialIds(rows, label, startId) {
21969
22042
  const m = rows[i].match(/\bid="(\d+)"/);
21970
22043
  const got = m ? Number(m[1]) : NaN;
21971
22044
  if (got !== startId + i) {
21972
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
22045
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
21973
22046
  `\uB0B4\uBD80 \uC624\uB958: ${label} id \uD30C\uD2F0\uC158 \uB4DC\uB9AC\uD504\uD2B8 \u2014 ${startId + i} \uC704\uCE58\uC5D0 id=${m ? m[1] : "?"} \uBC29\uCD9C. id \uC0C1\uC218(gen-ids)\uC640 \uC2E4\uC81C \uBC29\uCD9C \uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4 (GJ_CHAR_COUNT\uB958 \uCE74\uC6B4\uD2B8\xB7base \uC0B0\uC220 \uD655\uC778)`
21974
22047
  );
21975
22048
  }
@@ -22053,7 +22126,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
22053
22126
  }
22054
22127
  const expectedBase = charVariantBase(richAssets, !!gongmun);
22055
22128
  if (rows.length !== expectedBase) {
22056
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
22129
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
22057
22130
  `\uB0B4\uBD80 \uC624\uB958: charPr \uAE30\uBCF8 \uBE14\uB85D \uBC29\uCD9C \uC218(${rows.length}) \u2260 charVariantBase(${expectedBase}) \u2014 gen-header \uBC29\uCD9C \uD589\uACFC gen-ids \uCE74\uC6B4\uD2B8 \uC0C1\uC218\uAC00 \uC5B4\uAE0B\uB0AC\uB2E4`
22058
22131
  );
22059
22132
  }
@@ -22280,7 +22353,7 @@ function buildStyles(gongmun) {
22280
22353
  </hh:styles>`;
22281
22354
  }
22282
22355
  function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
22283
- const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _215 => _215.fonts, 'access', _216 => _216.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _217 => _217.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
22356
+ const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _220 => _220.fonts, 'access', _221 => _221.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _222 => _222.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
22284
22357
  const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
22285
22358
  const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
22286
22359
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
@@ -22409,8 +22482,8 @@ function parseChartFence(text) {
22409
22482
  const spec = chartSpec(type);
22410
22483
  let finalSeries = spec.pie ? [series[0]] : series;
22411
22484
  finalSeries = finalSeries.map((s) => ({ ...s }));
22412
- const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _218 => _218.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
22413
- const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _219 => _219[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22485
+ const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _223 => _223.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
22486
+ const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _224 => _224[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22414
22487
  if (!spec.scatter) {
22415
22488
  finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
22416
22489
  }
@@ -22452,7 +22525,7 @@ function serSpPr(color, stroke) {
22452
22525
  return stroke ? `<c:spPr><a:ln w="28575" cap="flat" cmpd="sng" algn="ctr">${f}<a:prstDash val="solid"/><a:round/></a:ln></c:spPr>` : `<c:spPr>${f}</c:spPr>`;
22453
22526
  }
22454
22527
  function dPtXml(pointColors, pie) {
22455
- if (!_optionalChain([pointColors, 'optionalAccess', _220 => _220.length])) return "";
22528
+ if (!_optionalChain([pointColors, 'optionalAccess', _225 => _225.length])) return "";
22456
22529
  return pointColors.map((col, i) => {
22457
22530
  const f = chartColorFill(col);
22458
22531
  if (!f) return "";
@@ -22691,8 +22764,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
22691
22764
  const botRow = cell({ bf: GJ_BF_BAR_DARK, col: 0, row: 2, w: g.botDarkW, h: g.botBarH, paras: barEmpty }) + cell({ bf: GJ_BF_BAR_LIGHT, col: 1, colSpan: 2, row: 2, w: g.botLightW, h: g.botBarH, paras: barEmpty });
22692
22765
  const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
22693
22766
  const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
22694
- const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _221 => _221.cover, 'optionalAccess', _222 => _222.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
22695
- const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _223 => _223.cover, 'optionalAccess', _224 => _224.org]), () => ( ""));
22767
+ const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _226 => _226.cover, 'optionalAccess', _227 => _227.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
22768
+ const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _228 => _228.cover, 'optionalAccess', _229 => _229.org]), () => ( ""));
22696
22769
  const sub = (t) => `<hp:p paraPrIDRef="${GJ_PARA_COVER}" styleIDRef="0"><hp:run charPrIDRef="${GJ_CHAR_COVER_SUB}"><hp:t>${escapeXml(t)}</hp:t></hp:run></hp:p>`;
22697
22770
  const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
22698
22771
  return [
@@ -22928,7 +23001,7 @@ function escapeGfm(text) {
22928
23001
  }
22929
23002
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
22930
23003
  function sanitizeText(text) {
22931
- let result = _chunkNIW7CZYXcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
23004
+ let result = _chunkDQJTNXVScjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
22932
23005
  if (result.length <= 30 && result.includes(" ")) {
22933
23006
  const tokens = result.split(" ");
22934
23007
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -22958,7 +23031,7 @@ function replicateGfmTable(table2) {
22958
23031
  for (let r = 0; r < numRows; r++) {
22959
23032
  for (let c = 0; c < numCols; c++) {
22960
23033
  if (skip.has(`${r},${c}`)) continue;
22961
- const cell2 = _optionalChain([cells, 'access', _225 => _225[r], 'optionalAccess', _226 => _226[c]]);
23034
+ const cell2 = _optionalChain([cells, 'access', _230 => _230[r], 'optionalAccess', _231 => _231[c]]);
22962
23035
  if (!cell2) continue;
22963
23036
  display[r][c] = {
22964
23037
  text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -23012,7 +23085,7 @@ function unescapeGfmCell(text) {
23012
23085
  return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*])/g, "$1");
23013
23086
  }
23014
23087
  function replicateCellInnerHtml(cell2) {
23015
- if (_optionalChain([cell2, 'access', _227 => _227.blocks, 'optionalAccess', _228 => _228.length])) {
23088
+ if (_optionalChain([cell2, 'access', _232 => _232.blocks, 'optionalAccess', _233 => _233.length])) {
23016
23089
  return cell2.blocks.map((b) => {
23017
23090
  if (b.type === "table" && b.table) {
23018
23091
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -23051,7 +23124,7 @@ function replicateHtmlTable(table2) {
23051
23124
  const rowCells = [];
23052
23125
  for (let c = 0; c < numCols; c++) {
23053
23126
  if (skip.has(`${r},${c}`)) continue;
23054
- const cell2 = _optionalChain([cells, 'access', _229 => _229[r], 'optionalAccess', _230 => _230[c]]);
23127
+ const cell2 = _optionalChain([cells, 'access', _234 => _234[r], 'optionalAccess', _235 => _235[c]]);
23055
23128
  if (!cell2) continue;
23056
23129
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
23057
23130
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -23097,8 +23170,8 @@ function parseHtmlTable(raw) {
23097
23170
  }
23098
23171
  } else {
23099
23172
  if (!isClose) {
23100
- const cs = parseInt(_optionalChain([attrs, 'access', _231 => _231.match, 'call', _232 => _232(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _233 => _233[1]]) || "1", 10);
23101
- const rs = parseInt(_optionalChain([attrs, 'access', _234 => _234.match, 'call', _235 => _235(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _236 => _236[1]]) || "1", 10);
23173
+ const cs = parseInt(_optionalChain([attrs, 'access', _236 => _236.match, 'call', _237 => _237(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _238 => _238[1]]) || "1", 10);
23174
+ const rs = parseInt(_optionalChain([attrs, 'access', _239 => _239.match, 'call', _240 => _240(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _241 => _241[1]]) || "1", 10);
23102
23175
  cellStart = m.index + m[0].length;
23103
23176
  cellInfo = { colSpan: isNaN(cs) ? 1 : cs, rowSpan: isNaN(rs) ? 1 : rs };
23104
23177
  } else if (cellStart >= 0 && cellInfo && currentRow) {
@@ -23124,7 +23197,7 @@ function htmlCellInnerToLines(inner) {
23124
23197
  hadNonText = true;
23125
23198
  work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
23126
23199
  const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
23127
- const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _237 => _237[1]]), () => ( _optionalChain([m, 'optionalAccess', _238 => _238[2]])));
23200
+ const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _242 => _242[1]]), () => ( _optionalChain([m, 'optionalAccess', _243 => _243[2]])));
23128
23201
  if (src) imgSrcs.push(src);
23129
23202
  return "";
23130
23203
  });
@@ -23255,7 +23328,7 @@ function edgeXml(tag, d) {
23255
23328
  return d ? `<hh:${tag} type="${escapeXml(d.type)}" width="${escapeXml(d.width)}" color="${escapeXml(d.color)}"/>` : `<hh:${tag} type="NONE" width="0.1 mm" color="#000000"/>`;
23256
23329
  }
23257
23330
  function borderFillDefToXml(id, def) {
23258
- const fill = _optionalChain([def, 'access', _239 => _239.fill, 'optionalAccess', _240 => _240.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
23331
+ const fill = _optionalChain([def, 'access', _244 => _244.fill, 'optionalAccess', _245 => _245.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
23259
23332
  return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
23260
23333
  <hh:slash type="NONE" Crooked="0" isCounter="0"/>
23261
23334
  <hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
@@ -23660,11 +23733,11 @@ function estimateRowHeight(cells, widths, charHeight) {
23660
23733
  function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
23661
23734
  const rowCnt = rows.length;
23662
23735
  const colCnt = Math.max(...rows.map((r) => r.length), 1);
23663
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _241 => _241.bfRegistry]), () => ( null));
23736
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _246 => _246.bfRegistry]), () => ( null));
23664
23737
  const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
23665
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _242 => _242.charHeight]), () => ( 1e3));
23738
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _247 => _247.charHeight]), () => ( 1e3));
23666
23739
  const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
23667
- const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _243 => _243[0], 'optionalAccess', _244 => _244[0]]), () => ( ""))), seq, rowAnchor);
23740
+ const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _248 => _248[0], 'optionalAccess', _249 => _249[0]]), () => ( ""))), seq, rowAnchor);
23668
23741
  const colMax = Array(colCnt).fill(0);
23669
23742
  const colMaxBody = Array(colCnt).fill(0);
23670
23743
  const colMinWord = Array(colCnt).fill(0);
@@ -23692,7 +23765,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
23692
23765
  const k = `${rowIdx},${colIdx}`;
23693
23766
  const isLabelCell2 = labelCol0 && colIdx === 0;
23694
23767
  const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
23695
- const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _245 => _245.cellChar, 'access', _246 => _246.get, 'call', _247 => _247(k)]), () => ( defaultCharPr));
23768
+ const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _250 => _250.cellChar, 'access', _251 => _251.get, 'call', _252 => _252(k)]), () => ( defaultCharPr));
23696
23769
  const centered = isHeaderRow || colCentered[colIdx];
23697
23770
  const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
23698
23771
  const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
@@ -23710,11 +23783,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
23710
23783
  }
23711
23784
  }
23712
23785
  }
23713
- const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _248 => _248.cellChar, 'access', _249 => _249.has, 'call', _250 => _250(k)]) ? void 0 : mapId);
23786
+ const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _253 => _253.cellChar, 'access', _254 => _254.has, 'call', _255 => _255(k)]) ? void 0 : mapId);
23714
23787
  const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
23715
23788
  return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
23716
23789
  }).join("");
23717
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _251 => _251.cellBf, 'access', _252 => _252.get, 'call', _253 => _253(k)]), () => ( (reg ? reg.get(dataCellSpec({
23790
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _256 => _256.cellBf, 'access', _257 => _257.get, 'call', _258 => _258(k)]), () => ( (reg ? reg.get(dataCellSpec({
23718
23791
  row: rowIdx,
23719
23792
  rowEnd: rowIdx,
23720
23793
  col: colIdx,
@@ -23724,7 +23797,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
23724
23797
  headerRows: 1,
23725
23798
  fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
23726
23799
  })) : style && isHeaderRow ? style.headerBf : 2)));
23727
- const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _254 => _254.cellH, 'access', _255 => _255.get, 'call', _256 => _256(k)]), () => ( cellH));
23800
+ const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _259 => _259.cellH, 'access', _260 => _260.get, 'call', _261 => _261(k)]), () => ( cellH));
23728
23801
  return `<hp:tc name="" header="${isHeaderRow ? 1 : 0}" hasMargin="0" protect="0" editable="1" dirty="0" borderFillIDRef="${bf}"><hp:subList id="" textDirection="HORIZONTAL" lineWrap="BREAK" vertAlign="${style ? "CENTER" : "TOP"}" linkListIDRef="0" linkListNextIDRef="0" textWidth="0" textHeight="0" hasTextRef="0" hasNumRef="0">${p}</hp:subList><hp:cellAddr colAddr="${colIdx}" rowAddr="${rowIdx}"/><hp:cellSpan colSpan="1" rowSpan="1"/><hp:cellSz width="${colWidths[colIdx]}" height="${h}"/><hp:cellMargin left="141" right="141" top="141" bottom="141"/></hp:tc>`;
23729
23802
  }).join("");
23730
23803
  return `<hp:tr>${tdElements}</hp:tr>`;
@@ -23733,7 +23806,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
23733
23806
  const tblH = rowHeights.reduce((a, b) => a + b, 0);
23734
23807
  const tblInner = `<hp:sz width="${tblW}" widthRelTo="ABSOLUTE" height="${tblH}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="1" affectLSpacing="0" flowWithText="0" allowOverlap="0" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="PARA" vertAlign="TOP" horzAlign="LEFT" vertOffset="0" horzOffset="0"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:inMargin left="510" right="510" top="141" bottom="141"/>` + trElements;
23735
23808
  const tbl2 = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="${style ? 1 : 0}" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="2" noShading="0">${tblInner}</hp:tbl>`;
23736
- const hostPr = reg && _optionalChain([style, 'optionalAccess', _257 => _257.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
23809
+ const hostPr = reg && _optionalChain([style, 'optionalAccess', _262 => _262.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
23737
23810
  return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
23738
23811
  }
23739
23812
  function layoutHtmlRows(rows) {
@@ -23773,7 +23846,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23773
23846
  if (!rows || rows.length === 0) return null;
23774
23847
  const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
23775
23848
  if (rowCnt === 0 || colCnt === 0) return null;
23776
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _258 => _258.charHeight]), () => ( 1e3));
23849
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _263 => _263.charHeight]), () => ( 1e3));
23777
23850
  const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
23778
23851
  const row0 = Array.from({ length: colCnt }, () => "");
23779
23852
  for (const cell2 of placed) {
@@ -23802,7 +23875,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23802
23875
  const tblId = nextTableId();
23803
23876
  const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
23804
23877
  const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
23805
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _259 => _259.bfRegistry]), () => ( null));
23878
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _264 => _264.bfRegistry]), () => ( null));
23806
23879
  let htmlHeaderRows = 0;
23807
23880
  while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
23808
23881
  const tableRowHeights = Array(rowCnt).fill(cellH);
@@ -23817,7 +23890,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23817
23890
  const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
23818
23891
  if (nestedXml) {
23819
23892
  nestedXmls.push(nestedXml);
23820
- const szH = _optionalChain([nestedXml, 'access', _260 => _260.match, 'call', _261 => _261(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _262 => _262[1]]);
23893
+ const szH = _optionalChain([nestedXml, 'access', _265 => _265.match, 'call', _266 => _266(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _267 => _267[1]]);
23821
23894
  nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
23822
23895
  }
23823
23896
  }
@@ -23826,7 +23899,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23826
23899
  for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
23827
23900
  const lineH = style ? Math.round(measureH * 1.6) : 800;
23828
23901
  const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
23829
- const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _263 => _263.cellH, 'access', _264 => _264.get, 'call', _265 => _265(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
23902
+ const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _268 => _268.cellH, 'access', _269 => _269.get, 'call', _270 => _270(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
23830
23903
  const perRow = Math.ceil(cellHeight / rowSpan);
23831
23904
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
23832
23905
  return { cell: cell2, rowSpan, lines, nestedXmls, imgSrcs: cellParsed[i].imgSrcs };
@@ -23837,7 +23910,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23837
23910
  const baseCharPr = style ? style.charPr : CHAR_NORMAL;
23838
23911
  const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
23839
23912
  const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
23840
- const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _266 => _266.cellChar, 'access', _267 => _267.get, 'call', _268 => _268(k)]), () => ( defaultCharPr));
23913
+ const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _271 => _271.cellChar, 'access', _272 => _272.get, 'call', _273 => _273(k)]), () => ( defaultCharPr));
23841
23914
  const centered = isHeader || colCentered[cell2.c];
23842
23915
  const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
23843
23916
  const picUrls = images ? [...imgSrcs] : [];
@@ -23873,7 +23946,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
23873
23946
  let cellHeight = 0;
23874
23947
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
23875
23948
  const rowEnd = cell2.r + rowSpan - 1;
23876
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _269 => _269.cellBf, 'access', _270 => _270.get, 'call', _271 => _271(k)]), () => ( (reg ? reg.get(dataCellSpec({
23949
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _274 => _274.cellBf, 'access', _275 => _275.get, 'call', _276 => _276(k)]), () => ( (reg ? reg.get(dataCellSpec({
23877
23950
  row: cell2.r,
23878
23951
  rowEnd,
23879
23952
  col: cell2.c,
@@ -24043,7 +24116,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
24043
24116
  return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
24044
24117
  }
24045
24118
  function buildPressContact(g, ids, bodyWidth, reg) {
24046
- const c = _optionalChain([g, 'access', _272 => _272.press, 'optionalAccess', _273 => _273.contact]);
24119
+ const c = _optionalChain([g, 'access', _277 => _277.press, 'optionalAccess', _278 => _278.contact]);
24047
24120
  if (!c || !c.dept && !c.manager && !c.phone) return [];
24048
24121
  const w = bodyWidth - 280;
24049
24122
  const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
@@ -24424,7 +24497,7 @@ function generateSecPr(gongmun) {
24424
24497
  }
24425
24498
  const secPr = `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="1" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="${A4_W_HU}" height="${A4_H_HU}" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
24426
24499
  const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
24427
- return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _274 => _274.pageNumbers]) ? pageNumCtrl() : "");
24500
+ return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _279 => _279.pageNumbers]) ? pageNumCtrl() : "");
24428
24501
  }
24429
24502
  var SectionOpener = (_class6 = class {
24430
24503
  constructor(gongmun) {;_class6.prototype.__init12.call(this);
@@ -24463,19 +24536,19 @@ function buildPreamble(blocks, ctx) {
24463
24536
  const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
24464
24537
  const preamble = [];
24465
24538
  let hasFrontPages = false;
24466
- if (_optionalChain([gongmun, 'optionalAccess', _275 => _275.reportInfo]) && dfIds) {
24539
+ if (_optionalChain([gongmun, 'optionalAccess', _280 => _280.reportInfo]) && dfIds) {
24467
24540
  preamble.push(buildReportInfo(gongmun, dfIds));
24468
24541
  }
24469
- if (_optionalChain([gongmun, 'optionalAccess', _276 => _276.approval]) && bfReg) {
24542
+ if (_optionalChain([gongmun, 'optionalAccess', _281 => _281.approval]) && bfReg) {
24470
24543
  preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
24471
24544
  }
24472
- if (_optionalChain([gongmun, 'optionalAccess', _277 => _277.docHead]) && dfIds) {
24545
+ if (_optionalChain([gongmun, 'optionalAccess', _282 => _282.docHead]) && dfIds) {
24473
24546
  preamble.push(...buildDocHead(gongmun, dfIds));
24474
24547
  }
24475
- if (_optionalChain([gongmun, 'optionalAccess', _278 => _278.noticeHead]) && dfIds) {
24548
+ if (_optionalChain([gongmun, 'optionalAccess', _283 => _283.noticeHead]) && dfIds) {
24476
24549
  preamble.push(...buildNoticeHead(gongmun));
24477
24550
  }
24478
- if (_optionalChain([gongmun, 'optionalAccess', _279 => _279.press]) && dfIds && bfReg && tableStyle) {
24551
+ if (_optionalChain([gongmun, 'optionalAccess', _284 => _284.press]) && dfIds && bfReg && tableStyle) {
24479
24552
  preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
24480
24553
  }
24481
24554
  if (gongmun && (gongmun.cover || gongmun.toc)) {
@@ -24504,7 +24577,7 @@ function buildPreamble(blocks, ctx) {
24504
24577
  }
24505
24578
  if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
24506
24579
  ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
24507
- } else if (_optionalChain([gongmun, 'optionalAccess', _280 => _280.press]) && ctx.coverH1Idx < 0 && dfIds) {
24580
+ } else if (_optionalChain([gongmun, 'optionalAccess', _285 => _285.press]) && ctx.coverH1Idx < 0 && dfIds) {
24508
24581
  ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
24509
24582
  }
24510
24583
  if (preamble.length > 0) {
@@ -24519,7 +24592,7 @@ function renderHeading(block, blockIdx, ctx) {
24519
24592
  if (gongmun && blockIdx === ctx.coverH1Idx) return "";
24520
24593
  if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
24521
24594
  const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
24522
- for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _281 => _281.press, 'optionalAccess', _282 => _282.sub]), () => ( []))) {
24595
+ for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _286 => _286.press, 'optionalAccess', _287 => _287.sub]), () => ( []))) {
24523
24596
  parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
24524
24597
  }
24525
24598
  return parts.join("\n ");
@@ -24613,8 +24686,8 @@ function renderListItem(block, blockIdx, ctx) {
24613
24686
  const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
24614
24687
  if (gongmun && gongmunList) {
24615
24688
  const info = gongmunList.items.get(blockIdx);
24616
- const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _283 => _283.depth]), () => ( 0));
24617
- const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _284 => _284.marker]), () => ( ""));
24689
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _288 => _288.depth]), () => ( 0));
24690
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _289 => _289.marker]), () => ( ""));
24618
24691
  const content = block.text || "";
24619
24692
  if (measured && content.trimStart().startsWith("\u203B")) {
24620
24693
  return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
@@ -24623,7 +24696,7 @@ function renderListItem(block, blockIdx, ctx) {
24623
24696
  return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
24624
24697
  }
24625
24698
  const text = marker2 ? `${marker2} ${content}` : content;
24626
- const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _285 => _285.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
24699
+ const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _290 => _290.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
24627
24700
  let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
24628
24701
  let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
24629
24702
  if (measured && depth === 0 && gongmun.numbering !== "standard") {
@@ -24682,18 +24755,18 @@ function renderHtmlTable(block, ctx) {
24682
24755
  }
24683
24756
  function appendPostamble(blocks, ctx) {
24684
24757
  const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
24685
- if (_optionalChain([gongmun, 'optionalAccess', _286 => _286.noticeHead]) && dfIds) {
24758
+ if (_optionalChain([gongmun, 'optionalAccess', _291 => _291.noticeHead]) && dfIds) {
24686
24759
  paraXmls.push(...buildNoticeFoot(gongmun));
24687
24760
  }
24688
- if (_optionalChain([gongmun, 'optionalAccess', _287 => _287.endMark]) && paraXmls.length > 0) {
24689
- const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _288 => _288.rows, 'optionalAccess', _289 => _289.length]));
24761
+ if (_optionalChain([gongmun, 'optionalAccess', _292 => _292.endMark]) && paraXmls.length > 0) {
24762
+ const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _293 => _293.rows, 'optionalAccess', _294 => _294.length]));
24690
24763
  const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
24691
24764
  if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
24692
24765
  }
24693
- if (_optionalChain([gongmun, 'optionalAccess', _290 => _290.docFoot]) && dfIds) {
24766
+ if (_optionalChain([gongmun, 'optionalAccess', _295 => _295.docFoot]) && dfIds) {
24694
24767
  paraXmls.push(...buildDocFoot(gongmun, dfIds));
24695
24768
  }
24696
- if (_optionalChain([gongmun, 'optionalAccess', _291 => _291.press]) && dfIds && bfReg && tableStyle) {
24769
+ if (_optionalChain([gongmun, 'optionalAccess', _296 => _296.press]) && dfIds && bfReg && tableStyle) {
24697
24770
  paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
24698
24771
  }
24699
24772
  }
@@ -24713,7 +24786,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
24713
24786
  remap,
24714
24787
  dfIds,
24715
24788
  images,
24716
- gaejosik: _optionalChain([gongmun, 'optionalAccess', _292 => _292.preset]) === "gaejosik",
24789
+ gaejosik: _optionalChain([gongmun, 'optionalAccess', _297 => _297.preset]) === "gaejosik",
24717
24790
  measured,
24718
24791
  richAssets,
24719
24792
  vBase: charVariantBase(richAssets, !!gongmun),
@@ -24819,18 +24892,18 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
24819
24892
 
24820
24893
  // src/hwpx/generator.ts
24821
24894
  async function markdownToHwpx(markdown, options) {
24822
- const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _293 => _293.theme]));
24823
- const gongmun = _optionalChain([options, 'optionalAccess', _294 => _294.gongmun]) ? resolveGongmun(options.gongmun) : null;
24895
+ const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _298 => _298.theme]));
24896
+ const gongmun = _optionalChain([options, 'optionalAccess', _299 => _299.gongmun]) ? resolveGongmun(options.gongmun) : null;
24824
24897
  const measured = !!gongmun && usesReportFonts(gongmun.preset);
24825
24898
  const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
24826
24899
  const blocks = parseMarkdownToBlocks(markdown);
24827
24900
  const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
24828
24901
  const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
24829
24902
  const staticBfEnd = staticBorderFillNext(gongmun);
24830
- const remap = _optionalChain([options, 'optionalAccess', _295 => _295.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _296 => _296.variants, 'optionalAccess', _297 => _297.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
24831
- const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _298 => _298.borderFillXmls, 'access', _299 => _299.length]), () => ( 0)))) : null;
24903
+ const remap = _optionalChain([options, 'optionalAccess', _300 => _300.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _301 => _301.variants, 'optionalAccess', _302 => _302.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
24904
+ const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _303 => _303.borderFillXmls, 'access', _304 => _304.length]), () => ( 0)))) : null;
24832
24905
  const dfActive = !!gongmun && docframeActive(gongmun);
24833
- const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _300 => _300.variants, 'optionalAccess', _301 => _301.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _302 => _302.charPrXmls, 'access', _303 => _303.length]), () => ( 0)));
24906
+ const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _305 => _305.variants, 'optionalAccess', _306 => _306.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _307 => _307.charPrXmls, 'access', _308 => _308.length]), () => ( 0)));
24834
24907
  const dfIds = dfActive ? docframeIds(dfBase) : null;
24835
24908
  const chartParts = [];
24836
24909
  const images = new ImageRegistry();
@@ -24841,7 +24914,7 @@ async function markdownToHwpx(markdown, options) {
24841
24914
  console.warn(`[kordoc] format profile: \uD504\uB85C\uD544 \uD45C ${unused}\uAC1C\uAC00 \uBB38\uC11C \uD45C\uC640 \uB9E4\uCE6D\uB418\uC9C0 \uC54A\uC544 \uBBF8\uC801\uC6A9 (\uD589\xB7\uC5F4/\uCCAB \uC140 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)`);
24842
24915
  }
24843
24916
  }
24844
- const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _304 => _304.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _305 => _305.emit, 'call', _306 => _306()]), () => ( []))];
24917
+ const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _309 => _309.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _310 => _310.emit, 'call', _311 => _311()]), () => ( []))];
24845
24918
  const zip = new (0, _jszip2.default)();
24846
24919
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
24847
24920
  zip.file("META-INF/container.xml", generateContainerXml());
@@ -24850,11 +24923,11 @@ async function markdownToHwpx(markdown, options) {
24850
24923
  zip.file("Contents/header.xml", generateHeaderXml(
24851
24924
  theme,
24852
24925
  gongmun,
24853
- _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _307 => _307.variants]), () => ( [])),
24926
+ _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _312 => _312.variants]), () => ( [])),
24854
24927
  extraBorderFills,
24855
- [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _308 => _308.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
24856
- _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _309 => _309.indentVariants]), () => ( [])),
24857
- _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _310 => _310.fontFaces]), () => ( []))
24928
+ [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _313 => _313.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
24929
+ _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _314 => _314.indentVariants]), () => ( [])),
24930
+ _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _315 => _315.fontFaces]), () => ( []))
24858
24931
  ));
24859
24932
  zip.file("Contents/section0.xml", sectionXml);
24860
24933
  for (const part of chartParts) zip.file(part.name, part.xml);
@@ -25149,7 +25222,7 @@ function parseRenderStyles(headXml) {
25149
25222
  const underlineEl = findChildByLocalName(el, "underline");
25150
25223
  const textColor = el.getAttribute("textColor");
25151
25224
  const fontRef = findChildByLocalName(el, "fontRef");
25152
- const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _311 => _311.getAttribute, 'call', _312 => _312("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _313 => _313.getAttribute, 'call', _314 => _314("latin")])));
25225
+ const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _316 => _316.getAttribute, 'call', _317 => _317("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _318 => _318.getAttribute, 'call', _319 => _319("latin")])));
25153
25226
  const face = fontId != null ? hangulFonts.get(fontId) : void 0;
25154
25227
  styles.charPr.set(id, {
25155
25228
  height: Number(el.getAttribute("height")) || 1e3,
@@ -25157,8 +25230,8 @@ function parseRenderStyles(headXml) {
25157
25230
  italic: findChildByLocalName(el, "italic") != null,
25158
25231
  underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
25159
25232
  color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
25160
- ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _315 => _315.getAttribute, 'call', _316 => _316("hangul")])) || 100,
25161
- spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _317 => _317.getAttribute, 'call', _318 => _318("hangul")])) || 0,
25233
+ ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _320 => _320.getAttribute, 'call', _321 => _321("hangul")])) || 100,
25234
+ spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _322 => _322.getAttribute, 'call', _323 => _323("hangul")])) || 0,
25162
25235
  fontFamily: face ? hwpFaceToCssStack(face) : void 0,
25163
25236
  face
25164
25237
  });
@@ -25167,7 +25240,7 @@ function parseRenderStyles(headXml) {
25167
25240
  const id = el.getAttribute("id");
25168
25241
  if (id != null) {
25169
25242
  const align = findChildByLocalName(el, "align");
25170
- styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _319 => _319.getAttribute, 'call', _320 => _320("horizontal")]) || "JUSTIFY");
25243
+ styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _324 => _324.getAttribute, 'call', _325 => _325("horizontal")]) || "JUSTIFY");
25171
25244
  styles.paraGeom.set(id, parseParaGeom(el));
25172
25245
  }
25173
25246
  } else if (tag === "borderFill") {
@@ -25181,7 +25254,7 @@ function parseRenderStyles(headXml) {
25181
25254
  };
25182
25255
  const fillBrush = findChildByLocalName(el, "fillBrush");
25183
25256
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
25184
- const face = _optionalChain([winBrush, 'optionalAccess', _321 => _321.getAttribute, 'call', _322 => _322("faceColor")]);
25257
+ const face = _optionalChain([winBrush, 'optionalAccess', _326 => _326.getAttribute, 'call', _327 => _327("faceColor")]);
25185
25258
  if (face && face.toLowerCase() !== "none") bf.fill = face;
25186
25259
  styles.borderFill.set(id, bf);
25187
25260
  }
@@ -25253,7 +25326,7 @@ function collectSites(scan) {
25253
25326
  }
25254
25327
  function attrOf(openTag, name) {
25255
25328
  const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
25256
- return _optionalChain([m, 'optionalAccess', _323 => _323[1]]);
25329
+ return _optionalChain([m, 'optionalAccess', _328 => _328[1]]);
25257
25330
  }
25258
25331
  function paraOpenTag(xml, para2) {
25259
25332
  const end = xml.indexOf(">", para2.start);
@@ -25268,7 +25341,7 @@ function anchorRunInfo(xml, para2, anchor) {
25268
25341
  if (!tr) return null;
25269
25342
  const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
25270
25343
  const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
25271
- const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _324 => _324[1]]), () => ( tr.prefix)), () => ( "hp"));
25344
+ const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _329 => _329[1]]), () => ( tr.prefix)), () => ( "hp"));
25272
25345
  const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
25273
25346
  const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
25274
25347
  if (close === -1) return null;
@@ -25295,7 +25368,7 @@ function cellContentWidthMm(xml, cell2) {
25295
25368
  if (width === null) return null;
25296
25369
  let content = width;
25297
25370
  const win = cellAddrWindow(xml, cell2);
25298
- const mg = _optionalChain([win, 'optionalAccess', _325 => _325.match, 'call', _326 => _326(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
25371
+ const mg = _optionalChain([win, 'optionalAccess', _330 => _330.match, 'call', _331 => _331(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
25299
25372
  if (mg) {
25300
25373
  content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
25301
25374
  }
@@ -25329,11 +25402,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
25329
25402
  return `<hp:pic xmlns:hc="http://www.hancom.co.kr/hwpml/2011/core" id="${ids.id}" zOrder="0" numberingType="PICTURE" textWrap="IN_FRONT_OF_TEXT" textFlow="BOTH_SIDES" lock="0" dropcapstyle="None" href="" groupLevel="0" instid="${ids.instid}" reverse="0"><hp:offset x="0" y="0"/><hp:orgSz width="${w}" height="${h}"/><hp:curSz width="${w}" height="${h}"/><hp:flip horizontal="0" vertical="0"/><hp:rotationInfo angle="0" centerX="${Math.round(w / 2)}" centerY="${Math.round(h / 2)}" rotateimage="1"/><hp:renderingInfo><hc:transMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:scaMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/><hc:rotMatrix e1="1" e2="0" e3="0" e4="0" e5="1" e6="0"/></hp:renderingInfo><hp:imgRect><hc:pt0 x="0" y="0"/><hc:pt1 x="${w}" y="0"/><hc:pt2 x="${w}" y="${h}"/><hc:pt3 x="0" y="${h}"/></hp:imgRect><hp:imgClip left="0" right="${w}" top="0" bottom="${h}"/><hp:inMargin left="0" right="0" top="0" bottom="0"/><hp:imgDim dimwidth="${w}" dimheight="${h}"/><hc:img binaryItemIDRef="${itemId}" bright="0" contrast="0" effect="REAL_PIC" alpha="0"/><hp:effects/><hp:sz width="${w}" widthRelTo="ABSOLUTE" height="${h}" heightRelTo="ABSOLUTE" protect="0"/><hp:pos treatAsChar="0" affectLSpacing="0" flowWithText="0" allowOverlap="1" holdAnchorAndSO="0" vertRelTo="PARA" horzRelTo="COLUMN" vertAlign="TOP" horzAlign="LEFT" vertOffset="${posYHu}" horzOffset="${posXHu}"/><hp:outMargin left="0" right="0" top="0" bottom="0"/><hp:shapeComment>kordoc seal</hp:shapeComment></hp:pic>`;
25330
25403
  }
25331
25404
  async function placeSealHwpx(hwpxBuffer, ops) {
25332
- if (ops.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
25405
+ if (ops.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
25333
25406
  const u8 = new Uint8Array(hwpxBuffer);
25334
25407
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
25335
- const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _327 => _327.match, 'call', _328 => _328(/(\d+)\.xml$/i), 'optionalAccess', _329 => _329[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _330 => _330.match, 'call', _331 => _331(/(\d+)\.xml$/i), 'optionalAccess', _332 => _332[1]]), () => ( 0))));
25336
- if (sectionPaths.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
25408
+ const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _332 => _332.match, 'call', _333 => _333(/(\d+)\.xml$/i), 'optionalAccess', _334 => _334[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _335 => _335.match, 'call', _336 => _336(/(\d+)\.xml$/i), 'optionalAccess', _337 => _337[1]]), () => ( 0))));
25409
+ if (sectionPaths.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
25337
25410
  const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
25338
25411
  const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
25339
25412
  const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
@@ -25374,11 +25447,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25374
25447
  const manifestItems = [];
25375
25448
  const placed = [];
25376
25449
  for (const op of ops) {
25377
- if (!op.anchor) throw new (0, _chunkNIW7CZYXcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25378
- if (!op.image || op.image.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25450
+ if (!op.anchor) throw new (0, _chunkDQJTNXVScjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25451
+ if (!op.image || op.image.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25379
25452
  const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
25380
- if (!MIME[ext]) throw new (0, _chunkNIW7CZYXcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
25381
- if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkNIW7CZYXcjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
25453
+ if (!MIME[ext]) throw new (0, _chunkDQJTNXVScjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
25454
+ if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkDQJTNXVScjs.KordocError)(`place_seal: \uC774\uBBF8\uC9C0 \uB0B4\uC6A9\uC774 .${ext} \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 (\uB9E4\uC9C1\uBC14\uC774\uD2B8 \uBD88\uC77C\uCE58)`);
25382
25455
  const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
25383
25456
  let found = null;
25384
25457
  let total = 0;
@@ -25411,7 +25484,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25411
25484
  }
25412
25485
  }
25413
25486
  }
25414
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
25487
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
25415
25488
  `place_seal: \uC575\uCEE4 "${op.anchor}" ${wantOcc}\uBC88\uC9F8 \uB4F1\uC7A5\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4 (\uBCF8\uBB38 \uB0B4 ${total}\uD68C \uB4F1\uC7A5 \u2014 occurrence 0..${Math.max(0, total - 1)})`
25416
25489
  );
25417
25490
  }
@@ -25419,9 +25492,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25419
25492
  const xml = sectionXmls[si];
25420
25493
  const run = anchorRunInfo(xml, site.para, op.anchor);
25421
25494
  if (!run) {
25422
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
25495
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
25423
25496
  }
25424
- const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _333 => _333.charPr, 'access', _334 => _334.get, 'call', _335 => _335(run.charPr), 'optionalAccess', _336 => _336.height]), () => ( 1e3));
25497
+ const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _338 => _338.charPr, 'access', _339 => _339.get, 'call', _340 => _340(run.charPr), 'optionalAccess', _341 => _341.height]), () => ( 1e3));
25425
25498
  const fontPt = charPrHeight / 100;
25426
25499
  const emMm = fontPt * 25.4 / 72;
25427
25500
  const lineHMm = emMm;
@@ -25430,7 +25503,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25430
25503
  const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
25431
25504
  const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
25432
25505
  const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
25433
- const align = _optionalChain([styles, 'optionalAccess', _337 => _337.paraAlign, 'access', _338 => _338.get, 'call', _339 => _339(paraPrId)]);
25506
+ const align = _optionalChain([styles, 'optionalAccess', _342 => _342.paraAlign, 'access', _343 => _343.get, 'call', _344 => _344(paraPrId)]);
25434
25507
  let alignShiftMm = 0;
25435
25508
  if (align === "CENTER" || align === "RIGHT") {
25436
25509
  const paraWMm = measureMm(site.para.text, emMm);
@@ -25526,7 +25599,7 @@ function parseBorderFills(headerDoc) {
25526
25599
  };
25527
25600
  const fillBrush = findChildByLocalName(bf, "fillBrush");
25528
25601
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
25529
- const face = _optionalChain([winBrush, 'optionalAccess', _340 => _340.getAttribute, 'call', _341 => _341("faceColor")]);
25602
+ const face = _optionalChain([winBrush, 'optionalAccess', _345 => _345.getAttribute, 'call', _346 => _346("faceColor")]);
25530
25603
  if (face && face !== "none") def.fill = { faceColor: face };
25531
25604
  map.set(id, def);
25532
25605
  }
@@ -25558,7 +25631,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
25558
25631
  if (cp.getAttribute("italic") === "1") def.italic = true;
25559
25632
  if (findChildByLocalName(cp, "underline")) def.underline = true;
25560
25633
  const fontRef = findChildByLocalName(cp, "fontRef");
25561
- const hangul = _optionalChain([fontRef, 'optionalAccess', _342 => _342.getAttribute, 'call', _343 => _343("hangul")]);
25634
+ const hangul = _optionalChain([fontRef, 'optionalAccess', _347 => _347.getAttribute, 'call', _348 => _348("hangul")]);
25562
25635
  if (hangul) {
25563
25636
  def.fontRef_hangul = hangul;
25564
25637
  const face = hangulFonts.get(hangul);
@@ -25586,7 +25659,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
25586
25659
  const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
25587
25660
  const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
25588
25661
  const sz = findChildByLocalName(tbl2, "sz");
25589
- const width = _optionalChain([sz, 'optionalAccess', _344 => _344.getAttribute, 'call', _345 => _345("width")]) || void 0;
25662
+ const width = _optionalChain([sz, 'optionalAccess', _349 => _349.getAttribute, 'call', _350 => _350("width")]) || void 0;
25590
25663
  const cells = [];
25591
25664
  const usedBf = /* @__PURE__ */ new Set();
25592
25665
  const usedCp = /* @__PURE__ */ new Set();
@@ -25599,17 +25672,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
25599
25672
  const addr = findChildByLocalName(tc2, "cellAddr");
25600
25673
  const span = findChildByLocalName(tc2, "cellSpan");
25601
25674
  const csz = findChildByLocalName(tc2, "cellSz");
25602
- const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _346 => _346.getAttribute, 'call', _347 => _347("rowAddr")])), () => ( 0));
25603
- const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _348 => _348.getAttribute, 'call', _349 => _349("colAddr")])), () => ( 0));
25675
+ const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _351 => _351.getAttribute, 'call', _352 => _352("rowAddr")])), () => ( 0));
25676
+ const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _353 => _353.getAttribute, 'call', _354 => _354("colAddr")])), () => ( 0));
25604
25677
  if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
25605
25678
  if (row === 0) row0Texts.set(col, directCellText(tc2));
25606
- const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _350 => _350.getAttribute, 'call', _351 => _351("colSpan")])), () => ( 1));
25607
- const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _352 => _352.getAttribute, 'call', _353 => _353("rowSpan")])), () => ( 1));
25679
+ const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _355 => _355.getAttribute, 'call', _356 => _356("colSpan")])), () => ( 1));
25680
+ const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _357 => _357.getAttribute, 'call', _358 => _358("rowSpan")])), () => ( 1));
25608
25681
  const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
25609
25682
  const cpId = firstRunCharPr(tc2);
25610
25683
  const cell2 = { row, col, rowSpan, colSpan };
25611
- const w = _optionalChain([csz, 'optionalAccess', _354 => _354.getAttribute, 'call', _355 => _355("width")]);
25612
- const hh = _optionalChain([csz, 'optionalAccess', _356 => _356.getAttribute, 'call', _357 => _357("height")]);
25684
+ const w = _optionalChain([csz, 'optionalAccess', _359 => _359.getAttribute, 'call', _360 => _360("width")]);
25685
+ const hh = _optionalChain([csz, 'optionalAccess', _361 => _361.getAttribute, 'call', _362 => _362("height")]);
25613
25686
  if (w) cell2.width_hwpunit = w;
25614
25687
  if (hh) cell2.height_hwpunit = hh;
25615
25688
  if (bfId) {
@@ -25697,16 +25770,16 @@ function pick(map, keys) {
25697
25770
  return out;
25698
25771
  }
25699
25772
  async function hwpxToProfile(input) {
25700
- const buf = input instanceof ArrayBuffer ? input : _chunkNIW7CZYXcjs.toArrayBuffer.call(void 0, input);
25773
+ const buf = input instanceof ArrayBuffer ? input : _chunkDQJTNXVScjs.toArrayBuffer.call(void 0, input);
25701
25774
  const zip = await _jszip2.default.loadAsync(buf);
25702
25775
  const parser = createXmlParser();
25703
- const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _358 => _358.file, 'call', _359 => _359(/[Hh]eader\.xml$/), 'optionalAccess', _360 => _360[0]])));
25776
+ const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _363 => _363.file, 'call', _364 => _364(/[Hh]eader\.xml$/), 'optionalAccess', _365 => _365[0]])));
25704
25777
  let headerXml = "<root/>";
25705
25778
  if (headerFile) headerXml = await headerFile.async("text");
25706
25779
  const headerDoc = parser.parseFromString(headerXml, "text/xml");
25707
25780
  const borderFills = parseBorderFills(headerDoc);
25708
25781
  const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
25709
- const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _361 => _361.name, 'access', _362 => _362.match, 'call', _363 => _363(/(\d+)\.xml$/), 'optionalAccess', _364 => _364[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _365 => _365.name, 'access', _366 => _366.match, 'call', _367 => _367(/(\d+)\.xml$/), 'optionalAccess', _368 => _368[1]]), () => ( null))), () => ( 0))));
25782
+ const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _366 => _366.name, 'access', _367 => _367.match, 'call', _368 => _368(/(\d+)\.xml$/), 'optionalAccess', _369 => _369[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _370 => _370.name, 'access', _371 => _371.match, 'call', _372 => _372(/(\d+)\.xml$/), 'optionalAccess', _373 => _373[1]]), () => ( null))), () => ( 0))));
25710
25783
  const tables = [];
25711
25784
  let tableIndex = 0;
25712
25785
  for (const f of sectionFiles) {
@@ -26020,7 +26093,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
26020
26093
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
26021
26094
  function patchTableRows(input) {
26022
26095
  const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
26023
- const xml = _optionalChain([ctx, 'access', _369 => _369.scans, 'access', _370 => _370[scanTable.sectionIndex], 'optionalAccess', _371 => _371.xml]);
26096
+ const xml = _optionalChain([ctx, 'access', _374 => _374.scans, 'access', _375 => _375[scanTable.sectionIndex], 'optionalAccess', _376 => _376.xml]);
26024
26097
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
26025
26098
  const numRows = table2.rows;
26026
26099
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -26187,7 +26260,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
26187
26260
  const rr = scanTable.rowRanges[template];
26188
26261
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
26189
26262
  const scan = scanSectionXml(wrapped, 0);
26190
- const row = _optionalChain([scan, 'access', _372 => _372.tables, 'access', _373 => _373[0], 'optionalAccess', _374 => _374.rows, 'access', _375 => _375[0]]);
26263
+ const row = _optionalChain([scan, 'access', _377 => _377.tables, 'access', _378 => _378[0], 'optionalAccess', _379 => _379.rows, 'access', _380 => _380[0]]);
26191
26264
  if (!row || row.length !== cells.length) return null;
26192
26265
  const splices = allLinesegRemovalSplices(wrapped);
26193
26266
  for (let i = 0; i < cells.length; i++) {
@@ -26230,7 +26303,7 @@ function rowHeightOf(fragment) {
26230
26303
  }
26231
26304
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
26232
26305
  const from = scanTable.start + tblOpenLen;
26233
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _376 => _376.rowRanges, 'access', _377 => _377[0], 'optionalAccess', _378 => _378.start]), () => ( from));
26306
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _381 => _381.rowRanges, 'access', _382 => _382[0], 'optionalAccess', _383 => _383.start]), () => ( from));
26234
26307
  const slice = xml.slice(from, to);
26235
26308
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
26236
26309
  if (!szM || szM.index === void 0) return null;
@@ -26419,9 +26492,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
26419
26492
  });
26420
26493
  }
26421
26494
  function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
26422
- const irCell = _optionalChain([table2, 'access', _379 => _379.cells, 'access', _380 => _380[oc.gridR], 'optionalAccess', _381 => _381[oc.gridC]]);
26495
+ const irCell = _optionalChain([table2, 'access', _384 => _384.cells, 'access', _385 => _385[oc.gridR], 'optionalAccess', _386 => _386[oc.gridC]]);
26423
26496
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
26424
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _382 => _382.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
26497
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _387 => _387.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
26425
26498
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
26426
26499
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
26427
26500
  }
@@ -26489,7 +26562,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
26489
26562
  };
26490
26563
  const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
26491
26564
  if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
26492
- const irCell = _optionalChain([table2, 'access', _383 => _383.cells, 'access', _384 => _384[gridR], 'optionalAccess', _385 => _385[gridC]]);
26565
+ const irCell = _optionalChain([table2, 'access', _388 => _388.cells, 'access', _389 => _389[gridR], 'optionalAccess', _390 => _390[gridC]]);
26493
26566
  const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
26494
26567
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
26495
26568
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -26512,7 +26585,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
26512
26585
  if (newLines.length === 0) return 0;
26513
26586
  const target = cell2.paragraphs[0];
26514
26587
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
26515
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _386 => _386.scans, 'access', _387 => _387[target.sectionIndex], 'optionalAccess', _388 => _388.xml]));
26588
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _391 => _391.scans, 'access', _392 => _392[target.sectionIndex], 'optionalAccess', _393 => _393.xml]));
26516
26589
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
26517
26590
  splices.push(...sp);
26518
26591
  sectionIndex = target.sectionIndex;
@@ -26535,7 +26608,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
26535
26608
  }
26536
26609
  for (let i = 0; i < nonEmpty.length; i++) {
26537
26610
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
26538
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _389 => _389.scans, 'access', _390 => _390[nonEmpty[i].sectionIndex], 'optionalAccess', _391 => _391.xml]));
26611
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _394 => _394.scans, 'access', _395 => _395[nonEmpty[i].sectionIndex], 'optionalAccess', _396 => _396.xml]));
26539
26612
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
26540
26613
  splices.push(...sp);
26541
26614
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -26616,7 +26689,7 @@ async function resolveSectionEntryNames(zip) {
26616
26689
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
26617
26690
  if (paths.length > 0) return paths;
26618
26691
  }
26619
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkNIW7CZYXcjs.compareSectionPaths);
26692
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkDQJTNXVScjs.compareSectionPaths);
26620
26693
  }
26621
26694
  function sectionPathsFromManifest(xml) {
26622
26695
  const attr = (tag, name) => {
@@ -26626,7 +26699,7 @@ function sectionPathsFromManifest(xml) {
26626
26699
  const idToHref = /* @__PURE__ */ new Map();
26627
26700
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
26628
26701
  const id = attr(m[1], "id");
26629
- const href = _chunkNIW7CZYXcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
26702
+ const href = _chunkDQJTNXVScjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
26630
26703
  if (id && href) idToHref.set(id, href);
26631
26704
  }
26632
26705
  const ordered = [];
@@ -26635,7 +26708,7 @@ function sectionPathsFromManifest(xml) {
26635
26708
  if (href) ordered.push(href);
26636
26709
  }
26637
26710
  if (ordered.length > 0) return ordered;
26638
- return Array.from(idToHref.values()).sort(_chunkNIW7CZYXcjs.compareSectionPaths);
26711
+ return Array.from(idToHref.values()).sort(_chunkDQJTNXVScjs.compareSectionPaths);
26639
26712
  }
26640
26713
 
26641
26714
  // src/roundtrip/patcher.ts
@@ -26727,7 +26800,7 @@ async function patchHwpx(original, editedMarkdown, options) {
26727
26800
  }
26728
26801
  }
26729
26802
  let verification;
26730
- if (_optionalChain([options, 'optionalAccess', _392 => _392.verify]) !== false) {
26803
+ if (_optionalChain([options, 'optionalAccess', _397 => _397.verify]) !== false) {
26731
26804
  try {
26732
26805
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
26733
26806
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -26745,17 +26818,17 @@ function buildOrigUnits(blocks) {
26745
26818
  let chunk2;
26746
26819
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
26747
26820
  const next = blocks[i + 1];
26748
- if (_optionalChain([next, 'optionalAccess', _393 => _393.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
26749
- chunk2 = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
26821
+ if (_optionalChain([next, 'optionalAccess', _398 => _398.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
26822
+ chunk2 = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
26750
26823
  } else {
26751
- chunk2 = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, [block]);
26824
+ chunk2 = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, [block]);
26752
26825
  }
26753
26826
  if (chunk2) {
26754
26827
  const subUnits = splitMarkdownUnits(chunk2);
26755
26828
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
26756
26829
  for (let s = 0; s < subUnits.length; s++) {
26757
26830
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
26758
- if (block.type === "table" && _optionalChain([block, 'access', _394 => _394.table, 'optionalAccess', _395 => _395.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
26831
+ if (block.type === "table" && _optionalChain([block, 'access', _399 => _399.table, 'optionalAccess', _400 => _400.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
26759
26832
  u.role = "caption";
26760
26833
  }
26761
26834
  units.push(u);
@@ -26866,7 +26939,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
26866
26939
  const ti = ctx.tableInsert;
26867
26940
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
26868
26941
  const mapping = ctx.paraMap.get(orig.blockIdx);
26869
- if (!_optionalChain([mapping, 'optionalAccess', _396 => _396.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
26942
+ if (!_optionalChain([mapping, 'optionalAccess', _401 => _401.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED) \u2014 \uD45C \uBCC0\uD658 \uBD88\uAC00");
26870
26943
  const para2 = mapping.para;
26871
26944
  if (para2.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
26872
26945
  const scan = ctx.scans[para2.sectionIndex];
@@ -26894,7 +26967,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
26894
26967
  }
26895
26968
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
26896
26969
  const mapping = ctx.paraMap.get(orig.blockIdx);
26897
- if (!_optionalChain([mapping, 'optionalAccess', _397 => _397.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
26970
+ if (!_optionalChain([mapping, 'optionalAccess', _402 => _402.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
26898
26971
  if (block.text && block.text.includes("\n")) {
26899
26972
  return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
26900
26973
  }
@@ -26925,7 +26998,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
26925
26998
  if (sanitizeText(newPlain) !== newPlain) {
26926
26999
  return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
26927
27000
  }
26928
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _398 => _398.scans, 'access', _399 => _399[mapping.para.sectionIndex], 'optionalAccess', _400 => _400.xml]));
27001
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _403 => _403.scans, 'access', _404 => _404[mapping.para.sectionIndex], 'optionalAccess', _405 => _405.xml]));
26929
27002
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
26930
27003
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
26931
27004
  return 1;
@@ -27111,7 +27184,7 @@ var Surgeon = (_class7 = class {
27111
27184
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
27112
27185
  findEntry(path) {
27113
27186
  const parts = path.replace(/^\//, "").split("/");
27114
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _401 => _401.entries, 'access', _402 => _402[0], 'optionalAccess', _403 => _403.child]), () => ( -1));
27187
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _406 => _406.entries, 'access', _407 => _407[0], 'optionalAccess', _408 => _408.child]), () => ( -1));
27115
27188
  let current;
27116
27189
  for (const part of parts) {
27117
27190
  const search = (idx) => {
@@ -27324,8 +27397,8 @@ function serializeRecords(recs, repl, inserts) {
27324
27397
  parts.push(header, data);
27325
27398
  };
27326
27399
  for (let i = 0; i < recs.length; i++) {
27327
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _404 => _404.get, 'call', _405 => _405(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
27328
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _406 => _406.get, 'call', _407 => _407(i)]), () => ( recs[i].data)));
27400
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _409 => _409.get, 'call', _410 => _410(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
27401
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _411 => _411.get, 'call', _412 => _412(i)]), () => ( recs[i].data)));
27329
27402
  }
27330
27403
  return Buffer.concat(parts);
27331
27404
  }
@@ -27443,7 +27516,7 @@ async function patchHwp(original, editedMarkdown, options) {
27443
27516
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
27444
27517
  }
27445
27518
  const fhEntry = CFB2.find(cfb, "/FileHeader");
27446
- if (!_optionalChain([fhEntry, 'optionalAccess', _408 => _408.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
27519
+ if (!_optionalChain([fhEntry, 'optionalAccess', _413 => _413.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
27447
27520
  let flags;
27448
27521
  try {
27449
27522
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -27465,7 +27538,7 @@ async function patchHwp(original, editedMarkdown, options) {
27465
27538
  const scans = [];
27466
27539
  for (let i = 0; i < sectionPaths.length; i++) {
27467
27540
  const entry = CFB2.find(cfb, sectionPaths[i]);
27468
- if (!_optionalChain([entry, 'optionalAccess', _409 => _409.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
27541
+ if (!_optionalChain([entry, 'optionalAccess', _414 => _414.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
27469
27542
  let stream;
27470
27543
  try {
27471
27544
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -27516,7 +27589,7 @@ async function patchHwp(original, editedMarkdown, options) {
27516
27589
  }
27517
27590
  }
27518
27591
  let verification;
27519
- if (_optionalChain([options, 'optionalAccess', _410 => _410.verify]) !== false) {
27592
+ if (_optionalChain([options, 'optionalAccess', _415 => _415.verify]) !== false) {
27520
27593
  try {
27521
27594
  const reparsed = parseHwp5Document(Buffer.from(data));
27522
27595
  const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
@@ -27606,7 +27679,7 @@ function tableContentScore(irTable, scanTable) {
27606
27679
  for (const [key, scanCell] of scanTable.cells) {
27607
27680
  const comma = key.indexOf(",");
27608
27681
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
27609
- const irCell = _optionalChain([irTable, 'access', _411 => _411.cells, 'access', _412 => _412[r], 'optionalAccess', _413 => _413[c]]);
27682
+ const irCell = _optionalChain([irTable, 'access', _416 => _416.cells, 'access', _417 => _417[r], 'optionalAccess', _418 => _418[c]]);
27610
27683
  if (!irCell) continue;
27611
27684
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
27612
27685
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -27642,7 +27715,7 @@ function handleModified(orig, edited, ctx) {
27642
27715
  }
27643
27716
  function patchParagraph(block, orig, edited, ctx, skip) {
27644
27717
  const mapping = ctx.paraMap.get(orig.blockIdx);
27645
- if (!_optionalChain([mapping, 'optionalAccess', _414 => _414.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
27718
+ if (!_optionalChain([mapping, 'optionalAccess', _419 => _419.para])) return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
27646
27719
  const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
27647
27720
  let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
27648
27721
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
@@ -27841,7 +27914,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
27841
27914
  };
27842
27915
  const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
27843
27916
  if (!cell2) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
27844
- const irCell = _optionalChain([table2, 'access', _415 => _415.cells, 'access', _416 => _416[gridR], 'optionalAccess', _417 => _417[gridC]]);
27917
+ const irCell = _optionalChain([table2, 'access', _420 => _420.cells, 'access', _421 => _421[gridR], 'optionalAccess', _422 => _422[gridC]]);
27845
27918
  const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
27846
27919
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
27847
27920
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -28233,7 +28306,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28233
28306
  const block = st.blocks[blockIndex];
28234
28307
  if (!block) return void 0;
28235
28308
  if (block.type === "paragraph" || block.type === "heading") {
28236
- const para2 = _optionalChain([st, 'access', _418 => _418.paraMap, 'access', _419 => _419.get, 'call', _420 => _420(blockIndex), 'optionalAccess', _421 => _421.para]);
28309
+ const para2 = _optionalChain([st, 'access', _423 => _423.paraMap, 'access', _424 => _424.get, 'call', _425 => _425(blockIndex), 'optionalAccess', _426 => _426.para]);
28237
28310
  if (!para2) return void 0;
28238
28311
  return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
28239
28312
  }
@@ -28258,7 +28331,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28258
28331
  if (block.text && block.text.includes("\n")) {
28259
28332
  return { capability: "locked", reason: "\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)" };
28260
28333
  }
28261
- if (!_optionalChain([st, 'access', _422 => _422.paraMap, 'access', _423 => _423.get, 'call', _424 => _424(blockIndex), 'optionalAccess', _425 => _425.para])) {
28334
+ if (!_optionalChain([st, 'access', _427 => _427.paraMap, 'access', _428 => _428.get, 'call', _429 => _429(blockIndex), 'optionalAccess', _430 => _430.para])) {
28262
28335
  return { capability: "locked", reason: "\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)" };
28263
28336
  }
28264
28337
  return { capability: "text" };
@@ -28324,7 +28397,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28324
28397
  continue;
28325
28398
  }
28326
28399
  if (block.type === "table" && block.table) {
28327
- if (!_optionalChain([edit, 'access', _426 => _426.cells, 'optionalAccess', _427 => _427.length])) {
28400
+ if (!_optionalChain([edit, 'access', _431 => _431.cells, 'optionalAccess', _432 => _432.length])) {
28328
28401
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
28329
28402
  continue;
28330
28403
  }
@@ -28344,7 +28417,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28344
28417
  skipped.push({ reason: "\uAC19\uC740 \uC140\uC5D0 \uC911\uBCF5 \uD3B8\uC9D1 \u2014 \uBA3C\uC800 \uC801\uC6A9\uB41C \uD3B8\uC9D1 \uC720\uC9C0", after: summarize(cellEdit.text) });
28345
28418
  continue;
28346
28419
  }
28347
- const irCell = _optionalChain([block, 'access', _428 => _428.table, 'access', _429 => _429.cells, 'access', _430 => _430[cellEdit.row], 'optionalAccess', _431 => _431[cellEdit.col]]);
28420
+ const irCell = _optionalChain([block, 'access', _433 => _433.table, 'access', _434 => _434.cells, 'access', _435 => _435[cellEdit.row], 'optionalAccess', _436 => _436[cellEdit.col]]);
28348
28421
  if (!irCell) {
28349
28422
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
28350
28423
  continue;
@@ -28400,7 +28473,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28400
28473
  }
28401
28474
  if (replacements.size === 0) {
28402
28475
  let changes2;
28403
- if (_optionalChain([options, 'optionalAccess', _432 => _432.verify]) !== false) {
28476
+ if (_optionalChain([options, 'optionalAccess', _437 => _437.verify]) !== false) {
28404
28477
  const units = splitMarkdownUnits(st.markdown);
28405
28478
  changes2 = diffUnitLists(units, units);
28406
28479
  }
@@ -28421,7 +28494,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28421
28494
  }
28422
28495
  this.state = newState;
28423
28496
  let changes;
28424
- if (_optionalChain([options, 'optionalAccess', _433 => _433.verify]) !== false) {
28497
+ if (_optionalChain([options, 'optionalAccess', _438 => _438.verify]) !== false) {
28425
28498
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
28426
28499
  }
28427
28500
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -28441,7 +28514,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
28441
28514
  return skip("\uBB38\uB2E8 \uB0B4 \uAC15\uC81C \uC904\uBC14\uAFC8 \uD3EC\uD568 \u2014 \uC218\uC815 \uC2DC \uC904\uBC14\uAFC8 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0 (v1)");
28442
28515
  }
28443
28516
  const mapping = st.paraMap.get(blockIndex);
28444
- if (!_optionalChain([mapping, 'optionalAccess', _434 => _434.para])) {
28517
+ if (!_optionalChain([mapping, 'optionalAccess', _439 => _439.para])) {
28445
28518
  return skip("\uBB38\uB2E8 \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328 (\uBA38\uB9AC\uB9D0/\uAE00\uC0C1\uC790/\uCEA1\uC158 \uC601\uC5ED\uC774\uAC70\uB098 \uD14D\uC2A4\uD2B8 \uBD88\uC77C\uCE58)");
28446
28519
  }
28447
28520
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -28461,14 +28534,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
28461
28534
  if (sanitizeText(newPlain) !== newPlain) {
28462
28535
  return skip("\uACF5\uBC31 \uC815\uADDC\uD654 \uBD88\uC548\uC815 \uD14D\uC2A4\uD2B8 \u2014 \uD328\uCE58 \uC2DC \uC6D0\uBB38 \uBCF4\uC874 \uBD88\uAC00\uB85C \uBBF8\uC9C0\uC6D0");
28463
28536
  }
28464
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _435 => _435.scans, 'access', _436 => _436[mapping.para.sectionIndex], 'optionalAccess', _437 => _437.xml]));
28537
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _440 => _440.scans, 'access', _441 => _441[mapping.para.sectionIndex], 'optionalAccess', _442 => _442.xml]));
28465
28538
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
28466
28539
  sectionSplices[mapping.para.sectionIndex].push(...splices);
28467
28540
  return 1;
28468
28541
  }
28469
28542
  }, _class8);
28470
28543
  function cellStaticCheck(table2, scanTable, r, c) {
28471
- const irCell = _optionalChain([table2, 'access', _438 => _438.cells, 'access', _439 => _439[r], 'optionalAccess', _440 => _440[c]]);
28544
+ const irCell = _optionalChain([table2, 'access', _443 => _443.cells, 'access', _444 => _444[r], 'optionalAccess', _445 => _445[c]]);
28472
28545
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
28473
28546
  const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
28474
28547
  if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -28552,11 +28625,11 @@ var md = new (0, _markdownit2.default)({
28552
28625
  breaks: false
28553
28626
  });
28554
28627
  function renderHtml(markdown, options) {
28555
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _441 => _441.preset]), () => ( "default"));
28556
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _442 => _442.extraCss]), () => ( "")));
28628
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _446 => _446.preset]), () => ( "default"));
28629
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _447 => _447.extraCss]), () => ( "")));
28557
28630
  const body = md.render(markdown);
28558
- const watermark = _optionalChain([options, 'optionalAccess', _443 => _443.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
28559
- const watermarkCss = _optionalChain([options, 'optionalAccess', _444 => _444.watermark]) ? `
28631
+ const watermark = _optionalChain([options, 'optionalAccess', _448 => _448.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
28632
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _449 => _449.watermark]) ? `
28560
28633
  .watermark {
28561
28634
  position: fixed;
28562
28635
  top: 50%; left: 50%;
@@ -28587,13 +28660,13 @@ async function htmlToPdf(html, options) {
28587
28660
  try {
28588
28661
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
28589
28662
  } catch (e31) {
28590
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
28663
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
28591
28664
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
28592
28665
  );
28593
28666
  }
28594
28667
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
28595
28668
  if (!executablePath) {
28596
- throw new (0, _chunkNIW7CZYXcjs.KordocError)(
28669
+ throw new (0, _chunkDQJTNXVScjs.KordocError)(
28597
28670
  "Chromium \uC2E4\uD589 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. PUPPETEER_EXECUTABLE_PATH \uD658\uACBD\uBCC0\uC218\uB97C \uC124\uC815\uD558\uC138\uC694."
28598
28671
  );
28599
28672
  }
@@ -28605,10 +28678,10 @@ async function htmlToPdf(html, options) {
28605
28678
  try {
28606
28679
  const page = await browser.newPage();
28607
28680
  await page.setContent(html, { waitUntil: "networkidle0" });
28608
- const margin = _optionalChain([options, 'optionalAccess', _445 => _445.margin]);
28681
+ const margin = _optionalChain([options, 'optionalAccess', _450 => _450.margin]);
28609
28682
  const pdf = await page.pdf({
28610
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _446 => _446.pageSize]), () => ( "A4")),
28611
- landscape: _optionalChain([options, 'optionalAccess', _447 => _447.orientation]) === "landscape",
28683
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _451 => _451.pageSize]), () => ( "A4")),
28684
+ landscape: _optionalChain([options, 'optionalAccess', _452 => _452.orientation]) === "landscape",
28612
28685
  printBackground: true,
28613
28686
  margin: margin ? {
28614
28687
  top: toCss(margin.top),
@@ -28616,9 +28689,9 @@ async function htmlToPdf(html, options) {
28616
28689
  bottom: toCss(margin.bottom),
28617
28690
  left: toCss(margin.left)
28618
28691
  } : void 0,
28619
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _448 => _448.header]) || _optionalChain([options, 'optionalAccess', _449 => _449.footer])),
28620
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _450 => _450.header]), () => ( "<div></div>")),
28621
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _451 => _451.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
28692
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _453 => _453.header]) || _optionalChain([options, 'optionalAccess', _454 => _454.footer])),
28693
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _455 => _455.header]), () => ( "<div></div>")),
28694
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _456 => _456.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
28622
28695
  });
28623
28696
  return Buffer.from(pdf);
28624
28697
  } finally {
@@ -28652,7 +28725,7 @@ async function markdownToPdf(markdown, options) {
28652
28725
  return htmlToPdf(html, options);
28653
28726
  }
28654
28727
  async function blocksToPdf(blocks, options) {
28655
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, blocks);
28728
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, blocks);
28656
28729
  return markdownToPdf(markdown, options);
28657
28730
  }
28658
28731
 
@@ -28831,7 +28904,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
28831
28904
  }
28832
28905
  const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
28833
28906
  if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
28834
- const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _452 => _452.getAttribute, 'call', _453 => _453("vertRelTo")]), () => ( "PARA"));
28907
+ const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _457 => _457.getAttribute, 'call', _458 => _458("vertRelTo")]), () => ( "PARA"));
28835
28908
  if (vertRel === "PAGE" || vertRel === "PAPER") continue;
28836
28909
  const vo = Math.max(0, num2(pos, "vertOffset"));
28837
28910
  if (wrapAttr === "TOP_AND_BOTTOM") {
@@ -28892,7 +28965,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
28892
28965
  if (ln(p) !== "p") continue;
28893
28966
  reflowTablesIn(p, doc, styles, mode, counter);
28894
28967
  const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
28895
- const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _454 => _454.spaceBefore]), () => ( 0)));
28968
+ const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _459 => _459.spaceBefore]), () => ( 0)));
28896
28969
  const res = reflowPara(p, doc, styles, areaW, startV, mode);
28897
28970
  if (!res) {
28898
28971
  const lsa = findChildByLocalName(p, "linesegarray");
@@ -28905,7 +28978,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
28905
28978
  }
28906
28979
  if (Number.isFinite(bottom)) {
28907
28980
  cursorV = bottom;
28908
- prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _455 => _455.spaceAfter]), () => ( 0));
28981
+ prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _460 => _460.spaceAfter]), () => ( 0));
28909
28982
  }
28910
28983
  }
28911
28984
  continue;
@@ -29015,7 +29088,7 @@ function buildPara(p) {
29015
29088
  el: ch,
29016
29089
  tag: cn,
29017
29090
  index: chars.length,
29018
- inline: _optionalChain([pos, 'optionalAccess', _456 => _456.getAttribute, 'call', _457 => _457("treatAsChar")]) === "1",
29091
+ inline: _optionalChain([pos, 'optionalAccess', _461 => _461.getAttribute, 'call', _462 => _462("treatAsChar")]) === "1",
29019
29092
  width: w,
29020
29093
  height: h
29021
29094
  });
@@ -29267,15 +29340,15 @@ function drawShape(o, x, y, ctx, depth) {
29267
29340
  const sx = ow > 0 ? w / ow : 1;
29268
29341
  const sy = oh > 0 ? h / oh : 1;
29269
29342
  const lineShape = findChildByLocalName(el, "lineShape");
29270
- const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _458 => _458.getAttribute, 'call', _459 => _459("style")]), () => ( "SOLID"));
29271
- const strokeCol = _optionalChain([lineShape, 'optionalAccess', _460 => _460.getAttribute, 'call', _461 => _461("color")]) || "#000000";
29343
+ const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _463 => _463.getAttribute, 'call', _464 => _464("style")]), () => ( "SOLID"));
29344
+ const strokeCol = _optionalChain([lineShape, 'optionalAccess', _465 => _465.getAttribute, 'call', _466 => _466("color")]) || "#000000";
29272
29345
  const hasStroke = lstyle !== "NONE";
29273
29346
  const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
29274
29347
  const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
29275
29348
  const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
29276
29349
  const fillBrush = findChildByLocalName(el, "fillBrush");
29277
29350
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
29278
- const face = _optionalChain([winBrush, 'optionalAccess', _462 => _462.getAttribute, 'call', _463 => _463("faceColor")]);
29351
+ const face = _optionalChain([winBrush, 'optionalAccess', _467 => _467.getAttribute, 'call', _468 => _468("faceColor")]);
29279
29352
  const fill = face && face.toLowerCase() !== "none" ? face : "none";
29280
29353
  const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
29281
29354
  if (o.tag === "rect") {
@@ -29307,7 +29380,7 @@ function cellContentExtent(cell2) {
29307
29380
  if (ln2(p) !== "p") continue;
29308
29381
  const m = buildPara(p);
29309
29382
  for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
29310
- const baseV = _nullishCoalesce(_optionalChain([m, 'access', _464 => _464.segs, 'access', _465 => _465[0], 'optionalAccess', _466 => _466.vertpos]), () => ( 0));
29383
+ const baseV = _nullishCoalesce(_optionalChain([m, 'access', _469 => _469.segs, 'access', _470 => _470[0], 'optionalAccess', _471 => _471.vertpos]), () => ( 0));
29311
29384
  for (const o of m.objs) {
29312
29385
  if (o.inline) {
29313
29386
  const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el)) : o.height;
@@ -29315,7 +29388,7 @@ function cellContentExtent(cell2) {
29315
29388
  continue;
29316
29389
  }
29317
29390
  const pos = findChildByLocalName(o.el, "pos");
29318
- if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _467 => _467.getAttribute, 'call', _468 => _468("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
29391
+ if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _472 => _472.getAttribute, 'call', _473 => _473("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
29319
29392
  const om = findChildByLocalName(o.el, "outMargin");
29320
29393
  const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
29321
29394
  const anchor = pushed >= -100 ? pushed : baseV;
@@ -29401,7 +29474,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
29401
29474
  }));
29402
29475
  for (const g of geom) {
29403
29476
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
29404
- if (_optionalChain([bf, 'optionalAccess', _469 => _469.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
29477
+ if (_optionalChain([bf, 'optionalAccess', _474 => _474.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
29405
29478
  }
29406
29479
  for (const g of geom) {
29407
29480
  const { c } = g;
@@ -29439,7 +29512,7 @@ function drawPic(pic, x, y, ctx) {
29439
29512
  const sz = findChildByLocalName(pic, "sz");
29440
29513
  const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
29441
29514
  const img = findFirst(pic, "img");
29442
- const ref = _optionalChain([img, 'optionalAccess', _470 => _470.getAttribute, 'call', _471 => _471("binaryItemIDRef")]);
29515
+ const ref = _optionalChain([img, 'optionalAccess', _475 => _475.getAttribute, 'call', _476 => _476("binaryItemIDRef")]);
29443
29516
  const loaded = ref != null ? ctx.images.get(ref) : void 0;
29444
29517
  if (!loaded) {
29445
29518
  emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
@@ -29478,7 +29551,7 @@ function readSectionGeom(root) {
29478
29551
  const pagePr = findFirst(root, "pagePr");
29479
29552
  const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
29480
29553
  let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
29481
- if (_optionalChain([pagePr, 'optionalAccess', _472 => _472.getAttribute, 'call', _473 => _473("landscape")]) === "NARROWLY" && PW < PH) {
29554
+ if (_optionalChain([pagePr, 'optionalAccess', _477 => _477.getAttribute, 'call', _478 => _478("landscape")]) === "NARROWLY" && PW < PH) {
29482
29555
  const t = PW;
29483
29556
  PW = PH;
29484
29557
  PH = t;
@@ -29536,17 +29609,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
29536
29609
  return { pages: ctx.pages, pageH };
29537
29610
  }
29538
29611
  async function renderHwpxToSvg(input, options) {
29539
- const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _474 => _474.maxImageBytes]), () => ( 40 * 1024 * 1024));
29612
+ const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _479 => _479.maxImageBytes]), () => ( 40 * 1024 * 1024));
29540
29613
  const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
29541
- _chunkNIW7CZYXcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
29614
+ _chunkDQJTNXVScjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
29542
29615
  let zip;
29543
29616
  try {
29544
29617
  zip = await _jszip2.default.loadAsync(input);
29545
29618
  } catch (e32) {
29546
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
29619
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
29547
29620
  }
29548
29621
  const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
29549
- if (secFiles.length === 0) throw new (0, _chunkNIW7CZYXcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
29622
+ if (secFiles.length === 0) throw new (0, _chunkDQJTNXVScjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
29550
29623
  const warnings = [];
29551
29624
  const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
29552
29625
  const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
@@ -29554,7 +29627,7 @@ async function renderHwpxToSvg(input, options) {
29554
29627
  const secXmls = [];
29555
29628
  for (const f of secFiles) {
29556
29629
  const xml = await f.async("string");
29557
- if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
29630
+ if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
29558
29631
  secXmls.push(xml);
29559
29632
  }
29560
29633
  const binmap = /* @__PURE__ */ new Map();
@@ -29578,7 +29651,7 @@ async function renderHwpxToSvg(input, options) {
29578
29651
  let href = binmap.get(ref);
29579
29652
  if (!href) {
29580
29653
  const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
29581
- href = _optionalChain([cand, 'optionalAccess', _475 => _475.name]);
29654
+ href = _optionalChain([cand, 'optionalAccess', _480 => _480.name]);
29582
29655
  }
29583
29656
  if (!href) continue;
29584
29657
  const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
@@ -29599,7 +29672,7 @@ async function renderHwpxToSvg(input, options) {
29599
29672
  styles,
29600
29673
  images,
29601
29674
  defs: [],
29602
- highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _476 => _476.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
29675
+ highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _481 => _481.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
29603
29676
  warnings,
29604
29677
  warned: /* @__PURE__ */ new Set(),
29605
29678
  stats: { texts: 0, images: 0, tables: 0 }
@@ -29609,7 +29682,7 @@ async function renderHwpxToSvg(input, options) {
29609
29682
  for (let si = 0; si < secXmls.length; si++) {
29610
29683
  const secXml = secXmls[si];
29611
29684
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
29612
- if (!hasCache && !_optionalChain([options, 'optionalAccess', _477 => _477.reflow])) {
29685
+ if (!hasCache && !_optionalChain([options, 'optionalAccess', _482 => _482.reflow])) {
29613
29686
  noCacheSkipped = true;
29614
29687
  warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
29615
29688
  continue;
@@ -29621,14 +29694,14 @@ async function renderHwpxToSvg(input, options) {
29621
29694
  continue;
29622
29695
  }
29623
29696
  const geom = readSectionGeom(root);
29624
- const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _478 => _478.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _479 => _479.reflowMode]), () => ( "keep")));
29697
+ const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _483 => _483.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _484 => _484.reflowMode]), () => ( "keep")));
29625
29698
  rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
29626
29699
  }
29627
29700
  if (rendered.length === 0) {
29628
29701
  if (noCacheSkipped) {
29629
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
29702
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("\uC870\uD310 \uCE90\uC2DC(linesegarray) \uC5C6\uC74C \u2014 \uD55C\uCEF4\uC5D0\uC11C \uC800\uC7A5\uD55C HWPX\uB9CC \uB80C\uB354 \uAC00\uB2A5 (reflow \uC635\uC158\uC73C\uB85C \uD569\uC131 \uB80C\uB354 \uAC00\uB2A5)");
29630
29703
  }
29631
- throw new (0, _chunkNIW7CZYXcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
29704
+ throw new (0, _chunkDQJTNXVScjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
29632
29705
  }
29633
29706
  const GAP = 2400;
29634
29707
  const clipDefs = [];
@@ -29660,17 +29733,17 @@ ${groups.join("\n")}
29660
29733
  // src/index.ts
29661
29734
  async function parse(input, options) {
29662
29735
  let buffer;
29663
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _480 => _480.filePath]) ? { ...options, filePath: input } : options;
29736
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _485 => _485.filePath]) ? { ...options, filePath: input } : options;
29664
29737
  if (typeof input === "string") {
29665
29738
  try {
29666
29739
  const buf = await _promises.readFile.call(void 0, input);
29667
- buffer = _chunkNIW7CZYXcjs.toArrayBuffer.call(void 0, buf);
29740
+ buffer = _chunkDQJTNXVScjs.toArrayBuffer.call(void 0, buf);
29668
29741
  } catch (err) {
29669
29742
  const msg2 = err instanceof Error && "code" in err && err.code === "ENOENT" ? `\uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input}` : `\uD30C\uC77C \uC77D\uAE30 \uC2E4\uD328: ${input}`;
29670
29743
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
29671
29744
  }
29672
29745
  } else if (Buffer.isBuffer(input)) {
29673
- buffer = _chunkNIW7CZYXcjs.toArrayBuffer.call(void 0, input);
29746
+ buffer = _chunkDQJTNXVScjs.toArrayBuffer.call(void 0, input);
29674
29747
  } else {
29675
29748
  buffer = input;
29676
29749
  }
@@ -29705,21 +29778,21 @@ async function parseHwp3(buffer, options) {
29705
29778
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
29706
29779
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
29707
29780
  } catch (err) {
29708
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29781
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29709
29782
  }
29710
29783
  }
29711
29784
  async function parseHwpx(buffer, options) {
29712
29785
  try {
29713
29786
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
29714
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _481 => _481.length]) ? images : void 0 };
29787
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _486 => _486.length]) ? images : void 0 };
29715
29788
  } catch (err) {
29716
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29789
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29717
29790
  }
29718
29791
  }
29719
29792
  async function parseHwp(buffer, options) {
29720
29793
  try {
29721
29794
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
29722
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _482 => _482.filePath])) {
29795
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _487 => _487.filePath])) {
29723
29796
  try {
29724
29797
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
29725
29798
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -29736,15 +29809,15 @@ async function parseHwp(buffer, options) {
29736
29809
  } catch (e33) {
29737
29810
  }
29738
29811
  }
29739
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _483 => _483.length]) ? images : void 0 };
29812
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _488 => _488.length]) ? images : void 0 };
29740
29813
  } catch (err) {
29741
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29814
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29742
29815
  }
29743
29816
  }
29744
29817
  async function parsePdf(buffer, options) {
29745
29818
  let parsePdfDocument;
29746
29819
  try {
29747
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-2ZUTCU2G.cjs")));
29820
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-VEY4B5CJ.cjs")));
29748
29821
  parsePdfDocument = mod.parsePdfDocument;
29749
29822
  } catch (e34) {
29750
29823
  return {
@@ -29759,7 +29832,7 @@ async function parsePdf(buffer, options) {
29759
29832
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
29760
29833
  } catch (err) {
29761
29834
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
29762
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err), isImageBased };
29835
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err), isImageBased };
29763
29836
  }
29764
29837
  }
29765
29838
  async function parseXlsx(buffer, options) {
@@ -29767,7 +29840,7 @@ async function parseXlsx(buffer, options) {
29767
29840
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
29768
29841
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
29769
29842
  } catch (err) {
29770
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29843
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29771
29844
  }
29772
29845
  }
29773
29846
  async function parseXls(buffer, options) {
@@ -29775,15 +29848,15 @@ async function parseXls(buffer, options) {
29775
29848
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
29776
29849
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
29777
29850
  } catch (err) {
29778
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29851
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29779
29852
  }
29780
29853
  }
29781
29854
  async function parseDocx(buffer, options) {
29782
29855
  try {
29783
29856
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
29784
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _484 => _484.length]) ? images : void 0 };
29857
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _489 => _489.length]) ? images : void 0 };
29785
29858
  } catch (err) {
29786
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29859
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29787
29860
  }
29788
29861
  }
29789
29862
  async function parseHwpml(buffer, options) {
@@ -29791,16 +29864,16 @@ async function parseHwpml(buffer, options) {
29791
29864
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
29792
29865
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
29793
29866
  } catch (err) {
29794
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkNIW7CZYXcjs.classifyError.call(void 0, err) };
29867
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkDQJTNXVScjs.classifyError.call(void 0, err) };
29795
29868
  }
29796
29869
  }
29797
29870
  async function fillForm(input, values, outputFormat = "markdown") {
29798
29871
  let buffer;
29799
29872
  if (typeof input === "string") {
29800
29873
  const buf = await _promises.readFile.call(void 0, input);
29801
- buffer = _chunkNIW7CZYXcjs.toArrayBuffer.call(void 0, buf);
29874
+ buffer = _chunkDQJTNXVScjs.toArrayBuffer.call(void 0, buf);
29802
29875
  } else if (Buffer.isBuffer(input)) {
29803
- buffer = _chunkNIW7CZYXcjs.toArrayBuffer.call(void 0, input);
29876
+ buffer = _chunkDQJTNXVScjs.toArrayBuffer.call(void 0, input);
29804
29877
  } else {
29805
29878
  buffer = input;
29806
29879
  }
@@ -29826,7 +29899,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
29826
29899
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
29827
29900
  }
29828
29901
  const fill = fillFormFields(parsed.blocks, values);
29829
- const markdown = _chunkNIW7CZYXcjs.blocksToMarkdown.call(void 0, fill.blocks);
29902
+ const markdown = _chunkDQJTNXVScjs.blocksToMarkdown.call(void 0, fill.blocks);
29830
29903
  if (outputFormat === "hwpx") {
29831
29904
  const hwpxBuffer = await markdownToHwpx(markdown);
29832
29905
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -29895,5 +29968,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
29895
29968
 
29896
29969
 
29897
29970
 
29898
- exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkNIW7CZYXcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkNIW7CZYXcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
29971
+ exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkDQJTNXVScjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkDQJTNXVScjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; exports.charWidthEm1000 = charWidthEm1000; exports.compare = compare; exports.detectFormat = detectFormat; exports.detectOle2Format = detectOle2Format; exports.detectZipFormat = detectZipFormat; exports.diffBlocks = diffBlocks; exports.extractFormFields = extractFormFields; exports.extractFormSchema = extractFormSchema; exports.fillForm = fillForm; exports.fillFormFields = fillFormFields; exports.fillHwpx = fillHwpx; exports.fillWithUniqueGuard = fillWithUniqueGuard; exports.fitRatioForFewerLines = fitRatioForFewerLines; exports.formatFillValue = formatFillValue; exports.gongmunLintWarnings = gongmunLintWarnings; exports.hwpxToProfile = hwpxToProfile; exports.incompatibleGongmunWarnings = incompatibleGongmunWarnings; exports.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isKnownFont = isKnownFont; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.lintGongmunText = lintGongmunText; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
29899
29972
  //# sourceMappingURL=index.cjs.map