@extend-ai/react-xlsx 0.24.0 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +8 -4
  2. package/dist/{chunk-DGNSB5M5.cjs → chunk-WW6G674Q.cjs} +728 -618
  3. package/dist/chunk-WW6G674Q.cjs.map +1 -0
  4. package/dist/{chunk-C4WTJIRG.js → chunk-XUHSQ3GF.js} +146 -36
  5. package/dist/chunk-XUHSQ3GF.js.map +1 -0
  6. package/dist/index.cjs +344 -234
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +9 -1
  9. package/dist/index.d.ts +9 -1
  10. package/dist/index.js +146 -36
  11. package/dist/index.js.map +1 -1
  12. package/dist/{internal-CwTqluL7.d.cts → internal-D5HReXVR.d.cts} +9 -1
  13. package/dist/{internal-CwTqluL7.d.ts → internal-D5HReXVR.d.ts} +9 -1
  14. package/dist/internal.cjs +2 -2
  15. package/dist/internal.d.cts +1 -1
  16. package/dist/internal.d.ts +1 -1
  17. package/dist/internal.js +1 -1
  18. package/dist/vanilla.cjs +2 -2
  19. package/dist/vanilla.d.cts +2 -2
  20. package/dist/vanilla.d.ts +2 -2
  21. package/dist/vanilla.js +1 -1
  22. package/dist/{workbook-runtime-QFXDLSSI.cjs → workbook-runtime-7WEPIK5Y.cjs} +41 -29
  23. package/dist/workbook-runtime-7WEPIK5Y.cjs.map +1 -0
  24. package/dist/{workbook-runtime-56Y3B64Y.js → workbook-runtime-BAAYDYYK.js} +17 -5
  25. package/dist/workbook-runtime-BAAYDYYK.js.map +1 -0
  26. package/dist/{workbook-runtime-7DSKESFL.js → workbook-runtime-FCKPXLTW.js} +17 -5
  27. package/dist/workbook-runtime-FCKPXLTW.js.map +1 -0
  28. package/dist/{workbook-runtime-MEI3CEWO.cjs → workbook-runtime-MOGSEJ5R.cjs} +41 -29
  29. package/dist/workbook-runtime-MOGSEJ5R.cjs.map +1 -0
  30. package/dist/xlsx-worker.js +16 -4
  31. package/dist/xlsx-worker.js.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/chunk-C4WTJIRG.js.map +0 -1
  34. package/dist/chunk-DGNSB5M5.cjs.map +0 -1
  35. package/dist/workbook-runtime-56Y3B64Y.js.map +0 -1
  36. package/dist/workbook-runtime-7DSKESFL.js.map +0 -1
  37. package/dist/workbook-runtime-MEI3CEWO.cjs.map +0 -1
  38. package/dist/workbook-runtime-QFXDLSSI.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -96,6 +96,80 @@ function* bandIndices(bands) {
96
96
  }
97
97
  }
98
98
 
99
+ // src/read-only-layout.ts
100
+ function changedVisibilityRanges(existing, ranges, hidden, fromSelection) {
101
+ if (!hidden && !existing.size) return [];
102
+ let firstVisible = 0;
103
+ if (!hidden && fromSelection) {
104
+ while (existing.has(firstVisible)) firstVisible++;
105
+ }
106
+ const changed = [];
107
+ for (const range of ranges) {
108
+ const start = firstVisible > 0 && range.start === firstVisible ? 0 : range.start;
109
+ for (let index = start; index <= range.end; index++) {
110
+ if (existing.has(index) !== hidden) {
111
+ changed.push({ start, end: range.end });
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ return changed;
117
+ }
118
+ function nextVisibleIndex(index, limit, isHidden) {
119
+ let next = index;
120
+ while (next < limit && isHidden(next)) next++;
121
+ if (next < limit) return next;
122
+ next = index - 1;
123
+ while (next >= 0 && isHidden(next)) next--;
124
+ return next;
125
+ }
126
+ function visibleAxis(hidden, max, originalIndices, originalSizes, overrides, defaultSize) {
127
+ const indices = [];
128
+ const sizes = [];
129
+ let offset = 0;
130
+ for (let index = 0; index <= max; index++) {
131
+ const originalSize = originalIndices[offset] === index ? originalSizes[offset++] : void 0;
132
+ if (hidden.has(index)) continue;
133
+ indices.push(index);
134
+ sizes.push(_nullishCoalesce(_nullishCoalesce(originalSize, () => ( overrides[index])), () => ( defaultSize)));
135
+ }
136
+ return { indices, sizes };
137
+ }
138
+ function applyReadOnlyLayout(sheet, layout) {
139
+ if (!layout) return sheet;
140
+ const view = { ...sheet };
141
+ if (layout.freezePanes !== void 0) view.freezePanes = layout.freezePanes;
142
+ if (layout.hiddenRows) {
143
+ const rows = visibleAxis(
144
+ layout.hiddenRows,
145
+ sheet.maxUsedRow,
146
+ sheet.visibleRows,
147
+ sheet.rowHeights,
148
+ sheet.rowHeightOverridesPx,
149
+ sheet.defaultRowHeightPx
150
+ );
151
+ view.hiddenRows = Array.from(layout.hiddenRows).sort((a, b) => a - b);
152
+ view.visibleRows = rows.indices;
153
+ view.rowHeights = rows.sizes;
154
+ view.rowCount = rows.indices.length;
155
+ }
156
+ if (layout.hiddenCols) {
157
+ const cols = visibleAxis(
158
+ layout.hiddenCols,
159
+ sheet.maxUsedCol,
160
+ sheet.visibleCols,
161
+ sheet.colWidths,
162
+ sheet.colWidthOverridesPx,
163
+ sheet.defaultColWidthPx
164
+ );
165
+ view.hiddenCols = Array.from(layout.hiddenCols).sort((a, b) => a - b);
166
+ view.visibleCols = cols.indices;
167
+ view.colWidths = cols.sizes;
168
+ view.colCount = cols.indices.length;
169
+ }
170
+ return view;
171
+ }
172
+
99
173
  // src/merged-range-lookup.ts
100
174
  function createMergedRangeLookup(ranges) {
101
175
  const normalizedRanges = [];
@@ -965,7 +1039,7 @@ var XlsxWorkerClient = (_class = class {
965
1039
  }
966
1040
  async getMainRuntime() {
967
1041
  if (this.disposed) throw createAbortError();
968
- this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-MEI3CEWO.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
1042
+ this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-MOGSEJ5R.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
969
1043
  const runtime = await this.mainRuntime;
970
1044
  if (this.disposed) {
971
1045
  runtime.dispose();
@@ -1941,6 +2015,8 @@ function downloadUrl(src, fileName) {
1941
2015
  }
1942
2016
  function useXlsxViewerController(options2) {
1943
2017
  const {
2018
+ allowFreezeInReadOnly = false,
2019
+ allowHideInReadOnly = false,
1944
2020
  allowResizeInReadOnly = false,
1945
2021
  deferLoadingAboveBytes = DEFAULT_DEFER_LOADING_ABOVE_BYTES,
1946
2022
  file,
@@ -1959,7 +2035,8 @@ function useXlsxViewerController(options2) {
1959
2035
  const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
1960
2036
  const [error, setError] = React.useState(null);
1961
2037
  const [workbook, setWorkbook] = React.useState(null);
1962
- const [sheets, setSheets] = React.useState([]);
2038
+ const [readOnlyLayouts, setReadOnlyLayouts] = React.useState({});
2039
+ const [workbookSheets, setSheets] = React.useState([]);
1963
2040
  const [chartsByWorkbookSheetIndex, setChartsByWorkbookSheetIndex] = React.useState([]);
1964
2041
  const [chartsheets, setChartsheets] = React.useState([]);
1965
2042
  const [tabs, setTabs] = React.useState([]);
@@ -2014,6 +2091,7 @@ function useXlsxViewerController(options2) {
2014
2091
  const displayFileName = React.useMemo(() => resolveDisplayFileName(src, fileName), [fileName, src]);
2015
2092
  const shouldDeferLoading = deferLoadingAboveBytes > 0;
2016
2093
  const readOnly = requestedReadOnly || forcedReadOnly;
2094
+ const sheets = React.useMemo(() => readOnly ? workbookSheets.map((sheet) => applyReadOnlyLayout(sheet, readOnlyLayouts[sheet.workbookSheetIndex])) : workbookSheets, [readOnly, readOnlyLayouts, workbookSheets]);
2017
2095
  const drawingMutationEpoch = React.useRef(0);
2018
2096
  const drawingMutationState = React.useRef({ workbook, revision, readOnly, activeCell, activeSheetIndex });
2019
2097
  drawingMutationState.current = { workbook, revision, readOnly, activeCell, activeSheetIndex };
@@ -2175,6 +2253,7 @@ function useXlsxViewerController(options2) {
2175
2253
  }, [disposeWorkerClient]);
2176
2254
  React.useEffect(() => {
2177
2255
  loadGenerationRef.current += 1;
2256
+ setReadOnlyLayouts({});
2178
2257
  if (!file && !src) {
2179
2258
  disposeWorkerClient();
2180
2259
  setForcedReadOnly(false);
@@ -3466,28 +3545,50 @@ function useXlsxViewerController(options2) {
3466
3545
  }));
3467
3546
  setRevision((current) => current + 1);
3468
3547
  }, [activeSheet]);
3548
+ const canChangeVisibility = Boolean(activeSheet && !isLoading && (readOnly ? allowHideInReadOnly : workbook));
3549
+ const canChangeFreezePanes = Boolean(activeSheet && !isLoading && (readOnly ? allowFreezeInReadOnly : workbook));
3550
+ const activeLayout = activeSheet && readOnly ? readOnlyLayouts[activeSheet.workbookSheetIndex] : void 0;
3551
+ React.useEffect(() => {
3552
+ if (!activeCell || !activeLayout) return;
3553
+ const { hiddenRows, hiddenCols } = activeLayout;
3554
+ const row2 = _optionalChain([hiddenRows, 'optionalAccess', _337 => _337.has, 'call', _338 => _338(activeCell.row)]) ? nextVisibleIndex(activeCell.row, _chunkXZJLPW64cjs.XLSX_MAX_ROWS, (index) => hiddenRows.has(index)) : activeCell.row;
3555
+ const col = _optionalChain([hiddenCols, 'optionalAccess', _339 => _339.has, 'call', _340 => _340(activeCell.col)]) ? nextVisibleIndex(activeCell.col, _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS, (index) => hiddenCols.has(index)) : activeCell.col;
3556
+ if (row2 === activeCell.row && col === activeCell.col) return;
3557
+ const cell = row2 < 0 || col < 0 ? null : { row: row2, col };
3558
+ setActiveCell(cell);
3559
+ setSelection(cell && { start: cell, end: cell });
3560
+ selectionAnchorRef.current = cell;
3561
+ }, [activeCell, activeLayout, setSelection]);
3469
3562
  const setAxisHidden = React.useCallback((axis, hidden, start, end = start) => {
3470
- if (readOnly || !workbook || !activeSheet) return;
3563
+ if (!canChangeVisibility || !activeSheet) return;
3471
3564
  const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
3472
- const ranges = start === void 0 && end === void 0 ? selectionRanges.map((area) => ({ start: area.start[axis], end: area.end[axis] })) : [{ start: _nullishCoalesce(start, () => ( -1)), end: _nullishCoalesce(end, () => ( -1)) }];
3565
+ const fromSelection = start === void 0 && end === void 0;
3566
+ const ranges = fromSelection ? selectionRanges.map((area) => ({ start: area.start[axis], end: area.end[axis] })) : [{ start: _nullishCoalesce(start, () => ( -1)), end: _nullishCoalesce(end, () => ( -1)) }];
3473
3567
  if (!ranges.length || ranges.some((range) => !Number.isInteger(range.start) || !Number.isInteger(range.end) || range.start < 0 || range.end < range.start || range.end >= limit)) return;
3474
- const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
3475
- try {
3476
- const existing = new Set(axis === "row" ? worksheet.hiddenRows : worksheet.hiddenColumns);
3477
- if (!hidden && !existing.size) return;
3478
- if (!hidden && start === void 0 && existing.has(0)) {
3479
- let firstVisible = 0;
3480
- while (existing.has(firstVisible)) firstVisible++;
3481
- for (const range of ranges) {
3482
- if (range.start === firstVisible) range.start = 0;
3483
- }
3484
- }
3485
- const changes = ranges.filter((range) => {
3486
- for (let index = range.start; index <= range.end; index++) {
3487
- if (existing.has(index) !== hidden) return true;
3568
+ const sheetIndex = activeSheet.workbookSheetIndex;
3569
+ if (readOnly) {
3570
+ const key = axis === "row" ? "hiddenRows" : "hiddenCols";
3571
+ setReadOnlyLayouts((current) => {
3572
+ const layout = current[sheetIndex];
3573
+ const existing = _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _341 => _341[key]]), () => ( new Set(activeSheet[key])));
3574
+ const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
3575
+ if (!changes.length) return current;
3576
+ const next = new Set(existing);
3577
+ for (const range of changes) {
3578
+ for (let index = range.start; index <= range.end; index++) {
3579
+ if (hidden) next.add(index);
3580
+ else next.delete(index);
3581
+ }
3488
3582
  }
3489
- return false;
3583
+ return { ...current, [sheetIndex]: { ...layout, [key]: next } };
3490
3584
  });
3585
+ return;
3586
+ }
3587
+ if (!workbook) return;
3588
+ const worksheet = workbook.getSheet(sheetIndex);
3589
+ try {
3590
+ const existing = new Set(axis === "row" ? worksheet.hiddenRows : worksheet.hiddenColumns);
3591
+ const changes = changedVisibilityRanges(existing, ranges, hidden, fromSelection);
3491
3592
  if (!changes.length) return;
3492
3593
  recordHistoryBeforeMutation();
3493
3594
  for (const range of changes) {
@@ -3495,13 +3596,11 @@ function useXlsxViewerController(options2) {
3495
3596
  else worksheet.setColumnsHidden(range.start, range.end, hidden);
3496
3597
  }
3497
3598
  if (hidden && activeCell && changes.some((range) => range.start <= activeCell[axis] && activeCell[axis] <= range.end)) {
3498
- const isHidden = (index2) => axis === "row" ? worksheet.isRowHidden(index2) : worksheet.isColumnHidden(index2);
3499
- let index = activeCell[axis];
3500
- while (index < limit && isHidden(index)) index++;
3501
- if (index === limit) {
3502
- index = activeCell[axis] - 1;
3503
- while (index >= 0 && isHidden(index)) index--;
3504
- }
3599
+ const index = nextVisibleIndex(
3600
+ activeCell[axis],
3601
+ limit,
3602
+ (value) => axis === "row" ? worksheet.isRowHidden(value) : worksheet.isColumnHidden(value)
3603
+ );
3505
3604
  if (index >= 0) {
3506
3605
  const cell = { ...activeCell, [axis]: index };
3507
3606
  setActiveCell(cell);
@@ -3513,28 +3612,35 @@ function useXlsxViewerController(options2) {
3513
3612
  } finally {
3514
3613
  worksheet.free();
3515
3614
  }
3516
- }, [activeCell, activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
3615
+ }, [activeCell, activeSheet, canChangeVisibility, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
3517
3616
  const hideRows = React.useCallback((start, end) => setAxisHidden("row", true, start, end), [setAxisHidden]);
3518
3617
  const unhideRows = React.useCallback((start, end) => setAxisHidden("row", false, start, end), [setAxisHidden]);
3519
3618
  const hideColumns = React.useCallback((start, end) => setAxisHidden("col", true, start, end), [setAxisHidden]);
3520
3619
  const unhideColumns = React.useCallback((start, end) => setAxisHidden("col", false, start, end), [setAxisHidden]);
3521
3620
  const setFreezeBoundary = React.useCallback((cell) => {
3522
- if (readOnly || !workbook || !activeSheet) return;
3621
+ if (!canChangeFreezePanes || !activeSheet) return;
3523
3622
  const { row: row2, col } = cell;
3524
3623
  if (!Number.isInteger(row2) || row2 < 0 || row2 >= _chunkXZJLPW64cjs.XLSX_MAX_ROWS || !Number.isInteger(col) || col < 0 || col >= _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS) return;
3525
- const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
3624
+ const sheetIndex = activeSheet.workbookSheetIndex;
3625
+ if (readOnly) {
3626
+ const freezePanes2 = row2 || col ? { row: row2, col } : null;
3627
+ setReadOnlyLayouts((current) => ({ ...current, [sheetIndex]: { ...current[sheetIndex], freezePanes: freezePanes2 } }));
3628
+ return;
3629
+ }
3630
+ if (!workbook) return;
3631
+ const worksheet = workbook.getSheet(sheetIndex);
3526
3632
  try {
3527
3633
  const current = parseWorksheetFreezePanes(worksheet);
3528
- if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _337 => _337.row]), () => ( 0))) && col === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _338 => _338.col]), () => ( 0)))) return;
3634
+ if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _342 => _342.row]), () => ( 0))) && col === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _343 => _343.col]), () => ( 0)))) return;
3529
3635
  recordHistoryBeforeMutation();
3530
3636
  worksheet.setFreezePanes(row2, col);
3531
3637
  refreshWorkbookState(workbook);
3532
3638
  } finally {
3533
3639
  worksheet.free();
3534
3640
  }
3535
- }, [activeSheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
3641
+ }, [activeSheet, canChangeFreezePanes, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
3536
3642
  const freezeCell = resolveFreezePanesCell(activeCell, selection);
3537
- const canFreezePanes = Boolean(!readOnly && workbook && activeSheet && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
3643
+ const canFreezePanes = Boolean(canChangeFreezePanes && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
3538
3644
  const freezePanes = React.useCallback((cell = freezeCell) => {
3539
3645
  if (cell) setFreezeBoundary(cell);
3540
3646
  }, [freezeCell, setFreezeBoundary]);
@@ -3615,10 +3721,10 @@ function useXlsxViewerController(options2) {
3615
3721
  const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentChart.anchor, {
3616
3722
  contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
3617
3723
  contentOffsetTop: GRID_HEADER_HEIGHT,
3618
- getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _339 => _339.columnWidths, 'access', _340 => _340[col]]), () => ( getColumnWidthPx(worksheet, col))),
3619
- getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _341 => _341.rowHeights, 'access', _342 => _342[row2]]), () => ( getRowHeightPx(worksheet, row2)))
3724
+ getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _344 => _344.columnWidths, 'access', _345 => _345[col]]), () => ( getColumnWidthPx(worksheet, col))),
3725
+ getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _346 => _346.rowHeights, 'access', _347 => _347[row2]]), () => ( getRowHeightPx(worksheet, row2)))
3620
3726
  });
3621
- if (_optionalChain([currentChart, 'access', _343 => _343.raw, 'optionalAccess', _344 => _344.pivotSource]) && currentChart.name) {
3727
+ if (_optionalChain([currentChart, 'access', _348 => _348.raw, 'optionalAccess', _349 => _349.pivotSource]) && currentChart.name) {
3622
3728
  commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(worksheet.name, currentChart.name, {
3623
3729
  anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, nextAnchor)
3624
3730
  }), false);
@@ -3654,8 +3760,8 @@ function useXlsxViewerController(options2) {
3654
3760
  const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentImage.anchor, {
3655
3761
  contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
3656
3762
  contentOffsetTop: GRID_HEADER_HEIGHT,
3657
- getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _345 => _345.columnWidths, 'access', _346 => _346[col]]), () => ( getColumnWidthPx(worksheet, col))),
3658
- getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _347 => _347.rowHeights, 'access', _348 => _348[row2]]), () => ( getRowHeightPx(worksheet, row2)))
3763
+ getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _350 => _350.columnWidths, 'access', _351 => _351[col]]), () => ( getColumnWidthPx(worksheet, col))),
3764
+ getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _352 => _352.rowHeights, 'access', _353 => _353[row2]]), () => ( getRowHeightPx(worksheet, row2)))
3659
3765
  });
3660
3766
  recordHistoryBeforeMutation();
3661
3767
  if (!_chunkXZJLPW64cjs.updateWorkbookImageAnchor.call(void 0, imageAssetsRef.current, id, nextAnchor)) {
@@ -3820,12 +3926,12 @@ function useXlsxViewerController(options2) {
3820
3926
  setSelectedChartId(null);
3821
3927
  setSelectedChartElement(null);
3822
3928
  if (target.kind === "chart") {
3823
- const chart = _optionalChain([chartAssetsRef, 'access', _349 => _349.current, 'optionalAccess', _350 => _350.chartsByWorkbookSheetIndex, 'access', _351 => _351.flat, 'call', _352 => _352(), 'access', _353 => _353.find, 'call', _354 => _354((chart2) => target.path ? chart2.chartPath === target.path : chart2.name === target.name)]);
3824
- setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess', _355 => _355.id]), () => ( null)));
3929
+ const chart = _optionalChain([chartAssetsRef, 'access', _354 => _354.current, 'optionalAccess', _355 => _355.chartsByWorkbookSheetIndex, 'access', _356 => _356.flat, 'call', _357 => _357(), 'access', _358 => _358.find, 'call', _359 => _359((chart2) => target.path ? chart2.chartPath === target.path : chart2.name === target.name)]);
3930
+ setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess', _360 => _360.id]), () => ( null)));
3825
3931
  setSelectedChartElement(chart ? { kind: "chart", chartId: chart.id } : null);
3826
3932
  } else if (target.kind === "image") {
3827
- const image = _optionalChain([nextAssets, 'optionalAccess', _356 => _356.imagesByWorkbookSheetIndex, 'access', _357 => _357.flat, 'call', _358 => _358(), 'access', _359 => _359.find, 'call', _360 => _360((image2) => image2.name === target.name)]);
3828
- setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess', _361 => _361.id]), () => ( null)));
3933
+ const image = _optionalChain([nextAssets, 'optionalAccess', _361 => _361.imagesByWorkbookSheetIndex, 'access', _362 => _362.flat, 'call', _363 => _363(), 'access', _364 => _364.find, 'call', _365 => _365((image2) => image2.name === target.name)]);
3934
+ setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess', _366 => _366.id]), () => ( null)));
3829
3935
  }
3830
3936
  return true;
3831
3937
  } catch (cause) {
@@ -3852,7 +3958,7 @@ function useXlsxViewerController(options2) {
3852
3958
  const generation = loadGenerationRef.current;
3853
3959
  const data = input === void 0 ? (await readBrowserClipboard()).drawing : typeof input === "string" ? decodeExcelDrawingClipboard(input) : input.type.startsWith("image/") ? await imageDrawingClipboard(input) : decodeExcelDrawingClipboard(new Uint8Array(await input.arrayBuffer()));
3854
3960
  const latest = drawingMutationState.current;
3855
- if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _362 => _362.activeCell, 'optionalAccess', _363 => _363.row]) !== _optionalChain([state, 'access', _364 => _364.activeCell, 'optionalAccess', _365 => _365.row]) || _optionalChain([latest, 'access', _366 => _366.activeCell, 'optionalAccess', _367 => _367.col]) !== _optionalChain([state, 'access', _368 => _368.activeCell, 'optionalAccess', _369 => _369.col])) return false;
3961
+ if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _367 => _367.activeCell, 'optionalAccess', _368 => _368.row]) !== _optionalChain([state, 'access', _369 => _369.activeCell, 'optionalAccess', _370 => _370.row]) || _optionalChain([latest, 'access', _371 => _371.activeCell, 'optionalAccess', _372 => _372.col]) !== _optionalChain([state, 'access', _373 => _373.activeCell, 'optionalAccess', _374 => _374.col])) return false;
3856
3962
  return pasteDrawing(data);
3857
3963
  }, [activeSheet, pasteDrawing, readOnly, workbook]);
3858
3964
  const arrangeDrawing = React.useCallback(async (kind, id, order) => {
@@ -3891,7 +3997,7 @@ function useXlsxViewerController(options2) {
3891
3997
  const chart = getChartById(id);
3892
3998
  const option = chartTypeOptions.find((option2) => option2.id === type);
3893
3999
  if (readOnly || !chart || !option || chartTypeUnavailable(chart, option)) return false;
3894
- if (_optionalChain([chart, 'access', _370 => _370.raw, 'optionalAccess', _371 => _371.pivotSource])) {
4000
+ if (_optionalChain([chart, 'access', _375 => _375.raw, 'optionalAccess', _376 => _376.pivotSource])) {
3895
4001
  if (!workbook || !chart.name) return false;
3896
4002
  commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(workbook.getSheet(chart.workbookSheetIndex).name, chart.name, { chartType: option.chartType }), false);
3897
4003
  return true;
@@ -3927,7 +4033,7 @@ function useXlsxViewerController(options2) {
3927
4033
  if (readOnly || !currentChart) {
3928
4034
  return;
3929
4035
  }
3930
- if (_optionalChain([currentChart, 'access', _372 => _372.raw, 'optionalAccess', _373 => _373.pivotSource])) {
4036
+ if (_optionalChain([currentChart, 'access', _377 => _377.raw, 'optionalAccess', _378 => _378.pivotSource])) {
3931
4037
  if (!workbook || !currentChart.name) return;
3932
4038
  if (Object.keys(patch).some((key) => !["title", "chartType", "anchor"].includes(key))) {
3933
4039
  throw new Error("Change PivotChart data through the pivot table field settings.");
@@ -3959,7 +4065,7 @@ function useXlsxViewerController(options2) {
3959
4065
  return false;
3960
4066
  }
3961
4067
  const chart = getChartById(chartId);
3962
- if (!chart || chart.editable === false || _optionalChain([chart, 'access', _374 => _374.raw, 'optionalAccess', _375 => _375.pivotSource])) {
4068
+ if (!chart || chart.editable === false || _optionalChain([chart, 'access', _379 => _379.raw, 'optionalAccess', _380 => _380.pivotSource])) {
3963
4069
  return false;
3964
4070
  }
3965
4071
  const nextChart = _chunkXZJLPW64cjs.applyChartSeriesFormula.call(void 0, chart, seriesIndex, formula, workbook);
@@ -3981,35 +4087,35 @@ function useXlsxViewerController(options2) {
3981
4087
  }
3982
4088
  return true;
3983
4089
  }, [getChartById, readOnly, updateChart, workbook]);
3984
- const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _376 => _376.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _377 => _377.mergedRanges])]);
4090
+ const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _381 => _381.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _382 => _382.mergedRanges])]);
3985
4091
  const selectCell = React.useCallback((cell, options3) => {
3986
4092
  const merged = findSelectionMerge(cell);
3987
- const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _378 => _378.start]), () => ( cell));
4093
+ const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _383 => _383.start]), () => ( cell));
3988
4094
  setSelectedChartId(null);
3989
4095
  setSelectedChartElement(null);
3990
4096
  setSelectedImageId(null);
3991
4097
  setActiveCell(anchorCell);
3992
- if (_optionalChain([options3, 'optionalAccess', _379 => _379.extend]) && selectionAnchorRef.current) {
3993
- setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _380 => _380.mergedRanges]), () => ( []))));
4098
+ if (_optionalChain([options3, 'optionalAccess', _384 => _384.extend]) && selectionAnchorRef.current) {
4099
+ setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _385 => _385.mergedRanges]), () => ( []))));
3994
4100
  return;
3995
4101
  }
3996
4102
  selectionAnchorRef.current = anchorCell;
3997
4103
  setSelection(_nullishCoalesce(merged, () => ( { start: cell, end: cell })));
3998
- }, [_optionalChain([activeSheet, 'optionalAccess', _381 => _381.mergedRanges]), findSelectionMerge]);
4104
+ }, [_optionalChain([activeSheet, 'optionalAccess', _386 => _386.mergedRanges]), findSelectionMerge]);
3999
4105
  const selectRanges = React.useCallback((ranges, activeCorner = "end") => {
4000
4106
  const areas = ranges.reduce((previous, range) => addSelectionRange(previous, normalizeRange(range)), []);
4001
4107
  const active = areas.at(-1);
4002
4108
  setSelectedChartId(null);
4003
4109
  setSelectedChartElement(null);
4004
4110
  setSelectedImageId(null);
4005
- selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess', _382 => _382.start]), () => ( null));
4006
- const cell = _optionalChain([active, 'optionalAccess', _383 => _383[activeCorner]]);
4007
- setActiveCell(cell ? _nullishCoalesce(_optionalChain([findSelectionMerge, 'call', _384 => _384(cell), 'optionalAccess', _385 => _385.start]), () => ( cell)) : null);
4111
+ selectionAnchorRef.current = _nullishCoalesce(_optionalChain([active, 'optionalAccess', _387 => _387.start]), () => ( null));
4112
+ const cell = _optionalChain([active, 'optionalAccess', _388 => _388[activeCorner]]);
4113
+ setActiveCell(cell ? _nullishCoalesce(_optionalChain([findSelectionMerge, 'call', _389 => _389(cell), 'optionalAccess', _390 => _390.start]), () => ( cell)) : null);
4008
4114
  setSelectionRanges(areas);
4009
4115
  }, [findSelectionMerge]);
4010
4116
  const selectRange = React.useCallback((range) => {
4011
- selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _386 => _386.mergedRanges]), () => ( [])))]);
4012
- }, [_optionalChain([activeSheet, 'optionalAccess', _387 => _387.mergedRanges]), selectRanges]);
4117
+ selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _391 => _391.mergedRanges]), () => ( [])))]);
4118
+ }, [_optionalChain([activeSheet, 'optionalAccess', _392 => _392.mergedRanges]), selectRanges]);
4013
4119
  const clearSelection = React.useCallback(() => {
4014
4120
  selectionAnchorRef.current = null;
4015
4121
  setActiveCell(null);
@@ -4158,7 +4264,7 @@ function useXlsxViewerController(options2) {
4158
4264
  setCellFormula(activeCell, formula);
4159
4265
  }, [activeCell, setCellFormula]);
4160
4266
  const setSelectedFormula = React.useCallback((formula) => {
4161
- if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _388 => _388.kind]) === "chartSeries") {
4267
+ if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _393 => _393.kind]) === "chartSeries") {
4162
4268
  return setChartSeriesFormula(selectedFormulaTarget.chartId, selectedFormulaTarget.seriesIndex, formula);
4163
4269
  }
4164
4270
  if (readOnly || !activeCell || getPivotTableAtCell(activeCell)) {
@@ -4325,7 +4431,7 @@ function useXlsxViewerController(options2) {
4325
4431
  return;
4326
4432
  }
4327
4433
  recordHistoryBeforeMutation();
4328
- const baseName = _optionalChain([name, 'optionalAccess', _389 => _389.trim, 'call', _390 => _390()]) || "Sheet";
4434
+ const baseName = _optionalChain([name, 'optionalAccess', _394 => _394.trim, 'call', _395 => _395()]) || "Sheet";
4329
4435
  let candidate = baseName;
4330
4436
  let counter = 2;
4331
4437
  while (workbook.sheetIndex(candidate) !== void 0) {
@@ -4345,11 +4451,11 @@ function useXlsxViewerController(options2) {
4345
4451
  }
4346
4452
  const nextSheets = buildSheetList(
4347
4453
  workbook,
4348
- _optionalChain([imageAssetsRef, 'access', _391 => _391.current, 'optionalAccess', _392 => _392.sheetStatesByWorkbookSheetIndex]),
4349
- _optionalChain([imageAssetsRef, 'access', _393 => _393.current, 'optionalAccess', _394 => _394.themePalette]),
4350
- _optionalChain([imageAssetsRef, 'access', _395 => _395.current, 'optionalAccess', _396 => _396.styleById]),
4351
- _optionalChain([imageAssetsRef, 'access', _397 => _397.current, 'optionalAccess', _398 => _398.namedCellStyleByName]),
4352
- _optionalChain([imageAssetsRef, 'access', _399 => _399.current, 'optionalAccess', _400 => _400.tableStyleByName]),
4454
+ _optionalChain([imageAssetsRef, 'access', _396 => _396.current, 'optionalAccess', _397 => _397.sheetStatesByWorkbookSheetIndex]),
4455
+ _optionalChain([imageAssetsRef, 'access', _398 => _398.current, 'optionalAccess', _399 => _399.themePalette]),
4456
+ _optionalChain([imageAssetsRef, 'access', _400 => _400.current, 'optionalAccess', _401 => _401.styleById]),
4457
+ _optionalChain([imageAssetsRef, 'access', _402 => _402.current, 'optionalAccess', _403 => _403.namedCellStyleByName]),
4458
+ _optionalChain([imageAssetsRef, 'access', _404 => _404.current, 'optionalAccess', _405 => _405.tableStyleByName]),
4353
4459
  showHiddenSheets
4354
4460
  );
4355
4461
  setSheets(nextSheets);
@@ -4359,7 +4465,7 @@ function useXlsxViewerController(options2) {
4359
4465
  }
4360
4466
  const nextIndex = nextSheets.findIndex((sheet) => sheet.name === candidate);
4361
4467
  setActiveSheetIndexState(nextIndex >= 0 ? nextIndex : 0);
4362
- const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _401 => _401.tabs, 'access', _402 => _402.findIndex, 'call', _403 => _403((tab) => tab.kind === "sheet" && tab.name === candidate)]), () => ( -1));
4468
+ const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _406 => _406.tabs, 'access', _407 => _407.findIndex, 'call', _408 => _408((tab) => tab.kind === "sheet" && tab.name === candidate)]), () => ( -1));
4363
4469
  if (nextTabIndex >= 0) {
4364
4470
  setActiveTabIndexState(nextTabIndex);
4365
4471
  }
@@ -4386,11 +4492,11 @@ function useXlsxViewerController(options2) {
4386
4492
  }
4387
4493
  const nextSheets = buildSheetList(
4388
4494
  workbook,
4389
- _optionalChain([imageAssetsRef, 'access', _404 => _404.current, 'optionalAccess', _405 => _405.sheetStatesByWorkbookSheetIndex]),
4390
- _optionalChain([imageAssetsRef, 'access', _406 => _406.current, 'optionalAccess', _407 => _407.themePalette]),
4391
- _optionalChain([imageAssetsRef, 'access', _408 => _408.current, 'optionalAccess', _409 => _409.styleById]),
4392
- _optionalChain([imageAssetsRef, 'access', _410 => _410.current, 'optionalAccess', _411 => _411.namedCellStyleByName]),
4393
- _optionalChain([imageAssetsRef, 'access', _412 => _412.current, 'optionalAccess', _413 => _413.tableStyleByName]),
4495
+ _optionalChain([imageAssetsRef, 'access', _409 => _409.current, 'optionalAccess', _410 => _410.sheetStatesByWorkbookSheetIndex]),
4496
+ _optionalChain([imageAssetsRef, 'access', _411 => _411.current, 'optionalAccess', _412 => _412.themePalette]),
4497
+ _optionalChain([imageAssetsRef, 'access', _413 => _413.current, 'optionalAccess', _414 => _414.styleById]),
4498
+ _optionalChain([imageAssetsRef, 'access', _415 => _415.current, 'optionalAccess', _416 => _416.namedCellStyleByName]),
4499
+ _optionalChain([imageAssetsRef, 'access', _417 => _417.current, 'optionalAccess', _418 => _418.tableStyleByName]),
4394
4500
  showHiddenSheets
4395
4501
  );
4396
4502
  setSheets(nextSheets);
@@ -4418,7 +4524,7 @@ function useXlsxViewerController(options2) {
4418
4524
  }, [readOnly, recordHistoryBeforeMutation, selection, selectionRanges, workbook]);
4419
4525
  const pasteText = React.useCallback((text) => {
4420
4526
  const worksheet = getActiveWorksheet();
4421
- const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _414 => _414.start]))), () => ( null));
4527
+ const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _419 => _419.start]))), () => ( null));
4422
4528
  if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !text) {
4423
4529
  return false;
4424
4530
  }
@@ -4487,7 +4593,7 @@ function useXlsxViewerController(options2) {
4487
4593
  }, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
4488
4594
  const pasteStructuredClipboardData = React.useCallback((serializedPayload) => {
4489
4595
  const worksheet = getActiveWorksheet();
4490
- const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _415 => _415.start]))), () => ( null));
4596
+ const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _420 => _420.start]))), () => ( null));
4491
4597
  if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !serializedPayload) {
4492
4598
  return false;
4493
4599
  }
@@ -4666,7 +4772,7 @@ function useXlsxViewerController(options2) {
4666
4772
  const generation = loadGenerationRef.current;
4667
4773
  const data = await readBrowserClipboard(clipboardData);
4668
4774
  const latest = drawingMutationState.current;
4669
- if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _416 => _416.activeCell, 'optionalAccess', _417 => _417.row]) !== _optionalChain([state, 'access', _418 => _418.activeCell, 'optionalAccess', _419 => _419.row]) || _optionalChain([latest, 'access', _420 => _420.activeCell, 'optionalAccess', _421 => _421.col]) !== _optionalChain([state, 'access', _422 => _422.activeCell, 'optionalAccess', _423 => _423.col])) return false;
4775
+ if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _421 => _421.activeCell, 'optionalAccess', _422 => _422.row]) !== _optionalChain([state, 'access', _423 => _423.activeCell, 'optionalAccess', _424 => _424.row]) || _optionalChain([latest, 'access', _425 => _425.activeCell, 'optionalAccess', _426 => _426.col]) !== _optionalChain([state, 'access', _427 => _427.activeCell, 'optionalAccess', _428 => _428.col])) return false;
4670
4776
  if (data.drawing) return pasteDrawing(data.drawing);
4671
4777
  if (data.structured && pasteStructuredClipboardData(data.structured)) return true;
4672
4778
  return Boolean(data.text) && pasteText(data.text);
@@ -4824,7 +4930,9 @@ function useXlsxViewerController(options2) {
4824
4930
  revision,
4825
4931
  resizeChartBy,
4826
4932
  resizeImageBy,
4827
- frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _424 => _424.freezePanes]), () => ( null)),
4933
+ frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _429 => _429.freezePanes]), () => ( null)),
4934
+ canChangeFreezePanes,
4935
+ canChangeVisibility,
4828
4936
  canFreezePanes,
4829
4937
  hideRows,
4830
4938
  unhideRows,
@@ -4977,6 +5085,8 @@ function useXlsxViewerController(options2) {
4977
5085
  revision,
4978
5086
  resizeChartBy,
4979
5087
  resizeImageBy,
5088
+ canChangeFreezePanes,
5089
+ canChangeVisibility,
4980
5090
  canFreezePanes,
4981
5091
  hideRows,
4982
5092
  unhideRows,
@@ -5086,8 +5196,8 @@ function CellEditor({
5086
5196
  const [bounds, setBounds] = React2.useState({ width: 0, height: 0, cellWidth: 0 });
5087
5197
  React2.useLayoutEffect(() => {
5088
5198
  const root = rootRef.current;
5089
- const anchor = _optionalChain([root, 'optionalAccess', _425 => _425.parentElement]);
5090
- const viewport = _optionalChain([root, 'optionalAccess', _426 => _426.closest, 'call', _427 => _427('[role="grid"]')]);
5199
+ const anchor = _optionalChain([root, 'optionalAccess', _430 => _430.parentElement]);
5200
+ const viewport = _optionalChain([root, 'optionalAccess', _431 => _431.closest, 'call', _432 => _432('[role="grid"]')]);
5091
5201
  if (!root || !anchor || !viewport) {
5092
5202
  return;
5093
5203
  }
@@ -5144,8 +5254,8 @@ function CellEditor({
5144
5254
  const canvas = canvasRef.current;
5145
5255
  if (canvas && paintCanvasText) {
5146
5256
  const dpr = window.devicePixelRatio || 1;
5147
- const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _428 => _428.left]), () => ( 0))) * dpr % 1 / dpr;
5148
- const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _429 => _429.top]), () => ( 0))) * dpr % 1 / dpr;
5257
+ const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _433 => _433.left]), () => ( 0))) * dpr % 1 / dpr;
5258
+ const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _434 => _434.top]), () => ( 0))) * dpr % 1 / dpr;
5149
5259
  const width = rootRect.width / scale;
5150
5260
  const height = rootRect.height / scale;
5151
5261
  canvas.width = Math.ceil((width + offsetX) * dpr);
@@ -5156,11 +5266,11 @@ function CellEditor({
5156
5266
  canvas.style.top = `${-offsetY}px`;
5157
5267
  const context = canvas.getContext("2d");
5158
5268
  if (context) {
5159
- const node = _optionalChain([plainTextRef, 'access', _430 => _430.current, 'optionalAccess', _431 => _431.firstChild]);
5269
+ const node = _optionalChain([plainTextRef, 'access', _435 => _435.current, 'optionalAccess', _436 => _436.firstChild]);
5160
5270
  const lines = [];
5161
5271
  if (node) {
5162
5272
  const range = document.createRange();
5163
- const length = _nullishCoalesce(_optionalChain([node, 'access', _432 => _432.textContent, 'optionalAccess', _433 => _433.length]), () => ( 0));
5273
+ const length = _nullishCoalesce(_optionalChain([node, 'access', _437 => _437.textContent, 'optionalAccess', _438 => _438.length]), () => ( 0));
5164
5274
  let start = 0;
5165
5275
  while (start < length) {
5166
5276
  range.setStart(node, start);
@@ -5274,7 +5384,7 @@ function CellEditor({
5274
5384
  onKeyDown: (event) => {
5275
5385
  event.stopPropagation();
5276
5386
  if (event.nativeEvent.isComposing) return;
5277
- if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _434 => _434()])) {
5387
+ if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _439 => _439()])) {
5278
5388
  event.preventDefault();
5279
5389
  } else if (event.key === "Enter" && !event.altKey) {
5280
5390
  event.preventDefault();
@@ -5463,7 +5573,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5463
5573
  const [savedDefinition, setSavedDefinition] = React11.useState("");
5464
5574
  const [pendingFocus, setPendingFocus] = React11.useState(null);
5465
5575
  const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
5466
- const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _435 => _435.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
5576
+ const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _440 => _440.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
5467
5577
  const run = React11.useCallback((action) => {
5468
5578
  setError(null);
5469
5579
  setStatus(null);
@@ -5488,7 +5598,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5488
5598
  if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
5489
5599
  }, [viewer.src, viewer.file]);
5490
5600
  React11.useEffect(() => {
5491
- if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _436 => _436.id])) return;
5601
+ if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _441 => _441.id])) return;
5492
5602
  const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
5493
5603
  setDraft(current ? copyPivot(current) : null);
5494
5604
  if (current) {
@@ -5499,19 +5609,19 @@ function usePivotTableEditor(viewer, options2 = {}) {
5499
5609
  React11.useEffect(() => {
5500
5610
  if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
5501
5611
  const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
5502
- if (!current || current.id === _optionalChain([draft, 'optionalAccess', _437 => _437.id])) return;
5612
+ if (!current || current.id === _optionalChain([draft, 'optionalAccess', _442 => _442.id])) return;
5503
5613
  setDraft(copyPivot(current));
5504
5614
  setLoadedSource(JSON.stringify(current.source));
5505
5615
  setSavedDefinition(JSON.stringify(current));
5506
5616
  setError(null);
5507
5617
  setStatus(null);
5508
5618
  setDetails(null);
5509
- }, [_optionalChain([viewer, 'access', _438 => _438.activeCell, 'optionalAccess', _439 => _439.row]), _optionalChain([viewer, 'access', _440 => _440.activeCell, 'optionalAccess', _441 => _441.col]), _optionalChain([viewer, 'access', _442 => _442.activeSheet, 'optionalAccess', _443 => _443.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
5619
+ }, [_optionalChain([viewer, 'access', _443 => _443.activeCell, 'optionalAccess', _444 => _444.row]), _optionalChain([viewer, 'access', _445 => _445.activeCell, 'optionalAccess', _446 => _446.col]), _optionalChain([viewer, 'access', _447 => _447.activeSheet, 'optionalAccess', _448 => _448.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
5510
5620
  React11.useEffect(() => {
5511
- if (!pendingFocus || _optionalChain([viewer, 'access', _444 => _444.activeSheet, 'optionalAccess', _445 => _445.name, 'access', _446 => _446.toLowerCase, 'call', _447 => _447()]) !== pendingFocus.sheet.toLowerCase()) return;
5621
+ if (!pendingFocus || _optionalChain([viewer, 'access', _449 => _449.activeSheet, 'optionalAccess', _450 => _450.name, 'access', _451 => _451.toLowerCase, 'call', _452 => _452()]) !== pendingFocus.sheet.toLowerCase()) return;
5512
5622
  viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
5513
5623
  setPendingFocus(null);
5514
- }, [pendingFocus, _optionalChain([viewer, 'access', _448 => _448.activeSheet, 'optionalAccess', _449 => _449.name]), viewer.selectCell]);
5624
+ }, [pendingFocus, _optionalChain([viewer, 'access', _453 => _453.activeSheet, 'optionalAccess', _454 => _454.name]), viewer.selectCell]);
5515
5625
  const focus = (pivot) => {
5516
5626
  const sheetIndex = viewer.sheets.findIndex((sheet) => sheet.name.toLowerCase() === pivot.target.sheet.toLowerCase());
5517
5627
  if (sheetIndex >= 0) viewer.setActiveSheetIndex(sheetIndex);
@@ -5531,7 +5641,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5531
5641
  focus(pivot);
5532
5642
  });
5533
5643
  const edit = (change) => {
5534
- if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _450 => _450.unsupportedFeatures, 'access', _451 => _451.length])) return;
5644
+ if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _455 => _455.unsupportedFeatures, 'access', _456 => _456.length])) return;
5535
5645
  setDraft((current) => current ? change(current) : current);
5536
5646
  setDirty(true);
5537
5647
  setStatus(null);
@@ -5582,7 +5692,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5582
5692
  if (!draft) return;
5583
5693
  const fields = viewer.getPivotSourceFields(draft.source);
5584
5694
  setLoadedSource(JSON.stringify(draft.source));
5585
- const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access', _452 => _452.fields, 'access', _453 => _453[index], 'optionalAccess', _454 => _454.name]));
5695
+ const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access', _457 => _457.fields, 'access', _458 => _458[index], 'optionalAccess', _459 => _459.name]));
5586
5696
  edit((pivot) => ({ ...pivot, fields, ...sameSchema ? {} : { rows: [], columns: [], values: [], filters: [], reportFilters: [], calculatedItems: [] } }));
5587
5697
  setStatus(sameSchema ? "Source fields updated." : "Fields loaded. Choose the fields to summarize.");
5588
5698
  });
@@ -5604,7 +5714,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5604
5714
  if (all) {
5605
5715
  const refreshed = viewer.refreshAllPivotTables();
5606
5716
  setStatus(`${refreshed.length} PivotTable${refreshed.length === 1 ? "" : "s"} refreshed.`);
5607
- } else if (_optionalChain([draft, 'optionalAccess', _455 => _455.id])) {
5717
+ } else if (_optionalChain([draft, 'optionalAccess', _460 => _460.id])) {
5608
5718
  const refreshed = viewer.refreshPivotTable(draft.id);
5609
5719
  setDraft(copyPivot(refreshed));
5610
5720
  setLoadedSource(JSON.stringify(refreshed.source));
@@ -5616,7 +5726,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5616
5726
  });
5617
5727
  const remove = () => run(() => {
5618
5728
  if (dirty) throw new Error("Apply or discard your changes before removing the report.");
5619
- if (!_optionalChain([draft, 'optionalAccess', _456 => _456.id])) return;
5729
+ if (!_optionalChain([draft, 'optionalAccess', _461 => _461.id])) return;
5620
5730
  if (viewer.removePivotTable(draft.id)) {
5621
5731
  setDraft(null);
5622
5732
  setDirty(false);
@@ -5625,7 +5735,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5625
5735
  }
5626
5736
  });
5627
5737
  const reset = () => run(() => {
5628
- const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _457 => _457.id]));
5738
+ const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _462 => _462.id]));
5629
5739
  setDraft(saved ? copyPivot(saved) : null);
5630
5740
  setLoadedSource(saved ? JSON.stringify(saved.source) : "");
5631
5741
  setSavedDefinition(saved ? JSON.stringify(saved) : "");
@@ -5633,8 +5743,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
5633
5743
  setDetails(null);
5634
5744
  });
5635
5745
  const showDetails = () => run(() => {
5636
- if (!_optionalChain([draft, 'optionalAccess', _458 => _458.id]) || !viewer.activeCell) return;
5637
- if (_optionalChain([viewer, 'access', _459 => _459.activeSheet, 'optionalAccess', _460 => _460.name, 'access', _461 => _461.toLowerCase, 'call', _462 => _462()]) !== draft.target.sheet.toLowerCase()) throw new Error("Select a value cell inside this PivotTable first.");
5746
+ if (!_optionalChain([draft, 'optionalAccess', _463 => _463.id]) || !viewer.activeCell) return;
5747
+ if (_optionalChain([viewer, 'access', _464 => _464.activeSheet, 'optionalAccess', _465 => _465.name, 'access', _466 => _466.toLowerCase, 'call', _467 => _467()]) !== draft.target.sheet.toLowerCase()) throw new Error("Select a value cell inside this PivotTable first.");
5638
5748
  setDetails(viewer.pivotDrillDown(draft.id, viewer.activeCell.row, viewer.activeCell.col));
5639
5749
  setDetailContext({ id: draft.id, row: viewer.activeCell.row, col: viewer.activeCell.col });
5640
5750
  setOpen(true);
@@ -5674,7 +5784,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5674
5784
  });
5675
5785
  const removeField = (area, index) => edit((pivot) => area === "values" ? replaceValues(pivot, pivot.values.filter((_, position) => position !== index)) : { ...pivot, [area]: pivot[area].filter((_, position) => position !== index) });
5676
5786
  const moveField = (fromArea, fromIndex, toArea, toIndex) => {
5677
- if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess', _463 => _463.values, 'access', _464 => _464[fromIndex], 'optionalAccess', _465 => _465.formula, 'optionalAccess', _466 => _466.trim, 'call', _467 => _467()])) {
5787
+ if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess', _468 => _468.values, 'access', _469 => _469[fromIndex], 'optionalAccess', _470 => _470.formula, 'optionalAccess', _471 => _471.trim, 'call', _472 => _472()])) {
5678
5788
  run(() => {
5679
5789
  throw new Error("Calculated fields can only be placed in Values.");
5680
5790
  });
@@ -5682,7 +5792,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5682
5792
  }
5683
5793
  edit((pivot) => {
5684
5794
  const entry = pivot[fromArea][fromIndex];
5685
- if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access', _468 => _468.formula, 'optionalAccess', _469 => _469.trim, 'call', _470 => _470()])) return pivot;
5795
+ if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access', _473 => _473.formula, 'optionalAccess', _474 => _474.trim, 'call', _475 => _475()])) return pivot;
5686
5796
  if (fromArea === toArea) {
5687
5797
  const entries2 = [...pivot[fromArea]];
5688
5798
  entries2.splice(fromIndex, 1);
@@ -5705,7 +5815,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5705
5815
  return { ...next, [toArea]: entries };
5706
5816
  });
5707
5817
  };
5708
- return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess', _471 => _471.unsupportedFeatures, 'access', _472 => _472.length])), open, setOpen, draft, dirty, edit, select, create, apply, reset, remove, refresh, readFields, addField, removeField, moveField, details, detailContext, showDetails, clearDetails: () => {
5818
+ return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess', _476 => _476.unsupportedFeatures, 'access', _477 => _477.length])), open, setOpen, draft, dirty, edit, select, create, apply, reset, remove, refresh, readFields, addField, removeField, moveField, details, detailContext, showDetails, clearDetails: () => {
5709
5819
  setDetails(null);
5710
5820
  setDetailContext(null);
5711
5821
  }, sourceNeedsLoad, stale, error, status, run };
@@ -5728,16 +5838,16 @@ var row = { display: "flex", alignItems: "center", gap: 6, minWidth: 0 };
5728
5838
  var hint = { color: "var(--xlsx-pivot-muted)", fontSize: 11, lineHeight: 1.5, margin: 0 };
5729
5839
  var control = { boxSizing: "border-box", width: "100%", minWidth: 0, minHeight: 30, border: "1px solid var(--xlsx-pivot-border)", borderRadius: 3, background: "var(--xlsx-pivot-input)", color: "inherit", padding: "4px 7px", font: "inherit" };
5730
5840
  function fieldName(pivot, index) {
5731
- return _nullishCoalesce(_optionalChain([pivot, 'access', _473 => _473.fields, 'access', _474 => _474.find, 'call', _475 => _475((field) => field.index === index), 'optionalAccess', _476 => _476.name]), () => ( `Field ${index + 1}`));
5841
+ return _nullishCoalesce(_optionalChain([pivot, 'access', _478 => _478.fields, 'access', _479 => _479.find, 'call', _480 => _480((field) => field.index === index), 'optionalAccess', _481 => _481.name]), () => ( `Field ${index + 1}`));
5732
5842
  }
5733
5843
  function fieldIndex(pivot, area, index) {
5734
- return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _477 => _477[area], 'access', _478 => _478[index], 'optionalAccess', _479 => _479.field]);
5844
+ return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _482 => _482[area], 'access', _483 => _483[index], 'optionalAccess', _484 => _484.field]);
5735
5845
  }
5736
5846
  function sourceFieldIndex(pivot, area, index) {
5737
- return area === "values" && _optionalChain([pivot, 'access', _480 => _480.values, 'access', _481 => _481[index], 'optionalAccess', _482 => _482.formula, 'optionalAccess', _483 => _483.trim, 'call', _484 => _484()]) ? void 0 : fieldIndex(pivot, area, index);
5847
+ return area === "values" && _optionalChain([pivot, 'access', _485 => _485.values, 'access', _486 => _486[index], 'optionalAccess', _487 => _487.formula, 'optionalAccess', _488 => _488.trim, 'call', _489 => _489()]) ? void 0 : fieldIndex(pivot, area, index);
5738
5848
  }
5739
5849
  function groupingUnit(axis) {
5740
- return _optionalChain([axis, 'optionalAccess', _485 => _485.grouping]) ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
5850
+ return _optionalChain([axis, 'optionalAccess', _490 => _490.grouping]) ? axis.grouping.kind === "date" ? axis.grouping.unit : axis.grouping.kind : null;
5741
5851
  }
5742
5852
  function Action({ children: children2, primary, style, ...props }) {
5743
5853
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { type: "button", ...props, style: { ...control, width: "auto", cursor: props.disabled ? "default" : "pointer", opacity: props.disabled ? 0.55 : 1, ...primary ? { background: "var(--xlsx-pivot-accent)", borderColor: "var(--xlsx-pivot-accent)", color: "#fff" } : {}, ...style }, children: children2 });
@@ -5804,10 +5914,10 @@ function ValueSettings({ pivot, value, onChange }) {
5804
5914
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5805
5915
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: value.name, onChange: (name) => onChange({ ...value, name }) }),
5806
5916
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Summarize values by", value: value.aggregation, options: AGGREGATIONS, onChange: (aggregation) => onChange({ ...value, aggregation }) }),
5807
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access', _486 => _486[0], 'optionalAccess', _487 => _487.field]))) }) }),
5917
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Show values as", value: value.showAs, options: SHOW_AS, onChange: (showAs) => onChange({ ...value, showAs, baseField: _nullishCoalesce(value.baseField, () => ( _optionalChain([axes, 'access', _491 => _491[0], 'optionalAccess', _492 => _492.field]))) }) }),
5808
5918
  needsBase ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base field", value: value.baseField == null ? "" : String(value.baseField), placeholder: "Choose a field", options: pivot.fields.filter((field) => axes.some((axis) => axis.field === field.index)).map((field) => [String(field.index), field.name]), onChange: (field) => onChange({ ...value, baseField: Number(field), baseGroupingUnit: null, baseItem: null }) }) : null,
5809
5919
  needsBase && baseAxes.length > 1 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base grouping level", value: _nullishCoalesce(_nullishCoalesce(value.baseGroupingUnit, () => ( groupingUnit(base))), () => ( "")), options: baseAxes.map((axis) => [_nullishCoalesce(groupingUnit(axis), () => ( "")), axis.name || groupingUnit(axis) || "Source items"]), onChange: (unit) => onChange({ ...value, baseGroupingUnit: unit || null, baseItem: null }) }) : null,
5810
- needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess', _488 => _488.items, 'optionalAccess', _489 => _489.length]) ? base.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _490 => _490.items]), () => ( []))).map((item) => [item.key, item.caption])], onChange: (baseItem) => onChange({ ...value, baseItem }) }) : null,
5920
+ needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess', _493 => _493.items, 'optionalAccess', _494 => _494.length]) ? base.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _495 => _495.items]), () => ( []))).map((item) => [item.key, item.caption])], onChange: (baseItem) => onChange({ ...value, baseItem }) }) : null,
5811
5921
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Number format", value: _nullishCoalesce(value.numberFormat, () => ( "")), placeholder: "General", onChange: (numberFormat) => onChange({ ...value, numberFormat: numberFormat || null }) }),
5812
5922
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Calculated field formula", value: _nullishCoalesce(value.formula, () => ( "")), placeholder: "Leave blank for a source field", onChange: (formula) => onChange({ ...value, formula: formula || null }) }),
5813
5923
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Use field names in formulas. Enclose names containing spaces in single quotes or square brackets." }),
@@ -5818,20 +5928,20 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
5818
5928
  const source = pivot.fields.find((field) => field.index === axis.field);
5819
5929
  const grouping = axis.grouping;
5820
5930
  const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
5821
- const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access', _491 => _491.grouping, 'optionalAccess', _492 => _492.kind]) === "date" && field.grouping.unit === unit));
5931
+ const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access', _496 => _496.grouping, 'optionalAccess', _497 => _497.kind]) === "date" && field.grouping.unit === unit));
5822
5932
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5823
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess', _493 => _493.name]), onChange: (name) => onChange({ ...axis, name: name || null }) }),
5933
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess', _498 => _498.name]), onChange: (name) => onChange({ ...axis, name: name || null }) }),
5824
5934
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort", value: axis.sort, options: [["ascending", "Ascending (A to Z)"], ["descending", "Descending (Z to A)"], ["manual", "Source order"], ["valueAscending", "Smallest to largest by value"], ["valueDescending", "Largest to smallest by value"]], onChange: (sort) => onChange({ ...axis, sort, sortMeasure: _nullishCoalesce(axis.sortMeasure, () => ( 0)) }) }),
5825
5935
  axis.sort.startsWith("value") ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Sort by value", value: String(_nullishCoalesce(axis.sortMeasure, () => ( 0))), options: pivot.values.map((value, index) => [String(index), value.name]), onChange: (sortMeasure) => onChange({ ...axis, sortMeasure: Number(sortMeasure) }) }) : null,
5826
5936
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show subtotals", checked: axis.subtotals, onChange: (subtotals) => onChange({ ...axis, subtotals }) }),
5827
5937
  axis.subtotals ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
5828
5938
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Custom subtotal functions" }),
5829
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access', _494 => _494.subtotalFunctions, 'optionalAccess', _495 => _495.includes, 'call', _496 => _496(value)]), () => ( false)), onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [..._nullishCoalesce(axis.subtotalFunctions, () => ( [])), value] : _optionalChain([axis, 'access', _497 => _497.subtotalFunctions, 'optionalAccess', _498 => _498.filter, 'call', _499 => _499((item) => item !== value)]) }) }, value)) }),
5939
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 3, marginTop: 6 }, children: AGGREGATIONS.map(([value, label]) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label, checked: _nullishCoalesce(_optionalChain([axis, 'access', _499 => _499.subtotalFunctions, 'optionalAccess', _500 => _500.includes, 'call', _501 => _501(value)]), () => ( false)), onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [..._nullishCoalesce(axis.subtotalFunctions, () => ( [])), value] : _optionalChain([axis, 'access', _502 => _502.subtotalFunctions, 'optionalAccess', _503 => _503.filter, 'call', _504 => _504((item) => item !== value)]) }) }, value)) }),
5830
5940
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Leave unchecked to use the value field\u2019s summary function." })
5831
5941
  ] }) : null,
5832
5942
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show items with no data", checked: _nullishCoalesce(axis.showItemsWithNoData, () => ( false)), onChange: (showItemsWithNoData) => onChange({ ...axis, showItemsWithNoData }) }),
5833
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess', _500 => _500.kind]), () => ( "none")), options: [["none", "None"], ["number", "Numeric intervals"], ["date", "Date intervals"], ["manual", "Named groups"]], onChange: (kind) => onChange({ ...axis, grouping: kind === "none" ? null : { kind, unit: "months", interval: 1, groups: [] }, items: [], collapsed: [] }) }),
5834
- _optionalChain([grouping, 'optionalAccess', _501 => _501.kind]) === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Group dates by", value: grouping.unit, options: DATE_UNITS.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => updateGrouping({ unit }) }) : null,
5943
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess', _505 => _505.kind]), () => ( "none")), options: [["none", "None"], ["number", "Numeric intervals"], ["date", "Date intervals"], ["manual", "Named groups"]], onChange: (kind) => onChange({ ...axis, grouping: kind === "none" ? null : { kind, unit: "months", interval: 1, groups: [] }, items: [], collapsed: [] }) }),
5944
+ _optionalChain([grouping, 'optionalAccess', _506 => _506.kind]) === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Group dates by", value: grouping.unit, options: DATE_UNITS.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => updateGrouping({ unit }) }) : null,
5835
5945
  grouping && grouping.kind !== "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5836
5946
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Interval", type: "number", min: 1e-6, step: "any", value: String(grouping.interval), onChange: (interval) => updateGrouping({ interval: Number(interval) }) }),
5837
5947
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
@@ -5840,18 +5950,18 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
5840
5950
  ] }),
5841
5951
  grouping.kind === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
5842
5952
  ] }) : null,
5843
- _optionalChain([grouping, 'optionalAccess', _502 => _502.kind]) === "date" && availableUnits.length ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Add date grouping level", value: "", placeholder: "Choose a level", options: availableUnits.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => onAddDateLevel(unit) }) : null,
5844
- _optionalChain([grouping, 'optionalAccess', _503 => _503.kind]) === "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5953
+ _optionalChain([grouping, 'optionalAccess', _507 => _507.kind]) === "date" && availableUnits.length ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Add date grouping level", value: "", placeholder: "Choose a level", options: availableUnits.map((unit) => [unit, unit[0].toUpperCase() + unit.slice(1)]), onChange: (unit) => onAddDateLevel(unit) }) : null,
5954
+ _optionalChain([grouping, 'optionalAccess', _508 => _508.kind]) === "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5845
5955
  grouping.groups.map((group, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, borderTop: "1px solid var(--xlsx-pivot-border)", paddingTop: 8 }, children: [
5846
5956
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Group name", value: group.name, onChange: (name) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, name } : item) }) }),
5847
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _504 => _504.items]), () => ( [])), selected: group.members, onChange: (members) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, members } : item) }) }),
5957
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _509 => _509.items]), () => ( [])), selected: group.members, onChange: (members) => updateGrouping({ groups: grouping.groups.map((item, position) => position === index ? { ...item, members } : item) }) }),
5848
5958
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: grouping.groups.filter((_, position) => position !== index) }), children: "Remove group" })
5849
5959
  ] }, index)),
5850
5960
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
5851
5961
  ] }) : null,
5852
5962
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
5853
5963
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Collapse members" }),
5854
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access', _505 => _505.items, 'optionalAccess', _506 => _506.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping to load its members." }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { label: "Members to collapse", items: _optionalChain([axis, 'access', _507 => _507.items, 'optionalAccess', _508 => _508.length]) ? axis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _509 => _509.items]), () => ( [])), selected: axis.collapsed, onChange: (collapsed) => onChange({ ...axis, collapsed }) }) })
5964
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access', _510 => _510.items, 'optionalAccess', _511 => _511.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping to load its members." }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { label: "Members to collapse", items: _optionalChain([axis, 'access', _512 => _512.items, 'optionalAccess', _513 => _513.length]) ? axis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _514 => _514.items]), () => ( [])), selected: axis.collapsed, onChange: (collapsed) => onChange({ ...axis, collapsed }) }) })
5855
5965
  ] })
5856
5966
  ] });
5857
5967
  }
@@ -5859,7 +5969,7 @@ function FieldFilters({ editor, pivot, field, axis }) {
5859
5969
  const source = pivot.fields.find((item) => item.index === field);
5860
5970
  const filterAxis = _nullishCoalesce(axis, () => ( [...pivot.rows, ...pivot.columns].find((item) => item.field === field && item.grouping)));
5861
5971
  const unit = groupingUnit(filterAxis);
5862
- const members = _optionalChain([filterAxis, 'optionalAccess', _510 => _510.items, 'optionalAccess', _511 => _511.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _512 => _512.items]), () => ( []));
5972
+ const members = _optionalChain([filterAxis, 'optionalAccess', _515 => _515.items, 'optionalAccess', _516 => _516.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _517 => _517.items]), () => ( []));
5863
5973
  const filters = pivot.filters.map((filter, index) => ({ filter, index })).filter(({ filter }) => filter.field === field && (_nullishCoalesce(filter.groupingUnit, () => ( null))) === unit);
5864
5974
  const kinds = [["members", "Select items"], ["label", "Label filter"], ["value", "Value filter"], ["top10", "Top / bottom filter"]];
5865
5975
  const update = (index, next) => editor.edit((current) => ({ ...current, filters: current.filters.flatMap((filter, position) => position === index ? next ? [next] : [] : [filter]) }));
@@ -5868,10 +5978,10 @@ function FieldFilters({ editor, pivot, field, axis }) {
5868
5978
  "Field filters",
5869
5979
  unit ? ` \xB7 ${unit}` : ""
5870
5980
  ] }),
5871
- _optionalChain([filterAxis, 'optionalAccess', _513 => _513.grouping]) && !_optionalChain([filterAxis, 'access', _514 => _514.items, 'optionalAccess', _515 => _515.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping before selecting its members." }) : null,
5981
+ _optionalChain([filterAxis, 'optionalAccess', _518 => _518.grouping]) && !_optionalChain([filterAxis, 'access', _519 => _519.items, 'optionalAccess', _520 => _520.length]) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Apply grouping before selecting its members." }) : null,
5872
5982
  filters.map(({ filter, index }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
5873
5983
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, justifyContent: "space-between" }, children: [
5874
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access', _516 => _516.find, 'call', _517 => _517(([kind]) => kind === filter.kind), 'optionalAccess', _518 => _518[1]]) }),
5984
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access', _521 => _521.find, 'call', _522 => _522(([kind]) => kind === filter.kind), 'optionalAccess', _523 => _523[1]]) }),
5875
5985
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { "aria-label": `Remove ${filter.kind} filter`, onClick: () => update(index, null), children: "\xD7" })
5876
5986
  ] }),
5877
5987
  filter.kind === "members" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
@@ -5931,10 +6041,10 @@ function Advanced({ editor, pivot }) {
5931
6041
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Formula", value: item.formula, onChange: (formula) => update({ calculatedItems: pivot.calculatedItems.map((entry, position) => position === index ? { ...entry, formula } : entry) }) }),
5932
6042
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => update({ calculatedItems: pivot.calculatedItems.filter((_, position) => position !== index) }), children: "Remove calculated item" })
5933
6043
  ] }, index)),
5934
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access', _519 => _519.rows, 'access', _520 => _520[0], 'optionalAccess', _521 => _521.field]), () => ( pivot.fields[0].index)), name: `Calculated item ${pivot.calculatedItems.length + 1}`, formula: "0" }] }), children: "Add calculated item" })
6044
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access', _524 => _524.rows, 'access', _525 => _525[0], 'optionalAccess', _526 => _526.field]), () => ( pivot.fields[0].index)), name: `Calculated item ${pivot.calculatedItems.length + 1}`, formula: "0" }] }), children: "Add calculated item" })
5935
6045
  ] }),
5936
6046
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Section, { title: "PivotChart", children: [
5937
- _optionalChain([pivot, 'access', _522 => _522.charts, 'optionalAccess', _523 => _523.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
6047
+ _optionalChain([pivot, 'access', _527 => _527.charts, 'optionalAccess', _528 => _528.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
5938
6048
  pivot.charts.length,
5939
6049
  " linked chart",
5940
6050
  pivot.charts.length === 1 ? "" : "s",
@@ -5967,13 +6077,13 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5967
6077
  const titleId = React12.useId();
5968
6078
  const settingsId = React12.useId();
5969
6079
  const pivot = editor.draft;
5970
- const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _524 => _524.unsupportedFeatures, 'access', _525 => _525.length])) || editor.sourceNeedsLoad;
6080
+ const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _529 => _529.unsupportedFeatures, 'access', _530 => _530.length])) || editor.sourceNeedsLoad;
5971
6081
  React12.useEffect(() => {
5972
6082
  setSelected(null);
5973
6083
  setSearch("");
5974
- }, [_optionalChain([pivot, 'optionalAccess', _526 => _526.id])]);
6084
+ }, [_optionalChain([pivot, 'optionalAccess', _531 => _531.id])]);
5975
6085
  React12.useEffect(() => {
5976
- const parent = _optionalChain([paneRef, 'access', _527 => _527.current, 'optionalAccess', _528 => _528.parentElement]);
6086
+ const parent = _optionalChain([paneRef, 'access', _532 => _532.current, 'optionalAccess', _533 => _533.parentElement]);
5977
6087
  if (!parent) return;
5978
6088
  const viewer = parent.closest(".react-xlsx-viewer");
5979
6089
  const measure = () => {
@@ -5983,16 +6093,16 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5983
6093
  };
5984
6094
  measure();
5985
6095
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
5986
- _optionalChain([observer, 'optionalAccess', _529 => _529.observe, 'call', _530 => _530(parent)]);
5987
- if (viewer) _optionalChain([observer, 'optionalAccess', _531 => _531.observe, 'call', _532 => _532(viewer)]);
6096
+ _optionalChain([observer, 'optionalAccess', _534 => _534.observe, 'call', _535 => _535(parent)]);
6097
+ if (viewer) _optionalChain([observer, 'optionalAccess', _536 => _536.observe, 'call', _537 => _537(viewer)]);
5988
6098
  window.addEventListener("resize", measure);
5989
6099
  return () => {
5990
- _optionalChain([observer, 'optionalAccess', _533 => _533.disconnect, 'call', _534 => _534()]);
6100
+ _optionalChain([observer, 'optionalAccess', _538 => _538.disconnect, 'call', _539 => _539()]);
5991
6101
  window.removeEventListener("resize", measure);
5992
6102
  };
5993
6103
  }, []);
5994
6104
  const selectedField = pivot && selected ? fieldIndex(pivot, selected.area, selected.index) : void 0;
5995
- const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess', _535 => _535.area]) === "values" && _optionalChain([pivot, 'access', _536 => _536.values, 'access', _537 => _537[selected.index], 'optionalAccess', _538 => _538.formula, 'optionalAccess', _539 => _539.trim, 'call', _540 => _540()]));
6105
+ const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess', _540 => _540.area]) === "values" && _optionalChain([pivot, 'access', _541 => _541.values, 'access', _542 => _542[selected.index], 'optionalAccess', _543 => _543.formula, 'optionalAccess', _544 => _544.trim, 'call', _545 => _545()]));
5996
6106
  const theme = {
5997
6107
  "--xlsx-pivot-bg": isDark ? "#242729" : "#fafbfa",
5998
6108
  "--xlsx-pivot-input": isDark ? "#303437" : "#ffffff",
@@ -6002,7 +6112,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
6002
6112
  "--xlsx-pivot-hover": isDark ? "#35483d" : "#edf5ef"
6003
6113
  };
6004
6114
  const move = (from, to, index) => {
6005
- if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess', _541 => _541.values, 'access', _542 => _542[from.index], 'optionalAccess', _543 => _543.formula, 'optionalAccess', _544 => _544.trim, 'call', _545 => _545()])) {
6115
+ if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess', _546 => _546.values, 'access', _547 => _547[from.index], 'optionalAccess', _548 => _548.formula, 'optionalAccess', _549 => _549.trim, 'call', _550 => _550()])) {
6006
6116
  setAnnouncement("Calculated fields stay in the Values area.");
6007
6117
  return;
6008
6118
  }
@@ -6017,7 +6127,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
6017
6127
  if (disabled) return;
6018
6128
  try {
6019
6129
  const data = JSON.parse(event.dataTransfer.getData(DRAG_TYPE));
6020
- if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess', _546 => _546.fields, 'access', _547 => _547.some, 'call', _548 => _548((field) => field.index === data.field)])) {
6130
+ if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess', _551 => _551.fields, 'access', _552 => _552.some, 'call', _553 => _553((field) => field.index === data.field)])) {
6021
6131
  editor.addField(area, data.field);
6022
6132
  setAnnouncement(`Field added to ${AREA_NAMES[area]}.`);
6023
6133
  } else if ("area" in data && AREAS.includes(data.area) && Number.isInteger(data.index) && pivot && data.index >= 0 && data.index < pivot[data.area].length) move(data, area, index);
@@ -6037,14 +6147,14 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
6037
6147
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
6038
6148
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, padding: 12 }, children: [
6039
6149
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, alignItems: "end" }, children: [
6040
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess', _549 => _549.id]), () => ( "")), placeholder: pivot && !pivot.id ? pivot.name : "Choose a PivotTable", options: editor.viewer.pivotTables.map((item) => [item.id, item.name]), onChange: editor.select, disabled: editor.dirty }) }),
6150
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { flex: 1, minWidth: 0 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "PivotTable", value: _nullishCoalesce(_optionalChain([pivot, 'optionalAccess', _554 => _554.id]), () => ( "")), placeholder: pivot && !pivot.id ? pivot.name : "Choose a PivotTable", options: editor.viewer.pivotTables.map((item) => [item.id, item.name]), onChange: editor.select, disabled: editor.dirty }) }),
6041
6151
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: editor.viewer.readOnly || editor.dirty, onClick: editor.create, children: "New" })
6042
6152
  ] }),
6043
6153
  editor.error ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: { margin: 0, color: isDark ? "#ffb7b0" : "#a12622", overflowWrap: "anywhere" }, children: editor.error }) : null,
6044
6154
  editor.status ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: editor.status }) : null,
6045
6155
  editor.stale ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "alert", style: hint, children: "The worksheet changed while you were editing. Discard these changes to load the current PivotTable." }) : null,
6046
6156
  editor.sourceNeedsLoad ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: "The source changed. Load its fields under Source and location." }) : null,
6047
- _optionalChain([pivot, 'optionalAccess', _550 => _550.unsupportedFeatures, 'access', _551 => _551.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
6157
+ _optionalChain([pivot, 'optionalAccess', _555 => _555.unsupportedFeatures, 'access', _556 => _556.length]) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: hint, children: [
6048
6158
  "This PivotTable is preserved for Excel. Editing is unavailable for: ",
6049
6159
  pivot.unsupportedFeatures.join(", "),
6050
6160
  "."
@@ -6086,7 +6196,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
6086
6196
  pivot[area].map((_, index) => {
6087
6197
  const field = fieldIndex(pivot, area, index);
6088
6198
  const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
6089
- const active = _optionalChain([selected, 'optionalAccess', _552 => _552.area]) === area && selected.index === index;
6199
+ const active = _optionalChain([selected, 'optionalAccess', _557 => _557.area]) === area && selected.index === index;
6090
6200
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { draggable: !disabled, onDragStart: (event) => drag(event, { area, index }), onDrop: (event) => drop(event, area, index), style: { marginBottom: 3 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { type: "button", "aria-expanded": active, "aria-controls": settingsId, title: `${name} settings. Alt+Up or Alt+Down reorders the field.`, onClick: () => setSelected(active ? null : { area, index }), onKeyDown: (event) => {
6091
6201
  if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
6092
6202
  event.preventDefault();
@@ -6746,7 +6856,7 @@ function parseCanvasGradientStops(value) {
6746
6856
  if (!match) {
6747
6857
  return null;
6748
6858
  }
6749
- const color = _optionalChain([match, 'access', _553 => _553[1], 'optionalAccess', _554 => _554.trim, 'call', _555 => _555()]);
6859
+ const color = _optionalChain([match, 'access', _558 => _558[1], 'optionalAccess', _559 => _559.trim, 'call', _560 => _560()]);
6750
6860
  const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
6751
6861
  if (!color) {
6752
6862
  return null;
@@ -6762,7 +6872,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
6762
6872
  if (linearMatch) {
6763
6873
  const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
6764
6874
  if (parts.length >= 2) {
6765
- const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _556 => _556[0], 'optionalAccess', _557 => _557.trim, 'call', _558 => _558()]), () => ( "180deg"));
6875
+ const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _561 => _561[0], 'optionalAccess', _562 => _562.trim, 'call', _563 => _563()]), () => ( "180deg"));
6766
6876
  const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
6767
6877
  const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
6768
6878
  const radians = (90 - cssAngle) * Math.PI / 180;
@@ -6792,7 +6902,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
6792
6902
  const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
6793
6903
  if (radialMatch) {
6794
6904
  const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
6795
- const stopParts = _optionalChain([parts, 'access', _559 => _559[0], 'optionalAccess', _560 => _560.startsWith, 'call', _561 => _561("circle")]) ? parts.slice(1) : parts;
6905
+ const stopParts = _optionalChain([parts, 'access', _564 => _564[0], 'optionalAccess', _565 => _565.startsWith, 'call', _566 => _566("circle")]) ? parts.slice(1) : parts;
6796
6906
  const gradient = context.createRadialGradient(
6797
6907
  rect.left + rect.width / 2,
6798
6908
  rect.top + rect.height / 2,
@@ -6918,7 +7028,7 @@ function resolveDarkModeSurface(themePalette, palette) {
6918
7028
  return "hsl(225 4% 6%)";
6919
7029
  }
6920
7030
  function resolveSheetSurface(sheet, palette) {
6921
- return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _562 => _562.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _563 => _563.themePalette, 'access', _564 => _564.colorsByIndex, 'access', _565 => _565[0]]), () => ( SHEET_SURFACE));
7031
+ return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _567 => _567.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _568 => _568.themePalette, 'access', _569 => _569.colorsByIndex, 'access', _570 => _570[0]]), () => ( SHEET_SURFACE));
6922
7032
  }
6923
7033
  function normalizeRange2(range) {
6924
7034
  return {
@@ -6949,7 +7059,7 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
6949
7059
  const visible = precomputed.filter((index) => index < displayLimit);
6950
7060
  const appendStart = precomputed.length ? Math.max(0, maxUsedIndex + 1) : 0;
6951
7061
  for (let index = appendStart; index < displayLimit; index++) {
6952
- if (!_optionalChain([hiddenIndices, 'optionalAccess', _566 => _566.has, 'call', _567 => _567(index)])) visible.push(index);
7062
+ if (!_optionalChain([hiddenIndices, 'optionalAccess', _571 => _571.has, 'call', _572 => _572(index)])) visible.push(index);
6953
7063
  }
6954
7064
  return visible;
6955
7065
  }
@@ -6982,7 +7092,7 @@ function clampPercent(value, fallback) {
6982
7092
  return Math.max(0, Math.min(100, value));
6983
7093
  }
6984
7094
  function resolveShapeAdjustment(shape, name, fallback) {
6985
- const rawValue = _optionalChain([shape, 'access', _568 => _568.geometryAdjustments, 'optionalAccess', _569 => _569[name]]);
7095
+ const rawValue = _optionalChain([shape, 'access', _573 => _573.geometryAdjustments, 'optionalAccess', _574 => _574[name]]);
6986
7096
  if (typeof rawValue !== "number") {
6987
7097
  return fallback;
6988
7098
  }
@@ -7882,8 +7992,8 @@ function normalizeThumbnailResolution(resolution) {
7882
7992
  }
7883
7993
  const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
7884
7994
  return {
7885
- maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _570 => _570.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
7886
- maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _571 => _571.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
7995
+ maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _575 => _575.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
7996
+ maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _576 => _576.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
7887
7997
  };
7888
7998
  }
7889
7999
  function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
@@ -8202,24 +8312,24 @@ function escapeCssFontFamily(name) {
8202
8312
  return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
8203
8313
  }
8204
8314
  function resolveSpreadsheetThemeFont(font, themePalette) {
8205
- const scheme = typeof _optionalChain([font, 'optionalAccess', _572 => _572.scheme]) === "string" ? font.scheme : null;
8315
+ const scheme = typeof _optionalChain([font, 'optionalAccess', _577 => _577.scheme]) === "string" ? font.scheme : null;
8206
8316
  if (scheme === "major") {
8207
- return _optionalChain([themePalette, 'optionalAccess', _573 => _573.majorLatinFont]);
8317
+ return _optionalChain([themePalette, 'optionalAccess', _578 => _578.majorLatinFont]);
8208
8318
  }
8209
8319
  if (scheme === "minor") {
8210
- return _optionalChain([themePalette, 'optionalAccess', _574 => _574.minorLatinFont]);
8320
+ return _optionalChain([themePalette, 'optionalAccess', _579 => _579.minorLatinFont]);
8211
8321
  }
8212
8322
  return void 0;
8213
8323
  }
8214
8324
  function buildSpreadsheetFontFamily(font, themePalette) {
8215
8325
  const candidates = [
8216
- typeof _optionalChain([font, 'optionalAccess', _575 => _575.name]) === "string" ? font.name.trim() : "",
8217
- _nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _576 => _576(font, themePalette), 'optionalAccess', _577 => _577.trim, 'call', _578 => _578()]), () => ( ""))
8326
+ typeof _optionalChain([font, 'optionalAccess', _580 => _580.name]) === "string" ? font.name.trim() : "",
8327
+ _nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _581 => _581(font, themePalette), 'optionalAccess', _582 => _582.trim, 'call', _583 => _583()]), () => ( ""))
8218
8328
  ].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
8219
8329
  if (candidates.length === 0) {
8220
8330
  return void 0;
8221
8331
  }
8222
- const primaryFont = _optionalChain([candidates, 'access', _579 => _579[0], 'optionalAccess', _580 => _580.toLowerCase, 'call', _581 => _581()]);
8332
+ const primaryFont = _optionalChain([candidates, 'access', _584 => _584[0], 'optionalAccess', _585 => _585.toLowerCase, 'call', _586 => _586()]);
8223
8333
  if (primaryFont === "calibri") {
8224
8334
  return [
8225
8335
  "Calibri",
@@ -8252,17 +8362,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
8252
8362
  }
8253
8363
  function buildGridlineShadow(color, options2) {
8254
8364
  const parts = [];
8255
- if (_optionalChain([options2, 'optionalAccess', _582 => _582.right]) !== false) {
8365
+ if (_optionalChain([options2, 'optionalAccess', _587 => _587.right]) !== false) {
8256
8366
  parts.push(`inset -1px 0 0 ${color}`);
8257
8367
  }
8258
- if (_optionalChain([options2, 'optionalAccess', _583 => _583.bottom]) !== false) {
8368
+ if (_optionalChain([options2, 'optionalAccess', _588 => _588.bottom]) !== false) {
8259
8369
  parts.push(`inset 0 -1px 0 ${color}`);
8260
8370
  }
8261
8371
  return parts.join(", ");
8262
8372
  }
8263
8373
  function buildCellStyle(style, palette, themePalette, options2) {
8264
- const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _584 => _584.showGridLines]), () => ( true));
8265
- const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _585 => _585.colorsByIndex, 'access', _586 => _586[0]]), () => ( SHEET_SURFACE));
8374
+ const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _589 => _589.showGridLines]), () => ( true));
8375
+ const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _590 => _590.colorsByIndex, 'access', _591 => _591[0]]), () => ( SHEET_SURFACE));
8266
8376
  const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
8267
8377
  const css = {
8268
8378
  backgroundColor: baseSurface,
@@ -8275,7 +8385,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
8275
8385
  lineHeight: String(resolveSpreadsheetLineHeight(11)),
8276
8386
  overflow: "hidden",
8277
8387
  padding: DEFAULT_CELL_PADDING,
8278
- textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _587 => _587.generalAlignment]), () => ( "left")),
8388
+ textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _592 => _592.generalAlignment]), () => ( "left")),
8279
8389
  textOverflow: "clip",
8280
8390
  verticalAlign: "bottom",
8281
8391
  whiteSpace: "nowrap"
@@ -8359,24 +8469,24 @@ function buildCellStyle(style, palette, themePalette, options2) {
8359
8469
  }
8360
8470
  const border = style.border;
8361
8471
  if (border) {
8362
- const hasRightBorder = Boolean(_optionalChain([border, 'access', _588 => _588.right, 'optionalAccess', _589 => _589.style]) && border.right.style !== "none");
8363
- const hasBottomBorder = Boolean(_optionalChain([border, 'access', _590 => _590.bottom, 'optionalAccess', _591 => _591.style]) && border.bottom.style !== "none");
8472
+ const hasRightBorder = Boolean(_optionalChain([border, 'access', _593 => _593.right, 'optionalAccess', _594 => _594.style]) && border.right.style !== "none");
8473
+ const hasBottomBorder = Boolean(_optionalChain([border, 'access', _595 => _595.bottom, 'optionalAccess', _596 => _596.style]) && border.bottom.style !== "none");
8364
8474
  if (showGridLines && (hasRightBorder || hasBottomBorder)) {
8365
8475
  css.boxShadow = buildGridlineShadow(palette.border, {
8366
8476
  bottom: !hasBottomBorder,
8367
8477
  right: !hasRightBorder
8368
8478
  }) || void 0;
8369
8479
  }
8370
- if (_optionalChain([border, 'access', _592 => _592.top, 'optionalAccess', _593 => _593.style]) && border.top.style !== "none") {
8480
+ if (_optionalChain([border, 'access', _597 => _597.top, 'optionalAccess', _598 => _598.style]) && border.top.style !== "none") {
8371
8481
  css.borderTop = mapBorder2(border.top, themePalette);
8372
8482
  }
8373
- if (_optionalChain([border, 'access', _594 => _594.right, 'optionalAccess', _595 => _595.style]) && border.right.style !== "none") {
8483
+ if (_optionalChain([border, 'access', _599 => _599.right, 'optionalAccess', _600 => _600.style]) && border.right.style !== "none") {
8374
8484
  css.borderRight = mapBorder2(border.right, themePalette);
8375
8485
  }
8376
- if (_optionalChain([border, 'access', _596 => _596.bottom, 'optionalAccess', _597 => _597.style]) && border.bottom.style !== "none") {
8486
+ if (_optionalChain([border, 'access', _601 => _601.bottom, 'optionalAccess', _602 => _602.style]) && border.bottom.style !== "none") {
8377
8487
  css.borderBottom = mapBorder2(border.bottom, themePalette);
8378
8488
  }
8379
- if (_optionalChain([border, 'access', _598 => _598.left, 'optionalAccess', _599 => _599.style]) && border.left.style !== "none") {
8489
+ if (_optionalChain([border, 'access', _603 => _603.left, 'optionalAccess', _604 => _604.style]) && border.left.style !== "none") {
8380
8490
  css.borderLeft = mapBorder2(border.left, themePalette);
8381
8491
  }
8382
8492
  }
@@ -8422,7 +8532,7 @@ function measureTextWidth(value, style) {
8422
8532
  }
8423
8533
  function getCellDisplayValue(worksheet, row2, col, activeSheet, locale = "en-US") {
8424
8534
  const formula = worksheet.getFormulaAt(row2, col);
8425
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _600 => _600.cachedFormulaValues, 'optionalAccess', _601 => _601[cellAddressToA12({ row: row2, col })]]) : void 0;
8535
+ const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _605 => _605.cachedFormulaValues, 'optionalAccess', _606 => _606[cellAddressToA12({ row: row2, col })]]) : void 0;
8426
8536
  const formatted = worksheet.getFormattedValueAt(row2, col);
8427
8537
  if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
8428
8538
  return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, row2, col, decodeHtmlEntities2(formatted), locale);
@@ -8669,7 +8779,7 @@ function normalizeBatchedMergeSpan(value) {
8669
8779
  }
8670
8780
  function normalizeBatchedCellValue(rawValue, formula, row2, col, activeSheet) {
8671
8781
  const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
8672
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _602 => _602.cachedFormulaValues, 'optionalAccess', _603 => _603[cellAddressToA12({ row: row2, col })]]) : void 0;
8782
+ const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _607 => _607.cachedFormulaValues, 'optionalAccess', _608 => _608[cellAddressToA12({ row: row2, col })]]) : void 0;
8673
8783
  if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
8674
8784
  return cachedFormulaValue;
8675
8785
  }
@@ -8717,31 +8827,31 @@ function mergeResolvedCellStyle(base, overlay, options2) {
8717
8827
  ..._nullishCoalesce(base, () => ( {})),
8718
8828
  ..._nullishCoalesce(overlay, () => ( {}))
8719
8829
  };
8720
- const baseAlignment = _optionalChain([base, 'optionalAccess', _604 => _604.alignment]);
8721
- const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _605 => _605.alignment]);
8830
+ const baseAlignment = _optionalChain([base, 'optionalAccess', _609 => _609.alignment]);
8831
+ const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _610 => _610.alignment]);
8722
8832
  if (baseAlignment || overlayAlignment) {
8723
8833
  nextStyle.alignment = {
8724
8834
  ..._nullishCoalesce(baseAlignment, () => ( {})),
8725
8835
  ..._nullishCoalesce(overlayAlignment, () => ( {}))
8726
8836
  };
8727
8837
  }
8728
- const baseBorder = _optionalChain([base, 'optionalAccess', _606 => _606.border]);
8729
- const overlayBorder = _optionalChain([overlay, 'optionalAccess', _607 => _607.border]);
8838
+ const baseBorder = _optionalChain([base, 'optionalAccess', _611 => _611.border]);
8839
+ const overlayBorder = _optionalChain([overlay, 'optionalAccess', _612 => _612.border]);
8730
8840
  if (baseBorder || overlayBorder) {
8731
- nextStyle.border = _optionalChain([options2, 'optionalAccess', _608 => _608.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
8841
+ nextStyle.border = _optionalChain([options2, 'optionalAccess', _613 => _613.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
8732
8842
  ..._nullishCoalesce(baseBorder, () => ( {})),
8733
8843
  ..._nullishCoalesce(overlayBorder, () => ( {}))
8734
8844
  };
8735
8845
  }
8736
- const baseFill = _optionalChain([base, 'optionalAccess', _609 => _609.fill]);
8737
- const overlayFill = _optionalChain([overlay, 'optionalAccess', _610 => _610.fill]);
8846
+ const baseFill = _optionalChain([base, 'optionalAccess', _614 => _614.fill]);
8847
+ const overlayFill = _optionalChain([overlay, 'optionalAccess', _615 => _615.fill]);
8738
8848
  if (baseFill || overlayFill) {
8739
- nextStyle.fill = _optionalChain([options2, 'optionalAccess', _611 => _611.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
8849
+ nextStyle.fill = _optionalChain([options2, 'optionalAccess', _616 => _616.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
8740
8850
  }
8741
- const baseFont = _optionalChain([base, 'optionalAccess', _612 => _612.font]);
8742
- const overlayFont = _optionalChain([overlay, 'optionalAccess', _613 => _613.font]);
8851
+ const baseFont = _optionalChain([base, 'optionalAccess', _617 => _617.font]);
8852
+ const overlayFont = _optionalChain([overlay, 'optionalAccess', _618 => _618.font]);
8743
8853
  if (baseFont || overlayFont) {
8744
- nextStyle.font = _optionalChain([options2, 'optionalAccess', _614 => _614.replaceXfSubtrees]) && overlayFont ? overlayFont : {
8854
+ nextStyle.font = _optionalChain([options2, 'optionalAccess', _619 => _619.replaceXfSubtrees]) && overlayFont ? overlayFont : {
8745
8855
  ..._nullishCoalesce(baseFont, () => ( {})),
8746
8856
  ..._nullishCoalesce(overlayFont, () => ( {}))
8747
8857
  };
@@ -9255,11 +9365,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
9255
9365
  return literal;
9256
9366
  }
9257
9367
  const splitReference = splitSheetFormulaReference(normalized);
9258
- const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _615 => _615.sheetName]), () => ( null));
9259
- if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _616 => _616.name]) && targetSheetName !== sheet.name) {
9368
+ const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _620 => _620.sheetName]), () => ( null));
9369
+ if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _621 => _621.name]) && targetSheetName !== sheet.name) {
9260
9370
  return literal;
9261
9371
  }
9262
- const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _617 => _617.range]), () => ( normalized));
9372
+ const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _622 => _622.range]), () => ( normalized));
9263
9373
  const cell = parseA1CellReference2(cellRef.replace(/\$/g, ""));
9264
9374
  if (!cell) {
9265
9375
  return literal;
@@ -9291,8 +9401,8 @@ function normalizeConditionalTextOperand(value) {
9291
9401
  }
9292
9402
  function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
9293
9403
  const normalizedRuleType = rule.ruleType.trim().toLowerCase();
9294
- const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _618 => _618.formulas, 'optionalAccess', _619 => _619[0]]), () => ( "")), worksheet, sheet, batchedCells);
9295
- const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _620 => _620.formulas, 'optionalAccess', _621 => _621[1]]), () => ( "")), worksheet, sheet, batchedCells);
9404
+ const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _623 => _623.formulas, 'optionalAccess', _624 => _624[0]]), () => ( "")), worksheet, sheet, batchedCells);
9405
+ const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _625 => _625.formulas, 'optionalAccess', _626 => _626[1]]), () => ( "")), worksheet, sheet, batchedCells);
9296
9406
  if (normalizedRuleType === "cellis") {
9297
9407
  return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
9298
9408
  }
@@ -9323,7 +9433,7 @@ function getStyledConditionalRules(rules) {
9323
9433
  return styledRules;
9324
9434
  }
9325
9435
  function resolveConditionalCellStyleForCell(row2, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
9326
- const rules = _optionalChain([sheet, 'optionalAccess', _622 => _622.conditionalFormatRules]);
9436
+ const rules = _optionalChain([sheet, 'optionalAccess', _627 => _627.conditionalFormatRules]);
9327
9437
  if (!sheet || !rules || rules.length === 0) {
9328
9438
  return null;
9329
9439
  }
@@ -9527,11 +9637,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9527
9637
  if (shape.paragraphs.length === 0) {
9528
9638
  return;
9529
9639
  }
9530
- const inset = _optionalChain([shape, 'access', _623 => _623.textBox, 'optionalAccess', _624 => _624.insetPx]);
9531
- const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _625 => _625.left]), () => ( 6))) * zoomFactor;
9532
- const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _626 => _626.right]), () => ( 6))) * zoomFactor;
9533
- const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _627 => _627.top]), () => ( 4))) * zoomFactor;
9534
- const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _628 => _628.bottom]), () => ( 4))) * zoomFactor;
9640
+ const inset = _optionalChain([shape, 'access', _628 => _628.textBox, 'optionalAccess', _629 => _629.insetPx]);
9641
+ const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _630 => _630.left]), () => ( 6))) * zoomFactor;
9642
+ const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _631 => _631.right]), () => ( 6))) * zoomFactor;
9643
+ const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _632 => _632.top]), () => ( 4))) * zoomFactor;
9644
+ const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _633 => _633.bottom]), () => ( 4))) * zoomFactor;
9535
9645
  const textLeft = left + paddingLeft;
9536
9646
  const textTop = top + paddingTop;
9537
9647
  const textWidth = Math.max(0, width - paddingLeft - paddingRight);
@@ -9553,9 +9663,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9553
9663
  });
9554
9664
  const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
9555
9665
  let y = textTop;
9556
- if (_optionalChain([shape, 'access', _629 => _629.textBox, 'optionalAccess', _630 => _630.verticalAlign]) === "middle") {
9666
+ if (_optionalChain([shape, 'access', _634 => _634.textBox, 'optionalAccess', _635 => _635.verticalAlign]) === "middle") {
9557
9667
  y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
9558
- } else if (_optionalChain([shape, 'access', _631 => _631.textBox, 'optionalAccess', _632 => _632.verticalAlign]) === "bottom") {
9668
+ } else if (_optionalChain([shape, 'access', _636 => _636.textBox, 'optionalAccess', _637 => _637.verticalAlign]) === "bottom") {
9559
9669
  y = textTop + Math.max(0, textHeight - totalTextHeight);
9560
9670
  }
9561
9671
  context.save();
@@ -9566,7 +9676,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9566
9676
  shape.paragraphs.forEach((paragraph, paragraphIndex) => {
9567
9677
  const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
9568
9678
  let x = textLeft;
9569
- const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _633 => _633.textBox, 'optionalAccess', _634 => _634.horizontalAlign]))), () => ( "left"));
9679
+ const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _638 => _638.textBox, 'optionalAccess', _639 => _639.horizontalAlign]))), () => ( "left"));
9570
9680
  if (align === "center") {
9571
9681
  x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
9572
9682
  } else if (align === "right") {
@@ -9595,11 +9705,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9595
9705
  context.restore();
9596
9706
  }
9597
9707
  function drawStaticShape(context, shape, rect, zoomFactor) {
9598
- const fillColor = _optionalChain([shape, 'access', _635 => _635.fill, 'optionalAccess', _636 => _636.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _637 => _637.fill, 'optionalAccess', _638 => _638.color]), () => ( "transparent"));
9599
- const strokeColor = _optionalChain([shape, 'access', _639 => _639.stroke, 'optionalAccess', _640 => _640.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _641 => _641.stroke, 'optionalAccess', _642 => _642.color]), () => ( "transparent"));
9600
- const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _643 => _643.stroke, 'optionalAccess', _644 => _644.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
9708
+ const fillColor = _optionalChain([shape, 'access', _640 => _640.fill, 'optionalAccess', _641 => _641.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _642 => _642.fill, 'optionalAccess', _643 => _643.color]), () => ( "transparent"));
9709
+ const strokeColor = _optionalChain([shape, 'access', _644 => _644.stroke, 'optionalAccess', _645 => _645.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _646 => _646.stroke, 'optionalAccess', _647 => _647.color]), () => ( "transparent"));
9710
+ const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _648 => _648.stroke, 'optionalAccess', _649 => _649.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
9601
9711
  const vectorShape = resolveShapeVector(shape);
9602
- const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _645 => _645.fill, 'optionalAccess', _646 => _646.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _647 => _647.stroke, 'optionalAccess', _648 => _648.opacity]), () => ( 1)));
9712
+ const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _650 => _650.fill, 'optionalAccess', _651 => _651.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _652 => _652.stroke, 'optionalAccess', _653 => _653.opacity]), () => ( 1)));
9603
9713
  context.save();
9604
9714
  context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
9605
9715
  if (shape.rotationDeg) {
@@ -9610,7 +9720,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
9610
9720
  context.lineWidth = lineWidth;
9611
9721
  context.strokeStyle = strokeColor;
9612
9722
  context.fillStyle = fillColor;
9613
- applyCanvasShapeDash(context, _optionalChain([shape, 'access', _649 => _649.stroke, 'optionalAccess', _650 => _650.dash]), lineWidth);
9723
+ applyCanvasShapeDash(context, _optionalChain([shape, 'access', _654 => _654.stroke, 'optionalAccess', _655 => _655.dash]), lineWidth);
9614
9724
  const localLeft = -rect.width / 2;
9615
9725
  const localTop = -rect.height / 2;
9616
9726
  if (vectorShape && typeof Path2D !== "undefined") {
@@ -9747,7 +9857,7 @@ function drawStaticFormControl(context, control2, rect, palette, zoomFactor, she
9747
9857
  context.restore();
9748
9858
  }
9749
9859
  function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCache) {
9750
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _651 => _651.conditionalFormatRules]), () => ( []));
9860
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _656 => _656.conditionalFormatRules]), () => ( []));
9751
9861
  const matchingRule = rules.find(
9752
9862
  (rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9753
9863
  );
@@ -9785,23 +9895,23 @@ function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCa
9785
9895
  const span = maxValue - minValue;
9786
9896
  const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
9787
9897
  const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
9788
- const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _652 => _652.themePalette]));
9898
+ const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _657 => _657.themePalette]));
9789
9899
  if (!color || widthPercent <= 0) {
9790
9900
  return null;
9791
9901
  }
9792
9902
  return {
9793
- axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _653 => _653.themePalette])), () => ( void 0)),
9903
+ axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _658 => _658.themePalette])), () => ( void 0)),
9794
9904
  border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
9795
- borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _654 => _654.themePalette])), () => ( void 0)),
9905
+ borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _659 => _659.themePalette])), () => ( void 0)),
9796
9906
  color,
9797
9907
  gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
9798
- negativeBorderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _655 => _655.themePalette])), () => ( void 0)),
9799
- negativeFillColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _656 => _656.themePalette])), () => ( void 0)),
9908
+ negativeBorderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _660 => _660.themePalette])), () => ( void 0)),
9909
+ negativeFillColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _661 => _661.themePalette])), () => ( void 0)),
9800
9910
  widthPercent
9801
9911
  };
9802
9912
  }
9803
9913
  function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metricsCache) {
9804
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _657 => _657.conditionalFormatRules]), () => ( []));
9914
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _662 => _662.conditionalFormatRules]), () => ( []));
9805
9915
  const matchingRule = rules.find(
9806
9916
  (rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9807
9917
  );
@@ -9829,7 +9939,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
9829
9939
  });
9830
9940
  metricsCache.set(cacheKey, ruleValues);
9831
9941
  }
9832
- const colors = matchingRule.colors.map((color) => _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess', _658 => _658.themePalette]))).filter((color) => typeof color === "string");
9942
+ const colors = matchingRule.colors.map((color) => _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess', _663 => _663.themePalette]))).filter((color) => typeof color === "string");
9833
9943
  const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
9834
9944
  if (colors.length < 2 || thresholds.length < 2) {
9835
9945
  return null;
@@ -9848,7 +9958,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
9848
9958
  return { color: resolvedColor };
9849
9959
  }
9850
9960
  function resolveConditionalIconForCell(row2, col, worksheet, sheet, metricsCache) {
9851
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _659 => _659.conditionalFormatRules]), () => ( []));
9961
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _664 => _664.conditionalFormatRules]), () => ( []));
9852
9962
  const matchingRule = rules.find(
9853
9963
  (rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9854
9964
  );
@@ -10150,7 +10260,7 @@ function GridRow({
10150
10260
  whiteSpace: "nowrap",
10151
10261
  width: "max-content"
10152
10262
  } : null;
10153
- const title = [_optionalChain([cellData, 'access', _660 => _660.hyperlink, 'optionalAccess', _661 => _661.tooltip]), _optionalChain([cellData, 'access', _662 => _662.validation, 'optionalAccess', _663 => _663.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
10263
+ const title = [_optionalChain([cellData, 'access', _665 => _665.hyperlink, 'optionalAccess', _666 => _666.tooltip]), _optionalChain([cellData, 'access', _667 => _667.validation, 'optionalAccess', _668 => _668.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
10154
10264
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
10155
10265
  "td",
10156
10266
  {
@@ -10339,8 +10449,8 @@ var MemoGridRow = React15.memo(GridRow, (prev, next) => {
10339
10449
  if (prev.actualRow !== next.actualRow || prev.rowHeight !== next.rowHeight || prev.headerLabelLiveScale !== next.headerLabelLiveScale || prev.palette !== next.palette || prev.readOnly !== next.readOnly || prev.visibleCols !== next.visibleCols || prev.leadingSpacerWidth !== next.leadingSpacerWidth || prev.rowHeaderWidth !== next.rowHeaderWidth || prev.stickyLeftByCol !== next.stickyLeftByCol || prev.stickyTop !== next.stickyTop || prev.trailingSpacerWidth !== next.trailingSpacerWidth || prev.zoomFactor !== next.zoomFactor || prev.getCellData !== next.getCellData || prev.onCellClick !== next.onCellClick || prev.onCellDoubleClick !== next.onCellDoubleClick || prev.onCellPointerDown !== next.onCellPointerDown || prev.onEditingBlur !== next.onEditingBlur || prev.onEditingCancel !== next.onEditingCancel || prev.onEditingCommit !== next.onEditingCommit || prev.onEditingNavigate !== next.onEditingNavigate || prev.onEditingValueChange !== next.onEditingValueChange || prev.onRowHeaderRef !== next.onRowHeaderRef || prev.onRowPointerDown !== next.onRowPointerDown || prev.onRowResizeDoubleClick !== next.onRowResizeDoubleClick || prev.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment || prev.cellEditorStyle !== next.cellEditorStyle || prev.onFocusEditorOverlay !== next.onFocusEditorOverlay) {
10340
10450
  return false;
10341
10451
  }
10342
- const prevEditingCol = _optionalChain([prev, 'access', _664 => _664.editingCell, 'optionalAccess', _665 => _665.row]) === prev.actualRow ? prev.editingCell.col : -1;
10343
- const nextEditingCol = _optionalChain([next, 'access', _666 => _666.editingCell, 'optionalAccess', _667 => _667.row]) === next.actualRow ? next.editingCell.col : -1;
10452
+ const prevEditingCol = _optionalChain([prev, 'access', _669 => _669.editingCell, 'optionalAccess', _670 => _670.row]) === prev.actualRow ? prev.editingCell.col : -1;
10453
+ const nextEditingCol = _optionalChain([next, 'access', _671 => _671.editingCell, 'optionalAccess', _672 => _672.row]) === next.actualRow ? next.editingCell.col : -1;
10344
10454
  if (prevEditingCol !== nextEditingCol) {
10345
10455
  return false;
10346
10456
  }
@@ -10398,10 +10508,10 @@ function useXlsxViewerSelection() {
10398
10508
  );
10399
10509
  }
10400
10510
  function useXlsxViewerLayout() {
10401
- const { canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
10511
+ const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
10402
10512
  return React15.useMemo(
10403
- () => ({ canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
10404
- [canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
10513
+ () => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
10514
+ [canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
10405
10515
  );
10406
10516
  }
10407
10517
  function useXlsxViewerZoom() {
@@ -10860,8 +10970,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
10860
10970
  const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
10861
10971
  if (!pendingRequest) {
10862
10972
  const request = {
10863
- endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _668 => _668.endRow]), () => ( endRow))),
10864
- startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _669 => _669.startRow]), () => ( startRow)))
10973
+ endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _673 => _673.endRow]), () => ( endRow))),
10974
+ startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _674 => _674.startRow]), () => ( startRow)))
10865
10975
  };
10866
10976
  workerThumbnailRowBatchRequestRef.current.set(sheet, request);
10867
10977
  void getRowsBatchAsync(
@@ -10925,7 +11035,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
10925
11035
  }, []);
10926
11036
  const thumbnails = React15.useMemo(() => {
10927
11037
  return sheets.map((sheet, sheetIndex) => {
10928
- const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _670 => _670.getSheet, 'call', _671 => _671(sheet.workbookSheetIndex)]), () => ( null));
11038
+ const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _675 => _675.getSheet, 'call', _676 => _676(sheet.workbookSheetIndex)]), () => ( null));
10929
11039
  const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
10930
11040
  const sheetShapes = getSheetShapes(sheetIndex);
10931
11041
  const sheetFormControls = getSheetFormControls(sheetIndex).filter((control2) => !control2.hidden);
@@ -10941,18 +11051,18 @@ function useXlsxViewerThumbnails(options2 = {}) {
10941
11051
  minRow: 0
10942
11052
  }));
10943
11053
  return {
10944
- maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _672 => _672.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
10945
- maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _673 => _673.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
10946
- minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _674 => _674.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
10947
- minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _675 => _675.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
11054
+ maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _677 => _677.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
11055
+ maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _678 => _678.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
11056
+ minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _679 => _679.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
11057
+ minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _680 => _680.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
10948
11058
  };
10949
11059
  }, null);
10950
11060
  const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
10951
11061
  const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
10952
- const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _676 => _676.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _677 => _677.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
10953
- const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _678 => _678.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _679 => _679.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
10954
- const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _680 => _680.maxRow]), () => ( -1)));
10955
- const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _681 => _681.maxCol]), () => ( -1)));
11062
+ const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _681 => _681.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _682 => _682.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
11063
+ const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _683 => _683.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _684 => _684.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
11064
+ const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _685 => _685.maxRow]), () => ( -1)));
11065
+ const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _686 => _686.maxCol]), () => ( -1)));
10956
11066
  const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
10957
11067
  const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
10958
11068
  const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
@@ -10969,7 +11079,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
10969
11079
  hiddenColSet
10970
11080
  );
10971
11081
  const resolveColumnWidthPx = (actualCol) => {
10972
- if (worksheet && !worksheet.isColumnHidden(actualCol)) {
11082
+ if (worksheet && !hiddenColSet.has(actualCol)) {
10973
11083
  const width = worksheet.getColumnWidth(actualCol);
10974
11084
  if (width !== void 0 && width !== null) {
10975
11085
  return Math.max(
@@ -10987,7 +11097,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
10987
11097
  );
10988
11098
  };
10989
11099
  const resolveRowHeightPx = (actualRow) => {
10990
- if (worksheet && !worksheet.isRowHidden(actualRow)) {
11100
+ if (worksheet && !hiddenRowSet.has(actualRow)) {
10991
11101
  const height = worksheet.getRowHeight(actualRow);
10992
11102
  if (height !== void 0 && height !== null) {
10993
11103
  return Math.max(
@@ -11165,8 +11275,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
11165
11275
  return cached;
11166
11276
  }
11167
11277
  const batchCoversRow = workerRowBatch ? row2 >= workerRowBatch.startRow && row2 <= workerRowBatch.endRow : false;
11168
- const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _682 => _682.cells, 'access', _683 => _683.get, 'call', _684 => _684(cacheKey)]) : void 0;
11169
- if (_optionalChain([batchedCell, 'optionalAccess', _685 => _685.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _686 => _686.isMergedSecondary, 'call', _687 => _687(row2, col)])) {
11278
+ const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _687 => _687.cells, 'access', _688 => _688.get, 'call', _689 => _689(cacheKey)]) : void 0;
11279
+ if (_optionalChain([batchedCell, 'optionalAccess', _690 => _690.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _691 => _691.isMergedSecondary, 'call', _692 => _692(row2, col)])) {
11170
11280
  const mergedSecondaryData = {
11171
11281
  isMergedSecondary: true,
11172
11282
  style: {},
@@ -11175,23 +11285,23 @@ function useXlsxViewerThumbnails(options2 = {}) {
11175
11285
  cellRenderCache.set(cacheKey, mergedSecondaryData);
11176
11286
  return mergedSecondaryData;
11177
11287
  }
11178
- const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _688 => _688.mergeSpan]);
11288
+ const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _693 => _693.mergeSpan]);
11179
11289
  const inheritedStyle = resolveInheritedCellStyle2(sheet, row2, col);
11180
- const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _689 => _689.style]), () => ( null));
11290
+ const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _694 => _694.style]), () => ( null));
11181
11291
  const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
11182
11292
  const conditionalCellStyle = resolveConditionalCellStyleForCell(
11183
11293
  row2,
11184
11294
  col,
11185
11295
  sheet,
11186
11296
  () => worksheet ? getCellNumericValue(worksheet, row2, col) : getBatchedCellNumericValue(batchedCell),
11187
- () => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _690 => _690.value]), () => ( "")),
11297
+ () => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _695 => _695.value]), () => ( "")),
11188
11298
  worksheet,
11189
- _optionalChain([workerRowBatch, 'optionalAccess', _691 => _691.cells])
11299
+ _optionalChain([workerRowBatch, 'optionalAccess', _696 => _696.cells])
11190
11300
  );
11191
11301
  const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
11192
- const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _692 => _692.alignment]);
11302
+ const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _697 => _697.alignment]);
11193
11303
  const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
11194
- const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _693 => _693.cells, 'access', _694 => _694.get, 'call', _695 => _695(`${targetRow}:${targetCol}`)]));
11304
+ const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _698 => _698.cells, 'access', _699 => _699.get, 'call', _700 => _700(`${targetRow}:${targetCol}`)]));
11195
11305
  const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
11196
11306
  { length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
11197
11307
  (_, index) => getNumericValue(
@@ -11205,26 +11315,26 @@ function useXlsxViewerThumbnails(options2 = {}) {
11205
11315
  sparkline.range.start.col
11206
11316
  )
11207
11317
  ) : null;
11208
- const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _696 => _696.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row2, col) : getBatchedCellBooleanValue(batchedCell) : null;
11318
+ const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _701 => _701.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row2, col) : getBatchedCellBooleanValue(batchedCell) : null;
11209
11319
  const nextData = {
11210
11320
  canvas: void 0,
11211
11321
  checkboxState,
11212
- colSpan: _optionalChain([merge, 'optionalAccess', _697 => _697.colSpan]),
11322
+ colSpan: _optionalChain([merge, 'optionalAccess', _702 => _702.colSpan]),
11213
11323
  conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11214
11324
  conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11215
11325
  conditionalIcon: worksheet ? resolveConditionalIconForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11216
11326
  isMergedSecondary: false,
11217
- rowSpan: _optionalChain([merge, 'optionalAccess', _698 => _698.rowSpan]),
11327
+ rowSpan: _optionalChain([merge, 'optionalAccess', _703 => _703.rowSpan]),
11218
11328
  sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
11219
11329
  style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
11220
- generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _699 => _699.generalAlignment]),
11330
+ generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _704 => _704.generalAlignment]),
11221
11331
  showGridLines
11222
11332
  }),
11223
- textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _700 => _700.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _701 => _701.textRotation])))),
11224
- value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _702 => _702.value]), () => ( ""))
11333
+ textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _705 => _705.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _706 => _706.textRotation])))),
11334
+ value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _707 => _707.value]), () => ( ""))
11225
11335
  };
11226
11336
  nextData.richText = resolveRichCellRuns(
11227
- worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _703 => _703.richText]),
11337
+ worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _708 => _708.richText]),
11228
11338
  nextData.value,
11229
11339
  nextData.style,
11230
11340
  sheet.themePalette,
@@ -11246,11 +11356,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
11246
11356
  let height = rowItem.size;
11247
11357
  for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
11248
11358
  const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
11249
- width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _704 => _704.size]), () => ( 0));
11359
+ width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _709 => _709.size]), () => ( 0));
11250
11360
  }
11251
11361
  for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
11252
11362
  const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
11253
- height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _705 => _705.size]), () => ( 0));
11363
+ height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _710 => _710.size]), () => ( 0));
11254
11364
  }
11255
11365
  const rect = {
11256
11366
  height,
@@ -11260,7 +11370,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
11260
11370
  };
11261
11371
  const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
11262
11372
  const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
11263
- const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _706 => _706.conditionalColorScale, 'optionalAccess', _707 => _707.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
11373
+ const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _711 => _711.conditionalColorScale, 'optionalAccess', _712 => _712.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
11264
11374
  context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
11265
11375
  context.fillRect(rect.left, rect.top, rect.width, rect.height);
11266
11376
  if (cellData.conditionalDataBar) {
@@ -11507,7 +11617,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
11507
11617
  workbook
11508
11618
  ]);
11509
11619
  const paintThumbnail = React15.useCallback(
11510
- (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _708 => _708[sheetIndex], 'optionalAccess', _709 => _709.paint, 'call', _710 => _710(canvas)]), () => ( false)),
11620
+ (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _713 => _713[sheetIndex], 'optionalAccess', _714 => _714.paint, 'call', _715 => _715(canvas)]), () => ( false)),
11511
11621
  [thumbnails]
11512
11622
  );
11513
11623
  return React15.useMemo(
@@ -11566,7 +11676,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
11566
11676
  }
11567
11677
  destroy() {
11568
11678
  this.destroyed = true;
11569
- _optionalChain([this, 'access', _711 => _711.observer, 'optionalAccess', _712 => _712.disconnect, 'call', _713 => _713()]);
11679
+ _optionalChain([this, 'access', _716 => _716.observer, 'optionalAccess', _717 => _717.disconnect, 'call', _718 => _718()]);
11570
11680
  this.observer = null;
11571
11681
  this.slots.clear();
11572
11682
  this.listeners.clear();
@@ -11608,7 +11718,7 @@ function RuntimeContent({ content }) {
11608
11718
  };
11609
11719
  }, []);
11610
11720
  React16.useLayoutEffect(() => {
11611
- _optionalChain([rootRef, 'access', _714 => _714.current, 'optionalAccess', _715 => _715.update, 'call', _716 => _716(content)]);
11721
+ _optionalChain([rootRef, 'access', _719 => _719.current, 'optionalAccess', _720 => _720.update, 'call', _721 => _721(content)]);
11612
11722
  }, [content]);
11613
11723
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
11614
11724
  }
@@ -11690,7 +11800,7 @@ function BoundViewer({ props, controller: sourceController }) {
11690
11800
  }, [slots]);
11691
11801
  React16.useLayoutEffect(() => {
11692
11802
  const host = hostRef.current;
11693
- if (host) _optionalChain([viewerRef, 'access', _717 => _717.current, 'optionalAccess', _718 => _718.update, 'call', _719 => _719(renderOptions(props, controller, slots, host.ownerDocument))]);
11803
+ if (host) _optionalChain([viewerRef, 'access', _722 => _722.current, 'optionalAccess', _723 => _723.update, 'call', _724 => _724(renderOptions(props, controller, slots, host.ownerDocument))]);
11694
11804
  }, [controller, props, slots]);
11695
11805
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
11696
11806
  headerBackgroundColor: props.headerBackgroundColor,