kordoc 4.2.2 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +14 -2
  2. package/dist/{-NFHVGTVM.js → -GJYDKVQD.js} +9 -9
  3. package/dist/{chunk-WMU2KJHF.cjs → chunk-5AXGFJQO.cjs} +4 -4
  4. package/dist/{chunk-WMU2KJHF.cjs.map → chunk-5AXGFJQO.cjs.map} +1 -1
  5. package/dist/{chunk-EFF2JPPA.cjs → chunk-AA6UPPZF.cjs} +9 -9
  6. package/dist/{chunk-EFF2JPPA.cjs.map → chunk-AA6UPPZF.cjs.map} +1 -1
  7. package/dist/{chunk-LUJN3VFB.js → chunk-CGFWS3BQ.js} +3 -3
  8. package/dist/{chunk-KKZATKQW.cjs → chunk-CWP56BRC.cjs} +2 -2
  9. package/dist/{chunk-KKZATKQW.cjs.map → chunk-CWP56BRC.cjs.map} +1 -1
  10. package/dist/{chunk-DSL6EVFJ.js → chunk-DE6FORIP.js} +2 -2
  11. package/dist/{chunk-T4AWY45Q.js → chunk-ELRVXOMP.js} +2 -2
  12. package/dist/{chunk-DLFZAU4X.cjs → chunk-FF5QNEKZ.cjs} +3 -3
  13. package/dist/{chunk-DLFZAU4X.cjs.map → chunk-FF5QNEKZ.cjs.map} +1 -1
  14. package/dist/{chunk-ZF7QL4IY.js → chunk-GJO3ORFW.js} +1 -1
  15. package/dist/chunk-GJO3ORFW.js.map +1 -0
  16. package/dist/{chunk-IXHBRMDB.js → chunk-K5LGSH5T.js} +2 -2
  17. package/dist/{chunk-MYD3QLBL.js → chunk-LMNSIPWZ.js} +2 -2
  18. package/dist/{chunk-X77U36TV.js → chunk-LPWP4FWU.js} +2 -2
  19. package/dist/{chunk-L5B7PQOP.js → chunk-NIPPOAT6.js} +2 -2
  20. package/dist/{chunk-MOOVF6CT.js → chunk-NOMNOG74.js} +2 -2
  21. package/dist/{chunk-GUYIXVV7.js → chunk-QNVZAKUQ.js} +2 -2
  22. package/dist/chunk-QNVZAKUQ.js.map +1 -0
  23. package/dist/{chunk-2L7MIKOM.js → chunk-RAS3HM4X.js} +2 -2
  24. package/dist/{chunk-OLDIDBJ2.js → chunk-U6XYOV32.js} +3 -3
  25. package/dist/{chunk-GHMVNMUN.js → chunk-WTJIRGPN.js} +3 -3
  26. package/dist/{chunk-TXYQJXOV.js → chunk-WX75LYAS.js} +89 -30
  27. package/dist/chunk-WX75LYAS.js.map +1 -0
  28. package/dist/{chunk-FHYLLKIP.js → chunk-X634MXVJ.js} +2 -2
  29. package/dist/chunks-JOGD2KUK.js +10 -0
  30. package/dist/cli.js +18 -18
  31. package/dist/{image-ocr-S4REURLR.js → image-ocr-O3YQ3KEN.js} +5 -5
  32. package/dist/{image-ocr-TGHAMIQL.js → image-ocr-PLTV4NOK.js} +4 -4
  33. package/dist/{image-ocr-3AFBDDJI.cjs → image-ocr-TCJLNMTG.cjs} +9 -9
  34. package/dist/{image-ocr-3AFBDDJI.cjs.map → image-ocr-TCJLNMTG.cjs.map} +1 -1
  35. package/dist/index.cjs +506 -447
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +7 -2
  38. package/dist/index.d.ts +7 -2
  39. package/dist/index.js +84 -25
  40. package/dist/index.js.map +1 -1
  41. package/dist/mcp.js +15 -15
  42. package/dist/{parser-C3APVZGT.js → parser-UX5T6KTZ.js} +6 -6
  43. package/dist/{parser-MRM6WICO.cjs → parser-VQIJPCI5.cjs} +24 -24
  44. package/dist/{parser-MRM6WICO.cjs.map → parser-VQIJPCI5.cjs.map} +1 -1
  45. package/dist/{parser-KMC4YOZH.js → parser-Y2X4JMAK.js} +5 -5
  46. package/dist/{pdf-ocr-UURMV6FD.js → pdf-ocr-DOPZP6QS.js} +5 -5
  47. package/dist/pdf-ocr-I3Y6YF5K.js +12 -0
  48. package/dist/pdf-ocr-XMDJ2IF5.cjs +13 -0
  49. package/dist/{pdf-ocr-5BRMIJAT.cjs.map → pdf-ocr-XMDJ2IF5.cjs.map} +1 -1
  50. package/dist/{profile-io-RLQ62KS5.js → profile-io-EGVJAZDG.js} +3 -3
  51. package/dist/{rasterize-LBABF2WI.js → rasterize-TH26U5E2.js} +2 -2
  52. package/dist/render-C4R3OJ45.js +10 -0
  53. package/dist/seal-JF2J4S52.js +10 -0
  54. package/dist/{setup-Q2PRE7UA.js → setup-GUQT5ELJ.js} +23 -3
  55. package/dist/setup-GUQT5ELJ.js.map +1 -0
  56. package/dist/{watch-XEUEGOXW.js → watch-4SP7V6SV.js} +9 -9
  57. package/package.json +1 -1
  58. package/dist/chunk-GUYIXVV7.js.map +0 -1
  59. package/dist/chunk-TXYQJXOV.js.map +0 -1
  60. package/dist/chunk-ZF7QL4IY.js.map +0 -1
  61. package/dist/chunks-N4CWHTJI.js +0 -10
  62. package/dist/pdf-ocr-5BRMIJAT.cjs +0 -13
  63. package/dist/pdf-ocr-UDTEQEWA.js +0 -12
  64. package/dist/render-CYXQEHS7.js +0 -10
  65. package/dist/seal-SV6PFFYU.js +0 -10
  66. package/dist/setup-Q2PRE7UA.js.map +0 -1
  67. /package/dist/{-NFHVGTVM.js.map → -GJYDKVQD.js.map} +0 -0
  68. /package/dist/{chunk-LUJN3VFB.js.map → chunk-CGFWS3BQ.js.map} +0 -0
  69. /package/dist/{chunk-DSL6EVFJ.js.map → chunk-DE6FORIP.js.map} +0 -0
  70. /package/dist/{chunk-T4AWY45Q.js.map → chunk-ELRVXOMP.js.map} +0 -0
  71. /package/dist/{chunk-IXHBRMDB.js.map → chunk-K5LGSH5T.js.map} +0 -0
  72. /package/dist/{chunk-MYD3QLBL.js.map → chunk-LMNSIPWZ.js.map} +0 -0
  73. /package/dist/{chunk-X77U36TV.js.map → chunk-LPWP4FWU.js.map} +0 -0
  74. /package/dist/{chunk-L5B7PQOP.js.map → chunk-NIPPOAT6.js.map} +0 -0
  75. /package/dist/{chunk-MOOVF6CT.js.map → chunk-NOMNOG74.js.map} +0 -0
  76. /package/dist/{chunk-2L7MIKOM.js.map → chunk-RAS3HM4X.js.map} +0 -0
  77. /package/dist/{chunk-OLDIDBJ2.js.map → chunk-U6XYOV32.js.map} +0 -0
  78. /package/dist/{chunk-GHMVNMUN.js.map → chunk-WTJIRGPN.js.map} +0 -0
  79. /package/dist/{chunk-FHYLLKIP.js.map → chunk-X634MXVJ.js.map} +0 -0
  80. /package/dist/{chunks-N4CWHTJI.js.map → chunks-JOGD2KUK.js.map} +0 -0
  81. /package/dist/{image-ocr-S4REURLR.js.map → image-ocr-O3YQ3KEN.js.map} +0 -0
  82. /package/dist/{image-ocr-TGHAMIQL.js.map → image-ocr-PLTV4NOK.js.map} +0 -0
  83. /package/dist/{parser-C3APVZGT.js.map → parser-UX5T6KTZ.js.map} +0 -0
  84. /package/dist/{parser-KMC4YOZH.js.map → parser-Y2X4JMAK.js.map} +0 -0
  85. /package/dist/{pdf-ocr-UDTEQEWA.js.map → pdf-ocr-DOPZP6QS.js.map} +0 -0
  86. /package/dist/{pdf-ocr-UURMV6FD.js.map → pdf-ocr-I3Y6YF5K.js.map} +0 -0
  87. /package/dist/{profile-io-RLQ62KS5.js.map → profile-io-EGVJAZDG.js.map} +0 -0
  88. /package/dist/{rasterize-LBABF2WI.js.map → rasterize-TH26U5E2.js.map} +0 -0
  89. /package/dist/{render-CYXQEHS7.js.map → render-C4R3OJ45.js.map} +0 -0
  90. /package/dist/{seal-SV6PFFYU.js.map → seal-JF2J4S52.js.map} +0 -0
  91. /package/dist/{watch-XEUEGOXW.js.map → watch-4SP7V6SV.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
 
10
10
 
11
- var _chunkWMU2KJHFcjs = require('./chunk-WMU2KJHF.cjs');
11
+ var _chunk5AXGFJQOcjs = require('./chunk-5AXGFJQO.cjs');
12
12
 
13
13
 
14
14
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -27,7 +27,7 @@ var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
27
27
 
28
28
 
29
29
 
30
- var _chunkKKZATKQWcjs = require('./chunk-KKZATKQW.cjs');
30
+ var _chunkCWP56BRCcjs = require('./chunk-CWP56BRC.cjs');
31
31
 
32
32
 
33
33
  var _chunkGS7T56RPcjs = require('./chunk-GS7T56RP.cjs');
@@ -413,7 +413,7 @@ function comResultToParseResult(pages, pageCount, warnings) {
413
413
  var _xmldom = require('@xmldom/xmldom');
414
414
  var MAX_DECOMPRESS_SIZE = 256 * 1024 * 1024;
415
415
  var MAX_ZIP_ENTRIES = 500;
416
- var ZipBombError = class extends _chunkKKZATKQWcjs.KordocError {
416
+ var ZipBombError = class extends _chunkCWP56BRCcjs.KordocError {
417
417
  constructor(message) {
418
418
  super(message);
419
419
  this.name = "ZipBombError";
@@ -429,7 +429,7 @@ function createSectionShared() {
429
429
  function createXmlParser(warnings) {
430
430
  return new (0, _xmldom.DOMParser)({
431
431
  onError(level, msg2) {
432
- if (level === "fatalError") throw new (0, _chunkKKZATKQWcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
432
+ if (level === "fatalError") throw new (0, _chunkCWP56BRCcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
433
433
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warning" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
434
434
  }
435
435
  });
@@ -506,10 +506,10 @@ async function extractHwpxStyles(zip, decompressed) {
506
506
  const xml = await file.async("text");
507
507
  if (decompressed) {
508
508
  decompressed.total += xml.length * 2;
509
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
509
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
510
510
  }
511
511
  const parser = createXmlParser();
512
- const doc = parser.parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, xml), "text/xml");
512
+ const doc = parser.parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, xml), "text/xml");
513
513
  if (!doc.documentElement) continue;
514
514
  const domDoc = doc;
515
515
  parseCharProperties(domDoc, result.charProperties);
@@ -696,9 +696,9 @@ function detectHwpxHeadings(blocks, styleMap) {
696
696
  let level = 0;
697
697
  if (baseFontSize > 0 && _optionalChain([block, 'access', _11 => _11.style, 'optionalAccess', _12 => _12.fontSize])) {
698
698
  const ratio = block.style.fontSize / baseFontSize;
699
- if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H1) level = 1;
700
- else if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H2) level = 2;
701
- else if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H3) level = 3;
699
+ if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H1) level = 1;
700
+ else if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H2) level = 2;
701
+ else if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H3) level = 3;
702
702
  }
703
703
  const compactText = text.replace(/\s+/g, "");
704
704
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1623,7 +1623,7 @@ function needsGaejosikAssets(gongmun) {
1623
1623
  }
1624
1624
  function assertFiniteRange(name, value, min, max) {
1625
1625
  if (!Number.isFinite(value) || value < min || value > max) {
1626
- throw new (0, _chunkKKZATKQWcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
1626
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(`${name} must be a finite number between ${min} and ${max}`);
1627
1627
  }
1628
1628
  }
1629
1629
  function validateGongmunOptions(opts) {
@@ -1638,10 +1638,10 @@ function validateGongmunOptions(opts) {
1638
1638
  assertFiniteRange(`margins.${side}`, value, 0, 200);
1639
1639
  }
1640
1640
  if (opts.margins.left + opts.margins.right >= 210) {
1641
- throw new (0, _chunkKKZATKQWcjs.KordocError)("margins.left + margins.right must be less than 210");
1641
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("margins.left + margins.right must be less than 210");
1642
1642
  }
1643
1643
  if (opts.margins.top + opts.margins.bottom >= 297) {
1644
- throw new (0, _chunkKKZATKQWcjs.KordocError)("margins.top + margins.bottom must be less than 297");
1644
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("margins.top + margins.bottom must be less than 297");
1645
1645
  }
1646
1646
  }
1647
1647
  if (opts.sizes) {
@@ -1650,7 +1650,7 @@ function validateGongmunOptions(opts) {
1650
1650
  }
1651
1651
  }
1652
1652
  if (opts.approval && opts.approval.length > 6) {
1653
- throw new (0, _chunkKKZATKQWcjs.KordocError)("approval must contain at most 6 labels");
1653
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("approval must contain at most 6 labels");
1654
1654
  }
1655
1655
  }
1656
1656
  function incompatibleGongmunWarnings(opts) {
@@ -1915,7 +1915,7 @@ function resolveParaHeading(paraEl, ctx) {
1915
1915
 
1916
1916
  // src/hwpx/table-build.ts
1917
1917
  function buildTableWithCellMeta(state, keepAnchoredEmptyCols) {
1918
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols });
1918
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, state.rows, { keepAnchoredEmptyCols });
1919
1919
  if (state.caption) table2.caption = state.caption;
1920
1920
  const anchors = [];
1921
1921
  {
@@ -1985,7 +1985,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1985
1985
  const cell2 = parentTable.cell;
1986
1986
  (cell2.blocks ??= []).push(block);
1987
1987
  cell2.hasStructure = true;
1988
- let flat = _chunkWMU2KJHFcjs.convertTableToText.call(void 0, newTable.rows);
1988
+ let flat = _chunk5AXGFJQOcjs.convertTableToText.call(void 0, newTable.rows);
1989
1989
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1990
1990
  if (flat) cell2.text += (cell2.text ? "\n" : "") + flat;
1991
1991
  } else {
@@ -1997,7 +1997,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1997
1997
  // src/hwpx/section-walker.ts
1998
1998
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1999
1999
  const parser = createXmlParser(warnings);
2000
- const doc = parser.parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, xml), "text/xml");
2000
+ const doc = parser.parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, xml), "text/xml");
2001
2001
  if (!doc.documentElement) return [];
2002
2002
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
2003
2003
  ctx.shared.track.deleteDepth = 0;
@@ -2103,12 +2103,12 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2103
2103
  const cs = isNaN(rawCs) ? 1 : rawCs;
2104
2104
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
2105
2105
  const rs = isNaN(rawRs) ? 1 : rawRs;
2106
- tableCtx.cell.colSpan = clampSpan(cs, _chunkWMU2KJHFcjs.MAX_COLS);
2107
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkWMU2KJHFcjs.MAX_ROWS);
2106
+ tableCtx.cell.colSpan = clampSpan(cs, _chunk5AXGFJQOcjs.MAX_COLS);
2107
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunk5AXGFJQOcjs.MAX_ROWS);
2108
2108
  }
2109
2109
  break;
2110
2110
  case "p": {
2111
- const { text: rawText, href, footnote, style } = extractParagraphInfo(el, ctx.styleMap, ctx);
2111
+ const { text: rawText, href, footnote, style, segments } = extractParagraphInfo(el, ctx.styleMap, ctx);
2112
2112
  let text = rawText;
2113
2113
  let headingLevel;
2114
2114
  const ph = resolveParaHeading(el, ctx);
@@ -2116,14 +2116,41 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2116
2116
  if (_optionalChain([ph, 'optionalAccess', _34 => _34.prefix])) text = ph.prefix + " " + text;
2117
2117
  headingLevel = _optionalChain([ph, 'optionalAccess', _35 => _35.headingLevel]);
2118
2118
  }
2119
+ if (segments) {
2120
+ const cell2 = _nullishCoalesce(_optionalChain([tableCtx, 'optionalAccess', _36 => _36.cell]), () => ( null));
2121
+ if (text && cell2) cell2.text += (cell2.text ? "\n" : "") + (footnote ? `${text} (\uC8FC: ${footnote})` : text);
2122
+ const segs = [...segments];
2123
+ if (_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
2124
+ const fi = segs.findIndex((s) => s);
2125
+ if (fi >= 0) segs[fi] = ph.prefix + " " + segs[fi];
2126
+ }
2127
+ let segIdx = 0;
2128
+ let first = true;
2129
+ const flush = () => {
2130
+ const s = segs[segIdx++];
2131
+ if (!s) return;
2132
+ const block = { type: "paragraph", text: s, pageNumber: ctx.sectionNum };
2133
+ if (first && !cell2) {
2134
+ first = false;
2135
+ if (style) block.style = style;
2136
+ if (href) block.href = href;
2137
+ if (footnote) block.footnoteText = footnote;
2138
+ }
2139
+ if (cell2) (cell2.blocks ??= []).push(block);
2140
+ else blocks.push(block);
2141
+ };
2142
+ tableCtx = walkParagraphChildren(el, blocks, tableCtx, tableStack, ctx, depth + 1, flush);
2143
+ while (segIdx < segs.length) flush();
2144
+ break;
2145
+ }
2119
2146
  if (text) {
2120
- if (_optionalChain([tableCtx, 'optionalAccess', _36 => _36.cell])) {
2147
+ if (_optionalChain([tableCtx, 'optionalAccess', _38 => _38.cell])) {
2121
2148
  const cell2 = tableCtx.cell;
2122
2149
  if (footnote) text += ` (\uC8FC: ${footnote})`;
2123
2150
  cell2.text += (cell2.text ? "\n" : "") + text;
2124
2151
  const cellBlock = { type: "paragraph", text, pageNumber: ctx.sectionNum };
2125
2152
  const cellSpanMode = spanModeOf(ctx.shared.kordocLayout);
2126
- if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _37 => _37.prefix])) {
2153
+ if (cellSpanMode && !_optionalChain([ph, 'optionalAccess', _39 => _39.prefix])) {
2127
2154
  const spans = extractRunSpans(el, ctx, cellSpanMode, cellSpanMode !== "kordoc");
2128
2155
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
2129
2156
  cellBlock.spans = spans;
@@ -2142,7 +2169,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2142
2169
  if (style) block.style = style;
2143
2170
  if (href) block.href = href;
2144
2171
  if (footnote) block.footnoteText = footnote;
2145
- const ind = _optionalChain([ctx, 'access', _38 => _38.styleMap, 'optionalAccess', _39 => _39.paraIndents, 'access', _40 => _40.get, 'call', _41 => _41(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
2172
+ const ind = _optionalChain([ctx, 'access', _40 => _40.styleMap, 'optionalAccess', _41 => _41.paraIndents, 'access', _42 => _42.get, 'call', _43 => _43(_nullishCoalesce(el.getAttribute("paraPrIDRef"), () => ( "")))]);
2146
2173
  if (ind) {
2147
2174
  const eff = ind.left + Math.max(0, ind.intent);
2148
2175
  if (eff > 0) block.indent = eff;
@@ -2153,7 +2180,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2153
2180
  }
2154
2181
  const spanMode = spanModeOf(ctx.shared.kordocLayout);
2155
2182
  if (!headingLevel && spanMode) {
2156
- if (!_optionalChain([ph, 'optionalAccess', _42 => _42.prefix])) {
2183
+ if (!_optionalChain([ph, 'optionalAccess', _44 => _44.prefix])) {
2157
2184
  const spans = extractRunSpans(el, ctx, spanMode, spanMode === "gongmun");
2158
2185
  if (spans && spans.map((s) => s.text).join("").replace(/[ \t]+/g, " ").trim() === text) {
2159
2186
  block.spans = spans;
@@ -2173,7 +2200,7 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2173
2200
  case "pic":
2174
2201
  case "shape":
2175
2202
  case "drawingObject": {
2176
- if (_optionalChain([tableCtx, 'optionalAccess', _43 => _43.cell])) {
2203
+ if (_optionalChain([tableCtx, 'optionalAccess', _45 => _45.cell])) {
2177
2204
  const sink = [];
2178
2205
  handleShape(el, sink, ctx);
2179
2206
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -2278,7 +2305,7 @@ function hasPageAutoNum(el, depth = 0) {
2278
2305
  const ch = children[i];
2279
2306
  if (ch.nodeType !== 1) continue;
2280
2307
  const tag = (ch.tagName || ch.localName || "").replace(/^[^:]+:/, "");
2281
- if (tag === "autoNum" && _optionalChain([ch, 'access', _44 => _44.getAttribute, 'optionalCall', _45 => _45("numType")]) === "PAGE") return true;
2308
+ if (tag === "autoNum" && _optionalChain([ch, 'access', _46 => _46.getAttribute, 'optionalCall', _47 => _47("numType")]) === "PAGE") return true;
2282
2309
  if (hasPageAutoNum(ch, depth + 1)) return true;
2283
2310
  }
2284
2311
  return false;
@@ -2315,7 +2342,7 @@ function flattenSubListTable(el, ctx, depth) {
2315
2342
  const sink = [];
2316
2343
  const st = { rows: [], currentRow: [], cell: null };
2317
2344
  walkSection(el, sink, st, [], ctx, depth + 1);
2318
- let flat = _chunkWMU2KJHFcjs.convertTableToText.call(void 0, st.rows);
2345
+ let flat = _chunk5AXGFJQOcjs.convertTableToText.call(void 0, st.rows);
2319
2346
  if (st.caption) flat = st.caption + (flat ? "\n" + flat : "");
2320
2347
  return flat;
2321
2348
  }
@@ -2334,7 +2361,7 @@ function findTopLevelTbls(el, out, depth = 0) {
2334
2361
  findTopLevelTbls(ch, out, depth + 1);
2335
2362
  }
2336
2363
  }
2337
- function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
2364
+ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth = 0, onTbl) {
2338
2365
  if (depth > MAX_XML_DEPTH) return tableCtx;
2339
2366
  const children = node.childNodes;
2340
2367
  if (!children) return tableCtx;
@@ -2348,6 +2375,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
2348
2375
  const tag = el.tagName || el.localName || "";
2349
2376
  const localTag = tag.replace(/^[^:]+:/, "");
2350
2377
  if (localTag === "tbl") {
2378
+ if (onTbl && isInlineTbl(el)) onTbl();
2351
2379
  if (!tableCtx) {
2352
2380
  const chan = kordocTableChannel(el, ctx);
2353
2381
  if (chan) {
@@ -2364,12 +2392,12 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
2364
2392
  } else if (localTag === "caption" && !inShape) {
2365
2393
  const capText = collectSubListText(el, ctx);
2366
2394
  if (capText) {
2367
- if (_optionalChain([tableCtx, 'optionalAccess', _46 => _46.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: capText, pageNumber: ctx.sectionNum }]);
2395
+ if (_optionalChain([tableCtx, 'optionalAccess', _48 => _48.cell])) mergeBlocksIntoCell(tableCtx.cell, [{ type: "paragraph", text: capText, pageNumber: ctx.sectionNum }]);
2368
2396
  else if (tableCtx) tableCtx.caption = (tableCtx.caption ? tableCtx.caption + "\n" : "") + capText;
2369
2397
  else blocks.push({ type: "paragraph", text: capText, pageNumber: ctx.sectionNum });
2370
2398
  }
2371
2399
  } else if (localTag === "pic" || localTag === "shape" || localTag === "drawingObject") {
2372
- if (_optionalChain([tableCtx, 'optionalAccess', _47 => _47.cell])) {
2400
+ if (_optionalChain([tableCtx, 'optionalAccess', _49 => _49.cell])) {
2373
2401
  const sink = [];
2374
2402
  handleShape(el, sink, ctx);
2375
2403
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -2377,7 +2405,7 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
2377
2405
  handleShape(el, blocks, ctx);
2378
2406
  }
2379
2407
  } else if (localTag === "drawText") {
2380
- if (_optionalChain([tableCtx, 'optionalAccess', _48 => _48.cell])) {
2408
+ if (_optionalChain([tableCtx, 'optionalAccess', _50 => _50.cell])) {
2381
2409
  const sink = [];
2382
2410
  extractDrawTextBlocks(el, sink, ctx);
2383
2411
  mergeBlocksIntoCell(tableCtx.cell, sink);
@@ -2394,6 +2422,9 @@ function walkParagraphChildren(node, blocks, tableCtx, tableStack, ctx, depth =
2394
2422
  walkChildren(node, depth);
2395
2423
  return tableCtx;
2396
2424
  }
2425
+ function isInlineTbl(tbl2) {
2426
+ return _optionalChain([findChildByLocalName, 'call', _51 => _51(tbl2, "pos"), 'optionalAccess', _52 => _52.getAttribute, 'call', _53 => _53("treatAsChar")]) === "1";
2427
+ }
2397
2428
  function findDescendant(node, targetTag, depth = 0) {
2398
2429
  if (depth > 5) return null;
2399
2430
  const children = node.childNodes;
@@ -2423,7 +2454,7 @@ function extractDrawTextBlocks(drawTextNode, blocks, ctx) {
2423
2454
  let text = info.text.trim();
2424
2455
  const ph = resolveParaHeading(child, ctx);
2425
2456
  if (text) {
2426
- if (_optionalChain([ph, 'optionalAccess', _49 => _49.prefix])) text = ph.prefix + " " + text;
2457
+ if (_optionalChain([ph, 'optionalAccess', _54 => _54.prefix])) text = ph.prefix + " " + text;
2427
2458
  const block = { type: "paragraph", text, style: _nullishCoalesce(info.style, () => ( void 0)), pageNumber: ctx.sectionNum };
2428
2459
  if (info.href) block.href = info.href;
2429
2460
  if (info.footnote) block.footnoteText = info.footnote;
@@ -2448,13 +2479,13 @@ function extractHyperlinkHref(fieldBegin) {
2448
2479
  let url = (ch.textContent || "").trim();
2449
2480
  if (!url) continue;
2450
2481
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
2451
- const safe = _chunkKKZATKQWcjs.sanitizeHref.call(void 0, url);
2482
+ const safe = _chunkCWP56BRCcjs.sanitizeHref.call(void 0, url);
2452
2483
  if (safe) return safe;
2453
2484
  }
2454
2485
  return void 0;
2455
2486
  }
2456
2487
  function isInDeletedRange(ctx) {
2457
- return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _50 => _50.shared, 'access', _51 => _51.track, 'access', _52 => _52.deleteDepth]), () => ( 0))) > 0;
2488
+ return (_nullishCoalesce(_optionalChain([ctx, 'optionalAccess', _55 => _55.shared, 'access', _56 => _56.track, 'access', _57 => _57.deleteDepth]), () => ( 0))) > 0;
2458
2489
  }
2459
2490
  function extractParagraphInfo(para2, styleMap, ctx) {
2460
2491
  let text = "";
@@ -2475,7 +2506,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2475
2506
  };
2476
2507
  const onFieldEnd = () => {
2477
2508
  const open = openFields.pop();
2478
- if (_optionalChain([open, 'optionalAccess', _53 => _53.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
2509
+ if (_optionalChain([open, 'optionalAccess', _58 => _58.rangeIdx]) !== void 0) linkRanges[open.rangeIdx].end = text.length;
2479
2510
  };
2480
2511
  const handleCtrl = (ctrlEl) => {
2481
2512
  const kids2 = ctrlEl.childNodes;
@@ -2526,7 +2557,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2526
2557
  // 삽입분은 최종본에 포함
2527
2558
  // 숨은 설명 — 본문 혼입 차단
2528
2559
  case "hiddenComment": {
2529
- if (_optionalChain([ctx, 'optionalAccess', _54 => _54.warnings]) && extractTextFromNode(k)) {
2560
+ if (_optionalChain([ctx, 'optionalAccess', _59 => _59.warnings]) && extractTextFromNode(k)) {
2530
2561
  ctx.warnings.push({ page: ctx.sectionNum, message: "\uC228\uC740 \uC124\uBA85 \uD14D\uC2A4\uD2B8 \uC81C\uC678: hiddenComment", code: "HIDDEN_TEXT_FILTERED" });
2531
2562
  }
2532
2563
  break;
@@ -2546,7 +2577,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2546
2577
  break;
2547
2578
  // 미지원 요소 — 텍스트를 가졌으면 무음 손실 대신 경고
2548
2579
  default: {
2549
- if (_optionalChain([ctx, 'optionalAccess', _55 => _55.warnings]) && extractTextFromNode(k)) {
2580
+ if (_optionalChain([ctx, 'optionalAccess', _60 => _60.warnings]) && extractTextFromNode(k)) {
2550
2581
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uBBF8\uC9C0\uC6D0 \uC81C\uC5B4 \uC694\uC18C\uC758 \uD14D\uC2A4\uD2B8 \uC190\uC2E4: ${ktag}`, code: "UNSUPPORTED_ELEMENT" });
2551
2582
  }
2552
2583
  }
@@ -2564,10 +2595,10 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2564
2595
  if (isInDeletedRange(ctx)) {
2565
2596
  if (t && ctx && !ctx.shared.track.warned) {
2566
2597
  ctx.shared.track.warned = true;
2567
- _optionalChain([ctx, 'access', _56 => _56.warnings, 'optionalAccess', _57 => _57.push, 'call', _58 => _58({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
2598
+ _optionalChain([ctx, 'access', _61 => _61.warnings, 'optionalAccess', _62 => _62.push, 'call', _63 => _63({ page: ctx.sectionNum, message: "\uBCC0\uACBD\uCD94\uC801 \uC0AD\uC81C \uD14D\uC2A4\uD2B8 \uCD9C\uB825 \uC81C\uC678", code: "HIDDEN_TEXT_FILTERED" })]);
2568
2599
  }
2569
2600
  } else {
2570
- text += t;
2601
+ text += t.replace(/\x1E/g, "");
2571
2602
  }
2572
2603
  continue;
2573
2604
  }
@@ -2598,14 +2629,17 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2598
2629
  case "hwSpace":
2599
2630
  text += " ";
2600
2631
  break;
2632
+ // 테이블 자체는 walkSection에서 처리 — 글자취급(inline) 표만 경계 마커를 남겨
2633
+ // 표 앞뒤 텍스트를 문서 순서대로 분할 방출할 수 있게 한다 (#49/#50).
2634
+ // float·페이지 앵커 표는 텍스트 흐름 불참(reflow 모델 정합) — 종전대로 텍스트 뒤 방출
2601
2635
  case "tbl":
2636
+ if (isInlineTbl(child)) text += "";
2602
2637
  break;
2603
- // 테이블은 walkSection에서 처리
2604
2638
  // 하이퍼링크
2605
2639
  case "hyperlink": {
2606
2640
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
2607
2641
  if (url) {
2608
- const safe = _chunkKKZATKQWcjs.sanitizeHref.call(void 0, url);
2642
+ const safe = _chunkCWP56BRCcjs.sanitizeHref.call(void 0, url);
2609
2643
  if (safe) href = safe;
2610
2644
  }
2611
2645
  walk(child, depth + 1);
@@ -2695,7 +2729,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2695
2729
  for (const r of closed) {
2696
2730
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
2697
2731
  const anchor = text.slice(r.start, r.end);
2698
- if (!anchor.trim() || /[\n\x1F\[\]]/.test(anchor)) continue;
2732
+ if (!anchor.trim() || /[\n\x1F\x1E\[\]]/.test(anchor)) continue;
2699
2733
  text = text.slice(0, r.start) + `[${anchor}](${r.url})` + text.slice(r.end);
2700
2734
  applied.push([r.start, r.end]);
2701
2735
  }
@@ -2703,10 +2737,18 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2703
2737
  }
2704
2738
  const leaderIdx = text.indexOf("");
2705
2739
  if (leaderIdx >= 0) text = text.substring(0, leaderIdx);
2706
- let cleanText = text.replace(/[ \t]+/g, " ").trim();
2707
- if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(cleanText)) cleanText = "";
2708
- cleanText = cleanText.replace(/그림입니다\.?\s*원본\s*그림의\s*(이름|크기)[^\n]*(\n[^\n]*원본\s*그림의\s*(이름|크기)[^\n]*)*/g, "").trim();
2709
- cleanText = cleanText.replace(/^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|선|직선|곡선|화살표|오각형|육각형|팔각형|별|십자|구름|마름모|도넛|평행사변형|사다리꼴|개체|그리기\s?개체|묶음\s?개체|글상자|표|그림|OLE\s?개체)\s?입니다\.?$/gm, "").trim();
2740
+ const cleanParaText = (raw) => {
2741
+ let t = raw.replace(/[ \t]+/g, " ").trim();
2742
+ if (/^그림입니다\.?\s*원본\s*그림의\s*(이름|크기)/.test(t)) t = "";
2743
+ t = t.replace(/그림입니다\.?\s*원본\s*그림의\s*(이름|크기)[^\n]*(\n[^\n]*원본\s*그림의\s*(이름|크기)[^\n]*)*/g, "").trim();
2744
+ return t.replace(/^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|선|직선|곡선|화살표|오각형|육각형|팔각형|별|십자|구름|마름모|도넛|평행사변형|사다리꼴|개체|그리기\s?개체|묶음\s?개체|글상자|표|그림|OLE\s?개체)\s?입니다\.?$/gm, "").trim();
2745
+ };
2746
+ let segments;
2747
+ if (text.includes("")) {
2748
+ segments = text.split("").map(cleanParaText);
2749
+ text = text.replace(/\x1E/g, "");
2750
+ }
2751
+ const cleanText = cleanParaText(text);
2710
2752
  let style;
2711
2753
  if (styleMap && charPrId) {
2712
2754
  const charProp = styleMap.charProperties.get(charPrId);
@@ -2719,7 +2761,7 @@ function extractParagraphInfo(para2, styleMap, ctx) {
2719
2761
  if (!style.fontSize && !style.bold && !style.italic) style = void 0;
2720
2762
  }
2721
2763
  }
2722
- return { text: cleanText, href, footnote, style };
2764
+ return { text: cleanText, href, footnote, style, segments };
2723
2765
  }
2724
2766
  var KORDOC_CHAR_CODE = "4";
2725
2767
  var KORDOC_PARA_QUOTE = "6";
@@ -2744,13 +2786,13 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2744
2786
  if (tag !== "run" && tag !== "r") return null;
2745
2787
  let text = "";
2746
2788
  const rkids = child.childNodes;
2747
- for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _59 => _59.length]), () => ( 0))); j++) {
2789
+ for (let j = 0; j < (_nullishCoalesce(_optionalChain([rkids, 'optionalAccess', _64 => _64.length]), () => ( 0))); j++) {
2748
2790
  const rc = rkids[j];
2749
2791
  if (rc.nodeType !== 1) continue;
2750
2792
  const rtag = (rc.tagName || rc.localName || "").replace(/^[^:]+:/, "");
2751
2793
  if (rtag === "t") {
2752
2794
  const tkids = rc.childNodes;
2753
- for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _60 => _60.length]), () => ( 0))); k++) {
2795
+ for (let k = 0; k < (_nullishCoalesce(_optionalChain([tkids, 'optionalAccess', _65 => _65.length]), () => ( 0))); k++) {
2754
2796
  const tk = tkids[k];
2755
2797
  if (tk.nodeType === 3) text += tk.textContent || "";
2756
2798
  else if (tk.nodeType === 1) return null;
@@ -2768,9 +2810,9 @@ function extractRunSpans(para2, ctx, mode, requireMixed) {
2768
2810
  const span = { text };
2769
2811
  if (mode !== "foreign" && prId === KORDOC_CHAR_CODE) span.code = true;
2770
2812
  else {
2771
- if (_optionalChain([cp, 'optionalAccess', _61 => _61.bold])) span.bold = true;
2772
- if (_optionalChain([cp, 'optionalAccess', _62 => _62.italic])) span.italic = true;
2773
- if (_optionalChain([cp, 'optionalAccess', _63 => _63.strike])) span.strike = true;
2813
+ if (_optionalChain([cp, 'optionalAccess', _66 => _66.bold])) span.bold = true;
2814
+ if (_optionalChain([cp, 'optionalAccess', _67 => _67.italic])) span.italic = true;
2815
+ if (_optionalChain([cp, 'optionalAccess', _68 => _68.strike])) span.strike = true;
2774
2816
  }
2775
2817
  if (span.bold || span.italic || span.strike || span.code) styled = true;
2776
2818
  spans.push(span);
@@ -2793,12 +2835,12 @@ function gongmunDepthFromIndent(para2, left, ctx) {
2793
2835
  if (!styleMap) return null;
2794
2836
  let unit = 0;
2795
2837
  const kids2 = para2.childNodes;
2796
- for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess', _64 => _64.length]), () => ( 0))); i++) {
2838
+ for (let i = 0; i < (_nullishCoalesce(_optionalChain([kids2, 'optionalAccess', _69 => _69.length]), () => ( 0))); i++) {
2797
2839
  const child = kids2[i];
2798
2840
  if (child.nodeType !== 1) continue;
2799
2841
  const tag = (child.tagName || child.localName || "").replace(/^[^:]+:/, "");
2800
2842
  if (tag !== "run" && tag !== "r") continue;
2801
- const size = _optionalChain([styleMap, 'access', _65 => _65.charProperties, 'access', _66 => _66.get, 'call', _67 => _67(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _68 => _68.fontSize]);
2843
+ const size = _optionalChain([styleMap, 'access', _70 => _70.charProperties, 'access', _71 => _71.get, 'call', _72 => _72(_nullishCoalesce(child.getAttribute("charPrIDRef"), () => ( ""))), 'optionalAccess', _73 => _73.fontSize]);
2802
2844
  if (size) unit = size * 100;
2803
2845
  break;
2804
2846
  }
@@ -2871,7 +2913,7 @@ function decompressStream(data) {
2871
2913
  return _zlib.inflateRawSync.call(void 0, data, opts);
2872
2914
  }
2873
2915
  function parseFileHeader(data) {
2874
- if (data.length < 40) throw new (0, _chunkKKZATKQWcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2916
+ if (data.length < 40) throw new (0, _chunkCWP56BRCcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2875
2917
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2876
2918
  return {
2877
2919
  signature: sig,
@@ -3004,7 +3046,7 @@ function appendParaText(state, data, resolveControl) {
3004
3046
  const resolveAt = (byteOffset, extended) => {
3005
3047
  const ctrlId = data.readUInt32LE(byteOffset);
3006
3048
  const idx = extended ? state.ctrlIdx : -1;
3007
- const replacement = _optionalChain([resolveControl, 'optionalCall', _69 => _69(idx, ctrlId)]);
3049
+ const replacement = _optionalChain([resolveControl, 'optionalCall', _74 => _74(idx, ctrlId)]);
3008
3050
  if (replacement) result += replacement;
3009
3051
  if (extended) state.ctrlIdx++;
3010
3052
  };
@@ -3206,7 +3248,7 @@ function extractHwp5Images(fileIndex, blocks, warnings, sweepUnreferenced) {
3206
3248
  const binDataMap = /* @__PURE__ */ new Map();
3207
3249
  if (fileIndex) {
3208
3250
  for (const entry of fileIndex) {
3209
- if (!_optionalChain([entry, 'optionalAccess', _70 => _70.name]) || !entry.content) continue;
3251
+ if (!_optionalChain([entry, 'optionalAccess', _75 => _75.name]) || !entry.content) continue;
3210
3252
  const match = entry.name.match(BIN_ENTRY_RE);
3211
3253
  if (!match) continue;
3212
3254
  const idx = parseInt(match[1], 16);
@@ -3282,7 +3324,7 @@ function collectImageBlocks2(blocks, out, ownerCell, depth = 0) {
3282
3324
  } else if (block.type === "table" && block.table) {
3283
3325
  for (const row of block.table.cells) {
3284
3326
  for (const cell2 of row) {
3285
- if (_optionalChain([cell2, 'access', _71 => _71.blocks, 'optionalAccess', _72 => _72.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
3327
+ if (_optionalChain([cell2, 'access', _76 => _76.blocks, 'optionalAccess', _77 => _77.length])) collectImageBlocks2(cell2.blocks, out, cell2, depth + 1);
3286
3328
  }
3287
3329
  }
3288
3330
  }
@@ -3320,13 +3362,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
3320
3362
  }
3321
3363
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
3322
3364
  for (const path of allCandidates) {
3323
- if (_chunkKKZATKQWcjs.isPathTraversal.call(void 0, path)) continue;
3365
+ if (_chunkCWP56BRCcjs.isPathTraversal.call(void 0, path)) continue;
3324
3366
  const file = zip.file(path);
3325
3367
  if (!file) continue;
3326
3368
  try {
3327
3369
  const data = await file.async("uint8array");
3328
3370
  decompressed.total += data.length;
3329
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3371
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3330
3372
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
3331
3373
  const mimeType = imageExtToMime(ext);
3332
3374
  imageIndex++;
@@ -3336,10 +3378,10 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
3336
3378
  usedPaths.add(path);
3337
3379
  break;
3338
3380
  } catch (err) {
3339
- if (err instanceof _chunkKKZATKQWcjs.KordocError) throw err;
3381
+ if (err instanceof _chunkCWP56BRCcjs.KordocError) throw err;
3340
3382
  }
3341
3383
  }
3342
- if (!img) _optionalChain([warnings, 'optionalAccess', _73 => _73.push, 'call', _74 => _74({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
3384
+ if (!img) _optionalChain([warnings, 'optionalAccess', _78 => _78.push, 'call', _79 => _79({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
3343
3385
  resolved.set(ref, img);
3344
3386
  }
3345
3387
  if (!img) {
@@ -3356,11 +3398,11 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
3356
3398
  if (sweepUnreferenced) {
3357
3399
  const binEntries = zip.file(/(?:^|\/)BinData\//i);
3358
3400
  for (const file of binEntries) {
3359
- if (file.dir || usedPaths.has(file.name) || _chunkKKZATKQWcjs.isPathTraversal.call(void 0, file.name)) continue;
3401
+ if (file.dir || usedPaths.has(file.name) || _chunkCWP56BRCcjs.isPathTraversal.call(void 0, file.name)) continue;
3360
3402
  try {
3361
3403
  const data = await file.async("uint8array");
3362
3404
  decompressed.total += data.length;
3363
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3405
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3364
3406
  const ext = file.name.includes(".") ? file.name.split(".").pop() || "" : "";
3365
3407
  let mimeType = imageExtToMime(ext);
3366
3408
  if (mimeType === "application/octet-stream") {
@@ -3374,8 +3416,8 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings, sweepUn
3374
3416
  images.push(img);
3375
3417
  blocks.push({ type: "image", text: filename, imageData: { data, mimeType, filename: file.name } });
3376
3418
  } catch (err) {
3377
- if (err instanceof _chunkKKZATKQWcjs.KordocError) throw err;
3378
- _optionalChain([warnings, 'optionalAccess', _75 => _75.push, 'call', _76 => _76({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
3419
+ if (err instanceof _chunkCWP56BRCcjs.KordocError) throw err;
3420
+ _optionalChain([warnings, 'optionalAccess', _80 => _80.push, 'call', _81 => _81({ message: `\uC774\uBBF8\uC9C0 \uCD94\uCD9C \uC2E4\uD328: ${file.name}`, code: "SKIPPED_IMAGE" })]);
3379
3421
  }
3380
3422
  }
3381
3423
  }
@@ -3425,7 +3467,7 @@ function extractFromBrokenZip(buffer) {
3425
3467
  }
3426
3468
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
3427
3469
  const name = new TextDecoder().decode(nameBytes);
3428
- if (_chunkKKZATKQWcjs.isPathTraversal.call(void 0, name)) {
3470
+ if (_chunkCWP56BRCcjs.isPathTraversal.call(void 0, name)) {
3429
3471
  pos = fileStart + compSize;
3430
3472
  continue;
3431
3473
  }
@@ -3443,16 +3485,16 @@ function extractFromBrokenZip(buffer) {
3443
3485
  continue;
3444
3486
  }
3445
3487
  totalDecompressed += content.length * 2;
3446
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
3488
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
3447
3489
  sectionNum++;
3448
3490
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
3449
3491
  } catch (e16) {
3450
3492
  continue;
3451
3493
  }
3452
3494
  }
3453
- if (blocks.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3495
+ if (blocks.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3454
3496
  applyPageText(blocks, shared);
3455
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
3497
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
3456
3498
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
3457
3499
  }
3458
3500
  async function readKordocLayout(zip) {
@@ -3461,7 +3503,7 @@ async function readKordocLayout(zip) {
3461
3503
  try {
3462
3504
  const xml = await file.async("text");
3463
3505
  if (!/<opf:meta\b[^>]*name="generator"[^>]*content="kordoc"/.test(xml)) return null;
3464
- return _nullishCoalesce(_optionalChain([xml, 'access', _77 => _77.match, 'call', _78 => _78(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _79 => _79[1]]), () => ( null));
3506
+ return _nullishCoalesce(_optionalChain([xml, 'access', _82 => _82.match, 'call', _83 => _83(/<opf:meta\b[^>]*name="kordoc-layout"[^>]*content="([^"]*)"/), 'optionalAccess', _84 => _84[1]]), () => ( null));
3465
3507
  } catch (e17) {
3466
3508
  return null;
3467
3509
  }
@@ -3477,18 +3519,18 @@ async function resolveSectionPaths(zip) {
3477
3519
  if (paths.length > 0) return paths;
3478
3520
  }
3479
3521
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
3480
- return sectionFiles.map((f) => f.name).sort(_chunkKKZATKQWcjs.compareSectionPaths);
3522
+ return sectionFiles.map((f) => f.name).sort(_chunkCWP56BRCcjs.compareSectionPaths);
3481
3523
  }
3482
3524
  function parseSectionPathsFromManifest(xml) {
3483
3525
  const parser = createXmlParser();
3484
- const doc = parser.parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, xml), "text/xml");
3526
+ const doc = parser.parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, xml), "text/xml");
3485
3527
  const items = doc.getElementsByTagName("opf:item");
3486
3528
  const spine = doc.getElementsByTagName("opf:itemref");
3487
3529
  const idToHref = /* @__PURE__ */ new Map();
3488
3530
  for (let i = 0; i < items.length; i++) {
3489
3531
  const item = items[i];
3490
3532
  const id = item.getAttribute("id") || "";
3491
- const href = _chunkKKZATKQWcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
3533
+ const href = _chunkCWP56BRCcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
3492
3534
  if (id && href) idToHref.set(id, href);
3493
3535
  }
3494
3536
  if (spine.length > 0) {
@@ -3499,7 +3541,7 @@ function parseSectionPathsFromManifest(xml) {
3499
3541
  }
3500
3542
  if (ordered.length > 0) return ordered;
3501
3543
  }
3502
- return Array.from(idToHref.values()).sort(_chunkKKZATKQWcjs.compareSectionPaths);
3544
+ return Array.from(idToHref.values()).sort(_chunkCWP56BRCcjs.compareSectionPaths);
3503
3545
  }
3504
3546
 
3505
3547
  // src/hwpx/metadata.ts
@@ -3512,7 +3554,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
3512
3554
  const xml = await file.async("text");
3513
3555
  if (decompressed) {
3514
3556
  decompressed.total += xml.length * 2;
3515
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3557
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3516
3558
  }
3517
3559
  parseDublinCoreMetadata(xml, metadata);
3518
3560
  if (metadata.title || metadata.author) return;
@@ -3522,13 +3564,13 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
3522
3564
  }
3523
3565
  function parseDublinCoreMetadata(xml, metadata) {
3524
3566
  const parser = createXmlParser();
3525
- const doc = parser.parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, xml), "text/xml");
3567
+ const doc = parser.parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, xml), "text/xml");
3526
3568
  if (!doc.documentElement) return;
3527
3569
  const getText = (tagNames) => {
3528
3570
  for (const tag of tagNames) {
3529
3571
  const els = doc.getElementsByTagName(tag);
3530
3572
  if (els.length > 0) {
3531
- const text = _optionalChain([els, 'access', _80 => _80[0], 'access', _81 => _81.textContent, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]);
3573
+ const text = _optionalChain([els, 'access', _85 => _85[0], 'access', _86 => _86.textContent, 'optionalAccess', _87 => _87.trim, 'call', _88 => _88()]);
3532
3574
  if (text) return text;
3533
3575
  }
3534
3576
  }
@@ -3547,7 +3589,7 @@ function parseDublinCoreMetadata(xml, metadata) {
3547
3589
 
3548
3590
  // src/hwpx/parser.ts
3549
3591
  async function parseHwpxDocument(buffer, options) {
3550
- _chunkKKZATKQWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
3592
+ _chunkCWP56BRCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
3551
3593
  let zip;
3552
3594
  try {
3553
3595
  zip = await _jszip2.default.loadAsync(buffer);
@@ -3556,19 +3598,19 @@ async function parseHwpxDocument(buffer, options) {
3556
3598
  }
3557
3599
  const actualEntryCount = Object.keys(zip.files).length;
3558
3600
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
3559
- throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3601
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3560
3602
  }
3561
3603
  const manifestFile = zip.file("META-INF/manifest.xml");
3562
3604
  if (manifestFile) {
3563
3605
  const manifestXml = await manifestFile.async("text");
3564
3606
  if (isEncryptedHwpx(manifestXml)) {
3565
- if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _84 => _84.filePath])) {
3607
+ if (isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _89 => _89.filePath])) {
3566
3608
  const { pages, pageCount, warnings: warnings2 } = extractTextViaCom(options.filePath);
3567
3609
  if (pages.some((p) => p && p.trim().length > 0)) {
3568
3610
  return comResultToParseResult(pages, pageCount, warnings2);
3569
3611
  }
3570
3612
  }
3571
- throw new (0, _chunkKKZATKQWcjs.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.");
3613
+ throw new (0, _chunkCWP56BRCcjs.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.");
3572
3614
  }
3573
3615
  }
3574
3616
  const decompressed = { total: 0 };
@@ -3577,14 +3619,14 @@ async function parseHwpxDocument(buffer, options) {
3577
3619
  const styleMap = await extractHwpxStyles(zip, decompressed);
3578
3620
  const warnings = [];
3579
3621
  const sectionPaths = await resolveSectionPaths(zip);
3580
- if (sectionPaths.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3622
+ if (sectionPaths.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3581
3623
  metadata.pageCount = sectionPaths.length;
3582
- const pageFilter = _optionalChain([options, 'optionalAccess', _85 => _85.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
3624
+ const pageFilter = _optionalChain([options, 'optionalAccess', _90 => _90.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
3583
3625
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
3584
3626
  const blocks = [];
3585
3627
  const shared = createSectionShared();
3586
3628
  shared.kordocLayout = await readKordocLayout(zip);
3587
- shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _86 => _86.keepTrailingEmptyCols]);
3629
+ shared.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _91 => _91.keepTrailingEmptyCols]);
3588
3630
  let parsedSections = 0;
3589
3631
  for (let si = 0; si < sectionPaths.length; si++) {
3590
3632
  if (pageFilter && !pageFilter.has(si + 1)) continue;
@@ -3596,7 +3638,7 @@ async function parseHwpxDocument(buffer, options) {
3596
3638
  if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new ZipBombError("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
3597
3639
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
3598
3640
  parsedSections++;
3599
- _optionalChain([options, 'optionalAccess', _87 => _87.onProgress, 'optionalCall', _88 => _88(parsedSections, totalTarget)]);
3641
+ _optionalChain([options, 'optionalAccess', _92 => _92.onProgress, 'optionalCall', _93 => _93(parsedSections, totalTarget)]);
3600
3642
  } catch (secErr) {
3601
3643
  if (secErr instanceof ZipBombError) throw secErr;
3602
3644
  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" });
@@ -3606,7 +3648,7 @@ async function parseHwpxDocument(buffer, options) {
3606
3648
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings, !pageFilter);
3607
3649
  detectHwpxHeadings(blocks, styleMap);
3608
3650
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3609
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
3651
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
3610
3652
  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 };
3611
3653
  }
3612
3654
 
@@ -4785,22 +4827,22 @@ function parseHwp5Document(buffer, options) {
4785
4827
  lenientCfb = parseLenientCfb(buffer);
4786
4828
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
4787
4829
  } catch (e22) {
4788
- throw new (0, _chunkKKZATKQWcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4830
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
4789
4831
  }
4790
4832
  }
4791
4833
  const findStream = (path) => {
4792
4834
  if (cfb) {
4793
4835
  const entry = CFB.find(cfb, path);
4794
- return _optionalChain([entry, 'optionalAccess', _89 => _89.content]) ? Buffer.from(entry.content) : null;
4836
+ return _optionalChain([entry, 'optionalAccess', _94 => _94.content]) ? Buffer.from(entry.content) : null;
4795
4837
  }
4796
4838
  return lenientCfb.findStream(path);
4797
4839
  };
4798
4840
  const headerData = findStream("/FileHeader");
4799
- if (!headerData) throw new (0, _chunkKKZATKQWcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4841
+ if (!headerData) throw new (0, _chunkCWP56BRCcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
4800
4842
  const header = parseFileHeader(headerData);
4801
- if (header.signature !== "HWP Document File") throw new (0, _chunkKKZATKQWcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4802
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4803
- if (header.flags & FLAG_DRM) throw new (0, _chunkKKZATKQWcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4843
+ if (header.signature !== "HWP Document File") throw new (0, _chunkCWP56BRCcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
4844
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4845
+ if (header.flags & FLAG_DRM) throw new (0, _chunkCWP56BRCcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
4804
4846
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
4805
4847
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
4806
4848
  const metadata = {
@@ -4809,13 +4851,13 @@ function parseHwp5Document(buffer, options) {
4809
4851
  if (cfb) extractHwp5Metadata(cfb, metadata);
4810
4852
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
4811
4853
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
4812
- if (sections.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4854
+ if (sections.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
4813
4855
  metadata.pageCount = sections.length;
4814
- const pageFilter = _optionalChain([options, 'optionalAccess', _90 => _90.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4856
+ const pageFilter = _optionalChain([options, 'optionalAccess', _95 => _95.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
4815
4857
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
4816
4858
  const bodyBlocks = [];
4817
4859
  const doc = createHwp5DocState();
4818
- doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _91 => _91.keepTrailingEmptyCols]);
4860
+ doc.keepTrailingEmptyCols = _optionalChain([options, 'optionalAccess', _96 => _96.keepTrailingEmptyCols]);
4819
4861
  let totalDecompressed = 0;
4820
4862
  let parsedSections = 0;
4821
4863
  for (let si = 0; si < sections.length; si++) {
@@ -4824,22 +4866,22 @@ function parseHwp5Document(buffer, options) {
4824
4866
  const sectionData = sections[si];
4825
4867
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
4826
4868
  totalDecompressed += data.length;
4827
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4869
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
4828
4870
  const records = readRecords(data);
4829
4871
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
4830
4872
  bodyBlocks.push(...sectionBlocks);
4831
4873
  parsedSections++;
4832
- _optionalChain([options, 'optionalAccess', _92 => _92.onProgress, 'optionalCall', _93 => _93(parsedSections, totalTarget)]);
4874
+ _optionalChain([options, 'optionalAccess', _97 => _97.onProgress, 'optionalCall', _98 => _98(parsedSections, totalTarget)]);
4833
4875
  } catch (secErr) {
4834
- if (secErr instanceof _chunkKKZATKQWcjs.KordocError) throw secErr;
4876
+ if (secErr instanceof _chunkCWP56BRCcjs.KordocError) throw secErr;
4835
4877
  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" });
4836
4878
  }
4837
4879
  }
4838
4880
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
4839
4881
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings, !pageFilter) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings, !pageFilter);
4840
- let flatBlocks = _chunkWMU2KJHFcjs.flattenLayoutTables.call(void 0, blocks);
4841
- if (_optionalChain([options, 'optionalAccess', _94 => _94.dedupeRunningHeaders])) {
4842
- const deduped = _chunkWMU2KJHFcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4882
+ let flatBlocks = _chunk5AXGFJQOcjs.flattenLayoutTables.call(void 0, blocks);
4883
+ if (_optionalChain([options, 'optionalAccess', _99 => _99.dedupeRunningHeaders])) {
4884
+ const deduped = _chunk5AXGFJQOcjs.dedupeRunningHeaders.call(void 0, flatBlocks);
4843
4885
  const removed = flatBlocks.length - deduped.length;
4844
4886
  if (removed > 0) warnings.push({ message: `\uBC18\uBCF5 \uB7EC\uB2DD \uD5E4\uB354 ${removed}\uAC1C \uC81C\uAC70`, code: "HIDDEN_TEXT_FILTERED" });
4845
4887
  flatBlocks = deduped;
@@ -4848,10 +4890,10 @@ function parseHwp5Document(buffer, options) {
4848
4890
  detectHwp5Headings(flatBlocks, docInfo);
4849
4891
  }
4850
4892
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
4851
- let markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, flatBlocks);
4852
- if (_optionalChain([options, 'optionalAccess', _95 => _95.inlineImages]) && images.length > 0) {
4893
+ let markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, flatBlocks);
4894
+ if (_optionalChain([options, 'optionalAccess', _100 => _100.inlineImages]) && images.length > 0) {
4853
4895
  try {
4854
- markdown = _chunkWMU2KJHFcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
4896
+ markdown = _chunk5AXGFJQOcjs.inlineImagesIntoMarkdown.call(void 0, markdown, images, { compress: true });
4855
4897
  } catch (inlineErr) {
4856
4898
  warnings.push({ message: `\uC774\uBBF8\uC9C0 \uC778\uB77C\uC778 \uC2E4\uD328 \u2014 \uC6D0\uBCF8 \uD30C\uC77C \uCC38\uC870\uB85C \uD3F4\uBC31: ${inlineErr instanceof Error ? inlineErr.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`, code: "SKIPPED_IMAGE" });
4857
4899
  }
@@ -4861,7 +4903,7 @@ function parseHwp5Document(buffer, options) {
4861
4903
  function parseDocInfoStream(cfb, compressed) {
4862
4904
  try {
4863
4905
  const entry = CFB.find(cfb, "/DocInfo");
4864
- if (!_optionalChain([entry, 'optionalAccess', _96 => _96.content])) return null;
4906
+ if (!_optionalChain([entry, 'optionalAccess', _101 => _101.content])) return null;
4865
4907
  const data = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
4866
4908
  const records = readRecords(data);
4867
4909
  return parseDocInfo(records);
@@ -4882,7 +4924,7 @@ function detectHwp5Headings(blocks, docInfo) {
4882
4924
  let baseFontSize = 0;
4883
4925
  const sizeFreq = /* @__PURE__ */ new Map();
4884
4926
  for (const b of blocks) {
4885
- if (_optionalChain([b, 'access', _97 => _97.style, 'optionalAccess', _98 => _98.fontSize]) && b.text) {
4927
+ if (_optionalChain([b, 'access', _102 => _102.style, 'optionalAccess', _103 => _103.fontSize]) && b.text) {
4886
4928
  sizeFreq.set(b.style.fontSize, (sizeFreq.get(b.style.fontSize) || 0) + b.text.length);
4887
4929
  }
4888
4930
  }
@@ -4898,7 +4940,7 @@ function detectHwp5Headings(blocks, docInfo) {
4898
4940
  const name = (style.nameKo || style.name).toLowerCase();
4899
4941
  if (name.includes("\uBC14\uD0D5") || name.includes("\uBCF8\uBB38") || name === "normal" || name === "body") {
4900
4942
  const cs = docInfo.charShapes[style.charShapeId];
4901
- if (_optionalChain([cs, 'optionalAccess', _99 => _99.fontSize]) > 0) {
4943
+ if (_optionalChain([cs, 'optionalAccess', _104 => _104.fontSize]) > 0) {
4902
4944
  baseFontSize = cs.fontSize / 10;
4903
4945
  break;
4904
4946
  }
@@ -4913,11 +4955,11 @@ function detectHwp5Headings(blocks, docInfo) {
4913
4955
  if (text.length === 0 || text.length > 200) continue;
4914
4956
  if (/^\d+$/.test(text)) continue;
4915
4957
  let level = 0;
4916
- if (_optionalChain([block, 'access', _100 => _100.style, 'optionalAccess', _101 => _101.fontSize]) && baseFontSize > 0) {
4958
+ if (_optionalChain([block, 'access', _105 => _105.style, 'optionalAccess', _106 => _106.fontSize]) && baseFontSize > 0) {
4917
4959
  const ratio = block.style.fontSize / baseFontSize;
4918
- if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H1) level = 1;
4919
- else if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H2) level = 2;
4920
- else if (ratio >= _chunkKKZATKQWcjs.HEADING_RATIO_H3) level = 3;
4960
+ if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H1) level = 1;
4961
+ else if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H2) level = 2;
4962
+ else if (ratio >= _chunkCWP56BRCcjs.HEADING_RATIO_H3) level = 3;
4921
4963
  }
4922
4964
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
4923
4965
  if (level === 0) level = 2;
@@ -4933,7 +4975,7 @@ function detectHwp5Headings(blocks, docInfo) {
4933
4975
  function extractHwp5Metadata(cfb, metadata) {
4934
4976
  try {
4935
4977
  const summaryEntry = CFB.find(cfb, "/HwpSummaryInformation") || CFB.find(cfb, "/SummaryInformation");
4936
- if (!_optionalChain([summaryEntry, 'optionalAccess', _102 => _102.content])) return;
4978
+ if (!_optionalChain([summaryEntry, 'optionalAccess', _107 => _107.content])) return;
4937
4979
  const data = Buffer.from(summaryEntry.content);
4938
4980
  if (data.length < 48) return;
4939
4981
  const numSets = data.readUInt32LE(24);
@@ -4966,7 +5008,7 @@ function findViewTextSections(cfb, compressed) {
4966
5008
  const sections = [];
4967
5009
  for (let i = 0; i < MAX_SECTIONS; i++) {
4968
5010
  const entry = CFB.find(cfb, `/ViewText/Section${i}`);
4969
- if (!_optionalChain([entry, 'optionalAccess', _103 => _103.content])) break;
5011
+ if (!_optionalChain([entry, 'optionalAccess', _108 => _108.content])) break;
4970
5012
  try {
4971
5013
  const decrypted = decryptViewText(Buffer.from(entry.content), compressed);
4972
5014
  sections.push({ idx: i, content: decrypted });
@@ -4980,13 +5022,13 @@ function findSections(cfb) {
4980
5022
  const sections = [];
4981
5023
  for (let i = 0; i < MAX_SECTIONS; i++) {
4982
5024
  const entry = CFB.find(cfb, `/BodyText/Section${i}`);
4983
- if (!_optionalChain([entry, 'optionalAccess', _104 => _104.content])) break;
5025
+ if (!_optionalChain([entry, 'optionalAccess', _109 => _109.content])) break;
4984
5026
  sections.push({ idx: i, content: Buffer.from(entry.content) });
4985
5027
  }
4986
5028
  if (sections.length === 0 && cfb.FileIndex) {
4987
5029
  for (const entry of cfb.FileIndex) {
4988
5030
  if (sections.length >= MAX_SECTIONS) break;
4989
- if (_optionalChain([entry, 'access', _105 => _105.name, 'optionalAccess', _106 => _106.startsWith, 'call', _107 => _107("Section")]) && entry.content) {
5031
+ if (_optionalChain([entry, 'access', _110 => _110.name, 'optionalAccess', _111 => _111.startsWith, 'call', _112 => _112("Section")]) && entry.content) {
4990
5032
  const idx = parseInt(entry.name.replace("Section", ""), 10) || 0;
4991
5033
  sections.push({ idx, content: Buffer.from(entry.content) });
4992
5034
  }
@@ -5002,7 +5044,7 @@ function findSectionsLenient(lcfb, compressed) {
5002
5044
  if (!raw) break;
5003
5045
  const content = compressed ? decompressStream(raw) : raw;
5004
5046
  totalDecompressed += content.length;
5005
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5047
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5006
5048
  sections.push({ idx: i, content });
5007
5049
  }
5008
5050
  if (sections.length === 0) {
@@ -5014,7 +5056,7 @@ function findSectionsLenient(lcfb, compressed) {
5014
5056
  if (raw) {
5015
5057
  const content = compressed ? decompressStream(raw) : raw;
5016
5058
  totalDecompressed += content.length;
5017
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5059
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5018
5060
  sections.push({ idx, content });
5019
5061
  }
5020
5062
  }
@@ -5031,7 +5073,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
5031
5073
  try {
5032
5074
  const content = decryptViewText(raw, compressed);
5033
5075
  totalDecompressed += content.length;
5034
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5076
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
5035
5077
  sections.push({ idx: i, content });
5036
5078
  } catch (e27) {
5037
5079
  break;
@@ -5132,9 +5174,9 @@ function parseParagraph(records, start, end, ctx) {
5132
5174
  const applied = [];
5133
5175
  for (const r of ranges) {
5134
5176
  const ctrl = ctrls[r.ctrlIdx];
5135
- if (!_optionalChain([ctrl, 'optionalAccess', _108 => _108.href]) || r.end <= r.start) continue;
5177
+ if (!_optionalChain([ctrl, 'optionalAccess', _113 => _113.href]) || r.end <= r.start) continue;
5136
5178
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
5137
- const href = _chunkKKZATKQWcjs.sanitizeHref.call(void 0, ctrl.href);
5179
+ const href = _chunkCWP56BRCcjs.sanitizeHref.call(void 0, ctrl.href);
5138
5180
  if (!href) continue;
5139
5181
  const anchor = text.slice(r.start, r.end);
5140
5182
  if (!anchor.trim()) continue;
@@ -5152,7 +5194,7 @@ function parseParagraph(records, start, end, ctx) {
5152
5194
  }
5153
5195
  if (ps.headType === 1 || ps.headType === 2) {
5154
5196
  const nid = ps.numberingId || (ps.headType === 1 ? ctx.doc.outlineNumberingId : 0);
5155
- const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _109 => _109.docInfo, 'optionalAccess', _110 => _110.numberings, 'access', _111 => _111[nid - 1]]) : void 0;
5197
+ const numbering = nid >= 1 ? _optionalChain([ctx, 'access', _114 => _114.docInfo, 'optionalAccess', _115 => _115.numberings, 'access', _116 => _116[nid - 1]]) : void 0;
5156
5198
  if (numbering) {
5157
5199
  const counters = ctx.doc.numbering.advance(nid, ps.paraLevel);
5158
5200
  const fmt = numbering.levelFormats[Math.min(ps.paraLevel, 6)];
@@ -5162,7 +5204,7 @@ function parseParagraph(records, start, end, ctx) {
5162
5204
  }
5163
5205
  }
5164
5206
  } else if (ps.headType === 3) {
5165
- const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _112 => _112.docInfo, 'optionalAccess', _113 => _113.bullets, 'access', _114 => _114[ps.numberingId - 1]]) : void 0;
5207
+ const bullet = ps.numberingId >= 1 ? _optionalChain([ctx, 'access', _117 => _117.docInfo, 'optionalAccess', _118 => _118.bullets, 'access', _119 => _119[ps.numberingId - 1]]) : void 0;
5166
5208
  if (bullet && bullet.char !== "\uFFFF") headMarker = bullet.char;
5167
5209
  }
5168
5210
  }
@@ -5370,8 +5412,8 @@ function parseTableControl(ctrl, records, ctx) {
5370
5412
  let tableIdx = -1;
5371
5413
  for (let i2 = childStart; i2 < childEnd; i2++) {
5372
5414
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
5373
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkWMU2KJHFcjs.MAX_ROWS);
5374
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkWMU2KJHFcjs.MAX_COLS);
5415
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunk5AXGFJQOcjs.MAX_ROWS);
5416
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunk5AXGFJQOcjs.MAX_COLS);
5375
5417
  tableIdx = i2;
5376
5418
  break;
5377
5419
  }
@@ -5411,7 +5453,7 @@ function parseTableControl(ctrl, records, ctx) {
5411
5453
  const cellRows2 = arrangeCells(rows, cols, cells);
5412
5454
  const irCells = cellRows2.map((row) => row.map((c) => {
5413
5455
  const ir = { text: c.text.trim(), colSpan: c.colSpan, rowSpan: c.rowSpan };
5414
- if (_optionalChain([c, 'access', _115 => _115.blocks, 'optionalAccess', _116 => _116.length])) ir.blocks = c.blocks;
5456
+ if (_optionalChain([c, 'access', _120 => _120.blocks, 'optionalAccess', _121 => _121.length])) ir.blocks = c.blocks;
5415
5457
  if (c.isHeader) ir.isHeader = true;
5416
5458
  return ir;
5417
5459
  }));
@@ -5420,7 +5462,7 @@ function parseTableControl(ctrl, records, ctx) {
5420
5462
  return table3;
5421
5463
  }
5422
5464
  const cellRows = arrangeCells(rows, cols, cells);
5423
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
5465
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: ctx.doc.keepTrailingEmptyCols });
5424
5466
  if (caption && table2.rows > 0) table2.caption = caption;
5425
5467
  return table2.rows > 0 ? table2 : null;
5426
5468
  }
@@ -5437,8 +5479,8 @@ function parseCell(records, lhIdx, end, ctx) {
5437
5479
  rowAddr = rec.data.readUInt16LE(10);
5438
5480
  const cs = rec.data.readUInt16LE(12);
5439
5481
  const rs = rec.data.readUInt16LE(14);
5440
- if (cs > 0) colSpan = Math.min(cs, _chunkWMU2KJHFcjs.MAX_COLS);
5441
- if (rs > 0) rowSpan = Math.min(rs, _chunkWMU2KJHFcjs.MAX_ROWS);
5482
+ if (cs > 0) colSpan = Math.min(cs, _chunk5AXGFJQOcjs.MAX_COLS);
5483
+ if (rs > 0) rowSpan = Math.min(rs, _chunk5AXGFJQOcjs.MAX_ROWS);
5442
5484
  }
5443
5485
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
5444
5486
  const parts = [];
@@ -5448,7 +5490,7 @@ function parseCell(records, lhIdx, end, ctx) {
5448
5490
  parts.push(`![image](hwp5bin:${b.text})`);
5449
5491
  hasStructure = true;
5450
5492
  } else if (b.type === "table" && b.table) {
5451
- const flat = _chunkWMU2KJHFcjs.convertTableToText.call(void 0, b.table.cells);
5493
+ const flat = _chunk5AXGFJQOcjs.convertTableToText.call(void 0, b.table.cells);
5452
5494
  if (flat) parts.push(flat);
5453
5495
  hasStructure = true;
5454
5496
  } else if (b.text) {
@@ -5545,8 +5587,8 @@ function pictureToImageBlock(data, ctx) {
5545
5587
  if (data.length < 73) return null;
5546
5588
  const binDataId = data.readUInt16LE(71);
5547
5589
  if (binDataId === 0) return null;
5548
- const item = _optionalChain([ctx, 'access', _117 => _117.docInfo, 'optionalAccess', _118 => _118.binData, 'access', _119 => _119[binDataId - 1]]);
5549
- if (_optionalChain([item, 'optionalAccess', _120 => _120.kind]) === "link") {
5590
+ const item = _optionalChain([ctx, 'access', _122 => _122.docInfo, 'optionalAccess', _123 => _123.binData, 'access', _124 => _124[binDataId - 1]]);
5591
+ if (_optionalChain([item, 'optionalAccess', _125 => _125.kind]) === "link") {
5550
5592
  ctx.warnings.push({ page: ctx.sectionNum, message: `\uC678\uBD80 \uC5F0\uACB0 \uC774\uBBF8\uC9C0 (binDataId ${binDataId})`, code: "SKIPPED_IMAGE" });
5551
5593
  return null;
5552
5594
  }
@@ -17700,7 +17742,7 @@ function parseHwp3Document(buffer, _options) {
17700
17742
  try {
17701
17743
  body = _zlib.inflateRawSync.call(void 0, tail, { maxOutputLength: MAX_DECOMPRESS_SIZE3 });
17702
17744
  } catch (err) {
17703
- if (_optionalChain([err, 'optionalAccess', _121 => _121.code]) === "ERR_BUFFER_TOO_LARGE") {
17745
+ if (_optionalChain([err, 'optionalAccess', _126 => _126.code]) === "ERR_BUFFER_TOO_LARGE") {
17704
17746
  throw new Error(`HWP3 \uC555\uCD95 \uD574\uC81C \uACB0\uACFC\uAC00 \uCD5C\uB300 \uD5C8\uC6A9 \uD06C\uAE30(${MAX_DECOMPRESS_SIZE3 / 1024 / 1024}MB)\uB97C \uCD08\uACFC\uD588\uC2B5\uB2C8\uB2E4`);
17705
17747
  }
17706
17748
  const msg2 = err instanceof Error ? err.message : String(err);
@@ -17935,15 +17977,15 @@ function getElements(parent, tagName) {
17935
17977
  const result = [];
17936
17978
  for (let i = 0; i < nodes.length; i++) result.push(nodes[i]);
17937
17979
  if (result.length > 0) return result;
17938
- const nsNodes = _optionalChain([parent, 'access', _122 => _122.getElementsByTagNameNS, 'optionalCall', _123 => _123("*", tagName)]);
17980
+ const nsNodes = _optionalChain([parent, 'access', _127 => _127.getElementsByTagNameNS, 'optionalCall', _128 => _128("*", tagName)]);
17939
17981
  if (nsNodes) for (let i = 0; i < nsNodes.length; i++) result.push(nsNodes[i]);
17940
17982
  return result;
17941
17983
  }
17942
17984
  function getTextContent(el) {
17943
- return _nullishCoalesce(_optionalChain([el, 'access', _124 => _124.textContent, 'optionalAccess', _125 => _125.trim, 'call', _126 => _126()]), () => ( ""));
17985
+ return _nullishCoalesce(_optionalChain([el, 'access', _129 => _129.textContent, 'optionalAccess', _130 => _130.trim, 'call', _131 => _131()]), () => ( ""));
17944
17986
  }
17945
17987
  function parseXml(text) {
17946
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, text), "text/xml");
17988
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, text), "text/xml");
17947
17989
  }
17948
17990
  function collectRichText(root) {
17949
17991
  let out = "";
@@ -17952,7 +17994,7 @@ function collectRichText(root) {
17952
17994
  for (let i = 0; i < children.length; i++) {
17953
17995
  if (children[i].nodeType !== 1) continue;
17954
17996
  const el = children[i];
17955
- const local = el.localName || _optionalChain([el, 'access', _127 => _127.tagName, 'optionalAccess', _128 => _128.replace, 'call', _129 => _129(/^[^:]+:/, "")]) || "";
17997
+ const local = el.localName || _optionalChain([el, 'access', _132 => _132.tagName, 'optionalAccess', _133 => _133.replace, 'call', _134 => _134(/^[^:]+:/, "")]) || "";
17956
17998
  if (local === "rPh") continue;
17957
17999
  if (local === "t") out += _nullishCoalesce(el.textContent, () => ( ""));
17958
18000
  else walk(el);
@@ -18171,14 +18213,14 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
18171
18213
  const merge = mergeMap.get(key);
18172
18214
  row.push({
18173
18215
  text,
18174
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _130 => _130.colSpan]), () => ( 1)),
18175
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _131 => _131.rowSpan]), () => ( 1))
18216
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _135 => _135.colSpan]), () => ( 1)),
18217
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _136 => _136.rowSpan]), () => ( 1))
18176
18218
  });
18177
18219
  }
18178
18220
  cellRows.push(row);
18179
18221
  }
18180
18222
  if (cellRows.length > 0) {
18181
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18223
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18182
18224
  if (table2.rows > 0) {
18183
18225
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
18184
18226
  }
@@ -18186,12 +18228,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex, keep
18186
18228
  return blocks;
18187
18229
  }
18188
18230
  async function parseXlsxDocument(buffer, options) {
18189
- _chunkKKZATKQWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18231
+ _chunkCWP56BRCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18190
18232
  const zip = await _jszip2.default.loadAsync(buffer);
18191
18233
  const warnings = [];
18192
18234
  const workbookFile = zip.file("xl/workbook.xml");
18193
18235
  if (!workbookFile) {
18194
- throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18236
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18195
18237
  }
18196
18238
  let sharedStrings = [];
18197
18239
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -18200,7 +18242,7 @@ async function parseXlsxDocument(buffer, options) {
18200
18242
  }
18201
18243
  const { sheets, date1904 } = parseWorkbook(await workbookFile.async("text"));
18202
18244
  if (sheets.length === 0) {
18203
- throw new (0, _chunkKKZATKQWcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
18245
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
18204
18246
  }
18205
18247
  let dateXfs = /* @__PURE__ */ new Map();
18206
18248
  const stylesFile = zip.file("xl/styles.xml");
@@ -18216,7 +18258,7 @@ async function parseXlsxDocument(buffer, options) {
18216
18258
  relsMap = parseRels(await relsFile.async("text"));
18217
18259
  }
18218
18260
  let pageFilter = null;
18219
- if (_optionalChain([options, 'optionalAccess', _132 => _132.pages])) {
18261
+ if (_optionalChain([options, 'optionalAccess', _137 => _137.pages])) {
18220
18262
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
18221
18263
  pageFilter = parsePageRange2(options.pages, sheets.length);
18222
18264
  }
@@ -18225,7 +18267,7 @@ async function parseXlsxDocument(buffer, options) {
18225
18267
  for (let i = 0; i < processedSheets; i++) {
18226
18268
  if (pageFilter && !pageFilter.has(i + 1)) continue;
18227
18269
  const sheet = sheets[i];
18228
- _optionalChain([options, 'optionalAccess', _133 => _133.onProgress, 'optionalCall', _134 => _134(i + 1, processedSheets)]);
18270
+ _optionalChain([options, 'optionalAccess', _138 => _138.onProgress, 'optionalCall', _139 => _139(i + 1, processedSheets)]);
18229
18271
  let sheetPath = relsMap.get(sheet.rId);
18230
18272
  if (sheetPath) {
18231
18273
  if (!sheetPath.startsWith("xl/") && !sheetPath.startsWith("/")) {
@@ -18248,7 +18290,7 @@ async function parseXlsxDocument(buffer, options) {
18248
18290
  try {
18249
18291
  const sheetXml = await sheetFile.async("text");
18250
18292
  const { grid, merges, maxRow, maxCol } = parseWorksheet(sheetXml, sharedStrings, dateXfs, date1904);
18251
- const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _135 => _135.keepTrailingEmptyCols]));
18293
+ const sheetBlocks = sheetToBlocks(sheet.name, grid, merges, maxRow, maxCol, i, _optionalChain([options, 'optionalAccess', _140 => _140.keepTrailingEmptyCols]));
18252
18294
  blocks.push(...sheetBlocks);
18253
18295
  } catch (err) {
18254
18296
  warnings.push({
@@ -18280,7 +18322,7 @@ async function parseXlsxDocument(buffer, options) {
18280
18322
  } catch (e29) {
18281
18323
  }
18282
18324
  }
18283
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
18325
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
18284
18326
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
18285
18327
  }
18286
18328
 
@@ -18731,11 +18773,11 @@ function processGlobals(records) {
18731
18773
  const xfFmtIds = [];
18732
18774
  const firstBof = records[0];
18733
18775
  if (!firstBof || firstBof.opcode !== OP_BOF) {
18734
- throw new (0, _chunkKKZATKQWcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18776
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
18735
18777
  }
18736
18778
  const bof = decodeBof(firstBof.data);
18737
18779
  if (!bof || bof.dt !== DT_GLOBALS) {
18738
- throw new (0, _chunkKKZATKQWcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18780
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
18739
18781
  }
18740
18782
  let i = 1;
18741
18783
  while (i < records.length) {
@@ -18863,14 +18905,14 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex, keepAnchoredEmptyCols) {
18863
18905
  const merge = mergeMap.get(key);
18864
18906
  row.push({
18865
18907
  text: grid[r][c],
18866
- colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _136 => _136.colSpan]), () => ( 1)),
18867
- rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _137 => _137.rowSpan]), () => ( 1))
18908
+ colSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _141 => _141.colSpan]), () => ( 1)),
18909
+ rowSpan: _nullishCoalesce(_optionalChain([merge, 'optionalAccess', _142 => _142.rowSpan]), () => ( 1))
18868
18910
  });
18869
18911
  }
18870
18912
  cellRows.push(row);
18871
18913
  }
18872
18914
  if (cellRows.length > 0) {
18873
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18915
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols });
18874
18916
  if (table2.rows > 0) {
18875
18917
  blocks.push({ type: "table", table: table2, pageNumber: sheetIndex + 1 });
18876
18918
  }
@@ -18883,21 +18925,21 @@ async function parseXlsDocument(buffer, options) {
18883
18925
  try {
18884
18926
  cfb = parseLenientCfb(buf);
18885
18927
  } catch (e) {
18886
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
18928
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
18887
18929
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
18888
18930
  );
18889
18931
  }
18890
18932
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
18891
18933
  if (!wb) {
18892
- throw new (0, _chunkKKZATKQWcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18934
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
18893
18935
  }
18894
18936
  const records = readRecords2(wb);
18895
18937
  if (records.length === 0) {
18896
- throw new (0, _chunkKKZATKQWcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18938
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
18897
18939
  }
18898
18940
  const firstBof = decodeBof(records[0].data);
18899
18941
  if (firstBof && firstBof.vers !== 1536) {
18900
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
18942
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
18901
18943
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
18902
18944
  );
18903
18945
  }
@@ -18926,7 +18968,7 @@ async function parseXlsDocument(buffer, options) {
18926
18968
  } : void 0;
18927
18969
  const totalSheets = Math.min(globals.sheets.length, MAX_SHEETS2);
18928
18970
  let pageFilter = null;
18929
- if (_optionalChain([options, 'optionalAccess', _138 => _138.pages])) {
18971
+ if (_optionalChain([options, 'optionalAccess', _143 => _143.pages])) {
18930
18972
  const { parsePageRange: parsePageRange2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./page-range-P7SDW6LR.cjs")));
18931
18973
  pageFilter = parsePageRange2(options.pages, totalSheets);
18932
18974
  }
@@ -18935,7 +18977,7 @@ async function parseXlsDocument(buffer, options) {
18935
18977
  if (pageFilter && !pageFilter.has(i + 1)) continue;
18936
18978
  const meta = globals.sheets[i];
18937
18979
  if (meta.dt !== 0) continue;
18938
- _optionalChain([options, 'optionalAccess', _139 => _139.onProgress, 'optionalCall', _140 => _140(i + 1, totalSheets)]);
18980
+ _optionalChain([options, 'optionalAccess', _144 => _144.onProgress, 'optionalCall', _145 => _145(i + 1, totalSheets)]);
18939
18981
  const bofIdx = findSheetBofIndex(records, meta.lbPlyPos);
18940
18982
  if (bofIdx < 0) {
18941
18983
  warnings.push({
@@ -18951,7 +18993,7 @@ async function parseXlsDocument(buffer, options) {
18951
18993
  }
18952
18994
  try {
18953
18995
  const { sheet } = extractSheetCells(records, bofIdx, globals.sst, convertNum);
18954
- const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _141 => _141.keepTrailingEmptyCols]));
18996
+ const blocks = sheetToBlocks2(meta.name, sheet, i, _optionalChain([options, 'optionalAccess', _146 => _146.keepTrailingEmptyCols]));
18955
18997
  allBlocks.push(...blocks);
18956
18998
  } catch (e) {
18957
18999
  warnings.push({
@@ -18965,7 +19007,7 @@ async function parseXlsDocument(buffer, options) {
18965
19007
  pageCount: totalSheets
18966
19008
  };
18967
19009
  return {
18968
- markdown: _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, allBlocks),
19010
+ markdown: _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, allBlocks),
18969
19011
  blocks: allBlocks,
18970
19012
  metadata,
18971
19013
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18978,7 +19020,7 @@ async function parseXlsDocument(buffer, options) {
18978
19020
 
18979
19021
  // src/docx/equation.ts
18980
19022
  function lname(el) {
18981
- return el.localName || _optionalChain([el, 'access', _142 => _142.tagName, 'optionalAccess', _143 => _143.replace, 'call', _144 => _144(/^[^:]+:/, "")]) || "";
19023
+ return el.localName || _optionalChain([el, 'access', _147 => _147.tagName, 'optionalAccess', _148 => _148.replace, 'call', _149 => _149(/^[^:]+:/, "")]) || "";
18982
19024
  }
18983
19025
  function kids(parent, name) {
18984
19026
  const out = [];
@@ -19367,7 +19409,7 @@ function isDisplayMath(el) {
19367
19409
  // src/docx/parser.ts
19368
19410
  var MAX_DECOMPRESS_SIZE5 = 100 * 1024 * 1024;
19369
19411
  function matchesLocal(el, localName2) {
19370
- return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _145 => _145.tagName, 'optionalAccess', _146 => _146.endsWith, 'call', _147 => _147(`:${localName2}`)]), () => ( false)));
19412
+ return el.localName === localName2 || (_nullishCoalesce(_optionalChain([el, 'access', _150 => _150.tagName, 'optionalAccess', _151 => _151.endsWith, 'call', _152 => _152(`:${localName2}`)]), () => ( false)));
19371
19413
  }
19372
19414
  function effectiveChildElements(parent) {
19373
19415
  const result = [];
@@ -19402,7 +19444,7 @@ function findElements(parent, localName2) {
19402
19444
  const child = children[i];
19403
19445
  if (child.nodeType === 1) {
19404
19446
  const el = child;
19405
- if (el.localName === localName2 || _optionalChain([el, 'access', _148 => _148.tagName, 'optionalAccess', _149 => _149.endsWith, 'call', _150 => _150(`:${localName2}`)])) {
19447
+ if (el.localName === localName2 || _optionalChain([el, 'access', _153 => _153.tagName, 'optionalAccess', _154 => _154.endsWith, 'call', _155 => _155(`:${localName2}`)])) {
19406
19448
  result.push(el);
19407
19449
  }
19408
19450
  walk(el);
@@ -19421,7 +19463,7 @@ function getAttr(el, localName2) {
19421
19463
  return null;
19422
19464
  }
19423
19465
  function parseXml2(text) {
19424
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkKKZATKQWcjs.stripDtd.call(void 0, text), "text/xml");
19466
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkCWP56BRCcjs.stripDtd.call(void 0, text), "text/xml");
19425
19467
  }
19426
19468
  function parseStyles(xml) {
19427
19469
  const doc = parseXml2(xml);
@@ -19538,7 +19580,7 @@ function collectOmmlRoots(p) {
19538
19580
  const child = children[i];
19539
19581
  if (child.nodeType !== 1) continue;
19540
19582
  const el = child;
19541
- const tag = el.localName || _optionalChain([el, 'access', _151 => _151.tagName, 'optionalAccess', _152 => _152.replace, 'call', _153 => _153(/^[^:]+:/, "")]) || "";
19583
+ const tag = el.localName || _optionalChain([el, 'access', _156 => _156.tagName, 'optionalAccess', _157 => _157.replace, 'call', _158 => _158(/^[^:]+:/, "")]) || "";
19542
19584
  if (tag === "oMath" || tag === "oMathPara") {
19543
19585
  out.push(el);
19544
19586
  } else if (tag === "txbxContent" || tag === "Fallback") {
@@ -19579,7 +19621,7 @@ function fieldUrlFromInstr(instr) {
19579
19621
  function makeLink(text, rawHref) {
19580
19622
  if (!text) return "";
19581
19623
  if (!rawHref) return text;
19582
- const href = _chunkKKZATKQWcjs.sanitizeHref.call(void 0, rawHref);
19624
+ const href = _chunkCWP56BRCcjs.sanitizeHref.call(void 0, rawHref);
19583
19625
  return href ? `[${text}](${href})` : text;
19584
19626
  }
19585
19627
  function collectInline(p, footnotes, rels) {
@@ -19681,7 +19723,7 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19681
19723
  const { text, bold: hasBold, italic: hasItalic, footnoteText } = collectInline(p, footnotes, rels);
19682
19724
  if (!text) return null;
19683
19725
  const style = styles.get(styleId);
19684
- if (_optionalChain([style, 'optionalAccess', _154 => _154.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19726
+ if (_optionalChain([style, 'optionalAccess', _159 => _159.outlineLevel]) !== void 0 && style.outlineLevel >= 0 && style.outlineLevel <= 5) {
19685
19727
  return {
19686
19728
  type: "heading",
19687
19729
  text,
@@ -19690,8 +19732,8 @@ function parseParagraph2(p, styles, numbering, footnotes, rels) {
19690
19732
  }
19691
19733
  if (numId && numId !== "0") {
19692
19734
  const numDef = numbering.get(numId);
19693
- const levelInfo = _optionalChain([numDef, 'optionalAccess', _155 => _155.get, 'call', _156 => _156(ilvl)]);
19694
- const listType = _optionalChain([levelInfo, 'optionalAccess', _157 => _157.numFmt]) === "bullet" ? "unordered" : "ordered";
19735
+ const levelInfo = _optionalChain([numDef, 'optionalAccess', _160 => _160.get, 'call', _161 => _161(ilvl)]);
19736
+ const listType = _optionalChain([levelInfo, 'optionalAccess', _162 => _162.numFmt]) === "bullet" ? "unordered" : "ordered";
19695
19737
  return { type: "list", text, listType };
19696
19738
  }
19697
19739
  const block = { type: "paragraph", text };
@@ -19773,7 +19815,7 @@ ${cell2.text}` : cell2.text;
19773
19815
  return { text: cell2.text, colSpan: cell2.colSpan, rowSpan, colAddr: cell2.col, rowAddr: r };
19774
19816
  })
19775
19817
  );
19776
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
19818
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keepEmptyCols });
19777
19819
  if (table2.rows === 0 || table2.cols === 0) return null;
19778
19820
  return { type: "table", table: table2 };
19779
19821
  }
@@ -19783,10 +19825,10 @@ function collectCellText(tc2, styles, numbering, footnotes, rels, depth) {
19783
19825
  for (const el of effectiveChildElements(tc2)) {
19784
19826
  if (matchesLocal(el, "p")) {
19785
19827
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19786
- if (_optionalChain([block, 'optionalAccess', _158 => _158.text])) parts.push(block.text);
19828
+ if (_optionalChain([block, 'optionalAccess', _163 => _163.text])) parts.push(block.text);
19787
19829
  for (const tp of collectTextboxParagraphs(el)) {
19788
19830
  const tb = parseParagraph2(tp, styles, numbering, footnotes, rels);
19789
- if (_optionalChain([tb, 'optionalAccess', _159 => _159.text])) parts.push(tb.text);
19831
+ if (_optionalChain([tb, 'optionalAccess', _164 => _164.text])) parts.push(tb.text);
19790
19832
  }
19791
19833
  } else if (matchesLocal(el, "tbl")) {
19792
19834
  for (const tr of getChildElements(el, "tr")) {
@@ -19821,7 +19863,7 @@ async function buildImageMap(zip, rels, doc, warnings) {
19821
19863
  try {
19822
19864
  const data = await imgFile.async("uint8array");
19823
19865
  imgIdx++;
19824
- const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _160 => _160.split, 'call', _161 => _161("."), 'access', _162 => _162.pop, 'call', _163 => _163(), 'optionalAccess', _164 => _164.toLowerCase, 'call', _165 => _165()]), () => ( "png"));
19866
+ const ext = _nullishCoalesce(_optionalChain([imgPath, 'access', _165 => _165.split, 'call', _166 => _166("."), 'access', _167 => _167.pop, 'call', _168 => _168(), 'optionalAccess', _169 => _169.toLowerCase, 'call', _170 => _170()]), () => ( "png"));
19825
19867
  const mimeMap = {
19826
19868
  png: "image/png",
19827
19869
  jpg: "image/jpeg",
@@ -19875,12 +19917,12 @@ function emitParagraphImages(p, imageMap, linked, out) {
19875
19917
  }
19876
19918
  }
19877
19919
  async function parseDocxDocument(buffer, options) {
19878
- _chunkKKZATKQWcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
19920
+ _chunkCWP56BRCcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE5);
19879
19921
  const zip = await _jszip2.default.loadAsync(buffer);
19880
19922
  const warnings = [];
19881
19923
  const docFile = zip.file("word/document.xml");
19882
19924
  if (!docFile) {
19883
- throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19925
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
19884
19926
  }
19885
19927
  let rels = /* @__PURE__ */ new Map();
19886
19928
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -19927,7 +19969,7 @@ async function parseDocxDocument(buffer, options) {
19927
19969
  const doc = parseXml2(docXml);
19928
19970
  const body = findElements(doc, "body");
19929
19971
  if (body.length === 0) {
19930
- throw new (0, _chunkKKZATKQWcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19972
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19931
19973
  }
19932
19974
  const { imageMap, images } = await buildImageMap(zip, rels, doc, warnings);
19933
19975
  const linkedImages = /* @__PURE__ */ new Set();
@@ -19935,7 +19977,7 @@ async function parseDocxDocument(buffer, options) {
19935
19977
  const bodyEl = body[0];
19936
19978
  const topLevel = effectiveChildElements(bodyEl);
19937
19979
  for (const el of topLevel) {
19938
- const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _166 => _166.tagName, 'optionalAccess', _167 => _167.split, 'call', _168 => _168(":"), 'access', _169 => _169.pop, 'call', _170 => _170()])));
19980
+ const localName2 = _nullishCoalesce(el.localName, () => ( _optionalChain([el, 'access', _171 => _171.tagName, 'optionalAccess', _172 => _172.split, 'call', _173 => _173(":"), 'access', _174 => _174.pop, 'call', _175 => _175()])));
19939
19981
  if (localName2 === "p") {
19940
19982
  const block = parseParagraph2(el, styles, numbering, footnotes, rels);
19941
19983
  if (block) blocks.push(block);
@@ -19946,7 +19988,7 @@ async function parseDocxDocument(buffer, options) {
19946
19988
  if (imageMap.size > 0) emitParagraphImages(tp, imageMap, linkedImages, blocks);
19947
19989
  }
19948
19990
  } else if (localName2 === "tbl") {
19949
- const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _171 => _171.keepTrailingEmptyCols]));
19991
+ const block = parseTable(el, styles, numbering, footnotes, rels, _optionalChain([options, 'optionalAccess', _176 => _176.keepTrailingEmptyCols]));
19950
19992
  if (block) blocks.push(block);
19951
19993
  }
19952
19994
  }
@@ -19978,7 +20020,7 @@ async function parseDocxDocument(buffer, options) {
19978
20020
  }
19979
20021
  }
19980
20022
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
19981
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
20023
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
19982
20024
  return {
19983
20025
  markdown,
19984
20026
  blocks,
@@ -20001,7 +20043,7 @@ function parseHwpmlDocument(buffer, options) {
20001
20043
  }
20002
20044
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
20003
20045
  const normalized = text.replace(/&nbsp;/g, "&#160;");
20004
- const xml = _chunkKKZATKQWcjs.stripDtd.call(void 0, normalized);
20046
+ const xml = _chunkCWP56BRCcjs.stripDtd.call(void 0, normalized);
20005
20047
  const warnings = [];
20006
20048
  const parser = new (0, _xmldom.DOMParser)({
20007
20049
  onError: (_level, msg2) => {
@@ -20029,7 +20071,7 @@ function parseHwpmlDocument(buffer, options) {
20029
20071
  return { markdown: "", blocks: [], metadata, warnings };
20030
20072
  }
20031
20073
  const blocks = [];
20032
- const pageFilter = _optionalChain([options, 'optionalAccess', _172 => _172.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
20074
+ const pageFilter = _optionalChain([options, 'optionalAccess', _177 => _177.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, countSections(body)) : null;
20033
20075
  let sectionIdx = 0;
20034
20076
  const children = body.childNodes;
20035
20077
  for (let i = 0; i < children.length; i++) {
@@ -20038,10 +20080,10 @@ function parseHwpmlDocument(buffer, options) {
20038
20080
  if (localName(el) !== "SECTION") continue;
20039
20081
  sectionIdx++;
20040
20082
  if (pageFilter && !pageFilter.has(sectionIdx)) continue;
20041
- parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _173 => _173.keepTrailingEmptyCols]), () => ( false)));
20083
+ parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _178 => _178.keepTrailingEmptyCols]), () => ( false)));
20042
20084
  }
20043
20085
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
20044
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
20086
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
20045
20087
  return {
20046
20088
  markdown,
20047
20089
  blocks,
@@ -20127,7 +20169,7 @@ function parseParagraph3(el, blocks, paraShapeMap, sectionNum) {
20127
20169
  const shapeInfo = paraShapeMap.get(paraShapeId);
20128
20170
  const text = extractParagraphText(el);
20129
20171
  if (!text) return;
20130
- if (_optionalChain([shapeInfo, 'optionalAccess', _174 => _174.headingLevel]) != null) {
20172
+ if (_optionalChain([shapeInfo, 'optionalAccess', _179 => _179.headingLevel]) != null) {
20131
20173
  blocks.push({ type: "heading", text, level: shapeInfo.headingLevel, pageNumber: sectionNum });
20132
20174
  } else {
20133
20175
  blocks.push({ type: "paragraph", text, pageNumber: sectionNum });
@@ -20186,7 +20228,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings, keep) {
20186
20228
  const r = Math.min(Math.max(_nullishCoalesce(cell2.rowAddr, () => ( 0)), 0), rowCount - 1);
20187
20229
  cellRows[r].push(cell2);
20188
20230
  }
20189
- const table2 = _chunkWMU2KJHFcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
20231
+ const table2 = _chunk5AXGFJQOcjs.buildTable.call(void 0, cellRows, { keepAnchoredEmptyCols: keep });
20190
20232
  const caption = extractShapeCaption(el);
20191
20233
  if (caption.text && caption.before) {
20192
20234
  blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
@@ -20446,7 +20488,7 @@ function fillInCellPatterns(cellText, values, matchedLabels, blockedLabels) {
20446
20488
  (match, prefix, suffix) => {
20447
20489
  const label = prefix + suffix;
20448
20490
  const normalizedLabel = normalizeLabel(label);
20449
- if (_optionalChain([blockedLabels, 'optionalAccess', _175 => _175.has, 'call', _176 => _176(normalizedLabel)])) return match;
20491
+ if (_optionalChain([blockedLabels, 'optionalAccess', _180 => _180.has, 'call', _181 => _181(normalizedLabel)])) return match;
20450
20492
  const matchKey = values.available(normalizedLabel) ? normalizedLabel : values.available(normalizeLabel(prefix)) ? normalizeLabel(prefix) : void 0;
20451
20493
  if (matchKey === void 0) return match;
20452
20494
  const newValue = values.consume(matchKey);
@@ -20525,17 +20567,17 @@ function matchInlineSegment(seg, values, blockedLabels) {
20525
20567
  const nlabel = normalizeLabel(seg.label);
20526
20568
  if (seg.extLabel !== void 0) {
20527
20569
  const nExt = normalizeLabel(seg.extLabel);
20528
- if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _177 => _177.has, 'call', _178 => _178(nExt)]) && values.has(nExt)) {
20570
+ if (nExt !== nlabel && !_optionalChain([blockedLabels, 'optionalAccess', _182 => _182.has, 'call', _183 => _183(nExt)]) && values.has(nExt)) {
20529
20571
  return { key: nExt, label: seg.extLabel, viaExt: true };
20530
20572
  }
20531
20573
  }
20532
- if (_optionalChain([blockedLabels, 'optionalAccess', _179 => _179.has, 'call', _180 => _180(nlabel)])) return void 0;
20574
+ if (_optionalChain([blockedLabels, 'optionalAccess', _184 => _184.has, 'call', _185 => _185(nlabel)])) return void 0;
20533
20575
  const key = findMatchingKey(nlabel, values);
20534
20576
  return key !== void 0 ? { key, label: seg.label, viaExt: false } : void 0;
20535
20577
  }
20536
20578
  function clampSegmentEnd(text, seg, next, nextViaExt) {
20537
20579
  let ve = seg.valueEnd;
20538
- if (nextViaExt && _optionalChain([next, 'optionalAccess', _181 => _181.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
20580
+ if (nextViaExt && _optionalChain([next, 'optionalAccess', _186 => _186.extStart]) !== void 0 && next.extStart < ve) ve = next.extStart;
20539
20581
  while (ve > seg.valueStart && /\s/.test(text[ve - 1])) ve--;
20540
20582
  return ve;
20541
20583
  }
@@ -20550,7 +20592,7 @@ function normalizeValues(values, warnings) {
20550
20592
  const { value, format } = typeof raw === "object" && !Array.isArray(raw) ? raw : { value: raw, format: void 0 };
20551
20593
  const key = normalizeLabel(label);
20552
20594
  if (map.has(key)) {
20553
- _optionalChain([warnings, 'optionalAccess', _182 => _182.push, 'call', _183 => _183(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
20595
+ _optionalChain([warnings, 'optionalAccess', _187 => _187.push, 'call', _188 => _188(`\uC785\uB825 \uB77C\uBCA8 "${label}"\uC774 \uC815\uADDC\uD654 \uD0A4 "${key}"\uC5D0\uC11C \uB2E4\uB978 \uB77C\uBCA8\uACFC \uCDA9\uB3CC \u2014 \uB4A4 \uAC12\uC73C\uB85C \uB36E\uC5B4\uC500`)]);
20554
20596
  }
20555
20597
  map.set(key, Array.isArray(value) ? value.map((v) => formatFillValue(v, format)) : formatFillValue(value, format));
20556
20598
  }
@@ -20725,8 +20767,8 @@ function extractFromTable(table2) {
20725
20767
  if (table2.cols >= 2) {
20726
20768
  for (let r = 0; r < table2.rows; r++) {
20727
20769
  for (let c = 0; c < table2.cols - 1; c++) {
20728
- const labelCell = _optionalChain([table2, 'access', _184 => _184.cells, 'access', _185 => _185[r], 'optionalAccess', _186 => _186[c]]);
20729
- const valueCell = _optionalChain([table2, 'access', _187 => _187.cells, 'access', _188 => _188[r], 'optionalAccess', _189 => _189[c + 1]]);
20770
+ const labelCell = _optionalChain([table2, 'access', _189 => _189.cells, 'access', _190 => _190[r], 'optionalAccess', _191 => _191[c]]);
20771
+ const valueCell = _optionalChain([table2, 'access', _192 => _192.cells, 'access', _193 => _193[r], 'optionalAccess', _194 => _194[c + 1]]);
20730
20772
  if (!labelCell || !valueCell) continue;
20731
20773
  if (isLabelCell(labelCell.text)) {
20732
20774
  fields.push({
@@ -20741,15 +20783,15 @@ function extractFromTable(table2) {
20741
20783
  }
20742
20784
  if (fields.length === 0 && table2.rows >= 2 && table2.cols >= 2) {
20743
20785
  const headerRow = table2.cells[0];
20744
- const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _190 => _190.every, 'call', _191 => _191((cell2) => {
20745
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _192 => _192.text, 'access', _193 => _193.trim, 'call', _194 => _194()]), () => ( ""));
20786
+ const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _195 => _195.every, 'call', _196 => _196((cell2) => {
20787
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _197 => _197.text, 'access', _198 => _198.trim, 'call', _199 => _199()]), () => ( ""));
20746
20788
  return t.length > 0 && t.length <= 20;
20747
20789
  })]), () => ( false));
20748
20790
  if (allLabels) {
20749
20791
  for (let r = 1; r < table2.rows; r++) {
20750
20792
  for (let c = 0; c < table2.cols; c++) {
20751
- const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _195 => _195[c], 'optionalAccess', _196 => _196.text, 'access', _197 => _197.trim, 'call', _198 => _198()]), () => ( ""));
20752
- const value = _nullishCoalesce(_optionalChain([table2, 'access', _199 => _199.cells, 'access', _200 => _200[r], 'optionalAccess', _201 => _201[c], 'optionalAccess', _202 => _202.text, 'access', _203 => _203.trim, 'call', _204 => _204()]), () => ( ""));
20793
+ const label = _nullishCoalesce(_optionalChain([headerRow, 'access', _200 => _200[c], 'optionalAccess', _201 => _201.text, 'access', _202 => _202.trim, 'call', _203 => _203()]), () => ( ""));
20794
+ const value = _nullishCoalesce(_optionalChain([table2, 'access', _204 => _204.cells, 'access', _205 => _205[r], 'optionalAccess', _206 => _206[c], 'optionalAccess', _207 => _207.text, 'access', _208 => _208.trim, 'call', _209 => _209()]), () => ( ""));
20753
20795
  if (label && value) {
20754
20796
  fields.push({ label, value, row: r, col: c });
20755
20797
  }
@@ -20843,7 +20885,7 @@ function fillFormFields(blocks, values, blockedLabels) {
20843
20885
  for (const table2 of allTables) {
20844
20886
  for (let r = 0; r < table2.rows; r++) {
20845
20887
  for (let c = 0; c < table2.cols; c++) {
20846
- const cell2 = _optionalChain([table2, 'access', _205 => _205.cells, 'access', _206 => _206[r], 'optionalAccess', _207 => _207[c]]);
20888
+ const cell2 = _optionalChain([table2, 'access', _210 => _210.cells, 'access', _211 => _211[r], 'optionalAccess', _212 => _212[c]]);
20847
20889
  if (!cell2) continue;
20848
20890
  const result = fillInCellPatterns(cell2.text, cursor, matchedLabels, blockedLabels);
20849
20891
  if (result) {
@@ -20875,7 +20917,7 @@ function collectIRTables(blocks, depth) {
20875
20917
  out.push(block.table);
20876
20918
  for (const row of block.table.cells) {
20877
20919
  for (const cell2 of row) {
20878
- if (_optionalChain([cell2, 'optionalAccess', _208 => _208.blocks, 'optionalAccess', _209 => _209.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20920
+ if (_optionalChain([cell2, 'optionalAccess', _213 => _213.blocks, 'optionalAccess', _214 => _214.length])) out.push(...collectIRTables(cell2.blocks, depth + 1));
20879
20921
  }
20880
20922
  }
20881
20923
  }
@@ -20886,7 +20928,7 @@ function coveredPositions(table2) {
20886
20928
  for (let r = 0; r < table2.rows; r++) {
20887
20929
  for (let c = 0; c < table2.cols; c++) {
20888
20930
  if (covered.has(`${r},${c}`)) continue;
20889
- const cell2 = _optionalChain([table2, 'access', _210 => _210.cells, 'access', _211 => _211[r], 'optionalAccess', _212 => _212[c]]);
20931
+ const cell2 = _optionalChain([table2, 'access', _215 => _215.cells, 'access', _216 => _216[r], 'optionalAccess', _217 => _217[c]]);
20890
20932
  if (!cell2) continue;
20891
20933
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
20892
20934
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -20902,15 +20944,15 @@ function coveredPositions(table2) {
20902
20944
  function isHeaderDataTable(table2, covered) {
20903
20945
  if (table2.rows < 2) return false;
20904
20946
  const headerRow = table2.cells[0];
20905
- if (!_optionalChain([headerRow, 'optionalAccess', _213 => _213.length])) return false;
20947
+ if (!_optionalChain([headerRow, 'optionalAccess', _218 => _218.length])) return false;
20906
20948
  const allLabels = headerRow.every((cell2) => {
20907
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _214 => _214.text, 'access', _215 => _215.trim, 'call', _216 => _216()]), () => ( ""));
20949
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _219 => _219.text, 'access', _220 => _220.trim, 'call', _221 => _221()]), () => ( ""));
20908
20950
  return t.length > 0 && t.length <= 20 && isLabelCell(t);
20909
20951
  });
20910
20952
  if (!allLabels) return false;
20911
20953
  for (let c = 0; c < table2.cols; c++) {
20912
20954
  if (covered.has(`1,${c}`)) continue;
20913
- const cell2 = _optionalChain([table2, 'access', _217 => _217.cells, 'access', _218 => _218[1], 'optionalAccess', _219 => _219[c]]);
20955
+ const cell2 = _optionalChain([table2, 'access', _222 => _222.cells, 'access', _223 => _223[1], 'optionalAccess', _224 => _224[c]]);
20914
20956
  if (!cell2) break;
20915
20957
  return !isLabelCell(cell2.text);
20916
20958
  }
@@ -20923,7 +20965,7 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20923
20965
  for (let r = skipHeaderRow ? 1 : 0; r < table2.rows; r++) {
20924
20966
  for (let c = 0; c < table2.cols; c++) {
20925
20967
  if (covered.has(`${r},${c}`)) continue;
20926
- const labelCell = _optionalChain([table2, 'access', _220 => _220.cells, 'access', _221 => _221[r], 'optionalAccess', _222 => _222[c]]);
20968
+ const labelCell = _optionalChain([table2, 'access', _225 => _225.cells, 'access', _226 => _226[r], 'optionalAccess', _227 => _227[c]]);
20927
20969
  if (!labelCell) continue;
20928
20970
  if (!isLabelCell(labelCell.text)) continue;
20929
20971
  let vc = c + labelCell.colSpan;
@@ -20934,12 +20976,12 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20934
20976
  if (isKeywordLabel(valueCell.text)) continue;
20935
20977
  const normalizedCellLabel = normalizeLabel(labelCell.text);
20936
20978
  if (!normalizedCellLabel) continue;
20937
- if (_optionalChain([blockedLabels, 'optionalAccess', _223 => _223.has, 'call', _224 => _224(normalizedCellLabel)])) continue;
20979
+ if (_optionalChain([blockedLabels, 'optionalAccess', _228 => _228.has, 'call', _229 => _229(normalizedCellLabel)])) continue;
20938
20980
  const matchKey = findMatchingKey(normalizedCellLabel, values);
20939
20981
  if (matchKey === void 0) continue;
20940
20982
  const newValue = values.consume(matchKey);
20941
20983
  if (newValue === void 0) continue;
20942
- if (_optionalChain([patternFilledCells, 'optionalAccess', _225 => _225.has, 'call', _226 => _226(valueCell)])) {
20984
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _230 => _230.has, 'call', _231 => _231(valueCell)])) {
20943
20985
  valueCell.text = newValue + " " + valueCell.text;
20944
20986
  } else {
20945
20987
  valueCell.text = newValue;
@@ -20956,8 +20998,8 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20956
20998
  }
20957
20999
  if (table2.rows >= 2 && table2.cols >= 2) {
20958
21000
  const headerRow = table2.cells[0];
20959
- const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _227 => _227.every, 'call', _228 => _228((cell2) => {
20960
- const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _229 => _229.text, 'access', _230 => _230.trim, 'call', _231 => _231()]), () => ( ""));
21001
+ const allLabels = _nullishCoalesce(_optionalChain([headerRow, 'optionalAccess', _232 => _232.every, 'call', _233 => _233((cell2) => {
21002
+ const t = _nullishCoalesce(_optionalChain([cell2, 'optionalAccess', _234 => _234.text, 'access', _235 => _235.trim, 'call', _236 => _236()]), () => ( ""));
20961
21003
  return t.length > 0 && t.length <= 20 && isLabelCell(t);
20962
21004
  })]), () => ( false));
20963
21005
  if (!allLabels) return;
@@ -20965,16 +21007,16 @@ function fillTable(table2, values, filled, matchedLabels, patternFilledCells, bl
20965
21007
  for (let c = 0; c < table2.cols; c++) {
20966
21008
  if (covered.has(`${r},${c}`)) continue;
20967
21009
  const headerCell = headerRow[c];
20968
- const valueCell = _optionalChain([table2, 'access', _232 => _232.cells, 'access', _233 => _233[r], 'optionalAccess', _234 => _234[c]]);
21010
+ const valueCell = _optionalChain([table2, 'access', _237 => _237.cells, 'access', _238 => _238[r], 'optionalAccess', _239 => _239[c]]);
20969
21011
  if (!headerCell || !valueCell) continue;
20970
21012
  const headerLabel = normalizeLabel(headerCell.text);
20971
- if (_optionalChain([blockedLabels, 'optionalAccess', _235 => _235.has, 'call', _236 => _236(headerLabel)])) continue;
21013
+ if (_optionalChain([blockedLabels, 'optionalAccess', _240 => _240.has, 'call', _241 => _241(headerLabel)])) continue;
20972
21014
  const matchKey = findMatchingKey(headerLabel, values);
20973
21015
  if (matchKey === void 0) continue;
20974
21016
  if (!values.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
20975
21017
  const newValue = values.consume(matchKey);
20976
21018
  if (newValue === void 0) continue;
20977
- if (_optionalChain([patternFilledCells, 'optionalAccess', _237 => _237.has, 'call', _238 => _238(valueCell)])) {
21019
+ if (_optionalChain([patternFilledCells, 'optionalAccess', _242 => _242.has, 'call', _243 => _243(valueCell)])) {
20978
21020
  valueCell.text = newValue + " " + valueCell.text;
20979
21021
  } else {
20980
21022
  valueCell.text = newValue;
@@ -21006,7 +21048,7 @@ function fillInlineFields(text, values, filled, matchedLabels, blockedLabels) {
21006
21048
  if (newValue === void 0) continue;
21007
21049
  matchedLabels.add(matchKey);
21008
21050
  filled.push({ label: matched.label.trim(), value: newValue, row: -1, col: -1, key: matchKey });
21009
- const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _239 => _239[i + 1], 'optionalAccess', _240 => _240.viaExt]), () => ( false)));
21051
+ const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _244 => _244[i + 1], 'optionalAccess', _245 => _245.viaExt]), () => ( false)));
21010
21052
  out += text.slice(pos, seg.valueStart);
21011
21053
  out += seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
21012
21054
  pos = ve;
@@ -21568,19 +21610,19 @@ function parseCentralDirectory(buf) {
21568
21610
  }
21569
21611
  }
21570
21612
  }
21571
- if (eocdOffset < 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21613
+ if (eocdOffset < 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21572
21614
  const totalEntries = view.getUint16(eocdOffset + 10, true);
21573
21615
  const cdSize = view.getUint32(eocdOffset + 12, true);
21574
21616
  const cdOffset = view.getUint32(eocdOffset + 16, true);
21575
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21617
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21576
21618
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
21577
- throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21619
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21578
21620
  }
21579
21621
  const decoder = new TextDecoder("utf-8");
21580
21622
  const entries = [];
21581
21623
  let pos = cdOffset;
21582
21624
  for (let i = 0; i < totalEntries; i++) {
21583
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21625
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
21584
21626
  const flags = view.getUint16(pos + 8, true);
21585
21627
  const method = view.getUint16(pos + 10, true);
21586
21628
  const crc = view.getUint32(pos + 16, true);
@@ -21591,7 +21633,7 @@ function parseCentralDirectory(buf) {
21591
21633
  const commentLen = view.getUint16(pos + 32, true);
21592
21634
  const localOffset = view.getUint32(pos + 42, true);
21593
21635
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
21594
- throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21636
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
21595
21637
  }
21596
21638
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
21597
21639
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -21620,11 +21662,11 @@ function patchZipEntries(original, replacements, additions) {
21620
21662
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
21621
21663
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
21622
21664
  for (const name of replacements.keys()) {
21623
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkKKZATKQWcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21665
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkCWP56BRCcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21624
21666
  }
21625
21667
  if (additions) {
21626
21668
  for (const name of additions.keys()) {
21627
- if (entries.some((e) => e.name === name)) throw new (0, _chunkKKZATKQWcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21669
+ if (entries.some((e) => e.name === name)) throw new (0, _chunkCWP56BRCcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
21628
21670
  }
21629
21671
  }
21630
21672
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
@@ -21643,7 +21685,7 @@ function patchZipEntries(original, replacements, additions) {
21643
21685
  offset += seg.length;
21644
21686
  continue;
21645
21687
  }
21646
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkKKZATKQWcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21688
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkCWP56BRCcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
21647
21689
  const nameLen = view.getUint16(e.localOffset + 26, true);
21648
21690
  const extraLen = view.getUint16(e.localOffset + 28, true);
21649
21691
  const headerLen = 30 + nameLen + extraLen;
@@ -21651,7 +21693,7 @@ function patchZipEntries(original, replacements, additions) {
21651
21693
  const hview = new DataView(header.buffer, header.byteOffset, header.byteLength);
21652
21694
  const method = e.method;
21653
21695
  if (method !== 0 && method !== 8) {
21654
- throw new (0, _chunkKKZATKQWcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
21696
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(`\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 ZIP \uC555\uCD95 \uBC29\uC2DD(method=${method}): ${e.name} \u2014 STORE(0)/DEFLATE(8)\uB9CC \uAD50\uCCB4 \uAC00\uB2A5`);
21655
21697
  }
21656
21698
  const compData = method === 0 ? newData : new Uint8Array(_zlib.deflateRawSync.call(void 0, newData));
21657
21699
  const crc = crc32(newData);
@@ -21752,7 +21794,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21752
21794
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
21753
21795
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
21754
21796
  if (sectionPaths.length === 0) {
21755
- throw new (0, _chunkKKZATKQWcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21797
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
21756
21798
  }
21757
21799
  const warnings = [];
21758
21800
  const normalizedValues = normalizeValues(values, warnings);
@@ -21836,7 +21878,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21836
21878
  if (isKeywordLabel(cellLabelText(valueCell))) continue;
21837
21879
  const normalizedCellLabel = normalizeLabel(labelText);
21838
21880
  if (!normalizedCellLabel) continue;
21839
- if (_optionalChain([blockedLabels, 'optionalAccess', _241 => _241.has, 'call', _242 => _242(normalizedCellLabel)])) continue;
21881
+ if (_optionalChain([blockedLabels, 'optionalAccess', _246 => _246.has, 'call', _247 => _247(normalizedCellLabel)])) continue;
21840
21882
  const matchKey = findMatchingKey(normalizedCellLabel, cursor);
21841
21883
  if (matchKey === void 0) continue;
21842
21884
  if (patternApplied.has(valueCell)) {
@@ -21894,7 +21936,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21894
21936
  const dataCells = table2.rows[rowIdx];
21895
21937
  for (let colIdx = 0; colIdx < Math.min(headerCells.length, dataCells.length); colIdx++) {
21896
21938
  const headerLabel = normalizeLabel(cellLabelText(headerCells[colIdx]));
21897
- if (_optionalChain([blockedLabels, 'optionalAccess', _243 => _243.has, 'call', _244 => _244(headerLabel)])) continue;
21939
+ if (_optionalChain([blockedLabels, 'optionalAccess', _248 => _248.has, 'call', _249 => _249(headerLabel)])) continue;
21898
21940
  const matchKey = findMatchingKey(headerLabel, cursor);
21899
21941
  if (matchKey === void 0) continue;
21900
21942
  if (!cursor.isArray(matchKey) && matchedLabels.has(matchKey)) continue;
@@ -21948,7 +21990,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21948
21990
  }
21949
21991
  for (const para2 of [...scan.bodyParagraphs, ...scan.excludedParagraphs]) {
21950
21992
  const existing = ledger.get(para2);
21951
- if (_optionalChain([existing, 'optionalAccess', _245 => _245.fullText]) !== void 0) continue;
21993
+ if (_optionalChain([existing, 'optionalAccess', _250 => _250.fullText]) !== void 0) continue;
21952
21994
  const text = matchText(para2);
21953
21995
  const segments = scanInlineSegments(text);
21954
21996
  const matches = segments.map((seg) => matchInlineSegment(seg, cursor, blockedLabels));
@@ -21959,7 +22001,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
21959
22001
  const matchKey = matched.key;
21960
22002
  const newValue = cursor.consume(matchKey);
21961
22003
  if (newValue === void 0) continue;
21962
- const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _246 => _246[i + 1], 'optionalAccess', _247 => _247.viaExt]), () => ( false)));
22004
+ const ve = clampSegmentEnd(text, seg, segments[i + 1], _nullishCoalesce(_optionalChain([matches, 'access', _251 => _251[i + 1], 'optionalAccess', _252 => _252.viaExt]), () => ( false)));
21963
22005
  const replacement = seg.valueStart === ve ? padInsertion(text, seg.valueStart, newValue) : newValue;
21964
22006
  const l = led(para2);
21965
22007
  l.ranges.push({ start: seg.valueStart, end: ve, replacement });
@@ -22065,16 +22107,16 @@ var PARA_LIST = 7;
22065
22107
  var DEFAULT_TEXT_COLOR = "#000000";
22066
22108
  function resolveTheme(theme) {
22067
22109
  return {
22068
- h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _248 => _248.headingColors, 'optionalAccess', _249 => _249[1]]), () => ( DEFAULT_TEXT_COLOR)),
22069
- h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _250 => _250.headingColors, 'optionalAccess', _251 => _251[2]]), () => ( DEFAULT_TEXT_COLOR)),
22070
- h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _252 => _252.headingColors, 'optionalAccess', _253 => _253[3]]), () => ( DEFAULT_TEXT_COLOR)),
22071
- h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _254 => _254.headingColors, 'optionalAccess', _255 => _255[4]]), () => ( _optionalChain([theme, 'optionalAccess', _256 => _256.headingColors, 'optionalAccess', _257 => _257[3]]))), () => ( DEFAULT_TEXT_COLOR)),
22072
- body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _258 => _258.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
22073
- quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _259 => _259.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
22110
+ h1: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _253 => _253.headingColors, 'optionalAccess', _254 => _254[1]]), () => ( DEFAULT_TEXT_COLOR)),
22111
+ h2: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _255 => _255.headingColors, 'optionalAccess', _256 => _256[2]]), () => ( DEFAULT_TEXT_COLOR)),
22112
+ h3: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _257 => _257.headingColors, 'optionalAccess', _258 => _258[3]]), () => ( DEFAULT_TEXT_COLOR)),
22113
+ h4: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _259 => _259.headingColors, 'optionalAccess', _260 => _260[4]]), () => ( _optionalChain([theme, 'optionalAccess', _261 => _261.headingColors, 'optionalAccess', _262 => _262[3]]))), () => ( DEFAULT_TEXT_COLOR)),
22114
+ body: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _263 => _263.bodyColor]), () => ( DEFAULT_TEXT_COLOR)),
22115
+ quote: _nullishCoalesce(_optionalChain([theme, 'optionalAccess', _264 => _264.quoteColor]), () => ( DEFAULT_TEXT_COLOR)),
22074
22116
  /** quoteColor가 명시되었는지 — blockquote charPr 분기에 사용 (baseline 호환) */
22075
- hasQuoteOption: _optionalChain([theme, 'optionalAccess', _260 => _260.quoteColor]) !== void 0,
22076
- tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _261 => _261.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _262 => _262.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
22077
- tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _263 => _263.tableHeaderBold])
22117
+ hasQuoteOption: _optionalChain([theme, 'optionalAccess', _265 => _265.quoteColor]) !== void 0,
22118
+ tableHeader: _nullishCoalesce(_nullishCoalesce(_optionalChain([theme, 'optionalAccess', _266 => _266.tableHeaderColor]), () => ( _optionalChain([theme, 'optionalAccess', _267 => _267.bodyColor]))), () => ( DEFAULT_TEXT_COLOR)),
22119
+ tableHeaderBold: !!_optionalChain([theme, 'optionalAccess', _268 => _268.tableHeaderBold])
22078
22120
  };
22079
22121
  }
22080
22122
  function escapeXml(text) {
@@ -22489,7 +22531,7 @@ function assertSequentialIds(rows, label, startId) {
22489
22531
  const m = rows[i].match(/\bid="(\d+)"/);
22490
22532
  const got = m ? Number(m[1]) : NaN;
22491
22533
  if (got !== startId + i) {
22492
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
22534
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
22493
22535
  `\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)`
22494
22536
  );
22495
22537
  }
@@ -22573,7 +22615,7 @@ function buildCharProperties(theme, gongmun, ratioVariants = [], extraCharPrXmls
22573
22615
  }
22574
22616
  const expectedBase = charVariantBase(richAssets, !!gongmun);
22575
22617
  if (rows.length !== expectedBase) {
22576
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
22618
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
22577
22619
  `\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`
22578
22620
  );
22579
22621
  }
@@ -22800,7 +22842,7 @@ function buildStyles(gongmun) {
22800
22842
  </hh:styles>`;
22801
22843
  }
22802
22844
  function generateHeaderXml(theme, gongmun, ratioVariants = [], extraBorderFills = [], extraCharPrXmls = [], listIndentVariants = [], extraFonts = []) {
22803
- const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _264 => _264.fonts, 'access', _265 => _265.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _266 => _266.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
22845
+ const bodyFace = _nullishCoalesce(_optionalChain([gongmun, 'optionalAccess', _269 => _269.fonts, 'access', _270 => _270.body]), () => ( (_optionalChain([gongmun, 'optionalAccess', _271 => _271.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5")));
22804
22846
  const charPropsXml = buildCharProperties(theme, gongmun, ratioVariants, extraCharPrXmls);
22805
22847
  const paraPropsXml = buildParaProperties(gongmun, gongmun ? listIndentVariants : []);
22806
22848
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
@@ -22929,8 +22971,8 @@ function parseChartFence(text) {
22929
22971
  const spec = chartSpec(type);
22930
22972
  let finalSeries = spec.pie ? [series[0]] : series;
22931
22973
  finalSeries = finalSeries.map((s) => ({ ...s }));
22932
- const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _267 => _267.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
22933
- const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _268 => _268[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22974
+ const ptLen = Math.max(_nullishCoalesce(_optionalChain([cat, 'optionalAccess', _272 => _272.length]), () => ( 0)), ...finalSeries.map((s) => s.values.length));
22975
+ const catFinal = Array.from({ length: ptLen }, (_, i) => _nullishCoalesce(_optionalChain([cat, 'optionalAccess', _273 => _273[i]]), () => ( `\uD56D\uBAA9 ${i + 1}`)));
22934
22976
  if (!spec.scatter) {
22935
22977
  finalSeries = finalSeries.map((s) => ({ ...s, values: catFinal.map((_, i) => _nullishCoalesce(s.values[i], () => ( 0))) }));
22936
22978
  }
@@ -22972,7 +23014,7 @@ function serSpPr(color, stroke) {
22972
23014
  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>`;
22973
23015
  }
22974
23016
  function dPtXml(pointColors, pie) {
22975
- if (!_optionalChain([pointColors, 'optionalAccess', _269 => _269.length])) return "";
23017
+ if (!_optionalChain([pointColors, 'optionalAccess', _274 => _274.length])) return "";
22976
23018
  return pointColors.map((col, i) => {
22977
23019
  const f = chartColorFill(col);
22978
23020
  if (!f) return "";
@@ -23211,8 +23253,8 @@ function buildGaejosikCover(title, gongmun, bodyWidth = GAEJOSIK_BASE_WIDTH) {
23211
23253
  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 });
23212
23254
  const tbl2 = table([topRow, titleRow, botRow], g.totalW, g.barH + g.titleH + g.botBarH, 3, 1, bodyWidth);
23213
23255
  const host = `<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${tbl2}</hp:run></hp:p>`;
23214
- const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _270 => _270.cover, 'optionalAccess', _271 => _271.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
23215
- const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _272 => _272.cover, 'optionalAccess', _273 => _273.org]), () => ( ""));
23256
+ const date = _nullishCoalesce(_optionalChain([gongmun, 'access', _275 => _275.cover, 'optionalAccess', _276 => _276.date]), () => ( formatGaejosikDate(/* @__PURE__ */ new Date())));
23257
+ const org = _nullishCoalesce(_optionalChain([gongmun, 'access', _277 => _277.cover, 'optionalAccess', _278 => _278.org]), () => ( ""));
23216
23258
  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>`;
23217
23259
  const subEmpty = emptyPara(GJ_PARA_COVER, false, GJ_CHAR_COVER_SUB);
23218
23260
  return [
@@ -23468,7 +23510,7 @@ function escapeGfm(text) {
23468
23510
  }
23469
23511
  var HWP_SHAPE_ALT_TEXT_RE = /^(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?$/gm;
23470
23512
  function sanitizeText(text) {
23471
- let result = _chunkWMU2KJHFcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
23513
+ let result = _chunk5AXGFJQOcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
23472
23514
  if (result.length <= 30 && result.includes(" ")) {
23473
23515
  const tokens = result.split(" ");
23474
23516
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -23498,7 +23540,7 @@ function replicateGfmTable(table2) {
23498
23540
  for (let r = 0; r < numRows; r++) {
23499
23541
  for (let c = 0; c < numCols; c++) {
23500
23542
  if (skip.has(`${r},${c}`)) continue;
23501
- const cell2 = _optionalChain([cells, 'access', _274 => _274[r], 'optionalAccess', _275 => _275[c]]);
23543
+ const cell2 = _optionalChain([cells, 'access', _279 => _279[r], 'optionalAccess', _280 => _280[c]]);
23502
23544
  if (!cell2) continue;
23503
23545
  display[r][c] = {
23504
23546
  text: escapeGfm(sanitizeText(cell2.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -23552,7 +23594,7 @@ function unescapeGfmCell(text) {
23552
23594
  return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\([~*_`])/g, "$1");
23553
23595
  }
23554
23596
  function replicateCellInnerHtml(cell2) {
23555
- if (_optionalChain([cell2, 'access', _276 => _276.blocks, 'optionalAccess', _277 => _277.length])) {
23597
+ if (_optionalChain([cell2, 'access', _281 => _281.blocks, 'optionalAccess', _282 => _282.length])) {
23556
23598
  return cell2.blocks.map((b) => {
23557
23599
  if (b.type === "table" && b.table) {
23558
23600
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -23591,7 +23633,7 @@ function replicateHtmlTable(table2) {
23591
23633
  const rowCells = [];
23592
23634
  for (let c = 0; c < numCols; c++) {
23593
23635
  if (skip.has(`${r},${c}`)) continue;
23594
- const cell2 = _optionalChain([cells, 'access', _278 => _278[r], 'optionalAccess', _279 => _279[c]]);
23636
+ const cell2 = _optionalChain([cells, 'access', _283 => _283[r], 'optionalAccess', _284 => _284[c]]);
23595
23637
  if (!cell2) continue;
23596
23638
  for (let dr = 0; dr < cell2.rowSpan; dr++) {
23597
23639
  for (let dc = 0; dc < cell2.colSpan; dc++) {
@@ -23637,10 +23679,10 @@ function parseHtmlTable(raw) {
23637
23679
  }
23638
23680
  } else {
23639
23681
  if (!isClose) {
23640
- const cs = parseInt(_optionalChain([attrs, 'access', _280 => _280.match, 'call', _281 => _281(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _282 => _282[1]]) || "1", 10);
23641
- const rs = parseInt(_optionalChain([attrs, 'access', _283 => _283.match, 'call', _284 => _284(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _285 => _285[1]]) || "1", 10);
23682
+ const cs = parseInt(_optionalChain([attrs, 'access', _285 => _285.match, 'call', _286 => _286(/colspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _287 => _287[1]]) || "1", 10);
23683
+ const rs = parseInt(_optionalChain([attrs, 'access', _288 => _288.match, 'call', _289 => _289(/rowspan\s*=\s*["']?(\d+)/i), 'optionalAccess', _290 => _290[1]]) || "1", 10);
23642
23684
  cellStart = m.index + m[0].length;
23643
- cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunkWMU2KJHFcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunkWMU2KJHFcjs.MAX_ROWS) };
23685
+ cellInfo = { colSpan: clampSpan(isNaN(cs) ? 1 : cs, _chunk5AXGFJQOcjs.MAX_COLS), rowSpan: clampSpan(isNaN(rs) ? 1 : rs, _chunk5AXGFJQOcjs.MAX_ROWS) };
23644
23686
  } else if (cellStart >= 0 && cellInfo && currentRow) {
23645
23687
  currentRow.push({ inner: raw.slice(cellStart, m.index), colSpan: cellInfo.colSpan, rowSpan: cellInfo.rowSpan });
23646
23688
  cellStart = -1;
@@ -23664,7 +23706,7 @@ function htmlCellInnerToLines(inner) {
23664
23706
  hadNonText = true;
23665
23707
  work = work.replace(/<img\s(?:"[^"]*"|'[^']*'|[^>"'])*?>/gi, (tag) => {
23666
23708
  const m = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
23667
- const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _286 => _286[1]]), () => ( _optionalChain([m, 'optionalAccess', _287 => _287[2]])));
23709
+ const src = _nullishCoalesce(_optionalChain([m, 'optionalAccess', _291 => _291[1]]), () => ( _optionalChain([m, 'optionalAccess', _292 => _292[2]])));
23668
23710
  if (src) imgSrcs.push(src);
23669
23711
  return "";
23670
23712
  });
@@ -23672,6 +23714,18 @@ function htmlCellInnerToLines(inner) {
23672
23714
  const lines = work.split(/<br\s*\/?>/gi).map((s) => s.trim()).filter((s) => s.length > 0);
23673
23715
  return { lines, hadNonText, imgSrcs };
23674
23716
  }
23717
+ function splitCellByTopLevelTables(html) {
23718
+ const tables = extractTopLevelTables(html);
23719
+ const texts = [];
23720
+ let rest = html;
23721
+ for (const t of tables) {
23722
+ const i = rest.indexOf(t);
23723
+ texts.push(rest.slice(0, i));
23724
+ rest = rest.slice(i + t.length);
23725
+ }
23726
+ texts.push(rest);
23727
+ return { texts, tables };
23728
+ }
23675
23729
  function extractTopLevelTables(html) {
23676
23730
  const result = [];
23677
23731
  let depth = 0;
@@ -23795,7 +23849,7 @@ function edgeXml(tag, d) {
23795
23849
  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"/>`;
23796
23850
  }
23797
23851
  function borderFillDefToXml(id, def) {
23798
- const fill = _optionalChain([def, 'access', _288 => _288.fill, 'optionalAccess', _289 => _289.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
23852
+ const fill = _optionalChain([def, 'access', _293 => _293.fill, 'optionalAccess', _294 => _294.faceColor]) ? `<hh:fillBrush><hh:winBrush faceColor="${escapeXml(def.fill.faceColor)}" hatchColor="#000000" alpha="0"/></hh:fillBrush>` : "";
23799
23853
  return ` <hh:borderFill id="${id}" threeD="0" shadow="0" centerLine="NONE" breakCellSeparateLine="0">
23800
23854
  <hh:slash type="NONE" Crooked="0" isCounter="0"/>
23801
23855
  <hh:backSlash type="NONE" Crooked="0" isCounter="0"/>
@@ -24200,11 +24254,11 @@ function estimateRowHeight(cells, widths, charHeight) {
24200
24254
  function generateTable(rows, theme, style = null, remap = null, seq = 0, images = null) {
24201
24255
  const rowCnt = rows.length;
24202
24256
  const colCnt = Math.max(...rows.map((r) => r.length), 1);
24203
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _290 => _290.bfRegistry]), () => ( null));
24257
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _295 => _295.bfRegistry]), () => ( null));
24204
24258
  const totalW = style ? reg ? style.totalWidth - DATA_TABLE_INSET : style.totalWidth : 44e3;
24205
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _291 => _291.charHeight]), () => ( 1e3));
24259
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _296 => _296.charHeight]), () => ( 1e3));
24206
24260
  const rowAnchor = normalizeRowAnchor((_nullishCoalesce(rows[0], () => ( []))).map((c) => c.replace(/!\[[^\]]*\]\([^)]*\)/g, "")));
24207
- const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _292 => _292[0], 'optionalAccess', _293 => _293[0]]), () => ( ""))), seq, rowAnchor);
24261
+ const prof = takeProfile(remap, rowCnt, colCnt, anchorOfMarkdownCell(_nullishCoalesce(_optionalChain([rows, 'access', _297 => _297[0], 'optionalAccess', _298 => _298[0]]), () => ( ""))), seq, rowAnchor);
24208
24262
  const colMax = Array(colCnt).fill(0);
24209
24263
  const colMaxBody = Array(colCnt).fill(0);
24210
24264
  const colMinWord = Array(colCnt).fill(0);
@@ -24232,7 +24286,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24232
24286
  const k = `${rowIdx},${colIdx}`;
24233
24287
  const isLabelCell2 = labelCol0 && colIdx === 0;
24234
24288
  const defaultCharPr = style ? reg && (isHeaderRow || isLabelCell2) ? style.boldCharPr : style.charPr : isHeaderRow ? headerCharPr : baseCharPr;
24235
- const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _294 => _294.cellChar, 'access', _295 => _295.get, 'call', _296 => _296(k)]), () => ( defaultCharPr));
24289
+ const cellCharPr = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _299 => _299.cellChar, 'access', _300 => _300.get, 'call', _301 => _301(k)]), () => ( defaultCharPr));
24236
24290
  const centered = isHeaderRow || colCentered[colIdx];
24237
24291
  const paraPrId = style ? centered ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
24238
24292
  const p = cell2.split(/<br\s*\/?>/i).map((seg) => {
@@ -24250,11 +24304,11 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24250
24304
  }
24251
24305
  }
24252
24306
  }
24253
- const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _297 => _297.cellChar, 'access', _298 => _298.has, 'call', _299 => _299(k)]) ? void 0 : mapId);
24307
+ const runs = generateRuns(seg, cellCharPr, _optionalChain([prof, 'optionalAccess', _302 => _302.cellChar, 'access', _303 => _303.has, 'call', _304 => _304(k)]) ? void 0 : mapId);
24254
24308
  const body = (runs || (picRuns ? "" : `<hp:run charPrIDRef="${cellCharPr}"><hp:t></hp:t></hp:run>`)) + picRuns;
24255
24309
  return `<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0">${body}</hp:p>`;
24256
24310
  }).join("");
24257
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _300 => _300.cellBf, 'access', _301 => _301.get, 'call', _302 => _302(k)]), () => ( (reg ? reg.get(dataCellSpec({
24311
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _305 => _305.cellBf, 'access', _306 => _306.get, 'call', _307 => _307(k)]), () => ( (reg ? reg.get(dataCellSpec({
24258
24312
  row: rowIdx,
24259
24313
  rowEnd: rowIdx,
24260
24314
  col: colIdx,
@@ -24264,7 +24318,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24264
24318
  headerRows: 1,
24265
24319
  fill: isHeaderRow ? _nullishCoalesce(style.headerFill, () => ( "#E6E6E6")) : isLabelCell2 ? _nullishCoalesce(style.labelFill, () => ( "#E7E7E7")) : void 0
24266
24320
  })) : style && isHeaderRow ? style.headerBf : 2)));
24267
- const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _303 => _303.cellH, 'access', _304 => _304.get, 'call', _305 => _305(k)]), () => ( cellH));
24321
+ const h = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _308 => _308.cellH, 'access', _309 => _309.get, 'call', _310 => _310(k)]), () => ( cellH));
24268
24322
  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>`;
24269
24323
  }).join("");
24270
24324
  return `<hp:tr>${tdElements}</hp:tr>`;
@@ -24273,7 +24327,7 @@ function generateTable(rows, theme, style = null, remap = null, seq = 0, images
24273
24327
  const tblH = rowHeights.reduce((a, b) => a + b, 0);
24274
24328
  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;
24275
24329
  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>`;
24276
- const hostPr = reg && _optionalChain([style, 'optionalAccess', _306 => _306.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
24330
+ const hostPr = reg && _optionalChain([style, 'optionalAccess', _311 => _311.rightParaPr]) !== void 0 ? style.rightParaPr : 0;
24277
24331
  return `<hp:p paraPrIDRef="${hostPr}" styleIDRef="0"><hp:run charPrIDRef="0">${tbl2}</hp:run></hp:p>`;
24278
24332
  }
24279
24333
  function layoutHtmlRows(rows) {
@@ -24284,8 +24338,8 @@ function layoutHtmlRows(rows) {
24284
24338
  let c = 0;
24285
24339
  for (const cell2 of rows[r].cells) {
24286
24340
  while (occupied.has(`${r},${c}`)) c++;
24287
- const colSpan = clampSpan(cell2.colSpan, _chunkWMU2KJHFcjs.MAX_COLS);
24288
- const rowSpan = clampSpan(cell2.rowSpan, _chunkWMU2KJHFcjs.MAX_ROWS);
24341
+ const colSpan = clampSpan(cell2.colSpan, _chunk5AXGFJQOcjs.MAX_COLS);
24342
+ const rowSpan = clampSpan(cell2.rowSpan, _chunk5AXGFJQOcjs.MAX_ROWS);
24289
24343
  placed.push({ r, c, colSpan, rowSpan, inner: cell2.inner, isHeader: rows[r].tag === "th" });
24290
24344
  for (let dr = 0; dr < rowSpan; dr++) {
24291
24345
  for (let dc = 0; dc < colSpan; dc++) occupied.add(`${r + dr},${c + dc}`);
@@ -24313,7 +24367,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24313
24367
  if (!rows || rows.length === 0) return null;
24314
24368
  const { placed, rowCnt, colCnt } = layoutHtmlRows(rows);
24315
24369
  if (rowCnt === 0 || colCnt === 0) return null;
24316
- const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _307 => _307.charHeight]), () => ( 1e3));
24370
+ const measureH = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _312 => _312.charHeight]), () => ( 1e3));
24317
24371
  const first = _nullishCoalesce(placed.find((p) => p.r === 0 && p.c === 0), () => ( placed[0]));
24318
24372
  const row0 = Array.from({ length: colCnt }, () => "");
24319
24373
  for (const cell2 of placed) {
@@ -24342,7 +24396,7 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24342
24396
  const tblId = nextTableId();
24343
24397
  const useHeaderStyle = !style && (theme.tableHeader !== theme.body || theme.tableHeaderBold);
24344
24398
  const spanW = (cell2) => colWidths.slice(cell2.c, cell2.c + cell2.colSpan).reduce((a, b) => a + b, 0);
24345
- const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _308 => _308.bfRegistry]), () => ( null));
24399
+ const reg = _nullishCoalesce(_optionalChain([style, 'optionalAccess', _313 => _313.bfRegistry]), () => ( null));
24346
24400
  let htmlHeaderRows = 0;
24347
24401
  while (htmlHeaderRows < rows.length && rows[htmlHeaderRows].tag === "th") htmlHeaderRows++;
24348
24402
  const tableRowHeights = Array(rowCnt).fill(cellH);
@@ -24350,39 +24404,40 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24350
24404
  const rowSpan = Math.min(cell2.rowSpan, rowCnt - cell2.r);
24351
24405
  const lines = cellLines[i];
24352
24406
  let nestedH = 0;
24353
- const nestedXmls = [];
24354
- for (const nested of extractTopLevelTables(cell2.inner)) {
24407
+ const { texts: segTexts, tables: nestedTables } = splitCellByTopLevelTables(cell2.inner);
24408
+ const nestedXmls = nestedTables.map((nested) => {
24355
24409
  const sw = spanW(cell2);
24356
24410
  const nestedW = Math.max(Math.min(Math.max(sw - 1020, 4e3), sw - 282), 500);
24357
24411
  const nestedXml = generateHtmlTableXml(nested, theme, nestedW, style ? { ...style, totalWidth: nestedW } : null);
24358
24412
  if (nestedXml) {
24359
- nestedXmls.push(nestedXml);
24360
- const szH = _optionalChain([nestedXml, 'access', _309 => _309.match, 'call', _310 => _310(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _311 => _311[1]]);
24413
+ const szH = _optionalChain([nestedXml, 'access', _314 => _314.match, 'call', _315 => _315(/<hp:sz [^>]*height="(\d+)"/), 'optionalAccess', _316 => _316[1]]);
24361
24414
  nestedH += (szH ? Number(szH) : (_nullishCoalesce(nested.match(/<tr[\s>]/gi), () => ( []))).length * cellH) + 300;
24362
24415
  }
24363
- }
24416
+ return nestedXml;
24417
+ });
24418
+ const segLines = segTexts.map((t) => htmlCellInnerToLines(t).lines);
24364
24419
  const usable = Math.max(spanW(cell2) - CELL_PAD, 1e3);
24365
24420
  let wrapLines = 0;
24366
24421
  for (const line of lines) wrapLines += Math.max(1, Math.ceil(measureTextWidth(unescapeHtml(line).trim(), measureH, 100) / usable));
24367
24422
  const lineH = style ? Math.round(measureH * 1.6) : 800;
24368
24423
  const contentH = Math.max(cellH * rowSpan, Math.max(wrapLines, 1) * lineH + nestedH);
24369
- const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _312 => _312.cellH, 'access', _313 => _313.get, 'call', _314 => _314(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
24424
+ const cellHeight = Math.max(_nullishCoalesce(_optionalChain([prof, 'optionalAccess', _317 => _317.cellH, 'access', _318 => _318.get, 'call', _319 => _319(`${cell2.r},${cell2.c}`)]), () => ( 0)), contentH);
24370
24425
  const perRow = Math.ceil(cellHeight / rowSpan);
24371
24426
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) tableRowHeights[r] = Math.max(tableRowHeights[r], perRow);
24372
- return { cell: cell2, rowSpan, lines, nestedXmls, imgSrcs: cellParsed[i].imgSrcs };
24427
+ return { cell: cell2, rowSpan, lines, nestedXmls, segLines, imgSrcs: cellParsed[i].imgSrcs };
24373
24428
  });
24374
- const tcXmls = meta.map(({ cell: cell2, rowSpan, lines, nestedXmls, imgSrcs }) => {
24429
+ const tcXmls = meta.map(({ cell: cell2, rowSpan, nestedXmls, segLines, imgSrcs }) => {
24375
24430
  const k = `${cell2.r},${cell2.c}`;
24376
24431
  const isHeader = cell2.isHeader;
24377
24432
  const baseCharPr = style ? style.charPr : CHAR_NORMAL;
24378
24433
  const headerCharPr = isHeader && useHeaderStyle ? CHAR_TABLE_HEADER : baseCharPr;
24379
24434
  const defaultCharPr = style && reg && isHeader ? style.boldCharPr : isHeader ? headerCharPr : baseCharPr;
24380
- const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _315 => _315.cellChar, 'access', _316 => _316.get, 'call', _317 => _317(k)]), () => ( defaultCharPr));
24435
+ const charPrId = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _320 => _320.cellChar, 'access', _321 => _321.get, 'call', _322 => _322(k)]), () => ( defaultCharPr));
24381
24436
  const centered = isHeader || colCentered[cell2.c];
24382
24437
  const paraPrId = style ? centered ? reg ? _nullishCoalesce(style.tblCenterParaPr, () => ( style.centerParaPr)) : style.centerParaPr : reg ? _nullishCoalesce(style.tblLeftParaPr, () => ( PARA_NORMAL)) : PARA_NORMAL : PARA_NORMAL;
24383
24438
  const picUrls = images ? [...imgSrcs] : [];
24384
24439
  const paras = [];
24385
- for (const line of lines) {
24440
+ const pushTextLine = (line) => {
24386
24441
  let text = unescapeHtml(line);
24387
24442
  if (images) {
24388
24443
  const { text: rest, urls } = splitImageRefs(text);
@@ -24394,7 +24449,14 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24394
24449
  if (!images || text.trim() || picUrls.length === 0) {
24395
24450
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t>${escapeXml(text)}</hp:t></hp:run></hp:p>`);
24396
24451
  }
24397
- }
24452
+ };
24453
+ segLines.forEach((seg, si) => {
24454
+ for (const line of seg) pushTextLine(line);
24455
+ const nestedXml = nestedXmls[si];
24456
+ if (nestedXml) {
24457
+ paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${nestedXml}</hp:run></hp:p>`);
24458
+ }
24459
+ });
24398
24460
  if (images && picUrls.length > 0) {
24399
24461
  const pics = picUrls.map((u) => {
24400
24462
  const part = images.take(u);
@@ -24404,16 +24466,13 @@ function generateHtmlTableXml(rawHtml, theme, totalWidth = 44e3, style = null, r
24404
24466
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}">${pics.join("")}</hp:run></hp:p>`);
24405
24467
  }
24406
24468
  }
24407
- for (const nestedXml of nestedXmls) {
24408
- paras.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${nestedXml}</hp:run></hp:p>`);
24409
- }
24410
24469
  if (paras.length === 0) {
24411
24470
  paras.push(`<hp:p paraPrIDRef="${paraPrId}" styleIDRef="0"><hp:run charPrIDRef="${charPrId}"><hp:t></hp:t></hp:run></hp:p>`);
24412
24471
  }
24413
24472
  let cellHeight = 0;
24414
24473
  for (let r = cell2.r; r < cell2.r + rowSpan; r++) cellHeight += tableRowHeights[r];
24415
24474
  const rowEnd = cell2.r + rowSpan - 1;
24416
- const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _318 => _318.cellBf, 'access', _319 => _319.get, 'call', _320 => _320(k)]), () => ( (reg ? reg.get(dataCellSpec({
24475
+ const bf = _nullishCoalesce(_optionalChain([prof, 'optionalAccess', _323 => _323.cellBf, 'access', _324 => _324.get, 'call', _325 => _325(k)]), () => ( (reg ? reg.get(dataCellSpec({
24417
24476
  row: cell2.r,
24418
24477
  rowEnd,
24419
24478
  col: cell2.c,
@@ -24583,7 +24642,7 @@ function buildPressHead(g, ids, bodyWidth, reg) {
24583
24642
  return [`<hp:p paraPrIDRef="${PARA_NORMAL}" styleIDRef="0"><hp:run charPrIDRef="${CHAR_NORMAL}">${table2}</hp:run></hp:p>`, blank()];
24584
24643
  }
24585
24644
  function buildPressContact(g, ids, bodyWidth, reg) {
24586
- const c = _optionalChain([g, 'access', _321 => _321.press, 'optionalAccess', _322 => _322.contact]);
24645
+ const c = _optionalChain([g, 'access', _326 => _326.press, 'optionalAccess', _327 => _327.contact]);
24587
24646
  if (!c || !c.dept && !c.manager && !c.phone) return [];
24588
24647
  const w = bodyWidth - 280;
24589
24648
  const cells = [["\uB2F4\uB2F9 \uBD80\uC11C", _nullishCoalesce(c.dept, () => ( ""))], ["\uB2F4\uB2F9\uC790", _nullishCoalesce(c.manager, () => ( ""))], ["\uC5F0\uB77D\uCC98", _nullishCoalesce(c.phone, () => ( ""))]];
@@ -24964,7 +25023,7 @@ function generateSecPr(gongmun) {
24964
25023
  }
24965
25024
  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>`;
24966
25025
  const colPr = `<hp:ctrl><hp:colPr id="" type="NEWSPAPER" layout="LEFT" colCount="1" sameSz="1" sameGap="0"/></hp:ctrl>`;
24967
- return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _323 => _323.pageNumbers]) ? pageNumCtrl() : "");
25026
+ return secPr + colPr + (_optionalChain([gongmun, 'optionalAccess', _328 => _328.pageNumbers]) ? pageNumCtrl() : "");
24968
25027
  }
24969
25028
  var SectionOpener = (_class6 = class {
24970
25029
  constructor(gongmun) {;_class6.prototype.__init12.call(this);
@@ -25003,19 +25062,19 @@ function buildPreamble(blocks, ctx) {
25003
25062
  const { gongmun, dfIds, bfReg, tableStyle, richAssets, gjBodyW } = ctx;
25004
25063
  const preamble = [];
25005
25064
  let hasFrontPages = false;
25006
- if (_optionalChain([gongmun, 'optionalAccess', _324 => _324.reportInfo]) && dfIds) {
25065
+ if (_optionalChain([gongmun, 'optionalAccess', _329 => _329.reportInfo]) && dfIds) {
25007
25066
  preamble.push(buildReportInfo(gongmun, dfIds));
25008
25067
  }
25009
- if (_optionalChain([gongmun, 'optionalAccess', _325 => _325.approval]) && bfReg) {
25068
+ if (_optionalChain([gongmun, 'optionalAccess', _330 => _330.approval]) && bfReg) {
25010
25069
  preamble.push(buildApprovalTable(gongmun.approval, bfReg, richAssets ? GJ_CHAR_APPROVAL : GONGMUN_APPROVAL_CHAR));
25011
25070
  }
25012
- if (_optionalChain([gongmun, 'optionalAccess', _326 => _326.docHead]) && dfIds) {
25071
+ if (_optionalChain([gongmun, 'optionalAccess', _331 => _331.docHead]) && dfIds) {
25013
25072
  preamble.push(...buildDocHead(gongmun, dfIds));
25014
25073
  }
25015
- if (_optionalChain([gongmun, 'optionalAccess', _327 => _327.noticeHead]) && dfIds) {
25074
+ if (_optionalChain([gongmun, 'optionalAccess', _332 => _332.noticeHead]) && dfIds) {
25016
25075
  preamble.push(...buildNoticeHead(gongmun));
25017
25076
  }
25018
- if (_optionalChain([gongmun, 'optionalAccess', _328 => _328.press]) && dfIds && bfReg && tableStyle) {
25077
+ if (_optionalChain([gongmun, 'optionalAccess', _333 => _333.press]) && dfIds && bfReg && tableStyle) {
25019
25078
  preamble.push(...buildPressHead(gongmun, dfIds, tableStyle.totalWidth, bfReg));
25020
25079
  }
25021
25080
  if (gongmun && (gongmun.cover || gongmun.toc)) {
@@ -25044,7 +25103,7 @@ function buildPreamble(blocks, ctx) {
25044
25103
  }
25045
25104
  if (gongmun && !ctx.gaejosik && ctx.coverH1Idx < 0 && bfReg && (gongmun.preset === "report" || gongmun.preset === "plan" || gongmun.preset === "notice")) {
25046
25105
  ctx.titleBoxH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
25047
- } else if (_optionalChain([gongmun, 'optionalAccess', _329 => _329.press]) && ctx.coverH1Idx < 0 && dfIds) {
25106
+ } else if (_optionalChain([gongmun, 'optionalAccess', _334 => _334.press]) && ctx.coverH1Idx < 0 && dfIds) {
25048
25107
  ctx.pressH1Idx = blocks.findIndex((b) => b.type === "heading" && (_nullishCoalesce(b.level, () => ( 1))) === 1);
25049
25108
  }
25050
25109
  if (preamble.length > 0) {
@@ -25059,7 +25118,7 @@ function renderHeading(block, blockIdx, ctx) {
25059
25118
  if (gongmun && blockIdx === ctx.coverH1Idx) return "";
25060
25119
  if (gongmun && blockIdx === ctx.pressH1Idx && dfIds) {
25061
25120
  const parts = [generateParagraph((block.text || "").trim(), GONGMUN_CENTER, dfIds.pressTitle)];
25062
- for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _330 => _330.press, 'optionalAccess', _331 => _331.sub]), () => ( []))) {
25121
+ for (const s of _nullishCoalesce(_optionalChain([gongmun, 'access', _335 => _335.press, 'optionalAccess', _336 => _336.sub]), () => ( []))) {
25063
25122
  parts.push(generateParagraph(`- ${s} -`, GONGMUN_CENTER, dfIds.pressSub));
25064
25123
  }
25065
25124
  return parts.join("\n ");
@@ -25153,8 +25212,8 @@ function renderListItem(block, blockIdx, ctx) {
25153
25212
  const { gongmun, gongmunList, measured, fit, vBase, dfIds } = ctx;
25154
25213
  if (gongmun && gongmunList) {
25155
25214
  const info = gongmunList.items.get(blockIdx);
25156
- const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _332 => _332.depth]), () => ( 0));
25157
- const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _333 => _333.marker]), () => ( ""));
25215
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _337 => _337.depth]), () => ( 0));
25216
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _338 => _338.marker]), () => ( ""));
25158
25217
  const content = block.text || "";
25159
25218
  if (measured && content.trimStart().startsWith("\u203B")) {
25160
25219
  return generateParagraph(content.trim(), GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
@@ -25163,7 +25222,7 @@ function renderListItem(block, blockIdx, ctx) {
25163
25222
  return generateParagraph(`* ${content.trim()}`, GJ_PARA_CHAM, GJ_CHAR_CHAM, ctx.chamMap);
25164
25223
  }
25165
25224
  const text = marker2 ? `${marker2} ${content}` : content;
25166
- const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _334 => _334.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
25225
+ const listParaPr = marker2 ? _optionalChain([info, 'optionalAccess', _339 => _339.indentVariant]) !== void 0 ? GONGMUN_LIST_VARIANT_BASE + info.indentVariant : GONGMUN_LIST_BASE + depth : GONGMUN_LIST_PLAIN_BASE + depth;
25167
25226
  let listCharPr = gongmun.numbering === "report" && depth === 0 ? CHAR_BOLD : CHAR_NORMAL;
25168
25227
  let mapId = fit ? variantMapper(fit, blockIdx, vBase) : void 0;
25169
25228
  if (measured && depth === 0 && gongmun.numbering !== "standard") {
@@ -25222,18 +25281,18 @@ function renderHtmlTable(block, ctx) {
25222
25281
  }
25223
25282
  function appendPostamble(blocks, ctx) {
25224
25283
  const { gongmun, dfIds, bfReg, tableStyle, paraXmls } = ctx;
25225
- if (_optionalChain([gongmun, 'optionalAccess', _335 => _335.noticeHead]) && dfIds) {
25284
+ if (_optionalChain([gongmun, 'optionalAccess', _340 => _340.noticeHead]) && dfIds) {
25226
25285
  paraXmls.push(...buildNoticeFoot(gongmun));
25227
25286
  }
25228
- if (_optionalChain([gongmun, 'optionalAccess', _336 => _336.endMark]) && paraXmls.length > 0) {
25229
- const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _337 => _337.rows, 'optionalAccess', _338 => _338.length]));
25287
+ if (_optionalChain([gongmun, 'optionalAccess', _341 => _341.endMark]) && paraXmls.length > 0) {
25288
+ const lastBlock = [...blocks].reverse().find((b) => (b.text || "").trim() || b.type === "table" && _optionalChain([b, 'access', _342 => _342.rows, 'optionalAccess', _343 => _343.length]));
25230
25289
  const lastText = lastBlock && (lastBlock.type === "paragraph" || lastBlock.type === "list_item") ? lastBlock.text || "" : "";
25231
25290
  if (!hasEndMark(lastText)) paraXmls.push(buildEndMark());
25232
25291
  }
25233
- if (_optionalChain([gongmun, 'optionalAccess', _339 => _339.docFoot]) && dfIds) {
25292
+ if (_optionalChain([gongmun, 'optionalAccess', _344 => _344.docFoot]) && dfIds) {
25234
25293
  paraXmls.push(...buildDocFoot(gongmun, dfIds));
25235
25294
  }
25236
- if (_optionalChain([gongmun, 'optionalAccess', _340 => _340.press]) && dfIds && bfReg && tableStyle) {
25295
+ if (_optionalChain([gongmun, 'optionalAccess', _345 => _345.press]) && dfIds && bfReg && tableStyle) {
25237
25296
  paraXmls.push(...buildPressContact(gongmun, dfIds, tableStyle.totalWidth, bfReg));
25238
25297
  }
25239
25298
  }
@@ -25253,7 +25312,7 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
25253
25312
  remap,
25254
25313
  dfIds,
25255
25314
  images,
25256
- gaejosik: _optionalChain([gongmun, 'optionalAccess', _341 => _341.preset]) === "gaejosik",
25315
+ gaejosik: _optionalChain([gongmun, 'optionalAccess', _346 => _346.preset]) === "gaejosik",
25257
25316
  measured,
25258
25317
  richAssets,
25259
25318
  vBase: charVariantBase(richAssets, !!gongmun),
@@ -25359,18 +25418,18 @@ function blocksToSectionXml(blocks, theme, gongmun, gongmunList = gongmun ? prec
25359
25418
 
25360
25419
  // src/hwpx/generator.ts
25361
25420
  async function markdownToHwpx(markdown, options) {
25362
- const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _342 => _342.theme]));
25363
- const gongmun = _optionalChain([options, 'optionalAccess', _343 => _343.gongmun]) ? resolveGongmun(options.gongmun) : null;
25421
+ const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _347 => _347.theme]));
25422
+ const gongmun = _optionalChain([options, 'optionalAccess', _348 => _348.gongmun]) ? resolveGongmun(options.gongmun) : null;
25364
25423
  const measured = !!gongmun && usesReportFonts(gongmun.preset);
25365
25424
  const richAssets = !!gongmun && needsGaejosikAssets(gongmun);
25366
25425
  const blocks = parseMarkdownToBlocks(markdown);
25367
25426
  const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
25368
25427
  const fit = gongmun && gongmunList ? computeGongmunFitPlan(blocks, gongmun, gongmunList) : null;
25369
25428
  const staticBfEnd = staticBorderFillNext(gongmun);
25370
- const remap = _optionalChain([options, 'optionalAccess', _344 => _344.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _345 => _345.variants, 'optionalAccess', _346 => _346.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
25371
- const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _347 => _347.borderFillXmls, 'access', _348 => _348.length]), () => ( 0)))) : null;
25429
+ const remap = _optionalChain([options, 'optionalAccess', _349 => _349.profile]) ? buildProfileRemap(options.profile, charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _350 => _350.variants, 'optionalAccess', _351 => _351.length]), () => ( 0))) * 4, staticBfEnd, staticFontNext(gongmun)) : null;
25430
+ const bfReg = gongmun ? new TableBfRegistry(staticBfEnd + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _352 => _352.borderFillXmls, 'access', _353 => _353.length]), () => ( 0)))) : null;
25372
25431
  const dfActive = !!gongmun && docframeActive(gongmun);
25373
- const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _349 => _349.variants, 'optionalAccess', _350 => _350.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _351 => _351.charPrXmls, 'access', _352 => _352.length]), () => ( 0)));
25432
+ const dfBase = charVariantBase(richAssets, !!gongmun) + (_nullishCoalesce(_optionalChain([fit, 'optionalAccess', _354 => _354.variants, 'optionalAccess', _355 => _355.length]), () => ( 0))) * 4 + (_nullishCoalesce(_optionalChain([remap, 'optionalAccess', _356 => _356.charPrXmls, 'access', _357 => _357.length]), () => ( 0)));
25374
25433
  const dfIds = dfActive ? docframeIds(dfBase) : null;
25375
25434
  const chartParts = [];
25376
25435
  const images = new ImageRegistry();
@@ -25381,7 +25440,7 @@ async function markdownToHwpx(markdown, options) {
25381
25440
  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)`);
25382
25441
  }
25383
25442
  }
25384
- const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _353 => _353.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _354 => _354.emit, 'call', _355 => _355()]), () => ( []))];
25443
+ const extraBorderFills = [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _358 => _358.borderFillXmls]), () => ( [])), ..._nullishCoalesce(_optionalChain([bfReg, 'optionalAccess', _359 => _359.emit, 'call', _360 => _360()]), () => ( []))];
25385
25444
  const zip = new (0, _jszip2.default)();
25386
25445
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
25387
25446
  zip.file("META-INF/container.xml", generateContainerXml());
@@ -25390,11 +25449,11 @@ async function markdownToHwpx(markdown, options) {
25390
25449
  zip.file("Contents/header.xml", generateHeaderXml(
25391
25450
  theme,
25392
25451
  gongmun,
25393
- _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _356 => _356.variants]), () => ( [])),
25452
+ _nullishCoalesce(_optionalChain([fit, 'optionalAccess', _361 => _361.variants]), () => ( [])),
25394
25453
  extraBorderFills,
25395
- [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _357 => _357.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
25396
- _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _358 => _358.indentVariants]), () => ( [])),
25397
- _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _359 => _359.fontFaces]), () => ( []))
25454
+ [..._nullishCoalesce(_optionalChain([remap, 'optionalAccess', _362 => _362.charPrXmls]), () => ( [])), ...dfActive ? docframeCharPrXmls(dfBase, richAssets) : []],
25455
+ _nullishCoalesce(_optionalChain([gongmunList, 'optionalAccess', _363 => _363.indentVariants]), () => ( [])),
25456
+ _nullishCoalesce(_optionalChain([remap, 'optionalAccess', _364 => _364.fontFaces]), () => ( []))
25398
25457
  ));
25399
25458
  zip.file("Contents/section0.xml", sectionXml);
25400
25459
  for (const part of chartParts) zip.file(part.name, part.xml);
@@ -25445,7 +25504,7 @@ function alignBlocks(a, b) {
25445
25504
  const m = a.length, n = b.length;
25446
25505
  if (m * n > 1e7) return fallbackAlign(a, b);
25447
25506
  const lenOf = (blk) => {
25448
- const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _360 => _360.text]), () => ( ""))).join(" ") : "";
25507
+ const t = blk.text !== void 0 ? blk.text : blk.type === "table" && blk.table ? blk.table.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _365 => _365.text]), () => ( ""))).join(" ") : "";
25449
25508
  return t.replace(/\s+/g, " ").trim().length;
25450
25509
  };
25451
25510
  const aLen = a.map(lenOf);
@@ -25518,8 +25577,8 @@ function blockSimilarity(a, b) {
25518
25577
  }
25519
25578
  function tableSimilarity(a, b) {
25520
25579
  const dimSim = 1 - Math.abs(a.rows * a.cols - b.rows * b.cols) / Math.max(a.rows * a.cols, b.rows * b.cols, 1);
25521
- const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _361 => _361.text]), () => ( ""))).join(" ");
25522
- const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _362 => _362.text]), () => ( ""))).join(" ");
25580
+ const textsA = a.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _366 => _366.text]), () => ( ""))).join(" ");
25581
+ const textsB = b.cells.flat().map((c) => _nullishCoalesce(_optionalChain([c, 'optionalAccess', _367 => _367.text]), () => ( ""))).join(" ");
25523
25582
  const contentSim = normalizedSimilarity(textsA, textsB);
25524
25583
  return dimSim * 0.3 + contentSim * 0.7;
25525
25584
  }
@@ -25530,8 +25589,8 @@ function diffTableCells(a, b) {
25530
25589
  for (let r = 0; r < maxRows; r++) {
25531
25590
  const row = [];
25532
25591
  for (let c = 0; c < maxCols; c++) {
25533
- const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _363 => _363.cells, 'access', _364 => _364[r], 'optionalAccess', _365 => _365[c], 'optionalAccess', _366 => _366.text]) : void 0;
25534
- const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _367 => _367.cells, 'access', _368 => _368[r], 'optionalAccess', _369 => _369[c], 'optionalAccess', _370 => _370.text]) : void 0;
25592
+ const cellA = r < a.rows && c < a.cols ? _optionalChain([a, 'access', _368 => _368.cells, 'access', _369 => _369[r], 'optionalAccess', _370 => _370[c], 'optionalAccess', _371 => _371.text]) : void 0;
25593
+ const cellB = r < b.rows && c < b.cols ? _optionalChain([b, 'access', _372 => _372.cells, 'access', _373 => _373[r], 'optionalAccess', _374 => _374[c], 'optionalAccess', _375 => _375.text]) : void 0;
25535
25594
  let type;
25536
25595
  if (cellA === void 0) type = "added";
25537
25596
  else if (cellB === void 0) type = "removed";
@@ -25697,7 +25756,7 @@ function parseRenderStyles(headXml) {
25697
25756
  const underlineEl = findChildByLocalName(el, "underline");
25698
25757
  const textColor = el.getAttribute("textColor");
25699
25758
  const fontRef = findChildByLocalName(el, "fontRef");
25700
- const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _371 => _371.getAttribute, 'call', _372 => _372("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _373 => _373.getAttribute, 'call', _374 => _374("latin")])));
25759
+ const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _376 => _376.getAttribute, 'call', _377 => _377("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _378 => _378.getAttribute, 'call', _379 => _379("latin")])));
25701
25760
  const face = fontId != null ? hangulFonts.get(fontId) : void 0;
25702
25761
  styles.charPr.set(id, {
25703
25762
  height: Number(el.getAttribute("height")) || 1e3,
@@ -25705,8 +25764,8 @@ function parseRenderStyles(headXml) {
25705
25764
  italic: findChildByLocalName(el, "italic") != null,
25706
25765
  underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
25707
25766
  color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
25708
- ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _375 => _375.getAttribute, 'call', _376 => _376("hangul")])) || 100,
25709
- spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _377 => _377.getAttribute, 'call', _378 => _378("hangul")])) || 0,
25767
+ ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _380 => _380.getAttribute, 'call', _381 => _381("hangul")])) || 100,
25768
+ spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _382 => _382.getAttribute, 'call', _383 => _383("hangul")])) || 0,
25710
25769
  fontFamily: face ? hwpFaceToCssStack(face) : void 0,
25711
25770
  face
25712
25771
  });
@@ -25715,7 +25774,7 @@ function parseRenderStyles(headXml) {
25715
25774
  const id = el.getAttribute("id");
25716
25775
  if (id != null) {
25717
25776
  const align = findChildByLocalName(el, "align");
25718
- styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _379 => _379.getAttribute, 'call', _380 => _380("horizontal")]) || "JUSTIFY");
25777
+ styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _384 => _384.getAttribute, 'call', _385 => _385("horizontal")]) || "JUSTIFY");
25719
25778
  styles.paraGeom.set(id, parseParaGeom(el));
25720
25779
  }
25721
25780
  } else if (tag === "borderFill") {
@@ -25729,7 +25788,7 @@ function parseRenderStyles(headXml) {
25729
25788
  };
25730
25789
  const fillBrush = findChildByLocalName(el, "fillBrush");
25731
25790
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
25732
- const face = _optionalChain([winBrush, 'optionalAccess', _381 => _381.getAttribute, 'call', _382 => _382("faceColor")]);
25791
+ const face = _optionalChain([winBrush, 'optionalAccess', _386 => _386.getAttribute, 'call', _387 => _387("faceColor")]);
25733
25792
  if (face && face.toLowerCase() !== "none") bf.fill = face;
25734
25793
  styles.borderFill.set(id, bf);
25735
25794
  }
@@ -25801,7 +25860,7 @@ function collectSites(scan) {
25801
25860
  }
25802
25861
  function attrOf(openTag, name) {
25803
25862
  const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
25804
- return _optionalChain([m, 'optionalAccess', _383 => _383[1]]);
25863
+ return _optionalChain([m, 'optionalAccess', _388 => _388[1]]);
25805
25864
  }
25806
25865
  function paraOpenTag(xml, para2) {
25807
25866
  const end = xml.indexOf(">", para2.start);
@@ -25816,7 +25875,7 @@ function anchorRunInfo(xml, para2, anchor) {
25816
25875
  if (!tr) return null;
25817
25876
  const before = xml.slice(Math.max(0, para2.start), tr.contentStart);
25818
25877
  const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
25819
- const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _384 => _384[1]]), () => ( tr.prefix)), () => ( "hp"));
25878
+ const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _389 => _389[1]]), () => ( tr.prefix)), () => ( "hp"));
25820
25879
  const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
25821
25880
  const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
25822
25881
  if (close === -1) return null;
@@ -25843,7 +25902,7 @@ function cellContentWidthMm(xml, cell2) {
25843
25902
  if (width === null) return null;
25844
25903
  let content = width;
25845
25904
  const win = cellAddrWindow(xml, cell2);
25846
- const mg = _optionalChain([win, 'optionalAccess', _385 => _385.match, 'call', _386 => _386(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
25905
+ const mg = _optionalChain([win, 'optionalAccess', _390 => _390.match, 'call', _391 => _391(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
25847
25906
  if (mg) {
25848
25907
  content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
25849
25908
  }
@@ -25877,11 +25936,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
25877
25936
  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>`;
25878
25937
  }
25879
25938
  async function placeSealHwpx(hwpxBuffer, ops) {
25880
- if (ops.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
25939
+ if (ops.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
25881
25940
  const u8 = new Uint8Array(hwpxBuffer);
25882
25941
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
25883
- const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _387 => _387.match, 'call', _388 => _388(/(\d+)\.xml$/i), 'optionalAccess', _389 => _389[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _390 => _390.match, 'call', _391 => _391(/(\d+)\.xml$/i), 'optionalAccess', _392 => _392[1]]), () => ( 0))));
25884
- if (sectionPaths.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
25942
+ const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _392 => _392.match, 'call', _393 => _393(/(\d+)\.xml$/i), 'optionalAccess', _394 => _394[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _395 => _395.match, 'call', _396 => _396(/(\d+)\.xml$/i), 'optionalAccess', _397 => _397[1]]), () => ( 0))));
25943
+ if (sectionPaths.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
25885
25944
  const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
25886
25945
  const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
25887
25946
  const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
@@ -25922,11 +25981,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25922
25981
  const manifestItems = [];
25923
25982
  const placed = [];
25924
25983
  for (const op of ops) {
25925
- if (!op.anchor) throw new (0, _chunkKKZATKQWcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25926
- if (!op.image || op.image.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25984
+ if (!op.anchor) throw new (0, _chunkCWP56BRCcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25985
+ if (!op.image || op.image.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
25927
25986
  const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
25928
- if (!MIME[ext]) throw new (0, _chunkKKZATKQWcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
25929
- if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkKKZATKQWcjs.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)`);
25987
+ if (!MIME[ext]) throw new (0, _chunkCWP56BRCcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
25988
+ if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkCWP56BRCcjs.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)`);
25930
25989
  const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
25931
25990
  let found = null;
25932
25991
  let total = 0;
@@ -25959,7 +26018,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25959
26018
  }
25960
26019
  }
25961
26020
  }
25962
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
26021
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
25963
26022
  `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)})`
25964
26023
  );
25965
26024
  }
@@ -25967,9 +26026,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25967
26026
  const xml = sectionXmls[si];
25968
26027
  const run = anchorRunInfo(xml, site.para, op.anchor);
25969
26028
  if (!run) {
25970
- throw new (0, _chunkKKZATKQWcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
26029
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
25971
26030
  }
25972
- const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _393 => _393.charPr, 'access', _394 => _394.get, 'call', _395 => _395(run.charPr), 'optionalAccess', _396 => _396.height]), () => ( 1e3));
26031
+ const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _398 => _398.charPr, 'access', _399 => _399.get, 'call', _400 => _400(run.charPr), 'optionalAccess', _401 => _401.height]), () => ( 1e3));
25973
26032
  const fontPt = charPrHeight / 100;
25974
26033
  const emMm = fontPt * 25.4 / 72;
25975
26034
  const lineHMm = emMm;
@@ -25978,7 +26037,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
25978
26037
  const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
25979
26038
  const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
25980
26039
  const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
25981
- const align = _optionalChain([styles, 'optionalAccess', _397 => _397.paraAlign, 'access', _398 => _398.get, 'call', _399 => _399(paraPrId)]);
26040
+ const align = _optionalChain([styles, 'optionalAccess', _402 => _402.paraAlign, 'access', _403 => _403.get, 'call', _404 => _404(paraPrId)]);
25982
26041
  let alignShiftMm = 0;
25983
26042
  if (align === "CENTER" || align === "RIGHT") {
25984
26043
  const paraWMm = measureMm(site.para.text, emMm);
@@ -26074,7 +26133,7 @@ function parseBorderFills(headerDoc) {
26074
26133
  };
26075
26134
  const fillBrush = findChildByLocalName(bf, "fillBrush");
26076
26135
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
26077
- const face = _optionalChain([winBrush, 'optionalAccess', _400 => _400.getAttribute, 'call', _401 => _401("faceColor")]);
26136
+ const face = _optionalChain([winBrush, 'optionalAccess', _405 => _405.getAttribute, 'call', _406 => _406("faceColor")]);
26078
26137
  if (face && face !== "none") def.fill = { faceColor: face };
26079
26138
  map.set(id, def);
26080
26139
  }
@@ -26106,7 +26165,7 @@ function parseCharPrs(headerDoc, hangulFonts) {
26106
26165
  if (cp.getAttribute("italic") === "1") def.italic = true;
26107
26166
  if (findChildByLocalName(cp, "underline")) def.underline = true;
26108
26167
  const fontRef = findChildByLocalName(cp, "fontRef");
26109
- const hangul = _optionalChain([fontRef, 'optionalAccess', _402 => _402.getAttribute, 'call', _403 => _403("hangul")]);
26168
+ const hangul = _optionalChain([fontRef, 'optionalAccess', _407 => _407.getAttribute, 'call', _408 => _408("hangul")]);
26110
26169
  if (hangul) {
26111
26170
  def.fontRef_hangul = hangul;
26112
26171
  const face = hangulFonts.get(hangul);
@@ -26134,7 +26193,7 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
26134
26193
  const rows = _nullishCoalesce(num(tbl2.getAttribute("rowCnt")), () => ( 0));
26135
26194
  const cols = _nullishCoalesce(num(tbl2.getAttribute("colCnt")), () => ( 0));
26136
26195
  const sz = findChildByLocalName(tbl2, "sz");
26137
- const width = _optionalChain([sz, 'optionalAccess', _404 => _404.getAttribute, 'call', _405 => _405("width")]) || void 0;
26196
+ const width = _optionalChain([sz, 'optionalAccess', _409 => _409.getAttribute, 'call', _410 => _410("width")]) || void 0;
26138
26197
  const cells = [];
26139
26198
  const usedBf = /* @__PURE__ */ new Set();
26140
26199
  const usedCp = /* @__PURE__ */ new Set();
@@ -26147,17 +26206,17 @@ function parseTable3(tbl2, tableIndex, borderFills, charPrs) {
26147
26206
  const addr = findChildByLocalName(tc2, "cellAddr");
26148
26207
  const span = findChildByLocalName(tc2, "cellSpan");
26149
26208
  const csz = findChildByLocalName(tc2, "cellSz");
26150
- const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _406 => _406.getAttribute, 'call', _407 => _407("rowAddr")])), () => ( 0));
26151
- const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _408 => _408.getAttribute, 'call', _409 => _409("colAddr")])), () => ( 0));
26209
+ const row = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _411 => _411.getAttribute, 'call', _412 => _412("rowAddr")])), () => ( 0));
26210
+ const col = _nullishCoalesce(num(_optionalChain([addr, 'optionalAccess', _413 => _413.getAttribute, 'call', _414 => _414("colAddr")])), () => ( 0));
26152
26211
  if (row === 0 && col === 0 && !anchorText) anchorText = directCellText(tc2);
26153
26212
  if (row === 0) row0Texts.set(col, directCellText(tc2));
26154
- const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _410 => _410.getAttribute, 'call', _411 => _411("colSpan")])), () => ( 1));
26155
- const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _412 => _412.getAttribute, 'call', _413 => _413("rowSpan")])), () => ( 1));
26213
+ const colSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _415 => _415.getAttribute, 'call', _416 => _416("colSpan")])), () => ( 1));
26214
+ const rowSpan = _nullishCoalesce(num(_optionalChain([span, 'optionalAccess', _417 => _417.getAttribute, 'call', _418 => _418("rowSpan")])), () => ( 1));
26156
26215
  const bfId = tc2.getAttribute("borderFillIDRef") || void 0;
26157
26216
  const cpId = firstRunCharPr(tc2);
26158
26217
  const cell2 = { row, col, rowSpan, colSpan };
26159
- const w = _optionalChain([csz, 'optionalAccess', _414 => _414.getAttribute, 'call', _415 => _415("width")]);
26160
- const hh = _optionalChain([csz, 'optionalAccess', _416 => _416.getAttribute, 'call', _417 => _417("height")]);
26218
+ const w = _optionalChain([csz, 'optionalAccess', _419 => _419.getAttribute, 'call', _420 => _420("width")]);
26219
+ const hh = _optionalChain([csz, 'optionalAccess', _421 => _421.getAttribute, 'call', _422 => _422("height")]);
26161
26220
  if (w) cell2.width_hwpunit = w;
26162
26221
  if (hh) cell2.height_hwpunit = hh;
26163
26222
  if (bfId) {
@@ -26245,16 +26304,16 @@ function pick(map, keys) {
26245
26304
  return out;
26246
26305
  }
26247
26306
  async function hwpxToProfile(input) {
26248
- const buf = input instanceof ArrayBuffer ? input : _chunkKKZATKQWcjs.toArrayBuffer.call(void 0, input);
26307
+ const buf = input instanceof ArrayBuffer ? input : _chunkCWP56BRCcjs.toArrayBuffer.call(void 0, input);
26249
26308
  const zip = await _jszip2.default.loadAsync(buf);
26250
26309
  const parser = createXmlParser();
26251
- const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _418 => _418.file, 'call', _419 => _419(/[Hh]eader\.xml$/), 'optionalAccess', _420 => _420[0]])));
26310
+ const headerFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( _optionalChain([zip, 'access', _423 => _423.file, 'call', _424 => _424(/[Hh]eader\.xml$/), 'optionalAccess', _425 => _425[0]])));
26252
26311
  let headerXml = "<root/>";
26253
26312
  if (headerFile) headerXml = await headerFile.async("text");
26254
26313
  const headerDoc = parser.parseFromString(headerXml, "text/xml");
26255
26314
  const borderFills = parseBorderFills(headerDoc);
26256
26315
  const charPrs = parseCharPrs(headerDoc, parseHangulFonts(headerDoc));
26257
- const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _421 => _421.name, 'access', _422 => _422.match, 'call', _423 => _423(/(\d+)\.xml$/), 'optionalAccess', _424 => _424[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _425 => _425.name, 'access', _426 => _426.match, 'call', _427 => _427(/(\d+)\.xml$/), 'optionalAccess', _428 => _428[1]]), () => ( null))), () => ( 0))));
26316
+ const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/).sort((a, b) => (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([a, 'access', _426 => _426.name, 'access', _427 => _427.match, 'call', _428 => _428(/(\d+)\.xml$/), 'optionalAccess', _429 => _429[1]]), () => ( null))), () => ( 0))) - (_nullishCoalesce(num(_nullishCoalesce(_optionalChain([b, 'access', _430 => _430.name, 'access', _431 => _431.match, 'call', _432 => _432(/(\d+)\.xml$/), 'optionalAccess', _433 => _433[1]]), () => ( null))), () => ( 0))));
26258
26317
  const tables = [];
26259
26318
  let tableIndex = 0;
26260
26319
  for (const f of sectionFiles) {
@@ -26568,7 +26627,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
26568
26627
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
26569
26628
  function patchTableRows(input) {
26570
26629
  const { table: table2, scanTable, ctx, skip, origKeys, editedKeys } = input;
26571
- const xml = _optionalChain([ctx, 'access', _429 => _429.scans, 'access', _430 => _430[scanTable.sectionIndex], 'optionalAccess', _431 => _431.xml]);
26630
+ const xml = _optionalChain([ctx, 'access', _434 => _434.scans, 'access', _435 => _435[scanTable.sectionIndex], 'optionalAccess', _436 => _436.xml]);
26572
26631
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
26573
26632
  const numRows = table2.rows;
26574
26633
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -26735,7 +26794,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
26735
26794
  const rr = scanTable.rowRanges[template];
26736
26795
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
26737
26796
  const scan = scanSectionXml(wrapped, 0);
26738
- const row = _optionalChain([scan, 'access', _432 => _432.tables, 'access', _433 => _433[0], 'optionalAccess', _434 => _434.rows, 'access', _435 => _435[0]]);
26797
+ const row = _optionalChain([scan, 'access', _437 => _437.tables, 'access', _438 => _438[0], 'optionalAccess', _439 => _439.rows, 'access', _440 => _440[0]]);
26739
26798
  if (!row || row.length !== cells.length) return null;
26740
26799
  const splices = allLinesegRemovalSplices(wrapped);
26741
26800
  for (let i = 0; i < cells.length; i++) {
@@ -26778,7 +26837,7 @@ function rowHeightOf(fragment) {
26778
26837
  }
26779
26838
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
26780
26839
  const from = scanTable.start + tblOpenLen;
26781
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _436 => _436.rowRanges, 'access', _437 => _437[0], 'optionalAccess', _438 => _438.start]), () => ( from));
26840
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _441 => _441.rowRanges, 'access', _442 => _442[0], 'optionalAccess', _443 => _443.start]), () => ( from));
26782
26841
  const slice = xml.slice(from, to);
26783
26842
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
26784
26843
  if (!szM || szM.index === void 0) return null;
@@ -26967,9 +27026,9 @@ function patchHtmlTableRows(table2, scanTable, replica, editedRows, ctx, skip, d
26967
27026
  });
26968
27027
  }
26969
27028
  function patchNestedTables(table2, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
26970
- const irCell = _optionalChain([table2, 'access', _439 => _439.cells, 'access', _440 => _440[oc.gridR], 'optionalAccess', _441 => _441[oc.gridC]]);
27029
+ const irCell = _optionalChain([table2, 'access', _444 => _444.cells, 'access', _445 => _445[oc.gridR], 'optionalAccess', _446 => _446[oc.gridC]]);
26971
27030
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
26972
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _442 => _442.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
27031
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _447 => _447.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
26973
27032
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
26974
27033
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
26975
27034
  }
@@ -27037,7 +27096,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27037
27096
  };
27038
27097
  const cell2 = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
27039
27098
  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)");
27040
- const irCell = _optionalChain([table2, 'access', _443 => _443.cells, 'access', _444 => _444[gridR], 'optionalAccess', _445 => _445[gridC]]);
27099
+ const irCell = _optionalChain([table2, 'access', _448 => _448.cells, 'access', _449 => _449[gridR], 'optionalAccess', _450 => _450[gridC]]);
27041
27100
  const scanJoined = cell2.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
27042
27101
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
27043
27102
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -27060,7 +27119,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27060
27119
  if (newLines.length === 0) return 0;
27061
27120
  const target = cell2.paragraphs[0];
27062
27121
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
27063
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _446 => _446.scans, 'access', _447 => _447[target.sectionIndex], 'optionalAccess', _448 => _448.xml]));
27122
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _451 => _451.scans, 'access', _452 => _452[target.sectionIndex], 'optionalAccess', _453 => _453.xml]));
27064
27123
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27065
27124
  splices.push(...sp);
27066
27125
  sectionIndex = target.sectionIndex;
@@ -27083,7 +27142,7 @@ function applyCellEdit(table2, scanTable, gridR, gridC, newLines, ctx, before, a
27083
27142
  }
27084
27143
  for (let i = 0; i < nonEmpty.length; i++) {
27085
27144
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
27086
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _449 => _449.scans, 'access', _450 => _450[nonEmpty[i].sectionIndex], 'optionalAccess', _451 => _451.xml]));
27145
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _454 => _454.scans, 'access', _455 => _455[nonEmpty[i].sectionIndex], 'optionalAccess', _456 => _456.xml]));
27087
27146
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27088
27147
  splices.push(...sp);
27089
27148
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -27164,7 +27223,7 @@ async function resolveSectionEntryNames(zip) {
27164
27223
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
27165
27224
  if (paths.length > 0) return paths;
27166
27225
  }
27167
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkKKZATKQWcjs.compareSectionPaths);
27226
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkCWP56BRCcjs.compareSectionPaths);
27168
27227
  }
27169
27228
  function sectionPathsFromManifest(xml) {
27170
27229
  const attr = (tag, name) => {
@@ -27174,7 +27233,7 @@ function sectionPathsFromManifest(xml) {
27174
27233
  const idToHref = /* @__PURE__ */ new Map();
27175
27234
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
27176
27235
  const id = attr(m[1], "id");
27177
- const href = _chunkKKZATKQWcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
27236
+ const href = _chunkCWP56BRCcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
27178
27237
  if (id && href) idToHref.set(id, href);
27179
27238
  }
27180
27239
  const ordered = [];
@@ -27183,7 +27242,7 @@ function sectionPathsFromManifest(xml) {
27183
27242
  if (href) ordered.push(href);
27184
27243
  }
27185
27244
  if (ordered.length > 0) return ordered;
27186
- return Array.from(idToHref.values()).sort(_chunkKKZATKQWcjs.compareSectionPaths);
27245
+ return Array.from(idToHref.values()).sort(_chunkCWP56BRCcjs.compareSectionPaths);
27187
27246
  }
27188
27247
 
27189
27248
  // src/roundtrip/patcher.ts
@@ -27275,7 +27334,7 @@ async function patchHwpx(original, editedMarkdown, options) {
27275
27334
  }
27276
27335
  }
27277
27336
  let verification;
27278
- if (_optionalChain([options, 'optionalAccess', _452 => _452.verify]) !== false) {
27337
+ if (_optionalChain([options, 'optionalAccess', _457 => _457.verify]) !== false) {
27279
27338
  try {
27280
27339
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
27281
27340
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -27293,17 +27352,17 @@ function buildOrigUnits(blocks) {
27293
27352
  let chunk;
27294
27353
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
27295
27354
  const next = blocks[i + 1];
27296
- if (_optionalChain([next, 'optionalAccess', _453 => _453.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
27297
- chunk = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
27355
+ if (_optionalChain([next, 'optionalAccess', _458 => _458.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
27356
+ chunk = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
27298
27357
  } else {
27299
- chunk = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, [block]);
27358
+ chunk = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, [block]);
27300
27359
  }
27301
27360
  if (chunk) {
27302
27361
  const subUnits = splitMarkdownUnits(chunk);
27303
27362
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
27304
27363
  for (let s = 0; s < subUnits.length; s++) {
27305
27364
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
27306
- if (block.type === "table" && _optionalChain([block, 'access', _454 => _454.table, 'optionalAccess', _455 => _455.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
27365
+ if (block.type === "table" && _optionalChain([block, 'access', _459 => _459.table, 'optionalAccess', _460 => _460.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
27307
27366
  u.role = "caption";
27308
27367
  }
27309
27368
  units.push(u);
@@ -27414,7 +27473,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
27414
27473
  const ti = ctx.tableInsert;
27415
27474
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
27416
27475
  const mapping = ctx.paraMap.get(orig.blockIdx);
27417
- if (!_optionalChain([mapping, 'optionalAccess', _456 => _456.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");
27476
+ if (!_optionalChain([mapping, 'optionalAccess', _461 => _461.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");
27418
27477
  const para2 = mapping.para;
27419
27478
  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");
27420
27479
  const scan = ctx.scans[para2.sectionIndex];
@@ -27442,7 +27501,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
27442
27501
  }
27443
27502
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
27444
27503
  const mapping = ctx.paraMap.get(orig.blockIdx);
27445
- if (!_optionalChain([mapping, 'optionalAccess', _457 => _457.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)");
27504
+ if (!_optionalChain([mapping, 'optionalAccess', _462 => _462.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)");
27446
27505
  if (block.text && block.text.includes("\n")) {
27447
27506
  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)");
27448
27507
  }
@@ -27473,7 +27532,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
27473
27532
  if (sanitizeText(newPlain) !== newPlain) {
27474
27533
  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");
27475
27534
  }
27476
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _458 => _458.scans, 'access', _459 => _459[mapping.para.sectionIndex], 'optionalAccess', _460 => _460.xml]));
27535
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _463 => _463.scans, 'access', _464 => _464[mapping.para.sectionIndex], 'optionalAccess', _465 => _465.xml]));
27477
27536
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
27478
27537
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
27479
27538
  return 1;
@@ -27662,7 +27721,7 @@ var Surgeon = (_class7 = class {
27662
27721
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
27663
27722
  findEntry(path) {
27664
27723
  const parts = path.replace(/^\//, "").split("/");
27665
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _461 => _461.entries, 'access', _462 => _462[0], 'optionalAccess', _463 => _463.child]), () => ( -1));
27724
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _466 => _466.entries, 'access', _467 => _467[0], 'optionalAccess', _468 => _468.child]), () => ( -1));
27666
27725
  let current;
27667
27726
  for (const part of parts) {
27668
27727
  const search = (idx) => {
@@ -27901,8 +27960,8 @@ function serializeRecords(recs, repl, inserts) {
27901
27960
  parts.push(header, data);
27902
27961
  };
27903
27962
  for (let i = 0; i < recs.length; i++) {
27904
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _464 => _464.get, 'call', _465 => _465(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
27905
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _466 => _466.get, 'call', _467 => _467(i)]), () => ( recs[i].data)));
27963
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _469 => _469.get, 'call', _470 => _470(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
27964
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _471 => _471.get, 'call', _472 => _472(i)]), () => ( recs[i].data)));
27906
27965
  }
27907
27966
  return Buffer.concat(parts);
27908
27967
  }
@@ -28020,7 +28079,7 @@ async function patchHwp(original, editedMarkdown, options) {
28020
28079
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
28021
28080
  }
28022
28081
  const fhEntry = CFB2.find(cfb, "/FileHeader");
28023
- if (!_optionalChain([fhEntry, 'optionalAccess', _468 => _468.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
28082
+ if (!_optionalChain([fhEntry, 'optionalAccess', _473 => _473.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
28024
28083
  let flags;
28025
28084
  try {
28026
28085
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -28042,7 +28101,7 @@ async function patchHwp(original, editedMarkdown, options) {
28042
28101
  const scans = [];
28043
28102
  for (let i = 0; i < sectionPaths.length; i++) {
28044
28103
  const entry = CFB2.find(cfb, sectionPaths[i]);
28045
- if (!_optionalChain([entry, 'optionalAccess', _469 => _469.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
28104
+ if (!_optionalChain([entry, 'optionalAccess', _474 => _474.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
28046
28105
  let stream;
28047
28106
  try {
28048
28107
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -28093,7 +28152,7 @@ async function patchHwp(original, editedMarkdown, options) {
28093
28152
  }
28094
28153
  }
28095
28154
  let verification;
28096
- if (_optionalChain([options, 'optionalAccess', _470 => _470.verify]) !== false) {
28155
+ if (_optionalChain([options, 'optionalAccess', _475 => _475.verify]) !== false) {
28097
28156
  try {
28098
28157
  const reparsed = parseHwp5Document(Buffer.from(data));
28099
28158
  const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
@@ -28183,7 +28242,7 @@ function tableContentScore(irTable, scanTable) {
28183
28242
  for (const [key, scanCell] of scanTable.cells) {
28184
28243
  const comma = key.indexOf(",");
28185
28244
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
28186
- const irCell = _optionalChain([irTable, 'access', _471 => _471.cells, 'access', _472 => _472[r], 'optionalAccess', _473 => _473[c]]);
28245
+ const irCell = _optionalChain([irTable, 'access', _476 => _476.cells, 'access', _477 => _477[r], 'optionalAccess', _478 => _478[c]]);
28187
28246
  if (!irCell) continue;
28188
28247
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
28189
28248
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -28219,7 +28278,7 @@ function handleModified(orig, edited, ctx) {
28219
28278
  }
28220
28279
  function patchParagraph(block, orig, edited, ctx, skip) {
28221
28280
  const mapping = ctx.paraMap.get(orig.blockIdx);
28222
- if (!_optionalChain([mapping, 'optionalAccess', _474 => _474.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)");
28281
+ if (!_optionalChain([mapping, 'optionalAccess', _479 => _479.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)");
28223
28282
  const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
28224
28283
  let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
28225
28284
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
@@ -28418,7 +28477,7 @@ function applyCellEdit5(table2, scanTable, gridR, gridC, newLines, ctx, before,
28418
28477
  };
28419
28478
  const cell2 = scanTable.cells.get(`${gridR},${gridC}`);
28420
28479
  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)");
28421
- const irCell = _optionalChain([table2, 'access', _475 => _475.cells, 'access', _476 => _476[gridR], 'optionalAccess', _477 => _477[gridC]]);
28480
+ const irCell = _optionalChain([table2, 'access', _480 => _480.cells, 'access', _481 => _481[gridR], 'optionalAccess', _482 => _482[gridC]]);
28422
28481
  const scanJoined = cell2.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
28423
28482
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
28424
28483
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -28825,11 +28884,11 @@ var RULES2 = {
28825
28884
  }
28826
28885
  };
28827
28886
  function redactText(text, options) {
28828
- const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _478 => _478.maskChar]), () => ( "\u25CF"));
28887
+ const maskChar = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _483 => _483.maskChar]), () => ( "\u25CF"));
28829
28888
  if (maskChar.length !== 1 || /[0-9A-Za-z]/.test(maskChar)) {
28830
28889
  throw new Error(`maskChar\uB294 \uC601\uC22B\uC790\uAC00 \uC544\uB2CC 1\uAE00\uC790\uC5EC\uC57C \uD568: ${JSON.stringify(maskChar)}`);
28831
28890
  }
28832
- const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _479 => _479.rules]), () => ( DEFAULT_REDACT_RULES));
28891
+ const enabled = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _484 => _484.rules]), () => ( DEFAULT_REDACT_RULES));
28833
28892
  const hits = [];
28834
28893
  if (text === "" || enabled.length === 0) return { text, hits };
28835
28894
  const occupied = [];
@@ -28884,8 +28943,8 @@ function sameBreadcrumb(a, b) {
28884
28943
  return a.length === b.length && a.every((v, i) => v === b[i]);
28885
28944
  }
28886
28945
  function blocksToChunks(blocks, options) {
28887
- const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _480 => _480.granularity]), () => ( "section"));
28888
- const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _481 => _481.includeTableCells]), () => ( false));
28946
+ const granularity = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _485 => _485.granularity]), () => ( "section"));
28947
+ const includeCells = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _486 => _486.includeTableCells]), () => ( false));
28889
28948
  const chunks = [];
28890
28949
  const headingStack = [];
28891
28950
  const listStack = [];
@@ -28899,12 +28958,12 @@ function blocksToChunks(blocks, options) {
28899
28958
  let run = null;
28900
28959
  const flushRun = () => {
28901
28960
  if (!run) return;
28902
- push("text", run.breadcrumb, _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
28961
+ push("text", run.breadcrumb, _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, run.blocks), [run.start, run.end], run.page);
28903
28962
  run = null;
28904
28963
  };
28905
28964
  for (let i = 0; i < blocks.length; i++) {
28906
28965
  const block = blocks[i];
28907
- const md2 = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, [block]);
28966
+ const md2 = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, [block]);
28908
28967
  if (!md2) continue;
28909
28968
  if (block.type === "heading") {
28910
28969
  flushRun();
@@ -29020,7 +29079,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29020
29079
  const block = st.blocks[blockIndex];
29021
29080
  if (!block) return void 0;
29022
29081
  if (block.type === "paragraph" || block.type === "heading") {
29023
- const para2 = _optionalChain([st, 'access', _482 => _482.paraMap, 'access', _483 => _483.get, 'call', _484 => _484(blockIndex), 'optionalAccess', _485 => _485.para]);
29082
+ const para2 = _optionalChain([st, 'access', _487 => _487.paraMap, 'access', _488 => _488.get, 'call', _489 => _489(blockIndex), 'optionalAccess', _490 => _490.para]);
29024
29083
  if (!para2) return void 0;
29025
29084
  return { kind: "paragraph", sectionIndex: para2.sectionIndex, xmlStart: para2.start };
29026
29085
  }
@@ -29045,7 +29104,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29045
29104
  if (block.text && block.text.includes("\n")) {
29046
29105
  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)" };
29047
29106
  }
29048
- if (!_optionalChain([st, 'access', _486 => _486.paraMap, 'access', _487 => _487.get, 'call', _488 => _488(blockIndex), 'optionalAccess', _489 => _489.para])) {
29107
+ if (!_optionalChain([st, 'access', _491 => _491.paraMap, 'access', _492 => _492.get, 'call', _493 => _493(blockIndex), 'optionalAccess', _494 => _494.para])) {
29049
29108
  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)" };
29050
29109
  }
29051
29110
  return { capability: "text" };
@@ -29111,7 +29170,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29111
29170
  continue;
29112
29171
  }
29113
29172
  if (block.type === "table" && block.table) {
29114
- if (!_optionalChain([edit, 'access', _490 => _490.cells, 'optionalAccess', _491 => _491.length])) {
29173
+ if (!_optionalChain([edit, 'access', _495 => _495.cells, 'optionalAccess', _496 => _496.length])) {
29115
29174
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
29116
29175
  continue;
29117
29176
  }
@@ -29131,7 +29190,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29131
29190
  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) });
29132
29191
  continue;
29133
29192
  }
29134
- const irCell = _optionalChain([block, 'access', _492 => _492.table, 'access', _493 => _493.cells, 'access', _494 => _494[cellEdit.row], 'optionalAccess', _495 => _495[cellEdit.col]]);
29193
+ const irCell = _optionalChain([block, 'access', _497 => _497.table, 'access', _498 => _498.cells, 'access', _499 => _499[cellEdit.row], 'optionalAccess', _500 => _500[cellEdit.col]]);
29135
29194
  if (!irCell) {
29136
29195
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
29137
29196
  continue;
@@ -29187,7 +29246,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29187
29246
  }
29188
29247
  if (replacements.size === 0) {
29189
29248
  let changes2;
29190
- if (_optionalChain([options, 'optionalAccess', _496 => _496.verify]) !== false) {
29249
+ if (_optionalChain([options, 'optionalAccess', _501 => _501.verify]) !== false) {
29191
29250
  const units = splitMarkdownUnits(st.markdown);
29192
29251
  changes2 = diffUnitLists(units, units);
29193
29252
  }
@@ -29208,7 +29267,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29208
29267
  }
29209
29268
  this.state = newState;
29210
29269
  let changes;
29211
- if (_optionalChain([options, 'optionalAccess', _497 => _497.verify]) !== false) {
29270
+ if (_optionalChain([options, 'optionalAccess', _502 => _502.verify]) !== false) {
29212
29271
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
29213
29272
  }
29214
29273
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -29228,7 +29287,7 @@ var HwpxSession = (_class8 = class _HwpxSession {
29228
29287
  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)");
29229
29288
  }
29230
29289
  const mapping = st.paraMap.get(blockIndex);
29231
- if (!_optionalChain([mapping, 'optionalAccess', _498 => _498.para])) {
29290
+ if (!_optionalChain([mapping, 'optionalAccess', _503 => _503.para])) {
29232
29291
  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)");
29233
29292
  }
29234
29293
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -29248,14 +29307,14 @@ var HwpxSession = (_class8 = class _HwpxSession {
29248
29307
  if (sanitizeText(newPlain) !== newPlain) {
29249
29308
  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");
29250
29309
  }
29251
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _499 => _499.scans, 'access', _500 => _500[mapping.para.sectionIndex], 'optionalAccess', _501 => _501.xml]));
29310
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _504 => _504.scans, 'access', _505 => _505[mapping.para.sectionIndex], 'optionalAccess', _506 => _506.xml]));
29252
29311
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
29253
29312
  sectionSplices[mapping.para.sectionIndex].push(...splices);
29254
29313
  return 1;
29255
29314
  }
29256
29315
  }, _class8);
29257
29316
  function cellStaticCheck(table2, scanTable, r, c) {
29258
- const irCell = _optionalChain([table2, 'access', _502 => _502.cells, 'access', _503 => _503[r], 'optionalAccess', _504 => _504[c]]);
29317
+ const irCell = _optionalChain([table2, 'access', _507 => _507.cells, 'access', _508 => _508[r], 'optionalAccess', _509 => _509[c]]);
29259
29318
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
29260
29319
  const cell2 = scanTable.cellByAnchor.get(`${r},${c}`);
29261
29320
  if (!cell2) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -29339,11 +29398,11 @@ var md = new (0, _markdownit2.default)({
29339
29398
  breaks: false
29340
29399
  });
29341
29400
  function renderHtml(markdown, options) {
29342
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _505 => _505.preset]), () => ( "default"));
29343
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _506 => _506.extraCss]), () => ( "")));
29401
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _510 => _510.preset]), () => ( "default"));
29402
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _511 => _511.extraCss]), () => ( "")));
29344
29403
  const body = md.render(markdown);
29345
- const watermark = _optionalChain([options, 'optionalAccess', _507 => _507.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
29346
- const watermarkCss = _optionalChain([options, 'optionalAccess', _508 => _508.watermark]) ? `
29404
+ const watermark = _optionalChain([options, 'optionalAccess', _512 => _512.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
29405
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _513 => _513.watermark]) ? `
29347
29406
  .watermark {
29348
29407
  position: fixed;
29349
29408
  top: 50%; left: 50%;
@@ -29374,13 +29433,13 @@ async function htmlToPdf(html, options) {
29374
29433
  try {
29375
29434
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
29376
29435
  } catch (e32) {
29377
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
29436
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
29378
29437
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
29379
29438
  );
29380
29439
  }
29381
29440
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
29382
29441
  if (!executablePath) {
29383
- throw new (0, _chunkKKZATKQWcjs.KordocError)(
29442
+ throw new (0, _chunkCWP56BRCcjs.KordocError)(
29384
29443
  "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."
29385
29444
  );
29386
29445
  }
@@ -29392,10 +29451,10 @@ async function htmlToPdf(html, options) {
29392
29451
  try {
29393
29452
  const page = await browser.newPage();
29394
29453
  await page.setContent(html, { waitUntil: "networkidle0" });
29395
- const margin = _optionalChain([options, 'optionalAccess', _509 => _509.margin]);
29454
+ const margin = _optionalChain([options, 'optionalAccess', _514 => _514.margin]);
29396
29455
  const pdf = await page.pdf({
29397
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _510 => _510.pageSize]), () => ( "A4")),
29398
- landscape: _optionalChain([options, 'optionalAccess', _511 => _511.orientation]) === "landscape",
29456
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _515 => _515.pageSize]), () => ( "A4")),
29457
+ landscape: _optionalChain([options, 'optionalAccess', _516 => _516.orientation]) === "landscape",
29399
29458
  printBackground: true,
29400
29459
  margin: margin ? {
29401
29460
  top: toCss(margin.top),
@@ -29403,9 +29462,9 @@ async function htmlToPdf(html, options) {
29403
29462
  bottom: toCss(margin.bottom),
29404
29463
  left: toCss(margin.left)
29405
29464
  } : void 0,
29406
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _512 => _512.header]) || _optionalChain([options, 'optionalAccess', _513 => _513.footer])),
29407
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _514 => _514.header]), () => ( "<div></div>")),
29408
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _515 => _515.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
29465
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _517 => _517.header]) || _optionalChain([options, 'optionalAccess', _518 => _518.footer])),
29466
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _519 => _519.header]), () => ( "<div></div>")),
29467
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _520 => _520.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
29409
29468
  });
29410
29469
  return Buffer.from(pdf);
29411
29470
  } finally {
@@ -29439,7 +29498,7 @@ async function markdownToPdf(markdown, options) {
29439
29498
  return htmlToPdf(html, options);
29440
29499
  }
29441
29500
  async function blocksToPdf(blocks, options) {
29442
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks);
29501
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks);
29443
29502
  return markdownToPdf(markdown, options);
29444
29503
  }
29445
29504
 
@@ -29618,7 +29677,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
29618
29677
  }
29619
29678
  const wrapAttr = _nullishCoalesce(o.el.getAttribute("textWrap"), () => ( ""));
29620
29679
  if (wrapAttr === "BEHIND_TEXT" || wrapAttr === "IN_FRONT_OF_TEXT") continue;
29621
- const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _516 => _516.getAttribute, 'call', _517 => _517("vertRelTo")]), () => ( "PARA"));
29680
+ const vertRel = _nullishCoalesce(_optionalChain([pos, 'optionalAccess', _521 => _521.getAttribute, 'call', _522 => _522("vertRelTo")]), () => ( "PARA"));
29622
29681
  if (vertRel === "PAGE" || vertRel === "PAPER") continue;
29623
29682
  const vo = Math.max(0, num2(pos, "vertOffset"));
29624
29683
  if (wrapAttr === "TOP_AND_BOTTOM") {
@@ -29679,7 +29738,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
29679
29738
  if (ln(p) !== "p") continue;
29680
29739
  reflowTablesIn(p, doc, styles, mode, counter);
29681
29740
  const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
29682
- const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _518 => _518.spaceBefore]), () => ( 0)));
29741
+ const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _523 => _523.spaceBefore]), () => ( 0)));
29683
29742
  const res = reflowPara(p, doc, styles, areaW, startV, mode);
29684
29743
  if (!res) {
29685
29744
  const lsa = findChildByLocalName(p, "linesegarray");
@@ -29692,7 +29751,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
29692
29751
  }
29693
29752
  if (Number.isFinite(bottom)) {
29694
29753
  cursorV = bottom;
29695
- prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _519 => _519.spaceAfter]), () => ( 0));
29754
+ prevSpaceAfter = _nullishCoalesce(_optionalChain([g, 'optionalAccess', _524 => _524.spaceAfter]), () => ( 0));
29696
29755
  }
29697
29756
  }
29698
29757
  continue;
@@ -29802,7 +29861,7 @@ function buildPara(p) {
29802
29861
  el: ch,
29803
29862
  tag: cn,
29804
29863
  index: chars.length,
29805
- inline: _optionalChain([pos, 'optionalAccess', _520 => _520.getAttribute, 'call', _521 => _521("treatAsChar")]) === "1",
29864
+ inline: _optionalChain([pos, 'optionalAccess', _525 => _525.getAttribute, 'call', _526 => _526("treatAsChar")]) === "1",
29806
29865
  width: w,
29807
29866
  height: h
29808
29867
  });
@@ -30054,15 +30113,15 @@ function drawShape(o, x, y, ctx, depth) {
30054
30113
  const sx = ow > 0 ? w / ow : 1;
30055
30114
  const sy = oh > 0 ? h / oh : 1;
30056
30115
  const lineShape = findChildByLocalName(el, "lineShape");
30057
- const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _522 => _522.getAttribute, 'call', _523 => _523("style")]), () => ( "SOLID"));
30058
- const strokeCol = _optionalChain([lineShape, 'optionalAccess', _524 => _524.getAttribute, 'call', _525 => _525("color")]) || "#000000";
30116
+ const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _527 => _527.getAttribute, 'call', _528 => _528("style")]), () => ( "SOLID"));
30117
+ const strokeCol = _optionalChain([lineShape, 'optionalAccess', _529 => _529.getAttribute, 'call', _530 => _530("color")]) || "#000000";
30059
30118
  const hasStroke = lstyle !== "NONE";
30060
30119
  const strokeW = hasStroke ? shapeStrokePt(lineShape ? num3(lineShape, "width") : 33) : 0;
30061
30120
  const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
30062
30121
  const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
30063
30122
  const fillBrush = findChildByLocalName(el, "fillBrush");
30064
30123
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
30065
- const face = _optionalChain([winBrush, 'optionalAccess', _526 => _526.getAttribute, 'call', _527 => _527("faceColor")]);
30124
+ const face = _optionalChain([winBrush, 'optionalAccess', _531 => _531.getAttribute, 'call', _532 => _532("faceColor")]);
30066
30125
  const fill = face && face.toLowerCase() !== "none" ? face : "none";
30067
30126
  const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
30068
30127
  if (o.tag === "rect") {
@@ -30089,14 +30148,14 @@ function drawShape(o, x, y, ctx, depth) {
30089
30148
  }
30090
30149
  function cellContentExtent(cell2, memo) {
30091
30150
  if (!cell2.sub) return 0;
30092
- const hit = _optionalChain([memo, 'optionalAccess', _528 => _528.cell, 'access', _529 => _529.get, 'call', _530 => _530(cell2.el)]);
30151
+ const hit = _optionalChain([memo, 'optionalAccess', _533 => _533.cell, 'access', _534 => _534.get, 'call', _535 => _535(cell2.el)]);
30093
30152
  if (hit !== void 0) return hit;
30094
30153
  let ext = 0;
30095
30154
  for (const p of elements2(cell2.sub)) {
30096
30155
  if (ln2(p) !== "p") continue;
30097
30156
  const m = buildPara(p);
30098
30157
  for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
30099
- const baseV = _nullishCoalesce(_optionalChain([m, 'access', _531 => _531.segs, 'access', _532 => _532[0], 'optionalAccess', _533 => _533.vertpos]), () => ( 0));
30158
+ const baseV = _nullishCoalesce(_optionalChain([m, 'access', _536 => _536.segs, 'access', _537 => _537[0], 'optionalAccess', _538 => _538.vertpos]), () => ( 0));
30100
30159
  for (const o of m.objs) {
30101
30160
  if (o.inline) {
30102
30161
  const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el, memo)) : o.height;
@@ -30104,14 +30163,14 @@ function cellContentExtent(cell2, memo) {
30104
30163
  continue;
30105
30164
  }
30106
30165
  const pos = findChildByLocalName(o.el, "pos");
30107
- if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _534 => _534.getAttribute, 'call', _535 => _535("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
30166
+ if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _539 => _539.getAttribute, 'call', _540 => _540("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
30108
30167
  const om = findChildByLocalName(o.el, "outMargin");
30109
30168
  const pushed = baseV - (num3(om, "top") + o.height + num3(om, "bottom"));
30110
30169
  const anchor = pushed >= -100 ? pushed : baseV;
30111
30170
  ext = Math.max(ext, anchor + num3(om, "top") + num3(pos, "vertOffset") + o.height);
30112
30171
  }
30113
30172
  }
30114
- _optionalChain([memo, 'optionalAccess', _536 => _536.cell, 'access', _537 => _537.set, 'call', _538 => _538(cell2.el, ext)]);
30173
+ _optionalChain([memo, 'optionalAccess', _541 => _541.cell, 'access', _542 => _542.set, 'call', _543 => _543(cell2.el, ext)]);
30115
30174
  return ext;
30116
30175
  }
30117
30176
  function edgeLine(x1, y1, x2, y2, e) {
@@ -30153,7 +30212,7 @@ function collectCells(tbl2) {
30153
30212
  return cells;
30154
30213
  }
30155
30214
  function measureTableHeight(tbl2, memo) {
30156
- const hit = _optionalChain([memo, 'optionalAccess', _539 => _539.table, 'access', _540 => _540.get, 'call', _541 => _541(tbl2)]);
30215
+ const hit = _optionalChain([memo, 'optionalAccess', _544 => _544.table, 'access', _545 => _545.get, 'call', _546 => _546(tbl2)]);
30157
30216
  if (hit !== void 0) return hit;
30158
30217
  const cells = collectCells(tbl2);
30159
30218
  if (cells.length === 0 || cells.length > 4096) return 0;
@@ -30164,7 +30223,7 @@ function measureTableHeight(tbl2, memo) {
30164
30223
  );
30165
30224
  let sum = 0;
30166
30225
  for (const h of rowH) sum += h;
30167
- _optionalChain([memo, 'optionalAccess', _542 => _542.table, 'access', _543 => _543.set, 'call', _544 => _544(tbl2, sum)]);
30226
+ _optionalChain([memo, 'optionalAccess', _547 => _547.table, 'access', _548 => _548.set, 'call', _549 => _549(tbl2, sum)]);
30168
30227
  return sum;
30169
30228
  }
30170
30229
  function drawTable(tbl2, tx, ty, ctx, depth) {
@@ -30195,7 +30254,7 @@ function drawTable(tbl2, tx, ty, ctx, depth) {
30195
30254
  }));
30196
30255
  for (const g of geom) {
30197
30256
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
30198
- if (_optionalChain([bf, 'optionalAccess', _545 => _545.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
30257
+ if (_optionalChain([bf, 'optionalAccess', _550 => _550.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
30199
30258
  }
30200
30259
  for (const g of geom) {
30201
30260
  const { c } = g;
@@ -30233,7 +30292,7 @@ function drawPic(pic, x, y, ctx) {
30233
30292
  const sz = findChildByLocalName(pic, "sz");
30234
30293
  const w = num3(sz, "width", 5669), h = num3(sz, "height", 5669);
30235
30294
  const img = findFirst(pic, "img");
30236
- const ref = _optionalChain([img, 'optionalAccess', _546 => _546.getAttribute, 'call', _547 => _547("binaryItemIDRef")]);
30295
+ const ref = _optionalChain([img, 'optionalAccess', _551 => _551.getAttribute, 'call', _552 => _552("binaryItemIDRef")]);
30237
30296
  const loaded = ref != null ? ctx.images.get(ref) : void 0;
30238
30297
  if (!loaded) {
30239
30298
  emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
@@ -30273,7 +30332,7 @@ function readSectionGeom(root) {
30273
30332
  const pagePr = findFirst(root, "pagePr");
30274
30333
  const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
30275
30334
  let PW = num3(pagePr, "width", 59528), PH = num3(pagePr, "height", 84188);
30276
- if (_optionalChain([pagePr, 'optionalAccess', _548 => _548.getAttribute, 'call', _549 => _549("landscape")]) === "NARROWLY" && PW < PH) {
30335
+ if (_optionalChain([pagePr, 'optionalAccess', _553 => _553.getAttribute, 'call', _554 => _554("landscape")]) === "NARROWLY" && PW < PH) {
30277
30336
  const t = PW;
30278
30337
  PW = PH;
30279
30338
  PH = t;
@@ -30331,17 +30390,17 @@ function renderSectionToPages(root, geom, ctxBase, doReflow, reflowMode) {
30331
30390
  return { pages: ctx.pages, pageH };
30332
30391
  }
30333
30392
  async function renderHwpxToSvg(input, options) {
30334
- const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _550 => _550.maxImageBytes]), () => ( 40 * 1024 * 1024));
30393
+ const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _555 => _555.maxImageBytes]), () => ( 40 * 1024 * 1024));
30335
30394
  const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
30336
- _chunkKKZATKQWcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
30395
+ _chunkCWP56BRCcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
30337
30396
  let zip;
30338
30397
  try {
30339
30398
  zip = await _jszip2.default.loadAsync(input);
30340
30399
  } catch (e33) {
30341
- throw new (0, _chunkKKZATKQWcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
30400
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
30342
30401
  }
30343
30402
  const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
30344
- if (secFiles.length === 0) throw new (0, _chunkKKZATKQWcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
30403
+ if (secFiles.length === 0) throw new (0, _chunkCWP56BRCcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
30345
30404
  const warnings = [];
30346
30405
  const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
30347
30406
  const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
@@ -30349,7 +30408,7 @@ async function renderHwpxToSvg(input, options) {
30349
30408
  const secXmls = [];
30350
30409
  for (const f of secFiles) {
30351
30410
  const xml = await f.async("string");
30352
- if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkKKZATKQWcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
30411
+ if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkCWP56BRCcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
30353
30412
  secXmls.push(xml);
30354
30413
  }
30355
30414
  const binmap = /* @__PURE__ */ new Map();
@@ -30373,7 +30432,7 @@ async function renderHwpxToSvg(input, options) {
30373
30432
  let href = binmap.get(ref);
30374
30433
  if (!href) {
30375
30434
  const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
30376
- href = _optionalChain([cand, 'optionalAccess', _551 => _551.name]);
30435
+ href = _optionalChain([cand, 'optionalAccess', _556 => _556.name]);
30377
30436
  }
30378
30437
  if (!href) continue;
30379
30438
  const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
@@ -30394,7 +30453,7 @@ async function renderHwpxToSvg(input, options) {
30394
30453
  styles,
30395
30454
  images,
30396
30455
  defs: [],
30397
- highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _552 => _552.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
30456
+ highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _557 => _557.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
30398
30457
  warnings,
30399
30458
  warned: /* @__PURE__ */ new Set(),
30400
30459
  stats: { texts: 0, images: 0, tables: 0 },
@@ -30405,7 +30464,7 @@ async function renderHwpxToSvg(input, options) {
30405
30464
  for (let si = 0; si < secXmls.length; si++) {
30406
30465
  const secXml = secXmls[si];
30407
30466
  const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
30408
- if (!hasCache && !_optionalChain([options, 'optionalAccess', _553 => _553.reflow])) {
30467
+ if (!hasCache && !_optionalChain([options, 'optionalAccess', _558 => _558.reflow])) {
30409
30468
  noCacheSkipped = true;
30410
30469
  warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
30411
30470
  continue;
@@ -30417,14 +30476,14 @@ async function renderHwpxToSvg(input, options) {
30417
30476
  continue;
30418
30477
  }
30419
30478
  const geom = readSectionGeom(root);
30420
- const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _554 => _554.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _555 => _555.reflowMode]), () => ( "keep")));
30479
+ const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, !!_optionalChain([options, 'optionalAccess', _559 => _559.reflow]), _nullishCoalesce(_optionalChain([options, 'optionalAccess', _560 => _560.reflowMode]), () => ( "keep")));
30421
30480
  rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
30422
30481
  }
30423
30482
  if (rendered.length === 0) {
30424
30483
  if (noCacheSkipped) {
30425
- throw new (0, _chunkKKZATKQWcjs.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)");
30484
+ throw new (0, _chunkCWP56BRCcjs.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)");
30426
30485
  }
30427
- throw new (0, _chunkKKZATKQWcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
30486
+ throw new (0, _chunkCWP56BRCcjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
30428
30487
  }
30429
30488
  const GAP = 2400;
30430
30489
  const clipDefs = [];
@@ -30456,17 +30515,17 @@ ${groups.join("\n")}
30456
30515
  // src/index.ts
30457
30516
  async function parse(input, options) {
30458
30517
  let buffer;
30459
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _556 => _556.filePath]) ? { ...options, filePath: input } : options;
30518
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _561 => _561.filePath]) ? { ...options, filePath: input } : options;
30460
30519
  if (typeof input === "string") {
30461
30520
  try {
30462
30521
  const buf = await _promises.readFile.call(void 0, input);
30463
- buffer = _chunkKKZATKQWcjs.toArrayBuffer.call(void 0, buf);
30522
+ buffer = _chunkCWP56BRCcjs.toArrayBuffer.call(void 0, buf);
30464
30523
  } catch (err) {
30465
30524
  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}`;
30466
30525
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
30467
30526
  }
30468
30527
  } else if (Buffer.isBuffer(input)) {
30469
- buffer = _chunkKKZATKQWcjs.toArrayBuffer.call(void 0, input);
30528
+ buffer = _chunkCWP56BRCcjs.toArrayBuffer.call(void 0, input);
30470
30529
  } else {
30471
30530
  buffer = input;
30472
30531
  }
@@ -30500,18 +30559,18 @@ async function parse(input, options) {
30500
30559
  }
30501
30560
  async function parseImage(buffer, options) {
30502
30561
  try {
30503
- const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-3AFBDDJI.cjs")));
30562
+ const { parseImageDocument } = await Promise.resolve().then(() => _interopRequireWildcard(require("./image-ocr-TCJLNMTG.cjs")));
30504
30563
  const { blocks, warnings } = await parseImageDocument(buffer, options);
30505
30564
  return {
30506
30565
  success: true,
30507
30566
  fileType: "image",
30508
- markdown: _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, blocks),
30567
+ markdown: _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, blocks),
30509
30568
  blocks,
30510
30569
  warnings: warnings.length ? warnings : void 0,
30511
30570
  pageCount: 1
30512
30571
  };
30513
30572
  } catch (err) {
30514
- return { success: false, fileType: "image", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30573
+ return { success: false, fileType: "image", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30515
30574
  }
30516
30575
  }
30517
30576
  async function parseHwp3(buffer, options) {
@@ -30519,21 +30578,21 @@ async function parseHwp3(buffer, options) {
30519
30578
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
30520
30579
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
30521
30580
  } catch (err) {
30522
- return { success: false, fileType: "hwp3", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30581
+ return { success: false, fileType: "hwp3", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30523
30582
  }
30524
30583
  }
30525
30584
  async function parseHwpx(buffer, options) {
30526
30585
  try {
30527
30586
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
30528
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _557 => _557.length]) ? images : void 0 };
30587
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _562 => _562.length]) ? images : void 0 };
30529
30588
  } catch (err) {
30530
- return { success: false, fileType: "hwpx", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30589
+ return { success: false, fileType: "hwpx", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30531
30590
  }
30532
30591
  }
30533
30592
  async function parseHwp(buffer, options) {
30534
30593
  try {
30535
30594
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
30536
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _558 => _558.filePath])) {
30595
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _563 => _563.filePath])) {
30537
30596
  try {
30538
30597
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
30539
30598
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -30550,15 +30609,15 @@ async function parseHwp(buffer, options) {
30550
30609
  } catch (e34) {
30551
30610
  }
30552
30611
  }
30553
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _559 => _559.length]) ? images : void 0 };
30612
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _564 => _564.length]) ? images : void 0 };
30554
30613
  } catch (err) {
30555
- return { success: false, fileType: "hwp", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30614
+ return { success: false, fileType: "hwp", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30556
30615
  }
30557
30616
  }
30558
30617
  async function parsePdf(buffer, options) {
30559
30618
  let parsePdfDocument;
30560
30619
  try {
30561
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-MRM6WICO.cjs")));
30620
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-VQIJPCI5.cjs")));
30562
30621
  parsePdfDocument = mod.parsePdfDocument;
30563
30622
  } catch (e35) {
30564
30623
  return {
@@ -30573,7 +30632,7 @@ async function parsePdf(buffer, options) {
30573
30632
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary, images };
30574
30633
  } catch (err) {
30575
30634
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
30576
- return { success: false, fileType: "pdf", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err), isImageBased };
30635
+ return { success: false, fileType: "pdf", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err), isImageBased };
30577
30636
  }
30578
30637
  }
30579
30638
  async function parseXlsx(buffer, options) {
@@ -30581,7 +30640,7 @@ async function parseXlsx(buffer, options) {
30581
30640
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
30582
30641
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
30583
30642
  } catch (err) {
30584
- return { success: false, fileType: "xlsx", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30643
+ return { success: false, fileType: "xlsx", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30585
30644
  }
30586
30645
  }
30587
30646
  async function parseXls(buffer, options) {
@@ -30589,15 +30648,15 @@ async function parseXls(buffer, options) {
30589
30648
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
30590
30649
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
30591
30650
  } catch (err) {
30592
- return { success: false, fileType: "xls", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30651
+ return { success: false, fileType: "xls", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30593
30652
  }
30594
30653
  }
30595
30654
  async function parseDocx(buffer, options) {
30596
30655
  try {
30597
30656
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
30598
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _560 => _560.length]) ? images : void 0 };
30657
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _565 => _565.length]) ? images : void 0 };
30599
30658
  } catch (err) {
30600
- return { success: false, fileType: "docx", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30659
+ return { success: false, fileType: "docx", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30601
30660
  }
30602
30661
  }
30603
30662
  async function parseHwpml(buffer, options) {
@@ -30605,16 +30664,16 @@ async function parseHwpml(buffer, options) {
30605
30664
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
30606
30665
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
30607
30666
  } catch (err) {
30608
- return { success: false, fileType: "hwpml", error: _chunkKKZATKQWcjs.sanitizeError.call(void 0, err), code: _chunkKKZATKQWcjs.classifyError.call(void 0, err) };
30667
+ return { success: false, fileType: "hwpml", error: _chunkCWP56BRCcjs.sanitizeError.call(void 0, err), code: _chunkCWP56BRCcjs.classifyError.call(void 0, err) };
30609
30668
  }
30610
30669
  }
30611
30670
  async function fillForm(input, values, outputFormat = "markdown") {
30612
30671
  let buffer;
30613
30672
  if (typeof input === "string") {
30614
30673
  const buf = await _promises.readFile.call(void 0, input);
30615
- buffer = _chunkKKZATKQWcjs.toArrayBuffer.call(void 0, buf);
30674
+ buffer = _chunkCWP56BRCcjs.toArrayBuffer.call(void 0, buf);
30616
30675
  } else if (Buffer.isBuffer(input)) {
30617
- buffer = _chunkKKZATKQWcjs.toArrayBuffer.call(void 0, input);
30676
+ buffer = _chunkCWP56BRCcjs.toArrayBuffer.call(void 0, input);
30618
30677
  } else {
30619
30678
  buffer = input;
30620
30679
  }
@@ -30640,7 +30699,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
30640
30699
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
30641
30700
  }
30642
30701
  const fill = fillFormFields(parsed.blocks, values);
30643
- const markdown = _chunkWMU2KJHFcjs.blocksToMarkdown.call(void 0, fill.blocks);
30702
+ const markdown = _chunk5AXGFJQOcjs.blocksToMarkdown.call(void 0, fill.blocks);
30644
30703
  if (outputFormat === "hwpx") {
30645
30704
  const hwpxBuffer = await markdownToHwpx(markdown);
30646
30705
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -30714,5 +30773,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
30714
30773
 
30715
30774
 
30716
30775
 
30717
- exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkKKZATKQWcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunkWMU2KJHFcjs.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.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
30776
+ exports.DEFAULT_REDACT_RULES = DEFAULT_REDACT_RULES; exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkCWP56BRCcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToChunks = blocksToChunks; exports.blocksToMarkdown = _chunk5AXGFJQOcjs.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.parseImage = parseImage; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.redactMarkdown = redactMarkdown; exports.redactText = redactText; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.unknownFontWarnings = unknownFontWarnings; exports.validateHwpx = validateHwpx;
30718
30777
  //# sourceMappingURL=index.cjs.map