ooxml-core 1.17.0 → 1.19.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 (137) hide show
  1. package/dist/{PptxHandler-K7GMS2ST.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
  2. package/dist/{PptxHandler-L3JPWOBN.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
  3. package/dist/{PptxHandler-U6EFO73T.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
  4. package/dist/{PresentationBuilder-XC3F3OPY.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
  5. package/dist/{PresentationBuilder-OK526SZ4.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
  6. package/dist/{PresentationBuilder-LUR6LGHU.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
  7. package/dist/automation/index.cjs +5198 -3235
  8. package/dist/automation/index.mjs +5198 -3235
  9. package/dist/chart/axis-range-auto.d.ts +10 -0
  10. package/dist/chart/axis-range-auto.d.ts.map +1 -0
  11. package/dist/chart/axis-range-types.d.ts +27 -0
  12. package/dist/chart/axis-range-types.d.ts.map +1 -0
  13. package/dist/chart/axis-range.d.ts +37 -0
  14. package/dist/chart/axis-range.d.ts.map +1 -0
  15. package/dist/chart/axis-ticks.d.ts +8 -0
  16. package/dist/chart/axis-ticks.d.ts.map +1 -0
  17. package/dist/chart/data-label-text.d.ts +70 -0
  18. package/dist/chart/data-label-text.d.ts.map +1 -0
  19. package/dist/chart/formatting-nodes.d.ts +6 -0
  20. package/dist/chart/formatting-nodes.d.ts.map +1 -1
  21. package/dist/chart/index.cjs +1536 -571
  22. package/dist/chart/index.d.ts +7 -0
  23. package/dist/chart/index.d.ts.map +1 -1
  24. package/dist/chart/index.mjs +1512 -572
  25. package/dist/chart/line-dash.d.ts +2 -0
  26. package/dist/chart/line-dash.d.ts.map +1 -0
  27. package/dist/chart/marker-shape.d.ts +70 -0
  28. package/dist/chart/marker-shape.d.ts.map +1 -0
  29. package/dist/chart/read-formatting.d.ts.map +1 -1
  30. package/dist/chart/render/chart-svg-axes.d.ts +9 -0
  31. package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
  32. package/dist/chart/render/chart-svg-bars.d.ts.map +1 -1
  33. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  34. package/dist/chart/render/chart-svg-labels.d.ts +42 -0
  35. package/dist/chart/render/chart-svg-labels.d.ts.map +1 -0
  36. package/dist/chart/render/chart-svg-markers.d.ts +6 -0
  37. package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
  38. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  39. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  40. package/dist/chart/render/chart-view-axes.d.ts +30 -0
  41. package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
  42. package/dist/chart/render/chart-view-labels.d.ts +16 -0
  43. package/dist/chart/render/chart-view-labels.d.ts.map +1 -0
  44. package/dist/chart/render/chart-view-markers.d.ts +27 -0
  45. package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
  46. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  47. package/dist/chart/render/chart-view.d.ts +7 -1
  48. package/dist/chart/render/chart-view.d.ts.map +1 -1
  49. package/dist/chart/render/index.d.ts +2 -0
  50. package/dist/chart/render/index.d.ts.map +1 -1
  51. package/dist/chart/render/summary-from-space.d.ts +2 -2
  52. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  53. package/dist/chart/render/summary-labels.d.ts +9 -0
  54. package/dist/chart/render/summary-labels.d.ts.map +1 -0
  55. package/dist/chart/render/summary.d.ts +29 -1
  56. package/dist/chart/render/summary.d.ts.map +1 -1
  57. package/dist/{chunk-IM5LFEA2.mjs → chunk-3XFPCZKB.mjs} +1 -1
  58. package/dist/{chunk-YS43OMM3.mjs → chunk-75GLSRZE.mjs} +4 -4
  59. package/dist/{chunk-A7S2NYAU.mjs → chunk-BIVNVDAH.mjs} +1 -1
  60. package/dist/{chunk-UFGJNXRG.mjs → chunk-QBJRB6WW.mjs} +1 -1
  61. package/dist/{chunk-HLZIALC5.mjs → chunk-RUZEMWDI.mjs} +1 -1
  62. package/dist/docx/embedded.cjs +15 -0
  63. package/dist/docx/embedded.mjs +15 -0
  64. package/dist/docx/index.cjs +1825 -693
  65. package/dist/docx/index.mjs +1825 -693
  66. package/dist/docx/layout/index.cjs +1684 -567
  67. package/dist/docx/layout/index.mjs +1684 -567
  68. package/dist/docx/load/index.cjs +15 -0
  69. package/dist/docx/load/index.mjs +15 -0
  70. package/dist/docx/ui/index.cjs +1696 -579
  71. package/dist/docx/ui/index.mjs +1696 -579
  72. package/dist/index.cjs +1623 -658
  73. package/dist/index.mjs +1623 -658
  74. package/dist/pptx/automation/index.cjs +61 -0
  75. package/dist/pptx/automation/index.mjs +5 -5
  76. package/dist/pptx/cli/index.cjs +61 -0
  77. package/dist/pptx/cli/index.mjs +4 -4
  78. package/dist/pptx/converter/index.mjs +2 -2
  79. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  80. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  81. package/dist/pptx/index.cjs +61 -0
  82. package/dist/pptx/index.mjs +5 -5
  83. package/dist/teams/index.cjs +212 -50
  84. package/dist/teams/index.mjs +212 -50
  85. package/dist/visio/edit-chart-object-commands.d.ts +36 -0
  86. package/dist/visio/edit-chart-object-commands.d.ts.map +1 -0
  87. package/dist/visio/edit-chart-object.d.ts +7 -0
  88. package/dist/visio/edit-chart-object.d.ts.map +1 -0
  89. package/dist/visio/edit-commands.d.ts +2 -1
  90. package/dist/visio/edit-commands.d.ts.map +1 -1
  91. package/dist/visio/edit-foreign-frame.d.ts +8 -0
  92. package/dist/visio/edit-foreign-frame.d.ts.map +1 -0
  93. package/dist/visio/edit-metadata-commands.d.ts +7 -0
  94. package/dist/visio/edit-metadata-commands.d.ts.map +1 -1
  95. package/dist/visio/edit-picture.d.ts +8 -0
  96. package/dist/visio/edit-picture.d.ts.map +1 -1
  97. package/dist/visio/edit.d.ts.map +1 -1
  98. package/dist/visio/emf-bitmap.d.ts +8 -0
  99. package/dist/visio/emf-bitmap.d.ts.map +1 -0
  100. package/dist/visio/index.cjs +17505 -6279
  101. package/dist/visio/index.d.ts +2 -0
  102. package/dist/visio/index.d.ts.map +1 -1
  103. package/dist/visio/index.mjs +17503 -6280
  104. package/dist/visio/model.d.ts +18 -0
  105. package/dist/visio/model.d.ts.map +1 -1
  106. package/dist/visio/prepare-embedded.d.ts +10 -0
  107. package/dist/visio/prepare-embedded.d.ts.map +1 -0
  108. package/dist/visio/prepare-images.d.ts.map +1 -1
  109. package/dist/visio/shapes.d.ts.map +1 -1
  110. package/dist/visio/sheet.d.ts +2 -1
  111. package/dist/visio/sheet.d.ts.map +1 -1
  112. package/dist/visio/ui/edit-commands.d.ts.map +1 -1
  113. package/dist/visio/ui/index.cjs +33580 -22875
  114. package/dist/visio/ui/index.mjs +33578 -22875
  115. package/dist/visio/ui/insert.d.ts +11 -0
  116. package/dist/visio/ui/insert.d.ts.map +1 -1
  117. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  118. package/dist/xlsx/index.cjs +1965 -817
  119. package/dist/xlsx/index.mjs +1965 -817
  120. package/dist/xlsx/load/index.cjs +190 -51
  121. package/dist/xlsx/load/index.mjs +190 -51
  122. package/dist/xlsx/model.d.ts +5 -0
  123. package/dist/xlsx/model.d.ts.map +1 -1
  124. package/dist/xlsx/read/chart.d.ts.map +1 -1
  125. package/dist/xlsx/read/load.d.ts.map +1 -1
  126. package/dist/xlsx/read/workbook-part.d.ts +2 -0
  127. package/dist/xlsx/read/workbook-part.d.ts.map +1 -1
  128. package/dist/xlsx/ui/dialogs/grid-chart.d.ts +22 -1
  129. package/dist/xlsx/ui/dialogs/grid-chart.d.ts.map +1 -1
  130. package/dist/xlsx/ui/index.cjs +17482 -4364
  131. package/dist/xlsx/ui/index.mjs +17472 -4362
  132. package/dist/xlsx/write/workbook-part.d.ts.map +1 -1
  133. package/package.json +1 -1
  134. package/dist/visio/edit-foreign-bitmap.d.ts +0 -7
  135. package/dist/visio/edit-foreign-bitmap.d.ts.map +0 -1
  136. /package/dist/{chunk-KU3SMBFU.mjs → chunk-H6TNNXJK.mjs} +0 -0
  137. /package/dist/{chunk-UWWS6VVJ.cjs → chunk-MHMVD23Y.cjs} +0 -0
package/dist/index.cjs CHANGED
@@ -147,8 +147,8 @@ function rgbToHsl(r, g2, b) {
147
147
  }
148
148
  return { h: h2, s: clampUnitInterval(s2), l: clampUnitInterval(l) };
149
149
  }
150
- function hslToRgb(h2, s2, l, roundChannel = Math.round, options) {
151
- const sC = options?.clampSaturation === false ? s2 : clampUnitInterval(s2);
150
+ function hslToRgb(h2, s2, l, roundChannel = Math.round, options2) {
151
+ const sC = options2?.clampSaturation === false ? s2 : clampUnitInterval(s2);
152
152
  const lC = clampUnitInterval(l);
153
153
  const hN = (h2 % 360 + 360) % 360;
154
154
  const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
@@ -636,6 +636,8 @@ __export(chart_exports, {
636
636
  CHART_ERROR_VALUE_TYPES: () => CHART_ERROR_VALUE_TYPES,
637
637
  CHART_GROUP_ELEMENTS: () => CHART_GROUP_ELEMENTS,
638
638
  CHART_STYLE_PARTS: () => CHART_STYLE_PARTS,
639
+ DATA_LABEL_CATEGORY_PERCENT_SEPARATOR: () => DATA_LABEL_CATEGORY_PERCENT_SEPARATOR,
640
+ DATA_LABEL_SEPARATOR: () => DATA_LABEL_SEPARATOR,
639
641
  DEFAULT_BAR_GAP_WIDTH: () => DEFAULT_BAR_GAP_WIDTH,
640
642
  DEFAULT_CHART_PALETTE: () => DEFAULT_CHART_PALETTE,
641
643
  DEFAULT_THEME_COLORS: () => DEFAULT_THEME_COLORS,
@@ -650,9 +652,11 @@ __export(chart_exports, {
650
652
  aggregateByCategory: () => aggregateByCategory,
651
653
  assertBarClusterOptions: () => assertBarClusterOptions,
652
654
  autoSeriesColor: () => autoSeriesColor,
655
+ automaticMarkerSymbol: () => automaticMarkerSymbol,
653
656
  axisTargetIntervals: () => axisTargetIntervals,
654
657
  buildChartGradientDef: () => buildChartGradientDef,
655
658
  buildHierarchyRoots: () => buildHierarchyRoots,
659
+ buildMarkerPrimitive: () => buildMarkerPrimitive,
656
660
  buildWaterfallSteps: () => buildWaterfallSteps,
657
661
  builtInChartStyleXml: () => builtInChartStyleXml,
658
662
  builtInChartTextStyle: () => builtInChartTextStyle,
@@ -664,10 +668,13 @@ __export(chart_exports, {
664
668
  chartErrorBarAmount: () => chartErrorBarAmount,
665
669
  chartExSummary: () => chartExSummary,
666
670
  chartGradientMarkup: () => chartGradientMarkup,
671
+ chartLineDashArray: () => chartLineDashArray,
672
+ chartMarkerRadius: () => chartMarkerRadius,
667
673
  chartPaletteColors: () => chartPaletteColors,
668
674
  chartPaletteSeriesColor: () => chartPaletteSeriesColor,
669
675
  chartPaletteSeriesColorChoice: () => chartPaletteSeriesColorChoice,
670
676
  chartSampleVariance: () => chartSampleVariance,
677
+ chartSeriesMarkerSvg: () => chartSeriesMarkerSvg,
671
678
  chartSourceValues: () => chartSourceValues,
672
679
  chartSpaceKind: () => chartSpaceKind,
673
680
  chartSummaryFromSpace: () => chartSummaryFromSpace,
@@ -677,18 +684,26 @@ __export(chart_exports, {
677
684
  chartTrendlineKind: () => chartTrendlineKind,
678
685
  chartTrendlineType: () => chartTrendlineType,
679
686
  clusteredBarGeometry: () => clusteredBarGeometry,
687
+ composeDataLabelText: () => composeDataLabelText,
688
+ computeAxisStackedValueRange: () => computeAxisStackedValueRange,
689
+ computeAxisValueRange: () => computeAxisValueRange,
680
690
  computeBoxStats: () => computeBoxStats,
681
691
  computeBubbleRadius: () => computeBubbleRadius,
682
692
  computeHierarchicalSunburstArcs: () => computeHierarchicalSunburstArcs,
683
693
  computeHistogramBins: () => computeHistogramBins,
684
694
  computeLinearRegression: () => computeLinearRegression,
695
+ computeLogValueRange: () => computeLogValueRange,
685
696
  computeRSquared: () => computeRSquared,
686
697
  computeRadarPoints: () => computeRadarPoints,
687
698
  computeStackedSeriesPlots: () => computeStackedSeriesPlots,
699
+ computeStackedValueRangeForAxis: () => computeStackedValueRangeForAxis,
688
700
  computeSunburstArcs: () => computeSunburstArcs,
701
+ computeValueRangeForAxis: () => computeValueRangeForAxis,
702
+ computeValueRangeForChart: () => computeValueRangeForChart,
689
703
  computeWaterfallRange: () => computeWaterfallRange,
690
704
  effectiveBuiltInChartStyle: () => effectiveBuiltInChartStyle,
691
705
  findChartColorPalette: () => findChartColorPalette,
706
+ findLogAxis: () => findLogAxis,
692
707
  fitChartTrendline: () => fitChartTrendline,
693
708
  fitPolynomial: () => fitPolynomial,
694
709
  formatChartNumber: () => formatChartNumber,
@@ -700,6 +715,9 @@ __export(chart_exports, {
700
715
  formatPolynomialEquation: () => formatPolynomialEquation,
701
716
  formatPowerEquation: () => formatPowerEquation,
702
717
  formatTrendlineCoefficient: () => formatTrendlineCoefficient,
718
+ generateAxisTicks: () => generateAxisTicks,
719
+ generateLogTicks: () => generateLogTicks,
720
+ generateMinorAxisTicks: () => generateMinorAxisTicks,
703
721
  getChartStylePalette: () => getChartStylePalette,
704
722
  groupRowsByCategory: () => groupRowsByCategory,
705
723
  hasManualLayoutFields: () => hasManualLayoutFields,
@@ -707,6 +725,8 @@ __export(chart_exports, {
707
725
  impliesAutoTitle: () => impliesAutoTitle,
708
726
  isChartexOnlyType: () => isChartexOnlyType,
709
727
  layoutTreemap: () => layoutTreemap,
728
+ markerOutline: () => markerOutline,
729
+ markerRadius: () => markerRadius,
710
730
  maxBubbleSize: () => maxBubbleSize,
711
731
  medianBubbleRadius: () => medianBubbleRadius,
712
732
  modulateLuminance: () => modulateLuminance,
@@ -731,18 +751,23 @@ __export(chart_exports, {
731
751
  resolveBlankDisplay: () => resolveBlankDisplay,
732
752
  resolveChartGradient: () => resolveChartGradient,
733
753
  resolveChartStyleDefinition: () => resolveChartStyleDefinition,
754
+ resolveDataLabelFlags: () => resolveDataLabelFlags,
734
755
  resolveManualLayoutRect: () => resolveManualLayoutRect,
735
756
  scottBinCount: () => scottBinCount,
757
+ seriesMarkerViews: () => seriesMarkerViews,
736
758
  shade: () => shade,
737
759
  sortGradientStops: () => sortGradientStops,
738
760
  squarify: () => squarify,
739
761
  stockCandle: () => stockCandle,
740
762
  stockSlots: () => stockSlots,
763
+ summaryMarkers: () => summaryMarkers,
741
764
  sunburstArcPath: () => sunburstArcPath,
742
765
  themeColor: () => themeColor,
743
766
  tint: () => tint,
744
767
  updateGradientStop: () => updateGradientStop,
768
+ valueToYLog: () => valueToYLog,
745
769
  visibleRuns: () => visibleRuns,
770
+ withAxisBounds: () => withAxisBounds,
746
771
  withChartGradientDirection: () => withChartGradientDirection,
747
772
  withinLinearTransform: () => withinLinearTransform,
748
773
  writeChartAxisFormatting: () => writeChartAxisFormatting,
@@ -1277,6 +1302,52 @@ function formatChartNumber(value, formatCode) {
1277
1302
  return formatChartNumberWithColor(value, formatCode)?.text;
1278
1303
  }
1279
1304
 
1305
+ // chart/data-label-text.ts
1306
+ var DATA_LABEL_SEPARATOR = ", ";
1307
+ var DATA_LABEL_CATEGORY_PERCENT_SEPARATOR = "\n";
1308
+ var FLAG_KEYS = [
1309
+ "showValue",
1310
+ "showCategory",
1311
+ "showSeriesName",
1312
+ "showPercent",
1313
+ "showBubbleSize"
1314
+ ];
1315
+ function resolveDataLabelFlags(levels) {
1316
+ const { point, series, chart } = levels;
1317
+ const picked = {};
1318
+ for (const key of FLAG_KEYS) picked[key] = point?.[key] ?? series?.[key] ?? chart?.[key];
1319
+ const anyDeclared = FLAG_KEYS.some((key) => picked[key] !== void 0);
1320
+ return {
1321
+ showValue: anyDeclared ? picked.showValue === true : levels.siblingOwnsLabels !== true,
1322
+ showCategory: picked.showCategory === true,
1323
+ showSeriesName: picked.showSeriesName === true,
1324
+ showPercent: picked.showPercent === true,
1325
+ showBubbleSize: picked.showBubbleSize === true,
1326
+ separator: point?.separator ?? series?.separator ?? chart?.separator ?? (picked.showCategory === true && picked.showPercent === true ? DATA_LABEL_CATEGORY_PERCENT_SEPARATOR : DATA_LABEL_SEPARATOR)
1327
+ };
1328
+ }
1329
+ function composeDataLabelText(input) {
1330
+ const { flags, value, numberFormat: numberFormat2 } = input;
1331
+ const parts = [];
1332
+ let valueColor;
1333
+ if (flags.showSeriesName && input.seriesName) parts.push(input.seriesName);
1334
+ if (flags.showCategory && input.category) parts.push(input.category);
1335
+ if (flags.showValue) {
1336
+ const formatted = formatChartNumberWithColor(value, numberFormat2);
1337
+ parts.push(formatted?.text ?? (input.formatValue ?? String)(value, numberFormat2));
1338
+ valueColor = formatted?.color;
1339
+ }
1340
+ if (flags.showPercent) {
1341
+ const base = input.percentBase;
1342
+ parts.push(base > 0 ? `${Math.round(Math.abs(value) / base * 100)}%` : "0%");
1343
+ }
1344
+ if (flags.showBubbleSize && input.bubbleSize !== void 0)
1345
+ parts.push((input.formatBubbleSize ?? String)(input.bubbleSize));
1346
+ const text4 = parts.join(flags.separator);
1347
+ if (text4.length === 0) return void 0;
1348
+ return { text: text4, color: parts.length === 1 && flags.showValue ? valueColor : void 0 };
1349
+ }
1350
+
1280
1351
  // chart/auto-title.ts
1281
1352
  var CHART_AUTO_TITLE = "Chart Title";
1282
1353
  var CHARTEX_ONLY_TYPES = /* @__PURE__ */ new Set([
@@ -1313,12 +1384,12 @@ function formatCompactAxisValue(value, formatCode) {
1313
1384
  }
1314
1385
 
1315
1386
  // chart/bubble-radius.ts
1316
- function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options) {
1317
- const scale = (options?.bubbleScale ?? 100) / 100;
1387
+ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
1388
+ const scale = (options2?.bubbleScale ?? 100) / 100;
1318
1389
  if (sizeVal === void 0) return medianRadius * scale;
1319
1390
  const denom = maxBubble > 0 ? maxBubble : 1;
1320
1391
  const magnitude = Math.abs(sizeVal);
1321
- const ratio = (options?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
1392
+ const ratio = (options2?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
1322
1393
  return medianRadius * scale * 0.5 + ratio * medianRadius * scale * 1.5;
1323
1394
  }
1324
1395
  function maxBubbleSize(sizes) {
@@ -1424,10 +1495,10 @@ function squarify(nodes, box) {
1424
1495
 
1425
1496
  // chart/hierarchy.ts
1426
1497
  function normalizeLevels(levels, pointCount) {
1427
- return levels.map((level2) => {
1498
+ return levels.map((level3) => {
1428
1499
  let previous = "";
1429
1500
  return Array.from({ length: pointCount }, (_, index) => {
1430
- const label = level2[index]?.trim() ?? "";
1501
+ const label = level3[index]?.trim() ?? "";
1431
1502
  if (label) previous = label;
1432
1503
  return label || previous;
1433
1504
  });
@@ -1585,12 +1656,12 @@ function computeSunburstArcs(series, cx2, cy, maxR) {
1585
1656
  });
1586
1657
  return out;
1587
1658
  }
1588
- function hierarchyKey(levels, level2, index) {
1589
- return levels.slice(level2).map((labels) => labels[index] ?? "").join("\0");
1659
+ function hierarchyKey(levels, level3, index) {
1660
+ return levels.slice(level3).map((labels) => labels[index] ?? "").join("\0");
1590
1661
  }
1591
1662
  function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR) {
1592
- const levels = categoryLevels2.filter((level2) => level2.length > 0);
1593
- const leafCount = Math.max(values.length, ...levels.map((level2) => level2.length), 0);
1663
+ const levels = categoryLevels2.filter((level3) => level3.length > 0);
1664
+ const leafCount = Math.max(values.length, ...levels.map((level3) => level3.length), 0);
1594
1665
  if (levels.length === 0 || leafCount === 0) return [];
1595
1666
  const rawWeights = Array.from({ length: leafCount }, (_, index) => Math.abs(values[index] ?? 0));
1596
1667
  const weights = rawWeights.some((value) => value !== 0) ? rawWeights : rawWeights.map(() => 1);
@@ -1601,15 +1672,15 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
1601
1672
  const rootLabels = levels[levels.length - 1] ?? [];
1602
1673
  const rootColors = /* @__PURE__ */ new Map();
1603
1674
  const out = [];
1604
- for (let level2 = levels.length - 1; level2 >= 0; level2--) {
1605
- const ringIndex = levels.length - 1 - level2;
1675
+ for (let level3 = levels.length - 1; level3 >= 0; level3--) {
1676
+ const ringIndex = levels.length - 1 - level3;
1606
1677
  const innerRadius = ringWidth * (ringIndex + 0.5);
1607
1678
  const outerRadius = ringWidth * (ringIndex + 1.5);
1608
1679
  let start = 0;
1609
1680
  while (start < leafCount) {
1610
- const key = hierarchyKey(levels, level2, start);
1681
+ const key = hierarchyKey(levels, level3, start);
1611
1682
  let end = start + 1;
1612
- while (end < leafCount && hierarchyKey(levels, level2, end) === key) end++;
1683
+ while (end < leafCount && hierarchyKey(levels, level3, end) === key) end++;
1613
1684
  const startAngle = -Math.PI / 2 + (prefix[start] ?? 0) / total * Math.PI * 2;
1614
1685
  const endAngle = -Math.PI / 2 + (prefix[end] ?? 0) / total * Math.PI * 2;
1615
1686
  const rootLabel = rootLabels[start] ?? "";
@@ -1619,8 +1690,8 @@ function computeHierarchicalSunburstArcs(categoryLevels2, values, cx2, cy, maxR)
1619
1690
  colorIndex: rootColors.get(rootLabel) ?? start,
1620
1691
  opacity: Math.max(0.1, 0.9 - ringIndex * 0.1),
1621
1692
  level: ringIndex,
1622
- label: levels[level2]?.[start] ?? "",
1623
- ...level2 === 0 && end === start + 1 ? { pointIndex: start } : {},
1693
+ label: levels[level3]?.[start] ?? "",
1694
+ ...level3 === 0 && end === start + 1 ? { pointIndex: start } : {},
1624
1695
  ...arcLabelPlacement(cx2, cy, (innerRadius + outerRadius) / 2, startAngle, endAngle)
1625
1696
  });
1626
1697
  start = end;
@@ -1719,14 +1790,14 @@ function scottBinCount(values, min, max) {
1719
1790
  const width = 3.49 * sd * values.length ** (-1 / 3);
1720
1791
  return Math.max(1, Math.ceil((max - min) / width));
1721
1792
  }
1722
- function computeHistogramBins(values, options, format = String) {
1723
- const closed = options.intervalClosed ?? "l";
1793
+ function computeHistogramBins(values, options2, format = String) {
1794
+ const closed = options2.intervalClosed ?? "l";
1724
1795
  const finite4 = values.map((value, sourceIndex) => ({ value, sourceIndex })).filter((item) => Number.isFinite(item.value));
1725
1796
  if (finite4.length === 0) {
1726
1797
  return [];
1727
1798
  }
1728
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
1729
- const overflow = typeof options.overflow === "number" ? options.overflow : void 0;
1799
+ const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
1800
+ const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
1730
1801
  const under = underflow === void 0 ? [] : finite4.filter(
1731
1802
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
1732
1803
  );
@@ -1743,8 +1814,8 @@ function computeHistogramBins(values, options, format = String) {
1743
1814
  if (regular.length > 0) {
1744
1815
  const min = Math.min(...regular.map((item) => item.value));
1745
1816
  const max = Math.max(...regular.map((item) => item.value));
1746
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
1747
- const requestedCount = options.binCount && options.binCount > 0 ? options.binCount : void 0;
1817
+ const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
1818
+ const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
1748
1819
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
1749
1820
  const count = requestedSize ? Math.max(
1750
1821
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -1795,9 +1866,9 @@ function aggregateByCategory(values, rawCategories) {
1795
1866
  }
1796
1867
 
1797
1868
  // chart/waterfall.ts
1798
- function buildWaterfallSteps(values, options) {
1869
+ function buildWaterfallSteps(values, options2) {
1799
1870
  const subtotalIndices = new Set(
1800
- options?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1871
+ options2?.subtotalIndices ?? (values.length > 0 ? [values.length - 1] : [])
1801
1872
  );
1802
1873
  const steps = [];
1803
1874
  let runningTotal = 0;
@@ -1873,13 +1944,13 @@ var noFit = () => ({
1873
1944
  rSquared: 0,
1874
1945
  coefficients: []
1875
1946
  });
1876
- function fitModel(options, xVals, yVals) {
1947
+ function fitModel(options2, xVals, yVals) {
1877
1948
  const xs = [...xVals];
1878
1949
  const ys = [...yVals];
1879
- switch (options.kind) {
1950
+ switch (options2.kind) {
1880
1951
  case "linear": {
1881
1952
  const reg = computeLinearRegression(xs, ys);
1882
- const fixed = options.intercept;
1953
+ const fixed = options2.intercept;
1883
1954
  const slope = fixed !== void 0 ? ys.reduce((s2, y, i2) => s2 + (y - fixed) * xs[i2], 0) / xs.reduce((s2, x) => s2 + x * x, 0) : reg.slope;
1884
1955
  const b = fixed ?? reg.intercept;
1885
1956
  return {
@@ -1929,7 +2000,7 @@ function fitModel(options, xVals, yVals) {
1929
2000
  };
1930
2001
  }
1931
2002
  case "polynomial": {
1932
- const order = Math.min(options.order ?? 2, 6);
2003
+ const order = Math.min(options2.order ?? 2, 6);
1933
2004
  const coeffs = fitPolynomial(xs, ys, order);
1934
2005
  const evaluate = (x) => coeffs.reduce((s2, c2, i2) => s2 + c2 * x ** i2, 0);
1935
2006
  return {
@@ -1943,11 +2014,11 @@ function fitModel(options, xVals, yVals) {
1943
2014
  return void 0;
1944
2015
  }
1945
2016
  }
1946
- function fitChartTrendline(options, xVals, yVals) {
2017
+ function fitChartTrendline(options2, xVals, yVals) {
1947
2018
  const count = yVals.length;
1948
2019
  if (count < 2) return noFit();
1949
- if (options.kind === "movingAvg") {
1950
- const period = options.period ?? 2;
2020
+ if (options2.kind === "movingAvg") {
2021
+ const period = options2.period ?? 2;
1951
2022
  const points2 = [];
1952
2023
  for (let i2 = period - 1; i2 < count; i2++) {
1953
2024
  let sum = 0;
@@ -1956,10 +2027,10 @@ function fitChartTrendline(options, xVals, yVals) {
1956
2027
  }
1957
2028
  return { points: points2, equation: `${period}-period moving average`, rSquared: 0, coefficients: [] };
1958
2029
  }
1959
- const model = fitModel(options, xVals, yVals);
2030
+ const model = fitModel(options2, xVals, yVals);
1960
2031
  if (!model) return noFit();
1961
- const startX = Math.min(...xVals) - (options.backward ?? 0);
1962
- const endX = Math.max(...xVals) + (options.forward ?? 0);
2032
+ const startX = Math.min(...xVals) - (options2.backward ?? 0);
2033
+ const endX = Math.max(...xVals) + (options2.forward ?? 0);
1963
2034
  const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
1964
2035
  const points = [];
1965
2036
  for (let step = 0; step <= steps; step++) {
@@ -1982,18 +2053,18 @@ function chartSampleVariance(values) {
1982
2053
  const mean = values.reduce((sum, value) => sum + value, 0) / count;
1983
2054
  return values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / Math.max(count - 1, 1);
1984
2055
  }
1985
- function chartErrorBarAmount(options, values, displayIndex, sourceIndex, side) {
1986
- switch (options.valueType) {
2056
+ function chartErrorBarAmount(options2, values, displayIndex, sourceIndex, side) {
2057
+ switch (options2.valueType) {
1987
2058
  case "fixedVal":
1988
- return options.value ?? 0;
2059
+ return options2.value ?? 0;
1989
2060
  case "percentage":
1990
- return Math.abs(values[displayIndex] ?? 0) * ((options.value ?? 0) / 100);
2061
+ return Math.abs(values[displayIndex] ?? 0) * ((options2.value ?? 0) / 100);
1991
2062
  case "stdDev":
1992
- return Math.sqrt(chartSampleVariance(values)) * (options.value ?? 1);
2063
+ return Math.sqrt(chartSampleVariance(values)) * (options2.value ?? 1);
1993
2064
  case "stdErr":
1994
2065
  return Math.sqrt(chartSampleVariance(values) / Math.max(values.length, 1));
1995
2066
  case "cust":
1996
- return side === "plus" ? options.customPlus?.[sourceIndex] ?? 0 : options.customMinus?.[sourceIndex] ?? 0;
2067
+ return side === "plus" ? options2.customPlus?.[sourceIndex] ?? 0 : options2.customMinus?.[sourceIndex] ?? 0;
1997
2068
  }
1998
2069
  }
1999
2070
 
@@ -2264,17 +2335,17 @@ function checkXmlLimits(xml, label, limits = {}) {
2264
2335
  throw new Error(`${label} XML exceeds the nesting depth limit of ${maxDepth2}`);
2265
2336
  }
2266
2337
  }
2267
- function parseXml(xml, options = {}) {
2268
- const label = options.label ?? "OOXML";
2338
+ function parseXml(xml, options2 = {}) {
2339
+ const label = options2.label ?? "OOXML";
2269
2340
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
2270
2341
  throw new Error(`${label} XML with DTD or entity declarations is not supported`);
2271
- checkXmlLimits(xml, label, options.limits);
2342
+ checkXmlLimits(xml, label, options2.limits);
2272
2343
  let parseError = "";
2273
2344
  let parsed;
2274
2345
  try {
2275
2346
  parsed = new xmldom.DOMParser({
2276
- onError: (level2, message) => {
2277
- if (level2 !== "warning") parseError = message;
2347
+ onError: (level3, message) => {
2348
+ if (level3 !== "warning") parseError = message;
2278
2349
  }
2279
2350
  }).parseFromString(xml, "application/xml");
2280
2351
  } catch (error) {
@@ -2653,13 +2724,13 @@ var APPLIED = /* @__PURE__ */ new Set([
2653
2724
  "lumMod",
2654
2725
  "lumOff"
2655
2726
  ]);
2656
- function resolveDrawingColor(color, theme, options) {
2727
+ function resolveDrawingColor(color, theme, options2) {
2657
2728
  const base = baseHex(color, theme);
2658
2729
  const rgb = base ? hexToRgbChannels(base) : null;
2659
2730
  if (!rgb) return void 0;
2660
- if (options?.transformOrder === "document") {
2731
+ if (options2?.transformOrder === "document") {
2661
2732
  const value = orderedColorTransforms(rgb, color.transforms);
2662
- const round3 = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
2733
+ const round3 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
2663
2734
  return {
2664
2735
  hex: `#${toHex(round3(value.r))}${toHex(round3(value.g))}${toHex(round3(value.b))}`,
2665
2736
  alpha: value.alpha,
@@ -2710,7 +2781,7 @@ function resolveDrawingColor(color, theme, options) {
2710
2781
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
2711
2782
  const lumOff = parseDrawingFraction(find("lumOff"));
2712
2783
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
2713
- const round3 = options?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
2784
+ const round3 = options2?.hslRounding === "halfDown" ? (value) => Math.ceil(value - 0.5) : Math.round;
2714
2785
  ({ r, g: g2, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round3));
2715
2786
  }
2716
2787
  let alpha = parseDrawingPercent(find("alpha")) ?? 1;
@@ -3099,6 +3170,19 @@ function readChartStyle(xml) {
3099
3170
  }
3100
3171
 
3101
3172
  // chart/formatting-nodes.ts
3173
+ function chartDataLabelNode(root) {
3174
+ const plot = first(first(root, "chart", NS.c), "plotArea", NS.c);
3175
+ const groups = plot ? elements(plot).filter((node) => node.localName.endsWith("Chart")) : [];
3176
+ const candidates = groups.flatMap((group2) => [
3177
+ ...children(group2, "ser", NS.c).map((ser) => first(ser, "dLbls", NS.c)),
3178
+ first(group2, "dLbls", NS.c)
3179
+ ]);
3180
+ return candidates.find(
3181
+ (node) => node !== void 0 && (first(node, "txPr", NS.c) !== void 0 || elements(node).some(
3182
+ (child3) => child3.localName.startsWith("show") && child3.getAttribute("val") === "1"
3183
+ ))
3184
+ );
3185
+ }
3102
3186
  function chartFormattingNodes(root) {
3103
3187
  const chart = first(root, "chart", NS.c);
3104
3188
  const plot = first(chart, "plotArea", NS.c);
@@ -3273,6 +3357,8 @@ function readChartFormatting(root) {
3273
3357
  const entries = Object.fromEntries(
3274
3358
  Object.entries(nodes).flatMap(([name, node]) => node ? [[name, entry2(node)]] : [])
3275
3359
  );
3360
+ const labels = chartDataLabelNode(root);
3361
+ if (labels) entries["dataLabel"] = entry2(labels);
3276
3362
  const builtInStyle = readBuiltInChartStyle(root);
3277
3363
  const textBody = c(root, "txPr");
3278
3364
  const textDefaults = textBody ? {
@@ -3681,7 +3767,7 @@ function resolveInnerRect(fillToRect, focalPoint) {
3681
3767
  function lerpEdge(inner, outer, t) {
3682
3768
  return inner + (outer - inner) * t;
3683
3769
  }
3684
- function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3770
+ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options2) {
3685
3771
  if (stops.length === 0) {
3686
3772
  return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
3687
3773
  }
@@ -3689,8 +3775,8 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
3689
3775
  const inner = resolveInnerRect(fillToRect, focalPoint);
3690
3776
  const rects = [];
3691
3777
  const alphaRects = [];
3692
- const masked = options?.independentOpacity && sorted.some((stop) => (stop.opacity ?? 1) < 1);
3693
- const bands = options?.bands ?? BAND_COUNT;
3778
+ const masked = options2?.independentOpacity && sorted.some((stop) => (stop.opacity ?? 1) < 1);
3779
+ const bands = options2?.bands ?? BAND_COUNT;
3694
3780
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
3695
3781
  for (let i2 = bands; i2 >= 0; i2 -= 1) {
3696
3782
  const t = i2 / bands;
@@ -3883,12 +3969,12 @@ function chartGradientMarkup(def) {
3883
3969
 
3884
3970
  // chart/bar-cluster-geometry.ts
3885
3971
  var DEFAULT_BAR_GAP_WIDTH = 150;
3886
- function assertBarClusterOptions(options) {
3972
+ function assertBarClusterOptions(options2) {
3887
3973
  for (const [field, min, max] of [
3888
3974
  ["barGapWidth", 0, 500],
3889
3975
  ["barOverlap", -100, 100]
3890
3976
  ]) {
3891
- const value = options[field];
3977
+ const value = options2[field];
3892
3978
  if (value !== void 0 && (!Number.isInteger(value) || value < min || value > max))
3893
3979
  throw new RangeError(`${field} must be an integer from ${min} to ${max}`);
3894
3980
  }
@@ -5141,7 +5227,7 @@ function dataSourceInner(source) {
5141
5227
  case "multiLvlStrRef": {
5142
5228
  const levels = source.levels ? elementXml(
5143
5229
  "multiLvlStrCache",
5144
- valXml("ptCount", source.levelPointCount) + source.levels.map((level2) => elementXml("lvl", cachePoints(level2))).join("")
5230
+ valXml("ptCount", source.levelPointCount) + source.levels.map((level3) => elementXml("lvl", cachePoints(level3))).join("")
5145
5231
  ) : "";
5146
5232
  return `<c:multiLvlStrRef>${formula}${levels}</c:multiLvlStrRef>`;
5147
5233
  }
@@ -5174,8 +5260,8 @@ function titleXml(context, title) {
5174
5260
  chartTextXml(context, tx, false) + layoutXml(context, title.layout) + valXml("overlay", title.overlay) + shapePropertiesXml(context, title.spPr) + textBodyXml(context, title.txPr) + raw(context, title.extLst)
5175
5261
  );
5176
5262
  }
5177
- function labelOptionsXml(context, options) {
5178
- return numberFormatXml(options.numberFormat) + shapePropertiesXml(context, options.spPr) + textBodyXml(context, options.txPr) + valXml("dLblPos", options.position) + valXml("showLegendKey", options.showLegendKey) + valXml("showVal", options.showValue) + valXml("showCatName", options.showCategoryName) + valXml("showSerName", options.showSeriesName) + valXml("showPercent", options.showPercent) + valXml("showBubbleSize", options.showBubbleSize) + (options.separator === void 0 ? "" : textElement("separator", options.separator));
5263
+ function labelOptionsXml(context, options2) {
5264
+ return numberFormatXml(options2.numberFormat) + shapePropertiesXml(context, options2.spPr) + textBodyXml(context, options2.txPr) + valXml("dLblPos", options2.position) + valXml("showLegendKey", options2.showLegendKey) + valXml("showVal", options2.showValue) + valXml("showCatName", options2.showCategoryName) + valXml("showSerName", options2.showSeriesName) + valXml("showPercent", options2.showPercent) + valXml("showBubbleSize", options2.showBubbleSize) + (options2.separator === void 0 ? "" : textElement("separator", options2.separator));
5179
5265
  }
5180
5266
  function labelXml(context, label) {
5181
5267
  return elementXml(
@@ -5345,7 +5431,7 @@ function styleXml(context, space3) {
5345
5431
  );
5346
5432
  }
5347
5433
  var relationship = (local, id, content2 = "") => id === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id)}"`);
5348
- function writeChartSpace(space3, options = {}) {
5434
+ function writeChartSpace(space3, options2 = {}) {
5349
5435
  const bindings = new Map(CHART_ROOT_BINDINGS);
5350
5436
  for (const { prefix, uri } of space3.namespaceDeclarations ?? [])
5351
5437
  if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
@@ -5360,10 +5446,204 @@ function writeChartSpace(space3, options = {}) {
5360
5446
  space3.externalDataRelId,
5361
5447
  valXml("autoUpdate", space3.externalDataAutoUpdate)
5362
5448
  ) + raw(context, space3.printSettings) + relationship("userShapes", space3.userShapesRelId) + raw(context, space3.extLst);
5363
- const breakAfter = options.declarationBreak ?? "\r\n";
5449
+ const breakAfter = options2.declarationBreak ?? "\r\n";
5364
5450
  return `${DECLARATION2}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
5365
5451
  }
5366
5452
 
5453
+ // chart/marker-shape.ts
5454
+ var CHART_PX_PER_PT = 4 / 3;
5455
+ var DEFAULT_MARKER_OUTLINE_PT = 0.75;
5456
+ function markerOutline(marker) {
5457
+ if (!marker.stroke) {
5458
+ return {};
5459
+ }
5460
+ return {
5461
+ stroke: marker.stroke,
5462
+ strokeWidth: (marker.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT) * CHART_PX_PER_PT
5463
+ };
5464
+ }
5465
+ var AUTOMATIC_MARKER_CYCLE = [
5466
+ "diamond",
5467
+ "square",
5468
+ "triangle",
5469
+ "x",
5470
+ "star",
5471
+ "circle",
5472
+ "plus",
5473
+ "dot",
5474
+ "dash"
5475
+ ];
5476
+ function automaticMarkerSymbol(seriesIdx) {
5477
+ const length = AUTOMATIC_MARKER_CYCLE.length;
5478
+ const normalized = (Math.trunc(seriesIdx) % length + length) % length;
5479
+ return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
5480
+ }
5481
+ function markerRadius(size, defaultRadius) {
5482
+ if (size === void 0 || !Number.isFinite(size) || size <= 0) {
5483
+ return defaultRadius;
5484
+ }
5485
+ return size / 2;
5486
+ }
5487
+ function polygonPoints(vertices) {
5488
+ return vertices.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(" ");
5489
+ }
5490
+ function starVertices(cx2, cy, r) {
5491
+ const inner = r * 0.5;
5492
+ const out = [];
5493
+ for (let i2 = 0; i2 < 10; i2++) {
5494
+ const radius = i2 % 2 === 0 ? r : inner;
5495
+ const angle = -Math.PI / 2 + Math.PI * i2 / 5;
5496
+ out.push([cx2 + radius * Math.cos(angle), cy + radius * Math.sin(angle)]);
5497
+ }
5498
+ return out;
5499
+ }
5500
+ function rectPolygon(x, y, w, h2) {
5501
+ return polygonPoints([
5502
+ [x, y],
5503
+ [x + w, y],
5504
+ [x + w, y + h2],
5505
+ [x, y + h2]
5506
+ ]);
5507
+ }
5508
+ function buildMarkerPrimitive(input) {
5509
+ const { symbol, cx: cx2, cy, fill } = input;
5510
+ const part = input.part === void 0 ? {} : { part: input.part };
5511
+ if (symbol === "none") {
5512
+ return null;
5513
+ }
5514
+ const r = markerRadius(input.size, input.defaultRadius);
5515
+ const outline = input.stroke ? {
5516
+ stroke: input.stroke,
5517
+ strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
5518
+ } : void 0;
5519
+ const polygonStroke = outline ?? { stroke: fill, strokeWidth: 0 };
5520
+ const lineStroke = input.stroke ?? fill;
5521
+ switch (symbol) {
5522
+ case "square":
5523
+ case "dash": {
5524
+ const h2 = symbol === "dash" ? r * 0.64 : r * 2;
5525
+ const y = cy - h2 / 2;
5526
+ if (outline) {
5527
+ return {
5528
+ kind: "polygon",
5529
+ points: rectPolygon(cx2 - r, y, r * 2, h2),
5530
+ fill,
5531
+ ...outline,
5532
+ ...part
5533
+ };
5534
+ }
5535
+ return { kind: "rect", x: cx2 - r, y, w: r * 2, h: h2, fill, ...part };
5536
+ }
5537
+ case "diamond":
5538
+ return {
5539
+ kind: "polygon",
5540
+ points: polygonPoints([
5541
+ [cx2, cy - r],
5542
+ [cx2 + r, cy],
5543
+ [cx2, cy + r],
5544
+ [cx2 - r, cy]
5545
+ ]),
5546
+ fill,
5547
+ ...polygonStroke,
5548
+ ...part
5549
+ };
5550
+ case "triangle":
5551
+ return {
5552
+ kind: "polygon",
5553
+ points: polygonPoints([
5554
+ [cx2, cy - r],
5555
+ [cx2 + r * 0.9, cy + r * 0.75],
5556
+ [cx2 - r * 0.9, cy + r * 0.75]
5557
+ ]),
5558
+ fill,
5559
+ ...polygonStroke,
5560
+ ...part
5561
+ };
5562
+ case "star":
5563
+ return {
5564
+ kind: "polygon",
5565
+ points: polygonPoints(starVertices(cx2, cy, r)),
5566
+ fill,
5567
+ ...polygonStroke,
5568
+ ...part
5569
+ };
5570
+ case "plus":
5571
+ return {
5572
+ kind: "path",
5573
+ d: `M${(cx2 - r).toFixed(2)},${cy.toFixed(2)} L${(cx2 + r).toFixed(2)},${cy.toFixed(2)} M${cx2.toFixed(2)},${(cy - r).toFixed(2)} L${cx2.toFixed(2)},${(cy + r).toFixed(2)}`,
5574
+ fill: "none",
5575
+ stroke: lineStroke,
5576
+ strokeWidth: Math.max(1, r * 0.4),
5577
+ ...part
5578
+ };
5579
+ case "x":
5580
+ return {
5581
+ kind: "path",
5582
+ d: `M${(cx2 - r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx2 + r).toFixed(2)},${(cy + r).toFixed(2)} M${(cx2 + r).toFixed(2)},${(cy - r).toFixed(2)} L${(cx2 - r).toFixed(2)},${(cy + r).toFixed(2)}`,
5583
+ fill: "none",
5584
+ stroke: lineStroke,
5585
+ strokeWidth: Math.max(1, r * 0.4),
5586
+ ...part
5587
+ };
5588
+ case "dot":
5589
+ return { kind: "circle", cx: cx2, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline };
5590
+ default:
5591
+ return { kind: "circle", cx: cx2, cy, r, fill, ...part, ...outline };
5592
+ }
5593
+ }
5594
+
5595
+ // chart/render/chart-view-markers.ts
5596
+ function summaryMarkers(source, group2, seriesPosition) {
5597
+ if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
5598
+ const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
5599
+ const symbol = source.marker?.symbol;
5600
+ const marker = {
5601
+ ...source.marker,
5602
+ symbol: symbol && symbol !== "auto" ? symbol : source.marker || enabled ? automaticMarkerSymbol(source.index ?? seriesPosition) : "none"
5603
+ };
5604
+ const pointMarkers = {};
5605
+ for (const point of source.dataPoints) {
5606
+ if (point.index === void 0 || !point.marker) continue;
5607
+ const override = point.marker;
5608
+ pointMarkers[point.index] = {
5609
+ ...marker,
5610
+ ...override,
5611
+ ...override.symbol === "auto" || !source.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source.index ?? seriesPosition) } : {},
5612
+ ...marker.spPr || override.spPr ? {
5613
+ spPr: {
5614
+ ...marker.spPr,
5615
+ ...override.spPr,
5616
+ ...marker.spPr?.line || override.spPr?.line ? { line: { ...marker.spPr?.line, ...override.spPr?.line } } : {}
5617
+ }
5618
+ } : {}
5619
+ };
5620
+ }
5621
+ return { marker, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
5622
+ }
5623
+ function seriesMarkerViews(source, drawingColor) {
5624
+ const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor(fill.color) : void 0;
5625
+ const resolve = (marker) => {
5626
+ const fill = fillColor(marker.spPr?.fill);
5627
+ const stroke = fillColor(marker.spPr?.line?.fill);
5628
+ const width = marker.spPr?.line?.widthEmu;
5629
+ return {
5630
+ ...marker.symbol !== void 0 ? { symbol: marker.symbol } : {},
5631
+ ...marker.size !== void 0 ? { size: marker.size } : {},
5632
+ ...fill !== void 0 ? { fill } : {},
5633
+ ...stroke !== void 0 ? { stroke } : {},
5634
+ ...width !== void 0 ? { strokeWidth: width / 9525 } : {}
5635
+ };
5636
+ };
5637
+ return {
5638
+ ...source.marker ? { marker: resolve(source.marker) } : {},
5639
+ ...source.pointMarkers ? {
5640
+ pointMarkers: Object.fromEntries(
5641
+ Object.entries(source.pointMarkers).map(([i2, marker]) => [i2, resolve(marker)])
5642
+ )
5643
+ } : {}
5644
+ };
5645
+ }
5646
+
5367
5647
  // chart/render/summary-analysis.ts
5368
5648
  function summaryTrendline(source) {
5369
5649
  const kind = chartTrendlineKind(source.trendlineType);
@@ -5404,6 +5684,41 @@ function summaryAnalysis(series) {
5404
5684
  };
5405
5685
  }
5406
5686
 
5687
+ // chart/render/summary-labels.ts
5688
+ function level(options2, custom) {
5689
+ const out = {};
5690
+ if (options2.deleted !== void 0) out.deleted = options2.deleted;
5691
+ if (options2.showValue !== void 0) out.showValue = options2.showValue;
5692
+ if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
5693
+ if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
5694
+ if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
5695
+ if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
5696
+ if (options2.separator !== void 0) out.separator = options2.separator;
5697
+ if (options2.position) out.position = options2.position;
5698
+ if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
5699
+ if (custom?.text !== void 0) out.text = custom.text;
5700
+ return out;
5701
+ }
5702
+ function shows(levels, point) {
5703
+ const flags = resolveDataLabelFlags({ ...levels, ...point ? { point } : {} });
5704
+ return point?.text !== void 0 || Object.values(flags).some((value) => value === true);
5705
+ }
5706
+ function summaryDataLabels(series, group2) {
5707
+ const own = series.dataLabels;
5708
+ if (!own && !group2) return void 0;
5709
+ const out = {};
5710
+ if (group2) out.chart = level(group2);
5711
+ if (own) out.series = level(own);
5712
+ const points = {};
5713
+ for (const labels of [group2, own])
5714
+ for (const label of labels?.labels ?? [])
5715
+ if (label.index !== void 0)
5716
+ points[label.index] = { ...points[label.index], ...level(label, label.tx) };
5717
+ if (Object.keys(points).length) out.points = points;
5718
+ if (!shows(out) && !Object.values(points).some((point) => shows(out, point))) return void 0;
5719
+ return out;
5720
+ }
5721
+
5407
5722
  // chart/render/summary-from-space.ts
5408
5723
  var solidColor = (fill) => fill?.kind === "solid" ? fill.color : void 0;
5409
5724
  var isSolidFill = (fill) => fill?.kind === "solid" || fill?.kind === "unsupported" && fill.element === "solidFill";
@@ -5421,7 +5736,7 @@ var GROUP_TYPES = {
5421
5736
  surface: "surface"
5422
5737
  };
5423
5738
  var GROUPINGS = /* @__PURE__ */ new Set(["clustered", "stacked", "percentStacked", "standard"]);
5424
- function chartSummarySeries(source, chartType) {
5739
+ function chartSummarySeries(source, chartType, groupLabels) {
5425
5740
  const categories = source.categories ?? source.xValues;
5426
5741
  const values = source.values ?? source.yValues;
5427
5742
  const numeric = (v) => typeof v === "number" ? v : v === "" ? null : Number.isFinite(Number(v)) ? Number(v) : null;
@@ -5429,6 +5744,7 @@ function chartSummarySeries(source, chartType) {
5429
5744
  categories: chartSourceValues(categories),
5430
5745
  values: chartSourceValues(values).map(numeric)
5431
5746
  };
5747
+ if (values?.cache?.formatCode !== void 0) out.numberFormat = values.cache.formatCode;
5432
5748
  if (source.bubbleSizes) {
5433
5749
  out.bubbleSizes = chartSourceValues(source.bubbleSizes).map(numeric);
5434
5750
  if (source.bubbleSizes.formula) out.bubbleSizesRef = source.bubbleSizes.formula;
@@ -5457,6 +5773,8 @@ function chartSummarySeries(source, chartType) {
5457
5773
  }
5458
5774
  if (Object.keys(points).length) out.pointColors = points;
5459
5775
  if (Object.keys(pointFills).length) out.pointFills = pointFills;
5776
+ const dataLabels = summaryDataLabels(source, groupLabels);
5777
+ if (dataLabels) out.dataLabels = dataLabels;
5460
5778
  Object.assign(out, summaryAnalysis(source));
5461
5779
  return out;
5462
5780
  }
@@ -5484,7 +5802,10 @@ function extraGroups(chartSpace, firstType) {
5484
5802
  const type = group2.kind === "bar" ? "column" : group2.kind;
5485
5803
  const entry3 = {
5486
5804
  chartType: type,
5487
- series: group2.series.map((source) => chartSummarySeries(source, type)),
5805
+ series: group2.series.map((source, index) => ({
5806
+ ...chartSummarySeries(source, type, group2.dataLabels),
5807
+ ...summaryMarkers(source, group2, index)
5808
+ })),
5488
5809
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
5489
5810
  };
5490
5811
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -5502,11 +5823,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
5502
5823
  const group2 = chartSpace.plotArea.groups[0];
5503
5824
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
5504
5825
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
5505
- const series = (group2?.series ?? []).map((source) => chartSummarySeries(source, chartType));
5826
+ const series = (group2?.series ?? []).map((source, index) => ({
5827
+ ...chartSummarySeries(source, chartType, group2?.dataLabels),
5828
+ ...group2 ? summaryMarkers(source, group2, index) : {}
5829
+ }));
5506
5830
  const summary = {
5507
5831
  chartType,
5508
5832
  series,
5509
- showLegend: chartSpace.legend !== void 0
5833
+ showLegend: chartSpace.legend !== void 0,
5834
+ axes: chartSpace.plotArea.axes,
5835
+ axisIds: group2?.axisIds ?? []
5510
5836
  };
5511
5837
  const combined = extraGroups(chartSpace, chartType);
5512
5838
  if (combined.length) summary.extraGroups = combined;
@@ -5568,9 +5894,9 @@ function dimension(data, kind, type) {
5568
5894
  const out = { points: [] };
5569
5895
  const formula = text(cx(element2, "f"));
5570
5896
  if (formula) out.formula = formula;
5571
- const level2 = cx(element2, "lvl");
5572
- const count = Number(level2?.getAttribute("ptCount") ?? 0);
5573
- for (const point of level2 ? children(level2, "pt", NS.cx) : []) {
5897
+ const level3 = cx(element2, "lvl");
5898
+ const count = Number(level3?.getAttribute("ptCount") ?? 0);
5899
+ for (const point of level3 ? children(level3, "pt", NS.cx) : []) {
5574
5900
  const index = Number(point.getAttribute("idx") ?? out.points.length);
5575
5901
  if (Number.isInteger(index) && index >= 0) out.points[index] = text(point);
5576
5902
  }
@@ -5579,10 +5905,10 @@ function dimension(data, kind, type) {
5579
5905
  }
5580
5906
  function categoryLevels(data) {
5581
5907
  const element2 = data ? children(data, "strDim", NS.cx).find((d) => (d.getAttribute("type") ?? "") === "cat") : void 0;
5582
- return (element2 ? children(element2, "lvl", NS.cx) : []).map((level2) => {
5908
+ return (element2 ? children(element2, "lvl", NS.cx) : []).map((level3) => {
5583
5909
  const points = [];
5584
- const count = Number(level2.getAttribute("ptCount") ?? 0);
5585
- for (const point of children(level2, "pt", NS.cx)) {
5910
+ const count = Number(level3.getAttribute("ptCount") ?? 0);
5911
+ for (const point of children(level3, "pt", NS.cx)) {
5586
5912
  const index = Number(point.getAttribute("idx") ?? points.length);
5587
5913
  if (Number.isInteger(index) && index >= 0) points[index] = text(point);
5588
5914
  }
@@ -5883,218 +6209,6 @@ function chartBarSpacing(chart) {
5883
6209
  };
5884
6210
  }
5885
6211
 
5886
- // chart/render/chart-svg-bars.ts
5887
- function barLayout(model, frame2) {
5888
- const count = Math.max(1, model.series.length);
5889
- const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
5890
- const barSize = geometry.singleBarWidth;
5891
- const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
5892
- return { barSize, offset };
5893
- }
5894
- function bars(model, frame2, out, values) {
5895
- const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
5896
- const { barSize, offset: barOffset } = barLayout(model, frame2);
5897
- const base = frame2.value(0);
5898
- const pos = new Array(model.categories.length).fill(0);
5899
- const neg = new Array(model.categories.length).fill(0);
5900
- model.series.forEach((s2, si) => {
5901
- values[si]?.forEach((v, i2) => {
5902
- if (v === null || i2 >= model.categories.length) return;
5903
- let from = 0;
5904
- let to = v;
5905
- if (stacked) {
5906
- const acc = v >= 0 ? pos : neg;
5907
- from = acc[i2] ?? 0;
5908
- to = from + v;
5909
- acc[i2] = to;
5910
- }
5911
- const a2 = stacked ? frame2.value(from) : base;
5912
- const b = frame2.value(to);
5913
- const offset = barOffset(si);
5914
- const center = frame2.band(i2);
5915
- const width = model.horizontal ? Math.abs(b - a2) : barSize;
5916
- const height = model.horizontal ? barSize : Math.abs(b - a2);
5917
- let color = s2.pointColors?.[i2] ?? s2.color;
5918
- const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
5919
- if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
5920
- const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
5921
- if (baseId) {
5922
- const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
5923
- const def = buildChartGradientDef(id, gradient, {
5924
- width: Number(n(width)),
5925
- height: Number(n(height)),
5926
- shape: "rect"
5927
- });
5928
- out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
5929
- color = `url(#${id})`;
5930
- }
5931
- }
5932
- out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
5933
- if (model.horizontal)
5934
- out.push(
5935
- rect(Math.min(a2, b), center + offset, Math.abs(b - a2), barSize, color, s2.shadowFilter)
5936
- );
5937
- else
5938
- out.push(
5939
- rect(center + offset, Math.min(a2, b), barSize, Math.abs(b - a2), color, s2.shadowFilter)
5940
- );
5941
- out.push("</g>");
5942
- });
5943
- });
5944
- }
5945
-
5946
- // chart/render/chart-svg-analysis.ts
5947
- var DASHES = {
5948
- dot: [1, 3],
5949
- dash: [4, 3],
5950
- lgDash: [8, 3],
5951
- dashDot: [4, 3, 1, 3],
5952
- lgDashDot: [8, 3, 1, 3],
5953
- lgDashDotDot: [8, 3, 1, 3, 1, 3],
5954
- sysDash: [3, 1],
5955
- sysDot: [1, 1],
5956
- sysDashDot: [3, 1, 1, 1],
5957
- sysDashDotDot: [3, 1, 1, 1, 1, 1]
5958
- };
5959
- var CAP = 4;
5960
- function strokeAttributes(stroke) {
5961
- const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
5962
- const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
5963
- return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
5964
- }
5965
- var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
5966
- function trendlines(series, si, xs, ys, plane, out) {
5967
- for (const trendline of series.trendlines ?? []) {
5968
- const fit2 = fitChartTrendline(trendline.fit, xs, ys);
5969
- if (fit2.points.length < 2) continue;
5970
- const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
5971
- out.push(
5972
- `<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
5973
- );
5974
- }
5975
- }
5976
- function errorBar(bars2, at2, values, plane, out) {
5977
- const stroke = strokeAttributes(bars2.stroke);
5978
- for (const side of ["plus", "minus"]) {
5979
- if (bars2.barType !== side && bars2.barType !== "both") continue;
5980
- const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
5981
- const sign = side === "plus" ? 1 : -1;
5982
- const [x1, y1] = plane(at2.x, at2.y);
5983
- const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
5984
- out.push(segment(x1, y1, x2, y2, stroke));
5985
- if (!bars2.endCap) continue;
5986
- if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
5987
- else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
5988
- }
5989
- }
5990
- function plottedPoints(series, xOf) {
5991
- return series.values.flatMap((y, index) => {
5992
- const x = xOf(index);
5993
- return y === null || x === null ? [] : [{ x, y, index }];
5994
- });
5995
- }
5996
- function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
5997
- const points = plottedPoints(series, xOf);
5998
- const xs = points.map((p) => p.x);
5999
- const ys = points.map((p) => p.y);
6000
- trendlines(series, si, xs, ys, plane, out);
6001
- for (const bars2 of series.errorBars ?? []) {
6002
- if (categoryAxis && bars2.direction === "x") continue;
6003
- const values = bars2.direction === "x" ? xs : ys;
6004
- points.forEach(
6005
- (p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
6006
- );
6007
- }
6008
- }
6009
- function categoryAnalysis(model, frame2, out) {
6010
- if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
6011
- const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
6012
- const barred = model.type === "bar" || model.type === "column";
6013
- const layout = barred ? barLayout(model, frame2) : void 0;
6014
- model.series.forEach((series, si) => {
6015
- if (!series.trendlines && !series.errorBars) return;
6016
- const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
6017
- const barPlane = (x, y) => {
6018
- const [px3, py] = plane(x, y);
6019
- return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
6020
- };
6021
- seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
6022
- });
6023
- }
6024
- function scatterAnalysis(model, px3, py, out) {
6025
- const plane = (x, y) => [px3(x), py(y)];
6026
- model.series.forEach((series, si) => {
6027
- if (!series.trendlines && !series.errorBars) return;
6028
- seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
6029
- });
6030
- }
6031
-
6032
- // chart/render/chart-scale.ts
6033
- var clean = (n2) => Number(n2.toPrecision(12));
6034
- function* units(raw2) {
6035
- let exp = Math.floor(Math.log10(raw2)) - 1;
6036
- for (; ; ) {
6037
- const base = 10 ** exp;
6038
- for (const m of [1, 2, 5]) yield clean(m * base);
6039
- exp++;
6040
- }
6041
- }
6042
- function niceScale(dataMin, dataMax, options = {}) {
6043
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
6044
- let lo = Number.isFinite(dataMin) ? dataMin : 0;
6045
- let hi = Number.isFinite(dataMax) ? dataMax : 0;
6046
- if (lo > hi) [lo, hi] = [hi, lo];
6047
- if (lo === hi) {
6048
- if (lo === 0) hi = 1;
6049
- else if (options.noZero) {
6050
- const pad2 = Math.abs(lo) * 0.1 || 1;
6051
- lo -= pad2;
6052
- hi += pad2;
6053
- } else if (lo > 0) lo = 0;
6054
- else hi = 0;
6055
- }
6056
- let fixedLo = false;
6057
- let fixedHi = false;
6058
- if (!options.noZero) {
6059
- if (lo >= 0 && hi - lo >= hi / 6) {
6060
- lo = 0;
6061
- fixedLo = true;
6062
- } else if (hi <= 0 && hi - lo >= -lo / 6) {
6063
- hi = 0;
6064
- fixedHi = true;
6065
- }
6066
- }
6067
- const range = hi - lo;
6068
- const top = fixedHi ? hi : hi + range * 0.05;
6069
- const bottom = fixedLo ? lo : lo - range * 0.05;
6070
- for (const unit of units(range / maxIntervals)) {
6071
- const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
6072
- const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
6073
- const intervals = Math.round((max - min) / unit);
6074
- if (intervals <= maxIntervals && intervals > 0) {
6075
- const ticks = [];
6076
- for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
6077
- return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
6078
- }
6079
- }
6080
- return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
6081
- }
6082
- var PERCENT_SCALE = {
6083
- min: 0,
6084
- max: 1,
6085
- majorUnit: 0.1,
6086
- ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
6087
- };
6088
- function formatAxisValue(value, percent = false) {
6089
- if (percent) return `${clean(value * 100)}%`;
6090
- const v = clean(value);
6091
- if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
6092
- return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
6093
- const [int2 = "0", frac] = String(Math.abs(v)).split(".");
6094
- const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6095
- return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
6096
- }
6097
-
6098
6212
  // drawingml/drawing-color-css.ts
6099
6213
  function drawingColorCss(value) {
6100
6214
  if (!value || value.alpha === 1) return value?.hex;
@@ -6112,36 +6226,6 @@ var TWIPS_PER_POINT = 20;
6112
6226
  var TWIPS_PER_INCH = 1440;
6113
6227
  var PIXELS_PER_INCH = 96;
6114
6228
 
6115
- // drawingml/drawing-shadow.ts
6116
- function resolveDrawingShadow(effects, theme) {
6117
- const node = first(effects, "outerShdw", NS.a);
6118
- if (!node) return void 0;
6119
- const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
6120
- if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
6121
- return void 0;
6122
- const color = parseDrawingColorIn(node);
6123
- const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
6124
- const blur = value("blurRad", 0) / EMU_PER_PIXEL;
6125
- const distance = value("dist", 0) / EMU_PER_PIXEL;
6126
- const angle = value("dir", 0) / 6e4 * Math.PI / 180;
6127
- if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
6128
- return void 0;
6129
- return {
6130
- color: resolved.hex,
6131
- opacity: resolved.alpha,
6132
- blur,
6133
- dx: Math.cos(angle) * distance,
6134
- dy: Math.sin(angle) * distance
6135
- };
6136
- }
6137
- function resolveDrawingShadowXml(xml, theme) {
6138
- return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
6139
- }
6140
- function svgDropShadowElement(s2, format) {
6141
- const num2 = format.number;
6142
- return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
6143
- }
6144
-
6145
6229
  // chart/render/theme-palette.ts
6146
6230
  var THEME_SLOTS = [
6147
6231
  "lt1",
@@ -6203,6 +6287,36 @@ function autoSeriesColor(theme, index) {
6203
6287
  return chartPaletteSeriesColor(findChartColorPalette(10), i2, i2 + 1, chartColorScheme(theme));
6204
6288
  }
6205
6289
 
6290
+ // drawingml/drawing-shadow.ts
6291
+ function resolveDrawingShadow(effects, theme) {
6292
+ const node = first(effects, "outerShdw", NS.a);
6293
+ if (!node) return void 0;
6294
+ const value = (key, fallback) => Number(node.getAttribute(key) ?? fallback);
6295
+ if (value("sx", 1e5) !== 1e5 || value("sy", 1e5) !== 1e5 || value("kx", 0) !== 0 || value("ky", 0) !== 0)
6296
+ return void 0;
6297
+ const color = parseDrawingColorIn(node);
6298
+ const resolved = color && resolveDrawingColor(color, theme, { transformOrder: "document" });
6299
+ const blur = value("blurRad", 0) / EMU_PER_PIXEL;
6300
+ const distance = value("dist", 0) / EMU_PER_PIXEL;
6301
+ const angle = value("dir", 0) / 6e4 * Math.PI / 180;
6302
+ if (!resolved || ![blur, distance, angle].every(Number.isFinite) || blur < 0 || distance < 0)
6303
+ return void 0;
6304
+ return {
6305
+ color: resolved.hex,
6306
+ opacity: resolved.alpha,
6307
+ blur,
6308
+ dx: Math.cos(angle) * distance,
6309
+ dy: Math.sin(angle) * distance
6310
+ };
6311
+ }
6312
+ function resolveDrawingShadowXml(xml, theme) {
6313
+ return xml ? resolveDrawingShadow(parseXml(xml).documentElement, theme) : void 0;
6314
+ }
6315
+ function svgDropShadowElement(s2, format) {
6316
+ const num2 = format.number;
6317
+ return `<feDropShadow dx="${num2(s2.dx)}" dy="${num2(s2.dy)}" stdDeviation="${num2(s2.blur / 2)}" flood-color="${format.color(s2.color, "#000000")}" flood-opacity="${num2(s2.opacity)}" result="shadow"/>`;
6318
+ }
6319
+
6206
6320
  // chart/text-inheritance.ts
6207
6321
  var TEXT_KEYS = [
6208
6322
  "fontSize",
@@ -6291,6 +6405,821 @@ function chartAppearance(chart, theme) {
6291
6405
  return out;
6292
6406
  }
6293
6407
 
6408
+ // text/css-font-family.ts
6409
+ var FALLBACKS = {
6410
+ calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6411
+ "calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6412
+ cambria: '"Cambria", "Caladea", Georgia, serif',
6413
+ arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
6414
+ "times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
6415
+ "courier new": '"Courier New", "Liberation Mono", monospace',
6416
+ aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
6417
+ };
6418
+ function cssFontFamily(name) {
6419
+ const known = FALLBACKS[name.toLowerCase()];
6420
+ if (known) return known;
6421
+ const quoted = `"${name.replace(/["\\]/g, "")}"`;
6422
+ return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
6423
+ }
6424
+
6425
+ // chart/render/chart-svg-appearance.ts
6426
+ var nextPaintId = 0;
6427
+ function chartGradientPaint(model, width = 1024, height = 768) {
6428
+ const prefix = `xlsx-chart-${++nextPaintId}`;
6429
+ const appearance = { ...model.appearance };
6430
+ const defs = [];
6431
+ const shadowPaint = (shadow, suffix) => {
6432
+ const id = `${prefix}-${suffix}`;
6433
+ const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
6434
+ defs.push(
6435
+ `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
6436
+ );
6437
+ return `url(#${id})`;
6438
+ };
6439
+ for (const [part, entry3] of Object.entries(appearance)) {
6440
+ if (entry3?.textShadow)
6441
+ appearance[part] = {
6442
+ ...entry3,
6443
+ textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
6444
+ };
6445
+ }
6446
+ const paint2 = (gradient, suffix, bounds2) => {
6447
+ const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
6448
+ defs.push(chartGradientMarkup(def));
6449
+ return `url(#${def.id})`;
6450
+ };
6451
+ for (const part of ["chartArea", "plotArea"]) {
6452
+ const entry3 = appearance[part];
6453
+ if (!entry3?.gradient) continue;
6454
+ if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
6455
+ appearance[part] = {
6456
+ ...entry3,
6457
+ fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
6458
+ };
6459
+ }
6460
+ const series = model.series.map((source, index) => {
6461
+ const view = { ...source };
6462
+ if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
6463
+ const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
6464
+ if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
6465
+ if (source.pointGradients) {
6466
+ view.pointColors = [...source.pointColors ?? []];
6467
+ for (const [key, gradient] of Object.entries(source.pointGradients))
6468
+ view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
6469
+ }
6470
+ return view;
6471
+ });
6472
+ return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
6473
+ }
6474
+ function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
6475
+ const entry3 = model.appearance?.[part];
6476
+ return {
6477
+ size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
6478
+ ...entry3?.color === void 0 ? {} : { fill: entry3.color },
6479
+ ...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
6480
+ ...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
6481
+ ...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
6482
+ ...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
6483
+ ...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
6484
+ };
6485
+ }
6486
+ function chartStroke(model, part) {
6487
+ const entry3 = model.appearance?.[part];
6488
+ return {
6489
+ color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part.startsWith("gridline") ? GRID_COLOR : AXIS_COLOR),
6490
+ width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
6491
+ };
6492
+ }
6493
+ function chartAreaRect(model, part, area) {
6494
+ if (area.w <= 0 || area.h <= 0) return "";
6495
+ const entry3 = model.appearance?.[part];
6496
+ let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
6497
+ let defs = "";
6498
+ if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
6499
+ const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
6500
+ width: area.w,
6501
+ height: area.h,
6502
+ shape: "rect"
6503
+ });
6504
+ defs = `<defs>${chartGradientMarkup(def)}</defs>`;
6505
+ fill = `url(#${def.id})`;
6506
+ }
6507
+ const stroke = entry3?.lineColor ?? "none";
6508
+ if (fill === "none" && stroke === "none") return "";
6509
+ const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
6510
+ return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
6511
+ }
6512
+
6513
+ // chart/render/chart-svg-labels.ts
6514
+ var GAP = 3;
6515
+ var LINE = 1.2;
6516
+ var NAMED_COLORS = /^(black|blue|cyan|green|magenta|red|white|yellow)$/iu;
6517
+ function measure(model, label) {
6518
+ const attrs = chartTextAttributes(model, "dataLabel", 10);
6519
+ const size = attrs.size ?? 10;
6520
+ const lines = label.text.split("\n");
6521
+ return {
6522
+ lines,
6523
+ size,
6524
+ w: Math.max(...lines.map((l) => textWidth(l, size))),
6525
+ h: lines.length * size * LINE,
6526
+ attrs
6527
+ };
6528
+ }
6529
+ function draw(m, label, x, y, anchor, out) {
6530
+ const fill = label.color && NAMED_COLORS.test(label.color) ? label.color.toLowerCase() : void 0;
6531
+ m.lines.forEach((line3, k) => {
6532
+ const lineY = y - m.h / 2 + (k + 0.5) * m.size * LINE + m.size * 0.35;
6533
+ out.push(text2(x, lineY, line3, { ...m.attrs, ...fill ? { fill } : {}, anchor }));
6534
+ });
6535
+ }
6536
+ function barLabels(model, marks, out) {
6537
+ const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6538
+ for (const mark of marks) {
6539
+ const label = mark.series.labels?.[mark.index];
6540
+ if (!label) continue;
6541
+ const m = measure(model, label);
6542
+ let position = label.position ?? (stacked ? "ctr" : "outEnd");
6543
+ if (stacked && position === "outEnd") position = "ctr";
6544
+ const cx2 = mark.x + mark.w / 2;
6545
+ const cy = mark.y + mark.h / 2;
6546
+ if (model.horizontal) {
6547
+ const end = mark.negative ? mark.x : mark.x + mark.w;
6548
+ const base = mark.negative ? mark.x + mark.w : mark.x;
6549
+ const dir2 = mark.negative ? -1 : 1;
6550
+ const side = (at2, outward) => [
6551
+ at2 + (outward ? dir2 : -dir2) * GAP,
6552
+ (outward ? dir2 : -dir2) > 0 ? "start" : "end"
6553
+ ];
6554
+ const [x, anchor] = position === "ctr" ? [cx2, "middle"] : position === "inEnd" ? side(end, false) : position === "inBase" ? side(base, true) : side(end, true);
6555
+ draw(m, label, x, cy, anchor, out);
6556
+ continue;
6557
+ }
6558
+ const top = mark.negative ? mark.y + mark.h : mark.y;
6559
+ const bottom = mark.negative ? mark.y : mark.y + mark.h;
6560
+ const dir = mark.negative ? 1 : -1;
6561
+ const y = position === "ctr" ? cy : position === "inEnd" ? top - dir * (GAP + m.h / 2) : position === "inBase" ? bottom + dir * (GAP + m.h / 2) : top + dir * (GAP + m.h / 2);
6562
+ draw(m, label, cx2, y, "middle", out);
6563
+ }
6564
+ }
6565
+ function pointLabels(model, marks, out) {
6566
+ for (const mark of marks) {
6567
+ const label = mark.series.labels?.[mark.index];
6568
+ if (!label) continue;
6569
+ const m = measure(model, label);
6570
+ const reach = mark.radius + GAP;
6571
+ switch (model.type === "area" ? "ctr" : label.position ?? "r") {
6572
+ case "ctr":
6573
+ draw(m, label, mark.x, mark.y, "middle", out);
6574
+ break;
6575
+ case "t":
6576
+ draw(m, label, mark.x, mark.y - reach - m.h / 2, "middle", out);
6577
+ break;
6578
+ case "b":
6579
+ draw(m, label, mark.x, mark.y + reach + m.h / 2, "middle", out);
6580
+ break;
6581
+ case "l":
6582
+ draw(m, label, mark.x - reach, mark.y, "end", out);
6583
+ break;
6584
+ default:
6585
+ draw(m, label, mark.x + reach, mark.y, "start", out);
6586
+ }
6587
+ }
6588
+ }
6589
+ function sliceLabels(model, marks, out) {
6590
+ for (const mark of marks) {
6591
+ const label = mark.series.labels?.[mark.index];
6592
+ if (!label) continue;
6593
+ const m = measure(model, label);
6594
+ const mid = (mark.start + mark.end) / 2;
6595
+ const ux = Math.sin(mid);
6596
+ const uy = -Math.cos(mid);
6597
+ const place = (radius) => [
6598
+ mark.cx + radius * ux,
6599
+ mark.cy + radius * uy
6600
+ ];
6601
+ const position = model.type === "doughnut" ? "ctr" : label.position ?? "bestFit";
6602
+ let x;
6603
+ let y;
6604
+ if (position === "ctr") [x, y] = place(mark.inner + (mark.outer - mark.inner) / 2);
6605
+ else if (position === "inEnd") {
6606
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
6607
+ [x, y] = place(Math.max(0, mark.outer - GAP - extent));
6608
+ } else if (position === "outEnd") {
6609
+ const extent = Math.abs(ux) * m.w / 2 + Math.abs(uy) * m.h / 2;
6610
+ [x, y] = place(mark.outer + GAP + extent);
6611
+ } else {
6612
+ const placed2 = placeBestFitLabel(
6613
+ {
6614
+ cx: mark.cx,
6615
+ cy: mark.cy,
6616
+ outerR: mark.outer,
6617
+ startAngle: mark.start - Math.PI / 2,
6618
+ endAngle: mark.end - Math.PI / 2
6619
+ },
6620
+ m.w,
6621
+ m.h
6622
+ );
6623
+ x = placed2.x;
6624
+ y = placed2.y;
6625
+ }
6626
+ draw(m, label, x, y, "middle", out);
6627
+ }
6628
+ }
6629
+ function hasOutsideLabels(model) {
6630
+ return model.series.some(
6631
+ (s2) => s2.labels?.some(
6632
+ (l) => l !== void 0 && ["bestFit", "outEnd"].includes(l.position ?? "bestFit")
6633
+ )
6634
+ );
6635
+ }
6636
+
6637
+ // chart/render/chart-svg-bars.ts
6638
+ function barLayout(model, frame2) {
6639
+ const count = Math.max(1, model.series.length);
6640
+ const geometry = clusteredBarGeometry(frame2.bandSize, count, chartBarSpacing(model));
6641
+ const barSize = geometry.singleBarWidth;
6642
+ const offset = (si) => model.horizontal ? geometry.clusterWidth / 2 - barSize - si * geometry.step : -geometry.clusterWidth / 2 + si * geometry.step;
6643
+ return { barSize, offset };
6644
+ }
6645
+ function bars(model, frame2, out, values) {
6646
+ const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6647
+ const { barSize, offset: barOffset } = barLayout(model, frame2);
6648
+ const base = frame2.value(0);
6649
+ const pos = new Array(model.categories.length).fill(0);
6650
+ const neg = new Array(model.categories.length).fill(0);
6651
+ const marks = [];
6652
+ model.series.forEach((s2, si) => {
6653
+ values[si]?.forEach((v, i2) => {
6654
+ if (v === null || i2 >= model.categories.length) return;
6655
+ let from = 0;
6656
+ let to = v;
6657
+ if (stacked) {
6658
+ const acc = v >= 0 ? pos : neg;
6659
+ from = acc[i2] ?? 0;
6660
+ to = from + v;
6661
+ acc[i2] = to;
6662
+ }
6663
+ const a2 = stacked ? frame2.value(from) : base;
6664
+ const b = frame2.value(to);
6665
+ const offset = barOffset(si);
6666
+ const center = frame2.band(i2);
6667
+ const width = model.horizontal ? Math.abs(b - a2) : barSize;
6668
+ const height = model.horizontal ? barSize : Math.abs(b - a2);
6669
+ let color = s2.pointColors?.[i2] ?? s2.color;
6670
+ const gradient = s2.pointGradients?.[i2] ?? (s2.pointColors?.[i2] === void 0 ? s2.gradient : void 0);
6671
+ if (gradient && (gradient.path === "circle" || gradient.path === "shape")) {
6672
+ const baseId = color.match(/^url\(#(.+)\)$/)?.[1];
6673
+ if (baseId) {
6674
+ const id = baseId.replace(/(-s\d+(?:-p\d+)?)$/, `-mark${i2}$1`);
6675
+ const def = buildChartGradientDef(id, gradient, {
6676
+ width: Number(n(width)),
6677
+ height: Number(n(height)),
6678
+ shape: "rect"
6679
+ });
6680
+ out.push(`<defs>${chartGradientMarkup(def)}</defs>`);
6681
+ color = `url(#${id})`;
6682
+ }
6683
+ }
6684
+ out.push(`<g data-chart-series="${si}" data-chart-point="${i2}">`);
6685
+ const box = model.horizontal ? { x: Math.min(a2, b), y: center + offset, w: Math.abs(b - a2), h: barSize } : { x: center + offset, y: Math.min(a2, b), w: barSize, h: Math.abs(b - a2) };
6686
+ out.push(rect(box.x, box.y, box.w, box.h, color, s2.shadowFilter));
6687
+ out.push("</g>");
6688
+ marks.push({ series: s2, index: i2, ...box, negative: v < 0 });
6689
+ });
6690
+ });
6691
+ barLabels(model, marks, out);
6692
+ }
6693
+
6694
+ // chart/render/chart-svg-analysis.ts
6695
+ var DASHES = {
6696
+ dot: [1, 3],
6697
+ dash: [4, 3],
6698
+ lgDash: [8, 3],
6699
+ dashDot: [4, 3, 1, 3],
6700
+ lgDashDot: [8, 3, 1, 3],
6701
+ lgDashDotDot: [8, 3, 1, 3, 1, 3],
6702
+ sysDash: [3, 1],
6703
+ sysDot: [1, 1],
6704
+ sysDashDot: [3, 1, 1, 1],
6705
+ sysDashDotDot: [3, 1, 1, 1, 1, 1]
6706
+ };
6707
+ var CAP = 4;
6708
+ function strokeAttributes(stroke) {
6709
+ const pattern = stroke.dash ? DASHES[stroke.dash] : void 0;
6710
+ const dash = pattern ? ` stroke-dasharray="${pattern.map((step) => n(step * stroke.width)).join(" ")}"` : "";
6711
+ return `stroke="${esc(stroke.color)}" stroke-width="${n(stroke.width)}"${dash}`;
6712
+ }
6713
+ var segment = (x1, y1, x2, y2, stroke) => `<line x1="${n(x1)}" y1="${n(y1)}" x2="${n(x2)}" y2="${n(y2)}" ${stroke}/>`;
6714
+ function trendlines(series, si, xs, ys, plane, out) {
6715
+ for (const trendline of series.trendlines ?? []) {
6716
+ const fit2 = fitChartTrendline(trendline.fit, xs, ys);
6717
+ if (fit2.points.length < 2) continue;
6718
+ const points = fit2.points.map(({ x, y }) => plane(x, y).map(n).join(",")).join(" ");
6719
+ out.push(
6720
+ `<polyline points="${points}" fill="none" ${strokeAttributes(trendline.stroke)} data-chart-part="trendline" data-chart-series="${si}"/>`
6721
+ );
6722
+ }
6723
+ }
6724
+ function errorBar(bars2, at2, values, plane, out) {
6725
+ const stroke = strokeAttributes(bars2.stroke);
6726
+ for (const side of ["plus", "minus"]) {
6727
+ if (bars2.barType !== side && bars2.barType !== "both") continue;
6728
+ const amount = chartErrorBarAmount(bars2.amount, values, at2.displayIndex, at2.sourceIndex, side);
6729
+ const sign = side === "plus" ? 1 : -1;
6730
+ const [x1, y1] = plane(at2.x, at2.y);
6731
+ const [x2, y2] = bars2.direction === "x" ? plane(at2.x + sign * amount, at2.y) : plane(at2.x, at2.y + sign * amount);
6732
+ out.push(segment(x1, y1, x2, y2, stroke));
6733
+ if (!bars2.endCap) continue;
6734
+ if (x1 === x2) out.push(segment(x2 - CAP, y2, x2 + CAP, y2, stroke));
6735
+ else out.push(segment(x2, y2 - CAP, x2, y2 + CAP, stroke));
6736
+ }
6737
+ }
6738
+ function plottedPoints(series, xOf) {
6739
+ return series.values.flatMap((y, index) => {
6740
+ const x = xOf(index);
6741
+ return y === null || x === null ? [] : [{ x, y, index }];
6742
+ });
6743
+ }
6744
+ function seriesAnalysis(series, si, xOf, plane, barPlane, categoryAxis, out) {
6745
+ const points = plottedPoints(series, xOf);
6746
+ const xs = points.map((p) => p.x);
6747
+ const ys = points.map((p) => p.y);
6748
+ trendlines(series, si, xs, ys, plane, out);
6749
+ for (const bars2 of series.errorBars ?? []) {
6750
+ if (categoryAxis && bars2.direction === "x") continue;
6751
+ const values = bars2.direction === "x" ? xs : ys;
6752
+ points.forEach(
6753
+ (p, displayIndex) => errorBar(bars2, { x: p.x, y: p.y, displayIndex, sourceIndex: p.index }, values, barPlane, out)
6754
+ );
6755
+ }
6756
+ }
6757
+ function categoryAnalysis(model, frame2, out) {
6758
+ if (model.grouping === "stacked" || model.grouping === "percentStacked") return;
6759
+ const plane = (x, y) => model.horizontal ? [frame2.value(y), frame2.band(x - 1)] : [frame2.band(x - 1), frame2.value(y)];
6760
+ const barred = model.type === "bar" || model.type === "column";
6761
+ const layout = barred ? barLayout(model, frame2) : void 0;
6762
+ model.series.forEach((series, si) => {
6763
+ if (!series.trendlines && !series.errorBars) return;
6764
+ const shift = layout ? layout.offset(si) + layout.barSize / 2 : 0;
6765
+ const barPlane = (x, y) => {
6766
+ const [px3, py] = plane(x, y);
6767
+ return model.horizontal ? [px3, py + shift] : [px3 + shift, py];
6768
+ };
6769
+ seriesAnalysis(series, si, (i2) => i2 + 1, plane, barPlane, true, out);
6770
+ });
6771
+ }
6772
+ function scatterAnalysis(model, px3, py, out) {
6773
+ const plane = (x, y) => [px3(x), py(y)];
6774
+ model.series.forEach((series, si) => {
6775
+ if (!series.trendlines && !series.errorBars) return;
6776
+ seriesAnalysis(series, si, (i2) => series.xValues?.[i2] ?? null, plane, plane, false, out);
6777
+ });
6778
+ }
6779
+
6780
+ // chart/render/chart-svg-markers.ts
6781
+ function chartMarkerRadius(series, index, defaultRadius = 3) {
6782
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
6783
+ if (marker.symbol === "none") return 0;
6784
+ const radius = markerRadius(marker.size, defaultRadius);
6785
+ return marker.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
6786
+ }
6787
+ function chartSeriesMarkerSvg(series, index, cx2, cy, defaultRadius = 3) {
6788
+ const marker = { ...series.marker, ...series.pointMarkers?.[index] };
6789
+ const primitive = buildMarkerPrimitive({
6790
+ ...marker,
6791
+ symbol: marker.symbol,
6792
+ size: marker.size,
6793
+ cx: cx2,
6794
+ cy,
6795
+ fill: marker.fill ?? series.pointColors?.[index] ?? series.color,
6796
+ defaultRadius
6797
+ });
6798
+ if (!primitive) return "";
6799
+ let geometry;
6800
+ switch (primitive.kind) {
6801
+ case "circle":
6802
+ geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
6803
+ break;
6804
+ case "rect":
6805
+ geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
6806
+ break;
6807
+ case "path":
6808
+ geometry = `d="${esc(primitive.d)}"`;
6809
+ break;
6810
+ case "polygon":
6811
+ geometry = `points="${esc(primitive.points)}"`;
6812
+ break;
6813
+ }
6814
+ const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
6815
+ const filter = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
6816
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter}/>`;
6817
+ }
6818
+
6819
+ // chart/line-dash.ts
6820
+ function chartLineDashArray(style, width) {
6821
+ if (!style || style === "solid") {
6822
+ return void 0;
6823
+ }
6824
+ const unit = Math.max(width, 1);
6825
+ if (style === "dot" || style === "sysDot") {
6826
+ return `${unit} ${unit * 2}`;
6827
+ }
6828
+ if (style === "lgDash") {
6829
+ return `${unit * 6} ${unit * 3}`;
6830
+ }
6831
+ return `${unit * 3} ${unit * 2}`;
6832
+ }
6833
+
6834
+ // chart/render/chart-scale.ts
6835
+ var clean = (n2) => Number(n2.toPrecision(12));
6836
+ function* units(raw2) {
6837
+ let exp = Math.floor(Math.log10(raw2)) - 1;
6838
+ for (; ; ) {
6839
+ const base = 10 ** exp;
6840
+ for (const m of [1, 2, 5]) yield clean(m * base);
6841
+ exp++;
6842
+ }
6843
+ }
6844
+ function niceScale(dataMin, dataMax, options2 = {}) {
6845
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
6846
+ let lo = Number.isFinite(dataMin) ? dataMin : 0;
6847
+ let hi = Number.isFinite(dataMax) ? dataMax : 0;
6848
+ if (lo > hi) [lo, hi] = [hi, lo];
6849
+ if (lo === hi) {
6850
+ if (lo === 0) hi = 1;
6851
+ else if (options2.noZero) {
6852
+ const pad2 = Math.abs(lo) * 0.1 || 1;
6853
+ lo -= pad2;
6854
+ hi += pad2;
6855
+ } else if (lo > 0) lo = 0;
6856
+ else hi = 0;
6857
+ }
6858
+ let fixedLo = false;
6859
+ let fixedHi = false;
6860
+ if (!options2.noZero) {
6861
+ if (lo >= 0 && hi - lo >= hi / 6) {
6862
+ lo = 0;
6863
+ fixedLo = true;
6864
+ } else if (hi <= 0 && hi - lo >= -lo / 6) {
6865
+ hi = 0;
6866
+ fixedHi = true;
6867
+ }
6868
+ }
6869
+ const range = hi - lo;
6870
+ const top = fixedHi ? hi : hi + range * 0.05;
6871
+ const bottom = fixedLo ? lo : lo - range * 0.05;
6872
+ for (const unit of units(range / maxIntervals)) {
6873
+ const min = fixedLo ? lo : Math.floor(clean(bottom / unit)) * unit;
6874
+ const max = fixedHi ? hi : Math.ceil(clean(top / unit)) * unit;
6875
+ const intervals = Math.round((max - min) / unit);
6876
+ if (intervals <= maxIntervals && intervals > 0) {
6877
+ const ticks = [];
6878
+ for (let i2 = 0; i2 <= intervals; i2++) ticks.push(clean(min + i2 * unit));
6879
+ return { min: clean(min), max: clean(max), majorUnit: unit, ticks };
6880
+ }
6881
+ }
6882
+ return { min: lo, max: hi, majorUnit: range, ticks: [lo, hi] };
6883
+ }
6884
+ var PERCENT_SCALE = {
6885
+ min: 0,
6886
+ max: 1,
6887
+ majorUnit: 0.1,
6888
+ ticks: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
6889
+ };
6890
+ function formatAxisValue(value, percent = false) {
6891
+ if (percent) return `${clean(value * 100)}%`;
6892
+ const v = clean(value);
6893
+ if (Math.abs(v) >= 1e15 || v !== 0 && Math.abs(v) < 1e-6)
6894
+ return v.toExponential(2).replace("e+", "E+").replace("e-", "E-");
6895
+ const [int2 = "0", frac] = String(Math.abs(v)).split(".");
6896
+ const grouped2 = int2.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6897
+ return `${v < 0 ? "-" : ""}${grouped2}${frac ? `.${frac}` : ""}`;
6898
+ }
6899
+
6900
+ // chart/render/chart-svg-axes.ts
6901
+ function axisTickText(value, axis, percent = false) {
6902
+ return formatChartNumber(value, axis?.source.numberFormat?.formatCode) ?? formatAxisValue(value, percent);
6903
+ }
6904
+ function axisLine(model, axis, part, x1, y1, x2, y2) {
6905
+ if (axis?.source.deleted) return "";
6906
+ return styledAxisLine(x1, y1, x2, y2, axis?.line, chartStroke(model, part));
6907
+ }
6908
+ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
6909
+ const color = paint2?.color ?? fallback.color;
6910
+ const width = paint2?.width ?? fallback.width;
6911
+ if (color === "none" || width === 0) return "";
6912
+ const dash = chartLineDashArray(paint2?.dash, width);
6913
+ return line(x1, y1, x2, y2, esc(color), width).replace(
6914
+ "/>",
6915
+ dash ? ` stroke-dasharray="${dash}"/>` : "/>"
6916
+ );
6917
+ }
6918
+ function axisGridlines(model, axis, ticks, position, plot, vertical) {
6919
+ const draw2 = (values, paint2, minor2) => {
6920
+ const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
6921
+ return values.map((value) => {
6922
+ const p = position(value);
6923
+ return vertical ? styledAxisLine(p, plot.y, p, plot.y + plot.h, paint2, fallback) : styledAxisLine(plot.x, p, plot.x + plot.w, p, paint2, fallback);
6924
+ }).join("");
6925
+ };
6926
+ const major = !axis || axis.source.majorGridlines ? draw2(ticks, axis?.majorGrid, false) : "";
6927
+ const minor = axis?.source.minorGridlines ? draw2(axis.minorTicks, axis.minorGrid, true) : "";
6928
+ return major + minor;
6929
+ }
6930
+
6931
+ // chart/axis-range-auto.ts
6932
+ function computeAxisValueRange(series, plotHeightPx) {
6933
+ let dataMin = Number.POSITIVE_INFINITY, dataMax = Number.NEGATIVE_INFINITY;
6934
+ for (const item of series) {
6935
+ for (const value of item.values) {
6936
+ if (value !== null && Number.isFinite(value) && value < dataMin) {
6937
+ dataMin = value;
6938
+ }
6939
+ if (value !== null && Number.isFinite(value) && value > dataMax) {
6940
+ dataMax = value;
6941
+ }
6942
+ }
6943
+ }
6944
+ if (dataMin === Number.POSITIVE_INFINITY) {
6945
+ return { min: 0, max: 1, span: 1 };
6946
+ }
6947
+ const { min, max, majorUnit } = niceValueAxisBounds(
6948
+ dataMin,
6949
+ dataMax,
6950
+ plotHeightPx !== void 0 ? axisTargetIntervals(plotHeightPx) : void 0
6951
+ );
6952
+ return { min, max, span: Math.max(max - min, Number.EPSILON), majorUnit };
6953
+ }
6954
+ function computeAxisStackedValueRange(series, catCount, plotHeightPx) {
6955
+ let maxSum = 0, minSum = 0;
6956
+ for (let ci = 0; ci < catCount; ci++) {
6957
+ let pos = 0, neg = 0;
6958
+ for (const s2 of series) {
6959
+ const v = s2.values[ci] ?? 0;
6960
+ if (v >= 0) {
6961
+ pos += v;
6962
+ } else {
6963
+ neg += v;
6964
+ }
6965
+ }
6966
+ maxSum = Math.max(maxSum, pos);
6967
+ minSum = Math.min(minSum, neg);
6968
+ }
6969
+ const { min, max, majorUnit } = niceValueAxisBounds(
6970
+ Math.min(minSum, 0),
6971
+ Math.max(maxSum, 0),
6972
+ plotHeightPx !== void 0 ? axisTargetIntervals(plotHeightPx) : void 0
6973
+ );
6974
+ return { min, max, span: Math.max(max - min, Number.EPSILON), majorUnit };
6975
+ }
6976
+
6977
+ // chart/axis-range.ts
6978
+ function computeLogValueRange(series, logBase) {
6979
+ const allValues = series.flatMap((item) => item.values).filter((value) => value !== null && Number.isFinite(value) && value > 0);
6980
+ if (allValues.length === 0) {
6981
+ return { min: 1, max: logBase, span: 1, logScale: true, logBase };
6982
+ }
6983
+ const dataMin = Math.min(...allValues);
6984
+ const dataMax = Math.max(...allValues);
6985
+ const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
6986
+ const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
6987
+ const min = logBase ** logMin;
6988
+ const max = logBase ** Math.max(logMax, logMin + 1);
6989
+ return {
6990
+ min,
6991
+ max,
6992
+ span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
6993
+ logScale: true,
6994
+ logBase
6995
+ };
6996
+ }
6997
+ function computeValueRangeForAxis(series, axis, plotHeightPx) {
6998
+ const requestedLogBase = axis?.logBase ?? 10;
6999
+ const logBase = axis?.logScale && Number.isFinite(requestedLogBase) && requestedLogBase > 1 ? requestedLogBase : axis?.logScale ? 10 : void 0;
7000
+ const automatic = logBase ? computeLogValueRange(series, logBase) : computeAxisValueRange(series, plotHeightPx);
7001
+ return withAxisBounds(automatic, axis, logBase);
7002
+ }
7003
+ function computeStackedValueRangeForAxis(series, catCount, axis, isPercent, plotSizePx) {
7004
+ if (isPercent) {
7005
+ return {
7006
+ ...percentStackedRange(series, catCount, plotSizePx),
7007
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
7008
+ };
7009
+ }
7010
+ return withAxisBounds(computeAxisStackedValueRange(series, catCount, plotSizePx), axis);
7011
+ }
7012
+ function percentStackedRange(series, catCount, plotSizePx) {
7013
+ const shares = series.map((entry3) => ({
7014
+ ...entry3,
7015
+ values: Array.from({ length: catCount }, (_, ci) => {
7016
+ const total = series.reduce((sum, s2) => sum + Math.abs(s2.values[ci] ?? 0), 0);
7017
+ return total > 0 ? (entry3.values[ci] ?? 0) / total * 100 : 0;
7018
+ })
7019
+ }));
7020
+ const automatic = computeAxisStackedValueRange(shares, catCount, plotSizePx);
7021
+ if (automatic.min >= 0) {
7022
+ return { min: 0, max: 100, span: 100 };
7023
+ }
7024
+ const min = Math.max(automatic.min, -100);
7025
+ const unit = automatic.majorUnit;
7026
+ return {
7027
+ min,
7028
+ max: 100,
7029
+ span: 100 - min,
7030
+ ...unit !== void 0 && 100 % unit === 0 && min % unit === 0 ? { majorUnit: unit } : {}
7031
+ };
7032
+ }
7033
+ function withAxisBounds(automatic, axis, logBase) {
7034
+ const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
7035
+ const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
7036
+ const min = validMin ?? automatic.min;
7037
+ let max = validMax ?? automatic.max;
7038
+ const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
7039
+ if (max <= min) {
7040
+ max = logBase ? min * logBase : min + 1;
7041
+ }
7042
+ const span = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
7043
+ return {
7044
+ min,
7045
+ max,
7046
+ span: Math.max(span, Number.EPSILON),
7047
+ ...majorUnit !== void 0 ? { majorUnit } : {},
7048
+ ...logBase ? { logScale: true, logBase } : {},
7049
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
7050
+ };
7051
+ }
7052
+ function valueToYLog(val2, range, topY, bottomY) {
7053
+ const base = range.logBase ?? 10;
7054
+ const logValue = Math.log(Math.max(val2, range.min)) / Math.log(base);
7055
+ const logMin = Math.log(range.min) / Math.log(base);
7056
+ const ratio = (logValue - logMin) / range.span;
7057
+ return range.reverseOrder ? topY + ratio * (bottomY - topY) : bottomY - ratio * (bottomY - topY);
7058
+ }
7059
+ function findLogAxis(axes) {
7060
+ return axes?.find((axis) => axis.axisType === "valAx" && axis.logScale);
7061
+ }
7062
+ function computeValueRangeForChart(series, axes, plotHeightPx) {
7063
+ const primaryAxis = axes?.find((axis) => axis.axisType === "valAx" && axis.axPos === "l") ?? axes?.find((axis) => axis.axisType === "valAx" && axis.axPos !== "r");
7064
+ return computeValueRangeForAxis(series, primaryAxis, plotHeightPx);
7065
+ }
7066
+
7067
+ // chart/axis-ticks.ts
7068
+ var LOG_EXPONENT_TOLERANCE = 1e-12;
7069
+ function generateLogTicks(range) {
7070
+ if (!range.logScale || !range.logBase) {
7071
+ return [];
7072
+ }
7073
+ const base = range.logBase;
7074
+ const logMin = Math.log(range.min) / Math.log(base);
7075
+ const logMax = Math.log(range.max) / Math.log(base);
7076
+ const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
7077
+ const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
7078
+ if (lastExponent < firstExponent) {
7079
+ return range.min === range.max ? [range.min] : [range.min, range.max];
7080
+ }
7081
+ return Array.from(
7082
+ { length: lastExponent - firstExponent + 1 },
7083
+ (_unused, index) => base ** (firstExponent + index)
7084
+ );
7085
+ }
7086
+ function generateIntervalTicks(range, unit) {
7087
+ if (!Number.isFinite(unit) || unit <= 0 || range.logScale) {
7088
+ return [];
7089
+ }
7090
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-12;
7091
+ const first2 = Math.ceil((range.min - tolerance) / unit);
7092
+ const last = Math.floor((range.max + tolerance) / unit);
7093
+ const count = Math.min(Math.max(last - first2 + 1, 0), 2e3);
7094
+ return Array.from({ length: count }, (_, index) => (first2 + index) * unit);
7095
+ }
7096
+ function generateAxisTicks(range, axis, defaultIntervals) {
7097
+ if (range.logScale && range.logBase) {
7098
+ return generateLogTicks(range);
7099
+ }
7100
+ const explicit = generateIntervalTicks(range, axis?.majorUnit ?? 0);
7101
+ if (explicit.length > 0) {
7102
+ return explicit;
7103
+ }
7104
+ const automatic = generateIntervalTicks(range, range.majorUnit ?? 0);
7105
+ if (automatic.length > 0) {
7106
+ return automatic;
7107
+ }
7108
+ return Array.from(
7109
+ { length: defaultIntervals + 1 },
7110
+ (_, index) => range.min + range.span / defaultIntervals * index
7111
+ );
7112
+ }
7113
+ function generateMinorAxisTicks(range, axis) {
7114
+ const minor = generateIntervalTicks(range, axis?.minorUnit ?? 0);
7115
+ if (minor.length === 0) {
7116
+ return [];
7117
+ }
7118
+ const majorUnit = axis?.majorUnit;
7119
+ if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
7120
+ return minor;
7121
+ }
7122
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-10;
7123
+ return minor.filter(
7124
+ (value) => Math.abs(value / majorUnit - Math.round(value / majorUnit)) > tolerance
7125
+ );
7126
+ }
7127
+
7128
+ // chart/render/chart-view-axes.ts
7129
+ function chartAxisRatio(value, scale, axis) {
7130
+ const range = axis?.range;
7131
+ const ratio = range?.logScale ? Math.log(Math.max(value, range.min) / range.min) / Math.log(range.max / range.min) : (value - scale.min) / (scale.max - scale.min || 1);
7132
+ return range?.reverseOrder ? 1 - ratio : ratio;
7133
+ }
7134
+ function chartAxisLabels(axis) {
7135
+ return axis?.source.deleted !== true && axis?.source.tickLabelPosition !== "none";
7136
+ }
7137
+ function options(axis) {
7138
+ return {
7139
+ ...axis.scaling,
7140
+ ...axis.scaling.logBase === void 0 ? {} : { logScale: true },
7141
+ ...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
7142
+ ...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
7143
+ };
7144
+ }
7145
+ function applyChartAxes(model, chart, color) {
7146
+ if (!chart.axes?.length) return;
7147
+ const axes = chart.axes;
7148
+ const linked = axes.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
7149
+ const candidates = linked.length ? linked : axes;
7150
+ const xy = model.type === "scatter" || model.type === "bubble";
7151
+ const value = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
7152
+ const category = candidates.find(
7153
+ (axis) => xy ? axis.kind === "val" && axis !== value : axis.kind === "cat" || axis.kind === "date"
7154
+ );
7155
+ const secondary = axes.find((axis) => axis.kind === "val" && axis !== value && axis !== category);
7156
+ const paint2 = (shape) => {
7157
+ const ln = shape?.line;
7158
+ const fill = ln?.fill;
7159
+ const resolved = fill?.kind === "none" ? "none" : color(fill?.kind === "solid" ? fill.color : void 0);
7160
+ return {
7161
+ ...resolved === void 0 ? {} : { color: resolved },
7162
+ ...ln?.widthEmu === void 0 ? {} : { width: ln.widthEmu / EMU_PER_PIXEL },
7163
+ ...ln?.dash === void 0 ? {} : { dash: ln.dash }
7164
+ };
7165
+ };
7166
+ const bind = (axis, scale, values) => {
7167
+ const opts = options(axis);
7168
+ const automatic = opts.logScale ? computeLogValueRange(
7169
+ [{ values: values ?? [] }],
7170
+ opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
7171
+ ) : {
7172
+ min: scale?.min ?? 0,
7173
+ max: scale?.max ?? 1,
7174
+ span: (scale?.max ?? 1) - (scale?.min ?? 0),
7175
+ ...scale ? { majorUnit: scale.majorUnit } : {}
7176
+ };
7177
+ const logBase = automatic.logBase;
7178
+ const range = withAxisBounds(automatic, opts, logBase);
7179
+ if (scale) {
7180
+ scale.min = range.min;
7181
+ scale.max = range.max;
7182
+ scale.ticks = generateAxisTicks(range, opts, 5);
7183
+ }
7184
+ return {
7185
+ source: axis,
7186
+ range,
7187
+ minorTicks: generateMinorAxisTicks(range, opts),
7188
+ line: paint2(axis.spPr),
7189
+ majorGrid: paint2(axis.majorGridlinesSpPr),
7190
+ minorGrid: paint2(axis.minorGridlinesSpPr)
7191
+ };
7192
+ };
7193
+ const out = {};
7194
+ if (value)
7195
+ out.value = bind(
7196
+ value,
7197
+ model.valueAxis,
7198
+ [
7199
+ ...model.series,
7200
+ ...model.extraGroups?.filter((g2) => !g2.secondary).flatMap((g2) => g2.series) ?? []
7201
+ ].flatMap((s2) => s2.values)
7202
+ );
7203
+ if (category)
7204
+ out.category = bind(
7205
+ category,
7206
+ model.xAxis ?? {
7207
+ min: 0,
7208
+ max: Math.max(1, model.categories.length - 1),
7209
+ majorUnit: 1,
7210
+ ticks: []
7211
+ },
7212
+ model.series.flatMap((s2) => s2.xValues ?? [])
7213
+ );
7214
+ if (secondary)
7215
+ out.secondary = bind(
7216
+ secondary,
7217
+ model.secondaryAxis,
7218
+ model.extraGroups?.filter((g2) => g2.secondary).flatMap((g2) => g2.series.flatMap((s2) => s2.values))
7219
+ );
7220
+ model.axes = out;
7221
+ }
7222
+
6294
7223
  // chart/render/chart-view-analysis.ts
6295
7224
  function strokeOf(line3, fallback, resolve) {
6296
7225
  if (line3?.fill?.kind === "none") return void 0;
@@ -6340,15 +7269,15 @@ function seriesName(series, index, evaluateRef) {
6340
7269
  const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText).filter((t) => t !== "").join(" ");
6341
7270
  return fromRef || series.name || `Series${index + 1}`;
6342
7271
  }
6343
- function seriesContext(chart, theme, options) {
7272
+ function seriesContext(chart, theme, options2) {
6344
7273
  const scheme = chartColorScheme(theme);
6345
7274
  const resolver = { scheme: (name) => scheme[name] };
6346
7275
  return {
6347
7276
  theme,
6348
7277
  scheme,
6349
7278
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
6350
- evaluateRef: options.evaluateRef ?? (() => []),
6351
- seriesColor: options.seriesColor,
7279
+ evaluateRef: options2.evaluateRef ?? (() => []),
7280
+ seriesColor: options2.seriesColor,
6352
7281
  drawingColor: (color) => color && drawingColorCss(resolveDrawingColor(color, resolver, { transformOrder: "document" })),
6353
7282
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
6354
7283
  fill,
@@ -6374,7 +7303,11 @@ function seriesView(ctx, s2, index, total, categoriesOf) {
6374
7303
  })
6375
7304
  );
6376
7305
  if (Object.keys(points).length) view.pointGradients = points;
6377
- Object.assign(view, analysisView(s2, color, ctx.drawingColor));
7306
+ Object.assign(
7307
+ view,
7308
+ analysisView(s2, color, ctx.drawingColor),
7309
+ seriesMarkerViews(s2, ctx.drawingColor)
7310
+ );
6378
7311
  return view;
6379
7312
  }
6380
7313
 
@@ -6547,6 +7480,64 @@ function chartTitleText(chart, theme) {
6547
7480
  };
6548
7481
  }
6549
7482
 
7483
+ // chart/render/chart-view-labels.ts
7484
+ function labelsOf(source, view, categories, numberFormat2) {
7485
+ const { chart, series, points } = source;
7486
+ if ((series?.deleted ?? chart?.deleted) === true) return void 0;
7487
+ const percentBase = view.values.reduce(
7488
+ (sum, v) => sum + (v === null ? 0 : Math.abs(v)),
7489
+ 0
7490
+ );
7491
+ const out = [];
7492
+ let any = false;
7493
+ view.values.forEach((value, i2) => {
7494
+ const point = points?.[i2];
7495
+ if (value === null || point?.deleted === true) return;
7496
+ const position = point?.position ?? series?.position ?? chart?.position;
7497
+ const x = view.xValues?.[i2];
7498
+ const category = x === void 0 || x === null ? categories[i2] : formatAxisValue(x);
7499
+ let built;
7500
+ if (point?.text !== void 0) built = { text: point.text };
7501
+ else {
7502
+ const flags = resolveDataLabelFlags({
7503
+ ...point ? { point } : {},
7504
+ ...series ? { series } : {},
7505
+ ...chart ? { chart } : {}
7506
+ });
7507
+ built = composeDataLabelText({
7508
+ flags,
7509
+ seriesName: view.name,
7510
+ category,
7511
+ value,
7512
+ numberFormat: point?.numberFormat ?? series?.numberFormat ?? chart?.numberFormat ?? numberFormat2,
7513
+ percentBase,
7514
+ bubbleSize: view.sizes?.[i2] ?? void 0,
7515
+ formatValue: (v) => formatAxisValue(v),
7516
+ formatBubbleSize: (size) => formatAxisValue(size)
7517
+ });
7518
+ }
7519
+ if (!built) return;
7520
+ any = true;
7521
+ out[i2] = {
7522
+ text: built.text,
7523
+ ...position ? { position } : {},
7524
+ ...built.color ? { color: built.color } : {}
7525
+ };
7526
+ });
7527
+ return any ? out : void 0;
7528
+ }
7529
+ function applyDataLabels(model, sources, extra) {
7530
+ const apply = (source, view) => {
7531
+ if (!source?.dataLabels) return;
7532
+ const labels = labelsOf(source.dataLabels, view, model.categories, source.numberFormat);
7533
+ if (labels) view.labels = labels;
7534
+ };
7535
+ model.series.forEach((view, i2) => apply(sources[i2], view));
7536
+ model.extraGroups?.forEach(
7537
+ (group2, g2) => group2.series.forEach((view, i2) => apply(extra[g2]?.series[i2], view))
7538
+ );
7539
+ }
7540
+
6550
7541
  // chart/render/chart-view-ex.ts
6551
7542
  function groupsAxis(groups, categories) {
6552
7543
  let min = Infinity;
@@ -6616,11 +7607,11 @@ function histogramView(chart, model) {
6616
7607
  const first2 = model.series[0];
6617
7608
  if (!first2) return;
6618
7609
  const raw2 = first2.values.map((v) => v ?? Number.NaN);
6619
- const options = chart.histogram ?? {};
6620
- const bins = options.aggregateByCategory ? aggregateByCategory(
7610
+ const options2 = chart.histogram ?? {};
7611
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
6621
7612
  first2.values.map((v) => v ?? 0),
6622
7613
  model.categories
6623
- ) : computeHistogramBins(raw2, options, formatAxisValue);
7614
+ ) : computeHistogramBins(raw2, options2, formatAxisValue);
6624
7615
  model.categories = bins.map((bin) => bin.label);
6625
7616
  first2.values = bins.map((bin) => bin.value);
6626
7617
  model.barGapWidth = 0;
@@ -6644,11 +7635,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
6644
7635
  "treemap",
6645
7636
  "sunburst"
6646
7637
  ]);
6647
- function chartSummaryView(chart, theme, options = {}) {
7638
+ function chartSummaryView(chart, theme, options2 = {}) {
6648
7639
  const type = chart.chartType;
6649
7640
  const radial = type === "pie" || type === "doughnut";
6650
7641
  const byPoint = radial || type === "treemap" || type === "sunburst";
6651
- const ctx = seriesContext(chart, theme, options);
7642
+ const ctx = seriesContext(chart, theme, options2);
6652
7643
  const { palette, scheme, drawingColor } = ctx;
6653
7644
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
6654
7645
  const rawCategories = [];
@@ -6732,128 +7723,23 @@ function chartSummaryView(chart, theme, options = {}) {
6732
7723
  chartExtraView(chart, model, ctx, total, collect);
6733
7724
  if (type === "waterfall") waterfallView(chart, model, ctx);
6734
7725
  else if (!byPoint) model.valueAxis = valueAxis(model);
7726
+ applyDataLabels(model, chart.series, extra);
6735
7727
  chartExtraAxes(model);
7728
+ applyChartAxes(model, chart, ctx.drawingColor);
6736
7729
  return model;
6737
7730
  }
6738
7731
 
6739
- // text/css-font-family.ts
6740
- var FALLBACKS = {
6741
- calibri: '"Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6742
- "calibri light": '"Calibri Light", "Calibri", "Carlito", "Segoe UI", Arial, sans-serif',
6743
- cambria: '"Cambria", "Caladea", Georgia, serif',
6744
- arial: 'Arial, "Liberation Sans", Helvetica, sans-serif',
6745
- "times new roman": '"Times New Roman", "Liberation Serif", Times, serif',
6746
- "courier new": '"Courier New", "Liberation Mono", monospace',
6747
- aptos: '"Aptos", "Calibri", "Carlito", "Segoe UI", sans-serif'
6748
- };
6749
- function cssFontFamily(name) {
6750
- const known = FALLBACKS[name.toLowerCase()];
6751
- if (known) return known;
6752
- const quoted = `"${name.replace(/["\\]/g, "")}"`;
6753
- return `${quoted}, "Calibri", "Carlito", "Segoe UI", sans-serif`;
6754
- }
6755
-
6756
- // chart/render/chart-svg-appearance.ts
6757
- var nextPaintId = 0;
6758
- function chartGradientPaint(model, width = 1024, height = 768) {
6759
- const prefix = `xlsx-chart-${++nextPaintId}`;
6760
- const appearance = { ...model.appearance };
6761
- const defs = [];
6762
- const shadowPaint = (shadow, suffix) => {
6763
- const id = `${prefix}-${suffix}`;
6764
- const pad2 = Math.max(4, shadow.blur * 3 + Math.abs(shadow.dx) + Math.abs(shadow.dy));
6765
- defs.push(
6766
- `<filter id="${id}" filterUnits="userSpaceOnUse" x="${n(-pad2)}" y="${n(-pad2)}" width="${n(width + pad2 * 2)}" height="${n(height + pad2 * 2)}" color-interpolation-filters="sRGB">${svgDropShadowElement(shadow, { number: n, color: (value) => esc(value) })}</filter>`
6767
- );
6768
- return `url(#${id})`;
6769
- };
6770
- for (const [part, entry3] of Object.entries(appearance)) {
6771
- if (entry3?.textShadow)
6772
- appearance[part] = {
6773
- ...entry3,
6774
- textShadowFilter: shadowPaint(entry3.textShadow, `${part}-text-shadow`)
6775
- };
6776
- }
6777
- const paint2 = (gradient, suffix, bounds2) => {
6778
- const def = buildChartGradientDef(`${prefix}-${suffix}`, gradient, bounds2);
6779
- defs.push(chartGradientMarkup(def));
6780
- return `url(#${def.id})`;
6781
- };
6782
- for (const part of ["chartArea", "plotArea"]) {
6783
- const entry3 = appearance[part];
6784
- if (!entry3?.gradient) continue;
6785
- if (part === "plotArea" && ["circle", "shape"].includes(entry3.gradient.path ?? "")) continue;
6786
- appearance[part] = {
6787
- ...entry3,
6788
- fillColor: paint2(entry3.gradient, part, { width, height, shape: "rect" })
6789
- };
6790
- }
6791
- const series = model.series.map((source, index) => {
6792
- const view = { ...source };
6793
- if (source.shadow) view.shadowFilter = shadowPaint(source.shadow, `s${index}-shadow`);
6794
- const bounds2 = model.type === "bar" || model.type === "column" ? { width: 1, height: 1, shape: "rect" } : void 0;
6795
- if (source.gradient) view.color = paint2(source.gradient, `s${index}`, bounds2);
6796
- if (source.pointGradients) {
6797
- view.pointColors = [...source.pointColors ?? []];
6798
- for (const [key, gradient] of Object.entries(source.pointGradients))
6799
- view.pointColors[Number(key)] = paint2(gradient, `s${index}-p${key}`, bounds2);
6800
- }
6801
- return view;
6802
- });
6803
- return defs.length ? { model: { ...model, appearance, series }, defs: `<defs>${defs.join("")}</defs>` } : { model, defs: "" };
6804
- }
6805
- function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
6806
- const entry3 = model.appearance?.[part];
6807
- return {
6808
- size: entry3?.fontSize === void 0 ? fallbackSize : chartPointsToPixels(entry3.fontSize),
6809
- ...entry3?.color === void 0 ? {} : { fill: entry3.color },
6810
- ...entry3?.bold === void 0 ? {} : { weight: entry3.bold ? "bold" : "normal" },
6811
- ...entry3?.italic === void 0 ? {} : { italic: entry3.italic },
6812
- ...entry3?.underline === void 0 ? {} : { underline: entry3.underline },
6813
- ...entry3?.typeface === void 0 ? {} : { family: cssFontFamily(entry3.typeface) },
6814
- ...entry3?.textShadowFilter === void 0 ? {} : { filter: entry3.textShadowFilter }
6815
- };
6816
- }
6817
- function chartStroke(model, part) {
6818
- const entry3 = model.appearance?.[part];
6819
- return {
6820
- color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
6821
- width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
6822
- };
6823
- }
6824
- function chartAreaRect(model, part, area) {
6825
- if (area.w <= 0 || area.h <= 0) return "";
6826
- const entry3 = model.appearance?.[part];
6827
- let fill = entry3?.fillColor ?? (part === "chartArea" ? "#FFFFFF" : "none");
6828
- let defs = "";
6829
- if (part !== "chartArea" && entry3?.gradient && (part !== "plotArea" || ["circle", "shape"].includes(entry3.gradient.path ?? ""))) {
6830
- const def = buildChartGradientDef(`xlsx-chart-${++nextPaintId}-${part}`, entry3.gradient, {
6831
- width: area.w,
6832
- height: area.h,
6833
- shape: "rect"
6834
- });
6835
- defs = `<defs>${chartGradientMarkup(def)}</defs>`;
6836
- fill = `url(#${def.id})`;
6837
- }
6838
- const stroke = entry3?.lineColor ?? "none";
6839
- if (fill === "none" && stroke === "none") return "";
6840
- const width = entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth);
6841
- return `${defs}<rect x="${n(area.x)}" y="${n(area.y)}" width="${n(area.w)}" height="${n(area.h)}" fill="${esc(fill)}" stroke="${esc(stroke)}" stroke-width="${n(width)}" data-chart-part="${part}"/>`;
6842
- }
6843
-
6844
7732
  // chart/render/chart-svg-cartesian.ts
6845
7733
  function cartesianAxes(model, area, out) {
6846
7734
  const scale = model.valueAxis;
6847
7735
  if (!scale) return void 0;
6848
- const labels = scale.ticks.map((t) => formatAxisValue(t, scale.percent));
7736
+ const labels = scale.ticks.map((t) => axisTickText(t, model.axes?.value, scale.percent));
6849
7737
  const valueAttrs = chartTextAttributes(model, "valueAxis");
6850
7738
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
6851
7739
  const valueSize = valueAttrs.size ?? 10;
6852
7740
  const categorySize = categoryAttrs.size ?? 10;
6853
- const grid = chartStroke(model, "gridlineMajor");
6854
- const axis = chartStroke(model, "categoryAxis");
6855
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
6856
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
7741
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
7742
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
6857
7743
  const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
6858
7744
  const horizontal = model.horizontal;
6859
7745
  const cats = Math.max(1, model.categories.length);
@@ -6862,7 +7748,7 @@ function cartesianAxes(model, area, out) {
6862
7748
  Math.max(...model.categories.map((c2) => textWidth(c2, categorySize)), 8) + 6
6863
7749
  );
6864
7750
  const second = horizontal ? void 0 : model.secondaryAxis;
6865
- const secondLabels = second?.ticks.map((t) => formatAxisValue(t, second.percent)) ?? [];
7751
+ const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
6866
7752
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
6867
7753
  const plot = horizontal ? {
6868
7754
  x: area.x + catW,
@@ -6875,29 +7761,47 @@ function cartesianAxes(model, area, out) {
6875
7761
  w: Math.max(1, area.w - labelW - 4 - secondW),
6876
7762
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
6877
7763
  };
6878
- const span = scale.max - scale.min || 1;
6879
- const value = horizontal ? (v) => plot.x + (v - scale.min) / span * plot.w : (v) => plot.y + plot.h - (v - scale.min) / span * plot.h;
7764
+ const value = horizontal ? (v) => plot.x + chartAxisRatio(v, scale, model.axes?.value) * plot.w : (v) => plot.y + plot.h - chartAxisRatio(v, scale, model.axes?.value) * plot.h;
6880
7765
  const bandSize = (horizontal ? plot.h : plot.w) / cats;
6881
- const band = horizontal ? (i2) => plot.y + plot.h - bandSize * (i2 + 0.5) : (i2) => plot.x + bandSize * (i2 + 0.5);
7766
+ const index = (i2) => model.axes?.category?.range.reverseOrder ? cats - 1 - i2 : i2;
7767
+ const band = horizontal ? (i2) => plot.y + plot.h - bandSize * (index(i2) + 0.5) : (i2) => plot.x + bandSize * (index(i2) + 0.5);
6882
7768
  out.push(chartAreaRect(model, "plotArea", plot));
7769
+ out.push(axisGridlines(model, model.axes?.value, scale.ticks, value, plot, horizontal));
7770
+ if (model.axes?.category?.source.majorGridlines || model.axes?.category?.source.minorGridlines)
7771
+ out.push(
7772
+ axisGridlines(
7773
+ model,
7774
+ model.axes.category,
7775
+ model.categories.map((_, i2) => i2),
7776
+ band,
7777
+ plot,
7778
+ !horizontal
7779
+ )
7780
+ );
6883
7781
  scale.ticks.forEach((t, i2) => {
6884
7782
  const p = value(t);
6885
7783
  const label = labels[i2] ?? "";
6886
7784
  if (horizontal) {
6887
- out.push(line(p, plot.y, p, plot.y + plot.h, grid.color, grid.width));
6888
7785
  if (valueLabels)
6889
7786
  out.push(
6890
7787
  text2(p, plot.y + plot.h + valueSize + 2, label, { anchor: "middle", ...valueAttrs })
6891
7788
  );
6892
7789
  } else {
6893
- out.push(line(plot.x, p, plot.x + plot.w, p, grid.color, grid.width));
6894
7790
  if (valueLabels)
6895
7791
  out.push(text2(plot.x - 4, p + valueSize * 0.3, label, { anchor: "end", ...valueAttrs }));
6896
7792
  }
6897
7793
  });
6898
- const zero = value(Math.min(Math.max(0, scale.min), scale.max));
6899
- if (horizontal) out.push(line(zero, plot.y, zero, plot.y + plot.h, axis.color, axis.width));
6900
- else out.push(line(plot.x, zero, plot.x + plot.w, zero, axis.color, axis.width));
7794
+ const source = model.axes?.value?.source;
7795
+ const crossing = source?.crosses === "max" ? scale.max : source?.crosses === "min" ? scale.min : source?.crossesAt ?? 0;
7796
+ const zero = value(Math.min(Math.max(crossing, scale.min), scale.max));
7797
+ if (horizontal)
7798
+ out.push(
7799
+ axisLine(model, model.axes?.category, "categoryAxis", zero, plot.y, zero, plot.y + plot.h)
7800
+ );
7801
+ else
7802
+ out.push(
7803
+ axisLine(model, model.axes?.category, "categoryAxis", plot.x, zero, plot.x + plot.w, zero)
7804
+ );
6901
7805
  const step = Math.max(
6902
7806
  1,
6903
7807
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot.h : plot.w) / 14)))
@@ -6922,20 +7826,23 @@ function cartesianAxes(model, area, out) {
6922
7826
  });
6923
7827
  const frame2 = { plot, value, band, bandSize };
6924
7828
  if (second) {
6925
- const secondSpan = second.max - second.min || 1;
6926
- frame2.secondary = (v) => plot.y + plot.h - (v - second.min) / secondSpan * plot.h;
6927
- const secondAxis = chartStroke(model, "valueAxis");
7829
+ frame2.secondary = (v) => plot.y + plot.h - chartAxisRatio(v, second, model.axes?.secondary) * plot.h;
6928
7830
  out.push(
6929
- line(
7831
+ axisLine(
7832
+ model,
7833
+ model.axes?.secondary,
7834
+ "valueAxis",
6930
7835
  plot.x + plot.w,
6931
7836
  plot.y,
6932
7837
  plot.x + plot.w,
6933
- plot.y + plot.h,
6934
- secondAxis.color,
6935
- secondAxis.width
7838
+ plot.y + plot.h
6936
7839
  )
6937
7840
  );
6938
- if (valueLabels)
7841
+ if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
7842
+ out.push(
7843
+ axisGridlines(model, model.axes.secondary, second.ticks, frame2.secondary, plot, false)
7844
+ );
7845
+ if (chartAxisLabels(model.axes?.secondary))
6939
7846
  second.ticks.forEach(
6940
7847
  (t, i2) => out.push(
6941
7848
  text2(plot.x + plot.w + 4, frame2.secondary(t) + valueSize * 0.3, secondLabels[i2] ?? "", {
@@ -6959,6 +7866,7 @@ function linesAndAreas(model, frame2, out) {
6959
7866
  const stacked = model.grouping === "stacked" || model.grouping === "percentStacked";
6960
7867
  const acc = new Array(model.categories.length).fill(0);
6961
7868
  const area = model.type === "area";
7869
+ const marks = [];
6962
7870
  const layers2 = [];
6963
7871
  model.series.forEach((s2, si) => {
6964
7872
  const points = [];
@@ -6973,16 +7881,24 @@ function linesAndAreas(model, frame2, out) {
6973
7881
  const top = below2 + (v ?? 0);
6974
7882
  if (stacked) acc[i2] = top;
6975
7883
  points.push([frame2.band(i2), frame2.value(top)]);
7884
+ marks.push({
7885
+ series: s2,
7886
+ index: i2,
7887
+ x: frame2.band(i2),
7888
+ y: frame2.value(top),
7889
+ radius: area ? 0 : chartMarkerRadius(s2, i2, 2.5)
7890
+ });
6976
7891
  lower.push([frame2.band(i2), frame2.value(below2)]);
6977
7892
  });
6978
7893
  layers2.push({
7894
+ series: s2,
6979
7895
  points,
6980
7896
  lower,
6981
7897
  color: s2.color,
6982
7898
  filter: s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""
6983
7899
  });
6984
7900
  });
6985
- for (const { points, lower, color, filter } of area ? [...layers2].reverse() : layers2) {
7901
+ for (const { points, lower, color, filter, series } of area ? [...layers2].reverse() : layers2) {
6986
7902
  if (area) {
6987
7903
  const poly = [...points, ...[...lower].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
6988
7904
  out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter}/>`);
@@ -7001,10 +7917,11 @@ function linesAndAreas(model, frame2, out) {
7001
7917
  else segment2.push(`${n(x)},${n(y)}`);
7002
7918
  }
7003
7919
  flush();
7004
- for (const [x, y] of points)
7005
- if (!Number.isNaN(x))
7006
- out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter}/>`);
7920
+ points.forEach(([x, y], index) => {
7921
+ if (!Number.isNaN(x)) out.push(chartSeriesMarkerSvg(series, index, x, y, 2.5));
7922
+ });
7007
7923
  }
7924
+ pointLabels(model, marks, out);
7008
7925
  }
7009
7926
 
7010
7927
  // chart/render/chart-svg-xy.ts
@@ -7012,16 +7929,14 @@ function scatter(model, area, out) {
7012
7929
  const ys = model.valueAxis;
7013
7930
  const xs = model.xAxis;
7014
7931
  if (!ys || !xs) return;
7015
- const yLabels = ys.ticks.map((t) => formatAxisValue(t));
7932
+ const yLabels = ys.ticks.map((t) => axisTickText(t, model.axes?.value));
7016
7933
  const valueAttrs = chartTextAttributes(model, "valueAxis");
7017
7934
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
7018
7935
  const valueSize = valueAttrs.size ?? 10;
7019
7936
  const categorySize = categoryAttrs.size ?? 10;
7020
- const grid = chartStroke(model, "gridlineMajor");
7021
7937
  const xAxis = chartStroke(model, "categoryAxis");
7022
- const yAxis = chartStroke(model, "valueAxis");
7023
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
7024
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
7938
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
7939
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
7025
7940
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
7026
7941
  const plot = {
7027
7942
  x: area.x + labelW,
@@ -7041,17 +7956,24 @@ function scatter(model, area, out) {
7041
7956
  s2.values.forEach((_, i2) => {
7042
7957
  reach = Math.max(reach, radiusOf(s2.sizes?.[i2] ?? void 0) ?? 0);
7043
7958
  });
7044
- const widen = (s2, length) => {
7959
+ const widen = (s2, length, axis) => {
7960
+ if (axis?.range.logScale) return s2;
7045
7961
  const pad2 = reach * (s2.max - s2.min || 1) / Math.max(1, length - 2 * reach);
7046
- return { ...s2, min: s2.min - pad2, max: s2.max + pad2 };
7962
+ return {
7963
+ ...s2,
7964
+ min: axis?.source.scaling.min === void 0 ? s2.min - pad2 : s2.min,
7965
+ max: axis?.source.scaling.max === void 0 ? s2.max + pad2 : s2.max
7966
+ };
7047
7967
  };
7048
- const xView = widen(xs, plot.w);
7049
- const yView = widen(ys, plot.h);
7050
- const px3 = (v) => plot.x + (v - xView.min) / (xView.max - xView.min || 1) * plot.w;
7051
- const py = (v) => plot.y + plot.h - (v - yView.min) / (yView.max - yView.min || 1) * plot.h;
7968
+ const xView = widen(xs, plot.w, model.axes?.category);
7969
+ const yView = widen(ys, plot.h, model.axes?.value);
7970
+ const px3 = (v) => plot.x + chartAxisRatio(v, xView, model.axes?.category) * plot.w;
7971
+ const py = (v) => plot.y + plot.h - chartAxisRatio(v, yView, model.axes?.value) * plot.h;
7052
7972
  out.push(chartAreaRect(model, "plotArea", plot));
7973
+ out.push(axisGridlines(model, model.axes?.value, ys.ticks, py, plot, false));
7974
+ if (model.axes?.category)
7975
+ out.push(axisGridlines(model, model.axes.category, xs.ticks, px3, plot, true));
7053
7976
  ys.ticks.forEach((t, i2) => {
7054
- out.push(line(plot.x, py(t), plot.x + plot.w, py(t), grid.color, grid.width));
7055
7977
  if (valueLabels)
7056
7978
  out.push(
7057
7979
  text2(plot.x - 4, py(t) + valueSize * 0.3, yLabels[i2] ?? "", {
@@ -7061,19 +7983,31 @@ function scatter(model, area, out) {
7061
7983
  );
7062
7984
  });
7063
7985
  for (const t of xs.ticks) {
7064
- out.push(line(px3(t), plot.y + plot.h, px3(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
7986
+ if (!model.axes?.category?.source.deleted)
7987
+ out.push(line(px3(t), plot.y + plot.h, px3(t), plot.y + plot.h + 3, xAxis.color, xAxis.width));
7065
7988
  if (categoryLabels)
7066
7989
  out.push(
7067
- text2(px3(t), plot.y + plot.h + categorySize + 3, formatAxisValue(t), {
7990
+ text2(px3(t), plot.y + plot.h + categorySize + 3, axisTickText(t, model.axes?.category), {
7068
7991
  anchor: "middle",
7069
7992
  ...categoryAttrs
7070
7993
  })
7071
7994
  );
7072
7995
  }
7073
7996
  out.push(
7074
- line(plot.x, plot.y + plot.h, plot.x + plot.w, plot.y + plot.h, xAxis.color, xAxis.width)
7997
+ axisLine(
7998
+ model,
7999
+ model.axes?.category,
8000
+ "categoryAxis",
8001
+ plot.x,
8002
+ plot.y + plot.h,
8003
+ plot.x + plot.w,
8004
+ plot.y + plot.h
8005
+ )
8006
+ );
8007
+ out.push(
8008
+ axisLine(model, model.axes?.value, "valueAxis", plot.x, plot.y, plot.x, plot.y + plot.h)
7075
8009
  );
7076
- out.push(line(plot.x, plot.y, plot.x, plot.y + plot.h, yAxis.color, yAxis.width));
8010
+ const marks = [];
7077
8011
  for (const [si, s2] of model.series.entries())
7078
8012
  s2.values.forEach((v, i2) => {
7079
8013
  const x = s2.xValues?.[i2] ?? null;
@@ -7081,15 +8015,18 @@ function scatter(model, area, out) {
7081
8015
  const filter = s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : "";
7082
8016
  const fill = s2.pointColors?.[i2] ?? s2.color;
7083
8017
  if (!bubble) {
7084
- out.push(`<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter}/>`);
8018
+ out.push(chartSeriesMarkerSvg(s2, i2, px3(x), py(v)));
8019
+ marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: chartMarkerRadius(s2, i2) });
7085
8020
  return;
7086
8021
  }
7087
8022
  const r = radiusOf(s2.sizes?.[i2] ?? void 0);
7088
8023
  if (r === void 0) return;
8024
+ marks.push({ series: s2, index: i2, x: px3(x), y: py(v), radius: r });
7089
8025
  out.push(
7090
8026
  `<circle cx="${n(px3(x))}" cy="${n(py(v))}" r="${n(r)}" fill="${fill}" fill-opacity="0.6" data-chart-series="${si}" data-chart-point="${i2}"${filter}/>`
7091
8027
  );
7092
8028
  });
8029
+ pointLabels(model, marks, out);
7093
8030
  scatterAnalysis(model, px3, py, out);
7094
8031
  }
7095
8032
 
@@ -7254,7 +8191,9 @@ function pieSvg(model, area) {
7254
8191
  const out = [chartAreaRect(model, "plotArea", area)];
7255
8192
  const cx2 = area.x + area.w / 2;
7256
8193
  const cy = area.y + area.h / 2;
7257
- const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4);
8194
+ const margin = hasOutsideLabels(model) ? Math.min(area.w, area.h) * 0.12 : 0;
8195
+ const radius = Math.max(1, Math.min(area.w, area.h) / 2 - 4 - margin);
8196
+ const slices = [];
7258
8197
  const rings = model.type === "doughnut" ? model.series : model.series.slice(0, 1);
7259
8198
  const hole = model.type === "doughnut" ? radius * 0.5 : 0;
7260
8199
  const ringSize = (radius - hole) / Math.max(1, rings.length);
@@ -7271,9 +8210,20 @@ function pieSvg(model, area) {
7271
8210
  out.push(
7272
8211
  `<path d="${slicePath(cx2, cy, outer, inner, angle, angle + sweep)}" fill="${color}" stroke="#FFFFFF" stroke-width="1"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
7273
8212
  );
8213
+ slices.push({
8214
+ series: s2,
8215
+ index: i2,
8216
+ cx: cx2,
8217
+ cy,
8218
+ outer,
8219
+ inner,
8220
+ start: angle,
8221
+ end: angle + sweep
8222
+ });
7274
8223
  angle += sweep;
7275
8224
  });
7276
8225
  });
8226
+ sliceLabels(model, slices, out);
7277
8227
  return out.join("");
7278
8228
  }
7279
8229
  function radarSvg(model, area) {
@@ -7286,32 +8236,37 @@ function radarSvg(model, area) {
7286
8236
  const valueSize = valueAttrs.size ?? 9;
7287
8237
  const categorySize = categoryAttrs.size ?? 10;
7288
8238
  const grid = chartStroke(model, "gridlineMajor");
7289
- const axis = chartStroke(model, "categoryAxis");
7290
8239
  const cx2 = area.x + area.w / 2;
7291
8240
  const cy = area.y + area.h / 2 + 4;
7292
8241
  const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
7293
8242
  const angle = (i2) => i2 / count * Math.PI * 2;
7294
- const r = (v) => (v - scale.min) / (scale.max - scale.min || 1) * radius;
8243
+ const r = (v) => chartAxisRatio(v, scale, model.axes?.value) * radius;
7295
8244
  const labelEvery = Math.max(
7296
8245
  1,
7297
8246
  Math.ceil(12 / Math.max(1, radius / Math.max(1, scale.ticks.length - 1)))
7298
8247
  );
7299
8248
  for (const [k, t] of scale.ticks.entries()) {
7300
8249
  const ring = Array.from({ length: count }, (_, i2) => polar(cx2, cy, r(t), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7301
- out.push(
7302
- `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
7303
- );
7304
- if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
8250
+ if (!model.axes?.value || model.axes.value.source.majorGridlines)
7305
8251
  out.push(
7306
- text2(cx2 + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale.percent), valueAttrs)
8252
+ `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
8253
+ );
8254
+ if (chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
8255
+ out.push(
8256
+ text2(
8257
+ cx2 + 3,
8258
+ cy - r(t) + valueSize * 0.3,
8259
+ axisTickText(t, model.axes?.value, scale.percent),
8260
+ valueAttrs
8261
+ )
7307
8262
  );
7308
8263
  }
7309
8264
  model.categories.forEach((c2, i2) => {
7310
8265
  const [x, y] = polar(cx2, cy, radius, angle(i2));
7311
- out.push(line(cx2, cy, x, y, axis.color, axis.width));
8266
+ out.push(axisLine(model, model.axes?.category, "categoryAxis", cx2, cy, x, y));
7312
8267
  const [lx, ly] = polar(cx2, cy, radius + 10, angle(i2));
7313
8268
  const anchor = Math.abs(lx - cx2) < 2 ? "middle" : lx > cx2 ? "start" : "end";
7314
- if (model.appearance?.categoryAxis?.labelsVisible !== false)
8269
+ if (chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false)
7315
8270
  out.push(
7316
8271
  text2(lx, ly + categorySize * 0.3, fit(c2, area.w / 4, categorySize), {
7317
8272
  anchor,
@@ -7319,12 +8274,22 @@ function radarSvg(model, area) {
7319
8274
  })
7320
8275
  );
7321
8276
  });
8277
+ const marks = [];
7322
8278
  for (const s2 of model.series) {
7323
- const points = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
8279
+ const vertices = s2.values.slice(0, count).map((v, i2) => polar(cx2, cy, r(v ?? scale.min), angle(i2)));
8280
+ vertices.forEach(([x, y], i2) => {
8281
+ if (s2.values[i2] === null) return;
8282
+ const markerSeries = s2;
8283
+ if (markerSeries.marker || markerSeries.pointMarkers)
8284
+ out.push(chartSeriesMarkerSvg(s2, i2, x, y));
8285
+ marks.push({ series: s2, index: i2, x, y, radius: chartMarkerRadius(s2, i2) });
8286
+ });
8287
+ const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
7324
8288
  out.push(
7325
8289
  `<polygon points="${points}" fill="none" stroke="${s2.color}" stroke-width="2"${s2.shadowFilter ? ` filter="${s2.shadowFilter}"` : ""}/>`
7326
8290
  );
7327
8291
  }
8292
+ pointLabels(model, marks, out);
7328
8293
  return out.join("");
7329
8294
  }
7330
8295
 
@@ -7415,33 +8380,33 @@ var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
7415
8380
  function cssFont(attrs) {
7416
8381
  return `${attrs.italic ? "italic" : "normal"} ${attrs.weight ?? "normal"} ${attrs.size ?? 10}px ${attrs.family ?? CHART_FONT_FAMILY}`;
7417
8382
  }
7418
- function chartFontMetrics(attrs, options) {
7419
- const metrics = options.measureFont?.(cssFont(attrs));
8383
+ function chartFontMetrics(attrs, options2) {
8384
+ const metrics = options2.measureFont?.(cssFont(attrs));
7420
8385
  return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
7421
8386
  }
7422
- function chartTextWidth(content2, attrs, options) {
7423
- const width = options.measureText?.(content2, cssFont(attrs));
8387
+ function chartTextWidth(content2, attrs, options2) {
8388
+ const width = options2.measureText?.(content2, cssFont(attrs));
7424
8389
  return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content2, attrs.size);
7425
8390
  }
7426
- function fitChartText(content2, maxWidth, attrs, options) {
7427
- if (!options.measureText) return fit(content2, maxWidth, attrs.size);
7428
- if (chartTextWidth(content2, attrs, options) <= maxWidth) return content2;
8391
+ function fitChartText(content2, maxWidth, attrs, options2) {
8392
+ if (!options2.measureText) return fit(content2, maxWidth, attrs.size);
8393
+ if (chartTextWidth(content2, attrs, options2) <= maxWidth) return content2;
7429
8394
  const points = [...content2];
7430
8395
  let low = 0;
7431
8396
  let high = points.length;
7432
8397
  while (low < high) {
7433
8398
  const mid = Math.ceil((low + high) / 2);
7434
- if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options) <= maxWidth) low = mid;
8399
+ if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs, options2) <= maxWidth) low = mid;
7435
8400
  else high = mid - 1;
7436
8401
  }
7437
8402
  return `${points.slice(0, low).join("")}\u2026`;
7438
8403
  }
7439
8404
 
7440
8405
  // chart/render/chart-svg-legend.ts
7441
- function chartLegendSvg(model, area, frame2, options) {
8406
+ function chartLegendSvg(model, area, frame2, options2) {
7442
8407
  const automatic = [];
7443
8408
  const bounds2 = {};
7444
- const reserved = automaticLegend(model, area, automatic, options, bounds2);
8409
+ const reserved = automaticLegend(model, area, automatic, options2, bounds2);
7445
8410
  const plot = model.legendOverlay ? area : reserved;
7446
8411
  const box = bounds2.box;
7447
8412
  if (!box) return { plot, markup: "", foreground: false };
@@ -7455,11 +8420,11 @@ function chartLegendSvg(model, area, frame2, options) {
7455
8420
  const entries = legendEntries(model);
7456
8421
  const attrs = chartTextAttributes(model, "legend");
7457
8422
  const size = attrs.size ?? 10;
7458
- const font = chartFontMetrics(attrs, options);
8423
+ const font = chartFontMetrics(attrs, options2);
7459
8424
  const keySize = size / 2;
7460
8425
  const keyGap = size / 4;
7461
8426
  const widths = entries.map(
7462
- (entry3) => chartTextWidth(entry3.label, attrs, options) + keySize + keyGap
8427
+ (entry3) => chartTextWidth(entry3.label, attrs, options2) + keySize + keyGap
7463
8428
  );
7464
8429
  const horizontal = manual.width > manual.height && widths.reduce((sum, width) => sum + width, 0) + size <= manual.width;
7465
8430
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -7474,8 +8439,8 @@ function chartLegendSvg(model, area, frame2, options) {
7474
8439
  ];
7475
8440
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
7476
8441
  entries.forEach((entry3, i2) => {
7477
- const available = horizontal ? chartTextWidth(entry3.label, attrs, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
7478
- const label = fitChartText(entry3.label, available, attrs, options);
8442
+ const available = horizontal ? chartTextWidth(entry3.label, attrs, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
8443
+ const label = fitChartText(entry3.label, available, attrs, options2);
7479
8444
  const contentWidth = Math.min(
7480
8445
  horizontal ? widths[i2] ?? 0 : Math.max(...widths),
7481
8446
  rowWidth - size / 2
@@ -7518,7 +8483,7 @@ function legendEntries(model) {
7518
8483
  color: s2.color
7519
8484
  }));
7520
8485
  }
7521
- function automaticLegend(model, area, out, options, bounds2) {
8486
+ function automaticLegend(model, area, out, options2, bounds2) {
7522
8487
  const entries = legendEntries(model);
7523
8488
  if (!model.showLegend || entries.length === 0) return area;
7524
8489
  const pos = model.legendPosition;
@@ -7527,7 +8492,7 @@ function automaticLegend(model, area, out, options, bounds2) {
7527
8492
  const rowH = Math.max(16, size * 1.4);
7528
8493
  if (pos === "t" || pos === "b") {
7529
8494
  const widths = entries.map(
7530
- (e) => Math.min(chartTextWidth(e.label, attrs, options) + 20, area.w / 2)
8495
+ (e) => Math.min(chartTextWidth(e.label, attrs, options2) + 20, area.w / 2)
7531
8496
  );
7532
8497
  const total = widths.reduce((a2, b) => a2 + b, 0);
7533
8498
  let x2 = area.x + Math.max(0, (area.w - total) / 2);
@@ -7544,14 +8509,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7544
8509
  entries.forEach((e, i2) => {
7545
8510
  const w = widths[i2] ?? 0;
7546
8511
  out.push(rect(x2, y, 8, 8, e.color));
7547
- out.push(text2(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options), attrs));
8512
+ out.push(text2(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs, options2), attrs));
7548
8513
  x2 += w;
7549
8514
  });
7550
8515
  return pos === "t" ? { x: area.x, y: area.y + rowH + 4, w: area.w, h: area.h - rowH - 4 } : { x: area.x, y: area.y, w: area.w, h: area.h - rowH - 4 };
7551
8516
  }
7552
8517
  const width = Math.min(
7553
8518
  area.w * 0.35,
7554
- Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options))) + 22
8519
+ Math.max(...entries.map((e) => chartTextWidth(e.label, attrs, options2))) + 22
7555
8520
  );
7556
8521
  const height = entries.length * rowH;
7557
8522
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -7569,14 +8534,14 @@ function automaticLegend(model, area, out, options, bounds2) {
7569
8534
  const y = y0 + i2 * rowH;
7570
8535
  if (y + rowH > area.y + area.h + 2) return;
7571
8536
  out.push(rect(x, y + 3, 8, 8, e.color));
7572
- out.push(text2(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options), attrs));
8537
+ out.push(text2(x + 12, y + 11, fitChartText(e.label, width - 16, attrs, options2), attrs));
7573
8538
  });
7574
8539
  return pos === "l" ? { x: area.x + width + 8, y: area.y, w: area.w - width - 8, h: area.h } : { x: area.x, y: area.y, w: area.w - width - 8, h: area.h };
7575
8540
  }
7576
8541
 
7577
8542
  // text/wrap-styled-runs.ts
7578
8543
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
7579
- function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
8544
+ function wrapStyledRuns(runs, maxWidth, measure4, options2 = {}) {
7580
8545
  const groups = [];
7581
8546
  for (const [source, run2] of runs.entries()) {
7582
8547
  for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
@@ -7599,7 +8564,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7599
8564
  return result2;
7600
8565
  };
7601
8566
  const width = (pieces) => pieces.reduce((sum, piece) => {
7602
- const advance = measure3(piece.text, piece.run);
8567
+ const advance = measure4(piece.text, piece.run);
7603
8568
  return sum + (Number.isFinite(advance) && advance >= 0 ? advance : 0);
7604
8569
  }, 0);
7605
8570
  const result = [];
@@ -7624,7 +8589,7 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7624
8589
  if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
7625
8590
  else line3 = merged(line3, separator);
7626
8591
  spaces = [];
7627
- if (options.breakWords && wordWidth > maxWidth) {
8592
+ if (options2.breakWords && wordWidth > maxWidth) {
7628
8593
  for (const piece of group2.pieces) {
7629
8594
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
7630
8595
  const next = { ...piece, text: segment2 };
@@ -7642,11 +8607,11 @@ function wrapStyledRuns(runs, maxWidth, measure3, options = {}) {
7642
8607
  function spacing2(value, naturalHeight, fallback) {
7643
8608
  return value ? value.unit === "points" ? chartPointsToPixels(value.value) : naturalHeight * value.value : fallback;
7644
8609
  }
7645
- function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
8610
+ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
7646
8611
  if (!model.title) return void 0;
7647
8612
  const base = chartTextAttributes(model, "title", 14);
7648
8613
  const capacity = Math.max(1, width * 0.8 - 8);
7649
- if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
8614
+ if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options2) <= capacity)
7650
8615
  return void 0;
7651
8616
  const paragraphs = model.titleText?.paragraphs ?? [
7652
8617
  {
@@ -7682,7 +8647,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7682
8647
  "title",
7683
8648
  base.size
7684
8649
  ),
7685
- options
8650
+ options2
7686
8651
  ),
7687
8652
  { breakWords: true }
7688
8653
  );
@@ -7706,10 +8671,10 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7706
8671
  return {
7707
8672
  ...line3,
7708
8673
  runs,
7709
- width: runs.reduce((sum, run2) => sum + chartTextWidth(run2.text, run2.attrs, options), 0),
8674
+ width: runs.reduce((sum, run2) => sum + chartTextWidth(run2.text, run2.attrs, options2), 0),
7710
8675
  size: runs.length ? Math.max(...runs.map((run2) => run2.attrs.size ?? 14)) : base.size ?? 14,
7711
8676
  fontMetrics: (runs.length ? runs.map((run2) => run2.attrs) : [base]).map(
7712
- (attrs) => chartFontMetrics(attrs, options)
8677
+ (attrs) => chartFontMetrics(attrs, options2)
7713
8678
  )
7714
8679
  };
7715
8680
  });
@@ -7747,7 +8712,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7747
8712
  anchor: "start"
7748
8713
  }).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
7749
8714
  );
7750
- x += chartTextWidth(run2.text, run2.attrs, options);
8715
+ x += chartTextWidth(run2.text, run2.attrs, options2);
7751
8716
  }
7752
8717
  }
7753
8718
  const parent = text2(0, 0, "", { ...base, underline: false }).replace(
@@ -7773,7 +8738,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
7773
8738
  }
7774
8739
 
7775
8740
  // chart/render/chart-svg.ts
7776
- function renderChartSvg(model, width, height, options = {}) {
8741
+ function renderChartSvg(model, width, height, options2 = {}) {
7777
8742
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
7778
8743
  model = paint2.model;
7779
8744
  const w = Math.max(1, width);
@@ -7787,7 +8752,7 @@ function renderChartSvg(model, width, height, options = {}) {
7787
8752
  if (paint2.defs) out.push(paint2.defs);
7788
8753
  out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h: h2 }));
7789
8754
  let area = { x: 8, y: 8, w: w - 16, h: h2 - 16 };
7790
- const richTitle = chartRichTitleSvg(model, w, options, h2);
8755
+ const richTitle = chartRichTitleSvg(model, w, options2, h2);
7791
8756
  if (richTitle) {
7792
8757
  if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
7793
8758
  else out.push(richTitle.markup);
@@ -7796,9 +8761,9 @@ function renderChartSvg(model, width, height, options = {}) {
7796
8761
  } else if (model.title) {
7797
8762
  const attrs = chartTextAttributes(model, "title", 14);
7798
8763
  const size = attrs.size ?? 14;
7799
- const label = fitChartText(model.title, w - 16, attrs, options);
7800
- const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options) + 8);
7801
- const font = chartFontMetrics(attrs, options);
8764
+ const label = fitChartText(model.title, w - 16, attrs, options2);
8765
+ const titleWidth = Math.min(w - 16, chartTextWidth(label, attrs, options2) + 8);
8766
+ const font = chartFontMetrics(attrs, options2);
7802
8767
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
7803
8768
  out.push(
7804
8769
  chartAreaRect(model, "title", {
@@ -7826,7 +8791,7 @@ function renderChartSvg(model, width, height, options = {}) {
7826
8791
  out.push("</svg>");
7827
8792
  return out.join("");
7828
8793
  }
7829
- const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options);
8794
+ const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options2);
7830
8795
  area = legend.plot;
7831
8796
  if (!legend.foreground) out.push(legend.markup);
7832
8797
  if (area.w > 4 && area.h > 4) {
@@ -7873,8 +8838,8 @@ function chartSpaceKind(space3) {
7873
8838
  const type = chartSummaryFromSpace(space3).chartType;
7874
8839
  return { type, drawn: DRAWN_CHART_TYPES.has(type) };
7875
8840
  }
7876
- function renderChartSpaceSvg(space3, options) {
7877
- const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options;
8841
+ function renderChartSpaceSvg(space3, options2) {
8842
+ const { width, height, theme, fonts, formatting, colorPalette, styleDefinition, ...svg } = options2;
7878
8843
  const summary = chartSummaryFromSpace(space3, {
7879
8844
  ...formatting ? { formatting } : {},
7880
8845
  ...colorPalette !== void 0 ? { colorPalette } : {},
@@ -7883,8 +8848,8 @@ function renderChartSpaceSvg(space3, options) {
7883
8848
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
7884
8849
  return renderChartSvg(view, width, height, svg);
7885
8850
  }
7886
- function renderChartSummarySvg(summary, options) {
7887
- const { width, height, theme, fonts, ...svg } = options;
8851
+ function renderChartSummarySvg(summary, options2) {
8852
+ const { width, height, theme, fonts, ...svg } = options2;
7888
8853
  const view = chartSummaryView(summary, chartThemePalette(theme, fonts));
7889
8854
  return renderChartSvg(view, width, height, svg);
7890
8855
  }
@@ -8228,7 +9193,7 @@ __export(i18n_exports, {
8228
9193
  // i18n/locale.ts
8229
9194
  var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
8230
9195
  var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
8231
- function normalizeLocale(input, supported, fallback, options = {}) {
9196
+ function normalizeLocale(input, supported, fallback, options2 = {}) {
8232
9197
  const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
8233
9198
  const language = parts[0];
8234
9199
  if (!language) return fallback;
@@ -8237,7 +9202,7 @@ function normalizeLocale(input, supported, fallback, options = {}) {
8237
9202
  if (exact) return exact;
8238
9203
  const base = find(language);
8239
9204
  if (base) return base;
8240
- const rejected = options.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
9205
+ const rejected = options2.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
8241
9206
  if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
8242
9207
  return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
8243
9208
  }
@@ -8275,12 +9240,12 @@ function interpolate2(template, params, placeholder = "single") {
8275
9240
  (match, name) => Object.prototype.hasOwnProperty.call(params, name) && params[name] !== void 0 ? String(params[name]) : match
8276
9241
  );
8277
9242
  }
8278
- function createTranslator(messages, fallbacks = [], options = {}) {
8279
- const placeholder = options.placeholder ?? "single";
9243
+ function createTranslator(messages, fallbacks = [], options2 = {}) {
9244
+ const placeholder = options2.placeholder ?? "single";
8280
9245
  return (key, params) => {
8281
9246
  let text4 = messages?.[key];
8282
9247
  for (let i2 = 0; text4 === void 0 && i2 < fallbacks.length; i2++) text4 = fallbacks[i2]?.[key];
8283
- return interpolate2(text4 ?? options.missing?.(key) ?? key, params, placeholder);
9248
+ return interpolate2(text4 ?? options2.missing?.(key) ?? key, params, placeholder);
8284
9249
  };
8285
9250
  }
8286
9251
  function translateOr(translate, key, fallback, params) {
@@ -20790,9 +21755,9 @@ function paragraphsAt(text4, sizePt) {
20790
21755
  const afterParent = (text4.spaceAfterParent ?? DEFAULT_SPACE_AFTER_PARENT) / 100;
20791
21756
  const afterChild = (text4.spaceAfterChild ?? DEFAULT_SPACE_AFTER_CHILD) / 100;
20792
21757
  const { secondary } = paragraphSizesPt(text4, sizePt);
20793
- const paragraph2 = (value, level2) => {
20794
- const bullet = bulletLevel > 0 && level2 >= bulletLevel;
20795
- const size = bullet || level2 >= 2 ? secondary : sizePt;
21758
+ const paragraph2 = (value, level3) => {
21759
+ const bullet = bulletLevel > 0 && level3 >= bulletLevel;
21760
+ const size = bullet || level3 >= 2 ? secondary : sizePt;
20796
21761
  return {
20797
21762
  text: value,
20798
21763
  size,
@@ -21350,9 +22315,9 @@ function evaluateCondition(condition, point, lookup) {
21350
22315
  // diagram/engine/pres-tree.ts
21351
22316
  var MAX_DEPTH = 96;
21352
22317
  var MAX_NODES = 1e5;
21353
- function lookupVariable(node, name, options) {
21354
- if (name === "dir" && options.direction) {
21355
- return options.direction;
22318
+ function lookupVariable(node, name, options2) {
22319
+ if (name === "dir" && options2.direction) {
22320
+ return options2.direction;
21356
22321
  }
21357
22322
  let current = node;
21358
22323
  while (current) {
@@ -21466,8 +22431,8 @@ function buildNode(def, point, parent, state) {
21466
22431
  state.depth--;
21467
22432
  return node;
21468
22433
  }
21469
- function buildPresentationTree(def, doc, options = {}) {
21470
- return buildNode(def.root, doc, void 0, { def, options, counter: 0, depth: 0 });
22434
+ function buildPresentationTree(def, doc, options2 = {}) {
22435
+ return buildNode(def.root, doc, void 0, { def, options: options2, counter: 0, depth: 0 });
21471
22436
  }
21472
22437
 
21473
22438
  // diagram/engine/preferred-size.ts
@@ -22226,7 +23191,7 @@ function arrangeHierRoot(node) {
22226
23191
  }
22227
23192
 
22228
23193
  // diagram/engine/alg-linear.ts
22229
- function measure(node, box, horizontal, scale, uniform = false) {
23194
+ function measure2(node, box, horizontal, scale, uniform = false) {
22230
23195
  const refW = horizontal || uniform ? box.w * scale : box.w;
22231
23196
  const refH = !horizontal || uniform ? box.h * scale : box.h;
22232
23197
  evaluateWithReference(node, refW, refH);
@@ -22293,7 +23258,7 @@ function fitLinear(node, box, horizontal) {
22293
23258
  const along = horizontal ? box.w : box.h;
22294
23259
  const across = horizontal ? box.h : box.w;
22295
23260
  let scale = 1;
22296
- let current = measure(node, box, horizontal, scale);
23261
+ let current = measure2(node, box, horizontal, scale);
22297
23262
  const full = current;
22298
23263
  let crossLimited = true;
22299
23264
  for (let iteration = 0; iteration < 12; iteration++) {
@@ -22303,10 +23268,10 @@ function fitLinear(node, box, horizontal) {
22303
23268
  if (factor >= 0.99999) {
22304
23269
  break;
22305
23270
  }
22306
- const next = measure(node, box, horizontal, scale * factor);
23271
+ const next = measure2(node, box, horizontal, scale * factor);
22307
23272
  if (factor === fitAcross && next.cross >= current.cross - 1e-6) {
22308
23273
  crossLimited = false;
22309
- current = measure(node, box, horizontal, scale);
23274
+ current = measure2(node, box, horizontal, scale);
22310
23275
  continue;
22311
23276
  }
22312
23277
  scale *= factor;
@@ -22323,9 +23288,9 @@ function fitLinear(node, box, horizontal) {
22323
23288
  function fitUniform(node, box, horizontal, stuck) {
22324
23289
  const along = horizontal ? box.w : box.h;
22325
23290
  let scale = 1;
22326
- let current = measure(node, box, horizontal, 1, true);
23291
+ let current = measure2(node, box, horizontal, 1, true);
22327
23292
  for (let iteration = 0; iteration < 12 && current.total > along + 1e-3; iteration++) {
22328
- const next = measure(node, box, horizontal, scale * (along / current.total), true);
23293
+ const next = measure2(node, box, horizontal, scale * (along / current.total), true);
22329
23294
  if (next.total >= current.total - 1e-6) {
22330
23295
  break;
22331
23296
  }
@@ -22347,7 +23312,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
22347
23312
  let t1 = current.total;
22348
23313
  for (let i2 = 0; i2 < 6 && s1 < 1 && Math.abs(t1 - along) > 1e-3 && Math.abs(t0 - t1) > 1e-9; i2++) {
22349
23314
  const next = Math.min(1, Math.max(1e-6, s1 + (along - t1) * (s0 - s1) / (t0 - t1)));
22350
- const measured = measure(node, box, horizontal, next);
23315
+ const measured = measure2(node, box, horizontal, next);
22351
23316
  if (measured.total > along + 1e-3 || crossLimited && measured.cross > across + 1e-6) {
22352
23317
  break;
22353
23318
  }
@@ -22360,7 +23325,7 @@ function refineAlong(node, box, horizontal, scale, current, full, crossLimited)
22360
23325
  if (best !== current) {
22361
23326
  return best;
22362
23327
  }
22363
- return measure(node, box, horizontal, scale);
23328
+ return measure2(node, box, horizontal, scale);
22364
23329
  }
22365
23330
  function alignOffset(free, align, start, end) {
22366
23331
  if (align === start) {
@@ -22545,7 +23510,7 @@ function contentHeight(cell, w, h2) {
22545
23510
  cell.values = saved;
22546
23511
  return bottom;
22547
23512
  }
22548
- function measure2(node, box, cells, spacer, row2) {
23513
+ function measure3(node, box, cells, spacer, row2) {
22549
23514
  const cellW = Math.max(...cells.map((c2) => c2.values.get("w") ?? box.w));
22550
23515
  const assignedH = Math.max(...cells.map((c2) => c2.values.get("h") ?? box.h));
22551
23516
  const cellH = Math.max(...cells.map((c2) => contentHeight(c2, cellW, assignedH)));
@@ -22580,7 +23545,7 @@ function fitSnakeByRule(node, box, cells, spacers, row2) {
22580
23545
  const floor = rule.val * POINTS_PER_MM2;
22581
23546
  const at2 = (value) => {
22582
23547
  evaluateAt(node, box, rule, targets, value);
22583
- return measure2(node, box, cells, spacers[0], row2);
23548
+ return measure3(node, box, cells, spacers[0], row2);
22584
23549
  };
22585
23550
  let best = at2(start);
22586
23551
  if (fits2(best, cells.length, box, row2) || !(start > floor)) {
@@ -22885,7 +23850,7 @@ function depthOf(point) {
22885
23850
  }
22886
23851
  return depth;
22887
23852
  }
22888
- function level(depth) {
23853
+ function level2(depth) {
22889
23854
  return Math.max(0, Math.min(MAX_LEVEL, depth));
22890
23855
  }
22891
23856
  function connectorDim(node) {
@@ -22899,11 +23864,11 @@ function derivedStyleLabel(node) {
22899
23864
  switch (point.type) {
22900
23865
  case "node":
22901
23866
  case "asst":
22902
- return `node${level(depthOf(point))}`;
23867
+ return `node${level2(depthOf(point))}`;
22903
23868
  case "sibTrans":
22904
23869
  return `sibTrans${connectorDim(node)}1`;
22905
23870
  case "parTrans":
22906
- return `parChTrans${connectorDim(node)}${level(depthOf(point))}`;
23871
+ return `parChTrans${connectorDim(node)}${level2(depthOf(point))}`;
22907
23872
  default:
22908
23873
  return void 0;
22909
23874
  }
@@ -29657,18 +30622,18 @@ function fanContinues(t, perRow, orgChart, siblingCount, normalCount) {
29657
30622
  const spanW = effectiveWidth(t, orgChart);
29658
30623
  return chPrefFanEligible || isSoloChainLink && normalCount > 1 && spanW === normalCount;
29659
30624
  }
29660
- function walk2(t, level2, perRow, orgChart, siblingCount) {
30625
+ function walk2(t, level3, perRow, orgChart, siblingCount) {
29661
30626
  const { normal } = partitionChildren(t, orgChart);
29662
30627
  if (normal.length === 0) {
29663
- return { deepestFanLevel: level2, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
30628
+ return { deepestFanLevel: level3, maxHangDepth: 0, maxHangRows: 0, hangingColumns: 0 };
29664
30629
  }
29665
- if (level2 === 0) {
29666
- let deepestFan = level2;
30630
+ if (level3 === 0) {
30631
+ let deepestFan = level3;
29667
30632
  let maxHang = 0;
29668
30633
  let maxRows = 0;
29669
30634
  let hangingColumns = 0;
29670
30635
  for (const child3 of normal) {
29671
- const r = walk2(child3, level2 + 1, perRow, orgChart, normal.length);
30636
+ const r = walk2(child3, level3 + 1, perRow, orgChart, normal.length);
29672
30637
  deepestFan = Math.max(deepestFan, r.deepestFanLevel);
29673
30638
  maxHang = Math.max(maxHang, r.maxHangDepth);
29674
30639
  maxRows = Math.max(maxRows, r.maxHangRows);
@@ -29682,12 +30647,12 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
29682
30647
  };
29683
30648
  }
29684
30649
  if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
29685
- let deepestFan = level2 + 1;
30650
+ let deepestFan = level3 + 1;
29686
30651
  let maxHang = 0;
29687
30652
  let maxRows = 0;
29688
30653
  let hangingColumns = 0;
29689
30654
  for (const child3 of normal) {
29690
- const r = walk2(child3, level2 + 1, perRow, orgChart, void 0);
30655
+ const r = walk2(child3, level3 + 1, perRow, orgChart, void 0);
29691
30656
  deepestFan = Math.max(deepestFan, r.deepestFanLevel);
29692
30657
  maxHang = Math.max(maxHang, r.maxHangDepth);
29693
30658
  maxRows = Math.max(maxRows, r.maxHangRows);
@@ -29701,7 +30666,7 @@ function walk2(t, level2, perRow, orgChart, siblingCount) {
29701
30666
  };
29702
30667
  }
29703
30668
  return {
29704
- deepestFanLevel: level2,
30669
+ deepestFanLevel: level3,
29705
30670
  maxHangDepth: treeDepth(t) - 1,
29706
30671
  maxHangRows: countDescendants(t, orgChart),
29707
30672
  hangingColumns: 1
@@ -29740,20 +30705,20 @@ function computeHangShape(roots2, orgChart, perRow) {
29740
30705
  }
29741
30706
 
29742
30707
  // diagram/hierarchy/smartart-hierarchy-fan-aware-width.ts
29743
- function widthWalk(t, level2, perRow, orgChart, siblingCount, map) {
30708
+ function widthWalk(t, level3, perRow, orgChart, siblingCount, map) {
29744
30709
  const { normal } = partitionChildren(t, orgChart);
29745
30710
  let width;
29746
30711
  if (normal.length === 0) {
29747
30712
  width = 1;
29748
- } else if (level2 === 0) {
30713
+ } else if (level3 === 0) {
29749
30714
  width = 0;
29750
30715
  for (const child3 of normal) {
29751
- width += widthWalk(child3, level2 + 1, perRow, orgChart, normal.length, map);
30716
+ width += widthWalk(child3, level3 + 1, perRow, orgChart, normal.length, map);
29752
30717
  }
29753
30718
  } else if (fanContinues(t, perRow, orgChart, siblingCount, normal.length)) {
29754
30719
  width = 0;
29755
30720
  for (const child3 of normal) {
29756
- width += widthWalk(child3, level2 + 1, perRow, orgChart, void 0, map);
30721
+ width += widthWalk(child3, level3 + 1, perRow, orgChart, void 0, map);
29757
30722
  }
29758
30723
  } else {
29759
30724
  width = 1;
@@ -29937,33 +30902,33 @@ function arrangeFannedHangingForest(view, nodes, box, palette, style, elementId,
29937
30902
  }
29938
30903
 
29939
30904
  // diagram/hierarchy/smartart-hierarchy-hanging.ts
29940
- function placeAssistants(hc, x, parentBottom, assistants, options, cursor) {
30905
+ function placeAssistants(hc, x, parentBottom, assistants, options2, cursor) {
29941
30906
  for (const assistant of assistants) {
29942
30907
  const y = cursor.y;
29943
- cursor.y += hc.boxH + options.vGap;
30908
+ cursor.y += hc.boxH + options2.vGap;
29944
30909
  const width = hc.boxW * 0.85;
29945
30910
  const height = hc.boxH * 0.85;
29946
30911
  pushNode(hc, assistant.node, x, y, width, height);
29947
30912
  stubConnector(hc, assistant.node.id, x + hc.boxH / 2, parentBottom, x + width / 2, y);
29948
30913
  }
29949
30914
  }
29950
- function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
30915
+ function placeHangingTree(hc, t, x, options2, cursor, size, level3 = 0) {
29951
30916
  const y = cursor.y;
29952
30917
  const boxW = size?.w ?? hc.boxW;
29953
30918
  const boxH = size?.h ?? hc.boxH;
29954
- const align = options.columnAlign;
30919
+ const align = options2.columnAlign;
29955
30920
  const placeX = align ? align.side === "right" ? align.edgeX - boxW : align.edgeX : x;
29956
- cursor.y += boxH + options.vGap;
30921
+ cursor.y += boxH + options2.vGap;
29957
30922
  pushNode(hc, t.node, placeX, y, boxW, boxH);
29958
- const { assistants, normal } = partitionChildren(t, options.orgChart);
29959
- placeAssistants(hc, placeX, y + boxH, assistants, options, cursor);
30923
+ const { assistants, normal } = partitionChildren(t, options2.orgChart);
30924
+ placeAssistants(hc, placeX, y + boxH, assistants, options2, cursor);
29960
30925
  if (normal.length === 0) {
29961
30926
  return;
29962
30927
  }
29963
- if (options.foldDeeperGenerations && level2 >= 1) {
30928
+ if (options2.foldDeeperGenerations && level3 >= 1) {
29964
30929
  return;
29965
30930
  }
29966
- const childX = align ? placeX : options.direction === "left" ? x - options.indent : x + options.indent;
30931
+ const childX = align ? placeX : options2.direction === "left" ? x - options2.indent : x + options2.indent;
29967
30932
  for (const child3 of normal) {
29968
30933
  const childY = cursor.y;
29969
30934
  elbowConnector(
@@ -29975,13 +30940,13 @@ function placeHangingTree(hc, t, x, options, cursor, size, level2 = 0) {
29975
30940
  childY,
29976
30941
  child3.node.id
29977
30942
  );
29978
- placeHangingTree(hc, child3, childX, options, cursor, void 0, level2 + 1);
30943
+ placeHangingTree(hc, child3, childX, options2, cursor, void 0, level3 + 1);
29979
30944
  }
29980
30945
  }
29981
- function placeHangingForest(hc, roots2, startX, startY, options, rootSize) {
30946
+ function placeHangingForest(hc, roots2, startX, startY, options2, rootSize) {
29982
30947
  const cursor = { y: startY };
29983
30948
  for (const root of roots2) {
29984
- placeHangingTree(hc, root, startX, options, cursor, rootSize);
30949
+ placeHangingTree(hc, root, startX, options2, cursor, rootSize);
29985
30950
  }
29986
30951
  }
29987
30952
 
@@ -30048,17 +31013,17 @@ function fitHangingBox(view, algorithmNode, index, w, h2, rows, nodeCount, presL
30048
31013
  }
30049
31014
 
30050
31015
  // diagram/hierarchy/smartart-hierarchy-hanging-fold.ts
30051
- function countRows(t, level2, orgChart, fold) {
31016
+ function countRows(t, level3, orgChart, fold) {
30052
31017
  const { assistants, normal } = partitionChildren(t, orgChart);
30053
31018
  let count = 1 + assistants.length;
30054
31019
  if (normal.length === 0) {
30055
31020
  return count;
30056
31021
  }
30057
- if (fold && level2 >= 1) {
31022
+ if (fold && level3 >= 1) {
30058
31023
  return count;
30059
31024
  }
30060
31025
  for (const child3 of normal) {
30061
- count += countRows(child3, level2 + 1, orgChart, fold);
31026
+ count += countRows(child3, level3 + 1, orgChart, fold);
30062
31027
  }
30063
31028
  return count;
30064
31029
  }
@@ -30615,8 +31580,8 @@ function planFan(childCount, perRow, siblingCxs) {
30615
31580
  }
30616
31581
  return { columns: siblingCxs, overflow: childCount - siblingCxs.length };
30617
31582
  }
30618
- function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, options, placeAtFn) {
30619
- const fanCy = (level2 + 1) * cellH + cellH / 2;
31583
+ function placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAtFn) {
31584
+ const fanCy = (level3 + 1) * cellH + cellH / 2;
30620
31585
  const fanned = normal.slice(0, plan.columns.length);
30621
31586
  for (let i2 = 0; i2 < fanned.length; i2++) {
30622
31587
  const child3 = fanned[i2];
@@ -30630,15 +31595,15 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
30630
31595
  fanCy - hc.boxH / 2,
30631
31596
  child3.node.id
30632
31597
  );
30633
- placeAtFn(hc, child3, childCx, fanCy, 0, 1, level2 + 1, cellW, cellH, options);
31598
+ placeAtFn(hc, child3, childCx, fanCy, 0, 1, level3 + 1, cellW, cellH, options2);
30634
31599
  }
30635
- if (plan.overflow <= 0 || !options.hangingPlacer) {
31600
+ if (plan.overflow <= 0 || !options2.hangingPlacer) {
30636
31601
  return;
30637
31602
  }
30638
31603
  const remainder = normal.slice(plan.columns.length);
30639
31604
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
30640
31605
  const anchorX = plan.columns[0] - hc.boxW / 2 + columnOffset;
30641
- const anchorY = (level2 + 2) * cellH;
31606
+ const anchorY = (level3 + 2) * cellH;
30642
31607
  for (const child3 of remainder) {
30643
31608
  elbowConnector(
30644
31609
  hc,
@@ -30650,12 +31615,12 @@ function placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, opti
30650
31615
  child3.node.id
30651
31616
  );
30652
31617
  }
30653
- options.hangingPlacer(hc, remainder, anchorX, anchorY);
31618
+ options2.hangingPlacer(hc, remainder, anchorX, anchorY);
30654
31619
  }
30655
31620
 
30656
31621
  // diagram/hierarchy/smartart-hierarchy-standard-options.ts
30657
- function spanOf(t, options) {
30658
- return options.resolveSpan ? options.resolveSpan(t) : effectiveWidth(t, options.orgChart);
31622
+ function spanOf(t, options2) {
31623
+ return options2.resolveSpan ? options2.resolveSpan(t) : effectiveWidth(t, options2.orgChart);
30659
31624
  }
30660
31625
 
30661
31626
  // diagram/hierarchy/smartart-hierarchy-standard-rows.ts
@@ -30675,22 +31640,22 @@ function placeAssistantRow(hc, parentId, cx2, cy, assistants) {
30675
31640
  x += assistW + ASSISTANT_GAP;
30676
31641
  }
30677
31642
  }
30678
- function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW, cellH, options, placeChild) {
31643
+ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2, placeChild) {
30679
31644
  const siblingCxs = [];
30680
31645
  {
30681
31646
  let offset = xOffset;
30682
31647
  for (const child3 of normal) {
30683
- const childW = spanOf(child3, options);
31648
+ const childW = spanOf(child3, options2);
30684
31649
  siblingCxs.push((offset + childW / 2) * cellW);
30685
31650
  offset += childW;
30686
31651
  }
30687
31652
  }
30688
- const cascadeShift = options.cascadeOffsetX && level2 + 1 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
31653
+ const cascadeShift = options2.cascadeOffsetX && level3 + 1 >= options2.cascadeOffsetX.fromLevel ? options2.cascadeOffsetX.offsetPx : 0;
30689
31654
  let childOffset = xOffset;
30690
31655
  for (const child3 of normal) {
30691
- const childW = spanOf(child3, options);
31656
+ const childW = spanOf(child3, options2);
30692
31657
  const childCx = (childOffset + childW / 2) * cellW + cascadeShift;
30693
- const childCy = (level2 + 1) * cellH + cellH / 2;
31658
+ const childCy = (level3 + 1) * cellH + cellH / 2;
30694
31659
  elbowConnector(
30695
31660
  hc,
30696
31661
  parentId,
@@ -30707,10 +31672,10 @@ function placeFlatChildren(hc, parentId, normal, cx2, cy, xOffset, level2, cellW
30707
31672
  childCy,
30708
31673
  childOffset,
30709
31674
  childW,
30710
- level2 + 1,
31675
+ level3 + 1,
30711
31676
  cellW,
30712
31677
  cellH,
30713
- options,
31678
+ options2,
30714
31679
  siblingCxs
30715
31680
  );
30716
31681
  childOffset += childW;
@@ -30733,13 +31698,13 @@ function wrappedGroupSlotCount(group2, orgChart) {
30733
31698
  }
30734
31699
  return group2.members.reduce((sum, m) => sum + effectiveWidth(m, orgChart), 0);
30735
31700
  }
30736
- function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level2, cellW, cellH, options, placeAtFn) {
30737
- const groups = planWrappedGroups(normal, options.perRow, options.orgChart);
30738
- const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options.orgChart), 0);
31701
+ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2, placeAtFn) {
31702
+ const groups = planWrappedGroups(normal, options2.perRow, options2.orgChart);
31703
+ const totalSlots = groups.reduce((sum, g2) => sum + wrappedGroupSlotCount(g2, options2.orgChart), 0);
30739
31704
  const totalW = spanW * cellW;
30740
31705
  const leftX = xOffset * cellW;
30741
31706
  const unitW = totalW / Math.max(1, totalSlots);
30742
- const rowCy = (level2 + 1) * cellH + cellH / 2;
31707
+ const rowCy = (level3 + 1) * cellH + cellH / 2;
30743
31708
  let slot2 = 0;
30744
31709
  for (const group2 of groups) {
30745
31710
  slot2 = group2.fansAsRow ? placeRowFanGroup(
@@ -30752,10 +31717,10 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
30752
31717
  unitW,
30753
31718
  slot2,
30754
31719
  rowCy,
30755
- level2,
31720
+ level3,
30756
31721
  cellW,
30757
31722
  cellH,
30758
- options,
31723
+ options2,
30759
31724
  placeAtFn
30760
31725
  ) : placeColumnGroup(
30761
31726
  hc,
@@ -30769,25 +31734,25 @@ function placeWrappedChildren(hc, parentId, normal, cx2, cy, xOffset, spanW, lev
30769
31734
  rowCy,
30770
31735
  cellW,
30771
31736
  cellH,
30772
- level2,
30773
- options,
31737
+ level3,
31738
+ options2,
30774
31739
  placeAtFn
30775
31740
  );
30776
31741
  }
30777
31742
  }
30778
- function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level2, cellW, cellH, options, placeAtFn) {
31743
+ function placeRowFanGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, level3, cellW, cellH, options2, placeAtFn) {
30779
31744
  let cursor = slot2;
30780
31745
  for (const child3 of group2.members) {
30781
- const childW = effectiveWidth(child3, options.orgChart);
31746
+ const childW = effectiveWidth(child3, options2.orgChart);
30782
31747
  const childCx = leftX + unitW * (cursor + childW / 2);
30783
31748
  elbowConnector(hc, parentId, cx2, cy + hc.boxH / 2, childCx, rowCy - hc.boxH / 2, child3.node.id);
30784
31749
  const virtualOffset = childCx / cellW - childW / 2;
30785
- placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
31750
+ placeAtFn(hc, child3, childCx, rowCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
30786
31751
  cursor += childW;
30787
31752
  }
30788
31753
  return cursor;
30789
31754
  }
30790
- function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level2, options, placeAtFn) {
31755
+ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, rowCy, cellW, cellH, level3, options2, placeAtFn) {
30791
31756
  const groupCx = leftX + unitW * (slot2 + 0.5);
30792
31757
  const subRowH = cellH / group2.members.length;
30793
31758
  let fromId = parentId;
@@ -30797,9 +31762,9 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
30797
31762
  const child3 = group2.members[i2];
30798
31763
  const childCy = rowCy + subRowH * i2;
30799
31764
  elbowConnector(hc, fromId, fromX, fromY, groupCx, childCy - hc.boxH / 2, child3.node.id);
30800
- const childW = effectiveWidth(child3, options.orgChart);
31765
+ const childW = effectiveWidth(child3, options2.orgChart);
30801
31766
  const virtualOffset = groupCx / cellW - childW / 2;
30802
- placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level2 + 1, cellW, cellH, options);
31767
+ placeAtFn(hc, child3, groupCx, childCy, virtualOffset, childW, level3 + 1, cellW, cellH, options2);
30803
31768
  fromId = child3.node.id;
30804
31769
  fromX = groupCx;
30805
31770
  fromY = childCy + hc.boxH / 2;
@@ -30808,7 +31773,7 @@ function placeColumnGroup(hc, parentId, group2, cx2, cy, leftX, unitW, slot2, ro
30808
31773
  }
30809
31774
 
30810
31775
  // diagram/hierarchy/smartart-hierarchy-standard.ts
30811
- function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cellW, cellH, options) {
31776
+ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level3, cellW, cellH, options2) {
30812
31777
  placeFlatChildren(
30813
31778
  hc,
30814
31779
  parentId,
@@ -30816,14 +31781,14 @@ function placeFlatChildren2(hc, parentId, normal, cx2, cy, xOffset, level2, cell
30816
31781
  cx2,
30817
31782
  cy,
30818
31783
  xOffset,
30819
- level2,
31784
+ level3,
30820
31785
  cellW,
30821
31786
  cellH,
30822
- options,
31787
+ options2,
30823
31788
  placeAt
30824
31789
  );
30825
31790
  }
30826
- function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level2, cellW, cellH, options) {
31791
+ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2) {
30827
31792
  placeWrappedChildren(
30828
31793
  hc,
30829
31794
  parentId,
@@ -30832,35 +31797,35 @@ function placeWrappedChildren2(hc, parentId, normal, cx2, cy, xOffset, spanW, le
30832
31797
  cy,
30833
31798
  xOffset,
30834
31799
  spanW,
30835
- level2,
31800
+ level3,
30836
31801
  cellW,
30837
31802
  cellH,
30838
- options,
31803
+ options2,
30839
31804
  placeAt
30840
31805
  );
30841
31806
  }
30842
- function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options, siblingCxs) {
31807
+ function placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2, siblingCxs) {
30843
31808
  pushNode(hc, t.node, cx2 - hc.boxW / 2, cy - hc.boxH / 2);
30844
- const { assistants, normal } = partitionChildren(t, options.orgChart);
31809
+ const { assistants, normal } = partitionChildren(t, options2.orgChart);
30845
31810
  placeAssistantRow(hc, t.node.id, cx2, cy, assistants);
30846
31811
  if (normal.length === 0) {
30847
31812
  return;
30848
31813
  }
30849
- if (options.foldDeeperGenerations && level2 >= 1) {
31814
+ if (options2.foldDeeperGenerations && level3 >= 1) {
30850
31815
  return;
30851
31816
  }
30852
- if (options.hangingPlacer && level2 >= 1) {
30853
- const plan = planFan(normal.length, options.perRow, siblingCxs);
31817
+ if (options2.hangingPlacer && level3 >= 1) {
31818
+ const plan = planFan(normal.length, options2.perRow, siblingCxs);
30854
31819
  if (plan) {
30855
- placeFannedRow(hc, t, normal, plan, cx2, cy, level2, cellW, cellH, options, placeAt);
31820
+ placeFannedRow(hc, t, normal, plan, cx2, cy, level3, cellW, cellH, options2, placeAt);
30856
31821
  return;
30857
31822
  }
30858
31823
  const isSoloChainLink = !siblingCxs || siblingCxs.length === 1;
30859
31824
  if (isSoloChainLink && normal.length > 1 && spanW === normal.length) {
30860
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level2, cellW, cellH, options);
31825
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
30861
31826
  return;
30862
31827
  }
30863
- const anchorY = cy + hc.boxH / 2 + (options.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
31828
+ const anchorY = cy + hc.boxH / 2 + (options2.hangHeightRatio ?? HANG_HEIGHT_RATIO) * hc.boxH;
30864
31829
  const columnOffset = hc.boxW * HIER_TAIL_OFFSET_RATIO;
30865
31830
  for (const child3 of normal) {
30866
31831
  elbowConnector(
@@ -30873,10 +31838,10 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
30873
31838
  child3.node.id
30874
31839
  );
30875
31840
  }
30876
- options.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
31841
+ options2.hangingPlacer(hc, normal, cx2 - hc.boxW / 2 + columnOffset, anchorY);
30877
31842
  return;
30878
31843
  }
30879
- if (Number.isFinite(options.perRow) && normal.length > options.perRow) {
31844
+ if (Number.isFinite(options2.perRow) && normal.length > options2.perRow) {
30880
31845
  placeWrappedChildren2(
30881
31846
  hc,
30882
31847
  t.node.id,
@@ -30885,21 +31850,21 @@ function placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options,
30885
31850
  cy,
30886
31851
  xOffset,
30887
31852
  spanW,
30888
- level2,
31853
+ level3,
30889
31854
  cellW,
30890
31855
  cellH,
30891
- options
31856
+ options2
30892
31857
  );
30893
31858
  } else {
30894
- placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level2, cellW, cellH, options);
31859
+ placeFlatChildren2(hc, t.node.id, normal, cx2, cy, xOffset, level3, cellW, cellH, options2);
30895
31860
  }
30896
31861
  }
30897
- function placeStandardTree(hc, t, xOffset, level2, cellW, cellH, options) {
30898
- const spanW = spanOf(t, options);
30899
- const cascadeShift = options.cascadeOffsetX && level2 >= options.cascadeOffsetX.fromLevel ? options.cascadeOffsetX.offsetPx : 0;
31862
+ function placeStandardTree(hc, t, xOffset, level3, cellW, cellH, options2) {
31863
+ const spanW = spanOf(t, options2);
31864
+ const cascadeShift = options2.cascadeOffsetX && level3 >= options2.cascadeOffsetX.fromLevel ? options2.cascadeOffsetX.offsetPx : 0;
30900
31865
  const cx2 = (xOffset + spanW / 2) * cellW + cascadeShift;
30901
- const cy = level2 * cellH + cellH / 2;
30902
- placeAt(hc, t, cx2, cy, xOffset, spanW, level2, cellW, cellH, options);
31866
+ const cy = level3 * cellH + cellH / 2;
31867
+ placeAt(hc, t, cx2, cy, xOffset, spanW, level3, cellW, cellH, options2);
30903
31868
  }
30904
31869
 
30905
31870
  // diagram/hierarchy/smartart-hierarchy-tailed-placer.ts
@@ -32125,10 +33090,10 @@ function relativePartTarget(basePart, targetPart) {
32125
33090
  }
32126
33091
  return [...base.map(() => ".."), ...target].join("/");
32127
33092
  }
32128
- async function clonePartGraph(options) {
32129
- const { zip, sourcePart, targetPart, shouldClone } = options;
32130
- const sourceZip = options.sourceZip ?? zip;
32131
- const copies = options.copies ?? /* @__PURE__ */ new Map();
33093
+ async function clonePartGraph(options2) {
33094
+ const { zip, sourcePart, targetPart, shouldClone } = options2;
33095
+ const sourceZip = options2.sourceZip ?? zip;
33096
+ const copies = options2.copies ?? /* @__PURE__ */ new Map();
32132
33097
  copies.set(sourcePart, targetPart);
32133
33098
  const types = parseContentTypes(await sourceZip.file("[Content_Types].xml")?.async("string"));
32134
33099
  const reserved = new Set(Object.keys(zip.files));
@@ -35579,8 +36544,8 @@ function hashBytes(password, { algorithmName, saltValue, spinCount }, limits) {
35579
36544
  if (!digest || !salt || !isValidSpinCount(spinCount, limits.maxSpinCount)) return void 0;
35580
36545
  return spinPasswordHash(password, salt, spinCount ?? 0, digest);
35581
36546
  }
35582
- function hashPassword(password, options, limits = {}) {
35583
- const bytes = hashBytes(password, options, limits);
36547
+ function hashPassword(password, options2, limits = {}) {
36548
+ const bytes = hashBytes(password, options2, limits);
35584
36549
  return bytes && encodeBase64(bytes);
35585
36550
  }
35586
36551
  function verifyPasswordHash(password, hash, limits = {}) {
@@ -37000,8 +37965,8 @@ function routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight) {
37000
37965
  const path2 = aStarOrthogonal(nodes, start, end, inflated);
37001
37966
  return simplifyPath(path2);
37002
37967
  }
37003
- function routeConnector(options) {
37004
- const { start, end, obstacles, canvasWidth, canvasHeight, padding = PADDING_DEFAULT } = options;
37968
+ function routeConnector(options2) {
37969
+ const { start, end, obstacles, canvasWidth, canvasHeight, padding = PADDING_DEFAULT } = options2;
37005
37970
  return routeCore(start, end, obstacles, padding, canvasWidth, canvasHeight);
37006
37971
  }
37007
37972
  function waypointsToPathData(waypoints) {
@@ -42405,18 +43370,18 @@ function snapBox(box, size) {
42405
43370
  }
42406
43371
 
42407
43372
  // geometry/align-distribute.ts
42408
- function usesSlideReference(elementCount, options) {
42409
- if (!options?.slideSize) {
43373
+ function usesSlideReference(elementCount, options2) {
43374
+ if (!options2?.slideSize) {
42410
43375
  return false;
42411
43376
  }
42412
- return options.reference === "slide" || options.reference === void 0 && elementCount === 1;
43377
+ return options2.reference === "slide" || options2.reference === void 0 && elementCount === 1;
42413
43378
  }
42414
- function resolveAlignReferenceBox(elements2, options) {
43379
+ function resolveAlignReferenceBox(elements2, options2) {
42415
43380
  if (elements2.length === 0) {
42416
43381
  return null;
42417
43382
  }
42418
- if (usesSlideReference(elements2.length, options)) {
42419
- return { minX: 0, minY: 0, maxX: options.slideSize.width, maxY: options.slideSize.height };
43383
+ if (usesSlideReference(elements2.length, options2)) {
43384
+ return { minX: 0, minY: 0, maxX: options2.slideSize.width, maxY: options2.slideSize.height };
42420
43385
  }
42421
43386
  if (elements2.length < 2) {
42422
43387
  return null;
@@ -42428,9 +43393,9 @@ function resolveAlignReferenceBox(elements2, options) {
42428
43393
  maxY: Math.max(...elements2.map((e) => e.y + e.height))
42429
43394
  };
42430
43395
  }
42431
- function alignElements(elements2, edge, options) {
43396
+ function alignElements(elements2, edge, options2) {
42432
43397
  const result = /* @__PURE__ */ new Map();
42433
- const ref = resolveAlignReferenceBox(elements2, options);
43398
+ const ref = resolveAlignReferenceBox(elements2, options2);
42434
43399
  if (!ref) {
42435
43400
  return result;
42436
43401
  }
@@ -42461,7 +43426,7 @@ function alignElements(elements2, edge, options) {
42461
43426
  }
42462
43427
  return result;
42463
43428
  }
42464
- function distributeElements(elements2, axis, options) {
43429
+ function distributeElements(elements2, axis, options2) {
42465
43430
  const result = /* @__PURE__ */ new Map();
42466
43431
  const horizontal = axis === "horizontal";
42467
43432
  const start = (e) => horizontal ? e.x : e.y;
@@ -42470,11 +43435,11 @@ function distributeElements(elements2, axis, options) {
42470
43435
  const totalSize = sorted.reduce((sum, e) => sum + size(e), 0);
42471
43436
  let cursor;
42472
43437
  let gap;
42473
- if (usesSlideReference(elements2.length, options)) {
43438
+ if (usesSlideReference(elements2.length, options2)) {
42474
43439
  if (sorted.length === 0) {
42475
43440
  return result;
42476
43441
  }
42477
- const span = horizontal ? options.slideSize.width : options.slideSize.height;
43442
+ const span = horizontal ? options2.slideSize.width : options2.slideSize.height;
42478
43443
  gap = (span - totalSize) / (sorted.length + 1);
42479
43444
  cursor = gap;
42480
43445
  } else {
@@ -42508,11 +43473,11 @@ function onlyMoved(boxes, positions) {
42508
43473
  }
42509
43474
  return result;
42510
43475
  }
42511
- function computeAlign(boxes, mode, options) {
42512
- return onlyMoved(boxes, alignElements(boxes, mode, options));
43476
+ function computeAlign(boxes, mode, options2) {
43477
+ return onlyMoved(boxes, alignElements(boxes, mode, options2));
42513
43478
  }
42514
- function computeDistribute(boxes, mode, options) {
42515
- return onlyMoved(boxes, distributeElements(boxes, mode, options));
43479
+ function computeDistribute(boxes, mode, options2) {
43480
+ return onlyMoved(boxes, distributeElements(boxes, mode, options2));
42516
43481
  }
42517
43482
 
42518
43483
  // geometry/rotation-drag.ts
@@ -42520,7 +43485,7 @@ function computeRotation(center, pointer) {
42520
43485
  const deg = Math.atan2(pointer.x - center.x, center.y - pointer.y) * (180 / Math.PI);
42521
43486
  return (deg % 360 + 360) % 360;
42522
43487
  }
42523
- function createRotationDrag(center, startPointer, startRotation, options = {}) {
43488
+ function createRotationDrag(center, startPointer, startRotation, options2 = {}) {
42524
43489
  const bearing = (pointer) => pointer.x === center.x && pointer.y === center.y ? void 0 : computeRotation(center, pointer);
42525
43490
  let startAngle = bearing(startPointer);
42526
43491
  let rotation = startRotation;
@@ -42535,7 +43500,7 @@ function createRotationDrag(center, startPointer, startRotation, options = {}) {
42535
43500
  previousAngle = angle;
42536
43501
  return rotation;
42537
43502
  }
42538
- if (options.unwrapped) {
43503
+ if (options2.unwrapped) {
42539
43504
  const delta = (angle - (previousAngle ?? angle) + 540) % 360 - 180;
42540
43505
  rotation += delta;
42541
43506
  previousAngle = angle;
@@ -42702,8 +43667,8 @@ function layers(ids, forward, shortest) {
42702
43667
  }
42703
43668
  const result = [];
42704
43669
  for (const id of ids) {
42705
- const level2 = rank.get(id) ?? 0;
42706
- (result[level2] ??= []).push(id);
43670
+ const level3 = rank.get(id) ?? 0;
43671
+ (result[level3] ??= []).push(id);
42707
43672
  }
42708
43673
  return result.filter((layer) => layer.length);
42709
43674
  }
@@ -42833,10 +43798,10 @@ function placeGrid(ids, size, spacing3) {
42833
43798
  height: size.get(id).height
42834
43799
  }));
42835
43800
  }
42836
- function layoutGraph(nodes, edges, style, options = {}) {
43801
+ function layoutGraph(nodes, edges, style, options2 = {}) {
42837
43802
  if (!GRAPH_LAYOUT_STYLES.includes(style)) throw new Error("Unknown graph layout style.");
42838
- const spacing3 = options.spacing ?? 0.5;
42839
- const layerSpacing = options.layerSpacing ?? spacing3;
43803
+ const spacing3 = options2.spacing ?? 0.5;
43804
+ const layerSpacing = options2.layerSpacing ?? spacing3;
42840
43805
  if (![spacing3, layerSpacing].every((value) => Number.isFinite(value) && value >= 0))
42841
43806
  throw new Error("Layout spacing must be finite and not negative.");
42842
43807
  const size = /* @__PURE__ */ new Map();
@@ -42936,7 +43901,7 @@ function space2(groups, start, size, minimumGap) {
42936
43901
  });
42937
43902
  return result;
42938
43903
  }
42939
- function autoAlignBoxes(boxes, options = {}) {
43904
+ function autoAlignBoxes(boxes, options2 = {}) {
42940
43905
  if (new Set(boxes.map((box) => box.id)).size !== boxes.length)
42941
43906
  throw new Error("Auto align box IDs must be unique.");
42942
43907
  if (!boxes.every(
@@ -42945,9 +43910,9 @@ function autoAlignBoxes(boxes, options = {}) {
42945
43910
  throw new Error("Auto align boxes must be finite.");
42946
43911
  const result = /* @__PURE__ */ new Map();
42947
43912
  if (!boxes.length) return result;
42948
- const toleranceX = options.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
42949
- const toleranceY = options.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
42950
- const minimumGap = options.minimumGap ?? 0;
43913
+ const toleranceX = options2.tolerance?.x ?? median(boxes.map((box) => box.width)) / 2;
43914
+ const toleranceY = options2.tolerance?.y ?? median(boxes.map((box) => box.height)) / 2;
43915
+ const minimumGap = options2.minimumGap ?? 0;
42951
43916
  const rows = clusters(boxes, (box) => box.y + box.height / 2, toleranceY);
42952
43917
  const columns = clusters(boxes, (box) => box.x + box.width / 2, toleranceX);
42953
43918
  const ys = space2(