kordoc 3.16.2 → 3.17.0

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 (51) hide show
  1. package/README.md +32 -12
  2. package/dist/{-C4FVXHIP.js → -3KPDRR3A.js} +7 -7
  3. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  4. package/dist/{chunk-EJ2ZIYTO.js → chunk-E6NQWOFQ.js} +2 -2
  5. package/dist/{chunk-72LLOLFX.cjs → chunk-EL2Y4BL2.cjs} +2 -2
  6. package/dist/chunk-EL2Y4BL2.cjs.map +1 -0
  7. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  8. package/dist/{chunk-4WI7QXEG.js → chunk-HVEEFHN7.js} +2 -2
  9. package/dist/{chunk-HECUYZZK.js → chunk-NKICMZ7F.js} +79 -3
  10. package/dist/chunk-NKICMZ7F.js.map +1 -0
  11. package/dist/{chunk-E4Y73XRH.js → chunk-SADQWCWR.js} +127 -68
  12. package/dist/chunk-SADQWCWR.js.map +1 -0
  13. package/dist/{chunk-WR5LHRXO.js → chunk-TDIDUEBH.js} +3 -3
  14. package/dist/{chunk-EUEKDZ7O.js → chunk-VUS6LRVY.js} +7 -7
  15. package/dist/{chunk-IS3IK7UT.js → chunk-WHMNPQXW.js} +2 -2
  16. package/dist/cli.js +12 -12
  17. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  18. package/dist/index.cjs +393 -258
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +3 -2
  21. package/dist/index.d.ts +3 -2
  22. package/dist/index.js +203 -68
  23. package/dist/index.js.map +1 -1
  24. package/dist/mcp.js +8 -8
  25. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  26. package/dist/{parser-CMPNM6ZL.js → parser-CYJMOXUR.js} +3 -3
  27. package/dist/{parser-YVRTKGKO.cjs → parser-I5GC4QQ5.cjs} +14 -14
  28. package/dist/parser-I5GC4QQ5.cjs.map +1 -0
  29. package/dist/{parser-GWL72XYS.js → parser-LHBXIKXX.js} +2 -2
  30. package/dist/provider-G4C2V2PD.cjs.map +1 -1
  31. package/dist/render-HY7KKYPV.js +10 -0
  32. package/dist/seal-ITGYHENO.js +10 -0
  33. package/dist/{watch-WLI6K3IR.js → watch-VT7BSLNI.js} +7 -7
  34. package/package.json +1 -1
  35. package/dist/chunk-72LLOLFX.cjs.map +0 -1
  36. package/dist/chunk-E4Y73XRH.js.map +0 -1
  37. package/dist/chunk-HECUYZZK.js.map +0 -1
  38. package/dist/parser-YVRTKGKO.cjs.map +0 -1
  39. package/dist/render-A2LFMJCP.js +0 -10
  40. package/dist/seal-KA4VAV2Z.js +0 -10
  41. /package/dist/{-C4FVXHIP.js.map → -3KPDRR3A.js.map} +0 -0
  42. /package/dist/{chunk-EJ2ZIYTO.js.map → chunk-E6NQWOFQ.js.map} +0 -0
  43. /package/dist/{chunk-4WI7QXEG.js.map → chunk-HVEEFHN7.js.map} +0 -0
  44. /package/dist/{chunk-WR5LHRXO.js.map → chunk-TDIDUEBH.js.map} +0 -0
  45. /package/dist/{chunk-EUEKDZ7O.js.map → chunk-VUS6LRVY.js.map} +0 -0
  46. /package/dist/{chunk-IS3IK7UT.js.map → chunk-WHMNPQXW.js.map} +0 -0
  47. /package/dist/{parser-CMPNM6ZL.js.map → parser-CYJMOXUR.js.map} +0 -0
  48. /package/dist/{parser-GWL72XYS.js.map → parser-LHBXIKXX.js.map} +0 -0
  49. /package/dist/{render-A2LFMJCP.js.map → render-HY7KKYPV.js.map} +0 -0
  50. /package/dist/{seal-KA4VAV2Z.js.map → seal-ITGYHENO.js.map} +0 -0
  51. /package/dist/{watch-WLI6K3IR.js.map → watch-VT7BSLNI.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunk72LLOLFXcjs = require('./chunk-72LLOLFX.cjs');
22
+ var _chunkEL2Y4BL2cjs = require('./chunk-EL2Y4BL2.cjs');
23
23
 
24
24
 
25
25
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -405,7 +405,7 @@ function createSectionShared() {
405
405
  function createXmlParser(warnings) {
406
406
  return new (0, _xmldom.DOMParser)({
407
407
  onError(level, msg2) {
408
- if (level === "fatalError") throw new (0, _chunk72LLOLFXcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
408
+ if (level === "fatalError") throw new (0, _chunkEL2Y4BL2cjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
409
409
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
410
410
  }
411
411
  });
@@ -460,10 +460,10 @@ async function extractHwpxStyles(zip, decompressed) {
460
460
  const xml = await file.async("text");
461
461
  if (decompressed) {
462
462
  decompressed.total += xml.length * 2;
463
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
463
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
464
464
  }
465
465
  const parser = createXmlParser();
466
- const doc = parser.parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, xml), "text/xml");
466
+ const doc = parser.parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, xml), "text/xml");
467
467
  if (!doc.documentElement) continue;
468
468
  parseCharProperties(doc, result.charProperties);
469
469
  parseStyleElements(doc, result.styles);
@@ -615,9 +615,9 @@ function detectHwpxHeadings(blocks, styleMap) {
615
615
  let level = 0;
616
616
  if (baseFontSize > 0 && _optionalChain([block, 'access', _7 => _7.style, 'optionalAccess', _8 => _8.fontSize])) {
617
617
  const ratio = block.style.fontSize / baseFontSize;
618
- if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H1) level = 1;
619
- else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H2) level = 2;
620
- else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H3) level = 3;
618
+ if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H1) level = 1;
619
+ else if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H2) level = 2;
620
+ else if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H3) level = 3;
621
621
  }
622
622
  const compactText = text.replace(/\s+/g, "");
623
623
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1194,7 +1194,7 @@ function resolveParaHeading(paraEl, ctx) {
1194
1194
 
1195
1195
  // src/hwpx/table-build.ts
1196
1196
  function buildTableWithCellMeta(state) {
1197
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, state.rows);
1197
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, state.rows);
1198
1198
  if (state.caption) table.caption = state.caption;
1199
1199
  const anchors = [];
1200
1200
  {
@@ -1264,7 +1264,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1264
1264
  const cell = parentTable.cell;
1265
1265
  (cell.blocks ??= []).push(block);
1266
1266
  cell.hasStructure = true;
1267
- let flat = _chunk72LLOLFXcjs.convertTableToText.call(void 0, newTable.rows);
1267
+ let flat = _chunkEL2Y4BL2cjs.convertTableToText.call(void 0, newTable.rows);
1268
1268
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1269
1269
  if (flat) cell.text += (cell.text ? "\n" : "") + flat;
1270
1270
  } else {
@@ -1276,7 +1276,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1276
1276
  // src/hwpx/section-walker.ts
1277
1277
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1278
1278
  const parser = createXmlParser(warnings);
1279
- const doc = parser.parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, xml), "text/xml");
1279
+ const doc = parser.parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, xml), "text/xml");
1280
1280
  if (!doc.documentElement) return [];
1281
1281
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1282
1282
  ctx.shared.track.deleteDepth = 0;
@@ -1367,8 +1367,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1367
1367
  const cs = isNaN(rawCs) ? 1 : rawCs;
1368
1368
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1369
1369
  const rs = isNaN(rawRs) ? 1 : rawRs;
1370
- tableCtx.cell.colSpan = clampSpan(cs, _chunk72LLOLFXcjs.MAX_COLS);
1371
- tableCtx.cell.rowSpan = clampSpan(rs, _chunk72LLOLFXcjs.MAX_ROWS);
1370
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkEL2Y4BL2cjs.MAX_COLS);
1371
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkEL2Y4BL2cjs.MAX_ROWS);
1372
1372
  }
1373
1373
  break;
1374
1374
  case "p": {
@@ -1590,7 +1590,7 @@ function extractHyperlinkHref(fieldBegin) {
1590
1590
  let url = (ch.textContent || "").trim();
1591
1591
  if (!url) continue;
1592
1592
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1593
- const safe = _chunk72LLOLFXcjs.sanitizeHref.call(void 0, url);
1593
+ const safe = _chunkEL2Y4BL2cjs.sanitizeHref.call(void 0, url);
1594
1594
  if (safe) return safe;
1595
1595
  }
1596
1596
  return void 0;
@@ -1725,7 +1725,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1725
1725
  case "hyperlink": {
1726
1726
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
1727
1727
  if (url) {
1728
- const safe = _chunk72LLOLFXcjs.sanitizeHref.call(void 0, url);
1728
+ const safe = _chunkEL2Y4BL2cjs.sanitizeHref.call(void 0, url);
1729
1729
  if (safe) href = safe;
1730
1730
  }
1731
1731
  walk(child);
@@ -1911,13 +1911,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1911
1911
  }
1912
1912
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
1913
1913
  for (const path of allCandidates) {
1914
- if (_chunk72LLOLFXcjs.isPathTraversal.call(void 0, path)) continue;
1914
+ if (_chunkEL2Y4BL2cjs.isPathTraversal.call(void 0, path)) continue;
1915
1915
  const file = zip.file(path);
1916
1916
  if (!file) continue;
1917
1917
  try {
1918
1918
  const data = await file.async("uint8array");
1919
1919
  decompressed.total += data.length;
1920
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1920
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1921
1921
  const ext = path.includes(".") ? path.split(".").pop() || "png" : "png";
1922
1922
  const mimeType = imageExtToMime(ext);
1923
1923
  imageIndex++;
@@ -1926,7 +1926,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1926
1926
  images.push(img);
1927
1927
  break;
1928
1928
  } catch (err) {
1929
- if (err instanceof _chunk72LLOLFXcjs.KordocError) throw err;
1929
+ if (err instanceof _chunkEL2Y4BL2cjs.KordocError) throw err;
1930
1930
  }
1931
1931
  }
1932
1932
  if (!img) _optionalChain([warnings, 'optionalAccess', _38 => _38.push, 'call', _39 => _39({ page: block.pageNumber, message: `\uC774\uBBF8\uC9C0 \uD30C\uC77C \uC5C6\uC74C: ${ref}`, code: "SKIPPED_IMAGE" })]);
@@ -1988,7 +1988,7 @@ function extractFromBrokenZip(buffer) {
1988
1988
  }
1989
1989
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
1990
1990
  const name = new TextDecoder().decode(nameBytes);
1991
- if (_chunk72LLOLFXcjs.isPathTraversal.call(void 0, name)) {
1991
+ if (_chunkEL2Y4BL2cjs.isPathTraversal.call(void 0, name)) {
1992
1992
  pos = fileStart + compSize;
1993
1993
  continue;
1994
1994
  }
@@ -2006,16 +2006,16 @@ function extractFromBrokenZip(buffer) {
2006
2006
  continue;
2007
2007
  }
2008
2008
  totalDecompressed += content.length * 2;
2009
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2009
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
2010
2010
  sectionNum++;
2011
2011
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
2012
2012
  } catch (e13) {
2013
2013
  continue;
2014
2014
  }
2015
2015
  }
2016
- if (blocks.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2016
+ if (blocks.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2017
2017
  applyPageText(blocks, shared);
2018
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
2018
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
2019
2019
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
2020
2020
  }
2021
2021
  async function resolveSectionPaths(zip) {
@@ -2029,18 +2029,18 @@ async function resolveSectionPaths(zip) {
2029
2029
  if (paths.length > 0) return paths;
2030
2030
  }
2031
2031
  const sectionFiles = zip.file(/[Ss]ection\d+\.xml$/);
2032
- return sectionFiles.map((f) => f.name).sort(_chunk72LLOLFXcjs.compareSectionPaths);
2032
+ return sectionFiles.map((f) => f.name).sort(_chunkEL2Y4BL2cjs.compareSectionPaths);
2033
2033
  }
2034
2034
  function parseSectionPathsFromManifest(xml) {
2035
2035
  const parser = createXmlParser();
2036
- const doc = parser.parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, xml), "text/xml");
2036
+ const doc = parser.parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, xml), "text/xml");
2037
2037
  const items = doc.getElementsByTagName("opf:item");
2038
2038
  const spine = doc.getElementsByTagName("opf:itemref");
2039
2039
  const idToHref = /* @__PURE__ */ new Map();
2040
2040
  for (let i = 0; i < items.length; i++) {
2041
2041
  const item = items[i];
2042
2042
  const id = item.getAttribute("id") || "";
2043
- const href = _chunk72LLOLFXcjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2043
+ const href = _chunkEL2Y4BL2cjs.normalizeSectionHref.call(void 0, item.getAttribute("href") || "");
2044
2044
  if (id && href) idToHref.set(id, href);
2045
2045
  }
2046
2046
  if (spine.length > 0) {
@@ -2051,7 +2051,7 @@ function parseSectionPathsFromManifest(xml) {
2051
2051
  }
2052
2052
  if (ordered.length > 0) return ordered;
2053
2053
  }
2054
- return Array.from(idToHref.values()).sort(_chunk72LLOLFXcjs.compareSectionPaths);
2054
+ return Array.from(idToHref.values()).sort(_chunkEL2Y4BL2cjs.compareSectionPaths);
2055
2055
  }
2056
2056
 
2057
2057
  // src/hwpx/metadata.ts
@@ -2064,7 +2064,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2064
2064
  const xml = await file.async("text");
2065
2065
  if (decompressed) {
2066
2066
  decompressed.total += xml.length * 2;
2067
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2067
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2068
2068
  }
2069
2069
  parseDublinCoreMetadata(xml, metadata);
2070
2070
  if (metadata.title || metadata.author) return;
@@ -2074,7 +2074,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
2074
2074
  }
2075
2075
  function parseDublinCoreMetadata(xml, metadata) {
2076
2076
  const parser = createXmlParser();
2077
- const doc = parser.parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, xml), "text/xml");
2077
+ const doc = parser.parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, xml), "text/xml");
2078
2078
  if (!doc.documentElement) return;
2079
2079
  const getText = (tagNames) => {
2080
2080
  for (const tag of tagNames) {
@@ -2099,7 +2099,7 @@ function parseDublinCoreMetadata(xml, metadata) {
2099
2099
 
2100
2100
  // src/hwpx/parser.ts
2101
2101
  async function parseHwpxDocument(buffer, options) {
2102
- _chunk72LLOLFXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2102
+ _chunkEL2Y4BL2cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
2103
2103
  let zip;
2104
2104
  try {
2105
2105
  zip = await _jszip2.default.loadAsync(buffer);
@@ -2108,7 +2108,7 @@ async function parseHwpxDocument(buffer, options) {
2108
2108
  }
2109
2109
  const actualEntryCount = Object.keys(zip.files).length;
2110
2110
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
2111
- throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2111
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2112
2112
  }
2113
2113
  const manifestFile = zip.file("META-INF/manifest.xml");
2114
2114
  if (manifestFile) {
@@ -2120,7 +2120,7 @@ async function parseHwpxDocument(buffer, options) {
2120
2120
  return comResultToParseResult(pages, pageCount, warnings2);
2121
2121
  }
2122
2122
  }
2123
- throw new (0, _chunk72LLOLFXcjs.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.");
2123
+ throw new (0, _chunkEL2Y4BL2cjs.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.");
2124
2124
  }
2125
2125
  }
2126
2126
  const decompressed = { total: 0 };
@@ -2129,7 +2129,7 @@ async function parseHwpxDocument(buffer, options) {
2129
2129
  const styleMap = await extractHwpxStyles(zip, decompressed);
2130
2130
  const warnings = [];
2131
2131
  const sectionPaths = await resolveSectionPaths(zip);
2132
- if (sectionPaths.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2132
+ if (sectionPaths.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
2133
2133
  metadata.pageCount = sectionPaths.length;
2134
2134
  const pageFilter = _optionalChain([options, 'optionalAccess', _45 => _45.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
2135
2135
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
@@ -2143,12 +2143,12 @@ async function parseHwpxDocument(buffer, options) {
2143
2143
  try {
2144
2144
  const xml = await file.async("text");
2145
2145
  decompressed.total += xml.length * 2;
2146
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2146
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
2147
2147
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
2148
2148
  parsedSections++;
2149
2149
  _optionalChain([options, 'optionalAccess', _46 => _46.onProgress, 'optionalCall', _47 => _47(parsedSections, totalTarget)]);
2150
2150
  } catch (secErr) {
2151
- if (secErr instanceof _chunk72LLOLFXcjs.KordocError) throw secErr;
2151
+ if (secErr instanceof _chunkEL2Y4BL2cjs.KordocError) throw secErr;
2152
2152
  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" });
2153
2153
  }
2154
2154
  }
@@ -2156,7 +2156,7 @@ async function parseHwpxDocument(buffer, options) {
2156
2156
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
2157
2157
  detectHwpxHeadings(blocks, styleMap);
2158
2158
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
2159
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
2159
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
2160
2160
  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 };
2161
2161
  }
2162
2162
 
@@ -2223,7 +2223,7 @@ function decompressStream(data) {
2223
2223
  return _zlib.inflateRawSync.call(void 0, data, opts);
2224
2224
  }
2225
2225
  function parseFileHeader(data) {
2226
- if (data.length < 40) throw new (0, _chunk72LLOLFXcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2226
+ if (data.length < 40) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2227
2227
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2228
2228
  return {
2229
2229
  signature: sig,
@@ -3756,7 +3756,7 @@ function parseHwp5Document(buffer, options) {
3756
3756
  lenientCfb = parseLenientCfb(buffer);
3757
3757
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
3758
3758
  } catch (e21) {
3759
- throw new (0, _chunk72LLOLFXcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3759
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3760
3760
  }
3761
3761
  }
3762
3762
  const findStream = (path) => {
@@ -3767,11 +3767,11 @@ function parseHwp5Document(buffer, options) {
3767
3767
  return lenientCfb.findStream(path);
3768
3768
  };
3769
3769
  const headerData = findStream("/FileHeader");
3770
- if (!headerData) throw new (0, _chunk72LLOLFXcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3770
+ if (!headerData) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3771
3771
  const header = parseFileHeader(headerData);
3772
- if (header.signature !== "HWP Document File") throw new (0, _chunk72LLOLFXcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3773
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3774
- if (header.flags & FLAG_DRM) throw new (0, _chunk72LLOLFXcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3772
+ if (header.signature !== "HWP Document File") throw new (0, _chunkEL2Y4BL2cjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3773
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3774
+ if (header.flags & FLAG_DRM) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3775
3775
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
3776
3776
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
3777
3777
  const metadata = {
@@ -3780,7 +3780,7 @@ function parseHwp5Document(buffer, options) {
3780
3780
  if (cfb) extractHwp5Metadata(cfb, metadata);
3781
3781
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
3782
3782
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
3783
- if (sections.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3783
+ if (sections.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3784
3784
  metadata.pageCount = sections.length;
3785
3785
  const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3786
3786
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
@@ -3794,25 +3794,25 @@ function parseHwp5Document(buffer, options) {
3794
3794
  const sectionData = sections[si];
3795
3795
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
3796
3796
  totalDecompressed += data.length;
3797
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3797
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3798
3798
  const records = readRecords(data);
3799
3799
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
3800
3800
  bodyBlocks.push(...sectionBlocks);
3801
3801
  parsedSections++;
3802
3802
  _optionalChain([options, 'optionalAccess', _52 => _52.onProgress, 'optionalCall', _53 => _53(parsedSections, totalTarget)]);
3803
3803
  } catch (secErr) {
3804
- if (secErr instanceof _chunk72LLOLFXcjs.KordocError) throw secErr;
3804
+ if (secErr instanceof _chunkEL2Y4BL2cjs.KordocError) throw secErr;
3805
3805
  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" });
3806
3806
  }
3807
3807
  }
3808
3808
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
3809
3809
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
3810
- const flatBlocks = _chunk72LLOLFXcjs.flattenLayoutTables.call(void 0, blocks);
3810
+ const flatBlocks = _chunkEL2Y4BL2cjs.flattenLayoutTables.call(void 0, blocks);
3811
3811
  if (docInfo) {
3812
3812
  detectHwp5Headings(flatBlocks, docInfo);
3813
3813
  }
3814
3814
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3815
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, flatBlocks);
3815
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, flatBlocks);
3816
3816
  return { markdown, blocks: flatBlocks, metadata, outline: outline.length > 0 ? outline : void 0, warnings: warnings.length > 0 ? warnings : void 0, images: images.length > 0 ? images : void 0 };
3817
3817
  }
3818
3818
  function parseDocInfoStream(cfb, compressed) {
@@ -3872,9 +3872,9 @@ function detectHwp5Headings(blocks, docInfo) {
3872
3872
  let level = 0;
3873
3873
  if (_optionalChain([block, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && baseFontSize > 0) {
3874
3874
  const ratio = block.style.fontSize / baseFontSize;
3875
- if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H1) level = 1;
3876
- else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H2) level = 2;
3877
- else if (ratio >= _chunk72LLOLFXcjs.HEADING_RATIO_H3) level = 3;
3875
+ if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H1) level = 1;
3876
+ else if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H2) level = 2;
3877
+ else if (ratio >= _chunkEL2Y4BL2cjs.HEADING_RATIO_H3) level = 3;
3878
3878
  }
3879
3879
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
3880
3880
  if (level === 0) level = 2;
@@ -3959,7 +3959,7 @@ function findSectionsLenient(lcfb, compressed) {
3959
3959
  if (!raw) break;
3960
3960
  const content = compressed ? decompressStream(raw) : raw;
3961
3961
  totalDecompressed += content.length;
3962
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3962
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3963
3963
  sections.push({ idx: i, content });
3964
3964
  }
3965
3965
  if (sections.length === 0) {
@@ -3971,7 +3971,7 @@ function findSectionsLenient(lcfb, compressed) {
3971
3971
  if (raw) {
3972
3972
  const content = compressed ? decompressStream(raw) : raw;
3973
3973
  totalDecompressed += content.length;
3974
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3974
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3975
3975
  sections.push({ idx, content });
3976
3976
  }
3977
3977
  }
@@ -3988,7 +3988,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
3988
3988
  try {
3989
3989
  const content = decryptViewText(raw, compressed);
3990
3990
  totalDecompressed += content.length;
3991
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3991
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3992
3992
  sections.push({ idx: i, content });
3993
3993
  } catch (e26) {
3994
3994
  break;
@@ -4091,7 +4091,7 @@ function parseParagraph(records, start, end, ctx) {
4091
4091
  const ctrl = ctrls[r.ctrlIdx];
4092
4092
  if (!_optionalChain([ctrl, 'optionalAccess', _66 => _66.href]) || r.end <= r.start) continue;
4093
4093
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
4094
- const href = _chunk72LLOLFXcjs.sanitizeHref.call(void 0, ctrl.href);
4094
+ const href = _chunkEL2Y4BL2cjs.sanitizeHref.call(void 0, ctrl.href);
4095
4095
  if (!href) continue;
4096
4096
  const anchor = text.slice(r.start, r.end);
4097
4097
  if (!anchor.trim()) continue;
@@ -4324,8 +4324,8 @@ function parseTableControl(ctrl, records, ctx) {
4324
4324
  let tableIdx = -1;
4325
4325
  for (let i2 = childStart; i2 < childEnd; i2++) {
4326
4326
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4327
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunk72LLOLFXcjs.MAX_ROWS);
4328
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunk72LLOLFXcjs.MAX_COLS);
4327
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkEL2Y4BL2cjs.MAX_ROWS);
4328
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkEL2Y4BL2cjs.MAX_COLS);
4329
4329
  tableIdx = i2;
4330
4330
  break;
4331
4331
  }
@@ -4374,7 +4374,7 @@ function parseTableControl(ctrl, records, ctx) {
4374
4374
  return table2;
4375
4375
  }
4376
4376
  const cellRows = arrangeCells(rows, cols, cells);
4377
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, cellRows);
4377
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, cellRows);
4378
4378
  if (caption && table.rows > 0) table.caption = caption;
4379
4379
  return table.rows > 0 ? table : null;
4380
4380
  }
@@ -4391,8 +4391,8 @@ function parseCell(records, lhIdx, end, ctx) {
4391
4391
  rowAddr = rec.data.readUInt16LE(10);
4392
4392
  const cs = rec.data.readUInt16LE(12);
4393
4393
  const rs = rec.data.readUInt16LE(14);
4394
- if (cs > 0) colSpan = Math.min(cs, _chunk72LLOLFXcjs.MAX_COLS);
4395
- if (rs > 0) rowSpan = Math.min(rs, _chunk72LLOLFXcjs.MAX_ROWS);
4394
+ if (cs > 0) colSpan = Math.min(cs, _chunkEL2Y4BL2cjs.MAX_COLS);
4395
+ if (rs > 0) rowSpan = Math.min(rs, _chunkEL2Y4BL2cjs.MAX_ROWS);
4396
4396
  }
4397
4397
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4398
4398
  const parts = [];
@@ -4402,7 +4402,7 @@ function parseCell(records, lhIdx, end, ctx) {
4402
4402
  parts.push(`![image](hwp5bin:${b.text})`);
4403
4403
  hasStructure = true;
4404
4404
  } else if (b.type === "table" && b.table) {
4405
- const flat = _chunk72LLOLFXcjs.convertTableToText.call(void 0, b.table.cells);
4405
+ const flat = _chunkEL2Y4BL2cjs.convertTableToText.call(void 0, b.table.cells);
4406
4406
  if (flat) parts.push(flat);
4407
4407
  hasStructure = true;
4408
4408
  } else if (b.text) {
@@ -16839,7 +16839,7 @@ function getTextContent(el) {
16839
16839
  return _nullishCoalesce(_optionalChain([el, 'access', _81 => _81.textContent, 'optionalAccess', _82 => _82.trim, 'call', _83 => _83()]), () => ( ""));
16840
16840
  }
16841
16841
  function parseXml(text) {
16842
- return new (0, _xmldom.DOMParser)().parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, text), "text/xml");
16842
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, text), "text/xml");
16843
16843
  }
16844
16844
  function parseSharedStrings(xml) {
16845
16845
  const doc = parseXml(xml);
@@ -16983,7 +16983,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16983
16983
  cellRows.push(row);
16984
16984
  }
16985
16985
  if (cellRows.length > 0) {
16986
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, cellRows);
16986
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, cellRows);
16987
16987
  if (table.rows > 0) {
16988
16988
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
16989
16989
  }
@@ -16991,12 +16991,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16991
16991
  return blocks;
16992
16992
  }
16993
16993
  async function parseXlsxDocument(buffer, options) {
16994
- _chunk72LLOLFXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16994
+ _chunkEL2Y4BL2cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16995
16995
  const zip = await _jszip2.default.loadAsync(buffer);
16996
16996
  const warnings = [];
16997
16997
  const workbookFile = zip.file("xl/workbook.xml");
16998
16998
  if (!workbookFile) {
16999
- throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16999
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
17000
17000
  }
17001
17001
  let sharedStrings = [];
17002
17002
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -17005,7 +17005,7 @@ async function parseXlsxDocument(buffer, options) {
17005
17005
  }
17006
17006
  const sheets = parseWorkbook(await workbookFile.async("text"));
17007
17007
  if (sheets.length === 0) {
17008
- throw new (0, _chunk72LLOLFXcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17008
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
17009
17009
  }
17010
17010
  let relsMap = /* @__PURE__ */ new Map();
17011
17011
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -17077,7 +17077,7 @@ async function parseXlsxDocument(buffer, options) {
17077
17077
  } catch (e27) {
17078
17078
  }
17079
17079
  }
17080
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
17080
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
17081
17081
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
17082
17082
  }
17083
17083
 
@@ -17484,11 +17484,11 @@ function processGlobals(records) {
17484
17484
  let encrypted = false;
17485
17485
  const firstBof = records[0];
17486
17486
  if (!firstBof || firstBof.opcode !== OP_BOF) {
17487
- throw new (0, _chunk72LLOLFXcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17487
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17488
17488
  }
17489
17489
  const bof = decodeBof(firstBof.data);
17490
17490
  if (!bof || bof.dt !== DT_GLOBALS) {
17491
- throw new (0, _chunk72LLOLFXcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17491
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17492
17492
  }
17493
17493
  let i = 1;
17494
17494
  while (i < records.length) {
@@ -17603,7 +17603,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
17603
17603
  cellRows.push(row);
17604
17604
  }
17605
17605
  if (cellRows.length > 0) {
17606
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, cellRows);
17606
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, cellRows);
17607
17607
  if (table.rows > 0) {
17608
17608
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
17609
17609
  }
@@ -17616,21 +17616,21 @@ async function parseXlsDocument(buffer, options) {
17616
17616
  try {
17617
17617
  cfb = parseLenientCfb(buf);
17618
17618
  } catch (e) {
17619
- throw new (0, _chunk72LLOLFXcjs.KordocError)(
17619
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(
17620
17620
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
17621
17621
  );
17622
17622
  }
17623
17623
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
17624
17624
  if (!wb) {
17625
- throw new (0, _chunk72LLOLFXcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17625
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17626
17626
  }
17627
17627
  const records = readRecords2(wb);
17628
17628
  if (records.length === 0) {
17629
- throw new (0, _chunk72LLOLFXcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17629
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17630
17630
  }
17631
17631
  const firstBof = decodeBof(records[0].data);
17632
17632
  if (firstBof && firstBof.vers !== 1536) {
17633
- throw new (0, _chunk72LLOLFXcjs.KordocError)(
17633
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(
17634
17634
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
17635
17635
  );
17636
17636
  }
@@ -17690,7 +17690,7 @@ async function parseXlsDocument(buffer, options) {
17690
17690
  pageCount: totalSheets
17691
17691
  };
17692
17692
  return {
17693
- markdown: _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, allBlocks),
17693
+ markdown: _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, allBlocks),
17694
17694
  blocks: allBlocks,
17695
17695
  metadata,
17696
17696
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18128,7 +18128,7 @@ function getAttr(el, localName2) {
18128
18128
  return null;
18129
18129
  }
18130
18130
  function parseXml2(text) {
18131
- return new (0, _xmldom.DOMParser)().parseFromString(_chunk72LLOLFXcjs.stripDtd.call(void 0, text), "text/xml");
18131
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkEL2Y4BL2cjs.stripDtd.call(void 0, text), "text/xml");
18132
18132
  }
18133
18133
  function parseStyles(xml) {
18134
18134
  const doc = parseXml2(xml);
@@ -18413,7 +18413,7 @@ ${cell.text}` : cell.text;
18413
18413
  return { text: cell.text, colSpan: cell.colSpan, rowSpan, colAddr: cell.col, rowAddr: r };
18414
18414
  })
18415
18415
  );
18416
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, cellRows);
18416
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, cellRows);
18417
18417
  if (table.rows === 0 || table.cols === 0) return null;
18418
18418
  return { type: "table", table };
18419
18419
  }
@@ -18480,12 +18480,12 @@ async function extractImages(zip, rels, doc, warnings) {
18480
18480
  return { blocks, images };
18481
18481
  }
18482
18482
  async function parseDocxDocument(buffer, options) {
18483
- _chunk72LLOLFXcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18483
+ _chunkEL2Y4BL2cjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18484
18484
  const zip = await _jszip2.default.loadAsync(buffer);
18485
18485
  const warnings = [];
18486
18486
  const docFile = zip.file("word/document.xml");
18487
18487
  if (!docFile) {
18488
- throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18488
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18489
18489
  }
18490
18490
  let rels = /* @__PURE__ */ new Map();
18491
18491
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -18532,7 +18532,7 @@ async function parseDocxDocument(buffer, options) {
18532
18532
  const doc = parseXml2(docXml);
18533
18533
  const body = findElements(doc, "body");
18534
18534
  if (body.length === 0) {
18535
- throw new (0, _chunk72LLOLFXcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18535
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18536
18536
  }
18537
18537
  const blocks = [];
18538
18538
  const bodyEl = body[0];
@@ -18577,7 +18577,7 @@ async function parseDocxDocument(buffer, options) {
18577
18577
  }
18578
18578
  }
18579
18579
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
18580
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
18580
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
18581
18581
  return {
18582
18582
  markdown,
18583
18583
  blocks,
@@ -18600,7 +18600,7 @@ function parseHwpmlDocument(buffer, options) {
18600
18600
  }
18601
18601
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
18602
18602
  const normalized = text.replace(/&nbsp;/g, "&#160;");
18603
- const xml = _chunk72LLOLFXcjs.stripDtd.call(void 0, normalized);
18603
+ const xml = _chunkEL2Y4BL2cjs.stripDtd.call(void 0, normalized);
18604
18604
  const warnings = [];
18605
18605
  const parser = new (0, _xmldom.DOMParser)({
18606
18606
  onError: (_level, msg2) => {
@@ -18640,7 +18640,7 @@ function parseHwpmlDocument(buffer, options) {
18640
18640
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
18641
18641
  }
18642
18642
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
18643
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
18643
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
18644
18644
  return {
18645
18645
  markdown,
18646
18646
  blocks,
@@ -18798,7 +18798,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
18798
18798
  const cellRows = grid.map(
18799
18799
  (row) => row.map((cell) => _nullishCoalesce(cell, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
18800
18800
  );
18801
- const table = _chunk72LLOLFXcjs.buildTable.call(void 0, cellRows);
18801
+ const table = _chunkEL2Y4BL2cjs.buildTable.call(void 0, cellRows);
18802
18802
  const caption = extractShapeCaption(el);
18803
18803
  if (caption.text && caption.before) {
18804
18804
  blocks.push({ type: "paragraph", text: caption.text, pageNumber: sectionNum });
@@ -20126,19 +20126,19 @@ function parseCentralDirectory(buf) {
20126
20126
  }
20127
20127
  }
20128
20128
  }
20129
- if (eocdOffset < 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20129
+ if (eocdOffset < 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20130
20130
  const totalEntries = view.getUint16(eocdOffset + 10, true);
20131
20131
  const cdSize = view.getUint32(eocdOffset + 12, true);
20132
20132
  const cdOffset = view.getUint32(eocdOffset + 16, true);
20133
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20133
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20134
20134
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
20135
- throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20135
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20136
20136
  }
20137
20137
  const decoder = new TextDecoder("utf-8");
20138
20138
  const entries = [];
20139
20139
  let pos = cdOffset;
20140
20140
  for (let i = 0; i < totalEntries; i++) {
20141
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
20141
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
20142
20142
  const flags = view.getUint16(pos + 8, true);
20143
20143
  const method = view.getUint16(pos + 10, true);
20144
20144
  const crc = view.getUint32(pos + 16, true);
@@ -20149,7 +20149,7 @@ function parseCentralDirectory(buf) {
20149
20149
  const commentLen = view.getUint16(pos + 32, true);
20150
20150
  const localOffset = view.getUint32(pos + 42, true);
20151
20151
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
20152
- throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20152
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
20153
20153
  }
20154
20154
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
20155
20155
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -20178,11 +20178,11 @@ function patchZipEntries(original, replacements, additions) {
20178
20178
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
20179
20179
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
20180
20180
  for (const name of replacements.keys()) {
20181
- if (!entries.some((e) => e.name === name)) throw new (0, _chunk72LLOLFXcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20181
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkEL2Y4BL2cjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20182
20182
  }
20183
20183
  if (additions) {
20184
20184
  for (const name of additions.keys()) {
20185
- if (entries.some((e) => e.name === name)) throw new (0, _chunk72LLOLFXcjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20185
+ if (entries.some((e) => e.name === name)) throw new (0, _chunkEL2Y4BL2cjs.KordocError)(`ZIP\uC5D0 \uC774\uBBF8 \uC788\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
20186
20186
  }
20187
20187
  }
20188
20188
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
@@ -20201,7 +20201,7 @@ function patchZipEntries(original, replacements, additions) {
20201
20201
  offset += seg.length;
20202
20202
  continue;
20203
20203
  }
20204
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunk72LLOLFXcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20204
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
20205
20205
  const nameLen = view.getUint16(e.localOffset + 26, true);
20206
20206
  const extraLen = view.getUint16(e.localOffset + 28, true);
20207
20207
  const headerLen = 30 + nameLen + extraLen;
@@ -20307,7 +20307,7 @@ async function fillHwpx(hwpxBuffer, values, blockedLabels) {
20307
20307
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
20308
20308
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
20309
20309
  if (sectionPaths.length === 0) {
20310
- throw new (0, _chunk72LLOLFXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20310
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
20311
20311
  }
20312
20312
  const normalizedValues = normalizeValues(values);
20313
20313
  const cursor = new ValueCursor(normalizedValues);
@@ -21901,7 +21901,7 @@ function escapeGfm(text) {
21901
21901
  }
21902
21902
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
21903
21903
  function sanitizeText(text) {
21904
- let result = _chunk72LLOLFXcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
21904
+ let result = _chunkEL2Y4BL2cjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
21905
21905
  if (result.length <= 30 && result.includes(" ")) {
21906
21906
  const tokens = result.split(" ");
21907
21907
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -22836,6 +22836,77 @@ var DEFAULT_PARA_GEOM = {
22836
22836
  spaceAfter: 0
22837
22837
  };
22838
22838
  var DEFAULT_CHAR = { height: 1e3, bold: false, italic: false, underline: false, ratio: 100, spacing: 0 };
22839
+ var FONT_ALIASES = {
22840
+ "\uD568\uCD08\uB86C\uBC14\uD0D5": "'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','\uD55C\uCEF4\uBC14\uD0D5'",
22841
+ "\uD55C\uCEF4\uBC14\uD0D5": "'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','\uD55C\uCEF4\uBC14\uD0D5'",
22842
+ "\uD568\uCD08\uB86C\uB3CB\uC6C0": "'HCR Dotum','\uD568\uCD08\uB86C\uB3CB\uC6C0','\uD55C\uCEF4\uB3CB\uC6C0'",
22843
+ "\uD55C\uCEF4\uB3CB\uC6C0": "'HCR Dotum','\uD568\uCD08\uB86C\uB3CB\uC6C0','\uD55C\uCEF4\uB3CB\uC6C0'",
22844
+ "\uB9D1\uC740 \uACE0\uB515": "'Malgun Gothic','\uB9D1\uC740 \uACE0\uB515'",
22845
+ "\uB9D1\uC740\uACE0\uB515": "'Malgun Gothic','\uB9D1\uC740 \uACE0\uB515'",
22846
+ "\uAD74\uB9BC": "'Gulim','\uAD74\uB9BC'",
22847
+ "\uAD74\uB9BC\uCCB4": "'GulimChe','\uAD74\uB9BC\uCCB4','Gulim'",
22848
+ "\uB3CB\uC6C0": "'Dotum','\uB3CB\uC6C0'",
22849
+ "\uB3CB\uC6C0\uCCB4": "'DotumChe','\uB3CB\uC6C0\uCCB4','Dotum'",
22850
+ "\uBC14\uD0D5": "'Batang','\uBC14\uD0D5'",
22851
+ "\uBC14\uD0D5\uCCB4": "'BatangChe','\uBC14\uD0D5\uCCB4','Batang'",
22852
+ "\uAD81\uC11C": "'Gungsuh','\uAD81\uC11C'",
22853
+ "\uAD81\uC11C\uCCB4": "'GungsuhChe','\uAD81\uC11C\uCCB4','Gungsuh'",
22854
+ "\uB098\uB214\uACE0\uB515": "'NanumGothic','\uB098\uB214\uACE0\uB515'",
22855
+ "\uB098\uB214\uBA85\uC870": "'NanumMyeongjo','\uB098\uB214\uBA85\uC870'",
22856
+ "\uB9D1\uC740 \uACE0\uB515 Semilight": "'Malgun Gothic Semilight','\uB9D1\uC740 \uACE0\uB515'"
22857
+ };
22858
+ function isSerifFace(face) {
22859
+ return /바탕|명조|Batang|Myeong|Mincho|궁서|Gungsuh|Serif|신명|순명|Song|송/i.test(face);
22860
+ }
22861
+ function cssQuote(name) {
22862
+ return /^[A-Za-z0-9_-]+$/.test(name) ? name : `'${name.replace(/['"\\]/g, "")}'`;
22863
+ }
22864
+ function hwpFaceToCssStack(face) {
22865
+ const trimmed = (_nullishCoalesce(face, () => ( ""))).trim();
22866
+ if (!trimmed) return "";
22867
+ const generic = isSerifFace(trimmed) ? "'HCR Batang','Batang','Noto Serif KR',serif" : "'Malgun Gothic','HCR Dotum','Noto Sans KR',sans-serif";
22868
+ const head = _nullishCoalesce(FONT_ALIASES[trimmed], () => ( cssQuote(trimmed)));
22869
+ return `${head},${generic}`;
22870
+ }
22871
+ function collectHangulFonts(root) {
22872
+ const map = /* @__PURE__ */ new Map();
22873
+ const findFaces = (el, depth) => {
22874
+ if (depth > 24) return null;
22875
+ for (const ch of Array.from(el.childNodes)) {
22876
+ if (ch.nodeType !== 1) continue;
22877
+ const e = ch;
22878
+ if ((e.tagName || "").replace(/^[^:]+:/, "") === "fontfaces") return e;
22879
+ const f = findFaces(e, depth + 1);
22880
+ if (f) return f;
22881
+ }
22882
+ return null;
22883
+ };
22884
+ const faces = findFaces(root, 0);
22885
+ if (!faces) return map;
22886
+ let group = null;
22887
+ let firstGroup = null;
22888
+ for (const ch of Array.from(faces.childNodes)) {
22889
+ if (ch.nodeType !== 1) continue;
22890
+ const e = ch;
22891
+ if ((e.tagName || "").replace(/^[^:]+:/, "") !== "fontface") continue;
22892
+ if (!firstGroup) firstGroup = e;
22893
+ if ((_nullishCoalesce(e.getAttribute("lang"), () => ( ""))).toUpperCase() === "HANGUL") {
22894
+ group = e;
22895
+ break;
22896
+ }
22897
+ }
22898
+ group = _nullishCoalesce(group, () => ( firstGroup));
22899
+ if (!group) return map;
22900
+ for (const ch of Array.from(group.childNodes)) {
22901
+ if (ch.nodeType !== 1) continue;
22902
+ const e = ch;
22903
+ if ((e.tagName || "").replace(/^[^:]+:/, "") !== "font") continue;
22904
+ const id = e.getAttribute("id");
22905
+ const face = e.getAttribute("face");
22906
+ if (id != null && face) map.set(id, face);
22907
+ }
22908
+ return map;
22909
+ }
22839
22910
  function borderWidthPt(v) {
22840
22911
  const n = parseFloat(_nullishCoalesce(v, () => ( "")));
22841
22912
  if (!Number.isFinite(n)) return 0.34;
@@ -22887,6 +22958,7 @@ function parseRenderStyles(headXml) {
22887
22958
  const doc = createXmlParser().parseFromString(headXml, "text/xml");
22888
22959
  const root = doc.documentElement;
22889
22960
  if (!root) return styles;
22961
+ const hangulFonts = collectHangulFonts(root);
22890
22962
  const walk = (el) => {
22891
22963
  const tag = (el.tagName || "").replace(/^[^:]+:/, "");
22892
22964
  if (tag === "charPr") {
@@ -22896,21 +22968,25 @@ function parseRenderStyles(headXml) {
22896
22968
  const spacingEl = findChildByLocalName(el, "spacing");
22897
22969
  const underlineEl = findChildByLocalName(el, "underline");
22898
22970
  const textColor = el.getAttribute("textColor");
22971
+ const fontRef = findChildByLocalName(el, "fontRef");
22972
+ const fontId = _nullishCoalesce(_optionalChain([fontRef, 'optionalAccess', _210 => _210.getAttribute, 'call', _211 => _211("hangul")]), () => ( _optionalChain([fontRef, 'optionalAccess', _212 => _212.getAttribute, 'call', _213 => _213("latin")])));
22973
+ const face = fontId != null ? hangulFonts.get(fontId) : void 0;
22899
22974
  styles.charPr.set(id, {
22900
22975
  height: Number(el.getAttribute("height")) || 1e3,
22901
22976
  bold: findChildByLocalName(el, "bold") != null,
22902
22977
  italic: findChildByLocalName(el, "italic") != null,
22903
22978
  underline: underlineEl != null && (_nullishCoalesce(underlineEl.getAttribute("type"), () => ( "NONE"))) !== "NONE",
22904
22979
  color: textColor && textColor !== "#000000" && textColor.toLowerCase() !== "none" ? textColor : void 0,
22905
- ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _210 => _210.getAttribute, 'call', _211 => _211("hangul")])) || 100,
22906
- spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _212 => _212.getAttribute, 'call', _213 => _213("hangul")])) || 0
22980
+ ratio: Number(_optionalChain([ratioEl, 'optionalAccess', _214 => _214.getAttribute, 'call', _215 => _215("hangul")])) || 100,
22981
+ spacing: Number(_optionalChain([spacingEl, 'optionalAccess', _216 => _216.getAttribute, 'call', _217 => _217("hangul")])) || 0,
22982
+ fontFamily: face ? hwpFaceToCssStack(face) : void 0
22907
22983
  });
22908
22984
  }
22909
22985
  } else if (tag === "paraPr") {
22910
22986
  const id = el.getAttribute("id");
22911
22987
  if (id != null) {
22912
22988
  const align = findChildByLocalName(el, "align");
22913
- styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _214 => _214.getAttribute, 'call', _215 => _215("horizontal")]) || "JUSTIFY");
22989
+ styles.paraAlign.set(id, _optionalChain([align, 'optionalAccess', _218 => _218.getAttribute, 'call', _219 => _219("horizontal")]) || "JUSTIFY");
22914
22990
  styles.paraGeom.set(id, parseParaGeom(el));
22915
22991
  }
22916
22992
  } else if (tag === "borderFill") {
@@ -22924,7 +23000,7 @@ function parseRenderStyles(headXml) {
22924
23000
  };
22925
23001
  const fillBrush = findChildByLocalName(el, "fillBrush");
22926
23002
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
22927
- const face = _optionalChain([winBrush, 'optionalAccess', _216 => _216.getAttribute, 'call', _217 => _217("faceColor")]);
23003
+ const face = _optionalChain([winBrush, 'optionalAccess', _220 => _220.getAttribute, 'call', _221 => _221("faceColor")]);
22928
23004
  if (face && face.toLowerCase() !== "none") bf.fill = face;
22929
23005
  styles.borderFill.set(id, bf);
22930
23006
  }
@@ -22996,7 +23072,7 @@ function collectSites(scan) {
22996
23072
  }
22997
23073
  function attrOf(openTag, name) {
22998
23074
  const m = openTag.match(new RegExp(`\\b${name}="([^"]*)"`));
22999
- return _optionalChain([m, 'optionalAccess', _218 => _218[1]]);
23075
+ return _optionalChain([m, 'optionalAccess', _222 => _222[1]]);
23000
23076
  }
23001
23077
  function paraOpenTag(xml, para) {
23002
23078
  const end = xml.indexOf(">", para.start);
@@ -23011,7 +23087,7 @@ function anchorRunInfo(xml, para, anchor) {
23011
23087
  if (!tr) return null;
23012
23088
  const before = xml.slice(Math.max(0, para.start), tr.contentStart);
23013
23089
  const runOpen = [...before.matchAll(/<([A-Za-z0-9]+):run\b[^>]*>/g)].pop();
23014
- const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _219 => _219[1]]), () => ( tr.prefix)), () => ( "hp"));
23090
+ const prefix = _nullishCoalesce(_nullishCoalesce(_optionalChain([runOpen, 'optionalAccess', _223 => _223[1]]), () => ( tr.prefix)), () => ( "hp"));
23015
23091
  const charPr2 = runOpen && attrOf(runOpen[0], "charPrIDRef") || "0";
23016
23092
  const close = xml.indexOf(`</${prefix}:run>`, tr.contentEnd);
23017
23093
  if (close === -1) return null;
@@ -23038,7 +23114,7 @@ function cellContentWidthMm(xml, cell) {
23038
23114
  if (width === null) return null;
23039
23115
  let content = width;
23040
23116
  const win = cellAddrWindow(xml, cell);
23041
- const mg = _optionalChain([win, 'optionalAccess', _220 => _220.match, 'call', _221 => _221(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
23117
+ const mg = _optionalChain([win, 'optionalAccess', _224 => _224.match, 'call', _225 => _225(/<[A-Za-z0-9]+:cellMargin\b[^>]*>/)]);
23042
23118
  if (mg) {
23043
23119
  content -= Number(_nullishCoalesce(attrOf(mg[0], "left"), () => ( 0))) + Number(_nullishCoalesce(attrOf(mg[0], "right"), () => ( 0)));
23044
23120
  }
@@ -23072,11 +23148,11 @@ function buildFloatPicXml(itemId, sizeHu, posXHu, posYHu, ids) {
23072
23148
  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>`;
23073
23149
  }
23074
23150
  async function placeSealHwpx(hwpxBuffer, ops) {
23075
- if (ops.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
23151
+ if (ops.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("place_seal: \uBC30\uCE58\uD560 \uB3C4\uC7A5\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
23076
23152
  const u8 = new Uint8Array(hwpxBuffer);
23077
23153
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
23078
- const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _222 => _222.match, 'call', _223 => _223(/(\d+)\.xml$/i), 'optionalAccess', _224 => _224[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _225 => _225.match, 'call', _226 => _226(/(\d+)\.xml$/i), 'optionalAccess', _227 => _227[1]]), () => ( 0))));
23079
- if (sectionPaths.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
23154
+ const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort((a, b) => Number(_nullishCoalesce(_optionalChain([a, 'access', _226 => _226.match, 'call', _227 => _227(/(\d+)\.xml$/i), 'optionalAccess', _228 => _228[1]]), () => ( 0))) - Number(_nullishCoalesce(_optionalChain([b, 'access', _229 => _229.match, 'call', _230 => _230(/(\d+)\.xml$/i), 'optionalAccess', _231 => _231[1]]), () => ( 0))));
23155
+ if (sectionPaths.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
23080
23156
  const manifestPath = Object.keys(zip.files).find((name) => /\.hpf$/i.test(name));
23081
23157
  const headerPath = Object.keys(zip.files).find((name) => /(^|\/)header\.xml$/i.test(name));
23082
23158
  const styles = headerPath ? parseRenderStyles(await zip.file(headerPath).async("text")) : null;
@@ -23117,11 +23193,11 @@ async function placeSealHwpx(hwpxBuffer, ops) {
23117
23193
  const manifestItems = [];
23118
23194
  const placed = [];
23119
23195
  for (const op of ops) {
23120
- if (!op.anchor) throw new (0, _chunk72LLOLFXcjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
23121
- if (!op.image || op.image.length === 0) throw new (0, _chunk72LLOLFXcjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
23196
+ if (!op.anchor) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("place_seal: anchor \uBB38\uAD6C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
23197
+ if (!op.image || op.image.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("place_seal: \uB3C4\uC7A5 \uC774\uBBF8\uC9C0\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4");
23122
23198
  const ext = (_nullishCoalesce(op.ext, () => ( "png"))).toLowerCase();
23123
- if (!MIME[ext]) throw new (0, _chunk72LLOLFXcjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
23124
- if (!imageMagicMatches(op.image, ext)) throw new (0, _chunk72LLOLFXcjs.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)`);
23199
+ if (!MIME[ext]) throw new (0, _chunkEL2Y4BL2cjs.KordocError)(`place_seal: \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uC774\uBBF8\uC9C0 \uD655\uC7A5\uC790 .${ext} (png/jpg/bmp/gif)`);
23200
+ if (!imageMagicMatches(op.image, ext)) throw new (0, _chunkEL2Y4BL2cjs.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)`);
23125
23201
  const wantOcc = _nullishCoalesce(op.occurrence, () => ( 0));
23126
23202
  let found = null;
23127
23203
  let total = 0;
@@ -23154,7 +23230,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
23154
23230
  }
23155
23231
  }
23156
23232
  }
23157
- throw new (0, _chunk72LLOLFXcjs.KordocError)(
23233
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(
23158
23234
  `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)})`
23159
23235
  );
23160
23236
  }
@@ -23162,9 +23238,9 @@ async function placeSealHwpx(hwpxBuffer, ops) {
23162
23238
  const xml = sectionXmls[si];
23163
23239
  const run = anchorRunInfo(xml, site.para, op.anchor);
23164
23240
  if (!run) {
23165
- throw new (0, _chunk72LLOLFXcjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
23241
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(`place_seal: \uC575\uCEE4 "${op.anchor}" \uBB38\uB2E8\uC5D0\uC11C run\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4`);
23166
23242
  }
23167
- const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _228 => _228.charPr, 'access', _229 => _229.get, 'call', _230 => _230(run.charPr), 'optionalAccess', _231 => _231.height]), () => ( 1e3));
23243
+ const charPrHeight = _nullishCoalesce(_optionalChain([styles, 'optionalAccess', _232 => _232.charPr, 'access', _233 => _233.get, 'call', _234 => _234(run.charPr), 'optionalAccess', _235 => _235.height]), () => ( 1e3));
23168
23244
  const fontPt = charPrHeight / 100;
23169
23245
  const emMm = fontPt * 25.4 / 72;
23170
23246
  const lineHMm = emMm;
@@ -23173,7 +23249,7 @@ async function placeSealHwpx(hwpxBuffer, ops) {
23173
23249
  const sizeMm = op.sizeMm != null && Number.isFinite(op.sizeMm) && op.sizeMm > 0 ? op.sizeMm : Math.max(7, Math.min(18, lineHMm * 1.6));
23174
23250
  const availMm = _nullishCoalesce((site.cell ? cellContentWidthMm(xml, site.cell) : null), () => ( bodyColumnWidthMm(xml)));
23175
23251
  const paraPrId = _nullishCoalesce(attrOf(paraOpenTag(xml, site.para), "paraPrIDRef"), () => ( "0"));
23176
- const align = _optionalChain([styles, 'optionalAccess', _232 => _232.paraAlign, 'access', _233 => _233.get, 'call', _234 => _234(paraPrId)]);
23252
+ const align = _optionalChain([styles, 'optionalAccess', _236 => _236.paraAlign, 'access', _237 => _237.get, 'call', _238 => _238(paraPrId)]);
23177
23253
  let alignShiftMm = 0;
23178
23254
  if (align === "CENTER" || align === "RIGHT") {
23179
23255
  const paraWMm = measureMm(site.para.text, emMm);
@@ -23245,7 +23321,7 @@ var ROW_OBJECT_RE = /<(?:[A-Za-z0-9_]+:)?(?:tbl|pic|equation|ole|container|shape
23245
23321
  var TAG_AT_RE = /<[A-Za-z0-9_:]+(?:"[^"]*"|'[^']*'|[^>"'])*>/y;
23246
23322
  function patchTableRows(input) {
23247
23323
  const { table, scanTable, ctx, skip, origKeys, editedKeys } = input;
23248
- const xml = _optionalChain([ctx, 'access', _235 => _235.scans, 'access', _236 => _236[scanTable.sectionIndex], 'optionalAccess', _237 => _237.xml]);
23324
+ const xml = _optionalChain([ctx, 'access', _239 => _239.scans, 'access', _240 => _240[scanTable.sectionIndex], 'optionalAccess', _241 => _241.xml]);
23249
23325
  if (!xml) return skip("\uC139\uC158 XML \uB9E4\uD551 \uC2E4\uD328");
23250
23326
  const numRows = table.rows;
23251
23327
  if (origKeys.length !== numRows) return skip("\uD45C \uD589 \uC88C\uD45C \uBD88\uC77C\uCE58 \u2014 \uD589 \uCD94\uAC00/\uC0AD\uC81C \uBBF8\uC9C0\uC6D0");
@@ -23412,7 +23488,7 @@ function buildRowFragment(xml, scanTable, template, cells, finalRow, hasExplicit
23412
23488
  const rr = scanTable.rowRanges[template];
23413
23489
  const wrapped = FRAG_OPEN + xml.slice(rr.start, rr.end) + FRAG_CLOSE;
23414
23490
  const scan = scanSectionXml(wrapped, 0);
23415
- const row = _optionalChain([scan, 'access', _238 => _238.tables, 'access', _239 => _239[0], 'optionalAccess', _240 => _240.rows, 'access', _241 => _241[0]]);
23491
+ const row = _optionalChain([scan, 'access', _242 => _242.tables, 'access', _243 => _243[0], 'optionalAccess', _244 => _244.rows, 'access', _245 => _245[0]]);
23416
23492
  if (!row || row.length !== cells.length) return null;
23417
23493
  const splices = allLinesegRemovalSplices(wrapped);
23418
23494
  for (let i = 0; i < cells.length; i++) {
@@ -23455,7 +23531,7 @@ function rowHeightOf(fragment) {
23455
23531
  }
23456
23532
  function tableSzHeightSplice(xml, scanTable, tblOpenLen, delta) {
23457
23533
  const from = scanTable.start + tblOpenLen;
23458
- const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _242 => _242.rowRanges, 'access', _243 => _243[0], 'optionalAccess', _244 => _244.start]), () => ( from));
23534
+ const to = _nullishCoalesce(_optionalChain([scanTable, 'access', _246 => _246.rowRanges, 'access', _247 => _247[0], 'optionalAccess', _248 => _248.start]), () => ( from));
23459
23535
  const slice = xml.slice(from, to);
23460
23536
  const szM = slice.match(/<(?:[A-Za-z0-9_]+:)?sz\b(?:"[^"]*"|'[^']*'|[^>"'])*>/);
23461
23537
  if (!szM || szM.index === void 0) return null;
@@ -23644,9 +23720,9 @@ function patchHtmlTableRows(table, scanTable, replica, editedRows, ctx, skip, de
23644
23720
  });
23645
23721
  }
23646
23722
  function patchNestedTables(table, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
23647
- const irCell = _optionalChain([table, 'access', _245 => _245.cells, 'access', _246 => _246[oc.gridR], 'optionalAccess', _247 => _247[oc.gridC]]);
23723
+ const irCell = _optionalChain([table, 'access', _249 => _249.cells, 'access', _250 => _250[oc.gridR], 'optionalAccess', _251 => _251[oc.gridC]]);
23648
23724
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
23649
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _248 => _248.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
23725
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _252 => _252.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
23650
23726
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
23651
23727
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
23652
23728
  }
@@ -23714,7 +23790,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
23714
23790
  };
23715
23791
  const cell = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
23716
23792
  if (!cell) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
23717
- const irCell = _optionalChain([table, 'access', _249 => _249.cells, 'access', _250 => _250[gridR], 'optionalAccess', _251 => _251[gridC]]);
23793
+ const irCell = _optionalChain([table, 'access', _253 => _253.cells, 'access', _254 => _254[gridR], 'optionalAccess', _255 => _255[gridC]]);
23718
23794
  const scanJoined = cell.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
23719
23795
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
23720
23796
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -23737,7 +23813,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
23737
23813
  if (newLines.length === 0) return 0;
23738
23814
  const target = cell.paragraphs[0];
23739
23815
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
23740
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _252 => _252.scans, 'access', _253 => _253[target.sectionIndex], 'optionalAccess', _254 => _254.xml]));
23816
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _256 => _256.scans, 'access', _257 => _257[target.sectionIndex], 'optionalAccess', _258 => _258.xml]));
23741
23817
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
23742
23818
  splices.push(...sp);
23743
23819
  sectionIndex = target.sectionIndex;
@@ -23760,7 +23836,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
23760
23836
  }
23761
23837
  for (let i = 0; i < nonEmpty.length; i++) {
23762
23838
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
23763
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _255 => _255.scans, 'access', _256 => _256[nonEmpty[i].sectionIndex], 'optionalAccess', _257 => _257.xml]));
23839
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _259 => _259.scans, 'access', _260 => _260[nonEmpty[i].sectionIndex], 'optionalAccess', _261 => _261.xml]));
23764
23840
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
23765
23841
  splices.push(...sp);
23766
23842
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -23841,7 +23917,7 @@ async function resolveSectionEntryNames(zip) {
23841
23917
  const paths = sectionPathsFromManifest(xml).filter((p) => zip.file(p) !== null);
23842
23918
  if (paths.length > 0) return paths;
23843
23919
  }
23844
- return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunk72LLOLFXcjs.compareSectionPaths);
23920
+ return Object.keys(zip.files).filter((n) => /[Ss]ection\d+\.xml$/.test(n)).sort(_chunkEL2Y4BL2cjs.compareSectionPaths);
23845
23921
  }
23846
23922
  function sectionPathsFromManifest(xml) {
23847
23923
  const attr = (tag, name) => {
@@ -23851,7 +23927,7 @@ function sectionPathsFromManifest(xml) {
23851
23927
  const idToHref = /* @__PURE__ */ new Map();
23852
23928
  for (const m of xml.matchAll(/<opf:item(\s(?:"[^"]*"|'[^']*'|[^>"'])*?)\/?>/g)) {
23853
23929
  const id = attr(m[1], "id");
23854
- const href = _chunk72LLOLFXcjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
23930
+ const href = _chunkEL2Y4BL2cjs.normalizeSectionHref.call(void 0, attr(m[1], "href"));
23855
23931
  if (id && href) idToHref.set(id, href);
23856
23932
  }
23857
23933
  const ordered = [];
@@ -23860,7 +23936,7 @@ function sectionPathsFromManifest(xml) {
23860
23936
  if (href) ordered.push(href);
23861
23937
  }
23862
23938
  if (ordered.length > 0) return ordered;
23863
- return Array.from(idToHref.values()).sort(_chunk72LLOLFXcjs.compareSectionPaths);
23939
+ return Array.from(idToHref.values()).sort(_chunkEL2Y4BL2cjs.compareSectionPaths);
23864
23940
  }
23865
23941
 
23866
23942
  // src/roundtrip/patcher.ts
@@ -23952,7 +24028,7 @@ async function patchHwpx(original, editedMarkdown, options) {
23952
24028
  }
23953
24029
  }
23954
24030
  let verification;
23955
- if (_optionalChain([options, 'optionalAccess', _258 => _258.verify]) !== false) {
24031
+ if (_optionalChain([options, 'optionalAccess', _262 => _262.verify]) !== false) {
23956
24032
  try {
23957
24033
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
23958
24034
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -23970,17 +24046,17 @@ function buildOrigUnits(blocks) {
23970
24046
  let chunk;
23971
24047
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
23972
24048
  const next = blocks[i + 1];
23973
- if (_optionalChain([next, 'optionalAccess', _259 => _259.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
23974
- chunk = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
24049
+ if (_optionalChain([next, 'optionalAccess', _263 => _263.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
24050
+ chunk = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
23975
24051
  } else {
23976
- chunk = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, [block]);
24052
+ chunk = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, [block]);
23977
24053
  }
23978
24054
  if (chunk) {
23979
24055
  const subUnits = splitMarkdownUnits(chunk);
23980
24056
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
23981
24057
  for (let s = 0; s < subUnits.length; s++) {
23982
24058
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
23983
- if (block.type === "table" && _optionalChain([block, 'access', _260 => _260.table, 'optionalAccess', _261 => _261.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
24059
+ if (block.type === "table" && _optionalChain([block, 'access', _264 => _264.table, 'optionalAccess', _265 => _265.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
23984
24060
  u.role = "caption";
23985
24061
  }
23986
24062
  units.push(u);
@@ -24091,7 +24167,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
24091
24167
  const ti = ctx.tableInsert;
24092
24168
  if (!ti) return skip("\uBB38\uB2E8\u2192\uD45C \uBCC0\uD658 \uBD88\uAC00 \u2014 header \uC5D4\uD2B8\uB9AC(borderFills) \uD574\uC11D \uC2E4\uD328");
24093
24169
  const mapping = ctx.paraMap.get(orig.blockIdx);
24094
- if (!_optionalChain([mapping, 'optionalAccess', _262 => _262.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");
24170
+ if (!_optionalChain([mapping, 'optionalAccess', _266 => _266.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");
24095
24171
  const para = mapping.para;
24096
24172
  if (para.kind !== "body") return skip("\uBCF8\uBB38 \uC678 \uC601\uC5ED(\uD45C \uC140/\uAE00\uC0C1\uC790) \uBB38\uB2E8\uC758 \uD45C \uBCC0\uD658\uC740 \uBBF8\uC9C0\uC6D0");
24097
24173
  const scan = ctx.scans[para.sectionIndex];
@@ -24119,7 +24195,7 @@ function convertParagraphToTable(block, orig, edited, ctx, skip) {
24119
24195
  }
24120
24196
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
24121
24197
  const mapping = ctx.paraMap.get(orig.blockIdx);
24122
- if (!_optionalChain([mapping, 'optionalAccess', _263 => _263.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)");
24198
+ if (!_optionalChain([mapping, 'optionalAccess', _267 => _267.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)");
24123
24199
  if (block.text && block.text.includes("\n")) {
24124
24200
  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)");
24125
24201
  }
@@ -24150,7 +24226,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
24150
24226
  if (sanitizeText(newPlain) !== newPlain) {
24151
24227
  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");
24152
24228
  }
24153
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _264 => _264.scans, 'access', _265 => _265[mapping.para.sectionIndex], 'optionalAccess', _266 => _266.xml]));
24229
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _268 => _268.scans, 'access', _269 => _269[mapping.para.sectionIndex], 'optionalAccess', _270 => _270.xml]));
24154
24230
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
24155
24231
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
24156
24232
  return 1;
@@ -24336,7 +24412,7 @@ var Surgeon = (_class4 = class {
24336
24412
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
24337
24413
  findEntry(path) {
24338
24414
  const parts = path.replace(/^\//, "").split("/");
24339
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _267 => _267.entries, 'access', _268 => _268[0], 'optionalAccess', _269 => _269.child]), () => ( -1));
24415
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _271 => _271.entries, 'access', _272 => _272[0], 'optionalAccess', _273 => _273.child]), () => ( -1));
24340
24416
  let current;
24341
24417
  for (const part of parts) {
24342
24418
  const search = (idx) => {
@@ -24549,8 +24625,8 @@ function serializeRecords(recs, repl, inserts) {
24549
24625
  parts.push(header, data);
24550
24626
  };
24551
24627
  for (let i = 0; i < recs.length; i++) {
24552
- for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _270 => _270.get, 'call', _271 => _271(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
24553
- push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _272 => _272.get, 'call', _273 => _273(i)]), () => ( recs[i].data)));
24628
+ for (const ins of _nullishCoalesce(_optionalChain([inserts, 'optionalAccess', _274 => _274.get, 'call', _275 => _275(i)]), () => ( []))) push(ins.tagId, ins.level, ins.data);
24629
+ push(recs[i].tagId, recs[i].level, _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _276 => _276.get, 'call', _277 => _277(i)]), () => ( recs[i].data)));
24554
24630
  }
24555
24631
  return Buffer.concat(parts);
24556
24632
  }
@@ -24668,7 +24744,7 @@ async function patchHwp(original, editedMarkdown, options) {
24668
24744
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
24669
24745
  }
24670
24746
  const fhEntry = CFB2.find(cfb, "/FileHeader");
24671
- if (!_optionalChain([fhEntry, 'optionalAccess', _274 => _274.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
24747
+ if (!_optionalChain([fhEntry, 'optionalAccess', _278 => _278.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
24672
24748
  let flags;
24673
24749
  try {
24674
24750
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -24690,7 +24766,7 @@ async function patchHwp(original, editedMarkdown, options) {
24690
24766
  const scans = [];
24691
24767
  for (let i = 0; i < sectionPaths.length; i++) {
24692
24768
  const entry = CFB2.find(cfb, sectionPaths[i]);
24693
- if (!_optionalChain([entry, 'optionalAccess', _275 => _275.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
24769
+ if (!_optionalChain([entry, 'optionalAccess', _279 => _279.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
24694
24770
  let stream;
24695
24771
  try {
24696
24772
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -24741,7 +24817,7 @@ async function patchHwp(original, editedMarkdown, options) {
24741
24817
  }
24742
24818
  }
24743
24819
  let verification;
24744
- if (_optionalChain([options, 'optionalAccess', _276 => _276.verify]) !== false) {
24820
+ if (_optionalChain([options, 'optionalAccess', _280 => _280.verify]) !== false) {
24745
24821
  try {
24746
24822
  const reparsed = parseHwp5Document(Buffer.from(data));
24747
24823
  const normBr = (u) => ({ ...u, raw: u.raw.replace(/<br\s*\/?\s*>/gi, "\n") });
@@ -24831,7 +24907,7 @@ function tableContentScore(irTable, scanTable) {
24831
24907
  for (const [key, scanCell] of scanTable.cells) {
24832
24908
  const comma = key.indexOf(",");
24833
24909
  const r = Number(key.slice(0, comma)), c = Number(key.slice(comma + 1));
24834
- const irCell = _optionalChain([irTable, 'access', _277 => _277.cells, 'access', _278 => _278[r], 'optionalAccess', _279 => _279[c]]);
24910
+ const irCell = _optionalChain([irTable, 'access', _281 => _281.cells, 'access', _282 => _282[r], 'optionalAccess', _283 => _283[c]]);
24835
24911
  if (!irCell) continue;
24836
24912
  const a = normForMatch(scanCell.paras.map((p) => p.rawText).join(" "));
24837
24913
  const b = normForMatch(stripCellTokens(irCell.text));
@@ -24867,7 +24943,7 @@ function handleModified(orig, edited, ctx) {
24867
24943
  }
24868
24944
  function patchParagraph(block, orig, edited, ctx, skip) {
24869
24945
  const mapping = ctx.paraMap.get(orig.blockIdx);
24870
- if (!_optionalChain([mapping, 'optionalAccess', _280 => _280.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)");
24946
+ if (!_optionalChain([mapping, 'optionalAccess', _284 => _284.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)");
24871
24947
  const restoreBr = (s) => s.replace(/(?:\s*<br\s*\/?\s*>\s*)+/gi, "\n");
24872
24948
  let newPlain = restoreBr(textUnitToPlain(edited.raw, block));
24873
24949
  if (block.text && block.text.includes("\n") && !newPlain.includes("\n")) {
@@ -25066,7 +25142,7 @@ function applyCellEdit5(table, scanTable, gridR, gridC, newLines, ctx, before, a
25066
25142
  };
25067
25143
  const cell = scanTable.cells.get(`${gridR},${gridC}`);
25068
25144
  if (!cell) return skip("\uC140 \uC88C\uD45C \uB9E4\uD551 \uC2E4\uD328 (\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58)");
25069
- const irCell = _optionalChain([table, 'access', _281 => _281.cells, 'access', _282 => _282[gridR], 'optionalAccess', _283 => _283[gridC]]);
25145
+ const irCell = _optionalChain([table, 'access', _285 => _285.cells, 'access', _286 => _286[gridR], 'optionalAccess', _287 => _287[gridC]]);
25070
25146
  const scanJoined = cell.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
25071
25147
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
25072
25148
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -25458,7 +25534,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25458
25534
  const block = st.blocks[blockIndex];
25459
25535
  if (!block) return void 0;
25460
25536
  if (block.type === "paragraph" || block.type === "heading") {
25461
- const para = _optionalChain([st, 'access', _284 => _284.paraMap, 'access', _285 => _285.get, 'call', _286 => _286(blockIndex), 'optionalAccess', _287 => _287.para]);
25537
+ const para = _optionalChain([st, 'access', _288 => _288.paraMap, 'access', _289 => _289.get, 'call', _290 => _290(blockIndex), 'optionalAccess', _291 => _291.para]);
25462
25538
  if (!para) return void 0;
25463
25539
  return { kind: "paragraph", sectionIndex: para.sectionIndex, xmlStart: para.start };
25464
25540
  }
@@ -25483,7 +25559,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25483
25559
  if (block.text && block.text.includes("\n")) {
25484
25560
  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)" };
25485
25561
  }
25486
- if (!_optionalChain([st, 'access', _288 => _288.paraMap, 'access', _289 => _289.get, 'call', _290 => _290(blockIndex), 'optionalAccess', _291 => _291.para])) {
25562
+ if (!_optionalChain([st, 'access', _292 => _292.paraMap, 'access', _293 => _293.get, 'call', _294 => _294(blockIndex), 'optionalAccess', _295 => _295.para])) {
25487
25563
  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)" };
25488
25564
  }
25489
25565
  return { capability: "text" };
@@ -25549,7 +25625,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25549
25625
  continue;
25550
25626
  }
25551
25627
  if (block.type === "table" && block.table) {
25552
- if (!_optionalChain([edit, 'access', _292 => _292.cells, 'optionalAccess', _293 => _293.length])) {
25628
+ if (!_optionalChain([edit, 'access', _296 => _296.cells, 'optionalAccess', _297 => _297.length])) {
25553
25629
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
25554
25630
  continue;
25555
25631
  }
@@ -25569,7 +25645,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25569
25645
  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) });
25570
25646
  continue;
25571
25647
  }
25572
- const irCell = _optionalChain([block, 'access', _294 => _294.table, 'access', _295 => _295.cells, 'access', _296 => _296[cellEdit.row], 'optionalAccess', _297 => _297[cellEdit.col]]);
25648
+ const irCell = _optionalChain([block, 'access', _298 => _298.table, 'access', _299 => _299.cells, 'access', _300 => _300[cellEdit.row], 'optionalAccess', _301 => _301[cellEdit.col]]);
25573
25649
  if (!irCell) {
25574
25650
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
25575
25651
  continue;
@@ -25625,7 +25701,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25625
25701
  }
25626
25702
  if (replacements.size === 0) {
25627
25703
  let changes2;
25628
- if (_optionalChain([options, 'optionalAccess', _298 => _298.verify]) !== false) {
25704
+ if (_optionalChain([options, 'optionalAccess', _302 => _302.verify]) !== false) {
25629
25705
  const units = splitMarkdownUnits(st.markdown);
25630
25706
  changes2 = diffUnitLists(units, units);
25631
25707
  }
@@ -25646,7 +25722,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25646
25722
  }
25647
25723
  this.state = newState;
25648
25724
  let changes;
25649
- if (_optionalChain([options, 'optionalAccess', _299 => _299.verify]) !== false) {
25725
+ if (_optionalChain([options, 'optionalAccess', _303 => _303.verify]) !== false) {
25650
25726
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
25651
25727
  }
25652
25728
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -25666,7 +25742,7 @@ var HwpxSession = (_class5 = class _HwpxSession {
25666
25742
  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)");
25667
25743
  }
25668
25744
  const mapping = st.paraMap.get(blockIndex);
25669
- if (!_optionalChain([mapping, 'optionalAccess', _300 => _300.para])) {
25745
+ if (!_optionalChain([mapping, 'optionalAccess', _304 => _304.para])) {
25670
25746
  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)");
25671
25747
  }
25672
25748
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -25686,14 +25762,14 @@ var HwpxSession = (_class5 = class _HwpxSession {
25686
25762
  if (sanitizeText(newPlain) !== newPlain) {
25687
25763
  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");
25688
25764
  }
25689
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _301 => _301.scans, 'access', _302 => _302[mapping.para.sectionIndex], 'optionalAccess', _303 => _303.xml]));
25765
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _305 => _305.scans, 'access', _306 => _306[mapping.para.sectionIndex], 'optionalAccess', _307 => _307.xml]));
25690
25766
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
25691
25767
  sectionSplices[mapping.para.sectionIndex].push(...splices);
25692
25768
  return 1;
25693
25769
  }
25694
25770
  }, _class5);
25695
25771
  function cellStaticCheck(table, scanTable, r, c) {
25696
- const irCell = _optionalChain([table, 'access', _304 => _304.cells, 'access', _305 => _305[r], 'optionalAccess', _306 => _306[c]]);
25772
+ const irCell = _optionalChain([table, 'access', _308 => _308.cells, 'access', _309 => _309[r], 'optionalAccess', _310 => _310[c]]);
25697
25773
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
25698
25774
  const cell = scanTable.cellByAnchor.get(`${r},${c}`);
25699
25775
  if (!cell) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -25777,11 +25853,11 @@ var md = new (0, _markdownit2.default)({
25777
25853
  breaks: false
25778
25854
  });
25779
25855
  function renderHtml(markdown, options) {
25780
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _307 => _307.preset]), () => ( "default"));
25781
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _308 => _308.extraCss]), () => ( "")));
25856
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _311 => _311.preset]), () => ( "default"));
25857
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _312 => _312.extraCss]), () => ( "")));
25782
25858
  const body = md.render(markdown);
25783
- const watermark = _optionalChain([options, 'optionalAccess', _309 => _309.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
25784
- const watermarkCss = _optionalChain([options, 'optionalAccess', _310 => _310.watermark]) ? `
25859
+ const watermark = _optionalChain([options, 'optionalAccess', _313 => _313.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
25860
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _314 => _314.watermark]) ? `
25785
25861
  .watermark {
25786
25862
  position: fixed;
25787
25863
  top: 50%; left: 50%;
@@ -25812,13 +25888,13 @@ async function htmlToPdf(html, options) {
25812
25888
  try {
25813
25889
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
25814
25890
  } catch (e30) {
25815
- throw new (0, _chunk72LLOLFXcjs.KordocError)(
25891
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(
25816
25892
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
25817
25893
  );
25818
25894
  }
25819
25895
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
25820
25896
  if (!executablePath) {
25821
- throw new (0, _chunk72LLOLFXcjs.KordocError)(
25897
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)(
25822
25898
  "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."
25823
25899
  );
25824
25900
  }
@@ -25830,10 +25906,10 @@ async function htmlToPdf(html, options) {
25830
25906
  try {
25831
25907
  const page = await browser.newPage();
25832
25908
  await page.setContent(html, { waitUntil: "networkidle0" });
25833
- const margin = _optionalChain([options, 'optionalAccess', _311 => _311.margin]);
25909
+ const margin = _optionalChain([options, 'optionalAccess', _315 => _315.margin]);
25834
25910
  const pdf = await page.pdf({
25835
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _312 => _312.pageSize]), () => ( "A4")),
25836
- landscape: _optionalChain([options, 'optionalAccess', _313 => _313.orientation]) === "landscape",
25911
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _316 => _316.pageSize]), () => ( "A4")),
25912
+ landscape: _optionalChain([options, 'optionalAccess', _317 => _317.orientation]) === "landscape",
25837
25913
  printBackground: true,
25838
25914
  margin: margin ? {
25839
25915
  top: toCss(margin.top),
@@ -25841,9 +25917,9 @@ async function htmlToPdf(html, options) {
25841
25917
  bottom: toCss(margin.bottom),
25842
25918
  left: toCss(margin.left)
25843
25919
  } : void 0,
25844
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _314 => _314.header]) || _optionalChain([options, 'optionalAccess', _315 => _315.footer])),
25845
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _316 => _316.header]), () => ( "<div></div>")),
25846
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _317 => _317.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
25920
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _318 => _318.header]) || _optionalChain([options, 'optionalAccess', _319 => _319.footer])),
25921
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _320 => _320.header]), () => ( "<div></div>")),
25922
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _321 => _321.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
25847
25923
  });
25848
25924
  return Buffer.from(pdf);
25849
25925
  } finally {
@@ -25877,7 +25953,7 @@ async function markdownToPdf(markdown, options) {
25877
25953
  return htmlToPdf(html, options);
25878
25954
  }
25879
25955
  async function blocksToPdf(blocks, options) {
25880
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, blocks);
25956
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, blocks);
25881
25957
  return markdownToPdf(markdown, options);
25882
25958
  }
25883
25959
 
@@ -26034,7 +26110,7 @@ function reflowPara(p, doc, styles, areaW, startV, mode) {
26034
26110
  const lsa = doc.createElement("hp:linesegarray");
26035
26111
  for (let li = 0; li < wrap.starts.length; li++) {
26036
26112
  const startReal = wrap.starts[li];
26037
- const textpos = startReal < realIdx.length ? realIdx[startReal] : m.chars.length;
26113
+ const textpos = startReal < realIdx.length ? realIdx[startReal] : 0;
26038
26114
  const vertpos = startV + li * pitch;
26039
26115
  const isFirst = li === 0;
26040
26116
  const seg = doc.createElement("hp:lineseg");
@@ -26087,7 +26163,7 @@ function reflowBlockFlow(container, doc, styles, areaW, mode, counter, bodyH) {
26087
26163
  if (ln(p) !== "p") continue;
26088
26164
  reflowTablesIn(p, doc, styles, mode, counter);
26089
26165
  const g = styles.paraGeom.get(_nullishCoalesce(p.getAttribute("paraPrIDRef"), () => ( "")));
26090
- const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _318 => _318.spaceBefore]), () => ( 0)));
26166
+ const startV = cursorV + prevSpaceAfter + (_nullishCoalesce(_optionalChain([g, 'optionalAccess', _322 => _322.spaceBefore]), () => ( 0)));
26091
26167
  const res = reflowPara(p, doc, styles, areaW, startV, mode);
26092
26168
  if (res) {
26093
26169
  const paraH = res.paraBottom - startV;
@@ -26196,7 +26272,7 @@ function buildPara(p) {
26196
26272
  el: ch,
26197
26273
  tag: cn,
26198
26274
  index: chars.length,
26199
- inline: _optionalChain([pos, 'optionalAccess', _319 => _319.getAttribute, 'call', _320 => _320("treatAsChar")]) === "1",
26275
+ inline: _optionalChain([pos, 'optionalAccess', _323 => _323.getAttribute, 'call', _324 => _324("treatAsChar")]) === "1",
26200
26276
  width: w,
26201
26277
  height: h
26202
26278
  });
@@ -26314,6 +26390,7 @@ function drawPara(p, ox, oy, areaW, ctx, depth, segPages) {
26314
26390
  }
26315
26391
  if (text.trim().length > 0) {
26316
26392
  const attrs = [`x="${pt(cx)}"`, `y="${pt(y)}"`, `font-size="${pt(st.height)}"`];
26393
+ if (st.fontFamily) attrs.push(`font-family="${st.fontFamily}"`);
26317
26394
  if ([...text].length > 1 && sw > 50) {
26318
26395
  attrs.push(`textLength="${pt(sw)}"`, `lengthAdjust="${plan.scale < 1 ? "spacingAndGlyphs" : "spacing"}"`);
26319
26396
  }
@@ -26447,15 +26524,15 @@ function drawShape(o, x, y, ctx, depth) {
26447
26524
  const sx = ow > 0 ? w / ow : 1;
26448
26525
  const sy = oh > 0 ? h / oh : 1;
26449
26526
  const lineShape = findChildByLocalName(el, "lineShape");
26450
- const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _321 => _321.getAttribute, 'call', _322 => _322("style")]), () => ( "SOLID"));
26451
- const strokeCol = _optionalChain([lineShape, 'optionalAccess', _323 => _323.getAttribute, 'call', _324 => _324("color")]) || "#000000";
26527
+ const lstyle = _nullishCoalesce(_optionalChain([lineShape, 'optionalAccess', _325 => _325.getAttribute, 'call', _326 => _326("style")]), () => ( "SOLID"));
26528
+ const strokeCol = _optionalChain([lineShape, 'optionalAccess', _327 => _327.getAttribute, 'call', _328 => _328("color")]) || "#000000";
26452
26529
  const hasStroke = lstyle !== "NONE";
26453
26530
  const strokeW = hasStroke ? shapeStrokePt(lineShape ? num2(lineShape, "width") : 33) : 0;
26454
26531
  const dash = /DASH|DOT/.test(lstyle) ? ` stroke-dasharray="${lstyle.includes("DOT") ? "1,1.5" : "3,1.5"}"` : "";
26455
26532
  const strokeAttr = hasStroke ? ` stroke="${escapeXml3(strokeCol)}" stroke-width="${strokeW.toFixed(2)}"${dash}` : "";
26456
26533
  const fillBrush = findChildByLocalName(el, "fillBrush");
26457
26534
  const winBrush = fillBrush ? findChildByLocalName(fillBrush, "winBrush") : null;
26458
- const face = _optionalChain([winBrush, 'optionalAccess', _325 => _325.getAttribute, 'call', _326 => _326("faceColor")]);
26535
+ const face = _optionalChain([winBrush, 'optionalAccess', _329 => _329.getAttribute, 'call', _330 => _330("faceColor")]);
26459
26536
  const fill = face && face.toLowerCase() !== "none" ? face : "none";
26460
26537
  const fillAttr = ` fill="${fill === "none" ? "none" : escapeXml3(fill)}"`;
26461
26538
  if (o.tag === "rect") {
@@ -26487,11 +26564,15 @@ function cellContentExtent(cell) {
26487
26564
  if (ln2(p) !== "p") continue;
26488
26565
  const m = buildPara(p);
26489
26566
  for (const s of m.segs) ext = Math.max(ext, s.vertpos + s.textheight);
26490
- const baseV = _nullishCoalesce(_optionalChain([m, 'access', _327 => _327.segs, 'access', _328 => _328[0], 'optionalAccess', _329 => _329.vertpos]), () => ( 0));
26567
+ const baseV = _nullishCoalesce(_optionalChain([m, 'access', _331 => _331.segs, 'access', _332 => _332[0], 'optionalAccess', _333 => _333.vertpos]), () => ( 0));
26491
26568
  for (const o of m.objs) {
26492
- if (o.inline) continue;
26569
+ if (o.inline) {
26570
+ const h = o.tag === "tbl" ? Math.max(o.height, measureTableHeight(o.el)) : o.height;
26571
+ ext = Math.max(ext, baseV + h);
26572
+ continue;
26573
+ }
26493
26574
  const pos = findChildByLocalName(o.el, "pos");
26494
- if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _330 => _330.getAttribute, 'call', _331 => _331("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
26575
+ if ((_nullishCoalesce(_optionalChain([pos, 'optionalAccess', _334 => _334.getAttribute, 'call', _335 => _335("vertRelTo")]), () => ( "PARA"))) !== "PARA") continue;
26495
26576
  const om = findChildByLocalName(o.el, "outMargin");
26496
26577
  const pushed = baseV - (num2(om, "top") + o.height + num2(om, "bottom"));
26497
26578
  const anchor = pushed >= -100 ? pushed : baseV;
@@ -26577,7 +26658,7 @@ function drawTable(tbl, tx, ty, ctx, depth) {
26577
26658
  }));
26578
26659
  for (const g of geom) {
26579
26660
  const bf = g.c.bfId != null ? ctx.styles.borderFill.get(g.c.bfId) : void 0;
26580
- if (_optionalChain([bf, 'optionalAccess', _332 => _332.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
26661
+ if (_optionalChain([bf, 'optionalAccess', _336 => _336.fill])) emit(ctx, `<rect x="${pt(g.x)}" y="${pt(g.y)}" width="${pt(g.w)}" height="${pt(g.h)}" fill="${escapeXml3(bf.fill)}"/>`);
26581
26662
  }
26582
26663
  for (const g of geom) {
26583
26664
  const { c } = g;
@@ -26615,7 +26696,7 @@ function drawPic(pic, x, y, ctx) {
26615
26696
  const sz = findChildByLocalName(pic, "sz");
26616
26697
  const w = num2(sz, "width", 5669), h = num2(sz, "height", 5669);
26617
26698
  const img = findFirst(pic, "img");
26618
- const ref = _optionalChain([img, 'optionalAccess', _333 => _333.getAttribute, 'call', _334 => _334("binaryItemIDRef")]);
26699
+ const ref = _optionalChain([img, 'optionalAccess', _337 => _337.getAttribute, 'call', _338 => _338("binaryItemIDRef")]);
26619
26700
  const loaded = ref != null ? ctx.images.get(ref) : void 0;
26620
26701
  if (!loaded) {
26621
26702
  emit(ctx, `<rect x="${pt(x)}" y="${pt(y)}" width="${pt(w)}" height="${pt(h)}" fill="#eee" stroke="#c00" stroke-width="0.5"/>`);
@@ -26650,28 +26731,89 @@ function sniffMime(name, bytes) {
26650
26731
  if (lower.endsWith(".svg")) return "image/svg+xml";
26651
26732
  return "image/jpeg";
26652
26733
  }
26734
+ function readSectionGeom(root) {
26735
+ const pagePr = findFirst(root, "pagePr");
26736
+ const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
26737
+ let PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
26738
+ if (_optionalChain([pagePr, 'optionalAccess', _339 => _339.getAttribute, 'call', _340 => _340("landscape")]) === "NARROWLY" && PW < PH) {
26739
+ const t = PW;
26740
+ PW = PH;
26741
+ PH = t;
26742
+ }
26743
+ const ML = num2(margin, "left", 8504);
26744
+ const MT = num2(margin, "top", 5668) + num2(margin, "header", 0);
26745
+ const BODY_H = PH - MT - num2(margin, "bottom", 4252) - num2(margin, "footer", 0);
26746
+ const BODY_W = PW - ML - num2(margin, "right", 8504);
26747
+ return { PW, PH, ML, MT, BODY_W, BODY_H };
26748
+ }
26749
+ function renderSectionToPages(root, geom, ctxBase, hasCache, reflowMode) {
26750
+ const { PW, PH, ML, MT, BODY_W, BODY_H } = geom;
26751
+ if (!hasCache) reflowSection(root, ctxBase.styles, { BODY_W, BODY_H }, reflowMode);
26752
+ const colPr = findFirst(root, "colPr");
26753
+ const multiCol = num2(colPr, "colCount", 1) > 1;
26754
+ const paraSegPages = /* @__PURE__ */ new Map();
26755
+ let nPages = 1;
26756
+ let maxTopV = 0;
26757
+ {
26758
+ let prevV = Number.NEGATIVE_INFINITY;
26759
+ let prevH = Number.NEGATIVE_INFINITY;
26760
+ let cur = 0;
26761
+ for (const p of elements2(root)) {
26762
+ if (ln2(p) !== "p") continue;
26763
+ const lsa = findChildByLocalName(p, "linesegarray");
26764
+ const segEls = lsa ? elements2(lsa).filter((s) => ln2(s) === "lineseg") : [];
26765
+ const pagesOf = [];
26766
+ let paraFirst = true;
26767
+ for (const s of segEls) {
26768
+ const v = num2(s, "vertpos");
26769
+ const h = num2(s, "horzpos");
26770
+ const brk = v < prevV ? !multiCol || h <= prevH : paraFirst && v === prevV && h <= prevH;
26771
+ if (brk) cur++;
26772
+ paraFirst = false;
26773
+ pagesOf.push(cur);
26774
+ maxTopV = Math.max(maxTopV, v + num2(s, "textheight", 1e3));
26775
+ prevV = v;
26776
+ prevH = h;
26777
+ }
26778
+ paraSegPages.set(p, pagesOf);
26779
+ nPages = Math.max(nPages, cur + 1);
26780
+ }
26781
+ }
26782
+ const ctx = {
26783
+ ...ctxBase,
26784
+ pages: Array.from({ length: nPages }, () => []),
26785
+ page: 0,
26786
+ geom
26787
+ };
26788
+ for (const p of elements2(root)) {
26789
+ if (ln2(p) !== "p") continue;
26790
+ drawPara(p, ML, MT, BODY_W, ctx, 0, paraSegPages.get(p));
26791
+ }
26792
+ const pageH = nPages === 1 ? Math.max(PH, MT + maxTopV + 2e3) : PH;
26793
+ return { pages: ctx.pages, pageH };
26794
+ }
26653
26795
  async function renderHwpxToSvg(input, options) {
26654
- const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _335 => _335.maxImageBytes]), () => ( 40 * 1024 * 1024));
26796
+ const maxImg = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _341 => _341.maxImageBytes]), () => ( 40 * 1024 * 1024));
26655
26797
  const ab = input instanceof Uint8Array ? input.buffer.slice(input.byteOffset, input.byteOffset + input.byteLength) : input;
26656
- _chunk72LLOLFXcjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
26798
+ _chunkEL2Y4BL2cjs.precheckZipSize.call(void 0, ab, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
26657
26799
  let zip;
26658
26800
  try {
26659
26801
  zip = await _jszip2.default.loadAsync(input);
26660
26802
  } catch (e31) {
26661
- throw new (0, _chunk72LLOLFXcjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
26662
- }
26663
- const secFile = _nullishCoalesce(zip.file("Contents/section0.xml"), () => ( zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name))[0]));
26664
- if (!secFile) throw new (0, _chunk72LLOLFXcjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
26665
- const secXml = await secFile.async("string");
26666
- if (secXml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
26667
- const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
26668
- if (!hasCache && !_optionalChain([options, 'optionalAccess', _336 => _336.reflow])) {
26669
- throw new (0, _chunk72LLOLFXcjs.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)");
26803
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("HWPX(ZIP) \uD615\uC2DD\uC774 \uC544\uB2D9\uB2C8\uB2E4 \u2014 \uB80C\uB354\uB294 HWPX\uB9CC \uC9C0\uC6D0");
26670
26804
  }
26805
+ const secFiles = zip.file(/Contents\/section\d+\.xml$/i).sort((a, b) => a.name.localeCompare(b.name));
26806
+ if (secFiles.length === 0) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("Contents/section0.xml \uC5C6\uC74C \u2014 HWPX\uAC00 \uC544\uB2C8\uAC70\uB098 \uC190\uC0C1\uB428");
26671
26807
  const warnings = [];
26672
26808
  const headFile = _nullishCoalesce(zip.file("Contents/header.xml"), () => ( zip.file("Contents/head.xml")));
26673
26809
  const styles = headFile ? parseRenderStyles(await headFile.async("string")) : { charPr: /* @__PURE__ */ new Map(), paraAlign: /* @__PURE__ */ new Map(), paraGeom: /* @__PURE__ */ new Map(), borderFill: /* @__PURE__ */ new Map() };
26674
26810
  if (!headFile) warnings.push("header.xml \uC5C6\uC74C \u2014 \uAE30\uBCF8 \uC2A4\uD0C0\uC77C\uB85C \uB80C\uB354");
26811
+ const secXmls = [];
26812
+ for (const f of secFiles) {
26813
+ const xml = await f.async("string");
26814
+ if (xml.length > MAX_DECOMPRESS_SIZE) throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uC139\uC158 XML\uC774 \uD5C8\uC6A9 \uD06C\uAE30\uB97C \uCD08\uACFC");
26815
+ secXmls.push(xml);
26816
+ }
26675
26817
  const binmap = /* @__PURE__ */ new Map();
26676
26818
  const hpf = zip.file(/content\.hpf$/i)[0];
26677
26819
  if (hpf) {
@@ -26683,7 +26825,7 @@ async function renderHwpxToSvg(input, options) {
26683
26825
  const MAX_TOTAL_IMAGE_BYTES = 128 * 1024 * 1024;
26684
26826
  const images = /* @__PURE__ */ new Map();
26685
26827
  const refs = /* @__PURE__ */ new Set();
26686
- for (const m of secXml.matchAll(/binaryItemIDRef="([^"]+)"/g)) refs.add(m[1]);
26828
+ for (const xml of secXmls) for (const m of xml.matchAll(/binaryItemIDRef="([^"]+)"/g)) refs.add(m[1]);
26687
26829
  let totalImgBytes = 0;
26688
26830
  for (const ref of refs) {
26689
26831
  if (images.size >= MAX_IMAGE_REFS) {
@@ -26693,7 +26835,7 @@ async function renderHwpxToSvg(input, options) {
26693
26835
  let href = binmap.get(ref);
26694
26836
  if (!href) {
26695
26837
  const cand = zip.file(new RegExp(`BinData/.*${ref.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`, "i"))[0];
26696
- href = _optionalChain([cand, 'optionalAccess', _337 => _337.name]);
26838
+ href = _optionalChain([cand, 'optionalAccess', _342 => _342.name]);
26697
26839
  }
26698
26840
  if (!href) continue;
26699
26841
  const f = _nullishCoalesce(zip.file(href), () => ( zip.file("Contents/" + href)));
@@ -26710,89 +26852,82 @@ async function renderHwpxToSvg(input, options) {
26710
26852
  totalImgBytes += bytes.length;
26711
26853
  images.set(ref, { dataUri: `data:${sniffMime(href, bytes)};base64,${Buffer.from(bytes).toString("base64")}` });
26712
26854
  }
26713
- const doc = createXmlParser().parseFromString(secXml, "text/xml");
26714
- const root = doc.documentElement;
26715
- if (!root) throw new (0, _chunk72LLOLFXcjs.KordocError)("\uC139\uC158 XML \uD30C\uC2F1 \uC2E4\uD328");
26716
- const pagePr = findFirst(root, "pagePr");
26717
- const margin = pagePr ? findChildByLocalName(pagePr, "margin") : null;
26718
- const PW = num2(pagePr, "width", 59528), PH = num2(pagePr, "height", 84188);
26719
- const ML = num2(margin, "left", 8504);
26720
- const MT = num2(margin, "top", 5668) + num2(margin, "header", 0);
26721
- const BODY_H = PH - MT - num2(margin, "bottom", 4252) - num2(margin, "footer", 0);
26722
- const BODY_W = PW - ML - num2(margin, "right", 8504);
26723
- if (!hasCache) reflowSection(root, styles, { BODY_W, BODY_H }, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.reflowMode]), () => ( "keep")));
26724
- const colPr = findFirst(root, "colPr");
26725
- const multiCol = num2(colPr, "colCount", 1) > 1;
26726
- const paraSegPages = /* @__PURE__ */ new Map();
26727
- let nPages = 1;
26728
- let maxTopV = 0;
26729
- {
26730
- let prevV = Number.NEGATIVE_INFINITY;
26731
- let prevH = Number.NEGATIVE_INFINITY;
26732
- let cur = 0;
26733
- for (const p of elements2(root)) {
26734
- if (ln2(p) !== "p") continue;
26735
- const lsa = findChildByLocalName(p, "linesegarray");
26736
- const segEls = lsa ? elements2(lsa).filter((s) => ln2(s) === "lineseg") : [];
26737
- const pagesOf = [];
26738
- for (const s of segEls) {
26739
- const v = num2(s, "vertpos");
26740
- const h = num2(s, "horzpos");
26741
- if (v < prevV && (!multiCol || h <= prevH)) cur++;
26742
- pagesOf.push(cur);
26743
- maxTopV = Math.max(maxTopV, v + num2(s, "textheight", 1e3));
26744
- prevV = v;
26745
- prevH = h;
26746
- }
26747
- paraSegPages.set(p, pagesOf);
26748
- nPages = Math.max(nPages, cur + 1);
26749
- }
26750
- }
26751
- const ctx = {
26752
- pages: Array.from({ length: nPages }, () => []),
26753
- page: 0,
26754
- geom: { PW, PH, ML, MT, BODY_W, BODY_H },
26855
+ const ctxBase = {
26755
26856
  styles,
26756
26857
  images,
26757
26858
  defs: [],
26758
- highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _339 => _339.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
26859
+ highlights: (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _343 => _343.highlights]), () => ( []))).map((s) => s.trim().toLowerCase()).filter((s) => s.length > 0),
26759
26860
  warnings,
26760
26861
  warned: /* @__PURE__ */ new Set(),
26761
26862
  stats: { texts: 0, images: 0, tables: 0 }
26762
26863
  };
26763
- for (const p of elements2(root)) {
26764
- if (ln2(p) !== "p") continue;
26765
- drawPara(p, ML, MT, BODY_W, ctx, 0, paraSegPages.get(p));
26864
+ const rendered = [];
26865
+ let noCacheSkipped = false;
26866
+ for (let si = 0; si < secXmls.length; si++) {
26867
+ const secXml = secXmls[si];
26868
+ const hasCache = /<(?:[A-Za-z][\w.-]*:)?linesegarray[\s/>]/.test(secXml);
26869
+ if (!hasCache && !_optionalChain([options, 'optionalAccess', _344 => _344.reflow])) {
26870
+ noCacheSkipped = true;
26871
+ warnings.push(`\uAD6C\uC5ED ${si}: \uC870\uD310 \uCE90\uC2DC \uC5C6\uC74C \u2014 reflow \uC635\uC158 \uD544\uC694, \uC0DD\uB7B5`);
26872
+ continue;
26873
+ }
26874
+ const doc = createXmlParser().parseFromString(secXml, "text/xml");
26875
+ const root = doc.documentElement;
26876
+ if (!root) {
26877
+ warnings.push(`\uAD6C\uC5ED ${si} XML \uD30C\uC2F1 \uC2E4\uD328 \u2014 \uC0DD\uB7B5`);
26878
+ continue;
26879
+ }
26880
+ const geom = readSectionGeom(root);
26881
+ const { pages, pageH } = renderSectionToPages(root, geom, ctxBase, hasCache, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _345 => _345.reflowMode]), () => ( "keep")));
26882
+ rendered.push({ pages, PW: geom.PW, pageH, clipId: `pgclip${si}` });
26883
+ }
26884
+ if (rendered.length === 0) {
26885
+ if (noCacheSkipped) {
26886
+ throw new (0, _chunkEL2Y4BL2cjs.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)");
26887
+ }
26888
+ throw new (0, _chunkEL2Y4BL2cjs.KordocError)("\uB80C\uB354\uD560 \uAD6C\uC5ED\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWPX\uAC00 \uC190\uC0C1\uB418\uC5C8\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4");
26766
26889
  }
26767
- const pageH = nPages === 1 ? Math.max(PH, MT + maxTopV + 2e3) : PH;
26768
26890
  const GAP = 2400;
26769
- const totalH = nPages * pageH + (nPages - 1) * GAP;
26770
- const pagesSvg = ctx.pages.map(
26771
- (buf, k) => `<g data-page="${k + 1}" transform="translate(0 ${pt(k * (pageH + GAP))})"><rect width="${pt(PW)}" height="${pt(pageH)}" fill="white" stroke="#c9c7c4" stroke-width="0.75"/><g clip-path="url(#pgclip)">
26891
+ const clipDefs = [];
26892
+ const groups = [];
26893
+ let y = 0;
26894
+ let maxPW = 0;
26895
+ let pageNo = 0;
26896
+ for (const rs of rendered) {
26897
+ maxPW = Math.max(maxPW, rs.PW);
26898
+ clipDefs.push(`<clipPath id="${rs.clipId}"><rect x="0" y="0" width="${pt(rs.PW)}" height="${pt(rs.pageH)}"/></clipPath>`);
26899
+ for (const buf of rs.pages) {
26900
+ pageNo++;
26901
+ groups.push(
26902
+ `<g data-page="${pageNo}" transform="translate(0 ${pt(y)})"><rect width="${pt(rs.PW)}" height="${pt(rs.pageH)}" fill="white" stroke="#c9c7c4" stroke-width="0.75"/><g clip-path="url(#${rs.clipId})">
26772
26903
  ${buf.join("\n")}
26773
26904
  </g></g>`
26774
- ).join("\n");
26775
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${pt(PW)} ${pt(totalH)}" width="${pt(PW)}pt" height="${pt(totalH)}pt" font-family="'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif" xml:space="preserve">
26776
- <defs><clipPath id="pgclip"><rect x="0" y="0" width="${pt(PW)}" height="${pt(pageH)}"/></clipPath>${ctx.defs.join("")}</defs>
26777
- ${pagesSvg}
26905
+ );
26906
+ y += rs.pageH + GAP;
26907
+ }
26908
+ }
26909
+ const totalH = Math.max(0, y - GAP);
26910
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${pt(maxPW)} ${pt(totalH)}" width="${pt(maxPW)}pt" height="${pt(totalH)}pt" font-family="'HCR Batang','\uD568\uCD08\uB86C\uBC14\uD0D5','Hancom Batang',AppleMyungjo,'Noto Serif CJK KR',serif" xml:space="preserve">
26911
+ <defs>${clipDefs.join("")}${ctxBase.defs.join("")}</defs>
26912
+ ${groups.join("\n")}
26778
26913
  </svg>`;
26779
- return { svg, width: Math.round(PW) / 100, height: Math.round(totalH) / 100, pageCount: nPages, warnings, stats: ctx.stats };
26914
+ return { svg, width: Math.round(maxPW) / 100, height: Math.round(totalH) / 100, pageCount: pageNo, warnings, stats: ctxBase.stats };
26780
26915
  }
26781
26916
 
26782
26917
  // src/index.ts
26783
26918
  async function parse(input, options) {
26784
26919
  let buffer;
26785
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _340 => _340.filePath]) ? { ...options, filePath: input } : options;
26920
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _346 => _346.filePath]) ? { ...options, filePath: input } : options;
26786
26921
  if (typeof input === "string") {
26787
26922
  try {
26788
26923
  const buf = await _promises.readFile.call(void 0, input);
26789
- buffer = _chunk72LLOLFXcjs.toArrayBuffer.call(void 0, buf);
26924
+ buffer = _chunkEL2Y4BL2cjs.toArrayBuffer.call(void 0, buf);
26790
26925
  } catch (err) {
26791
26926
  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}`;
26792
26927
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
26793
26928
  }
26794
26929
  } else if (Buffer.isBuffer(input)) {
26795
- buffer = _chunk72LLOLFXcjs.toArrayBuffer.call(void 0, input);
26930
+ buffer = _chunkEL2Y4BL2cjs.toArrayBuffer.call(void 0, input);
26796
26931
  } else {
26797
26932
  buffer = input;
26798
26933
  }
@@ -26827,21 +26962,21 @@ async function parseHwp3(buffer, options) {
26827
26962
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
26828
26963
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
26829
26964
  } catch (err) {
26830
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
26965
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26831
26966
  }
26832
26967
  }
26833
26968
  async function parseHwpx(buffer, options) {
26834
26969
  try {
26835
26970
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
26836
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _341 => _341.length]) ? images : void 0 };
26971
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _347 => _347.length]) ? images : void 0 };
26837
26972
  } catch (err) {
26838
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
26973
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26839
26974
  }
26840
26975
  }
26841
26976
  async function parseHwp(buffer, options) {
26842
26977
  try {
26843
26978
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
26844
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _342 => _342.filePath])) {
26979
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _348 => _348.filePath])) {
26845
26980
  try {
26846
26981
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
26847
26982
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -26858,15 +26993,15 @@ async function parseHwp(buffer, options) {
26858
26993
  } catch (e32) {
26859
26994
  }
26860
26995
  }
26861
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _343 => _343.length]) ? images : void 0 };
26996
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _349 => _349.length]) ? images : void 0 };
26862
26997
  } catch (err) {
26863
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
26998
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26864
26999
  }
26865
27000
  }
26866
27001
  async function parsePdf(buffer, options) {
26867
27002
  let parsePdfDocument;
26868
27003
  try {
26869
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-YVRTKGKO.cjs")));
27004
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-I5GC4QQ5.cjs")));
26870
27005
  parsePdfDocument = mod.parsePdfDocument;
26871
27006
  } catch (e33) {
26872
27007
  return {
@@ -26881,7 +27016,7 @@ async function parsePdf(buffer, options) {
26881
27016
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
26882
27017
  } catch (err) {
26883
27018
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
26884
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err), isImageBased };
27019
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err), isImageBased };
26885
27020
  }
26886
27021
  }
26887
27022
  async function parseXlsx(buffer, options) {
@@ -26889,7 +27024,7 @@ async function parseXlsx(buffer, options) {
26889
27024
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
26890
27025
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
26891
27026
  } catch (err) {
26892
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
27027
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26893
27028
  }
26894
27029
  }
26895
27030
  async function parseXls(buffer, options) {
@@ -26897,15 +27032,15 @@ async function parseXls(buffer, options) {
26897
27032
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
26898
27033
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
26899
27034
  } catch (err) {
26900
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
27035
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26901
27036
  }
26902
27037
  }
26903
27038
  async function parseDocx(buffer, options) {
26904
27039
  try {
26905
27040
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
26906
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _344 => _344.length]) ? images : void 0 };
27041
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _350 => _350.length]) ? images : void 0 };
26907
27042
  } catch (err) {
26908
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
27043
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26909
27044
  }
26910
27045
  }
26911
27046
  async function parseHwpml(buffer, options) {
@@ -26913,16 +27048,16 @@ async function parseHwpml(buffer, options) {
26913
27048
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
26914
27049
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
26915
27050
  } catch (err) {
26916
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunk72LLOLFXcjs.classifyError.call(void 0, err) };
27051
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkEL2Y4BL2cjs.classifyError.call(void 0, err) };
26917
27052
  }
26918
27053
  }
26919
27054
  async function fillForm(input, values, outputFormat = "markdown") {
26920
27055
  let buffer;
26921
27056
  if (typeof input === "string") {
26922
27057
  const buf = await _promises.readFile.call(void 0, input);
26923
- buffer = _chunk72LLOLFXcjs.toArrayBuffer.call(void 0, buf);
27058
+ buffer = _chunkEL2Y4BL2cjs.toArrayBuffer.call(void 0, buf);
26924
27059
  } else if (Buffer.isBuffer(input)) {
26925
- buffer = _chunk72LLOLFXcjs.toArrayBuffer.call(void 0, input);
27060
+ buffer = _chunkEL2Y4BL2cjs.toArrayBuffer.call(void 0, input);
26926
27061
  } else {
26927
27062
  buffer = input;
26928
27063
  }
@@ -26948,7 +27083,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
26948
27083
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
26949
27084
  }
26950
27085
  const fill = fillFormFields(parsed.blocks, values);
26951
- const markdown = _chunk72LLOLFXcjs.blocksToMarkdown.call(void 0, fill.blocks);
27086
+ const markdown = _chunkEL2Y4BL2cjs.blocksToMarkdown.call(void 0, fill.blocks);
26952
27087
  if (outputFormat === "hwpx") {
26953
27088
  const hwpxBuffer = await markdownToHwpx(markdown);
26954
27089
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -27011,5 +27146,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
27011
27146
 
27012
27147
 
27013
27148
 
27014
- exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunk72LLOLFXcjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunk72LLOLFXcjs.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.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.validateHwpx = validateHwpx;
27149
+ exports.HwpxSession = HwpxSession; exports.PRESET_ALIAS = PRESET_ALIAS; exports.SPACE_EM_FIXED = SPACE_EM_FIXED; exports.SPACE_EM_FONT = SPACE_EM_FONT; exports.VERSION = _chunkEL2Y4BL2cjs.VERSION; exports.ValueCursor = ValueCursor; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkEL2Y4BL2cjs.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.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; exports.measureTextWidth = measureTextWidth; exports.normalizeGongmunPreset = normalizeGongmunPreset; exports.openHwpxDocument = openHwpxDocument; exports.parse = parse; exports.parseDocx = parseDocx; exports.parseHwp = parseHwp; exports.parseHwp3 = parseHwp3; exports.parseHwpml = parseHwpml; exports.parseHwpx = parseHwpx; exports.parsePdf = parsePdf; exports.parseXls = parseXls; exports.parseXlsx = parseXlsx; exports.patchHwp = patchHwp; exports.patchHwpx = patchHwpx; exports.patchHwpxBlocks = patchHwpxBlocks; exports.placeSealHwpx = placeSealHwpx; exports.renderHtml = renderHtml; exports.renderHwpxToSvg = renderHwpxToSvg; exports.scanSectionXml = scanSectionXml; exports.simulateWrap = simulateWrap; exports.simulateWrapKeepWord = simulateWrapKeepWord; exports.validateHwpx = validateHwpx;
27015
27150
  //# sourceMappingURL=index.cjs.map