@superdoc-dev/mcp 0.12.0-next.47 → 0.12.0-next.48

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 (2) hide show
  1. package/dist/index.js +1024 -111
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -50479,7 +50479,7 @@ var init_remark_gfm_BUJjZJLy_es = __esm(() => {
50479
50479
  emptyOptions2 = {};
50480
50480
  });
50481
50481
 
50482
- // ../../packages/superdoc/dist/chunks/SuperConverter-DIgF4xk_.es.js
50482
+ // ../../packages/superdoc/dist/chunks/SuperConverter-Ed3nFN54.es.js
50483
50483
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
50484
50484
  const fieldValue = extension$1.config[field];
50485
50485
  if (typeof fieldValue === "function")
@@ -60055,6 +60055,50 @@ function getCellSpacingPx(cellSpacing) {
60055
60055
  const asPx = (cellSpacing.type ?? "").toLowerCase() === "dxa" && v >= 20 ? v / TWIPS_PER_PX : v;
60056
60056
  return Math.max(0, asPx);
60057
60057
  }
60058
+ function getBorderBandProfile(value) {
60059
+ if (value == null || typeof value !== "object")
60060
+ return null;
60061
+ if ("none" in value && value.none)
60062
+ return null;
60063
+ const raw = value;
60064
+ if (!raw.style)
60065
+ return null;
60066
+ const formula = COMPOUND_PROFILES[raw.style];
60067
+ if (!formula)
60068
+ return null;
60069
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
60070
+ if (w <= 0)
60071
+ return null;
60072
+ const segments = formula(w).map((s) => Math.max(1, s));
60073
+ return {
60074
+ segments,
60075
+ band: segments.reduce((sum, s) => sum + s, 0)
60076
+ };
60077
+ }
60078
+ function getBorderBandWidthPx(value) {
60079
+ if (value == null)
60080
+ return 0;
60081
+ if (typeof value !== "object")
60082
+ return 0;
60083
+ if ("none" in value && value.none)
60084
+ return 0;
60085
+ const raw = value;
60086
+ if (raw.style === "none")
60087
+ return 0;
60088
+ const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
60089
+ const width = Math.max(0, w);
60090
+ if (width === 0)
60091
+ return 0;
60092
+ if (raw.style === "thick")
60093
+ return Math.max(width, 1);
60094
+ const profile = getBorderBandProfile(value);
60095
+ if (profile)
60096
+ return profile.band;
60097
+ return width;
60098
+ }
60099
+ function isNativeCssDoubleStyle(style) {
60100
+ return style === "double";
60101
+ }
60058
60102
  function coerceRelativeHeight(raw) {
60059
60103
  if (typeof raw === "number" && Number.isFinite(raw))
60060
60104
  return raw;
@@ -61662,6 +61706,11 @@ function resolveConditionalProps(propertyType, styleType, styleId, translatedLin
61662
61706
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
61663
61707
  if (props)
61664
61708
  chain.push(props);
61709
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
61710
+ const baseProps = def?.tableCellProperties;
61711
+ if (baseProps)
61712
+ chain.push(baseProps);
61713
+ }
61665
61714
  currentId = def?.basedOn;
61666
61715
  }
61667
61716
  if (chain.length === 0)
@@ -61675,7 +61724,7 @@ function resolveCellStyles(propertyType, tableInfo, translatedLinkedStyles) {
61675
61724
  const cellStyleProps = [];
61676
61725
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
61677
61726
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes(tableStyleId, translatedLinkedStyles);
61678
- determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle).forEach((styleType) => {
61727
+ determineCellStyleTypes(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle, tableInfo.gridColumnStart, tableInfo.gridColumnSpan, tableInfo.numGridCols).forEach((styleType) => {
61679
61728
  const typeProps = resolveConditionalProps(propertyType, styleType, tableStyleId, translatedLinkedStyles);
61680
61729
  if (typeProps)
61681
61730
  cellStyleProps.push(typeProps);
@@ -61693,12 +61742,15 @@ function resolveTableCellProperties(inlineProps, tableInfo, translatedLinkedStyl
61693
61742
  chain.push(inlineProps);
61694
61743
  return combineProperties(chain, { fullOverrideProps: ["shading"] });
61695
61744
  }
61696
- function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
61745
+ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
61697
61746
  const applicable = new Set(["wholeTable"]);
61698
61747
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
61699
61748
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
61749
+ const columnStart = gridColumnStart ?? cellIndex;
61750
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
61751
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
61700
61752
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
61701
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
61753
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
61702
61754
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
61703
61755
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
61704
61756
  if (!tblLook?.noHBand)
@@ -61707,8 +61759,8 @@ function determineCellStyleTypes(tblLook, rowIndex, cellIndex, numRows, numCells
61707
61759
  applicable.add(colGroup % 2 === 0 ? "band1Vert" : "band2Vert");
61708
61760
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
61709
61761
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
61710
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
61711
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
61762
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
61763
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
61712
61764
  if (isFirstRow)
61713
61765
  applicable.add("firstRow");
61714
61766
  if (isFirstCol)
@@ -89561,10 +89613,40 @@ function normalizeLegacyBorderStyle(value) {
89561
89613
  return "dotDash";
89562
89614
  case "dotdotdash":
89563
89615
  return "dotDotDash";
89616
+ case "dashsmallgap":
89617
+ return "dashSmallGap";
89618
+ case "thinthicksmallgap":
89619
+ return "thinThickSmallGap";
89620
+ case "thickthinsmallgap":
89621
+ return "thickThinSmallGap";
89622
+ case "thinthickthinsmallgap":
89623
+ return "thinThickThinSmallGap";
89624
+ case "thinthickmediumgap":
89625
+ return "thinThickMediumGap";
89626
+ case "thickthinmediumgap":
89627
+ return "thickThinMediumGap";
89628
+ case "thinthickthinmediumgap":
89629
+ return "thinThickThinMediumGap";
89630
+ case "thinthicklargegap":
89631
+ return "thinThickLargeGap";
89632
+ case "thickthinlargegap":
89633
+ return "thickThinLargeGap";
89634
+ case "thinthickthinlargegap":
89635
+ return "thinThickThinLargeGap";
89564
89636
  case "wave":
89565
89637
  return "wave";
89566
89638
  case "doublewave":
89567
89639
  return "doubleWave";
89640
+ case "dashdotstroked":
89641
+ return "dashDotStroked";
89642
+ case "threedemboss":
89643
+ return "threeDEmboss";
89644
+ case "threedengrave":
89645
+ return "threeDEngrave";
89646
+ case "outset":
89647
+ return "outset";
89648
+ case "inset":
89649
+ return "inset";
89568
89650
  case "single":
89569
89651
  default:
89570
89652
  return "single";
@@ -89675,14 +89757,21 @@ function tableNodeToBlock(node2, { nextBlockId, positions, storyKey, trackedChan
89675
89757
  tableStyleId: effectiveStyleId ?? undefined
89676
89758
  } : undefined;
89677
89759
  const rows = [];
89760
+ const grid = node2.attrs?.grid;
89761
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
89762
+ let activeRowSpans = [];
89678
89763
  node2.content.forEach((rowNode, rowIndex) => {
89764
+ const { placements, nextActiveRowSpans } = placeRowCellsOnGrid(rowNode, activeRowSpans);
89765
+ activeRowSpans = nextActiveRowSpans;
89679
89766
  const parsedRow = parseTableRow({
89680
89767
  rowNode,
89681
89768
  rowIndex,
89682
89769
  numRows: node2?.content?.length ?? 1,
89683
89770
  context: parserDeps,
89684
89771
  defaultCellPadding,
89685
- tableProperties: tablePropertiesForCascade
89772
+ tableProperties: tablePropertiesForCascade,
89773
+ cellGridPlacements: placements,
89774
+ numGridCols
89686
89775
  });
89687
89776
  if (parsedRow) {
89688
89777
  if (!shouldHideTrackedNode(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig))
@@ -99390,7 +99479,7 @@ var isRegExp = (value) => {
99390
99479
  return true;
99391
99480
  }, areAttrsEqual = (attrsA = {}, attrsB = {}) => {
99392
99481
  return objectIncludes(attrsA, attrsB);
99393
- }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
99482
+ }, TrackInsertMarkName = "trackInsert", TrackDeleteMarkName = "trackDelete", TrackFormatMarkName = "trackFormat", TrackedFormatMarkNames, TAB_POSITION_TOLERANCE_TWIPS = 20, OOXML_PCT_DIVISOR = 5000, TWIPS_PER_PX = 15, PT_075 = 1, PT_150 = 2, COMPOUND_PROFILES, isPlainObject$3 = (value) => value !== null && typeof value === "object" && !Array.isArray(value), OOXML_Z_INDEX_BASE = 251658240, resolveOuterShadowOffset = (shadow) => {
99394
99483
  const radians = shadow.direction * Math.PI / 180;
99395
99484
  return {
99396
99485
  dx: shadow.distance * Math.cos(radians),
@@ -117903,6 +117992,39 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117903
117992
  value: measurement.value,
117904
117993
  type: measurement.type ?? "px"
117905
117994
  };
117995
+ }, placeRowCellsOnGrid = (rowNode, activeRowSpans) => {
117996
+ const placements = [];
117997
+ const nextActiveRowSpans = activeRowSpans.map((count) => Math.max(0, count - 1));
117998
+ let column = 0;
117999
+ const cellSpan = (cellNode) => {
118000
+ const colspan = cellNode.attrs?.colspan;
118001
+ if (typeof colspan === "number" && colspan > 0)
118002
+ return colspan;
118003
+ const colwidth = cellNode.attrs?.colwidth;
118004
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
118005
+ };
118006
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
118007
+ if (!isTableCellNode(cellNode)) {
118008
+ placements.push(null);
118009
+ continue;
118010
+ }
118011
+ while ((activeRowSpans[column] ?? 0) > 0)
118012
+ column += 1;
118013
+ const span = cellSpan(cellNode);
118014
+ placements.push({
118015
+ gridColumnStart: column,
118016
+ gridColumnSpan: span
118017
+ });
118018
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
118019
+ if (rowspan > 1)
118020
+ for (let covered = column;covered < column + span; covered += 1)
118021
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
118022
+ column += span;
118023
+ }
118024
+ return {
118025
+ placements,
118026
+ nextActiveRowSpans
118027
+ };
117906
118028
  }, isTableRowNode = (node2) => node2.type === "tableRow" || node2.type === "table_row", isTableCellNode = (node2) => node2.type === "tableCell" || node2.type === "table_cell" || node2.type === "tableHeader" || node2.type === "table_header", isTableSkipPlaceholderCell = (node2) => {
117907
118029
  const placeholder = node2.attrs?.__placeholder;
117908
118030
  return placeholder === "gridBefore" || placeholder === "gridAfter";
@@ -117945,7 +118067,12 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
117945
118067
  numCells,
117946
118068
  numRows,
117947
118069
  rowCnfStyle,
117948
- cellCnfStyle
118070
+ cellCnfStyle,
118071
+ ...args.gridPlacement != null && args.numGridCols != null ? {
118072
+ gridColumnStart: args.gridPlacement.gridColumnStart,
118073
+ gridColumnSpan: args.gridPlacement.gridColumnSpan,
118074
+ numGridCols: args.numGridCols
118075
+ } : {}
117949
118076
  } : undefined;
117950
118077
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
117951
118078
  const resolvedTcProps = resolveTableCellProperties(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
@@ -118236,7 +118363,9 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118236
118363
  tableProperties,
118237
118364
  numCells: rowNode?.content?.length || 1,
118238
118365
  numRows,
118239
- rowCnfStyle
118366
+ rowCnfStyle,
118367
+ gridPlacement: args.cellGridPlacements?.[cellIndex] ?? null,
118368
+ numGridCols: args.numGridCols
118240
118369
  });
118241
118370
  if (parsedCell)
118242
118371
  cells.push(parsedCell);
@@ -118823,7 +118952,7 @@ Docs: https://docs.superdoc.dev/getting-started/fonts`);
118823
118952
  state.kern = kernNode.attributes["w:val"];
118824
118953
  }
118825
118954
  }, SuperConverter;
118826
- var init_SuperConverter_DIgF4xk__es = __esm(() => {
118955
+ var init_SuperConverter_Ed3nFN54_es = __esm(() => {
118827
118956
  init_rolldown_runtime_Bg48TavK_es();
118828
118957
  init_jszip_C49i9kUs_es();
118829
118958
  init_xml_js_CqGKpaft_es();
@@ -123269,6 +123398,71 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
123269
123398
  "highlight",
123270
123399
  "link"
123271
123400
  ];
123401
+ COMPOUND_PROFILES = {
123402
+ double: (w) => [
123403
+ w,
123404
+ w,
123405
+ w
123406
+ ],
123407
+ triple: (w) => [
123408
+ w,
123409
+ w,
123410
+ w,
123411
+ w,
123412
+ w
123413
+ ],
123414
+ thinThickSmallGap: (w) => [
123415
+ w,
123416
+ PT_075,
123417
+ PT_075
123418
+ ],
123419
+ thickThinSmallGap: (w) => [
123420
+ PT_075,
123421
+ PT_075,
123422
+ w
123423
+ ],
123424
+ thinThickMediumGap: (w) => [
123425
+ w,
123426
+ w / 2,
123427
+ w / 2
123428
+ ],
123429
+ thickThinMediumGap: (w) => [
123430
+ w / 2,
123431
+ w / 2,
123432
+ w
123433
+ ],
123434
+ thinThickLargeGap: (w) => [
123435
+ PT_150,
123436
+ w,
123437
+ PT_075
123438
+ ],
123439
+ thickThinLargeGap: (w) => [
123440
+ PT_075,
123441
+ w,
123442
+ PT_150
123443
+ ],
123444
+ thinThickThinSmallGap: (w) => [
123445
+ PT_075,
123446
+ PT_075,
123447
+ w,
123448
+ PT_075,
123449
+ PT_075
123450
+ ],
123451
+ thinThickThinMediumGap: (w) => [
123452
+ w / 2,
123453
+ w / 2,
123454
+ w,
123455
+ w / 2,
123456
+ w / 2
123457
+ ],
123458
+ thinThickThinLargeGap: (w) => [
123459
+ PT_075,
123460
+ w,
123461
+ PT_150,
123462
+ w,
123463
+ PT_075
123464
+ ]
123465
+ };
123272
123466
  SPACE_CHARS = new Set([" ", " "]);
123273
123467
  idlessSdtContainerKeys = /* @__PURE__ */ new WeakMap;
123274
123468
  DRAWING_DIAGNOSTIC_CODES = {
@@ -146094,13 +146288,28 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
146094
146288
  "single",
146095
146289
  "double",
146096
146290
  "dashed",
146291
+ "dashSmallGap",
146097
146292
  "dotted",
146098
146293
  "thick",
146099
146294
  "triple",
146100
146295
  "dotDash",
146101
146296
  "dotDotDash",
146297
+ "thinThickSmallGap",
146298
+ "thickThinSmallGap",
146299
+ "thinThickThinSmallGap",
146300
+ "thinThickMediumGap",
146301
+ "thickThinMediumGap",
146302
+ "thinThickThinMediumGap",
146303
+ "thinThickLargeGap",
146304
+ "thickThinLargeGap",
146305
+ "thinThickThinLargeGap",
146102
146306
  "wave",
146103
- "doubleWave"
146307
+ "doubleWave",
146308
+ "dashDotStroked",
146309
+ "threeDEmboss",
146310
+ "threeDEngrave",
146311
+ "outset",
146312
+ "inset"
146104
146313
  ]);
146105
146314
  FONT_FAMILY_FALLBACKS$1 = Object.freeze({
146106
146315
  swiss: "Arial, sans-serif",
@@ -147749,7 +147958,7 @@ var init_SuperConverter_DIgF4xk__es = __esm(() => {
147749
147958
  };
147750
147959
  });
147751
147960
 
147752
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-BT4yIoZ-.es.js
147961
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-PSeH6IV5.es.js
147753
147962
  function parseSizeUnit(val = "0") {
147754
147963
  const length = val.toString() || "0";
147755
147964
  const value = Number.parseFloat(length);
@@ -158552,9 +158761,9 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, MARK_KEYS, STEP_OP_CATALOG_UNFROZEN, PU
158552
158761
  }
158553
158762
  };
158554
158763
  };
158555
- var init_create_headless_toolbar_BT4yIoZ_es = __esm(() => {
158764
+ var init_create_headless_toolbar_PSeH6IV5_es = __esm(() => {
158556
158765
  init_rolldown_runtime_Bg48TavK_es();
158557
- init_SuperConverter_DIgF4xk__es();
158766
+ init_SuperConverter_Ed3nFN54_es();
158558
158767
  init_jszip_C49i9kUs_es();
158559
158768
  init_uuid_B2wVPhPi_es();
158560
158769
  init_constants_D9qj59G2_es();
@@ -214168,7 +214377,7 @@ var init_remark_gfm_DCND_V_3_es = __esm(() => {
214168
214377
  init_remark_gfm_BUJjZJLy_es();
214169
214378
  });
214170
214379
 
214171
- // ../../packages/superdoc/dist/chunks/src-BrcexyXf.es.js
214380
+ // ../../packages/superdoc/dist/chunks/src-bMRzO9Kl.es.js
214172
214381
  function deleteProps(obj, propOrProps) {
214173
214382
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
214174
214383
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -219013,6 +219222,12 @@ function updateTableWrapper(tableWrapper, table2) {
219013
219222
  borderWidth = Math.ceil(Math.max(borderLeftMax, borderRightMax));
219014
219223
  tableWrapper.style.setProperty("--table-border-width", `${borderWidth || defaultBorderWidth}px`);
219015
219224
  }
219225
+ function cellWidthDxa(widthPx) {
219226
+ return {
219227
+ value: widthPx * 15,
219228
+ type: "dxa"
219229
+ };
219230
+ }
219016
219231
  function cloneBorders(borders, sides) {
219017
219232
  if (!borders || typeof borders !== "object")
219018
219233
  return {};
@@ -258056,6 +258271,19 @@ function countHeaderRows(block) {
258056
258271
  break;
258057
258272
  return count;
258058
258273
  }
258274
+ function countRepeatableHeaderRows(block) {
258275
+ const headerCount = countHeaderRows(block);
258276
+ if (headerCount === 0)
258277
+ return 0;
258278
+ let bandEnd = headerCount;
258279
+ for (let r$1 = 0;r$1 < headerCount && r$1 < block.rows.length; r$1++)
258280
+ for (const cell2 of block.rows[r$1]?.cells ?? []) {
258281
+ const rowSpan = cell2.rowSpan ?? 1;
258282
+ if (rowSpan > 1)
258283
+ bandEnd = Math.max(bandEnd, r$1 + rowSpan);
258284
+ }
258285
+ return Math.min(bandEnd, block.rows.length);
258286
+ }
258059
258287
  function sumRowHeights(rows, fromRow, toRow) {
258060
258288
  let total = 0;
258061
258289
  for (let i3 = fromRow;i3 < toRow && i3 < rows.length; i3++)
@@ -258440,7 +258668,7 @@ function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColu
258440
258668
  });
258441
258669
  return;
258442
258670
  }
258443
- const headerCount = countHeaderRows(block);
258671
+ const headerCount = countRepeatableHeaderRows(block);
258444
258672
  const headerPrefixHeights = [0];
258445
258673
  for (let i3 = 0;i3 < headerCount; i3 += 1)
258446
258674
  headerPrefixHeights.push(headerPrefixHeights[i3] + (measure.rows[i3]?.height ?? 0));
@@ -271245,12 +271473,14 @@ function computeAutoFitColumnWidths(input2) {
271245
271473
  const currentWidths = fixedLayout.columnWidths.slice(0, gridColumnCount);
271246
271474
  const minBounds = new Array(gridColumnCount).fill(0);
271247
271475
  const maxBounds = new Array(gridColumnCount).fill(0);
271476
+ const textBounds = new Array(gridColumnCount).fill(0);
271248
271477
  const preferredOverrides = new Array(gridColumnCount).fill(undefined);
271249
271478
  const multiSpanCells = [];
271250
271479
  accumulateBounds({
271251
271480
  rows: normalizedRows,
271252
271481
  minBounds,
271253
271482
  maxBounds,
271483
+ textBounds,
271254
271484
  preferredOverrides,
271255
271485
  multiSpanCells
271256
271486
  });
@@ -271273,7 +271503,26 @@ function computeAutoFitColumnWidths(input2) {
271273
271503
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
271274
271504
  } else {
271275
271505
  targetTableWidth = Math.min(targetTableWidth, maxResolvedTableWidth);
271276
- if (!shouldPreservePreferredGrid) {
271506
+ if (workingInput.contentSizeAutoTable === true) {
271507
+ const columnBandAllowances = workingInput.columnBandAllowances;
271508
+ resolvedWidths = maxBounds.map((max$2, index2) => {
271509
+ const allowance = columnBandAllowances?.[index2] ?? 0;
271510
+ const withAllowance = Math.max(max$2, minBounds[index2]) + allowance;
271511
+ const textFloor = textBounds[index2] + allowance * 2;
271512
+ return Math.max(withAllowance, textFloor);
271513
+ });
271514
+ for (const spanCell of multiSpanCells) {
271515
+ const covered = resolvedWidths.slice(spanCell.startColumn, spanCell.startColumn + spanCell.span);
271516
+ const currentTotal = sumWidths$1(covered);
271517
+ const demand = spanCell.preferredWidth ?? spanCell.maxContentWidth;
271518
+ if (currentTotal < demand && covered.length > 0) {
271519
+ const topUp = (demand - currentTotal) / covered.length;
271520
+ for (let index2 = 0;index2 < covered.length; index2++)
271521
+ resolvedWidths[spanCell.startColumn + index2] += topUp;
271522
+ }
271523
+ }
271524
+ targetTableWidth = Math.min(sumWidths$1(resolvedWidths), maxResolvedTableWidth);
271525
+ } else if (!shouldPreservePreferredGrid) {
271277
271526
  resolvedWidths = redistributeTowardMaximumsWithinCurrentTable(resolvedWidths, minBounds, maxBounds);
271278
271527
  resolvedWidths = redistributeTowardContentWeightedShape(resolvedWidths, minBounds, maxBounds);
271279
271528
  }
@@ -271335,7 +271584,8 @@ function resolveAutoFitContext(input2) {
271335
271584
  span: cell2.span,
271336
271585
  preferredWidth: cell2.preferredWidth,
271337
271586
  minContentWidth: cell2.minContentWidth,
271338
- maxContentWidth: cell2.maxContentWidth
271587
+ maxContentWidth: cell2.maxContentWidth,
271588
+ horizontalInsets: cell2.horizontalInsets
271339
271589
  }))
271340
271590
  })),
271341
271591
  minColumnWidth
@@ -271368,7 +271618,8 @@ function normalizeLegacyRows(rows) {
271368
271618
  span,
271369
271619
  preferredWidth: sanitizeOptionalWidth(cell2.preferredWidth),
271370
271620
  minContentWidth: Math.max(0, cell2.minContentWidth ?? 0),
271371
- maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0)
271621
+ maxContentWidth: Math.max(0, cell2.maxContentWidth ?? cell2.minContentWidth ?? 0),
271622
+ horizontalInsets: Math.max(0, cell2.horizontalInsets ?? 0)
271372
271623
  });
271373
271624
  columnIndex += span;
271374
271625
  }
@@ -271405,7 +271656,8 @@ function buildNormalizedRows(workingInput, rowMetrics) {
271405
271656
  span: Math.max(1, placedCell.span ?? metrics?.span ?? 1),
271406
271657
  preferredWidth: sanitizeOptionalWidth(metrics?.preferredWidth ?? placedCell.preferredWidth),
271407
271658
  minContentWidth: Math.max(0, metrics?.minContentWidth ?? 0),
271408
- maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0)
271659
+ maxContentWidth: Math.max(0, metrics?.maxContentWidth ?? metrics?.minContentWidth ?? 0),
271660
+ horizontalInsets: Math.max(0, metrics?.horizontalInsets ?? 0)
271409
271661
  };
271410
271662
  }),
271411
271663
  skippedColumns: (workingRow.skippedColumns ?? []).map((skipped) => ({
@@ -271419,7 +271671,7 @@ function buildNormalizedRows(workingInput, rowMetrics) {
271419
271671
  });
271420
271672
  }
271421
271673
  function accumulateBounds(args$1) {
271422
- const { rows, minBounds, maxBounds, preferredOverrides, multiSpanCells } = args$1;
271674
+ const { rows, minBounds, maxBounds, textBounds, preferredOverrides, multiSpanCells } = args$1;
271423
271675
  for (const row2 of rows) {
271424
271676
  for (const skipped of row2.skippedColumns) {
271425
271677
  minBounds[skipped.columnIndex] = Math.max(minBounds[skipped.columnIndex], skipped.minContentWidth);
@@ -271431,6 +271683,7 @@ function accumulateBounds(args$1) {
271431
271683
  if (cell2.span === 1) {
271432
271684
  minBounds[cell2.startColumn] = Math.max(minBounds[cell2.startColumn], cell2.minContentWidth);
271433
271685
  maxBounds[cell2.startColumn] = Math.max(maxBounds[cell2.startColumn], cell2.maxContentWidth);
271686
+ textBounds[cell2.startColumn] = Math.max(textBounds[cell2.startColumn], Math.max(0, cell2.maxContentWidth - cell2.horizontalInsets));
271434
271687
  if (preferredOverrides[cell2.startColumn] == null && cell2.preferredWidth != null)
271435
271688
  preferredOverrides[cell2.startColumn] = cell2.preferredWidth;
271436
271689
  } else
@@ -271874,16 +272127,29 @@ function buildAutoFitWorkingGridInput(block, constraints) {
271874
272127
  layoutMode,
271875
272128
  preferredColumnWidths,
271876
272129
  preferredTableWidth,
271877
- gridColumnCount
272130
+ gridColumnCount,
272131
+ rows
271878
272132
  });
271879
272133
  const preserveExplicitAutoGrid = shouldPreserveExplicitAutoGrid({
271880
272134
  layoutMode,
272135
+ tableWidth,
271881
272136
  preferredColumnWidths,
271882
272137
  preferredTableWidth,
271883
272138
  gridColumnCount,
271884
272139
  rows
271885
272140
  });
271886
- const autoGridWidthBudget = resolveAutoGridWidthBudget({
272141
+ const contentSizeAutoTable = resolveContentSizeAutoTable({
272142
+ layoutMode,
272143
+ tableWidth,
272144
+ preferredTableWidth,
272145
+ preferredColumnWidths,
272146
+ maxTableWidth,
272147
+ rows,
272148
+ preserveAutoGrid,
272149
+ preserveExplicitAutoGrid
272150
+ });
272151
+ const columnBandAllowances = contentSizeAutoTable ? resolveColumnBandAllowances(block.attrs?.borders, gridColumnCount) : undefined;
272152
+ const autoGridWidthBudget = contentSizeAutoTable ? undefined : resolveAutoGridWidthBudget({
271887
272153
  layoutMode,
271888
272154
  tableWidth,
271889
272155
  preferredColumnWidths,
@@ -271898,6 +272164,8 @@ function buildAutoFitWorkingGridInput(block, constraints) {
271898
272164
  ...preserveAutoGrid ? { preserveAutoGrid } : {},
271899
272165
  ...preserveExplicitAutoGrid ? { preserveExplicitAutoGrid } : {},
271900
272166
  ...autoGridWidthBudget != null ? { autoGridWidthBudget } : {},
272167
+ ...contentSizeAutoTable ? { contentSizeAutoTable } : {},
272168
+ ...columnBandAllowances ? { columnBandAllowances } : {},
271901
272169
  preferredTableWidth,
271902
272170
  preferredColumnWidths,
271903
272171
  gridColumnCount,
@@ -271919,19 +272187,21 @@ function shouldPreserveAuthoredGrid(args$1) {
271919
272187
  return approximatelyEqual(totalPreferredColumnWidth, preferredTableWidth) || isSlightlyUnderPreferredTableWidth(totalPreferredColumnWidth, preferredTableWidth);
271920
272188
  }
271921
272189
  function shouldPreserveAutoGrid(args$1) {
271922
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount } = args$1;
272190
+ const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
271923
272191
  if (layoutMode !== "autofit")
271924
272192
  return false;
271925
272193
  if (preferredTableWidth != null)
271926
272194
  return false;
271927
272195
  if (preferredColumnWidths.length === 0 || preferredColumnWidths.length !== gridColumnCount)
271928
272196
  return false;
272197
+ if (preferredColumnWidths.length === 1 && !hasConcreteCellWidthRequest(rows))
272198
+ return false;
271929
272199
  if (!hasNonUniformGrid(preferredColumnWidths))
271930
272200
  return false;
271931
272201
  return true;
271932
272202
  }
271933
272203
  function shouldPreserveExplicitAutoGrid(args$1) {
271934
- const { layoutMode, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
272204
+ const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, rows } = args$1;
271935
272205
  if (layoutMode !== "autofit")
271936
272206
  return false;
271937
272207
  if (preferredTableWidth == null || preferredTableWidth <= 0)
@@ -271940,8 +272210,52 @@ function shouldPreserveExplicitAutoGrid(args$1) {
271940
272210
  return false;
271941
272211
  if (!hasNonUniformGrid(preferredColumnWidths) && !hasConcreteCellWidthRequest(rows))
271942
272212
  return false;
272213
+ if (isPercentTableWidth(tableWidth))
272214
+ return true;
271943
272215
  return approximatelyEqual(sumWidths(preferredColumnWidths), preferredTableWidth);
271944
272216
  }
272217
+ function isPercentTableWidth(tableWidth) {
272218
+ return typeof tableWidth === "object" && tableWidth != null && typeof tableWidth.type === "string" && tableWidth.type.toLowerCase() === "pct";
272219
+ }
272220
+ function resolveContentSizeAutoTable(args$1) {
272221
+ const { layoutMode, tableWidth, preferredTableWidth, preferredColumnWidths, maxTableWidth, rows, preserveAutoGrid, preserveExplicitAutoGrid } = args$1;
272222
+ if (layoutMode !== "autofit")
272223
+ return false;
272224
+ if (preferredTableWidth != null)
272225
+ return false;
272226
+ if (preserveAutoGrid || preserveExplicitAutoGrid)
272227
+ return false;
272228
+ if (!isAutoOrNilTableWidth(tableWidth))
272229
+ return false;
272230
+ if (hasConcreteCellWidthRequest(rows))
272231
+ return false;
272232
+ if (sumWidths(preferredColumnWidths) > maxTableWidth + 0.5)
272233
+ return false;
272234
+ return true;
272235
+ }
272236
+ function isAutoOrNilTableWidth(tableWidth) {
272237
+ if (tableWidth == null)
272238
+ return true;
272239
+ if (hasAutoTableWidthSemantics(tableWidth))
272240
+ return true;
272241
+ if (typeof tableWidth === "object" && typeof tableWidth.type === "string")
272242
+ return tableWidth.type.toLowerCase() === "nil";
272243
+ return false;
272244
+ }
272245
+ function resolveColumnBandAllowances(borders, gridColumnCount) {
272246
+ if (gridColumnCount <= 0)
272247
+ return;
272248
+ const left$1 = getBorderBandWidthPx(borders?.left);
272249
+ const insideV = getBorderBandWidthPx(borders?.insideV);
272250
+ const right$1 = getBorderBandWidthPx(borders?.right);
272251
+ const allowances = [];
272252
+ for (let i3 = 0;i3 < gridColumnCount; i3++) {
272253
+ const edgeLeft = i3 === 0 ? left$1 : insideV;
272254
+ const edgeRight = i3 === gridColumnCount - 1 ? right$1 : insideV;
272255
+ allowances.push((edgeLeft + edgeRight) / 2);
272256
+ }
272257
+ return allowances.some((a2) => a2 > 0) ? allowances : undefined;
272258
+ }
271945
272259
  function resolveAutoGridWidthBudget(args$1) {
271946
272260
  const { layoutMode, tableWidth, preferredColumnWidths, preferredTableWidth, gridColumnCount, maxTableWidth } = args$1;
271947
272261
  if (layoutMode !== "autofit")
@@ -272242,7 +272556,8 @@ async function measureTableCellContentMetrics(cell2, options) {
272242
272556
  if (contentBlocks.length === 0) {
272243
272557
  const emptyMetrics = {
272244
272558
  minWidthPx: horizontalInsets,
272245
- maxWidthPx: horizontalInsets
272559
+ maxWidthPx: horizontalInsets,
272560
+ horizontalInsetsPx: horizontalInsets
272246
272561
  };
272247
272562
  tableCellMetricsCache.set(cacheKey, emptyMetrics);
272248
272563
  return emptyMetrics;
@@ -272256,7 +272571,8 @@ async function measureTableCellContentMetrics(cell2, options) {
272256
272571
  }
272257
272572
  const result = {
272258
272573
  minWidthPx: minContentWidthPx + horizontalInsets,
272259
- maxWidthPx: maxContentWidthPx + horizontalInsets
272574
+ maxWidthPx: maxContentWidthPx + horizontalInsets,
272575
+ horizontalInsetsPx: horizontalInsets
272260
272576
  };
272261
272577
  tableCellMetricsCache.set(cacheKey, result);
272262
272578
  return result;
@@ -272286,7 +272602,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
272286
272602
  span,
272287
272603
  preferredWidth: normalizedCell?.preferredWidth,
272288
272604
  minContentWidth: metrics.minWidthPx,
272289
- maxContentWidth: metrics.maxWidthPx
272605
+ maxContentWidth: metrics.maxWidthPx,
272606
+ horizontalInsets: metrics.horizontalInsetsPx
272290
272607
  };
272291
272608
  }))
272292
272609
  };
@@ -272301,7 +272618,8 @@ async function measureTableAutoFitContentMetrics(table2, workingInput, fixedLayo
272301
272618
  span: cellMetrics.span,
272302
272619
  preferredWidth: cellMetrics.preferredWidth,
272303
272620
  minContentWidth: cellMetrics.minContentWidth,
272304
- maxContentWidth: cellMetrics.maxContentWidth
272621
+ maxContentWidth: cellMetrics.maxContentWidth,
272622
+ horizontalInsets: cellMetrics.horizontalInsets
272305
272623
  })),
272306
272624
  skippedAfter: normalizedRow.skippedAfter ?? []
272307
272625
  };
@@ -272553,18 +272871,7 @@ function clearTextMeasurementCaches() {
272553
272871
  canvasContext = null;
272554
272872
  }
272555
272873
  function getTableBorderWidthPx(value) {
272556
- if (value == null)
272557
- return 0;
272558
- if (typeof value === "object" && "none" in value && value.none)
272559
- return 0;
272560
- const raw = value;
272561
- const w = typeof raw.width === "number" ? raw.width : typeof raw.size === "number" ? raw.size : 1;
272562
- const width = Math.max(0, w);
272563
- if (raw.style === "none")
272564
- return 0;
272565
- if (raw.style === "thick")
272566
- return Math.max(width * 2, 3);
272567
- return width;
272874
+ return getBorderBandWidthPx(value);
272568
272875
  }
272569
272876
  function getTableBorderWidths(borders) {
272570
272877
  return {
@@ -274265,12 +274572,17 @@ async function measureTableBlock(block, constraints, fontContext) {
274265
274572
  });
274266
274573
  if (rowspan === 1)
274267
274574
  rowBaseHeights[rowIndex] = Math.max(rowBaseHeights[rowIndex], totalCellHeight);
274268
- else
274575
+ else {
274576
+ const firstBlockMeasure = blockMeasures[0];
274577
+ const firstLineHeight = firstBlockMeasure?.kind === "paragraph" && firstBlockMeasure.lines.length > 0 ? firstBlockMeasure.lines[0].lineHeight : undefined;
274578
+ const minRowHeight = Math.min(totalCellHeight, firstLineHeight != null ? firstLineHeight + paddingTop + paddingBottom : totalCellHeight / rowspan);
274269
274579
  spanConstraints.push({
274270
274580
  startRow: rowIndex,
274271
274581
  rowSpan: rowspan,
274272
- requiredHeight: totalCellHeight
274582
+ requiredHeight: totalCellHeight,
274583
+ minRowHeight
274273
274584
  });
274585
+ }
274274
274586
  gridColIndex += colspan;
274275
274587
  }
274276
274588
  for (let col = gridColIndex;col < gridColumnCount; col++)
@@ -274282,6 +274594,12 @@ async function measureTableBlock(block, constraints, fontContext) {
274282
274594
  });
274283
274595
  }
274284
274596
  const rowHeights = [...rowBaseHeights];
274597
+ for (const constraint of spanConstraints) {
274598
+ const spanLength = Math.min(constraint.rowSpan, rowHeights.length - constraint.startRow);
274599
+ for (let i3 = 0;i3 < spanLength; i3++)
274600
+ if (rowBaseHeights[constraint.startRow + i3] === 0)
274601
+ rowHeights[constraint.startRow + i3] = Math.max(rowHeights[constraint.startRow + i3], constraint.minRowHeight);
274602
+ }
274285
274603
  for (const constraint of spanConstraints) {
274286
274604
  const { startRow, rowSpan, requiredHeight } = constraint;
274287
274605
  if (rowSpan <= 0)
@@ -274296,6 +274614,34 @@ async function measureTableBlock(block, constraints, fontContext) {
274296
274614
  rowHeights[startRow + i3] += increment2;
274297
274615
  }
274298
274616
  }
274617
+ if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) !== "separate" && block.rows.length > 0) {
274618
+ const tableBordersForBands = block.attrs?.borders;
274619
+ const bandReservation = (band) => band > 2 ? band - 1 : 0;
274620
+ const gridlineBand = (gridline) => {
274621
+ let band = 0;
274622
+ const rowAbove = gridline > 0 ? block.rows[gridline - 1] : undefined;
274623
+ const rowBelow = gridline < block.rows.length ? block.rows[gridline] : undefined;
274624
+ for (const row2 of [rowAbove, rowBelow]) {
274625
+ if (!row2)
274626
+ continue;
274627
+ const override = row2.attrs?.borders;
274628
+ const eff = override ? {
274629
+ ...tableBordersForBands ?? {},
274630
+ ...override
274631
+ } : tableBordersForBands;
274632
+ const value = gridline === 0 ? eff?.top : gridline === block.rows.length ? eff?.bottom : eff?.insideH;
274633
+ band = Math.max(band, getBorderBandWidthPx(value));
274634
+ }
274635
+ for (const cell2 of rowAbove?.cells ?? [])
274636
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.bottom));
274637
+ for (const cell2 of rowBelow?.cells ?? [])
274638
+ band = Math.max(band, getBorderBandWidthPx(cell2.attrs?.borders?.top));
274639
+ return band;
274640
+ };
274641
+ for (let i3 = 0;i3 < block.rows.length; i3++)
274642
+ rowHeights[i3] += bandReservation(gridlineBand(i3));
274643
+ rowHeights[block.rows.length - 1] += bandReservation(gridlineBand(block.rows.length));
274644
+ }
274299
274645
  block.rows.forEach((row2, index2) => {
274300
274646
  const spec = row2.attrs?.rowHeight;
274301
274647
  if (spec?.value != null && Number.isFinite(spec.value))
@@ -281943,7 +282289,10 @@ var Node$13 = class Node$14 {
281943
282289
  const headerCells = [];
281944
282290
  const cells = [];
281945
282291
  for (let index2 = 0;index2 < colsCount; index2++) {
281946
- const cellAttrs = columnWidths ? { colwidth: [columnWidths[index2]] } : null;
282292
+ const cellAttrs = columnWidths ? {
282293
+ colwidth: [columnWidths[index2]],
282294
+ tableCellProperties: { cellWidth: cellWidthDxa(columnWidths[index2]) }
282295
+ } : null;
281947
282296
  const cell2 = createCell2(types2.tableCell, cellContent, cellAttrs);
281948
282297
  if (cell2)
281949
282298
  cells.push(cell2);
@@ -297252,15 +297601,30 @@ menclose::after {
297252
297601
  single: "solid",
297253
297602
  double: "double",
297254
297603
  dashed: "dashed",
297604
+ dashSmallGap: "dashed",
297255
297605
  dotted: "dotted",
297256
297606
  thick: "solid",
297257
297607
  triple: "solid",
297258
297608
  dotDash: "dashed",
297259
297609
  dotDotDash: "dashed",
297610
+ thinThickSmallGap: "solid",
297611
+ thickThinSmallGap: "solid",
297612
+ thinThickThinSmallGap: "solid",
297613
+ thinThickMediumGap: "solid",
297614
+ thickThinMediumGap: "solid",
297615
+ thinThickThinMediumGap: "solid",
297616
+ thinThickLargeGap: "solid",
297617
+ thickThinLargeGap: "solid",
297618
+ thinThickThinLargeGap: "solid",
297260
297619
  wave: "solid",
297261
- doubleWave: "solid"
297620
+ doubleWave: "solid",
297621
+ dashDotStroked: "dashed",
297622
+ threeDEmboss: "ridge",
297623
+ threeDEngrave: "groove",
297624
+ outset: "solid",
297625
+ inset: "solid"
297262
297626
  }[style2];
297263
- }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border) => {
297627
+ }, isValidHexColor2 = (color2) => /^#[0-9A-Fa-f]{6}$/.test(color2), applyBorder = (element3, side, border, widthOverridePx) => {
297264
297628
  if (!border)
297265
297629
  return;
297266
297630
  if (border.style === "none" || border.width === 0) {
@@ -297268,18 +297632,40 @@ menclose::after {
297268
297632
  return;
297269
297633
  }
297270
297634
  const style2 = borderStyleToCSS(border.style);
297271
- const width = border.width ?? 1;
297272
297635
  const color2 = border.color ?? "#000000";
297273
297636
  const safeColor = isValidHexColor2(color2) ? color2 : "#000000";
297274
- const actualWidth = border.style === "thick" ? Math.max(width * 2, 3) : width;
297637
+ const actualWidth = widthOverridePx ?? getBorderBandWidthPx(border);
297275
297638
  element3.style[`border${side}`] = `${actualWidth}px ${style2} ${safeColor}`;
297276
- }, applyCellBorders = (element3, borders) => {
297639
+ }, applyCellBorders = (element3, borders, widthOverridesPx) => {
297277
297640
  if (!borders)
297278
297641
  return;
297279
297642
  applyBorder(element3, "Top", borders.top);
297280
- applyBorder(element3, "Right", borders.right);
297643
+ applyBorder(element3, "Right", borders.right, widthOverridesPx?.right);
297281
297644
  applyBorder(element3, "Bottom", borders.bottom);
297282
- applyBorder(element3, "Left", borders.left);
297645
+ applyBorder(element3, "Left", borders.left, widthOverridesPx?.left);
297646
+ }, BEVEL_LIGHT_AUTO = "#F0F0F0", BEVEL_DARK_AUTO = "#A0A0A0", bevelDarkColor = (color2) => {
297647
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
297648
+ return BEVEL_DARK_AUTO;
297649
+ const half = (i3) => Math.floor(parseInt(color2.slice(i3, i3 + 2), 16) / 2);
297650
+ return `#${[
297651
+ 1,
297652
+ 3,
297653
+ 5
297654
+ ].map((i3) => half(i3).toString(16).padStart(2, "0")).join("")}`;
297655
+ }, bevelLightColor = (color2) => {
297656
+ if (!color2 || !/^#[0-9A-Fa-f]{6}$/.test(color2) || color2.toLowerCase() === "#000000")
297657
+ return BEVEL_LIGHT_AUTO;
297658
+ return color2;
297659
+ }, bevelToneSpec = (spec, visualSide, owner) => {
297660
+ if (!spec || spec.style !== "outset" && spec.style !== "inset")
297661
+ return spec;
297662
+ const raisedSide = visualSide === "top" || visualSide === "left";
297663
+ const light = spec.style === "outset" === (owner === "table") === raisedSide;
297664
+ return {
297665
+ ...spec,
297666
+ style: "single",
297667
+ color: light ? bevelLightColor(spec.color) : bevelDarkColor(spec.color)
297668
+ };
297283
297669
  }, borderValueToSpec = (value) => {
297284
297670
  if (!value)
297285
297671
  return;
@@ -298388,7 +298774,7 @@ menclose::after {
298388
298774
  hasSdtContainerChrome
298389
298775
  };
298390
298776
  }, renderTableCell = (deps) => {
298391
- const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine, resolvePhysical } = deps;
298777
+ const { doc: doc$12, x, y: y$1, rowHeight, cellMeasure, cell: cell2, borders, useDefaultBorder, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, context, applySdtDataset: applySdtDataset$1, chrome: chrome2, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, tableIndent, isRtl, cellWidth, fromLine, toLine, resolvePhysical, borderBandOverridesPx } = deps;
298392
298778
  const padding = cell2?.attrs?.padding || {
298393
298779
  top: 0,
298394
298780
  left: 4,
@@ -298396,9 +298782,16 @@ menclose::after {
298396
298782
  bottom: 0
298397
298783
  };
298398
298784
  const buildTableImageHyperlinkAnchor = (imageEl, hyperlink, display) => buildImageHyperlinkAnchor(doc$12, imageEl, hyperlink, display);
298399
- const paddingLeft = isRtl ? padding.right ?? 4 : padding.left ?? 4;
298785
+ const compoundBandEats = (border, bandInCellPx) => {
298786
+ const profile = border ? getBorderBandProfile(border) : null;
298787
+ if (!profile)
298788
+ return 0;
298789
+ const bandInCell = bandInCellPx ?? profile.band;
298790
+ return Math.max(0, bandInCell - profile.band / 2);
298791
+ };
298792
+ const paddingLeft = Math.max(0, (isRtl ? padding.right ?? 4 : padding.left ?? 4) - compoundBandEats(borders?.left, borderBandOverridesPx?.left));
298400
298793
  const paddingTop = padding.top ?? 0;
298401
- const paddingRight = isRtl ? padding.left ?? 4 : padding.right ?? 4;
298794
+ const paddingRight = Math.max(0, (isRtl ? padding.left ?? 4 : padding.right ?? 4) - compoundBandEats(borders?.right, borderBandOverridesPx?.right));
298402
298795
  const paddingBottom = padding.bottom ?? 0;
298403
298796
  const cellEl = doc$12.createElement("div");
298404
298797
  cellEl.style.position = "absolute";
@@ -298413,7 +298806,7 @@ menclose::after {
298413
298806
  cellEl.style.paddingRight = `${paddingRight}px`;
298414
298807
  cellEl.style.paddingBottom = `${paddingBottom}px`;
298415
298808
  if (borders)
298416
- applyCellBorders(cellEl, borders);
298809
+ applyCellBorders(cellEl, borders, borderBandOverridesPx);
298417
298810
  else if (useDefaultBorder)
298418
298811
  cellEl.style.border = "1px solid rgba(0,0,0,0.6)";
298419
298812
  if (cell2?.attrs?.background)
@@ -298887,16 +299280,25 @@ menclose::after {
298887
299280
  elem.dataset.trackChangeAuthorColor = meta4.color;
298888
299281
  if (meta4.date)
298889
299282
  elem.dataset.trackChangeDate = meta4.date;
298890
- }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, nextRowLeavesRightGap, deferTopToAboveCell, nextRowSuppressesSharedTop }) => {
299283
+ }, hasAnyResolvedBorder = (borders) => Boolean(borders.top || borders.right || borders.bottom || borders.left), resolveRenderedCellBorders = ({ cellBorders, hasBordersAttribute, tableBorders, cellPosition, cellSpacingPx, continuesFromPrev, continuesOnNext, aboveCellBorders, leftCellBorders, rightCellBorders, separateBorders, nextRowSuppressesSharedTop }) => {
298891
299284
  const hasExplicitBorders = hasExplicitCellBorders(cellBorders);
298892
299285
  const cellBounds = getTableCellGridBounds(cellPosition);
298893
299286
  const touchesTopBoundary = cellBounds.touchesTopEdge || continuesFromPrev;
298894
- const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext || nextRowLeavesRightGap === true;
298895
- const hasInteriorNeighborBorder = !touchesTopBoundary && !deferTopToAboveCell && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
299287
+ const touchesBottomBoundary = cellBounds.touchesBottomEdge || continuesOnNext;
299288
+ const hasInteriorNeighborBorder = !touchesTopBoundary && isPresentBorder(aboveCellBorders?.bottom) || !cellBounds.touchesLeftEdge && isPresentBorder(leftCellBorders?.right);
299289
+ if (separateBorders && cellSpacingPx === 0) {
299290
+ const cb = cellBorders ?? {};
299291
+ return {
299292
+ top: resolveTableBorderValue(cb.top, touchesTopBoundary ? tableBorders?.top : tableBorders?.insideH),
299293
+ right: resolveTableBorderValue(cb.right, cellBounds.touchesRightEdge ? tableBorders?.right : tableBorders?.insideV),
299294
+ bottom: resolveTableBorderValue(cb.bottom, touchesBottomBoundary ? tableBorders?.bottom : tableBorders?.insideH),
299295
+ left: resolveTableBorderValue(cb.left, cellBounds.touchesLeftEdge ? tableBorders?.left : tableBorders?.insideV)
299296
+ };
299297
+ }
298896
299298
  if (cellSpacingPx === 0 && (hasExplicitBorders || hasInteriorNeighborBorder)) {
298897
299299
  const cb = cellBorders ?? {};
298898
299300
  return {
298899
- top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : deferTopToAboveCell ? undefined : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
299301
+ top: touchesTopBoundary ? resolveTableBorderValue(cb.top, tableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? (isExplicitNoneBorder(cb.top) && isExplicitNoneBorder(aboveCellBorders?.bottom) ? undefined : borderValueToSpec(tableBorders?.insideH)),
298900
299302
  left: cellBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, tableBorders?.left) : isPresentBorder(cb.left) ? resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(tableBorders?.insideV) : isPresentBorder(leftCellBorders?.right) ? undefined : isExplicitNoneBorder(cb.left) && isExplicitNoneBorder(leftCellBorders?.right) ? undefined : borderValueToSpec(tableBorders?.insideV),
298901
299303
  right: cellBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, tableBorders?.right) : isPresentBorder(cb.right) && !isPresentBorder(rightCellBorders?.left) ? cb.right : undefined,
298902
299304
  bottom: touchesBottomBoundary ? resolveTableBorderValue(cb.bottom, tableBorders?.bottom) : undefined
@@ -298936,8 +299338,102 @@ menclose::after {
298936
299338
  bottom: touchesBottomBoundary ? borderValueToSpec(tableBorders.bottom) : interiorBottom,
298937
299339
  left: baseBorders.left
298938
299340
  };
299341
+ }, appendCompoundBorderRects = (doc$12, container, cellElement, borders, rect, edges) => {
299342
+ if (!borders)
299343
+ return;
299344
+ const { ownsBottomBand, rightIsBoundary, leftIsBoundary, suppressMid } = edges;
299345
+ const sideInfo = [
299346
+ "top",
299347
+ "right",
299348
+ "bottom",
299349
+ "left"
299350
+ ].map((side) => {
299351
+ const spec = borders[side];
299352
+ const profile = spec ? getBorderBandProfile(spec) : null;
299353
+ if (!spec || !profile)
299354
+ return null;
299355
+ if (isNativeCssDoubleStyle(spec.style)) {
299356
+ if (side === "top" || side === "bottom" && ownsBottomBand || side === "left" && leftIsBoundary || side === "right" && rightIsBoundary)
299357
+ return null;
299358
+ }
299359
+ const { segments } = profile;
299360
+ return {
299361
+ side,
299362
+ band: Math.max(1, Math.round(profile.band)),
299363
+ outerRule: Math.max(1, Math.round(segments[0])),
299364
+ innerRule: Math.max(1, Math.round(segments[segments.length - 1])),
299365
+ midRule: segments.length === 5 ? Math.max(1, Math.round(segments[2])) : 0,
299366
+ midOffset: segments.length === 5 ? Math.round(segments[0] + segments[1]) : 0,
299367
+ color: spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000"
299368
+ };
299369
+ });
299370
+ if (!sideInfo.some(Boolean))
299371
+ return;
299372
+ const x0$1 = Math.round(rect.x);
299373
+ const y0 = Math.round(rect.y);
299374
+ const x1 = Math.round(rect.x + rect.width);
299375
+ const y1 = Math.round(rect.y + rect.height);
299376
+ for (const info of sideInfo) {
299377
+ if (!info)
299378
+ continue;
299379
+ const cssSide = info.side[0].toUpperCase() + info.side.slice(1);
299380
+ cellElement.style[`border${cssSide}Color`] = "transparent";
299381
+ }
299382
+ const [top$1, right$1, bottom$1, left$1] = sideInfo;
299383
+ const rectEl = doc$12.createElement("div");
299384
+ rectEl.className = "superdoc-compound-border-rect";
299385
+ const st = rectEl.style;
299386
+ st.position = "absolute";
299387
+ st.boxSizing = "border-box";
299388
+ st.pointerEvents = "none";
299389
+ const topInset = top$1 ? top$1.band - top$1.innerRule : 0;
299390
+ const leftInset = left$1 ? leftIsBoundary ? left$1.band - left$1.innerRule : Math.round(left$1.band / 2) - left$1.innerRule : 0;
299391
+ const bottomInset = bottom$1 ? ownsBottomBand ? bottom$1.band - bottom$1.innerRule : Math.round(bottom$1.band / 2) - bottom$1.outerRule : 0;
299392
+ const rightInset = right$1 ? rightIsBoundary ? right$1.band - right$1.innerRule : Math.round(right$1.band / 2) - right$1.outerRule : 0;
299393
+ st.left = `${x0$1 + leftInset}px`;
299394
+ st.top = `${y0 + topInset}px`;
299395
+ st.width = `${x1 - x0$1 - leftInset - rightInset}px`;
299396
+ st.height = `${y1 - y0 - topInset - bottomInset}px`;
299397
+ if (top$1)
299398
+ st.borderTop = `${top$1.innerRule}px solid ${top$1.color}`;
299399
+ if (bottom$1)
299400
+ st.borderBottom = `${ownsBottomBand ? bottom$1.innerRule : bottom$1.outerRule}px solid ${bottom$1.color}`;
299401
+ if (left$1)
299402
+ st.borderLeft = `${left$1.innerRule}px solid ${left$1.color}`;
299403
+ if (right$1)
299404
+ st.borderRight = `${rightIsBoundary ? right$1.innerRule : right$1.outerRule}px solid ${right$1.color}`;
299405
+ container.appendChild(rectEl);
299406
+ const midTop = top$1 && top$1.midRule > 0 && !suppressMid?.top ? top$1 : null;
299407
+ const midLeft = left$1 && left$1.midRule > 0 && !suppressMid?.left ? left$1 : null;
299408
+ const midBottom = bottom$1 && bottom$1.midRule > 0 && ownsBottomBand && !suppressMid?.bottom ? bottom$1 : null;
299409
+ const midRight = right$1 && right$1.midRule > 0 && rightIsBoundary && !suppressMid?.right ? right$1 : null;
299410
+ if (midTop || midLeft || midBottom || midRight) {
299411
+ const mid = doc$12.createElement("div");
299412
+ mid.className = "superdoc-compound-border-mid";
299413
+ const ms = mid.style;
299414
+ ms.position = "absolute";
299415
+ ms.boxSizing = "border-box";
299416
+ ms.pointerEvents = "none";
299417
+ const tIn = midTop ? midTop.midOffset : 0;
299418
+ const lIn = midLeft ? midLeft.midOffset : 0;
299419
+ const bIn = midBottom ? midBottom.midOffset : 0;
299420
+ const rIn = midRight ? midRight.midOffset : 0;
299421
+ ms.left = `${x0$1 + lIn}px`;
299422
+ ms.top = `${y0 + tIn}px`;
299423
+ ms.width = `${x1 - x0$1 - lIn - rIn}px`;
299424
+ ms.height = `${y1 - y0 - tIn - bIn}px`;
299425
+ if (midTop)
299426
+ ms.borderTop = `${midTop.midRule}px solid ${midTop.color}`;
299427
+ if (midBottom)
299428
+ ms.borderBottom = `${midBottom.midRule}px solid ${midBottom.color}`;
299429
+ if (midLeft)
299430
+ ms.borderLeft = `${midLeft.midRule}px solid ${midLeft.color}`;
299431
+ if (midRight)
299432
+ ms.borderRight = `${midRight.midRule}px solid ${midRight.color}`;
299433
+ container.appendChild(mid);
299434
+ }
298939
299435
  }, renderTableRow = (deps) => {
298940
- const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, prevRow, prevRowMeasure, nextRow, nextRowMeasure, rowOccupiedRightCol, nextRowOccupiedRightCol, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
299436
+ const { doc: doc$12, container, rowIndex, y: y$1, rowMeasure, row: row2, prevRow, prevRowMeasure, nextRow, rowOccupiedRightCol, separateBorders, totalRows, tableBorders, columnWidths, allRowHeights, tableIndent, isRtl, context, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applySdtDataset: applySdtDataset$1, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, continuesFromPrev, continuesOnNext, partialRow, cellSpacingPx = 0, chrome: chrome2, resolvePhysical } = deps;
298941
299437
  const totalCols = columnWidths.length;
298942
299438
  const rowTrackedChange = row2?.attrs?.trackedChange;
298943
299439
  let rowTrackedChangeConfig;
@@ -299001,17 +299497,6 @@ menclose::after {
299001
299497
  return cells[i3]?.attrs?.borders;
299002
299498
  }
299003
299499
  };
299004
- const findCellRightEdgeAtColumn = (measureCells, gridCol) => {
299005
- if (!measureCells)
299006
- return;
299007
- for (let i3 = 0;i3 < measureCells.length; i3++) {
299008
- const start$1 = measureCells[i3].gridColumnStart ?? i3;
299009
- const span = measureCells[i3].colSpan ?? 1;
299010
- if (gridCol >= start$1 && gridCol < start$1 + span)
299011
- return start$1 + span;
299012
- }
299013
- };
299014
- const nextRowMaxCol = nextRowOccupiedRightCol != null && nextRowOccupiedRightCol > 0 ? nextRowOccupiedRightCol : nextRowMeasure?.cells?.length ? Math.max(...nextRowMeasure.cells.map((c) => (c.gridColumnStart ?? 0) + (c.colSpan ?? 1))) : Infinity;
299015
299500
  for (let cellIndex = 0;cellIndex < rowMeasure.cells.length; cellIndex += 1) {
299016
299501
  const cellMeasure = rowMeasure.cells[cellIndex];
299017
299502
  const cell2 = row2?.cells?.[cellIndex];
@@ -299032,8 +299517,6 @@ menclose::after {
299032
299517
  const aboveCellBorders = findCellBordersAtColumn(prevRow?.cells, prevRowMeasure?.cells, gridColumnStart);
299033
299518
  const leftCellBorders = gridColumnStart > 0 ? findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart - 1) : undefined;
299034
299519
  const rightCellBorders = findCellBordersAtColumn(row2?.cells, rowMeasure.cells, gridColumnStart + colSpan);
299035
- const nextRowLeavesRightGap = gridColumnStart + colSpan > nextRowMaxCol;
299036
- const aboveCellRightEdge = findCellRightEdgeAtColumn(prevRowMeasure?.cells, gridColumnStart);
299037
299520
  const resolvedBorders = resolveRenderedCellBorders({
299038
299521
  cellBorders: cellBordersAttr,
299039
299522
  hasBordersAttribute,
@@ -299045,11 +299528,16 @@ menclose::after {
299045
299528
  aboveCellBorders,
299046
299529
  leftCellBorders,
299047
299530
  rightCellBorders,
299048
- nextRowLeavesRightGap,
299049
- deferTopToAboveCell: aboveCellRightEdge !== undefined && aboveCellRightEdge > rowRightEdgeCol,
299531
+ separateBorders,
299050
299532
  nextRowSuppressesSharedTop
299051
299533
  });
299052
299534
  const finalBorders = isRtl && resolvedBorders ? swapCellBordersLR(resolvedBorders) : resolvedBorders;
299535
+ const tonedBorders = separateBorders && finalBorders ? {
299536
+ top: bevelToneSpec(finalBorders.top, "top", "cell"),
299537
+ right: bevelToneSpec(finalBorders.right, "right", "cell"),
299538
+ bottom: bevelToneSpec(finalBorders.bottom, "bottom", "cell"),
299539
+ left: bevelToneSpec(finalBorders.left, "left", "cell")
299540
+ } : finalBorders;
299053
299541
  let cellHeight;
299054
299542
  if (partialRow)
299055
299543
  cellHeight = partialRow.partialHeight;
@@ -299062,6 +299550,34 @@ menclose::after {
299062
299550
  const computedCellWidth = calculateColspanWidth(gridColumnStart, colSpan);
299063
299551
  if (isRtl && computedCellWidth > 0)
299064
299552
  x = tableContentWidth - x - computedCellWidth;
299553
+ const cellGridBounds = getTableCellGridBounds(cellPosition);
299554
+ const cellIsIntentionallyBorderless = hasBordersAttribute && !hasExplicitCellBorders(cellBordersAttr);
299555
+ const cb = cellBordersAttr ?? {};
299556
+ const effectiveSideSpecs = cellIsIntentionallyBorderless ? {} : {
299557
+ top: cellGridBounds.touchesTopEdge || continuesFromPrev === true ? resolveTableBorderValue(cb.top, effectiveTableBorders?.top) : resolveBorderConflict(cb.top, aboveCellBorders?.bottom) ?? borderValueToSpec(effectiveTableBorders?.insideH),
299558
+ bottom: cellGridBounds.touchesBottomEdge || continuesOnNext === true ? resolveTableBorderValue(cb.bottom, effectiveTableBorders?.bottom) : resolveBorderConflict(cb.bottom, undefined) ?? borderValueToSpec(effectiveTableBorders?.insideH),
299559
+ left: cellGridBounds.touchesLeftEdge ? resolveTableBorderValue(cb.left, effectiveTableBorders?.left) : resolveBorderConflict(cb.left, leftCellBorders?.right) ?? borderValueToSpec(effectiveTableBorders?.insideV),
299560
+ right: cellGridBounds.touchesRightEdge ? resolveTableBorderValue(cb.right, effectiveTableBorders?.right) : resolveBorderConflict(cb.right, rightCellBorders?.left) ?? borderValueToSpec(effectiveTableBorders?.insideV)
299561
+ };
299562
+ const rectBorders = (isRtl ? swapCellBordersLR(effectiveSideSpecs) : effectiveSideSpecs) ?? effectiveSideSpecs;
299563
+ const visualTouchesLeft = isRtl ? cellGridBounds.touchesRightEdge : cellGridBounds.touchesLeftEdge;
299564
+ const visualTouchesRight = isRtl ? cellGridBounds.touchesLeftEdge : cellGridBounds.touchesRightEdge;
299565
+ const leftStraddleProfile = !visualTouchesLeft && rectBorders.left ? getBorderBandProfile(rectBorders.left) : null;
299566
+ const rightStraddleProfile = !visualTouchesRight && rectBorders.right ? getBorderBandProfile(rectBorders.right) : null;
299567
+ let paintBorders = tonedBorders;
299568
+ let borderBandOverridesPx;
299569
+ if (leftStraddleProfile || rightStraddleProfile) {
299570
+ paintBorders = { ...tonedBorders ?? {} };
299571
+ borderBandOverridesPx = {};
299572
+ if (leftStraddleProfile) {
299573
+ paintBorders.left = rectBorders.left;
299574
+ borderBandOverridesPx.left = leftStraddleProfile.band / 2;
299575
+ }
299576
+ if (rightStraddleProfile) {
299577
+ paintBorders.right = rectBorders.right;
299578
+ borderBandOverridesPx.right = rightStraddleProfile.band / 2;
299579
+ }
299580
+ }
299065
299581
  const { cellElement } = renderTableCell({
299066
299582
  doc: doc$12,
299067
299583
  x,
@@ -299069,7 +299585,8 @@ menclose::after {
299069
299585
  rowHeight: cellHeight,
299070
299586
  cellMeasure,
299071
299587
  cell: cell2,
299072
- borders: finalBorders,
299588
+ borders: paintBorders,
299589
+ borderBandOverridesPx,
299073
299590
  useDefaultBorder: false,
299074
299591
  renderLine: renderLine$1,
299075
299592
  captureLineSnapshot,
@@ -299092,7 +299609,68 @@ menclose::after {
299092
299609
  if (rowTrackedChange && rowTrackedChangeConfig)
299093
299610
  applyRowTrackedChangeToCell(cellElement, rowTrackedChange, rowTrackedChangeConfig);
299094
299611
  container.appendChild(cellElement);
299612
+ const tableProvidesMid = (value) => {
299613
+ const profile = value != null && typeof value === "object" ? getBorderBandProfile(value) : null;
299614
+ return profile != null && profile.segments.length === 5;
299615
+ };
299616
+ const suppressMid = {
299617
+ top: tableProvidesMid(cellGridBounds.touchesTopEdge || continuesFromPrev === true ? effectiveTableBorders?.top : effectiveTableBorders?.insideH),
299618
+ bottom: tableProvidesMid(cellGridBounds.touchesBottomEdge || continuesOnNext === true ? effectiveTableBorders?.bottom : effectiveTableBorders?.insideH),
299619
+ left: tableProvidesMid(visualTouchesLeft ? isRtl ? effectiveTableBorders?.right : effectiveTableBorders?.left : effectiveTableBorders?.insideV),
299620
+ right: tableProvidesMid(visualTouchesRight ? isRtl ? effectiveTableBorders?.left : effectiveTableBorders?.right : effectiveTableBorders?.insideV)
299621
+ };
299622
+ appendCompoundBorderRects(doc$12, container, cellElement, rectBorders, {
299623
+ x,
299624
+ y: y$1,
299625
+ width: computedCellWidth > 0 ? computedCellWidth : cellMeasure.width ?? 0,
299626
+ height: cellHeight
299627
+ }, {
299628
+ ownsBottomBand: cellGridBounds.touchesBottomEdge || continuesOnNext === true,
299629
+ rightIsBoundary: visualTouchesRight,
299630
+ leftIsBoundary: visualTouchesLeft,
299631
+ suppressMid
299632
+ });
299633
+ }
299634
+ }, buildColumnOccupancy = (rows, numCols) => {
299635
+ const occupancy = rows.map(() => new Array(numCols).fill(null));
299636
+ rows.forEach((row2, rowIndex) => {
299637
+ row2?.cells?.forEach((cell2, cellIndex) => {
299638
+ const startCol = cell2.gridColumnStart ?? 0;
299639
+ const endCol = Math.min(numCols, startCol + (cell2.colSpan ?? 1));
299640
+ const endRow = Math.min(rows.length, rowIndex + (cell2.rowSpan ?? 1));
299641
+ const ref$1 = {
299642
+ rowIndex,
299643
+ cellIndex
299644
+ };
299645
+ for (let r$1 = rowIndex;r$1 < endRow; r$1 += 1)
299646
+ for (let c = startCol;c < endCol; c += 1)
299647
+ occupancy[r$1][c] = ref$1;
299648
+ });
299649
+ });
299650
+ return occupancy;
299651
+ }, computeBoundaryGapSegments = (occupancy, belowRowIndex) => {
299652
+ const above = occupancy[belowRowIndex - 1];
299653
+ const below = occupancy[belowRowIndex];
299654
+ if (!above || !below)
299655
+ return [];
299656
+ const segments = [];
299657
+ let current = null;
299658
+ for (let c = 0;c < above.length; c += 1) {
299659
+ const aboveCell = above[c];
299660
+ const isGap = aboveCell !== null && below[c] === null;
299661
+ if (isGap && current && current.aboveCell === aboveCell)
299662
+ current.endColExclusive = c + 1;
299663
+ else if (isGap) {
299664
+ current = {
299665
+ startCol: c,
299666
+ endColExclusive: c + 1,
299667
+ aboveCell
299668
+ };
299669
+ segments.push(current);
299670
+ } else
299671
+ current = null;
299095
299672
  }
299673
+ return segments;
299096
299674
  }, renderTableFragment = (deps) => {
299097
299675
  const { doc: doc$12, fragment, block, measure, cellSpacingPx, effectiveColumnWidths, chrome: chrome2, context, sdtBoundary, ancestorContainerKey, ancestorContainerSdt, ancestorContainerKeys, ancestorContainerSdts, onSdtContainerChrome, renderLine: renderLine$1, captureLineSnapshot, renderDrawingContent, applyFragmentFrame, applySdtDataset: applySdtDataset$1, applyContainerSdtDataset: applyContainerSdtDataset$1, applyStyles: applyStyles$3, resolvePhysical } = deps;
299098
299676
  if (!doc$12) {
@@ -299244,11 +299822,23 @@ menclose::after {
299244
299822
  }
299245
299823
  if (block.id)
299246
299824
  container.setAttribute("data-sd-block-id", block.id);
299247
- if ((block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse")) === "separate" && tableBorders) {
299248
- applyBorder(container, "Top", borderValueToSpec(tableBorders.top));
299249
- applyBorder(container, "Right", borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right));
299250
- applyBorder(container, "Bottom", borderValueToSpec(tableBorders.bottom));
299251
- applyBorder(container, "Left", borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left));
299825
+ const borderCollapse = block.attrs?.borderCollapse ?? (block.attrs?.cellSpacing != null ? "separate" : "collapse");
299826
+ const separateBorders = borderCollapse === "separate";
299827
+ if (borderCollapse === "separate" && tableBorders) {
299828
+ applyBorder(container, "Top", bevelToneSpec(borderValueToSpec(tableBorders.top), "top", "table"));
299829
+ applyBorder(container, "Right", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.left : tableBorders.right), "right", "table"));
299830
+ applyBorder(container, "Bottom", bevelToneSpec(borderValueToSpec(tableBorders.bottom), "bottom", "table"));
299831
+ applyBorder(container, "Left", bevelToneSpec(borderValueToSpec(isRtl ? tableBorders.right : tableBorders.left), "left", "table"));
299832
+ for (const [cssSide, value] of [
299833
+ ["Top", tableBorders.top],
299834
+ ["Right", isRtl ? tableBorders.left : tableBorders.right],
299835
+ ["Bottom", tableBorders.bottom],
299836
+ ["Left", isRtl ? tableBorders.right : tableBorders.left]
299837
+ ]) {
299838
+ const spec = borderValueToSpec(value);
299839
+ if (spec && getBorderBandProfile(spec) && !isNativeCssDoubleStyle(spec.style))
299840
+ container.style[`border${cssSide}Color`] = "transparent";
299841
+ }
299252
299842
  }
299253
299843
  const allRowHeights = measure.rows.map((r$1, idx) => {
299254
299844
  if (fragment.partialRow && fragment.partialRow.rowIndex === idx)
@@ -299281,9 +299871,8 @@ menclose::after {
299281
299871
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
299282
299872
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
299283
299873
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
299284
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
299285
299874
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
299286
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
299875
+ separateBorders,
299287
299876
  totalRows: block.rows.length,
299288
299877
  tableBorders,
299289
299878
  columnWidths: effectiveColumnWidths,
@@ -299387,10 +299976,16 @@ menclose::after {
299387
299976
  }
299388
299977
  }
299389
299978
  }
299979
+ const interiorRowBoundaries = [];
299390
299980
  for (let r$1 = fragment.fromRow;r$1 < fragment.toRow; r$1 += 1) {
299391
299981
  const rowMeasure = measure.rows[r$1];
299392
299982
  if (!rowMeasure)
299393
299983
  break;
299984
+ if (r$1 > fragment.fromRow)
299985
+ interiorRowBoundaries.push({
299986
+ y: y$1,
299987
+ belowRowIndex: r$1
299988
+ });
299394
299989
  const isFirstRenderedBodyRow = r$1 === fragment.fromRow;
299395
299990
  const isLastRenderedBodyRow = r$1 === fragment.toRow - 1;
299396
299991
  const partialRowData = fragment.partialRow && fragment.partialRow.rowIndex === r$1 ? fragment.partialRow : undefined;
@@ -299405,9 +300000,8 @@ menclose::after {
299405
300000
  prevRow: r$1 > 0 ? block.rows[r$1 - 1] : undefined,
299406
300001
  prevRowMeasure: r$1 > 0 ? measure.rows[r$1 - 1] : undefined,
299407
300002
  nextRow: r$1 < block.rows.length - 1 ? block.rows[r$1 + 1] : undefined,
299408
- nextRowMeasure: r$1 < block.rows.length - 1 ? measure.rows[r$1 + 1] : undefined,
299409
300003
  rowOccupiedRightCol: rowOccupiedRightCols[r$1],
299410
- nextRowOccupiedRightCol: rowOccupiedRightCols[r$1 + 1],
300004
+ separateBorders,
299411
300005
  totalRows: block.rows.length,
299412
300006
  tableBorders,
299413
300007
  columnWidths: effectiveColumnWidths,
@@ -299433,6 +300027,171 @@ menclose::after {
299433
300027
  });
299434
300028
  y$1 += actualRowHeight + cellSpacingPx;
299435
300029
  }
300030
+ {
300031
+ const sides = [
300032
+ [
300033
+ "top",
300034
+ tableBorders?.top,
300035
+ fragment.continuesFromPrev !== true
300036
+ ],
300037
+ [
300038
+ "right",
300039
+ isRtl ? tableBorders?.left : tableBorders?.right,
300040
+ true
300041
+ ],
300042
+ [
300043
+ "bottom",
300044
+ tableBorders?.bottom,
300045
+ fragment.continuesOnNext !== true
300046
+ ],
300047
+ [
300048
+ "left",
300049
+ isRtl ? tableBorders?.right : tableBorders?.left,
300050
+ true
300051
+ ]
300052
+ ];
300053
+ let outlineEl = null;
300054
+ for (const [side, value, enabled] of sides) {
300055
+ if (!enabled || value == null || typeof value !== "object")
300056
+ continue;
300057
+ const spec = value;
300058
+ const profile = getBorderBandProfile(value);
300059
+ if (!profile)
300060
+ continue;
300061
+ if (isNativeCssDoubleStyle(spec.style))
300062
+ continue;
300063
+ const rule = Math.max(1, Math.round(profile.segments[0]));
300064
+ const color2 = spec.color && /^#[0-9A-Fa-f]{6}$/.test(spec.color) ? spec.color : "#000000";
300065
+ if (!outlineEl) {
300066
+ outlineEl = doc$12.createElement("div");
300067
+ outlineEl.className = "superdoc-compound-border-outline";
300068
+ const st = outlineEl.style;
300069
+ st.position = "absolute";
300070
+ st.inset = "0";
300071
+ st.boxSizing = "border-box";
300072
+ st.pointerEvents = "none";
300073
+ container.appendChild(outlineEl);
300074
+ }
300075
+ const cssSide = side[0].toUpperCase() + side.slice(1);
300076
+ outlineEl.style[`border${cssSide}`] = `${rule}px solid ${color2}`;
300077
+ }
300078
+ }
300079
+ {
300080
+ const midProfileOf = (value) => {
300081
+ if (value == null || typeof value !== "object")
300082
+ return null;
300083
+ const profile = getBorderBandProfile(value);
300084
+ return profile && profile.segments.length === 5 ? profile : null;
300085
+ };
300086
+ const colorOf = (value) => {
300087
+ const c = value?.color;
300088
+ return c && /^#[0-9A-Fa-f]{6}$/.test(c) ? c : "#000000";
300089
+ };
300090
+ const midOffsetOf = (profile) => Math.round(profile.segments[0] + profile.segments[1]);
300091
+ const midRuleOf = (profile) => Math.max(1, Math.round(profile.segments[2]));
300092
+ const topBorder = tableBorders?.top;
300093
+ const bottomBorder = tableBorders?.bottom;
300094
+ const leftBorder = isRtl ? tableBorders?.right : tableBorders?.left;
300095
+ const rightBorder = isRtl ? tableBorders?.left : tableBorders?.right;
300096
+ const topMid = fragment.continuesFromPrev !== true ? midProfileOf(topBorder) : null;
300097
+ const bottomMid = fragment.continuesOnNext !== true ? midProfileOf(bottomBorder) : null;
300098
+ const leftMid = midProfileOf(leftBorder);
300099
+ const rightMid = midProfileOf(rightBorder);
300100
+ const insideHMid = midProfileOf(tableBorders?.insideH);
300101
+ const insideVMid = midProfileOf(tableBorders?.insideV);
300102
+ const fragmentWidth = fragment.width;
300103
+ const fragmentHeight = fragment.height;
300104
+ const ringTopInset = topMid ? midOffsetOf(topMid) : 0;
300105
+ const ringBottomInset = bottomMid ? midOffsetOf(bottomMid) : 0;
300106
+ const ringLeftInset = leftMid ? midOffsetOf(leftMid) : 0;
300107
+ const ringRightInset = rightMid ? midOffsetOf(rightMid) : 0;
300108
+ if (topMid || bottomMid || leftMid || rightMid) {
300109
+ const ring = doc$12.createElement("div");
300110
+ ring.className = "superdoc-compound-border-midring";
300111
+ const rs = ring.style;
300112
+ rs.position = "absolute";
300113
+ rs.boxSizing = "border-box";
300114
+ rs.pointerEvents = "none";
300115
+ rs.left = `${ringLeftInset}px`;
300116
+ rs.top = `${ringTopInset}px`;
300117
+ rs.width = `${fragmentWidth - ringLeftInset - ringRightInset}px`;
300118
+ rs.height = `${fragmentHeight - ringTopInset - ringBottomInset}px`;
300119
+ if (topMid)
300120
+ rs.borderTop = `${midRuleOf(topMid)}px solid ${colorOf(topBorder)}`;
300121
+ if (bottomMid)
300122
+ rs.borderBottom = `${midRuleOf(bottomMid)}px solid ${colorOf(bottomBorder)}`;
300123
+ if (leftMid)
300124
+ rs.borderLeft = `${midRuleOf(leftMid)}px solid ${colorOf(leftBorder)}`;
300125
+ if (rightMid)
300126
+ rs.borderRight = `${midRuleOf(rightMid)}px solid ${colorOf(rightBorder)}`;
300127
+ container.appendChild(ring);
300128
+ }
300129
+ const appendStrip = (className, l, t, w, h$2, color2) => {
300130
+ const strip = doc$12.createElement("div");
300131
+ strip.className = className;
300132
+ const ss = strip.style;
300133
+ ss.position = "absolute";
300134
+ ss.pointerEvents = "none";
300135
+ ss.left = `${l}px`;
300136
+ ss.top = `${t}px`;
300137
+ ss.width = `${w}px`;
300138
+ ss.height = `${h$2}px`;
300139
+ ss.background = color2;
300140
+ container.appendChild(strip);
300141
+ };
300142
+ if (insideVMid && effectiveColumnWidths.length > 1) {
300143
+ const rule = midRuleOf(insideVMid);
300144
+ const color2 = colorOf(tableBorders?.insideV);
300145
+ let cum = 0;
300146
+ for (let i3 = 0;i3 < effectiveColumnWidths.length - 1; i3 += 1) {
300147
+ cum += effectiveColumnWidths[i3];
300148
+ const gx = isRtl ? fragmentWidth - cum : cum;
300149
+ appendStrip("superdoc-compound-border-midv", Math.round(gx - rule / 2), ringTopInset, rule, fragmentHeight - ringTopInset - ringBottomInset, color2);
300150
+ }
300151
+ }
300152
+ if (insideHMid && interiorRowBoundaries.length > 0) {
300153
+ const rule = midRuleOf(insideHMid);
300154
+ const color2 = colorOf(tableBorders?.insideH);
300155
+ for (const { y: gy } of interiorRowBoundaries)
300156
+ appendStrip("superdoc-compound-border-midh", ringLeftInset, Math.round(gy + midOffsetOf(insideHMid)), fragmentWidth - ringLeftInset - ringRightInset, rule, color2);
300157
+ }
300158
+ }
300159
+ if (cellSpacingPx === 0 && !separateBorders && interiorRowBoundaries.length > 0 && block.rows?.length) {
300160
+ const occupancy = buildColumnOccupancy(measure.rows, effectiveColumnWidths.length);
300161
+ const columnX = [0];
300162
+ for (const width of effectiveColumnWidths)
300163
+ columnX.push(columnX[columnX.length - 1] + width);
300164
+ for (const { y: boundaryY, belowRowIndex } of interiorRowBoundaries)
300165
+ for (const segment of computeBoundaryGapSegments(occupancy, belowRowIndex)) {
300166
+ if (segment.aboveCell.rowIndex < fragment.fromRow)
300167
+ continue;
300168
+ const aboveCell = block.rows[segment.aboveCell.rowIndex]?.cells?.[segment.aboveCell.cellIndex];
300169
+ const boundaryRowBorders = block.rows[belowRowIndex - 1]?.attrs?.borders;
300170
+ const effectiveInsideH = boundaryRowBorders ? {
300171
+ ...tableBorders ?? {},
300172
+ ...boundaryRowBorders
300173
+ }.insideH : tableBorders?.insideH;
300174
+ const cellBottom = aboveCell?.attrs?.borders?.bottom;
300175
+ const spec = isExplicitNoneBorder(cellBottom) ? undefined : resolveTableBorderValue(cellBottom, effectiveInsideH);
300176
+ if (!isPresentBorder(spec))
300177
+ continue;
300178
+ const x = columnX[segment.startCol];
300179
+ const width = columnX[segment.endColExclusive] - x;
300180
+ if (width <= 0)
300181
+ continue;
300182
+ const strip = doc$12.createElement("div");
300183
+ strip.className = "superdoc-row-boundary-gap";
300184
+ const ss = strip.style;
300185
+ ss.position = "absolute";
300186
+ ss.pointerEvents = "none";
300187
+ ss.left = `${isRtl ? fragment.width - x - width : x}px`;
300188
+ ss.top = `${boundaryY}px`;
300189
+ ss.width = `${width}px`;
300190
+ ss.height = "0";
300191
+ applyBorder(strip, "Top", spec);
300192
+ container.appendChild(strip);
300193
+ }
300194
+ }
299436
300195
  return container;
299437
300196
  }, getOwnContainerKey = (item) => {
299438
300197
  if (item.kind !== "fragment")
@@ -314310,13 +315069,13 @@ menclose::after {
314310
315069
  return;
314311
315070
  console.log(...args$1);
314312
315071
  }, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
314313
- var init_src_BrcexyXf_es = __esm(() => {
315072
+ var init_src_bMRzO9Kl_es = __esm(() => {
314314
315073
  init_rolldown_runtime_Bg48TavK_es();
314315
- init_SuperConverter_DIgF4xk__es();
315074
+ init_SuperConverter_Ed3nFN54_es();
314316
315075
  init_jszip_C49i9kUs_es();
314317
315076
  init_xml_js_CqGKpaft_es();
314318
315077
  init_uuid_B2wVPhPi_es();
314319
- init_create_headless_toolbar_BT4yIoZ_es();
315078
+ init_create_headless_toolbar_PSeH6IV5_es();
314320
315079
  init_constants_D9qj59G2_es();
314321
315080
  init_unified_BDuVPlMu_es();
314322
315081
  init_remark_gfm_BUJjZJLy_es();
@@ -324863,7 +325622,10 @@ ${err.toString()}`);
324863
325622
  for (let r$1 = 0;r$1 < rows; r$1++) {
324864
325623
  const cellNodes = [];
324865
325624
  for (let c = 0;c < columns; c++) {
324866
- const cellAttrs = widths ? { colwidth: [widths[c]] } : {};
325625
+ const cellAttrs = widths ? {
325626
+ colwidth: [widths[c]],
325627
+ tableCellProperties: { cellWidth: cellWidthDxa(widths[c]) }
325628
+ } : {};
324867
325629
  const cell2 = tableCellType.createAndFill(cellAttrs);
324868
325630
  if (!cell2)
324869
325631
  return false;
@@ -349092,13 +349854,28 @@ function print() { __p += __j.call(arguments, '') }
349092
349854
  "single",
349093
349855
  "double",
349094
349856
  "dashed",
349857
+ "dashSmallGap",
349095
349858
  "dotted",
349096
349859
  "thick",
349097
349860
  "triple",
349098
349861
  "dotDash",
349099
349862
  "dotDotDash",
349863
+ "thinThickSmallGap",
349864
+ "thickThinSmallGap",
349865
+ "thinThickThinSmallGap",
349866
+ "thinThickMediumGap",
349867
+ "thickThinMediumGap",
349868
+ "thinThickThinMediumGap",
349869
+ "thinThickLargeGap",
349870
+ "thickThinLargeGap",
349871
+ "thinThickThinLargeGap",
349100
349872
  "wave",
349101
- "doubleWave"
349873
+ "doubleWave",
349874
+ "dashDotStroked",
349875
+ "threeDEmboss",
349876
+ "threeDEngrave",
349877
+ "outset",
349878
+ "inset"
349102
349879
  ]);
349103
349880
  BORDER_STYLE_NUMBER = {
349104
349881
  single: 1,
@@ -349109,8 +349886,23 @@ function print() { __p += __j.call(arguments, '') }
349109
349886
  dotDash: 6,
349110
349887
  dotDotDash: 7,
349111
349888
  triple: 8,
349889
+ thinThickSmallGap: 9,
349890
+ thickThinSmallGap: 10,
349891
+ thinThickThinSmallGap: 11,
349892
+ thinThickMediumGap: 12,
349893
+ thickThinMediumGap: 13,
349894
+ thinThickThinMediumGap: 14,
349895
+ thinThickLargeGap: 15,
349896
+ thickThinLargeGap: 16,
349897
+ thinThickThinLargeGap: 17,
349112
349898
  wave: 18,
349113
- doubleWave: 19
349899
+ doubleWave: 19,
349900
+ dashSmallGap: 20,
349901
+ dashDotStroked: 21,
349902
+ threeDEmboss: 22,
349903
+ threeDEngrave: 23,
349904
+ outset: 24,
349905
+ inset: 25
349114
349906
  };
349115
349907
  BORDER_STYLE_LINES = {
349116
349908
  single: 1,
@@ -349121,8 +349913,21 @@ function print() { __p += __j.call(arguments, '') }
349121
349913
  dotDash: 1,
349122
349914
  dotDotDash: 1,
349123
349915
  triple: 3,
349916
+ thinThickSmallGap: 2,
349917
+ thickThinSmallGap: 2,
349918
+ thinThickThinSmallGap: 3,
349919
+ thinThickMediumGap: 2,
349920
+ thickThinMediumGap: 2,
349921
+ thinThickThinMediumGap: 3,
349922
+ thinThickLargeGap: 2,
349923
+ thickThinLargeGap: 2,
349924
+ thinThickThinLargeGap: 3,
349124
349925
  wave: 1,
349125
- doubleWave: 2
349926
+ doubleWave: 2,
349927
+ dashSmallGap: 1,
349928
+ dashDotStroked: 1,
349929
+ threeDEmboss: 1,
349930
+ threeDEngrave: 1
349126
349931
  };
349127
349932
  PX_PER_PT$12 = 96 / 72;
349128
349933
  BORDER_SIDES2 = [
@@ -357575,11 +358380,11 @@ function print() { __p += __j.call(arguments, '') }
357575
358380
  ]);
357576
358381
  });
357577
358382
 
357578
- // ../../packages/superdoc/dist/chunks/create-super-doc-ui-B-QEvuPe.es.js
358383
+ // ../../packages/superdoc/dist/chunks/create-super-doc-ui-DNNbMZCp.es.js
357579
358384
  var DEFAULT_TEXT_ALIGN_OPTIONS, DEFAULT_LINE_HEIGHT_OPTIONS, DEFAULT_ZOOM_OPTIONS, DEFAULT_DOCUMENT_MODE_OPTIONS, DEFAULT_FONT_SIZE_OPTIONS, headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, FONT_SIZE_OPTIONS;
357580
- var init_create_super_doc_ui_B_QEvuPe_es = __esm(() => {
357581
- init_SuperConverter_DIgF4xk__es();
357582
- init_create_headless_toolbar_BT4yIoZ_es();
358385
+ var init_create_super_doc_ui_DNNbMZCp_es = __esm(() => {
358386
+ init_SuperConverter_Ed3nFN54_es();
358387
+ init_create_headless_toolbar_PSeH6IV5_es();
357583
358388
  DEFAULT_TEXT_ALIGN_OPTIONS = [
357584
358389
  {
357585
358390
  label: "Left",
@@ -357870,15 +358675,15 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
357870
358675
 
357871
358676
  // ../../packages/superdoc/dist/super-editor.es.js
357872
358677
  var init_super_editor_es = __esm(() => {
357873
- init_src_BrcexyXf_es();
357874
- init_SuperConverter_DIgF4xk__es();
358678
+ init_src_bMRzO9Kl_es();
358679
+ init_SuperConverter_Ed3nFN54_es();
357875
358680
  init_jszip_C49i9kUs_es();
357876
358681
  init_xml_js_CqGKpaft_es();
357877
- init_create_headless_toolbar_BT4yIoZ_es();
358682
+ init_create_headless_toolbar_PSeH6IV5_es();
357878
358683
  init_constants_D9qj59G2_es();
357879
358684
  init_unified_BDuVPlMu_es();
357880
358685
  init_DocxZipper_BzS208BW_es();
357881
- init_create_super_doc_ui_B_QEvuPe_es();
358686
+ init_create_super_doc_ui_DNNbMZCp_es();
357882
358687
  init_ui_CGB3qmy3_es();
357883
358688
  init_eventemitter3_UwU_CLPU_es();
357884
358689
  init_errors_C_DoKMoN_es();
@@ -380965,6 +381770,9 @@ function resolveEffectiveHeaderFooterRef2({
380965
381770
  }
380966
381771
  return null;
380967
381772
  }
381773
+ // ../../packages/layout-engine/contracts/src/border-band.ts
381774
+ var init_border_band = () => {};
381775
+
380968
381776
  // ../../packages/layout-engine/contracts/src/ooxml-z-index.ts
380969
381777
  function coerceRelativeHeight2(raw) {
380970
381778
  if (typeof raw === "number" && Number.isFinite(raw))
@@ -381478,6 +382286,7 @@ var init_engines = () => {};
381478
382286
 
381479
382287
  // ../../packages/layout-engine/contracts/src/index.ts
381480
382288
  var init_src = __esm(() => {
382289
+ init_border_band();
381481
382290
  init_justify_utils();
381482
382291
  init_pm_range();
381483
382292
  init_graphic_placement();
@@ -388041,13 +388850,28 @@ var init_borders = __esm(() => {
388041
388850
  "single",
388042
388851
  "double",
388043
388852
  "dashed",
388853
+ "dashSmallGap",
388044
388854
  "dotted",
388045
388855
  "thick",
388046
388856
  "triple",
388047
388857
  "dotDash",
388048
388858
  "dotDotDash",
388859
+ "thinThickSmallGap",
388860
+ "thickThinSmallGap",
388861
+ "thinThickThinSmallGap",
388862
+ "thinThickMediumGap",
388863
+ "thickThinMediumGap",
388864
+ "thinThickThinMediumGap",
388865
+ "thinThickLargeGap",
388866
+ "thickThinLargeGap",
388867
+ "thinThickThinLargeGap",
388049
388868
  "wave",
388050
- "doubleWave"
388869
+ "doubleWave",
388870
+ "dashDotStroked",
388871
+ "threeDEmboss",
388872
+ "threeDEngrave",
388873
+ "outset",
388874
+ "inset"
388051
388875
  ]);
388052
388876
  });
388053
388877
 
@@ -388657,6 +389481,11 @@ function resolveConditionalProps2(propertyType, styleType, styleId2, translatedL
388657
389481
  const props = def?.tableStyleProperties?.[styleType]?.[propertyType];
388658
389482
  if (props)
388659
389483
  chain.push(props);
389484
+ if (styleType === "wholeTable" && propertyType === "tableCellProperties") {
389485
+ const baseProps = def?.tableCellProperties;
389486
+ if (baseProps)
389487
+ chain.push(baseProps);
389488
+ }
388660
389489
  currentId = def?.basedOn;
388661
389490
  }
388662
389491
  if (chain.length === 0)
@@ -388671,7 +389500,7 @@ function resolveCellStyles2(propertyType, tableInfo, translatedLinkedStyles) {
388671
389500
  const cellStyleProps = [];
388672
389501
  const tableStyleId = tableInfo.tableProperties.tableStyleId;
388673
389502
  const { rowBandSize, colBandSize } = resolveEffectiveBandSizes2(tableStyleId, translatedLinkedStyles);
388674
- const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK2, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle);
389503
+ const cellStyleTypes = determineCellStyleTypes2(tableInfo.tableProperties?.tblLook ?? DEFAULT_TBL_LOOK2, tableInfo.rowIndex, tableInfo.cellIndex, tableInfo.numRows, tableInfo.numCells, rowBandSize, colBandSize, tableInfo.rowCnfStyle, tableInfo.cellCnfStyle, tableInfo.gridColumnStart, tableInfo.gridColumnSpan, tableInfo.numGridCols);
388675
389504
  cellStyleTypes.forEach((styleType) => {
388676
389505
  const typeProps = resolveConditionalProps2(propertyType, styleType, tableStyleId, translatedLinkedStyles);
388677
389506
  if (typeProps) {
@@ -388694,12 +389523,15 @@ function resolveTableCellProperties2(inlineProps, tableInfo, translatedLinkedSty
388694
389523
  }
388695
389524
  return combineProperties2(chain, { fullOverrideProps: ["shading"] });
388696
389525
  }
388697
- function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle) {
389526
+ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCells, rowBandSize = 1, colBandSize = 1, rowCnfStyle, cellCnfStyle, gridColumnStart, gridColumnSpan, numGridCols) {
388698
389527
  const applicable = new Set(["wholeTable"]);
388699
389528
  const normalizedRowBandSize = rowBandSize > 0 ? rowBandSize : 1;
388700
389529
  const normalizedColBandSize = colBandSize > 0 ? colBandSize : 1;
389530
+ const columnStart = gridColumnStart ?? cellIndex;
389531
+ const columnEnd = columnStart + (gridColumnSpan ?? 1);
389532
+ const columnCount = numGridCols != null && numCells != null ? Math.max(numGridCols, numCells) : numGridCols ?? numCells;
388701
389533
  const bandRowIndex = Math.max(0, rowIndex - (tblLook?.firstRow ? 1 : 0));
388702
- const bandColIndex = Math.max(0, cellIndex - (tblLook?.firstColumn ? 1 : 0));
389534
+ const bandColIndex = Math.max(0, columnStart - (tblLook?.firstColumn ? 1 : 0));
388703
389535
  const rowGroup = Math.floor(bandRowIndex / normalizedRowBandSize);
388704
389536
  const colGroup = Math.floor(bandColIndex / normalizedColBandSize);
388705
389537
  if (!tblLook?.noHBand) {
@@ -388710,8 +389542,8 @@ function determineCellStyleTypes2(tblLook, rowIndex, cellIndex, numRows, numCell
388710
389542
  }
388711
389543
  const isFirstRow = !!tblLook?.firstRow && rowIndex === 0;
388712
389544
  const isLastRow = !!tblLook?.lastRow && numRows != null && numRows > 0 && rowIndex === numRows - 1;
388713
- const isFirstCol = !!tblLook?.firstColumn && cellIndex === 0;
388714
- const isLastCol = !!tblLook?.lastColumn && numCells != null && numCells > 0 && cellIndex === numCells - 1;
389545
+ const isFirstCol = !!tblLook?.firstColumn && columnStart === 0;
389546
+ const isLastCol = !!tblLook?.lastColumn && columnCount != null && columnCount > 0 && columnEnd >= columnCount;
388715
389547
  if (isFirstRow)
388716
389548
  applicable.add("firstRow");
388717
389549
  if (isFirstCol)
@@ -392052,10 +392884,40 @@ function normalizeLegacyBorderStyle2(value) {
392052
392884
  return "dotDash";
392053
392885
  case "dotdotdash":
392054
392886
  return "dotDotDash";
392887
+ case "dashsmallgap":
392888
+ return "dashSmallGap";
392889
+ case "thinthicksmallgap":
392890
+ return "thinThickSmallGap";
392891
+ case "thickthinsmallgap":
392892
+ return "thickThinSmallGap";
392893
+ case "thinthickthinsmallgap":
392894
+ return "thinThickThinSmallGap";
392895
+ case "thinthickmediumgap":
392896
+ return "thinThickMediumGap";
392897
+ case "thickthinmediumgap":
392898
+ return "thickThinMediumGap";
392899
+ case "thinthickthinmediumgap":
392900
+ return "thinThickThinMediumGap";
392901
+ case "thinthicklargegap":
392902
+ return "thinThickLargeGap";
392903
+ case "thickthinlargegap":
392904
+ return "thickThinLargeGap";
392905
+ case "thinthickthinlargegap":
392906
+ return "thinThickThinLargeGap";
392055
392907
  case "wave":
392056
392908
  return "wave";
392057
392909
  case "doublewave":
392058
392910
  return "doubleWave";
392911
+ case "dashdotstroked":
392912
+ return "dashDotStroked";
392913
+ case "threedemboss":
392914
+ return "threeDEmboss";
392915
+ case "threedengrave":
392916
+ return "threeDEngrave";
392917
+ case "outset":
392918
+ return "outset";
392919
+ case "inset":
392920
+ return "inset";
392059
392921
  case "single":
392060
392922
  default:
392061
392923
  return "single";
@@ -392193,14 +393055,21 @@ function tableNodeToBlock2(node3, {
392193
393055
  tableStyleId: effectiveStyleId ?? undefined
392194
393056
  } : undefined;
392195
393057
  const rows = [];
393058
+ const grid = node3.attrs?.grid;
393059
+ const numGridCols = Array.isArray(grid) && grid.length > 0 ? grid.length : undefined;
393060
+ let activeRowSpans = [];
392196
393061
  node3.content.forEach((rowNode, rowIndex) => {
393062
+ const { placements: placements2, nextActiveRowSpans } = placeRowCellsOnGrid2(rowNode, activeRowSpans);
393063
+ activeRowSpans = nextActiveRowSpans;
392197
393064
  const parsedRow = parseTableRow2({
392198
393065
  rowNode,
392199
393066
  rowIndex,
392200
393067
  numRows: node3?.content?.length ?? 1,
392201
393068
  context: parserDeps,
392202
393069
  defaultCellPadding,
392203
- tableProperties: tablePropertiesForCascade
393070
+ tableProperties: tablePropertiesForCascade,
393071
+ cellGridPlacements: placements2,
393072
+ numGridCols
392204
393073
  });
392205
393074
  if (parsedRow) {
392206
393075
  if (!shouldHideTrackedNode2(parsedRow.attrs?.trackedChange, parserDeps.trackedChangesConfig)) {
@@ -392331,7 +393200,36 @@ function tableNodeToBlock2(node3, {
392331
393200
  };
392332
393201
  return tableBlock;
392333
393202
  }
392334
- var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode2 = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell2 = (node3) => {
393203
+ var placeRowCellsOnGrid2 = (rowNode, activeRowSpans) => {
393204
+ const placements2 = [];
393205
+ const nextActiveRowSpans = activeRowSpans.map((count) => Math.max(0, count - 1));
393206
+ let column = 0;
393207
+ const cellSpan = (cellNode) => {
393208
+ const colspan = cellNode.attrs?.colspan;
393209
+ if (typeof colspan === "number" && colspan > 0)
393210
+ return colspan;
393211
+ const colwidth = cellNode.attrs?.colwidth;
393212
+ return Array.isArray(colwidth) && colwidth.length > 0 ? colwidth.length : 1;
393213
+ };
393214
+ for (const cellNode of Array.isArray(rowNode.content) ? rowNode.content : []) {
393215
+ if (!isTableCellNode2(cellNode)) {
393216
+ placements2.push(null);
393217
+ continue;
393218
+ }
393219
+ while ((activeRowSpans[column] ?? 0) > 0)
393220
+ column += 1;
393221
+ const span = cellSpan(cellNode);
393222
+ placements2.push({ gridColumnStart: column, gridColumnSpan: span });
393223
+ const rowspan = typeof cellNode.attrs?.rowspan === "number" ? cellNode.attrs.rowspan : 1;
393224
+ if (rowspan > 1) {
393225
+ for (let covered = column;covered < column + span; covered += 1) {
393226
+ nextActiveRowSpans[covered] = Math.max(nextActiveRowSpans[covered] ?? 0, rowspan - 1);
393227
+ }
393228
+ }
393229
+ column += span;
393230
+ }
393231
+ return { placements: placements2, nextActiveRowSpans };
393232
+ }, isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "table_row", isTableCellNode2 = (node3) => node3.type === "tableCell" || node3.type === "table_cell" || node3.type === "tableHeader" || node3.type === "table_header", isTableSkipPlaceholderCell2 = (node3) => {
392335
393233
  const placeholder = node3.attrs?.__placeholder;
392336
393234
  return placeholder === "gridBefore" || placeholder === "gridAfter";
392337
393235
  }, convertResolvedCellBorder2 = (value) => {
@@ -392366,7 +393264,20 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
392366
393264
  const blocks2 = [];
392367
393265
  const rowCnfStyle = args3.rowCnfStyle ?? null;
392368
393266
  const cellCnfStyle = cellNode.attrs?.tableCellProperties?.cnfStyle ?? null;
392369
- const tableInfo = tableProperties ? { tableProperties, rowIndex, cellIndex, numCells, numRows, rowCnfStyle, cellCnfStyle } : undefined;
393267
+ const tableInfo = tableProperties ? {
393268
+ tableProperties,
393269
+ rowIndex,
393270
+ cellIndex,
393271
+ numCells,
393272
+ numRows,
393273
+ rowCnfStyle,
393274
+ cellCnfStyle,
393275
+ ...args3.gridPlacement != null && args3.numGridCols != null ? {
393276
+ gridColumnStart: args3.gridPlacement.gridColumnStart,
393277
+ gridColumnSpan: args3.gridPlacement.gridColumnSpan,
393278
+ numGridCols: args3.numGridCols
393279
+ } : {}
393280
+ } : undefined;
392370
393281
  const inlineTcProps = cellNode.attrs?.tableCellProperties;
392371
393282
  const resolvedTcProps = resolveTableCellProperties2(inlineTcProps, tableInfo, context.converterContext?.translatedLinkedStyles);
392372
393283
  const cellBackground = cellNode.attrs?.background;
@@ -392666,7 +393577,9 @@ var isTableRowNode2 = (node3) => node3.type === "tableRow" || node3.type === "ta
392666
393577
  tableProperties,
392667
393578
  numCells: rowNode?.content?.length || 1,
392668
393579
  numRows,
392669
- rowCnfStyle
393580
+ rowCnfStyle,
393581
+ gridPlacement: args3.cellGridPlacements?.[cellIndex] ?? null,
393582
+ numGridCols: args3.numGridCols
392670
393583
  });
392671
393584
  if (parsedCell) {
392672
393585
  cells.push(parsedCell);