kordoc 3.12.0 → 3.13.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 (34) hide show
  1. package/README.md +7 -0
  2. package/dist/{-OPZIF3QT.js → -MRPDPE2X.js} +5 -5
  3. package/dist/{chunk-ILR7GF3W.js → chunk-33CIKNL4.js} +2 -2
  4. package/dist/{chunk-2C5GCXPJ.cjs → chunk-MEXUFQVC.cjs} +2 -2
  5. package/dist/{chunk-2C5GCXPJ.cjs.map → chunk-MEXUFQVC.cjs.map} +1 -1
  6. package/dist/{chunk-NGKIAZ6G.js → chunk-O4WFPOFN.js} +2 -2
  7. package/dist/{chunk-7Z43WEML.js → chunk-Q6UXVJXI.js} +2 -2
  8. package/dist/{chunk-RUYSNNYZ.js → chunk-TWACKS3K.js} +21 -5
  9. package/dist/{chunk-RUYSNNYZ.js.map → chunk-TWACKS3K.js.map} +1 -1
  10. package/dist/{chunk-BUDM6ULT.js → chunk-YXOT7P5B.js} +2 -2
  11. package/dist/cli.js +7 -7
  12. package/dist/index.cjs +134 -118
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.js +18 -2
  15. package/dist/index.js.map +1 -1
  16. package/dist/mcp.js +5 -5
  17. package/dist/{parser-PCTX7LGN.cjs → parser-DZBI3EA2.cjs} +66 -14
  18. package/dist/parser-DZBI3EA2.cjs.map +1 -0
  19. package/dist/{parser-5FSEFR3R.js → parser-XUNGOH76.js} +55 -3
  20. package/dist/{parser-AWEGMHHV.js.map → parser-XUNGOH76.js.map} +1 -1
  21. package/dist/{parser-AWEGMHHV.js → parser-Z3IL2ESY.js} +54 -2
  22. package/dist/{parser-5FSEFR3R.js.map → parser-Z3IL2ESY.js.map} +1 -1
  23. package/dist/render-VZ4OGHZU.js +9 -0
  24. package/dist/{watch-Y7BAYXJE.js → watch-G5NFIT5L.js} +5 -5
  25. package/package.json +1 -1
  26. package/dist/parser-PCTX7LGN.cjs.map +0 -1
  27. package/dist/render-ATQNKOT2.js +0 -9
  28. /package/dist/{-OPZIF3QT.js.map → -MRPDPE2X.js.map} +0 -0
  29. /package/dist/{chunk-ILR7GF3W.js.map → chunk-33CIKNL4.js.map} +0 -0
  30. /package/dist/{chunk-NGKIAZ6G.js.map → chunk-O4WFPOFN.js.map} +0 -0
  31. /package/dist/{chunk-7Z43WEML.js.map → chunk-Q6UXVJXI.js.map} +0 -0
  32. /package/dist/{chunk-BUDM6ULT.js.map → chunk-YXOT7P5B.js.map} +0 -0
  33. /package/dist/{render-ATQNKOT2.js.map → render-VZ4OGHZU.js.map} +0 -0
  34. /package/dist/{watch-Y7BAYXJE.js.map → watch-G5NFIT5L.js.map} +0 -0
@@ -6,7 +6,7 @@ import {
6
6
  blocksToMarkdown,
7
7
  safeMax,
8
8
  safeMin
9
- } from "./chunk-NGKIAZ6G.js";
9
+ } from "./chunk-O4WFPOFN.js";
10
10
  import {
11
11
  parsePageRange
12
12
  } from "./chunk-GE43BE46.js";
@@ -2718,6 +2718,54 @@ function wrapStrikethroughRuns(items) {
2718
2718
  arr[arr.length - 1].text = arr[arr.length - 1].text + "~~";
2719
2719
  }
2720
2720
  }
2721
+ var PROSEBOX_FULLWIDTH_MIN = 0.6;
2722
+ var PROSEBOX_LONG_CELL_CHARS = 80;
2723
+ var PROSEBOX_LONG_CELL_MIN = 3;
2724
+ var PROSEBOX_LONG_CELL_RATIO = 0.4;
2725
+ var PROSEBOX_X_TOL = 8;
2726
+ function verticalCoverageAt(verticals, x, yMin, yMax) {
2727
+ const tol = PROSEBOX_X_TOL;
2728
+ const spans = [];
2729
+ for (const v of verticals) {
2730
+ if (Math.abs(v.x1 - x) > tol) continue;
2731
+ const lo = Math.max(v.y1, yMin), hi = Math.min(v.y2, yMax);
2732
+ if (hi > lo) spans.push([lo, hi]);
2733
+ }
2734
+ if (spans.length === 0) return 0;
2735
+ spans.sort((a, b) => a[0] - b[0]);
2736
+ let total = 0, s = spans[0][0], e = spans[0][1];
2737
+ for (let i = 1; i < spans.length; i++) {
2738
+ if (spans[i][0] <= e) {
2739
+ if (spans[i][1] > e) e = spans[i][1];
2740
+ } else {
2741
+ total += e - s;
2742
+ s = spans[i][0];
2743
+ e = spans[i][1];
2744
+ }
2745
+ }
2746
+ return total + (e - s);
2747
+ }
2748
+ function isProseBoxGrid(grid, verticals, table) {
2749
+ const numCols = grid.colXs.length - 1;
2750
+ if (numCols < 2 || grid.rowYs.length < 3) return false;
2751
+ const gyMax = grid.rowYs[0], gyMin = grid.rowYs[grid.rowYs.length - 1];
2752
+ const span = gyMax - gyMin;
2753
+ if (span <= 0) return false;
2754
+ const interior = grid.colXs.slice(1, -1);
2755
+ let fullWidthHeight = 0;
2756
+ for (let r = 0; r < grid.rowYs.length - 1; r++) {
2757
+ const top = grid.rowYs[r], bot = grid.rowYs[r + 1];
2758
+ const h = top - bot;
2759
+ if (h <= 0) continue;
2760
+ const hasDivider = interior.some((cx) => verticalCoverageAt(verticals, cx, bot, top) >= h * 0.5);
2761
+ if (!hasDivider) fullWidthHeight += h;
2762
+ }
2763
+ if (fullWidthHeight < span * PROSEBOX_FULLWIDTH_MIN) return false;
2764
+ const texts = table.cells.flat().map((c) => c.text.trim()).filter(Boolean);
2765
+ const longCells = texts.filter((s) => s.length > PROSEBOX_LONG_CELL_CHARS).length;
2766
+ if (longCells < PROSEBOX_LONG_CELL_MIN || longCells < texts.length * PROSEBOX_LONG_CELL_RATIO) return false;
2767
+ return true;
2768
+ }
2721
2769
  function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals) {
2722
2770
  const blocks = [];
2723
2771
  const usedItems = /* @__PURE__ */ new Set();
@@ -2792,6 +2840,10 @@ function extractBlocksWithGrids(items, pageNum, grids, horizontals, verticals) {
2792
2840
  };
2793
2841
  const hasContent = finalGrid.some((row) => row.some((cell) => cell.text.trim() !== ""));
2794
2842
  if (!hasContent) continue;
2843
+ if (isProseBoxGrid(grid, verticals, irTable)) {
2844
+ for (const it of tableItems) usedItems.delete(it);
2845
+ continue;
2846
+ }
2795
2847
  const tableBbox = {
2796
2848
  page: pageNum,
2797
2849
  x: grid.bbox.x1,
@@ -3471,4 +3523,4 @@ export {
3471
3523
  parsePdfDocument,
3472
3524
  removeHeaderFooterBlocks
3473
3525
  };
3474
- //# sourceMappingURL=parser-AWEGMHHV.js.map
3526
+ //# sourceMappingURL=parser-Z3IL2ESY.js.map