@office-open/xlsx 0.12.3 → 0.13.1

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.
package/dist/index.mjs CHANGED
@@ -2042,7 +2042,7 @@ const worksheetDesc = {
2042
2042
  if (attr(pageSetUpPr, "autoPageBreaks") !== void 0) psup.autoPageBreaks = parseOnOff(attr(pageSetUpPr, "autoPageBreaks")) ?? true;
2043
2043
  if (Object.keys(psup).length > 0) pageSetUpPrCache = psup;
2044
2044
  }
2045
- if (Object.keys(sp).length > 0) result.sheetPr = sp;
2045
+ if (Object.keys(sp).length > 0) result.properties = sp;
2046
2046
  const tabColorEl = findChild(sheetPrEl, "tabColor");
2047
2047
  if (tabColorEl) {
2048
2048
  const tc = {};
@@ -2164,7 +2164,7 @@ const worksheetDesc = {
2164
2164
  if (olr !== void 0) sfp.outlineLevelRow = olr;
2165
2165
  const olc = attrNum(sfpEl, "outlineLevelCol");
2166
2166
  if (olc !== void 0) sfp.outlineLevelCol = olc;
2167
- result.sheetFormatPr = sfp;
2167
+ result.sheetFormat = sfp;
2168
2168
  }
2169
2169
  const dimensionEl = findChild(el, "dimension");
2170
2170
  if (dimensionEl) {
@@ -2447,13 +2447,13 @@ const worksheetDesc = {
2447
2447
  if (ppType) pp.type = ppType;
2448
2448
  const ppAlign = attr(ppEl, "alignment");
2449
2449
  if (ppAlign) pp.alignment = ppAlign;
2450
- result.phoneticPr = pp;
2450
+ result.phonetic = pp;
2451
2451
  }
2452
2452
  const scEl = findChild(el, "sheetCalcPr");
2453
2453
  if (scEl) {
2454
2454
  const sc = {};
2455
2455
  if (parseOnOff(attr(scEl, "fullCalcOnLoad"))) sc.fullCalcOnLoad = true;
2456
- result.sheetCalcPr = sc;
2456
+ result.calculation = sc;
2457
2457
  }
2458
2458
  const sheetDataEl = findChild(el, "sheetData");
2459
2459
  if (sheetDataEl) {
@@ -2698,7 +2698,7 @@ const worksheetDesc = {
2698
2698
  const anchor = readEmbeddedAnchor(anchorEl);
2699
2699
  if (anchor) opr.anchor = anchor;
2700
2700
  }
2701
- if (Object.keys(opr).length > 0) oo.objectPr = opr;
2701
+ if (Object.keys(opr).length > 0) oo.properties = opr;
2702
2702
  }
2703
2703
  oleObjects.push(oo);
2704
2704
  }
@@ -3639,7 +3639,7 @@ function stringifyWorksheet(opts, ctx) {
3639
3639
  const p = ["<worksheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" mc:Ignorable=\"x14ac xr xr2 xr3\" xmlns:x14ac=\"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac\" xmlns:xr=\"http://schemas.microsoft.com/office/spreadsheetml/2014/revision\" xmlns:xr2=\"http://schemas.microsoft.com/office/spreadsheetml/2015/revision2\" xmlns:xr3=\"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3\">"];
3640
3640
  const hasTabColor = !!opts.tabColor;
3641
3641
  const hasOutline = columns.some((c) => c.outlineLevel !== void 0);
3642
- const sp = opts.sheetPr;
3642
+ const sp = opts.properties;
3643
3643
  const hasSheetPrAttrs = sp && (sp.codeName || sp.syncHorizontal || sp.syncVertical || sp.syncRef || sp.transitionEvaluation || sp.transitionEntry || sp.published !== void 0 || sp.filterMode || sp.enableFormatConditionsCalculation !== void 0);
3644
3644
  const hasPageSetUpPr = !!opts.pageSetup?.fitToWidth || !!opts.pageSetup?.fitToHeight || opts.pageSetup?.fitToPage !== void 0 || opts.pageSetup?.autoPageBreaks !== void 0;
3645
3645
  if (hasTabColor || hasOutline || hasSheetPrAttrs || hasPageSetUpPr) {
@@ -3709,8 +3709,8 @@ function stringifyWorksheet(opts, ctx) {
3709
3709
  if (innerXml) p.push(`<sheetViews><sheetView${svAttrs}>${innerXml}</sheetView></sheetViews>`);
3710
3710
  else p.push(`<sheetViews><sheetView${svAttrs}/></sheetViews>`);
3711
3711
  }
3712
- if (opts.sheetFormatPr) {
3713
- const sfp = opts.sheetFormatPr;
3712
+ if (opts.sheetFormat) {
3713
+ const sfp = opts.sheetFormat;
3714
3714
  const sfpAttrs = {};
3715
3715
  if (sfp.baseColWidth !== void 0) sfpAttrs.baseColWidth = sfp.baseColWidth;
3716
3716
  if (sfp.defaultColWidth !== void 0) sfpAttrs.defaultColWidth = sfp.defaultColWidth;
@@ -3746,9 +3746,9 @@ function stringifyWorksheet(opts, ctx) {
3746
3746
  p.push("<sheetData>");
3747
3747
  appendSheetDataRows(rows, p, sharedStrings, styles);
3748
3748
  p.push("</sheetData>");
3749
- if (opts.sheetCalcPr) {
3749
+ if (opts.calculation) {
3750
3750
  const scAttrs = [];
3751
- if (opts.sheetCalcPr.fullCalcOnLoad) scAttrs.push("fullCalcOnLoad=\"1\"");
3751
+ if (opts.calculation.fullCalcOnLoad) scAttrs.push("fullCalcOnLoad=\"1\"");
3752
3752
  p.push(`<sheetCalcPr${scAttrs.length ? " " + scAttrs.join(" ") : ""}/>`);
3753
3753
  }
3754
3754
  if (opts.protection) p.push(stringifySheetProtectionXml(opts.protection));
@@ -3847,8 +3847,8 @@ function stringifyWorksheet(opts, ctx) {
3847
3847
  for (const mc of mergeCells) p.push(selfCloseElement("mergeCell", attrs({ ref: mc.ref })));
3848
3848
  p.push("</mergeCells>");
3849
3849
  }
3850
- if (opts.phoneticPr) {
3851
- const pp = opts.phoneticPr;
3850
+ if (opts.phonetic) {
3851
+ const pp = opts.phonetic;
3852
3852
  const ppAttrs = { fontId: pp.fontId };
3853
3853
  if (pp.type && pp.type !== "fullwidthKatakana") ppAttrs.type = pp.type;
3854
3854
  if (pp.alignment && pp.alignment !== "left") ppAttrs.alignment = pp.alignment;
@@ -4078,8 +4078,8 @@ function stringifyWorksheet(opts, ctx) {
4078
4078
  if (ole.autoLoad) oleAttrs.push("autoLoad=\"1\"");
4079
4079
  if (ole.rId) oleAttrs.push(`r:id="${escapeXml(ole.rId)}"`);
4080
4080
  let innerXml;
4081
- if (ole.objectPr) {
4082
- const opr = ole.objectPr;
4081
+ if (ole.properties) {
4082
+ const opr = ole.properties;
4083
4083
  const oprAttrs = [];
4084
4084
  if (opr.locked === false) oprAttrs.push("locked=\"0\"");
4085
4085
  if (opr.defaultSize === false) oprAttrs.push("defaultSize=\"0\"");
@@ -4711,7 +4711,7 @@ const commentsDesc = {
4711
4711
  author: authors[authorId] ?? "",
4712
4712
  text
4713
4713
  };
4714
- if (commentPrEl) comment.commentPr = parseCommentPr(commentPrEl);
4714
+ if (commentPrEl) comment.properties = parseCommentPr(commentPrEl);
4715
4715
  comments.push(comment);
4716
4716
  }
4717
4717
  return { comments };
@@ -5105,7 +5105,7 @@ function parseImageAnchor(anchor, pic, name, ctx) {
5105
5105
  if (srcRect) result.sourceRectangle = sourceRectangleDesc.parse(srcRect, ctx);
5106
5106
  const spPrEl = findXdr(pic, "spPr");
5107
5107
  if (spPrEl) {
5108
- result.spPr = shapePropertiesDesc.parse(spPrEl, ctx);
5108
+ result.properties = shapePropertiesDesc.parse(spPrEl, ctx);
5109
5109
  const bwMode = spPrEl.attributes?.["bwMode"];
5110
5110
  if (bwMode !== void 0) result.blackWhiteMode = bwMode;
5111
5111
  }
@@ -5189,7 +5189,7 @@ function parseShapeAnchor(anchor, sp, name, ctx) {
5189
5189
  const result = {
5190
5190
  col: 1,
5191
5191
  row: 1,
5192
- spPr: {}
5192
+ properties: {}
5193
5193
  };
5194
5194
  readAnchorFields(anchor, name, result);
5195
5195
  Object.assign(result, readCNvPr(sp, "nvSpPr", ctx));
@@ -5199,7 +5199,7 @@ function parseShapeAnchor(anchor, sp, name, ctx) {
5199
5199
  const spLocks = cNvSpPr ? findChild(cNvSpPr, "a:spLocks") : void 0;
5200
5200
  if (spLocks) result.locking = shapeLockingDesc.parse(spLocks, ctx);
5201
5201
  const spPr = findXdr(sp, "spPr");
5202
- if (spPr) result.spPr = shapePropertiesDesc.parse(spPr, ctx);
5202
+ if (spPr) result.properties = shapePropertiesDesc.parse(spPr, ctx);
5203
5203
  const styleEl = findXdr(sp, "style");
5204
5204
  if (styleEl) {
5205
5205
  const style = parseShapeStyle(styleEl, ctx);
@@ -5237,12 +5237,12 @@ function parseConnectorAnchor(anchor, cxnSp, name, ctx) {
5237
5237
  const result = {
5238
5238
  col: 1,
5239
5239
  row: 1,
5240
- spPr: {}
5240
+ properties: {}
5241
5241
  };
5242
5242
  readAnchorFields(anchor, name, result);
5243
5243
  Object.assign(result, readCNvPr(cxnSp, "nvCxnSpPr", ctx));
5244
5244
  const spPr = findXdr(cxnSp, "spPr");
5245
- if (spPr) result.spPr = shapePropertiesDesc.parse(spPr, ctx);
5245
+ if (spPr) result.properties = shapePropertiesDesc.parse(spPr, ctx);
5246
5246
  if (cxnSp.attributes?.["macro"] !== void 0) result.macro = String(cxnSp.attributes["macro"]);
5247
5247
  readConnectorNonVisual(result, cxnSp, ctx);
5248
5248
  const topConnStyle = findXdr(cxnSp, "style");
@@ -5256,19 +5256,19 @@ function parseGroupAnchor(anchor, grpSp, name, ctx) {
5256
5256
  const result = {
5257
5257
  col: 1,
5258
5258
  row: 1,
5259
- grpSpPr: {}
5259
+ properties: {}
5260
5260
  };
5261
5261
  readAnchorFields(anchor, name, result);
5262
5262
  Object.assign(result, readCNvPr(grpSp, "nvGrpSpPr", ctx));
5263
5263
  const grpSpPrEl = findXdr(grpSp, "grpSpPr");
5264
- if (grpSpPrEl) result.grpSpPr = groupShapePropertiesDesc.parse(grpSpPrEl, ctx);
5264
+ if (grpSpPrEl) result.properties = groupShapePropertiesDesc.parse(grpSpPrEl, ctx);
5265
5265
  const shapes = [];
5266
5266
  const childConnectors = [];
5267
5267
  for (const child of grpSp.elements ?? []) {
5268
5268
  const local = child.name?.startsWith("xdr:") ? child.name.slice(4) : child.name;
5269
5269
  if (local === "sp") {
5270
5270
  const spPr = findXdr(child, "spPr");
5271
- const childShape = { spPr: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
5271
+ const childShape = { properties: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
5272
5272
  Object.assign(childShape, readCNvPr(child, "nvSpPr", ctx));
5273
5273
  const childNvSpPr = findXdr(child, "nvSpPr");
5274
5274
  const childCnVSpPr = childNvSpPr ? findXdr(childNvSpPr, "cNvSpPr") : void 0;
@@ -5287,7 +5287,7 @@ function parseGroupAnchor(anchor, grpSp, name, ctx) {
5287
5287
  shapes.push(childShape);
5288
5288
  } else if (local === "cxnSp") {
5289
5289
  const spPr = findXdr(child, "spPr");
5290
- const childConn = { spPr: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
5290
+ const childConn = { properties: spPr ? shapePropertiesDesc.parse(spPr, ctx) : {} };
5291
5291
  Object.assign(childConn, readCNvPr(child, "nvCxnSpPr", ctx));
5292
5292
  if (child.attributes?.["macro"] !== void 0) childConn.macro = String(child.attributes["macro"]);
5293
5293
  readConnectorNonVisual(childConn, child, ctx);
@@ -5348,7 +5348,7 @@ function wrapAnchor(opts, inner) {
5348
5348
  return `<xdr:twoCellAnchor${opts.editAs === void 0 ? "" : ` editAs="${opts.editAs}"`}><xdr:from>${from}</xdr:from><xdr:to>${markerXml(opts.toCol ?? opts.col + 1, opts.toColOffset ?? 0, opts.toRow ?? opts.row + 1, opts.toRowOffset ?? 0)}</xdr:to>${inner}</xdr:twoCellAnchor>`;
5349
5349
  }
5350
5350
  function picXml(img, id, cx, cy, ctx) {
5351
- const spPr = (img.spPr ? shapePropertiesDesc.stringify(img.spPr, ctx) : shapePropertiesDesc.stringify({
5351
+ const spPr = (img.properties ? shapePropertiesDesc.stringify(img.properties, ctx) : shapePropertiesDesc.stringify({
5352
5352
  x: 0,
5353
5353
  y: 0,
5354
5354
  width: cx,
@@ -5447,25 +5447,25 @@ function buildConnectorContent(cNvPr, id, fallbackName, spPr, ctx, attrs = "", c
5447
5447
  return `<xdr:cxnSp${attrs}><xdr:nvCxnSpPr>${stringifyNonVisualDrawingProperties("xdr:cNvPr", id, cNvPr, fallbackName, hlinkClickXml(cNvPr?.hyperlink, ctx))}${cNvCxnSpPr}</xdr:nvCxnSpPr><xdr:spPr>${spPrXml}</xdr:spPr>${styleXml}</xdr:cxnSp>`;
5448
5448
  }
5449
5449
  function stringifyShape(shape, id, ctx) {
5450
- return wrapAnchor(shape, `${buildShapeContent(shape, id, `Shape ${id}`, shape.spPr, shape.textBody, ctx, macroTextlinkAttrs(shape), shape.style)}${clientDataXml(shape)}`);
5450
+ return wrapAnchor(shape, `${buildShapeContent(shape, id, `Shape ${id}`, shape.properties, shape.textBody, ctx, macroTextlinkAttrs(shape), shape.style)}${clientDataXml(shape)}`);
5451
5451
  }
5452
5452
  function stringifyConnector(conn, id, ctx) {
5453
- return wrapAnchor(conn, `${buildConnectorContent(conn, id, `Connector ${id}`, conn.spPr, ctx, macroTextlinkAttrs(conn), conn)}${clientDataXml(conn)}`);
5453
+ return wrapAnchor(conn, `${buildConnectorContent(conn, id, `Connector ${id}`, conn.properties, ctx, macroTextlinkAttrs(conn), conn)}${clientDataXml(conn)}`);
5454
5454
  }
5455
5455
  function stringifyContentPart(cp) {
5456
5456
  return wrapAnchor(cp, `<xdr:contentPart r:id="${cp.rId}"/>${clientDataXml(cp)}`);
5457
5457
  }
5458
5458
  /** Build xdr:grpSp content and return the next available cNvPr id. */
5459
5459
  function buildGroup(grp, id, ctx) {
5460
- const grpSpPrXml = groupShapePropertiesDesc.stringify(grp.grpSpPr, ctx) ?? "";
5460
+ const grpSpPrXml = groupShapePropertiesDesc.stringify(grp.properties, ctx) ?? "";
5461
5461
  let childId = id + 1;
5462
5462
  const children = [];
5463
5463
  for (const childShape of grp.shapes ?? []) {
5464
- children.push(buildShapeContent(childShape, childId, `Shape ${childId}`, childShape.spPr, childShape.textBody, ctx, macroTextlinkAttrs(childShape), childShape.style));
5464
+ children.push(buildShapeContent(childShape, childId, `Shape ${childId}`, childShape.properties, childShape.textBody, ctx, macroTextlinkAttrs(childShape), childShape.style));
5465
5465
  childId++;
5466
5466
  }
5467
5467
  for (const childConn of grp.connectors ?? []) {
5468
- children.push(buildConnectorContent(childConn, childId, `Connector ${childId}`, childConn.spPr, ctx, macroTextlinkAttrs(childConn), childConn));
5468
+ children.push(buildConnectorContent(childConn, childId, `Connector ${childId}`, childConn.properties, ctx, macroTextlinkAttrs(childConn), childConn));
5469
5469
  childId++;
5470
5470
  }
5471
5471
  return {
@@ -5881,16 +5881,16 @@ const connectionsDesc = {
5881
5881
  if (c.credentials !== void 0 && CRED_METHODS.has(c.credentials)) cAttrs.push(`credentials="${c.credentials}"`);
5882
5882
  if (c.singleSignOnId !== void 0) cAttrs.push(`singleSignOnId="${escapeXml(c.singleSignOnId)}"`);
5883
5883
  const inner = [];
5884
- if (c.dbPr) {
5885
- const dAttrs = [`connection="${escapeXml(c.dbPr.connection)}"`];
5886
- if (c.dbPr.command !== void 0) dAttrs.push(`command="${escapeXml(c.dbPr.command)}"`);
5887
- if (c.dbPr.serverCommand !== void 0) dAttrs.push(`serverCommand="${escapeXml(c.dbPr.serverCommand)}"`);
5888
- if (c.dbPr.commandType !== void 0) dAttrs.push(`commandType="${c.dbPr.commandType}"`);
5884
+ if (c.database) {
5885
+ const dAttrs = [`connection="${escapeXml(c.database.connection)}"`];
5886
+ if (c.database.command !== void 0) dAttrs.push(`command="${escapeXml(c.database.command)}"`);
5887
+ if (c.database.serverCommand !== void 0) dAttrs.push(`serverCommand="${escapeXml(c.database.serverCommand)}"`);
5888
+ if (c.database.commandType !== void 0) dAttrs.push(`commandType="${c.database.commandType}"`);
5889
5889
  inner.push(`<dbPr ${dAttrs.join(" ")}/>`);
5890
5890
  }
5891
- if (c.olapPr) inner.push(stringifyOlapPr(c.olapPr));
5892
- if (c.webPr) {
5893
- const w = c.webPr;
5891
+ if (c.olap) inner.push(stringifyOlapPr(c.olap));
5892
+ if (c.web) {
5893
+ const w = c.web;
5894
5894
  const wAttrs = [];
5895
5895
  if (w.xml) wAttrs.push("xml=\"1\"");
5896
5896
  if (w.sourceData) wAttrs.push("sourceData=\"1\"");
@@ -5909,8 +5909,8 @@ const connectionsDesc = {
5909
5909
  if (tablesXml) inner.push(`<webPr ${wAttrs.join(" ")}>${tablesXml}</webPr>`);
5910
5910
  else inner.push(`<webPr ${wAttrs.join(" ")}/>`);
5911
5911
  }
5912
- if (c.textPr) {
5913
- const t = c.textPr;
5912
+ if (c.text) {
5913
+ const t = c.text;
5914
5914
  const tAttrs = [];
5915
5915
  if (t.prompt === false) tAttrs.push("prompt=\"0\"");
5916
5916
  if (t.fileType !== void 0) tAttrs.push(`fileType="${t.fileType}"`);
@@ -5992,7 +5992,7 @@ const connectionsDesc = {
5992
5992
  if (attr(cEl, "credentials") !== void 0) c.credentials = attr(cEl, "credentials");
5993
5993
  if (attr(cEl, "singleSignOnId") !== void 0) c.singleSignOnId = attr(cEl, "singleSignOnId");
5994
5994
  const dbEl = findChild(cEl, "dbPr");
5995
- if (dbEl) c.dbPr = {
5995
+ if (dbEl) c.database = {
5996
5996
  connection: attr(dbEl, "connection") ?? "",
5997
5997
  command: attr(dbEl, "command"),
5998
5998
  serverCommand: attr(dbEl, "serverCommand"),
@@ -6001,7 +6001,7 @@ const connectionsDesc = {
6001
6001
  const olapEl = findChild(cEl, "olapPr");
6002
6002
  if (olapEl) {
6003
6003
  const ol = parseOlapPr(olapEl);
6004
- if (ol) c.olapPr = ol;
6004
+ if (ol) c.olap = ol;
6005
6005
  }
6006
6006
  const webEl = findChild(cEl, "webPr");
6007
6007
  if (webEl) {
@@ -6027,7 +6027,7 @@ const connectionsDesc = {
6027
6027
  else if (tEl.name === "x") tables.push(attrNum(tEl, "v") ?? 0);
6028
6028
  if (tables.length > 0) w.tables = tables;
6029
6029
  }
6030
- c.webPr = w;
6030
+ c.web = w;
6031
6031
  }
6032
6032
  const textEl = findChild(cEl, "textPr");
6033
6033
  if (textEl) {
@@ -6065,7 +6065,7 @@ const connectionsDesc = {
6065
6065
  }
6066
6066
  if (fields.length > 0) t.textFields = fields;
6067
6067
  }
6068
- c.textPr = t;
6068
+ c.text = t;
6069
6069
  }
6070
6070
  const paramsEl = findChild(cEl, "parameters");
6071
6071
  if (paramsEl) {
@@ -7043,8 +7043,8 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
7043
7043
  if (fg.parent !== void 0) fgParts.push(` par="${fg.parent}"`);
7044
7044
  if (fg.base !== void 0) fgParts.push(` base="${fg.base}"`);
7045
7045
  fgParts.push(">");
7046
- if (fg.rangePr) {
7047
- const rp = fg.rangePr;
7046
+ if (fg.range) {
7047
+ const rp = fg.range;
7048
7048
  const rpAttrs = [];
7049
7049
  if (rp.autoStart === false) rpAttrs.push("autoStart=\"0\"");
7050
7050
  if (rp.autoEnd === false) rpAttrs.push("autoEnd=\"0\"");
@@ -7056,9 +7056,9 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
7056
7056
  if (rp.groupInterval !== void 0) rpAttrs.push(`groupInterval="${rp.groupInterval}"`);
7057
7057
  fgParts.push(`<rangePr${rpAttrs.length ? " " + rpAttrs.join(" ") : ""}/>`);
7058
7058
  }
7059
- if (fg.discretePr && fg.discretePr.length > 0) {
7060
- fgParts.push(`<discretePr count="${fg.discretePr.length}">`);
7061
- for (const idx of fg.discretePr) fgParts.push(`<x v="${idx}"/>`);
7059
+ if (fg.discrete && fg.discrete.length > 0) {
7060
+ fgParts.push(`<discretePr count="${fg.discrete.length}">`);
7061
+ for (const idx of fg.discrete) fgParts.push(`<x v="${idx}"/>`);
7062
7062
  fgParts.push("</discretePr>");
7063
7063
  }
7064
7064
  if (fg.groupItems && fg.groupItems.length > 0) {
@@ -7074,7 +7074,7 @@ function stringifyPivotCacheDef(sourceRef, sourceSheet, sourceData, recordsRid,
7074
7074
  }
7075
7075
  p.push("</cacheFields>");
7076
7076
  if (cacheDefOpts?.mpMaps) for (const mp of cacheDefOpts.mpMaps) p.push(`<mpMap x="${mp.x}"/>`);
7077
- const olapPrXml = cacheDefOpts?.olapPr ? stringifyOlapPr(cacheDefOpts.olapPr) : "";
7077
+ const olapPrXml = cacheDefOpts?.olap ? stringifyOlapPr(cacheDefOpts.olap) : "";
7078
7078
  if (olapPrXml) p.push(olapPrXml);
7079
7079
  if (cacheDefOpts?.cacheHierarchies && cacheDefOpts.cacheHierarchies.length > 0) {
7080
7080
  const chs = cacheDefOpts.cacheHierarchies;
@@ -7365,8 +7365,8 @@ const tableDesc = {
7365
7365
  if (col.headerRowCellStyle) colAttrs.headerRowCellStyle = col.headerRowCellStyle;
7366
7366
  if (col.dataCellStyle) colAttrs.dataCellStyle = col.dataCellStyle;
7367
7367
  if (col.totalsRowCellStyle) colAttrs.totalsRowCellStyle = col.totalsRowCellStyle;
7368
- if (col.xmlColumnPr && typeof col.xmlColumnPr.mapId === "number") {
7369
- const xp = col.xmlColumnPr;
7368
+ if (col.mapping && typeof col.mapping.mapId === "number") {
7369
+ const xp = col.mapping;
7370
7370
  const xpAttrs = [`mapId="${xp.mapId}"`, `xpath="${escapeXml(xp.xpath)}"`];
7371
7371
  if (xp.denormalized) xpAttrs.push("denormalized=\"1\"");
7372
7372
  xpAttrs.push(`xmlDataType="${escapeXml(xp.xmlDataType)}"`);
@@ -7450,12 +7450,12 @@ const tableDesc = {
7450
7450
  if (attr(colEl, "totalsRowCellStyle")) col.totalsRowCellStyle = attr(colEl, "totalsRowCellStyle");
7451
7451
  const xcpEl = findChild(colEl, "xmlColumnPr");
7452
7452
  if (xcpEl) {
7453
- col.xmlColumnPr = {
7453
+ col.mapping = {
7454
7454
  mapId: attrNum(xcpEl, "mapId") ?? 0,
7455
7455
  xpath: attr(xcpEl, "xpath") ?? "",
7456
7456
  xmlDataType: attr(xcpEl, "xmlDataType") ?? ""
7457
7457
  };
7458
- if (parseOnOff(attr(xcpEl, "denormalized"))) col.xmlColumnPr.denormalized = true;
7458
+ if (parseOnOff(attr(xcpEl, "denormalized"))) col.mapping.denormalized = true;
7459
7459
  }
7460
7460
  columns.push(col);
7461
7461
  }
@@ -7543,8 +7543,8 @@ function stringifyWorkbook(opts) {
7543
7543
  if (fs.spinCount !== void 0) fsAttrs.push(`spinCount="${fs.spinCount}"`);
7544
7544
  if (fsAttrs.length > 0) parts.push(`<fileSharing ${fsAttrs.join(" ")}/>`);
7545
7545
  }
7546
- if (opts.workbookPr) {
7547
- const wbPr = opts.workbookPr;
7546
+ if (opts.properties) {
7547
+ const wbPr = opts.properties;
7548
7548
  const wbPrAttrs = [];
7549
7549
  if (wbPr.date1904) wbPrAttrs.push("date1904=\"1\"");
7550
7550
  if (wbPr.defaultThemeVersion !== void 0) wbPrAttrs.push(`defaultThemeVersion="${wbPr.defaultThemeVersion}"`);
@@ -7673,8 +7673,8 @@ function stringifyWorkbook(opts) {
7673
7673
  dnParts.push("</definedNames>");
7674
7674
  parts.push(dnParts.join(""));
7675
7675
  }
7676
- if (opts.calcPr) {
7677
- const cp = opts.calcPr;
7676
+ if (opts.calculation) {
7677
+ const cp = opts.calculation;
7678
7678
  const cpAttrs = [];
7679
7679
  cpAttrs.push(`calcId="${cp.calcId ?? 191029}"`);
7680
7680
  if (cp.calcMode) cpAttrs.push(`calcMode="${escapeXml(cp.calcMode)}"`);
@@ -7731,8 +7731,8 @@ function stringifyWorkbook(opts) {
7731
7731
  for (const pc of pivotCaches) parts.push(`<pivotCache cacheId="${pc.cacheId}" r:id="${pc.rId}"/>`);
7732
7732
  parts.push("</pivotCaches>");
7733
7733
  }
7734
- if (opts.smartTagPr) {
7735
- const stp = opts.smartTagPr;
7734
+ if (opts.smartTag) {
7735
+ const stp = opts.smartTag;
7736
7736
  const stpAttrs = [];
7737
7737
  if (stp.embed) stpAttrs.push("embed=\"1\"");
7738
7738
  if (stp.show && stp.show !== "all") stpAttrs.push(`show="${stp.show}"`);
@@ -7764,8 +7764,8 @@ function stringifyWorkbook(opts) {
7764
7764
  if (wp.characterSet) wpAttrs.push(`characterSet="${escapeXml(wp.characterSet)}"`);
7765
7765
  parts.push(`<webPublishing ${wpAttrs.join(" ")}/>`);
7766
7766
  }
7767
- if (opts.fileRecoveryPr) {
7768
- const frp = opts.fileRecoveryPr;
7767
+ if (opts.fileRecovery) {
7768
+ const frp = opts.fileRecovery;
7769
7769
  const frpAttrs = [];
7770
7770
  if (frp.autoRecover === false) frpAttrs.push("autoRecover=\"0\"");
7771
7771
  if (frp.crashSave) frpAttrs.push("crashSave=\"1\"");
@@ -7938,7 +7938,7 @@ const workbookDesc = {
7938
7938
  if (id !== void 0) calc.iterateDelta = id;
7939
7939
  if (String(attr(calcPrEl, "fullPrecision")) === "0") calc.fullPrecision = false;
7940
7940
  if (parseOnOff(attr(calcPrEl, "calcCompleted"))) calc.calcCompleted = true;
7941
- result.calcPr = calc;
7941
+ result.calculation = calc;
7942
7942
  }
7943
7943
  const oleSizeEl = findChild(el, "oleSize");
7944
7944
  if (oleSizeEl) {
@@ -8022,7 +8022,7 @@ const workbookDesc = {
8022
8022
  if (parseOnOff(attr(fileRecoveryEl, "crashSave"))) frp.crashSave = true;
8023
8023
  if (parseOnOff(attr(fileRecoveryEl, "dataExtractLoad"))) frp.dataExtractLoad = true;
8024
8024
  if (parseOnOff(attr(fileRecoveryEl, "repairLoad"))) frp.repairLoad = true;
8025
- result.fileRecoveryPr = frp;
8025
+ result.fileRecovery = frp;
8026
8026
  }
8027
8027
  const wbPrEl = findChild(el, "workbookPr");
8028
8028
  if (wbPrEl?.attributes) {
@@ -8046,7 +8046,7 @@ const workbookDesc = {
8046
8046
  if (parseOnOff(attr(wbPrEl, "checkCompatibility"))) wbPr.checkCompatibility = true;
8047
8047
  if (String(attr(wbPrEl, "autoCompressPictures")) === "0") wbPr.autoCompressPictures = false;
8048
8048
  if (parseOnOff(attr(wbPrEl, "refreshAllConnections"))) wbPr.refreshAllConnections = true;
8049
- result.workbookPr = wbPr;
8049
+ result.properties = wbPr;
8050
8050
  }
8051
8051
  const acEl = findChild(el, "mc:AlternateContent");
8052
8052
  if (acEl) {
@@ -8149,7 +8149,7 @@ const workbookDesc = {
8149
8149
  if (parseOnOff(attr(smartTagPrEl, "embed"))) stp.embed = true;
8150
8150
  const show = attr(smartTagPrEl, "show");
8151
8151
  if (show && show !== "all") stp.show = show;
8152
- result.smartTagPr = stp;
8152
+ result.smartTag = stp;
8153
8153
  }
8154
8154
  const smartTagTypesEl = findChild(el, "smartTagTypes");
8155
8155
  if (smartTagTypesEl) {
@@ -8373,11 +8373,11 @@ const singleXmlCellsDesc = {
8373
8373
  stringify(opts, _ctx) {
8374
8374
  const p = ["<singleXmlCells xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">"];
8375
8375
  for (const c of opts.cells) {
8376
- const pr = c.xmlCellPr;
8376
+ const pr = c.properties;
8377
8377
  const prAttrs = [`id="${pr.id}"`];
8378
8378
  if (pr.uniqueName !== void 0) prAttrs.push(`uniqueName="${escapeXml(pr.uniqueName)}"`);
8379
- if (typeof pr.xmlPr.mapId !== "number") continue;
8380
- p.push(`<singleXmlCell id="${c.id}" r="${escapeXml(c.reference)}" connectionId="${c.connectionId}"><xmlCellPr ${prAttrs.join(" ")}><xmlPr mapId="${pr.xmlPr.mapId}" xpath="${escapeXml(pr.xmlPr.xpath)}" xmlDataType="${escapeXml(pr.xmlPr.xmlDataType)}"/></xmlCellPr></singleXmlCell>`);
8379
+ if (typeof pr.mapping.mapId !== "number") continue;
8380
+ p.push(`<singleXmlCell id="${c.id}" r="${escapeXml(c.reference)}" connectionId="${c.connectionId}"><xmlCellPr ${prAttrs.join(" ")}><xmlPr mapId="${pr.mapping.mapId}" xpath="${escapeXml(pr.mapping.xpath)}" xmlDataType="${escapeXml(pr.mapping.xmlDataType)}"/></xmlCellPr></singleXmlCell>`);
8381
8381
  }
8382
8382
  p.push("</singleXmlCells>");
8383
8383
  return p.join("");
@@ -8392,7 +8392,7 @@ const singleXmlCellsDesc = {
8392
8392
  if (!xmlPrEl) continue;
8393
8393
  const pr = { id: attrNum(prEl, "id") ?? 0 };
8394
8394
  if (attr(prEl, "uniqueName") !== void 0) pr.uniqueName = attr(prEl, "uniqueName");
8395
- pr.xmlPr = {
8395
+ pr.mapping = {
8396
8396
  mapId: attrNum(xmlPrEl, "mapId") ?? 0,
8397
8397
  xpath: attr(xmlPrEl, "xpath") ?? "",
8398
8398
  xmlDataType: attr(xmlPrEl, "xmlDataType") ?? ""
@@ -8401,7 +8401,7 @@ const singleXmlCellsDesc = {
8401
8401
  id: attrNum(cEl, "id") ?? 0,
8402
8402
  reference: attr(cEl, "r") ?? "",
8403
8403
  connectionId: attrNum(cEl, "connectionId") ?? 0,
8404
- xmlCellPr: pr
8404
+ properties: pr
8405
8405
  });
8406
8406
  }
8407
8407
  return { cells };
@@ -9478,14 +9478,14 @@ function parseWorkbook(data) {
9478
9478
  }
9479
9479
  if (wbData.protection) opts.workbookProtection = wbData.protection;
9480
9480
  if (wbData.bookView) opts.bookView = wbData.bookView;
9481
- if (wbData.calcPr) opts.calcPr = wbData.calcPr;
9481
+ if (wbData.calculation) opts.calculation = wbData.calculation;
9482
9482
  if (wbData.oleSize) opts.oleSize = wbData.oleSize;
9483
9483
  if (wbData.customViews) opts.customWorkbookViews = wbData.customViews;
9484
- if (wbData.fileRecoveryPr) opts.fileRecoveryPr = wbData.fileRecoveryPr;
9484
+ if (wbData.fileRecovery) opts.fileRecovery = wbData.fileRecovery;
9485
9485
  if (wbData.functionGroups) opts.functionGroups = wbData.functionGroups;
9486
9486
  if (wbData.webPublishing) opts.webPublishing = wbData.webPublishing;
9487
9487
  if (wbData.fileSharing) opts.fileSharing = wbData.fileSharing;
9488
- if (wbData.workbookPr) opts.workbookPr = wbData.workbookPr;
9488
+ if (wbData.properties) opts.properties = wbData.properties;
9489
9489
  if (wbData.webPublishObjects) opts.webPublishObjects = wbData.webPublishObjects;
9490
9490
  if (wbData.definedNames) opts.definedNames = wbData.definedNames;
9491
9491
  if (wbData.absPath !== void 0) opts.absPath = wbData.absPath;
@@ -9562,7 +9562,7 @@ function parseWorkbook(data) {
9562
9562
  description: image.description,
9563
9563
  title: image.title,
9564
9564
  hidden: image.hidden,
9565
- ...image.spPr ? { spPr: image.spPr } : {},
9565
+ ...image.properties ? { properties: image.properties } : {},
9566
9566
  ...image.blackWhiteMode ? { blackWhiteMode: image.blackWhiteMode } : {},
9567
9567
  ...image.sourceRectangle ? { sourceRectangle: image.sourceRectangle } : {},
9568
9568
  ...image.preferRelativeResize !== void 0 ? { preferRelativeResize: image.preferRelativeResize } : {},
@@ -9587,7 +9587,7 @@ function parseWorkbook(data) {
9587
9587
  description: image.description,
9588
9588
  title: image.title,
9589
9589
  hidden: image.hidden,
9590
- ...image.spPr ? { spPr: image.spPr } : {},
9590
+ ...image.properties ? { properties: image.properties } : {},
9591
9591
  ...image.blackWhiteMode ? { blackWhiteMode: image.blackWhiteMode } : {},
9592
9592
  ...image.sourceRectangle ? { sourceRectangle: image.sourceRectangle } : {},
9593
9593
  ...image.preferRelativeResize !== void 0 ? { preferRelativeResize: image.preferRelativeResize } : {},
@@ -10544,14 +10544,14 @@ function compileWorkbook(options, overrides = [], mediaLevel = 0) {
10544
10544
  pivotCaches: ctx.pivotCacheRefs.length > 0 ? ctx.pivotCacheRefs : rtPivotRefs ?? [],
10545
10545
  protection: options.workbookProtection,
10546
10546
  customViews: options.customWorkbookViews,
10547
- fileRecoveryPr: options.fileRecoveryPr,
10547
+ fileRecovery: options.fileRecovery,
10548
10548
  functionGroups: options.functionGroups,
10549
10549
  webPublishing: options.webPublishing,
10550
10550
  fileSharing: options.fileSharing,
10551
10551
  webPublishObjects: options.webPublishObjects,
10552
10552
  definedNames: options.definedNames,
10553
- workbookPr: options.workbookPr,
10554
- calcPr: options.calcPr,
10553
+ properties: options.properties,
10554
+ calculation: options.calculation,
10555
10555
  oleSize: options.oleSize,
10556
10556
  bookView: options.bookView,
10557
10557
  ...options.absPath !== void 0 ? { absPath: options.absPath } : {},
@@ -10735,7 +10735,6 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10735
10735
  const groupOpts = wsOpts.groups ?? [];
10736
10736
  const hlOpts = wsOpts.hyperlinks ?? [];
10737
10737
  const sheetName = wsOpts.name ?? `Sheet${i + 1}`;
10738
- let sheetXml = stringifyWorksheet(wsOpts, wsContext);
10739
10738
  const sheetIdx = wsOpts.sheetId ?? i + 1;
10740
10739
  const wsRows = wsOpts.rows ?? [];
10741
10740
  for (let ri = 0; ri < wsRows.length; ri++) {
@@ -10766,13 +10765,68 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10766
10765
  const hasQueryTables = queryTableOpts.length > 0;
10767
10766
  const singleXmlCellOpts = wsOpts.singleXmlCells ?? [];
10768
10767
  const bgImg = wsOpts.backgroundImage;
10768
+ const wsPath = `xl/worksheets/sheet${i + 1}.xml`;
10769
10769
  let wsRels;
10770
- let nextRid = 0;
10771
- if (hasMedia || hasExternalHyperlinks || hasComments || hasPivots || hasTables || hasQueryTables || singleXmlCellOpts.length > 0 || bgImg) wsRels = new Relationships();
10770
+ if (hasMedia || hasExternalHyperlinks || hasComments || hasPivots || hasTables || hasQueryTables || singleXmlCellOpts.length > 0 || bgImg) {
10771
+ wsRels = new Relationships();
10772
+ wsRels.reserveSourceRids(wsPath, passthroughRelationships ?? []);
10773
+ }
10774
+ const resolvePassthroughRid = (typeFragment, originalRid) => {
10775
+ if (!wsRels) return originalRid;
10776
+ const rel = (passthroughRelationships ?? []).find((r) => r.source === wsPath && r.rId === originalRid && r.relationshipType.endsWith(typeFragment));
10777
+ if (!rel) return originalRid;
10778
+ const existing = wsRels.idOf(rel.relationshipType, rel.target);
10779
+ if (existing) return existing;
10780
+ if (wsRels.hasId(originalRid)) return `rId${wsRels.add(rel.relationshipType, rel.target)}`;
10781
+ wsRels.addRelationship(originalRid, rel.relationshipType, rel.target);
10782
+ return originalRid;
10783
+ };
10784
+ const resolveEmbeddingRid = (originalRid) => {
10785
+ const rid = resolvePassthroughRid("/oleObject", originalRid);
10786
+ return rid === originalRid ? resolvePassthroughRid("/package", originalRid) : rid;
10787
+ };
10788
+ let xmlOpts = wsOpts;
10789
+ if (wsRels && (passthroughRelationships?.length ?? 0) > 0) {
10790
+ const oleObjects = wsOpts.oleObjects?.map((ole) => ({
10791
+ ...ole,
10792
+ rId: ole.rId ? resolveEmbeddingRid(ole.rId) : ole.rId,
10793
+ properties: ole.properties?.iconRid !== void 0 ? {
10794
+ ...ole.properties,
10795
+ iconRid: resolvePassthroughRid("/image", ole.properties.iconRid)
10796
+ } : ole.properties
10797
+ }));
10798
+ const controls = wsOpts.controls?.map((c) => ({
10799
+ ...c,
10800
+ rId: resolvePassthroughRid("/controls", c.rId),
10801
+ iconRid: c.iconRid !== void 0 ? resolvePassthroughRid("/image", c.iconRid) : c.iconRid
10802
+ }));
10803
+ const pageSetup = wsOpts.pageSetup?.printerSettingsRId ? {
10804
+ ...wsOpts.pageSetup,
10805
+ printerSettingsRId: resolvePassthroughRid("/printerSettings", wsOpts.pageSetup.printerSettingsRId)
10806
+ } : wsOpts.pageSetup;
10807
+ const pivotSelection = wsOpts.pivotSelection?.rId ? {
10808
+ ...wsOpts.pivotSelection,
10809
+ rId: resolvePassthroughRid("/pivotTable", wsOpts.pivotSelection.rId)
10810
+ } : wsOpts.pivotSelection;
10811
+ const legacyDrawingHF = wsOpts.legacyDrawingHF ? resolvePassthroughRid("/vmlDrawing", wsOpts.legacyDrawingHF) : wsOpts.legacyDrawingHF;
10812
+ const customProperties = wsOpts.customProperties?.map((cp) => ({
10813
+ ...cp,
10814
+ rId: resolvePassthroughRid("/customXml", cp.rId)
10815
+ }));
10816
+ xmlOpts = {
10817
+ ...wsOpts,
10818
+ ...oleObjects ? { oleObjects } : {},
10819
+ ...controls ? { controls } : {},
10820
+ ...pageSetup !== wsOpts.pageSetup ? { pageSetup } : {},
10821
+ ...pivotSelection !== wsOpts.pivotSelection ? { pivotSelection } : {},
10822
+ ...legacyDrawingHF !== wsOpts.legacyDrawingHF ? { legacyDrawingHF } : {},
10823
+ ...customProperties ? { customProperties } : {}
10824
+ };
10825
+ }
10826
+ let sheetXml = stringifyWorksheet(xmlOpts, wsContext);
10772
10827
  if (hasExternalHyperlinks) for (const hl of hlOpts) {
10773
10828
  if (hl.url === void 0) continue;
10774
- const rid = ++nextRid;
10775
- wsRels.addRelationship(rid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hl.url, "External");
10829
+ wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hl.url, "External");
10776
10830
  }
10777
10831
  if (hasMedia) {
10778
10832
  const drawingImages = [];
@@ -10811,7 +10865,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10811
10865
  rId: embedRid ?? "",
10812
10866
  ...linkRid ? { linkRId: linkRid } : {},
10813
10867
  ...pickNonVisualDrawingProperties(img),
10814
- ...img.spPr ? { spPr: img.spPr } : {},
10868
+ ...img.properties ? { properties: img.properties } : {},
10815
10869
  ...img.blackWhiteMode ? { blackWhiteMode: img.blackWhiteMode } : {},
10816
10870
  ...img.sourceRectangle ? { sourceRectangle: img.sourceRectangle } : {},
10817
10871
  ...img.preferRelativeResize !== void 0 ? { preferRelativeResize: img.preferRelativeResize } : {},
@@ -10904,9 +10958,8 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10904
10958
  data: XML_DECL + drawingRels.serialize(),
10905
10959
  path: `xl/drawings/_rels/drawing${drawingIdx}.xml.rels`
10906
10960
  };
10907
- const drawingRid = ++nextRid;
10961
+ const drawingRid = wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", `../drawings/drawing${drawingIdx}.xml`);
10908
10962
  sheetXml = editSheetTailMarker(sheetXml, "<!--DRAWING-->", `<drawing r:id="rId${drawingRid}"/>`);
10909
- wsRels.addRelationship(drawingRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", `../drawings/drawing${drawingIdx}.xml`);
10910
10963
  }
10911
10964
  if (hasComments) {
10912
10965
  const commentsIdx = i + 1;
@@ -10920,10 +10973,8 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10920
10973
  data: XML_DECL + vmlXml,
10921
10974
  path: `xl/drawings/vmlDrawing${commentsIdx}.vml`
10922
10975
  };
10923
- const commentsRid = ++nextRid;
10924
- wsRels.addRelationship(commentsRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", `../comments${commentsIdx}.xml`);
10925
- const vmlRid = ++nextRid;
10926
- wsRels.addRelationship(vmlRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", `../drawings/vmlDrawing${commentsIdx}.vml`);
10976
+ wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments", `../comments${commentsIdx}.xml`);
10977
+ const vmlRid = wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", `../drawings/vmlDrawing${commentsIdx}.vml`);
10927
10978
  sheetXml = editSheetTailMarker(sheetXml, "<!--LEGACY_DRAWING-->", `<legacyDrawing r:id="rId${vmlRid}"/>`);
10928
10979
  }
10929
10980
  if (bgImg) {
@@ -10937,25 +10988,9 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
10937
10988
  height: 0
10938
10989
  }));
10939
10990
  state.globalMediaIdx++;
10940
- const bgRid = ++nextRid;
10941
- wsRels.addRelationship(bgRid, IMAGE_REL, `../media/${entry.fileName}`);
10991
+ const bgRid = wsRels.add(IMAGE_REL, `../media/${entry.fileName}`);
10942
10992
  sheetXml = editSheetTailMarker(sheetXml, "<!--BACKGROUND_PICTURE-->", `<picture r:id="rId${bgRid}"/>`);
10943
10993
  }
10944
- const wsPath = `xl/worksheets/sheet${i + 1}.xml`;
10945
- const resolvePassthroughRid = (typeFragment, originalRid) => {
10946
- if (!wsRels) return originalRid;
10947
- const rel = (passthroughRelationships ?? []).find((r) => r.source === wsPath && r.rId === originalRid && r.relationshipType.endsWith(typeFragment));
10948
- if (!rel) return originalRid;
10949
- const existing = wsRels.idOf(rel.relationshipType, rel.target);
10950
- if (existing) return existing;
10951
- if (wsRels.hasId(originalRid)) {
10952
- const n = ++nextRid;
10953
- wsRels.addRelationship(n, rel.relationshipType, rel.target);
10954
- return `rId${n}`;
10955
- }
10956
- wsRels.addRelationship(originalRid, rel.relationshipType, rel.target);
10957
- return originalRid;
10958
- };
10959
10994
  if (wsOpts.drawingRid) {
10960
10995
  const rid = escapeXml(resolvePassthroughRid("/drawing", wsOpts.drawingRid));
10961
10996
  sheetXml = editSheetTailMarker(sheetXml, "<!--DRAWING-->", `<drawing r:id="${rid}"/>`);
@@ -11031,8 +11066,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
11031
11066
  data: XML_DECL + ptRels.serialize(),
11032
11067
  path: `xl/pivotTables/_rels/pivotTable${pivotIdx}.xml.rels`
11033
11068
  };
11034
- const ptRid = ++nextRid;
11035
- wsRels.addRelationship(ptRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", `../pivotTables/pivotTable${pivotIdx}.xml`);
11069
+ wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable", `../pivotTables/pivotTable${pivotIdx}.xml`);
11036
11070
  }
11037
11071
  const wsTableParts = [];
11038
11072
  if (hasTables) for (const tbl of tableOpts) {
@@ -11047,8 +11081,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
11047
11081
  data: tableXmlStr,
11048
11082
  path: `xl/tables/table${tableIdx}.xml`
11049
11083
  };
11050
- const tblRid = ++nextRid;
11051
- wsRels.addRelationship(tblRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", `../tables/table${tableIdx}.xml`);
11084
+ const tblRid = wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", `../tables/table${tableIdx}.xml`);
11052
11085
  wsTableParts.push({ rId: `rId${tblRid}` });
11053
11086
  state.allTableParts.push({ rId: `rId${tblRid}` });
11054
11087
  }
@@ -11058,8 +11091,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
11058
11091
  data: XML_DECL + queryTableDesc.stringify(qt, ctx),
11059
11092
  path: `xl/queryTables/queryTable${state.globalQueryTableIdx}.xml`
11060
11093
  };
11061
- const qtRid = ++nextRid;
11062
- wsRels.addRelationship(qtRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable", `../queryTables/queryTable${state.globalQueryTableIdx}.xml`);
11094
+ wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/queryTable", `../queryTables/queryTable${state.globalQueryTableIdx}.xml`);
11063
11095
  }
11064
11096
  if (singleXmlCellOpts.length > 0) {
11065
11097
  state.globalSingleXmlCellsIdx++;
@@ -11067,8 +11099,7 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
11067
11099
  data: XML_DECL + singleXmlCellsDesc.stringify({ cells: singleXmlCellOpts }, ctx),
11068
11100
  path: `xl/tables/tableSingleCells${state.globalSingleXmlCellsIdx}.xml`
11069
11101
  };
11070
- const sxcRid = ++nextRid;
11071
- wsRels.addRelationship(sxcRid, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells", `../tables/tableSingleCells${state.globalSingleXmlCellsIdx}.xml`);
11102
+ wsRels.add("http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells", `../tables/tableSingleCells${state.globalSingleXmlCellsIdx}.xml`);
11072
11103
  }
11073
11104
  if (hasPivots) {
11074
11105
  const rendered = renderPivotSheetData(pivotOpts, worksheetConfigs, ctx.sharedStrings, sheetName);
@@ -11079,23 +11110,9 @@ function compileWorksheetPart(wsOpts, i, worksheetConfigs, ctx, mapping, wsConte
11079
11110
  }
11080
11111
  if (wsTableParts.length > 0) sheetXml = editSheetTailMarker(sheetXml, "<!--TABLE_PARTS-->", buildTablePartsXml(wsTableParts));
11081
11112
  sheetXml = stripWorksheetPlaceholders(sheetXml);
11082
- if (wsRels) {
11083
- if (wsOpts.pageSetup?.printerSettingsRId) {
11084
- const src = wsOpts.pageSetup.printerSettingsRId;
11085
- const rid = resolvePassthroughRid("/printerSettings", src);
11086
- if (rid !== src) sheetXml = sheetXml.replace(new RegExp(`(<pageSetup[^>]*r:id=")${src.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(")`), `$1${rid}$2`);
11087
- }
11088
- if (wsOpts.pivotSelection?.rId) {
11089
- const src = wsOpts.pivotSelection.rId;
11090
- const rid = resolvePassthroughRid("/pivotTable", src);
11091
- if (rid !== src) sheetXml = sheetXml.replace(new RegExp(`(<pivotSelection[^>]*r:id=")${src.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(")`), `$1${rid}$2`);
11092
- }
11093
- for (const rel of passthroughRelationships ?? []) {
11094
- if (rel.source !== wsPath) continue;
11095
- if (wsRels.hasRelationship(rel.relationshipType, rel.target)) continue;
11096
- const n = ++nextRid;
11097
- wsRels.addRelationship(n, rel.relationshipType, rel.target);
11098
- }
11113
+ if (wsRels) for (const rel of passthroughRelationships ?? []) {
11114
+ if (rel.source !== wsPath) continue;
11115
+ wsRels.claimSourceRel(rel);
11099
11116
  }
11100
11117
  if (wsRels) mapping[`WorksheetRels${i}`] = {
11101
11118
  data: XML_DECL + wsRels.serialize(),
@@ -11543,7 +11560,7 @@ const WORKBOOK_KEYS = /* @__PURE__ */ new Set([
11543
11560
  "customProperties",
11544
11561
  "workbookProtection",
11545
11562
  "definedNames",
11546
- "fileRecoveryPr",
11563
+ "fileRecovery",
11547
11564
  "functionGroups",
11548
11565
  "webPublishing",
11549
11566
  "fileSharing",
@@ -11616,7 +11633,7 @@ function streamWorkbook(options, ondata, compression = {}) {
11616
11633
  sheets,
11617
11634
  protection: options.workbookProtection,
11618
11635
  definedNames: options.definedNames,
11619
- fileRecoveryPr: options.fileRecoveryPr,
11636
+ fileRecovery: options.fileRecovery,
11620
11637
  functionGroups: options.functionGroups,
11621
11638
  webPublishing: options.webPublishing,
11622
11639
  fileSharing: options.fileSharing