@superdoc-dev/cli 0.8.0-next.28 → 0.8.0-next.29

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 +173 -101
  2. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -159118,7 +159118,7 @@ var init_remark_stringify_6MMJfY0k_es = __esm(() => {
159118
159118
  eol = /\r?\n|\r/g;
159119
159119
  });
159120
159120
 
159121
- // ../../packages/superdoc/dist/chunks/detect-container-CstXTt5n.es.js
159121
+ // ../../packages/superdoc/dist/chunks/detect-container-D4DBxokY.es.js
159122
159122
  function matchesMagic(bytes, magic) {
159123
159123
  if (bytes.length < magic.length)
159124
159124
  return false;
@@ -159136,7 +159136,7 @@ function detectContainerType(data) {
159136
159136
  return "unknown";
159137
159137
  }
159138
159138
  var ZIP_MAGIC, CFB_MAGIC;
159139
- var init_detect_container_CstXTt5n_es = __esm(() => {
159139
+ var init_detect_container_D4DBxokY_es = __esm(() => {
159140
159140
  ZIP_MAGIC = [
159141
159141
  80,
159142
159142
  75,
@@ -159155,18 +159155,18 @@ var init_detect_container_CstXTt5n_es = __esm(() => {
159155
159155
  ];
159156
159156
  });
159157
159157
 
159158
- // ../../packages/superdoc/dist/chunks/detect-container-Mk-wjDRB.es.js
159159
- var exports_detect_container_Mk_wjDRB_es = {};
159160
- __export(exports_detect_container_Mk_wjDRB_es, {
159158
+ // ../../packages/superdoc/dist/chunks/detect-container-C6TWMi8j.es.js
159159
+ var exports_detect_container_C6TWMi8j_es = {};
159160
+ __export(exports_detect_container_C6TWMi8j_es, {
159161
159161
  detectContainerType: () => detectContainerType
159162
159162
  });
159163
- var init_detect_container_Mk_wjDRB_es = __esm(() => {
159164
- init_detect_container_CstXTt5n_es();
159163
+ var init_detect_container_C6TWMi8j_es = __esm(() => {
159164
+ init_detect_container_D4DBxokY_es();
159165
159165
  });
159166
159166
 
159167
- // ../../packages/superdoc/dist/chunks/errors-CtyzHiH4.es.js
159167
+ // ../../packages/superdoc/dist/chunks/errors-C4DO-BsD.es.js
159168
159168
  var EditorError, InvalidStateError, NoSourcePathError, FileSystemNotAvailableError, DocumentLoadError, DocxEncryptionErrorCode, DocxEncryptionError;
159169
- var init_errors_CtyzHiH4_es = __esm(() => {
159169
+ var init_errors_C4DO_BsD_es = __esm(() => {
159170
159170
  EditorError = class extends Error {
159171
159171
  constructor(message) {
159172
159172
  super(message);
@@ -159214,9 +159214,9 @@ var init_errors_CtyzHiH4_es = __esm(() => {
159214
159214
  };
159215
159215
  });
159216
159216
 
159217
- // ../../packages/superdoc/dist/chunks/decrypt-docx-Bs1PbPQR.es.js
159218
- var exports_decrypt_docx_Bs1PbPQR_es = {};
159219
- __export(exports_decrypt_docx_Bs1PbPQR_es, {
159217
+ // ../../packages/superdoc/dist/chunks/decrypt-docx-D8IVL1og.es.js
159218
+ var exports_decrypt_docx_D8IVL1og_es = {};
159219
+ __export(exports_decrypt_docx_D8IVL1og_es, {
159220
159220
  decryptDocxIfNeeded: () => decryptDocxIfNeeded
159221
159221
  });
159222
159222
  function concatUint8Arrays(chunks) {
@@ -159757,10 +159757,10 @@ async function decryptDocxIfNeeded(data, options) {
159757
159757
  };
159758
159758
  }
159759
159759
  var CFB_SIGNATURE, CFB_END_OF_CHAIN = 4294967294, CFB_OBJECT_TYPE, utf16LeDecoder, AGILE_VERSION = 4, AGILE_RESERVED = 4, STANDARD_VERSION_3 = 3, STANDARD_VERSION_4 = 4, STANDARD_RESERVED = 3, MIN_HEADER_SIZE = 8, BLOCK_KEY_VERIFIER_INPUT, BLOCK_KEY_VERIFIER_VALUE, BLOCK_KEY_ENCRYPTED_KEY, BLOCK_KEY_HMAC_KEY, BLOCK_KEY_HMAC_VALUE, SEGMENT_SIZE = 4096, PACKAGE_HEADER_SIZE = 8;
159760
- var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
159760
+ var init_decrypt_docx_D8IVL1og_es = __esm(() => {
159761
159761
  init_dist_B8HfvhaK_es();
159762
- init_errors_CtyzHiH4_es();
159763
- init_detect_container_CstXTt5n_es();
159762
+ init_errors_C4DO_BsD_es();
159763
+ init_detect_container_D4DBxokY_es();
159764
159764
  CFB_SIGNATURE = new Uint8Array([
159765
159765
  208,
159766
159766
  207,
@@ -159829,7 +159829,7 @@ var init_decrypt_docx_Bs1PbPQR_es = __esm(() => {
159829
159829
  ]);
159830
159830
  });
159831
159831
 
159832
- // ../../packages/superdoc/dist/chunks/DocxZipper-CwFyjl1b.es.js
159832
+ // ../../packages/superdoc/dist/chunks/DocxZipper-CQnO0NBY.es.js
159833
159833
  function sniffEncoding(u8) {
159834
159834
  if (u8.length >= 2) {
159835
159835
  const b0 = u8[0], b1 = u8[1];
@@ -160136,11 +160136,11 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
160136
160136
  return new Uint8Array(0);
160137
160137
  }
160138
160138
  async getDocxData(file, isNode3 = false, options = {}) {
160139
- const { detectContainerType: detectContainerType2 } = await Promise.resolve().then(() => (init_detect_container_Mk_wjDRB_es(), exports_detect_container_Mk_wjDRB_es));
160139
+ const { detectContainerType: detectContainerType2 } = await Promise.resolve().then(() => (init_detect_container_C6TWMi8j_es(), exports_detect_container_C6TWMi8j_es));
160140
160140
  const containerType = detectContainerType2(await this.#peekBytes(file, 8));
160141
160141
  let fileData = file;
160142
160142
  if (containerType === "cfb") {
160143
- const { decryptDocxIfNeeded: decryptDocxIfNeeded2 } = await Promise.resolve().then(() => (init_decrypt_docx_Bs1PbPQR_es(), exports_decrypt_docx_Bs1PbPQR_es));
160143
+ const { decryptDocxIfNeeded: decryptDocxIfNeeded2 } = await Promise.resolve().then(() => (init_decrypt_docx_D8IVL1og_es(), exports_decrypt_docx_D8IVL1og_es));
160144
160144
  const result = await decryptDocxIfNeeded2(file instanceof Uint8Array ? file : file instanceof ArrayBuffer ? new Uint8Array(file) : new Uint8Array(await file.arrayBuffer()), { password: options.password });
160145
160145
  fileData = result.data;
160146
160146
  this.decryptedFileData = result.data;
@@ -160480,7 +160480,7 @@ var DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.docum
160480
160480
  return `image/${MIME_TYPE_FOR_EXT[detectedType] || detectedType}`;
160481
160481
  }
160482
160482
  }, DocxZipper_default;
160483
- var init_DocxZipper_CwFyjl1b_es = __esm(() => {
160483
+ var init_DocxZipper_CQnO0NBY_es = __esm(() => {
160484
160484
  init_rolldown_runtime_Bg48TavK_es();
160485
160485
  init_jszip_C49i9kUs_es();
160486
160486
  init_xml_js_CqGKpaft_es();
@@ -160552,9 +160552,9 @@ var __plugin_vue_export_helper_default = (sfc, props) => {
160552
160552
  };
160553
160553
  var init__plugin_vue_export_helper_HmhZBO0u_es = () => {};
160554
160554
 
160555
- // ../../packages/superdoc/dist/chunks/eventemitter3-BdNugZrm.es.js
160555
+ // ../../packages/superdoc/dist/chunks/eventemitter3-FJgkFNGb.es.js
160556
160556
  var import_eventemitter3, eventemitter3_default;
160557
- var init_eventemitter3_BdNugZrm_es = __esm(() => {
160557
+ var init_eventemitter3_FJgkFNGb_es = __esm(() => {
160558
160558
  init_rolldown_runtime_Bg48TavK_es();
160559
160559
  import_eventemitter3 = /* @__PURE__ */ __toESM2((/* @__PURE__ */ __commonJSMin((exports, module) => {
160560
160560
  var has = Object.prototype.hasOwnProperty, prefix = "~";
@@ -160724,8 +160724,8 @@ var init_eventemitter3_BdNugZrm_es = __esm(() => {
160724
160724
  eventemitter3_default = import_eventemitter3.default;
160725
160725
  });
160726
160726
 
160727
- // ../../packages/superdoc/dist/chunks/blank-docx-sI869qur.es.js
160728
- var init_blank_docx_sI869qur_es = () => {};
160727
+ // ../../packages/superdoc/dist/chunks/blank-docx-Co9nWTR1.es.js
160728
+ var init_blank_docx_Co9nWTR1_es = () => {};
160729
160729
 
160730
160730
  // ../../node_modules/.pnpm/@vue+shared@3.5.32/node_modules/@vue/shared/dist/shared.cjs.js
160731
160731
  var require_shared_cjs = __commonJS((exports) => {
@@ -196357,9 +196357,9 @@ var init_unified_vFnLRfAM_es = __esm(() => {
196357
196357
  init_unified_Dsuw2be5_es();
196358
196358
  });
196359
196359
 
196360
- // ../../packages/superdoc/dist/chunks/rehype-parse-Cekwpwes.es.js
196361
- var exports_rehype_parse_Cekwpwes_es = {};
196362
- __export(exports_rehype_parse_Cekwpwes_es, {
196360
+ // ../../packages/superdoc/dist/chunks/rehype-parse-Daj0cUby.es.js
196361
+ var exports_rehype_parse_Daj0cUby_es = {};
196362
+ __export(exports_rehype_parse_Daj0cUby_es, {
196363
196363
  default: () => rehypeParse
196364
196364
  });
196365
196365
  function merge2(definitions, space) {
@@ -202308,7 +202308,7 @@ var Schema2 = class {
202308
202308
  }
202309
202309
  }
202310
202310
  }, TABLE_VOID_ELEMENTS, errors, base3 = "https://html.spec.whatwg.org/multipage/parsing.html#parse-error-", dashToCamelRe, formatCRe, formatXRe, fatalities, emptyOptions3;
202311
- var init_rehype_parse_Cekwpwes_es = __esm(() => {
202311
+ var init_rehype_parse_Daj0cUby_es = __esm(() => {
202312
202312
  init_rolldown_runtime_Bg48TavK_es();
202313
202313
  init_default_BqgWzMfR_es();
202314
202314
  init_lib_CYqLdG4z_es();
@@ -205053,9 +205053,9 @@ var init_rehype_parse_Cekwpwes_es = __esm(() => {
205053
205053
  emptyOptions3 = {};
205054
205054
  });
205055
205055
 
205056
- // ../../packages/superdoc/dist/chunks/rehype-remark-BPIgFSP8.es.js
205057
- var exports_rehype_remark_BPIgFSP8_es = {};
205058
- __export(exports_rehype_remark_BPIgFSP8_es, {
205056
+ // ../../packages/superdoc/dist/chunks/rehype-remark-BHDNk9YW.es.js
205057
+ var exports_rehype_remark_BHDNk9YW_es = {};
205058
+ __export(exports_rehype_remark_BHDNk9YW_es, {
205059
205059
  default: () => rehypeRemark
205060
205060
  });
205061
205061
  function anyFactory2(tests) {
@@ -206675,7 +206675,7 @@ var env, deserializer = ($2, _2) => {
206675
206675
  if (is(parent.children[index2], index2, parent))
206676
206676
  return parent.children[index2];
206677
206677
  }, searchLineFeeds, searchTabOrSpaces, br$1, cell, p$1, row, notRendered, blockOrCaption, prefix = "language-", defaultChecked = "[x]", defaultUnchecked = "[ ]", own$12, list$1, basic, meta, defaultQuotes, nodeHandlers, handlers2, own6, emptyOptions4, defaults;
206678
- var init_rehype_remark_BPIgFSP8_es = __esm(() => {
206678
+ var init_rehype_remark_BHDNk9YW_es = __esm(() => {
206679
206679
  init_lib_DEff_P2k_es();
206680
206680
  env = typeof self === "object" ? self : globalThis;
206681
206681
  ({ toString: toString$1 } = {});
@@ -207051,12 +207051,12 @@ var init_rehype_remark_BPIgFSP8_es = __esm(() => {
207051
207051
  defaults = { document: true };
207052
207052
  });
207053
207053
 
207054
- // ../../packages/superdoc/dist/chunks/remark-stringify-JDwoZEhx.es.js
207055
- var exports_remark_stringify_JDwoZEhx_es = {};
207056
- __export(exports_remark_stringify_JDwoZEhx_es, {
207054
+ // ../../packages/superdoc/dist/chunks/remark-stringify-h8J661QC.es.js
207055
+ var exports_remark_stringify_h8J661QC_es = {};
207056
+ __export(exports_remark_stringify_h8J661QC_es, {
207057
207057
  default: () => remarkStringify
207058
207058
  });
207059
- var init_remark_stringify_JDwoZEhx_es = __esm(() => {
207059
+ var init_remark_stringify_h8J661QC_es = __esm(() => {
207060
207060
  init_remark_stringify_6MMJfY0k_es();
207061
207061
  });
207062
207062
 
@@ -207069,7 +207069,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
207069
207069
  init_remark_gfm_BhnWr3yf_es();
207070
207070
  });
207071
207071
 
207072
- // ../../packages/superdoc/dist/chunks/src-C-2U54wX.es.js
207072
+ // ../../packages/superdoc/dist/chunks/src-BjD8Jue-.es.js
207073
207073
  function deleteProps(obj, propOrProps) {
207074
207074
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
207075
207075
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -256249,11 +256249,14 @@ function layoutDocument(blocks2, measures, options = {}) {
256249
256249
  const newPageNumber = pageCount;
256250
256250
  if (isEnteringNewSection || !sectionFirstPageNumbers.has(activeSectionIndex))
256251
256251
  sectionFirstPageNumbers.set(activeSectionIndex, newPageNumber);
256252
+ const sectionPageNumber = newPageNumber - (sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber) + 1;
256253
+ const titlePgEnabled = sectionMetadataList[activeSectionIndex]?.titlePg ?? false;
256254
+ const alternateHeaders = options.alternateHeaders ?? false;
256252
256255
  const variantType = getVariantTypeForPage({
256253
- sectionPageNumber: newPageNumber - (sectionFirstPageNumbers.get(activeSectionIndex) ?? newPageNumber) + 1,
256256
+ sectionPageNumber,
256254
256257
  documentPageNumber: newPageNumber,
256255
- titlePgEnabled: sectionMetadataList[activeSectionIndex]?.titlePg ?? false,
256256
- alternateHeaders: options.alternateHeaders ?? false
256258
+ titlePgEnabled,
256259
+ alternateHeaders
256257
256260
  });
256258
256261
  let headerRef = activeSectionRefs?.headerRefs?.[variantType];
256259
256262
  let footerRef = activeSectionRefs?.footerRefs?.[variantType];
@@ -256272,12 +256275,16 @@ function layoutDocument(blocks2, measures, options = {}) {
256272
256275
  layoutLog(`[Layout] Page ${newPageNumber}: Inheriting footer '${variantType}' from section ${activeSectionIndex - 1}: ${footerRef}`);
256273
256276
  }
256274
256277
  }
256275
- if (!headerRef && variantType !== "default" && activeSectionRefs?.headerRefs?.default) {
256276
- headerRef = activeSectionRefs.headerRefs.default;
256278
+ const defaultHeaderRef = activeSectionRefs?.headerRefs?.default;
256279
+ const defaultFooterRef = activeSectionRefs?.footerRefs?.default;
256280
+ const shouldUseDefaultHeaderRef = variantType !== "default" && defaultHeaderRef && (!alternateHeaders || variantType === "odd");
256281
+ const shouldUseDefaultFooterRef = variantType !== "default" && defaultFooterRef && (!alternateHeaders || variantType === "odd");
256282
+ if (!headerRef && shouldUseDefaultHeaderRef) {
256283
+ headerRef = defaultHeaderRef;
256277
256284
  effectiveVariantType = "default";
256278
256285
  }
256279
- if (!footerRef && variantType !== "default" && activeSectionRefs?.footerRefs?.default)
256280
- footerRef = activeSectionRefs.footerRefs.default;
256286
+ if (!footerRef && shouldUseDefaultFooterRef)
256287
+ footerRef = defaultFooterRef;
256281
256288
  const headerHeight = getHeaderHeightForPage(effectiveVariantType, headerRef, activeSectionIndex);
256282
256289
  const footerHeight = getFooterHeightForPage(variantType !== "default" && !activeSectionRefs?.footerRefs?.[variantType] ? "default" : variantType, footerRef, activeSectionIndex);
256283
256290
  activeTopMargin = calculateEffectiveTopMargin(headerHeight, activeHeaderDistance, activeSectionBaseTopMargin);
@@ -257540,17 +257547,28 @@ function getHeaderFooterTypeForSection(pageNumber, sectionIndex, identifier, opt
257540
257547
  const hasEven = Boolean(ids.even);
257541
257548
  const hasOdd = Boolean(ids.odd);
257542
257549
  const hasDefault = Boolean(ids.default);
257550
+ const legacyIds = kind === "header" ? identifier.headerIds : identifier.footerIds;
257551
+ let hasAny = hasFirst || hasEven || hasOdd || hasDefault;
257552
+ if (!hasAny)
257553
+ for (let index2 = sectionIndex - 1;index2 >= 0; index2 -= 1) {
257554
+ const inheritedIds = kind === "header" ? identifier.sectionHeaderIds.get(index2) : identifier.sectionFooterIds.get(index2);
257555
+ if (inheritedIds?.first || inheritedIds?.even || inheritedIds?.odd || inheritedIds?.default) {
257556
+ hasAny = true;
257557
+ break;
257558
+ }
257559
+ }
257560
+ if (!hasAny)
257561
+ hasAny = Boolean(legacyIds.first || legacyIds.even || legacyIds.odd || legacyIds.default);
257543
257562
  const titlePgEnabled = (identifier.sectionTitlePg.has(sectionIndex) ? identifier.sectionTitlePg.get(sectionIndex) : identifier.titlePg) === true;
257544
257563
  if (sectionPageNumber === 1 && titlePgEnabled) {
257545
- if (hasFirst || hasDefault || hasEven || hasOdd)
257564
+ if (hasAny)
257546
257565
  return "first";
257547
257566
  return null;
257548
257567
  }
257549
257568
  if (identifier.alternateHeaders) {
257550
- if (pageNumber % 2 === 0 && (hasEven || hasDefault))
257551
- return hasEven ? "even" : "default";
257552
- if (pageNumber % 2 === 1 && (hasOdd || hasDefault))
257553
- return hasOdd ? "odd" : "default";
257569
+ if (!hasAny)
257570
+ return null;
257571
+ return pageNumber % 2 === 0 ? "even" : "odd";
257554
257572
  }
257555
257573
  if (hasDefault)
257556
257574
  return "default";
@@ -259208,22 +259226,8 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
259208
259226
  reservesStabilized = true;
259209
259227
  break;
259210
259228
  }
259211
- const nextKey = nextReserves.join(",");
259212
- if (seenReserveVectors.some((v) => v.join(",") === nextKey)) {
259213
- const allVectors = [...seenReserveVectors, nextReserves];
259214
- const mergedLength = Math.max(...allVectors.map((v) => v.length));
259215
- const merged = new Array(mergedLength).fill(0);
259216
- for (const vec of allVectors)
259217
- for (let i4 = 0;i4 < mergedLength; i4 += 1)
259218
- if ((vec[i4] ?? 0) > merged[i4])
259219
- merged[i4] = vec[i4];
259220
- reserves = merged;
259221
- layout = relayout(reserves);
259222
- ({ columns: pageColumns, idsByColumn } = resolveFootnoteAssignments(layout));
259223
- ({ measuresById } = await measureFootnoteBlocks(collectFootnoteIdsByColumn(idsByColumn)));
259224
- plan = computeFootnoteLayoutPlan(layout, idsByColumn, measuresById, reserves, pageColumns);
259229
+ if (seenReserveVectors.some((v) => v.join(",") === nextReserves.join(",")))
259225
259230
  break;
259226
- }
259227
259231
  seenReserveVectors.push(nextReserves.slice());
259228
259232
  if (pass < MAX_FOOTNOTE_LAYOUT_PASSES - 1)
259229
259233
  reserves = nextReserves;
@@ -259234,27 +259238,84 @@ async function incrementalLayout(previousBlocks, _previousLayout, nextBlocks, op
259234
259238
  let { blocks: finalBlocks, measuresById: finalMeasuresById } = await measureFootnoteBlocks(collectFootnoteIdsByColumn(finalIdsByColumn));
259235
259239
  let finalPlan = computeFootnoteLayoutPlan(layout, finalIdsByColumn, finalMeasuresById, reserves, finalPageColumns);
259236
259240
  let reservesAppliedToLayout = reserves;
259237
- const MAX_POST_PASSES = 3;
259238
- for (let postPass = 0;postPass < MAX_POST_PASSES; postPass += 1) {
259239
- const target = reservesAppliedToLayout.slice();
259240
- const planReserves = finalPlan.reserves;
259241
- const len3 = Math.max(target.length, planReserves.length);
259242
- let needsRelayout = false;
259243
- for (let i4 = 0;i4 < len3; i4 += 1) {
259244
- const applied = target[i4] ?? 0;
259245
- const needed = planReserves[i4] ?? 0;
259246
- if (needed > applied) {
259247
- target[i4] = needed;
259248
- needsRelayout = true;
259249
- }
259250
- }
259251
- if (!needsRelayout)
259252
- break;
259241
+ const vectorsEqual = (a2, b$1) => {
259242
+ for (let i4 = 0;i4 < Math.max(a2.length, b$1.length); i4 += 1)
259243
+ if ((a2[i4] ?? 0) !== (b$1[i4] ?? 0))
259244
+ return false;
259245
+ return true;
259246
+ };
259247
+ const applyReserves = async (target) => {
259253
259248
  layout = relayout(target);
259254
259249
  reservesAppliedToLayout = target;
259255
259250
  ({ columns: finalPageColumns, idsByColumn: finalIdsByColumn } = resolveFootnoteAssignments(layout));
259256
259251
  ({ blocks: finalBlocks, measuresById: finalMeasuresById } = await measureFootnoteBlocks(collectFootnoteIdsByColumn(finalIdsByColumn)));
259257
259252
  finalPlan = computeFootnoteLayoutPlan(layout, finalIdsByColumn, finalMeasuresById, reservesAppliedToLayout, finalPageColumns);
259253
+ };
259254
+ const growReserves = async (maxPasses) => {
259255
+ const seen = [reservesAppliedToLayout.slice()];
259256
+ for (let pass = 0;pass < maxPasses; pass += 1) {
259257
+ const target = reservesAppliedToLayout.slice();
259258
+ const plan$1 = finalPlan.reserves;
259259
+ let grew = false;
259260
+ for (let i4 = 0;i4 < Math.max(target.length, plan$1.length); i4 += 1)
259261
+ if ((plan$1[i4] ?? 0) > (target[i4] ?? 0)) {
259262
+ target[i4] = plan$1[i4];
259263
+ grew = true;
259264
+ }
259265
+ if (!grew)
259266
+ return true;
259267
+ let next2 = target;
259268
+ if (seen.some((prev) => vectorsEqual(prev, target))) {
259269
+ const last2 = seen[seen.length - 1];
259270
+ next2 = target.map((v, i4) => Math.max(v, last2[i4] ?? 0));
259271
+ if (vectorsEqual(next2, reservesAppliedToLayout))
259272
+ return true;
259273
+ }
259274
+ await applyReserves(next2);
259275
+ seen.push(next2);
259276
+ }
259277
+ return false;
259278
+ };
259279
+ const TIGHTEN_SLACK_PX = 8;
259280
+ if ((() => {
259281
+ const plan$1 = finalPlan.reserves;
259282
+ const applied = reservesAppliedToLayout;
259283
+ const len3 = Math.max(plan$1.length, applied.length);
259284
+ for (let i4 = 0;i4 < len3; i4 += 1) {
259285
+ const a2 = applied[i4] ?? 0;
259286
+ const p$12 = plan$1[i4] ?? 0;
259287
+ if (p$12 > a2)
259288
+ return true;
259289
+ if (a2 >= TIGHTEN_SLACK_PX && p$12 === 0)
259290
+ return true;
259291
+ }
259292
+ return false;
259293
+ })()) {
259294
+ const GROW_MAX_PASSES = 10;
259295
+ if (!await growReserves(GROW_MAX_PASSES))
259296
+ console.warn("[incrementalLayout] Footnote post-reserve loop did not converge; some pages may have footnotes overflowing the reserved band.");
259297
+ const MAX_TIGHTEN_ITERATIONS = 8;
259298
+ for (let iteration$1 = 0;iteration$1 < MAX_TIGHTEN_ITERATIONS; iteration$1 += 1) {
259299
+ const pagesToTighten = [];
259300
+ for (let i4 = 0;i4 < reservesAppliedToLayout.length; i4 += 1) {
259301
+ const applied = reservesAppliedToLayout[i4] ?? 0;
259302
+ const planned = finalPlan.reserves[i4] ?? 0;
259303
+ if (applied >= TIGHTEN_SLACK_PX && planned === 0)
259304
+ pagesToTighten.push(i4);
259305
+ }
259306
+ if (pagesToTighten.length === 0)
259307
+ break;
259308
+ const safeApplied = reservesAppliedToLayout.slice();
259309
+ const safePageCount = layout.pages.length;
259310
+ const tightened = reservesAppliedToLayout.slice();
259311
+ for (const i4 of pagesToTighten)
259312
+ tightened[i4] = 0;
259313
+ await applyReserves(tightened);
259314
+ if (!await growReserves(GROW_MAX_PASSES) || layout.pages.length > safePageCount) {
259315
+ await applyReserves(safeApplied);
259316
+ break;
259317
+ }
259318
+ }
259258
259319
  }
259259
259320
  const blockById = /* @__PURE__ */ new Map;
259260
259321
  finalBlocks.forEach((block) => {
@@ -277852,7 +277913,7 @@ var Node$13 = class Node$14 {
277852
277913
  PassthroughBlock,
277853
277914
  Diffing
277854
277915
  ];
277855
- }, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS, sanitizeNumber = (value, defaultNumber) => {
277916
+ }, sanitizeNumber = (value, defaultNumber) => {
277856
277917
  let sanitized = value.replace(/[^0-9.]/g, "");
277857
277918
  sanitized = parseFloat(sanitized);
277858
277919
  if (isNaN(sanitized))
@@ -287621,10 +287682,11 @@ menclose::after {
287621
287682
  if (pageNumber === 1 && titlePgEnabled)
287622
287683
  return "first";
287623
287684
  if (identifier.alternateHeaders) {
287624
- if (pageNumber % 2 === 0 && (hasEven || hasDefault))
287625
- return hasEven ? "even" : "default";
287685
+ if (pageNumber % 2 === 0 && hasEven)
287686
+ return "even";
287626
287687
  if (pageNumber % 2 === 1 && (hasOdd || hasDefault))
287627
287688
  return hasOdd ? "odd" : "default";
287689
+ return null;
287628
287690
  }
287629
287691
  if (hasDefault)
287630
287692
  return "default";
@@ -295837,13 +295899,15 @@ menclose::after {
295837
295899
  sectionRId = page.sectionRefs.headerRefs?.[headerFooterType];
295838
295900
  if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId)
295839
295901
  sectionRId = multiSectionId.sectionHeaderIds.get(sectionIndex - 1)?.[headerFooterType] ?? undefined;
295840
- if (!sectionRId && headerFooterType !== "default")
295902
+ const shouldUseDefaultHeaderRef = headerFooterType !== "default" && page.sectionRefs.headerRefs?.default && (!multiSectionId?.alternateHeaders || headerFooterType === "odd");
295903
+ if (!sectionRId && shouldUseDefaultHeaderRef)
295841
295904
  sectionRId = page.sectionRefs.headerRefs?.default;
295842
295905
  } else if (page?.sectionRefs && kind === "footer") {
295843
295906
  sectionRId = page.sectionRefs.footerRefs?.[headerFooterType];
295844
295907
  if (!sectionRId && headerFooterType && headerFooterType !== "default" && sectionIndex > 0 && multiSectionId)
295845
295908
  sectionRId = multiSectionId.sectionFooterIds.get(sectionIndex - 1)?.[headerFooterType] ?? undefined;
295846
- if (!sectionRId && headerFooterType !== "default")
295909
+ const shouldUseDefaultFooterRef = headerFooterType !== "default" && page.sectionRefs.footerRefs?.default && (!multiSectionId?.alternateHeaders || headerFooterType === "odd");
295910
+ if (!sectionRId && shouldUseDefaultFooterRef)
295847
295911
  sectionRId = page.sectionRefs.footerRefs?.default;
295848
295912
  }
295849
295913
  if (!headerFooterType)
@@ -296188,7 +296252,7 @@ menclose::after {
296188
296252
  return;
296189
296253
  console.log(...args$1);
296190
296254
  }, 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;
296191
- var init_src_C_2U54wX_es = __esm(() => {
296255
+ var init_src_BjD8Jue_es = __esm(() => {
296192
296256
  init_rolldown_runtime_Bg48TavK_es();
296193
296257
  init_SuperConverter_4akUYfWt_es();
296194
296258
  init_jszip_C49i9kUs_es();
@@ -296199,11 +296263,11 @@ var init_src_C_2U54wX_es = __esm(() => {
296199
296263
  init_unified_Dsuw2be5_es();
296200
296264
  init_remark_gfm_BhnWr3yf_es();
296201
296265
  init_remark_stringify_6MMJfY0k_es();
296202
- init_DocxZipper_CwFyjl1b_es();
296266
+ init_DocxZipper_CQnO0NBY_es();
296203
296267
  init__plugin_vue_export_helper_HmhZBO0u_es();
296204
- init_eventemitter3_BdNugZrm_es();
296205
- init_errors_CtyzHiH4_es();
296206
- init_blank_docx_sI869qur_es();
296268
+ init_eventemitter3_FJgkFNGb_es();
296269
+ init_errors_C4DO_BsD_es();
296270
+ init_blank_docx_Co9nWTR1_es();
296207
296271
  init_yjs();
296208
296272
  init_yjs();
296209
296273
  init_vue();
@@ -314550,8 +314614,6 @@ function print() { __p += __j.call(arguments, '') }
314550
314614
  };
314551
314615
  }
314552
314616
  });
314553
- ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
314554
- EMPTY_ACTIVE_IDS = Object.freeze([]);
314555
314617
  formatRegistry = { rules: [
314556
314618
  {
314557
314619
  name: "bold",
@@ -321264,9 +321326,9 @@ function print() { __p += __j.call(arguments, '') }
321264
321326
  try {
321265
321327
  const [{ unified: unified$1 }, { default: rehypeParse2 }, { default: rehypeRemark2 }, { default: remarkStringify$1 }, { default: remarkGfm$1 }] = await Promise.all([
321266
321328
  Promise.resolve().then(() => (init_unified_vFnLRfAM_es(), exports_unified_vFnLRfAM_es)),
321267
- Promise.resolve().then(() => (init_rehype_parse_Cekwpwes_es(), exports_rehype_parse_Cekwpwes_es)),
321268
- Promise.resolve().then(() => (init_rehype_remark_BPIgFSP8_es(), exports_rehype_remark_BPIgFSP8_es)),
321269
- Promise.resolve().then(() => (init_remark_stringify_JDwoZEhx_es(), exports_remark_stringify_JDwoZEhx_es)),
321329
+ Promise.resolve().then(() => (init_rehype_parse_Daj0cUby_es(), exports_rehype_parse_Daj0cUby_es)),
321330
+ Promise.resolve().then(() => (init_rehype_remark_BHDNk9YW_es(), exports_rehype_remark_BHDNk9YW_es)),
321331
+ Promise.resolve().then(() => (init_remark_stringify_h8J661QC_es(), exports_remark_stringify_h8J661QC_es)),
321270
321332
  Promise.resolve().then(() => (init_remark_gfm_eZN6yzWQ_es(), exports_remark_gfm_eZN6yzWQ_es))
321271
321333
  ]);
321272
321334
  const html3 = this.getHTML();
@@ -333119,9 +333181,18 @@ function print() { __p += __j.call(arguments, '') }
333119
333181
  ];
333120
333182
  });
333121
333183
 
333122
- // ../../packages/superdoc/dist/chunks/zipper-DbkgrypV.es.js
333184
+ // ../../packages/superdoc/dist/chunks/ui-BjrA5C4O.es.js
333185
+ var ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
333186
+ var init_ui_BjrA5C4O_es = __esm(() => {
333187
+ init_SuperConverter_4akUYfWt_es();
333188
+ init_create_headless_toolbar_DeNFsEHx_es();
333189
+ ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
333190
+ EMPTY_ACTIVE_IDS = Object.freeze([]);
333191
+ });
333192
+
333193
+ // ../../packages/superdoc/dist/chunks/zipper-CSxGBanD.es.js
333123
333194
  var import_jszip_min2;
333124
- var init_zipper_DbkgrypV_es = __esm(() => {
333195
+ var init_zipper_CSxGBanD_es = __esm(() => {
333125
333196
  init_rolldown_runtime_Bg48TavK_es();
333126
333197
  init_jszip_C49i9kUs_es();
333127
333198
  import_jszip_min2 = /* @__PURE__ */ __toESM2(require_jszip_min(), 1);
@@ -333129,7 +333200,7 @@ var init_zipper_DbkgrypV_es = __esm(() => {
333129
333200
 
333130
333201
  // ../../packages/superdoc/dist/super-editor.es.js
333131
333202
  var init_super_editor_es = __esm(() => {
333132
- init_src_C_2U54wX_es();
333203
+ init_src_BjD8Jue_es();
333133
333204
  init_SuperConverter_4akUYfWt_es();
333134
333205
  init_jszip_C49i9kUs_es();
333135
333206
  init_xml_js_CqGKpaft_es();
@@ -333137,10 +333208,11 @@ var init_super_editor_es = __esm(() => {
333137
333208
  init_constants_DrU4EASo_es();
333138
333209
  init_dist_B8HfvhaK_es();
333139
333210
  init_unified_Dsuw2be5_es();
333140
- init_DocxZipper_CwFyjl1b_es();
333141
- init_eventemitter3_BdNugZrm_es();
333142
- init_errors_CtyzHiH4_es();
333143
- init_zipper_DbkgrypV_es();
333211
+ init_DocxZipper_CQnO0NBY_es();
333212
+ init_ui_BjrA5C4O_es();
333213
+ init_eventemitter3_FJgkFNGb_es();
333214
+ init_errors_C4DO_BsD_es();
333215
+ init_zipper_CSxGBanD_es();
333144
333216
  });
333145
333217
 
333146
333218
  // ../../node_modules/.pnpm/happy-dom@20.4.0/node_modules/happy-dom/lib/PropertySymbol.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.8.0-next.28",
3
+ "version": "0.8.0-next.29",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -26,19 +26,19 @@
26
26
  "typescript": "^5.9.2",
27
27
  "@superdoc/document-api": "0.0.1",
28
28
  "@superdoc/pm-adapter": "0.0.0",
29
- "superdoc": "1.29.0",
30
- "@superdoc/super-editor": "0.0.1"
29
+ "@superdoc/super-editor": "0.0.1",
30
+ "superdoc": "1.29.0"
31
31
  },
32
32
  "module": "src/index.ts",
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.28",
38
- "@superdoc-dev/cli-linux-x64": "0.8.0-next.28",
39
- "@superdoc-dev/cli-darwin-x64": "0.8.0-next.28",
40
- "@superdoc-dev/cli-windows-x64": "0.8.0-next.28",
41
- "@superdoc-dev/cli-linux-arm64": "0.8.0-next.28"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.8.0-next.29",
38
+ "@superdoc-dev/cli-darwin-x64": "0.8.0-next.29",
39
+ "@superdoc-dev/cli-linux-x64": "0.8.0-next.29",
40
+ "@superdoc-dev/cli-linux-arm64": "0.8.0-next.29",
41
+ "@superdoc-dev/cli-windows-x64": "0.8.0-next.29"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",