kordoc 3.1.1 → 3.2.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 (60) hide show
  1. package/README.md +584 -559
  2. package/dist/{-UCE73NNK.js → -MSRLLJNM.js} +4 -4
  3. package/dist/{chunk-ZZNSI4GV.js → chunk-7KFBGOXZ.js} +2 -2
  4. package/dist/chunk-7KFBGOXZ.js.map +1 -0
  5. package/dist/{chunk-VMUP5WPI.js → chunk-CYLOXVYY.js} +247 -43
  6. package/dist/chunk-CYLOXVYY.js.map +1 -0
  7. package/dist/chunk-DCZVOIEO.cjs.map +1 -1
  8. package/dist/chunk-GS7T56RP.cjs.map +1 -1
  9. package/dist/{chunk-5CJGKKMZ.js → chunk-MEPHGCPQ.js} +1 -1
  10. package/dist/chunk-MEPHGCPQ.js.map +1 -0
  11. package/dist/chunk-MOL7MDBG.js +0 -0
  12. package/dist/{chunk-FJON4QNB.cjs → chunk-SWEBVX5K.cjs} +2 -2
  13. package/dist/chunk-SWEBVX5K.cjs.map +1 -0
  14. package/dist/{chunk-KR6DSGM7.js → chunk-ZWVTR2HQ.js} +2 -2
  15. package/dist/chunk-ZWVTR2HQ.js.map +1 -0
  16. package/dist/cli.js +72 -5
  17. package/dist/cli.js.map +1 -1
  18. package/dist/{detect-PJZMUL2Z.js → detect-RI2MQ33K.js} +2 -2
  19. package/dist/formula-5NKVS2LR.cjs.map +1 -1
  20. package/dist/formula-JCNF43NE.js +0 -0
  21. package/dist/index.cjs +409 -205
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +44 -1
  24. package/dist/index.d.ts +44 -1
  25. package/dist/index.js +245 -41
  26. package/dist/index.js.map +1 -1
  27. package/dist/mcp.js +5 -5
  28. package/dist/mcp.js.map +1 -1
  29. package/dist/page-range-737B4EZW.js +0 -0
  30. package/dist/page-range-P7SDW6LR.cjs.map +1 -1
  31. package/dist/{parser-QTJL6IQY.js → parser-HAWIRFS4.js} +3 -3
  32. package/dist/parser-HAWIRFS4.js.map +1 -0
  33. package/dist/{parser-XULVNDMN.cjs → parser-LKIUKZJV.cjs} +15 -15
  34. package/dist/parser-LKIUKZJV.cjs.map +1 -0
  35. package/dist/{parser-4L7UFVEP.js → parser-U6KRTEB7.js} +3 -3
  36. package/dist/parser-U6KRTEB7.js.map +1 -0
  37. package/dist/{provider-H4WWSPOV.js → provider-4ZJKV3DC.js} +1 -1
  38. package/dist/provider-4ZJKV3DC.js.map +1 -0
  39. package/dist/{provider-7H4CPZYS.js → provider-AKROB7WQ.js} +1 -1
  40. package/dist/provider-AKROB7WQ.js.map +1 -0
  41. package/dist/{provider-5K7O3Z2O.cjs → provider-G4C2V2PD.cjs} +1 -1
  42. package/dist/provider-G4C2V2PD.cjs.map +1 -0
  43. package/dist/setup-57FB3LSP.js +0 -0
  44. package/dist/{watch-FPDSHB23.js → watch-OKZAU3I5.js} +4 -4
  45. package/dist/watch-OKZAU3I5.js.map +1 -0
  46. package/package.json +98 -98
  47. package/dist/chunk-5CJGKKMZ.js.map +0 -1
  48. package/dist/chunk-FJON4QNB.cjs.map +0 -1
  49. package/dist/chunk-KR6DSGM7.js.map +0 -1
  50. package/dist/chunk-VMUP5WPI.js.map +0 -1
  51. package/dist/chunk-ZZNSI4GV.js.map +0 -1
  52. package/dist/parser-4L7UFVEP.js.map +0 -1
  53. package/dist/parser-QTJL6IQY.js.map +0 -1
  54. package/dist/parser-XULVNDMN.cjs.map +0 -1
  55. package/dist/provider-5K7O3Z2O.cjs.map +0 -1
  56. package/dist/provider-7H4CPZYS.js.map +0 -1
  57. package/dist/provider-H4WWSPOV.js.map +0 -1
  58. package/dist/watch-FPDSHB23.js.map +0 -1
  59. /package/dist/{-UCE73NNK.js.map → -MSRLLJNM.js.map} +0 -0
  60. /package/dist/{detect-PJZMUL2Z.js.map → detect-RI2MQ33K.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4;
2
2
 
3
3
 
4
4
 
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkFJON4QNBcjs = require('./chunk-FJON4QNB.cjs');
20
+ var _chunkSWEBVX5Kcjs = require('./chunk-SWEBVX5K.cjs');
21
21
 
22
22
 
23
23
  var _chunkDCZVOIEOcjs = require('./chunk-DCZVOIEO.cjs');
@@ -828,7 +828,7 @@ function createSectionShared() {
828
828
  function createXmlParser(warnings) {
829
829
  return new (0, _xmldom.DOMParser)({
830
830
  onError(level, msg2) {
831
- if (level === "fatalError") throw new (0, _chunkFJON4QNBcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
831
+ if (level === "fatalError") throw new (0, _chunkSWEBVX5Kcjs.KordocError)(`XML \uD30C\uC2F1 \uC2E4\uD328: ${msg2}`);
832
832
  _optionalChain([warnings, 'optionalAccess', _3 => _3.push, 'call', _4 => _4({ code: "MALFORMED_XML", message: `XML ${level === "warn" ? "\uACBD\uACE0" : "\uC624\uB958"}: ${msg2}` })]);
833
833
  }
834
834
  });
@@ -850,10 +850,10 @@ async function extractHwpxStyles(zip, decompressed) {
850
850
  const xml = await file.async("text");
851
851
  if (decompressed) {
852
852
  decompressed.total += xml.length * 2;
853
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
853
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
854
854
  }
855
855
  const parser = createXmlParser();
856
- const doc = parser.parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, xml), "text/xml");
856
+ const doc = parser.parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, xml), "text/xml");
857
857
  if (!doc.documentElement) continue;
858
858
  parseCharProperties(doc, result.charProperties);
859
859
  parseStyleElements(doc, result.styles);
@@ -1075,7 +1075,7 @@ function resolveParaHeading(paraEl, ctx) {
1075
1075
  return { prefix, headingLevel };
1076
1076
  }
1077
1077
  async function parseHwpxDocument(buffer, options) {
1078
- _chunkFJON4QNBcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
1078
+ _chunkSWEBVX5Kcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE, MAX_ZIP_ENTRIES);
1079
1079
  let zip;
1080
1080
  try {
1081
1081
  zip = await _jszip2.default.loadAsync(buffer);
@@ -1084,7 +1084,7 @@ async function parseHwpxDocument(buffer, options) {
1084
1084
  }
1085
1085
  const actualEntryCount = Object.keys(zip.files).length;
1086
1086
  if (actualEntryCount > MAX_ZIP_ENTRIES) {
1087
- throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1087
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uC5D4\uD2B8\uB9AC \uC218 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1088
1088
  }
1089
1089
  const manifestFile = zip.file("META-INF/manifest.xml");
1090
1090
  if (manifestFile) {
@@ -1096,7 +1096,7 @@ async function parseHwpxDocument(buffer, options) {
1096
1096
  return comResultToParseResult(pages, pageCount, warnings2);
1097
1097
  }
1098
1098
  }
1099
- throw new (0, _chunkFJON4QNBcjs.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.");
1099
+ throw new (0, _chunkSWEBVX5Kcjs.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.");
1100
1100
  }
1101
1101
  }
1102
1102
  const decompressed = { total: 0 };
@@ -1105,7 +1105,7 @@ async function parseHwpxDocument(buffer, options) {
1105
1105
  const styleMap = await extractHwpxStyles(zip, decompressed);
1106
1106
  const warnings = [];
1107
1107
  const sectionPaths = await resolveSectionPaths(zip);
1108
- if (sectionPaths.length === 0) throw new (0, _chunkFJON4QNBcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1108
+ if (sectionPaths.length === 0) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1109
1109
  metadata.pageCount = sectionPaths.length;
1110
1110
  const pageFilter = _optionalChain([options, 'optionalAccess', _12 => _12.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sectionPaths.length) : null;
1111
1111
  const totalTarget = pageFilter ? pageFilter.size : sectionPaths.length;
@@ -1119,12 +1119,12 @@ async function parseHwpxDocument(buffer, options) {
1119
1119
  try {
1120
1120
  const xml = await file.async("text");
1121
1121
  decompressed.total += xml.length * 2;
1122
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1122
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1123
1123
  blocks.push(...parseSectionXml(xml, styleMap, warnings, si + 1, shared));
1124
1124
  parsedSections++;
1125
1125
  _optionalChain([options, 'optionalAccess', _13 => _13.onProgress, 'optionalCall', _14 => _14(parsedSections, totalTarget)]);
1126
1126
  } catch (secErr) {
1127
- if (secErr instanceof _chunkFJON4QNBcjs.KordocError) throw secErr;
1127
+ if (secErr instanceof _chunkSWEBVX5Kcjs.KordocError) throw secErr;
1128
1128
  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" });
1129
1129
  }
1130
1130
  }
@@ -1132,7 +1132,7 @@ async function parseHwpxDocument(buffer, options) {
1132
1132
  const images = await extractImagesFromZip(zip, blocks, decompressed, warnings);
1133
1133
  detectHwpxHeadings(blocks, styleMap);
1134
1134
  const outline = blocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
1135
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
1135
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
1136
1136
  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 };
1137
1137
  }
1138
1138
  function applyPageText(blocks, shared) {
@@ -1221,13 +1221,13 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1221
1221
  let found = false;
1222
1222
  const allCandidates = resolvedPath ? [resolvedPath, ...candidates] : candidates;
1223
1223
  for (const path of allCandidates) {
1224
- if (_chunkFJON4QNBcjs.isPathTraversal.call(void 0, path)) continue;
1224
+ if (_chunkSWEBVX5Kcjs.isPathTraversal.call(void 0, path)) continue;
1225
1225
  const file = zip.file(path);
1226
1226
  if (!file) continue;
1227
1227
  try {
1228
1228
  const data = await file.async("uint8array");
1229
1229
  decompressed.total += data.length;
1230
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1230
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1231
1231
  const actualPath = path;
1232
1232
  const ext = actualPath.includes(".") ? actualPath.split(".").pop() || "png" : "png";
1233
1233
  const mimeType = imageExtToMime(ext);
@@ -1240,7 +1240,7 @@ async function extractImagesFromZip(zip, blocks, decompressed, warnings) {
1240
1240
  found = true;
1241
1241
  break;
1242
1242
  } catch (err) {
1243
- if (err instanceof _chunkFJON4QNBcjs.KordocError) throw err;
1243
+ if (err instanceof _chunkSWEBVX5Kcjs.KordocError) throw err;
1244
1244
  }
1245
1245
  }
1246
1246
  if (!found) {
@@ -1261,7 +1261,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
1261
1261
  const xml = await file.async("text");
1262
1262
  if (decompressed) {
1263
1263
  decompressed.total += xml.length * 2;
1264
- if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1264
+ if (decompressed.total > MAX_DECOMPRESS_SIZE) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (ZIP bomb \uC758\uC2EC)");
1265
1265
  }
1266
1266
  parseDublinCoreMetadata(xml, metadata);
1267
1267
  if (metadata.title || metadata.author) return;
@@ -1271,7 +1271,7 @@ async function extractHwpxMetadata(zip, metadata, decompressed) {
1271
1271
  }
1272
1272
  function parseDublinCoreMetadata(xml, metadata) {
1273
1273
  const parser = createXmlParser();
1274
- const doc = parser.parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, xml), "text/xml");
1274
+ const doc = parser.parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, xml), "text/xml");
1275
1275
  if (!doc.documentElement) return;
1276
1276
  const getText = (tagNames) => {
1277
1277
  for (const tag of tagNames) {
@@ -1331,7 +1331,7 @@ function extractFromBrokenZip(buffer) {
1331
1331
  }
1332
1332
  const nameBytes = data.slice(pos + 30, pos + 30 + nameLen);
1333
1333
  const name = new TextDecoder().decode(nameBytes);
1334
- if (_chunkFJON4QNBcjs.isPathTraversal.call(void 0, name)) {
1334
+ if (_chunkSWEBVX5Kcjs.isPathTraversal.call(void 0, name)) {
1335
1335
  pos = fileStart + compSize;
1336
1336
  continue;
1337
1337
  }
@@ -1349,16 +1349,16 @@ function extractFromBrokenZip(buffer) {
1349
1349
  continue;
1350
1350
  }
1351
1351
  totalDecompressed += content.length * 2;
1352
- if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1352
+ if (totalDecompressed > MAX_DECOMPRESS_SIZE) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC");
1353
1353
  sectionNum++;
1354
1354
  blocks.push(...parseSectionXml(content, void 0, warnings, sectionNum, shared));
1355
1355
  } catch (e13) {
1356
1356
  continue;
1357
1357
  }
1358
1358
  }
1359
- if (blocks.length === 0) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1359
+ if (blocks.length === 0) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC190\uC0C1\uB41C HWPX\uC5D0\uC11C \uC139\uC158 \uB370\uC774\uD130\uB97C \uBCF5\uAD6C\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
1360
1360
  applyPageText(blocks, shared);
1361
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
1361
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
1362
1362
  return { markdown, blocks, warnings: warnings.length > 0 ? warnings : void 0 };
1363
1363
  }
1364
1364
  async function resolveSectionPaths(zip) {
@@ -1376,7 +1376,7 @@ async function resolveSectionPaths(zip) {
1376
1376
  }
1377
1377
  function parseSectionPathsFromManifest(xml) {
1378
1378
  const parser = createXmlParser();
1379
- const doc = parser.parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, xml), "text/xml");
1379
+ const doc = parser.parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, xml), "text/xml");
1380
1380
  const items = doc.getElementsByTagName("opf:item");
1381
1381
  const spine = doc.getElementsByTagName("opf:itemref");
1382
1382
  const isSectionId = (id) => /^s/i.test(id) || id.toLowerCase().includes("section");
@@ -1424,9 +1424,9 @@ function detectHwpxHeadings(blocks, styleMap) {
1424
1424
  let level = 0;
1425
1425
  if (baseFontSize > 0 && _optionalChain([block, 'access', _25 => _25.style, 'optionalAccess', _26 => _26.fontSize])) {
1426
1426
  const ratio = block.style.fontSize / baseFontSize;
1427
- if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H1) level = 1;
1428
- else if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H2) level = 2;
1429
- else if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H3) level = 3;
1427
+ if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H1) level = 1;
1428
+ else if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H2) level = 2;
1429
+ else if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H3) level = 3;
1430
1430
  }
1431
1431
  const compactText = text.replace(/\s+/g, "");
1432
1432
  if (/^제\d+[조장절편]/.test(compactText) && text.length <= 50) {
@@ -1439,7 +1439,7 @@ function detectHwpxHeadings(blocks, styleMap) {
1439
1439
  }
1440
1440
  }
1441
1441
  function buildTableWithCellMeta(state) {
1442
- const table = _chunkFJON4QNBcjs.buildTable.call(void 0, state.rows);
1442
+ const table = _chunkSWEBVX5Kcjs.buildTable.call(void 0, state.rows);
1443
1443
  if (state.caption) table.caption = state.caption;
1444
1444
  const claimed = /* @__PURE__ */ new Set();
1445
1445
  for (const row of state.rows) {
@@ -1482,7 +1482,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1482
1482
  const cell = parentTable.cell;
1483
1483
  (cell.blocks ??= []).push(block);
1484
1484
  cell.hasStructure = true;
1485
- let flat = _chunkFJON4QNBcjs.convertTableToText.call(void 0, newTable.rows);
1485
+ let flat = _chunkSWEBVX5Kcjs.convertTableToText.call(void 0, newTable.rows);
1486
1486
  if (newTable.caption) flat = newTable.caption + (flat ? "\n" + flat : "");
1487
1487
  if (flat) cell.text += (cell.text ? "\n" : "") + flat;
1488
1488
  } else {
@@ -1492,7 +1492,7 @@ function completeTable(newTable, tableStack, blocks, ctx) {
1492
1492
  }
1493
1493
  function parseSectionXml(xml, styleMap, warnings, sectionNum, shared) {
1494
1494
  const parser = createXmlParser(warnings);
1495
- const doc = parser.parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, xml), "text/xml");
1495
+ const doc = parser.parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, xml), "text/xml");
1496
1496
  if (!doc.documentElement) return [];
1497
1497
  const ctx = { styleMap, warnings, sectionNum, shared: _nullishCoalesce(shared, () => ( createSectionShared())) };
1498
1498
  ctx.shared.track.deleteDepth = 0;
@@ -1583,8 +1583,8 @@ function walkSection(node, blocks, tableCtx, tableStack, ctx, depth = 0) {
1583
1583
  const cs = isNaN(rawCs) ? 1 : rawCs;
1584
1584
  const rawRs = parseInt(el.getAttribute("rowSpan") || "1", 10);
1585
1585
  const rs = isNaN(rawRs) ? 1 : rawRs;
1586
- tableCtx.cell.colSpan = clampSpan(cs, _chunkFJON4QNBcjs.MAX_COLS);
1587
- tableCtx.cell.rowSpan = clampSpan(rs, _chunkFJON4QNBcjs.MAX_ROWS);
1586
+ tableCtx.cell.colSpan = clampSpan(cs, _chunkSWEBVX5Kcjs.MAX_COLS);
1587
+ tableCtx.cell.rowSpan = clampSpan(rs, _chunkSWEBVX5Kcjs.MAX_ROWS);
1588
1588
  }
1589
1589
  break;
1590
1590
  case "p": {
@@ -1806,7 +1806,7 @@ function extractHyperlinkHref(fieldBegin) {
1806
1806
  let url = (ch.textContent || "").trim();
1807
1807
  if (!url) continue;
1808
1808
  url = url.replace(/^https?:\/\/(?=https?:\/\/)/i, "");
1809
- const safe = _chunkFJON4QNBcjs.sanitizeHref.call(void 0, url);
1809
+ const safe = _chunkSWEBVX5Kcjs.sanitizeHref.call(void 0, url);
1810
1810
  if (safe) return safe;
1811
1811
  }
1812
1812
  return void 0;
@@ -1941,7 +1941,7 @@ function extractParagraphInfo(para, styleMap, ctx) {
1941
1941
  case "hyperlink": {
1942
1942
  const url = child.getAttribute("url") || child.getAttribute("href") || "";
1943
1943
  if (url) {
1944
- const safe = _chunkFJON4QNBcjs.sanitizeHref.call(void 0, url);
1944
+ const safe = _chunkSWEBVX5Kcjs.sanitizeHref.call(void 0, url);
1945
1945
  if (safe) href = safe;
1946
1946
  }
1947
1947
  walk(child);
@@ -2131,7 +2131,7 @@ function decompressStream(data) {
2131
2131
  return _zlib.inflateRawSync.call(void 0, data, opts);
2132
2132
  }
2133
2133
  function parseFileHeader(data) {
2134
- if (data.length < 40) throw new (0, _chunkFJON4QNBcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2134
+ if (data.length < 40) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("FileHeader\uAC00 \uB108\uBB34 \uC9E7\uC2B5\uB2C8\uB2E4 (\uCD5C\uC18C 40\uBC14\uC774\uD2B8)");
2135
2135
  const sig = data.subarray(0, 32).toString("utf8").replace(/\0+$/, "");
2136
2136
  return {
2137
2137
  signature: sig,
@@ -3655,7 +3655,7 @@ function parseHwp5Document(buffer, options) {
3655
3655
  lenientCfb = parseLenientCfb(buffer);
3656
3656
  warnings.push({ message: "\uC190\uC0C1\uB41C CFB \uCEE8\uD14C\uC774\uB108 \u2014 lenient \uBAA8\uB4DC\uB85C \uBCF5\uAD6C", code: "LENIENT_CFB_RECOVERY" });
3657
3657
  } catch (e20) {
3658
- throw new (0, _chunkFJON4QNBcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3658
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328 (strict \uBC0F lenient \uBAA8\uB450)");
3659
3659
  }
3660
3660
  }
3661
3661
  const findStream = (path) => {
@@ -3666,11 +3666,11 @@ function parseHwp5Document(buffer, options) {
3666
3666
  return lenientCfb.findStream(path);
3667
3667
  };
3668
3668
  const headerData = findStream("/FileHeader");
3669
- if (!headerData) throw new (0, _chunkFJON4QNBcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3669
+ if (!headerData) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("FileHeader \uC2A4\uD2B8\uB9BC \uC5C6\uC74C");
3670
3670
  const header = parseFileHeader(headerData);
3671
- if (header.signature !== "HWP Document File") throw new (0, _chunkFJON4QNBcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3672
- if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3673
- if (header.flags & FLAG_DRM) throw new (0, _chunkFJON4QNBcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3671
+ if (header.signature !== "HWP Document File") throw new (0, _chunkSWEBVX5Kcjs.KordocError)("HWP \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
3672
+ if (header.flags & FLAG_ENCRYPTED) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC554\uD638\uD654\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3673
+ if (header.flags & FLAG_DRM) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("DRM \uBCF4\uD638\uB41C HWP\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
3674
3674
  const compressed = (header.flags & FLAG_COMPRESSED) !== 0;
3675
3675
  const distribution = (header.flags & FLAG_DISTRIBUTION) !== 0;
3676
3676
  const metadata = {
@@ -3679,7 +3679,7 @@ function parseHwp5Document(buffer, options) {
3679
3679
  if (cfb) extractHwp5Metadata(cfb, metadata);
3680
3680
  const docInfo = cfb ? parseDocInfoStream(cfb, compressed) : parseDocInfoFromStream(findStream("/DocInfo"), compressed);
3681
3681
  const sections = distribution ? cfb ? findViewTextSections(cfb, compressed) : findViewTextSectionsLenient(lenientCfb, compressed) : cfb ? findSections(cfb) : findSectionsLenient(lenientCfb, compressed);
3682
- if (sections.length === 0) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3682
+ if (sections.length === 0) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC139\uC158 \uC2A4\uD2B8\uB9BC\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
3683
3683
  metadata.pageCount = sections.length;
3684
3684
  const pageFilter = _optionalChain([options, 'optionalAccess', _51 => _51.pages]) ? _chunkDCZVOIEOcjs.parsePageRange.call(void 0, options.pages, sections.length) : null;
3685
3685
  const totalTarget = pageFilter ? pageFilter.size : sections.length;
@@ -3693,25 +3693,25 @@ function parseHwp5Document(buffer, options) {
3693
3693
  const sectionData = sections[si];
3694
3694
  const data = !distribution && compressed ? decompressStream(Buffer.from(sectionData)) : Buffer.from(sectionData);
3695
3695
  totalDecompressed += data.length;
3696
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3696
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3697
3697
  const records = readRecords(data);
3698
3698
  const sectionBlocks = parseSection(records, docInfo, warnings, si + 1, doc);
3699
3699
  bodyBlocks.push(...sectionBlocks);
3700
3700
  parsedSections++;
3701
3701
  _optionalChain([options, 'optionalAccess', _52 => _52.onProgress, 'optionalCall', _53 => _53(parsedSections, totalTarget)]);
3702
3702
  } catch (secErr) {
3703
- if (secErr instanceof _chunkFJON4QNBcjs.KordocError) throw secErr;
3703
+ if (secErr instanceof _chunkSWEBVX5Kcjs.KordocError) throw secErr;
3704
3704
  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" });
3705
3705
  }
3706
3706
  }
3707
3707
  const blocks = [...doc.headerBlocks, ...bodyBlocks, ...doc.footerBlocks];
3708
3708
  const images = cfb ? extractHwp5Images(cfb.FileIndex, blocks, warnings) : extractHwp5ImagesLenient(lenientCfb, blocks, warnings);
3709
- const flatBlocks = _chunkFJON4QNBcjs.flattenLayoutTables.call(void 0, blocks);
3709
+ const flatBlocks = _chunkSWEBVX5Kcjs.flattenLayoutTables.call(void 0, blocks);
3710
3710
  if (docInfo) {
3711
3711
  detectHwp5Headings(flatBlocks, docInfo);
3712
3712
  }
3713
3713
  const outline = flatBlocks.filter((b) => b.type === "heading" && b.level && b.text).map((b) => ({ level: b.level, text: b.text, pageNumber: b.pageNumber }));
3714
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, flatBlocks);
3714
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, flatBlocks);
3715
3715
  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 };
3716
3716
  }
3717
3717
  function parseDocInfoStream(cfb, compressed) {
@@ -3771,9 +3771,9 @@ function detectHwp5Headings(blocks, docInfo) {
3771
3771
  let level = 0;
3772
3772
  if (_optionalChain([block, 'access', _58 => _58.style, 'optionalAccess', _59 => _59.fontSize]) && baseFontSize > 0) {
3773
3773
  const ratio = block.style.fontSize / baseFontSize;
3774
- if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H1) level = 1;
3775
- else if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H2) level = 2;
3776
- else if (ratio >= _chunkFJON4QNBcjs.HEADING_RATIO_H3) level = 3;
3774
+ if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H1) level = 1;
3775
+ else if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H2) level = 2;
3776
+ else if (ratio >= _chunkSWEBVX5Kcjs.HEADING_RATIO_H3) level = 3;
3777
3777
  }
3778
3778
  if (/^제\d+[장절편]\s/.test(text) && text.length <= 50) {
3779
3779
  if (level === 0) level = 2;
@@ -3858,7 +3858,7 @@ function findSectionsLenient(lcfb, compressed) {
3858
3858
  if (!raw) break;
3859
3859
  const content = compressed ? decompressStream(raw) : raw;
3860
3860
  totalDecompressed += content.length;
3861
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3861
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3862
3862
  sections.push({ idx: i, content });
3863
3863
  }
3864
3864
  if (sections.length === 0) {
@@ -3870,7 +3870,7 @@ function findSectionsLenient(lcfb, compressed) {
3870
3870
  if (raw) {
3871
3871
  const content = compressed ? decompressStream(raw) : raw;
3872
3872
  totalDecompressed += content.length;
3873
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3873
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3874
3874
  sections.push({ idx, content });
3875
3875
  }
3876
3876
  }
@@ -3887,7 +3887,7 @@ function findViewTextSectionsLenient(lcfb, compressed) {
3887
3887
  try {
3888
3888
  const content = decryptViewText(raw, compressed);
3889
3889
  totalDecompressed += content.length;
3890
- if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkFJON4QNBcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3890
+ if (totalDecompressed > MAX_TOTAL_DECOMPRESS) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uCD1D \uC555\uCD95 \uD574\uC81C \uD06C\uAE30 \uCD08\uACFC (decompression bomb \uC758\uC2EC)");
3891
3891
  sections.push({ idx: i, content });
3892
3892
  } catch (e25) {
3893
3893
  break;
@@ -3990,7 +3990,7 @@ function parseParagraph(records, start, end, ctx) {
3990
3990
  const ctrl = ctrls[r.ctrlIdx];
3991
3991
  if (!_optionalChain([ctrl, 'optionalAccess', _66 => _66.href]) || r.end <= r.start) continue;
3992
3992
  if (applied.some(([s, e]) => r.start < e && r.end > s)) continue;
3993
- const href = _chunkFJON4QNBcjs.sanitizeHref.call(void 0, ctrl.href);
3993
+ const href = _chunkSWEBVX5Kcjs.sanitizeHref.call(void 0, ctrl.href);
3994
3994
  if (!href) continue;
3995
3995
  const anchor = text.slice(r.start, r.end);
3996
3996
  if (!anchor.trim()) continue;
@@ -4223,8 +4223,8 @@ function parseTableControl(ctrl, records, ctx) {
4223
4223
  let tableIdx = -1;
4224
4224
  for (let i2 = childStart; i2 < childEnd; i2++) {
4225
4225
  if (records[i2].tagId === TAG_TABLE && records[i2].data.length >= 8) {
4226
- rows = Math.min(records[i2].data.readUInt16LE(4), _chunkFJON4QNBcjs.MAX_ROWS);
4227
- cols = Math.min(records[i2].data.readUInt16LE(6), _chunkFJON4QNBcjs.MAX_COLS);
4226
+ rows = Math.min(records[i2].data.readUInt16LE(4), _chunkSWEBVX5Kcjs.MAX_ROWS);
4227
+ cols = Math.min(records[i2].data.readUInt16LE(6), _chunkSWEBVX5Kcjs.MAX_COLS);
4228
4228
  tableIdx = i2;
4229
4229
  break;
4230
4230
  }
@@ -4273,7 +4273,7 @@ function parseTableControl(ctrl, records, ctx) {
4273
4273
  return table2;
4274
4274
  }
4275
4275
  const cellRows = arrangeCells(rows, cols, cells);
4276
- const table = _chunkFJON4QNBcjs.buildTable.call(void 0, cellRows);
4276
+ const table = _chunkSWEBVX5Kcjs.buildTable.call(void 0, cellRows);
4277
4277
  if (caption && table.rows > 0) table.caption = caption;
4278
4278
  return table.rows > 0 ? table : null;
4279
4279
  }
@@ -4290,8 +4290,8 @@ function parseCell(records, lhIdx, end, ctx) {
4290
4290
  rowAddr = rec.data.readUInt16LE(10);
4291
4291
  const cs = rec.data.readUInt16LE(12);
4292
4292
  const rs = rec.data.readUInt16LE(14);
4293
- if (cs > 0) colSpan = Math.min(cs, _chunkFJON4QNBcjs.MAX_COLS);
4294
- if (rs > 0) rowSpan = Math.min(rs, _chunkFJON4QNBcjs.MAX_ROWS);
4293
+ if (cs > 0) colSpan = Math.min(cs, _chunkSWEBVX5Kcjs.MAX_COLS);
4294
+ if (rs > 0) rowSpan = Math.min(rs, _chunkSWEBVX5Kcjs.MAX_ROWS);
4295
4295
  }
4296
4296
  const blocks = ctx.depth < MAX_NEST_DEPTH ? parseParagraphList(records, lhIdx + 1, end, { ...ctx, depth: ctx.depth + 1 }) : [];
4297
4297
  const parts = [];
@@ -4301,7 +4301,7 @@ function parseCell(records, lhIdx, end, ctx) {
4301
4301
  parts.push(`![image](hwp5bin:${b.text})`);
4302
4302
  hasStructure = true;
4303
4303
  } else if (b.type === "table" && b.table) {
4304
- const flat = _chunkFJON4QNBcjs.convertTableToText.call(void 0, b.table.cells);
4304
+ const flat = _chunkSWEBVX5Kcjs.convertTableToText.call(void 0, b.table.cells);
4305
4305
  if (flat) parts.push(flat);
4306
4306
  hasStructure = true;
4307
4307
  } else if (b.text) {
@@ -16735,7 +16735,7 @@ function getTextContent(el) {
16735
16735
  return _nullishCoalesce(_optionalChain([el, 'access', _79 => _79.textContent, 'optionalAccess', _80 => _80.trim, 'call', _81 => _81()]), () => ( ""));
16736
16736
  }
16737
16737
  function parseXml(text) {
16738
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, text), "text/xml");
16738
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, text), "text/xml");
16739
16739
  }
16740
16740
  function parseSharedStrings(xml) {
16741
16741
  const doc = parseXml(xml);
@@ -16879,7 +16879,7 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16879
16879
  cellRows.push(row);
16880
16880
  }
16881
16881
  if (cellRows.length > 0) {
16882
- const table = _chunkFJON4QNBcjs.buildTable.call(void 0, cellRows);
16882
+ const table = _chunkSWEBVX5Kcjs.buildTable.call(void 0, cellRows);
16883
16883
  if (table.rows > 0) {
16884
16884
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
16885
16885
  }
@@ -16887,12 +16887,12 @@ function sheetToBlocks(sheetName, grid, merges, maxRow, maxCol, sheetIndex) {
16887
16887
  return blocks;
16888
16888
  }
16889
16889
  async function parseXlsxDocument(buffer, options) {
16890
- _chunkFJON4QNBcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16890
+ _chunkSWEBVX5Kcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE3);
16891
16891
  const zip = await _jszip2.default.loadAsync(buffer);
16892
16892
  const warnings = [];
16893
16893
  const workbookFile = zip.file("xl/workbook.xml");
16894
16894
  if (!workbookFile) {
16895
- throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16895
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 XLSX \uD30C\uC77C: xl/workbook.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
16896
16896
  }
16897
16897
  let sharedStrings = [];
16898
16898
  const ssFile = zip.file("xl/sharedStrings.xml");
@@ -16901,7 +16901,7 @@ async function parseXlsxDocument(buffer, options) {
16901
16901
  }
16902
16902
  const sheets = parseWorkbook(await workbookFile.async("text"));
16903
16903
  if (sheets.length === 0) {
16904
- throw new (0, _chunkFJON4QNBcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16904
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("XLSX \uD30C\uC77C\uC5D0 \uC2DC\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4");
16905
16905
  }
16906
16906
  let relsMap = /* @__PURE__ */ new Map();
16907
16907
  const relsFile = zip.file("xl/_rels/workbook.xml.rels");
@@ -16973,7 +16973,7 @@ async function parseXlsxDocument(buffer, options) {
16973
16973
  } catch (e26) {
16974
16974
  }
16975
16975
  }
16976
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
16976
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
16977
16977
  return { markdown, blocks, metadata, warnings: warnings.length > 0 ? warnings : void 0 };
16978
16978
  }
16979
16979
 
@@ -17380,11 +17380,11 @@ function processGlobals(records) {
17380
17380
  let encrypted = false;
17381
17381
  const firstBof = records[0];
17382
17382
  if (!firstBof || firstBof.opcode !== OP_BOF) {
17383
- throw new (0, _chunkFJON4QNBcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17383
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("XLS: \uCCAB \uB808\uCF54\uB4DC\uAC00 BOF\uAC00 \uC544\uB2D8");
17384
17384
  }
17385
17385
  const bof = decodeBof(firstBof.data);
17386
17386
  if (!bof || bof.dt !== DT_GLOBALS) {
17387
- throw new (0, _chunkFJON4QNBcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17387
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("XLS: Globals \uC11C\uBE0C\uC2A4\uD2B8\uB9BC BOF \uB204\uB77D");
17388
17388
  }
17389
17389
  let i = 1;
17390
17390
  while (i < records.length) {
@@ -17499,7 +17499,7 @@ function sheetToBlocks2(sheetName, sheet, sheetIndex) {
17499
17499
  cellRows.push(row);
17500
17500
  }
17501
17501
  if (cellRows.length > 0) {
17502
- const table = _chunkFJON4QNBcjs.buildTable.call(void 0, cellRows);
17502
+ const table = _chunkSWEBVX5Kcjs.buildTable.call(void 0, cellRows);
17503
17503
  if (table.rows > 0) {
17504
17504
  blocks.push({ type: "table", table, pageNumber: sheetIndex + 1 });
17505
17505
  }
@@ -17512,21 +17512,21 @@ async function parseXlsDocument(buffer, options) {
17512
17512
  try {
17513
17513
  cfb = parseLenientCfb(buf);
17514
17514
  } catch (e) {
17515
- throw new (0, _chunkFJON4QNBcjs.KordocError)(
17515
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)(
17516
17516
  `XLS: OLE2 \uC2DC\uADF8\uB2C8\uCC98 \uAC80\uC99D \uC2E4\uD328 \u2014 ${e instanceof Error ? e.message : "\uC54C \uC218 \uC5C6\uB294 \uC624\uB958"}`
17517
17517
  );
17518
17518
  }
17519
17519
  const wb = _nullishCoalesce(cfb.findStream("/Workbook"), () => ( cfb.findStream("/Book")));
17520
17520
  if (!wb) {
17521
- throw new (0, _chunkFJON4QNBcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17521
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("XLS: Workbook \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC74C (BIFF5 \uB610\uB294 \uBE44\uD45C\uC900 \uD30C\uC77C)");
17522
17522
  }
17523
17523
  const records = readRecords2(wb);
17524
17524
  if (records.length === 0) {
17525
- throw new (0, _chunkFJON4QNBcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17525
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("XLS: \uC2DC\uADF8\uB2C8\uCC98 \uB808\uCF54\uB4DC\uAC00 \uC5C6\uC74C (Workbook \uC2A4\uD2B8\uB9BC \uC190\uC0C1)");
17526
17526
  }
17527
17527
  const firstBof = decodeBof(records[0].data);
17528
17528
  if (firstBof && firstBof.vers !== 1536) {
17529
- throw new (0, _chunkFJON4QNBcjs.KordocError)(
17529
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)(
17530
17530
  `XLS: BIFF8(0x0600)\uB9CC \uC9C0\uC6D0 \u2014 \uBCF8 \uD30C\uC77C\uC740 0x${firstBof.vers.toString(16)}`
17531
17531
  );
17532
17532
  }
@@ -17586,7 +17586,7 @@ async function parseXlsDocument(buffer, options) {
17586
17586
  pageCount: totalSheets
17587
17587
  };
17588
17588
  return {
17589
- markdown: _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, allBlocks),
17589
+ markdown: _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, allBlocks),
17590
17590
  blocks: allBlocks,
17591
17591
  metadata,
17592
17592
  warnings: warnings.length > 0 ? warnings : void 0
@@ -18012,7 +18012,7 @@ function getAttr(el, localName2) {
18012
18012
  return null;
18013
18013
  }
18014
18014
  function parseXml2(text) {
18015
- return new (0, _xmldom.DOMParser)().parseFromString(_chunkFJON4QNBcjs.stripDtd.call(void 0, text), "text/xml");
18015
+ return new (0, _xmldom.DOMParser)().parseFromString(_chunkSWEBVX5Kcjs.stripDtd.call(void 0, text), "text/xml");
18016
18016
  }
18017
18017
  function parseStyles(xml) {
18018
18018
  const doc = parseXml2(xml);
@@ -18331,12 +18331,12 @@ async function extractImages(zip, rels, doc) {
18331
18331
  return { blocks, images };
18332
18332
  }
18333
18333
  async function parseDocxDocument(buffer, options) {
18334
- _chunkFJON4QNBcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18334
+ _chunkSWEBVX5Kcjs.precheckZipSize.call(void 0, buffer, MAX_DECOMPRESS_SIZE4);
18335
18335
  const zip = await _jszip2.default.loadAsync(buffer);
18336
18336
  const warnings = [];
18337
18337
  const docFile = zip.file("word/document.xml");
18338
18338
  if (!docFile) {
18339
- throw new (0, _chunkFJON4QNBcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18339
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("\uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 DOCX \uD30C\uC77C: word/document.xml\uC774 \uC5C6\uC2B5\uB2C8\uB2E4");
18340
18340
  }
18341
18341
  let rels = /* @__PURE__ */ new Map();
18342
18342
  const relsFile = zip.file("word/_rels/document.xml.rels");
@@ -18371,7 +18371,7 @@ async function parseDocxDocument(buffer, options) {
18371
18371
  const doc = parseXml2(docXml);
18372
18372
  const body = findElements(doc, "body");
18373
18373
  if (body.length === 0) {
18374
- throw new (0, _chunkFJON4QNBcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18374
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("DOCX \uBCF8\uBB38(w:body)\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
18375
18375
  }
18376
18376
  const blocks = [];
18377
18377
  const bodyEl = body[0];
@@ -18411,7 +18411,7 @@ async function parseDocxDocument(buffer, options) {
18411
18411
  }
18412
18412
  }
18413
18413
  const outline = blocks.filter((b) => b.type === "heading").map((b) => ({ level: _nullishCoalesce(b.level, () => ( 2)), text: _nullishCoalesce(b.text, () => ( "")) }));
18414
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
18414
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
18415
18415
  return {
18416
18416
  markdown,
18417
18417
  blocks,
@@ -18434,7 +18434,7 @@ function parseHwpmlDocument(buffer, options) {
18434
18434
  }
18435
18435
  const text = new TextDecoder("utf-8").decode(buffer).replace(/^\uFEFF/, "");
18436
18436
  const normalized = text.replace(/&nbsp;/g, "&#160;");
18437
- const xml = _chunkFJON4QNBcjs.stripDtd.call(void 0, normalized);
18437
+ const xml = _chunkSWEBVX5Kcjs.stripDtd.call(void 0, normalized);
18438
18438
  const warnings = [];
18439
18439
  const parser = new (0, _xmldom.DOMParser)({
18440
18440
  onError: (_level, msg2) => {
@@ -18474,7 +18474,7 @@ function parseHwpmlDocument(buffer, options) {
18474
18474
  parseSection2(el, blocks, paraShapeMap, sectionIdx, warnings);
18475
18475
  }
18476
18476
  const outline = blocks.filter((b) => b.type === "heading" && b.text).map((b) => ({ level: _nullishCoalesce(b.level, () => ( 1)), text: b.text, pageNumber: b.pageNumber }));
18477
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
18477
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
18478
18478
  return {
18479
18479
  markdown,
18480
18480
  blocks,
@@ -18616,7 +18616,7 @@ function parseTable2(el, blocks, paraShapeMap, sectionNum, warnings) {
18616
18616
  const cellRows = grid.map(
18617
18617
  (row) => row.map((cell) => _nullishCoalesce(cell, () => ( { text: "", colSpan: 1, rowSpan: 1 })))
18618
18618
  );
18619
- const table = _chunkFJON4QNBcjs.buildTable.call(void 0, cellRows);
18619
+ const table = _chunkSWEBVX5Kcjs.buildTable.call(void 0, cellRows);
18620
18620
  blocks.push({ type: "table", table, pageNumber: sectionNum });
18621
18621
  }
18622
18622
  function extractCellText(cellEl) {
@@ -19630,19 +19630,19 @@ function parseCentralDirectory(buf) {
19630
19630
  }
19631
19631
  }
19632
19632
  }
19633
- if (eocdOffset < 0) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19633
+ if (eocdOffset < 0) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP EOCD\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19634
19634
  const totalEntries = view.getUint16(eocdOffset + 10, true);
19635
19635
  const cdSize = view.getUint32(eocdOffset + 12, true);
19636
19636
  const cdOffset = view.getUint32(eocdOffset + 16, true);
19637
- if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19637
+ if (cdOffset === 4294967295 || totalEntries === 65535) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19638
19638
  if (eocdOffset >= 20 && view.getUint32(eocdOffset - 20, true) === ZIP64_EOCD_LOC_SIG) {
19639
- throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19639
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19640
19640
  }
19641
19641
  const decoder = new TextDecoder("utf-8");
19642
19642
  const entries = [];
19643
19643
  let pos = cdOffset;
19644
19644
  for (let i = 0; i < totalEntries; i++) {
19645
- if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19645
+ if (view.getUint32(pos, true) !== CD_SIG) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP Central Directory \uC190\uC0C1");
19646
19646
  const flags = view.getUint16(pos + 8, true);
19647
19647
  const method = view.getUint16(pos + 10, true);
19648
19648
  const crc = view.getUint32(pos + 16, true);
@@ -19653,7 +19653,7 @@ function parseCentralDirectory(buf) {
19653
19653
  const commentLen = view.getUint16(pos + 32, true);
19654
19654
  const localOffset = view.getUint32(pos + 42, true);
19655
19655
  if (compSize === 4294967295 || uncompSize === 4294967295 || localOffset === 4294967295) {
19656
- throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19656
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP64\uB294 \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4");
19657
19657
  }
19658
19658
  const name = decoder.decode(buf.subarray(pos + 46, pos + 46 + nameLen));
19659
19659
  const cdEnd = pos + 46 + nameLen + extraLen + commentLen;
@@ -19682,7 +19682,7 @@ function patchZipEntries(original, replacements) {
19682
19682
  const { entries, cdOffset, eocdOffset } = parseCentralDirectory(original);
19683
19683
  const view = new DataView(original.buffer, original.byteOffset, original.byteLength);
19684
19684
  for (const name of replacements.keys()) {
19685
- if (!entries.some((e) => e.name === name)) throw new (0, _chunkFJON4QNBcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19685
+ if (!entries.some((e) => e.name === name)) throw new (0, _chunkSWEBVX5Kcjs.KordocError)(`ZIP\uC5D0 \uC5C6\uB294 \uC5D4\uD2B8\uB9AC: ${name}`);
19686
19686
  }
19687
19687
  const byLocal = [...entries].sort((a, b) => a.localOffset - b.localOffset);
19688
19688
  const segments = [];
@@ -19700,7 +19700,7 @@ function patchZipEntries(original, replacements) {
19700
19700
  offset += seg.length;
19701
19701
  continue;
19702
19702
  }
19703
- if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkFJON4QNBcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
19703
+ if (view.getUint32(e.localOffset, true) !== LOCAL_SIG) throw new (0, _chunkSWEBVX5Kcjs.KordocError)("ZIP \uB85C\uCEEC \uD5E4\uB354 \uC2DC\uADF8\uB2C8\uCC98 \uBD88\uC77C\uCE58");
19704
19704
  const nameLen = view.getUint16(e.localOffset + 26, true);
19705
19705
  const extraLen = view.getUint16(e.localOffset + 28, true);
19706
19706
  const headerLen = 30 + nameLen + extraLen;
@@ -19755,7 +19755,7 @@ async function fillHwpx(hwpxBuffer, values) {
19755
19755
  const zip = await _jszip2.default.loadAsync(hwpxBuffer);
19756
19756
  const sectionPaths = Object.keys(zip.files).filter((name) => /[Ss]ection\d+\.xml$/i.test(name)).sort();
19757
19757
  if (sectionPaths.length === 0) {
19758
- throw new (0, _chunkFJON4QNBcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19758
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)("HWPX\uC5D0\uC11C \uC139\uC158 \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4");
19759
19759
  }
19760
19760
  const normalizedValues = normalizeValues(values);
19761
19761
  const matchedLabels = /* @__PURE__ */ new Set();
@@ -19981,9 +19981,115 @@ async function fillHwpx(hwpxBuffer, values) {
19981
19981
 
19982
19982
  // src/hwpx/generator.ts
19983
19983
 
19984
+
19985
+ // src/hwpx/gongmun.ts
19986
+ var OFFICIAL_MARGINS = { top: 20, bottom: 10, left: 20, right: 20 };
19987
+ var PRESET_DEFAULTS = {
19988
+ official: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19989
+ report: { bodyPt: 15, lineSpacing: 160, numbering: "report" },
19990
+ plan: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19991
+ notice: { bodyPt: 15, lineSpacing: 160, numbering: "standard" },
19992
+ minutes: { bodyPt: 14, lineSpacing: 130, numbering: "standard" }
19993
+ };
19994
+ function resolveGongmun(opts) {
19995
+ const preset = _nullishCoalesce(opts.preset, () => ( "official"));
19996
+ const d = PRESET_DEFAULTS[preset];
19997
+ const bodyPt = _nullishCoalesce(opts.bodyPt, () => ( d.bodyPt));
19998
+ return {
19999
+ preset,
20000
+ bodyFont: _nullishCoalesce(opts.bodyFont, () => ( "myeongjo")),
20001
+ bodyHeight: Math.round(bodyPt * 100),
20002
+ lineSpacing: _nullishCoalesce(opts.lineSpacing, () => ( d.lineSpacing)),
20003
+ numbering: _nullishCoalesce(opts.numbering, () => ( d.numbering)),
20004
+ margins: _nullishCoalesce(opts.margins, () => ( OFFICIAL_MARGINS)),
20005
+ centerTitle: _nullishCoalesce(opts.centerTitle, () => ( true))
20006
+ };
20007
+ }
20008
+ var HANGUL_INITIALS = [0, 2, 3, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 18];
20009
+ var HANGUL_MEDIALS = [0, 4, 8, 13, 18, 20];
20010
+ function hangulOrdinal(n) {
20011
+ const cols = HANGUL_INITIALS.length;
20012
+ const vowel = HANGUL_MEDIALS[Math.min(Math.floor(n / cols), HANGUL_MEDIALS.length - 1)];
20013
+ const init = HANGUL_INITIALS[n % cols];
20014
+ return String.fromCodePoint(44032 + init * 588 + vowel * 28);
20015
+ }
20016
+ function circledNumber(n) {
20017
+ return String.fromCodePoint(9312 + n % 20);
20018
+ }
20019
+ function circledHangul(n) {
20020
+ return String.fromCodePoint(12910 + n % 14);
20021
+ }
20022
+ var REPORT_BULLETS = ["\u25A1", "\u25CB", "-", "\u318D"];
20023
+ function standardMarker(depth, n) {
20024
+ switch (depth) {
20025
+ case 0:
20026
+ return `${n + 1}.`;
20027
+ case 1:
20028
+ return `${hangulOrdinal(n)}.`;
20029
+ case 2:
20030
+ return `${n + 1})`;
20031
+ case 3:
20032
+ return `${hangulOrdinal(n)})`;
20033
+ case 4:
20034
+ return `(${n + 1})`;
20035
+ case 5:
20036
+ return `(${hangulOrdinal(n)})`;
20037
+ case 6:
20038
+ return circledNumber(n);
20039
+ case 7:
20040
+ return circledHangul(n);
20041
+ default:
20042
+ return circledHangul(n);
20043
+ }
20044
+ }
20045
+ function reportMarker(depth) {
20046
+ return REPORT_BULLETS[Math.min(depth, REPORT_BULLETS.length - 1)];
20047
+ }
20048
+ function levelIndent(depth, bodyHeight, numbering) {
20049
+ const ta = bodyHeight / 2;
20050
+ const markerTa = numbering === "standard" && (depth === 4 || depth === 5) ? 3 : 2;
20051
+ const hang = Math.round((markerTa + 1) * ta);
20052
+ return { left: Math.round(depth * bodyHeight), indent: -hang };
20053
+ }
20054
+ function computeSuppression(depths) {
20055
+ const counts = /* @__PURE__ */ new Map();
20056
+ const keys = [];
20057
+ const path = [];
20058
+ for (const depth of depths) {
20059
+ path.length = depth + 1;
20060
+ path[depth] = (_nullishCoalesce(path[depth], () => ( 0))) + 1;
20061
+ const parentKey = path.slice(0, depth).join(".") + "|" + depth;
20062
+ keys.push(parentKey);
20063
+ counts.set(parentKey, (_nullishCoalesce(counts.get(parentKey), () => ( 0))) + 1);
20064
+ }
20065
+ return keys.map((k) => (_nullishCoalesce(counts.get(k), () => ( 0))) <= 1);
20066
+ }
20067
+ var GongmunNumberer = (_class2 = class {
20068
+ constructor(numbering) {;_class2.prototype.__init4.call(this);
20069
+ this.numbering = numbering;
20070
+ }
20071
+ __init4() {this.counts = []}
20072
+ /** depth 항목 하나에 대한 마커. suppress=true면 빈 문자열(부호 없음) */
20073
+ next(depth, suppress) {
20074
+ this.counts.length = depth + 1;
20075
+ const n = _nullishCoalesce(this.counts[depth], () => ( 0));
20076
+ this.counts[depth] = n + 1;
20077
+ if (suppress) return "";
20078
+ return this.numbering === "report" ? reportMarker(depth) : standardMarker(depth, n);
20079
+ }
20080
+ reset() {
20081
+ this.counts = [];
20082
+ }
20083
+ }, _class2);
20084
+ function mmToHwpunit(mm) {
20085
+ return Math.round(mm * 7200 / 25.4);
20086
+ }
20087
+
20088
+ // src/hwpx/generator.ts
19984
20089
  var NS_SECTION = "http://www.hancom.co.kr/hwpml/2011/section";
19985
20090
  var NS_PARA = "http://www.hancom.co.kr/hwpml/2011/paragraph";
19986
20091
  var NS_HEAD = "http://www.hancom.co.kr/hwpml/2011/head";
20092
+ var NS_CORE = "http://www.hancom.co.kr/hwpml/2011/core";
19987
20093
  var NS_OPF = "http://www.idpf.org/2007/opf/";
19988
20094
  var NS_HPF = "http://www.hancom.co.kr/schema/2011/hpf";
19989
20095
  var NS_OCF = "urn:oasis:names:tc:opendocument:xmlns:container";
@@ -20023,13 +20129,14 @@ function resolveTheme(theme) {
20023
20129
  }
20024
20130
  async function markdownToHwpx(markdown, options) {
20025
20131
  const theme = resolveTheme(_optionalChain([options, 'optionalAccess', _148 => _148.theme]));
20132
+ const gongmun = _optionalChain([options, 'optionalAccess', _149 => _149.gongmun]) ? resolveGongmun(options.gongmun) : null;
20026
20133
  const blocks = parseMarkdownToBlocks(markdown);
20027
- const sectionXml = blocksToSectionXml(blocks, theme);
20134
+ const sectionXml = blocksToSectionXml(blocks, theme, gongmun);
20028
20135
  const zip = new (0, _jszip2.default)();
20029
20136
  zip.file("mimetype", "application/hwp+zip", { compression: "STORE" });
20030
20137
  zip.file("META-INF/container.xml", generateContainerXml());
20031
20138
  zip.file("Contents/content.hpf", generateManifest());
20032
- zip.file("Contents/header.xml", generateHeaderXml(theme));
20139
+ zip.file("Contents/header.xml", generateHeaderXml(theme, gongmun));
20033
20140
  zip.file("Contents/section0.xml", sectionXml);
20034
20141
  zip.file("Preview/PrvText.txt", buildPrvText(blocks));
20035
20142
  return await zip.generateAsync({ type: "arraybuffer" });
@@ -20222,25 +20329,95 @@ function charPr(id, height, bold, italic, fontId = 0, textColor = DEFAULT_TEXT_C
20222
20329
  </hh:charPr>`;
20223
20330
  }
20224
20331
  function paraPr(id, opts = {}) {
20225
- const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0 } = opts;
20332
+ const { align = "JUSTIFY", spaceBefore = 0, spaceAfter = 0, lineSpacing = 160, indent = 0, left = 0 } = opts;
20226
20333
  return ` <hh:paraPr id="${id}" tabPrIDRef="0" condense="0" fontLineHeight="0" snapToGrid="1" suppressLineNumbers="0" checked="0" textDir="AUTO">
20227
20334
  <hh:align horizontal="${align}" vertical="BASELINE"/>
20228
20335
  <hh:heading type="NONE" idRef="0" level="0"/>
20229
20336
  <hh:breakSetting breakLatinWord="KEEP_WORD" breakNonLatinWord="BREAK_WORD" widowOrphan="0" keepWithNext="0" keepLines="0" pageBreakBefore="0" lineWrap="BREAK"/>
20230
20337
  <hh:autoSpacing eAsianEng="0" eAsianNum="0"/>
20231
- <hh:margin indent="${indent}" left="0" right="0" prev="${spaceBefore}" next="${spaceAfter}"/>
20338
+ <hh:margin><hc:intent value="${indent}" unit="HWPUNIT"/><hc:left value="${left}" unit="HWPUNIT"/><hc:right value="0" unit="HWPUNIT"/><hc:prev value="${spaceBefore}" unit="HWPUNIT"/><hc:next value="${spaceAfter}" unit="HWPUNIT"/></hh:margin>
20232
20339
  <hh:lineSpacing type="PERCENT" value="${lineSpacing}"/>
20233
20340
  <hh:border borderFillIDRef="0" offsetLeft="0" offsetRight="0" offsetTop="0" offsetBottom="0" connect="0" ignoreMargin="0"/>
20234
20341
  </hh:paraPr>`;
20235
20342
  }
20236
- function generateHeaderXml(theme) {
20343
+ var GONGMUN_LIST_BASE = 8;
20344
+ var GONGMUN_LIST_LEVELS = 8;
20345
+ var GONGMUN_CENTER = GONGMUN_LIST_BASE + GONGMUN_LIST_LEVELS;
20346
+ function buildCharProperties(theme, gongmun) {
20347
+ let body = 1e3, code = 900, h1 = 1800, h2 = 1400, h3 = 1200, h4 = 1100;
20348
+ if (gongmun) {
20349
+ body = gongmun.bodyHeight;
20350
+ code = Math.max(body - 200, 900);
20351
+ h1 = gongmun.preset === "report" || gongmun.preset === "plan" ? 2e3 : 1700;
20352
+ h2 = 1600;
20353
+ h3 = body;
20354
+ h4 = Math.max(body - 100, 1300);
20355
+ }
20356
+ const rows = [
20357
+ charPr(0, body, false, false, 0, theme.body),
20358
+ charPr(1, body, true, false, 0, theme.body),
20359
+ charPr(2, body, false, true, 0, theme.body),
20360
+ charPr(3, body, true, true, 0, theme.body),
20361
+ charPr(4, code, false, false, 1),
20362
+ charPr(5, h1, true, false, 1, theme.h1),
20363
+ charPr(6, h2, true, false, 1, theme.h2),
20364
+ charPr(7, h3, true, false, 1, theme.h3),
20365
+ charPr(8, h4, true, false, 1, theme.h4),
20366
+ charPr(CHAR_TABLE_HEADER, body, theme.tableHeaderBold, false, 0, theme.tableHeader),
20367
+ charPr(CHAR_QUOTE, body, false, true, 0, theme.quote)
20368
+ ];
20369
+ return `<hh:charProperties itemCnt="${rows.length}">
20370
+ ${rows.join("\n")}
20371
+ </hh:charProperties>`;
20372
+ }
20373
+ function buildParaProperties(gongmun) {
20374
+ if (!gongmun) {
20375
+ const base2 = [
20376
+ paraPr(0),
20377
+ paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 }),
20378
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 }),
20379
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 }),
20380
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 }),
20381
+ paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20382
+ paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 }),
20383
+ paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })
20384
+ ];
20385
+ return `<hh:paraProperties itemCnt="${base2.length}">
20386
+ ${base2.join("\n")}
20387
+ </hh:paraProperties>`;
20388
+ }
20389
+ const ls = gongmun.lineSpacing;
20390
+ const titleAlign = gongmun.centerTitle ? "CENTER" : "LEFT";
20391
+ const base = [
20392
+ paraPr(0, { lineSpacing: ls }),
20393
+ paraPr(1, { align: titleAlign, spaceBefore: 400, spaceAfter: 400, lineSpacing: ls }),
20394
+ paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: ls }),
20395
+ paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: ls }),
20396
+ paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: ls }),
20397
+ paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 }),
20398
+ paraPr(6, { align: "LEFT", lineSpacing: ls, indent: 600 }),
20399
+ paraPr(7, { align: "LEFT", lineSpacing: ls, indent: 600 })
20400
+ ];
20401
+ for (let d = 0; d < GONGMUN_LIST_LEVELS; d++) {
20402
+ const { left, indent } = levelIndent(d, gongmun.bodyHeight, gongmun.numbering);
20403
+ base.push(paraPr(GONGMUN_LIST_BASE + d, { align: "JUSTIFY", lineSpacing: ls, left, indent }));
20404
+ }
20405
+ base.push(paraPr(GONGMUN_CENTER, { align: "CENTER", lineSpacing: ls }));
20406
+ return `<hh:paraProperties itemCnt="${base.length}">
20407
+ ${base.join("\n")}
20408
+ </hh:paraProperties>`;
20409
+ }
20410
+ function generateHeaderXml(theme, gongmun) {
20411
+ const bodyFace = _optionalChain([gongmun, 'optionalAccess', _150 => _150.bodyFont]) === "gothic" ? "\uB9D1\uC740 \uACE0\uB515" : "\uD568\uCD08\uB86C\uBC14\uD0D5";
20412
+ const charPropsXml = buildCharProperties(theme, gongmun);
20413
+ const paraPropsXml = buildParaProperties(gongmun);
20237
20414
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
20238
- <hh:head xmlns:hh="${NS_HEAD}" xmlns:hp="${NS_PARA}" version="1.4" secCnt="1">
20415
+ <hh:head xmlns:hh="${NS_HEAD}" xmlns:hp="${NS_PARA}" xmlns:hc="${NS_CORE}" version="1.4" secCnt="1">
20239
20416
  <hh:beginNum page="1" footnote="1" endnote="1" pic="1" tbl="1" equation="1"/>
20240
20417
  <hh:refList>
20241
20418
  <hh:fontfaces itemCnt="7">
20242
20419
  <hh:fontface lang="HANGUL" fontCnt="3">
20243
- <hh:font id="0" face="\uD568\uCD08\uB86C\uBC14\uD0D5" type="TTF" isEmbedded="0">
20420
+ <hh:font id="0" face="${bodyFace}" type="TTF" isEmbedded="0">
20244
20421
  <hh:typeInfo familyType="FCAT_GOTHIC" weight="6" proportion="4" contrast="0" strokeVariation="1" armStyle="1" letterform="1" midline="1" xHeight="1"/>
20245
20422
  </hh:font>
20246
20423
  <hh:font id="1" face="\uD568\uCD08\uB86C\uB3CB\uC6C0" type="TTF" isEmbedded="0">
@@ -20309,32 +20486,11 @@ function generateHeaderXml(theme) {
20309
20486
  <hh:fillInfo/>
20310
20487
  </hh:borderFill>
20311
20488
  </hh:borderFills>
20312
- <hh:charProperties itemCnt="11">
20313
- ${charPr(0, 1e3, false, false, 0, theme.body)}
20314
- ${charPr(1, 1e3, true, false, 0, theme.body)}
20315
- ${charPr(2, 1e3, false, true, 0, theme.body)}
20316
- ${charPr(3, 1e3, true, true, 0, theme.body)}
20317
- ${charPr(4, 900, false, false, 1)}
20318
- ${charPr(5, 1800, true, false, 1, theme.h1)}
20319
- ${charPr(6, 1400, true, false, 1, theme.h2)}
20320
- ${charPr(7, 1200, true, false, 1, theme.h3)}
20321
- ${charPr(8, 1100, true, false, 1, theme.h4)}
20322
- ${charPr(CHAR_TABLE_HEADER, 1e3, theme.tableHeaderBold, false, 0, theme.tableHeader)}
20323
- ${charPr(CHAR_QUOTE, 1e3, false, true, 0, theme.quote)}
20324
- </hh:charProperties>
20489
+ ${charPropsXml}
20325
20490
  <hh:tabProperties itemCnt="0"/>
20326
20491
  <hh:numberings itemCnt="0"/>
20327
20492
  <hh:bullets itemCnt="0"/>
20328
- <hh:paraProperties itemCnt="8">
20329
- ${paraPr(0)}
20330
- ${paraPr(1, { align: "LEFT", spaceBefore: 800, spaceAfter: 200, lineSpacing: 180 })}
20331
- ${paraPr(2, { align: "LEFT", spaceBefore: 600, spaceAfter: 150, lineSpacing: 170 })}
20332
- ${paraPr(3, { align: "LEFT", spaceBefore: 400, spaceAfter: 100, lineSpacing: 160 })}
20333
- ${paraPr(4, { align: "LEFT", spaceBefore: 300, spaceAfter: 100, lineSpacing: 160 })}
20334
- ${paraPr(5, { align: "LEFT", lineSpacing: 130, indent: 400 })}
20335
- ${paraPr(6, { align: "LEFT", lineSpacing: 150, indent: 600 })}
20336
- ${paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })}
20337
- </hh:paraProperties>
20493
+ ${paraPropsXml}
20338
20494
  <hh:styles itemCnt="1">
20339
20495
  <hh:style id="0" type="PARA" name="\uBC14\uD0D5\uAE00" engName="Normal" paraPrIDRef="0" charPrIDRef="0" nextStyleIDRef="0" langIDRef="1042" lockForm="0"/>
20340
20496
  </hh:styles>
@@ -20342,8 +20498,16 @@ ${paraPr(7, { align: "LEFT", lineSpacing: 160, indent: 600 })}
20342
20498
  <hh:compatibleDocument targetProgram="HWP2018"/>
20343
20499
  </hh:head>`;
20344
20500
  }
20345
- function generateSecPr() {
20346
- return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="0" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="2835" footer="2835" gutter="0" left="5670" right="4252" top="8504" bottom="4252"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
20501
+ function generateSecPr(gongmun) {
20502
+ const m = gongmun ? {
20503
+ top: mmToHwpunit(gongmun.margins.top),
20504
+ bottom: mmToHwpunit(gongmun.margins.bottom),
20505
+ left: mmToHwpunit(gongmun.margins.left),
20506
+ right: mmToHwpunit(gongmun.margins.right),
20507
+ header: 0,
20508
+ footer: 0
20509
+ } : { top: 8504, bottom: 4252, left: 5670, right: 4252, header: 2835, footer: 2835 };
20510
+ return `<hp:secPr textDirection="HORIZONTAL" spaceColumns="1134" tabStop="8000" outlineShapeIDRef="0" memoShapeIDRef="0" textVerticalWidthHead="0" masterPageCnt="0"><hp:grid lineGrid="0" charGrid="0" wonggojiFormat="0"/><hp:startNum pageStartsOn="BOTH" page="0" pic="0" tbl="0" equation="0"/><hp:visibility hideFirstHeader="0" hideFirstFooter="0" hideFirstMasterPage="0" border="SHOW_ALL" fill="SHOW_ALL" hideFirstPageNum="0" hideFirstEmptyLine="0" showLineNumber="0"/><hp:pagePr landscape="WIDELY" width="59528" height="84188" gutterType="LEFT_ONLY"><hp:margin header="${m.header}" footer="${m.footer}" gutter="0" left="${m.left}" right="${m.right}" top="${m.top}" bottom="${m.bottom}"/></hp:pagePr><hp:footNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="-1" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="283" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="EACH_COLUMN" beneathText="0"/></hp:footNotePr><hp:endNotePr><hp:autoNumFormat type="DIGIT" userChar="" prefixChar="" suffixChar=")" supscript="0"/><hp:noteLine length="14692344" type="SOLID" width="0.12 mm" color="#000000"/><hp:noteSpacing betweenNotes="0" belowLine="567" aboveLine="850"/><hp:numbering type="CONTINUOUS" newNum="1"/><hp:placement place="END_OF_DOCUMENT" beneathText="0"/></hp:endNotePr></hp:secPr>`;
20347
20511
  }
20348
20512
  var TABLE_ID_BASE = 1e3;
20349
20513
  var tableIdCounter = TABLE_ID_BASE;
@@ -20374,12 +20538,37 @@ function generateTable(rows, theme) {
20374
20538
  const tbl = `<hp:tbl id="${tblId}" zOrder="0" numberingType="TABLE" pageBreak="CELL" repeatHeader="0" rowCnt="${rowCnt}" colCnt="${colCnt}" cellSpacing="0" borderFillIDRef="1" noShading="0">${tblInner}</hp:tbl>`;
20375
20539
  return `<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${tbl}</hp:run></hp:p>`;
20376
20540
  }
20377
- function blocksToSectionXml(blocks, theme) {
20541
+ function precomputeGongmunList(blocks, gongmun) {
20542
+ const result = /* @__PURE__ */ new Map();
20543
+ let i = 0;
20544
+ while (i < blocks.length) {
20545
+ if (blocks[i].type !== "list_item") {
20546
+ i++;
20547
+ continue;
20548
+ }
20549
+ const run = [];
20550
+ while (i < blocks.length && blocks[i].type === "list_item") {
20551
+ run.push(i);
20552
+ i++;
20553
+ }
20554
+ const depths = run.map((bi) => Math.min(Math.max(blocks[bi].indent || 0, 0), GONGMUN_LIST_LEVELS - 1));
20555
+ const suppress = gongmun.numbering === "standard" ? computeSuppression(depths) : depths.map(() => false);
20556
+ const numberer = new GongmunNumberer(gongmun.numbering);
20557
+ run.forEach((bi, k) => {
20558
+ const marker = numberer.next(depths[k], suppress[k]);
20559
+ result.set(bi, { marker, depth: depths[k] });
20560
+ });
20561
+ }
20562
+ return result;
20563
+ }
20564
+ function blocksToSectionXml(blocks, theme, gongmun) {
20378
20565
  const paraXmls = [];
20379
20566
  let isFirst = true;
20380
20567
  const orderedCounters = {};
20381
20568
  let prevWasOrdered = false;
20382
- for (const block of blocks) {
20569
+ const gongmunList = gongmun ? precomputeGongmunList(blocks, gongmun) : null;
20570
+ for (let blockIdx = 0; blockIdx < blocks.length; blockIdx++) {
20571
+ const block = blocks[blockIdx];
20383
20572
  let xml = "";
20384
20573
  if (block.type !== "list_item" || !block.ordered) {
20385
20574
  if (prevWasOrdered) {
@@ -20394,9 +20583,15 @@ function blocksToSectionXml(blocks, theme) {
20394
20583
  xml = generateParagraph(block.text || "", pId, cId);
20395
20584
  break;
20396
20585
  }
20397
- case "paragraph":
20398
- xml = generateParagraph(block.text || "");
20586
+ case "paragraph": {
20587
+ const ctr = gongmun && /^<center>([\s\S]*)<\/center>$/i.exec((block.text || "").trim());
20588
+ if (ctr) {
20589
+ xml = generateParagraph(ctr[1].trim(), GONGMUN_CENTER);
20590
+ } else {
20591
+ xml = generateParagraph(block.text || "");
20592
+ }
20399
20593
  break;
20594
+ }
20400
20595
  case "code_block": {
20401
20596
  const codeLines = (block.text || "").split("\n");
20402
20597
  xml = codeLines.map((line) => generateParagraph(line || " ", PARA_CODE)).join("\n ");
@@ -20410,6 +20605,15 @@ function blocksToSectionXml(blocks, theme) {
20410
20605
  );
20411
20606
  break;
20412
20607
  case "list_item": {
20608
+ if (gongmun && gongmunList) {
20609
+ const info = gongmunList.get(blockIdx);
20610
+ const depth = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _151 => _151.depth]), () => ( 0));
20611
+ const marker2 = _nullishCoalesce(_optionalChain([info, 'optionalAccess', _152 => _152.marker]), () => ( ""));
20612
+ const content = block.text || "";
20613
+ const text = marker2 ? `${marker2} ${content}` : content;
20614
+ xml = generateParagraph(text, GONGMUN_LIST_BASE + depth);
20615
+ break;
20616
+ }
20413
20617
  const indent = block.indent || 0;
20414
20618
  let marker;
20415
20619
  if (block.ordered) {
@@ -20436,7 +20640,7 @@ function blocksToSectionXml(blocks, theme) {
20436
20640
  case "table":
20437
20641
  if (block.rows) {
20438
20642
  if (isFirst) {
20439
- const secRun = `<hp:run charPrIDRef="0">${generateSecPr()}<hp:t></hp:t></hp:run>`;
20643
+ const secRun = `<hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run>`;
20440
20644
  paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0">${secRun}</hp:p>`);
20441
20645
  isFirst = false;
20442
20646
  }
@@ -20448,14 +20652,14 @@ function blocksToSectionXml(blocks, theme) {
20448
20652
  if (isFirst && block.type !== "table") {
20449
20653
  xml = xml.replace(
20450
20654
  /<hp:run charPrIDRef="(\d+)">/,
20451
- `<hp:run charPrIDRef="$1">${generateSecPr()}`
20655
+ `<hp:run charPrIDRef="$1">${generateSecPr(gongmun)}`
20452
20656
  );
20453
20657
  isFirst = false;
20454
20658
  }
20455
20659
  paraXmls.push(xml);
20456
20660
  }
20457
20661
  if (paraXmls.length === 0) {
20458
- paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr()}<hp:t></hp:t></hp:run></hp:p>`);
20662
+ paraXmls.push(`<hp:p paraPrIDRef="0" styleIDRef="0"><hp:run charPrIDRef="0">${generateSecPr(gongmun)}<hp:t></hp:t></hp:run></hp:p>`);
20459
20663
  }
20460
20664
  return `<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
20461
20665
  <hs:sec xmlns:hs="${NS_SECTION}" xmlns:hp="${NS_PARA}">
@@ -20701,7 +20905,7 @@ function escapeGfm(text) {
20701
20905
  }
20702
20906
  var HWP_SHAPE_ALT_TEXT_RE = /(?:모서리가 둥근 |둥근 )?(?:사각형|직사각형|정사각형|원|타원|삼각형|이등변 삼각형|직각 삼각형|선|직선|곡선|화살표|굵은 화살표|이중 화살표|오각형|육각형|팔각형|별|[4-8]점별|십자|십자형|구름|구름형|마름모|도넛|평행사변형|사다리꼴|부채꼴|호|반원|물결|번개|하트|빗금|블록 화살표|수식|표|그림|개체|그리기\s?개체|묶음\s?개체|글상자|수식\s?개체|OLE\s?개체)\s?입니다\.?/g;
20703
20907
  function sanitizeText(text) {
20704
- let result = _chunkFJON4QNBcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
20908
+ let result = _chunkSWEBVX5Kcjs.mapPuaText.call(void 0, text).replace(/[\u{F0000}-\u{FFFFD}]/gu, "").replace(HWP_SHAPE_ALT_TEXT_RE, "").replace(/ +/g, " ").trim();
20705
20909
  if (result.length <= 30 && result.includes(" ")) {
20706
20910
  const tokens = result.split(" ");
20707
20911
  const koreanSingleCharCount = tokens.filter((t) => t.length === 1 && /[가-힯ㄱ-ㆎ]/.test(t)).length;
@@ -20731,7 +20935,7 @@ function replicateGfmTable(table) {
20731
20935
  for (let r = 0; r < numRows; r++) {
20732
20936
  for (let c = 0; c < numCols; c++) {
20733
20937
  if (skip.has(`${r},${c}`)) continue;
20734
- const cell = _optionalChain([cells, 'access', _149 => _149[r], 'optionalAccess', _150 => _150[c]]);
20938
+ const cell = _optionalChain([cells, 'access', _153 => _153[r], 'optionalAccess', _154 => _154[c]]);
20735
20939
  if (!cell) continue;
20736
20940
  display[r][c] = {
20737
20941
  text: escapeGfm(sanitizeText(cell.text)).replace(/\|/g, "\\|").replace(/\n/g, "<br>"),
@@ -20785,7 +20989,7 @@ function unescapeGfmCell(text) {
20785
20989
  return text.replace(/<br\s*\/?>/gi, "\n").replace(/\\\|/g, "|").replace(/\\~/g, "~");
20786
20990
  }
20787
20991
  function replicateCellInnerHtml(cell) {
20788
- if (_optionalChain([cell, 'access', _151 => _151.blocks, 'optionalAccess', _152 => _152.length])) {
20992
+ if (_optionalChain([cell, 'access', _155 => _155.blocks, 'optionalAccess', _156 => _156.length])) {
20789
20993
  return cell.blocks.map((b) => {
20790
20994
  if (b.type === "table" && b.table) {
20791
20995
  const cap = b.table.caption ? sanitizeText(b.table.caption) : "";
@@ -20824,7 +21028,7 @@ function replicateHtmlTable(table) {
20824
21028
  const rowCells = [];
20825
21029
  for (let c = 0; c < numCols; c++) {
20826
21030
  if (skip.has(`${r},${c}`)) continue;
20827
- const cell = _optionalChain([cells, 'access', _153 => _153[r], 'optionalAccess', _154 => _154[c]]);
21031
+ const cell = _optionalChain([cells, 'access', _157 => _157[r], 'optionalAccess', _158 => _158[c]]);
20828
21032
  if (!cell) continue;
20829
21033
  for (let dr = 0; dr < cell.rowSpan; dr++) {
20830
21034
  for (let dc = 0; dc < cell.colSpan; dc++) {
@@ -20870,8 +21074,8 @@ function parseHtmlTable(raw) {
20870
21074
  }
20871
21075
  } else {
20872
21076
  if (!isClose) {
20873
- const cs = parseInt(_optionalChain([attrs, 'access', _155 => _155.match, 'call', _156 => _156(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _157 => _157[1]]) || "1", 10);
20874
- const rs = parseInt(_optionalChain([attrs, 'access', _158 => _158.match, 'call', _159 => _159(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _160 => _160[1]]) || "1", 10);
21077
+ const cs = parseInt(_optionalChain([attrs, 'access', _159 => _159.match, 'call', _160 => _160(/colspan\s*=\s*"(\d+)"/i), 'optionalAccess', _161 => _161[1]]) || "1", 10);
21078
+ const rs = parseInt(_optionalChain([attrs, 'access', _162 => _162.match, 'call', _163 => _163(/rowspan\s*=\s*"(\d+)"/i), 'optionalAccess', _164 => _164[1]]) || "1", 10);
20875
21079
  cellStart = m.index + m[0].length;
20876
21080
  cellInfo = { colSpan: isNaN(cs) ? 1 : cs, rowSpan: isNaN(rs) ? 1 : rs };
20877
21081
  } else if (cellStart >= 0 && cellInfo && currentRow) {
@@ -21033,9 +21237,9 @@ function patchHtmlTableRaw(table, scanTable, origRaw, editedRaw, ctx, skip, dept
21033
21237
  return applied;
21034
21238
  }
21035
21239
  function patchNestedTables(table, scanTable, oc, origTables, editedTables, ctx, skip, depth) {
21036
- const irCell = _optionalChain([table, 'access', _161 => _161.cells, 'access', _162 => _162[oc.gridR], 'optionalAccess', _163 => _163[oc.gridC]]);
21240
+ const irCell = _optionalChain([table, 'access', _165 => _165.cells, 'access', _166 => _166[oc.gridR], 'optionalAccess', _167 => _167[oc.gridC]]);
21037
21241
  const scanCell = scanTable.cellByAnchor.get(`${oc.gridR},${oc.gridC}`);
21038
- const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _164 => _164.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
21242
+ const nestedIRs = (_nullishCoalesce(_optionalChain([irCell, 'optionalAccess', _168 => _168.blocks]), () => ( []))).filter((b) => b.type === "table" && b.table).map((b) => b.table);
21039
21243
  if (!scanCell || nestedIRs.length !== origTables.length || scanCell.tables.length !== origTables.length) {
21040
21244
  return skip("\uC911\uCCA9\uD45C \uC18C\uC2A4\uB9F5 \uB9E4\uD551 \uC2E4\uD328");
21041
21245
  }
@@ -21103,7 +21307,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
21103
21307
  };
21104
21308
  const cell = scanTable.cellByAnchor.get(`${gridR},${gridC}`);
21105
21309
  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)");
21106
- const irCell = _optionalChain([table, 'access', _165 => _165.cells, 'access', _166 => _166[gridR], 'optionalAccess', _167 => _167[gridC]]);
21310
+ const irCell = _optionalChain([table, 'access', _169 => _169.cells, 'access', _170 => _170[gridR], 'optionalAccess', _171 => _171[gridC]]);
21107
21311
  const scanJoined = cell.paragraphs.map((p) => p.text).filter((t) => normForMatch(t)).join("\n");
21108
21312
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
21109
21313
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -21126,7 +21330,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
21126
21330
  if (newLines.length === 0) return 0;
21127
21331
  const target = cell.paragraphs[0];
21128
21332
  if (!target) return skip("\uBE48 \uC140\uC5D0 \uBB38\uB2E8\uC774 \uC5C6\uC5B4 \uD14D\uC2A4\uD2B8 \uC0BD\uC785 \uBD88\uAC00");
21129
- const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _168 => _168.scans, 'access', _169 => _169[target.sectionIndex], 'optionalAccess', _170 => _170.xml]));
21333
+ const sp = buildParagraphSplices(target, newLines.join(" "), _optionalChain([ctx, 'access', _172 => _172.scans, 'access', _173 => _173[target.sectionIndex], 'optionalAccess', _174 => _174.xml]));
21130
21334
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
21131
21335
  splices.push(...sp);
21132
21336
  sectionIndex = target.sectionIndex;
@@ -21147,7 +21351,7 @@ function applyCellEdit(table, scanTable, gridR, gridC, newLines, ctx, before, af
21147
21351
  }
21148
21352
  for (let i = 0; i < nonEmpty.length; i++) {
21149
21353
  if (assigned[i] === nonEmpty[i].text || normForMatch(assigned[i]) === normForMatch(nonEmpty[i].text)) continue;
21150
- const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _171 => _171.scans, 'access', _172 => _172[nonEmpty[i].sectionIndex], 'optionalAccess', _173 => _173.xml]));
21354
+ const sp = buildParagraphSplices(nonEmpty[i], assigned[i], _optionalChain([ctx, 'access', _175 => _175.scans, 'access', _176 => _176[nonEmpty[i].sectionIndex], 'optionalAccess', _177 => _177.xml]));
21151
21355
  if (sp === null) return skip("\uC140 \uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
21152
21356
  splices.push(...sp);
21153
21357
  sectionIndex = nonEmpty[i].sectionIndex;
@@ -21268,7 +21472,7 @@ async function patchHwpx(original, editedMarkdown, options) {
21268
21472
  }
21269
21473
  }
21270
21474
  let verification;
21271
- if (_optionalChain([options, 'optionalAccess', _174 => _174.verify]) !== false) {
21475
+ if (_optionalChain([options, 'optionalAccess', _178 => _178.verify]) !== false) {
21272
21476
  try {
21273
21477
  const reparsed = await parseHwpxDocument(u8ToArrayBuffer(data));
21274
21478
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -21286,17 +21490,17 @@ function buildOrigUnits(blocks) {
21286
21490
  let chunk;
21287
21491
  if (block.type === "paragraph" && block.text && /^\[별표\s*\d+/.test(sanitizeText(block.text))) {
21288
21492
  const next = blocks[i + 1];
21289
- if (_optionalChain([next, 'optionalAccess', _175 => _175.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
21290
- chunk = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
21493
+ if (_optionalChain([next, 'optionalAccess', _179 => _179.type]) === "paragraph" && next.text && /관련\)?$/.test(next.text)) consume = 2;
21494
+ chunk = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks.slice(i, i + consume));
21291
21495
  } else {
21292
- chunk = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, [block]);
21496
+ chunk = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, [block]);
21293
21497
  }
21294
21498
  if (chunk) {
21295
21499
  const subUnits = splitMarkdownUnits(chunk);
21296
21500
  const isFragment = consume === 2 || (block.type === "paragraph" || block.type === "heading") && subUnits.length > 1;
21297
21501
  for (let s = 0; s < subUnits.length; s++) {
21298
21502
  const u = { ...subUnits[s], blockIdx: i, fragment: isFragment || void 0 };
21299
- if (block.type === "table" && _optionalChain([block, 'access', _176 => _176.table, 'optionalAccess', _177 => _177.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
21503
+ if (block.type === "table" && _optionalChain([block, 'access', _180 => _180.table, 'optionalAccess', _181 => _181.caption]) && s === 0 && subUnits.length > 1 && u.kind === "text" && u.raw.startsWith("**")) {
21300
21504
  u.role = "caption";
21301
21505
  }
21302
21506
  units.push(u);
@@ -21473,7 +21677,7 @@ function handleModifiedUnit(orig, edited, ctx) {
21473
21677
  }
21474
21678
  function patchParagraphUnit(block, orig, edited, ctx, skip) {
21475
21679
  const mapping = ctx.paraMap.get(orig.blockIdx);
21476
- if (!_optionalChain([mapping, 'optionalAccess', _178 => _178.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)");
21680
+ if (!_optionalChain([mapping, 'optionalAccess', _182 => _182.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)");
21477
21681
  if (block.text && block.text.includes("\n")) {
21478
21682
  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)");
21479
21683
  }
@@ -21504,7 +21708,7 @@ function patchParagraphUnit(block, orig, edited, ctx, skip) {
21504
21708
  if (sanitizeText(newPlain) !== newPlain) {
21505
21709
  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");
21506
21710
  }
21507
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _179 => _179.scans, 'access', _180 => _180[mapping.para.sectionIndex], 'optionalAccess', _181 => _181.xml]));
21711
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([ctx, 'access', _183 => _183.scans, 'access', _184 => _184[mapping.para.sectionIndex], 'optionalAccess', _185 => _185.xml]));
21508
21712
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
21509
21713
  ctx.sectionSplices[mapping.para.sectionIndex].push(...splices);
21510
21714
  return 1;
@@ -21570,16 +21774,16 @@ function replaceOleStream(file, path, newData) {
21570
21774
  surgeon.replace(path, newData);
21571
21775
  return surgeon.finish();
21572
21776
  }
21573
- var Surgeon = (_class2 = class {
21777
+ var Surgeon = (_class3 = class {
21574
21778
 
21575
- __init4() {this.fat = []}
21779
+ __init5() {this.fat = []}
21576
21780
  /** FAT 배열을 구성하는 섹터 번호들 (DIFAT 순서) */
21577
- __init5() {this.fatSectors = []}
21578
- __init6() {this.miniFat = []}
21579
- __init7() {this.miniFatSectors = []}
21580
- __init8() {this.dirSectors = []}
21581
- __init9() {this.entries = []}
21582
- constructor(file) {;_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);_class2.prototype.__init6.call(this);_class2.prototype.__init7.call(this);_class2.prototype.__init8.call(this);_class2.prototype.__init9.call(this);
21781
+ __init6() {this.fatSectors = []}
21782
+ __init7() {this.miniFat = []}
21783
+ __init8() {this.miniFatSectors = []}
21784
+ __init9() {this.dirSectors = []}
21785
+ __init10() {this.entries = []}
21786
+ constructor(file) {;_class3.prototype.__init5.call(this);_class3.prototype.__init6.call(this);_class3.prototype.__init7.call(this);_class3.prototype.__init8.call(this);_class3.prototype.__init9.call(this);_class3.prototype.__init10.call(this);
21583
21787
  if (file.length < SECTOR || file.readUInt32LE(0) !== 3759263696) {
21584
21788
  throw new OleSurgeonError("OLE \uC2DC\uADF8\uB2C8\uCC98\uAC00 \uC544\uB2D9\uB2C8\uB2E4");
21585
21789
  }
@@ -21672,7 +21876,7 @@ var Surgeon = (_class2 = class {
21672
21876
  /** 디렉토리 트리에서 경로 해석 (형제 = L/R 이진 트리, 자식 = child) */
21673
21877
  findEntry(path) {
21674
21878
  const parts = path.replace(/^\//, "").split("/");
21675
- let scope = _nullishCoalesce(_optionalChain([this, 'access', _182 => _182.entries, 'access', _183 => _183[0], 'optionalAccess', _184 => _184.child]), () => ( -1));
21879
+ let scope = _nullishCoalesce(_optionalChain([this, 'access', _186 => _186.entries, 'access', _187 => _187[0], 'optionalAccess', _188 => _188.child]), () => ( -1));
21676
21880
  let current;
21677
21881
  for (const part of parts) {
21678
21882
  const search = (idx) => {
@@ -21835,7 +22039,7 @@ var Surgeon = (_class2 = class {
21835
22039
  this.flushFat();
21836
22040
  return this.buf;
21837
22041
  }
21838
- }, _class2);
22042
+ }, _class3);
21839
22043
 
21840
22044
  // src/roundtrip/hwp5-patch.ts
21841
22045
  var require3 = _module.createRequire.call(void 0, _chunkGS7T56RPcjs.importMetaUrl);
@@ -21878,7 +22082,7 @@ function readRecordsStrict(stream) {
21878
22082
  function serializeRecords(recs, repl) {
21879
22083
  const parts = [];
21880
22084
  for (let i = 0; i < recs.length; i++) {
21881
- const data = _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _185 => _185.get, 'call', _186 => _186(i)]), () => ( recs[i].data));
22085
+ const data = _nullishCoalesce(_optionalChain([repl, 'optionalAccess', _189 => _189.get, 'call', _190 => _190(i)]), () => ( recs[i].data));
21882
22086
  const ext = data.length >= 4095;
21883
22087
  const header = Buffer.alloc(ext ? 8 : 4);
21884
22088
  header.writeUInt32LE((recs[i].tagId & 1023 | (recs[i].level & 1023) << 10 | (ext ? 4095 : data.length) << 20) >>> 0, 0);
@@ -22001,7 +22205,7 @@ async function patchHwp(original, editedMarkdown, options) {
22001
22205
  return fail(`CFB \uCEE8\uD14C\uC774\uB108 \uD30C\uC2F1 \uC2E4\uD328: ${msg(err)}`);
22002
22206
  }
22003
22207
  const fhEntry = CFB2.find(cfb, "/FileHeader");
22004
- if (!_optionalChain([fhEntry, 'optionalAccess', _187 => _187.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
22208
+ if (!_optionalChain([fhEntry, 'optionalAccess', _191 => _191.content])) return fail("FileHeader \uC2A4\uD2B8\uB9BC\uC774 \uC5C6\uC2B5\uB2C8\uB2E4 \u2014 HWP 5.x \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4");
22005
22209
  let flags;
22006
22210
  try {
22007
22211
  flags = parseFileHeader(Buffer.from(fhEntry.content)).flags;
@@ -22023,7 +22227,7 @@ async function patchHwp(original, editedMarkdown, options) {
22023
22227
  const scans = [];
22024
22228
  for (let i = 0; i < sectionPaths.length; i++) {
22025
22229
  const entry = CFB2.find(cfb, sectionPaths[i]);
22026
- if (!_optionalChain([entry, 'optionalAccess', _188 => _188.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
22230
+ if (!_optionalChain([entry, 'optionalAccess', _192 => _192.content])) return fail(`\uC139\uC158 \uC2A4\uD2B8\uB9BC \uC77D\uAE30 \uC2E4\uD328: ${sectionPaths[i]}`);
22027
22231
  let stream;
22028
22232
  try {
22029
22233
  stream = compressed ? decompressStream(Buffer.from(entry.content)) : Buffer.from(entry.content);
@@ -22082,7 +22286,7 @@ async function patchHwp(original, editedMarkdown, options) {
22082
22286
  }
22083
22287
  }
22084
22288
  let verification;
22085
- if (_optionalChain([options, 'optionalAccess', _189 => _189.verify]) !== false) {
22289
+ if (_optionalChain([options, 'optionalAccess', _193 => _193.verify]) !== false) {
22086
22290
  try {
22087
22291
  const reparsed = parseHwp5Document(Buffer.from(data));
22088
22292
  verification = diffUnitLists(splitMarkdownUnits(reparsed.markdown), editedUnits);
@@ -22166,7 +22370,7 @@ function handleModified(orig, edited, ctx) {
22166
22370
  }
22167
22371
  function patchParagraph(block, orig, edited, ctx, skip) {
22168
22372
  const mapping = ctx.paraMap.get(orig.blockIdx);
22169
- if (!_optionalChain([mapping, 'optionalAccess', _190 => _190.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)");
22373
+ if (!_optionalChain([mapping, 'optionalAccess', _194 => _194.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)");
22170
22374
  if (block.text && block.text.includes("\n")) {
22171
22375
  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)");
22172
22376
  }
@@ -22293,7 +22497,7 @@ function applyCellEdit5(table, scanTable, gridR, gridC, newLines, ctx, before, a
22293
22497
  };
22294
22498
  const cell = scanTable.cells.get(`${gridR},${gridC}`);
22295
22499
  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)");
22296
- const irCell = _optionalChain([table, 'access', _191 => _191.cells, 'access', _192 => _192[gridR], 'optionalAccess', _193 => _193[gridC]]);
22500
+ const irCell = _optionalChain([table, 'access', _195 => _195.cells, 'access', _196 => _196[gridR], 'optionalAccess', _197 => _197[gridC]]);
22297
22501
  const scanJoined = cell.paras.map((p) => p.rawText).filter((t) => normForMatch(t)).join("\n");
22298
22502
  if (irCell && normForMatch(scanJoined) !== normForMatch(stripCellTokens(irCell.text))) {
22299
22503
  if (normForMatch(irCell.text) !== "" || normForMatch(scanJoined) !== "") {
@@ -22431,9 +22635,9 @@ function u8ToArrayBuffer2(u8) {
22431
22635
  function irCellLines(text) {
22432
22636
  return stripCellTokens(sanitizeText(text)).split("\n").map((s) => s.trim()).filter(Boolean);
22433
22637
  }
22434
- var HwpxSession = (_class3 = class _HwpxSession {
22638
+ var HwpxSession = (_class4 = class _HwpxSession {
22435
22639
 
22436
- constructor(state) {;_class3.prototype.__init10.call(this);
22640
+ constructor(state) {;_class4.prototype.__init11.call(this);
22437
22641
  this.state = state;
22438
22642
  }
22439
22643
  /** HWPX 바이트로 세션을 연다 (입력은 복사되어 외부 변이와 격리) */
@@ -22459,7 +22663,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22459
22663
  const block = st.blocks[blockIndex];
22460
22664
  if (!block) return void 0;
22461
22665
  if (block.type === "paragraph" || block.type === "heading") {
22462
- const para = _optionalChain([st, 'access', _194 => _194.paraMap, 'access', _195 => _195.get, 'call', _196 => _196(blockIndex), 'optionalAccess', _197 => _197.para]);
22666
+ const para = _optionalChain([st, 'access', _198 => _198.paraMap, 'access', _199 => _199.get, 'call', _200 => _200(blockIndex), 'optionalAccess', _201 => _201.para]);
22463
22667
  if (!para) return void 0;
22464
22668
  return { kind: "paragraph", sectionIndex: para.sectionIndex, xmlStart: para.start };
22465
22669
  }
@@ -22484,7 +22688,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22484
22688
  if (block.text && block.text.includes("\n")) {
22485
22689
  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)" };
22486
22690
  }
22487
- if (!_optionalChain([st, 'access', _198 => _198.paraMap, 'access', _199 => _199.get, 'call', _200 => _200(blockIndex), 'optionalAccess', _201 => _201.para])) {
22691
+ if (!_optionalChain([st, 'access', _202 => _202.paraMap, 'access', _203 => _203.get, 'call', _204 => _204(blockIndex), 'optionalAccess', _205 => _205.para])) {
22488
22692
  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)" };
22489
22693
  }
22490
22694
  return { capability: "text" };
@@ -22533,7 +22737,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22533
22737
  this.opQueue = run.then(() => void 0, () => void 0);
22534
22738
  return run;
22535
22739
  }
22536
- __init10() {this.opQueue = Promise.resolve()}
22740
+ __init11() {this.opQueue = Promise.resolve()}
22537
22741
  async patchBlocksInner(edits, options) {
22538
22742
  const st = this.state;
22539
22743
  const skipped = [];
@@ -22550,7 +22754,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22550
22754
  continue;
22551
22755
  }
22552
22756
  if (block.type === "table" && block.table) {
22553
- if (!_optionalChain([edit, 'access', _202 => _202.cells, 'optionalAccess', _203 => _203.length])) {
22757
+ if (!_optionalChain([edit, 'access', _206 => _206.cells, 'optionalAccess', _207 => _207.length])) {
22554
22758
  skipped.push({ reason: "\uD45C \uBE14\uB85D\uC5D0\uB294 cells \uD3B8\uC9D1\uB9CC \uC9C0\uC6D0", before: summarize(_nullishCoalesce(block.table.caption, () => ( "(\uD45C)"))) });
22555
22759
  continue;
22556
22760
  }
@@ -22570,7 +22774,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22570
22774
  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) });
22571
22775
  continue;
22572
22776
  }
22573
- const irCell = _optionalChain([block, 'access', _204 => _204.table, 'access', _205 => _205.cells, 'access', _206 => _206[cellEdit.row], 'optionalAccess', _207 => _207[cellEdit.col]]);
22777
+ const irCell = _optionalChain([block, 'access', _208 => _208.table, 'access', _209 => _209.cells, 'access', _210 => _210[cellEdit.row], 'optionalAccess', _211 => _211[cellEdit.col]]);
22574
22778
  if (!irCell) {
22575
22779
  skipped.push({ reason: `\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16: ${cellEdit.row},${cellEdit.col}`, after: summarize(cellEdit.text) });
22576
22780
  continue;
@@ -22625,7 +22829,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22625
22829
  }
22626
22830
  if (replacements.size === 0) {
22627
22831
  let changes2;
22628
- if (_optionalChain([options, 'optionalAccess', _208 => _208.verify]) !== false) {
22832
+ if (_optionalChain([options, 'optionalAccess', _212 => _212.verify]) !== false) {
22629
22833
  const units = splitMarkdownUnits(st.markdown);
22630
22834
  changes2 = diffUnitLists(units, units);
22631
22835
  }
@@ -22646,7 +22850,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22646
22850
  }
22647
22851
  this.state = newState;
22648
22852
  let changes;
22649
- if (_optionalChain([options, 'optionalAccess', _209 => _209.verify]) !== false) {
22853
+ if (_optionalChain([options, 'optionalAccess', _213 => _213.verify]) !== false) {
22650
22854
  changes = diffUnitLists(splitMarkdownUnits(beforeMarkdown), splitMarkdownUnits(newState.markdown));
22651
22855
  }
22652
22856
  return { success: true, data: new Uint8Array(data), applied, skipped, changes };
@@ -22666,7 +22870,7 @@ var HwpxSession = (_class3 = class _HwpxSession {
22666
22870
  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)");
22667
22871
  }
22668
22872
  const mapping = st.paraMap.get(blockIndex);
22669
- if (!_optionalChain([mapping, 'optionalAccess', _210 => _210.para])) {
22873
+ if (!_optionalChain([mapping, 'optionalAccess', _214 => _214.para])) {
22670
22874
  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)");
22671
22875
  }
22672
22876
  let newPlain = newTextRaw.split("\n").map((l) => l.trim()).filter(Boolean).join(" ");
@@ -22686,14 +22890,14 @@ var HwpxSession = (_class3 = class _HwpxSession {
22686
22890
  if (sanitizeText(newPlain) !== newPlain) {
22687
22891
  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");
22688
22892
  }
22689
- const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _211 => _211.scans, 'access', _212 => _212[mapping.para.sectionIndex], 'optionalAccess', _213 => _213.xml]));
22893
+ const splices = buildParagraphSplices(mapping.para, newPlain, _optionalChain([st, 'access', _215 => _215.scans, 'access', _216 => _216[mapping.para.sectionIndex], 'optionalAccess', _217 => _217.xml]));
22690
22894
  if (splices === null) return skip("\uBB38\uB2E8\uC5D0 \uD14D\uC2A4\uD2B8 \uB178\uB4DC\uB97C \uB9CC\uB4E4 \uC218 \uC5C6\uC74C");
22691
22895
  sectionSplices[mapping.para.sectionIndex].push(...splices);
22692
22896
  return 1;
22693
22897
  }
22694
- }, _class3);
22898
+ }, _class4);
22695
22899
  function cellStaticCheck(table, scanTable, r, c) {
22696
- const irCell = _optionalChain([table, 'access', _214 => _214.cells, 'access', _215 => _215[r], 'optionalAccess', _216 => _216[c]]);
22900
+ const irCell = _optionalChain([table, 'access', _218 => _218.cells, 'access', _219 => _219[r], 'optionalAccess', _220 => _220[c]]);
22697
22901
  if (!irCell) return { editable: false, reason: "\uC140 \uC88C\uD45C \uBC94\uC704 \uBC16" };
22698
22902
  const cell = scanTable.cellByAnchor.get(`${r},${c}`);
22699
22903
  if (!cell) return { editable: false, reason: "\uBCD1\uD569 \uC601\uC5ED\uC758 \uBE48 \uCE78\uC774\uAC70\uB098 \uC88C\uD45C \uBD88\uC77C\uCE58" };
@@ -22777,11 +22981,11 @@ var md = new (0, _markdownit2.default)({
22777
22981
  breaks: false
22778
22982
  });
22779
22983
  function renderHtml(markdown, options) {
22780
- const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _217 => _217.preset]), () => ( "default"));
22781
- const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _218 => _218.extraCss]), () => ( "")));
22984
+ const preset = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _221 => _221.preset]), () => ( "default"));
22985
+ const css = PRESETS[preset] + (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _222 => _222.extraCss]), () => ( "")));
22782
22986
  const body = md.render(markdown);
22783
- const watermark = _optionalChain([options, 'optionalAccess', _219 => _219.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
22784
- const watermarkCss = _optionalChain([options, 'optionalAccess', _220 => _220.watermark]) ? `
22987
+ const watermark = _optionalChain([options, 'optionalAccess', _223 => _223.watermark]) ? `<div class="watermark">${escapeHtml(options.watermark)}</div>` : "";
22988
+ const watermarkCss = _optionalChain([options, 'optionalAccess', _224 => _224.watermark]) ? `
22785
22989
  .watermark {
22786
22990
  position: fixed;
22787
22991
  top: 50%; left: 50%;
@@ -22812,13 +23016,13 @@ async function htmlToPdf(html, options) {
22812
23016
  try {
22813
23017
  puppeteer = await Promise.resolve().then(() => _interopRequireWildcard(require("puppeteer-core")));
22814
23018
  } catch (e34) {
22815
- throw new (0, _chunkFJON4QNBcjs.KordocError)(
23019
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)(
22816
23020
  "PDF \uC0DD\uC131\uC5D0 puppeteer-core\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC124\uCE58: npm install puppeteer-core"
22817
23021
  );
22818
23022
  }
22819
23023
  const executablePath = _nullishCoalesce(process.env.PUPPETEER_EXECUTABLE_PATH, () => ( findChromiumPath()));
22820
23024
  if (!executablePath) {
22821
- throw new (0, _chunkFJON4QNBcjs.KordocError)(
23025
+ throw new (0, _chunkSWEBVX5Kcjs.KordocError)(
22822
23026
  "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."
22823
23027
  );
22824
23028
  }
@@ -22830,10 +23034,10 @@ async function htmlToPdf(html, options) {
22830
23034
  try {
22831
23035
  const page = await browser.newPage();
22832
23036
  await page.setContent(html, { waitUntil: "networkidle0" });
22833
- const margin = _optionalChain([options, 'optionalAccess', _221 => _221.margin]);
23037
+ const margin = _optionalChain([options, 'optionalAccess', _225 => _225.margin]);
22834
23038
  const pdf = await page.pdf({
22835
- format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _222 => _222.pageSize]), () => ( "A4")),
22836
- landscape: _optionalChain([options, 'optionalAccess', _223 => _223.orientation]) === "landscape",
23039
+ format: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _226 => _226.pageSize]), () => ( "A4")),
23040
+ landscape: _optionalChain([options, 'optionalAccess', _227 => _227.orientation]) === "landscape",
22837
23041
  printBackground: true,
22838
23042
  margin: margin ? {
22839
23043
  top: toCss(margin.top),
@@ -22841,9 +23045,9 @@ async function htmlToPdf(html, options) {
22841
23045
  bottom: toCss(margin.bottom),
22842
23046
  left: toCss(margin.left)
22843
23047
  } : void 0,
22844
- displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _224 => _224.header]) || _optionalChain([options, 'optionalAccess', _225 => _225.footer])),
22845
- headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _226 => _226.header]), () => ( "<div></div>")),
22846
- footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _227 => _227.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
23048
+ displayHeaderFooter: !!(_optionalChain([options, 'optionalAccess', _228 => _228.header]) || _optionalChain([options, 'optionalAccess', _229 => _229.footer])),
23049
+ headerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _230 => _230.header]), () => ( "<div></div>")),
23050
+ footerTemplate: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _231 => _231.footer]), () => ( '<div style="font-size:8pt;width:100%;text-align:center;color:#777;"><span class="pageNumber"></span>/<span class="totalPages"></span></div>'))
22847
23051
  });
22848
23052
  return Buffer.from(pdf);
22849
23053
  } finally {
@@ -22877,24 +23081,24 @@ async function markdownToPdf(markdown, options) {
22877
23081
  return htmlToPdf(html, options);
22878
23082
  }
22879
23083
  async function blocksToPdf(blocks, options) {
22880
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, blocks);
23084
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, blocks);
22881
23085
  return markdownToPdf(markdown, options);
22882
23086
  }
22883
23087
 
22884
23088
  // src/index.ts
22885
23089
  async function parse(input, options) {
22886
23090
  let buffer;
22887
- const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _228 => _228.filePath]) ? { ...options, filePath: input } : options;
23091
+ const opts = typeof input === "string" && !_optionalChain([options, 'optionalAccess', _232 => _232.filePath]) ? { ...options, filePath: input } : options;
22888
23092
  if (typeof input === "string") {
22889
23093
  try {
22890
23094
  const buf = await _promises.readFile.call(void 0, input);
22891
- buffer = _chunkFJON4QNBcjs.toArrayBuffer.call(void 0, buf);
23095
+ buffer = _chunkSWEBVX5Kcjs.toArrayBuffer.call(void 0, buf);
22892
23096
  } catch (err) {
22893
23097
  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}`;
22894
23098
  return { success: false, fileType: "unknown", error: msg2, code: "PARSE_ERROR" };
22895
23099
  }
22896
23100
  } else if (Buffer.isBuffer(input)) {
22897
- buffer = _chunkFJON4QNBcjs.toArrayBuffer.call(void 0, input);
23101
+ buffer = _chunkSWEBVX5Kcjs.toArrayBuffer.call(void 0, input);
22898
23102
  } else {
22899
23103
  buffer = input;
22900
23104
  }
@@ -22929,21 +23133,21 @@ async function parseHwp3(buffer, options) {
22929
23133
  const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
22930
23134
  return { success: true, fileType: "hwp3", markdown, blocks, metadata, outline, warnings };
22931
23135
  } catch (err) {
22932
- return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23136
+ return { success: false, fileType: "hwp3", error: err instanceof Error ? err.message : "HWP3 \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
22933
23137
  }
22934
23138
  }
22935
23139
  async function parseHwpx(buffer, options) {
22936
23140
  try {
22937
23141
  const { markdown, blocks, metadata, outline, warnings, images } = await parseHwpxDocument(buffer, options);
22938
- return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _229 => _229.length]) ? images : void 0 };
23142
+ return { success: true, fileType: "hwpx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _233 => _233.length]) ? images : void 0 };
22939
23143
  } catch (err) {
22940
- return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23144
+ return { success: false, fileType: "hwpx", error: err instanceof Error ? err.message : "HWPX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
22941
23145
  }
22942
23146
  }
22943
23147
  async function parseHwp(buffer, options) {
22944
23148
  try {
22945
23149
  const { markdown, blocks, metadata, outline, warnings, images } = parseHwp5Document(Buffer.from(buffer), options);
22946
- if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _230 => _230.filePath])) {
23150
+ if (isDistributionSentinel(markdown) && isComFallbackAvailable() && _optionalChain([options, 'optionalAccess', _234 => _234.filePath])) {
22947
23151
  try {
22948
23152
  const { pages, pageCount, warnings: comWarns } = extractTextViaCom(options.filePath);
22949
23153
  if (pages.some((p) => p && p.trim().length > 0)) {
@@ -22960,15 +23164,15 @@ async function parseHwp(buffer, options) {
22960
23164
  } catch (e35) {
22961
23165
  }
22962
23166
  }
22963
- return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _231 => _231.length]) ? images : void 0 };
23167
+ return { success: true, fileType: "hwp", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _235 => _235.length]) ? images : void 0 };
22964
23168
  } catch (err) {
22965
- return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23169
+ return { success: false, fileType: "hwp", error: err instanceof Error ? err.message : "HWP \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
22966
23170
  }
22967
23171
  }
22968
23172
  async function parsePdf(buffer, options) {
22969
23173
  let parsePdfDocument;
22970
23174
  try {
22971
- const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-XULVNDMN.cjs")));
23175
+ const mod = await Promise.resolve().then(() => _interopRequireWildcard(require("./parser-LKIUKZJV.cjs")));
22972
23176
  parsePdfDocument = mod.parsePdfDocument;
22973
23177
  } catch (e36) {
22974
23178
  return {
@@ -22983,7 +23187,7 @@ async function parsePdf(buffer, options) {
22983
23187
  return { success: true, fileType: "pdf", markdown, blocks, metadata, outline, warnings, isImageBased, pageQuality, qualitySummary };
22984
23188
  } catch (err) {
22985
23189
  const isImageBased = err instanceof Error && "isImageBased" in err ? true : void 0;
22986
- return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err), isImageBased };
23190
+ return { success: false, fileType: "pdf", error: err instanceof Error ? err.message : "PDF \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err), isImageBased };
22987
23191
  }
22988
23192
  }
22989
23193
  async function parseXlsx(buffer, options) {
@@ -22991,7 +23195,7 @@ async function parseXlsx(buffer, options) {
22991
23195
  const { markdown, blocks, metadata, warnings } = await parseXlsxDocument(buffer, options);
22992
23196
  return { success: true, fileType: "xlsx", markdown, blocks, metadata, warnings };
22993
23197
  } catch (err) {
22994
- return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23198
+ return { success: false, fileType: "xlsx", error: err instanceof Error ? err.message : "XLSX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
22995
23199
  }
22996
23200
  }
22997
23201
  async function parseXls(buffer, options) {
@@ -22999,15 +23203,15 @@ async function parseXls(buffer, options) {
22999
23203
  const { markdown, blocks, metadata, warnings } = await parseXlsDocument(buffer, options);
23000
23204
  return { success: true, fileType: "xls", markdown, blocks, metadata, warnings };
23001
23205
  } catch (err) {
23002
- return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23206
+ return { success: false, fileType: "xls", error: err instanceof Error ? err.message : "XLS \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
23003
23207
  }
23004
23208
  }
23005
23209
  async function parseDocx(buffer, options) {
23006
23210
  try {
23007
23211
  const { markdown, blocks, metadata, outline, warnings, images } = await parseDocxDocument(buffer, options);
23008
- return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _232 => _232.length]) ? images : void 0 };
23212
+ return { success: true, fileType: "docx", markdown, blocks, metadata, outline, warnings, images: _optionalChain([images, 'optionalAccess', _236 => _236.length]) ? images : void 0 };
23009
23213
  } catch (err) {
23010
- return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23214
+ return { success: false, fileType: "docx", error: err instanceof Error ? err.message : "DOCX \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
23011
23215
  }
23012
23216
  }
23013
23217
  async function parseHwpml(buffer, options) {
@@ -23015,16 +23219,16 @@ async function parseHwpml(buffer, options) {
23015
23219
  const { markdown, blocks, metadata, outline, warnings } = parseHwpmlDocument(buffer, options);
23016
23220
  return { success: true, fileType: "hwpml", markdown, blocks, metadata, outline, warnings };
23017
23221
  } catch (err) {
23018
- return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkFJON4QNBcjs.classifyError.call(void 0, err) };
23222
+ return { success: false, fileType: "hwpml", error: err instanceof Error ? err.message : "HWPML \uD30C\uC2F1 \uC2E4\uD328", code: _chunkSWEBVX5Kcjs.classifyError.call(void 0, err) };
23019
23223
  }
23020
23224
  }
23021
23225
  async function fillForm(input, values, outputFormat = "markdown") {
23022
23226
  let buffer;
23023
23227
  if (typeof input === "string") {
23024
23228
  const buf = await _promises.readFile.call(void 0, input);
23025
- buffer = _chunkFJON4QNBcjs.toArrayBuffer.call(void 0, buf);
23229
+ buffer = _chunkSWEBVX5Kcjs.toArrayBuffer.call(void 0, buf);
23026
23230
  } else if (Buffer.isBuffer(input)) {
23027
- buffer = _chunkFJON4QNBcjs.toArrayBuffer.call(void 0, input);
23231
+ buffer = _chunkSWEBVX5Kcjs.toArrayBuffer.call(void 0, input);
23028
23232
  } else {
23029
23233
  buffer = input;
23030
23234
  }
@@ -23050,7 +23254,7 @@ async function fillForm(input, values, outputFormat = "markdown") {
23050
23254
  throw new Error(`\uC11C\uC2DD \uD30C\uC2F1 \uC2E4\uD328: ${parsed.error}`);
23051
23255
  }
23052
23256
  const fill = fillFormFields(parsed.blocks, values);
23053
- const markdown = _chunkFJON4QNBcjs.blocksToMarkdown.call(void 0, fill.blocks);
23257
+ const markdown = _chunkSWEBVX5Kcjs.blocksToMarkdown.call(void 0, fill.blocks);
23054
23258
  if (outputFormat === "hwpx") {
23055
23259
  const hwpxBuffer = await markdownToHwpx(markdown);
23056
23260
  return { output: hwpxBuffer, format: "hwpx", fill };
@@ -23098,5 +23302,5 @@ async function fillForm(input, values, outputFormat = "markdown") {
23098
23302
 
23099
23303
 
23100
23304
 
23101
- exports.HwpxSession = HwpxSession; exports.VERSION = _chunkFJON4QNBcjs.VERSION; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkFJON4QNBcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; 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.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; 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.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml;
23305
+ exports.HwpxSession = HwpxSession; exports.VERSION = _chunkSWEBVX5Kcjs.VERSION; exports.applySplices = applySplices; exports.blocksToMarkdown = _chunkSWEBVX5Kcjs.blocksToMarkdown; exports.blocksToPdf = blocksToPdf; exports.buildParagraphSplices = buildParagraphSplices; exports.buildRangeSplices = buildRangeSplices; 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.inferFieldType = inferFieldType; exports.isHwpxFile = isHwpxFile; exports.isLabelCell = isLabelCell; exports.isOldHwpFile = isOldHwpFile; exports.isPdfFile = isPdfFile; exports.isZipFile = isZipFile; exports.markdownToHwpx = markdownToHwpx; exports.markdownToPdf = markdownToPdf; 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.renderHtml = renderHtml; exports.scanSectionXml = scanSectionXml;
23102
23306
  //# sourceMappingURL=index.cjs.map