ooxml-core 1.18.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 (82) hide show
  1. package/dist/{PptxHandler-X6AO6LKJ.mjs → PptxHandler-5GBBVJCR.mjs} +2 -2
  2. package/dist/{PptxHandler-5X4VOWAO.mjs → PptxHandler-H43MAMTO.mjs} +1 -1
  3. package/dist/{PptxHandler-4AHDZDA5.cjs → PptxHandler-ZHPGBSAF.cjs} +2 -2
  4. package/dist/{PresentationBuilder-UY3S4YE2.mjs → PresentationBuilder-7ZSUKCX5.mjs} +1 -1
  5. package/dist/{PresentationBuilder-LRX55PXA.mjs → PresentationBuilder-IJW42L3R.mjs} +2 -2
  6. package/dist/{PresentationBuilder-MJB4LIFS.cjs → PresentationBuilder-O4H4MMWB.cjs} +4 -4
  7. package/dist/automation/index.cjs +535 -266
  8. package/dist/automation/index.mjs +535 -266
  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/index.cjs +815 -165
  18. package/dist/chart/index.d.ts +6 -0
  19. package/dist/chart/index.d.ts.map +1 -1
  20. package/dist/chart/index.mjs +795 -166
  21. package/dist/chart/line-dash.d.ts +2 -0
  22. package/dist/chart/line-dash.d.ts.map +1 -0
  23. package/dist/chart/marker-shape.d.ts +70 -0
  24. package/dist/chart/marker-shape.d.ts.map +1 -0
  25. package/dist/chart/render/chart-svg-axes.d.ts +9 -0
  26. package/dist/chart/render/chart-svg-axes.d.ts.map +1 -0
  27. package/dist/chart/render/chart-svg-cartesian.d.ts.map +1 -1
  28. package/dist/chart/render/chart-svg-markers.d.ts +6 -0
  29. package/dist/chart/render/chart-svg-markers.d.ts.map +1 -0
  30. package/dist/chart/render/chart-svg-radial.d.ts.map +1 -1
  31. package/dist/chart/render/chart-svg-xy.d.ts.map +1 -1
  32. package/dist/chart/render/chart-view-axes.d.ts +30 -0
  33. package/dist/chart/render/chart-view-axes.d.ts.map +1 -0
  34. package/dist/chart/render/chart-view-markers.d.ts +27 -0
  35. package/dist/chart/render/chart-view-markers.d.ts.map +1 -0
  36. package/dist/chart/render/chart-view-series.d.ts.map +1 -1
  37. package/dist/chart/render/chart-view.d.ts +4 -1
  38. package/dist/chart/render/chart-view.d.ts.map +1 -1
  39. package/dist/chart/render/index.d.ts +2 -0
  40. package/dist/chart/render/index.d.ts.map +1 -1
  41. package/dist/chart/render/summary-from-space.d.ts.map +1 -1
  42. package/dist/chart/render/summary.d.ts +6 -1
  43. package/dist/chart/render/summary.d.ts.map +1 -1
  44. package/dist/{chunk-7NWQUCGX.mjs → chunk-3XFPCZKB.mjs} +1 -1
  45. package/dist/{chunk-Z5Y53IZD.mjs → chunk-75GLSRZE.mjs} +4 -4
  46. package/dist/{chunk-LT7RCEHY.mjs → chunk-BIVNVDAH.mjs} +1 -1
  47. package/dist/{chunk-I5ZE3VLI.mjs → chunk-QBJRB6WW.mjs} +1 -1
  48. package/dist/{chunk-U7IDT6VT.mjs → chunk-RUZEMWDI.mjs} +1 -1
  49. package/dist/docx/index.cjs +695 -168
  50. package/dist/docx/index.mjs +695 -168
  51. package/dist/docx/layout/index.cjs +697 -170
  52. package/dist/docx/layout/index.mjs +697 -170
  53. package/dist/docx/ui/index.cjs +704 -177
  54. package/dist/docx/ui/index.mjs +704 -177
  55. package/dist/index.cjs +912 -262
  56. package/dist/index.mjs +912 -262
  57. package/dist/pptx/automation/index.cjs +54 -0
  58. package/dist/pptx/automation/index.mjs +5 -5
  59. package/dist/pptx/cli/index.cjs +54 -0
  60. package/dist/pptx/cli/index.mjs +4 -4
  61. package/dist/pptx/converter/index.mjs +2 -2
  62. package/dist/pptx/editor/render/slide-operations.cjs +1 -1
  63. package/dist/pptx/editor/render/slide-operations.mjs +1 -1
  64. package/dist/pptx/index.cjs +54 -0
  65. package/dist/pptx/index.mjs +5 -5
  66. package/dist/teams/index.cjs +71 -5
  67. package/dist/teams/index.mjs +71 -5
  68. package/dist/visio/index.cjs +483 -214
  69. package/dist/visio/index.mjs +483 -214
  70. package/dist/visio/ui/index.cjs +504 -235
  71. package/dist/visio/ui/index.mjs +504 -235
  72. package/dist/xlsx/edit/chart-colors.d.ts.map +1 -1
  73. package/dist/xlsx/index.cjs +818 -281
  74. package/dist/xlsx/index.mjs +818 -281
  75. package/dist/xlsx/load/index.cjs +58 -5
  76. package/dist/xlsx/load/index.mjs +58 -5
  77. package/dist/xlsx/read/chart.d.ts.map +1 -1
  78. package/dist/xlsx/ui/index.cjs +835 -298
  79. package/dist/xlsx/ui/index.mjs +835 -298
  80. package/package.json +1 -1
  81. /package/dist/{chunk-C363NN2C.mjs → chunk-H6TNNXJK.mjs} +0 -0
  82. /package/dist/{chunk-R4BCOQHB.cjs → chunk-MHMVD23Y.cjs} +0 -0
@@ -273,8 +273,8 @@ function createWorksheet(name, sheetId) {
273
273
  preserved: /* @__PURE__ */ new Map()
274
274
  };
275
275
  }
276
- function createWorkbook(options = {}) {
277
- const names = options.sheets?.length ? options.sheets : ["Sheet1"];
276
+ function createWorkbook(options2 = {}) {
277
+ const names = options2.sheets?.length ? options2.sheets : ["Sheet1"];
278
278
  return {
279
279
  sheets: names.map((name, index3) => createWorksheet(name, index3 + 1)),
280
280
  styles: [defaultCellStyle()],
@@ -1675,15 +1675,15 @@ function renderAbs(v, section, generalWidth) {
1675
1675
  }
1676
1676
  return { text: text4, zero: general === "0" };
1677
1677
  }
1678
- function hashFill(options) {
1679
- const width = options.width ?? 0;
1680
- const one2 = options.measure ? options.measure("#") : 1;
1678
+ function hashFill(options2) {
1679
+ const width = options2.width ?? 0;
1680
+ const one2 = options2.measure ? options2.measure("#") : 1;
1681
1681
  return "#".repeat(Math.max(1, Math.floor(one2 > 0 ? width / one2 : width)));
1682
1682
  }
1683
- function fitNumber(value2, format, options) {
1684
- const date1904 = options.date1904 ?? false;
1685
- const width = options.width ?? 0;
1686
- const fits = (text4) => (options.measure ? options.measure(text4) : text4.length) <= width;
1683
+ function fitNumber(value2, format, options2) {
1684
+ const date1904 = options2.date1904 ?? false;
1685
+ const width = options2.width ?? 0;
1686
+ const fits = (text4) => (options2.measure ? options2.measure(text4) : text4.length) <= width;
1687
1687
  const first2 = formatNumber(value2, format, date1904);
1688
1688
  if (fits(first2.text) || first2.text === OVERFLOW_TEXT) return first2;
1689
1689
  const choice = chooseSection(compileFormat(format), value2);
@@ -1694,7 +1694,7 @@ function fitNumber(value2, format, options) {
1694
1694
  if (fits(next.text)) return next;
1695
1695
  }
1696
1696
  }
1697
- const fill = hashFill(options);
1697
+ const fill = hashFill(options2);
1698
1698
  return first2.color ? { text: fill, color: first2.color } : { text: fill };
1699
1699
  }
1700
1700
  function formatNumber(value2, format, date1904, generalWidth) {
@@ -1716,13 +1716,13 @@ function formatNumber(value2, format, date1904, generalWidth) {
1716
1716
  const minus = value2 < 0 && !abs2 && !zero;
1717
1717
  return result(minus ? `-${text4}` : text4, section);
1718
1718
  }
1719
- function formatValue(value2, format, options = {}) {
1719
+ function formatValue(value2, format, options2 = {}) {
1720
1720
  if (value2 === null) return { text: "" };
1721
1721
  if (typeof value2 === "boolean") return { text: value2 ? "TRUE" : "FALSE" };
1722
1722
  if (typeof value2 === "string") return formatText(value2, compileFormat(format).text);
1723
1723
  if (isCellError(value2)) return { text: value2.error };
1724
- if (options.width !== void 0) return fitNumber(value2, format, options);
1725
- return formatNumber(value2, format, options.date1904 ?? false);
1724
+ if (options2.width !== void 0) return fitNumber(value2, format, options2);
1725
+ return formatNumber(value2, format, options2.date1904 ?? false);
1726
1726
  }
1727
1727
  function isDateFormat(format) {
1728
1728
  return compileFormat(format).isDate;
@@ -1933,7 +1933,7 @@ function parseFractionInput(text4) {
1933
1933
  numFmt: den < 10 ? "# ?/?" : "# ??/??"
1934
1934
  };
1935
1935
  }
1936
- function parseCellInput(text4, options = {}) {
1936
+ function parseCellInput(text4, options2 = {}) {
1937
1937
  if (text4 === "") return { value: null };
1938
1938
  if (text4.startsWith("=") && text4.length > 1) return { value: null, formula: text4.slice(1) };
1939
1939
  if (text4.startsWith("'")) return { value: text4.slice(1) };
@@ -1944,7 +1944,7 @@ function parseCellInput(text4, options = {}) {
1944
1944
  if (upper2 === "TRUE" || upper2 === "FALSE") return { value: upper2 === "TRUE" };
1945
1945
  if (isErrorCode(upper2)) return { value: cellError(upper2) };
1946
1946
  }
1947
- const parsed = parseNumberInput(trimmed2) ?? parseFractionInput(trimmed2) ?? parseDateTimeInput(trimmed2, options.date1904 ?? false);
1947
+ const parsed = parseNumberInput(trimmed2) ?? parseFractionInput(trimmed2) ?? parseDateTimeInput(trimmed2, options2.date1904 ?? false);
1948
1948
  if (!parsed) return { value: text4 };
1949
1949
  return parsed.numFmt ? { value: parsed.value, numFmt: parsed.numFmt } : { value: parsed.value };
1950
1950
  }
@@ -3495,7 +3495,7 @@ var int = (value2) => Math.trunc(num(value2));
3495
3495
  var optNum = (args, i2, fallback) => i2 < args.length ? num(args[i2]) : fallback;
3496
3496
  var optBool = (args, i2, fallback) => i2 < args.length ? bool(args[i2]) : fallback;
3497
3497
  var omitted = (args, i2) => i2 >= args.length || args[i2] === null;
3498
- function collectNumbers(ctx, args, options = {}) {
3498
+ function collectNumbers(ctx, args, options2 = {}) {
3499
3499
  const out = [];
3500
3500
  for (const arg of args) {
3501
3501
  ctx.forEach(arg, (value2, kind) => {
@@ -3504,7 +3504,7 @@ function collectNumbers(ctx, args, options = {}) {
3504
3504
  return;
3505
3505
  }
3506
3506
  if (isError(value2)) {
3507
- if (options.ignoreErrors) return;
3507
+ if (options2.ignoreErrors) return;
3508
3508
  throw new ErrorSignal(value2);
3509
3509
  }
3510
3510
  if (kind === "direct") {
@@ -3512,7 +3512,7 @@ function collectNumbers(ctx, args, options = {}) {
3512
3512
  else out.push(toNumber(value2));
3513
3513
  return;
3514
3514
  }
3515
- if (options.includeAll) {
3515
+ if (options2.includeAll) {
3516
3516
  if (typeof value2 === "boolean") out.push(value2 ? 1 : 0);
3517
3517
  else if (typeof value2 === "string") out.push(0);
3518
3518
  }
@@ -8477,11 +8477,11 @@ var SUM_FUNCTIONS = [
8477
8477
  255,
8478
8478
  (args, ctx) => {
8479
8479
  const code = int(args[0]);
8480
- const options = int(args[1]);
8481
- if (code < 1 || code > 19 || options < 0 || options > 7) fail(ERR.VALUE);
8482
- const skipNested = options <= 3;
8483
- const skipHidden = options === 1 || options === 3 || options === 5 || options === 7;
8484
- const skipErrors = options === 2 || options === 3 || options === 6 || options === 7;
8480
+ const options2 = int(args[1]);
8481
+ if (code < 1 || code > 19 || options2 < 0 || options2 > 7) fail(ERR.VALUE);
8482
+ const skipNested = options2 <= 3;
8483
+ const skipHidden = options2 === 1 || options2 === 3 || options2 === 5 || options2 === 7;
8484
+ const skipErrors = options2 === 2 || options2 === 3 || options2 === 6 || options2 === 7;
8485
8485
  if (code >= 14) {
8486
8486
  if (args.length !== 4) fail(ERR.VALUE);
8487
8487
  const values2 = subtotalValues(ctx, [args[2] ?? null], skipHidden, skipErrors, skipNested);
@@ -11768,11 +11768,11 @@ function checkXmlLimits(xml, label2, limits = {}) {
11768
11768
  throw new Error(`${label2} XML exceeds the nesting depth limit of ${maxDepth}`);
11769
11769
  }
11770
11770
  }
11771
- function parseXml(xml, options = {}) {
11772
- const label2 = options.label ?? "OOXML";
11771
+ function parseXml(xml, options2 = {}) {
11772
+ const label2 = options2.label ?? "OOXML";
11773
11773
  if (/<!DOCTYPE|<!ENTITY/i.test(xml))
11774
11774
  throw new Error(`${label2} XML with DTD or entity declarations is not supported`);
11775
- checkXmlLimits(xml, label2, options.limits);
11775
+ checkXmlLimits(xml, label2, options2.limits);
11776
11776
  let parseError = "";
11777
11777
  let parsed;
11778
11778
  try {
@@ -11986,7 +11986,7 @@ var pivotColumnFields = (pivot) => [
11986
11986
  // i18n/locale.ts
11987
11987
  var SUPPORTED_OFFICE_LOCALES = ["en", "fr", "de", "es", "zh-CN"];
11988
11988
  var DEFAULT_REJECTED_SUBTAGS = ["hant", "tw", "hk", "mo"];
11989
- function normalizeLocale(input, supported, fallback, options = {}) {
11989
+ function normalizeLocale(input, supported, fallback, options2 = {}) {
11990
11990
  const parts = (input ?? "").trim().toLowerCase().split(/[-_]/).filter(Boolean);
11991
11991
  const language = parts[0];
11992
11992
  if (!language) return fallback;
@@ -11995,7 +11995,7 @@ function normalizeLocale(input, supported, fallback, options = {}) {
11995
11995
  if (exact) return exact;
11996
11996
  const base = find3(language);
11997
11997
  if (base) return base;
11998
- const rejected = options.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
11998
+ const rejected = options2.rejectedSubtags ?? DEFAULT_REJECTED_SUBTAGS;
11999
11999
  if (parts.slice(1).some((part) => rejected.includes(part))) return fallback;
12000
12000
  return supported.find((item) => item.toLowerCase().split("-")[0] === language && item.includes("-")) ?? fallback;
12001
12001
  }
@@ -12195,8 +12195,8 @@ function trimmedCaptions(caps) {
12195
12195
  }
12196
12196
  return Object.keys(out).length ? out : void 0;
12197
12197
  }
12198
- function authoredCaptions(options) {
12199
- const own = options.captions ?? localizedPivotCaptions(options.locale);
12198
+ function authoredCaptions(options2) {
12199
+ const own = options2.captions ?? localizedPivotCaptions(options2.locale);
12200
12200
  return own && Object.keys(own).length ? structuredClone(own) : void 0;
12201
12201
  }
12202
12202
 
@@ -14718,9 +14718,9 @@ var Deferred = class {
14718
14718
  };
14719
14719
  var MAX_NESTED_COMPUTE = 40;
14720
14720
  var EngineHost = class {
14721
- constructor(workbook, options) {
14721
+ constructor(workbook, options2) {
14722
14722
  this.workbook = workbook;
14723
- this.options = options;
14723
+ this.options = options2;
14724
14724
  }
14725
14725
  workbook;
14726
14726
  options;
@@ -15817,8 +15817,8 @@ var Engine = class extends EngineStructure {
15817
15817
  return [...this.cycles].map(({ sheet, row: row2, col }) => ({ sheet, row: row2, col }));
15818
15818
  }
15819
15819
  };
15820
- function createCalcEngine(workbook, options = {}) {
15821
- return new Engine(workbook, options);
15820
+ function createCalcEngine(workbook, options2 = {}) {
15821
+ return new Engine(workbook, options2);
15822
15822
  }
15823
15823
 
15824
15824
  // xlsx/formula/ref-text.ts
@@ -19353,8 +19353,8 @@ function rgbToHsl(r, g2, b) {
19353
19353
  }
19354
19354
  return { h: h2, s: clampUnitInterval(s), l: clampUnitInterval(l) };
19355
19355
  }
19356
- function hslToRgb(h2, s, l, roundChannel = Math.round, options) {
19357
- const sC = options?.clampSaturation === false ? s : clampUnitInterval(s);
19356
+ function hslToRgb(h2, s, l, roundChannel = Math.round, options2) {
19357
+ const sC = options2?.clampSaturation === false ? s : clampUnitInterval(s);
19358
19358
  const lC = clampUnitInterval(l);
19359
19359
  const hN = (h2 % 360 + 360) % 360;
19360
19360
  const c2 = (1 - Math.abs(2 * lC - 1)) * sC;
@@ -19852,13 +19852,13 @@ var APPLIED = /* @__PURE__ */ new Set([
19852
19852
  "lumMod",
19853
19853
  "lumOff"
19854
19854
  ]);
19855
- function resolveDrawingColor(color, theme2, options) {
19855
+ function resolveDrawingColor(color, theme2, options2) {
19856
19856
  const base = baseHex(color, theme2);
19857
19857
  const rgb2 = base ? hexToRgbChannels(base) : null;
19858
19858
  if (!rgb2) return void 0;
19859
- if (options?.transformOrder === "document") {
19859
+ if (options2?.transformOrder === "document") {
19860
19860
  const value2 = orderedColorTransforms(rgb2, color.transforms);
19861
- const round4 = options.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
19861
+ const round4 = options2.hslRounding === "halfDown" ? (channel) => Math.ceil(channel - 0.5) : Math.round;
19862
19862
  return {
19863
19863
  hex: `#${toHex(round4(value2.r))}${toHex(round4(value2.g))}${toHex(round4(value2.b))}`,
19864
19864
  alpha: value2.alpha,
@@ -19909,7 +19909,7 @@ function resolveDrawingColor(color, theme2, options) {
19909
19909
  if (lumMod !== void 0) hsl.l = clampUnitInterval(hsl.l * lumMod);
19910
19910
  const lumOff = parseDrawingFraction(find3("lumOff"));
19911
19911
  if (lumOff !== void 0) hsl.l = clampUnitInterval(hsl.l + lumOff);
19912
- const round4 = options?.hslRounding === "halfDown" ? (value2) => Math.ceil(value2 - 0.5) : Math.round;
19912
+ const round4 = options2?.hslRounding === "halfDown" ? (value2) => Math.ceil(value2 - 0.5) : Math.round;
19913
19913
  ({ r, g: g2, b } = hslToRgb(hsl.h, hsl.s, hsl.l, round4));
19914
19914
  }
19915
19915
  let alpha = parseDrawingPercent(find3("alpha")) ?? 1;
@@ -21655,7 +21655,7 @@ function resolveInnerRect(fillToRect, focalPoint) {
21655
21655
  function lerpEdge(inner2, outer, t) {
21656
21656
  return inner2 + (outer - inner2) * t;
21657
21657
  }
21658
- function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
21658
+ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options2) {
21659
21659
  if (stops.length === 0) {
21660
21660
  return '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"/>';
21661
21661
  }
@@ -21664,7 +21664,7 @@ function buildRectPathGradientSvg(stops, focalPoint, fillToRect, options) {
21664
21664
  const rects = [];
21665
21665
  const alphaRects = [];
21666
21666
  const masked = sorted2.some((stop) => (stop.opacity ?? 1) < 1);
21667
- const bands = options?.bands;
21667
+ const bands = options2?.bands;
21668
21668
  if (!Number.isInteger(bands) || bands < 1) throw new RangeError("Invalid gradient band count");
21669
21669
  for (let i2 = bands; i2 >= 0; i2 -= 1) {
21670
21670
  const t = i2 / bands;
@@ -23403,6 +23403,191 @@ function parseChartSpace(source2) {
23403
23403
  return { chartSpace, issues: context.issues };
23404
23404
  }
23405
23405
 
23406
+ // chart/marker-shape.ts
23407
+ var CHART_PX_PER_PT = 4 / 3;
23408
+ var DEFAULT_MARKER_OUTLINE_PT = 0.75;
23409
+ var AUTOMATIC_MARKER_CYCLE = [
23410
+ "diamond",
23411
+ "square",
23412
+ "triangle",
23413
+ "x",
23414
+ "star",
23415
+ "circle",
23416
+ "plus",
23417
+ "dot",
23418
+ "dash"
23419
+ ];
23420
+ function automaticMarkerSymbol(seriesIdx) {
23421
+ const length = AUTOMATIC_MARKER_CYCLE.length;
23422
+ const normalized = (Math.trunc(seriesIdx) % length + length) % length;
23423
+ return AUTOMATIC_MARKER_CYCLE[Number.isFinite(normalized) ? normalized : 0];
23424
+ }
23425
+ function markerRadius(size, defaultRadius) {
23426
+ if (size === void 0 || !Number.isFinite(size) || size <= 0) {
23427
+ return defaultRadius;
23428
+ }
23429
+ return size / 2;
23430
+ }
23431
+ function polygonPoints(vertices) {
23432
+ return vertices.map(([x, y]) => `${x.toFixed(2)},${y.toFixed(2)}`).join(" ");
23433
+ }
23434
+ function starVertices(cx2, cy, r) {
23435
+ const inner2 = r * 0.5;
23436
+ const out = [];
23437
+ for (let i2 = 0; i2 < 10; i2++) {
23438
+ const radius = i2 % 2 === 0 ? r : inner2;
23439
+ const angle = -Math.PI / 2 + Math.PI * i2 / 5;
23440
+ out.push([cx2 + radius * Math.cos(angle), cy + radius * Math.sin(angle)]);
23441
+ }
23442
+ return out;
23443
+ }
23444
+ function rectPolygon(x, y, w, h2) {
23445
+ return polygonPoints([
23446
+ [x, y],
23447
+ [x + w, y],
23448
+ [x + w, y + h2],
23449
+ [x, y + h2]
23450
+ ]);
23451
+ }
23452
+ function buildMarkerPrimitive(input) {
23453
+ const { symbol, cx: cx2, cy, fill } = input;
23454
+ const part = input.part === void 0 ? {} : { part: input.part };
23455
+ if (symbol === "none") {
23456
+ return null;
23457
+ }
23458
+ const r = markerRadius(input.size, input.defaultRadius);
23459
+ const outline = input.stroke ? {
23460
+ stroke: input.stroke,
23461
+ strokeWidth: input.strokeWidth ?? DEFAULT_MARKER_OUTLINE_PT * CHART_PX_PER_PT
23462
+ } : void 0;
23463
+ const polygonStroke = outline ?? { stroke: fill, strokeWidth: 0 };
23464
+ const lineStroke = input.stroke ?? fill;
23465
+ switch (symbol) {
23466
+ case "square":
23467
+ case "dash": {
23468
+ const h2 = symbol === "dash" ? r * 0.64 : r * 2;
23469
+ const y = cy - h2 / 2;
23470
+ if (outline) {
23471
+ return {
23472
+ kind: "polygon",
23473
+ points: rectPolygon(cx2 - r, y, r * 2, h2),
23474
+ fill,
23475
+ ...outline,
23476
+ ...part
23477
+ };
23478
+ }
23479
+ return { kind: "rect", x: cx2 - r, y, w: r * 2, h: h2, fill, ...part };
23480
+ }
23481
+ case "diamond":
23482
+ return {
23483
+ kind: "polygon",
23484
+ points: polygonPoints([
23485
+ [cx2, cy - r],
23486
+ [cx2 + r, cy],
23487
+ [cx2, cy + r],
23488
+ [cx2 - r, cy]
23489
+ ]),
23490
+ fill,
23491
+ ...polygonStroke,
23492
+ ...part
23493
+ };
23494
+ case "triangle":
23495
+ return {
23496
+ kind: "polygon",
23497
+ points: polygonPoints([
23498
+ [cx2, cy - r],
23499
+ [cx2 + r * 0.9, cy + r * 0.75],
23500
+ [cx2 - r * 0.9, cy + r * 0.75]
23501
+ ]),
23502
+ fill,
23503
+ ...polygonStroke,
23504
+ ...part
23505
+ };
23506
+ case "star":
23507
+ return {
23508
+ kind: "polygon",
23509
+ points: polygonPoints(starVertices(cx2, cy, r)),
23510
+ fill,
23511
+ ...polygonStroke,
23512
+ ...part
23513
+ };
23514
+ case "plus":
23515
+ return {
23516
+ kind: "path",
23517
+ 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)}`,
23518
+ fill: "none",
23519
+ stroke: lineStroke,
23520
+ strokeWidth: Math.max(1, r * 0.4),
23521
+ ...part
23522
+ };
23523
+ case "x":
23524
+ return {
23525
+ kind: "path",
23526
+ 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)}`,
23527
+ fill: "none",
23528
+ stroke: lineStroke,
23529
+ strokeWidth: Math.max(1, r * 0.4),
23530
+ ...part
23531
+ };
23532
+ case "dot":
23533
+ return { kind: "circle", cx: cx2, cy, r: Math.max(r * 0.6, 1), fill, ...part, ...outline };
23534
+ default:
23535
+ return { kind: "circle", cx: cx2, cy, r, fill, ...part, ...outline };
23536
+ }
23537
+ }
23538
+
23539
+ // chart/render/chart-view-markers.ts
23540
+ function summaryMarkers(source2, group2, seriesPosition) {
23541
+ if (!["line", "scatter", "radar"].includes(group2.kind)) return {};
23542
+ const enabled = group2.kind === "line" ? group2.marker === true : group2.kind === "radar" ? group2.radarStyle === "marker" : !["line", "smooth", "none"].includes(group2.scatterStyle ?? "marker");
23543
+ const symbol = source2.marker?.symbol;
23544
+ const marker3 = {
23545
+ ...source2.marker,
23546
+ symbol: symbol && symbol !== "auto" ? symbol : source2.marker || enabled ? automaticMarkerSymbol(source2.index ?? seriesPosition) : "none"
23547
+ };
23548
+ const pointMarkers = {};
23549
+ for (const point of source2.dataPoints) {
23550
+ if (point.index === void 0 || !point.marker) continue;
23551
+ const override = point.marker;
23552
+ pointMarkers[point.index] = {
23553
+ ...marker3,
23554
+ ...override,
23555
+ ...override.symbol === "auto" || !source2.marker && override.symbol === void 0 ? { symbol: automaticMarkerSymbol(source2.index ?? seriesPosition) } : {},
23556
+ ...marker3.spPr || override.spPr ? {
23557
+ spPr: {
23558
+ ...marker3.spPr,
23559
+ ...override.spPr,
23560
+ ...marker3.spPr?.line || override.spPr?.line ? { line: { ...marker3.spPr?.line, ...override.spPr?.line } } : {}
23561
+ }
23562
+ } : {}
23563
+ };
23564
+ }
23565
+ return { marker: marker3, ...Object.keys(pointMarkers).length ? { pointMarkers } : {} };
23566
+ }
23567
+ function seriesMarkerViews(source2, drawingColor) {
23568
+ const fillColor = (fill) => fill?.kind === "none" ? "none" : fill?.kind === "solid" ? drawingColor(fill.color) : void 0;
23569
+ const resolve3 = (marker3) => {
23570
+ const fill = fillColor(marker3.spPr?.fill);
23571
+ const stroke = fillColor(marker3.spPr?.line?.fill);
23572
+ const width = marker3.spPr?.line?.widthEmu;
23573
+ return {
23574
+ ...marker3.symbol !== void 0 ? { symbol: marker3.symbol } : {},
23575
+ ...marker3.size !== void 0 ? { size: marker3.size } : {},
23576
+ ...fill !== void 0 ? { fill } : {},
23577
+ ...stroke !== void 0 ? { stroke } : {},
23578
+ ...width !== void 0 ? { strokeWidth: width / 9525 } : {}
23579
+ };
23580
+ };
23581
+ return {
23582
+ ...source2.marker ? { marker: resolve3(source2.marker) } : {},
23583
+ ...source2.pointMarkers ? {
23584
+ pointMarkers: Object.fromEntries(
23585
+ Object.entries(source2.pointMarkers).map(([i2, marker3]) => [i2, resolve3(marker3)])
23586
+ )
23587
+ } : {}
23588
+ };
23589
+ }
23590
+
23406
23591
  // chart/render/summary-analysis.ts
23407
23592
  function summaryTrendline(source2) {
23408
23593
  const kind = chartTrendlineKind(source2.trendlineType);
@@ -23677,6 +23862,9 @@ function formatChartNumberWithColor(value2, formatCode) {
23677
23862
  return void 0;
23678
23863
  }
23679
23864
  }
23865
+ function formatChartNumber(value2, formatCode) {
23866
+ return formatChartNumberWithColor(value2, formatCode)?.text;
23867
+ }
23680
23868
 
23681
23869
  // chart/data-label-text.ts
23682
23870
  var DATA_LABEL_SEPARATOR = ", ";
@@ -23725,17 +23913,17 @@ function composeDataLabelText(input) {
23725
23913
  }
23726
23914
 
23727
23915
  // chart/render/summary-labels.ts
23728
- function level(options, custom) {
23916
+ function level(options2, custom) {
23729
23917
  const out = {};
23730
- if (options.deleted !== void 0) out.deleted = options.deleted;
23731
- if (options.showValue !== void 0) out.showValue = options.showValue;
23732
- if (options.showCategoryName !== void 0) out.showCategory = options.showCategoryName;
23733
- if (options.showSeriesName !== void 0) out.showSeriesName = options.showSeriesName;
23734
- if (options.showPercent !== void 0) out.showPercent = options.showPercent;
23735
- if (options.showBubbleSize !== void 0) out.showBubbleSize = options.showBubbleSize;
23736
- if (options.separator !== void 0) out.separator = options.separator;
23737
- if (options.position) out.position = options.position;
23738
- if (options.numberFormat?.formatCode) out.numberFormat = options.numberFormat.formatCode;
23918
+ if (options2.deleted !== void 0) out.deleted = options2.deleted;
23919
+ if (options2.showValue !== void 0) out.showValue = options2.showValue;
23920
+ if (options2.showCategoryName !== void 0) out.showCategory = options2.showCategoryName;
23921
+ if (options2.showSeriesName !== void 0) out.showSeriesName = options2.showSeriesName;
23922
+ if (options2.showPercent !== void 0) out.showPercent = options2.showPercent;
23923
+ if (options2.showBubbleSize !== void 0) out.showBubbleSize = options2.showBubbleSize;
23924
+ if (options2.separator !== void 0) out.separator = options2.separator;
23925
+ if (options2.position) out.position = options2.position;
23926
+ if (options2.numberFormat?.formatCode) out.numberFormat = options2.numberFormat.formatCode;
23739
23927
  if (custom?.text !== void 0) out.text = custom.text;
23740
23928
  return out;
23741
23929
  }
@@ -23842,7 +24030,10 @@ function extraGroups(chartSpace, firstType) {
23842
24030
  const type = group2.kind === "bar" ? "column" : group2.kind;
23843
24031
  const entry3 = {
23844
24032
  chartType: type,
23845
- series: group2.series.map((source2) => chartSummarySeries(source2, type, group2.dataLabels)),
24033
+ series: group2.series.map((source2, index3) => ({
24034
+ ...chartSummarySeries(source2, type, group2.dataLabels),
24035
+ ...summaryMarkers(source2, group2, index3)
24036
+ })),
23846
24037
  secondary: valueAxisId(chartSpace, group2.axisIds) !== primary
23847
24038
  };
23848
24039
  if (group2.grouping && GROUPINGS.has(group2.grouping))
@@ -23860,13 +24051,16 @@ function chartSummaryFromSpace(chartSpace, extras = {}) {
23860
24051
  const group2 = chartSpace.plotArea.groups[0];
23861
24052
  let chartType = group2 ? GROUP_TYPES[group2.kind] : "column";
23862
24053
  if (chartType === "bar" && group2?.barDirection !== "bar") chartType = "column";
23863
- const series = (group2?.series ?? []).map(
23864
- (source2) => chartSummarySeries(source2, chartType, group2?.dataLabels)
23865
- );
24054
+ const series = (group2?.series ?? []).map((source2, index3) => ({
24055
+ ...chartSummarySeries(source2, chartType, group2?.dataLabels),
24056
+ ...group2 ? summaryMarkers(source2, group2, index3) : {}
24057
+ }));
23866
24058
  const summary = {
23867
24059
  chartType,
23868
24060
  series,
23869
- showLegend: chartSpace.legend !== void 0
24061
+ showLegend: chartSpace.legend !== void 0,
24062
+ axes: chartSpace.plotArea.axes,
24063
+ axisIds: group2?.axisIds ?? []
23870
24064
  };
23871
24065
  const combined = extraGroups(chartSpace, chartType);
23872
24066
  if (combined.length) summary.extraGroups = combined;
@@ -23949,6 +24143,8 @@ function parseChart(xml, anchor, partName, name) {
23949
24143
  showLegend: summary.showLegend,
23950
24144
  partName
23951
24145
  };
24146
+ if (summary.axes) object.axes = summary.axes;
24147
+ if (summary.axisIds) object.axisIds = summary.axisIds;
23952
24148
  if (summary.grouping) object.grouping = summary.grouping;
23953
24149
  if (summary.barGapWidth !== void 0) object.barGapWidth = summary.barGapWidth;
23954
24150
  if (summary.barOverlap !== void 0) object.barOverlap = summary.barOverlap;
@@ -24727,9 +24923,9 @@ function readPrintOptions(node2) {
24727
24923
  for (const key of KEYS) if (boolAttr(node2, key)) out[key] = true;
24728
24924
  return Object.keys(out).length ? out : void 0;
24729
24925
  }
24730
- function printOptionsXml(options) {
24731
- if (!options) return "";
24732
- const attrs2 = KEYS.filter((key) => options[key]).map((key) => ` ${key}="1"`);
24926
+ function printOptionsXml(options2) {
24927
+ if (!options2) return "";
24928
+ const attrs2 = KEYS.filter((key) => options2[key]).map((key) => ` ${key}="1"`);
24733
24929
  return attrs2.length ? `<printOptions${attrs2.join("")}/>` : "";
24734
24930
  }
24735
24931
 
@@ -25268,12 +25464,12 @@ Reply:
25268
25464
 
25269
25465
  // chart/bar-cluster-geometry.ts
25270
25466
  var DEFAULT_BAR_GAP_WIDTH = 150;
25271
- function assertBarClusterOptions(options) {
25467
+ function assertBarClusterOptions(options2) {
25272
25468
  for (const [field, min, max] of [
25273
25469
  ["barGapWidth", 0, 500],
25274
25470
  ["barOverlap", -100, 100]
25275
25471
  ]) {
25276
- const value2 = options[field];
25472
+ const value2 = options2[field];
25277
25473
  if (value2 !== void 0 && (!Number.isInteger(value2) || value2 < min || value2 > max))
25278
25474
  throw new RangeError(`${field} must be an integer from ${min} to ${max}`);
25279
25475
  }
@@ -25724,8 +25920,8 @@ function titleXml(context, title) {
25724
25920
  chartTextXml(context, tx, false) + layoutXml(context, title.layout) + valXml("overlay", title.overlay) + shapePropertiesXml(context, title.spPr) + textBodyXml(context, title.txPr) + raw(context, title.extLst)
25725
25921
  );
25726
25922
  }
25727
- function labelOptionsXml(context, options) {
25728
- 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));
25923
+ function labelOptionsXml(context, options2) {
25924
+ 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));
25729
25925
  }
25730
25926
  function labelXml(context, label2) {
25731
25927
  return elementXml(
@@ -25895,7 +26091,7 @@ function styleXml(context, space) {
25895
26091
  );
25896
26092
  }
25897
26093
  var relationship = (local, id, content2 = "") => id === void 0 ? "" : elementXml(local, content2, ` r:id="${escapeAttribute(id)}"`);
25898
- function writeChartSpace(space, options = {}) {
26094
+ function writeChartSpace(space, options2 = {}) {
25899
26095
  const bindings = new Map(CHART_ROOT_BINDINGS);
25900
26096
  for (const { prefix, uri } of space.namespaceDeclarations ?? [])
25901
26097
  if (!bindings.has(prefix) && /^[A-Za-z_][\w.-]*$/.test(prefix)) bindings.set(prefix, uri);
@@ -25910,7 +26106,7 @@ function writeChartSpace(space, options = {}) {
25910
26106
  space.externalDataRelId,
25911
26107
  valXml("autoUpdate", space.externalDataAutoUpdate)
25912
26108
  ) + raw(context, space.printSettings) + relationship("userShapes", space.userShapesRelId) + raw(context, space.extLst);
25913
- const breakAfter = options.declarationBreak ?? "\r\n";
26109
+ const breakAfter = options2.declarationBreak ?? "\r\n";
25914
26110
  return `${DECLARATION3}${breakAfter}<c:chartSpace${declarations}>${body}</c:chartSpace>`;
25915
26111
  }
25916
26112
 
@@ -26095,6 +26291,14 @@ function chartColorPalettePatch(chart, id) {
26095
26291
  if (!previous) return copy;
26096
26292
  const previousChoice = chartPaletteSeriesColorChoice(previous, index3, chart.series.length);
26097
26293
  const nextChoice = chartPaletteSeriesColorChoice(next, index3, chart.series.length);
26294
+ for (const marker3 of [copy.marker, ...Object.values(copy.pointMarkers ?? {})]) {
26295
+ const shape2 = marker3?.spPr;
26296
+ if (!shape2) continue;
26297
+ for (const paint2 of [shape2, shape2.line]) {
26298
+ if (paint2?.fill?.kind === "solid" && sameChartColor(paint2.fill.color, previousChoice))
26299
+ paint2.fill = { kind: "solid", color: structuredClone(nextChoice) };
26300
+ }
26301
+ }
26098
26302
  const fill = recolorGradient(copy.fill, previousChoice, nextChoice);
26099
26303
  if (fill) copy.fill = fill;
26100
26304
  if (sameChartColor(
@@ -26500,10 +26704,10 @@ var PackageWriter = class {
26500
26704
  async build() {
26501
26705
  const zip = new JSZip2();
26502
26706
  const date = new Date(Date.UTC(1980, 0, 1));
26503
- const options = { date, createFolders: false };
26504
- zip.file("[Content_Types].xml", this.contentTypesXml(), options);
26707
+ const options2 = { date, createFolders: false };
26708
+ zip.file("[Content_Types].xml", this.contentTypesXml(), options2);
26505
26709
  const names = [...this.parts.keys()].sort((a2, b) => rank2(a2) - rank2(b) || a2.localeCompare(b));
26506
- for (const name of names) zip.file(name, this.parts.get(name) ?? "", options);
26710
+ for (const name of names) zip.file(name, this.parts.get(name) ?? "", options2);
26507
26711
  return zip.generateAsync({
26508
26712
  type: "uint8array",
26509
26713
  compression: "DEFLATE",
@@ -33366,15 +33570,15 @@ function pasteAt(ctx, s, at, payload, request) {
33366
33570
  function pasteSelection(ctx, sheet, selection, payload, request) {
33367
33571
  const dest = normalizeRange(selection);
33368
33572
  const clip = typeof payload === "string" ? { tsv: payload, html: "", cells: cellsFromText(ctx.workbook, payload) } : payload;
33369
- const options = resolvePasteOptions(request);
33370
- if (options.mode === "widths")
33371
- return pasteWidths(ctx, sheet, dest, clip.cells, options.transpose, !!clip.cut);
33372
- const height = options.transpose ? clip.cells.cols : clip.cells.rows;
33373
- const width = options.transpose ? clip.cells.rows : clip.cells.cols;
33573
+ const options2 = resolvePasteOptions(request);
33574
+ if (options2.mode === "widths")
33575
+ return pasteWidths(ctx, sheet, dest, clip.cells, options2.transpose, !!clip.cut);
33576
+ const height = options2.transpose ? clip.cells.cols : clip.cells.rows;
33577
+ const width = options2.transpose ? clip.cells.rows : clip.cells.cols;
33374
33578
  const rows = dest.end.row - dest.start.row + 1;
33375
33579
  const cols = dest.end.col - dest.start.col + 1;
33376
33580
  if (clip.cut || !height || !width || rows === 1 && cols === 1 || dest.start.row === 0 && dest.end.row === MAX_ROW || dest.start.col === 0 && dest.end.col === MAX_COL)
33377
- return pasteAt(ctx, sheet, dest.start, clip, options);
33581
+ return pasteAt(ctx, sheet, dest.start, clip, options2);
33378
33582
  if (rows % height || cols % width)
33379
33583
  throw new RangeError("The copy and paste areas are not compatible sizes.");
33380
33584
  if (rows * cols > 25e4) throw new RangeError("The selected paste area is too large.");
@@ -33394,16 +33598,16 @@ function pasteSelection(ctx, sheet, selection, payload, request) {
33394
33598
  () => {
33395
33599
  for (let row2 = dest.start.row; row2 <= dest.end.row; row2 += height)
33396
33600
  for (let col = dest.start.col; col <= dest.end.col; col += width)
33397
- pasteAt(tileContext, sheet, { row: row2, col }, tileClip, options);
33398
- if (["all", "formats", "noBorders", "mergeFormats"].includes(options.mode))
33601
+ pasteAt(tileContext, sheet, { row: row2, col }, tileClip, options2);
33602
+ if (["all", "formats", "noBorders", "mergeFormats"].includes(options2.mode))
33399
33603
  pasteConditionalFormats(
33400
33604
  sheetAt(ctx.workbook, sheet),
33401
33605
  dest,
33402
33606
  clip.cells,
33403
- options.transpose,
33404
- options.skipBlanks,
33607
+ options2.transpose,
33608
+ options2.skipBlanks,
33405
33609
  void 0,
33406
- options.mode === "mergeFormats"
33610
+ options2.mode === "mergeFormats"
33407
33611
  );
33408
33612
  return dest;
33409
33613
  },
@@ -33870,7 +34074,7 @@ function numberInputText(value2, numFmt, date1904 = false) {
33870
34074
  if (/%/.test(numFmt.replace(/"[^"]*"|\\./g, ""))) return `${plainNumber(value2 * 100)}%`;
33871
34075
  return plainNumber(value2);
33872
34076
  }
33873
- function formulaBarText(workbook, cell, options = {}) {
34077
+ function formulaBarText(workbook, cell, options2 = {}) {
33874
34078
  if (!cell) return "";
33875
34079
  if (cell.formula !== void 0) return `=${cell.formula}`;
33876
34080
  const value2 = cell.value;
@@ -33884,7 +34088,7 @@ function formulaBarText(workbook, cell, options = {}) {
33884
34088
  workbook.date1904
33885
34089
  );
33886
34090
  const text4 = cell.richText?.length ? cell.richText.map((run2) => run2.text).join("") : value2;
33887
- if (text4 === "" || options.quote === false) return text4;
34091
+ if (text4 === "" || options2.quote === false) return text4;
33888
34092
  const parsed = parseCellInput(text4, { date1904: workbook.date1904 });
33889
34093
  const literal2 = parsed.formula === void 0 && parsed.value === text4;
33890
34094
  return literal2 ? text4 : `'${text4}`;
@@ -34515,9 +34719,9 @@ var SessionCalculator = class {
34515
34719
  // xlsx/edit/goal-solver.ts
34516
34720
  var DEFAULT_GOAL_ITERATIONS = 100;
34517
34721
  var DEFAULT_GOAL_MAX_CHANGE = 1e-3;
34518
- function solveGoal(f6, goal, start, options = {}) {
34519
- const maxIterations = options.maxIterations ?? DEFAULT_GOAL_ITERATIONS;
34520
- const tolerance = options.maxChange ?? DEFAULT_GOAL_MAX_CHANGE;
34722
+ function solveGoal(f6, goal, start, options2 = {}) {
34723
+ const maxIterations = options2.maxIterations ?? DEFAULT_GOAL_ITERATIONS;
34724
+ const tolerance = options2.maxChange ?? DEFAULT_GOAL_MAX_CHANGE;
34521
34725
  let iterations = 0;
34522
34726
  let best;
34523
34727
  let negative;
@@ -35024,10 +35228,10 @@ function columnOverrides(sheet, mdw, defaultPx) {
35024
35228
  }
35025
35229
  return out;
35026
35230
  }
35027
- function createGridMetrics(sheet, options = {}) {
35028
- const zoom = zoomPercent(options.zoom ?? sheet.view.zoom);
35231
+ function createGridMetrics(sheet, options2 = {}) {
35232
+ const zoom = zoomPercent(options2.zoom ?? sheet.view.zoom);
35029
35233
  const factor = zoom / 100;
35030
- const mdw = options.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
35234
+ const mdw = options2.mdw ?? DEFAULT_MAX_DIGIT_WIDTH;
35031
35235
  const scale2 = (px) => px > 0 ? Math.max(1, Math.round(px * factor)) : 0;
35032
35236
  const defaultColPx = defaultColumnPixels(sheet.defaultColWidth, mdw);
35033
35237
  const colOverrides = [...columnOverrides(sheet, mdw, defaultColPx)].map(
@@ -35049,8 +35253,8 @@ function createGridMetrics(sheet, options = {}) {
35049
35253
  for (const merge2 of sheet.merges) lastColUsed = Math.max(lastColUsed, merge2.end.col);
35050
35254
  for (const info of sheet.columns)
35051
35255
  if (info.max < MAX_COL) lastColUsed = Math.max(lastColUsed, info.max);
35052
- const lastRow = Math.min(MAX_ROW, lastRowUsed + (options.extraRows ?? 50));
35053
- const lastCol = Math.min(MAX_COL, lastColUsed + (options.extraCols ?? 20));
35256
+ const lastRow = Math.min(MAX_ROW, lastRowUsed + (options2.extraRows ?? 50));
35257
+ const lastCol = Math.min(MAX_COL, lastColUsed + (options2.extraCols ?? 20));
35054
35258
  return {
35055
35259
  zoom,
35056
35260
  lastRow,
@@ -35277,37 +35481,37 @@ function writePivot(ctx, s, pivot, old, label2, inside2) {
35277
35481
  );
35278
35482
  }
35279
35483
  var startRow = (range, offset2) => range.start.row + offset2;
35280
- function createPivotTable(ctx, s, destination, options) {
35281
- const data = pivotSourceData(ctx.workbook, s, options.source);
35282
- const name = options.name ?? uniqueName(ctx);
35484
+ function createPivotTable(ctx, s, destination, options2) {
35485
+ const data = pivotSourceData(ctx.workbook, s, options2.source);
35486
+ const name = options2.name ?? uniqueName(ctx);
35283
35487
  checkName2(ctx, name);
35284
- const aggregate3 = options.aggregate ?? "sum";
35285
- const captions = authoredCaptions(options);
35488
+ const aggregate3 = options2.aggregate ?? "sum";
35489
+ const captions = authoredCaptions(options2);
35286
35490
  const pivot = {
35287
35491
  ...data,
35288
35492
  ...captions ? { captions } : {},
35289
35493
  name,
35290
- rowField: options.rowField,
35291
- layout: options.layout ?? "tabular",
35292
- subtotalPosition: options.subtotalPosition ?? (options.layout && options.layout !== "tabular" ? "top" : "bottom"),
35293
- ...options.secondRowField ? { secondRowField: options.secondRowField } : {},
35294
- ...options.secondRowField && options.moreRowFields?.length ? { moreRowFields: [...options.moreRowFields] } : {},
35295
- ...options.fieldSubtotals?.length ? { fieldSubtotals: normalizedFieldSubtotals(options.fieldSubtotals) } : {},
35296
- ...options.dateGroups?.length ? { dateGroups: structuredClone(options.dateGroups) } : {},
35494
+ rowField: options2.rowField,
35495
+ layout: options2.layout ?? "tabular",
35496
+ subtotalPosition: options2.subtotalPosition ?? (options2.layout && options2.layout !== "tabular" ? "top" : "bottom"),
35497
+ ...options2.secondRowField ? { secondRowField: options2.secondRowField } : {},
35498
+ ...options2.secondRowField && options2.moreRowFields?.length ? { moreRowFields: [...options2.moreRowFields] } : {},
35499
+ ...options2.fieldSubtotals?.length ? { fieldSubtotals: normalizedFieldSubtotals(options2.fieldSubtotals) } : {},
35500
+ ...options2.dateGroups?.length ? { dateGroups: structuredClone(options2.dateGroups) } : {},
35297
35501
  ...ctx.workbook.date1904 ? { date1904: true } : {},
35298
- ...options.subtotals !== void 0 ? { subtotals: options.subtotals } : {},
35299
- ...options.repeatLabels !== void 0 ? { repeatLabels: options.repeatLabels } : {},
35300
- valueField: options.valueField,
35502
+ ...options2.subtotals !== void 0 ? { subtotals: options2.subtotals } : {},
35503
+ ...options2.repeatLabels !== void 0 ? { repeatLabels: options2.repeatLabels } : {},
35504
+ valueField: options2.valueField,
35301
35505
  aggregate: aggregate3,
35302
- valueCaption: pivotCaption(aggregate3, options.valueField, { captions }),
35303
- ...options.pageFilter !== void 0 ? { pageFilter: structuredClone(options.pageFilter) } : {},
35304
- ...options.fieldGroups?.length ? { fieldGroups: structuredClone(options.fieldGroups) } : {},
35305
- ...options.valuesAxis !== void 0 ? { valuesAxis: options.valuesAxis } : {},
35306
- ...options.valuesPosition !== void 0 ? { valuesPosition: options.valuesPosition } : {},
35307
- ...options.additionalValues ? { additionalValues: normalizedPivotMeasures(options.additionalValues, { captions }) } : {},
35506
+ valueCaption: pivotCaption(aggregate3, options2.valueField, { captions }),
35507
+ ...options2.pageFilter !== void 0 ? { pageFilter: structuredClone(options2.pageFilter) } : {},
35508
+ ...options2.fieldGroups?.length ? { fieldGroups: structuredClone(options2.fieldGroups) } : {},
35509
+ ...options2.valuesAxis !== void 0 ? { valuesAxis: options2.valuesAxis } : {},
35510
+ ...options2.valuesPosition !== void 0 ? { valuesPosition: options2.valuesPosition } : {},
35511
+ ...options2.additionalValues ? { additionalValues: normalizedPivotMeasures(options2.additionalValues, { captions }) } : {},
35308
35512
  location: { start: { ...destination }, end: { ...destination } },
35309
- ...options.columnField ? { columnField: options.columnField } : {},
35310
- ...options.columnField && options.moreColumnFields?.length ? { moreColumnFields: [...options.moreColumnFields] } : {}
35513
+ ...options2.columnField ? { columnField: options2.columnField } : {},
35514
+ ...options2.columnField && options2.moreColumnFields?.length ? { moreColumnFields: [...options2.moreColumnFields] } : {}
35311
35515
  };
35312
35516
  if (pivot.dateGroups) reconcileDateAxes(pivot);
35313
35517
  const dates = pivotDateFieldsOf(ctx.workbook, s, pivot);
@@ -39013,8 +39217,8 @@ function hashBytes(password, { algorithmName, saltValue, spinCount }, limits) {
39013
39217
  if (!digest || !salt || !isValidSpinCount(spinCount, limits.maxSpinCount)) return void 0;
39014
39218
  return spinPasswordHash(password, salt, spinCount ?? 0, digest);
39015
39219
  }
39016
- function hashPassword(password, options, limits = {}) {
39017
- const bytes = hashBytes(password, options, limits);
39220
+ function hashPassword(password, options2, limits = {}) {
39221
+ const bytes = hashBytes(password, options2, limits);
39018
39222
  return bytes && encodeBase64(bytes);
39019
39223
  }
39020
39224
  function verifyPasswordHash(password, hash, limits = {}) {
@@ -39315,7 +39519,7 @@ function displayText2(value2, style2, numFmt, workbook, sheet) {
39315
39519
  });
39316
39520
  return formatted.color ? { text: formatted.text, color: formatted.color } : { text: formatted.text };
39317
39521
  }
39318
- function cellView(workbook, sheetIndex2, row2, col, cf, options = {}) {
39522
+ function cellView(workbook, sheetIndex2, row2, col, cf, options2 = {}) {
39319
39523
  const sheet = workbook.sheets[sheetIndex2];
39320
39524
  if (!sheet) throw new RangeError(`No sheet at index ${sheetIndex2}`);
39321
39525
  const cell = getCell(sheet, row2, col);
@@ -39354,10 +39558,10 @@ function cellView(workbook, sheetIndex2, row2, col, cf, options = {}) {
39354
39558
  vAlign: alignment.vertical ?? "bottom",
39355
39559
  wrap: wrap3,
39356
39560
  shrink,
39357
- indentPx: indentable ? (alignment.indent ?? 0) * (options.indentPx ?? INDENT_PX_PER_LEVEL) : 0,
39561
+ indentPx: indentable ? (alignment.indent ?? 0) * (options2.indentPx ?? INDENT_PX_PER_LEVEL) : 0,
39358
39562
  rotation,
39359
39563
  isNumber,
39360
- overflow: (formulaText !== void 0 || typeof value2 === "string" && value2 !== "") && !wrap3 && !shrink && rotation === 0 && !vertical && hAlign !== "fill" && !(options.merged ?? sheet.merges.some((m) => rangeContains(m, { row: row2, col }))),
39564
+ overflow: (formulaText !== void 0 || typeof value2 === "string" && value2 !== "") && !wrap3 && !shrink && rotation === 0 && !vertical && hAlign !== "fill" && !(options2.merged ?? sheet.merges.some((m) => rangeContains(m, { row: row2, col }))),
39361
39565
  hasComment: sheet.comments.some((c2) => c2.address.row === row2 && c2.address.col === col),
39362
39566
  hasHyperlink: false,
39363
39567
  validationList: sheet.dataValidations.some(
@@ -39917,7 +40121,7 @@ function asNumber(value2) {
39917
40121
  return Number(value2);
39918
40122
  return void 0;
39919
40123
  }
39920
- function listValidationOptions(workbook, sheet, row2, col, options = {}) {
40124
+ function listValidationOptions(workbook, sheet, row2, col, options2 = {}) {
39921
40125
  const dv = validationAt(workbook, sheet, row2, col);
39922
40126
  if (!dv || dv.type !== "list" || dv.showDropDown === false || dv.formula1 === void 0)
39923
40127
  return void 0;
@@ -39926,7 +40130,7 @@ function listValidationOptions(workbook, sheet, row2, col, options = {}) {
39926
40130
  workbook,
39927
40131
  sheet,
39928
40132
  relativeTo(dv, dv.formula1, at),
39929
- options.evaluate ?? defaultEvaluate(workbook),
40133
+ options2.evaluate ?? defaultEvaluate(workbook),
39930
40134
  at
39931
40135
  );
39932
40136
  return items?.map((item) => item.text);
@@ -39987,11 +40191,11 @@ function check2(workbook, dv, value2, at, evaluate) {
39987
40191
  if (dv.type === "whole" && !Number.isInteger(n2)) return false;
39988
40192
  return compare(operator, n2, a2, b);
39989
40193
  }
39990
- function validateCellInput(workbook, sheet, row2, col, value2, options = {}) {
40194
+ function validateCellInput(workbook, sheet, row2, col, value2, options2 = {}) {
39991
40195
  const dv = validationAt(workbook, sheet, row2, col);
39992
40196
  if (!dv || dv.type === "none" || dv.showErrorMessage !== true) return { ok: true };
39993
40197
  if (value2 === null || value2 === "") return dv.allowBlank === false ? failure(dv) : { ok: true };
39994
- const evaluate = options.evaluate ?? defaultEvaluate(workbook);
40198
+ const evaluate = options2.evaluate ?? defaultEvaluate(workbook);
39995
40199
  return check2(workbook, dv, value2, { sheet, row: row2, col }, evaluate) ? { ok: true } : failure(dv);
39996
40200
  }
39997
40201
  function failure(dv) {
@@ -40005,10 +40209,10 @@ function failure(dv) {
40005
40209
  }
40006
40210
 
40007
40211
  // xlsx/edit/session.ts
40008
- function createEditSession(workbook, options = {}) {
40212
+ function createEditSession(workbook, options2 = {}) {
40009
40213
  const calc = createCalcEngine(workbook);
40010
- const autoRecalc = options.recalc ?? true;
40011
- const history = new History(options.historyLimit ?? 100);
40214
+ const autoRecalc = options2.recalc ?? true;
40215
+ const history = new History(options2.historyLimit ?? 100);
40012
40216
  const listeners = /* @__PURE__ */ new Set();
40013
40217
  let open;
40014
40218
  const emit = (change) => {
@@ -40107,8 +40311,8 @@ function createEditSession(workbook, options = {}) {
40107
40311
  return result2;
40108
40312
  };
40109
40313
  const ctx = { workbook, calc, run: run2 };
40110
- if (options.defaultSheetBase) ctx.defaultSheetBase = options.defaultSheetBase;
40111
- const autoRows = options.autoRowHeight ?? true;
40314
+ if (options2.defaultSheetBase) ctx.defaultSheetBase = options2.defaultSheetBase;
40315
+ const autoRows = options2.autoRowHeight ?? true;
40112
40316
  const refitRows = (current) => {
40113
40317
  const { sheet: s, kind, ranges } = current;
40114
40318
  if (!autoRows || s === void 0 || !ranges.length || !current.step.entries.length) return;
@@ -40116,7 +40320,7 @@ function createEditSession(workbook, options = {}) {
40116
40320
  const sheet = workbook.sheets[s];
40117
40321
  if (!sheet) return;
40118
40322
  try {
40119
- autoGrowRows(ctx, s, rowsToRefit(sheet, ranges), options.measureText);
40323
+ autoGrowRows(ctx, s, rowsToRefit(sheet, ranges), options2.measureText);
40120
40324
  } catch (error) {
40121
40325
  const message = `Row height update failed: ${error instanceof Error ? error.message : String(error)}`;
40122
40326
  if (!workbook.warnings.includes(message)) workbook.warnings.push(message);
@@ -40179,7 +40383,7 @@ function createEditSession(workbook, options = {}) {
40179
40383
  setDefinedName: (name) => setDefinedName(ctx, name),
40180
40384
  deleteDefinedName: (name, localSheet) => deleteDefinedName(ctx, name, localSheet),
40181
40385
  setDrawingAnchor: (s, index3, anchor) => setDrawingAnchor(ctx, s, index3, anchor),
40182
- createPivotTable: (s, destination, options2) => createPivotTable(ctx, s, destination, options2),
40386
+ createPivotTable: (s, destination, options3) => createPivotTable(ctx, s, destination, options3),
40183
40387
  refreshPivotTable: (s, name, patch3) => refreshPivotTable(ctx, s, name, patch3),
40184
40388
  deletePivotTable: (s, name) => deletePivotTable(ctx, s, name),
40185
40389
  setSlicerSelection: (cache3, keys) => setSlicerSelection(ctx, cache3, keys),
@@ -40229,8 +40433,8 @@ function createEditSession(workbook, options = {}) {
40229
40433
  setDocumentProperties: (patch3) => setDocumentProperties(ctx, patch3),
40230
40434
  setAutoRecalc: (enabled) => setCalcMode(ctx, enabled ? "auto" : "manual"),
40231
40435
  autoRecalc: () => autoRecalc && calcModeOf(workbook) === "auto",
40232
- calculateNow(options2) {
40233
- calculator.now(options2?.full ?? false);
40436
+ calculateNow(options3) {
40437
+ calculator.now(options3?.full ?? false);
40234
40438
  emit({ kind: "cells", label: "Calculate now", structural: false });
40235
40439
  },
40236
40440
  prepareCalculation: (opts) => calculator.prepare(opts?.timeRemaining),
@@ -40331,17 +40535,17 @@ function formatCursorLabel(userName, maxChars = MAX_LABEL_CHARS) {
40331
40535
  }
40332
40536
 
40333
40537
  // xlsx/layout/remote-selections.ts
40334
- function layoutRemoteSelections(metrics, peers, options) {
40335
- const tagHeight = options.tagHeight ?? 16;
40538
+ function layoutRemoteSelections(metrics, peers, options2) {
40539
+ const tagHeight = options2.tagHeight ?? 16;
40336
40540
  const boxes = [];
40337
40541
  for (const peer of peers) {
40338
- if (peer.sheet !== options.sheet) continue;
40542
+ if (peer.sheet !== options2.sheet) continue;
40339
40543
  const { start, end } = peer.range;
40340
40544
  const top = Math.min(start.row, end.row);
40341
40545
  const left2 = Math.min(start.col, end.col);
40342
- if (top > options.maxRow || left2 > options.maxCol) continue;
40343
- const bottom = Math.min(Math.max(start.row, end.row), options.maxRow);
40344
- const right2 = Math.min(Math.max(start.col, end.col), options.maxCol);
40546
+ if (top > options2.maxRow || left2 > options2.maxCol) continue;
40547
+ const bottom = Math.min(Math.max(start.row, end.row), options2.maxRow);
40548
+ const right2 = Math.min(Math.max(start.col, end.col), options2.maxCol);
40345
40549
  const x = metrics.colLeft(left2);
40346
40550
  const y = metrics.rowTop(top);
40347
40551
  const w = metrics.colLeft(right2 + 1) - x;
@@ -40354,7 +40558,7 @@ function layoutRemoteSelections(metrics, peers, options) {
40354
40558
  w,
40355
40559
  h: h2,
40356
40560
  color: peer.userColor,
40357
- label: formatCursorLabel(peer.userName, options.maxLabelChars),
40561
+ label: formatCursorLabel(peer.userName, options2.maxLabelChars),
40358
40562
  name: peer.userName,
40359
40563
  tag: y < tagHeight ? "inside" : "above"
40360
40564
  });
@@ -40451,14 +40655,14 @@ function dataBarAppearance(rule, workbook) {
40451
40655
  }
40452
40656
 
40453
40657
  // xlsx/layout/data-bar-geometry.ts
40454
- function dataBarGeometry(value2, low, high, options) {
40455
- const lo = options.autoMin ? Math.min(0, low) : low;
40456
- const hi = options.autoMax ? Math.max(0, high) : high;
40658
+ function dataBarGeometry(value2, low, high, options2) {
40659
+ const lo = options2.autoMin ? Math.min(0, low) : low;
40660
+ const hi = options2.autoMax ? Math.max(0, high) : high;
40457
40661
  const clamp = (v) => Math.max(0, Math.min(1, v));
40458
- const minimum = options.minLength;
40459
- const delta = options.maxLength - minimum;
40662
+ const minimum = options2.minLength;
40663
+ const delta = options2.maxLength - minimum;
40460
40664
  const interpolate = (ratio, offset2 = minimum) => clamp(offset2 + clamp(ratio) * delta);
40461
- if (options.axis === "none") {
40665
+ if (options2.axis === "none") {
40462
40666
  const ratio = hi > lo ? clamp((value2 - lo) / (hi - lo)) : 0.5;
40463
40667
  return {
40464
40668
  start: 0,
@@ -40466,7 +40670,7 @@ function dataBarGeometry(value2, low, high, options) {
40466
40670
  reverse: false
40467
40671
  };
40468
40672
  }
40469
- if (options.axis === "middle") {
40673
+ if (options2.axis === "middle") {
40470
40674
  const span3 = Math.max(Math.abs(lo), Math.abs(hi));
40471
40675
  const fraction2 = interpolate(span3 > 0 ? Math.abs(value2) / span3 : 0) / 2;
40472
40676
  return { start: value2 < 0 ? 0.5 - fraction2 : 0.5, fraction: fraction2, axis: 0.5, reverse: value2 < 0 };
@@ -40478,7 +40682,7 @@ function dataBarGeometry(value2, low, high, options) {
40478
40682
  }
40479
40683
  if (hi <= 0) {
40480
40684
  const fraction2 = hi > lo ? interpolate((hi - value2) / (hi - lo), hi === 0 ? minimum / 2 : minimum) : interpolate(0.5);
40481
- const axis2 = hi === 0 ? (1 + options.maxLength - minimum) / 2 : options.maxLength;
40685
+ const axis2 = hi === 0 ? (1 + options2.maxLength - minimum) / 2 : options2.maxLength;
40482
40686
  return {
40483
40687
  start: axis2 - fraction2,
40484
40688
  fraction: fraction2,
@@ -40486,7 +40690,7 @@ function dataBarGeometry(value2, low, high, options) {
40486
40690
  reverse: true
40487
40691
  };
40488
40692
  }
40489
- const axis = (1 - options.maxLength + minimum) / 2 + -lo / (hi - lo) * delta;
40693
+ const axis = (1 - options2.maxLength + minimum) / 2 + -lo / (hi - lo) * delta;
40490
40694
  const bounded = Math.max(lo, Math.min(hi, value2));
40491
40695
  const fraction = interpolate(Math.abs(bounded) / (hi - lo), minimum / 2);
40492
40696
  return { start: bounded < 0 ? axis - fraction : axis, fraction, axis, reverse: bounded < 0 };
@@ -40592,10 +40796,10 @@ function valueText(value2) {
40592
40796
 
40593
40797
  // xlsx/layout/cf-evaluator.ts
40594
40798
  var GRAPHIC_RULES = /* @__PURE__ */ new Set(["colorScale", "dataBar", "iconSet"]);
40595
- function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, options = {}) {
40799
+ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, options2 = {}) {
40596
40800
  const sheet = workbook.sheets[sheetIndex2];
40597
40801
  if (!sheet) return { at: () => void 0 };
40598
- const translate = options.translate ?? translateFormula;
40802
+ const translate = options2.translate ?? translateFormula;
40599
40803
  const entries = [];
40600
40804
  let order = 0;
40601
40805
  for (const format of sheet.conditionalFormats)
@@ -40615,7 +40819,7 @@ function createConditionalFormatEvaluator(workbook, sheetIndex2, evaluate, optio
40615
40819
  let todaySerial;
40616
40820
  const today = () => {
40617
40821
  if (todaySerial !== void 0) return todaySerial;
40618
- let serial = options.today?.();
40822
+ let serial = options2.today?.();
40619
40823
  if (serial === void 0) {
40620
40824
  const anchor = { sheet: sheetIndex2, row: 0, col: 0 };
40621
40825
  let raw2 = null;
@@ -41066,14 +41270,14 @@ function* units(raw2) {
41066
41270
  exp2++;
41067
41271
  }
41068
41272
  }
41069
- function niceScale(dataMin, dataMax, options = {}) {
41070
- const maxIntervals = Math.max(1, options.maxIntervals ?? 10);
41273
+ function niceScale(dataMin, dataMax, options2 = {}) {
41274
+ const maxIntervals = Math.max(1, options2.maxIntervals ?? 10);
41071
41275
  let lo = Number.isFinite(dataMin) ? dataMin : 0;
41072
41276
  let hi = Number.isFinite(dataMax) ? dataMax : 0;
41073
41277
  if (lo > hi) [lo, hi] = [hi, lo];
41074
41278
  if (lo === hi) {
41075
41279
  if (lo === 0) hi = 1;
41076
- else if (options.noZero) {
41280
+ else if (options2.noZero) {
41077
41281
  const pad7 = Math.abs(lo) * 0.1 || 1;
41078
41282
  lo -= pad7;
41079
41283
  hi += pad7;
@@ -41082,7 +41286,7 @@ function niceScale(dataMin, dataMax, options = {}) {
41082
41286
  }
41083
41287
  let fixedLo = false;
41084
41288
  let fixedHi = false;
41085
- if (!options.noZero) {
41289
+ if (!options2.noZero) {
41086
41290
  if (lo >= 0 && hi - lo >= hi / 6) {
41087
41291
  lo = 0;
41088
41292
  fixedLo = true;
@@ -41122,6 +41326,202 @@ function formatAxisValue(value2, percent2 = false) {
41122
41326
  return `${v < 0 ? "-" : ""}${grouped}${frac ? `.${frac}` : ""}`;
41123
41327
  }
41124
41328
 
41329
+ // chart/axis-range.ts
41330
+ function computeLogValueRange(series, logBase) {
41331
+ const allValues = series.flatMap((item) => item.values).filter((value2) => value2 !== null && Number.isFinite(value2) && value2 > 0);
41332
+ if (allValues.length === 0) {
41333
+ return { min: 1, max: logBase, span: 1, logScale: true, logBase };
41334
+ }
41335
+ const dataMin = Math.min(...allValues);
41336
+ const dataMax = Math.max(...allValues);
41337
+ const logMin = Math.floor(Math.log(dataMin) / Math.log(logBase));
41338
+ const logMax = Math.ceil(Math.log(dataMax) / Math.log(logBase));
41339
+ const min = logBase ** logMin;
41340
+ const max = logBase ** Math.max(logMax, logMin + 1);
41341
+ return {
41342
+ min,
41343
+ max,
41344
+ span: Math.max(Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase), 1),
41345
+ logScale: true,
41346
+ logBase
41347
+ };
41348
+ }
41349
+ function withAxisBounds(automatic, axis, logBase) {
41350
+ const validMin = typeof axis?.min === "number" && Number.isFinite(axis.min) && (!logBase || axis.min > 0) ? axis.min : void 0;
41351
+ const validMax = typeof axis?.max === "number" && Number.isFinite(axis.max) && (!logBase || axis.max > 0) ? axis.max : void 0;
41352
+ const min = validMin ?? automatic.min;
41353
+ let max = validMax ?? automatic.max;
41354
+ const majorUnit = validMin === void 0 && validMax === void 0 ? automatic.majorUnit : void 0;
41355
+ if (max <= min) {
41356
+ max = logBase ? min * logBase : min + 1;
41357
+ }
41358
+ const span3 = logBase ? Math.log(max) / Math.log(logBase) - Math.log(min) / Math.log(logBase) : max - min;
41359
+ return {
41360
+ min,
41361
+ max,
41362
+ span: Math.max(span3, Number.EPSILON),
41363
+ ...majorUnit !== void 0 ? { majorUnit } : {},
41364
+ ...logBase ? { logScale: true, logBase } : {},
41365
+ ...axis?.orientation === "maxMin" ? { reverseOrder: true } : {}
41366
+ };
41367
+ }
41368
+
41369
+ // chart/axis-ticks.ts
41370
+ var LOG_EXPONENT_TOLERANCE = 1e-12;
41371
+ function generateLogTicks(range) {
41372
+ if (!range.logScale || !range.logBase) {
41373
+ return [];
41374
+ }
41375
+ const base = range.logBase;
41376
+ const logMin = Math.log(range.min) / Math.log(base);
41377
+ const logMax = Math.log(range.max) / Math.log(base);
41378
+ const firstExponent = Math.ceil(logMin - LOG_EXPONENT_TOLERANCE);
41379
+ const lastExponent = Math.floor(logMax + LOG_EXPONENT_TOLERANCE);
41380
+ if (lastExponent < firstExponent) {
41381
+ return range.min === range.max ? [range.min] : [range.min, range.max];
41382
+ }
41383
+ return Array.from(
41384
+ { length: lastExponent - firstExponent + 1 },
41385
+ (_unused, index3) => base ** (firstExponent + index3)
41386
+ );
41387
+ }
41388
+ function generateIntervalTicks(range, unit) {
41389
+ if (!Number.isFinite(unit) || unit <= 0 || range.logScale) {
41390
+ return [];
41391
+ }
41392
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-12;
41393
+ const first2 = Math.ceil((range.min - tolerance) / unit);
41394
+ const last = Math.floor((range.max + tolerance) / unit);
41395
+ const count2 = Math.min(Math.max(last - first2 + 1, 0), 2e3);
41396
+ return Array.from({ length: count2 }, (_, index3) => (first2 + index3) * unit);
41397
+ }
41398
+ function generateAxisTicks(range, axis, defaultIntervals) {
41399
+ if (range.logScale && range.logBase) {
41400
+ return generateLogTicks(range);
41401
+ }
41402
+ const explicit = generateIntervalTicks(range, axis?.majorUnit ?? 0);
41403
+ if (explicit.length > 0) {
41404
+ return explicit;
41405
+ }
41406
+ const automatic = generateIntervalTicks(range, range.majorUnit ?? 0);
41407
+ if (automatic.length > 0) {
41408
+ return automatic;
41409
+ }
41410
+ return Array.from(
41411
+ { length: defaultIntervals + 1 },
41412
+ (_, index3) => range.min + range.span / defaultIntervals * index3
41413
+ );
41414
+ }
41415
+ function generateMinorAxisTicks(range, axis) {
41416
+ const minor = generateIntervalTicks(range, axis?.minorUnit ?? 0);
41417
+ if (minor.length === 0) {
41418
+ return [];
41419
+ }
41420
+ const majorUnit = axis?.majorUnit;
41421
+ if (!majorUnit || !Number.isFinite(majorUnit) || majorUnit <= 0) {
41422
+ return minor;
41423
+ }
41424
+ const tolerance = Math.max(1, Math.abs(range.min), Math.abs(range.max)) * 1e-10;
41425
+ return minor.filter(
41426
+ (value2) => Math.abs(value2 / majorUnit - Math.round(value2 / majorUnit)) > tolerance
41427
+ );
41428
+ }
41429
+
41430
+ // chart/render/chart-view-axes.ts
41431
+ function chartAxisRatio(value2, scale2, axis) {
41432
+ const range = axis?.range;
41433
+ const ratio = range?.logScale ? Math.log(Math.max(value2, range.min) / range.min) / Math.log(range.max / range.min) : (value2 - scale2.min) / (scale2.max - scale2.min || 1);
41434
+ return range?.reverseOrder ? 1 - ratio : ratio;
41435
+ }
41436
+ function chartAxisLabels(axis) {
41437
+ return axis?.source.deleted !== true && axis?.source.tickLabelPosition !== "none";
41438
+ }
41439
+ function options(axis) {
41440
+ return {
41441
+ ...axis.scaling,
41442
+ ...axis.scaling.logBase === void 0 ? {} : { logScale: true },
41443
+ ...axis.majorUnit === void 0 ? {} : { majorUnit: axis.majorUnit },
41444
+ ...axis.minorUnit === void 0 ? {} : { minorUnit: axis.minorUnit }
41445
+ };
41446
+ }
41447
+ function applyChartAxes(model, chart, color) {
41448
+ if (!chart.axes?.length) return;
41449
+ const axes2 = chart.axes;
41450
+ const linked = axes2.filter((axis) => axis.id !== void 0 && chart.axisIds?.includes(axis.id));
41451
+ const candidates = linked.length ? linked : axes2;
41452
+ const xy = model.type === "scatter" || model.type === "bubble";
41453
+ const value2 = candidates.find((axis) => axis.kind === "val" && !["b", "t"].includes(axis.position ?? "")) ?? candidates.find((axis) => axis.kind === "val");
41454
+ const category = candidates.find(
41455
+ (axis) => xy ? axis.kind === "val" && axis !== value2 : axis.kind === "cat" || axis.kind === "date"
41456
+ );
41457
+ const secondary = axes2.find((axis) => axis.kind === "val" && axis !== value2 && axis !== category);
41458
+ const paint2 = (shape2) => {
41459
+ const ln2 = shape2?.line;
41460
+ const fill = ln2?.fill;
41461
+ const resolved = fill?.kind === "none" ? "none" : color(fill?.kind === "solid" ? fill.color : void 0);
41462
+ return {
41463
+ ...resolved === void 0 ? {} : { color: resolved },
41464
+ ...ln2?.widthEmu === void 0 ? {} : { width: ln2.widthEmu / EMU_PER_PIXEL },
41465
+ ...ln2?.dash === void 0 ? {} : { dash: ln2.dash }
41466
+ };
41467
+ };
41468
+ const bind = (axis, scale2, values2) => {
41469
+ const opts = options(axis);
41470
+ const automatic = opts.logScale ? computeLogValueRange(
41471
+ [{ values: values2 ?? [] }],
41472
+ opts.logBase && Number.isFinite(opts.logBase) && opts.logBase > 1 ? opts.logBase : 10
41473
+ ) : {
41474
+ min: scale2?.min ?? 0,
41475
+ max: scale2?.max ?? 1,
41476
+ span: (scale2?.max ?? 1) - (scale2?.min ?? 0),
41477
+ ...scale2 ? { majorUnit: scale2.majorUnit } : {}
41478
+ };
41479
+ const logBase = automatic.logBase;
41480
+ const range = withAxisBounds(automatic, opts, logBase);
41481
+ if (scale2) {
41482
+ scale2.min = range.min;
41483
+ scale2.max = range.max;
41484
+ scale2.ticks = generateAxisTicks(range, opts, 5);
41485
+ }
41486
+ return {
41487
+ source: axis,
41488
+ range,
41489
+ minorTicks: generateMinorAxisTicks(range, opts),
41490
+ line: paint2(axis.spPr),
41491
+ majorGrid: paint2(axis.majorGridlinesSpPr),
41492
+ minorGrid: paint2(axis.minorGridlinesSpPr)
41493
+ };
41494
+ };
41495
+ const out = {};
41496
+ if (value2)
41497
+ out.value = bind(
41498
+ value2,
41499
+ model.valueAxis,
41500
+ [
41501
+ ...model.series,
41502
+ ...model.extraGroups?.filter((g2) => !g2.secondary).flatMap((g2) => g2.series) ?? []
41503
+ ].flatMap((s) => s.values)
41504
+ );
41505
+ if (category)
41506
+ out.category = bind(
41507
+ category,
41508
+ model.xAxis ?? {
41509
+ min: 0,
41510
+ max: Math.max(1, model.categories.length - 1),
41511
+ majorUnit: 1,
41512
+ ticks: []
41513
+ },
41514
+ model.series.flatMap((s) => s.xValues ?? [])
41515
+ );
41516
+ if (secondary)
41517
+ out.secondary = bind(
41518
+ secondary,
41519
+ model.secondaryAxis,
41520
+ model.extraGroups?.filter((g2) => g2.secondary).flatMap((g2) => g2.series.flatMap((s) => s.values))
41521
+ );
41522
+ model.axes = out;
41523
+ }
41524
+
41125
41525
  // chart/treemap-squarify.ts
41126
41526
  function worstAspectRatio(areas, side) {
41127
41527
  const sum3 = areas.reduce((total2, area) => total2 + area, 0);
@@ -41594,15 +41994,15 @@ function seriesName(series, index3, evaluateRef) {
41594
41994
  const fromRef = resolveRef(series.nameRef, evaluateRef)?.map(toText2).filter((t) => t !== "").join(" ");
41595
41995
  return fromRef || series.name || `Series${index3 + 1}`;
41596
41996
  }
41597
- function seriesContext(chart, theme2, options) {
41997
+ function seriesContext(chart, theme2, options2) {
41598
41998
  const scheme = chartColorScheme(theme2);
41599
41999
  const resolver = { scheme: (name) => scheme[name] };
41600
42000
  return {
41601
42001
  theme: theme2,
41602
42002
  scheme,
41603
42003
  palette: chart.colorPalette === void 0 ? void 0 : findChartColorPalette(chart.colorPalette),
41604
- evaluateRef: options.evaluateRef ?? (() => []),
41605
- seriesColor: options.seriesColor,
42004
+ evaluateRef: options2.evaluateRef ?? (() => []),
42005
+ seriesColor: options2.seriesColor,
41606
42006
  drawingColor: (color) => color && drawingColorCss(resolveDrawingColor(color, resolver, { transformOrder: "document" })),
41607
42007
  gradient: (fill) => fill?.kind === "gradient" ? resolveChartGradient(
41608
42008
  fill,
@@ -41628,7 +42028,11 @@ function seriesView(ctx, s, index3, total2, categoriesOf) {
41628
42028
  })
41629
42029
  );
41630
42030
  if (Object.keys(points).length) view.pointGradients = points;
41631
- Object.assign(view, analysisView(s, color, ctx.drawingColor));
42031
+ Object.assign(
42032
+ view,
42033
+ analysisView(s, color, ctx.drawingColor),
42034
+ seriesMarkerViews(s, ctx.drawingColor)
42035
+ );
41632
42036
  return view;
41633
42037
  }
41634
42038
 
@@ -41934,14 +42338,14 @@ function scottBinCount(values2, min, max) {
41934
42338
  const width = 3.49 * sd * values2.length ** (-1 / 3);
41935
42339
  return Math.max(1, Math.ceil((max - min) / width));
41936
42340
  }
41937
- function computeHistogramBins(values2, options, format = String) {
41938
- const closed = options.intervalClosed ?? "l";
42341
+ function computeHistogramBins(values2, options2, format = String) {
42342
+ const closed = options2.intervalClosed ?? "l";
41939
42343
  const finite2 = values2.map((value2, sourceIndex) => ({ value: value2, sourceIndex })).filter((item) => Number.isFinite(item.value));
41940
42344
  if (finite2.length === 0) {
41941
42345
  return [];
41942
42346
  }
41943
- const underflow = typeof options.underflow === "number" ? options.underflow : void 0;
41944
- const overflow = typeof options.overflow === "number" ? options.overflow : void 0;
42347
+ const underflow = typeof options2.underflow === "number" ? options2.underflow : void 0;
42348
+ const overflow = typeof options2.overflow === "number" ? options2.overflow : void 0;
41945
42349
  const under = underflow === void 0 ? [] : finite2.filter(
41946
42350
  (item) => closed === "r" ? item.value <= underflow : item.value < underflow
41947
42351
  );
@@ -41958,8 +42362,8 @@ function computeHistogramBins(values2, options, format = String) {
41958
42362
  if (regular.length > 0) {
41959
42363
  const min = Math.min(...regular.map((item) => item.value));
41960
42364
  const max = Math.max(...regular.map((item) => item.value));
41961
- const requestedSize = options.binSize && options.binSize > 0 ? options.binSize : void 0;
41962
- const requestedCount = options.binCount && options.binCount > 0 ? options.binCount : void 0;
42365
+ const requestedSize = options2.binSize && options2.binSize > 0 ? options2.binSize : void 0;
42366
+ const requestedCount = options2.binCount && options2.binCount > 0 ? options2.binCount : void 0;
41963
42367
  const start = requestedSize ? Math.floor(min / requestedSize) * requestedSize : min;
41964
42368
  const count2 = requestedSize ? Math.max(
41965
42369
  closed === "l" ? Math.floor((max - start) / requestedSize) + 1 : Math.ceil((max - start) / requestedSize),
@@ -42010,9 +42414,9 @@ function aggregateByCategory(values2, rawCategories) {
42010
42414
  }
42011
42415
 
42012
42416
  // chart/waterfall.ts
42013
- function buildWaterfallSteps(values2, options) {
42417
+ function buildWaterfallSteps(values2, options2) {
42014
42418
  const subtotalIndices = new Set(
42015
- options?.subtotalIndices ?? (values2.length > 0 ? [values2.length - 1] : [])
42419
+ options2?.subtotalIndices ?? (values2.length > 0 ? [values2.length - 1] : [])
42016
42420
  );
42017
42421
  const steps = [];
42018
42422
  let runningTotal = 0;
@@ -42096,11 +42500,11 @@ function histogramView(chart, model) {
42096
42500
  const first2 = model.series[0];
42097
42501
  if (!first2) return;
42098
42502
  const raw2 = first2.values.map((v) => v ?? Number.NaN);
42099
- const options = chart.histogram ?? {};
42100
- const bins = options.aggregateByCategory ? aggregateByCategory(
42503
+ const options2 = chart.histogram ?? {};
42504
+ const bins = options2.aggregateByCategory ? aggregateByCategory(
42101
42505
  first2.values.map((v) => v ?? 0),
42102
42506
  model.categories
42103
- ) : computeHistogramBins(raw2, options, formatAxisValue);
42507
+ ) : computeHistogramBins(raw2, options2, formatAxisValue);
42104
42508
  model.categories = bins.map((bin) => bin.label);
42105
42509
  first2.values = bins.map((bin) => bin.value);
42106
42510
  model.barGapWidth = 0;
@@ -42124,11 +42528,11 @@ var SUPPORTED = /* @__PURE__ */ new Set([
42124
42528
  "treemap",
42125
42529
  "sunburst"
42126
42530
  ]);
42127
- function chartSummaryView(chart, theme2, options = {}) {
42531
+ function chartSummaryView(chart, theme2, options2 = {}) {
42128
42532
  const type = chart.chartType;
42129
42533
  const radial = type === "pie" || type === "doughnut";
42130
42534
  const byPoint = radial || type === "treemap" || type === "sunburst";
42131
- const ctx = seriesContext(chart, theme2, options);
42535
+ const ctx = seriesContext(chart, theme2, options2);
42132
42536
  const { palette, scheme, drawingColor } = ctx;
42133
42537
  const grouping = chart.grouping ?? (type === "bar" || type === "column" ? "clustered" : "standard");
42134
42538
  const rawCategories = [];
@@ -42214,6 +42618,7 @@ function chartSummaryView(chart, theme2, options = {}) {
42214
42618
  else if (!byPoint) model.valueAxis = valueAxis(model);
42215
42619
  applyDataLabels(model, chart.series, extra);
42216
42620
  chartExtraAxes(model);
42621
+ applyChartAxes(model, chart, ctx.drawingColor);
42217
42622
  return model;
42218
42623
  }
42219
42624
 
@@ -42245,18 +42650,18 @@ function chartSampleVariance(values2) {
42245
42650
  const mean2 = values2.reduce((sum3, value2) => sum3 + value2, 0) / count2;
42246
42651
  return values2.reduce((sum3, value2) => sum3 + (value2 - mean2) ** 2, 0) / Math.max(count2 - 1, 1);
42247
42652
  }
42248
- function chartErrorBarAmount(options, values2, displayIndex, sourceIndex, side) {
42249
- switch (options.valueType) {
42653
+ function chartErrorBarAmount(options2, values2, displayIndex, sourceIndex, side) {
42654
+ switch (options2.valueType) {
42250
42655
  case "fixedVal":
42251
- return options.value ?? 0;
42656
+ return options2.value ?? 0;
42252
42657
  case "percentage":
42253
- return Math.abs(values2[displayIndex] ?? 0) * ((options.value ?? 0) / 100);
42658
+ return Math.abs(values2[displayIndex] ?? 0) * ((options2.value ?? 0) / 100);
42254
42659
  case "stdDev":
42255
- return Math.sqrt(chartSampleVariance(values2)) * (options.value ?? 1);
42660
+ return Math.sqrt(chartSampleVariance(values2)) * (options2.value ?? 1);
42256
42661
  case "stdErr":
42257
42662
  return Math.sqrt(chartSampleVariance(values2) / Math.max(values2.length, 1));
42258
42663
  case "cust":
42259
- return side === "plus" ? options.customPlus?.[sourceIndex] ?? 0 : options.customMinus?.[sourceIndex] ?? 0;
42664
+ return side === "plus" ? options2.customPlus?.[sourceIndex] ?? 0 : options2.customMinus?.[sourceIndex] ?? 0;
42260
42665
  }
42261
42666
  }
42262
42667
 
@@ -42393,13 +42798,13 @@ var noFit = () => ({
42393
42798
  rSquared: 0,
42394
42799
  coefficients: []
42395
42800
  });
42396
- function fitModel(options, xVals, yVals) {
42801
+ function fitModel(options2, xVals, yVals) {
42397
42802
  const xs = [...xVals];
42398
42803
  const ys = [...yVals];
42399
- switch (options.kind) {
42804
+ switch (options2.kind) {
42400
42805
  case "linear": {
42401
42806
  const reg = computeLinearRegression(xs, ys);
42402
- const fixed2 = options.intercept;
42807
+ const fixed2 = options2.intercept;
42403
42808
  const slope = fixed2 !== void 0 ? ys.reduce((s, y, i2) => s + (y - fixed2) * xs[i2], 0) / xs.reduce((s, x) => s + x * x, 0) : reg.slope;
42404
42809
  const b = fixed2 ?? reg.intercept;
42405
42810
  return {
@@ -42449,7 +42854,7 @@ function fitModel(options, xVals, yVals) {
42449
42854
  };
42450
42855
  }
42451
42856
  case "polynomial": {
42452
- const order = Math.min(options.order ?? 2, 6);
42857
+ const order = Math.min(options2.order ?? 2, 6);
42453
42858
  const coeffs = fitPolynomial(xs, ys, order);
42454
42859
  const evaluate = (x) => coeffs.reduce((s, c2, i2) => s + c2 * x ** i2, 0);
42455
42860
  return {
@@ -42463,11 +42868,11 @@ function fitModel(options, xVals, yVals) {
42463
42868
  return void 0;
42464
42869
  }
42465
42870
  }
42466
- function fitChartTrendline(options, xVals, yVals) {
42871
+ function fitChartTrendline(options2, xVals, yVals) {
42467
42872
  const count2 = yVals.length;
42468
42873
  if (count2 < 2) return noFit();
42469
- if (options.kind === "movingAvg") {
42470
- const period = options.period ?? 2;
42874
+ if (options2.kind === "movingAvg") {
42875
+ const period = options2.period ?? 2;
42471
42876
  const points2 = [];
42472
42877
  for (let i2 = period - 1; i2 < count2; i2++) {
42473
42878
  let sum3 = 0;
@@ -42476,10 +42881,10 @@ function fitChartTrendline(options, xVals, yVals) {
42476
42881
  }
42477
42882
  return { points: points2, equation: `${period}-period moving average`, rSquared: 0, coefficients: [] };
42478
42883
  }
42479
- const model = fitModel(options, xVals, yVals);
42884
+ const model = fitModel(options2, xVals, yVals);
42480
42885
  if (!model) return noFit();
42481
- const startX = Math.min(...xVals) - (options.backward ?? 0);
42482
- const endX = Math.max(...xVals) + (options.forward ?? 0);
42886
+ const startX = Math.min(...xVals) - (options2.backward ?? 0);
42887
+ const endX = Math.max(...xVals) + (options2.forward ?? 0);
42483
42888
  const steps = Math.max(Math.ceil((endX - startX) * 4), 20);
42484
42889
  const points = [];
42485
42890
  for (let step2 = 0; step2 <= steps; step2++) {
@@ -42656,7 +43061,7 @@ function chartTextAttributes(model, part, fallbackSize = FONT_SIZE) {
42656
43061
  function chartStroke(model, part) {
42657
43062
  const entry3 = model.appearance?.[part];
42658
43063
  return {
42659
- color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part === "gridlineMajor" ? GRID_COLOR : AXIS_COLOR),
43064
+ color: entry3?.axisVisible === false ? "none" : entry3?.lineColor ?? (part.startsWith("gridline") ? GRID_COLOR : AXIS_COLOR),
42660
43065
  width: entry3?.lineWidth === void 0 ? 1 : chartPointsToPixels(entry3.lineWidth)
42661
43066
  };
42662
43067
  }
@@ -42947,19 +43352,102 @@ function scatterAnalysis(model, px, py, out) {
42947
43352
  });
42948
43353
  }
42949
43354
 
43355
+ // chart/render/chart-svg-markers.ts
43356
+ function chartMarkerRadius(series, index3, defaultRadius = 3) {
43357
+ const marker3 = { ...series.marker, ...series.pointMarkers?.[index3] };
43358
+ if (marker3.symbol === "none") return 0;
43359
+ const radius = markerRadius(marker3.size, defaultRadius);
43360
+ return marker3.symbol === "dot" ? Math.max(radius * 0.6, 1) : radius;
43361
+ }
43362
+ function chartSeriesMarkerSvg(series, index3, cx2, cy, defaultRadius = 3) {
43363
+ const marker3 = { ...series.marker, ...series.pointMarkers?.[index3] };
43364
+ const primitive = buildMarkerPrimitive({
43365
+ ...marker3,
43366
+ symbol: marker3.symbol,
43367
+ size: marker3.size,
43368
+ cx: cx2,
43369
+ cy,
43370
+ fill: marker3.fill ?? series.pointColors?.[index3] ?? series.color,
43371
+ defaultRadius
43372
+ });
43373
+ if (!primitive) return "";
43374
+ let geometry;
43375
+ switch (primitive.kind) {
43376
+ case "circle":
43377
+ geometry = `cx="${n(primitive.cx)}" cy="${n(primitive.cy)}" r="${n(primitive.r)}"`;
43378
+ break;
43379
+ case "rect":
43380
+ geometry = `x="${n(primitive.x)}" y="${n(primitive.y)}" width="${n(primitive.w)}" height="${n(primitive.h)}"`;
43381
+ break;
43382
+ case "path":
43383
+ geometry = `d="${esc(primitive.d)}"`;
43384
+ break;
43385
+ case "polygon":
43386
+ geometry = `points="${esc(primitive.points)}"`;
43387
+ break;
43388
+ }
43389
+ const outline = primitive.stroke ? ` stroke="${esc(primitive.stroke)}" stroke-width="${n(primitive.strokeWidth ?? 1)}"` : "";
43390
+ const filter2 = series.shadowFilter ? ` filter="${esc(series.shadowFilter)}"` : "";
43391
+ return `<${primitive.kind} ${geometry} fill="${esc(primitive.fill)}"${outline}${filter2}/>`;
43392
+ }
43393
+
43394
+ // chart/line-dash.ts
43395
+ function chartLineDashArray(style2, width) {
43396
+ if (!style2 || style2 === "solid") {
43397
+ return void 0;
43398
+ }
43399
+ const unit = Math.max(width, 1);
43400
+ if (style2 === "dot" || style2 === "sysDot") {
43401
+ return `${unit} ${unit * 2}`;
43402
+ }
43403
+ if (style2 === "lgDash") {
43404
+ return `${unit * 6} ${unit * 3}`;
43405
+ }
43406
+ return `${unit * 3} ${unit * 2}`;
43407
+ }
43408
+
43409
+ // chart/render/chart-svg-axes.ts
43410
+ function axisTickText(value2, axis, percent2 = false) {
43411
+ return formatChartNumber(value2, axis?.source.numberFormat?.formatCode) ?? formatAxisValue(value2, percent2);
43412
+ }
43413
+ function axisLine(model, axis, part, x1, y1, x2, y2) {
43414
+ if (axis?.source.deleted) return "";
43415
+ return styledAxisLine(x1, y1, x2, y2, axis?.line, chartStroke(model, part));
43416
+ }
43417
+ function styledAxisLine(x1, y1, x2, y2, paint2, fallback) {
43418
+ const color = paint2?.color ?? fallback.color;
43419
+ const width = paint2?.width ?? fallback.width;
43420
+ if (color === "none" || width === 0) return "";
43421
+ const dash = chartLineDashArray(paint2?.dash, width);
43422
+ return line2(x1, y1, x2, y2, esc(color), width).replace(
43423
+ "/>",
43424
+ dash ? ` stroke-dasharray="${dash}"/>` : "/>"
43425
+ );
43426
+ }
43427
+ function axisGridlines(model, axis, ticks, position, plot2, vertical) {
43428
+ const draw2 = (values2, paint2, minor2) => {
43429
+ const fallback = chartStroke(model, minor2 ? "gridlineMinor" : "gridlineMajor");
43430
+ return values2.map((value2) => {
43431
+ const p = position(value2);
43432
+ return vertical ? styledAxisLine(p, plot2.y, p, plot2.y + plot2.h, paint2, fallback) : styledAxisLine(plot2.x, p, plot2.x + plot2.w, p, paint2, fallback);
43433
+ }).join("");
43434
+ };
43435
+ const major = !axis || axis.source.majorGridlines ? draw2(ticks, axis?.majorGrid, false) : "";
43436
+ const minor = axis?.source.minorGridlines ? draw2(axis.minorTicks, axis.minorGrid, true) : "";
43437
+ return major + minor;
43438
+ }
43439
+
42950
43440
  // chart/render/chart-svg-cartesian.ts
42951
43441
  function cartesianAxes(model, area, out) {
42952
43442
  const scale2 = model.valueAxis;
42953
43443
  if (!scale2) return void 0;
42954
- const labels = scale2.ticks.map((t) => formatAxisValue(t, scale2.percent));
43444
+ const labels = scale2.ticks.map((t) => axisTickText(t, model.axes?.value, scale2.percent));
42955
43445
  const valueAttrs = chartTextAttributes(model, "valueAxis");
42956
43446
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
42957
43447
  const valueSize = valueAttrs.size ?? 10;
42958
43448
  const categorySize = categoryAttrs.size ?? 10;
42959
- const grid = chartStroke(model, "gridlineMajor");
42960
- const axis = chartStroke(model, "categoryAxis");
42961
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
42962
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
43449
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
43450
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
42963
43451
  const labelW = valueLabels ? Math.max(...labels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
42964
43452
  const horizontal = model.horizontal;
42965
43453
  const cats = Math.max(1, model.categories.length);
@@ -42968,7 +43456,7 @@ function cartesianAxes(model, area, out) {
42968
43456
  Math.max(...model.categories.map((c2) => textWidth(c2, categorySize)), 8) + 6
42969
43457
  );
42970
43458
  const second = horizontal ? void 0 : model.secondaryAxis;
42971
- const secondLabels = second?.ticks.map((t) => formatAxisValue(t, second.percent)) ?? [];
43459
+ const secondLabels = second?.ticks.map((t) => axisTickText(t, model.axes?.secondary, second.percent)) ?? [];
42972
43460
  const secondW = second ? valueLabels ? Math.max(...secondLabels.map((l) => textWidth(l, valueSize)), 8) + 8 : 4 : 0;
42973
43461
  const plot2 = horizontal ? {
42974
43462
  x: area.x + catW,
@@ -42981,29 +43469,47 @@ function cartesianAxes(model, area, out) {
42981
43469
  w: Math.max(1, area.w - labelW - 4 - secondW),
42982
43470
  h: Math.max(1, area.h - Math.max(20, categorySize * 1.5))
42983
43471
  };
42984
- const span3 = scale2.max - scale2.min || 1;
42985
- const value2 = horizontal ? (v) => plot2.x + (v - scale2.min) / span3 * plot2.w : (v) => plot2.y + plot2.h - (v - scale2.min) / span3 * plot2.h;
43472
+ const value2 = horizontal ? (v) => plot2.x + chartAxisRatio(v, scale2, model.axes?.value) * plot2.w : (v) => plot2.y + plot2.h - chartAxisRatio(v, scale2, model.axes?.value) * plot2.h;
42986
43473
  const bandSize = (horizontal ? plot2.h : plot2.w) / cats;
42987
- const band = horizontal ? (i2) => plot2.y + plot2.h - bandSize * (i2 + 0.5) : (i2) => plot2.x + bandSize * (i2 + 0.5);
43474
+ const index3 = (i2) => model.axes?.category?.range.reverseOrder ? cats - 1 - i2 : i2;
43475
+ const band = horizontal ? (i2) => plot2.y + plot2.h - bandSize * (index3(i2) + 0.5) : (i2) => plot2.x + bandSize * (index3(i2) + 0.5);
42988
43476
  out.push(chartAreaRect(model, "plotArea", plot2));
43477
+ out.push(axisGridlines(model, model.axes?.value, scale2.ticks, value2, plot2, horizontal));
43478
+ if (model.axes?.category?.source.majorGridlines || model.axes?.category?.source.minorGridlines)
43479
+ out.push(
43480
+ axisGridlines(
43481
+ model,
43482
+ model.axes.category,
43483
+ model.categories.map((_, i2) => i2),
43484
+ band,
43485
+ plot2,
43486
+ !horizontal
43487
+ )
43488
+ );
42989
43489
  scale2.ticks.forEach((t, i2) => {
42990
43490
  const p = value2(t);
42991
43491
  const label2 = labels[i2] ?? "";
42992
43492
  if (horizontal) {
42993
- out.push(line2(p, plot2.y, p, plot2.y + plot2.h, grid.color, grid.width));
42994
43493
  if (valueLabels)
42995
43494
  out.push(
42996
43495
  text3(p, plot2.y + plot2.h + valueSize + 2, label2, { anchor: "middle", ...valueAttrs })
42997
43496
  );
42998
43497
  } else {
42999
- out.push(line2(plot2.x, p, plot2.x + plot2.w, p, grid.color, grid.width));
43000
43498
  if (valueLabels)
43001
43499
  out.push(text3(plot2.x - 4, p + valueSize * 0.3, label2, { anchor: "end", ...valueAttrs }));
43002
43500
  }
43003
43501
  });
43004
- const zero = value2(Math.min(Math.max(0, scale2.min), scale2.max));
43005
- if (horizontal) out.push(line2(zero, plot2.y, zero, plot2.y + plot2.h, axis.color, axis.width));
43006
- else out.push(line2(plot2.x, zero, plot2.x + plot2.w, zero, axis.color, axis.width));
43502
+ const source2 = model.axes?.value?.source;
43503
+ const crossing = source2?.crosses === "max" ? scale2.max : source2?.crosses === "min" ? scale2.min : source2?.crossesAt ?? 0;
43504
+ const zero = value2(Math.min(Math.max(crossing, scale2.min), scale2.max));
43505
+ if (horizontal)
43506
+ out.push(
43507
+ axisLine(model, model.axes?.category, "categoryAxis", zero, plot2.y, zero, plot2.y + plot2.h)
43508
+ );
43509
+ else
43510
+ out.push(
43511
+ axisLine(model, model.axes?.category, "categoryAxis", plot2.x, zero, plot2.x + plot2.w, zero)
43512
+ );
43007
43513
  const step2 = Math.max(
43008
43514
  1,
43009
43515
  Math.ceil(cats / Math.max(1, Math.floor((horizontal ? plot2.h : plot2.w) / 14)))
@@ -43028,20 +43534,23 @@ function cartesianAxes(model, area, out) {
43028
43534
  });
43029
43535
  const frame = { plot: plot2, value: value2, band, bandSize };
43030
43536
  if (second) {
43031
- const secondSpan = second.max - second.min || 1;
43032
- frame.secondary = (v) => plot2.y + plot2.h - (v - second.min) / secondSpan * plot2.h;
43033
- const secondAxis = chartStroke(model, "valueAxis");
43537
+ frame.secondary = (v) => plot2.y + plot2.h - chartAxisRatio(v, second, model.axes?.secondary) * plot2.h;
43034
43538
  out.push(
43035
- line2(
43539
+ axisLine(
43540
+ model,
43541
+ model.axes?.secondary,
43542
+ "valueAxis",
43036
43543
  plot2.x + plot2.w,
43037
43544
  plot2.y,
43038
43545
  plot2.x + plot2.w,
43039
- plot2.y + plot2.h,
43040
- secondAxis.color,
43041
- secondAxis.width
43546
+ plot2.y + plot2.h
43042
43547
  )
43043
43548
  );
43044
- if (valueLabels)
43549
+ if (model.axes?.secondary?.source.majorGridlines || model.axes?.secondary?.source.minorGridlines)
43550
+ out.push(
43551
+ axisGridlines(model, model.axes.secondary, second.ticks, frame.secondary, plot2, false)
43552
+ );
43553
+ if (chartAxisLabels(model.axes?.secondary))
43045
43554
  second.ticks.forEach(
43046
43555
  (t, i2) => out.push(
43047
43556
  text3(plot2.x + plot2.w + 4, frame.secondary(t) + valueSize * 0.3, secondLabels[i2] ?? "", {
@@ -43085,18 +43594,19 @@ function linesAndAreas(model, frame, out) {
43085
43594
  index: i2,
43086
43595
  x: frame.band(i2),
43087
43596
  y: frame.value(top),
43088
- radius: area ? 0 : 3
43597
+ radius: area ? 0 : chartMarkerRadius(s, i2, 2.5)
43089
43598
  });
43090
43599
  lower3.push([frame.band(i2), frame.value(below)]);
43091
43600
  });
43092
43601
  layers.push({
43602
+ series: s,
43093
43603
  points,
43094
43604
  lower: lower3,
43095
43605
  color: s.color,
43096
43606
  filter: s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""
43097
43607
  });
43098
43608
  });
43099
- for (const { points, lower: lower3, color, filter: filter2 } of area ? [...layers].reverse() : layers) {
43609
+ for (const { points, lower: lower3, color, filter: filter2, series } of area ? [...layers].reverse() : layers) {
43100
43610
  if (area) {
43101
43611
  const poly = [...points, ...[...lower3].reverse()].map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
43102
43612
  out.push(`<polygon points="${poly}" fill="${color}" fill-opacity="0.85"${filter2}/>`);
@@ -43115,20 +43625,20 @@ function linesAndAreas(model, frame, out) {
43115
43625
  else segment2.push(`${n(x)},${n(y)}`);
43116
43626
  }
43117
43627
  flush();
43118
- for (const [x, y] of points)
43119
- if (!Number.isNaN(x))
43120
- out.push(`<circle cx="${n(x)}" cy="${n(y)}" r="2.5" fill="${color}"${filter2}/>`);
43628
+ points.forEach(([x, y], index3) => {
43629
+ if (!Number.isNaN(x)) out.push(chartSeriesMarkerSvg(series, index3, x, y, 2.5));
43630
+ });
43121
43631
  }
43122
43632
  pointLabels(model, marks, out);
43123
43633
  }
43124
43634
 
43125
43635
  // chart/bubble-radius.ts
43126
- function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options) {
43127
- const scale2 = (options?.bubbleScale ?? 100) / 100;
43636
+ function computeBubbleRadius(sizeVal, maxBubble, medianRadius, options2) {
43637
+ const scale2 = (options2?.bubbleScale ?? 100) / 100;
43128
43638
  if (sizeVal === void 0) return medianRadius * scale2;
43129
43639
  const denom = maxBubble > 0 ? maxBubble : 1;
43130
43640
  const magnitude = Math.abs(sizeVal);
43131
- const ratio = (options?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
43641
+ const ratio = (options2?.sizeRepresents ?? "w") === "area" ? Math.sqrt(magnitude) / Math.sqrt(denom) : magnitude / denom;
43132
43642
  return medianRadius * scale2 * 0.5 + ratio * medianRadius * scale2 * 1.5;
43133
43643
  }
43134
43644
  function maxBubbleSize(sizes) {
@@ -43143,16 +43653,14 @@ function scatter(model, area, out) {
43143
43653
  const ys = model.valueAxis;
43144
43654
  const xs = model.xAxis;
43145
43655
  if (!ys || !xs) return;
43146
- const yLabels = ys.ticks.map((t) => formatAxisValue(t));
43656
+ const yLabels = ys.ticks.map((t) => axisTickText(t, model.axes?.value));
43147
43657
  const valueAttrs = chartTextAttributes(model, "valueAxis");
43148
43658
  const categoryAttrs = chartTextAttributes(model, "categoryAxis");
43149
43659
  const valueSize = valueAttrs.size ?? 10;
43150
43660
  const categorySize = categoryAttrs.size ?? 10;
43151
- const grid = chartStroke(model, "gridlineMajor");
43152
43661
  const xAxis = chartStroke(model, "categoryAxis");
43153
- const yAxis = chartStroke(model, "valueAxis");
43154
- const valueLabels = model.appearance?.valueAxis?.labelsVisible !== false;
43155
- const categoryLabels = model.appearance?.categoryAxis?.labelsVisible !== false;
43662
+ const valueLabels = chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false;
43663
+ const categoryLabels = chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false;
43156
43664
  const labelW = valueLabels ? Math.max(...yLabels.map((l) => textWidth(l, valueSize)), 8) + 6 : 4;
43157
43665
  const plot2 = {
43158
43666
  x: area.x + labelW,
@@ -43172,17 +43680,24 @@ function scatter(model, area, out) {
43172
43680
  s.values.forEach((_, i2) => {
43173
43681
  reach = Math.max(reach, radiusOf(s.sizes?.[i2] ?? void 0) ?? 0);
43174
43682
  });
43175
- const widen = (s, length) => {
43683
+ const widen = (s, length, axis) => {
43684
+ if (axis?.range.logScale) return s;
43176
43685
  const pad7 = reach * (s.max - s.min || 1) / Math.max(1, length - 2 * reach);
43177
- return { ...s, min: s.min - pad7, max: s.max + pad7 };
43686
+ return {
43687
+ ...s,
43688
+ min: axis?.source.scaling.min === void 0 ? s.min - pad7 : s.min,
43689
+ max: axis?.source.scaling.max === void 0 ? s.max + pad7 : s.max
43690
+ };
43178
43691
  };
43179
- const xView = widen(xs, plot2.w);
43180
- const yView = widen(ys, plot2.h);
43181
- const px = (v) => plot2.x + (v - xView.min) / (xView.max - xView.min || 1) * plot2.w;
43182
- const py = (v) => plot2.y + plot2.h - (v - yView.min) / (yView.max - yView.min || 1) * plot2.h;
43692
+ const xView = widen(xs, plot2.w, model.axes?.category);
43693
+ const yView = widen(ys, plot2.h, model.axes?.value);
43694
+ const px = (v) => plot2.x + chartAxisRatio(v, xView, model.axes?.category) * plot2.w;
43695
+ const py = (v) => plot2.y + plot2.h - chartAxisRatio(v, yView, model.axes?.value) * plot2.h;
43183
43696
  out.push(chartAreaRect(model, "plotArea", plot2));
43697
+ out.push(axisGridlines(model, model.axes?.value, ys.ticks, py, plot2, false));
43698
+ if (model.axes?.category)
43699
+ out.push(axisGridlines(model, model.axes.category, xs.ticks, px, plot2, true));
43184
43700
  ys.ticks.forEach((t, i2) => {
43185
- out.push(line2(plot2.x, py(t), plot2.x + plot2.w, py(t), grid.color, grid.width));
43186
43701
  if (valueLabels)
43187
43702
  out.push(
43188
43703
  text3(plot2.x - 4, py(t) + valueSize * 0.3, yLabels[i2] ?? "", {
@@ -43192,19 +43707,30 @@ function scatter(model, area, out) {
43192
43707
  );
43193
43708
  });
43194
43709
  for (const t of xs.ticks) {
43195
- out.push(line2(px(t), plot2.y + plot2.h, px(t), plot2.y + plot2.h + 3, xAxis.color, xAxis.width));
43710
+ if (!model.axes?.category?.source.deleted)
43711
+ out.push(line2(px(t), plot2.y + plot2.h, px(t), plot2.y + plot2.h + 3, xAxis.color, xAxis.width));
43196
43712
  if (categoryLabels)
43197
43713
  out.push(
43198
- text3(px(t), plot2.y + plot2.h + categorySize + 3, formatAxisValue(t), {
43714
+ text3(px(t), plot2.y + plot2.h + categorySize + 3, axisTickText(t, model.axes?.category), {
43199
43715
  anchor: "middle",
43200
43716
  ...categoryAttrs
43201
43717
  })
43202
43718
  );
43203
43719
  }
43204
43720
  out.push(
43205
- line2(plot2.x, plot2.y + plot2.h, plot2.x + plot2.w, plot2.y + plot2.h, xAxis.color, xAxis.width)
43721
+ axisLine(
43722
+ model,
43723
+ model.axes?.category,
43724
+ "categoryAxis",
43725
+ plot2.x,
43726
+ plot2.y + plot2.h,
43727
+ plot2.x + plot2.w,
43728
+ plot2.y + plot2.h
43729
+ )
43730
+ );
43731
+ out.push(
43732
+ axisLine(model, model.axes?.value, "valueAxis", plot2.x, plot2.y, plot2.x, plot2.y + plot2.h)
43206
43733
  );
43207
- out.push(line2(plot2.x, plot2.y, plot2.x, plot2.y + plot2.h, yAxis.color, yAxis.width));
43208
43734
  const marks = [];
43209
43735
  for (const [si, s] of model.series.entries())
43210
43736
  s.values.forEach((v, i2) => {
@@ -43213,8 +43739,8 @@ function scatter(model, area, out) {
43213
43739
  const filter2 = s.shadowFilter ? ` filter="${s.shadowFilter}"` : "";
43214
43740
  const fill = s.pointColors?.[i2] ?? s.color;
43215
43741
  if (!bubble) {
43216
- out.push(`<circle cx="${n(px(x))}" cy="${n(py(v))}" r="3" fill="${fill}"${filter2}/>`);
43217
- marks.push({ series: s, index: i2, x: px(x), y: py(v), radius: 3 });
43742
+ out.push(chartSeriesMarkerSvg(s, i2, px(x), py(v)));
43743
+ marks.push({ series: s, index: i2, x: px(x), y: py(v), radius: chartMarkerRadius(s, i2) });
43218
43744
  return;
43219
43745
  }
43220
43746
  const r = radiusOf(s.sizes?.[i2] ?? void 0);
@@ -43434,32 +43960,37 @@ function radarSvg(model, area) {
43434
43960
  const valueSize = valueAttrs.size ?? 9;
43435
43961
  const categorySize = categoryAttrs.size ?? 10;
43436
43962
  const grid = chartStroke(model, "gridlineMajor");
43437
- const axis = chartStroke(model, "categoryAxis");
43438
43963
  const cx2 = area.x + area.w / 2;
43439
43964
  const cy = area.y + area.h / 2 + 4;
43440
43965
  const radius = Math.max(1, Math.min(area.w, area.h) / 2 - Math.max(18, categorySize * 1.8));
43441
43966
  const angle = (i2) => i2 / count2 * Math.PI * 2;
43442
- const r = (v) => (v - scale2.min) / (scale2.max - scale2.min || 1) * radius;
43967
+ const r = (v) => chartAxisRatio(v, scale2, model.axes?.value) * radius;
43443
43968
  const labelEvery = Math.max(
43444
43969
  1,
43445
43970
  Math.ceil(12 / Math.max(1, radius / Math.max(1, scale2.ticks.length - 1)))
43446
43971
  );
43447
43972
  for (const [k, t] of scale2.ticks.entries()) {
43448
43973
  const ring = Array.from({ length: count2 }, (_, i2) => polar2(cx2, cy, r(t), angle(i2))).map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
43449
- out.push(
43450
- `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
43451
- );
43452
- if (model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
43974
+ if (!model.axes?.value || model.axes.value.source.majorGridlines)
43453
43975
  out.push(
43454
- text3(cx2 + 3, cy - r(t) + valueSize * 0.3, formatAxisValue(t, scale2.percent), valueAttrs)
43976
+ `<polygon points="${ring}" fill="none" stroke="${grid.color}" stroke-width="${n(grid.width)}"/>`
43977
+ );
43978
+ if (chartAxisLabels(model.axes?.value) && model.appearance?.valueAxis?.labelsVisible !== false && k % labelEvery === 0)
43979
+ out.push(
43980
+ text3(
43981
+ cx2 + 3,
43982
+ cy - r(t) + valueSize * 0.3,
43983
+ axisTickText(t, model.axes?.value, scale2.percent),
43984
+ valueAttrs
43985
+ )
43455
43986
  );
43456
43987
  }
43457
43988
  model.categories.forEach((c2, i2) => {
43458
43989
  const [x, y] = polar2(cx2, cy, radius, angle(i2));
43459
- out.push(line2(cx2, cy, x, y, axis.color, axis.width));
43990
+ out.push(axisLine(model, model.axes?.category, "categoryAxis", cx2, cy, x, y));
43460
43991
  const [lx, ly] = polar2(cx2, cy, radius + 10, angle(i2));
43461
43992
  const anchor = Math.abs(lx - cx2) < 2 ? "middle" : lx > cx2 ? "start" : "end";
43462
- if (model.appearance?.categoryAxis?.labelsVisible !== false)
43993
+ if (chartAxisLabels(model.axes?.category) && model.appearance?.categoryAxis?.labelsVisible !== false)
43463
43994
  out.push(
43464
43995
  text3(lx, ly + categorySize * 0.3, fit(c2, area.w / 4, categorySize), {
43465
43996
  anchor,
@@ -43470,7 +44001,13 @@ function radarSvg(model, area) {
43470
44001
  const marks = [];
43471
44002
  for (const s of model.series) {
43472
44003
  const vertices = s.values.slice(0, count2).map((v, i2) => polar2(cx2, cy, r(v ?? scale2.min), angle(i2)));
43473
- vertices.forEach(([x, y], i2) => marks.push({ series: s, index: i2, x, y, radius: 3 }));
44004
+ vertices.forEach(([x, y], i2) => {
44005
+ if (s.values[i2] === null) return;
44006
+ const markerSeries = s;
44007
+ if (markerSeries.marker || markerSeries.pointMarkers)
44008
+ out.push(chartSeriesMarkerSvg(s, i2, x, y));
44009
+ marks.push({ series: s, index: i2, x, y, radius: chartMarkerRadius(s, i2) });
44010
+ });
43474
44011
  const points = vertices.map(([x, y]) => `${n(x)},${n(y)}`).join(" ");
43475
44012
  out.push(
43476
44013
  `<polygon points="${points}" fill="none" stroke="${s.color}" stroke-width="2"${s.shadowFilter ? ` filter="${s.shadowFilter}"` : ""}/>`
@@ -43660,33 +44197,33 @@ var CHART_FONT_FAMILY = "Calibri, Carlito, Arial, sans-serif";
43660
44197
  function cssFont(attrs2) {
43661
44198
  return `${attrs2.italic ? "italic" : "normal"} ${attrs2.weight ?? "normal"} ${attrs2.size ?? 10}px ${attrs2.family ?? CHART_FONT_FAMILY}`;
43662
44199
  }
43663
- function chartFontMetrics(attrs2, options) {
43664
- const metrics = options.measureFont?.(cssFont(attrs2));
44200
+ function chartFontMetrics(attrs2, options2) {
44201
+ const metrics = options2.measureFont?.(cssFont(attrs2));
43665
44202
  return metrics && Number.isFinite(metrics.ascent) && Number.isFinite(metrics.descent) && metrics.ascent >= 0 && metrics.descent >= 0 && metrics.ascent + metrics.descent > 0 ? metrics : void 0;
43666
44203
  }
43667
- function chartTextWidth(content2, attrs2, options) {
43668
- const width = options.measureText?.(content2, cssFont(attrs2));
44204
+ function chartTextWidth(content2, attrs2, options2) {
44205
+ const width = options2.measureText?.(content2, cssFont(attrs2));
43669
44206
  return width !== void 0 && Number.isFinite(width) && width >= 0 ? width : textWidth(content2, attrs2.size);
43670
44207
  }
43671
- function fitChartText(content2, maxWidth, attrs2, options) {
43672
- if (!options.measureText) return fit(content2, maxWidth, attrs2.size);
43673
- if (chartTextWidth(content2, attrs2, options) <= maxWidth) return content2;
44208
+ function fitChartText(content2, maxWidth, attrs2, options2) {
44209
+ if (!options2.measureText) return fit(content2, maxWidth, attrs2.size);
44210
+ if (chartTextWidth(content2, attrs2, options2) <= maxWidth) return content2;
43674
44211
  const points = [...content2];
43675
44212
  let low = 0;
43676
44213
  let high = points.length;
43677
44214
  while (low < high) {
43678
44215
  const mid = Math.ceil((low + high) / 2);
43679
- if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs2, options) <= maxWidth) low = mid;
44216
+ if (chartTextWidth(`${points.slice(0, mid).join("")}\u2026`, attrs2, options2) <= maxWidth) low = mid;
43680
44217
  else high = mid - 1;
43681
44218
  }
43682
44219
  return `${points.slice(0, low).join("")}\u2026`;
43683
44220
  }
43684
44221
 
43685
44222
  // chart/render/chart-svg-legend.ts
43686
- function chartLegendSvg(model, area, frame, options) {
44223
+ function chartLegendSvg(model, area, frame, options2) {
43687
44224
  const automatic = [];
43688
44225
  const bounds = {};
43689
- const reserved = automaticLegend(model, area, automatic, options, bounds);
44226
+ const reserved = automaticLegend(model, area, automatic, options2, bounds);
43690
44227
  const plot2 = model.legendOverlay ? area : reserved;
43691
44228
  const box2 = bounds.box;
43692
44229
  if (!box2) return { plot: plot2, markup: "", foreground: false };
@@ -43700,11 +44237,11 @@ function chartLegendSvg(model, area, frame, options) {
43700
44237
  const entries = legendEntries(model);
43701
44238
  const attrs2 = chartTextAttributes(model, "legend");
43702
44239
  const size = attrs2.size ?? 10;
43703
- const font = chartFontMetrics(attrs2, options);
44240
+ const font = chartFontMetrics(attrs2, options2);
43704
44241
  const keySize = size / 2;
43705
44242
  const keyGap = size / 4;
43706
44243
  const widths = entries.map(
43707
- (entry3) => chartTextWidth(entry3.label, attrs2, options) + keySize + keyGap
44244
+ (entry3) => chartTextWidth(entry3.label, attrs2, options2) + keySize + keyGap
43708
44245
  );
43709
44246
  const horizontal = manual.width > manual.height && widths.reduce((sum3, width) => sum3 + width, 0) + size <= manual.width;
43710
44247
  const rowWidth = horizontal ? manual.width / entries.length : manual.width;
@@ -43719,8 +44256,8 @@ function chartLegendSvg(model, area, frame, options) {
43719
44256
  ];
43720
44257
  const baselineOffset = font ? (font.ascent - font.descent) / 2 : size * 0.35;
43721
44258
  entries.forEach((entry3, i2) => {
43722
- const available = horizontal ? chartTextWidth(entry3.label, attrs2, options) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
43723
- const label2 = fitChartText(entry3.label, available, attrs2, options);
44259
+ const available = horizontal ? chartTextWidth(entry3.label, attrs2, options2) : Math.max(0, rowWidth - size / 2 - keySize - keyGap);
44260
+ const label2 = fitChartText(entry3.label, available, attrs2, options2);
43724
44261
  const contentWidth = Math.min(
43725
44262
  horizontal ? widths[i2] ?? 0 : Math.max(...widths),
43726
44263
  rowWidth - size / 2
@@ -43763,7 +44300,7 @@ function legendEntries(model) {
43763
44300
  color: s.color
43764
44301
  }));
43765
44302
  }
43766
- function automaticLegend(model, area, out, options, bounds) {
44303
+ function automaticLegend(model, area, out, options2, bounds) {
43767
44304
  const entries = legendEntries(model);
43768
44305
  if (!model.showLegend || entries.length === 0) return area;
43769
44306
  const pos = model.legendPosition;
@@ -43772,7 +44309,7 @@ function automaticLegend(model, area, out, options, bounds) {
43772
44309
  const rowH = Math.max(16, size * 1.4);
43773
44310
  if (pos === "t" || pos === "b") {
43774
44311
  const widths = entries.map(
43775
- (e) => Math.min(chartTextWidth(e.label, attrs2, options) + 20, area.w / 2)
44312
+ (e) => Math.min(chartTextWidth(e.label, attrs2, options2) + 20, area.w / 2)
43776
44313
  );
43777
44314
  const total2 = widths.reduce((a2, b) => a2 + b, 0);
43778
44315
  let x2 = area.x + Math.max(0, (area.w - total2) / 2);
@@ -43789,14 +44326,14 @@ function automaticLegend(model, area, out, options, bounds) {
43789
44326
  entries.forEach((e, i2) => {
43790
44327
  const w = widths[i2] ?? 0;
43791
44328
  out.push(rect(x2, y, 8, 8, e.color));
43792
- out.push(text3(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs2, options), attrs2));
44329
+ out.push(text3(x2 + 12, y + 8, fitChartText(e.label, w - 16, attrs2, options2), attrs2));
43793
44330
  x2 += w;
43794
44331
  });
43795
44332
  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 };
43796
44333
  }
43797
44334
  const width = Math.min(
43798
44335
  area.w * 0.35,
43799
- Math.max(...entries.map((e) => chartTextWidth(e.label, attrs2, options))) + 22
44336
+ Math.max(...entries.map((e) => chartTextWidth(e.label, attrs2, options2))) + 22
43800
44337
  );
43801
44338
  const height = entries.length * rowH;
43802
44339
  const x = pos === "l" ? area.x + 4 : area.x + area.w - width;
@@ -43814,14 +44351,14 @@ function automaticLegend(model, area, out, options, bounds) {
43814
44351
  const y = y0 + i2 * rowH;
43815
44352
  if (y + rowH > area.y + area.h + 2) return;
43816
44353
  out.push(rect(x, y + 3, 8, 8, e.color));
43817
- out.push(text3(x + 12, y + 11, fitChartText(e.label, width - 16, attrs2, options), attrs2));
44354
+ out.push(text3(x + 12, y + 11, fitChartText(e.label, width - 16, attrs2, options2), attrs2));
43818
44355
  });
43819
44356
  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 };
43820
44357
  }
43821
44358
 
43822
44359
  // text/wrap-styled-runs.ts
43823
44360
  var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
43824
- function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
44361
+ function wrapStyledRuns(runs, maxWidth, measure2, options2 = {}) {
43825
44362
  const groups = [];
43826
44363
  for (const [source2, run2] of runs.entries()) {
43827
44364
  for (const token of run2.text.split(/(\r\n|[\r\n]|[ \t]+)/u).filter(Boolean)) {
@@ -43869,7 +44406,7 @@ function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
43869
44406
  if (line3.length && width(merged(line3, [...separator, ...group2.pieces])) > maxWidth) flush();
43870
44407
  else line3 = merged(line3, separator);
43871
44408
  spaces = [];
43872
- if (options.breakWords && wordWidth > maxWidth) {
44409
+ if (options2.breakWords && wordWidth > maxWidth) {
43873
44410
  for (const piece of group2.pieces) {
43874
44411
  for (const { segment: segment2 } of graphemes.segment(piece.text)) {
43875
44412
  const next = { ...piece, text: segment2 };
@@ -43887,11 +44424,11 @@ function wrapStyledRuns(runs, maxWidth, measure2, options = {}) {
43887
44424
  function spacing2(value2, naturalHeight, fallback) {
43888
44425
  return value2 ? value2.unit === "points" ? chartPointsToPixels(value2.value) : naturalHeight * value2.value : fallback;
43889
44426
  }
43890
- function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
44427
+ function chartRichTitleSvg(model, width, options2 = {}, frameHeight = 400) {
43891
44428
  if (!model.title) return void 0;
43892
44429
  const base = chartTextAttributes(model, "title", 14);
43893
44430
  const capacity = Math.max(1, width * 0.8 - 8);
43894
- if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options) <= capacity)
44431
+ if (!model.titleText && !hasManualLayoutFields(model.titleLayout) && !model.titleOverlay && !model.title.includes("\n") && chartTextWidth(model.title, base, options2) <= capacity)
43895
44432
  return void 0;
43896
44433
  const paragraphs = model.titleText?.paragraphs ?? [
43897
44434
  {
@@ -43927,7 +44464,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
43927
44464
  "title",
43928
44465
  base.size
43929
44466
  ),
43930
- options
44467
+ options2
43931
44468
  ),
43932
44469
  { breakWords: true }
43933
44470
  );
@@ -43951,10 +44488,10 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
43951
44488
  return {
43952
44489
  ...line3,
43953
44490
  runs,
43954
- width: runs.reduce((sum3, run2) => sum3 + chartTextWidth(run2.text, run2.attrs, options), 0),
44491
+ width: runs.reduce((sum3, run2) => sum3 + chartTextWidth(run2.text, run2.attrs, options2), 0),
43955
44492
  size: runs.length ? Math.max(...runs.map((run2) => run2.attrs.size ?? 14)) : base.size ?? 14,
43956
44493
  fontMetrics: (runs.length ? runs.map((run2) => run2.attrs) : [base]).map(
43957
- (attrs2) => chartFontMetrics(attrs2, options)
44494
+ (attrs2) => chartFontMetrics(attrs2, options2)
43958
44495
  )
43959
44496
  };
43960
44497
  });
@@ -43992,7 +44529,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
43992
44529
  anchor: "start"
43993
44530
  }).replace("<text ", '<tspan data-chart-title-run="true" ').replace("</text>", "</tspan>")
43994
44531
  );
43995
- x += chartTextWidth(run2.text, run2.attrs, options);
44532
+ x += chartTextWidth(run2.text, run2.attrs, options2);
43996
44533
  }
43997
44534
  }
43998
44535
  const parent = text3(0, 0, "", { ...base, underline: false }).replace(
@@ -44018,7 +44555,7 @@ function chartRichTitleSvg(model, width, options = {}, frameHeight = 400) {
44018
44555
  }
44019
44556
 
44020
44557
  // chart/render/chart-svg.ts
44021
- function renderChartSvg(model, width, height, options = {}) {
44558
+ function renderChartSvg(model, width, height, options2 = {}) {
44022
44559
  const paint2 = chartGradientPaint(model, Math.max(1, width), Math.max(1, height));
44023
44560
  model = paint2.model;
44024
44561
  const w = Math.max(1, width);
@@ -44032,7 +44569,7 @@ function renderChartSvg(model, width, height, options = {}) {
44032
44569
  if (paint2.defs) out.push(paint2.defs);
44033
44570
  out.push(chartAreaRect(model, "chartArea", { x: 0, y: 0, w, h: h2 }));
44034
44571
  let area = { x: 8, y: 8, w: w - 16, h: h2 - 16 };
44035
- const richTitle = chartRichTitleSvg(model, w, options, h2);
44572
+ const richTitle = chartRichTitleSvg(model, w, options2, h2);
44036
44573
  if (richTitle) {
44037
44574
  if (model.titleLayout || model.titleOverlay) foregroundTitle = richTitle.markup;
44038
44575
  else out.push(richTitle.markup);
@@ -44041,9 +44578,9 @@ function renderChartSvg(model, width, height, options = {}) {
44041
44578
  } else if (model.title) {
44042
44579
  const attrs2 = chartTextAttributes(model, "title", 14);
44043
44580
  const size = attrs2.size ?? 14;
44044
- const label2 = fitChartText(model.title, w - 16, attrs2, options);
44045
- const titleWidth = Math.min(w - 16, chartTextWidth(label2, attrs2, options) + 8);
44046
- const font = chartFontMetrics(attrs2, options);
44581
+ const label2 = fitChartText(model.title, w - 16, attrs2, options2);
44582
+ const titleWidth = Math.min(w - 16, chartTextWidth(label2, attrs2, options2) + 8);
44583
+ const font = chartFontMetrics(attrs2, options2);
44047
44584
  const titleHeight = Math.max(24, font ? font.ascent + font.descent + 4 : size * 1.4 + 4);
44048
44585
  out.push(
44049
44586
  chartAreaRect(model, "title", {
@@ -44071,7 +44608,7 @@ function renderChartSvg(model, width, height, options = {}) {
44071
44608
  out.push("</svg>");
44072
44609
  return out.join("");
44073
44610
  }
44074
- const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options);
44611
+ const legend = chartLegendSvg(model, area, { width: w, height: h2 }, options2);
44075
44612
  area = legend.plot;
44076
44613
  if (!legend.foreground) out.push(legend.markup);
44077
44614
  if (area.w > 4 && area.h > 4) {
@@ -44127,11 +44664,11 @@ function readRange(workbook, sheetIndex2, range) {
44127
44664
  for (let c2 = range.start.col; c2 <= end.col; c2++) out.push(getValue(sheet, r, c2));
44128
44665
  return out;
44129
44666
  }
44130
- function createRefEvaluator(workbook, calc, options = {}) {
44667
+ function createRefEvaluator(workbook, calc, options2 = {}) {
44131
44668
  return (ref) => {
44132
44669
  const text4 = ref.trim().replace(/^=/, "");
44133
44670
  if (!text4) return [];
44134
- const sheetIndex2 = options.sheet ?? workbook.activeSheet;
44671
+ const sheetIndex2 = options2.sheet ?? workbook.activeSheet;
44135
44672
  const plain3 = plainReference(workbook, text4, sheetIndex2);
44136
44673
  if (plain3) return readRange(workbook, plain3.sheet, plain3.range);
44137
44674
  const named2 = /^_xlchart\./i.test(text4) ? workbook.definedNames.find(