ooxml-core 1.35.0 → 1.36.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/automation/index.cjs +1290 -825
  2. package/dist/automation/index.mjs +1290 -825
  3. package/dist/visio/bevel-3d.d.ts +31 -4
  4. package/dist/visio/bevel-3d.d.ts.map +1 -1
  5. package/dist/visio/cff-author.d.ts +14 -0
  6. package/dist/visio/cff-author.d.ts.map +1 -0
  7. package/dist/visio/cff-masters.d.ts +11 -0
  8. package/dist/visio/cff-masters.d.ts.map +1 -1
  9. package/dist/visio/edit-commands.d.ts +7 -0
  10. package/dist/visio/edit-commands.d.ts.map +1 -1
  11. package/dist/visio/edit-formatting-commands.d.ts +6 -0
  12. package/dist/visio/edit-formatting-commands.d.ts.map +1 -1
  13. package/dist/visio/edit-formatting-paint.d.ts.map +1 -1
  14. package/dist/visio/edit-instance-geometry.d.ts.map +1 -1
  15. package/dist/visio/edit-instance-recalculate.d.ts +6 -1
  16. package/dist/visio/edit-instance-recalculate.d.ts.map +1 -1
  17. package/dist/visio/edit-shape-create.d.ts.map +1 -1
  18. package/dist/visio/edit-stencil-connector.d.ts.map +1 -1
  19. package/dist/visio/edit-swimlane-stamp.d.ts +22 -0
  20. package/dist/visio/edit-swimlane-stamp.d.ts.map +1 -0
  21. package/dist/visio/edit.d.ts.map +1 -1
  22. package/dist/visio/index.cjs +1338 -568
  23. package/dist/visio/index.d.ts +3 -1
  24. package/dist/visio/index.d.ts.map +1 -1
  25. package/dist/visio/index.mjs +1331 -569
  26. package/dist/visio/model.d.ts +6 -2
  27. package/dist/visio/model.d.ts.map +1 -1
  28. package/dist/visio/path-segments.d.ts +25 -0
  29. package/dist/visio/path-segments.d.ts.map +1 -0
  30. package/dist/visio/shape-sections.d.ts +4 -3
  31. package/dist/visio/shape-sections.d.ts.map +1 -1
  32. package/dist/visio/solid-3d.d.ts +55 -0
  33. package/dist/visio/solid-3d.d.ts.map +1 -0
  34. package/dist/visio/style.d.ts.map +1 -1
  35. package/dist/visio/theme-solid.d.ts +21 -0
  36. package/dist/visio/theme-solid.d.ts.map +1 -0
  37. package/dist/visio/ui/data-visualizer-edits.d.ts +1 -0
  38. package/dist/visio/ui/data-visualizer-edits.d.ts.map +1 -1
  39. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  40. package/dist/visio/ui/index.cjs +1188 -571
  41. package/dist/visio/ui/index.mjs +1188 -572
  42. package/dist/visio/ui/org-chart-belt.d.ts +20 -0
  43. package/dist/visio/ui/org-chart-belt.d.ts.map +1 -0
  44. package/dist/visio/ui/org-chart-edit.d.ts +8 -1
  45. package/dist/visio/ui/org-chart-edit.d.ts.map +1 -1
  46. package/dist/visio/ui/org-chart-import.d.ts.map +1 -1
  47. package/dist/visio/ui/scene-validation.d.ts.map +1 -1
  48. package/dist/visio/ui/snapshot-scene.d.ts.map +1 -1
  49. package/package.json +1 -1
@@ -1525,8 +1525,8 @@ function isSafePartName(name3) {
1525
1525
  if (body.startsWith("/")) return false;
1526
1526
  return !body.split("/").some((segment) => segment === "..");
1527
1527
  }
1528
- function declaredEntrySize(entry3) {
1529
- const data = entry3._data;
1528
+ function declaredEntrySize(entry4) {
1529
+ const data = entry4._data;
1530
1530
  const size3 = Number(data?.uncompressedSize ?? 0);
1531
1531
  return Number.isFinite(size3) && size3 > 0 ? size3 : 0;
1532
1532
  }
@@ -1540,10 +1540,10 @@ function resolveLimits(limits) {
1540
1540
  fail: (message, limit3, kind, actual) => create4 ? create4(message, { limit: limit3, kind, actual }) : new ZipLimitError(message, { limit: limit3, kind, actual })
1541
1541
  };
1542
1542
  }
1543
- async function inflateEntryGuarded(entry3, alreadyRead, limits) {
1543
+ async function inflateEntryGuarded(entry4, alreadyRead, limits) {
1544
1544
  const chunks = [];
1545
1545
  let size3 = 0;
1546
- for await (const chunk of streamEntryGuarded(entry3, alreadyRead, limits)) {
1546
+ for await (const chunk of streamEntryGuarded(entry4, alreadyRead, limits)) {
1547
1547
  chunks.push(chunk);
1548
1548
  size3 += chunk.byteLength;
1549
1549
  }
@@ -1557,10 +1557,10 @@ async function inflateEntryGuarded(entry3, alreadyRead, limits) {
1557
1557
  return out;
1558
1558
  }
1559
1559
  var AHEAD = 8;
1560
- async function* streamEntryGuarded(entry3, alreadyRead, limits) {
1560
+ async function* streamEntryGuarded(entry4, alreadyRead, limits) {
1561
1561
  const r = resolveLimits(limits);
1562
- const declared = declaredEntrySize(entry3);
1563
- const stream = entry3.internalStream("uint8array");
1562
+ const declared = declaredEntrySize(entry4);
1563
+ const stream = entry4.internalStream("uint8array");
1564
1564
  const queue = [];
1565
1565
  let size3 = 0;
1566
1566
  let ended = false;
@@ -1590,7 +1590,7 @@ async function* streamEntryGuarded(entry3, alreadyRead, limits) {
1590
1590
  if (size3 > declared || size3 > r.maxEntryBytes)
1591
1591
  return fail4(
1592
1592
  r.fail(
1593
- `${r.label} part ${entry3.name} inflates past its declared size`,
1593
+ `${r.label} part ${entry4.name} inflates past its declared size`,
1594
1594
  r.maxEntryBytes,
1595
1595
  size3 > declared ? "declaredSize" : "maxEntryBytes",
1596
1596
  size3
@@ -1653,15 +1653,15 @@ function guardZip(zip, limits = {}) {
1653
1653
  entries.length
1654
1654
  );
1655
1655
  let declared = 0;
1656
- for (const entry3 of entries) {
1657
- const original = entry3.unsafeOriginalName;
1658
- if (!isSafePartName(entry3.name) || original !== void 0 && !isSafePartName(original))
1656
+ for (const entry4 of entries) {
1657
+ const original = entry4.unsafeOriginalName;
1658
+ if (!isSafePartName(entry4.name) || original !== void 0 && !isSafePartName(original))
1659
1659
  throw r.fail(`${r.label} package has an unsafe part name`, r.maxEntries, "partName");
1660
- if (entry3.dir) continue;
1661
- const size3 = declaredEntrySize(entry3);
1660
+ if (entry4.dir) continue;
1661
+ const size3 = declaredEntrySize(entry4);
1662
1662
  if (size3 > r.maxEntryBytes)
1663
1663
  throw r.fail(
1664
- `${r.label} part ${entry3.name} exceeds the uncompressed part size limit`,
1664
+ `${r.label} part ${entry4.name} exceeds the uncompressed part size limit`,
1665
1665
  r.maxEntryBytes,
1666
1666
  "maxEntryBytes",
1667
1667
  size3
@@ -1677,15 +1677,15 @@ function guardZip(zip, limits = {}) {
1677
1677
  );
1678
1678
  const produced = /* @__PURE__ */ new Map();
1679
1679
  let total2 = 0;
1680
- for (const entry3 of entries) {
1681
- if (entry3.dir) continue;
1682
- const inflateOriginal = entry3.async.bind(entry3);
1683
- entry3.async = async (type, onUpdate) => {
1684
- const previous = produced.get(entry3.name) ?? 0;
1685
- const bytes = await inflateEntryGuarded(entry3, total2 - previous, limits);
1680
+ for (const entry4 of entries) {
1681
+ if (entry4.dir) continue;
1682
+ const inflateOriginal = entry4.async.bind(entry4);
1683
+ entry4.async = async (type, onUpdate) => {
1684
+ const previous = produced.get(entry4.name) ?? 0;
1685
+ const bytes = await inflateEntryGuarded(entry4, total2 - previous, limits);
1686
1686
  if (bytes.byteLength > previous) {
1687
1687
  total2 += bytes.byteLength - previous;
1688
- produced.set(entry3.name, bytes.byteLength);
1688
+ produced.set(entry4.name, bytes.byteLength);
1689
1689
  }
1690
1690
  switch (type) {
1691
1691
  case "uint8array":
@@ -2287,8 +2287,8 @@ var MAX_DOCUMENT_PART_BYTES = 25 * 1024 * 1024;
2287
2287
  // opc/zip-folders.ts
2288
2288
  var entryNames = (zip) => new Set(Object.keys(zip.files));
2289
2289
  function dropAddedFolders(zip, source3) {
2290
- for (const [name3, entry3] of Object.entries(zip.files))
2291
- if (entry3.dir && !source3.has(name3)) delete zip.files[name3];
2290
+ for (const [name3, entry4] of Object.entries(zip.files))
2291
+ if (entry4.dir && !source3.has(name3)) delete zip.files[name3];
2292
2292
  }
2293
2293
 
2294
2294
  // docx/save-modified.ts
@@ -2353,7 +2353,7 @@ var RPR_ORDER = [
2353
2353
  ];
2354
2354
  function orderChildren(parent, order) {
2355
2355
  const elements2 = Array.from(parent.childNodes).filter(isElement);
2356
- const rankOf = (name3) => order.findIndex((entry3) => typeof entry3 === "string" ? entry3 === name3 : entry3.includes(name3));
2356
+ const rankOf = (name3) => order.findIndex((entry4) => typeof entry4 === "string" ? entry4 === name3 : entry4.includes(name3));
2357
2357
  let previousRank = -1;
2358
2358
  const ranked = elements2.map((element5, index5) => {
2359
2359
  const rank7 = element5.namespaceURI === WORD_NS ? rankOf(element5.localName ?? "") : -1;
@@ -2361,7 +2361,7 @@ function orderChildren(parent, order) {
2361
2361
  return { element: element5, index: index5, rank: rank7 >= 0 ? rank7 : previousRank + 0.5 };
2362
2362
  });
2363
2363
  const sorted2 = [...ranked].sort((a2, b) => a2.rank - b.rank || a2.index - b.index);
2364
- if (sorted2.every((entry3, index5) => entry3.element === elements2[index5])) return;
2364
+ if (sorted2.every((entry4, index5) => entry4.element === elements2[index5])) return;
2365
2365
  for (const { element: element5 } of sorted2) parent.appendChild(element5);
2366
2366
  }
2367
2367
  var SECTPR_ORDER = [
@@ -2975,7 +2975,7 @@ function trackMoveRange(item2, moves) {
2975
2975
  const open2 = moves[range3.kind];
2976
2976
  if (range3.start) open2.push({ name: getW(item2, "name") ?? id5, id: id5 });
2977
2977
  else {
2978
- const index5 = open2.findIndex((entry3) => entry3.id === id5);
2978
+ const index5 = open2.findIndex((entry4) => entry4.id === id5);
2979
2979
  if (index5 >= 0) open2.splice(index5, 1);
2980
2980
  }
2981
2981
  return true;
@@ -3273,9 +3273,9 @@ function validItems(items) {
3273
3273
  return items.flatMap((item2) => {
3274
3274
  if (!item2 || typeof item2 !== "object") return [];
3275
3275
  const { display, value: value3 } = item2;
3276
- const [shown, entry3] = [entryText(display), entryText(value3)];
3277
- const text9 = shown ?? entry3;
3278
- return text9 === void 0 ? [] : [{ display: text9, value: entry3 ?? text9 }];
3276
+ const [shown, entry4] = [entryText(display), entryText(value3)];
3277
+ const text9 = shown ?? entry4;
3278
+ return text9 === void 0 ? [] : [{ display: text9, value: entry4 ?? text9 }];
3279
3279
  });
3280
3280
  }
3281
3281
  function validGlyph(glyph2) {
@@ -3452,8 +3452,8 @@ function topLevel(node4, container) {
3452
3452
  return current;
3453
3453
  }
3454
3454
  function pruneEmptyControls(flat) {
3455
- for (const entry3 of flat) {
3456
- let sdt = entry3.sdt;
3455
+ for (const entry4 of flat) {
3456
+ let sdt = entry4.sdt;
3457
3457
  while (sdt) {
3458
3458
  const content2 = sdtContent(sdt);
3459
3459
  const parent = sdt.parentNode;
@@ -3466,13 +3466,13 @@ function pruneEmptyControls(flat) {
3466
3466
  }
3467
3467
  }
3468
3468
  function placeBlocksById(doc, container, flat, blocks, nodes, anchor2) {
3469
- const oldSet = new Set(flat.map((entry3) => entry3.element));
3469
+ const oldSet = new Set(flat.map((entry4) => entry4.element));
3470
3470
  const keptInOrder = nodes.filter((node4) => oldSet.has(node4));
3471
- const documentOrder2 = flat.map((entry3) => entry3.element).filter((node4) => keptInOrder.includes(node4));
3471
+ const documentOrder2 = flat.map((entry4) => entry4.element).filter((node4) => keptInOrder.includes(node4));
3472
3472
  if (keptInOrder.some((node4, index5) => node4 !== documentOrder2[index5])) return false;
3473
3473
  const outputSet = new Set(nodes);
3474
- for (const entry3 of flat)
3475
- if (!outputSet.has(entry3.element)) entry3.element.parentNode?.removeChild(entry3.element);
3474
+ for (const entry4 of flat)
3475
+ if (!outputSet.has(entry4.element)) entry4.element.parentNode?.removeChild(entry4.element);
3476
3476
  pruneEmptyControls(flat);
3477
3477
  let previous;
3478
3478
  nodes.forEach((node4, index5) => {
@@ -3498,11 +3498,11 @@ function placeBlocksById(doc, container, flat, blocks, nodes, anchor2) {
3498
3498
  function syncBlockControls(doc, flat, blocks, nodes) {
3499
3499
  const bySdt = /* @__PURE__ */ new Map();
3500
3500
  const dropped = /* @__PURE__ */ new Map();
3501
- flat.forEach((entry3) => {
3502
- const block = blocks[nodes.indexOf(entry3.element)];
3503
- if (!entry3.sdt || !block) return;
3504
- if (block.contentControl && !bySdt.has(entry3.sdt)) bySdt.set(entry3.sdt, block);
3505
- dropped.set(entry3.sdt, (dropped.get(entry3.sdt) ?? true) && !block.contentControl);
3501
+ flat.forEach((entry4) => {
3502
+ const block = blocks[nodes.indexOf(entry4.element)];
3503
+ if (!entry4.sdt || !block) return;
3504
+ if (block.contentControl && !bySdt.has(entry4.sdt)) bySdt.set(entry4.sdt, block);
3505
+ dropped.set(entry4.sdt, (dropped.get(entry4.sdt) ?? true) && !block.contentControl);
3506
3506
  });
3507
3507
  for (const [sdt, block] of bySdt) patchContentControl(doc, sdt, block.contentControl);
3508
3508
  for (const [sdt, gone] of dropped) if (gone) unwrapContentControl(sdt);
@@ -3626,13 +3626,13 @@ function buildCommentsExtendedDocument(comments) {
3626
3626
  );
3627
3627
  const root = doc.documentElement;
3628
3628
  comments.forEach((comment, index5) => {
3629
- const entry3 = doc.createElementNS(W15_NS, "w15:commentEx");
3630
- entry3.setAttributeNS(W15_NS, "w15:paraId", paraIdFor(comment.id, index5));
3631
- if (comment.resolved) entry3.setAttributeNS(W15_NS, "w15:done", "1");
3629
+ const entry4 = doc.createElementNS(W15_NS, "w15:commentEx");
3630
+ entry4.setAttributeNS(W15_NS, "w15:paraId", paraIdFor(comment.id, index5));
3631
+ if (comment.resolved) entry4.setAttributeNS(W15_NS, "w15:done", "1");
3632
3632
  const parentIndex = comments.findIndex((c2) => c2.id === comment.parentId);
3633
3633
  if (parentIndex >= 0)
3634
- entry3.setAttributeNS(W15_NS, "w15:paraIdParent", paraIdFor(comment.parentId, parentIndex));
3635
- root.appendChild(entry3);
3634
+ entry4.setAttributeNS(W15_NS, "w15:paraIdParent", paraIdFor(comment.parentId, parentIndex));
3635
+ root.appendChild(entry4);
3636
3636
  });
3637
3637
  return doc;
3638
3638
  }
@@ -3906,12 +3906,12 @@ function linearToSrgb255(linear) {
3906
3906
  // color/hex-rgb.ts
3907
3907
  function parseArgbHex(hex4) {
3908
3908
  const clean6 = hex4.replace(/^#/, "");
3909
- const rgb7 = clean6.length === 8 ? clean6.slice(2) : clean6;
3910
- if (!/^[0-9a-fA-F]{6}$/.test(rgb7)) return void 0;
3911
- return [0, 2, 4].map((i2) => parseInt(rgb7.slice(i2, i2 + 2), 16));
3909
+ const rgb8 = clean6.length === 8 ? clean6.slice(2) : clean6;
3910
+ if (!/^[0-9a-fA-F]{6}$/.test(rgb8)) return void 0;
3911
+ return [0, 2, 4].map((i2) => parseInt(rgb8.slice(i2, i2 + 2), 16));
3912
3912
  }
3913
3913
  var clamp255 = (v) => Math.max(0, Math.min(255, v));
3914
- var rgbToUpperHex = (rgb7) => `#${rgb7.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
3914
+ var rgbToUpperHex = (rgb8) => `#${rgb8.map((v) => clamp255(Math.round(v)).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
3915
3915
 
3916
3916
  // color/theme-palette.ts
3917
3917
  function themePaletteVariantLuminance(variant) {
@@ -3920,9 +3920,9 @@ function themePaletteVariantLuminance(variant) {
3920
3920
  return variant.kind === "lighter" ? { lumMod, lumOff: fraction } : { lumMod };
3921
3921
  }
3922
3922
  function applyThemePaletteVariant(hex4, variant) {
3923
- const rgb7 = hexToRgbChannels(hex4);
3924
- if (!rgb7) return hex4;
3925
- const { h: h2, s, l } = rgbToHsl(rgb7.r, rgb7.g, rgb7.b);
3923
+ const rgb8 = hexToRgbChannels(hex4);
3924
+ if (!rgb8) return hex4;
3925
+ const { h: h2, s, l } = rgbToHsl(rgb8.r, rgb8.g, rgb8.b);
3926
3926
  const { lumMod, lumOff } = themePaletteVariantLuminance(variant);
3927
3927
  const next = hslToRgb(h2, s, l * lumMod + (lumOff ?? 0), (value3) => Math.floor(value3 + 1e-6));
3928
3928
  return `#${toHex(next.r)}${toHex(next.g)}${toHex(next.b)}`.toLowerCase();
@@ -4563,8 +4563,8 @@ function patchGrid(doc, node4, table4) {
4563
4563
  function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, writeNested) {
4564
4564
  if (table4.rows.some((row3) => !row3.length || row3.some((cell2) => !cell2.paragraphs.length)))
4565
4565
  throw new Error("Every table row needs a cell and every cell a paragraph.");
4566
- const oldRows = flatRows(node4).map((entry3) => entry3.element);
4567
- const oldCells = oldRows.map((tr) => flatCells(tr).map((entry3) => entry3.element));
4566
+ const oldRows = flatRows(node4).map((entry4) => entry4.element);
4567
+ const oldCells = oldRows.map((tr) => flatCells(tr).map((entry4) => entry4.element));
4568
4568
  const cellById = /* @__PURE__ */ new Map();
4569
4569
  const paragraphById = /* @__PURE__ */ new Map();
4570
4570
  base3.rows.forEach(
@@ -4575,8 +4575,8 @@ function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, repla
4575
4575
  if (id5) cellById.set(id5, { tc, model: cell2, row: ri });
4576
4576
  const flat = flatCellParagraphs(tc);
4577
4577
  cell2.paragraphs.forEach((model2, pi) => {
4578
- const entry3 = flat[pi];
4579
- if (entry3) paragraphById.set(model2.id, { element: entry3.element, model: model2 });
4578
+ const entry4 = flat[pi];
4579
+ if (entry4) paragraphById.set(model2.id, { element: entry4.element, model: model2 });
4580
4580
  });
4581
4581
  })
4582
4582
  );
@@ -4607,7 +4607,7 @@ function writeRestructuredTable(doc, table4, node4, base3, writeParagraph, repla
4607
4607
  const props = buildCellProperties(doc, cell2);
4608
4608
  if (props) tc.insertBefore(props, tc.firstChild);
4609
4609
  }
4610
- const oldParagraphs = reuse ? flatCellParagraphs(tc).map((entry3) => entry3.element) : [];
4610
+ const oldParagraphs = reuse ? flatCellParagraphs(tc).map((entry4) => entry4.element) : [];
4611
4611
  const owned = new Set(oldParagraphs);
4612
4612
  const nextParagraphs = cell2.paragraphs.map((paragraph2) => {
4613
4613
  const found = paragraphById.get(paragraph2.id);
@@ -4641,19 +4641,19 @@ function tableGrid(table4) {
4641
4641
  const line3 = new Array(columns2);
4642
4642
  let col = 0;
4643
4643
  cells3.forEach((cell2, index5) => {
4644
- const entry3 = { cell: cell2, row: row3, index: index5, col, span: spanOf(cell2) };
4645
- for (let k = 0; k < entry3.span; k++) line3[col + k] = entry3;
4646
- col += entry3.span;
4647
- placed.push(entry3);
4644
+ const entry4 = { cell: cell2, row: row3, index: index5, col, span: spanOf(cell2) };
4645
+ for (let k = 0; k < entry4.span; k++) line3[col + k] = entry4;
4646
+ col += entry4.span;
4647
+ placed.push(entry4);
4648
4648
  });
4649
4649
  rows.push(placed);
4650
4650
  cover.push(line3);
4651
4651
  }
4652
4652
  const grid = { columns: columns2, rows, cover };
4653
- for (const entry3 of rows.flat())
4654
- if (entry3.cell.verticalMerge === "continue") {
4655
- const above = entry3.row > 0 ? cover[entry3.row - 1]?.[entry3.col] : void 0;
4656
- if (!above || above.col !== entry3.col || above.span !== entry3.span) return void 0;
4653
+ for (const entry4 of rows.flat())
4654
+ if (entry4.cell.verticalMerge === "continue") {
4655
+ const above = entry4.row > 0 ? cover[entry4.row - 1]?.[entry4.col] : void 0;
4656
+ if (!above || above.col !== entry4.col || above.span !== entry4.span) return void 0;
4657
4657
  if (!above.cell.verticalMerge) return void 0;
4658
4658
  }
4659
4659
  return grid;
@@ -4744,7 +4744,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
4744
4744
  (row3) => reshaped && row3.length !== width || row3.some((cell2) => !cell2.paragraphs.length)
4745
4745
  ))
4746
4746
  throw new Error("Tables must contain rectangular rows and at least one paragraph per cell.");
4747
- const oldRows = flatRows(node4).map((entry3) => entry3.element);
4747
+ const oldRows = flatRows(node4).map((entry4) => entry4.element);
4748
4748
  const sourceById = /* @__PURE__ */ new Map();
4749
4749
  base3?.rows.forEach(
4750
4750
  (row3, ri) => row3.forEach((cell2, ci) => {
@@ -4776,7 +4776,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
4776
4776
  if (sourceRow !== void 0) usedRows.add(sourceRow);
4777
4777
  rowSources.push(sourceRow);
4778
4778
  const tr = sourceRow === void 0 ? makeW(doc, "tr") : expectDefined(oldRows[sourceRow], `table row ${sourceRow}`);
4779
- const oldCells = flatCells(tr).map((entry3) => entry3.element);
4779
+ const oldCells = flatCells(tr).map((entry4) => entry4.element);
4780
4780
  patchRowProperties(
4781
4781
  doc,
4782
4782
  tr,
@@ -4803,7 +4803,7 @@ function writeTable(doc, table4, node4, base3, writeParagraph, replaceSlots2, ne
4803
4803
  patchCellMargins(doc, tc, cell2.margins, source3?.model.margins);
4804
4804
  patchCellVerticalAlignment(doc, tc, cell2.verticalAlign, source3?.model.verticalAlign);
4805
4805
  const flatParagraphs = flatCellParagraphs(tc);
4806
- const oldParagraphs = flatParagraphs.map((entry3) => entry3.element);
4806
+ const oldParagraphs = flatParagraphs.map((entry4) => entry4.element);
4807
4807
  const nextParagraphs = cell2.paragraphs.map((paragraph2) => {
4808
4808
  const index5 = source3?.paragraphs.findIndex((p) => p.id === paragraph2.id) ?? -1;
4809
4809
  return writeParagraph(
@@ -6279,10 +6279,10 @@ var APPLIED = /* @__PURE__ */ new Set([
6279
6279
  ]);
6280
6280
  function resolveDrawingColor(color4, theme3, options2) {
6281
6281
  const base3 = baseHex(color4, theme3);
6282
- const rgb7 = base3 ? hexToRgbChannels(base3) : null;
6283
- if (!rgb7) return void 0;
6282
+ const rgb8 = base3 ? hexToRgbChannels(base3) : null;
6283
+ if (!rgb8) return void 0;
6284
6284
  if (options2?.transformOrder === "document") {
6285
- const value3 = orderedColorTransforms(rgb7, color4.transforms);
6285
+ const value3 = orderedColorTransforms(rgb8, color4.transforms);
6286
6286
  const round6 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
6287
6287
  return {
6288
6288
  hex: `#${toHex(round6(value3.r))}${toHex(round6(value3.g))}${toHex(round6(value3.b))}`,
@@ -6292,9 +6292,9 @@ function resolveDrawingColor(color4, theme3, options2) {
6292
6292
  )
6293
6293
  };
6294
6294
  }
6295
- let { r, g: g2, b } = rgb7;
6296
- const find3 = (name3) => color4.transforms.find((entry3) => entry3.name === name3)?.value;
6297
- const has = (name3) => color4.transforms.some((entry3) => entry3.name === name3);
6295
+ let { r, g: g2, b } = rgb8;
6296
+ const find3 = (name3) => color4.transforms.find((entry4) => entry4.name === name3)?.value;
6297
+ const has = (name3) => color4.transforms.some((entry4) => entry4.name === name3);
6298
6298
  if (has("comp")) {
6299
6299
  const hsl = rgbToHsl(r, g2, b);
6300
6300
  ({ r, g: g2, b } = hslToRgb((hsl.h + 180) % 360, hsl.s, hsl.l));
@@ -6345,7 +6345,7 @@ function resolveDrawingColor(color4, theme3, options2) {
6345
6345
  return {
6346
6346
  hex: `#${toHex(r)}${toHex(g2)}${toHex(b)}`,
6347
6347
  alpha,
6348
- unapplied: [...new Set(color4.transforms.map((entry3) => entry3.name))].filter(
6348
+ unapplied: [...new Set(color4.transforms.map((entry4) => entry4.name))].filter(
6349
6349
  (name3) => !APPLIED.has(name3)
6350
6350
  )
6351
6351
  };
@@ -8073,7 +8073,7 @@ function drawingEffectsXml(value3) {
8073
8073
  // drawingml/drawing-shadow.ts
8074
8074
  function resolveDrawingShadow(effects, theme3) {
8075
8075
  const effect = parseDrawingEffects(effects)?.effects.find(
8076
- (entry3) => entry3.kind === "outerShadow"
8076
+ (entry4) => entry4.kind === "outerShadow"
8077
8077
  );
8078
8078
  return effect?.kind === "outerShadow" ? resolveDrawingOuterShadow(effect, theme3) : void 0;
8079
8079
  }
@@ -9194,7 +9194,7 @@ function appendInSchemaOrder(parent, order, entries) {
9194
9194
  const index5 = order.indexOf(name3);
9195
9195
  return index5 < 0 ? order.length : index5;
9196
9196
  };
9197
- entries.map((entry3, index5) => ({ entry: entry3, index: index5 })).sort((a2, b) => rank7(a2.entry.name) - rank7(b.entry.name) || a2.index - b.index).forEach(({ entry: entry3 }) => parent.appendChild(entry3.node));
9197
+ entries.map((entry4, index5) => ({ entry: entry4, index: index5 })).sort((a2, b) => rank7(a2.entry.name) - rank7(b.entry.name) || a2.index - b.index).forEach(({ entry: entry4 }) => parent.appendChild(entry4.node));
9198
9198
  }
9199
9199
  function setBoolean(element5, name3, value3) {
9200
9200
  if (value3 !== void 0) element5.setAttribute(name3, value3 ? "1" : "0");
@@ -15945,9 +15945,9 @@ function gd14(name3, formula2) {
15945
15945
  return { name: name3, formula: formula2, args: parts.slice(1) };
15946
15946
  }
15947
15947
  function parseGdTable(table4) {
15948
- return table4.trim().split(/[\n;]/).filter((entry3) => entry3.length > 0).map((entry3) => {
15949
- const sep = entry3.indexOf("|");
15950
- return gd14(entry3.slice(0, sep), entry3.slice(sep + 1));
15948
+ return table4.trim().split(/[\n;]/).filter((entry4) => entry4.length > 0).map((entry4) => {
15949
+ const sep = entry4.indexOf("|");
15950
+ return gd14(entry4.slice(0, sep), entry4.slice(sep + 1));
15951
15951
  });
15952
15952
  }
15953
15953
  var GEAR9_GD_TABLE = `
@@ -19302,9 +19302,9 @@ function isContentType(nodeType) {
19302
19302
  function buildDataModel(nodes, connections2) {
19303
19303
  const flat = [];
19304
19304
  collectNodes(nodes, void 0, flat);
19305
- const content2 = flat.filter((entry3) => isContentType(entry3.node.nodeType));
19306
- const contentIds = new Set(content2.map((entry3) => entry3.node.id));
19307
- const docId = content2.find((entry3) => entry3.parentId && !contentIds.has(entry3.parentId))?.parentId ?? "__doc__";
19305
+ const content2 = flat.filter((entry4) => isContentType(entry4.node.nodeType));
19306
+ const contentIds = new Set(content2.map((entry4) => entry4.node.id));
19307
+ const docId = content2.find((entry4) => entry4.parentId && !contentIds.has(entry4.parentId))?.parentId ?? "__doc__";
19308
19308
  const doc = { id: docId, type: "doc", children: [] };
19309
19309
  const byId2 = /* @__PURE__ */ new Map([[docId, doc]]);
19310
19310
  const cxnByChild = /* @__PURE__ */ new Map();
@@ -19613,9 +19613,9 @@ function parseAlgorithm(element5) {
19613
19613
  function parseShape2(element5) {
19614
19614
  const adj = {};
19615
19615
  const adjList = element5.children.find((child11) => child11.name === "adjLst");
19616
- for (const entry3 of adjList?.children ?? []) {
19617
- if (entry3.name === "adj") {
19618
- adj[Number(entry3.attrs.idx)] = Number(entry3.attrs.val);
19616
+ for (const entry4 of adjList?.children ?? []) {
19617
+ if (entry4.name === "adj") {
19618
+ adj[Number(entry4.attrs.idx)] = Number(entry4.attrs.val);
19619
19619
  }
19620
19620
  }
19621
19621
  const type = element5.attrs.type;
@@ -19730,8 +19730,8 @@ function parseStatement(element5, state) {
19730
19730
  };
19731
19731
  case "varLst": {
19732
19732
  const vars = /* @__PURE__ */ Object.create(null);
19733
- for (const entry3 of element5.children) {
19734
- vars[entry3.name] = entry3.attrs.val ?? "";
19733
+ for (const entry4 of element5.children) {
19734
+ vars[entry4.name] = entry4.attrs.val ?? "";
19735
19735
  }
19736
19736
  return { kind: "varLst", vars };
19737
19737
  }
@@ -20194,7 +20194,7 @@ function applyConstraint(node4, constraint) {
20194
20194
  }
20195
20195
  if (FONT_TYPES.has(constraint.refType)) {
20196
20196
  for (const target3 of targets) {
20197
- target3.deferred = target3.deferred.filter((entry3) => entry3.source !== constraint);
20197
+ target3.deferred = target3.deferred.filter((entry4) => entry4.source !== constraint);
20198
20198
  target3.deferred.push({
20199
20199
  source: constraint,
20200
20200
  type: constraint.type,
@@ -23497,17 +23497,17 @@ function equalise(sizes, starts, groups, caps) {
23497
23497
  function resolveEngineFonts(entries, metrics) {
23498
23498
  const { groups, caps } = buildLinks(entries);
23499
23499
  const starts = /* @__PURE__ */ new Map();
23500
- for (const entry3 of entries) {
23501
- starts.set(entry3.node, nodeFontBounds(entry3.node).start);
23500
+ for (const entry4 of entries) {
23501
+ starts.set(entry4.node, nodeFontBounds(entry4.node).start);
23502
23502
  }
23503
23503
  let resolved = /* @__PURE__ */ new Map();
23504
23504
  for (let round6 = 0; round6 < 4; round6++) {
23505
23505
  const previous = resolved;
23506
23506
  const refSize = (ref) => previous.get(ref) ?? starts.get(ref);
23507
23507
  const sizes = /* @__PURE__ */ new Map();
23508
- for (const entry3 of entries) {
23509
- const bounds3 = nodeFontBounds(entry3.node);
23510
- sizes.set(entry3.node, fitNodeFontPt(entry3.node, entry3.text, bounds3, metrics, refSize));
23508
+ for (const entry4 of entries) {
23509
+ const bounds3 = nodeFontBounds(entry4.node);
23510
+ sizes.set(entry4.node, fitNodeFontPt(entry4.node, entry4.text, bounds3, metrics, refSize));
23511
23511
  }
23512
23512
  equalise(sizes, starts, groups, caps);
23513
23513
  resolved = sizes;
@@ -23610,30 +23610,30 @@ function nodeTextFor(node4, ids, literal5, nodeById, fitNode = node4) {
23610
23610
 
23611
23611
  // diagram/engine/engine-fonts.ts
23612
23612
  var PX_PER_PT4 = 96 / 72;
23613
- function nodeTextOf(entry3, nodeById) {
23614
- const ids = sourceIdsOf(entry3.node);
23615
- for (const id5 of entry3.mergedIds ?? []) {
23613
+ function nodeTextOf(entry4, nodeById) {
23614
+ const ids = sourceIdsOf(entry4.node);
23615
+ for (const id5 of entry4.mergedIds ?? []) {
23616
23616
  if (!ids.includes(id5)) {
23617
23617
  ids.push(id5);
23618
23618
  }
23619
23619
  }
23620
23620
  return nodeTextFor(
23621
- entry3.node,
23621
+ entry4.node,
23622
23622
  ids,
23623
- entry3.rendered.literalText ?? entry3.rendered.text,
23623
+ entry4.rendered.literalText ?? entry4.rendered.text,
23624
23624
  nodeById,
23625
- entry3.textNode ?? entry3.node
23625
+ entry4.textNode ?? entry4.node
23626
23626
  );
23627
23627
  }
23628
23628
  function applyEngineFonts(collected, nodeById, fontName) {
23629
23629
  const texts = /* @__PURE__ */ new Map();
23630
23630
  const txBySource = /* @__PURE__ */ new Map();
23631
- for (const entry3 of collected) {
23632
- const text9 = nodeTextOf(entry3, nodeById);
23631
+ for (const entry4 of collected) {
23632
+ const text9 = nodeTextOf(entry4, nodeById);
23633
23633
  if (!text9) {
23634
23634
  continue;
23635
23635
  }
23636
- const fitNode = entry3.textNode ?? entry3.node;
23636
+ const fitNode = entry4.textNode ?? entry4.node;
23637
23637
  texts.set(fitNode, text9);
23638
23638
  const first3 = sourceIdsOf(fitNode)[0];
23639
23639
  if (first3 && fitNode.alg.type === "tx" && !txBySource.has(first3)) {
@@ -23839,7 +23839,7 @@ function runEngineLayout(smartArtData, containerBounds, nodes, palette, style4)
23839
23839
  smartArtData.colorTransform?.roleColors
23840
23840
  );
23841
23841
  applyEngineFonts(collected, nodeById, smartArtData.themeMinorFont);
23842
- const rendered = [...collected.map((entry3) => entry3.rendered), ...connectors2];
23842
+ const rendered = [...collected.map((entry4) => entry4.rendered), ...connectors2];
23843
23843
  if (rendered.length === 0 || !rendered.every(isFiniteGeometry)) {
23844
23844
  return void 0;
23845
23845
  }
@@ -24121,15 +24121,15 @@ function reconcileRegion(items, desired) {
24121
24121
  }
24122
24122
  let insertionOffset = 0;
24123
24123
  for (let affectedIndex = 0; affectedIndex < affected.length; affectedIndex++) {
24124
- const entry3 = affected[affectedIndex];
24124
+ const entry4 = affected[affectedIndex];
24125
24125
  const isLast = affectedIndex === affected.length - 1;
24126
- const take2 = isLast ? insertion.length - insertionOffset : Math.min(entry3.removed, insertion.length - insertionOffset);
24126
+ const take2 = isLast ? insertion.length - insertionOffset : Math.min(entry4.removed, insertion.length - insertionOffset);
24127
24127
  const allocated = insertion.slice(insertionOffset, insertionOffset + Math.max(0, take2));
24128
24128
  insertionOffset += Math.max(0, take2);
24129
- const original = texts[entry3.index];
24129
+ const original = texts[entry4.index];
24130
24130
  setItemText(
24131
- items[entry3.index],
24132
- original.slice(0, entry3.start) + allocated + original.slice(entry3.end)
24131
+ items[entry4.index],
24132
+ original.slice(0, entry4.start) + allocated + original.slice(entry4.end)
24133
24133
  );
24134
24134
  }
24135
24135
  }
@@ -24144,13 +24144,13 @@ function atoms(paragraphs) {
24144
24144
  const result2 = [];
24145
24145
  for (let paragraph2 = 0; paragraph2 < paragraphs.length; paragraph2++) {
24146
24146
  for (let item2 = 0; item2 < paragraphs[paragraph2].items.length; item2++) {
24147
- const entry3 = paragraphs[paragraph2].items[item2];
24148
- const text9 = itemText(entry3);
24147
+ const entry4 = paragraphs[paragraph2].items[item2];
24148
+ const text9 = itemText(entry4);
24149
24149
  if (text9 !== void 0) {
24150
24150
  for (let character = 0; character < text9.length; character++) {
24151
24151
  result2.push({ kind: "text", paragraph: paragraph2, item: item2, character });
24152
24152
  }
24153
- } else if (entry3.kind === "tab" || entry3.kind === "break") {
24153
+ } else if (entry4.kind === "tab" || entry4.kind === "break") {
24154
24154
  result2.push({ kind: "item", paragraph: paragraph2, item: item2 });
24155
24155
  }
24156
24156
  }
@@ -25253,7 +25253,7 @@ function diagramNodesInTreeOrder(data) {
25253
25253
  nodes.sort(
25254
25254
  (a2, b) => (order.get(a2.node.id) ?? Number.MAX_SAFE_INTEGER) - (order.get(b.node.id) ?? Number.MAX_SAFE_INTEGER) || a2.index - b.index
25255
25255
  );
25256
- return treeOrderDiagramNodes(nodes.map((entry3) => entry3.node));
25256
+ return treeOrderDiagramNodes(nodes.map((entry4) => entry4.node));
25257
25257
  }
25258
25258
 
25259
25259
  // diagram/edit/node-edit.ts
@@ -25568,7 +25568,7 @@ function ensure(parent, name3, namespace = NS.dgm) {
25568
25568
  }
25569
25569
  function writeDiagramFormatDefinition(source3, change) {
25570
25570
  if (!(change.kind === "colors" ? DIAGRAM_COLOR_ENTRIES : DIAGRAM_STYLE_ENTRIES).some(
25571
- (entry3) => entry3.id === change.value
25571
+ (entry4) => entry4.id === change.value
25572
25572
  ))
25573
25573
  throw new RangeError("Unknown SmartArt format preset.");
25574
25574
  const template2 = change.kind === "colors" ? buildFabricatedColorsXml(change.value) : buildFabricatedQuickStyleXml(change.value);
@@ -25584,7 +25584,7 @@ function writeDiagramFormatDefinition(source3, change) {
25584
25584
  root.setAttribute("uniqueId", `urn:ooxml-core/${change.kind}/${change.value}`);
25585
25585
  for (const label2 of children(root, "styleLbl", NS.dgm)) {
25586
25586
  const name3 = label2.getAttribute("name") ?? "";
25587
- const model2 = children(fresh, "styleLbl", NS.dgm).find((entry3) => entry3.getAttribute("name") === name3) ?? children(fresh, "styleLbl", NS.dgm)[0];
25587
+ const model2 = children(fresh, "styleLbl", NS.dgm).find((entry4) => entry4.getAttribute("name") === name3) ?? children(fresh, "styleLbl", NS.dgm)[0];
25588
25588
  if (change.kind === "colors") {
25589
25589
  for (const listName of ["fillClrLst", "linClrLst", "txFillClrLst"]) {
25590
25590
  const list3 = ensure(label2, listName);
@@ -26595,12 +26595,12 @@ function captureDiagramPictures(model2, dataXml2, dataParts, drawing) {
26595
26595
  id5 = `ooxmlDiagramPicture${index5}`;
26596
26596
  parts[id5] = part;
26597
26597
  }
26598
- const entry3 = { ...source3, fill: remapFill(source3.fill, id5) };
26598
+ const entry4 = { ...source3, fill: remapFill(source3.fill, id5) };
26599
26599
  const existing = pictures.findIndex(
26600
- (item2) => item2.nodeId === entry3.nodeId && (item2.role === entry3.role && item2.styleLabel === entry3.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry3.fill.relId)
26600
+ (item2) => item2.nodeId === entry4.nodeId && (item2.role === entry4.role && item2.styleLabel === entry4.styleLabel || !item2.role && !item2.styleLabel && item2.fill.relId === entry4.fill.relId)
26601
26601
  );
26602
- if (existing < 0) pictures.push(entry3);
26603
- else pictures[existing] = entry3;
26602
+ if (existing < 0) pictures.push(entry4);
26603
+ else pictures[existing] = entry4;
26604
26604
  };
26605
26605
  const root = parseXml(dataXml2).documentElement;
26606
26606
  const saved2 = root.getElementsByTagNameNS(DIAGRAM_PICTURE_SOURCE_NS, "picture");
@@ -26771,9 +26771,9 @@ function applyDiagramRoleColors(shape2, role, index5, minorFont) {
26771
26771
  function diagramLayoutData(input2) {
26772
26772
  const original = input2.source?.dataXml ? parseDiagramDataModel(input2.source.dataXml) : void 0;
26773
26773
  const nodes = input2.nodes.map((node4) => {
26774
- const point3 = original?.nodes.find((entry3) => entry3.modelId === node4.id);
26774
+ const point3 = original?.nodes.find((entry4) => entry4.modelId === node4.id);
26775
26775
  const presentation = original?.points.find(
26776
- (entry3) => entry3.type === "pres" && entry3.presAssocId === node4.id
26776
+ (entry4) => entry4.type === "pres" && entry4.presAssocId === node4.id
26777
26777
  );
26778
26778
  const customLayout = point3?.customLayout ?? presentation?.customLayout;
26779
26779
  const styleRole = point3?.presStyleLabel ?? presentation?.presStyleLabel;
@@ -26794,7 +26794,7 @@ function diagramLayoutData(input2) {
26794
26794
  });
26795
26795
  const connections2 = nodes.map((node4, index5) => {
26796
26796
  const connection = original?.connections.find(
26797
- (entry3) => entry3.destId === node4.id && (!entry3.type || entry3.type === "parOf")
26797
+ (entry4) => entry4.destId === node4.id && (!entry4.type || entry4.type === "parOf")
26798
26798
  );
26799
26799
  return {
26800
26800
  ...connection,
@@ -26919,7 +26919,7 @@ function previewDiagramLayout(input2) {
26919
26919
  result2.nodes.forEach((node4, index5) => {
26920
26920
  const shape2 = drawing2.shapes[index5];
26921
26921
  if (!shape2 || node4.kind !== "rect" || node4.literalText !== void 0) return;
26922
- const label2 = quickStyle?.labels.find((entry3) => entry3.name === node4.styleLabel);
26922
+ const label2 = quickStyle?.labels.find((entry4) => entry4.name === node4.styleLabel);
26923
26923
  if (label2) {
26924
26924
  shape2.style = label2;
26925
26925
  shape2.has3d = label2.requires3d ?? label2.hasShape3d;
@@ -26929,7 +26929,7 @@ function previewDiagramLayout(input2) {
26929
26929
  if (node4.layoutRole) shape2.sourceLayoutRole = node4.layoutRole;
26930
26930
  if (node4.styleLabel) shape2.sourceStyleLabel = node4.styleLabel;
26931
26931
  if (node4.foldedNodeIds?.length) shape2.foldedNodeIds = node4.foldedNodeIds;
26932
- const sourceNode = data.nodes.find((entry3) => entry3.id === node4.nodeId);
26932
+ const sourceNode = data.nodes.find((entry4) => entry4.id === node4.nodeId);
26933
26933
  if (input2.formatScheme && label2?.fill?.index && !sourceNode?.style?.fillColor && shape2.fill?.kind === "solid") {
26934
26934
  const fill2 = resolveThemeFillStyle(
26935
26935
  input2.formatScheme,
@@ -26938,10 +26938,10 @@ function previewDiagramLayout(input2) {
26938
26938
  );
26939
26939
  if (fill2) shape2.fill = fill2;
26940
26940
  }
26941
- const direct = originalModel?.nodes.find((entry3) => entry3.modelId === node4.nodeId);
26941
+ const direct = originalModel?.nodes.find((entry4) => entry4.modelId === node4.nodeId);
26942
26942
  const sourceIds = [node4.nodeId, ...node4.foldedNodeIds ?? []];
26943
26943
  const textNodes = sourceIds.flatMap((id5) => {
26944
- const source3 = input2.nodes.find((entry3) => entry3.id === id5);
26944
+ const source3 = input2.nodes.find((entry4) => entry4.id === id5);
26945
26945
  return source3 ? [source3] : [];
26946
26946
  });
26947
26947
  if (textNodes.length) shape2.text = diagramPreviewText(textNodes, node4.fontSize);
@@ -26955,7 +26955,7 @@ function previewDiagramLayout(input2) {
26955
26955
  colors?.labels.find((label3) => label3.name === node4.styleLabel),
26956
26956
  Math.max(
26957
26957
  0,
26958
- input2.nodes.findIndex((entry3) => entry3.id === contextNodeId)
26958
+ input2.nodes.findIndex((entry4) => entry4.id === contextNodeId)
26959
26959
  ),
26960
26960
  input2.minorFont
26961
26961
  );
@@ -27215,7 +27215,7 @@ async function resolveDiagramDrawingPart(hostPart, dataRelId, drawingExtensionRe
27215
27215
  const entries = await host.readRelationshipEntries(diagramRelationshipsPart(dataPath));
27216
27216
  if (!entries) return void 0;
27217
27217
  const drawing = entries.find(
27218
- (entry3) => (!drawingExtensionRelId || entry3.id.trim() === drawingExtensionRelId) && entry3.type.endsWith("/diagramDrawing")
27218
+ (entry4) => (!drawingExtensionRelId || entry4.id.trim() === drawingExtensionRelId) && entry4.type.endsWith("/diagramDrawing")
27219
27219
  );
27220
27220
  const id5 = drawing?.id.trim() ?? "";
27221
27221
  const target3 = drawing?.target.trim() ?? "";
@@ -27434,13 +27434,13 @@ async function loadDiagram(hostPart, relationshipIds, host) {
27434
27434
  diagramRelationshipsPart(drawingResolution.path)
27435
27435
  );
27436
27436
  const pictures = (entries ?? []).filter(
27437
- (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
27437
+ (entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
27438
27438
  );
27439
27439
  if (pictures.length)
27440
27440
  drawing.pictureParts = Object.fromEntries(
27441
- pictures.map((entry3) => [
27442
- entry3.id,
27443
- host.resolvePath(drawingResolution.path, entry3.target)
27441
+ pictures.map((entry4) => [
27442
+ entry4.id,
27443
+ host.resolvePath(drawingResolution.path, entry4.target)
27444
27444
  ])
27445
27445
  );
27446
27446
  } catch {
@@ -27464,8 +27464,8 @@ async function loadDiagram(hostPart, relationshipIds, host) {
27464
27464
  const entries = await host.readRelationshipEntries(diagramRelationshipsPart(owner));
27465
27465
  pictureParts = Object.fromEntries(
27466
27466
  (entries ?? []).filter(
27467
- (entry3) => entry3.type.endsWith("/image") && entry3.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry3.target)
27468
- ).map((entry3) => [entry3.id, host.resolvePath(owner, entry3.target)])
27467
+ (entry4) => entry4.type.endsWith("/image") && entry4.mode !== "External" && !/^[a-z][a-z0-9+.-]*:/i.test(entry4.target)
27468
+ ).map((entry4) => [entry4.id, host.resolvePath(owner, entry4.target)])
27469
27469
  );
27470
27470
  } catch {
27471
27471
  issues.push({
@@ -27977,8 +27977,8 @@ function hexToRgb(hex4) {
27977
27977
  ];
27978
27978
  }
27979
27979
  function rgbToHex(r, g2, b) {
27980
- const clamp4 = (v) => Math.max(0, Math.min(255, Math.round(v)));
27981
- return `#${clamp4(r).toString(16).padStart(2, "0")}${clamp4(g2).toString(16).padStart(2, "0")}${clamp4(b).toString(16).padStart(2, "0")}`;
27980
+ const clamp5 = (v) => Math.max(0, Math.min(255, Math.round(v)));
27981
+ return `#${clamp5(r).toString(16).padStart(2, "0")}${clamp5(g2).toString(16).padStart(2, "0")}${clamp5(b).toString(16).padStart(2, "0")}`;
27982
27982
  }
27983
27983
  function tint(hex4, amount) {
27984
27984
  const [r, g2, b] = hexToRgb(hex4);
@@ -28379,20 +28379,20 @@ function resolveChartStyleDefinition(style4, resolve3) {
28379
28379
  for (const name3 of CHART_STYLE_PARTS) {
28380
28380
  const source3 = style4.entries[name3];
28381
28381
  if (!source3) continue;
28382
- const entry3 = {};
28382
+ const entry4 = {};
28383
28383
  for (const key2 of ["fontSize", "bold", "italic", "underline"]) {
28384
28384
  const value3 = source3[key2];
28385
- if (value3 !== void 0) Object.assign(entry3, { [key2]: value3 });
28385
+ if (value3 !== void 0) Object.assign(entry4, { [key2]: value3 });
28386
28386
  }
28387
28387
  const line3 = fillColor(source3.line?.fill) ?? (source3.lineRef?.color && resolve3(source3.lineRef.color));
28388
28388
  const fill2 = fillColor(source3.fill) ?? (source3.fillRef?.color && resolve3(source3.fillRef.color));
28389
28389
  const color4 = (source3.textColor && resolve3(source3.textColor)) ?? (source3.fontRef?.color && resolve3(source3.fontRef.color));
28390
- if (color4 !== void 0) entry3.color = color4;
28391
- if (line3 !== void 0) entry3.lineColor = line3;
28392
- if (fill2 !== void 0) entry3.fillColor = fill2;
28390
+ if (color4 !== void 0) entry4.color = color4;
28391
+ if (line3 !== void 0) entry4.lineColor = line3;
28392
+ if (fill2 !== void 0) entry4.fillColor = fill2;
28393
28393
  if (source3.line?.widthEmu !== void 0 && source3.line.widthEmu > 0)
28394
- entry3.lineWidth = source3.line.widthEmu / 12700;
28395
- if (Object.keys(entry3).length) out[name3] = entry3;
28394
+ entry4.lineWidth = source3.line.widthEmu / 12700;
28395
+ if (Object.keys(entry4).length) out[name3] = entry4;
28396
28396
  }
28397
28397
  return Object.keys(out).length ? out : void 0;
28398
28398
  }
@@ -28628,13 +28628,13 @@ function writeChartAxisFormatting(root, formatting) {
28628
28628
  let changed = false;
28629
28629
  for (const part of ["categoryAxis", "valueAxis"]) {
28630
28630
  const axis = nodes[part];
28631
- const entry3 = formatting.entries[part];
28632
- if (!axis || !entry3) continue;
28631
+ const entry4 = formatting.entries[part];
28632
+ if (!axis || !entry4) continue;
28633
28633
  for (const [name3, flag5, value3, successors] of [
28634
28634
  [
28635
28635
  "delete",
28636
- entry3.axisVisible,
28637
- entry3.axisVisible ? "0" : "1",
28636
+ entry4.axisVisible,
28637
+ entry4.axisVisible ? "0" : "1",
28638
28638
  [
28639
28639
  "axPos",
28640
28640
  "majorGridlines",
@@ -28654,8 +28654,8 @@ function writeChartAxisFormatting(root, formatting) {
28654
28654
  ],
28655
28655
  [
28656
28656
  "tickLblPos",
28657
- entry3.labelsVisible,
28658
- entry3.labelsVisible ? "nextTo" : "none",
28657
+ entry4.labelsVisible,
28658
+ entry4.labelsVisible ? "nextTo" : "none",
28659
28659
  [
28660
28660
  "spPr",
28661
28661
  "txPr",
@@ -28675,7 +28675,7 @@ function writeChartAxisFormatting(root, formatting) {
28675
28675
  ]) {
28676
28676
  if (flag5 === void 0) continue;
28677
28677
  const key2 = name3 === "delete" ? "axisVisible" : "labelsVisible";
28678
- const revealingAxis = name3 === "tickLblPos" && entry3.axisVisible === true && previous?.entries[part]?.axisVisible === false;
28678
+ const revealingAxis = name3 === "tickLblPos" && entry4.axisVisible === true && previous?.entries[part]?.axisVisible === false;
28679
28679
  if (flag5 === previous?.entries[part]?.[key2] && !revealingAxis) continue;
28680
28680
  let node4 = first(axis, name3, NS.c);
28681
28681
  const old = node4?.getAttribute("val");
@@ -29703,12 +29703,12 @@ var LEGEND = /* @__PURE__ */ new Set(["legendPos", "legendEntry", "layout", "ove
29703
29703
  function parseLegend(context, element5) {
29704
29704
  reportUnmodelled(context, element5, LEGEND);
29705
29705
  const entries = children(element5, "legendEntry", NS.c).map(
29706
- (entry3) => assignDefined(
29706
+ (entry4) => assignDefined(
29707
29707
  {},
29708
29708
  {
29709
- index: cNumber(context, entry3, "idx"),
29710
- deleted: cBool(context, entry3, "delete"),
29711
- txPr: textProperties(entry3)
29709
+ index: cNumber(context, entry4, "idx"),
29710
+ deleted: cBool(context, entry4, "delete"),
29711
+ txPr: textProperties(entry4)
29712
29712
  }
29713
29713
  )
29714
29714
  );
@@ -30200,9 +30200,9 @@ function view3DXml(view) {
30200
30200
  function legendXml(context, legend) {
30201
30201
  if (!legend) return "";
30202
30202
  const entries = legend.entries.map(
30203
- (entry3) => elementXml(
30203
+ (entry4) => elementXml(
30204
30204
  "legendEntry",
30205
- valXml("idx", entry3.index) + valXml("delete", entry3.deleted) + textBodyXml(context, entry3.txPr)
30205
+ valXml("idx", entry4.index) + valXml("delete", entry4.deleted) + textBodyXml(context, entry4.txPr)
30206
30206
  )
30207
30207
  ).join("");
30208
30208
  return elementXml(
@@ -31187,12 +31187,12 @@ function chartSeriesEntries(space) {
31187
31187
  (group3, groupIndex) => group3.series.map((series, position3) => ({ group: group3, groupIndex, series, position: position3 }))
31188
31188
  );
31189
31189
  }
31190
- var chartSpaceSeries = (space) => chartSeriesEntries(space).map((entry3) => entry3.series);
31190
+ var chartSpaceSeries = (space) => chartSeriesEntries(space).map((entry4) => entry4.series);
31191
31191
  function chartSeriesEntryAt(space, index5) {
31192
31192
  const entries = chartSeriesEntries(space);
31193
- const entry3 = typeof index5 === "number" && Number.isSafeInteger(index5) ? entries.find((_, position3) => position3 === index5) : void 0;
31194
- if (!entry3) throw new RangeError(`No chart series at index ${String(index5)}`);
31195
- return entry3;
31193
+ const entry4 = typeof index5 === "number" && Number.isSafeInteger(index5) ? entries.find((_, position3) => position3 === index5) : void 0;
31194
+ if (!entry4) throw new RangeError(`No chart series at index ${String(index5)}`);
31195
+ return entry4;
31196
31196
  }
31197
31197
  function firstChartGroup(space) {
31198
31198
  const group3 = space.plotArea.groups[0];
@@ -32156,7 +32156,7 @@ async function appendChartExWorkbookData(bytes, before, after) {
32156
32156
  const defined = first(root, "definedNames", NS.x);
32157
32157
  const names = defined ? children(defined, "definedName", NS.x) : [];
32158
32158
  const resolve3 = (name3) => names.find(
32159
- (entry3) => entry3.getAttribute("name")?.toLowerCase() === name3.toLowerCase() && !entry3.hasAttribute("localSheetId")
32159
+ (entry4) => entry4.getAttribute("name")?.toLowerCase() === name3.toLowerCase() && !entry4.hasAttribute("localSheetId")
32160
32160
  )?.textContent ?? void 0;
32161
32161
  await writeChartWorkbookUpdates(bytes, chartExSpaceWorkbookWrites(before, resolve3), {
32162
32162
  atomic: true,
@@ -32274,8 +32274,8 @@ function summaryErrorBars(source3) {
32274
32274
  return out;
32275
32275
  }
32276
32276
  function summaryAnalysis(series) {
32277
- const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry3) => entry3 !== void 0);
32278
- const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry3) => entry3 !== void 0);
32277
+ const trendlines = (series.trendlines ?? []).map(summaryTrendline).filter((entry4) => entry4 !== void 0);
32278
+ const errorBars = (series.errorBars ?? []).map(summaryErrorBars).filter((entry4) => entry4 !== void 0);
32279
32279
  return {
32280
32280
  ...trendlines.length ? { trendlines } : {},
32281
32281
  ...errorBars.length ? { errorBars } : {}
@@ -32404,7 +32404,7 @@ function extraGroups(chartSpace, firstType) {
32404
32404
  const stockOverColumns = group3.kind === "stock" && firstType === "column";
32405
32405
  if (group3.is3D || !(["bar", "line", "area"].includes(group3.kind) || stockOverColumns)) continue;
32406
32406
  const type = group3.kind === "bar" ? "column" : group3.kind;
32407
- const entry3 = {
32407
+ const entry4 = {
32408
32408
  chartType: type,
32409
32409
  series: group3.series.map((source3, index5) => ({
32410
32410
  ...chartSummarySeries(
@@ -32418,13 +32418,13 @@ function extraGroups(chartSpace, firstType) {
32418
32418
  secondary: valueAxisId(chartSpace, group3.axisIds) !== primary
32419
32419
  };
32420
32420
  if (group3.grouping && GROUPINGS.has(group3.grouping))
32421
- entry3.grouping = group3.grouping;
32422
- if (type === "stock") entry3.stock = stockStyle(group3);
32421
+ entry4.grouping = group3.grouping;
32422
+ if (type === "stock") entry4.stock = stockStyle(group3);
32423
32423
  if (type === "column") {
32424
- if (group3.gapWidth !== void 0) entry3.barGapWidth = group3.gapWidth;
32425
- if (group3.overlap !== void 0) entry3.barOverlap = group3.overlap;
32424
+ if (group3.gapWidth !== void 0) entry4.barGapWidth = group3.gapWidth;
32425
+ if (group3.overlap !== void 0) entry4.barOverlap = group3.overlap;
32426
32426
  }
32427
- if (entry3.series.length) out.push(entry3);
32427
+ if (entry4.series.length) out.push(entry4);
32428
32428
  }
32429
32429
  return out;
32430
32430
  }
@@ -32572,9 +32572,9 @@ var TEXT_PARTS = [
32572
32572
  "legend",
32573
32573
  "dataLabel"
32574
32574
  ];
32575
- function inheritChartText(part, entry3, builtIn, root) {
32576
- if (!root || !TEXT_PARTS.includes(part)) return entry3;
32577
- const out = { ...entry3 };
32575
+ function inheritChartText(part, entry4, builtIn, root) {
32576
+ if (!root || !TEXT_PARTS.includes(part)) return entry4;
32577
+ const out = { ...entry4 };
32578
32578
  for (const key2 of TEXT_KEYS) {
32579
32579
  delete out[key2];
32580
32580
  const value3 = root[key2] ?? builtIn?.[key2];
@@ -32587,11 +32587,11 @@ function inheritChartText(part, entry3, builtIn, root) {
32587
32587
 
32588
32588
  // chart/render/chart-appearance.ts
32589
32589
  var chartPointsToPixels = (points3) => points3 * EMU_PER_POINT / EMU_PER_PIXEL;
32590
- function typeface(entry3, theme3) {
32591
- const name3 = entry3.typeface;
32590
+ function typeface(entry4, theme3) {
32591
+ const name3 = entry4.typeface;
32592
32592
  if (name3?.startsWith("+mj-")) return theme3.majorFont;
32593
32593
  if (name3?.startsWith("+mn-")) return theme3.minorFont;
32594
- return name3 ?? (entry3.fontRef?.index === "major" ? theme3.majorFont : entry3.fontRef?.index === "minor" ? theme3.minorFont : void 0);
32594
+ return name3 ?? (entry4.fontRef?.index === "major" ? theme3.majorFont : entry4.fontRef?.index === "minor" ? theme3.minorFont : void 0);
32595
32595
  }
32596
32596
  function chartAppearance(chart, theme3) {
32597
32597
  const defaults = builtInChartTextStyle(effectiveBuiltInChartStyle(chart.formatting));
@@ -32600,7 +32600,7 @@ function chartAppearance(chart, theme3) {
32600
32600
  const base3 = chart.styleDefinition?.entries[part];
32601
32601
  const direct = chart.formatting?.entries[part];
32602
32602
  if (!defaults[part] && !base3 && !direct) continue;
32603
- const entry3 = {
32603
+ const entry4 = {
32604
32604
  ...inheritChartText(
32605
32605
  part,
32606
32606
  { ...defaults[part], ...base3, sourceXml: base3?.sourceXml ?? "" },
@@ -32610,8 +32610,8 @@ function chartAppearance(chart, theme3) {
32610
32610
  ...direct,
32611
32611
  sourceXml: direct?.sourceXml ?? base3?.sourceXml ?? ""
32612
32612
  };
32613
- if (base3?.line || direct?.line) entry3.line = { ...base3?.line, ...direct?.line };
32614
- entries[part] = entry3;
32613
+ if (base3?.line || direct?.line) entry4.line = { ...base3?.line, ...direct?.line };
32614
+ entries[part] = entry4;
32615
32615
  }
32616
32616
  const scheme2 = chartColorScheme(theme3);
32617
32617
  const resolve3 = (color4) => resolveDrawingColor(
@@ -32624,19 +32624,19 @@ function chartAppearance(chart, theme3) {
32624
32624
  (color4) => drawingColorCss(resolve3(color4))
32625
32625
  ) ?? {};
32626
32626
  for (const part of CHART_STYLE_PARTS) {
32627
- const entry3 = entries[part];
32628
- if (!entry3) continue;
32629
- const family = typeface(entry3, theme3);
32630
- const shadow = resolveDrawingShadowXml(entry3.textEffectsXml, {
32627
+ const entry4 = entries[part];
32628
+ if (!entry4) continue;
32629
+ const family = typeface(entry4, theme3);
32630
+ const shadow = resolveDrawingShadowXml(entry4.textEffectsXml, {
32631
32631
  scheme: (name3) => scheme2[name3]
32632
32632
  });
32633
32633
  if (shadow) (out[part] ??= {}).textShadow = shadow;
32634
32634
  if (family) (out[part] ??= {}).typeface = family;
32635
- if (entry3.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry3.axisVisible;
32636
- if (entry3.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry3.labelsVisible;
32637
- if (entry3.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
32638
- if (entry3.fill?.kind === "gradient") {
32639
- (out[part] ??= {}).gradient = resolveChartGradient(entry3.fill, resolve3);
32635
+ if (entry4.axisVisible !== void 0) (out[part] ??= {}).axisVisible = entry4.axisVisible;
32636
+ if (entry4.labelsVisible !== void 0) (out[part] ??= {}).labelsVisible = entry4.labelsVisible;
32637
+ if (entry4.line?.widthEmu === 0) (out[part] ??= {}).lineWidth = 0;
32638
+ if (entry4.fill?.kind === "gradient") {
32639
+ (out[part] ??= {}).gradient = resolveChartGradient(entry4.fill, resolve3);
32640
32640
  }
32641
32641
  }
32642
32642
  return out;
@@ -32655,8 +32655,8 @@ function chartRunStyle(run2) {
32655
32655
  }
32656
32656
  function chartTitleText(chart, theme3) {
32657
32657
  const formatting = chart.formatting;
32658
- const entry3 = formatting?.entries.title;
32659
- const body = entry3?.textBody;
32658
+ const entry4 = formatting?.entries.title;
32659
+ const body = entry4?.textBody;
32660
32660
  if (!formatting || !body || body.text !== chart.title) return void 0;
32661
32661
  if (body.paragraphs.length === 1 && body.paragraphs[0].runs.length <= 1 && !body.text.includes("\n") && !body.paragraphs[0].lineSpacing && !body.paragraphs[0].spaceBefore && !body.paragraphs[0].spaceAfter)
32662
32662
  return void 0;
@@ -32669,7 +32669,7 @@ function chartTitleText(chart, theme3) {
32669
32669
  runs: paragraph2.runs.map((run2) => {
32670
32670
  const direct = {
32671
32671
  sourceXml: "",
32672
- ...entry3.textBodyStyle,
32672
+ ...entry4.textBodyStyle,
32673
32673
  ...chartRunStyle(paragraph2.defaultProperties ?? {}),
32674
32674
  ...chartRunStyle(run2)
32675
32675
  };
@@ -33245,14 +33245,14 @@ function strokeOf(line3, fallback, resolve3) {
33245
33245
  }
33246
33246
  function analysisView(source3, seriesColor, resolve3) {
33247
33247
  const plain4 = seriesColor === "none" || seriesColor.startsWith("url(") ? TEXT_COLOR : seriesColor;
33248
- const trendlines = (source3.trendlines ?? []).flatMap((entry3) => {
33249
- const { name: _name, line: line3, ...fit3 } = entry3;
33248
+ const trendlines = (source3.trendlines ?? []).flatMap((entry4) => {
33249
+ const { name: _name, line: line3, ...fit3 } = entry4;
33250
33250
  const fallback = { color: plain4, width: chartPointsToPixels(1.5), dash: "sysDot" };
33251
33251
  const stroke = strokeOf(line3, fallback, resolve3);
33252
33252
  return stroke ? [{ fit: fit3, stroke }] : [];
33253
33253
  });
33254
- const errorBars = (source3.errorBars ?? []).flatMap((entry3) => {
33255
- const { direction: direction2, barType, noEndCap, line: line3, ...amount } = entry3;
33254
+ const errorBars = (source3.errorBars ?? []).flatMap((entry4) => {
33255
+ const { direction: direction2, barType, noEndCap, line: line3, ...amount } = entry4;
33256
33256
  const stroke = strokeOf(line3, { color: TEXT_COLOR, width: chartPointsToPixels(0.75) }, resolve3);
33257
33257
  return stroke ? [{ direction: direction2, barType, amount, endCap: noEndCap !== true, stroke }] : [];
33258
33258
  });
@@ -34071,10 +34071,10 @@ function chartTargetDraftShapes(draft, target3) {
34071
34071
  for (const group3 of draft.plotArea.groups)
34072
34072
  if (group3.kind !== "surface") group3.dataLabels ??= { labels: [] };
34073
34073
  } else {
34074
- const entry3 = chartSeriesEntryAt(draft, target3.seriesIndex);
34075
- if (entry3.group.kind === "surface")
34074
+ const entry4 = chartSeriesEntryAt(draft, target3.seriesIndex);
34075
+ if (entry4.group.kind === "surface")
34076
34076
  throw new RangeError("Surface charts have no data labels");
34077
- entry3.series.dataLabels ??= { labels: [] };
34077
+ entry4.series.dataLabels ??= { labels: [] };
34078
34078
  }
34079
34079
  const labels = target3.seriesIndex === void 0 ? draft.plotArea.groups.flatMap((group3) => group3.dataLabels ? [group3.dataLabels] : []) : [chartSeriesEntryAt(draft, target3.seriesIndex).series.dataLabels].filter(
34080
34080
  (item2) => item2 !== void 0
@@ -34479,10 +34479,10 @@ function holders(draft, target3, create4 = false) {
34479
34479
  for (const group3 of draft.plotArea.groups)
34480
34480
  if (group3.kind !== "surface") group3.dataLabels ??= { labels: [] };
34481
34481
  } else {
34482
- const entry3 = chartSeriesEntryAt(draft, target3.seriesIndex);
34483
- if (entry3.group.kind === "surface")
34482
+ const entry4 = chartSeriesEntryAt(draft, target3.seriesIndex);
34483
+ if (entry4.group.kind === "surface")
34484
34484
  throw new RangeError("Surface charts have no data labels");
34485
- entry3.series.dataLabels ??= { labels: [] };
34485
+ entry4.series.dataLabels ??= { labels: [] };
34486
34486
  }
34487
34487
  }
34488
34488
  const labels = target3.seriesIndex === void 0 ? draft.plotArea.groups.flatMap((group3) => group3.dataLabels ? [group3.dataLabels] : []) : [chartSeriesEntryAt(draft, target3.seriesIndex).series.dataLabels].filter(
@@ -35772,8 +35772,8 @@ function chartSpaceDataSheet(space) {
35772
35772
  const firstEntry = entries[0];
35773
35773
  const first3 = firstEntry ? isXYChartKind(firstEntry.group.kind) ? firstEntry.series.xValues : firstEntry.series.categories : void 0;
35774
35774
  const valuesOf = (index5) => {
35775
- const entry3 = entries[index5];
35776
- const source3 = isXYChartKind(entry3.group.kind) ? entry3.series.yValues : entry3.series.values;
35775
+ const entry4 = entries[index5];
35776
+ const source3 = isXYChartKind(entry4.group.kind) ? entry4.series.yValues : entry4.series.values;
35777
35777
  return chartSourceValues(source3).map((value3) => typeof value3 === "number" ? value3 : null);
35778
35778
  };
35779
35779
  const longest = entries.reduce((max, _, index5) => Math.max(max, valuesOf(index5).length), 0);
@@ -35782,10 +35782,10 @@ function chartSpaceDataSheet(space) {
35782
35782
  const categories = Array.from({ length: count3 }, (_, index5) => labels[index5] ?? "");
35783
35783
  return {
35784
35784
  categories,
35785
- series: entries.map((entry3, index5) => {
35785
+ series: entries.map((entry4, index5) => {
35786
35786
  const values2 = valuesOf(index5);
35787
35787
  return {
35788
- name: entry3.series.tx?.text ?? entry3.series.tx?.value ?? String(chartSourceValues(entry3.series.tx?.reference)[0] ?? ""),
35788
+ name: entry4.series.tx?.text ?? entry4.series.tx?.value ?? String(chartSourceValues(entry4.series.tx?.reference)[0] ?? ""),
35789
35789
  values: Array.from({ length: count3 }, (_, point3) => values2[point3] ?? null)
35790
35790
  };
35791
35791
  })
@@ -37089,11 +37089,11 @@ async function dropDrawingPart(zip, relId, partName, ownerPart = HOST_PART) {
37089
37089
  const xml = await zip.file(relsPath)?.async("string");
37090
37090
  if (xml) {
37091
37091
  const document = parseXml(xml);
37092
- const entry3 = elements(document.documentElement).find(
37092
+ const entry4 = elements(document.documentElement).find(
37093
37093
  (node4) => node4.namespaceURI === NS.rels && node4.getAttribute("Id") === relId && node4.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
37094
37094
  );
37095
- if (entry3) {
37096
- document.documentElement.removeChild(entry3);
37095
+ if (entry4) {
37096
+ document.documentElement.removeChild(entry4);
37097
37097
  zip.file(relsPath, buildXml(document));
37098
37098
  }
37099
37099
  }
@@ -37798,7 +37798,7 @@ function parseFormField(ffData) {
37798
37798
  const result2 = parseInteger(getW(first2(typed, "result"), "val"));
37799
37799
  const fallback = parseInteger(getW(first2(typed, "default"), "val"));
37800
37800
  field2.dropDown = {
37801
- entries: elementChildren(typed).filter((child11) => named2(child11, "listEntry")).map((entry3) => getW(entry3, "val") ?? ""),
37801
+ entries: elementChildren(typed).filter((child11) => named2(child11, "listEntry")).map((entry4) => getW(entry4, "val") ?? ""),
37802
37802
  ...result2 !== void 0 && { result: result2 },
37803
37803
  ...fallback !== void 0 && { default: fallback }
37804
37804
  };
@@ -37835,7 +37835,7 @@ function kindElement(doc, field2) {
37835
37835
  const list3 = field2.dropDown ?? { entries: [] };
37836
37836
  if (list3.result !== void 0) add5(valued(doc, "result", String(list3.result)));
37837
37837
  if (list3.default !== void 0) add5(valued(doc, "default", String(list3.default)));
37838
- for (const entry3 of list3.entries) add5(valued(doc, "listEntry", entry3));
37838
+ for (const entry4 of list3.entries) add5(valued(doc, "listEntry", entry4));
37839
37839
  }
37840
37840
  return element5;
37841
37841
  }
@@ -39061,7 +39061,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
39061
39061
  };
39062
39062
  const boundWriteParagraph = (writeDoc, paragraph2, node4, base3) => writeParagraphImpl(writeDoc, paragraph2, node4, base3, allocator, spans3);
39063
39063
  const flat = flatBlocks(container);
39064
- const oldNodes = flat.map((entry3) => entry3.element);
39064
+ const oldNodes = flat.map((entry4) => entry4.element);
39065
39065
  const oldById = /* @__PURE__ */ new Map();
39066
39066
  original.forEach((block, index5) => {
39067
39067
  if (oldNodes[index5]) oldById.set(block.id, oldNodes[index5]);
@@ -39087,7 +39087,7 @@ function applyBlocks(doc, container, blocks, original, allocator, contentWidthTw
39087
39087
  ) : createTable(doc, block, allocator, contentWidthTwips, spans3)
39088
39088
  );
39089
39089
  }
39090
- const nested = flat.some((entry3) => entry3.sdt) || blocks.some((block) => block.contentControl);
39090
+ const nested = flat.some((entry4) => entry4.sdt) || blocks.some((block) => block.contentControl);
39091
39091
  if (nested && placeBlocksById(doc, container, flat, blocks, output2, anchor2)) return;
39092
39092
  replaceSlots(doc, container, oldNodes, output2, anchor2);
39093
39093
  }
@@ -39840,12 +39840,12 @@ function parseNum(element5) {
39840
39840
  const levelOverrides = dictionary();
39841
39841
  for (const override of children2(element5, "lvlOverride")) {
39842
39842
  const level4 = integer3(getW(override, "ilvl"), 0);
39843
- const entry3 = {};
39843
+ const entry4 = {};
39844
39844
  const startOverride = getW(first2(override, "startOverride"), "val");
39845
- if (startOverride !== void 0) entry3.startOverride = clampStart(integer3(startOverride, 1));
39845
+ if (startOverride !== void 0) entry4.startOverride = clampStart(integer3(startOverride, 1));
39846
39846
  const lvl = first2(override, "lvl");
39847
- if (lvl) entry3.lvl = parseNumberingLevel(lvl);
39848
- if (Object.keys(entry3).length) levelOverrides[level4] = entry3;
39847
+ if (lvl) entry4.lvl = parseNumberingLevel(lvl);
39848
+ if (Object.keys(entry4).length) levelOverrides[level4] = entry4;
39849
39849
  }
39850
39850
  return {
39851
39851
  id: id5,
@@ -44332,15 +44332,15 @@ function parseComments(commentsXml, extendedXml) {
44332
44332
  });
44333
44333
  if (extendedXml) {
44334
44334
  const extended2 = parseXml2(extendedXml);
44335
- for (const entry3 of Array.from(
44335
+ for (const entry4 of Array.from(
44336
44336
  extended2.getElementsByTagNameNS(W15_NS2, "commentEx")
44337
44337
  )) {
44338
- const paraId = entry3.getAttributeNS(W15_NS2, "paraId");
44338
+ const paraId = entry4.getAttributeNS(W15_NS2, "paraId");
44339
44339
  const comment = paraId && comments.find((c2) => c2.id === paraIdToCommentId.get(paraId));
44340
44340
  if (!comment) continue;
44341
- const done = entry3.getAttributeNS(W15_NS2, "done");
44341
+ const done = entry4.getAttributeNS(W15_NS2, "done");
44342
44342
  comment.resolved = done === "1" || done === "true";
44343
- const parentParaId = entry3.getAttributeNS(W15_NS2, "paraIdParent");
44343
+ const parentParaId = entry4.getAttributeNS(W15_NS2, "paraIdParent");
44344
44344
  const parentId = parentParaId && paraIdToCommentId.get(parentParaId);
44345
44345
  if (parentId) comment.parentId = parentId;
44346
44346
  }
@@ -44460,7 +44460,7 @@ async function readPlaceholderTexts(zip, relationships, model2) {
44460
44460
  });
44461
44461
  if (!named3.length) return;
44462
44462
  const relationship2 = [...relationships.values()].find(
44463
- (entry3) => entry3.type === GLOSSARY_DOCUMENT && entry3.mode === "Internal"
44463
+ (entry4) => entry4.type === GLOSSARY_DOCUMENT && entry4.mode === "Internal"
44464
44464
  );
44465
44465
  const part = relationship2 && zip.file(resolveInternalTarget(relationship2.target));
44466
44466
  if (!part) return;
@@ -45147,7 +45147,7 @@ function describeLegacy(site) {
45147
45147
  ...base3,
45148
45148
  type: "dropdown",
45149
45149
  value: index5 === void 0 ? "" : entries[index5],
45150
- choices: entries.map((entry3) => ({ display: entry3, value: entry3 })),
45150
+ choices: entries.map((entry4) => ({ display: entry4, value: entry4 })),
45151
45151
  ...blocked()
45152
45152
  };
45153
45153
  }
@@ -47142,8 +47142,8 @@ function sortKeys(value3) {
47142
47142
  if (value3 && typeof value3 === "object") {
47143
47143
  const out = {};
47144
47144
  for (const key2 of Object.keys(value3).sort()) {
47145
- const entry3 = value3[key2];
47146
- if (entry3 !== void 0) out[key2] = sortKeys(entry3);
47145
+ const entry4 = value3[key2];
47146
+ if (entry4 !== void 0) out[key2] = sortKeys(entry4);
47147
47147
  }
47148
47148
  return out;
47149
47149
  }
@@ -47185,7 +47185,7 @@ function styleCache(workbook) {
47185
47185
  }
47186
47186
  function compact(value3) {
47187
47187
  const out = {};
47188
- for (const [key2, entry3] of Object.entries(value3)) if (entry3 !== void 0) out[key2] = entry3;
47188
+ for (const [key2, entry4] of Object.entries(value3)) if (entry4 !== void 0) out[key2] = entry4;
47189
47189
  return out;
47190
47190
  }
47191
47191
  function patchStyle(base3, patch2) {
@@ -47389,10 +47389,10 @@ function hls240ToRgb({ h: h2, l, s }) {
47389
47389
  var parseHex = parseArgbHex;
47390
47390
  var toHexColor = rgbToUpperHex;
47391
47391
  function applyTint(hex4, tint2) {
47392
- const rgb7 = parseHex(hex4) ?? [0, 0, 0];
47393
- if (!tint2) return toHexColor(rgb7);
47392
+ const rgb8 = parseHex(hex4) ?? [0, 0, 0];
47393
+ if (!tint2) return toHexColor(rgb8);
47394
47394
  const t = Math.max(-1, Math.min(1, tint2));
47395
- const hls = rgbToHls240(...rgb7);
47395
+ const hls = rgbToHls240(...rgb8);
47396
47396
  const l = t < 0 ? Math.trunc(hls.l * (1 + t)) : Math.round(hls.l * (1 - t) + HLSMAX * t);
47397
47397
  return toHexColor(hls240ToRgb({ ...hls, l: Math.max(0, Math.min(HLSMAX, l)) }));
47398
47398
  }
@@ -48916,7 +48916,7 @@ function countDerived(pivot) {
48916
48916
  }
48917
48917
  var pivotAxisFieldNames = (pivot) => [
48918
48918
  ...pivot.fields,
48919
- ...derivedDateFields(pivot).filter((entry3) => !pivot.fields.includes(entry3.name)).map((entry3) => entry3.name)
48919
+ ...derivedDateFields(pivot).filter((entry4) => !pivot.fields.includes(entry4.name)).map((entry4) => entry4.name)
48920
48920
  ];
48921
48921
  function resolveDateGroups(pivot) {
48922
48922
  return (pivot.dateGroups ?? []).map((group3) => {
@@ -48927,11 +48927,11 @@ function resolveDateGroups(pivot) {
48927
48927
  });
48928
48928
  }
48929
48929
  function derivedDateLabels(pivot, name3) {
48930
- const entry3 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
48931
- if (!entry3) return void 0;
48932
- const [group3] = resolveDateGroups({ ...pivot, dateGroups: [entry3.group] });
48930
+ const entry4 = derivedDateFields(pivot).find((candidate) => candidate.name === name3);
48931
+ if (!entry4) return void 0;
48932
+ const [group3] = resolveDateGroups({ ...pivot, dateGroups: [entry4.group] });
48933
48933
  const range3 = { start: group3.start, end: group3.end };
48934
- return dateUnitLabels(entry3.unit, range3, dateGroupDays(group3), pivot.date1904 ?? false, group3);
48934
+ return dateUnitLabels(entry4.unit, range3, dateGroupDays(group3), pivot.date1904 ?? false, group3);
48935
48935
  }
48936
48936
  function validateDateGroups(pivot) {
48937
48937
  const groups = pivot.dateGroups;
@@ -48967,19 +48967,19 @@ function expandDateGroups(pivot) {
48967
48967
  const resolved = { ...pivot, dateGroups: groups };
48968
48968
  const derived2 = derivedDateFields(resolved);
48969
48969
  const date1904 = pivot.date1904 ?? false;
48970
- const tables = derived2.map((entry3) => {
48971
- const range3 = { start: entry3.group.start, end: entry3.group.end };
48972
- const days = dateGroupDays(entry3.group);
48973
- const labels = dateUnitLabels(entry3.unit, range3, days, date1904, entry3.group);
48970
+ const tables = derived2.map((entry4) => {
48971
+ const range3 = { start: entry4.group.start, end: entry4.group.end };
48972
+ const days = dateGroupDays(entry4.group);
48973
+ const labels = dateUnitLabels(entry4.unit, range3, days, date1904, entry4.group);
48974
48974
  return {
48975
- base: pivot.fields.indexOf(entry3.group.field),
48975
+ base: pivot.fields.indexOf(entry4.group.field),
48976
48976
  labels,
48977
- index: (serial) => dateUnitIndex(entry3.unit, range3, days, date1904, serial, labels.length)
48977
+ index: (serial) => dateUnitIndex(entry4.unit, range3, days, date1904, serial, labels.length)
48978
48978
  };
48979
48979
  });
48980
48980
  return {
48981
48981
  ...resolved,
48982
- fields: [...pivot.fields, ...derived2.map((entry3) => entry3.name)],
48982
+ fields: [...pivot.fields, ...derived2.map((entry4) => entry4.name)],
48983
48983
  records: pivot.records.map((record3) => [
48984
48984
  ...record3,
48985
48985
  ...tables.map((table4) => {
@@ -49024,7 +49024,7 @@ function validateFieldGroups(pivot) {
49024
49024
  if (!group3 || typeof group3 !== "object" || index5 < 0 || seen.has(group3.field) || ![group3.start, group3.end, group3.by].every(Number.isInteger) || group3.by < 1 || group3.start >= group3.end || groupBucketCount(group3) > MAX_BUCKETS)
49025
49025
  throw new Error("Choose a valid number group.");
49026
49026
  seen.add(group3.field);
49027
- if (pivot.pageFilter?.field === group3.field || pivot.valueField === group3.field || (pivot.additionalValues ?? []).some((measure5) => measure5.field === group3.field) || (pivot.dateFields ?? []).includes(group3.field) || (pivot.itemFilters ?? []).some((filter2) => filter2.field === group3.field))
49027
+ if (pivot.pageFilter?.field === group3.field || pivot.valueField === group3.field || (pivot.additionalValues ?? []).some((measure6) => measure6.field === group3.field) || (pivot.dateFields ?? []).includes(group3.field) || (pivot.itemFilters ?? []).some((filter2) => filter2.field === group3.field))
49028
49028
  throw new Error("A grouped field cannot also be a filter, date field or value field.");
49029
49029
  for (const record3 of pivot.records) {
49030
49030
  const value3 = record3[index5];
@@ -49089,17 +49089,17 @@ var PIVOT_SUBTOTAL_ORDER = [
49089
49089
  "varp"
49090
49090
  ];
49091
49091
  function fieldSubtotalFunctions(pivot, field2) {
49092
- const entry3 = pivot.fieldSubtotals?.find((item2) => item2.field === field2);
49093
- if (entry3) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry3.functions.includes(fn));
49092
+ const entry4 = pivot.fieldSubtotals?.find((item2) => item2.field === field2);
49093
+ if (entry4) return PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn));
49094
49094
  return field2 === pivot.rowField && pivot.subtotals === false ? [] : "auto";
49095
49095
  }
49096
49096
  function normalizedFieldSubtotals(entries) {
49097
- return entries.map((entry3) => {
49098
- if (!entry3 || !Array.isArray(entry3.functions) || entry3.functions.some((fn) => !PIVOT_SUBTOTAL_ORDER.includes(fn)))
49097
+ return entries.map((entry4) => {
49098
+ if (!entry4 || !Array.isArray(entry4.functions) || entry4.functions.some((fn) => !PIVOT_SUBTOTAL_ORDER.includes(fn)))
49099
49099
  throw new Error("Choose valid field subtotals.");
49100
49100
  return {
49101
- field: entry3.field,
49102
- functions: PIVOT_SUBTOTAL_ORDER.filter((fn) => entry3.functions.includes(fn))
49101
+ field: entry4.field,
49102
+ functions: PIVOT_SUBTOTAL_ORDER.filter((fn) => entry4.functions.includes(fn))
49103
49103
  };
49104
49104
  });
49105
49105
  }
@@ -49108,31 +49108,31 @@ function validateFieldSubtotals(pivot, axisFields) {
49108
49108
  if (entries === void 0) return;
49109
49109
  if (!Array.isArray(entries)) throw new Error("Choose valid field subtotals.");
49110
49110
  const seen = /* @__PURE__ */ new Set();
49111
- for (const entry3 of entries) {
49112
- if (!entry3 || typeof entry3 !== "object" || !axisFields.includes(entry3.field) || seen.has(entry3.field) || !Array.isArray(entry3.functions) || entry3.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry3.functions).size !== entry3.functions.length)
49111
+ for (const entry4 of entries) {
49112
+ if (!entry4 || typeof entry4 !== "object" || !axisFields.includes(entry4.field) || seen.has(entry4.field) || !Array.isArray(entry4.functions) || entry4.functions.some((fn) => !PIVOT_AGGREGATES.includes(fn)) || new Set(entry4.functions).size !== entry4.functions.length)
49113
49113
  throw new Error("Choose valid field subtotals.");
49114
- seen.add(entry3.field);
49114
+ seen.add(entry4.field);
49115
49115
  }
49116
49116
  }
49117
49117
 
49118
49118
  // xlsx/pivot/item-filters.ts
49119
49119
  function hiddenItemKeys(pivot, field2) {
49120
- const filter2 = pivot.itemFilters?.find((entry3) => entry3.field === field2);
49120
+ const filter2 = pivot.itemFilters?.find((entry4) => entry4.field === field2);
49121
49121
  return new Set((filter2?.hidden ?? []).map(pivotValueKey));
49122
49122
  }
49123
49123
  function filteredFields(pivot) {
49124
49124
  return new Set(
49125
- (pivot.itemFilters ?? []).filter((entry3) => entry3.hidden.length).map((entry3) => entry3.field)
49125
+ (pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length).map((entry4) => entry4.field)
49126
49126
  );
49127
49127
  }
49128
49128
  function applyPivotItemFilters(pivot) {
49129
- const active = (pivot.itemFilters ?? []).filter((entry3) => entry3.hidden.length);
49129
+ const active = (pivot.itemFilters ?? []).filter((entry4) => entry4.hidden.length);
49130
49130
  const range3 = pivot.dateFilter;
49131
49131
  if (!active.length && !range3) return pivot;
49132
49132
  const dateIndex = range3 ? pivot.fields.indexOf(range3.field) : -1;
49133
- const tests = active.map((entry3) => ({
49134
- index: pivot.fields.indexOf(entry3.field),
49135
- hidden: new Set(entry3.hidden.map(pivotValueKey))
49133
+ const tests = active.map((entry4) => ({
49134
+ index: pivot.fields.indexOf(entry4.field),
49135
+ hidden: new Set(entry4.hidden.map(pivotValueKey))
49136
49136
  }));
49137
49137
  return {
49138
49138
  ...pivot,
@@ -49192,11 +49192,11 @@ function pruneItemFilters(pivot) {
49192
49192
  var keyOf = (field2, item2) => `${field2}\0${pivotValueKey(item2)}`;
49193
49193
  function pivotItemLabeler(pivot) {
49194
49194
  const blank = pivotCaptions(pivot).blank;
49195
- const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry3) => [keyOf(entry3.field, entry3.item), entry3.name])) : void 0;
49195
+ const names = pivot.itemNames?.length ? new Map(pivot.itemNames.map((entry4) => [keyOf(entry4.field, entry4.item), entry4.name])) : void 0;
49196
49196
  return (field2, value3) => names?.get(keyOf(field2, value3)) ?? (value3 === null || value3 === "" ? blank : pivotItemLabel(value3));
49197
49197
  }
49198
49198
  var pivotItemName = (pivot, field2, item2) => pivot.itemNames?.find(
49199
- (entry3) => entry3.field === field2 && pivotValueKey(entry3.item) === pivotValueKey(item2)
49199
+ (entry4) => entry4.field === field2 && pivotValueKey(entry4.item) === pivotValueKey(item2)
49200
49200
  )?.name;
49201
49201
 
49202
49202
  // xlsx/pivot/page-filter.ts
@@ -49387,9 +49387,9 @@ function validatePivotFields(pivot) {
49387
49387
  if (extras.length > 0 && pivot.sourceXml && parseXml(pivot.sourceXml).documentElement.getAttribute("dataCaption") !== pivotCaptions(pivot).values)
49388
49388
  throw new Error("This PivotTable uses unsupported Values header captions.");
49389
49389
  if (!Array.isArray(extras) || extras.length > 15 || extras.some(
49390
- (measure5) => !measure5 || !pivot.fields.includes(measure5.field) || !PIVOT_AGGREGATES.includes(measure5.aggregate) || typeof measure5.caption !== "string" || !measure5.caption.trim() || measure5.caption.length > 255 || pivot.fields.some((field2) => field2.toLowerCase() === measure5.caption.toLowerCase())
49390
+ (measure6) => !measure6 || !pivot.fields.includes(measure6.field) || !PIVOT_AGGREGATES.includes(measure6.aggregate) || typeof measure6.caption !== "string" || !measure6.caption.trim() || measure6.caption.length > 255 || pivot.fields.some((field2) => field2.toLowerCase() === measure6.caption.toLowerCase())
49391
49391
  ) || new Set(
49392
- [pivot.valueCaption, ...extras.map((measure5) => measure5.caption)].map(
49392
+ [pivot.valueCaption, ...extras.map((measure6) => measure6.caption)].map(
49393
49393
  (caption) => caption?.toLowerCase()
49394
49394
  )
49395
49395
  ).size !== extras.length + 1)
@@ -49488,7 +49488,7 @@ function aggregateValues(records, field2, type) {
49488
49488
  const sum3 = numbers3.reduce((total2, value3) => total2 + value3, 0);
49489
49489
  return type === "average" ? sum3 / numbers3.length : sum3;
49490
49490
  }
49491
- var pivotMeasureNumber = (pivot, records, measure5) => aggregateValues(records, pivot.fields.indexOf(measure5.field), measure5.aggregate);
49491
+ var pivotMeasureNumber = (pivot, records, measure6) => aggregateValues(records, pivot.fields.indexOf(measure6.field), measure6.aggregate);
49492
49492
 
49493
49493
  // xlsx/pivot/columns.ts
49494
49494
  var SEPARATOR = "";
@@ -49525,17 +49525,17 @@ function pivotColumnEntries(pivot) {
49525
49525
  values: [...values2, child11[1].value],
49526
49526
  keys: [...keys, child11[0]]
49527
49527
  };
49528
- const entry3 = {
49528
+ const entry4 = {
49529
49529
  path: here.path,
49530
49530
  key: columnKey(here.keys, here.keys.length),
49531
49531
  values: here.values
49532
49532
  };
49533
- if (level4 === names.length - 1) entries.push({ kind: "leaf", ...entry3 });
49533
+ if (level4 === names.length - 1) entries.push({ kind: "leaf", ...entry4 });
49534
49534
  else {
49535
49535
  visit3(child11[1], level4 + 1, here.path, here.values, here.keys);
49536
49536
  const own3 = functions[level4];
49537
- if (own3 === "auto") entries.push({ kind: "subtotal", ...entry3 });
49538
- else for (const fn of own3) entries.push({ kind: "subtotal", ...entry3, fn });
49537
+ if (own3 === "auto") entries.push({ kind: "subtotal", ...entry4 });
49538
+ else for (const fn of own3) entries.push({ kind: "subtotal", ...entry4, fn });
49539
49539
  }
49540
49540
  }
49541
49541
  };
@@ -49558,7 +49558,7 @@ function pivotColumnHeaders(pivot, columns2, rowLabels2, valuesOnRows = false) {
49558
49558
  const levels = columns2.names.length;
49559
49559
  if (!levels)
49560
49560
  return [
49561
- [...rowLabels2, ...valuesOnRows ? [null] : measures2.map((measure5) => measure5.caption)]
49561
+ [...rowLabels2, ...valuesOnRows ? [null] : measures2.map((measure6) => measure6.caption)]
49562
49562
  ];
49563
49563
  const compact3 = pivot.layout === "compact";
49564
49564
  const labelColumns = rowLabels2.length;
@@ -49576,22 +49576,22 @@ function pivotColumnHeaders(pivot, columns2, rowLabels2, valuesOnRows = false) {
49576
49576
  grid[rows - 1][i2] = text9;
49577
49577
  });
49578
49578
  let previous = [];
49579
- columns2.entries.forEach((entry3, j) => {
49579
+ columns2.entries.forEach((entry4, j) => {
49580
49580
  const at3 = labelColumns + j * count3;
49581
- if (entry3.kind === "leaf") {
49582
- entry3.path.forEach((_index, level4) => {
49583
- const continued = entry3.path.slice(0, level4 + 1).every((p, i2) => p === previous[i2]);
49584
- if (!continued) grid[1 + level4][at3] = labelOf(columns2.names[level4], entry3.values[level4]);
49581
+ if (entry4.kind === "leaf") {
49582
+ entry4.path.forEach((_index, level4) => {
49583
+ const continued = entry4.path.slice(0, level4 + 1).every((p, i2) => p === previous[i2]);
49584
+ if (!continued) grid[1 + level4][at3] = labelOf(columns2.names[level4], entry4.values[level4]);
49585
49585
  });
49586
- previous = entry3.path;
49587
- if (count3 > 1) measures2.forEach((measure5, m) => grid[rows - 1][at3 + m] = measure5.caption);
49586
+ previous = entry4.path;
49587
+ if (count3 > 1) measures2.forEach((measure6, m) => grid[rows - 1][at3 + m] = measure6.caption);
49588
49588
  return;
49589
49589
  }
49590
- const row3 = entry3.kind === "grand" ? 1 : entry3.path.length;
49591
- const name3 = entry3.kind === "grand" ? "" : String(labelOf(columns2.names[entry3.path.length - 1], entry3.values.at(-1)));
49592
- measures2.forEach((measure5, m) => {
49593
- const custom2 = entry3.fn ? caps.functions[entry3.fn] : void 0;
49594
- grid[row3][at3 + m] = custom2 ? count3 === 1 ? `${name3} ${custom2}` : `${name3} ${custom2} of ${measure5.field}` : count3 === 1 ? entry3.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry3.kind === "grand" ? fillCaption(caps.measureTotal, measure5.caption) : `${name3} ${measure5.caption}`;
49590
+ const row3 = entry4.kind === "grand" ? 1 : entry4.path.length;
49591
+ const name3 = entry4.kind === "grand" ? "" : String(labelOf(columns2.names[entry4.path.length - 1], entry4.values.at(-1)));
49592
+ measures2.forEach((measure6, m) => {
49593
+ const custom2 = entry4.fn ? caps.functions[entry4.fn] : void 0;
49594
+ grid[row3][at3 + m] = custom2 ? count3 === 1 ? `${name3} ${custom2}` : `${name3} ${custom2} of ${measure6.field}` : count3 === 1 ? entry4.kind === "grand" ? caps.grandTotal : fillCaption(caps.subtotal, name3) : entry4.kind === "grand" ? fillCaption(caps.measureTotal, measure6.caption) : `${name3} ${measure6.caption}`;
49595
49595
  });
49596
49596
  });
49597
49597
  return grid;
@@ -49604,19 +49604,19 @@ function sharedPrefix(path4, previous) {
49604
49604
  function pivotColumnItemsXml(entries, measures2, remap) {
49605
49605
  const out = [];
49606
49606
  let previous = [];
49607
- for (const entry3 of entries)
49607
+ for (const entry4 of entries)
49608
49608
  for (let m = 0; m < measures2; m++) {
49609
- if (entry3.kind === "grand") {
49609
+ if (entry4.kind === "grand") {
49610
49610
  out.push(`<i${attrs3({ t: "grand", i: m || void 0 })}><x/></i>`);
49611
49611
  previous = [];
49612
49612
  continue;
49613
49613
  }
49614
- const group3 = entry3.path.map((index5, level4) => remap(level4, index5));
49615
- const path4 = entry3.kind === "leaf" && measures2 > 1 ? [...group3, m] : group3;
49614
+ const group3 = entry4.path.map((index5, level4) => remap(level4, index5));
49615
+ const path4 = entry4.kind === "leaf" && measures2 > 1 ? [...group3, m] : group3;
49616
49616
  const prefix3 = sharedPrefix(path4, previous);
49617
49617
  const xs = path4.slice(prefix3).map((index5) => `<x${attrs3({ v: index5 || void 0 })}/>`);
49618
49618
  out.push(
49619
- `<i${attrs3({ t: entry3.kind === "subtotal" ? entry3.fn ? PIVOT_SUBTOTALS[entry3.fn].item : "default" : void 0, r: prefix3 || void 0, i: m || void 0 })}>${xs.join("")}</i>`
49619
+ `<i${attrs3({ t: entry4.kind === "subtotal" ? entry4.fn ? PIVOT_SUBTOTALS[entry4.fn].item : "default" : void 0, r: prefix3 || void 0, i: m || void 0 })}>${xs.join("")}</i>`
49620
49620
  );
49621
49621
  previous = path4;
49622
49622
  }
@@ -49689,11 +49689,11 @@ function nestedPivotGrid(pivot) {
49689
49689
  let rowCount = 0;
49690
49690
  const width = dimensions3.width - labelColumns;
49691
49691
  const blanks = () => Array(width).fill(null);
49692
- const cells3 = (group3, rowFn, measure5) => columns2.entries.flatMap((entry3) => {
49693
- const records = entry3.kind === "grand" ? group3.records : group3.columns.get(entry3.key) ?? [];
49694
- const picked = measure5 === void 0 ? measures2 : [measures2[measure5]];
49695
- if (rowFn && entry3.fn && rowFn !== entry3.fn) return picked.map(() => null);
49696
- const fn = rowFn ?? entry3.fn;
49692
+ const cells3 = (group3, rowFn, measure6) => columns2.entries.flatMap((entry4) => {
49693
+ const records = entry4.kind === "grand" ? group3.records : group3.columns.get(entry4.key) ?? [];
49694
+ const picked = measure6 === void 0 ? measures2 : [measures2[measure6]];
49695
+ if (rowFn && entry4.fn && rowFn !== entry4.fn) return picked.map(() => null);
49696
+ const fn = rowFn ?? entry4.fn;
49697
49697
  return picked.map(
49698
49698
  (one2) => fn ? aggregateValues(records, pivot.fields.indexOf(one2.field), fn) : pivotMeasureNumber(pivot, records, one2)
49699
49699
  );
@@ -49713,17 +49713,17 @@ function nestedPivotGrid(pivot) {
49713
49713
  throw new Error("The PivotTable result is too large.");
49714
49714
  return;
49715
49715
  }
49716
- const [cells4, numbers3, entry3] = build3();
49716
+ const [cells4, numbers3, entry4] = build3();
49717
49717
  values2.push([...cells4, ...numbers3]);
49718
- rowEntries.push(entry3);
49718
+ rowEntries.push(entry4);
49719
49719
  indents.push(compact3 ? indent : 0);
49720
49720
  };
49721
- const entryOf = (indices, measure5, type) => ({
49721
+ const entryOf = (indices, measure6, type) => ({
49722
49722
  indices,
49723
- ...measure5 !== void 0 ? { measure: measure5 } : {},
49723
+ ...measure6 !== void 0 ? { measure: measure6 } : {},
49724
49724
  ...type ? { type } : {}
49725
49725
  });
49726
- const walk3 = (level4, group3, measure5, path4) => {
49726
+ const walk3 = (level4, group3, measure6, path4) => {
49727
49727
  const field2 = fieldOf(level4);
49728
49728
  const last = level4 === levels - 1;
49729
49729
  const repeated = Array.from(
@@ -49768,16 +49768,16 @@ function nestedPivotGrid(pivot) {
49768
49768
  if (last)
49769
49769
  return push3(level4, () => [
49770
49770
  labelCells(path4, leafShown(here.firsts), level4, text9),
49771
- cells3(child11, void 0, measure5),
49772
- entryOf(here.indices, measure5)
49771
+ cells3(child11, void 0, measure6),
49772
+ entryOf(here.indices, measure6)
49773
49773
  ]);
49774
49774
  if (!tabular)
49775
49775
  push3(level4, () => [
49776
49776
  labelCells(path4, repeated, level4, text9),
49777
- showsValue ? cells3(child11, void 0, measure5) : blanks(),
49778
- entryOf(here.indices, measure5)
49777
+ showsValue ? cells3(child11, void 0, measure6) : blanks(),
49778
+ entryOf(here.indices, measure6)
49779
49779
  ]);
49780
- walk3(level4 + 1, child11, measure5, here);
49780
+ walk3(level4 + 1, child11, measure6, here);
49781
49781
  if (field2 === depth - 1) return;
49782
49782
  const caption = String(text9);
49783
49783
  const subtotal = (title, fn, one2) => push3(level4, () => [
@@ -49787,21 +49787,21 @@ function nestedPivotGrid(pivot) {
49787
49787
  ]);
49788
49788
  if (own3 === "auto") {
49789
49789
  if (showsValue) return;
49790
- if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure5);
49790
+ if (valuesAbove) subtotal(fillCaption(caps.subtotal, caption), void 0, measure6);
49791
49791
  else measures2.forEach((one2, m) => subtotal(`${caption} ${one2.caption}`, void 0, m));
49792
49792
  } else
49793
49793
  for (const fn of own3)
49794
- if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure5);
49794
+ if (valuesAbove) subtotal(`${caption} ${caps.functions[fn]}`, fn, measure6);
49795
49795
  else
49796
49796
  measures2.forEach(
49797
49797
  (one2, m) => subtotal(`${caption} ${caps.functions[fn]} of ${one2.field}`, fn, m)
49798
49798
  );
49799
49799
  });
49800
49800
  };
49801
- const grand = (text9, measure5) => push3(0, () => [
49801
+ const grand = (text9, measure6) => push3(0, () => [
49802
49802
  compact3 ? [text9] : [text9, ...Array(levels - 1).fill(null)],
49803
- cells3(root, void 0, measure5),
49804
- entryOf([0], measure5, "grand")
49803
+ cells3(root, void 0, measure6),
49804
+ entryOf([0], measure6, "grand")
49805
49805
  ]);
49806
49806
  const build2 = () => {
49807
49807
  walk3(0, root, void 0, { labels: [], indices: [], firsts: [] });
@@ -49981,15 +49981,15 @@ function readPivotCaptionAttributes(root) {
49981
49981
  }
49982
49982
  function aggregateCaptionsOf(pivot) {
49983
49983
  const out = {};
49984
- for (const measure5 of [
49984
+ for (const measure6 of [
49985
49985
  { field: pivot.valueField, aggregate: pivot.aggregate, caption: pivot.valueCaption },
49986
49986
  ...pivot.additionalValues ?? []
49987
49987
  ]) {
49988
- const at3 = measure5.caption.indexOf(measure5.field);
49989
- if (at3 < 0 || measure5.caption === measure5.field) continue;
49990
- const template2 = `${measure5.caption.slice(0, at3)}{0}${measure5.caption.slice(at3 + measure5.field.length)}`;
49991
- if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure5.aggregate])
49992
- out[measure5.aggregate] = template2;
49988
+ const at3 = measure6.caption.indexOf(measure6.field);
49989
+ if (at3 < 0 || measure6.caption === measure6.field) continue;
49990
+ const template2 = `${measure6.caption.slice(0, at3)}{0}${measure6.caption.slice(at3 + measure6.field.length)}`;
49991
+ if (template2 !== ENGLISH_PIVOT_CAPTIONS.aggregates[measure6.aggregate])
49992
+ out[measure6.aggregate] = template2;
49993
49993
  }
49994
49994
  return Object.keys(out).length ? out : void 0;
49995
49995
  }
@@ -50385,17 +50385,17 @@ function settleSlicers(workbook, warn) {
50385
50385
  const book = workbook.slicers;
50386
50386
  if (!book) return;
50387
50387
  const pivotAt2 = (tabId, name3) => {
50388
- const sheet2 = workbook.sheets.find((entry3) => entry3.sheetId === tabId);
50389
- const pivot = sheet2?.pivotTables?.find((entry3) => entry3.name === name3);
50388
+ const sheet2 = workbook.sheets.find((entry4) => entry4.sheetId === tabId);
50389
+ const pivot = sheet2?.pivotTables?.find((entry4) => entry4.name === name3);
50390
50390
  return sheet2 && pivot ? { sheet: sheet2, pivot } : void 0;
50391
50391
  };
50392
50392
  const good = (cache3) => {
50393
50393
  if (cache3.source.kind === "table") {
50394
50394
  const { tableId, column: column3 } = cache3.source;
50395
50395
  for (const sheet2 of workbook.sheets) {
50396
- const table4 = sheet2.tables.find((entry3) => entry3.id === tableId);
50396
+ const table4 = sheet2.tables.find((entry4) => entry4.id === tableId);
50397
50397
  if (table4)
50398
- return table4.headerRow && !table4.filterNotModeled && table4.columns.some((entry3) => entry3.sourceId === column3);
50398
+ return table4.headerRow && !table4.filterNotModeled && table4.columns.some((entry4) => entry4.sourceId === column3);
50399
50399
  }
50400
50400
  return false;
50401
50401
  }
@@ -50496,7 +50496,7 @@ function pivotDateFieldsOf(workbook, sheet2, pivot) {
50496
50496
  ...pivot.moreColumnFields ?? [],
50497
50497
  pivot.pageFilter?.field,
50498
50498
  pivot.valueField,
50499
- ...(pivot.additionalValues ?? []).map((measure5) => measure5.field)
50499
+ ...(pivot.additionalValues ?? []).map((measure6) => measure6.field)
50500
50500
  ].filter((name3) => !!name3)
50501
50501
  );
50502
50502
  return pivotDateColumns(workbook, sheet2, pivot.source, pivot.fields, used);
@@ -50618,13 +50618,13 @@ function readDateGroups(fields, count3, names, dateFields, records, date1904) {
50618
50618
  for (const [base3, list3] of members4) {
50619
50619
  const field2 = names[base3] ?? "";
50620
50620
  const parent = first(fields[base3], "fieldGroup", NS.x);
50621
- const units3 = list3.map((entry3) => entry3.unit);
50621
+ const units3 = list3.map((entry4) => entry4.unit);
50622
50622
  if (!dateFields.includes(field2) || Number(att(parent, "par")) !== list3.at(-1).index || units3.some(
50623
50623
  (unit4, i2) => i2 > 0 && PIVOT_DATE_UNITS.indexOf(unit4) <= PIVOT_DATE_UNITS.indexOf(units3[i2 - 1])
50624
50624
  ))
50625
50625
  throw unsupported3("group parent");
50626
50626
  const ranges = list3.map(
50627
- (entry3) => first(first(entry3.node, "fieldGroup", NS.x), "rangePr", NS.x)
50627
+ (entry4) => first(first(entry4.node, "fieldGroup", NS.x), "rangePr", NS.x)
50628
50628
  );
50629
50629
  const sample = ranges[0];
50630
50630
  const autoStart = att(sample, "autoStart") !== "0";
@@ -50652,15 +50652,15 @@ function readDateGroups(fields, count3, names, dateFields, records, date1904) {
50652
50652
  if (!close(expected.start, start) || !close(expected.end, end))
50653
50653
  throw unsupported3("stale range");
50654
50654
  const localized = {};
50655
- for (const entry3 of list3) {
50656
- const labels = englishDateUnitLabels(entry3.unit, expected, dateGroupDays(group3), date1904);
50657
- const node4 = first(first(entry3.node, "fieldGroup", NS.x), "groupItems", NS.x);
50655
+ for (const entry4 of list3) {
50656
+ const labels = englishDateUnitLabels(entry4.unit, expected, dateGroupDays(group3), date1904);
50657
+ const node4 = first(first(entry4.node, "fieldGroup", NS.x), "groupItems", NS.x);
50658
50658
  const actual = children(node4, "s", NS.x).map((item2) => decodeEscapes(att(item2, "v") ?? ""));
50659
- const name3 = decodeEscapes(att(entry3.node, "name") ?? "");
50659
+ const name3 = decodeEscapes(att(entry4.node, "name") ?? "");
50660
50660
  if (!name3 || elements(node4).length !== actual.length || actual.length !== labels.length || actual.some((label2) => !label2) || new Set(actual).size !== actual.length)
50661
50661
  throw unsupported3("group items");
50662
- if (name3 !== dateGroupFieldName(entry3.unit, field2) || actual.some((l, i2) => l !== labels[i2]))
50663
- localized[entry3.unit] = { name: name3, labels: actual };
50662
+ if (name3 !== dateGroupFieldName(entry4.unit, field2) || actual.some((l, i2) => l !== labels[i2]))
50663
+ localized[entry4.unit] = { name: name3, labels: actual };
50664
50664
  }
50665
50665
  groups.push(Object.keys(localized).length ? { ...group3, localized } : group3);
50666
50666
  }
@@ -50737,9 +50737,9 @@ function readItemNames(tableFields2, names, shared) {
50737
50737
  // xlsx/pivot/values-axis.ts
50738
50738
  function remapPivotRowEntries(entries, axes) {
50739
50739
  return entries.map(
50740
- (entry3) => entry3.type === "grand" ? entry3 : {
50741
- ...entry3,
50742
- indices: entry3.indices.map((item2, axis) => {
50740
+ (entry4) => entry4.type === "grand" ? entry4 : {
50741
+ ...entry4,
50742
+ indices: entry4.indices.map((item2, axis) => {
50743
50743
  if (axes[axis] === null) return item2;
50744
50744
  const index5 = axes[axis]?.[item2];
50745
50745
  if (index5 === void 0) throw new Error("Invalid report row axis item");
@@ -50765,9 +50765,9 @@ function pivotValueIndex(root, axis) {
50765
50765
  }
50766
50766
  function pivotValueAxisItems(measures2) {
50767
50767
  const entries = [];
50768
- for (let measure5 = 0; measure5 < measures2; measure5++)
50768
+ for (let measure6 = 0; measure6 < measures2; measure6++)
50769
50769
  entries.push(
50770
- `<i${attrs3({ i: measure5 || void 0 })}><x${attrs3({ v: measure5 || void 0 })}/></i>`
50770
+ `<i${attrs3({ i: measure6 || void 0 })}><x${attrs3({ v: measure6 || void 0 })}/></i>`
50771
50771
  );
50772
50772
  return `<colItems count="${entries.length}">${entries.join("")}</colItems>`;
50773
50773
  }
@@ -50883,9 +50883,9 @@ function assertPageAxisItems(root, pivot, shared, cache3, recordRoot) {
50883
50883
  throw new Error("Invalid page column items");
50884
50884
  let previous = [];
50885
50885
  colItems.forEach((item2, i2) => {
50886
- const grand = i2 >= expected.length, measure5 = grand ? i2 - expected.length : i2 % measures2;
50886
+ const grand = i2 >= expected.length, measure6 = grand ? i2 - expected.length : i2 % measures2;
50887
50887
  const xs = children(item2, "x", NS.x).map((x) => integer5(x.getAttribute("v"), 0)), prefix3 = integer5(item2.getAttribute("r"), 0);
50888
- if (integer5(item2.getAttribute("i"), 0) !== measure5 || !Number.isInteger(prefix3) || prefix3 < 0 || prefix3 > Math.max(0, previous.length - 1))
50888
+ if (integer5(item2.getAttribute("i"), 0) !== measure6 || !Number.isInteger(prefix3) || prefix3 < 0 || prefix3 > Math.max(0, previous.length - 1))
50889
50889
  throw new Error("Invalid page column prefix");
50890
50890
  if (grand) {
50891
50891
  if (item2.getAttribute("t") !== "grand" || prefix3 !== 0 || xs.length !== 1 || xs[0] !== 0)
@@ -50927,12 +50927,12 @@ function readOne(workbook, source3, part) {
50927
50927
  const cachePart = source3.targetOfType(part, RELATIONSHIP_TYPES.pivotCacheDefinition);
50928
50928
  if (!cachePart) throw new Error("Missing pivot cache");
50929
50929
  const bookPart = source3.workbookPart();
50930
- const entry3 = children(
50930
+ const entry4 = children(
50931
50931
  first(parseXml(source3.text(bookPart)).documentElement, "pivotCaches", NS.x),
50932
50932
  "pivotCache",
50933
50933
  NS.x
50934
50934
  ).find((node4) => Number(att(node4, "cacheId")) === cacheId);
50935
- const relationship2 = entry3 && source3.rels(bookPart).get(relAttr(entry3, "id") ?? "");
50935
+ const relationship2 = entry4 && source3.rels(bookPart).get(relAttr(entry4, "id") ?? "");
50936
50936
  if (!relationship2 || source3.target(bookPart, relationship2) !== cachePart)
50937
50937
  throw new Error("Inconsistent pivot cache identity");
50938
50938
  const cache3 = parseXml(source3.text(cachePart)).documentElement;
@@ -50987,7 +50987,7 @@ function readOne(workbook, source3, part) {
50987
50987
  if (rowFields.length < 1 || dataFields.length < 1 || dataFields.length > 16 || !supportedPivotAxes(rowFields, colFields, dataFields.length, rowsAxis) || root.getAttribute("rowGrandTotals") === "0" || root.getAttribute("colGrandTotals") === "0")
50988
50988
  throw new Error("Unsupported pivot layout");
50989
50989
  const valueIndex = pivotValueIndex(root, rowsAxis ? rowFields : colFields);
50990
- const measure5 = dataFields[0];
50990
+ const measure6 = dataFields[0];
50991
50991
  const definition2 = elements(first(root, "extLst", NS.x) ?? parseXml("<root/>").documentElement).map(
50992
50992
  (extension2) => first(
50993
50993
  extension2,
@@ -51011,8 +51011,8 @@ function readOne(workbook, source3, part) {
51011
51011
  throw new Error("Unsupported Values axis item");
51012
51012
  }
51013
51013
  }
51014
- const aggregate3 = att(measure5, "subtotal") ?? "sum";
51015
- if (!PIVOT_AGGREGATES.includes(aggregate3) || att(measure5, "showDataAs") && att(measure5, "showDataAs") !== "normal")
51014
+ const aggregate3 = att(measure6, "subtotal") ?? "sum";
51015
+ if (!PIVOT_AGGREGATES.includes(aggregate3) || att(measure6, "showDataAs") && att(measure6, "showDataAs") !== "normal")
51016
51016
  throw new Error("Unsupported pivot aggregate");
51017
51017
  const names = fields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
51018
51018
  const axisNames = allFields.map((field2) => decodeEscapes(att(field2, "name") ?? ""));
@@ -51033,7 +51033,7 @@ function readOne(workbook, source3, part) {
51033
51033
  const rowDefinitions = realRows.map((field2) => tableFields2[Number(att(field2, "x"))]);
51034
51034
  const subtotalSettings = fieldSubtotalsOf(rowDefinitions, [row3, second, ...more]);
51035
51035
  const subtotal = !subtotalSettings.some(
51036
- (entry4) => entry4.field === row3 && entry4.functions.length === 0
51036
+ (entry5) => entry5.field === row3 && entry5.functions.length === 0
51037
51037
  );
51038
51038
  const repeat = realRows.map((field2) => {
51039
51039
  const node4 = tableFields2[Number(att(field2, "x"))];
@@ -51047,7 +51047,7 @@ function readOne(workbook, source3, part) {
51047
51047
  "fillDownLabels"
51048
51048
  ) === "1";
51049
51049
  });
51050
- if (repeat.some((entry4) => entry4 !== repeat[0])) throw new Error("Mixed field label repetition");
51050
+ if (repeat.some((entry5) => entry5 !== repeat[0])) throw new Error("Mixed field label repetition");
51051
51051
  const columnDefs = dataFields.length > 1 && !rowsAxis ? colFields.slice(0, -1) : colFields;
51052
51052
  const columnNames = columnDefs.map((field2) => axisNames[Number(att(field2, "x"))]);
51053
51053
  const hasColumn = columnDefs.length > 0;
@@ -51056,7 +51056,7 @@ function readOne(workbook, source3, part) {
51056
51056
  const columnDefinitions = columnDefs.map((field2) => tableFields2[Number(att(field2, "x"))]);
51057
51057
  if (columnNames.some((name3) => !name3)) throw new Error("Invalid pivot column fields");
51058
51058
  const columnSubtotals = fieldSubtotalsOf(columnDefinitions, columnNames);
51059
- const data = names[Number(att(measure5, "fld"))];
51059
+ const data = names[Number(att(measure6, "fld"))];
51060
51060
  const location = parseRange(att(first(root, "location", NS.x), "ref") ?? "");
51061
51061
  if (!row3 || !data || !location || hasColumn && !col || realRows.length === 2 && !second)
51062
51062
  throw new Error("Invalid pivot fields");
@@ -51098,7 +51098,7 @@ function readOne(workbook, source3, part) {
51098
51098
  if (dateFields.some((field2) => onAxis.has(field2)))
51099
51099
  throw new Error("Date fields used as rows, columns or values are preserved");
51100
51100
  const fieldSubtotals = [
51101
- ...subtotalSettings.filter((entry4) => entry4.field !== row3 || entry4.functions.length),
51101
+ ...subtotalSettings.filter((entry5) => entry5.field !== row3 || entry5.functions.length),
51102
51102
  ...columnSubtotals
51103
51103
  ];
51104
51104
  const pivot = {
@@ -51128,14 +51128,14 @@ function readOne(workbook, source3, part) {
51128
51128
  },
51129
51129
  valueField: data,
51130
51130
  aggregate: aggregate3,
51131
- valueCaption: decodeEscapes(att(measure5, "name") ?? data),
51131
+ valueCaption: decodeEscapes(att(measure6, "name") ?? data),
51132
51132
  ...dataFields.length > 1 ? {
51133
- additionalValues: dataFields.slice(1).map((measure6) => {
51134
- const field2 = names[Number(att(measure6, "fld"))];
51135
- const aggregate4 = att(measure6, "subtotal") ?? "sum";
51136
- if (!field2 || !PIVOT_AGGREGATES.includes(aggregate4) || att(measure6, "showDataAs") && att(measure6, "showDataAs") !== "normal")
51133
+ additionalValues: dataFields.slice(1).map((measure7) => {
51134
+ const field2 = names[Number(att(measure7, "fld"))];
51135
+ const aggregate4 = att(measure7, "subtotal") ?? "sum";
51136
+ if (!field2 || !PIVOT_AGGREGATES.includes(aggregate4) || att(measure7, "showDataAs") && att(measure7, "showDataAs") !== "normal")
51137
51137
  throw new Error("Unsupported pivot measure");
51138
- return { field: field2, aggregate: aggregate4, caption: decodeEscapes(att(measure6, "name") ?? field2) };
51138
+ return { field: field2, aggregate: aggregate4, caption: decodeEscapes(att(measure7, "name") ?? field2) };
51139
51139
  })
51140
51140
  } : {},
51141
51141
  fields: names,
@@ -51460,9 +51460,9 @@ async function openPackage(input2, limits) {
51460
51460
  async function readZipParts(input2, limits = {}) {
51461
51461
  const zip = await openPackage(input2, resolveLoadLimits(limits));
51462
51462
  const parts = /* @__PURE__ */ new Map();
51463
- for (const entry3 of Object.values(zip.files)) {
51464
- if (entry3.dir) continue;
51465
- parts.set(entry3.name.replace(/^\//, ""), await entry3.async("uint8array"));
51463
+ for (const entry4 of Object.values(zip.files)) {
51464
+ if (entry4.dir) continue;
51465
+ parts.set(entry4.name.replace(/^\//, ""), await entry4.async("uint8array"));
51466
51466
  }
51467
51467
  return parts;
51468
51468
  }
@@ -51586,10 +51586,10 @@ function splitSheetData(xml) {
51586
51586
  function parseColor(element5, palette) {
51587
51587
  if (!element5) return void 0;
51588
51588
  const color4 = {};
51589
- const rgb7 = att(element5, "rgb");
51589
+ const rgb8 = att(element5, "rgb");
51590
51590
  const theme3 = numAttr(element5, "theme");
51591
51591
  const indexed = numAttr(element5, "indexed");
51592
- if (rgb7 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb7)) color4.rgb = rgb7.toUpperCase();
51592
+ if (rgb8 && /^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/.test(rgb8)) color4.rgb = rgb8.toUpperCase();
51593
51593
  else if (theme3 !== void 0) color4.theme = theme3;
51594
51594
  else if (indexed !== void 0) {
51595
51595
  const override = palette?.[indexed];
@@ -51877,15 +51877,15 @@ function parseStyles(xml, warnings) {
51877
51877
  const xfId = numAttr(node4, "xfId") ?? 0;
51878
51878
  const name3 = att(node4, "name") ?? `Style ${xfId}`;
51879
51879
  const style4 = styleXfs[xfId] ?? fallback;
51880
- const entry3 = { name: name3, style: structuredClone(style4) };
51880
+ const entry4 = { name: name3, style: structuredClone(style4) };
51881
51881
  const builtinId = numAttr(node4, "builtinId");
51882
- if (builtinId !== void 0) entry3.builtinId = builtinId;
51882
+ if (builtinId !== void 0) entry4.builtinId = builtinId;
51883
51883
  if (!namesByXf.has(xfId)) namesByXf.set(xfId, name3);
51884
- namedStyles.push(entry3);
51884
+ namedStyles.push(entry4);
51885
51885
  }
51886
- const normalAt = namedStyles.findIndex((entry3) => entry3.builtinId === 0);
51886
+ const normalAt = namedStyles.findIndex((entry4) => entry4.builtinId === 0);
51887
51887
  if (normalAt > 0) namedStyles.unshift(...namedStyles.splice(normalAt, 1));
51888
- if (!namedStyles.some((entry3) => entry3.name === "Normal"))
51888
+ if (!namedStyles.some((entry4) => entry4.name === "Normal"))
51889
51889
  namedStyles.unshift({ name: "Normal", style: styleXfs[0] ?? defaultCellStyle(), builtinId: 0 });
51890
51890
  const styles = [];
51891
51891
  const keys = /* @__PURE__ */ new Map();
@@ -52008,13 +52008,13 @@ function readDateGroup(node4) {
52008
52008
  return item2;
52009
52009
  }
52010
52010
  function readFilterColumn(column3, dxfs) {
52011
- const entry3 = { offset: numAttr(column3, "colId") ?? 0 };
52011
+ const entry4 = { offset: numAttr(column3, "colId") ?? 0 };
52012
52012
  const filters = xFirst(column3, "filters");
52013
52013
  if (filters) {
52014
- entry3.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
52015
- if (boolAttr(filters, "blank")) entry3.blank = true;
52014
+ entry4.values = xChildren(filters, "filter").map((f6) => att(f6, "val") ?? "");
52015
+ if (boolAttr(filters, "blank")) entry4.blank = true;
52016
52016
  const groups = xChildren(filters, "dateGroupItem").map(readDateGroup).filter((g2) => g2 !== void 0);
52017
- if (groups.length) entry3.dateGroups = groups;
52017
+ if (groups.length) entry4.dateGroups = groups;
52018
52018
  }
52019
52019
  const custom2 = xFirst(column3, "customFilters");
52020
52020
  if (custom2) {
@@ -52025,12 +52025,12 @@ function readFilterColumn(column3, dxfs) {
52025
52025
  value: att(c2, "val") ?? ""
52026
52026
  };
52027
52027
  });
52028
- entry3.custom = { ...boolAttr(custom2, "and") ? { and: true } : {}, conditions };
52028
+ entry4.custom = { ...boolAttr(custom2, "and") ? { and: true } : {}, conditions };
52029
52029
  }
52030
52030
  const top = xFirst(column3, "top10");
52031
52031
  if (top) {
52032
52032
  const filterValue = numAttr(top, "filterVal");
52033
- entry3.top10 = {
52033
+ entry4.top10 = {
52034
52034
  top: boolAttr(top, "top", true),
52035
52035
  percent: boolAttr(top, "percent", false),
52036
52036
  value: numAttr(top, "val") ?? 10,
@@ -52041,7 +52041,7 @@ function readFilterColumn(column3, dxfs) {
52041
52041
  if (dynamic2) {
52042
52042
  const value3 = numAttr(dynamic2, "val");
52043
52043
  const maxValue = numAttr(dynamic2, "maxVal");
52044
- entry3.dynamic = {
52044
+ entry4.dynamic = {
52045
52045
  type: att(dynamic2, "type") ?? "null",
52046
52046
  ...value3 !== void 0 ? { value: value3 } : {},
52047
52047
  ...maxValue !== void 0 ? { maxValue } : {}
@@ -52051,7 +52051,7 @@ function readFilterColumn(column3, dxfs) {
52051
52051
  if (color4) {
52052
52052
  const dxfId = numAttr(color4, "dxfId");
52053
52053
  const style4 = dxfId === void 0 ? void 0 : dxfs?.[dxfId];
52054
- entry3.color = {
52054
+ entry4.color = {
52055
52055
  cellColor: boolAttr(color4, "cellColor", true),
52056
52056
  ...dxfId !== void 0 ? { dxfId } : {},
52057
52057
  ...style4 ? { style: structuredClone(style4) } : {}
@@ -52061,11 +52061,11 @@ function readFilterColumn(column3, dxfs) {
52061
52061
  const iconSet = att(icon, "iconSet");
52062
52062
  if (iconSet) {
52063
52063
  const iconId = numAttr(icon, "iconId");
52064
- entry3.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
52064
+ entry4.icon = { iconSet, ...iconId !== void 0 ? { iconId } : {} };
52065
52065
  }
52066
- if (boolAttr(column3, "hiddenButton")) entry3.hiddenButton = true;
52067
- entry3.sourceXml = outerXml2(column3).replace(MAIN_NS_DECL, "");
52068
- return entry3;
52066
+ if (boolAttr(column3, "hiddenButton")) entry4.hiddenButton = true;
52067
+ entry4.sourceXml = outerXml2(column3).replace(MAIN_NS_DECL, "");
52068
+ return entry4;
52069
52069
  }
52070
52070
 
52071
52071
  // xlsx/read/sort-state.ts
@@ -53895,23 +53895,23 @@ function readValue2(ctx, c2, cell2) {
53895
53895
  const raw2 = v ? v.textContent ?? "" : void 0;
53896
53896
  switch (type) {
53897
53897
  case "s": {
53898
- const entry3 = ctx.sharedStrings[Number(raw2)];
53899
- if (!entry3) {
53898
+ const entry4 = ctx.sharedStrings[Number(raw2)];
53899
+ if (!entry4) {
53900
53900
  if (raw2 !== void 0) ctx.warn("A cell refers to a missing shared string.");
53901
53901
  return;
53902
53902
  }
53903
- cell2.value = entry3.text;
53904
- if (entry3.runs) cell2.richText = entry3.runs.map((run2) => ({ ...run2 }));
53905
- if (entry3.phonetic) cell2.phonetic = structuredClone(entry3.phonetic);
53903
+ cell2.value = entry4.text;
53904
+ if (entry4.runs) cell2.richText = entry4.runs.map((run2) => ({ ...run2 }));
53905
+ if (entry4.phonetic) cell2.phonetic = structuredClone(entry4.phonetic);
53906
53906
  return;
53907
53907
  }
53908
53908
  case "inlineStr": {
53909
53909
  const is2 = xFirst(c2, "is");
53910
53910
  if (!is2) return;
53911
- const entry3 = parseRichString(is2, ctx.palette);
53912
- cell2.value = entry3.text;
53913
- if (entry3.runs) cell2.richText = entry3.runs;
53914
- if (entry3.phonetic) cell2.phonetic = entry3.phonetic;
53911
+ const entry4 = parseRichString(is2, ctx.palette);
53912
+ cell2.value = entry4.text;
53913
+ if (entry4.runs) cell2.richText = entry4.runs;
53914
+ if (entry4.phonetic) cell2.phonetic = entry4.phonetic;
53915
53915
  return;
53916
53916
  }
53917
53917
  case "str":
@@ -54404,13 +54404,13 @@ async function loadXlsx(input2, options2 = {}) {
54404
54404
  const warn = (message) => {
54405
54405
  if (!warnings.includes(message)) warnings.push(message);
54406
54406
  };
54407
- const partOf = (type) => source3.targetOfType(workbookPart, type);
54408
- const stylesPart = partOf(RELATIONSHIP_TYPES.styles);
54407
+ const partOf2 = (type) => source3.targetOfType(workbookPart, type);
54408
+ const stylesPart = partOf2(RELATIONSHIP_TYPES.styles);
54409
54409
  const styles = parseStyles(stylesPart ? source3.text(stylesPart) : void 0, warnings);
54410
- const themePart2 = partOf(RELATIONSHIP_TYPES.theme);
54411
- const stringsPart = partOf(RELATIONSHIP_TYPES.sharedStrings);
54412
- const personsPart = partOf(RELATIONSHIP_TYPES.person);
54413
- const metadataPart = partOf(RELATIONSHIP_TYPES.sheetMetadata);
54410
+ const themePart2 = partOf2(RELATIONSHIP_TYPES.theme);
54411
+ const stringsPart = partOf2(RELATIONSHIP_TYPES.sharedStrings);
54412
+ const personsPart = partOf2(RELATIONSHIP_TYPES.person);
54413
+ const metadataPart = partOf2(RELATIONSHIP_TYPES.sheetMetadata);
54414
54414
  const ctx = {
54415
54415
  source: source3,
54416
54416
  sharedStrings: parseSharedStrings(
@@ -54428,24 +54428,24 @@ async function loadXlsx(input2, options2 = {}) {
54428
54428
  maxXmlElements: limits.maxXmlElements
54429
54429
  };
54430
54430
  const rels = source3.rels(workbookPart);
54431
- const sheets = book.sheets.map((entry3) => {
54432
- const rel = rels.get(entry3.relId);
54431
+ const sheets = book.sheets.map((entry4) => {
54432
+ const rel = rels.get(entry4.relId);
54433
54433
  const target3 = rel ? source3.target(workbookPart, rel) : void 0;
54434
54434
  let sheet2;
54435
54435
  if (rel?.type === RELATIONSHIP_TYPES.worksheet && target3) {
54436
- sheet2 = parseWorksheet(ctx, target3, entry3.name, entry3.sheetId);
54436
+ sheet2 = parseWorksheet(ctx, target3, entry4.name, entry4.sheetId);
54437
54437
  } else {
54438
- sheet2 = createWorksheet(entry3.name, entry3.sheetId);
54438
+ sheet2 = createWorksheet(entry4.name, entry4.sheetId);
54439
54439
  if (target3) sheet2.partName = target3;
54440
54440
  const kind = rel?.type.split("/").pop() ?? "sheet";
54441
- warn(`Sheet "${entry3.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
54441
+ warn(`Sheet "${entry4.name}" is a ${kind}; it is kept on save but cannot be shown or edited.`);
54442
54442
  }
54443
- sheet2.state = entry3.state;
54443
+ sheet2.state = entry4.state;
54444
54444
  return sheet2;
54445
54445
  });
54446
- if (source3.has("xl/vbaProject.bin") || partOf(RELATIONSHIP_TYPES.vbaProject))
54446
+ if (source3.has("xl/vbaProject.bin") || partOf2(RELATIONSHIP_TYPES.vbaProject))
54447
54447
  warn("The workbook contains VBA macros; they are kept on save but never run.");
54448
- if (partOf(RELATIONSHIP_TYPES.externalLink))
54448
+ if (partOf2(RELATIONSHIP_TYPES.externalLink))
54449
54449
  warn("External workbook links are kept but not updated.");
54450
54450
  const signatures = detectDigitalSignatures([...parts.keys()]);
54451
54451
  if (signatures.hasSignatures)
@@ -55075,8 +55075,8 @@ function writeChartColorStyle(writer, chartPart, chart) {
55075
55075
  if (!palette) return;
55076
55076
  const source3 = writer.source;
55077
55077
  const existing = [...source3?.rels(chartPart).entries() ?? []];
55078
- const entry3 = existing.find(([, rel]) => rel.type.endsWith("/chartColorStyle"));
55079
- const sourcePart = entry3 && source3?.target(chartPart, entry3[1]);
55078
+ const entry4 = existing.find(([, rel]) => rel.type.endsWith("/chartColorStyle"));
55079
+ const sourcePart = entry4 && source3?.target(chartPart, entry4[1]);
55080
55080
  const original = sourcePart && source3?.text(sourcePart);
55081
55081
  if (original && chartColorStyleId(original) === palette.id) return;
55082
55082
  const part = writer.uniqueName(
@@ -55091,7 +55091,7 @@ function writeChartColorStyle(writer, chartPart, chart) {
55091
55091
  const rels = new RelationshipSet();
55092
55092
  for (const [id5, rel] of existing) rels.keep(id5, rel);
55093
55093
  const target3 = chartPart.split("/").slice(0, -1).join("/") === "xl/charts" ? part.slice("xl/charts/".length) : "/" + part;
55094
- if (entry3) rels.keep(entry3[0], { ...entry3[1], target: target3 });
55094
+ if (entry4) rels.keep(entry4[0], { ...entry4[1], target: target3 });
55095
55095
  else rels.add(CHART_COLOR_STYLE_REL, target3);
55096
55096
  writer.rels(chartPart, rels);
55097
55097
  }
@@ -55228,7 +55228,7 @@ function style(chart) {
55228
55228
  return id5 > 100 ? { c14Style: id5, style: id5 - 100 } : { style: id5 };
55229
55229
  }
55230
55230
  function chartSpaceFromObject(chart) {
55231
- const series = chart.series.map((entry3, index5) => seriesModel(chart, entry3, index5));
55231
+ const series = chart.series.map((entry4, index5) => seriesModel(chart, entry4, index5));
55232
55232
  const [group3, chartAxes] = plot(chart, series);
55233
55233
  const space = {
55234
55234
  roundedCorners: false,
@@ -55271,8 +55271,8 @@ function stable2(value3) {
55271
55271
  if (value3 && typeof value3 === "object") {
55272
55272
  const out = {};
55273
55273
  for (const key2 of Object.keys(value3).sort()) {
55274
- const entry3 = value3[key2];
55275
- if (entry3 !== void 0) out[key2] = stable2(entry3);
55274
+ const entry4 = value3[key2];
55275
+ if (entry4 !== void 0) out[key2] = stable2(entry4);
55276
55276
  }
55277
55277
  return out;
55278
55278
  }
@@ -55394,9 +55394,9 @@ function writeEditedSmartArt(writer, object2, rels, relativeTarget5, context = {
55394
55394
  if (dataRelsXml) {
55395
55395
  const document = parseXml(dataRelsXml);
55396
55396
  const drawingLinks = elements(document.documentElement).filter(
55397
- (entry3) => entry3.namespaceURI === NS.rels && entry3.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
55397
+ (entry4) => entry4.namespaceURI === NS.rels && entry4.getAttribute("Type") === DIAGRAM_RELATIONSHIP_TYPES.drawing
55398
55398
  );
55399
- for (const entry3 of drawingLinks) document.documentElement.removeChild(entry3);
55399
+ for (const entry4 of drawingLinks) document.documentElement.removeChild(entry4);
55400
55400
  if (drawingLinks.length) writer.add(dataRelsPath, buildXml(document), CONTENT_TYPES2.rels);
55401
55401
  }
55402
55402
  writer.add(
@@ -55771,25 +55771,25 @@ var AreaIndex = class {
55771
55771
  for (let col = start.col; col <= end.col; col++) push(cells3, cellKey(start.row, col), node4);
55772
55772
  return;
55773
55773
  }
55774
- const entry3 = { range: area2.range, node: node4 };
55774
+ const entry4 = { range: area2.range, node: node4 };
55775
55775
  if (end.col - start.col + 1 > BUCKET_WIDTH) {
55776
55776
  const list3 = this.wide.get(area2.sheet);
55777
- if (list3) list3.push(entry3);
55778
- else this.wide.set(area2.sheet, [entry3]);
55777
+ if (list3) list3.push(entry4);
55778
+ else this.wide.set(area2.sheet, [entry4]);
55779
55779
  return;
55780
55780
  }
55781
55781
  const first3 = start.row >> CHUNK_SHIFT;
55782
55782
  const last = end.row >> CHUNK_SHIFT;
55783
55783
  if (last - first3 + 1 > CHUNKS) {
55784
55784
  const cols2 = inner(this.tall, area2.sheet);
55785
- for (let c2 = start.col; c2 <= end.col; c2++) push(cols2, c2, entry3);
55785
+ for (let c2 = start.col; c2 <= end.col; c2++) push(cols2, c2, entry4);
55786
55786
  return;
55787
55787
  }
55788
55788
  const cols = inner(this.chunked, area2.sheet);
55789
55789
  for (let c2 = start.col; c2 <= end.col; c2++) {
55790
55790
  let chunks = cols.get(c2);
55791
55791
  if (!chunks) cols.set(c2, chunks = /* @__PURE__ */ new Map());
55792
- for (let k = first3; k <= last; k++) push(chunks, k, entry3);
55792
+ for (let k = first3; k <= last; k++) push(chunks, k, entry4);
55793
55793
  }
55794
55794
  }
55795
55795
  /** Items whose areas intersect `range` on `sheet` (each once). */
@@ -55802,7 +55802,7 @@ var AreaIndex = class {
55802
55802
  const { start, end } = range3;
55803
55803
  const check4 = (list3) => {
55804
55804
  if (list3) {
55805
- for (const entry3 of list3) if (rangesIntersect(entry3.range, range3)) out.add(entry3.node);
55805
+ for (const entry4 of list3) if (rangesIntersect(entry4.range, range3)) out.add(entry4.node);
55806
55806
  }
55807
55807
  };
55808
55808
  const cells3 = this.cells.get(sheet2);
@@ -57123,8 +57123,8 @@ function unique(args, ctx) {
57123
57123
  const counts = /* @__PURE__ */ new Map();
57124
57124
  for (const row3 of m.data) {
57125
57125
  const key2 = keyOf3(row3);
57126
- const entry3 = counts.get(key2);
57127
- if (entry3) entry3.count++;
57126
+ const entry4 = counts.get(key2);
57127
+ if (entry4) entry4.count++;
57128
57128
  else counts.set(key2, { row: row3, count: 1 });
57129
57129
  }
57130
57130
  const rows = [...counts.values()].filter((e) => !once || e.count === 1).map((e) => e.row);
@@ -65625,10 +65625,10 @@ var GETPIVOTDATA = spec(
65625
65625
  return fail(ERR.REF);
65626
65626
  }
65627
65627
  const wanted = str(args[0]).toLowerCase();
65628
- const measure5 = pivotMeasures(pivot).find(
65628
+ const measure6 = pivotMeasures(pivot).find(
65629
65629
  (m) => m.caption.toLowerCase() === wanted || m.field.toLowerCase() === wanted
65630
65630
  );
65631
- if (!measure5) fail(ERR.REF);
65631
+ if (!measure6) fail(ERR.REF);
65632
65632
  const axes = [...pivotRowFields(pivot), ...pivotColumnFields(pivot), pivot.pageFilter?.field];
65633
65633
  let records = pivot.records;
65634
65634
  for (let i2 = 2; i2 < args.length; i2 += 2) {
@@ -65641,7 +65641,7 @@ var GETPIVOTDATA = spec(
65641
65641
  records = records.filter((record3) => same7(record3[index5] ?? null, item2));
65642
65642
  }
65643
65643
  if (records.length === 0) fail(ERR.REF);
65644
- const value3 = pivotMeasureNumber(pivot, records, measure5);
65644
+ const value3 = pivotMeasureNumber(pivot, records, measure6);
65645
65645
  return value3;
65646
65646
  },
65647
65647
  ["any"]
@@ -68844,7 +68844,7 @@ function writeMetadataPart(writer, rels, bookPart, plan2, dynamicArraysUsed, sou
68844
68844
  }
68845
68845
 
68846
68846
  // xlsx/write/style-xml.ts
68847
- var argb = (rgb7) => (rgb7.length === 6 ? `FF${rgb7}` : rgb7).toUpperCase();
68847
+ var argb = (rgb8) => (rgb8.length === 6 ? `FF${rgb8}` : rgb8).toUpperCase();
68848
68848
  function colorXml(color4, name3 = "color") {
68849
68849
  if (!color4) return "";
68850
68850
  if (color4.rgb) return el5(name3, { rgb: argb(color4.rgb), tint: color4.tint });
@@ -69054,7 +69054,7 @@ var StyleWriter = class {
69054
69054
  }
69055
69055
  xml() {
69056
69056
  const named3 = [...this.workbook.namedStyles];
69057
- const normalAt = named3.findIndex((entry3) => entry3.name === "Normal" || entry3.builtinId === 0);
69057
+ const normalAt = named3.findIndex((entry4) => entry4.name === "Normal" || entry4.builtinId === 0);
69058
69058
  if (normalAt > 0) named3.unshift(...named3.splice(normalAt, 1));
69059
69059
  if (normalAt < 0)
69060
69060
  named3.unshift({
@@ -69063,17 +69063,17 @@ var StyleWriter = class {
69063
69063
  builtinId: 0
69064
69064
  });
69065
69065
  const seen = /* @__PURE__ */ new Set();
69066
- const unique4 = named3.filter((entry3) => !seen.has(entry3.name) && seen.add(entry3.name));
69067
- const xfIdOf = new Map(unique4.map((entry3, index5) => [entry3.name, index5]));
69066
+ const unique4 = named3.filter((entry4) => !seen.has(entry4.name) && seen.add(entry4.name));
69067
+ const xfIdOf = new Map(unique4.map((entry4, index5) => [entry4.name, index5]));
69068
69068
  const base3 = this.workbook.styles[0] ?? defaultCellStyle();
69069
69069
  this.fonts.id(fontXml(base3.font));
69070
69070
  this.borders.id(borderXml({}));
69071
- const styleXfs = unique4.map((entry3) => this.xf(entry3.style, void 0));
69071
+ const styleXfs = unique4.map((entry4) => this.xf(entry4.style, void 0));
69072
69072
  const cellXfs = (this.workbook.styles.length ? this.workbook.styles : [base3]).map(
69073
69073
  (style4) => this.xf(style4, xfIdOf.get(style4.cellStyleName ?? "Normal") ?? 0)
69074
69074
  );
69075
69075
  const cellStyles = unique4.map(
69076
- (entry3, index5) => el5("cellStyle", { name: entry3.name, xfId: index5, builtinId: entry3.builtinId })
69076
+ (entry4, index5) => el5("cellStyle", { name: entry4.name, xfId: index5, builtinId: entry4.builtinId })
69077
69077
  );
69078
69078
  const custom2 = [...this.numFmts].filter(([code]) => builtinFormatIdOf(code) === void 0).sort((a2, b) => a2[1] - b[1]);
69079
69079
  let out = `${XML_HEADER}<styleSheet xmlns="${NS.x}" xmlns:mc="${NS.mc}" mc:Ignorable="x14ac" xmlns:x14ac="${NS.x14ac}">`;
@@ -69723,7 +69723,7 @@ function workbookXml(workbook, sheets, activeTab, sourceXml, pivotCachesXml) {
69723
69723
  "workbookSaltValue",
69724
69724
  "workbookSpinCount"
69725
69725
  ];
69726
- const modern = Object.entries(modernHashValues(workbook.workbookModernHash, "workbook")).filter((entry3) => entry3[1] !== void 0).map(([name3, value3]) => ` ${name3}="${escapeAttr3(value3)}"`).join("");
69726
+ const modern = Object.entries(modernHashValues(workbook.workbookModernHash, "workbook")).filter((entry4) => entry4[1] !== void 0).map(([name3, value3]) => ` ${name3}="${escapeAttr3(value3)}"`).join("");
69727
69727
  const password = workbook.workbookPasswordHash ? ` workbookPassword="${escapeAttr3(workbook.workbookPasswordHash)}"` : "";
69728
69728
  out += `<workbookProtection${copyAttrs(kept.get("workbookProtection"), skip)}${modern}${password} lockStructure="1"/>`;
69729
69729
  }
@@ -70484,9 +70484,9 @@ function groupData(workbook, sheet2, group3) {
70484
70484
  function sparklineViewAt(workbook, sheetIndex2, row3, col) {
70485
70485
  const sheet2 = workbook.sheets[sheetIndex2];
70486
70486
  if (!sheet2) return void 0;
70487
- const entry3 = hosts(sheet2).get(cellKey(row3, col));
70488
- if (!entry3) return void 0;
70489
- const { group: group3, index: index5 } = entry3;
70487
+ const entry4 = hosts(sheet2).get(cellKey(row3, col));
70488
+ if (!entry4) return void 0;
70489
+ const { group: group3, index: index5 } = entry4;
70490
70490
  const needsGroup = group3.minAxisType === "group" || group3.maxAxisType === "group";
70491
70491
  const data = needsGroup ? groupData(workbook, sheet2, group3) : groupData(workbook, sheet2, { ...group3, sparklines: [group3.sparklines[index5]] });
70492
70492
  const at3 = needsGroup ? index5 : 0;
@@ -71389,7 +71389,7 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
71389
71389
  if (pivot.dateFields?.includes(name3) && items.every((v) => typeof v === "number")) {
71390
71390
  const serials = items;
71391
71391
  const range3 = dateGroupRange({}, serials);
71392
- const parent = derived2.filter((entry3) => entry3.group.field === name3).at(-1);
71392
+ const parent = derived2.filter((entry4) => entry4.group.field === name3).at(-1);
71393
71393
  const link = parent ? `<fieldGroup par="${parent.index}"/>` : "";
71394
71394
  return `<cacheField${attrs3({ name: encodeEscapes(name3), numFmtId: 14 })}><sharedItems${attrs3({ containsSemiMixedTypes: false, containsNonDate: false, containsDate: true, containsString: false, minDate: iso(range3.start), maxDate: iso(range3.end), count: serials.length })}>${serials.map((serial) => `<d v="${iso(serial)}"/>`).join("")}</sharedItems>${link}</cacheField>`;
71395
71395
  }
@@ -71400,22 +71400,22 @@ function pivotCacheDefinitionXml(pivot, workbook, data, recordRel) {
71400
71400
  const text9 = items.some((item2) => item2 !== null && item2 !== "" && typeof item2 !== "number");
71401
71401
  return `<cacheField${attrs3({ name: encodeEscapes(name3), numFmtId: 0 })}><sharedItems${attrs3({ count: items.length, containsString: !nums.length || text9, containsNumber: !!nums.length, containsInteger: nums.length > 0 && nums.every(Number.isInteger), containsBlank: types.has("blank"), containsMixedTypes: nums.length > 0 && text9, containsSemiMixedTypes: !nums.length || types.size > 1 })}>${items.map(valueXml).join("")}</sharedItems>${groupXml2(pivot, name3, index5)}</cacheField>`;
71402
71402
  }).join("");
71403
- const extra = derived2.map((entry3) => derivedFieldXml(pivot, entry3, workbook.date1904)).join("");
71403
+ const extra = derived2.map((entry4) => derivedFieldXml(pivot, entry4, workbook.date1904)).join("");
71404
71404
  return `${XML_HEADER}<pivotCacheDefinition xmlns="${NS.x}" xmlns:r="${NS.r}" r:id="${recordRel}" createdVersion="6" refreshedVersion="6" minRefreshableVersion="3" recordCount="${pivot.records.length}"><cacheSource type="worksheet"><worksheetSource${attrs3({ ref: formatRange(source3.range), sheet: workbook.sheets[source3.sheet].name })}/></cacheSource><cacheFields count="${pivot.fields.length + derived2.length}">${fields}${extra}</cacheFields>${slicerExt(pivot)}</pivotCacheDefinition>`;
71405
71405
  }
71406
71406
  function derivedFields(pivot, date1904) {
71407
71407
  const resolved = { ...pivot, dateGroups: resolveDateGroups({ ...pivot}) };
71408
- return derivedDateFields(resolved).map((entry3) => {
71409
- const chosen = pivot.dateGroups.find((group3) => group3.field === entry3.group.field);
71410
- return { ...entry3, autoStart: chosen.start === void 0, autoEnd: chosen.end === void 0 };
71408
+ return derivedDateFields(resolved).map((entry4) => {
71409
+ const chosen = pivot.dateGroups.find((group3) => group3.field === entry4.group.field);
71410
+ return { ...entry4, autoStart: chosen.start === void 0, autoEnd: chosen.end === void 0 };
71411
71411
  });
71412
71412
  }
71413
- function derivedFieldXml(pivot, entry3, date1904) {
71414
- const range3 = { start: entry3.group.start, end: entry3.group.end };
71415
- const days = dateGroupDays(entry3.group);
71416
- const labels = dateUnitLabels(entry3.unit, range3, days, date1904, entry3.group);
71417
- const base3 = pivot.fields.indexOf(entry3.group.field);
71418
- return `<cacheField${attrs3({ name: encodeEscapes(entry3.name), numFmtId: 0, databaseField: false })}><fieldGroup base="${base3}"><rangePr${attrs3({ autoStart: entry3.autoStart ? void 0 : false, autoEnd: entry3.autoEnd ? void 0 : false, groupBy: entry3.unit, startDate: serialToIso(range3.start, date1904), endDate: serialToIso(range3.end, date1904), groupInterval: days > 1 ? days : void 0 })}/><groupItems count="${labels.length}">${labels.map((label2) => `<s v="${escapeAttr3(label2)}"/>`).join("")}</groupItems></fieldGroup></cacheField>`;
71413
+ function derivedFieldXml(pivot, entry4, date1904) {
71414
+ const range3 = { start: entry4.group.start, end: entry4.group.end };
71415
+ const days = dateGroupDays(entry4.group);
71416
+ const labels = dateUnitLabels(entry4.unit, range3, days, date1904, entry4.group);
71417
+ const base3 = pivot.fields.indexOf(entry4.group.field);
71418
+ return `<cacheField${attrs3({ name: encodeEscapes(entry4.name), numFmtId: 0, databaseField: false })}><fieldGroup base="${base3}"><rangePr${attrs3({ autoStart: entry4.autoStart ? void 0 : false, autoEnd: entry4.autoEnd ? void 0 : false, groupBy: entry4.unit, startDate: serialToIso(range3.start, date1904), endDate: serialToIso(range3.end, date1904), groupInterval: days > 1 ? days : void 0 })}/><groupItems count="${labels.length}">${labels.map((label2) => `<s v="${escapeAttr3(label2)}"/>`).join("")}</groupItems></fieldGroup></cacheField>`;
71419
71419
  }
71420
71420
  function groupXml2(pivot, name3, index5) {
71421
71421
  const group3 = groupOf(pivot, name3);
@@ -71499,19 +71499,19 @@ function pivotTableXml(source3, cacheId, cache3) {
71499
71499
  custom2.map((fn) => [PIVOT_SUBTOTALS[fn].attr, true])
71500
71500
  );
71501
71501
  const entries = automatic ? '<item t="default"/>' : custom2.map((fn) => `<item t="${PIVOT_SUBTOTALS[fn].item}"/>`).join("");
71502
- return `<pivotField${attrs3({ axis: index5 === page ? "axisPage" : at3 >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures2.some((measure5) => pivot.fields.indexOf(measure5.field) === index5) ? true : void 0, compact: compact3, outline: outline2, showAll: false, subtotalTop: at3 >= 0 ? top : void 0, numFmtId: isDate ? 14 : void 0, defaultSubtotal: automatic ? void 0 : false, ...flags })}>${items2 ? `<items count="${items2.length + (automatic ? 1 : custom2.length)}">${items2.map((item2) => `<item${hidden.has(pivotValueKey(item2)) ? ' h="1"' : ""}${named3(name3, item2)} x="${itemX(index5, item2)}"/>`).join("")}${entries}</items>` : ""}${repeated}</pivotField>`;
71502
+ return `<pivotField${attrs3({ axis: index5 === page ? "axisPage" : at3 >= 0 ? "axisRow" : colAt >= 0 ? "axisCol" : void 0, dataField: measures2.some((measure6) => pivot.fields.indexOf(measure6.field) === index5) ? true : void 0, compact: compact3, outline: outline2, showAll: false, subtotalTop: at3 >= 0 ? top : void 0, numFmtId: isDate ? 14 : void 0, defaultSubtotal: automatic ? void 0 : false, ...flags })}>${items2 ? `<items count="${items2.length + (automatic ? 1 : custom2.length)}">${items2.map((item2) => `<item${hidden.has(pivotValueKey(item2)) ? ' h="1"' : ""}${named3(name3, item2)} x="${itemX(index5, item2)}"/>`).join("")}${entries}</items>` : ""}${repeated}</pivotField>`;
71503
71503
  }).join("");
71504
71504
  const items = (count3, indices) => Array.from({ length: count3 }, (_v, i2) => `<i><x v="${indices?.[i2] ?? i2}"/></i>`).join("") + '<i t="grand"><x/></i>';
71505
71505
  const header = grid.firstHeaderRow !== void 0 ? grid.firstHeaderRow - pageOffset : col >= 0 ? 1 : grid.firstDataRow - pageOffset - 1;
71506
71506
  const rowIndices = [...rowIdx];
71507
71507
  if (valuesAt >= 0) rowIndices.splice(valuesAt, 0, -2);
71508
71508
  let previous = [];
71509
- const rowItems = rowEntries?.map((entry3) => {
71509
+ const rowItems = rowEntries?.map((entry4) => {
71510
71510
  let prefix3 = 0;
71511
- const type = entry3.type === void 0 || entry3.type === "default" || entry3.type === "grand" ? entry3.type : PIVOT_SUBTOTALS[entry3.type].item;
71512
- if (entry3.type !== "grand") prefix3 = sharedPrefix(entry3.indices, previous);
71513
- previous = entry3.type === "grand" ? [] : entry3.indices;
71514
- return `<i${attrs3({ t: type, r: prefix3 || void 0, i: entry3.measure || void 0 })}>${entry3.indices.slice(prefix3).map((index5) => `<x${attrs3({ v: index5 || void 0 })}/>`).join("")}</i>`;
71511
+ const type = entry4.type === void 0 || entry4.type === "default" || entry4.type === "grand" ? entry4.type : PIVOT_SUBTOTALS[entry4.type].item;
71512
+ if (entry4.type !== "grand") prefix3 = sharedPrefix(entry4.indices, previous);
71513
+ previous = entry4.type === "grand" ? [] : entry4.indices;
71514
+ return `<i${attrs3({ t: type, r: prefix3 || void 0, i: entry4.measure || void 0 })}>${entry4.indices.slice(prefix3).map((index5) => `<x${attrs3({ v: index5 || void 0 })}/>`).join("")}</i>`;
71515
71515
  }).join("") ?? items(grid.rowItems.length, rowIndicesFull[0]);
71516
71516
  let body = `<location${attrs3({ ref: formatRange({ ...pivot.location, start: { ...pivot.location.start, row: pivot.location.start.row + pageOffset } }), firstHeaderRow: header, firstDataRow: grid.firstDataRow - pageOffset, rowPageCount: page >= 0 ? 1 : void 0, colPageCount: page >= 0 ? 1 : void 0, firstDataCol: grid.rowLabelColumns ?? 1 })}/><pivotFields count="${pivot.fields.length}">${fields}</pivotFields><rowFields count="${rowIndices.length}">${rowIndices.map((index5) => `<field x="${index5}"/>`).join("")}</rowFields><rowItems count="${grid.rowEntries?.length ?? grid.rowItems.length + 1}">${rowItems}</rowItems>`;
71517
71517
  if (col >= 0 && grid.columnEntries) {
@@ -71522,7 +71522,7 @@ function pivotTableXml(source3, cacheId, cache3) {
71522
71522
  else body += '<colItems count="1"><i/></colItems>';
71523
71523
  if (page >= 0)
71524
71524
  body += `<pageFields count="1"><pageField${attrs3({ fld: page, hier: -1, item: pivot.pageFilter.item !== void 0 ? pageItems.findIndex((item2) => pivotValueKey(item2) === pivotValueKey(pivot.pageFilter.item)) : void 0 })}/></pageFields>`;
71525
- body += `<dataFields count="${measures2.length}">${measures2.map((measure5) => `<dataField${attrs3({ name: encodeEscapes(measure5.caption), fld: pivot.fields.indexOf(measure5.field), subtotal: measure5.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
71525
+ body += `<dataFields count="${measures2.length}">${measures2.map((measure6) => `<dataField${attrs3({ name: encodeEscapes(measure6.caption), fld: pivot.fields.indexOf(measure6.field), subtotal: measure6.aggregate, baseField: 0, baseItem: 0 })}/>`).join("")}</dataFields>`;
71526
71526
  const doc = parseXml(
71527
71527
  pivot.sourceXml ?? `<pivotTableDefinition xmlns="${NS.x}" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" createdVersion="6"><pivotTableStyleInfo name="PivotStyleLight16" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/></pivotTableDefinition>`
71528
71528
  );
@@ -71640,7 +71640,7 @@ var PivotWritePlan = class {
71640
71640
  if (rel.type !== RELATIONSHIP_TYPES.pivotTable) continue;
71641
71641
  const part = source3.target(sheet2.partName, rel);
71642
71642
  if (!part) continue;
71643
- const pivot = sheet2.pivotTables?.find((entry3) => entry3.partName === part);
71643
+ const pivot = sheet2.pivotTables?.find((entry4) => entry4.partName === part);
71644
71644
  if (pivot?.dirty || !pivot && sheet2.preserved.get("source:pivotTables")?.includes(part))
71645
71645
  continue;
71646
71646
  const xml = source3.text(part);
@@ -71715,10 +71715,10 @@ var PivotWritePlan = class {
71715
71715
 
71716
71716
  // xlsx/filter-menu.ts
71717
71717
  function colorFilterCriteria(color4, cellColor) {
71718
- const rgb7 = color4 && `FF${color4.replace("#", "").toUpperCase()}`;
71718
+ const rgb8 = color4 && `FF${color4.replace("#", "").toUpperCase()}`;
71719
71719
  const style4 = cellColor ? {
71720
- fill: rgb7 ? { type: "pattern", pattern: "solid", fgColor: { rgb: rgb7 } } : { type: "pattern", pattern: "none" }
71721
- } : rgb7 ? { font: { color: { rgb: rgb7 } } } : {};
71720
+ fill: rgb8 ? { type: "pattern", pattern: "solid", fgColor: { rgb: rgb8 } } : { type: "pattern", pattern: "none" }
71721
+ } : rgb8 ? { font: { color: { rgb: rgb8 } } } : {};
71722
71722
  return { color: { cellColor, style: style4 } };
71723
71723
  }
71724
71724
 
@@ -71918,12 +71918,12 @@ function dataBarAppearance(rule2, workbook) {
71918
71918
  function dataBarGeometry(value3, low, high, options2) {
71919
71919
  const lo = options2.autoMin ? Math.min(0, low) : low;
71920
71920
  const hi = options2.autoMax ? Math.max(0, high) : high;
71921
- const clamp4 = (v) => Math.max(0, Math.min(1, v));
71921
+ const clamp5 = (v) => Math.max(0, Math.min(1, v));
71922
71922
  const minimum = options2.minLength;
71923
71923
  const delta = options2.maxLength - minimum;
71924
- const interpolate = (ratio, offset2 = minimum) => clamp4(offset2 + clamp4(ratio) * delta);
71924
+ const interpolate = (ratio, offset2 = minimum) => clamp5(offset2 + clamp5(ratio) * delta);
71925
71925
  if (options2.axis === "none") {
71926
- const ratio = hi > lo ? clamp4((value3 - lo) / (hi - lo)) : 0.5;
71926
+ const ratio = hi > lo ? clamp5((value3 - lo) / (hi - lo)) : 0.5;
71927
71927
  return {
71928
71928
  start: 0,
71929
71929
  fraction: interpolate(ratio),
@@ -72106,11 +72106,11 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72106
72106
  return { error: "#VALUE!" };
72107
72107
  }
72108
72108
  };
72109
- const thresholdValue = (t, entry3) => {
72110
- const s = stats(entry3.format);
72111
- const anchor2 = entry3.format.ranges[0]?.start ?? { row: 0, col: 0 };
72109
+ const thresholdValue = (t, entry4) => {
72110
+ const s = stats(entry4.format);
72111
+ const anchor2 = entry4.format.ranges[0]?.start ?? { row: 0, col: 0 };
72112
72112
  const n = () => {
72113
- const raw2 = t.value === void 0 ? 0 : run2(t.value, entry3.format, anchor2.row, anchor2.col);
72113
+ const raw2 = t.value === void 0 ? 0 : run2(t.value, entry4.format, anchor2.row, anchor2.col);
72114
72114
  return typeof raw2 === "number" ? raw2 : Number(raw2) || 0;
72115
72115
  };
72116
72116
  switch (t.type) {
@@ -72127,16 +72127,16 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72127
72127
  return percentile(s.sorted, n() / 100);
72128
72128
  }
72129
72129
  };
72130
- const thresholds = (entry3, list3) => {
72131
- let cached7 = thresholdCache.get(entry3);
72130
+ const thresholds = (entry4, list3) => {
72131
+ let cached7 = thresholdCache.get(entry4);
72132
72132
  if (!cached7) {
72133
- cached7 = list3.map((t) => thresholdValue(t, entry3));
72134
- thresholdCache.set(entry3, cached7);
72133
+ cached7 = list3.map((t) => thresholdValue(t, entry4));
72134
+ thresholdCache.set(entry4, cached7);
72135
72135
  }
72136
72136
  return cached7;
72137
72137
  };
72138
- const matches3 = (entry3, value3, row3, col) => {
72139
- const { rule: rule2, format: format9 } = entry3;
72138
+ const matches3 = (entry4, value3, row3, col) => {
72139
+ const { rule: rule2, format: format9 } = entry4;
72140
72140
  switch (rule2.type) {
72141
72141
  case "cellIs": {
72142
72142
  const a2 = rule2.formulas[0] !== void 0 ? run2(rule2.formulas[0], format9, row3, col) : null;
@@ -72193,13 +72193,13 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72193
72193
  return false;
72194
72194
  }
72195
72195
  };
72196
- const apply3 = (entry3, value3, row3, col, result2) => {
72197
- const { rule: rule2 } = entry3;
72196
+ const apply3 = (entry4, value3, row3, col, result2) => {
72197
+ const { rule: rule2 } = entry4;
72198
72198
  if (rule2.type === "colorScale") {
72199
72199
  if (result2.colorScale || typeof value3 !== "number") return false;
72200
72200
  const color4 = scaleColor(
72201
72201
  value3,
72202
- thresholds(entry3, rule2.thresholds),
72202
+ thresholds(entry4, rule2.thresholds),
72203
72203
  rule2.colors.map((c2) => resolveColor(c2, workbook.theme, "#FFFFFF") ?? "#FFFFFF")
72204
72204
  );
72205
72205
  if (!color4) return false;
@@ -72208,12 +72208,12 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72208
72208
  }
72209
72209
  if (rule2.type === "dataBar") {
72210
72210
  if (result2.dataBar || typeof value3 !== "number") return false;
72211
- let appearance = barAppearances.get(entry3);
72211
+ let appearance = barAppearances.get(entry4);
72212
72212
  if (!appearance) {
72213
72213
  appearance = dataBarAppearance(rule2, workbook);
72214
- barAppearances.set(entry3, appearance);
72214
+ barAppearances.set(entry4, appearance);
72215
72215
  }
72216
- const [lo = 0, hi = 0] = thresholds(entry3, [rule2.min, rule2.max]);
72216
+ const [lo = 0, hi = 0] = thresholds(entry4, [rule2.min, rule2.max]);
72217
72217
  const geometry2 = dataBarGeometry(value3, lo, hi, appearance);
72218
72218
  const rtl = appearance.direction === "context" ? Boolean(sheet2.view.rightToLeft) : appearance.direction === "rightToLeft";
72219
72219
  result2.dataBar = {
@@ -72236,7 +72236,7 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72236
72236
  }
72237
72237
  if (rule2.type === "iconSet") {
72238
72238
  if (result2.icon || typeof value3 !== "number") return false;
72239
- const index5 = iconIndex(value3, thresholds(entry3, rule2.thresholds), rule2.thresholds);
72239
+ const index5 = iconIndex(value3, thresholds(entry4, rule2.thresholds), rule2.thresholds);
72240
72240
  result2.icon = {
72241
72241
  set: rule2.iconSet,
72242
72242
  index: rule2.reverse ? rule2.thresholds.length - 1 - index5 : index5
@@ -72244,7 +72244,7 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72244
72244
  if (rule2.showValue === false) result2.hideValue = true;
72245
72245
  return true;
72246
72246
  }
72247
- if (!matches3(entry3, value3, row3, col)) return false;
72247
+ if (!matches3(entry4, value3, row3, col)) return false;
72248
72248
  result2.style = mergeDxf(result2.style, rule2.style);
72249
72249
  return true;
72250
72250
  };
@@ -72253,12 +72253,12 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
72253
72253
  const result2 = {};
72254
72254
  let value3;
72255
72255
  let any2 = false;
72256
- for (const entry3 of entries) {
72257
- if (!entry3.format.ranges.some((r) => rangeContains(r, { row: row3, col }))) continue;
72256
+ for (const entry4 of entries) {
72257
+ if (!entry4.format.ranges.some((r) => rangeContains(r, { row: row3, col }))) continue;
72258
72258
  value3 ??= getValue(sheet2, row3, col);
72259
- if (!apply3(entry3, value3, row3, col, result2)) continue;
72259
+ if (!apply3(entry4, value3, row3, col, result2)) continue;
72260
72260
  any2 = true;
72261
- if (entry3.rule.stopIfTrue && !GRAPHIC_RULES.has(entry3.rule.type)) break;
72261
+ if (entry4.rule.stopIfTrue && !GRAPHIC_RULES.has(entry4.rule.type)) break;
72262
72262
  }
72263
72263
  return any2 ? result2 : void 0;
72264
72264
  }
@@ -72589,12 +72589,12 @@ function slicerTarget(workbook, cache3) {
72589
72589
  const source3 = cache3.source;
72590
72590
  for (const [sheetIndex2, sheet2] of workbook.sheets.entries()) {
72591
72591
  if (source3.kind === "table") {
72592
- const table4 = sheet2.tables.find((entry3) => entry3.id === source3.tableId);
72592
+ const table4 = sheet2.tables.find((entry4) => entry4.id === source3.tableId);
72593
72593
  const offset2 = table4?.columns.findIndex((column3) => column3.sourceId === source3.column) ?? -1;
72594
72594
  if (table4 && offset2 >= 0) return { kind: "table", sheet: sheet2, sheetIndex: sheetIndex2, table: table4, offset: offset2 };
72595
72595
  } else {
72596
72596
  const first3 = source3.pivots[0];
72597
- const pivot = first3 && sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry3) => entry3.name === first3.name) : void 0;
72597
+ const pivot = first3 && sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry4) => entry4.name === first3.name) : void 0;
72598
72598
  if (pivot) return { kind: "pivot", sheet: sheet2, sheetIndex: sheetIndex2, pivot };
72599
72599
  }
72600
72600
  }
@@ -72615,7 +72615,7 @@ function timelineTarget(workbook, cache3) {
72615
72615
  const first3 = cache3.pivots[0];
72616
72616
  if (!first3) return void 0;
72617
72617
  for (const [sheetIndex2, sheet2] of workbook.sheets.entries()) {
72618
- const pivot = sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry3) => entry3.name === first3.name) : void 0;
72618
+ const pivot = sheet2.sheetId === first3.tabId ? sheet2.pivotTables?.find((entry4) => entry4.name === first3.name) : void 0;
72619
72619
  if (pivot) return { sheet: sheet2, sheetIndex: sheetIndex2, pivot };
72620
72620
  }
72621
72621
  return void 0;
@@ -72885,7 +72885,7 @@ var SlicerWritePlan = class {
72885
72885
  const modeled = /* @__PURE__ */ new Set();
72886
72886
  const place4 = (kind, group3, xml, pattern, type) => {
72887
72887
  if (!group3.length) return;
72888
- const existing = group3.find((entry3) => entry3.partName && !this.claimed.has(entry3.partName));
72888
+ const existing = group3.find((entry4) => entry4.partName && !this.claimed.has(entry4.partName));
72889
72889
  const part = existing?.partName ?? this.writer.uniqueName(pattern, /* @__PURE__ */ new Set([...this.reserved, ...this.claimed]));
72890
72890
  this.claimed.add(part);
72891
72891
  modeled.add(part);
@@ -72922,9 +72922,9 @@ var SlicerWritePlan = class {
72922
72922
  for (const ext of elements(root)) {
72923
72923
  const kind = uris.get(ext.getAttribute("uri") ?? "");
72924
72924
  if (!kind) continue;
72925
- for (const entry3 of ext.getElementsByTagName("*")) {
72926
- if (entry3.localName !== FAMILIES[kind].sheetChild) continue;
72927
- const id5 = entry3.getAttributeNS(NS.r, "id");
72925
+ for (const entry4 of ext.getElementsByTagName("*")) {
72926
+ if (entry4.localName !== FAMILIES[kind].sheetChild) continue;
72927
+ const id5 = entry4.getAttributeNS(NS.r, "id");
72928
72928
  const rel = id5 ? rels.entries.get(id5) : void 0;
72929
72929
  const target3 = rel && resolvePartPath(sheetPart, rel.target);
72930
72930
  if (id5 && target3 && !modeled.has(target3) && !this.removed(target3)) kept[kind].push(id5);
@@ -73417,7 +73417,7 @@ function syncTableHeader(ctx, sheet2, row3, col, formulaCells) {
73417
73417
  const text9 = displayText(ctx.workbook, getCell(sheet2, row3, col)).trim();
73418
73418
  if (!text9 || column3.name === text9) return;
73419
73419
  const oldName = column3.name;
73420
- const others = table4.columns.filter((entry3) => entry3 !== column3).map((entry3) => entry3.name);
73420
+ const others = table4.columns.filter((entry4) => entry4 !== column3).map((entry4) => entry4.name);
73421
73421
  const newName = uniqueHeaders([...others, text9]).at(-1);
73422
73422
  column3.name = newName;
73423
73423
  if (newName !== text9) writeValue2(sheet2, row3, col, newName);
@@ -75136,10 +75136,10 @@ function parseCssColor(text9) {
75136
75136
  return {
75137
75137
  rgb: (hex4.length === 3 ? [...hex4].map((ch) => ch + ch).join("") : hex4).toUpperCase()
75138
75138
  };
75139
- const rgb7 = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(value3);
75140
- if (rgb7)
75139
+ const rgb8 = /^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(value3);
75140
+ if (rgb8)
75141
75141
  return {
75142
- rgb: rgb7.slice(1, 4).map((n) => Math.min(255, Number(n)).toString(16).padStart(2, "0")).join("").toUpperCase()
75142
+ rgb: rgb8.slice(1, 4).map((n) => Math.min(255, Number(n)).toString(16).padStart(2, "0")).join("").toUpperCase()
75143
75143
  };
75144
75144
  const named3 = NAMED_COLORS2[value3];
75145
75145
  return named3 ? { rgb: named3 } : void 0;
@@ -76024,25 +76024,25 @@ function estimateWidth(text9, style4) {
76024
76024
  return longest * MDW * scale2 * (style4.font.bold ? 1.1 : 1);
76025
76025
  }
76026
76026
  var pixelsToWidth = (px2) => Math.round((px2 + 5) / MDW * 256) / 256;
76027
- function fitColumnWidth(ctx, sheet2, col, measure5) {
76027
+ function fitColumnWidth(ctx, sheet2, col, measure6) {
76028
76028
  let widest = -1;
76029
76029
  for (const [row3, cells3] of sheet2.rows) {
76030
76030
  const cell2 = cells3.get(col);
76031
76031
  if (!cell2 || sheet2.rowInfo.get(row3)?.hidden) continue;
76032
76032
  const text9 = displayText(ctx.workbook, cell2);
76033
76033
  if (!text9) continue;
76034
- widest = Math.max(widest, measure5(text9, styleAt(ctx.workbook, cell2.styleId)));
76034
+ widest = Math.max(widest, measure6(text9, styleAt(ctx.workbook, cell2.styleId)));
76035
76035
  }
76036
76036
  return widest < 0 ? void 0 : Math.min(MAX_WIDTH, pixelsToWidth(widest));
76037
76037
  }
76038
- function setColumnWidth(ctx, s, cols, width, measure5) {
76038
+ function setColumnWidth(ctx, s, cols, width, measure6) {
76039
76039
  const sheet2 = sheetAt(ctx.workbook, s);
76040
76040
  if (!cols.length) return;
76041
76041
  const widths = /* @__PURE__ */ new Map();
76042
76042
  for (const col of cols)
76043
76043
  widths.set(
76044
76044
  col,
76045
- width === "auto" ? fitColumnWidth(ctx, sheet2, col, measure5 ?? estimateWidth) : Math.max(0, Math.min(MAX_WIDTH, width))
76045
+ width === "auto" ? fitColumnWidth(ctx, sheet2, col, measure6 ?? estimateWidth) : Math.max(0, Math.min(MAX_WIDTH, width))
76046
76046
  );
76047
76047
  ctx.run(
76048
76048
  "Column width",
@@ -76290,9 +76290,9 @@ function setColumnCriteria(ctx, s, col, criteria) {
76290
76290
  const old = filter2.columns?.find((fc) => fc.offset === offset2);
76291
76291
  const columns2 = (filter2.columns ?? []).filter((fc) => fc.offset !== offset2);
76292
76292
  if (criteria) {
76293
- const entry3 = { offset: offset2, ...structuredClone(criteria) };
76294
- if (old?.hiddenButton) entry3.hiddenButton = true;
76295
- columns2.push(entry3);
76293
+ const entry4 = { offset: offset2, ...structuredClone(criteria) };
76294
+ if (old?.hiddenButton) entry4.hiddenButton = true;
76295
+ columns2.push(entry4);
76296
76296
  }
76297
76297
  columns2.sort((a2, b) => a2.offset - b.offset);
76298
76298
  const next = { ...filter2 };
@@ -76473,7 +76473,7 @@ function replaceAll(ctx, query, replacement) {
76473
76473
  )
76474
76474
  );
76475
76475
  const uniqueScopes = scopes.filter(
76476
- (scope, index5) => scope.kind !== "refs" || scopes.findIndex((entry3) => entry3.kind === "refs") === index5
76476
+ (scope, index5) => scope.kind !== "refs" || scopes.findIndex((entry4) => entry4.kind === "refs") === index5
76477
76477
  );
76478
76478
  return ctx.run(
76479
76479
  "Replace",
@@ -76516,10 +76516,10 @@ function captureRefs(workbook, withFormulas2 = true) {
76516
76516
  (sheet2, s) => sheet2.rows.forEach(
76517
76517
  (cells3, row3) => cells3.forEach((cell2, col) => {
76518
76518
  if (cell2.formula === void 0 && !cell2.arrayRange) return;
76519
- const entry3 = { sheet: s, row: row3, col, cell: cell2 };
76520
- if (cell2.formula !== void 0) entry3.formula = cell2.formula;
76521
- if (cell2.arrayRange) entry3.arrayRange = structuredClone(cell2.arrayRange);
76522
- formulas.push(entry3);
76519
+ const entry4 = { sheet: s, row: row3, col, cell: cell2 };
76520
+ if (cell2.formula !== void 0) entry4.formula = cell2.formula;
76521
+ if (cell2.arrayRange) entry4.arrayRange = structuredClone(cell2.arrayRange);
76522
+ formulas.push(entry4);
76523
76523
  })
76524
76524
  )
76525
76525
  );
@@ -76539,13 +76539,13 @@ function restoreRefs(workbook, data) {
76539
76539
  Object.assign(target3, copy9);
76540
76540
  });
76541
76541
  workbook.definedNames = structuredClone(data.definedNames);
76542
- for (const entry3 of data.formulas) {
76543
- const sheet2 = workbook.sheets[entry3.sheet];
76544
- const cell2 = sheet2 && getCell(sheet2, entry3.row, entry3.col);
76542
+ for (const entry4 of data.formulas) {
76543
+ const sheet2 = workbook.sheets[entry4.sheet];
76544
+ const cell2 = sheet2 && getCell(sheet2, entry4.row, entry4.col);
76545
76545
  if (!cell2) continue;
76546
- if (entry3.formula === void 0) delete cell2.formula;
76547
- else cell2.formula = entry3.formula;
76548
- if (entry3.arrayRange) cell2.arrayRange = structuredClone(entry3.arrayRange);
76546
+ if (entry4.formula === void 0) delete cell2.formula;
76547
+ else cell2.formula = entry4.formula;
76548
+ if (entry4.arrayRange) cell2.arrayRange = structuredClone(entry4.arrayRange);
76549
76549
  else delete cell2.arrayRange;
76550
76550
  }
76551
76551
  }
@@ -76815,7 +76815,7 @@ function rowMajor(cells3) {
76815
76815
  }
76816
76816
  function touchedCells(step2) {
76817
76817
  const out = [];
76818
- const lists2 = step2.entries.flatMap((entry3) => [entry3.before, entry3.after]).filter((snapshot2) => snapshot2.kind === "cells" && snapshot2.cells.length > 0);
76818
+ const lists2 = step2.entries.flatMap((entry4) => [entry4.before, entry4.after]).filter((snapshot2) => snapshot2.kind === "cells" && snapshot2.cells.length > 0);
76819
76819
  const [first3, second, ...rest] = lists2;
76820
76820
  if (first3 && !rest.length && (!second || second.sheet === first3.sheet)) {
76821
76821
  const sheet2 = first3.sheet;
@@ -76839,8 +76839,8 @@ function touchedCells(step2) {
76839
76839
  out.length = 0;
76840
76840
  }
76841
76841
  const seen = /* @__PURE__ */ new Map();
76842
- for (const entry3 of step2.entries)
76843
- for (const snapshot2 of [entry3.before, entry3.after]) {
76842
+ for (const entry4 of step2.entries)
76843
+ for (const snapshot2 of [entry4.before, entry4.after]) {
76844
76844
  if (snapshot2.kind !== "cells") continue;
76845
76845
  let keys = seen.get(snapshot2.sheet);
76846
76846
  if (!keys) seen.set(snapshot2.sheet, keys = /* @__PURE__ */ new Set());
@@ -76869,8 +76869,8 @@ var History = class {
76869
76869
  const step2 = this.done.pop();
76870
76870
  if (!step2) return void 0;
76871
76871
  for (let i2 = step2.entries.length - 1; i2 >= 0; i2--) {
76872
- const entry3 = step2.entries[i2];
76873
- if (entry3) restoreSnapshot(workbook, entry3.before);
76872
+ const entry4 = step2.entries[i2];
76873
+ if (entry4) restoreSnapshot(workbook, entry4.before);
76874
76874
  }
76875
76875
  this.undone.push(step2);
76876
76876
  return step2;
@@ -76878,7 +76878,7 @@ var History = class {
76878
76878
  redo(workbook) {
76879
76879
  const step2 = this.undone.pop();
76880
76880
  if (!step2) return void 0;
76881
- for (const entry3 of step2.entries) restoreSnapshot(workbook, entry3.after);
76881
+ for (const entry4 of step2.entries) restoreSnapshot(workbook, entry4.after);
76882
76882
  this.done.push(step2);
76883
76883
  return step2;
76884
76884
  }
@@ -76905,7 +76905,7 @@ function setCalcMode(ctx, mode) {
76905
76905
  }
76906
76906
 
76907
76907
  // xlsx/edit/session-calc.ts
76908
- var isStructural = (step2) => step2.structural || step2.entries.some((entry3) => entry3.before.kind !== "cells");
76908
+ var isStructural = (step2) => step2.structural || step2.entries.some((entry4) => entry4.before.kind !== "cells");
76909
76909
  function hintFor(step2, mode) {
76910
76910
  const hint = step2.calc;
76911
76911
  if (!hint) return void 0;
@@ -77815,11 +77815,11 @@ function removeTimelines(workbook, doomed) {
77815
77815
  workbook.slicers = book;
77816
77816
  }
77817
77817
  function timelineOnPivot(workbook, cacheName, tabId, name3) {
77818
- const cache3 = workbook.slicers?.timelineCaches.find((entry3) => entry3.name === cacheName);
77818
+ const cache3 = workbook.slicers?.timelineCaches.find((entry4) => entry4.name === cacheName);
77819
77819
  return !!cache3?.pivots.some((pivot) => pivot.tabId === tabId && pivot.name === name3);
77820
77820
  }
77821
77821
  function slicerOnPivot(workbook, cacheName, tabId, name3) {
77822
- const cache3 = workbook.slicers?.caches.find((entry3) => entry3.name === cacheName);
77822
+ const cache3 = workbook.slicers?.caches.find((entry4) => entry4.name === cacheName);
77823
77823
  return cache3?.source.kind === "pivot" && cache3.source.pivots.some((pivot) => pivot.tabId === tabId && pivot.name === name3);
77824
77824
  }
77825
77825
  function removeSlicers(workbook, doomed) {
@@ -77885,7 +77885,7 @@ function reconcileDateAxes(next, previous) {
77885
77885
  else delete next.moreColumnFields;
77886
77886
  if (next.fieldSubtotals) {
77887
77887
  const kept = next.fieldSubtotals.filter(
77888
- (entry3) => rows.includes(entry3.field) || columns2.includes(entry3.field)
77888
+ (entry4) => rows.includes(entry4.field) || columns2.includes(entry4.field)
77889
77889
  );
77890
77890
  if (kept.length) next.fieldSubtotals = kept;
77891
77891
  else delete next.fieldSubtotals;
@@ -77894,7 +77894,7 @@ function reconcileDateAxes(next, previous) {
77894
77894
 
77895
77895
  // xlsx/edit/pivots.ts
77896
77896
  function pivotAt(ctx, sheet2, name3) {
77897
- const pivot = sheetAt(ctx.workbook, sheet2).pivotTables?.find((entry3) => entry3.name === name3);
77897
+ const pivot = sheetAt(ctx.workbook, sheet2).pivotTables?.find((entry4) => entry4.name === name3);
77898
77898
  if (!pivot) throw new Error("The selected PivotTable is not available.");
77899
77899
  return pivot;
77900
77900
  }
@@ -77975,7 +77975,7 @@ function writePivot(ctx, s, pivot, old, label2, inside2) {
77975
77975
  inside2?.();
77976
77976
  const next = { ...pivot, location, dirty: true };
77977
77977
  const list3 = sheet2.pivotTables ?? [];
77978
- sheet2.pivotTables = old ? list3.map((entry3) => entry3 === old ? next : entry3) : [...list3, next];
77978
+ sheet2.pivotTables = old ? list3.map((entry4) => entry4 === old ? next : entry4) : [...list3, next];
77979
77979
  grid.values.forEach(
77980
77980
  (line3, row3) => line3.forEach((value3, col) => {
77981
77981
  const r = startRow(location, row3);
@@ -78106,7 +78106,7 @@ function refreshPivotTable(ctx, s, name3, patch2 = {}) {
78106
78106
  if (next.dateFilter && !dates.includes(next.dateFilter.field)) delete next.dateFilter;
78107
78107
  if (patch2.fieldSubtotals === void 0 && next.fieldSubtotals) {
78108
78108
  const onAxes = [...pivotRowFields(next), ...pivotColumnFields(next)];
78109
- const left2 = next.fieldSubtotals.filter((entry3) => onAxes.includes(entry3.field));
78109
+ const left2 = next.fieldSubtotals.filter((entry4) => onAxes.includes(entry4.field));
78110
78110
  if (left2.length) next.fieldSubtotals = left2;
78111
78111
  else delete next.fieldSubtotals;
78112
78112
  }
@@ -78144,7 +78144,7 @@ function deletePivotTable(ctx, s, name3) {
78144
78144
  ctx.workbook,
78145
78145
  (timeline) => timelineOnPivot(ctx.workbook, timeline.cache, sheet2.sheetId, pivot.name)
78146
78146
  );
78147
- sheet2.pivotTables = sheet2.pivotTables.filter((entry3) => entry3 !== pivot);
78147
+ sheet2.pivotTables = sheet2.pivotTables.filter((entry4) => entry4 !== pivot);
78148
78148
  forEachCellInRange(sheet2, pivot.location, (_cell, row3, col) => deleteCell(sheet2, row3, col));
78149
78149
  },
78150
78150
  { sheet: s, ranges: [pivot.location] }
@@ -78154,7 +78154,7 @@ function deletePivotTable(ctx, s, name3) {
78154
78154
  // xlsx/edit/timelines.ts
78155
78155
  var TIMELINE_BOX = { w: 480, h: 130 };
78156
78156
  function cacheOf(ctx, name3) {
78157
- const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry3) => entry3.name === name3);
78157
+ const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry4) => entry4.name === name3);
78158
78158
  if (!cache3) throw new Error("The timeline is not available.");
78159
78159
  return cache3;
78160
78160
  }
@@ -78179,13 +78179,13 @@ function setTimelineSelection(ctx, cacheName, selection) {
78179
78179
  selection ? "Filter timeline" : "Clear timeline filter",
78180
78180
  () => {
78181
78181
  const book = cloneBook(ctx.workbook);
78182
- const entry3 = book.timelineCaches.find((item2) => item2.name === cacheName);
78182
+ const entry4 = book.timelineCaches.find((item2) => item2.name === cacheName);
78183
78183
  if (selection) {
78184
- entry3.selection = { ...selection };
78185
- entry3.filterType = "dateBetween";
78184
+ entry4.selection = { ...selection };
78185
+ entry4.filterType = "dateBetween";
78186
78186
  } else {
78187
- delete entry3.selection;
78188
- entry3.filterType = "unknown";
78187
+ delete entry4.selection;
78188
+ entry4.filterType = "unknown";
78189
78189
  }
78190
78190
  book.dirty = true;
78191
78191
  ctx.workbook.slicers = book;
@@ -78193,7 +78193,7 @@ function setTimelineSelection(ctx, cacheName, selection) {
78193
78193
  );
78194
78194
  }
78195
78195
  function updateTimeline(ctx, name3, patch2) {
78196
- if (!ctx.workbook.slicers?.timelines.some((entry3) => entry3.name === name3))
78196
+ if (!ctx.workbook.slicers?.timelines.some((entry4) => entry4.name === name3))
78197
78197
  throw new Error("The timeline is not available.");
78198
78198
  if (patch2.level !== void 0 && ![0, 1, 2, 3].includes(patch2.level) || patch2.caption !== void 0 && patch2.caption.length > 255)
78199
78199
  throw new Error("Choose a valid timeline setting.");
@@ -78203,7 +78203,7 @@ function updateTimeline(ctx, name3, patch2) {
78203
78203
  [{ kind: "meta" }],
78204
78204
  () => {
78205
78205
  const book = cloneBook(ctx.workbook);
78206
- const entry3 = book.timelines.find((item2) => item2.name === name3);
78206
+ const entry4 = book.timelines.find((item2) => item2.name === name3);
78207
78207
  for (const key2 of [
78208
78208
  "caption",
78209
78209
  "showHeader",
@@ -78213,11 +78213,11 @@ function updateTimeline(ctx, name3, patch2) {
78213
78213
  "style"
78214
78214
  ])
78215
78215
  if (patch2[key2] !== void 0)
78216
- entry3[key2] = patch2[key2];
78216
+ entry4[key2] = patch2[key2];
78217
78217
  if (patch2.level !== void 0) {
78218
- entry3.level = patch2.level;
78219
- entry3.selectionLevel = patch2.level;
78220
- delete entry3.scrollPosition;
78218
+ entry4.level = patch2.level;
78219
+ entry4.selectionLevel = patch2.level;
78220
+ delete entry4.scrollPosition;
78221
78221
  }
78222
78222
  book.dirty = true;
78223
78223
  ctx.workbook.slicers = book;
@@ -78228,7 +78228,7 @@ function updateTimeline(ctx, name3, patch2) {
78228
78228
  function insertTimeline(ctx, s, ref) {
78229
78229
  const { workbook } = ctx;
78230
78230
  const sheet2 = sheetAt(workbook, s);
78231
- const pivot = sheet2.pivotTables?.find((entry3) => entry3.name === ref.pivot);
78231
+ const pivot = sheet2.pivotTables?.find((entry4) => entry4.name === ref.pivot);
78232
78232
  if (!pivot || !pivot.dateFields?.includes(ref.field))
78233
78233
  throw new Error("Choose a PivotTable with a date field.");
78234
78234
  const column3 = pivot.fields.indexOf(ref.field);
@@ -78242,11 +78242,11 @@ function insertTimeline(ctx, s, ref) {
78242
78242
  }
78243
78243
  if (earliest > latest) throw new Error("Choose a PivotTable with a date field.");
78244
78244
  const taken = /* @__PURE__ */ new Set([
78245
- ...(workbook.slicers?.slicers ?? []).map((entry3) => entry3.name.toLowerCase()),
78246
- ...(workbook.slicers?.timelines ?? []).map((entry3) => entry3.name.toLowerCase()),
78247
- ...(workbook.slicers?.caches ?? []).map((entry3) => entry3.name.toLowerCase()),
78248
- ...(workbook.slicers?.timelineCaches ?? []).map((entry3) => entry3.name.toLowerCase()),
78249
- ...workbook.definedNames.map((entry3) => entry3.name.toLowerCase())
78245
+ ...(workbook.slicers?.slicers ?? []).map((entry4) => entry4.name.toLowerCase()),
78246
+ ...(workbook.slicers?.timelines ?? []).map((entry4) => entry4.name.toLowerCase()),
78247
+ ...(workbook.slicers?.caches ?? []).map((entry4) => entry4.name.toLowerCase()),
78248
+ ...(workbook.slicers?.timelineCaches ?? []).map((entry4) => entry4.name.toLowerCase()),
78249
+ ...workbook.definedNames.map((entry4) => entry4.name.toLowerCase())
78250
78250
  ]);
78251
78251
  const unique4 = (base3) => {
78252
78252
  if (!taken.has(base3.toLowerCase())) return base3;
@@ -78337,9 +78337,9 @@ function insertTimeline(ctx, s, ref) {
78337
78337
  return name3;
78338
78338
  }
78339
78339
  function deleteTimeline(ctx, name3) {
78340
- const timeline = ctx.workbook.slicers?.timelines.find((entry3) => entry3.name === name3);
78340
+ const timeline = ctx.workbook.slicers?.timelines.find((entry4) => entry4.name === name3);
78341
78341
  if (!timeline) throw new Error("The timeline is not available.");
78342
- const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry3) => entry3.name === timeline.cache);
78342
+ const cache3 = ctx.workbook.slicers?.timelineCaches.find((entry4) => entry4.name === timeline.cache);
78343
78343
  const target3 = cache3 && timelineTarget(ctx.workbook, cache3);
78344
78344
  if (cache3?.selection && target3) {
78345
78345
  setTimelineSelection(ctx, cache3.name, null);
@@ -78348,7 +78348,7 @@ function deleteTimeline(ctx, name3) {
78348
78348
  "Delete timeline",
78349
78349
  "annotations",
78350
78350
  [{ kind: "workbook" }],
78351
- () => removeTimelines(ctx.workbook, (entry3) => entry3.name === name3),
78351
+ () => removeTimelines(ctx.workbook, (entry4) => entry4.name === name3),
78352
78352
  {}
78353
78353
  );
78354
78354
  }
@@ -78599,7 +78599,7 @@ function deleteSparklines(ctx, s, ranges, wholeGroups = false) {
78599
78599
  // xlsx/edit/slicers.ts
78600
78600
  var SLICER_BOX = { w: 144, h: 188 };
78601
78601
  function cacheOf2(workbook, name3) {
78602
- const cache3 = workbook.slicers?.caches.find((entry3) => entry3.name === name3);
78602
+ const cache3 = workbook.slicers?.caches.find((entry4) => entry4.name === name3);
78603
78603
  if (!cache3) throw new Error("The slicer is not available.");
78604
78604
  return cache3;
78605
78605
  }
@@ -78633,7 +78633,7 @@ function setSlicerSelection(ctx, cacheName, keys) {
78633
78633
  return;
78634
78634
  }
78635
78635
  const { pivot } = target3;
78636
- const filters = (pivot.itemFilters ?? []).filter((entry3) => entry3.field !== cache3.sourceName);
78636
+ const filters = (pivot.itemFilters ?? []).filter((entry4) => entry4.field !== cache3.sourceName);
78637
78637
  const hidden = hiddenFor(pivot, cache3.sourceName, keys);
78638
78638
  if (hidden.length) filters.push({ field: cache3.sourceName, hidden });
78639
78639
  const next = { ...pivot };
@@ -78649,7 +78649,7 @@ function setSlicerSelection(ctx, cacheName, keys) {
78649
78649
  );
78650
78650
  }
78651
78651
  function updateSlicer(ctx, name3, patch2) {
78652
- const slicer = ctx.workbook.slicers?.slicers.find((entry3) => entry3.name === name3);
78652
+ const slicer = ctx.workbook.slicers?.slicers.find((entry4) => entry4.name === name3);
78653
78653
  if (!slicer) throw new Error("The slicer is not available.");
78654
78654
  if (patch2.columnCount !== void 0 && (!Number.isInteger(patch2.columnCount) || patch2.columnCount < 1 || patch2.columnCount > 2e4) || patch2.rowHeight !== void 0 && !(patch2.rowHeight >= 38100 && patch2.rowHeight <= 9144e3) || patch2.caption !== void 0 && patch2.caption.length > 255)
78655
78655
  throw new Error("Choose a valid slicer setting.");
@@ -78659,14 +78659,14 @@ function updateSlicer(ctx, name3, patch2) {
78659
78659
  [{ kind: "meta" }],
78660
78660
  () => {
78661
78661
  const book = cloneBook(ctx.workbook);
78662
- const entry3 = book.slicers.find((item2) => item2.name === name3);
78663
- const cache3 = book.caches.find((item2) => item2.name === entry3.cache);
78662
+ const entry4 = book.slicers.find((item2) => item2.name === name3);
78663
+ const cache3 = book.caches.find((item2) => item2.name === entry4.cache);
78664
78664
  for (const key2 of ["caption", "style", "rowHeight", "showCaption"])
78665
78665
  if (patch2[key2] !== void 0)
78666
- entry3[key2] = patch2[key2];
78666
+ entry4[key2] = patch2[key2];
78667
78667
  if (patch2.columnCount !== void 0) {
78668
- if (patch2.columnCount === 1) delete entry3.columnCount;
78669
- else entry3.columnCount = patch2.columnCount;
78668
+ if (patch2.columnCount === 1) delete entry4.columnCount;
78669
+ else entry4.columnCount = patch2.columnCount;
78670
78670
  }
78671
78671
  if (patch2.sortOrder !== void 0) cache3.sortOrder = patch2.sortOrder;
78672
78672
  if (patch2.hideNoData !== void 0) {
@@ -78702,7 +78702,7 @@ function insertSlicer(ctx, s, ref) {
78702
78702
  let field2;
78703
78703
  if (ref.kind === "table") {
78704
78704
  table4 = sheet2.tables.find(
78705
- (entry3) => entry3.name === ref.table || entry3.displayName === ref.table
78705
+ (entry4) => entry4.name === ref.table || entry4.displayName === ref.table
78706
78706
  );
78707
78707
  if (!table4?.headerRow || table4.filterNotModeled)
78708
78708
  throw new Error("Choose a table with a header row and value filters.");
@@ -78710,16 +78710,16 @@ function insertSlicer(ctx, s, ref) {
78710
78710
  if (!table4.columns.some((column3) => column3.name === field2))
78711
78711
  throw new Error("Choose a column of the table.");
78712
78712
  } else {
78713
- pivot = sheet2.pivotTables?.find((entry3) => entry3.name === ref.pivot);
78713
+ pivot = sheet2.pivotTables?.find((entry4) => entry4.name === ref.pivot);
78714
78714
  if (!pivot) throw new Error("Choose a PivotTable that can be refreshed.");
78715
78715
  field2 = ref.field;
78716
78716
  if (!pivot.fields.includes(field2) || pivot.pageFilter?.field === field2)
78717
78717
  throw new Error("Choose a PivotTable field that is not the report filter.");
78718
78718
  }
78719
78719
  const names = /* @__PURE__ */ new Set([
78720
- ...(workbook.slicers?.slicers ?? []).map((entry3) => entry3.name.toLowerCase()),
78721
- ...(workbook.slicers?.caches ?? []).map((entry3) => entry3.name.toLowerCase()),
78722
- ...workbook.definedNames.map((entry3) => entry3.name.toLowerCase())
78720
+ ...(workbook.slicers?.slicers ?? []).map((entry4) => entry4.name.toLowerCase()),
78721
+ ...(workbook.slicers?.caches ?? []).map((entry4) => entry4.name.toLowerCase()),
78722
+ ...workbook.definedNames.map((entry4) => entry4.name.toLowerCase())
78723
78723
  ]);
78724
78724
  const slicerName = unique2(field2, (c2) => names.has(c2.toLowerCase()));
78725
78725
  const cacheName = unique2(
@@ -79007,22 +79007,22 @@ var BUILTIN_CELL_STYLES = [
79007
79007
  }
79008
79008
  ];
79009
79009
  var builtinCellStyle = (name3) => BUILTIN_CELL_STYLES.find((s) => s.name.toLowerCase() === name3.toLowerCase());
79010
- function applyBuiltinStyle(base3, entry3, normal3) {
79011
- if (entry3.builtinId === 0) {
79010
+ function applyBuiltinStyle(base3, entry4, normal3) {
79011
+ if (entry4.builtinId === 0) {
79012
79012
  const reset = structuredClone(normal3);
79013
79013
  delete reset.cellStyleName;
79014
79014
  return { ...reset, cellStyleName: "Normal" };
79015
79015
  }
79016
- const next = { ...structuredClone(base3), cellStyleName: entry3.name };
79017
- if (entry3.font) {
79018
- const font = { ...structuredClone(normal3.font), ...structuredClone(entry3.font) };
79016
+ const next = { ...structuredClone(base3), cellStyleName: entry4.name };
79017
+ if (entry4.font) {
79018
+ const font = { ...structuredClone(normal3.font), ...structuredClone(entry4.font) };
79019
79019
  next.font = font;
79020
79020
  }
79021
- if (entry3.fill) next.fill = structuredClone(entry3.fill);
79022
- if (entry3.border) next.border = structuredClone(entry3.border);
79023
- if (entry3.numFmt !== void 0) next.numFmt = entry3.numFmt;
79024
- if (entry3.alignment) next.alignment = structuredClone(entry3.alignment);
79025
- if (entry3.protection) next.protection = structuredClone(entry3.protection);
79021
+ if (entry4.fill) next.fill = structuredClone(entry4.fill);
79022
+ if (entry4.border) next.border = structuredClone(entry4.border);
79023
+ if (entry4.numFmt !== void 0) next.numFmt = entry4.numFmt;
79024
+ if (entry4.alignment) next.alignment = structuredClone(entry4.alignment);
79025
+ if (entry4.protection) next.protection = structuredClone(entry4.protection);
79026
79026
  return next;
79027
79027
  }
79028
79028
 
@@ -79034,13 +79034,13 @@ function ensureNamedStyle(workbook, name3) {
79034
79034
  const builtin = builtinCellStyle(name3);
79035
79035
  if (!builtin) throw new Error(`Unknown cell style "${name3}".`);
79036
79036
  const normal3 = styleAt(workbook, 0);
79037
- const entry3 = {
79037
+ const entry4 = {
79038
79038
  name: builtin.name,
79039
79039
  style: applyBuiltinStyle(normal3, builtin, normal3),
79040
79040
  builtinId: builtin.builtinId
79041
79041
  };
79042
- workbook.namedStyles.push(entry3);
79043
- return entry3;
79042
+ workbook.namedStyles.push(entry4);
79043
+ return entry4;
79044
79044
  }
79045
79045
  function styled(base3, named3, builtin, normal3) {
79046
79046
  if (!builtin) return { ...structuredClone(named3.style), cellStyleName: named3.name };
@@ -80085,9 +80085,9 @@ function resetPageBreaks(ctx, s) {
80085
80085
  "view",
80086
80086
  [{ kind: "parts", sheet: s, parts: ["preserved"] }],
80087
80087
  () => {
80088
- for (const entry3 of next) {
80089
- if (entry3.xml.length) sheet2.preserved.set(entry3.key, entry3.xml);
80090
- else sheet2.preserved.delete(entry3.key);
80088
+ for (const entry4 of next) {
80089
+ if (entry4.xml.length) sheet2.preserved.set(entry4.key, entry4.xml);
80090
+ else sheet2.preserved.delete(entry4.key);
80091
80091
  }
80092
80092
  },
80093
80093
  { sheet: s }
@@ -80101,7 +80101,7 @@ function refs(ast) {
80101
80101
  }
80102
80102
  function printTitles(workbook, sheetIndex2) {
80103
80103
  const name3 = workbook.definedNames.find(
80104
- (entry3) => entry3.name === PRINT_TITLES_NAME && entry3.localSheet === sheetIndex2
80104
+ (entry4) => entry4.name === PRINT_TITLES_NAME && entry4.localSheet === sheetIndex2
80105
80105
  );
80106
80106
  if (!name3) return {};
80107
80107
  try {
@@ -80214,13 +80214,13 @@ function setDefinedName(ctx, name3) {
80214
80214
  const problem2 = name3.name.startsWith("_xlnm.") ? void 0 : validateDefinedName(name3.name);
80215
80215
  if (problem2) throw new Error(problem2);
80216
80216
  if (name3.localSheet !== void 0) sheetAt(ctx.workbook, name3.localSheet);
80217
- const entry3 = structuredClone(name3);
80218
- entry3.formula = entry3.formula.replace(/^=/, "");
80217
+ const entry4 = structuredClone(name3);
80218
+ entry4.formula = entry4.formula.replace(/^=/, "");
80219
80219
  ctx.run("Define name", "names", [{ kind: "meta" }], () => {
80220
80220
  const { definedNames } = ctx.workbook;
80221
80221
  const index5 = definedNames.findIndex((n) => sameName(n, name3.name, name3.localSheet));
80222
- if (index5 >= 0) definedNames[index5] = entry3;
80223
- else definedNames.push(entry3);
80222
+ if (index5 >= 0) definedNames[index5] = entry4;
80223
+ else definedNames.push(entry4);
80224
80224
  });
80225
80225
  }
80226
80226
  function deleteDefinedName(ctx, name3, localSheet) {
@@ -80607,7 +80607,7 @@ function lineHeightPoints(sizePt) {
80607
80607
  }
80608
80608
  return Math.max(0.75, Math.ceil(height / 0.75 - 1e-9) * 0.75);
80609
80609
  }
80610
- function wrappedLineCount2(text9, width, measure5) {
80610
+ function wrappedLineCount2(text9, width, measure6) {
80611
80611
  let lines3 = 0;
80612
80612
  for (const paragraph2 of text9.split(/\r?\n/)) {
80613
80613
  lines3++;
@@ -80616,14 +80616,14 @@ function wrappedLineCount2(text9, width, measure5) {
80616
80616
  for (const word of paragraph2.split(/(\s+)/)) {
80617
80617
  if (word === "") continue;
80618
80618
  const next = current + word;
80619
- if (current.trim() === "" || measure5(next) <= width) current = next;
80619
+ if (current.trim() === "" || measure6(next) <= width) current = next;
80620
80620
  else {
80621
80621
  lines3++;
80622
80622
  current = word.trimStart();
80623
80623
  }
80624
- while (current.length > 1 && measure5(current) > width) {
80624
+ while (current.length > 1 && measure6(current) > width) {
80625
80625
  let fit3 = 1;
80626
- while (fit3 < current.length && measure5(current.slice(0, fit3 + 1)) <= width) fit3++;
80626
+ while (fit3 < current.length && measure6(current.slice(0, fit3 + 1)) <= width) fit3++;
80627
80627
  current = current.slice(fit3);
80628
80628
  lines3++;
80629
80629
  }
@@ -80631,7 +80631,7 @@ function wrappedLineCount2(text9, width, measure5) {
80631
80631
  }
80632
80632
  return lines3;
80633
80633
  }
80634
- function fitRowHeights(workbook, sheetIndex2, rows, measure5) {
80634
+ function fitRowHeights(workbook, sheetIndex2, rows, measure6) {
80635
80635
  const heights = /* @__PURE__ */ new Map();
80636
80636
  const sheet2 = workbook.sheets[sheetIndex2];
80637
80637
  if (!sheet2) return heights;
@@ -80657,7 +80657,7 @@ function fitRowHeights(workbook, sheetIndex2, rows, measure5) {
80657
80657
  if (view.wrap) {
80658
80658
  colWidth ??= createColumnWidths(sheet2, { zoom: 100 });
80659
80659
  const width = colWidth(col) - COLUMN_PADDING_PX - 1 - view.indentPx;
80660
- lines3 = wrappedLineCount2(view.text, width, (text9) => measure5(text9, view.font));
80660
+ lines3 = wrappedLineCount2(view.text, width, (text9) => measure6(text9, view.font));
80661
80661
  }
80662
80662
  tallest = Math.max(tallest, lines3 * lineHeightPoints(sizePt));
80663
80663
  }
@@ -80669,13 +80669,13 @@ var approximateMeasure = (text9, font) => text9.length * font.sizePx * (font.bol
80669
80669
 
80670
80670
  // xlsx/edit/row-autofit.ts
80671
80671
  var MAX_HEIGHT2 = 409;
80672
- function autoGrowRows(ctx, s, rows, measure5 = approximateMeasure) {
80672
+ function autoGrowRows(ctx, s, rows, measure6 = approximateMeasure) {
80673
80673
  const sheet2 = sheetAt(ctx.workbook, s);
80674
80674
  const candidates = [...new Set(rows)].filter((row3) => {
80675
80675
  const info = sheet2.rowInfo.get(row3);
80676
80676
  return !info?.customHeight && !info?.hidden;
80677
80677
  });
80678
- const fits4 = fitRowHeights(ctx.workbook, s, candidates, measure5);
80678
+ const fits4 = fitRowHeights(ctx.workbook, s, candidates, measure6);
80679
80679
  const updates = [];
80680
80680
  for (const row3 of candidates) {
80681
80681
  const fit3 = Math.min(MAX_HEIGHT2, fits4.get(row3) ?? sheet2.defaultRowHeight);
@@ -81234,8 +81234,8 @@ function createEditSession(workbook, options2 = {}) {
81234
81234
  };
81235
81235
  const rollback = (current, from) => {
81236
81236
  for (let i2 = current.step.entries.length - 1; i2 >= from; i2--) {
81237
- const entry3 = current.step.entries[i2];
81238
- if (entry3) restoreSnapshot(workbook, entry3.before);
81237
+ const entry4 = current.step.entries[i2];
81238
+ if (entry4) restoreSnapshot(workbook, entry4.before);
81239
81239
  }
81240
81240
  current.step.entries.length = from;
81241
81241
  };
@@ -81330,7 +81330,7 @@ function createEditSession(workbook, options2 = {}) {
81330
81330
  deleteColumns: (s, at3, count3) => deleteColumns(ctx, s, at3, count3),
81331
81331
  insertCellsShift: (s, range3, dir) => insertCellsShift(ctx, s, range3, dir),
81332
81332
  deleteCellsShift: (s, range3, dir) => deleteCellsShift(ctx, s, range3, dir),
81333
- setColumnWidth: (s, cols, width, measure5) => setColumnWidth(ctx, s, cols, width, measure5),
81333
+ setColumnWidth: (s, cols, width, measure6) => setColumnWidth(ctx, s, cols, width, measure6),
81334
81334
  setRowHeight: (s, rows, height) => setRowHeight(ctx, s, rows, height),
81335
81335
  setHidden: (s, axis, indices, hidden) => setHidden(ctx, s, axis, indices, hidden),
81336
81336
  merge: (s, range3, mode) => merge(ctx, s, range3, mode),
@@ -81842,8 +81842,8 @@ function color2(value3) {
81842
81842
  if (!value3) return void 0;
81843
81843
  const out = {};
81844
81844
  if (value3.rgb) {
81845
- const rgb7 = value3.rgb.toUpperCase();
81846
- out.rgb = rgb7.length === 6 ? `FF${rgb7}` : rgb7;
81845
+ const rgb8 = value3.rgb.toUpperCase();
81846
+ out.rgb = rgb8.length === 6 ? `FF${rgb8}` : rgb8;
81847
81847
  }
81848
81848
  if (value3.theme !== void 0) out.theme = value3.theme;
81849
81849
  if (value3.indexed !== void 0) out.indexed = value3.indexed;
@@ -81929,11 +81929,11 @@ function formatAttributeKeys(style4) {
81929
81929
  function withCanonicalColors(value3) {
81930
81930
  if (Array.isArray(value3)) return value3.map(withCanonicalColors);
81931
81931
  if (!value3 || typeof value3 !== "object") return value3;
81932
- const entries = Object.entries(value3).map(([key2, entry3]) => [key2, withCanonicalColors(entry3)]);
81932
+ const entries = Object.entries(value3).map(([key2, entry4]) => [key2, withCanonicalColors(entry4)]);
81933
81933
  const out = Object.fromEntries(entries);
81934
81934
  if (typeof out.rgb === "string") {
81935
- const rgb7 = out.rgb.toUpperCase();
81936
- out.rgb = rgb7.length === 6 ? `FF${rgb7}` : rgb7;
81935
+ const rgb8 = out.rgb.toUpperCase();
81936
+ out.rgb = rgb8.length === 6 ? `FF${rgb8}` : rgb8;
81937
81937
  }
81938
81938
  if (out.tint === 0) delete out.tint;
81939
81939
  return out;
@@ -82803,8 +82803,8 @@ function canonicalJson(value3) {
82803
82803
  if (Array.isArray(value3))
82804
82804
  return `[${value3.map((item2) => canonicalJson(item2 ?? null)).join(",")}]`;
82805
82805
  if (value3 && typeof value3 === "object") {
82806
- const entries = Object.entries(value3).filter(([, entry3]) => entry3 !== void 0).sort(([a2], [b]) => a2 < b ? -1 : a2 > b ? 1 : 0);
82807
- return `{${entries.map(([key2, entry3]) => `${JSON.stringify(key2)}:${canonicalJson(entry3)}`).join(",")}}`;
82806
+ const entries = Object.entries(value3).filter(([, entry4]) => entry4 !== void 0).sort(([a2], [b]) => a2 < b ? -1 : a2 > b ? 1 : 0);
82807
+ return `{${entries.map(([key2, entry4]) => `${JSON.stringify(key2)}:${canonicalJson(entry4)}`).join(",")}}`;
82808
82808
  }
82809
82809
  return JSON.stringify(value3) ?? "null";
82810
82810
  }
@@ -83199,8 +83199,8 @@ var VisioPackage = class _VisioPackage {
83199
83199
  this.entries = entries;
83200
83200
  this.limits = limits;
83201
83201
  this.deadline = deadline;
83202
- for (const entry3 of entries.values())
83203
- if (!entry3.directory) this.decodedNames.set(decodePath(entry3.name), entry3.name);
83202
+ for (const entry4 of entries.values())
83203
+ if (!entry4.directory) this.decodedNames.set(decodePath(entry4.name), entry4.name);
83204
83204
  }
83205
83205
  zip;
83206
83206
  entries;
@@ -83260,15 +83260,15 @@ var VisioPackage = class _VisioPackage {
83260
83260
  }
83261
83261
  /** The declared CRC-32 and size of a part, or an empty string when the package lacks it. */
83262
83262
  printOf(path4) {
83263
- const entry3 = this.entries.get(path4);
83264
- return entry3 && !entry3.directory ? `${entry3.crc}:${entry3.size}` : "";
83263
+ const entry4 = this.entries.get(path4);
83264
+ return entry4 && !entry4.directory ? `${entry4.crc}:${entry4.size}` : "";
83265
83265
  }
83266
83266
  has(path4) {
83267
83267
  this.noted?.add(path4);
83268
83268
  return this.entries.get(path4)?.directory === false;
83269
83269
  }
83270
83270
  paths() {
83271
- return [...this.entries.values()].filter((entry3) => !entry3.directory).map((entry3) => entry3.name);
83271
+ return [...this.entries.values()].filter((entry4) => !entry4.directory).map((entry4) => entry4.name);
83272
83272
  }
83273
83273
  async readXml(path4, expectedRoot) {
83274
83274
  this.check();
@@ -83290,9 +83290,9 @@ var VisioPackage = class _VisioPackage {
83290
83290
  this.check();
83291
83291
  this.noted?.add(path4);
83292
83292
  safePath(path4);
83293
- const entry3 = this.entries.get(path4);
83294
- if (!entry3 || entry3.directory) fail3("MISSING_PART", `Missing package part: ${path4}`);
83295
- return entry3.size;
83293
+ const entry4 = this.entries.get(path4);
83294
+ if (!entry4 || entry4.directory) fail3("MISSING_PART", `Missing package part: ${path4}`);
83295
+ return entry4.size;
83296
83296
  }
83297
83297
  /** Shared package-owned bytes. Treat the returned buffer as immutable. */
83298
83298
  async readBytes(path4) {
@@ -83309,8 +83309,8 @@ var VisioPackage = class _VisioPackage {
83309
83309
  return bytes;
83310
83310
  }
83311
83311
  async loadBytes(path4) {
83312
- const entry3 = this.entries.get(path4), file2 = this.zip.file(path4);
83313
- if (!entry3 || entry3.directory || !file2)
83312
+ const entry4 = this.entries.get(path4), file2 = this.zip.file(path4);
83313
+ if (!entry4 || entry4.directory || !file2)
83314
83314
  return fail3("MISSING_PART", `Missing package part: ${path4}`);
83315
83315
  return new Promise((resolve3, reject2) => {
83316
83316
  const stream = file2.internalStream("uint8array");
@@ -83341,9 +83341,9 @@ var VisioPackage = class _VisioPackage {
83341
83341
  fail3("LIMIT_ENTRY", `Actual inflated entry exceeds limit: ${path4}`);
83342
83342
  if (this.totalOutput > this.limits.maxTotalBytes)
83343
83343
  fail3("LIMIT_TOTAL", "Actual inflated ZIP total exceeds limit");
83344
- if (size3 > Math.max(1, entry3.compressed) * this.limits.maxCompressionRatio)
83344
+ if (size3 > Math.max(1, entry4.compressed) * this.limits.maxCompressionRatio)
83345
83345
  fail3("LIMIT_RATIO", `Actual ZIP compression ratio exceeds limit: ${path4}`);
83346
- if (size3 > entry3.size)
83346
+ if (size3 > entry4.size)
83347
83347
  fail3("ZIP_MISMATCH", `Actual ZIP entry exceeds declared size: ${path4}`);
83348
83348
  crc = crc32(chunk, crc);
83349
83349
  chunks.push(chunk);
@@ -83352,7 +83352,7 @@ var VisioPackage = class _VisioPackage {
83352
83352
  }
83353
83353
  }).on("error", abort).on("end", () => {
83354
83354
  if (settled) return;
83355
- if (size3 !== entry3.size || (crc ^ 4294967295) >>> 0 !== entry3.crc) {
83355
+ if (size3 !== entry4.size || (crc ^ 4294967295) >>> 0 !== entry4.crc) {
83356
83356
  abort(new VisioPackageError("ZIP_MISMATCH", `Inflated size or CRC mismatch: ${path4}`));
83357
83357
  return;
83358
83358
  }
@@ -87329,20 +87329,20 @@ function drawingPaint(node4, colors, placeholder3, depth = 0) {
87329
87329
  (transform9) => !SUPPORTED_TRANSFORMS.has(transform9.name) || (integer7(transform9.value) ?? 100001) > 1e5
87330
87330
  ))
87331
87331
  return void 0;
87332
- let rgb7;
87332
+ let rgb8;
87333
87333
  let inherited;
87334
- if (color4.kind === "srgb") rgb7 = color4.value;
87335
- else if (color4.kind === "system") rgb7 = color4.fallback;
87334
+ if (color4.kind === "srgb") rgb8 = color4.value;
87335
+ else if (color4.kind === "system") rgb8 = color4.fallback;
87336
87336
  else if (color4.kind === "scheme") {
87337
- if (color4.value === "phClr") rgb7 = placeholder3;
87337
+ if (color4.value === "phClr") rgb8 = placeholder3;
87338
87338
  else {
87339
87339
  inherited = drawingPaint(colors.get(color4.value), colors, placeholder3, depth + 1);
87340
- rgb7 = inherited?.color;
87340
+ rgb8 = inherited?.color;
87341
87341
  }
87342
87342
  }
87343
- if (!rgb7 || !/^#?[\da-f]{6}$/i.test(rgb7)) return void 0;
87343
+ if (!rgb8 || !/^#?[\da-f]{6}$/i.test(rgb8)) return void 0;
87344
87344
  const resolved = resolveDrawingColor(
87345
- { kind: "srgb", value: rgb7.replace(/^#/, ""), transforms },
87345
+ { kind: "srgb", value: rgb8.replace(/^#/, ""), transforms },
87346
87346
  void 0,
87347
87347
  { transformOrder: "document" }
87348
87348
  );
@@ -88333,7 +88333,7 @@ function shapeShadow(cells3, color4, report, themed) {
88333
88333
  "approximate-shadow-offset",
88334
88334
  "A shadow without a shape offset uses Visio's default 0.125 inch page offset."
88335
88335
  );
88336
- const clamp4 = (value3, limit3) => Math.max(-limit3, Math.min(limit3, value3));
88336
+ const clamp5 = (value3, limit3) => Math.max(-limit3, Math.min(limit3, value3));
88337
88337
  const transparency = number2(cells3, "ShdwForegndTrans", 0, report);
88338
88338
  report(
88339
88339
  "unverified-shadow",
@@ -88342,8 +88342,8 @@ function shapeShadow(cells3, color4, report, themed) {
88342
88342
  return {
88343
88343
  color: color4("ShdwForegnd", "#000000"),
88344
88344
  opacity: Math.max(0, Math.min(1, 1 - transparency)),
88345
- offsetX: clamp4(hasOffset ? number2(cells3, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
88346
- offsetY: clamp4(hasOffset ? number2(cells3, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
88345
+ offsetX: clamp5(hasOffset ? number2(cells3, "ShapeShdwOffsetX", 0.125, report) : 0.125, 1e3),
88346
+ offsetY: clamp5(hasOffset ? number2(cells3, "ShapeShdwOffsetY", -0.125, report) : -0.125, 1e3),
88347
88347
  blur: Math.max(0, Math.min(10, number2(cells3, "ShapeShdwBlur", 0, report)))
88348
88348
  };
88349
88349
  }
@@ -88351,30 +88351,30 @@ function shapeShadow(cells3, color4, report, themed) {
88351
88351
  // visio/effects.ts
88352
88352
  function shapeEffects(cells3, color4, report, themed) {
88353
88353
  const explicit = (name3) => cells3.has(name3) && cells3.get(name3)?.value !== "Themed";
88354
- const clamp4 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
88354
+ const clamp5 = (value3, maximum) => Math.max(0, Math.min(maximum, value3));
88355
88355
  const result2 = {};
88356
- const glow = explicit("GlowSize") ? clamp4(number2(cells3, "GlowSize", 0, report), 2.5) : 0;
88356
+ const glow = explicit("GlowSize") ? clamp5(number2(cells3, "GlowSize", 0, report), 2.5) : 0;
88357
88357
  if (glow > 0) {
88358
- const opacity2 = 1 - clamp4(number2(cells3, "GlowColorTrans", 0, report), 1);
88358
+ const opacity2 = 1 - clamp5(number2(cells3, "GlowColorTrans", 0, report), 1);
88359
88359
  if (opacity2 > 0) result2.glow = { color: color4("GlowColor", "#000000"), opacity: opacity2, size: glow };
88360
88360
  }
88361
- const soft = explicit("SoftEdgesSize") ? clamp4(number2(cells3, "SoftEdgesSize", 0, report), 2) : 0;
88361
+ const soft = explicit("SoftEdgesSize") ? clamp5(number2(cells3, "SoftEdgesSize", 0, report), 2) : 0;
88362
88362
  if (soft > 0) result2.softEdges = soft;
88363
- const size3 = explicit("ReflectionSize") ? clamp4(number2(cells3, "ReflectionSize", 0, report), 1) : 0;
88363
+ const size3 = explicit("ReflectionSize") ? clamp5(number2(cells3, "ReflectionSize", 0, report), 1) : 0;
88364
88364
  if (size3 > 0) {
88365
- const opacity2 = 1 - clamp4(number2(cells3, "ReflectionTrans", 0, report), 1);
88365
+ const opacity2 = 1 - clamp5(number2(cells3, "ReflectionTrans", 0, report), 1);
88366
88366
  if (opacity2 > 0)
88367
88367
  result2.reflection = {
88368
88368
  opacity: opacity2,
88369
88369
  size: size3,
88370
- distance: clamp4(number2(cells3, "ReflectionDist", 0, report), 2),
88371
- blur: clamp4(number2(cells3, "ReflectionBlur", 0, report), 2)
88370
+ distance: clamp5(number2(cells3, "ReflectionDist", 0, report), 2),
88371
+ blur: clamp5(number2(cells3, "ReflectionBlur", 0, report), 2)
88372
88372
  };
88373
88373
  }
88374
- const themedCell = (...names) => names.some((name3) => cells3.get(name3)?.value === "Themed");
88375
- if (themed?.glow && themedCell("GlowSize")) result2.glow = themed.glow;
88376
- if (themed?.softEdges && themedCell("SoftEdgesSize")) result2.softEdges = themed.softEdges;
88377
- if (themed?.reflection && themedCell("ReflectionSize", "ReflectionTrans"))
88374
+ const themedCell2 = (...names) => names.some((name3) => cells3.get(name3)?.value === "Themed");
88375
+ if (themed?.glow && themedCell2("GlowSize")) result2.glow = themed.glow;
88376
+ if (themed?.softEdges && themedCell2("SoftEdgesSize")) result2.softEdges = themed.softEdges;
88377
+ if (themed?.reflection && themedCell2("ReflectionSize", "ReflectionTrans"))
88378
88378
  result2.reflection = themed.reflection;
88379
88379
  if (result2.glow || result2.softEdges || result2.reflection)
88380
88380
  report(
@@ -88410,7 +88410,11 @@ var VISIO_ROTATION_PRESETS = [
88410
88410
  ["off-axis-right", "Off Axis Right", 30, 20, 0, 0],
88411
88411
  ["perspective-left", "Perspective Left", -35, 0, 0, 60],
88412
88412
  ["perspective-right", "Perspective Right", 35, 0, 0, 60],
88413
- ["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60]
88413
+ ["perspective-relaxed", "Perspective Relaxed", 20, 10, 0, 60],
88414
+ ["perspective-above", "Perspective Above", 0, -25, 0, 60],
88415
+ ["perspective-below", "Perspective Below", 0, 25, 0, 60],
88416
+ ["perspective-heroic-left", "Perspective Heroic Left", -45, -20, 0, 90],
88417
+ ["perspective-heroic-right", "Perspective Heroic Right", 45, -20, 0, 90]
88414
88418
  ].map(([id5, label2, x, y, z2, perspective]) => ({
88415
88419
  id: id5,
88416
88420
  label: label2,
@@ -88435,6 +88439,39 @@ function rotationWrites(id5, add5) {
88435
88439
  add5("RotationZAngle", radians(preset.z), "FillStyle", "DEG");
88436
88440
  add5("Perspective", radians(preset.perspective), "FillStyle", "DEG");
88437
88441
  }
88442
+ var rgb2 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
88443
+ function solidWrites(edit2, add5) {
88444
+ if (edit2.extrusionDepth !== void 0)
88445
+ add5("BevelDepthSize", edit2.extrusionDepth / 72, "FillStyle", "PT");
88446
+ if (edit2.extrusionColor !== void 0)
88447
+ add5("BevelDepthColor", edit2.extrusionColor, "FillStyle", void 0, rgb2(edit2.extrusionColor));
88448
+ if (edit2.contourSize !== void 0)
88449
+ add5("BevelContourSize", edit2.contourSize / 72, "FillStyle", "PT");
88450
+ if (edit2.contourColor !== void 0)
88451
+ add5("BevelContourColor", edit2.contourColor, "FillStyle", void 0, rgb2(edit2.contourColor));
88452
+ }
88453
+ function snapshotSolid(edit2) {
88454
+ const length = (value3, high, what) => {
88455
+ if (typeof value3 !== "number" || !Number.isFinite(value3) || value3 < 0 || value3 > high)
88456
+ fail3("INVALID_EDIT", `${what} must be 0 to ${high} points.`);
88457
+ return Math.round(value3 * 100) / 100;
88458
+ };
88459
+ const color4 = (value3, what) => {
88460
+ if (typeof value3 !== "string" || !/^#[0-9a-f]{6}$/i.test(value3))
88461
+ fail3("INVALID_EDIT", `${what} requires six hexadecimal digits.`);
88462
+ return value3.toLowerCase();
88463
+ };
88464
+ const result2 = {};
88465
+ if (edit2.extrusionDepth !== void 0)
88466
+ result2.extrusionDepth = length(edit2.extrusionDepth, 288, "Extrusion depth");
88467
+ if (edit2.extrusionColor !== void 0)
88468
+ result2.extrusionColor = color4(edit2.extrusionColor, "The extrusion colour");
88469
+ if (edit2.contourSize !== void 0)
88470
+ result2.contourSize = length(edit2.contourSize, 72, "Contour size");
88471
+ if (edit2.contourColor !== void 0)
88472
+ result2.contourColor = color4(edit2.contourColor, "The contour colour");
88473
+ return result2;
88474
+ }
88438
88475
  function snapshotBevel(value3) {
88439
88476
  if (!isVisioBevelPreset(value3)) fail3("INVALID_EDIT", "Unknown bevel preset.");
88440
88477
  return value3;
@@ -88443,14 +88480,29 @@ function snapshotRotation(value3) {
88443
88480
  if (!isVisioRotationPreset(value3)) fail3("INVALID_EDIT", "Unknown 3-D rotation preset.");
88444
88481
  return value3;
88445
88482
  }
88446
- var saved = (cells3, name3) => cells3.has(name3) && cells3.get(name3)?.value !== "Themed" ? number2(cells3, name3, 0) : 0;
88447
- function shapeBevel(cells3) {
88448
- const type = Math.trunc(saved(cells3, "BevelTopType"));
88449
- const width = Math.max(0, Math.min(2, saved(cells3, "BevelTopWidth")));
88450
- const height = Math.max(0, Math.min(2, saved(cells3, "BevelTopHeight")));
88451
- return type >= 1 && type <= 12 && (width > 0 || height > 0) ? { type, width, height } : void 0;
88452
- }
88453
- var hasUndrawnBevel = (cells3) => saved(cells3, "BevelBottomType") > 0 || saved(cells3, "BevelContourSize") > 0;
88483
+ var themedCell = (cells3, name3) => cells3.get(name3)?.value === "Themed";
88484
+ var saved = (cells3, name3) => cells3.has(name3) && !themedCell(cells3, name3) ? number2(cells3, name3, 0) : 0;
88485
+ var clamp4 = (value3, high) => Math.max(0, Math.min(high, value3));
88486
+ function shapeBevel(cells3, themed) {
88487
+ const read = (name3, themeValue) => themedCell(cells3, name3) ? themeValue ?? 0 : saved(cells3, name3);
88488
+ const type = Math.trunc(read("BevelTopType", themed?.bevel?.type));
88489
+ const width = clamp4(read("BevelTopWidth", themed?.bevel?.width), 2);
88490
+ const height = clamp4(read("BevelTopHeight", themed?.bevel?.height), 2);
88491
+ return type >= 1 && type <= 12 ? { type, width, height } : void 0;
88492
+ }
88493
+ function shapeExtrusion(cells3, solid3, colorOf4) {
88494
+ const depth = clamp4(saved(cells3, "BevelDepthSize"), 4);
88495
+ return solid3 && depth > 0 ? { depth, color: colorOf4("BevelDepthColor", "#ffffff") } : void 0;
88496
+ }
88497
+ function shapeContour(cells3, solid3, themed, colorOf4) {
88498
+ const size3 = clamp4(
88499
+ themedCell(cells3, "BevelContourSize") ? themed?.contour?.size ?? 0 : saved(cells3, "BevelContourSize"),
88500
+ 1
88501
+ );
88502
+ const color4 = themedCell(cells3, "BevelContourColor") ? themed?.contour?.color ?? colorOf4("BevelContourColor", "#000000") : colorOf4("BevelContourColor", "#000000");
88503
+ return solid3 && size3 > 0 ? { size: size3, color: color4 } : void 0;
88504
+ }
88505
+ var hasUndrawnBevel = (cells3) => saved(cells3, "BevelBottomType") > 0;
88454
88506
  function shapeRotation3d(cells3) {
88455
88507
  const angle = (name3) => Math.max(-Math.PI, Math.min(Math.PI, saved(cells3, name3)));
88456
88508
  const x = angle("RotationXAngle"), y = angle("RotationYAngle"), z2 = angle("RotationZAngle");
@@ -88465,6 +88517,52 @@ function shapeRotation3d(cells3) {
88465
88517
  };
88466
88518
  }
88467
88519
 
88520
+ // visio/theme-solid.ts
88521
+ var PRESETS = [
88522
+ "circle",
88523
+ "relaxedInset",
88524
+ "cross",
88525
+ "coolSlant",
88526
+ "angle",
88527
+ "softRound",
88528
+ "convex",
88529
+ "slope",
88530
+ "divot",
88531
+ "riblet",
88532
+ "hardEdge",
88533
+ "artDeco"
88534
+ ];
88535
+ var EMU2 = 914400;
88536
+ var measure4 = (node4, name3, fallback) => {
88537
+ const raw2 = node4.getAttribute(name3);
88538
+ return raw2 !== null && /^\d{1,10}$/.test(raw2) ? Number(raw2) / EMU2 : fallback;
88539
+ };
88540
+ function themeSolid(cells3, resources, placeholder3) {
88541
+ const solid3 = themeChild(themeFormat(cells3, "Effects", resources), "sp3d");
88542
+ if (!solid3) return void 0;
88543
+ const result2 = {};
88544
+ const top = themeChild(solid3, "bevelT");
88545
+ if (top) {
88546
+ const type = PRESETS.indexOf(top.getAttribute("prst") ?? "circle") + 1;
88547
+ if (type > 0)
88548
+ result2.bevel = {
88549
+ type,
88550
+ width: measure4(top, "w", 76200 / EMU2),
88551
+ height: measure4(top, "h", 76200 / EMU2)
88552
+ };
88553
+ }
88554
+ const size3 = measure4(solid3, "contourW", 0);
88555
+ if (size3 > 0) {
88556
+ const paint3 = drawingPaint(
88557
+ colorChoice(themeChild(solid3, "contourClr")),
88558
+ /* @__PURE__ */ new Map(),
88559
+ placeholder3
88560
+ );
88561
+ result2.contour = { size: size3, ...paint3 ? { color: paint3.color } : {} };
88562
+ }
88563
+ return result2;
88564
+ }
88565
+
88468
88566
  // visio/text-background.ts
88469
88567
  function textBackground(cells3, resources, report) {
88470
88568
  const raw2 = cells3.get("TextBkgnd")?.value;
@@ -89743,9 +89841,9 @@ function roundedRectanglePath(points3, rounding, point3) {
89743
89841
  const sweep = a2[0] * b[1] - a2[1] * b[0] > 0 ? 1 : 0;
89744
89842
  const start = after[0], commands = [`M ${point3(start[0], start[1])}`];
89745
89843
  for (let i2 = 1; i2 <= 4; i2++) {
89746
- const entry3 = before[i2 % 4], exit2 = after[i2 % 4];
89844
+ const entry4 = before[i2 % 4], exit2 = after[i2 % 4];
89747
89845
  commands.push(
89748
- `L ${point3(entry3[0], entry3[1])}`,
89846
+ `L ${point3(entry4[0], entry4[1])}`,
89749
89847
  `A ${point3(radius, radius)} 0 0 ${sweep} ${point3(exit2[0], exit2[1])}`
89750
89848
  );
89751
89849
  }
@@ -89791,7 +89889,7 @@ function roundedOrthogonalPath(points3, radius, point3) {
89791
89889
  const radius2 = radii[i2];
89792
89890
  if (!Number.isFinite(radius2) || radius2 < 1e-9) return void 0;
89793
89891
  const incoming = directions[i2 - 1], outgoing = directions[i2];
89794
- const entry3 = [
89892
+ const entry4 = [
89795
89893
  vertex[0] - incoming[0] * radius2,
89796
89894
  vertex[1] - incoming[1] * radius2
89797
89895
  ];
@@ -89799,11 +89897,11 @@ function roundedOrthogonalPath(points3, radius, point3) {
89799
89897
  vertex[0] + outgoing[0] * radius2,
89800
89898
  vertex[1] + outgoing[1] * radius2
89801
89899
  ];
89802
- if (!entry3.every(Number.isFinite) || !exit2.every(Number.isFinite) || point3(...entry3) === point3(...vertex) || point3(...exit2) === point3(...vertex))
89900
+ if (!entry4.every(Number.isFinite) || !exit2.every(Number.isFinite) || point3(...entry4) === point3(...vertex) || point3(...exit2) === point3(...vertex))
89803
89901
  return void 0;
89804
89902
  const sweep = incoming[0] * outgoing[1] - incoming[1] * outgoing[0] > 0 ? 1 : 0;
89805
89903
  commands.push(
89806
- `L ${point3(...entry3)}`,
89904
+ `L ${point3(...entry4)}`,
89807
89905
  `A ${point3(radius2, radius2)} 0 0 ${sweep} ${point3(...exit2)}`
89808
89906
  );
89809
89907
  extraCommands++;
@@ -90110,8 +90208,8 @@ function color3(cells3, name3, fallback, resources, report, themeCells = cells3,
90110
90208
  if (value3 === void 0) return fallback;
90111
90209
  if (/^#[0-9a-f]{6}$/i.test(value3)) return value3;
90112
90210
  if (/^\d+$/.test(value3)) {
90113
- const entry3 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
90114
- if (entry3 && /^#[0-9a-f]{6}$/i.test(entry3)) return entry3;
90211
+ const entry4 = resources.colors.get(value3) ?? PALETTE[Number(value3)];
90212
+ if (entry4 && /^#[0-9a-f]{6}$/i.test(entry4)) return entry4;
90115
90213
  }
90116
90214
  if (value3 === "Themed") {
90117
90215
  const resolved = themeColor2(themeCells, name3, resources, report, gradientRendered);
@@ -90179,15 +90277,27 @@ function shapeStyle2(sheet2, resources, report, width = number2(sheet2.cells, "W
90179
90277
  report,
90180
90278
  themedEffects
90181
90279
  );
90182
- const bevel2 = shapeBevel(cells3);
90280
+ const themedSolid = themeSolid(
90281
+ cells3,
90282
+ resources,
90283
+ color3(cells3, "FillForegnd", "#ffffff", resources, () => {
90284
+ })
90285
+ );
90286
+ const bevel2 = shapeBevel(cells3, themedSolid);
90287
+ const solidColor2 = (name3, fallback) => color3(cells3, name3, fallback, resources, report);
90288
+ const extrusion = shapeExtrusion(cells3, !!bevel2, solidColor2);
90289
+ const contour = shapeContour(cells3, !!bevel2, themedSolid, solidColor2);
90183
90290
  const rotation3d = shapeRotation3d(cells3);
90184
- if (bevel2 || rotation3d)
90291
+ if (bevel2 && (bevel2.width > 0 || bevel2.height > 0) || rotation3d || extrusion || contour)
90185
90292
  report(
90186
90293
  "approximated-3d",
90187
- "Bevel and 3-D rotation are approximated by a lighting overlay and a parallel projection; perspective and extrusion are not drawn."
90294
+ "Bevel, 3-D rotation, perspective, extrusion and contour are approximations: a lighting overlay, a projection and flat-shaded side faces, not Visio's renderer."
90188
90295
  );
90189
90296
  if (hasUndrawnBevel(cells3))
90190
- report("unsupported-bevel", "Bottom bevels and bevel contours are not drawn.");
90297
+ report(
90298
+ "unsupported-bevel",
90299
+ "Bottom bevels are not drawn (Visio 16 shows no change on the front of a shape)."
90300
+ );
90191
90301
  const themedBegin = themeArrow(cells3, resources, "Begin");
90192
90302
  const themedEnd = themeArrow(cells3, resources, "End");
90193
90303
  const cap = lineCap(cells3, resources, report);
@@ -90215,6 +90325,8 @@ function shapeStyle2(sheet2, resources, report, width = number2(sheet2.cells, "W
90215
90325
  ...shadow ? { shadow } : {},
90216
90326
  ...effects,
90217
90327
  ...bevel2 ? { bevel: bevel2 } : {},
90328
+ ...extrusion ? { extrusion } : {},
90329
+ ...contour ? { contour } : {},
90218
90330
  ...rotation3d ? { rotation3d } : {}
90219
90331
  };
90220
90332
  }
@@ -90528,7 +90640,7 @@ var VISIO_BUILT_IN_THEMES = [
90528
90640
  )
90529
90641
  ];
90530
90642
  function visioBuiltInTheme(id5) {
90531
- return VISIO_BUILT_IN_THEMES.find((entry3) => entry3.id === id5);
90643
+ return VISIO_BUILT_IN_THEMES.find((entry4) => entry4.id === id5);
90532
90644
  }
90533
90645
  function visioThemeVariantColors(source3, variant) {
90534
90646
  const accents = source3.colors.slice(4, 10);
@@ -90552,7 +90664,7 @@ function visioPageTheme(themes, pageCells) {
90552
90664
  const light = drawingColor(theme3.colors.get("lt1"), theme3.colors);
90553
90665
  const dark = drawingColor(theme3.colors.get("dk1"), theme3.colors);
90554
90666
  const builtIn = VISIO_BUILT_IN_THEMES.find(
90555
- (entry3) => entry3.schemeId === id5 && entry3.name === theme3.name
90667
+ (entry4) => entry4.schemeId === id5 && entry4.name === theme3.name
90556
90668
  );
90557
90669
  return {
90558
90670
  name: theme3.name ?? `Theme ${id5}`,
@@ -90581,7 +90693,7 @@ function visioPageThemeSchemes(themes, pageCells) {
90581
90693
  if (!themes || id5 === void 0 || id5 === 0 || id5 >= 65534) continue;
90582
90694
  const matches3 = themes.filter((theme3) => theme3[field2] === id5);
90583
90695
  const builtIn = matches3.length === 1 ? VISIO_BUILT_IN_THEMES.find(
90584
- (entry3) => entry3.schemeId === id5 && entry3.name === matches3[0].name
90696
+ (entry4) => entry4.schemeId === id5 && entry4.name === matches3[0].name
90585
90697
  ) : void 0;
90586
90698
  if (builtIn) result2[key2] = builtIn.id;
90587
90699
  }
@@ -90992,7 +91104,7 @@ function optionsKey(options2) {
90992
91104
  const { metafileConverter: _converter, pages: _pages, documentCache: _cache, ...rest } = options2;
90993
91105
  return JSON.stringify(rest);
90994
91106
  }
90995
- var cacheMatches = (entry3, pkg, options2) => entry3 !== void 0 && entry3.options === optionsKey(options2) && entry3.converter === options2.metafileConverter && entry3.reads.every(([path4, print]) => pkg.printOf(path4) === print);
91107
+ var cacheMatches = (entry4, pkg, options2) => entry4 !== void 0 && entry4.options === optionsKey(options2) && entry4.converter === options2.metafileConverter && entry4.reads.every(([path4, print]) => pkg.printOf(path4) === print);
90996
91108
  async function readDocumentLevel(pkg, documentPart, options2, checkTime, forward) {
90997
91109
  const reports = [];
90998
91110
  const report = (...args) => {
@@ -91072,8 +91184,8 @@ var VISIO_COMMENT_LIMIT = 1e4;
91072
91184
  var VISIO_COMMENT_TEXT_LIMIT = 16384;
91073
91185
  var VISIO_COMMENT_AUTHOR_LIMIT = 256;
91074
91186
  var unsigned = (value3) => value3 !== void 0 && /^(0|[1-9]\d{0,9})$/.test(value3) && Number(value3) <= 4294967295 ? value3 : void 0;
91075
- function visioCommentId(entry3, index5) {
91076
- return unsigned(attribute3(entry3, "CommentID")) ?? `n${index5}`;
91187
+ function visioCommentId(entry4, index5) {
91188
+ return unsigned(attribute3(entry4, "CommentID")) ?? `n${index5}`;
91077
91189
  }
91078
91190
  async function readVisioComments(pkg, documentPart, report) {
91079
91191
  const path4 = await related(pkg, documentPart, "comments", false);
@@ -91098,10 +91210,10 @@ async function readVisioComments(pkg, documentPart, report) {
91098
91210
  const comments = [];
91099
91211
  const ids = /* @__PURE__ */ new Set();
91100
91212
  let characters = 0;
91101
- entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry3, index5) => {
91102
- const pageId2 = unsigned(attribute3(entry3, "PageID"));
91103
- const id5 = visioCommentId(entry3, index5);
91104
- const text9 = entry3.textContent ?? "";
91213
+ entries.slice(0, VISIO_COMMENT_LIMIT).forEach((entry4, index5) => {
91214
+ const pageId2 = unsigned(attribute3(entry4, "PageID"));
91215
+ const id5 = visioCommentId(entry4, index5);
91216
+ const text9 = entry4.textContent ?? "";
91105
91217
  characters += text9.length;
91106
91218
  if (pageId2 === void 0 || ids.has(id5) || characters > 1e6) {
91107
91219
  report(
@@ -91114,10 +91226,10 @@ async function readVisioComments(pkg, documentPart, report) {
91114
91226
  return;
91115
91227
  }
91116
91228
  ids.add(id5);
91117
- const shapeId2 = unsigned(attribute3(entry3, "ShapeID"));
91118
- const author = authors.get(attribute3(entry3, "AuthorID") ?? "");
91119
- const date6 = attribute3(entry3, "Date");
91120
- const editDate = attribute3(entry3, "EditDate");
91229
+ const shapeId2 = unsigned(attribute3(entry4, "ShapeID"));
91230
+ const author = authors.get(attribute3(entry4, "AuthorID") ?? "");
91231
+ const date6 = attribute3(entry4, "Date");
91232
+ const editDate = attribute3(entry4, "EditDate");
91121
91233
  comments.push({
91122
91234
  id: id5,
91123
91235
  pageId: pageId2,
@@ -91127,7 +91239,7 @@ async function readVisioComments(pkg, documentPart, report) {
91127
91239
  ...date6 ? { date: date6.slice(0, 64) } : {},
91128
91240
  ...editDate ? { editDate: editDate.slice(0, 64) } : {},
91129
91241
  text: text9.slice(0, VISIO_COMMENT_TEXT_LIMIT),
91130
- ...yes(attribute3(entry3, "Done")) ? { done: true } : {}
91242
+ ...yes(attribute3(entry4, "Done")) ? { done: true } : {}
91131
91243
  });
91132
91244
  });
91133
91245
  return comments;
@@ -94124,9 +94236,28 @@ function createLine(root, document, edit2) {
94124
94236
  setCell(row3, "Y", 0);
94125
94237
  section3.appendChild(row3);
94126
94238
  }
94239
+ if (edit2.text !== void 0) appendLineTextCells(shape2, width);
94127
94240
  shape2.appendChild(section3);
94241
+ if (edit2.text !== void 0) {
94242
+ const text9 = root.ownerDocument.createElementNS(root.namespaceURI, "Text");
94243
+ text9.appendChild(root.ownerDocument.createTextNode(encodeVisioPlainText(edit2.text)));
94244
+ shape2.appendChild(text9);
94245
+ }
94128
94246
  return shape2;
94129
94247
  }
94248
+ function appendLineTextCells(shape2, width) {
94249
+ const box6 = Math.max(0.5, Math.min(width, 1.2));
94250
+ const entries = [
94251
+ ["TxtPinX", width / 2, "Width*0.5"],
94252
+ ["TxtPinY", 0, "Height*0.5"],
94253
+ ["TxtWidth", box6],
94254
+ ["TxtHeight", 0.25],
94255
+ ["TxtLocPinX", box6 / 2, "TxtWidth*0.5"],
94256
+ ["TxtLocPinY", 0.125, "TxtHeight*0.5"],
94257
+ ["TxtAngle", 0, "-Angle"]
94258
+ ];
94259
+ for (const [name3, value3, formula2] of entries) setCell(shape2, name3, value3, formula2);
94260
+ }
94130
94261
 
94131
94262
  // visio/path-fit.ts
94132
94263
  var distance3 = (a2, b) => Math.hypot(b.x - a2.x, b.y - a2.y);
@@ -95897,13 +96028,17 @@ function effectiveNumber(cells3, name3, fallback) {
95897
96028
  fail3("UNSUPPORTED_GEOMETRY_EDIT", `${name3} of the stencil shape is out of range.`);
95898
96029
  return value3;
95899
96030
  }
95900
- var sectionRows2 = (shape2, name3) => children3(shape2, "Section").filter((section3) => attribute3(section3, "N") === name3 && !deleted(section3)).flatMap((section3) => children3(section3, "Row"));
96031
+ var sectionRows2 = (shape2, name3) => children3(shape2, "Section").filter((section3) => attribute3(section3, "N") === name3 && !deleted(section3)).flatMap(
96032
+ (section3) => children3(section3, "Row").map((row3, position3) => ({
96033
+ row: row3,
96034
+ index: attribute3(row3, "IX") === void 0 ? position3 : Number(attribute3(row3, "IX"))
96035
+ }))
96036
+ );
95901
96037
  function effectiveRows(shape2, section3) {
95902
96038
  const rows = /* @__PURE__ */ new Map();
95903
96039
  const gone = /* @__PURE__ */ new Set();
95904
96040
  for (const source3 of [templates2.get(shape2), shape2])
95905
- for (const row3 of sectionRows2(source3, section3)) {
95906
- const index5 = Number(attribute3(row3, "IX") ?? "0");
96041
+ for (const { row: row3, index: index5 } of sectionRows2(source3, section3)) {
95907
96042
  if (deleted(row3)) {
95908
96043
  gone.add(index5);
95909
96044
  continue;
@@ -96395,7 +96530,7 @@ var PASSIVE = /* @__PURE__ */ new Set([
96395
96530
  "Reviewer",
96396
96531
  "Annotation"
96397
96532
  ]);
96398
- var LENGTHS2 = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy)$/;
96533
+ var LENGTHS2 = /^(width|height|pinx|piny|locpinx|locpiny|txtpinx|txtpiny|txtwidth|txtheight|txtlocpinx|txtlocpiny|beginx|beginy|endx|endy|lineweight|imgoffsetx|imgoffsety|imgwidth|imgheight)$/;
96399
96534
  function expectedUnit(cell2) {
96400
96535
  const unit4 = attribute3(cell2.local, "U") ?? attribute3(cell2.inherited, "U");
96401
96536
  if (unit4 === void 0 && cell2.section && PASSIVE.has(cell2.section.name)) return void 0;
@@ -96413,7 +96548,12 @@ function expectedUnit(cell2) {
96413
96548
  return "length";
96414
96549
  return !cell2.relative && /^(geometry\d+|connections|controls)\.[xy]\d+$/.test(name3) ? "length" : "scalar";
96415
96550
  }
96416
- function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__ */ new Map(), text9) {
96551
+ function untaggedLength(cell2) {
96552
+ if (cell2.section?.name !== "User") return void 0;
96553
+ const formula2 = effectiveFormula(cell2);
96554
+ return formula2 && /^\s*[\d.]+\s*(?:MM|CM|IN|FT|M)/i.test(formula2) ? "length" : void 0;
96555
+ }
96556
+ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__ */ new Map(), text9, keepTextSize = false) {
96417
96557
  const scope = "sheets" in target3 ? target3 : singleScope(target3);
96418
96558
  const overrides = new Map(changed);
96419
96559
  const pinned = /* @__PURE__ */ new Map();
@@ -96435,11 +96575,11 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
96435
96575
  try {
96436
96576
  const ast = parseVisioFormula(source3);
96437
96577
  const analysis = analyzeVisioFormula(ast);
96438
- const sized = text9 && analysis.dynamic ? textSizeFormula(ast) : void 0;
96578
+ const sized = analysis.dynamic && (text9 || keepTextSize) ? textSizeFormula(ast) : void 0;
96439
96579
  result2 = sized ? {
96440
96580
  ast,
96441
96581
  local,
96442
- text: true,
96582
+ ...text9 ? { text: true } : { deferText: true },
96443
96583
  references: sized.references.flatMap((ref) => found(ref.cell, ref.shapeId))
96444
96584
  } : analysis.dynamic ? { local, references: mentioned() } : {
96445
96585
  ast,
@@ -96485,22 +96625,42 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
96485
96625
  if (!node4 || node4.hasAttribute("E")) throw new Unevaluable();
96486
96626
  try {
96487
96627
  const value3 = visioFormulaCachedValue(attribute3(node4, "V") ?? "", attribute3(node4, "U"));
96488
- const unit4 = expectedUnit(cell2);
96628
+ const unit4 = expectedUnit(cell2) ?? untaggedLength(cell2);
96489
96629
  return value3.unit === "scalar" && unit4 && unit4 !== "scalar" ? { ...value3, unit: unit4 } : value3;
96490
96630
  } catch {
96491
96631
  throw new Unevaluable();
96492
96632
  }
96493
96633
  };
96634
+ const tainted = /* @__PURE__ */ new Set();
96635
+ let sawDeferred = false;
96494
96636
  const evaluate = (cell2) => {
96637
+ const outer = sawDeferred;
96638
+ sawDeferred = false;
96639
+ try {
96640
+ const result2 = evaluateCell(cell2);
96641
+ if (sawDeferred) tainted.add(cell2);
96642
+ return result2;
96643
+ } finally {
96644
+ sawDeferred = sawDeferred || outer;
96645
+ }
96646
+ };
96647
+ const evaluateCell = (cell2) => {
96495
96648
  check4();
96496
96649
  if (--steps < 0)
96497
96650
  fail3("LIMIT_FORMULA_STEPS", "ShapeSheet dependency evaluation limit exceeded.");
96498
96651
  const override = overrides.get(cell2);
96499
96652
  if (override !== void 0) return { value: override, unit: expectedUnit(cell2) ?? "scalar" };
96500
96653
  const known = values2.get(cell2);
96501
- if (known) return known;
96654
+ if (known) {
96655
+ if (tainted.has(cell2)) sawDeferred = true;
96656
+ return known;
96657
+ }
96502
96658
  if (!isAffected(cell2, /* @__PURE__ */ new Set())) return cached7(cell2);
96503
96659
  const own3 = dependenciesOf(cell2);
96660
+ if (own3?.deferText) {
96661
+ sawDeferred = true;
96662
+ return cached7(cell2);
96663
+ }
96504
96664
  const ast = own3?.ast;
96505
96665
  if (!ast || evaluating.has(cell2)) throw new Unevaluable();
96506
96666
  evaluating.add(cell2);
@@ -96544,9 +96704,11 @@ function recalculateInstanceCaches(target3, changed, check4, pins = /* @__PURE__
96544
96704
  let value3;
96545
96705
  let length;
96546
96706
  try {
96707
+ sawDeferred = false;
96547
96708
  const result2 = evaluate(cell2);
96548
96709
  value3 = result2.value;
96549
96710
  length = result2.unit === "length";
96711
+ if (tainted.has(cell2) && cell2.section && PASSIVE.has(cell2.section.name)) continue;
96550
96712
  } catch (error62) {
96551
96713
  if (!(error62 instanceof Unevaluable)) throw error62;
96552
96714
  if (cell2.section && PASSIVE.has(cell2.section.name)) continue;
@@ -97929,12 +98091,12 @@ function pathVertices(sheet2, width, height, writes) {
97929
98091
  return refuse();
97930
98092
  }
97931
98093
  }
97932
- const entry3 = rows.get(item2.row) ?? { relative: item2.relative };
97933
- entry3[item2.name === "X" ? "x" : "y"] = number10;
97934
- rows.set(item2.row, entry3);
98094
+ const entry4 = rows.get(item2.row) ?? { relative: item2.relative };
98095
+ entry4[item2.name === "X" ? "x" : "y"] = number10;
98096
+ rows.set(item2.row, entry4);
97935
98097
  }
97936
- return [...rows.values()].filter((entry3) => entry3.x !== void 0 && entry3.y !== void 0).map(
97937
- (entry3) => entry3.relative ? { x: entry3.x * width, y: entry3.y * height } : { x: entry3.x, y: entry3.y }
98098
+ return [...rows.values()].filter((entry4) => entry4.x !== void 0 && entry4.y !== void 0).map(
98099
+ (entry4) => entry4.relative ? { x: entry4.x * width, y: entry4.y * height } : { x: entry4.x, y: entry4.y }
97938
98100
  );
97939
98101
  }
97940
98102
  function layoutStencilLine(root, pageId2, shape2, ends, check4) {
@@ -98691,7 +98853,7 @@ var designTextMeasurer = {
98691
98853
  return em === void 0 ? void 0 : em * style4.fontSize + (style4.letterSpacing ?? 0) * text9.length;
98692
98854
  }
98693
98855
  };
98694
- function measure4(text9, style4) {
98856
+ function measure5(text9, style4) {
98695
98857
  for (const measurer of [designTextMeasurer]) {
98696
98858
  const width = measurer.width(text9, style4);
98697
98859
  if (width !== void 0 && Number.isFinite(width) && width >= 0)
@@ -98735,7 +98897,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
98735
98897
  for (const piece of pieces) {
98736
98898
  for (const token2 of piece.text.match(/ +|[^ ]+/g) ?? []) {
98737
98899
  if (UNSUPPORTED2.test(token2)) return void 0;
98738
- const measured = measure4(token2, piece.run);
98900
+ const measured = measure5(token2, piece.run);
98739
98901
  if (!measured) return void 0;
98740
98902
  if (token2.startsWith(" ")) {
98741
98903
  if (width > 0) pending3 += measured.width;
@@ -98751,7 +98913,7 @@ function layoutParagraph(pieces, fallback, paragraph2, available) {
98751
98913
  pending3 = 0;
98752
98914
  if (start === 0 && Number.isFinite(room()) && measured.width > room()) {
98753
98915
  for (const character of token2) {
98754
- const one2 = measure4(character, piece.run);
98916
+ const one2 = measure5(character, piece.run);
98755
98917
  if (!one2) return void 0;
98756
98918
  const edge2 = room();
98757
98919
  if (width > 0) {
@@ -98803,7 +98965,7 @@ function visioTextExtents(text9) {
98803
98965
  width(maximum) {
98804
98966
  const inner2 = maximum === void 0 ? Infinity : maximum - text9.margins.left - text9.margins.right;
98805
98967
  const laid = layout3(inner2);
98806
- const mark = measure4(" ", text9.runs.at(-1) ?? fallback);
98968
+ const mark = measure5(" ", text9.runs.at(-1) ?? fallback);
98807
98969
  if (!laid || !mark) return void 0;
98808
98970
  let widest = 0;
98809
98971
  laid.forEach((lines3, index5) => {
@@ -99561,7 +99723,9 @@ async function applyInstanceGeometryEdit(roots, edit2, template2, check4) {
99561
99723
  scope,
99562
99724
  overrides,
99563
99725
  check4,
99564
- new Map(pins.map((item2) => [item2, item2 === cell2("Width") ? width : height]))
99726
+ new Map(pins.map((item2) => [item2, item2 === cell2("Width") ? width : height])),
99727
+ void 0,
99728
+ true
99565
99729
  );
99566
99730
  for (const [item2, value3] of pinned) {
99567
99731
  assertOverridable(item2, "The size");
@@ -103279,13 +103443,13 @@ function masterMediaParts(media, directory, taken, types, existing) {
103279
103443
  node4.setAttribute("Target", `../media/${part.slice(folder.length)}`);
103280
103444
  rels.appendChild(node4);
103281
103445
  const known = Array.from(types.getElementsByTagNameNS(types.namespaceURI, "Default")).some(
103282
- (entry3) => entry3.getAttribute("Extension")?.toLowerCase() === extension2
103446
+ (entry4) => entry4.getAttribute("Extension")?.toLowerCase() === extension2
103283
103447
  );
103284
103448
  if (!known) {
103285
- const entry3 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
103286
- entry3.setAttribute("Extension", extension2);
103287
- entry3.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
103288
- types.insertBefore(entry3, types.firstChild);
103449
+ const entry4 = types.ownerDocument.createElementNS(types.namespaceURI, "Default");
103450
+ entry4.setAttribute("Extension", extension2);
103451
+ entry4.setAttribute("ContentType", MEDIA_TYPES[extension2] ?? "application/octet-stream");
103452
+ types.insertBefore(entry4, types.firstChild);
103289
103453
  }
103290
103454
  }
103291
103455
  return { rels, parts };
@@ -103314,17 +103478,17 @@ async function addMasterToDrawing(source3, spec2, limits, maxOutput, deadline, c
103314
103478
  if (entries.length >= MAX_MASTERS)
103315
103479
  fail3("LIMIT_EDITS", "The drawing holds too many masters to add another.");
103316
103480
  const same17 = (value3, other) => value3?.toLowerCase() === other.toLowerCase();
103317
- const ours = spec2.uniqueId && entries.find((entry3) => same17(attribute3(entry3, "UniqueID"), spec2.uniqueId));
103481
+ const ours = spec2.uniqueId && entries.find((entry4) => same17(attribute3(entry4, "UniqueID"), spec2.uniqueId));
103318
103482
  if (ours) return { bytes: source3, masterId: attribute3(ours, "ID") ?? "", changedParts: [] };
103319
103483
  const name3 = spec2.name;
103320
103484
  const reused = await spec2.reuse?.({ pkg, existingPart, entries, check: check4 });
103321
103485
  if (reused !== void 0) return { bytes: source3, masterId: reused, changedParts: [] };
103322
- const ids = entries.map((entry3) => Number(attribute3(entry3, "ID")));
103486
+ const ids = entries.map((entry4) => Number(attribute3(entry4, "ID")));
103323
103487
  if (ids.some((id6) => !Number.isSafeInteger(id6) || id6 < 0))
103324
103488
  fail3("UNSUPPORTED_EDIT_PACKAGE", "The drawing has masters without canonical IDs.");
103325
103489
  const id5 = String(Math.max(1, ...ids.map((value3) => value3 + 1)));
103326
103490
  const names = new Set(
103327
- entries.flatMap((entry3) => [attribute3(entry3, "NameU"), attribute3(entry3, "Name")])
103491
+ entries.flatMap((entry4) => [attribute3(entry4, "NameU"), attribute3(entry4, "Name")])
103328
103492
  );
103329
103493
  const unique4 = names.has(name3) ? `${name3}.${id5}` : name3;
103330
103494
  const relsPart = relationshipsPartFor(mastersPart);
@@ -103364,11 +103528,11 @@ async function addMasterToDrawing(source3, spec2, limits, maxOutput, deadline, c
103364
103528
  spec2.entry(masters, id5, unique4, relId);
103365
103529
  const documentCopy = copy2(document);
103366
103530
  let documentTouched = false;
103367
- const contents = await spec2.contents(documentCopy, () => documentTouched = true);
103531
+ const contents2 = await spec2.contents(documentCopy, () => documentTouched = true);
103368
103532
  const dirty = /* @__PURE__ */ new Map([
103369
103533
  [mastersPart, masters],
103370
103534
  [relsPart, rels],
103371
- [masterPart, contents],
103535
+ [masterPart, contents2],
103372
103536
  ["[Content_Types].xml", types]
103373
103537
  ]);
103374
103538
  if (documentTouched) dirty.set(documentPart, documentCopy);
@@ -103676,18 +103840,18 @@ async function ensureStencilMaster(source3, master2, limits, maxOutput, deadline
103676
103840
  uniqueId: builtIn.uniqueId,
103677
103841
  name: name3,
103678
103842
  async reuse({ pkg, existingPart, entries, check: tick }) {
103679
- for (const entry3 of entries) {
103843
+ for (const entry4 of entries) {
103680
103844
  tick();
103681
- if (!existingPart || !same17(attribute3(entry3, "NameU") ?? attribute3(entry3, "Name"), name3))
103845
+ if (!existingPart || !same17(attribute3(entry4, "NameU") ?? attribute3(entry4, "Name"), name3))
103682
103846
  continue;
103683
103847
  try {
103684
- const part = await indexedPart(pkg, existingPart, entry3, "master");
103848
+ const part = await indexedPart(pkg, existingPart, entry4, "master");
103685
103849
  const roots = shapesOf2(await visioXml(pkg, part, "MasterContents")).filter(
103686
103850
  (shape2) => attribute3(shape2, "Del") !== "1"
103687
103851
  );
103688
103852
  const cells3 = new Set(children3(roots[0], "Cell").map((cell2) => attribute3(cell2, "N")));
103689
103853
  if (roots.length === 1 && !cells3.has("BeginX") && !roots[0].hasAttribute("Master"))
103690
- return attribute3(entry3, "ID") ?? "";
103854
+ return attribute3(entry4, "ID") ?? "";
103691
103855
  } catch {
103692
103856
  }
103693
103857
  }
@@ -103779,26 +103943,26 @@ async function importStencilMaster(source3, stencil, stencilMasterId, limits, ma
103779
103943
  const stencilDocument = await visioXml(pkg, documentPart, "VisioDocument");
103780
103944
  const mastersPart = await related(pkg, documentPart, "masters", false);
103781
103945
  if (!mastersPart) fail3("EDIT_TARGET_NOT_FOUND", "The stencil has no masters.");
103782
- const entry3 = children3(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
103946
+ const entry4 = children3(await visioXml(pkg, mastersPart, "Masters"), "Master").find(
103783
103947
  (node4) => attribute3(node4, "ID") === stencilMasterId
103784
103948
  );
103785
- if (!entry3) fail3("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
103786
- const part = await indexedPart(pkg, mastersPart, entry3, "master");
103949
+ if (!entry4) fail3("EDIT_TARGET_NOT_FOUND", "The stencil has no such master.");
103950
+ const part = await indexedPart(pkg, mastersPart, entry4, "master");
103787
103951
  const media = await masterPictures(pkg, part);
103788
- const contents = await visioXml(pkg, part, "MasterContents");
103789
- const name3 = attribute3(entry3, "NameU") ?? attribute3(entry3, "Name") ?? `Master ${stencilMasterId}`;
103952
+ const contents2 = await visioXml(pkg, part, "MasterContents");
103953
+ const name3 = attribute3(entry4, "NameU") ?? attribute3(entry4, "Name") ?? `Master ${stencilMasterId}`;
103790
103954
  return addMasterToDrawing(
103791
103955
  source3,
103792
103956
  {
103793
- uniqueId: attribute3(entry3, "UniqueID") ?? "",
103957
+ uniqueId: attribute3(entry4, "UniqueID") ?? "",
103794
103958
  name: name3,
103795
103959
  entry(masters, id5, unique4, relationshipId) {
103796
- const node4 = masters.ownerDocument.importNode(entry3, true);
103960
+ const node4 = masters.ownerDocument.importNode(entry4, true);
103797
103961
  if (node4.namespaceURI !== masters.namespaceURI)
103798
103962
  fail3("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
103799
103963
  node4.setAttribute("ID", id5);
103800
103964
  node4.setAttribute("NameU", unique4);
103801
- if (node4.hasAttribute("Name") && attribute3(entry3, "Name") === name3)
103965
+ if (node4.hasAttribute("Name") && attribute3(entry4, "Name") === name3)
103802
103966
  node4.setAttribute("Name", unique4);
103803
103967
  for (const sheet2 of children3(node4, "PageSheet"))
103804
103968
  for (const style4 of STYLE_ATTRIBUTES)
@@ -103809,7 +103973,7 @@ async function importStencilMaster(source3, stencil, stencilMasterId, limits, ma
103809
103973
  media,
103810
103974
  contents(document, touch) {
103811
103975
  const map2 = styleMapper(stencilDocument, document, touch);
103812
- const root = copy2(contents);
103976
+ const root = copy2(contents2);
103813
103977
  if (root.namespaceURI !== document.namespaceURI)
103814
103978
  fail3("UNSUPPORTED_EDIT_PACKAGE", "The stencil uses another Visio namespace.");
103815
103979
  for (const shape2 of Array.from(root.getElementsByTagNameNS(root.namespaceURI, "Shape")))
@@ -105866,7 +106030,7 @@ function visioFallbackQuickStyle(style4) {
105866
106030
  return { fill: mix2(base3, 0, 0.5), line: mix2(base3, 0, 0.5), font: light };
105867
106031
  }
105868
106032
  }
105869
- var rgb2 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
106033
+ var rgb3 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
105870
106034
  function shadowWrites(preset, add5) {
105871
106035
  if (preset === "none") {
105872
106036
  add5("ShdwPattern", 0, "FillStyle");
@@ -105874,7 +106038,7 @@ function shadowWrites(preset, add5) {
105874
106038
  }
105875
106039
  const { x, y, blur } = visioShadowPresetGeometry(preset);
105876
106040
  add5("ShdwPattern", 1, "FillStyle");
105877
- add5("ShdwForegnd", "#000000", "FillStyle", void 0, rgb2("#000000"));
106041
+ add5("ShdwForegnd", "#000000", "FillStyle", void 0, rgb3("#000000"));
105878
106042
  add5("ShdwForegndTrans", 0.6, "FillStyle");
105879
106043
  add5("ShapeShdwType", 1, "FillStyle");
105880
106044
  add5("ShapeShdwOffsetX", x / 72, "FillStyle", "PT");
@@ -105903,7 +106067,7 @@ async function quickStyleWrites(pkg, document, shape2, pageId2, style4, add5, ch
105903
106067
  );
105904
106068
  for (const [name3, value3, category] of selectors2) add5(name3, value3, category);
105905
106069
  const fallback = visioFallbackQuickStyle(style4);
105906
- const paint3 = (name3, category, color4) => themed ? add5(name3, "Themed", category, void 0, "THEMEVAL()") : add5(name3, color4, category, void 0, rgb2(color4));
106070
+ const paint3 = (name3, category, color4) => themed ? add5(name3, "Themed", category, void 0, "THEMEVAL()") : add5(name3, color4, category, void 0, rgb3(color4));
105907
106071
  add5("FillPattern", 1, "FillStyle");
105908
106072
  add5("FillForegndTrans", 0, "FillStyle");
105909
106073
  add5("LinePattern", 1, "LineStyle");
@@ -105968,12 +106132,12 @@ function snapshotReflection(value3) {
105968
106132
  blur: bounded3(value3.blur, 100, "Reflection blur must be 0 to 100 points.")
105969
106133
  };
105970
106134
  }
105971
- var rgb3 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
106135
+ var rgb4 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
105972
106136
  function effectWrites(edit2, add5) {
105973
106137
  if (edit2.glow) {
105974
106138
  add5("GlowSize", edit2.glow.size / 72, "FillStyle", "PT");
105975
106139
  if (edit2.glow.size > 0) {
105976
- add5("GlowColor", edit2.glow.color, "FillStyle", void 0, rgb3(edit2.glow.color));
106140
+ add5("GlowColor", edit2.glow.color, "FillStyle", void 0, rgb4(edit2.glow.color));
105977
106141
  add5("GlowColorTrans", edit2.glow.transparency / 100, "FillStyle");
105978
106142
  }
105979
106143
  }
@@ -106197,7 +106361,11 @@ function snapshotFormatting(edit2) {
106197
106361
  "softEdges",
106198
106362
  "reflection",
106199
106363
  "bevel",
106200
- "rotation3d"
106364
+ "rotation3d",
106365
+ "extrusionDepth",
106366
+ "extrusionColor",
106367
+ "contourSize",
106368
+ "contourColor"
106201
106369
  ].includes(key2) && edit2[key2] !== void 0
106202
106370
  ))
106203
106371
  fail3("INVALID_EDIT", "A Quick Style replaces fill, line and font paint as a whole.");
@@ -106211,6 +106379,7 @@ function snapshotFormatting(edit2) {
106211
106379
  if (edit2.reflection !== void 0) result2.reflection = snapshotReflection(edit2.reflection);
106212
106380
  if (edit2.bevel !== void 0) result2.bevel = snapshotBevel(edit2.bevel);
106213
106381
  if (edit2.rotation3d !== void 0) result2.rotation3d = snapshotRotation(edit2.rotation3d);
106382
+ Object.assign(result2, snapshotSolid(edit2));
106214
106383
  if (result2.fillColor === "none" && result2.fillPattern !== void 0 && result2.fillPattern !== 0)
106215
106384
  fail3("INVALID_EDIT", "No fill conflicts with a visible fill pattern.");
106216
106385
  }
@@ -106383,7 +106552,8 @@ function snapshotVisioEdits(edits2, maxEdits, maxText) {
106383
106552
  endX,
106384
106553
  endY,
106385
106554
  ...connect ? { connect } : {},
106386
- ...route ? { route } : {}
106555
+ ...route ? { route } : {},
106556
+ ...edit2.text !== void 0 ? { text: text9(edit2.text) } : {}
106387
106557
  };
106388
106558
  }
106389
106559
  case "create-rectangle":
@@ -106432,7 +106602,7 @@ function snapshotVisioEdits(edits2, maxEdits, maxText) {
106432
106602
  };
106433
106603
  }
106434
106604
  case "delete-shape":
106435
- return { ...target3, type: edit2.type };
106605
+ return { ...target3, type: edit2.type, ...edit2.deferred ? { deferred: true } : {} };
106436
106606
  default:
106437
106607
  return fail3("INVALID_EDIT", "Unsupported edit command.");
106438
106608
  }
@@ -107676,13 +107846,13 @@ function createVisioPagePart(parts, pages, pageId2, check4) {
107676
107846
  override.setAttribute("PartName", `/${path4}`);
107677
107847
  override.setAttribute("ContentType", contentType);
107678
107848
  parts.types.appendChild(override);
107679
- const contents = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
107680
- contents.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
107681
- parts.dirty.set(path4, contents);
107849
+ const contents2 = parseXml(`<PageContents xmlns="${pages.namespaceURI}"/>`).documentElement;
107850
+ contents2.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
107851
+ parts.dirty.set(path4, contents2);
107682
107852
  parts.dirty.set(parts.pagesPart, pages);
107683
107853
  parts.dirty.set(parts.relsPart, parts.rels);
107684
107854
  parts.dirty.set("[Content_Types].xml", parts.types);
107685
- return { page, contents };
107855
+ return { page, contents: contents2 };
107686
107856
  }
107687
107857
 
107688
107858
  // visio/edit-page-decoration.ts
@@ -108084,7 +108254,7 @@ function formattingFont(document, family) {
108084
108254
  var hasCharacterExtras = (edit2) => textExtraCharacterKeys.some((key2) => edit2[key2] !== void 0);
108085
108255
  var hasParagraphExtras = (edit2) => textExtraParagraphKeys.some((key2) => edit2[key2] !== void 0);
108086
108256
  var quoted = (text9) => `"${text9.replaceAll('"', '""')}"`;
108087
- var rgb4 = (color4) => `RGB(${[1, 3, 5].map((i2) => parseInt(color4.slice(i2, i2 + 2), 16)).join(",")})`;
108257
+ var rgb5 = (color4) => `RGB(${[1, 3, 5].map((i2) => parseInt(color4.slice(i2, i2 + 2), 16)).join(",")})`;
108088
108258
  var inches = (value3) => Number(value3.toFixed(10));
108089
108259
  function characterExtraWrites(edit2, name3, add5) {
108090
108260
  if (edit2.fontTransparency !== void 0) add5(name3("ColorTrans"), edit2.fontTransparency / 100);
@@ -108137,7 +108307,7 @@ function textBlockWrites(shape2, edit2, add5) {
108137
108307
  }
108138
108308
  if (edit2.textBackground !== void 0) {
108139
108309
  if (edit2.textBackground === "none") add5("TextBkgnd", 0);
108140
- else add5("TextBkgnd", edit2.textBackground, void 0, `${rgb4(edit2.textBackground)}+1`);
108310
+ else add5("TextBkgnd", edit2.textBackground, void 0, `${rgb5(edit2.textBackground)}+1`);
108141
108311
  }
108142
108312
  if (edit2.textBackgroundTransparency !== void 0)
108143
108313
  add5("TextBkgndTrans", edit2.textBackgroundTransparency / 100);
@@ -108301,7 +108471,7 @@ function shapeFormattingWrites(edit2) {
108301
108471
  edit2.fillColor,
108302
108472
  "FillStyle",
108303
108473
  void 0,
108304
- edit2.fillColorTheme ? visioThemeColorFormula(edit2.fillColorTheme) : rgb5(edit2.fillColor)
108474
+ edit2.fillColorTheme ? visioThemeColorFormula(edit2.fillColorTheme) : rgb6(edit2.fillColor)
108305
108475
  );
108306
108476
  add5("FillForegndTrans", 0, "FillStyle");
108307
108477
  }
@@ -108316,7 +108486,7 @@ function shapeFormattingWrites(edit2) {
108316
108486
  edit2.fillBackgroundColor,
108317
108487
  "FillStyle",
108318
108488
  void 0,
108319
- rgb5(edit2.fillBackgroundColor)
108489
+ rgb6(edit2.fillBackgroundColor)
108320
108490
  );
108321
108491
  }
108322
108492
  if (edit2.fillTransparency !== void 0) {
@@ -108329,7 +108499,7 @@ function shapeFormattingWrites(edit2) {
108329
108499
  edit2.lineColor,
108330
108500
  "LineStyle",
108331
108501
  void 0,
108332
- edit2.lineColorTheme ? visioThemeColorFormula(edit2.lineColorTheme) : rgb5(edit2.lineColor)
108502
+ edit2.lineColorTheme ? visioThemeColorFormula(edit2.lineColorTheme) : rgb6(edit2.lineColor)
108333
108503
  );
108334
108504
  add5("LineColorTrans", 0, "LineStyle");
108335
108505
  add5("LineGradientEnabled", 0, "LineStyle");
@@ -108368,6 +108538,7 @@ async function shapeFormattingPlan(pkg, document, shape2, edit2, check4) {
108368
108538
  effectWrites(edit2, add5);
108369
108539
  if (edit2.bevel !== void 0) bevelWrites(edit2.bevel, add5);
108370
108540
  if (edit2.rotation3d !== void 0) rotationWrites(edit2.rotation3d, add5);
108541
+ solidWrites(edit2, add5);
108371
108542
  return { writes: [...writes.values()], ...rows ? { rows } : {} };
108372
108543
  }
108373
108544
  async function assertShapeFormattingPaintScope(pkg, document, shape2, edit2, changed, check4) {
@@ -108377,7 +108548,7 @@ async function assertShapeFormattingPaintScope(pkg, document, shape2, edit2, cha
108377
108548
  if (edit2.lineColor === void 0 && changed.has("LineColorTrans"))
108378
108549
  await assertNonGradientPaint(pkg, document, shape2, edit2.pageId, "Line", check4);
108379
108550
  }
108380
- function rgb5(color4) {
108551
+ function rgb6(color4) {
108381
108552
  return `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
108382
108553
  }
108383
108554
 
@@ -109062,11 +109233,11 @@ async function masterEntry(pkg, masterId) {
109062
109233
  async function masterIdentities(pkg, masterIds) {
109063
109234
  const result2 = [];
109064
109235
  for (const id5 of masterIds) {
109065
- const entry3 = await masterEntry(pkg, id5);
109066
- if (!entry3) fail3("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
109236
+ const entry4 = await masterEntry(pkg, id5);
109237
+ if (!entry4) fail3("UNSUPPORTED_CLIPBOARD", "The master of a stencil shape cannot be resolved.");
109067
109238
  result2.push({
109068
109239
  id: id5,
109069
- identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute3(entry3.master, name3) ?? "").join("|")
109240
+ identity: ["UniqueID", "BaseID", "NameU"].map((name3) => attribute3(entry4.master, name3) ?? "").join("|")
109070
109241
  });
109071
109242
  }
109072
109243
  return result2;
@@ -109074,11 +109245,11 @@ async function masterIdentities(pkg, masterIds) {
109074
109245
  async function assertClipboardMasters(pkg, pagePath, source3, captured) {
109075
109246
  for (const id5 of instanceMasterIds(source3)) {
109076
109247
  const known = captured?.find((master2) => master2.id === id5);
109077
- const entry3 = await masterEntry(pkg, id5);
109078
- if (!known || !entry3) fail3("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
109248
+ const entry4 = await masterEntry(pkg, id5);
109249
+ if (!known || !entry4) fail3("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
109079
109250
  const [actual] = await masterIdentities(pkg, [id5]);
109080
109251
  if (actual.identity !== known.identity) fail3("CLIPBOARD_RESOURCE_MISMATCH", ELSEWHERE);
109081
- const masterPart = await indexedPart(pkg, entry3.mastersPart, entry3.master, "master");
109252
+ const masterPart = await indexedPart(pkg, entry4.mastersPart, entry4.master, "master");
109082
109253
  const linked = [...(await pkg.relationships(pagePath)).values()].some(
109083
109254
  (rel) => rel.type === MASTER_RELATIONSHIP3 && rel.target === masterPart
109084
109255
  );
@@ -109676,14 +109847,14 @@ async function editVsdxPicture(pkg, parts, pages, edit2, limits, maxOutput, dead
109676
109847
  (node4) => node4.getAttribute("Extension")?.toLowerCase() === format9.extension
109677
109848
  );
109678
109849
  if (!declared || declared.getAttribute("ContentType") !== info.mimeType) {
109679
- const entry3 = types.ownerDocument.createElementNS(
109850
+ const entry4 = types.ownerDocument.createElementNS(
109680
109851
  types.namespaceURI,
109681
109852
  declared ? "Override" : "Default"
109682
109853
  );
109683
- if (declared) entry3.setAttribute("PartName", `/${media}`);
109684
- else entry3.setAttribute("Extension", format9.extension);
109685
- entry3.setAttribute("ContentType", info.mimeType);
109686
- types.insertBefore(entry3, declared ? null : types.firstElementChild ?? null);
109854
+ if (declared) entry4.setAttribute("PartName", `/${media}`);
109855
+ else entry4.setAttribute("Extension", format9.extension);
109856
+ entry4.setAttribute("ContentType", info.mimeType);
109857
+ types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
109687
109858
  }
109688
109859
  const dirty = /* @__PURE__ */ new Map([
109689
109860
  [path4, root],
@@ -109742,14 +109913,14 @@ function declareType(types, extension2, contentType2, partName) {
109742
109913
  (node4) => node4.getAttribute("Extension")?.toLowerCase() === extension2
109743
109914
  );
109744
109915
  if (declared?.getAttribute("ContentType") === contentType2) return;
109745
- const entry3 = types.ownerDocument.createElementNS(
109916
+ const entry4 = types.ownerDocument.createElementNS(
109746
109917
  types.namespaceURI,
109747
109918
  declared ? "Override" : "Default"
109748
109919
  );
109749
- if (declared) entry3.setAttribute("PartName", `/${partName}`);
109750
- else entry3.setAttribute("Extension", extension2);
109751
- entry3.setAttribute("ContentType", contentType2);
109752
- types.insertBefore(entry3, declared ? null : types.firstElementChild ?? null);
109920
+ if (declared) entry4.setAttribute("PartName", `/${partName}`);
109921
+ else entry4.setAttribute("Extension", extension2);
109922
+ entry4.setAttribute("ContentType", contentType2);
109923
+ types.insertBefore(entry4, declared ? null : types.firstElementChild ?? null);
109753
109924
  }
109754
109925
  async function stage(pkg, parts) {
109755
109926
  const types = cloneRoot(await pkg.readXml("[Content_Types].xml", "Types"));
@@ -109936,7 +110107,7 @@ function refreshThemeColorCaches(root, colors, check4) {
109936
110107
  }
109937
110108
 
109938
110109
  // visio/edit-page-theme-recolor.ts
109939
- var rgb6 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
110110
+ var rgb7 = (color4) => `RGB(${[1, 3, 5].map((index5) => parseInt(color4.slice(index5, index5 + 2), 16)).join(",")})`;
109940
110111
  function formattingCell2(sheet2, name3) {
109941
110112
  const matches3 = children3(sheet2, "Cell").filter((cell2) => attribute3(cell2, "N") === name3);
109942
110113
  return matches3.length === 1 ? matches3[0] : void 0;
@@ -109960,14 +110131,14 @@ function style3(shape2, kind) {
109960
110131
  function convert(cell2, fallback, mode) {
109961
110132
  if (!cell2 || cell2.hasAttribute("E")) return false;
109962
110133
  if (mode === "themed") {
109963
- if (normal2(attribute3(cell2, "F")) !== rgb6(fallback)) return false;
110134
+ if (normal2(attribute3(cell2, "F")) !== rgb7(fallback)) return false;
109964
110135
  cell2.setAttribute("V", "Themed");
109965
110136
  cell2.setAttribute("F", "THEMEVAL()");
109966
110137
  } else {
109967
110138
  if (normal2(attribute3(cell2, "F")) !== "THEMEVAL()" || attribute3(cell2, "V") !== "Themed")
109968
110139
  return false;
109969
110140
  cell2.setAttribute("V", fallback);
109970
- cell2.setAttribute("F", rgb6(fallback));
110141
+ cell2.setAttribute("F", rgb7(fallback));
109971
110142
  }
109972
110143
  cell2.removeAttribute("U");
109973
110144
  return true;
@@ -110186,7 +110357,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
110186
110357
  });
110187
110358
  const dirty = /* @__PURE__ */ new Map([[pagesPath, pagesRoot]]);
110188
110359
  const created = /* @__PURE__ */ new Map();
110189
- const contents = copy5(await visioXml(pkg, contentsPath, "PageContents"));
110360
+ const contents2 = copy5(await visioXml(pkg, contentsPath, "PageContents"));
110190
110361
  let recolored = false;
110191
110362
  const part = PAGE_THEME_PARTS.find((name3) => edit2[name3] !== void 0);
110192
110363
  if (edit2.embellishment !== void 0)
@@ -110199,8 +110370,8 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
110199
110370
  (style4) => attribute3(style4, "ID") === "0"
110200
110371
  );
110201
110372
  if (attribute3(root, "NameU") !== "No Style")
110202
- recolored = recolorQuickStyledShapes(contents, "fallback", check4);
110203
- recolored = refreshThemeColorCaches(contents, VISIO_UNTHEMED_COLORS, check4) || recolored;
110373
+ recolored = recolorQuickStyledShapes(contents2, "fallback", check4);
110374
+ recolored = refreshThemeColorCaches(contents2, VISIO_UNTHEMED_COLORS, check4) || recolored;
110204
110375
  } else if (edit2.theme || part) {
110205
110376
  const source3 = visioBuiltInTheme(edit2.theme ?? edit2[part]);
110206
110377
  await ensureBuiltInThemePart(pkg, parts, documentPath, themes, source3, dirty, created, check4);
@@ -110209,7 +110380,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
110209
110380
  if (!part || part === "colors") {
110210
110381
  for (const name3 of ["VariationColorIndex", "VariationStyleIndex"])
110211
110382
  setCell(sheet2, name3, edit2.variant ?? 0);
110212
- recolored = recolorQuickStyledShapes(contents, "themed", check4);
110383
+ recolored = recolorQuickStyledShapes(contents2, "themed", check4);
110213
110384
  }
110214
110385
  const hex4 = (index5) => `#${source3.colors[index5].toLowerCase()}`;
110215
110386
  const variant = visioThemeVariantColors(source3, edit2.variant ?? 0);
@@ -110218,7 +110389,7 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
110218
110389
  for (let index5 = 1; index5 <= 7; index5++)
110219
110390
  colors[`variant${index5}`] = `#${variant[index5 - 1].toLowerCase()}`;
110220
110391
  if (!part || part === "colors")
110221
- recolored = refreshThemeColorCaches(contents, colors, check4) || recolored;
110392
+ recolored = refreshThemeColorCaches(contents2, colors, check4) || recolored;
110222
110393
  } else if (edit2.variant !== void 0) {
110223
110394
  const current = pageSelectedTheme(themes, sheet2);
110224
110395
  if (!current || current.variants.length <= edit2.variant)
@@ -110238,9 +110409,9 @@ async function editVsdxPageTheme(pkg, parts, pages, edit2, limits, maxOutput, de
110238
110409
  const color4 = drawingColor(current.colors.get(key2), current.colors);
110239
110410
  if (color4) colors[slot2] = color4;
110240
110411
  }
110241
- recolored = refreshThemeColorCaches(contents, colors, check4);
110412
+ recolored = refreshThemeColorCaches(contents2, colors, check4);
110242
110413
  }
110243
- if (recolored) dirty.set(contentsPath, contents);
110414
+ if (recolored) dirty.set(contentsPath, contents2);
110244
110415
  if ((/* @__PURE__ */ new Set([...parts.keys(), ...dirty.keys(), ...created.keys()])).size > limits.maxEntries)
110245
110416
  fail3("LIMIT_ENTRIES", "The theme exceeds the package entry limit.");
110246
110417
  let total2 = [...parts.values()].reduce((sum3, bytes2) => sum3 + bytes2.length, 0);
@@ -110331,7 +110502,7 @@ async function editVsdxComments(pkg, parts, pages, edits2, limits, maxOutput, de
110331
110502
  const authors = list2(root, "AuthorList");
110332
110503
  const comments = list2(root, "CommentList");
110333
110504
  const byId2 = new Map(
110334
- children3(comments, "CommentEntry").map((entry3, index5) => [visioCommentId(entry3, index5), entry3])
110505
+ children3(comments, "CommentEntry").map((entry4, index5) => [visioCommentId(entry4, index5), entry4])
110335
110506
  );
110336
110507
  const removed2 = /* @__PURE__ */ new Set();
110337
110508
  for (const edit2 of edits2) {
@@ -110354,29 +110525,29 @@ async function editVsdxComments(pkg, parts, pages, edits2, limits, maxOutput, de
110354
110525
  if (edit2.initials) author.setAttribute("Initials", edit2.initials);
110355
110526
  authors.appendChild(author);
110356
110527
  }
110357
- const entry4 = root.ownerDocument.createElementNS(root.namespaceURI, "CommentEntry");
110358
- entry4.setAttribute("AuthorID", attribute3(author, "ID"));
110359
- entry4.setAttribute("PageID", edit2.pageId);
110360
- if (edit2.shapeId !== void 0) entry4.setAttribute("ShapeID", edit2.shapeId);
110361
- entry4.setAttribute("Date", edit2.date);
110362
- entry4.setAttribute("CommentID", nextId(children3(comments, "CommentEntry"), "CommentID"));
110363
- entry4.textContent = edit2.text;
110364
- comments.appendChild(entry4);
110528
+ const entry5 = root.ownerDocument.createElementNS(root.namespaceURI, "CommentEntry");
110529
+ entry5.setAttribute("AuthorID", attribute3(author, "ID"));
110530
+ entry5.setAttribute("PageID", edit2.pageId);
110531
+ if (edit2.shapeId !== void 0) entry5.setAttribute("ShapeID", edit2.shapeId);
110532
+ entry5.setAttribute("Date", edit2.date);
110533
+ entry5.setAttribute("CommentID", nextId(children3(comments, "CommentEntry"), "CommentID"));
110534
+ entry5.textContent = edit2.text;
110535
+ comments.appendChild(entry5);
110365
110536
  continue;
110366
110537
  }
110367
- const entry3 = byId2.get(edit2.commentId);
110368
- if (!entry3 || removed2.has(entry3) || attribute3(entry3, "PageID") !== edit2.pageId)
110538
+ const entry4 = byId2.get(edit2.commentId);
110539
+ if (!entry4 || removed2.has(entry4) || attribute3(entry4, "PageID") !== edit2.pageId)
110369
110540
  fail3("EDIT_TARGET_NOT_FOUND", "Comment does not exist on the page.");
110370
110541
  if (edit2.type === "delete-comment") {
110371
- entry3.parentNode.removeChild(entry3);
110372
- removed2.add(entry3);
110542
+ entry4.parentNode.removeChild(entry4);
110543
+ removed2.add(entry4);
110373
110544
  continue;
110374
110545
  }
110375
110546
  if (edit2.text !== void 0) {
110376
- entry3.textContent = edit2.text;
110377
- entry3.setAttribute("EditDate", edit2.date);
110547
+ entry4.textContent = edit2.text;
110548
+ entry4.setAttribute("EditDate", edit2.date);
110378
110549
  }
110379
- if (edit2.done !== void 0) entry3.setAttribute("Done", edit2.done ? "1" : "0");
110550
+ if (edit2.done !== void 0) entry4.setAttribute("Done", edit2.done ? "1" : "0");
110380
110551
  }
110381
110552
  const dirty = /* @__PURE__ */ new Map([[path4, root]]);
110382
110553
  if (created) {
@@ -110839,9 +111010,21 @@ var ROLES = {
110839
111010
  "swimlane list": "swimlane-list",
110840
111011
  "phase list": "phase-list"
110841
111012
  };
111013
+ var CFF_AUTHORED_IDS = {
111014
+ frame: "{0F0C7A10-0001-0000-8E40-00608CF305B2}",
111015
+ "swimlane-list": "{0F0C7A10-0002-0000-8E40-00608CF305B2}",
111016
+ "phase-list": "{0F0C7A10-0003-0000-8E40-00608CF305B2}",
111017
+ lane: "{0F0C7A10-0004-0000-8E40-00608CF305B2}",
111018
+ separator: "{0F0C7A10-0005-0000-8E40-00608CF305B2}"
111019
+ };
111020
+ var AUTHORED_ROLES = new Map(
111021
+ Object.entries(CFF_AUTHORED_IDS).map(([role, id5]) => [id5, role])
111022
+ );
110842
111023
  var noCffMasters = {
110843
111024
  get: () => void 0,
110844
111025
  roleOf: () => void 0,
111026
+ authoredId: () => void 0,
111027
+ authoredPart: () => void 0,
110845
111028
  empty: true
110846
111029
  };
110847
111030
  async function loadCffMasters(pkg) {
@@ -110851,25 +111034,31 @@ async function loadCffMasters(pkg) {
110851
111034
  const list3 = await visioXml(pkg, mastersPart, "Masters");
110852
111035
  const shapes = /* @__PURE__ */ new Map();
110853
111036
  const roles = /* @__PURE__ */ new Map();
111037
+ const authored = /* @__PURE__ */ new Map();
110854
111038
  for (const master2 of children3(list3, "Master")) {
110855
111039
  const id5 = attribute3(master2, "ID");
110856
111040
  const role = ROLES[(attribute3(master2, "NameU") ?? attribute3(master2, "Name") ?? "").toLowerCase()];
110857
- if (!id5 || !role) continue;
110858
- const root = await visioXml(
110859
- pkg,
110860
- await indexedPart(pkg, mastersPart, master2, "master"),
110861
- "MasterContents"
110862
- );
111041
+ if (!id5) continue;
111042
+ const own3 = AUTHORED_ROLES.get((attribute3(master2, "UniqueID") ?? "").toUpperCase());
111043
+ if (!role && !own3) continue;
111044
+ const part = await indexedPart(pkg, mastersPart, master2, "master");
111045
+ if (own3) {
111046
+ authored.set(own3, { id: id5, part });
111047
+ continue;
111048
+ }
111049
+ const root = await visioXml(pkg, part, "MasterContents");
110863
111050
  const top = children3(children3(root, "Shapes")[0], "Shape");
110864
111051
  if (top.length !== 1) continue;
110865
111052
  shapes.set(id5, top[0]);
110866
111053
  roles.set(id5, role);
110867
111054
  }
110868
- if (!shapes.size) return noCffMasters;
111055
+ if (!shapes.size && !authored.size) return noCffMasters;
110869
111056
  return {
110870
111057
  get: (id5) => shapes.get(id5),
110871
111058
  roleOf: (id5) => id5 ? roles.get(id5) : void 0,
110872
- empty: false
111059
+ authoredId: (role) => authored.get(role)?.id,
111060
+ authoredPart: (role) => authored.get(role)?.part,
111061
+ empty: !shapes.size
110873
111062
  };
110874
111063
  }
110875
111064
 
@@ -110892,10 +111081,10 @@ function turnSwimlanes(from, frame2, showTitle, lanes) {
110892
111081
  box: horizontal2 ? { minX: 0, maxX: size3, minY: 0, maxY: cross } : { minX: 0, maxX: cross, minY: 0, maxY: size3 }
110893
111082
  }))
110894
111083
  );
110895
- const turned = stacking.lanes.map((entry3, index5) => ({
110896
- id: entry3.id,
111084
+ const turned = stacking.lanes.map((entry4, index5) => ({
111085
+ id: entry4.id,
110897
111086
  from: lanes[index5].box,
110898
- to: entry3.target
111087
+ to: entry4.target
110899
111088
  }));
110900
111089
  return {
110901
111090
  direction: direction2,
@@ -111639,13 +111828,13 @@ function relayout(scope, frame2, order) {
111639
111828
  const titleSize = native && options2.title && Number.isFinite(laneTop) ? Math.max(0, frameBox.maxY - laneTop) : void 0;
111640
111829
  const stacking = stackSwimlanes(options2.direction, frameBox, options2.title, boxes, titleSize);
111641
111830
  const carried = new Map(
111642
- stacking.lanes.map((entry3, index5) => [index5, [...containerClosure(scope.root, lanes[index5])]])
111831
+ stacking.lanes.map((entry4, index5) => [index5, [...containerClosure(scope.root, lanes[index5])]])
111643
111832
  );
111644
111833
  if (scope.contents === "move") for (const ids of carried.values()) assertMovable(scope.root, ids);
111645
- stacking.lanes.forEach((entry3, index5) => {
111834
+ stacking.lanes.forEach((entry4, index5) => {
111646
111835
  scope.check();
111647
- place3(scope, lanes[index5], entry3.target);
111648
- if (scope.contents === "move") shift4(scope, carried.get(index5), entry3.dx, entry3.dy);
111836
+ place3(scope, lanes[index5], entry4.target);
111837
+ if (scope.contents === "move") shift4(scope, carried.get(index5), entry4.dx, entry4.dy);
111649
111838
  });
111650
111839
  const bars = separatorsOf(scope, frame2);
111651
111840
  for (const shape2 of bars) {
@@ -111998,8 +112187,8 @@ function applySwimlaneEdit(roots, document, edit2, check4, instances = /* @__PUR
111998
112187
  check4();
111999
112188
  const root = roots.get(edit2.pageId);
112000
112189
  if (!root) fail3("EDIT_TARGET_NOT_FOUND", "Page does not exist.");
112001
- const contents = "contents" in edit2 && edit2.contents === "leave" ? "leave" : "move";
112002
- const scope = { roots, document, root, pageId: edit2.pageId, check: check4, contents, masters };
112190
+ const contents2 = "contents" in edit2 && edit2.contents === "leave" ? "leave" : "move";
112191
+ const scope = { roots, document, root, pageId: edit2.pageId, check: check4, contents: contents2, masters };
112003
112192
  refuseBuiltByVisio(scope, edit2);
112004
112193
  if (edit2.type === "create-swimlanes") createSwimlanes(scope, edit2);
112005
112194
  else if (edit2.type === "insert-swimlane") insertSwimlane(scope, edit2);
@@ -112009,6 +112198,251 @@ function applySwimlaneEdit(roots, document, edit2, check4, instances = /* @__PUR
112009
112198
  else setOptions(scope, edit2);
112010
112199
  }
112011
112200
 
112201
+ // visio/edit-swimlane-stamp.ts
112202
+ var MASTER_RELATIONSHIP4 = "http://schemas.microsoft.com/visio/2010/relationships/master";
112203
+ var CFF_ROLES = Object.keys(CFF_AUTHORED_IDS);
112204
+ function partOf(shape2) {
112205
+ if (userValue(shape2, VISIO_SWIMLANE_FRAME_ROW) === "1") return "frame";
112206
+ if (userValue(shape2, VISIO_SWIMLANE_LANE_ROW) === "1") return "lane";
112207
+ if (userValue(shape2, VISIO_SEPARATOR_ROW) === "1") return "separator";
112208
+ if (userValue(shape2, "msvStructureType")?.toLowerCase() !== "list") return void 0;
112209
+ const kind = userValue(shape2, "msvSDListRequiredCategories");
112210
+ return kind === "Swimlane" ? "swimlane-list" : kind === "Phase" ? "phase-list" : void 0;
112211
+ }
112212
+ function unstampCffMasters(root, masters) {
112213
+ const ids = new Set(CFF_ROLES.map((role) => masters.authoredId(role)).filter(Boolean));
112214
+ if (!ids.size) return;
112215
+ for (const shape2 of topLevelShapes(root))
112216
+ if (ids.has(attribute3(shape2, "Master"))) shape2.removeAttribute("Master");
112217
+ }
112218
+ function stampCffMasters(root, masters) {
112219
+ const used = /* @__PURE__ */ new Set();
112220
+ for (const shape2 of topLevelShapes(root)) {
112221
+ const id5 = attribute3(shape2, "Master");
112222
+ const role = CFF_ROLES.find((item2) => masters.authoredId(item2) === id5);
112223
+ if (role && id5) used.add(role);
112224
+ }
112225
+ for (const shape2 of topLevelShapes(root)) {
112226
+ if (attribute3(shape2, "Master") || !shapeIdOf(shape2)) continue;
112227
+ const role = partOf(shape2);
112228
+ const id5 = role && masters.authoredId(role);
112229
+ if (!id5) continue;
112230
+ shape2.setAttribute("Master", id5);
112231
+ used.add(role);
112232
+ }
112233
+ return used;
112234
+ }
112235
+ async function relateCffMasters(pkg, parts, pagePath, roles, masters) {
112236
+ const part = relationshipsPartFor(pagePath);
112237
+ const rels = parts.has(part) ? copy2(await pkg.readXml(part, "Relationships")) : parseXml(`<Relationships xmlns="${NS.rels}"/>`).documentElement;
112238
+ const existing = () => Array.from(rels.getElementsByTagNameNS(rels.namespaceURI, "Relationship"));
112239
+ let changed = false;
112240
+ for (const role of roles) {
112241
+ const target3 = masters.authoredPart(role);
112242
+ if (!target3) continue;
112243
+ const linked = existing().some(
112244
+ (rel) => rel.getAttribute("Type") === MASTER_RELATIONSHIP4 && rel.getAttribute("TargetMode") !== "External" && resolvePartPath(pagePath, rel.getAttribute("Target") ?? "") === target3
112245
+ );
112246
+ if (linked) continue;
112247
+ const ids = new Set(existing().map((rel) => rel.getAttribute("Id") ?? ""));
112248
+ let index5 = 1;
112249
+ while (ids.has(`rId${index5}`)) index5++;
112250
+ const relationship2 = rels.ownerDocument.createElementNS(rels.namespaceURI, "Relationship");
112251
+ relationship2.setAttribute("Id", `rId${index5}`);
112252
+ relationship2.setAttribute("Type", MASTER_RELATIONSHIP4);
112253
+ const from = pagePath.split("/").slice(0, -1);
112254
+ const to = target3.split("/");
112255
+ let shared = 0;
112256
+ while (shared < from.length && shared < to.length - 1 && from[shared] === to[shared]) shared++;
112257
+ relationship2.setAttribute(
112258
+ "Target",
112259
+ [...from.slice(shared).map(() => ".."), ...to.slice(shared)].join("/")
112260
+ );
112261
+ rels.appendChild(relationship2);
112262
+ changed = true;
112263
+ }
112264
+ return changed ? { part, rels } : void 0;
112265
+ }
112266
+
112267
+ // visio/cff-author.ts
112268
+ var MM = 1 / 25.4;
112269
+ var STENCIL = ["visMasterStencil", "xfunc_m.vss"];
112270
+ var VERSION = ["visVersion", "15", ""];
112271
+ var HIDDEN_LAYER = ["msvSDMembersOnHiddenLayer", "1", "BOOL"];
112272
+ var QUIET = [
112273
+ ["msvSDContainerNoHighlight", "1", "BOOL"],
112274
+ ["msvSDContainerNoRibbon", "1", "BOOL"]
112275
+ ];
112276
+ var ALL_PARTS2 = "CFF Container;CFF List;Swimlane;Phase;NonCFF";
112277
+ var DEFINITIONS = {
112278
+ frame: {
112279
+ name: "CFF Container",
112280
+ size: { width: 150 * MM, height: 100 * MM },
112281
+ rows: [
112282
+ ["msvShapeCategories", "CFF Container;DoNotContain"],
112283
+ ["msvStructureType", "Container"],
112284
+ ...QUIET,
112285
+ ["msvSDContainerRequiredCategories", "CFF List"],
112286
+ ["msvSDContainerExcludedCategories", ""],
112287
+ STENCIL,
112288
+ VERSION
112289
+ ]
112290
+ },
112291
+ "swimlane-list": {
112292
+ name: "Swimlane List",
112293
+ size: { width: 125 * MM, height: 100 * MM },
112294
+ rows: [
112295
+ ["msvStructureType", "List"],
112296
+ ["msvShapeCategories", "CFF List;DoNotContain"],
112297
+ ["msvSDListRequiredCategories", "Swimlane"],
112298
+ ["msvSDContainerExcludedCategories", "CFF Container;CFF List;Phase;NonCFF"],
112299
+ ...QUIET,
112300
+ ["msvSDListDirection", "2", ""],
112301
+ HIDDEN_LAYER,
112302
+ STENCIL,
112303
+ VERSION
112304
+ ]
112305
+ },
112306
+ "phase-list": {
112307
+ name: "Phase List",
112308
+ size: { width: 100 * MM, height: 150 * MM },
112309
+ rows: [
112310
+ ["msvStructureType", "List"],
112311
+ ["msvShapeCategories", "CFF List;DoNotContain"],
112312
+ ["msvSDContainerRequiredCategories", "Phase"],
112313
+ ["msvSDListRequiredCategories", "Phase"],
112314
+ ...QUIET,
112315
+ ["msvSDListDirection", "0", ""],
112316
+ HIDDEN_LAYER,
112317
+ STENCIL,
112318
+ VERSION
112319
+ ]
112320
+ },
112321
+ lane: {
112322
+ name: "Swimlane",
112323
+ size: { width: 125 * MM, height: 30 * MM },
112324
+ rows: [
112325
+ ["msvShapeCategories", "Swimlane;DoNotContain"],
112326
+ ["msvStructureType", "Container"],
112327
+ ["msvSDContainerNoRibbon", "1", "BOOL"],
112328
+ ["msvSDContainerExcludedCategories", ALL_PARTS2],
112329
+ HIDDEN_LAYER,
112330
+ STENCIL,
112331
+ VERSION
112332
+ ]
112333
+ },
112334
+ separator: {
112335
+ name: "Separator",
112336
+ size: { width: 0.1, height: 100 * MM },
112337
+ rows: [
112338
+ ["msvStructureType", "Container"],
112339
+ ["msvShapeCategories", "Phase;DoNotContain"],
112340
+ ["msvSDContainerExcludedCategories", ALL_PARTS2],
112341
+ ...QUIET,
112342
+ HIDDEN_LAYER,
112343
+ STENCIL,
112344
+ VERSION
112345
+ ]
112346
+ }
112347
+ };
112348
+ var CFF_ROLES2 = [
112349
+ "frame",
112350
+ "swimlane-list",
112351
+ "phase-list",
112352
+ "lane",
112353
+ "separator"
112354
+ ];
112355
+ var baseId = (uniqueId) => uniqueId.replace(/^\{[0-9A-F]{8}/, "{4F0C7A10");
112356
+ function entry3(role) {
112357
+ return (masters, id5, name3, relationshipId) => {
112358
+ const doc = masters.ownerDocument;
112359
+ const node4 = (parent, tag) => parent.appendChild(doc.createElementNS(masters.namespaceURI, tag));
112360
+ const master2 = node4(masters, "Master");
112361
+ const { size: size3 } = DEFINITIONS[role];
112362
+ for (const [attribute4, value3] of [
112363
+ ["ID", id5],
112364
+ ["NameU", name3],
112365
+ ["IsCustomNameU", "1"],
112366
+ ["Name", name3],
112367
+ ["IsCustomName", "1"],
112368
+ ["Prompt", ""],
112369
+ ["IconSize", "1"],
112370
+ ["AlignName", "2"],
112371
+ ["MatchByName", "0"],
112372
+ ["IconUpdate", "1"],
112373
+ ["UniqueID", CFF_AUTHORED_IDS[role]],
112374
+ ["BaseID", baseId(CFF_AUTHORED_IDS[role])],
112375
+ ["PatternFlags", "0"],
112376
+ ["Hidden", "1"],
112377
+ ["MasterType", "34"]
112378
+ ])
112379
+ master2.setAttribute(attribute4, value3);
112380
+ const sheet2 = node4(master2, "PageSheet");
112381
+ for (const style4 of ["LineStyle", "FillStyle", "TextStyle"]) sheet2.setAttribute(style4, "0");
112382
+ for (const [cell2, value3] of [
112383
+ ["PageWidth", size3.width],
112384
+ ["PageHeight", size3.height],
112385
+ ["PageScale", 1],
112386
+ ["DrawingScale", 1],
112387
+ ["DrawingSizeType", 4],
112388
+ ["DrawingScaleType", 0]
112389
+ ])
112390
+ setCell(sheet2, cell2, value3);
112391
+ node4(master2, "Rel").setAttributeNS(NS.r, "r:id", relationshipId);
112392
+ };
112393
+ }
112394
+ function contents(role) {
112395
+ return (document) => {
112396
+ const namespace = document.namespaceURI;
112397
+ const root = parseXml(`<MasterContents xmlns="${namespace}"/>`).documentElement;
112398
+ root.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
112399
+ const doc = root.ownerDocument;
112400
+ const shapes = root.appendChild(doc.createElementNS(namespace, "Shapes"));
112401
+ const shape2 = shapes.appendChild(doc.createElementNS(namespace, "Shape"));
112402
+ shape2.setAttribute("ID", "5");
112403
+ shape2.setAttribute("Type", "Shape");
112404
+ applyShapeCreationStyles(shape2, document);
112405
+ const { width, height } = DEFINITIONS[role].size;
112406
+ for (const [name3, value3, formula2] of [
112407
+ ["PinX", width / 2],
112408
+ ["PinY", height / 2],
112409
+ ["Width", width],
112410
+ ["Height", height],
112411
+ ["LocPinX", width / 2, "Width*0.5"],
112412
+ ["LocPinY", height / 2, "Height*0.5"],
112413
+ ["Angle", 0],
112414
+ ["FlipX", 0],
112415
+ ["FlipY", 0],
112416
+ ["ResizeMode", 0]
112417
+ ])
112418
+ setCell(shape2, name3, value3, formula2);
112419
+ shape2.appendChild(userSection(shape2, DEFINITIONS[role].rows));
112420
+ return root;
112421
+ };
112422
+ }
112423
+ async function ensureCffMasters(source3, limits, maxOutput, deadline, check4) {
112424
+ let bytes = source3;
112425
+ const changedParts = /* @__PURE__ */ new Set();
112426
+ for (const role of CFF_ROLES2) {
112427
+ const added = await addMasterToDrawing(
112428
+ bytes,
112429
+ {
112430
+ uniqueId: CFF_AUTHORED_IDS[role],
112431
+ name: DEFINITIONS[role].name,
112432
+ entry: entry3(role),
112433
+ contents: contents(role)
112434
+ },
112435
+ limits,
112436
+ maxOutput,
112437
+ deadline,
112438
+ check4
112439
+ );
112440
+ bytes = added.bytes;
112441
+ for (const part of added.changedParts) changedParts.add(part);
112442
+ }
112443
+ return { bytes, changedParts: [...changedParts] };
112444
+ }
112445
+
112012
112446
  // visio/edit-shape-data.ts
112013
112447
  var UNITS = {
112014
112448
  string: "STR",
@@ -113017,11 +113451,33 @@ async function editVsdx(input2, edits2, options2 = {}) {
113017
113451
  ] : [],
113018
113452
  ...prepared2.templateConverted ? [{ code: "TEMPLATE_SAVED_AS_DRAWING", message: "The template was saved as a drawing." }] : []
113019
113453
  ];
113020
- const final = await editVisioPrepared(prepared2.bytes, snapshot2, options2, clock);
113454
+ const final = await editWithDeletionsLast(prepared2.bytes, snapshot2, options2, clock);
113021
113455
  return notes.length ? { ...final, diagnostics: [...notes, ...final.diagnostics] } : final;
113022
113456
  }
113457
+ async function editWithDeletionsLast(input2, edits2, options2, clock) {
113458
+ const deferred2 = edits2.filter((edit2) => edit2.type === "delete-shape" && edit2.deferred);
113459
+ if (!deferred2.length) return editVisioPrepared(input2, edits2, options2, clock);
113460
+ const rest = edits2.filter((edit2) => !deferred2.includes(edit2));
113461
+ const first3 = rest.length ? await editVsdx(input2, rest, options2) : { bytes: input2, changedParts: [], diagnostics: [] };
113462
+ const plain4 = deferred2.map((edit2) => ({ ...edit2, deferred: false }));
113463
+ const second = await editVsdx(first3.bytes, plain4, options2);
113464
+ return {
113465
+ bytes: second.bytes,
113466
+ changedParts: [.../* @__PURE__ */ new Set([...first3.changedParts, ...second.changedParts])],
113467
+ diagnostics: [...first3.diagnostics, ...second.diagnostics]
113468
+ };
113469
+ }
113023
113470
  async function editVisioPrepared(input2, edits2, options2, clock) {
113024
- const edited = await editVsdxTransaction(input2, edits2, options2, clock);
113471
+ const limits = { ...DEFAULTS2, ...options2.limits };
113472
+ const cff = edits2.some((edit2) => edit2.type === "create-swimlanes") ? await ensureCffMasters(
113473
+ input2,
113474
+ limits,
113475
+ positive4(options2.maxOutputBytes ?? limits.maxInputBytes),
113476
+ Date.now() + limits.maxRuntimeMs,
113477
+ () => void 0
113478
+ ) : void 0;
113479
+ const first3 = await editVsdxTransaction(cff?.bytes ?? input2, edits2, options2, clock);
113480
+ const edited = cff ? { ...first3, changedParts: [.../* @__PURE__ */ new Set([...cff.changedParts, ...first3.changedParts])] } : first3;
113025
113481
  const resized = await refreshTextSizes(clock.textSizes, edited, options2, clock.deadline);
113026
113482
  const result2 = await refreshLineJumpCaches(
113027
113483
  clock.jumpPages,
@@ -113208,7 +113664,7 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
113208
113664
  (command2) => command2.type !== "replace-plain-text" && command2.type !== "replace-text-ranges" && command2.type !== "insert-text-field" && command2.type !== "update-text-field" && command2.type !== "reorder-shape" && command2.type !== "duplicate-shapes" && command2.type !== "paste-shapes" && command2.type !== "change-shape" && command2.type !== "insert-picture" && !isVisioChartObjectEdit(command2) && command2.type !== "set-page-theme" && !isVisioMetadataEdit(command2) && command2.type !== "set-shape-data" && !isVisioControlEdit(command2) && !isVisioActionEdit(command2) && !isVisioGroupEdit(command2) && !isVisioDiagramPartEdit(command2) && !isVisioContainerEdit(command2) && !isVisioPictureEdit(command2) && !isVisioGuideEdit(command2) && !isVisioFormatEdit(command2)
113209
113665
  );
113210
113666
  let document;
113211
- const cffMasters = commands.some(isVisioSwimlaneEdit) ? await loadCffMasters(pkg) : noCffMasters;
113667
+ const cffMasters = await loadCffMasters(pkg);
113212
113668
  let masterMovePins = emptyMasterMoveProof();
113213
113669
  const instanceCommands = /* @__PURE__ */ new Set();
113214
113670
  let instanceDeletes = /* @__PURE__ */ new Set();
@@ -113218,7 +113674,9 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
113218
113674
  )) {
113219
113675
  for (const [pageId2, path5] of pages) {
113220
113676
  const sourceRoot = await visioXml(pkg, path5, "PageContents");
113221
- roots.set(pageId2, sourceRoot.ownerDocument.cloneNode(true).documentElement);
113677
+ const root = sourceRoot.ownerDocument.cloneNode(true).documentElement;
113678
+ unstampCffMasters(root, cffMasters);
113679
+ roots.set(pageId2, root);
113222
113680
  }
113223
113681
  for (const [pageId2, root] of roots) {
113224
113682
  const ids = new Set(
@@ -113482,12 +113940,18 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
113482
113940
  for (const shapeId2 of takeDeferredTextSizes(root)) clock.textSizes.push({ pageId: pageId2, shapeId: shapeId2 });
113483
113941
  let totalBytes = [...parts.values()].reduce((sum3, bytes2) => sum3 + bytes2.length, 0);
113484
113942
  let nodes = 0;
113943
+ for (const [path4, root] of [...dirty]) {
113944
+ if (![...pages.values()].includes(path4)) continue;
113945
+ const used = stampCffMasters(root, cffMasters);
113946
+ const related2 = used.size ? await relateCffMasters(pkg, parts, path4, used, cffMasters) : void 0;
113947
+ if (related2) dirty.set(related2.part, related2.rels);
113948
+ }
113485
113949
  for (const [path4, root] of dirty) {
113486
113950
  const serialized = serializeEditedXml(root, limits, check4);
113487
113951
  nodes += serialized.nodes;
113488
113952
  if (nodes > limits.maxTotalXmlNodes)
113489
113953
  fail3("LIMIT_XML_TOTAL", "Edited XML node total exceeds limit.");
113490
- totalBytes += serialized.bytes.length - parts.get(path4).length;
113954
+ totalBytes += serialized.bytes.length - (parts.get(path4)?.length ?? 0);
113491
113955
  if (totalBytes > limits.maxTotalBytes)
113492
113956
  fail3("LIMIT_TOTAL", "Edited package total exceeds limit.");
113493
113957
  parts.set(path4, serialized.bytes);
@@ -113503,7 +113967,8 @@ async function editVsdxTransaction(input2, edits2, options2, clock = {
113503
113967
  { ...limits, maxInputBytes: maxOutput, maxRuntimeMs: Math.max(1, deadline - Date.now()) },
113504
113968
  check4
113505
113969
  );
113506
- for (const path4 of dirty.keys()) await visioXml(verified.pkg, path4, "PageContents");
113970
+ for (const path4 of dirty.keys())
113971
+ if (!path4.endsWith(".rels")) await visioXml(verified.pkg, path4, "PageContents");
113507
113972
  check4();
113508
113973
  }
113509
113974
  return {
@@ -118970,9 +119435,9 @@ var memo = {
118970
119435
  if (!bucket)
118971
119436
  return empty;
118972
119437
  handoff = void 0;
118973
- const entry3 = { value: empty, issues: null };
118974
- bucket.set(payload.value, entry3);
118975
- open.push(entry3);
119438
+ const entry4 = { value: empty, issues: null };
119439
+ bucket.set(payload.value, entry4);
119440
+ open.push(entry4);
118976
119441
  return empty;
118977
119442
  },
118978
119443
  guard(inst) {
@@ -119046,16 +119511,16 @@ var memo = {
119046
119511
  const depth = open.length;
119047
119512
  const result2 = base3(payload, ctx);
119048
119513
  handoff = void 0;
119049
- const entry3 = open.length > depth ? open.pop() : void 0;
119514
+ const entry4 = open.length > depth ? open.pop() : void 0;
119050
119515
  if (result2 instanceof Promise) {
119051
119516
  return result2.then((r) => {
119052
- if (entry3)
119053
- entry3.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
119517
+ if (entry4)
119518
+ entry4.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
119054
119519
  return r;
119055
119520
  });
119056
119521
  }
119057
- if (entry3)
119058
- entry3.issues = result2.issues.length ? cloneIssues(result2.issues) : NO_ISSUES;
119522
+ if (entry4)
119523
+ entry4.issues = result2.issues.length ? cloneIssues(result2.issues) : NO_ISSUES;
119059
119524
  return result2;
119060
119525
  };
119061
119526
  inst._zod.parse = wrapped;
@@ -129464,42 +129929,42 @@ function extractDefs(ctx, schema) {
129464
129929
  if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
129465
129930
  return;
129466
129931
  const idToSchema = /* @__PURE__ */ new Map();
129467
- for (const entry3 of ctx.seen.entries()) {
129468
- const id5 = ctx.metadataRegistry.get(entry3[0])?.id;
129932
+ for (const entry4 of ctx.seen.entries()) {
129933
+ const id5 = ctx.metadataRegistry.get(entry4[0])?.id;
129469
129934
  if (id5) {
129470
129935
  const existing = idToSchema.get(id5);
129471
- if (existing && existing !== entry3[0]) {
129936
+ if (existing && existing !== entry4[0]) {
129472
129937
  throw new Error(`Duplicate schema id "${id5}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
129473
129938
  }
129474
- idToSchema.set(id5, entry3[0]);
129939
+ idToSchema.set(id5, entry4[0]);
129475
129940
  }
129476
129941
  }
129477
- const makeURI = (entry3) => {
129942
+ const makeURI = (entry4) => {
129478
129943
  const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
129479
129944
  if (ctx.external) {
129480
- const externalId = ctx.external.registry.get(entry3[0])?.id;
129945
+ const externalId = ctx.external.registry.get(entry4[0])?.id;
129481
129946
  const uriGenerator = ctx.external.uri ?? ((id6) => id6);
129482
129947
  if (externalId) {
129483
129948
  return { ref: uriGenerator(externalId) };
129484
129949
  }
129485
- const id5 = entry3[1].defId ?? entry3[1].schema.id ?? `schema${ctx.counter++}`;
129486
- entry3[1].defId = id5;
129950
+ const id5 = entry4[1].defId ?? entry4[1].schema.id ?? `schema${ctx.counter++}`;
129951
+ entry4[1].defId = id5;
129487
129952
  return { defId: id5, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id5)}` };
129488
129953
  }
129489
129954
  const uriPrefix = `#`;
129490
129955
  const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
129491
- if (entry3[1] === root && !entry3[1].schema.id) {
129956
+ if (entry4[1] === root && !entry4[1].schema.id) {
129492
129957
  return { ref: uriPrefix };
129493
129958
  }
129494
- const defId = entry3[1].schema.id ?? `__schema${ctx.counter++}`;
129959
+ const defId = entry4[1].schema.id ?? `__schema${ctx.counter++}`;
129495
129960
  return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };
129496
129961
  };
129497
- const extractToDef = (entry3) => {
129498
- if (entry3[1].schema.$ref) {
129962
+ const extractToDef = (entry4) => {
129963
+ if (entry4[1].schema.$ref) {
129499
129964
  return;
129500
129965
  }
129501
- const seen = entry3[1];
129502
- const { ref, defId } = makeURI(entry3);
129966
+ const seen = entry4[1];
129967
+ const { ref, defId } = makeURI(entry4);
129503
129968
  seen.def = { ...seen.schema };
129504
129969
  if (defId)
129505
129970
  seen.defId = defId;
@@ -129510,8 +129975,8 @@ function extractDefs(ctx, schema) {
129510
129975
  schema2.$ref = ref;
129511
129976
  };
129512
129977
  if (ctx.cycles === "throw") {
129513
- for (const entry3 of ctx.seen.entries()) {
129514
- const seen = entry3[1];
129978
+ for (const entry4 of ctx.seen.entries()) {
129979
+ const seen = entry4[1];
129515
129980
  if (seen.cycle) {
129516
129981
  throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
129517
129982
 
@@ -129519,31 +129984,31 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
129519
129984
  }
129520
129985
  }
129521
129986
  }
129522
- for (const entry3 of ctx.seen.entries()) {
129523
- const seen = entry3[1];
129524
- if (schema === entry3[0]) {
129525
- extractToDef(entry3);
129987
+ for (const entry4 of ctx.seen.entries()) {
129988
+ const seen = entry4[1];
129989
+ if (schema === entry4[0]) {
129990
+ extractToDef(entry4);
129526
129991
  continue;
129527
129992
  }
129528
129993
  if (ctx.external) {
129529
- const ext = ctx.external.registry.get(entry3[0])?.id;
129530
- if (schema !== entry3[0] && ext) {
129531
- extractToDef(entry3);
129994
+ const ext = ctx.external.registry.get(entry4[0])?.id;
129995
+ if (schema !== entry4[0] && ext) {
129996
+ extractToDef(entry4);
129532
129997
  continue;
129533
129998
  }
129534
129999
  }
129535
- const id5 = ctx.metadataRegistry.get(entry3[0])?.id;
130000
+ const id5 = ctx.metadataRegistry.get(entry4[0])?.id;
129536
130001
  if (id5) {
129537
- extractToDef(entry3);
130002
+ extractToDef(entry4);
129538
130003
  continue;
129539
130004
  }
129540
130005
  if (seen.cycle) {
129541
- extractToDef(entry3);
130006
+ extractToDef(entry4);
129542
130007
  continue;
129543
130008
  }
129544
130009
  if (seen.count > 1) {
129545
130010
  if (ctx.reused === "ref") {
129546
- extractToDef(entry3);
130011
+ extractToDef(entry4);
129547
130012
  }
129548
130013
  }
129549
130014
  }
@@ -129725,12 +130190,12 @@ function finalize2(ctx, schema) {
129725
130190
  });
129726
130191
  };
129727
130192
  if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
129728
- for (const entry3 of [...ctx.seen.entries()].reverse()) {
129729
- flattenRef(entry3[0]);
130193
+ for (const entry4 of [...ctx.seen.entries()].reverse()) {
130194
+ flattenRef(entry4[0]);
129730
130195
  }
129731
130196
  if (ctx.target !== "openapi-3.0") {
129732
- for (const entry3 of ctx.seen.entries()) {
129733
- compactTypeUnion(entry3[1].def ?? entry3[1].schema);
130197
+ for (const entry4 of ctx.seen.entries()) {
130198
+ compactTypeUnion(entry4[1].def ?? entry4[1].schema);
129734
130199
  }
129735
130200
  }
129736
130201
  for (const rewrite2 of ctx.deferred)
@@ -129775,8 +130240,8 @@ function finalize2(ctx, schema) {
129775
130240
  delete result2.id;
129776
130241
  const defs = ctx.external?.defs ?? {};
129777
130242
  if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
129778
- for (const entry3 of ctx.seen.entries()) {
129779
- const seen = entry3[1];
130243
+ for (const entry4 of ctx.seen.entries()) {
130244
+ const seen = entry4[1];
129780
130245
  if (seen.def && seen.defId) {
129781
130246
  if (seen.def.id === seen.defId)
129782
130247
  delete seen.def.id;
@@ -130386,9 +130851,9 @@ function stringifyKeyNames(bySchema, json2, visited) {
130386
130851
  var pendingRecords = /* @__PURE__ */ new WeakMap();
130387
130852
  function rewriteKeyNames(ctx) {
130388
130853
  const bySchema = /* @__PURE__ */ new Map();
130389
- for (const entry3 of ctx.seen.values()) {
130390
- if (entry3.def && !bySchema.has(entry3.schema))
130391
- bySchema.set(entry3.schema, entry3);
130854
+ for (const entry4 of ctx.seen.values()) {
130855
+ if (entry4.def && !bySchema.has(entry4.schema))
130856
+ bySchema.set(entry4.schema, entry4);
130392
130857
  }
130393
130858
  const rewrites = /* @__PURE__ */ new Map();
130394
130859
  for (const record3 of pendingRecords.get(ctx) ?? []) {
@@ -130402,8 +130867,8 @@ function rewriteKeyNames(ctx) {
130402
130867
  }
130403
130868
  if (!rewrites.size)
130404
130869
  return;
130405
- for (const entry3 of ctx.seen.values()) {
130406
- for (const carrier of [entry3.schema, entry3.def]) {
130870
+ for (const entry4 of ctx.seen.values()) {
130871
+ for (const carrier of [entry4.schema, entry4.def]) {
130407
130872
  const rewritten = carrier && rewrites.get(carrier.propertyNames);
130408
130873
  if (rewritten)
130409
130874
  carrier.propertyNames = rewritten;
@@ -130597,8 +131062,8 @@ function toJSONSchema(input2, params) {
130597
131062
  const registry2 = input2;
130598
131063
  const ctx2 = initializeContext({ ...params, processors: allProcessors });
130599
131064
  const defs = {};
130600
- for (const entry3 of registry2._idmap.entries()) {
130601
- const [_, schema] = entry3;
131065
+ for (const entry4 of registry2._idmap.entries()) {
131066
+ const [_, schema] = entry4;
130602
131067
  processSchema(schema, ctx2);
130603
131068
  }
130604
131069
  const schemas = {};
@@ -130608,8 +131073,8 @@ function toJSONSchema(input2, params) {
130608
131073
  defs
130609
131074
  };
130610
131075
  ctx2.external = external;
130611
- for (const entry3 of registry2._idmap.entries()) {
130612
- const [key2, schema] = entry3;
131076
+ for (const entry4 of registry2._idmap.entries()) {
131077
+ const [key2, schema] = entry4;
130613
131078
  extractDefs(ctx2, schema);
130614
131079
  assignProp(schemas, key2, finalize2(ctx2, schema));
130615
131080
  }