@extend-ai/react-xlsx 0.23.2 → 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 (80) hide show
  1. package/README.md +22 -2
  2. package/dist/{chunk-UICWNF5V.js → chunk-2TLD35UF.js} +3 -27
  3. package/dist/chunk-2TLD35UF.js.map +1 -0
  4. package/dist/{chunk-A3WA6ZLI.cjs → chunk-GP5SOQQH.cjs} +3 -29
  5. package/dist/chunk-GP5SOQQH.cjs.map +1 -0
  6. package/dist/{chunk-MEZOJBL5.js → chunk-HAV76TR2.js} +57 -1
  7. package/dist/{chunk-MEZOJBL5.js.map → chunk-HAV76TR2.js.map} +1 -1
  8. package/dist/{chunk-JJJZYWAL.js → chunk-MNIFKMIL.js} +57 -1
  9. package/dist/chunk-MNIFKMIL.js.map +1 -0
  10. package/dist/{chunk-3JFYU42O.js → chunk-Q6YY3AB4.js} +2 -28
  11. package/dist/chunk-Q6YY3AB4.js.map +1 -0
  12. package/dist/{chunk-FGJY2TIS.cjs → chunk-WW6G674Q.cjs} +2672 -2340
  13. package/dist/chunk-WW6G674Q.cjs.map +1 -0
  14. package/dist/{chunk-M7QVMFYT.js → chunk-XUHSQ3GF.js} +819 -487
  15. package/dist/chunk-XUHSQ3GF.js.map +1 -0
  16. package/dist/{chunk-JCSAS3M2.cjs → chunk-XZJLPW64.cjs} +2 -26
  17. package/dist/chunk-XZJLPW64.cjs.map +1 -0
  18. package/dist/{chunk-TMYAG7GY.cjs → chunk-YOLIVKZD.cjs} +57 -1
  19. package/dist/chunk-YOLIVKZD.cjs.map +1 -0
  20. package/dist/{chunk-R3FQM7V3.cjs → chunk-Z4WMURVU.cjs} +57 -1
  21. package/dist/chunk-Z4WMURVU.cjs.map +1 -0
  22. package/dist/duke-sheets-provenance.json +5 -5
  23. package/dist/{duke_sheets_wasm-TLSZAVKP.cjs → duke_sheets_wasm-GM4K5QQX.cjs} +57 -1
  24. package/dist/duke_sheets_wasm-GM4K5QQX.cjs.map +1 -0
  25. package/dist/{duke_sheets_wasm-V4J6QYIZ.js → duke_sheets_wasm-MYY4ZNUI.js} +57 -1
  26. package/dist/duke_sheets_wasm-MYY4ZNUI.js.map +1 -0
  27. package/dist/{duke_sheets_wasm-R7KXJNYL.js → duke_sheets_wasm-UXZ2KTVD.js} +57 -1
  28. package/dist/duke_sheets_wasm-UXZ2KTVD.js.map +1 -0
  29. package/dist/duke_sheets_wasm_bg.wasm +0 -0
  30. package/dist/index.cjs +805 -606
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +53 -7
  33. package/dist/index.d.ts +53 -7
  34. package/dist/index.js +784 -585
  35. package/dist/index.js.map +1 -1
  36. package/dist/{internal-BVZRgYaH.d.ts → internal-D5HReXVR.d.cts} +114 -64
  37. package/dist/{internal-BVZRgYaH.d.cts → internal-D5HReXVR.d.ts} +114 -64
  38. package/dist/internal.cjs +4 -4
  39. package/dist/internal.d.cts +1 -1
  40. package/dist/internal.d.ts +1 -1
  41. package/dist/internal.js +3 -3
  42. package/dist/{shared-chart-V24MOVXX.js → shared-chart-24MCGSFJ.js} +2 -2
  43. package/dist/{shared-chart-N44DT2QV.cjs → shared-chart-7E6KMGTG.cjs} +3 -3
  44. package/dist/{shared-chart-N44DT2QV.cjs.map → shared-chart-7E6KMGTG.cjs.map} +1 -1
  45. package/dist/{shared-chart-64L5EL3Z.js → shared-chart-CGEK7EAB.js} +2 -2
  46. package/dist/{shared-chart-BZTEPO7C.cjs → shared-chart-GKNMM72Q.cjs} +15 -15
  47. package/dist/{shared-chart-BZTEPO7C.cjs.map → shared-chart-GKNMM72Q.cjs.map} +1 -1
  48. package/dist/vanilla.cjs +4 -4
  49. package/dist/vanilla.d.cts +2 -2
  50. package/dist/vanilla.d.ts +2 -2
  51. package/dist/vanilla.js +3 -3
  52. package/dist/{workbook-runtime-OJDBGHMM.cjs → workbook-runtime-7WEPIK5Y.cjs} +85 -77
  53. package/dist/workbook-runtime-7WEPIK5Y.cjs.map +1 -0
  54. package/dist/{workbook-runtime-O3QY5UED.js → workbook-runtime-BAAYDYYK.js} +24 -16
  55. package/dist/workbook-runtime-BAAYDYYK.js.map +1 -0
  56. package/dist/{workbook-runtime-FXUSOOFT.js → workbook-runtime-FCKPXLTW.js} +24 -16
  57. package/dist/workbook-runtime-FCKPXLTW.js.map +1 -0
  58. package/dist/{workbook-runtime-2HYFRGZD.cjs → workbook-runtime-MOGSEJ5R.cjs} +83 -75
  59. package/dist/workbook-runtime-MOGSEJ5R.cjs.map +1 -0
  60. package/dist/xlsx-worker.js +23 -15
  61. package/dist/xlsx-worker.js.map +1 -1
  62. package/package.json +2 -2
  63. package/dist/chunk-3JFYU42O.js.map +0 -1
  64. package/dist/chunk-A3WA6ZLI.cjs.map +0 -1
  65. package/dist/chunk-FGJY2TIS.cjs.map +0 -1
  66. package/dist/chunk-JCSAS3M2.cjs.map +0 -1
  67. package/dist/chunk-JJJZYWAL.js.map +0 -1
  68. package/dist/chunk-M7QVMFYT.js.map +0 -1
  69. package/dist/chunk-R3FQM7V3.cjs.map +0 -1
  70. package/dist/chunk-TMYAG7GY.cjs.map +0 -1
  71. package/dist/chunk-UICWNF5V.js.map +0 -1
  72. package/dist/duke_sheets_wasm-R7KXJNYL.js.map +0 -1
  73. package/dist/duke_sheets_wasm-TLSZAVKP.cjs.map +0 -1
  74. package/dist/duke_sheets_wasm-V4J6QYIZ.js.map +0 -1
  75. package/dist/workbook-runtime-2HYFRGZD.cjs.map +0 -1
  76. package/dist/workbook-runtime-FXUSOOFT.js.map +0 -1
  77. package/dist/workbook-runtime-O3QY5UED.js.map +0 -1
  78. package/dist/workbook-runtime-OJDBGHMM.cjs.map +0 -1
  79. /package/dist/{shared-chart-V24MOVXX.js.map → shared-chart-24MCGSFJ.js.map} +0 -0
  80. /package/dist/{shared-chart-64L5EL3Z.js.map → shared-chart-CGEK7EAB.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -36,13 +36,13 @@
36
36
 
37
37
 
38
38
 
39
- var _chunkJCSAS3M2cjs = require('./chunk-JCSAS3M2.cjs');
39
+ var _chunkXZJLPW64cjs = require('./chunk-XZJLPW64.cjs');
40
40
 
41
41
 
42
42
 
43
43
 
44
44
 
45
- var _chunkTMYAG7GYcjs = require('./chunk-TMYAG7GY.cjs');
45
+ var _chunkYOLIVKZDcjs = require('./chunk-YOLIVKZD.cjs');
46
46
  require('./chunk-JRWNIQWR.cjs');
47
47
 
48
48
 
@@ -55,6 +55,121 @@ var _chunkJI2BMZ67cjs = require('./chunk-JI2BMZ67.cjs');
55
55
 
56
56
  var _chunkAD4CGQN2cjs = require('./chunk-AD4CGQN2.cjs');
57
57
 
58
+ // src/selection-ranges.ts
59
+ function resolveFreezePanesCell(activeCell, selection) {
60
+ if (activeCell && selection && (activeCell.row < selection.start.row || activeCell.col < selection.start.col)) {
61
+ return selection.start;
62
+ }
63
+ return activeCell;
64
+ }
65
+ function subtractRange(area, cut) {
66
+ const top = Math.max(area.start.row, cut.start.row);
67
+ const bottom = Math.min(area.end.row, cut.end.row);
68
+ const left = Math.max(area.start.col, cut.start.col);
69
+ const right = Math.min(area.end.col, cut.end.col);
70
+ if (top > bottom || left > right) return [area];
71
+ const remaining = [];
72
+ if (area.start.row < top) remaining.push({ start: area.start, end: { row: top - 1, col: area.end.col } });
73
+ if (bottom < area.end.row) remaining.push({ start: { row: bottom + 1, col: area.start.col }, end: area.end });
74
+ if (area.start.col < left) remaining.push({ start: { row: top, col: area.start.col }, end: { row: bottom, col: left - 1 } });
75
+ if (right < area.end.col) remaining.push({ start: { row: top, col: right + 1 }, end: { row: bottom, col: area.end.col } });
76
+ return remaining;
77
+ }
78
+ function addSelectionRange(areas, range) {
79
+ return [...areas.flatMap((area) => subtractRange(area, range)), range];
80
+ }
81
+ function clipboardBands(areas) {
82
+ const first = areas[0];
83
+ if (!first) return null;
84
+ const sameExtent = (axis) => areas.every((area) => area.start[axis] === first.start[axis] && area.end[axis] === first.end[axis]);
85
+ const bands = (axis, ranges) => ranges.map((range) => ({ start: range.start[axis], end: range.end[axis] })).sort((a, b) => a.start - b.start);
86
+ if (sameExtent("col")) return { rows: bands("row", areas), cols: bands("col", [first]) };
87
+ if (sameExtent("row")) return { rows: bands("row", [first]), cols: bands("col", areas) };
88
+ return null;
89
+ }
90
+ function* bandIndices(bands) {
91
+ let offset = 0;
92
+ for (const band of bands) {
93
+ for (let index = band.start; index <= band.end; index++) {
94
+ yield { index, offset: offset++, remaining: band.end - index + 1 };
95
+ }
96
+ }
97
+ }
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
+
58
173
  // src/merged-range-lookup.ts
59
174
  function createMergedRangeLookup(ranges) {
60
175
  const normalizedRanges = [];
@@ -679,7 +794,7 @@ function getFormulaReferences(value, sheetName) {
679
794
  const end = index + match[0].length;
680
795
  const previous = value[index - 1];
681
796
  const next = value[end];
682
- const parsed = _chunkJCSAS3M2cjs.parseXlsxRange.call(void 0, match[0].replace(/\s*:\s*/g, ":"));
797
+ const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, match[0].replace(/\s*:\s*/g, ":"));
683
798
  if (parsed && !NAME_CHARACTER.test(previous) && previous !== "]" && previous !== "!" && previous !== ":" && (!next || !NAME_CHARACTER.test(next) && !/[!\[]/.test(next)) && !/^\s*\(/.test(value.slice(end))) {
684
799
  const { range } = parsed;
685
800
  const key = `${(_nullishCoalesce(parsed.sheetName, () => ( sheetName))).toLowerCase()}:${range.start.row},${range.start.col}:${range.end.row},${range.end.col}`;
@@ -716,7 +831,7 @@ function coerceUserEnteredValue(value, locale = "en-US", source = "edit") {
716
831
  const trimmed = value.trim();
717
832
  if (!trimmed) return value;
718
833
  if (/^(true|false)$/i.test(trimmed)) return trimmed.toLowerCase() === "true";
719
- const localized = _chunkJCSAS3M2cjs.parseLocaleNumber.call(void 0, trimmed, locale);
834
+ const localized = _chunkXZJLPW64cjs.parseLocaleNumber.call(void 0, trimmed, locale);
720
835
  if (localized !== void 0) return localized;
721
836
  if (/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(trimmed)) {
722
837
  const number = Number(trimmed);
@@ -774,7 +889,7 @@ function quoteClipboardField(value) {
774
889
  }
775
890
 
776
891
  // src/controller.tsx
777
- var _react = require('react'); var React = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react);
892
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React16 = _interopRequireWildcard(_react); var React15 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React8 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React9 = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React11 = _interopRequireWildcard(_react); var React12 = _interopRequireWildcard(_react); var React14 = _interopRequireWildcard(_react); var React13 = _interopRequireWildcard(_react);
778
893
  var _internal = require('@extend-ai/react-xlsx/internal');
779
894
 
780
895
 
@@ -878,7 +993,7 @@ var XlsxWorkerClient = (_class = class {
878
993
  type: "load"
879
994
  }, [workerBuffer]);
880
995
  }, () => this.loadOnMainThread());
881
- _chunkJCSAS3M2cjs.restoreWorkerImageBlobs.call(void 0, result.imageAssets, result.imageBlobs);
996
+ _chunkXZJLPW64cjs.restoreWorkerImageBlobs.call(void 0, result.imageAssets, result.imageBlobs);
882
997
  delete result.imageBlobs;
883
998
  for (const [key, value] of result.columnFontMeasurements) columnFontMeasurements.set(key, value);
884
999
  while (columnFontMeasurements.size > 256) columnFontMeasurements.delete(columnFontMeasurements.keys().next().value);
@@ -924,7 +1039,7 @@ var XlsxWorkerClient = (_class = class {
924
1039
  }
925
1040
  async getMainRuntime() {
926
1041
  if (this.disposed) throw createAbortError();
927
- this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-2HYFRGZD.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
1042
+ this.mainRuntime ??= Promise.resolve().then(() => _interopRequireWildcard(require("./workbook-runtime-MOGSEJ5R.cjs"))).then(({ createWorkbookRuntime }) => createWorkbookRuntime());
928
1043
  const runtime = await this.mainRuntime;
929
1044
  if (this.disposed) {
930
1045
  runtime.dispose();
@@ -1102,17 +1217,17 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
1102
1217
  for (let index = 0; index < workbook.sheetCount; index += 1) {
1103
1218
  const worksheet = workbook.getSheet(index);
1104
1219
  const sheetState = _nullishCoalesce(_optionalChain([sheetStatesByWorkbookSheetIndex, 'optionalAccess', _115 => _115[index]]), () => ( null));
1105
- const mergeMetadata = _chunkJCSAS3M2cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet);
1220
+ const mergeMetadata = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet);
1106
1221
  const effectiveSheetState = {
1107
1222
  ...sheetState,
1108
1223
  ...mergeMetadata
1109
1224
  };
1110
- const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _116 => _116.defaultColWidthPx]), () => ( _chunkJCSAS3M2cjs.resolveWorksheetDefaultColumnWidthPixels.call(void 0,
1225
+ const defaultColWidthPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _116 => _116.defaultColWidthPx]), () => ( _chunkXZJLPW64cjs.resolveWorksheetDefaultColumnWidthPixels.call(void 0,
1111
1226
  worksheet,
1112
1227
  _optionalChain([sheetState, 'optionalAccess', _117 => _117.columnWidthCharacterWidthPx]),
1113
1228
  DEFAULT_COL_WIDTH
1114
1229
  )));
1115
- const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _118 => _118.defaultRowHeightPx]), () => ( _chunkJCSAS3M2cjs.resolveWorksheetDefaultRowHeightPixels.call(void 0,
1230
+ const defaultRowHeightPx = _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _118 => _118.defaultRowHeightPx]), () => ( _chunkXZJLPW64cjs.resolveWorksheetDefaultRowHeightPixels.call(void 0,
1116
1231
  worksheet,
1117
1232
  DEFAULT_ROW_HEIGHT
1118
1233
  )));
@@ -1123,7 +1238,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
1123
1238
  const resolveColumnWidthPx = (col) => {
1124
1239
  const width = worksheet.getColumnWidth(col);
1125
1240
  if (width !== void 0 && width !== null) {
1126
- return _chunkJCSAS3M2cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _119 => _119.columnWidthCharacterWidthPx]));
1241
+ return _chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _119 => _119.columnWidthCharacterWidthPx]));
1127
1242
  }
1128
1243
  return _nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _120 => _120.colWidthOverridesPx, 'optionalAccess', _121 => _121[col]]), () => ( defaultColWidthPx));
1129
1244
  };
@@ -1153,8 +1268,8 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
1153
1268
  maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
1154
1269
  maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
1155
1270
  mergedRanges: mergeMetadata.mergedRanges,
1156
- hiddenCols: [],
1157
- hiddenRows: [],
1271
+ hiddenCols: Array.from(worksheet.hiddenColumns),
1272
+ hiddenRows: Array.from(worksheet.hiddenRows),
1158
1273
  minUsedCol: -1,
1159
1274
  minUsedRow: -1,
1160
1275
  maxUsedCol: -1,
@@ -1243,8 +1358,8 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
1243
1358
  maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
1244
1359
  maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
1245
1360
  mergedRanges: mergeMetadata.mergedRanges,
1246
- hiddenCols: _chunkJCSAS3M2cjs.resolveWorksheetHiddenCols.call(void 0, worksheet, maxCol),
1247
- hiddenRows: _chunkJCSAS3M2cjs.resolveWorksheetHiddenRows.call(void 0, worksheet, maxRow),
1361
+ hiddenCols: Array.from(worksheet.hiddenColumns),
1362
+ hiddenRows: Array.from(worksheet.hiddenRows),
1248
1363
  minUsedCol: minCol,
1249
1364
  minUsedRow: minRow,
1250
1365
  maxUsedCol: maxCol,
@@ -1498,7 +1613,7 @@ function formControlInputFromDukeControl(control2) {
1498
1613
  function xlsxFormControlInputToDukeDrawing(input) {
1499
1614
  return {
1500
1615
  altText: input.altText,
1501
- anchor: _chunkJCSAS3M2cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, input.anchor, input.editAs),
1616
+ anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, input.anchor, input.editAs),
1502
1617
  formControl: {
1503
1618
  kind: xlsxFormControlKindToDukeKind(input.kind),
1504
1619
  macroName: input.macroName,
@@ -1538,9 +1653,9 @@ function formControlLinkTouchesPivot(workbook, pivots, sourceSheetIndex, kind) {
1538
1653
  if (sheetIndex < 0) return false;
1539
1654
  address2 = address2.slice(separator + 1);
1540
1655
  }
1541
- const parsed = _chunkJCSAS3M2cjs.parseXlsxRange.call(void 0, address2);
1656
+ const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, address2);
1542
1657
  if (_optionalChain([parsed, 'optionalAccess', _161 => _161.kind]) === "cells" && !parsed.sheetName && parsed.range.start.row === parsed.range.end.row && parsed.range.start.col === parsed.range.end.col) {
1543
- return Boolean(_chunkJCSAS3M2cjs.findIntersectingPivot.call(void 0, pivots, sheetNames[sheetIndex], parsed.range));
1658
+ return Boolean(_chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivots, sheetNames[sheetIndex], parsed.range));
1544
1659
  }
1545
1660
  const matching = names.filter((name) => name.name.toLowerCase() === address2.toLowerCase());
1546
1661
  const named = _nullishCoalesce(matching.find((name) => name.sheetIndex === sheetIndex), () => ( matching.find((name) => name.sheetIndex == null)));
@@ -1900,6 +2015,8 @@ function downloadUrl(src, fileName) {
1900
2015
  }
1901
2016
  function useXlsxViewerController(options2) {
1902
2017
  const {
2018
+ allowFreezeInReadOnly = false,
2019
+ allowHideInReadOnly = false,
1903
2020
  allowResizeInReadOnly = false,
1904
2021
  deferLoadingAboveBytes = DEFAULT_DEFER_LOADING_ABOVE_BYTES,
1905
2022
  file,
@@ -1914,11 +2031,12 @@ function useXlsxViewerController(options2) {
1914
2031
  src,
1915
2032
  useWorker = true
1916
2033
  } = options2;
1917
- const messages = React.useMemo(() => _chunkTMYAG7GYcjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
2034
+ const messages = React.useMemo(() => _chunkYOLIVKZDcjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
1918
2035
  const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
1919
2036
  const [error, setError] = React.useState(null);
1920
2037
  const [workbook, setWorkbook] = React.useState(null);
1921
- const [sheets, setSheets] = React.useState([]);
2038
+ const [readOnlyLayouts, setReadOnlyLayouts] = React.useState({});
2039
+ const [workbookSheets, setSheets] = React.useState([]);
1922
2040
  const [chartsByWorkbookSheetIndex, setChartsByWorkbookSheetIndex] = React.useState([]);
1923
2041
  const [chartsheets, setChartsheets] = React.useState([]);
1924
2042
  const [tabs, setTabs] = React.useState([]);
@@ -1938,7 +2056,11 @@ function useXlsxViewerController(options2) {
1938
2056
  const [activeTabIndex, setActiveTabIndexState] = React.useState(0);
1939
2057
  const [zoomScaleOverridesByTabId, setZoomScaleOverridesByTabId] = React.useState({});
1940
2058
  const [activeCell, setActiveCell] = React.useState(null);
1941
- const [selection, setSelection] = React.useState(null);
2059
+ const [selectionRanges, setSelectionRanges] = React.useState([]);
2060
+ const selection = _nullishCoalesce(selectionRanges.at(-1), () => ( null));
2061
+ const setSelection = React.useCallback((range) => {
2062
+ setSelectionRanges(range ? [range] : []);
2063
+ }, []);
1942
2064
  const [highlightedRanges, setHighlightedRanges] = React.useState([]);
1943
2065
  const [selectedChartId, setSelectedChartId] = React.useState(null);
1944
2066
  const [selectedChartElement, setSelectedChartElement] = React.useState(null);
@@ -1969,6 +2091,7 @@ function useXlsxViewerController(options2) {
1969
2091
  const displayFileName = React.useMemo(() => resolveDisplayFileName(src, fileName), [fileName, src]);
1970
2092
  const shouldDeferLoading = deferLoadingAboveBytes > 0;
1971
2093
  const readOnly = requestedReadOnly || forcedReadOnly;
2094
+ const sheets = React.useMemo(() => readOnly ? workbookSheets.map((sheet) => applyReadOnlyLayout(sheet, readOnlyLayouts[sheet.workbookSheetIndex])) : workbookSheets, [readOnly, readOnlyLayouts, workbookSheets]);
1972
2095
  const drawingMutationEpoch = React.useRef(0);
1973
2096
  const drawingMutationState = React.useRef({ workbook, revision, readOnly, activeCell, activeSheetIndex });
1974
2097
  drawingMutationState.current = { workbook, revision, readOnly, activeCell, activeSheetIndex };
@@ -1989,7 +2112,7 @@ function useXlsxViewerController(options2) {
1989
2112
  releaseXmlRecordsRef.current = null;
1990
2113
  for (const url of retainedObjectUrlsRef.current) URL.revokeObjectURL(url);
1991
2114
  retainedObjectUrlsRef.current.clear();
1992
- _chunkJCSAS3M2cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
2115
+ _chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
1993
2116
  imageAssetsRef.current = null;
1994
2117
  sheetOriginsRef.current = [];
1995
2118
  setFormControlsByWorkbookSheetIndex([]);
@@ -2049,7 +2172,7 @@ function useXlsxViewerController(options2) {
2049
2172
  if (!targetWorkbook || !imageAssetsRef.current) {
2050
2173
  return chartAssetsRef.current;
2051
2174
  }
2052
- const assets = _chunkJCSAS3M2cjs.loadWorkbookChartAssets.call(void 0,
2175
+ const assets = _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0,
2053
2176
  targetWorkbook,
2054
2177
  imageAssetsRef.current,
2055
2178
  buildVisibleSheetIndexMap(targetSheets),
@@ -2059,12 +2182,12 @@ function useXlsxViewerController(options2) {
2059
2182
  return assets;
2060
2183
  }, [showHiddenSheets]);
2061
2184
  const loadPreparedWorkbook = React.useCallback(async (buffer, isCurrent = () => true) => {
2062
- const defaultFonts = _chunkJCSAS3M2cjs.loadSpreadsheetFonts.call(void 0, ["Calibri", "Arial"]);
2185
+ const defaultFonts = _chunkXZJLPW64cjs.loadSpreadsheetFonts.call(void 0, ["Calibri", "Arial"]);
2063
2186
  const forced = shouldForceReadOnlyForBuffer(buffer.byteLength);
2064
2187
  const editable = !requestedReadOnly && !forced;
2065
2188
  const snapshot = await getWorkerClient().loadWorkbook(buffer, skipXmlParsing, showHiddenSheets, editable || !useWorker);
2066
2189
  if (!isCurrent()) return;
2067
- await Promise.all([defaultFonts, _chunkJCSAS3M2cjs.loadSpreadsheetFonts.call(void 0, snapshot.fontFamilies)]);
2190
+ await Promise.all([defaultFonts, _chunkXZJLPW64cjs.loadSpreadsheetFonts.call(void 0, snapshot.fontFamilies)]);
2068
2191
  if (!isCurrent()) return;
2069
2192
  const nextWorkbook = snapshot.workbookSnapshot ? (await _internal.getSheetsWasmModule.call(void 0, )).Workbook.fromSnapshot(snapshot.workbookSnapshot) : null;
2070
2193
  if (!isCurrent()) {
@@ -2087,9 +2210,9 @@ function useXlsxViewerController(options2) {
2087
2210
  setIsLoading(false);
2088
2211
  }, [getWorkerClient, requestedReadOnly, setChartAssets, setImageAssets, shouldForceReadOnlyForBuffer, showHiddenSheets, skipXmlParsing, useWorker]);
2089
2212
  const refreshWorkbookState = React.useCallback((targetWorkbook) => {
2090
- setPivotTables(_chunkJCSAS3M2cjs.readPivotTables.call(void 0, targetWorkbook));
2213
+ setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, targetWorkbook));
2091
2214
  const currentFormControls = _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _201 => _201.current, 'optionalAccess', _202 => _202.formControlsByWorkbookSheetIndex]), () => ( []));
2092
- const nextFormControls = _chunkJCSAS3M2cjs.refreshWorkbookFormControls.call(void 0,
2215
+ const nextFormControls = _chunkXZJLPW64cjs.refreshWorkbookFormControls.call(void 0,
2093
2216
  targetWorkbook,
2094
2217
  currentFormControls,
2095
2218
  _optionalChain([imageAssetsRef, 'access', _203 => _203.current, 'optionalAccess', _204 => _204.themePalette])
@@ -2109,7 +2232,7 @@ function useXlsxViewerController(options2) {
2109
2232
  );
2110
2233
  setSheets(nextSheets);
2111
2234
  setChartAssets(
2112
- _chunkJCSAS3M2cjs.loadWorkbookChartAssets.call(void 0,
2235
+ _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0,
2113
2236
  targetWorkbook,
2114
2237
  imageAssetsRef.current,
2115
2238
  buildVisibleSheetIndexMap(nextSheets),
@@ -2125,11 +2248,12 @@ function useXlsxViewerController(options2) {
2125
2248
  chartDisplayFallbackCleanupRef.current = null;
2126
2249
  for (const url of retainedObjectUrlsRef.current) URL.revokeObjectURL(url);
2127
2250
  retainedObjectUrlsRef.current.clear();
2128
- _chunkJCSAS3M2cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
2251
+ _chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, imageAssetsRef.current);
2129
2252
  disposeWorkerClient();
2130
2253
  }, [disposeWorkerClient]);
2131
2254
  React.useEffect(() => {
2132
2255
  loadGenerationRef.current += 1;
2256
+ setReadOnlyLayouts({});
2133
2257
  if (!file && !src) {
2134
2258
  disposeWorkerClient();
2135
2259
  setForcedReadOnly(false);
@@ -2306,7 +2430,7 @@ function useXlsxViewerController(options2) {
2306
2430
  const nextHighlights = [];
2307
2431
  let firstSheetIndex = activeSheetIndex;
2308
2432
  for (const reference of inputs) {
2309
- const parsed = _chunkJCSAS3M2cjs.parseXlsxRange.call(void 0, reference);
2433
+ const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, reference);
2310
2434
  if (!parsed) {
2311
2435
  return false;
2312
2436
  }
@@ -2400,7 +2524,7 @@ function useXlsxViewerController(options2) {
2400
2524
  if (!shouldAutoCalculate) {
2401
2525
  return;
2402
2526
  }
2403
- const result = _chunkJCSAS3M2cjs.tryRecalculate.call(void 0, targetWorkbook);
2527
+ const result = _chunkXZJLPW64cjs.tryRecalculate.call(void 0, targetWorkbook);
2404
2528
  if (!result.calculated) {
2405
2529
  setShouldAutoCalculate(false);
2406
2530
  }
@@ -2633,12 +2757,12 @@ function useXlsxViewerController(options2) {
2633
2757
  const width = worksheet.getColumnWidth(col);
2634
2758
  const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _248 => _248.showGridLines]), () => ( true));
2635
2759
  if (width !== void 0 && width !== null) {
2636
- return _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0,
2637
- _chunkJCSAS3M2cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _249 => _249.columnWidthCharacterWidthPx])),
2760
+ return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
2761
+ _chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, _optionalChain([sheetState, 'optionalAccess', _249 => _249.columnWidthCharacterWidthPx])),
2638
2762
  showGridLines
2639
2763
  );
2640
2764
  }
2641
- return _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0,
2765
+ return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
2642
2766
  _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _250 => _250.colWidthOverridesPx, 'optionalAccess', _251 => _251[col]]), () => ( _optionalChain([sheetState, 'optionalAccess', _252 => _252.defaultColWidthPx]))), () => ( DEFAULT_COL_WIDTH)),
2643
2767
  showGridLines
2644
2768
  );
@@ -2648,9 +2772,9 @@ function useXlsxViewerController(options2) {
2648
2772
  const height = worksheet.getRowHeight(row2);
2649
2773
  const showGridLines = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _259 => _259.showGridLines]), () => ( true));
2650
2774
  if (height !== void 0 && height !== null) {
2651
- return _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkJCSAS3M2cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines);
2775
+ return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines);
2652
2776
  }
2653
- return _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0,
2777
+ return _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
2654
2778
  _nullishCoalesce(_nullishCoalesce(_optionalChain([sheetState, 'optionalAccess', _260 => _260.rowHeightOverridesPx, 'optionalAccess', _261 => _261[row2]]), () => ( _optionalChain([sheetState, 'optionalAccess', _262 => _262.defaultRowHeightPx]))), () => ( DEFAULT_ROW_HEIGHT)),
2655
2779
  showGridLines
2656
2780
  );
@@ -2670,7 +2794,7 @@ function useXlsxViewerController(options2) {
2670
2794
  const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _265 => _265.cachedFormulaValues, 'optionalAccess', _266 => _266[cellAddressToA1(cell)]]) : void 0;
2671
2795
  const formatted = worksheet.getFormattedValueAt(cell.row, cell.col);
2672
2796
  if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
2673
- return _chunkJCSAS3M2cjs.localizeCellNumber.call(void 0, worksheet, cell.row, cell.col, decodeHtmlEntities(formatted), locale);
2797
+ return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, cell.row, cell.col, decodeHtmlEntities(formatted), locale);
2674
2798
  }
2675
2799
  const calculated = worksheet.getCalculatedValueAt(cell.row, cell.col);
2676
2800
  if (formula && cachedFormulaValue !== void 0 && calculated.is_error) {
@@ -2699,23 +2823,20 @@ function useXlsxViewerController(options2) {
2699
2823
  }, [activeSheet, getActiveWorksheet, locale]);
2700
2824
  const getClipboardData = React.useCallback(() => {
2701
2825
  const worksheet = getActiveWorksheet();
2702
- const targetRange = _nullishCoalesce(selection, () => ( (activeCell ? { start: activeCell, end: activeCell } : null)));
2703
- if (!worksheet || !targetRange) {
2704
- return null;
2705
- }
2706
- const normalized = normalizeRange(targetRange);
2826
+ const bands = clipboardBands(selectionRanges);
2827
+ if (!worksheet || !bands) return null;
2707
2828
  const rows = [];
2708
2829
  const htmlRows = [];
2709
2830
  const payload = {
2710
2831
  cells: [],
2711
- cols: normalized.end.col - normalized.start.col + 1,
2832
+ cols: bands.cols.reduce((total, band) => total + band.end - band.start + 1, 0),
2712
2833
  merges: [],
2713
- rows: normalized.end.row - normalized.start.row + 1
2834
+ rows: bands.rows.reduce((total, band) => total + band.end - band.start + 1, 0)
2714
2835
  };
2715
- for (let row2 = normalized.start.row; row2 <= normalized.end.row; row2 += 1) {
2836
+ for (const { index: row2, offset: rowOffset, remaining: rowsRemaining } of bandIndices(bands.rows)) {
2716
2837
  const textCells = [];
2717
2838
  const htmlCells = [];
2718
- for (let col = normalized.start.col; col <= normalized.end.col; col += 1) {
2839
+ for (const { index: col, offset: colOffset, remaining: colsRemaining } of bandIndices(bands.cols)) {
2719
2840
  if (worksheet.isMergedSecondary(row2, col)) {
2720
2841
  textCells.push("");
2721
2842
  continue;
@@ -2731,7 +2852,7 @@ function useXlsxViewerController(options2) {
2731
2852
  ];
2732
2853
  const fill = _optionalChain([rawStyle, 'optionalAccess', _267 => _267.fill]);
2733
2854
  if (fill) {
2734
- const fillStyle = _chunkJCSAS3M2cjs.resolveWorkbookFillStyle.call(void 0, fill, _optionalChain([activeSheet, 'optionalAccess', _268 => _268.themePalette]));
2855
+ const fillStyle = _chunkXZJLPW64cjs.resolveWorkbookFillStyle.call(void 0, fill, _optionalChain([activeSheet, 'optionalAccess', _268 => _268.themePalette]));
2735
2856
  if (fillStyle.backgroundColor && fillStyle.backgroundColor.toLowerCase() !== "#ffffff") {
2736
2857
  cellStyles.push(`background-color:${fillStyle.backgroundColor}`);
2737
2858
  }
@@ -2753,7 +2874,7 @@ function useXlsxViewerController(options2) {
2753
2874
  if (font.strikethrough) {
2754
2875
  cellStyles.push("text-decoration:line-through");
2755
2876
  }
2756
- const fontColor = _chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, font.color, _optionalChain([activeSheet, 'optionalAccess', _270 => _270.themePalette]));
2877
+ const fontColor = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, _optionalChain([activeSheet, 'optionalAccess', _270 => _270.themePalette]));
2757
2878
  if (fontColor) {
2758
2879
  cellStyles.push(`color:${fontColor}`);
2759
2880
  }
@@ -2782,19 +2903,19 @@ function useXlsxViewerController(options2) {
2782
2903
  if (_optionalChain([border, 'optionalAccess', _281 => _281.left, 'optionalAccess', _282 => _282.style]) && border.left.style !== "none") {
2783
2904
  cellStyles.push(`border-left:${mapBorder(border.left)}`);
2784
2905
  }
2785
- const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _283 => _283.rowSpan]), () => ( 1)), normalized.end.row - row2 + 1);
2786
- const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _284 => _284.colSpan]), () => ( 1)), normalized.end.col - col + 1);
2906
+ const rowSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _283 => _283.rowSpan]), () => ( 1)), rowsRemaining);
2907
+ const colSpan = Math.min(_nullishCoalesce(_optionalChain([merge, 'optionalAccess', _284 => _284.colSpan]), () => ( 1)), colsRemaining);
2787
2908
  payload.cells.push({
2788
- colOffset: col - normalized.start.col,
2909
+ colOffset,
2789
2910
  formula,
2790
- rowOffset: row2 - normalized.start.row,
2911
+ rowOffset,
2791
2912
  value
2792
2913
  });
2793
2914
  if (rowSpan > 1 || colSpan > 1) {
2794
2915
  payload.merges.push({
2795
- colOffset: col - normalized.start.col,
2916
+ colOffset,
2796
2917
  colSpan,
2797
- rowOffset: row2 - normalized.start.row,
2918
+ rowOffset,
2798
2919
  rowSpan
2799
2920
  });
2800
2921
  }
@@ -2811,7 +2932,7 @@ function useXlsxViewerController(options2) {
2811
2932
  structured: JSON.stringify(payload),
2812
2933
  text: rows.join("\n")
2813
2934
  };
2814
- }, [activeCell, getActiveWorksheet, getCellDisplayValue2, selection]);
2935
+ }, [activeSheet, getActiveWorksheet, getCellDisplayValue2, selectionRanges]);
2815
2936
  React.useEffect(() => {
2816
2937
  if (!isWorkerBacked || !deferredMetadataSheet || !deferredMetadataCell) {
2817
2938
  return;
@@ -2842,7 +2963,7 @@ function useXlsxViewerController(options2) {
2842
2963
  };
2843
2964
  }, [deferredMetadataCell, deferredMetadataSheet, getCellSnapshotAsync, isWorkerBacked, locale]);
2844
2965
  const activeCellAddress = React.useMemo(() => activeCell ? cellAddressToA1(activeCell) : null, [activeCell]);
2845
- const selectedRangeAddress = React.useMemo(() => selection ? rangeToA1(selection) : null, [selection]);
2966
+ const selectedRangeAddress = React.useMemo(() => selectionRanges.map(rangeToA1).join(",") || null, [selectionRanges]);
2846
2967
  const selectedValue = React.useMemo(
2847
2968
  () => getCellDisplayValue2(deferredMetadataCell),
2848
2969
  [deferredMetadataCell, getCellDisplayValue2, revision, workerCellSnapshotRevision]
@@ -2851,7 +2972,7 @@ function useXlsxViewerController(options2) {
2851
2972
  () => getCellFormula(deferredMetadataCell),
2852
2973
  [deferredMetadataCell, getCellFormula, revision, workerCellSnapshotRevision]
2853
2974
  );
2854
- const getChartSeriesFormula = React.useCallback((chartId, seriesIndex) => _chunkJCSAS3M2cjs.buildChartSeriesFormula.call(void 0, getChartById(chartId), seriesIndex), [getChartById]);
2975
+ const getChartSeriesFormula = React.useCallback((chartId, seriesIndex) => _chunkXZJLPW64cjs.buildChartSeriesFormula.call(void 0, getChartById(chartId), seriesIndex), [getChartById]);
2855
2976
  const selectedChartFormula = React.useMemo(() => {
2856
2977
  if (!selectedChartElement || selectedChartElement.kind === "chart" || selectedChartElement.kind === "legend" || selectedChartElement.seriesIndex < 0) {
2857
2978
  return null;
@@ -2892,10 +3013,10 @@ function useXlsxViewerController(options2) {
2892
3013
  bytes: workbook.exportSnapshot(),
2893
3014
  assets: imageAssetsRef.current ? structuredClone(imageAssetsRef.current) : null,
2894
3015
  origins: structuredClone(sheetOriginsRef.current),
2895
- selection,
3016
+ selectionRanges,
2896
3017
  sortState
2897
3018
  };
2898
- }, [activeCell, activeSheetIndex, selection, sortState, workbook]);
3019
+ }, [activeCell, activeSheetIndex, selectionRanges, sortState, workbook]);
2899
3020
  const captureCellMutationState = React.useCallback((cell) => {
2900
3021
  const worksheet = getActiveWorksheet();
2901
3022
  if (!worksheet) {
@@ -2928,8 +3049,8 @@ function useXlsxViewerController(options2) {
2928
3049
  sheetOriginsRef.current = structuredClone(entry.origins);
2929
3050
  setWorkbook(nextWorkbook);
2930
3051
  setSheets(nextSheets);
2931
- setPivotTables(_chunkJCSAS3M2cjs.readPivotTables.call(void 0, nextWorkbook));
2932
- const nextChartAssets = _chunkJCSAS3M2cjs.loadWorkbookChartAssets.call(void 0, nextWorkbook, nextImageAssets, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets);
3052
+ setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, nextWorkbook));
3053
+ const nextChartAssets = _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, nextWorkbook, nextImageAssets, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets);
2933
3054
  setChartAssets(nextChartAssets);
2934
3055
  setActiveSheetIndexState(nextSheetIndex);
2935
3056
  const nextTabIndex = nextChartAssets.tabs.findIndex((tab) => tab.kind === "sheet" && tab.sheetIndex === nextSheetIndex);
@@ -2937,9 +3058,9 @@ function useXlsxViewerController(options2) {
2937
3058
  setActiveTabIndexState(nextTabIndex);
2938
3059
  }
2939
3060
  setActiveCell(entry.activeCell);
2940
- setSelection(entry.selection);
3061
+ setSelectionRanges(entry.selectionRanges);
2941
3062
  setSortState(entry.sortState);
2942
- selectionAnchorRef.current = entry.selection ? normalizeRange(entry.selection).start : entry.activeCell;
3063
+ selectionAnchorRef.current = _nullishCoalesce(_optionalChain([entry, 'access', _290 => _290.selectionRanges, 'access', _291 => _291.at, 'call', _292 => _292(-1), 'optionalAccess', _293 => _293.start]), () => ( entry.activeCell));
2943
3064
  setRevision((current) => current + 1);
2944
3065
  }, [setChartAssets, setImageAssets]);
2945
3066
  const applyCellEditHistoryEntry = React.useCallback((entry, direction) => {
@@ -2959,8 +3080,8 @@ function useXlsxViewerController(options2) {
2959
3080
  setActiveSheetIndexState(visibleSheetIndex);
2960
3081
  }
2961
3082
  setActiveCell(nextActiveCell);
2962
- setSelection(nextSelection);
2963
- selectionAnchorRef.current = nextSelection ? normalizeRange(nextSelection).start : nextActiveCell;
3083
+ setSelectionRanges(nextSelection);
3084
+ selectionAnchorRef.current = _nullishCoalesce(_optionalChain([nextSelection, 'access', _294 => _294.at, 'call', _295 => _295(-1), 'optionalAccess', _296 => _296.start]), () => ( nextActiveCell));
2964
3085
  isApplyingHistoryRef.current = false;
2965
3086
  }, [maybeRecalculateWorkbook, refreshWorkbookState, sheets, workbook]);
2966
3087
  const applyRangeEditHistoryEntry = React.useCallback((entry, direction) => {
@@ -2982,8 +3103,8 @@ function useXlsxViewerController(options2) {
2982
3103
  setActiveSheetIndexState(visibleSheetIndex);
2983
3104
  }
2984
3105
  setActiveCell(nextActiveCell);
2985
- setSelection(nextSelection);
2986
- selectionAnchorRef.current = nextSelection ? normalizeRange(nextSelection).start : nextActiveCell;
3106
+ setSelectionRanges(nextSelection);
3107
+ selectionAnchorRef.current = _nullishCoalesce(_optionalChain([nextSelection, 'access', _297 => _297.at, 'call', _298 => _298(-1), 'optionalAccess', _299 => _299.start]), () => ( nextActiveCell));
2987
3108
  isApplyingHistoryRef.current = false;
2988
3109
  }, [maybeRecalculateWorkbook, refreshWorkbookState, sheets, workbook]);
2989
3110
  const recordHistoryBeforeMutation = React.useCallback(() => {
@@ -3000,17 +3121,17 @@ function useXlsxViewerController(options2) {
3000
3121
  }, [createHistoryEntry]);
3001
3122
  const getPivotSourceFields = React.useCallback((source) => {
3002
3123
  if (!workbook) throw new Error("Load an editable workbook to inspect a pivot source.");
3003
- return _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, workbook).getPivotSourceFields(source);
3124
+ return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).getPivotSourceFields(source);
3004
3125
  }, [workbook]);
3005
- const getPivotTableAtCell = React.useCallback((cell, sheetName = _optionalChain([activeSheet, 'optionalAccess', _290 => _290.name])) => _chunkJCSAS3M2cjs.findIntersectingPivot.call(void 0, pivotTables, sheetName, { start: cell, end: cell }), [_optionalChain([activeSheet, 'optionalAccess', _291 => _291.name]), pivotTables]);
3126
+ const getPivotTableAtCell = React.useCallback((cell, sheetName = _optionalChain([activeSheet, 'optionalAccess', _300 => _300.name])) => _chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivotTables, sheetName, { start: cell, end: cell }), [_optionalChain([activeSheet, 'optionalAccess', _301 => _301.name]), pivotTables]);
3006
3127
  React.useEffect(() => {
3007
3128
  const insidePivot = activeCell && !selectedChartId && !selectedImageId && getPivotTableAtCell(activeCell);
3008
3129
  setPivotFieldListVisibleState(Boolean(pivotFieldListRequestedRef.current && insidePivot));
3009
- }, [_optionalChain([activeCell, 'optionalAccess', _292 => _292.row]), _optionalChain([activeCell, 'optionalAccess', _293 => _293.col]), _optionalChain([activeSheet, 'optionalAccess', _294 => _294.name]), getPivotTableAtCell, selectedChartId, selectedImageId]);
3010
- const intersectsPivot = React.useCallback((range) => Boolean(_chunkJCSAS3M2cjs.findIntersectingPivot.call(void 0, pivotTables, _optionalChain([activeSheet, 'optionalAccess', _295 => _295.name]), range)), [_optionalChain([activeSheet, 'optionalAccess', _296 => _296.name]), pivotTables]);
3130
+ }, [_optionalChain([activeCell, 'optionalAccess', _302 => _302.row]), _optionalChain([activeCell, 'optionalAccess', _303 => _303.col]), _optionalChain([activeSheet, 'optionalAccess', _304 => _304.name]), getPivotTableAtCell, selectedChartId, selectedImageId]);
3131
+ const intersectsPivot = React.useCallback((range) => Boolean(_chunkXZJLPW64cjs.findIntersectingPivot.call(void 0, pivotTables, _optionalChain([activeSheet, 'optionalAccess', _305 => _305.name]), range)), [_optionalChain([activeSheet, 'optionalAccess', _306 => _306.name]), pivotTables]);
3011
3132
  const calculateForPivotMutation = React.useCallback((target, preserveSavedValues = true) => {
3012
3133
  const snapshot = preserveSavedValues ? target.exportSnapshot() : null;
3013
- const result = _chunkJCSAS3M2cjs.safeCalculate.call(void 0, target, snapshot ? { reparse: () => target.constructor.fromSnapshot(snapshot) } : {});
3134
+ const result = _chunkXZJLPW64cjs.safeCalculate.call(void 0, target, snapshot ? { reparse: () => target.constructor.fromSnapshot(snapshot) } : {});
3014
3135
  if (!result.calculated) {
3015
3136
  if (result.workbook !== target) result.workbook.free();
3016
3137
  throw new Error("The workbook formulas could not be recalculated safely. The pivot table and existing values have been kept.");
@@ -3020,7 +3141,7 @@ function useXlsxViewerController(options2) {
3020
3141
  if (readOnly) throw new Error("Enable editing to change pivot tables.");
3021
3142
  if (!workbook) throw new Error("Load a workbook before changing pivot tables.");
3022
3143
  const before = createHistoryEntry();
3023
- const next = workbook.constructor.fromSnapshot(_nullishCoalesce(_optionalChain([before, 'optionalAccess', _297 => _297.bytes]), () => ( workbook.exportSnapshot())));
3144
+ const next = workbook.constructor.fromSnapshot(_nullishCoalesce(_optionalChain([before, 'optionalAccess', _307 => _307.bytes]), () => ( workbook.exportSnapshot())));
3024
3145
  let result;
3025
3146
  try {
3026
3147
  if (recalculate2) calculateForPivotMutation(next);
@@ -3036,17 +3157,17 @@ function useXlsxViewerController(options2) {
3036
3157
  setHistoryRevision((current) => current + 1);
3037
3158
  }
3038
3159
  if (recalculate2) {
3039
- for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _298 => _298.current, 'optionalAccess', _299 => _299.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
3160
+ for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _308 => _308.current, 'optionalAccess', _309 => _309.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
3040
3161
  }
3041
3162
  setWorkbook(next);
3042
3163
  refreshWorkbookState(next);
3043
3164
  return result;
3044
3165
  }, [calculateForPivotMutation, createHistoryEntry, readOnly, refreshWorkbookState, workbook]);
3045
3166
  const upsertPivotTable = React.useCallback((input) => {
3046
- return commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).upsertPivotTable(input));
3167
+ return commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).upsertPivotTable(input));
3047
3168
  }, [commitPivotMutation]);
3048
- const refreshPivotTable = React.useCallback((id) => commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).refreshPivotTable(id), true), [commitPivotMutation]);
3049
- const createPivotChart = React.useCallback((id, options3 = {}) => commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).createPivotChart(id, { ...options3, workbookName: `${fileStem(displayFileName)}.xlsx` }), false), [commitPivotMutation, displayFileName]);
3169
+ const refreshPivotTable = React.useCallback((id) => commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).refreshPivotTable(id), true), [commitPivotMutation]);
3170
+ const createPivotChart = React.useCallback((id, options3 = {}) => commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).createPivotChart(id, { ...options3, workbookName: `${fileStem(displayFileName)}.xlsx` }), false), [commitPivotMutation, displayFileName]);
3050
3171
  const togglePivotGroup = React.useCallback((id, toggle) => {
3051
3172
  const pivot = pivotTables.find((item) => item.id === id);
3052
3173
  if (!pivot) throw new Error("The pivot table no longer exists.");
@@ -3060,7 +3181,7 @@ function useXlsxViewerController(options2) {
3060
3181
  }, [pivotTables, upsertPivotTable]);
3061
3182
  const removePivotTable = React.useCallback((id) => {
3062
3183
  if (!pivotTables.some((pivot) => pivot.id === id)) return false;
3063
- return commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).removePivotTable(id));
3184
+ return commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).removePivotTable(id));
3064
3185
  }, [commitPivotMutation, pivotTables]);
3065
3186
  const refreshAllPivotTables = React.useCallback(() => {
3066
3187
  if (readOnly) throw new Error("Enable editing to refresh pivot tables.");
@@ -3070,7 +3191,7 @@ function useXlsxViewerController(options2) {
3070
3191
  const next = workbook.constructor.fromSnapshot(workbook.exportSnapshot());
3071
3192
  try {
3072
3193
  calculateForPivotMutation(next);
3073
- const engine = _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, next);
3194
+ const engine = _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, next);
3074
3195
  for (const pivot of engine.pivotTables) {
3075
3196
  engine.refreshPivotTable(pivot.id);
3076
3197
  calculateForPivotMutation(next, false);
@@ -3084,19 +3205,19 @@ function useXlsxViewerController(options2) {
3084
3205
  redoStackRef.current = [];
3085
3206
  setHistoryRevision((current) => current + 1);
3086
3207
  }
3087
- for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _300 => _300.current, 'optionalAccess', _301 => _301.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
3208
+ for (const sheet of _nullishCoalesce(_optionalChain([imageAssetsRef, 'access', _310 => _310.current, 'optionalAccess', _311 => _311.sheetStatesByWorkbookSheetIndex]), () => ( []))) if (sheet) sheet.cachedFormulaValues = {};
3088
3209
  setWorkbook(next);
3089
3210
  refreshWorkbookState(next);
3090
- return _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, next).pivotTables;
3211
+ return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, next).pivotTables;
3091
3212
  }, [calculateForPivotMutation, createHistoryEntry, pivotTables.length, readOnly, refreshWorkbookState, workbook]);
3092
3213
  const pivotDrillDown = React.useCallback((id, row2, col) => {
3093
3214
  if (!workbook) throw new Error("Load an editable workbook to inspect pivot details.");
3094
- return _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
3215
+ return _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
3095
3216
  }, [workbook]);
3096
3217
  const showPivotDetails = React.useCallback((id, row2, col) => {
3097
3218
  if (readOnly) throw new Error("Enable editing to create a details worksheet.");
3098
3219
  if (!workbook) throw new Error("Load a workbook before inspecting pivot details.");
3099
- const details = _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
3220
+ const details = _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, workbook).pivotDrillDown(id, row2, col);
3100
3221
  if (!details.rows.length) throw new Error("This pivot cell has no source records to display.");
3101
3222
  const before = createHistoryEntry();
3102
3223
  const next = workbook.constructor.fromSnapshot(workbook.exportSnapshot());
@@ -3142,10 +3263,10 @@ function useXlsxViewerController(options2) {
3142
3263
  target.worksheet.addDrawing(xlsxFormControlInputToDukeDrawing(input));
3143
3264
  const controlIndex = target.worksheet.formControlCount - 1;
3144
3265
  const addedControl = target.worksheet.formControls[controlIndex];
3145
- const addedKind = _optionalChain([addedControl, 'optionalAccess', _302 => _302.formControl, 'access', _303 => _303.kind]);
3146
- if (addedControl && (_optionalChain([addedKind, 'optionalAccess', _304 => _304.kind]) === "checkbox" || _optionalChain([addedKind, 'optionalAccess', _305 => _305.kind]) === "optionButton")) {
3266
+ const addedKind = _optionalChain([addedControl, 'optionalAccess', _312 => _312.formControl, 'access', _313 => _313.kind]);
3267
+ if (addedControl && (_optionalChain([addedKind, 'optionalAccess', _314 => _314.kind]) === "checkbox" || _optionalChain([addedKind, 'optionalAccess', _315 => _315.kind]) === "optionButton")) {
3147
3268
  target.worksheet.setFormControlCheckState(addedControl.drawingPath, addedKind.state);
3148
- } else if (_optionalChain([addedKind, 'optionalAccess', _306 => _306.kind]) === "groupBox") {
3269
+ } else if (_optionalChain([addedKind, 'optionalAccess', _316 => _316.kind]) === "groupBox") {
3149
3270
  reconcileCheckedOptionButtons(target.worksheet);
3150
3271
  } else if (addedKind && "cellLink" in addedKind && addedKind.cellLink) {
3151
3272
  workbook.syncFormControls();
@@ -3156,7 +3277,7 @@ function useXlsxViewerController(options2) {
3156
3277
  }, [activeSheetIndex, getFormControlWorksheet, maybeRecalculateWorkbook, pivotTables, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
3157
3278
  const updateFormControl = React.useCallback((controlIndex, patch, sheetIndex = activeSheetIndex) => {
3158
3279
  const target = getFormControlWorksheet(sheetIndex);
3159
- const currentControl = _optionalChain([target, 'optionalAccess', _307 => _307.worksheet, 'access', _308 => _308.formControls, 'access', _309 => _309[controlIndex]]);
3280
+ const currentControl = _optionalChain([target, 'optionalAccess', _317 => _317.worksheet, 'access', _318 => _318.formControls, 'access', _319 => _319[controlIndex]]);
3160
3281
  if (readOnly || !workbook || !target || !currentControl) {
3161
3282
  return false;
3162
3283
  }
@@ -3164,7 +3285,7 @@ function useXlsxViewerController(options2) {
3164
3285
  if (currentInput.kind !== "formControl" || !currentControl.anchor) {
3165
3286
  return false;
3166
3287
  }
3167
- const nextAnchor = patch.anchor ? _chunkJCSAS3M2cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0,
3288
+ const nextAnchor = patch.anchor ? _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0,
3168
3289
  patch.anchor,
3169
3290
  _nullishCoalesce(patch.editAs, () => ( (currentControl.anchor.type === "twoCell" ? currentControl.anchor.editAs : void 0)))
3170
3291
  ) : patch.editAs !== void 0 && currentControl.anchor.type === "twoCell" ? { ...currentControl.anchor, editAs: patch.editAs } : currentControl.anchor;
@@ -3178,8 +3299,8 @@ function useXlsxViewerController(options2) {
3178
3299
  legacyObjectType: _nullishCoalesce(nextKind.legacyObjectType, () => ( currentControl.formControl.kind.legacyObjectType))
3179
3300
  };
3180
3301
  }
3181
- const patchedRawObj = _optionalChain([patch, 'access', _310 => _310.kind, 'optionalAccess', _311 => _311.kind]) === "editbox" || _optionalChain([patch, 'access', _312 => _312.kind, 'optionalAccess', _313 => _313.kind]) === "unknown" ? patch.kind.rawObj : void 0;
3182
- const patchedRawProperties = _optionalChain([patch, 'access', _314 => _314.kind, 'optionalAccess', _315 => _315.kind]) === "editbox" || _optionalChain([patch, 'access', _316 => _316.kind, 'optionalAccess', _317 => _317.kind]) === "unknown" ? patch.kind.rawProperties : void 0;
3302
+ const patchedRawObj = _optionalChain([patch, 'access', _320 => _320.kind, 'optionalAccess', _321 => _321.kind]) === "editbox" || _optionalChain([patch, 'access', _322 => _322.kind, 'optionalAccess', _323 => _323.kind]) === "unknown" ? patch.kind.rawObj : void 0;
3303
+ const patchedRawProperties = _optionalChain([patch, 'access', _324 => _324.kind, 'optionalAccess', _325 => _325.kind]) === "editbox" || _optionalChain([patch, 'access', _326 => _326.kind, 'optionalAccess', _327 => _327.kind]) === "unknown" ? patch.kind.rawProperties : void 0;
3183
3304
  const nextInput = {
3184
3305
  altText: "altText" in patch ? patch.altText : currentControl.altText,
3185
3306
  anchor: nextAnchor,
@@ -3201,10 +3322,10 @@ function useXlsxViewerController(options2) {
3201
3322
  recordHistoryBeforeMutation();
3202
3323
  target.worksheet.setDrawing(currentControl.drawingPath, nextInput);
3203
3324
  const updatedControl = target.worksheet.formControls[controlIndex];
3204
- const updatedKind = _optionalChain([updatedControl, 'optionalAccess', _318 => _318.formControl, 'access', _319 => _319.kind]);
3325
+ const updatedKind = _optionalChain([updatedControl, 'optionalAccess', _328 => _328.formControl, 'access', _329 => _329.kind]);
3205
3326
  const interactionChanged = updatedKind ? formControlInteractionChanged(currentControl.formControl.kind, updatedKind) : false;
3206
3327
  const groupTopologyChanged = patch.anchor !== void 0 || updatedKind !== void 0 && updatedKind.kind !== currentControl.formControl.kind.kind && (updatedKind.kind === "groupBox" || currentControl.formControl.kind.kind === "groupBox");
3207
- if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess', _320 => _320.kind]) === "checkbox" || _optionalChain([updatedKind, 'optionalAccess', _321 => _321.kind]) === "optionButton")) {
3328
+ if (interactionChanged && updatedControl && (_optionalChain([updatedKind, 'optionalAccess', _330 => _330.kind]) === "checkbox" || _optionalChain([updatedKind, 'optionalAccess', _331 => _331.kind]) === "optionButton")) {
3208
3329
  target.worksheet.setFormControlCheckState(updatedControl.drawingPath, updatedKind.state);
3209
3330
  } else if (groupTopologyChanged) {
3210
3331
  reconcileCheckedOptionButtons(target.worksheet);
@@ -3242,13 +3363,13 @@ function useXlsxViewerController(options2) {
3242
3363
  after,
3243
3364
  before,
3244
3365
  cell,
3245
- selectionAfter: { start: cell, end: cell },
3246
- selectionBefore: selection,
3366
+ selectionAfter: [{ start: cell, end: cell }],
3367
+ selectionBefore: selectionRanges,
3247
3368
  sheetIndex: activeSheet.workbookSheetIndex
3248
3369
  });
3249
3370
  redoStackRef.current = [];
3250
3371
  setHistoryRevision((current) => current + 1);
3251
- }, [activeCell, activeSheet, selection]);
3372
+ }, [activeCell, activeSheet, selectionRanges]);
3252
3373
  const recordRangeEditHistory = React.useCallback((mutations, selectionAfter, activeCellAfter, sortStateAfter = sortState) => {
3253
3374
  if (!activeSheet || isApplyingHistoryRef.current || mutations.length === 0 && sortStateAfter === sortState) {
3254
3375
  return;
@@ -3259,14 +3380,14 @@ function useXlsxViewerController(options2) {
3259
3380
  activeCellBefore: activeCell,
3260
3381
  mutations,
3261
3382
  selectionAfter,
3262
- selectionBefore: selection,
3383
+ selectionBefore: selectionRanges,
3263
3384
  sheetIndex: activeSheet.workbookSheetIndex,
3264
3385
  sortStateAfter,
3265
3386
  sortStateBefore: sortState
3266
3387
  });
3267
3388
  redoStackRef.current = [];
3268
3389
  setHistoryRevision((current) => current + 1);
3269
- }, [activeCell, activeSheet, selection, sortState]);
3390
+ }, [activeCell, activeSheet, selectionRanges, sortState]);
3270
3391
  const sortTable = React.useCallback((tableName, columnIndex, direction) => {
3271
3392
  const worksheet = getActiveWorksheet();
3272
3393
  const targetTable = tables.find((table) => table.name === tableName || table.displayName === tableName);
@@ -3320,12 +3441,12 @@ function useXlsxViewerController(options2) {
3320
3441
  return direction === "ascending" ? comparedText : -comparedText;
3321
3442
  });
3322
3443
  const nextSortState = { columnIndex, direction, tableName: targetTable.name };
3323
- if (sortedRows.every((row2, index) => row2.index === _optionalChain([rows, 'access', _322 => _322[index], 'optionalAccess', _323 => _323.index]))) {
3324
- if (_optionalChain([sortState, 'optionalAccess', _324 => _324.tableName]) === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
3444
+ if (sortedRows.every((row2, index) => row2.index === _optionalChain([rows, 'access', _332 => _332[index], 'optionalAccess', _333 => _333.index]))) {
3445
+ if (_optionalChain([sortState, 'optionalAccess', _334 => _334.tableName]) === targetTable.name && sortState.columnIndex === columnIndex && sortState.direction === direction) {
3325
3446
  return;
3326
3447
  }
3327
3448
  setSortState(nextSortState);
3328
- recordRangeEditHistory([], selection, activeCell, nextSortState);
3449
+ recordRangeEditHistory([], selectionRanges, activeCell, nextSortState);
3329
3450
  return;
3330
3451
  }
3331
3452
  const mutations = [];
@@ -3354,7 +3475,7 @@ function useXlsxViewerController(options2) {
3354
3475
  maybeRecalculateWorkbook(workbook);
3355
3476
  refreshWorkbookState(workbook);
3356
3477
  setSortState(nextSortState);
3357
- recordRangeEditHistory(mutations, selection, activeCell, nextSortState);
3478
+ recordRangeEditHistory(mutations, selectionRanges, activeCell, nextSortState);
3358
3479
  }, [
3359
3480
  intersectsPivot,
3360
3481
  activeCell,
@@ -3364,7 +3485,7 @@ function useXlsxViewerController(options2) {
3364
3485
  readOnly,
3365
3486
  recordRangeEditHistory,
3366
3487
  refreshWorkbookState,
3367
- selection,
3488
+ selectionRanges,
3368
3489
  sortState,
3369
3490
  tables,
3370
3491
  workbook
@@ -3395,120 +3516,163 @@ function useXlsxViewerController(options2) {
3395
3516
  if (!workbook) {
3396
3517
  return;
3397
3518
  }
3398
- const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _325 => _325.name]), () => ( "sheet"));
3519
+ const activeSheetName = _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _335 => _335.name]), () => ( "sheet"));
3399
3520
  downloadText(workbook.saveCsvString(), `${fileStem(displayFileName)}-${activeSheetName}.csv`, CSV_MIME_TYPE);
3400
- }, [_optionalChain([activeSheet, 'optionalAccess', _326 => _326.name]), displayFileName, workbook]);
3521
+ }, [_optionalChain([activeSheet, 'optionalAccess', _336 => _336.name]), displayFileName, workbook]);
3401
3522
  const recalculate = React.useCallback(() => {
3402
3523
  if (!workbook) {
3403
3524
  return;
3404
3525
  }
3405
- const result = _chunkJCSAS3M2cjs.tryRecalculate.call(void 0, workbook);
3526
+ const result = _chunkXZJLPW64cjs.tryRecalculate.call(void 0, workbook);
3406
3527
  if (result.calculated) {
3407
3528
  refreshWorkbookState(workbook);
3408
3529
  return;
3409
3530
  }
3410
3531
  setShouldAutoCalculate(false);
3411
3532
  }, [refreshWorkbookState, workbook]);
3412
- const applyReadOnlyResizeOverride = React.useCallback((axis, actualIndex, sizePx) => {
3413
- if (!activeSheet) {
3414
- return;
3415
- }
3416
- const contentSizePx = activeSheet.officeLayout ? sizePx : _chunkJCSAS3M2cjs.resolveContentSheetAxisPixels.call(void 0, sizePx, activeSheet.showGridLines);
3417
- const targetWorkbookSheetIndex = activeSheet.workbookSheetIndex;
3418
- setSheets((currentSheets) => currentSheets.map((sheet) => {
3419
- if (sheet.workbookSheetIndex !== targetWorkbookSheetIndex) {
3420
- return sheet;
3421
- }
3422
- if (axis === "column") {
3423
- const nextColWidthOverridesPx = {
3424
- ...sheet.colWidthOverridesPx,
3425
- [actualIndex]: contentSizePx
3426
- };
3427
- const nextColWidths = [...sheet.colWidths];
3428
- const visibleColIndex = sheet.visibleCols.indexOf(actualIndex);
3429
- if (visibleColIndex >= 0) {
3430
- nextColWidths[visibleColIndex] = contentSizePx;
3431
- }
3432
- return {
3433
- ...sheet,
3434
- colWidthOverridesPx: nextColWidthOverridesPx,
3435
- colWidths: nextColWidths
3436
- };
3437
- }
3438
- const nextRowHeightOverridesPx = {
3439
- ...sheet.rowHeightOverridesPx,
3440
- [actualIndex]: contentSizePx
3441
- };
3442
- const nextRowHeights = [...sheet.rowHeights];
3443
- const visibleRowIndex = sheet.visibleRows.indexOf(actualIndex);
3444
- if (visibleRowIndex >= 0) {
3445
- nextRowHeights[visibleRowIndex] = contentSizePx;
3446
- }
3447
- return {
3448
- ...sheet,
3449
- rowHeightOverridesPx: nextRowHeightOverridesPx,
3450
- rowHeights: nextRowHeights
3451
- };
3533
+ const applyReadOnlyResizeOverride = React.useCallback((axis, indices, sizePx) => {
3534
+ if (!activeSheet) return;
3535
+ const contentSizePx = activeSheet.officeLayout ? sizePx : _chunkXZJLPW64cjs.resolveContentSheetAxisPixels.call(void 0, sizePx, activeSheet.showGridLines);
3536
+ const selected = new Set(indices);
3537
+ setSheets((current) => current.map((sheet) => {
3538
+ if (sheet.workbookSheetIndex !== activeSheet.workbookSheetIndex) return sheet;
3539
+ const isRow = axis === "row";
3540
+ const overrides = { ...isRow ? sheet.rowHeightOverridesPx : sheet.colWidthOverridesPx };
3541
+ for (const index of selected) overrides[index] = contentSizePx;
3542
+ const visible = isRow ? sheet.visibleRows : sheet.visibleCols;
3543
+ const sizes = (isRow ? sheet.rowHeights : sheet.colWidths).map((size, offset) => selected.has(visible[offset]) ? contentSizePx : size);
3544
+ return isRow ? { ...sheet, rowHeightOverridesPx: overrides, rowHeights: sizes } : { ...sheet, colWidthOverridesPx: overrides, colWidths: sizes };
3452
3545
  }));
3453
3546
  setRevision((current) => current + 1);
3454
3547
  }, [activeSheet]);
3455
- const resizeColumn = React.useCallback((col, widthPx) => {
3456
- if (!canResize || !activeSheet) {
3457
- return;
3458
- }
3459
- if (isWorkerBacked) {
3460
- applyReadOnlyResizeOverride("column", col, widthPx);
3461
- return;
3462
- }
3463
- if (!workbook) {
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]);
3562
+ const setAxisHidden = React.useCallback((axis, hidden, start, end = start) => {
3563
+ if (!canChangeVisibility || !activeSheet) return;
3564
+ const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
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)) }];
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;
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
+ }
3582
+ }
3583
+ return { ...current, [sheetIndex]: { ...layout, [key]: next } };
3584
+ });
3464
3585
  return;
3465
3586
  }
3466
- recordHistoryBeforeMutation();
3467
- const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
3468
- worksheet.setColumnWidth(
3469
- col,
3470
- activeSheet.officeLayout ? _chunkJCSAS3M2cjs.pxToOfficeColumnWidth.call(void 0, widthPx, activeSheet.officeLayout.columnDigitWidthPt) : _chunkJCSAS3M2cjs.pxToSheetColumnWidth.call(void 0,
3471
- _chunkJCSAS3M2cjs.resolveContentSheetAxisPixels.call(void 0, widthPx, activeSheet.showGridLines),
3472
- activeSheet.columnWidthCharacterWidthPx
3473
- )
3474
- );
3475
- refreshWorkbookState(workbook);
3476
- }, [
3477
- activeSheet,
3478
- applyReadOnlyResizeOverride,
3479
- canResize,
3480
- isWorkerBacked,
3481
- recordHistoryBeforeMutation,
3482
- refreshWorkbookState,
3483
- workbook
3484
- ]);
3485
- const resizeRow = React.useCallback((row2, heightPx) => {
3486
- if (!canResize || !activeSheet) {
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);
3592
+ if (!changes.length) return;
3593
+ recordHistoryBeforeMutation();
3594
+ for (const range of changes) {
3595
+ if (axis === "row") worksheet.setRowsHidden(range.start, range.end, hidden);
3596
+ else worksheet.setColumnsHidden(range.start, range.end, hidden);
3597
+ }
3598
+ if (hidden && activeCell && changes.some((range) => range.start <= activeCell[axis] && activeCell[axis] <= range.end)) {
3599
+ const index = nextVisibleIndex(
3600
+ activeCell[axis],
3601
+ limit,
3602
+ (value) => axis === "row" ? worksheet.isRowHidden(value) : worksheet.isColumnHidden(value)
3603
+ );
3604
+ if (index >= 0) {
3605
+ const cell = { ...activeCell, [axis]: index };
3606
+ setActiveCell(cell);
3607
+ setSelection({ start: cell, end: cell });
3608
+ selectionAnchorRef.current = cell;
3609
+ }
3610
+ }
3611
+ refreshWorkbookState(workbook);
3612
+ } finally {
3613
+ worksheet.free();
3614
+ }
3615
+ }, [activeCell, activeSheet, canChangeVisibility, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selectionRanges, setSelection, workbook]);
3616
+ const hideRows = React.useCallback((start, end) => setAxisHidden("row", true, start, end), [setAxisHidden]);
3617
+ const unhideRows = React.useCallback((start, end) => setAxisHidden("row", false, start, end), [setAxisHidden]);
3618
+ const hideColumns = React.useCallback((start, end) => setAxisHidden("col", true, start, end), [setAxisHidden]);
3619
+ const unhideColumns = React.useCallback((start, end) => setAxisHidden("col", false, start, end), [setAxisHidden]);
3620
+ const setFreezeBoundary = React.useCallback((cell) => {
3621
+ if (!canChangeFreezePanes || !activeSheet) return;
3622
+ const { row: row2, col } = cell;
3623
+ if (!Number.isInteger(row2) || row2 < 0 || row2 >= _chunkXZJLPW64cjs.XLSX_MAX_ROWS || !Number.isInteger(col) || col < 0 || col >= _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS) return;
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 } }));
3487
3628
  return;
3488
3629
  }
3630
+ if (!workbook) return;
3631
+ const worksheet = workbook.getSheet(sheetIndex);
3632
+ try {
3633
+ const current = parseWorksheetFreezePanes(worksheet);
3634
+ if (row2 === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _342 => _342.row]), () => ( 0))) && col === (_nullishCoalesce(_optionalChain([current, 'optionalAccess', _343 => _343.col]), () => ( 0)))) return;
3635
+ recordHistoryBeforeMutation();
3636
+ worksheet.setFreezePanes(row2, col);
3637
+ refreshWorkbookState(workbook);
3638
+ } finally {
3639
+ worksheet.free();
3640
+ }
3641
+ }, [activeSheet, canChangeFreezePanes, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
3642
+ const freezeCell = resolveFreezePanesCell(activeCell, selection);
3643
+ const canFreezePanes = Boolean(canChangeFreezePanes && freezeCell && (freezeCell.row > 0 || freezeCell.col > 0));
3644
+ const freezePanes = React.useCallback((cell = freezeCell) => {
3645
+ if (cell) setFreezeBoundary(cell);
3646
+ }, [freezeCell, setFreezeBoundary]);
3647
+ const unfreezePanes = React.useCallback(() => setFreezeBoundary({ row: 0, col: 0 }), [setFreezeBoundary]);
3648
+ const resizeAxis = React.useCallback((axis, target, sizePx) => {
3649
+ if (!canResize || !activeSheet || !Number.isFinite(sizePx)) return;
3650
+ const indices = typeof target === "number" ? [target] : target;
3651
+ const limit = axis === "row" ? _chunkXZJLPW64cjs.XLSX_MAX_ROWS : _chunkXZJLPW64cjs.XLSX_MAX_COLUMNS;
3652
+ if (!indices.length || indices.some((index) => !Number.isInteger(index) || index < 0 || index >= limit)) return;
3489
3653
  if (isWorkerBacked) {
3490
- applyReadOnlyResizeOverride("row", row2, heightPx);
3654
+ applyReadOnlyResizeOverride(axis, indices, sizePx);
3491
3655
  return;
3492
3656
  }
3493
- if (!workbook) {
3494
- return;
3495
- }
3496
- recordHistoryBeforeMutation();
3657
+ if (!workbook) return;
3497
3658
  const worksheet = workbook.getSheet(activeSheet.workbookSheetIndex);
3498
- worksheet.setRowHeight(
3499
- row2,
3500
- activeSheet.officeLayout ? Math.max(heightPx, MIN_ROW_HEIGHT_PX) * (3 / 4) : pxToSheetRowHeight(_chunkJCSAS3M2cjs.resolveContentSheetAxisPixels.call(void 0, heightPx, activeSheet.showGridLines))
3501
- );
3502
- refreshWorkbookState(workbook);
3503
- }, [
3504
- activeSheet,
3505
- applyReadOnlyResizeOverride,
3506
- canResize,
3507
- isWorkerBacked,
3508
- recordHistoryBeforeMutation,
3509
- refreshWorkbookState,
3510
- workbook
3511
- ]);
3659
+ try {
3660
+ recordHistoryBeforeMutation();
3661
+ const contentPx = _chunkXZJLPW64cjs.resolveContentSheetAxisPixels.call(void 0, sizePx, activeSheet.showGridLines);
3662
+ if (axis === "row") {
3663
+ const points = activeSheet.officeLayout ? Math.max(sizePx, MIN_ROW_HEIGHT_PX) * 3 / 4 : pxToSheetRowHeight(contentPx);
3664
+ for (const index of indices) worksheet.setRowHeight(index, points);
3665
+ } else {
3666
+ const width = activeSheet.officeLayout ? _chunkXZJLPW64cjs.pxToOfficeColumnWidth.call(void 0, sizePx, activeSheet.officeLayout.columnDigitWidthPt) : _chunkXZJLPW64cjs.pxToSheetColumnWidth.call(void 0, contentPx, activeSheet.columnWidthCharacterWidthPx);
3667
+ for (const index of indices) worksheet.setColumnWidth(index, width);
3668
+ }
3669
+ refreshWorkbookState(workbook);
3670
+ } finally {
3671
+ worksheet.free();
3672
+ }
3673
+ }, [activeSheet, applyReadOnlyResizeOverride, canResize, isWorkerBacked, recordHistoryBeforeMutation, refreshWorkbookState, workbook]);
3674
+ const resizeColumn = React.useCallback((col, widthPx) => resizeAxis("column", col, widthPx), [resizeAxis]);
3675
+ const resizeRow = React.useCallback((row2, heightPx) => resizeAxis("row", row2, heightPx), [resizeAxis]);
3512
3676
  const resolveAnchoredObjectRect = React.useCallback((anchor, worksheet) => {
3513
3677
  const resolveAxisSum = (index, getSize) => {
3514
3678
  let total = 0;
@@ -3554,21 +3718,21 @@ function useXlsxViewerController(options2) {
3554
3718
  if (!currentChart || currentChart.editable === false || currentChart.workbookSheetIndex !== activeSheet.workbookSheetIndex) {
3555
3719
  return;
3556
3720
  }
3557
- const nextAnchor = _chunkJCSAS3M2cjs.rectToImageAnchor.call(void 0, rect, currentChart.anchor, {
3721
+ const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentChart.anchor, {
3558
3722
  contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
3559
3723
  contentOffsetTop: GRID_HEADER_HEIGHT,
3560
- getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _327 => _327.columnWidths, 'access', _328 => _328[col]]), () => ( getColumnWidthPx(worksheet, col))),
3561
- getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _329 => _329.rowHeights, 'access', _330 => _330[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)))
3562
3726
  });
3563
- if (_optionalChain([currentChart, 'access', _331 => _331.raw, 'optionalAccess', _332 => _332.pivotSource]) && currentChart.name) {
3564
- commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).updatePivotChart(worksheet.name, currentChart.name, {
3565
- anchor: _chunkJCSAS3M2cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, nextAnchor)
3727
+ if (_optionalChain([currentChart, 'access', _348 => _348.raw, 'optionalAccess', _349 => _349.pivotSource]) && currentChart.name) {
3728
+ commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(worksheet.name, currentChart.name, {
3729
+ anchor: _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, nextAnchor)
3566
3730
  }), false);
3567
3731
  return;
3568
3732
  }
3569
3733
  if (!imageAssetsRef.current || !hydratedChartAssets) return;
3570
3734
  recordHistoryBeforeMutation();
3571
- if (!_chunkJCSAS3M2cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, nextAnchor)) return;
3735
+ if (!_chunkXZJLPW64cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, nextAnchor)) return;
3572
3736
  hydratedChartAssets.chartsByWorkbookSheetIndex = hydratedChartAssets.chartsByWorkbookSheetIndex.map((sheetCharts) => sheetCharts.map((chart) => chart.id === id ? { ...chart, anchor: nextAnchor } : chart));
3573
3737
  setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) => chart.id === id ? { ...chart, anchor: nextAnchor } : chart)));
3574
3738
  setRevision((current) => current + 1);
@@ -3593,14 +3757,14 @@ function useXlsxViewerController(options2) {
3593
3757
  if (!currentImage || currentImage.editable === false || currentImage.workbookSheetIndex !== activeSheet.workbookSheetIndex) {
3594
3758
  return;
3595
3759
  }
3596
- const nextAnchor = _chunkJCSAS3M2cjs.rectToImageAnchor.call(void 0, rect, currentImage.anchor, {
3760
+ const nextAnchor = _chunkXZJLPW64cjs.rectToImageAnchor.call(void 0, rect, currentImage.anchor, {
3597
3761
  contentOffsetLeft: GRID_ROW_HEADER_WIDTH,
3598
3762
  contentOffsetTop: GRID_HEADER_HEIGHT,
3599
- getColumnWidthPx: (col) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _333 => _333.columnWidths, 'access', _334 => _334[col]]), () => ( getColumnWidthPx(worksheet, col))),
3600
- getRowHeightPx: (row2) => _nullishCoalesce(_optionalChain([layout, 'optionalAccess', _335 => _335.rowHeights, 'access', _336 => _336[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)))
3601
3765
  });
3602
3766
  recordHistoryBeforeMutation();
3603
- if (!_chunkJCSAS3M2cjs.updateWorkbookImageAnchor.call(void 0, imageAssetsRef.current, id, nextAnchor)) {
3767
+ if (!_chunkXZJLPW64cjs.updateWorkbookImageAnchor.call(void 0, imageAssetsRef.current, id, nextAnchor)) {
3604
3768
  return;
3605
3769
  }
3606
3770
  setImagesByWorkbookSheetIndex([...imageAssetsRef.current.imagesByWorkbookSheetIndex]);
@@ -3693,7 +3857,7 @@ function useXlsxViewerController(options2) {
3693
3857
  return;
3694
3858
  }
3695
3859
  const currentRect = resolveAnchoredObjectRect(currentChart.anchor, worksheet);
3696
- setChartRect(id, _chunkJCSAS3M2cjs.resizeImageRect.call(void 0, currentRect, handle, deltaX, deltaY, 48));
3860
+ setChartRect(id, _chunkXZJLPW64cjs.resizeImageRect.call(void 0, currentRect, handle, deltaX, deltaY, 48));
3697
3861
  }, [getActiveWorksheet, getChartById, resolveAnchoredObjectRect, setChartRect]);
3698
3862
  const resizeImageBy = React.useCallback((id, handle, deltaX, deltaY) => {
3699
3863
  const currentImage = getImageById(id);
@@ -3721,7 +3885,7 @@ function useXlsxViewerController(options2) {
3721
3885
  1,
3722
3886
  GRID_HEADER_HEIGHT + resolveAxisSum(currentImage.anchor.to.row, (row2) => getRowHeightPx(worksheet, row2)) + currentImage.anchor.to.rowOffsetEmu / 9525 - top
3723
3887
  ) : currentImage.anchor.sizeEmu.cy / 9525;
3724
- const nextRect = _chunkJCSAS3M2cjs.resizeImageRect.call(void 0, { height, left, top, width }, handle, deltaX, deltaY);
3888
+ const nextRect = _chunkXZJLPW64cjs.resizeImageRect.call(void 0, { height, left, top, width }, handle, deltaX, deltaY);
3725
3889
  setImageRect(id, nextRect);
3726
3890
  }, [getActiveWorksheet, getColumnWidthPx, getImageById, getRowHeightPx, setImageRect]);
3727
3891
  const commitDrawingArchiveMutation = React.useCallback(async (mutate, target) => {
@@ -3743,10 +3907,10 @@ function useXlsxViewerController(options2) {
3743
3907
  let nextAssets = null;
3744
3908
  let published = false;
3745
3909
  try {
3746
- nextAssets = await _chunkJCSAS3M2cjs.loadWorkbookImageAssets.call(void 0, bytes, next);
3910
+ nextAssets = await _chunkXZJLPW64cjs.loadWorkbookImageAssets.call(void 0, bytes, next);
3747
3911
  const latest = drawingMutationState.current;
3748
3912
  if (epoch !== drawingMutationEpoch.current || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly) {
3749
- _chunkJCSAS3M2cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
3913
+ _chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
3750
3914
  next.free();
3751
3915
  return false;
3752
3916
  }
@@ -3762,17 +3926,17 @@ function useXlsxViewerController(options2) {
3762
3926
  setSelectedChartId(null);
3763
3927
  setSelectedChartElement(null);
3764
3928
  if (target.kind === "chart") {
3765
- const chart = _optionalChain([chartAssetsRef, 'access', _337 => _337.current, 'optionalAccess', _338 => _338.chartsByWorkbookSheetIndex, 'access', _339 => _339.flat, 'call', _340 => _340(), 'access', _341 => _341.find, 'call', _342 => _342((chart2) => target.path ? chart2.chartPath === target.path : chart2.name === target.name)]);
3766
- setSelectedChartId(_nullishCoalesce(_optionalChain([chart, 'optionalAccess', _343 => _343.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)));
3767
3931
  setSelectedChartElement(chart ? { kind: "chart", chartId: chart.id } : null);
3768
3932
  } else if (target.kind === "image") {
3769
- const image = _optionalChain([nextAssets, 'optionalAccess', _344 => _344.imagesByWorkbookSheetIndex, 'access', _345 => _345.flat, 'call', _346 => _346(), 'access', _347 => _347.find, 'call', _348 => _348((image2) => image2.name === target.name)]);
3770
- setSelectedImageId(_nullishCoalesce(_optionalChain([image, 'optionalAccess', _349 => _349.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)));
3771
3935
  }
3772
3936
  return true;
3773
3937
  } catch (cause) {
3774
3938
  if (!published) {
3775
- _chunkJCSAS3M2cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
3939
+ _chunkXZJLPW64cjs.revokeWorkbookImageAssets.call(void 0, nextAssets);
3776
3940
  next.free();
3777
3941
  }
3778
3942
  throw cause;
@@ -3794,7 +3958,7 @@ function useXlsxViewerController(options2) {
3794
3958
  const generation = loadGenerationRef.current;
3795
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()));
3796
3960
  const latest = drawingMutationState.current;
3797
- if (!data || generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _350 => _350.activeCell, 'optionalAccess', _351 => _351.row]) !== _optionalChain([state, 'access', _352 => _352.activeCell, 'optionalAccess', _353 => _353.row]) || _optionalChain([latest, 'access', _354 => _354.activeCell, 'optionalAccess', _355 => _355.col]) !== _optionalChain([state, 'access', _356 => _356.activeCell, 'optionalAccess', _357 => _357.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;
3798
3962
  return pasteDrawing(data);
3799
3963
  }, [activeSheet, pasteDrawing, readOnly, workbook]);
3800
3964
  const arrangeDrawing = React.useCallback(async (kind, id, order) => {
@@ -3833,9 +3997,9 @@ function useXlsxViewerController(options2) {
3833
3997
  const chart = getChartById(id);
3834
3998
  const option = chartTypeOptions.find((option2) => option2.id === type);
3835
3999
  if (readOnly || !chart || !option || chartTypeUnavailable(chart, option)) return false;
3836
- if (_optionalChain([chart, 'access', _358 => _358.raw, 'optionalAccess', _359 => _359.pivotSource])) {
4000
+ if (_optionalChain([chart, 'access', _375 => _375.raw, 'optionalAccess', _376 => _376.pivotSource])) {
3837
4001
  if (!workbook || !chart.name) return false;
3838
- commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).updatePivotChart(workbook.getSheet(chart.workbookSheetIndex).name, chart.name, { chartType: option.chartType }), false);
4002
+ commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(workbook.getSheet(chart.workbookSheetIndex).name, chart.name, { chartType: option.chartType }), false);
3839
4003
  return true;
3840
4004
  }
3841
4005
  const assets = imageAssetsRef.current;
@@ -3856,7 +4020,7 @@ function useXlsxViewerController(options2) {
3856
4020
  assets.archive = nextAssets.archive;
3857
4021
  assets.dirtyArchivePaths = nextAssets.dirtyArchivePaths;
3858
4022
  origin.chartKind = option.layout ? "modern" : "classic";
3859
- const nextChart = _chunkJCSAS3M2cjs.refreshChartRenderSource.call(void 0, { ...chart, chartType: option.chartType, chartExLayout: option.layout, is3d: option.is3d, typeGroups: void 0 }, assets, workbook);
4023
+ const nextChart = _chunkXZJLPW64cjs.refreshChartRenderSource.call(void 0, { ...chart, chartType: option.chartType, chartExLayout: option.layout, is3d: option.is3d, typeGroups: void 0 }, assets, workbook);
3860
4024
  charts2.chartsByWorkbookSheetIndex = charts2.chartsByWorkbookSheetIndex.map((items) => items.map((item) => item.id === id ? nextChart : item));
3861
4025
  setChartsByWorkbookSheetIndex(charts2.chartsByWorkbookSheetIndex);
3862
4026
  setSelectedChartElement({ kind: "chart", chartId: id });
@@ -3869,30 +4033,30 @@ function useXlsxViewerController(options2) {
3869
4033
  if (readOnly || !currentChart) {
3870
4034
  return;
3871
4035
  }
3872
- if (_optionalChain([currentChart, 'access', _360 => _360.raw, 'optionalAccess', _361 => _361.pivotSource])) {
4036
+ if (_optionalChain([currentChart, 'access', _377 => _377.raw, 'optionalAccess', _378 => _378.pivotSource])) {
3873
4037
  if (!workbook || !currentChart.name) return;
3874
4038
  if (Object.keys(patch).some((key) => !["title", "chartType", "anchor"].includes(key))) {
3875
4039
  throw new Error("Change PivotChart data through the pivot table field settings.");
3876
4040
  }
3877
4041
  const sheetName = workbook.getSheet(currentChart.workbookSheetIndex).name;
3878
- commitPivotMutation((target) => _chunkJCSAS3M2cjs.pivotWorkbook.call(void 0, target).updatePivotChart(sheetName, currentChart.name, {
4042
+ commitPivotMutation((target) => _chunkXZJLPW64cjs.pivotWorkbook.call(void 0, target).updatePivotChart(sheetName, currentChart.name, {
3879
4043
  title: patch.title,
3880
4044
  chartType: patch.chartType,
3881
- anchor: patch.anchor ? _chunkJCSAS3M2cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, patch.anchor) : void 0
4045
+ anchor: patch.anchor ? _chunkXZJLPW64cjs.xlsxAnchorToDukeDrawingAnchor.call(void 0, patch.anchor) : void 0
3882
4046
  }), false);
3883
4047
  return;
3884
4048
  }
3885
4049
  recordHistoryBeforeMutation();
3886
4050
  if (patch.anchor && imageAssetsRef.current && hydratedChartAssets) {
3887
- _chunkJCSAS3M2cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch.anchor);
4051
+ _chunkXZJLPW64cjs.updateWorkbookChartAnchor.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch.anchor);
3888
4052
  }
3889
4053
  if (imageAssetsRef.current && hydratedChartAssets) {
3890
- _chunkJCSAS3M2cjs.updateWorkbookChartDefinition.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch);
4054
+ _chunkXZJLPW64cjs.updateWorkbookChartDefinition.call(void 0, imageAssetsRef.current, hydratedChartAssets, id, patch);
3891
4055
  }
3892
4056
  setChartsByWorkbookSheetIndex((current) => current.map((sheetCharts) => sheetCharts.map((chart) => {
3893
4057
  if (chart.id !== id) return chart;
3894
4058
  const nextChart = { ...chart, ...patch, renderSource: _nullishCoalesce(patch.renderSource, () => ( chart.renderSource)) };
3895
- return imageAssetsRef.current ? _chunkJCSAS3M2cjs.refreshChartRenderSource.call(void 0, nextChart, imageAssetsRef.current, workbook) : nextChart;
4059
+ return imageAssetsRef.current ? _chunkXZJLPW64cjs.refreshChartRenderSource.call(void 0, nextChart, imageAssetsRef.current, workbook) : nextChart;
3896
4060
  })));
3897
4061
  setRevision((current) => current + 1);
3898
4062
  }, [commitPivotMutation, ensureChartAssetsHydrated, getChartById, readOnly, recordHistoryBeforeMutation, sheets, workbook]);
@@ -3901,10 +4065,10 @@ function useXlsxViewerController(options2) {
3901
4065
  return false;
3902
4066
  }
3903
4067
  const chart = getChartById(chartId);
3904
- if (!chart || chart.editable === false || _optionalChain([chart, 'access', _362 => _362.raw, 'optionalAccess', _363 => _363.pivotSource])) {
4068
+ if (!chart || chart.editable === false || _optionalChain([chart, 'access', _379 => _379.raw, 'optionalAccess', _380 => _380.pivotSource])) {
3905
4069
  return false;
3906
4070
  }
3907
- const nextChart = _chunkJCSAS3M2cjs.applyChartSeriesFormula.call(void 0, chart, seriesIndex, formula, workbook);
4071
+ const nextChart = _chunkXZJLPW64cjs.applyChartSeriesFormula.call(void 0, chart, seriesIndex, formula, workbook);
3908
4072
  if (!nextChart) {
3909
4073
  return false;
3910
4074
  }
@@ -3923,30 +4087,35 @@ function useXlsxViewerController(options2) {
3923
4087
  }
3924
4088
  return true;
3925
4089
  }, [getChartById, readOnly, updateChart, workbook]);
3926
- const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _364 => _364.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _365 => _365.mergedRanges])]);
4090
+ const findSelectionMerge = React.useMemo(() => createMergedRangeLookup(_nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _381 => _381.mergedRanges]), () => ( []))), [_optionalChain([activeSheet, 'optionalAccess', _382 => _382.mergedRanges])]);
3927
4091
  const selectCell = React.useCallback((cell, options3) => {
3928
4092
  const merged = findSelectionMerge(cell);
3929
- const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _366 => _366.start]), () => ( cell));
4093
+ const anchorCell = _nullishCoalesce(_optionalChain([merged, 'optionalAccess', _383 => _383.start]), () => ( cell));
3930
4094
  setSelectedChartId(null);
3931
4095
  setSelectedChartElement(null);
3932
4096
  setSelectedImageId(null);
3933
4097
  setActiveCell(anchorCell);
3934
- if (_optionalChain([options3, 'optionalAccess', _367 => _367.extend]) && selectionAnchorRef.current) {
3935
- setSelection(expandHighlightedRange(normalizeRange({ start: selectionAnchorRef.current, end: cell }), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _368 => _368.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]), () => ( []))));
3936
4100
  return;
3937
4101
  }
3938
4102
  selectionAnchorRef.current = anchorCell;
3939
4103
  setSelection(_nullishCoalesce(merged, () => ( { start: cell, end: cell })));
3940
- }, [_optionalChain([activeSheet, 'optionalAccess', _369 => _369.mergedRanges]), findSelectionMerge]);
3941
- const selectRange = React.useCallback((range) => {
3942
- const normalized = expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _370 => _370.mergedRanges]), () => ( [])));
4104
+ }, [_optionalChain([activeSheet, 'optionalAccess', _386 => _386.mergedRanges]), findSelectionMerge]);
4105
+ const selectRanges = React.useCallback((ranges, activeCorner = "end") => {
4106
+ const areas = ranges.reduce((previous, range) => addSelectionRange(previous, normalizeRange(range)), []);
4107
+ const active = areas.at(-1);
3943
4108
  setSelectedChartId(null);
3944
4109
  setSelectedChartElement(null);
3945
4110
  setSelectedImageId(null);
3946
- selectionAnchorRef.current = normalized.start;
3947
- setActiveCell(_nullishCoalesce(_optionalChain([findSelectionMerge, 'call', _371 => _371(normalized.end), 'optionalAccess', _372 => _372.start]), () => ( normalized.end)));
3948
- setSelection(normalized);
3949
- }, [_optionalChain([activeSheet, 'optionalAccess', _373 => _373.mergedRanges]), findSelectionMerge]);
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);
4114
+ setSelectionRanges(areas);
4115
+ }, [findSelectionMerge]);
4116
+ const selectRange = React.useCallback((range) => {
4117
+ selectRanges([expandHighlightedRange(normalizeRange(range), _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _391 => _391.mergedRanges]), () => ( [])))]);
4118
+ }, [_optionalChain([activeSheet, 'optionalAccess', _392 => _392.mergedRanges]), selectRanges]);
3950
4119
  const clearSelection = React.useCallback(() => {
3951
4120
  selectionAnchorRef.current = null;
3952
4121
  setActiveCell(null);
@@ -3957,38 +4126,35 @@ function useXlsxViewerController(options2) {
3957
4126
  }, []);
3958
4127
  const clearSelectedCells = React.useCallback(() => {
3959
4128
  const worksheet = getActiveWorksheet();
3960
- const targetRange = _nullishCoalesce(selection, () => ( (activeCell ? { start: activeCell, end: activeCell } : null)));
3961
- if (readOnly || !worksheet || !workbook || !targetRange) {
3962
- return;
3963
- }
3964
- if (intersectsPivot(targetRange)) return;
3965
- const normalized = normalizeRange(targetRange);
4129
+ if (readOnly || !worksheet || !workbook || !selectionRanges.length || selectionRanges.some(intersectsPivot)) return;
3966
4130
  const mutations = [];
3967
- for (let row2 = normalized.start.row; row2 <= normalized.end.row; row2 += 1) {
3968
- for (let col = normalized.start.col; col <= normalized.end.col; col += 1) {
3969
- if (worksheet.isMergedSecondary(row2, col)) {
3970
- continue;
3971
- }
3972
- const cell = { row: row2, col };
3973
- const before = captureCellMutationState(cell);
3974
- if (!before) {
3975
- continue;
3976
- }
3977
- worksheet.setCell(cellAddressToA1({ row: row2, col }), "");
3978
- const after = captureCellMutationState(cell);
3979
- if (!after) {
3980
- continue;
4131
+ for (const area of selectionRanges) {
4132
+ for (let row2 = area.start.row; row2 <= area.end.row; row2 += 1) {
4133
+ for (let col = area.start.col; col <= area.end.col; col += 1) {
4134
+ if (worksheet.isMergedSecondary(row2, col)) {
4135
+ continue;
4136
+ }
4137
+ const cell = { row: row2, col };
4138
+ const before = captureCellMutationState(cell);
4139
+ if (!before) {
4140
+ continue;
4141
+ }
4142
+ worksheet.setCell(cellAddressToA1({ row: row2, col }), "");
4143
+ const after = captureCellMutationState(cell);
4144
+ if (!after) {
4145
+ continue;
4146
+ }
4147
+ mutations.push({
4148
+ after,
4149
+ before,
4150
+ cell
4151
+ });
3981
4152
  }
3982
- mutations.push({
3983
- after,
3984
- before,
3985
- cell
3986
- });
3987
4153
  }
3988
4154
  }
3989
4155
  maybeRecalculateWorkbook(workbook);
3990
4156
  refreshWorkbookState(workbook);
3991
- recordRangeEditHistory(mutations, normalized, _nullishCoalesce(activeCell, () => ( normalized.start)));
4157
+ recordRangeEditHistory(mutations, selectionRanges, activeCell);
3992
4158
  }, [
3993
4159
  intersectsPivot,
3994
4160
  activeCell,
@@ -3998,7 +4164,7 @@ function useXlsxViewerController(options2) {
3998
4164
  readOnly,
3999
4165
  recordRangeEditHistory,
4000
4166
  refreshWorkbookState,
4001
- selection,
4167
+ selectionRanges,
4002
4168
  workbook
4003
4169
  ]);
4004
4170
  const setCellValue = React.useCallback((cell, value) => {
@@ -4083,8 +4249,8 @@ function useXlsxViewerController(options2) {
4083
4249
  if (after) mutations.push({ cell, before, after });
4084
4250
  }
4085
4251
  refreshWorkbookState(workbook);
4086
- recordRangeEditHistory(mutations, selection, activeCell);
4087
- }, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
4252
+ recordRangeEditHistory(mutations, selectionRanges, activeCell);
4253
+ }, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selectionRanges, workbook]);
4088
4254
  const setSelectedCellValue = React.useCallback((value) => {
4089
4255
  if (!activeCell) {
4090
4256
  return;
@@ -4098,7 +4264,7 @@ function useXlsxViewerController(options2) {
4098
4264
  setCellFormula(activeCell, formula);
4099
4265
  }, [activeCell, setCellFormula]);
4100
4266
  const setSelectedFormula = React.useCallback((formula) => {
4101
- if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _374 => _374.kind]) === "chartSeries") {
4267
+ if (_optionalChain([selectedFormulaTarget, 'optionalAccess', _393 => _393.kind]) === "chartSeries") {
4102
4268
  return setChartSeriesFormula(selectedFormulaTarget.chartId, selectedFormulaTarget.seriesIndex, formula);
4103
4269
  }
4104
4270
  if (readOnly || !activeCell || getPivotTableAtCell(activeCell)) {
@@ -4118,25 +4284,27 @@ function useXlsxViewerController(options2) {
4118
4284
  if (readOnly || !worksheet || !workbook) {
4119
4285
  return;
4120
4286
  }
4121
- const normalized = normalizeRange(range);
4287
+ const areas = "start" in range ? [normalizeRange(range)] : range.map(normalizeRange);
4122
4288
  const beforeStates = [];
4123
- for (let row2 = normalized.start.row; row2 <= normalized.end.row; row2 += 1) {
4124
- for (let col = normalized.start.col; col <= normalized.end.col; col += 1) {
4125
- const cell = { row: row2, col };
4126
- const before = captureCellMutationState(cell);
4127
- if (!before) {
4128
- continue;
4289
+ for (const area of areas) {
4290
+ for (let row2 = area.start.row; row2 <= area.end.row; row2 += 1) {
4291
+ for (let col = area.start.col; col <= area.end.col; col += 1) {
4292
+ const cell = { row: row2, col };
4293
+ const before = captureCellMutationState(cell);
4294
+ if (!before) {
4295
+ continue;
4296
+ }
4297
+ beforeStates.push({
4298
+ before,
4299
+ cell
4300
+ });
4129
4301
  }
4130
- beforeStates.push({
4131
- before,
4132
- cell
4133
- });
4134
4302
  }
4135
4303
  }
4136
4304
  if (beforeStates.length === 0) {
4137
4305
  return;
4138
4306
  }
4139
- worksheet.setRangeStyle(rangeToA1(normalized), style);
4307
+ for (const area of areas) worksheet.setRangeStyle(rangeToA1(area), style);
4140
4308
  const mutations = [];
4141
4309
  for (const mutation of beforeStates) {
4142
4310
  const after = captureCellMutationState(mutation.cell);
@@ -4150,11 +4318,11 @@ function useXlsxViewerController(options2) {
4150
4318
  });
4151
4319
  }
4152
4320
  refreshWorkbookState(workbook);
4153
- recordRangeEditHistory(mutations, selection, activeCell);
4154
- }, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
4321
+ recordRangeEditHistory(mutations, selectionRanges, activeCell);
4322
+ }, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selectionRanges, workbook]);
4155
4323
  const fillSelection = React.useCallback((targetRange) => {
4156
4324
  const worksheet = getActiveWorksheet();
4157
- if (readOnly || !worksheet || !workbook || !selection) {
4325
+ if (readOnly || !worksheet || !workbook || !selection || selectionRanges.length > 1) {
4158
4326
  return;
4159
4327
  }
4160
4328
  if (intersectsPivot(targetRange)) return;
@@ -4205,15 +4373,15 @@ function useXlsxViewerController(options2) {
4205
4373
  setSelection(nextRange);
4206
4374
  setActiveCell(nextRange.end);
4207
4375
  selectionAnchorRef.current = nextRange.start;
4208
- recordRangeEditHistory(mutations, nextRange, nextRange.end);
4209
- }, [intersectsPivot, captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
4376
+ recordRangeEditHistory(mutations, [nextRange], nextRange.end);
4377
+ }, [intersectsPivot, captureCellMutationState, getActiveWorksheet, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
4210
4378
  const mergeSelection = React.useCallback((mode = "cells") => {
4211
4379
  const worksheet = getActiveWorksheet();
4212
- if (readOnly || !worksheet || !selection || !workbook) {
4380
+ if (readOnly || !worksheet || !selection || selectionRanges.length > 1 || !workbook) {
4213
4381
  return;
4214
4382
  }
4215
4383
  if (intersectsPivot(selection)) return;
4216
- const mergedRanges = _chunkJCSAS3M2cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges;
4384
+ const mergedRanges = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges;
4217
4385
  const range = expandHighlightedRange(normalizeRange(selection), mergedRanges);
4218
4386
  const isSingleCell = range.start.row === range.end.row && range.start.col === range.end.col;
4219
4387
  if (isSingleCell && mode !== "center" || mode === "across" && range.start.col === range.end.col) {
@@ -4242,28 +4410,28 @@ function useXlsxViewerController(options2) {
4242
4410
  selectionAnchorRef.current = range.start;
4243
4411
  setSelection(range);
4244
4412
  setActiveCell(range.start);
4245
- }, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, workbook]);
4413
+ }, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, selectionRanges, workbook]);
4246
4414
  const unmergeSelection = React.useCallback(() => {
4247
4415
  const worksheet = getActiveWorksheet();
4248
- if (readOnly || !worksheet || !selection || !workbook) {
4416
+ if (readOnly || !worksheet || !selection || selectionRanges.length > 1 || !workbook) {
4249
4417
  return;
4250
4418
  }
4251
4419
  const range = normalizeRange(selection);
4252
4420
  if (intersectsPivot(selection)) return;
4253
- const mergedRanges = _chunkJCSAS3M2cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges.filter((merged) => rangesIntersect(range, merged));
4421
+ const mergedRanges = _chunkXZJLPW64cjs.resolveWorksheetMergeMetadata.call(void 0, worksheet).mergedRanges.filter((merged) => rangesIntersect(range, merged));
4254
4422
  if (mergedRanges.length === 0) return;
4255
4423
  recordHistoryBeforeMutation();
4256
4424
  for (const merged of mergedRanges) {
4257
4425
  worksheet.unmergeCells(rangeToA1(merged));
4258
4426
  }
4259
4427
  refreshWorkbookState(workbook);
4260
- }, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, workbook]);
4428
+ }, [intersectsPivot, getActiveWorksheet, readOnly, recordHistoryBeforeMutation, refreshWorkbookState, selection, selectionRanges, workbook]);
4261
4429
  const addSheet = React.useCallback((name) => {
4262
4430
  if (readOnly || !workbook) {
4263
4431
  return;
4264
4432
  }
4265
4433
  recordHistoryBeforeMutation();
4266
- const baseName = _optionalChain([name, 'optionalAccess', _375 => _375.trim, 'call', _376 => _376()]) || "Sheet";
4434
+ const baseName = _optionalChain([name, 'optionalAccess', _394 => _394.trim, 'call', _395 => _395()]) || "Sheet";
4267
4435
  let candidate = baseName;
4268
4436
  let counter = 2;
4269
4437
  while (workbook.sheetIndex(candidate) !== void 0) {
@@ -4283,21 +4451,21 @@ function useXlsxViewerController(options2) {
4283
4451
  }
4284
4452
  const nextSheets = buildSheetList(
4285
4453
  workbook,
4286
- _optionalChain([imageAssetsRef, 'access', _377 => _377.current, 'optionalAccess', _378 => _378.sheetStatesByWorkbookSheetIndex]),
4287
- _optionalChain([imageAssetsRef, 'access', _379 => _379.current, 'optionalAccess', _380 => _380.themePalette]),
4288
- _optionalChain([imageAssetsRef, 'access', _381 => _381.current, 'optionalAccess', _382 => _382.styleById]),
4289
- _optionalChain([imageAssetsRef, 'access', _383 => _383.current, 'optionalAccess', _384 => _384.namedCellStyleByName]),
4290
- _optionalChain([imageAssetsRef, 'access', _385 => _385.current, 'optionalAccess', _386 => _386.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]),
4291
4459
  showHiddenSheets
4292
4460
  );
4293
4461
  setSheets(nextSheets);
4294
- const nextChartAssets = imageAssetsRef.current ? _chunkJCSAS3M2cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets) : null;
4462
+ const nextChartAssets = imageAssetsRef.current ? _chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets) : null;
4295
4463
  if (imageAssetsRef.current) {
4296
4464
  setChartAssets(nextChartAssets);
4297
4465
  }
4298
4466
  const nextIndex = nextSheets.findIndex((sheet) => sheet.name === candidate);
4299
4467
  setActiveSheetIndexState(nextIndex >= 0 ? nextIndex : 0);
4300
- const nextTabIndex = _nullishCoalesce(_optionalChain([nextChartAssets, 'optionalAccess', _387 => _387.tabs, 'access', _388 => _388.findIndex, 'call', _389 => _389((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));
4301
4469
  if (nextTabIndex >= 0) {
4302
4470
  setActiveTabIndexState(nextTabIndex);
4303
4471
  }
@@ -4309,7 +4477,7 @@ function useXlsxViewerController(options2) {
4309
4477
  }
4310
4478
  recordHistoryBeforeMutation();
4311
4479
  workbook.removeSheet(activeSheet.workbookSheetIndex);
4312
- setPivotTables(_chunkJCSAS3M2cjs.readPivotTables.call(void 0, workbook));
4480
+ setPivotTables(_chunkXZJLPW64cjs.readPivotTables.call(void 0, workbook));
4313
4481
  sheetOriginsRef.current = sheetOriginsRef.current.filter((_, index) => index !== activeSheet.workbookSheetIndex);
4314
4482
  setFormControlsByWorkbookSheetIndex((current) => current.filter((_, index) => index !== activeSheet.workbookSheetIndex));
4315
4483
  setImagesByWorkbookSheetIndex((current) => current.filter((_, index) => index !== activeSheet.workbookSheetIndex));
@@ -4324,16 +4492,16 @@ function useXlsxViewerController(options2) {
4324
4492
  }
4325
4493
  const nextSheets = buildSheetList(
4326
4494
  workbook,
4327
- _optionalChain([imageAssetsRef, 'access', _390 => _390.current, 'optionalAccess', _391 => _391.sheetStatesByWorkbookSheetIndex]),
4328
- _optionalChain([imageAssetsRef, 'access', _392 => _392.current, 'optionalAccess', _393 => _393.themePalette]),
4329
- _optionalChain([imageAssetsRef, 'access', _394 => _394.current, 'optionalAccess', _395 => _395.styleById]),
4330
- _optionalChain([imageAssetsRef, 'access', _396 => _396.current, 'optionalAccess', _397 => _397.namedCellStyleByName]),
4331
- _optionalChain([imageAssetsRef, 'access', _398 => _398.current, 'optionalAccess', _399 => _399.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]),
4332
4500
  showHiddenSheets
4333
4501
  );
4334
4502
  setSheets(nextSheets);
4335
4503
  if (imageAssetsRef.current) {
4336
- setChartAssets(_chunkJCSAS3M2cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets));
4504
+ setChartAssets(_chunkXZJLPW64cjs.loadWorkbookChartAssets.call(void 0, workbook, imageAssetsRef.current, buildVisibleSheetIndexMap(nextSheets), showHiddenSheets));
4337
4505
  }
4338
4506
  setActiveSheetIndexState((current) => Math.max(0, Math.min(current, nextSheets.length - 1)));
4339
4507
  setRevision((current) => current + 1);
@@ -4346,18 +4514,18 @@ function useXlsxViewerController(options2) {
4346
4514
  if (!trimmed) {
4347
4515
  return;
4348
4516
  }
4349
- const targetRange = _nullishCoalesce(range, () => ( selection));
4517
+ const targetRange = _nullishCoalesce(range, () => ( (selectionRanges.length === 1 ? selection : null)));
4350
4518
  if (!targetRange) {
4351
4519
  return;
4352
4520
  }
4353
4521
  recordHistoryBeforeMutation();
4354
4522
  workbook.defineName(trimmed, rangeToA1(targetRange));
4355
4523
  setRevision((current) => current + 1);
4356
- }, [readOnly, recordHistoryBeforeMutation, selection, workbook]);
4524
+ }, [readOnly, recordHistoryBeforeMutation, selection, selectionRanges, workbook]);
4357
4525
  const pasteText = React.useCallback((text) => {
4358
4526
  const worksheet = getActiveWorksheet();
4359
- const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _400 => _400.start]))), () => ( null));
4360
- if (readOnly || !worksheet || !workbook || !targetCell || !text) {
4527
+ const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _419 => _419.start]))), () => ( null));
4528
+ if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !text) {
4361
4529
  return false;
4362
4530
  }
4363
4531
  const grid = parseClipboardText(text);
@@ -4420,13 +4588,13 @@ function useXlsxViewerController(options2) {
4420
4588
  setActiveCell(targetCell);
4421
4589
  setSelection(nextRange);
4422
4590
  selectionAnchorRef.current = targetCell;
4423
- recordRangeEditHistory(mutations, nextRange, targetCell);
4591
+ recordRangeEditHistory(mutations, [nextRange], targetCell);
4424
4592
  return true;
4425
- }, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
4593
+ }, [intersectsPivot, activeCell, captureCellMutationState, getActiveWorksheet, locale, maybeRecalculateWorkbook, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, selectionRanges, workbook]);
4426
4594
  const pasteStructuredClipboardData = React.useCallback((serializedPayload) => {
4427
4595
  const worksheet = getActiveWorksheet();
4428
- const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _401 => _401.start]))), () => ( null));
4429
- if (readOnly || !worksheet || !workbook || !targetCell || !serializedPayload) {
4596
+ const targetCell = _nullishCoalesce(_nullishCoalesce(activeCell, () => ( _optionalChain([selection, 'optionalAccess', _420 => _420.start]))), () => ( null));
4597
+ if (readOnly || !worksheet || !workbook || !targetCell || selectionRanges.length > 1 || !serializedPayload) {
4430
4598
  return false;
4431
4599
  }
4432
4600
  let payload;
@@ -4515,7 +4683,7 @@ function useXlsxViewerController(options2) {
4515
4683
  setSelection(nextRange);
4516
4684
  selectionAnchorRef.current = targetCell;
4517
4685
  if (!hasMergeOperations) {
4518
- recordRangeEditHistory(mutations, nextRange, targetCell);
4686
+ recordRangeEditHistory(mutations, [nextRange], targetCell);
4519
4687
  }
4520
4688
  return true;
4521
4689
  }, [
@@ -4529,33 +4697,37 @@ function useXlsxViewerController(options2) {
4529
4697
  recordRangeEditHistory,
4530
4698
  refreshWorkbookState,
4531
4699
  selection,
4700
+ selectionRanges,
4532
4701
  workbook
4533
4702
  ]);
4534
4703
  const copySelectionToClipboard = React.useCallback(async () => {
4535
4704
  if (typeof navigator === "undefined" || !navigator.clipboard) {
4536
4705
  return false;
4537
4706
  }
4538
- if (isWorkerBacked && activeSheet && selection) {
4539
- const range = normalizeRange(selection);
4707
+ if (isWorkerBacked && activeSheet) {
4708
+ const bands = clipboardBands(selectionRanges);
4709
+ if (!bands) return false;
4540
4710
  const textPromise = (async () => {
4541
4711
  const lines = [];
4542
- for (let startRow = range.start.row; startRow <= range.end.row; startRow += 128) {
4543
- const count = Math.min(128, range.end.row - startRow + 1);
4544
- const batch = await getRowsBatchAsync(activeSheet.workbookSheetIndex, startRow, count);
4545
- if (!batch) throw new Error("Unable to read the selected cells.");
4546
- const values = /* @__PURE__ */ new Map();
4547
- for (const entry of batch) {
4548
- for (const cell of _nullishCoalesce(entry.cells, () => ( []))) {
4549
- if (cell.col < range.start.col || cell.col > range.end.col || cell.isMergedSecondary) continue;
4550
- const value = String(_nullishCoalesce(cell.value, () => ( "")));
4551
- const cached = cell.formula ? activeSheet.cachedFormulaValues[cellAddressToA1({ row: entry.index, col: cell.col })] : void 0;
4552
- values.set(`${entry.index}:${cell.col}`, decodeHtmlEntities(cached !== void 0 && value.startsWith("#") ? cached : value));
4712
+ for (const band of bands.rows) {
4713
+ for (let startRow = band.start; startRow <= band.end; startRow += 128) {
4714
+ const count = Math.min(128, band.end - startRow + 1);
4715
+ const batch = await getRowsBatchAsync(activeSheet.workbookSheetIndex, startRow, count);
4716
+ if (!batch) throw new Error("Unable to read the selected cells.");
4717
+ const values = /* @__PURE__ */ new Map();
4718
+ for (const entry of batch) {
4719
+ for (const cell of _nullishCoalesce(entry.cells, () => ( []))) {
4720
+ if (cell.isMergedSecondary) continue;
4721
+ const value = String(_nullishCoalesce(cell.value, () => ( "")));
4722
+ const cached = cell.formula ? activeSheet.cachedFormulaValues[cellAddressToA1({ row: entry.index, col: cell.col })] : void 0;
4723
+ values.set(`${entry.index}:${cell.col}`, decodeHtmlEntities(cached !== void 0 && value.startsWith("#") ? cached : value));
4724
+ }
4725
+ }
4726
+ for (let row2 = startRow; row2 < startRow + count; row2++) {
4727
+ const cells = [];
4728
+ for (const { index: col } of bandIndices(bands.cols)) cells.push(_nullishCoalesce(values.get(`${row2}:${col}`), () => ( "")));
4729
+ lines.push(cells.join(" "));
4553
4730
  }
4554
- }
4555
- for (let row2 = startRow; row2 < startRow + count; row2++) {
4556
- const cells = [];
4557
- for (let col = range.start.col; col <= range.end.col; col++) cells.push(_nullishCoalesce(values.get(`${row2}:${col}`), () => ( "")));
4558
- lines.push(cells.join(" "));
4559
4731
  }
4560
4732
  }
4561
4733
  return lines.join("\n");
@@ -4593,14 +4765,14 @@ function useXlsxViewerController(options2) {
4593
4765
  }
4594
4766
  await navigator.clipboard.writeText(clipboardData.text);
4595
4767
  return true;
4596
- }, [activeSheet, getClipboardData, getRowsBatchAsync, isWorkerBacked, selection]);
4768
+ }, [activeSheet, getClipboardData, getRowsBatchAsync, isWorkerBacked, selectionRanges]);
4597
4769
  const pasteFromClipboard = React.useCallback(async (clipboardData) => {
4598
4770
  if (readOnly) return false;
4599
4771
  const state = drawingMutationState.current;
4600
4772
  const generation = loadGenerationRef.current;
4601
4773
  const data = await readBrowserClipboard(clipboardData);
4602
4774
  const latest = drawingMutationState.current;
4603
- if (generation !== loadGenerationRef.current || latest.workbook !== state.workbook || latest.revision !== state.revision || latest.readOnly || latest.activeSheetIndex !== state.activeSheetIndex || _optionalChain([latest, 'access', _402 => _402.activeCell, 'optionalAccess', _403 => _403.row]) !== _optionalChain([state, 'access', _404 => _404.activeCell, 'optionalAccess', _405 => _405.row]) || _optionalChain([latest, 'access', _406 => _406.activeCell, 'optionalAccess', _407 => _407.col]) !== _optionalChain([state, 'access', _408 => _408.activeCell, 'optionalAccess', _409 => _409.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;
4604
4776
  if (data.drawing) return pasteDrawing(data.drawing);
4605
4777
  if (data.structured && pasteStructuredClipboardData(data.structured)) return true;
4606
4778
  return Boolean(data.text) && pasteText(data.text);
@@ -4758,6 +4930,16 @@ function useXlsxViewerController(options2) {
4758
4930
  revision,
4759
4931
  resizeChartBy,
4760
4932
  resizeImageBy,
4933
+ frozenPanes: _nullishCoalesce(_optionalChain([activeSheet, 'optionalAccess', _429 => _429.freezePanes]), () => ( null)),
4934
+ canChangeFreezePanes,
4935
+ canChangeVisibility,
4936
+ canFreezePanes,
4937
+ hideRows,
4938
+ unhideRows,
4939
+ hideColumns,
4940
+ unhideColumns,
4941
+ freezePanes,
4942
+ unfreezePanes,
4761
4943
  resizeColumn,
4762
4944
  resizeRow,
4763
4945
  setCellFormula,
@@ -4786,6 +4968,8 @@ function useXlsxViewerController(options2) {
4786
4968
  selectChartElement,
4787
4969
  selectImage,
4788
4970
  selectRange,
4971
+ selectRanges,
4972
+ selectionRanges,
4789
4973
  selection,
4790
4974
  setActiveSheetIndex,
4791
4975
  setActiveTabIndex,
@@ -4901,6 +5085,15 @@ function useXlsxViewerController(options2) {
4901
5085
  revision,
4902
5086
  resizeChartBy,
4903
5087
  resizeImageBy,
5088
+ canChangeFreezePanes,
5089
+ canChangeVisibility,
5090
+ canFreezePanes,
5091
+ hideRows,
5092
+ unhideRows,
5093
+ hideColumns,
5094
+ unhideColumns,
5095
+ freezePanes,
5096
+ unfreezePanes,
4904
5097
  resizeColumn,
4905
5098
  resizeRow,
4906
5099
  setCellFormula,
@@ -4929,6 +5122,8 @@ function useXlsxViewerController(options2) {
4929
5122
  selectChartElement,
4930
5123
  selectImage,
4931
5124
  selectRange,
5125
+ selectRanges,
5126
+ selectionRanges,
4932
5127
  selection,
4933
5128
  setActiveSheetIndex,
4934
5129
  setActiveTabIndex,
@@ -4989,7 +5184,7 @@ function CellEditor({
4989
5184
  onNavigate
4990
5185
  }) {
4991
5186
  const rootRef = React2.useRef(null);
4992
- const messages = _chunkTMYAG7GYcjs.useXlsxMessages.call(void 0, );
5187
+ const messages = _chunkYOLIVKZDcjs.useXlsxMessages.call(void 0, );
4993
5188
  const mirrorRef = React2.useRef(null);
4994
5189
  const textRef = React2.useRef(null);
4995
5190
  const baselineRef = React2.useRef(null);
@@ -5001,8 +5196,8 @@ function CellEditor({
5001
5196
  const [bounds, setBounds] = React2.useState({ width: 0, height: 0, cellWidth: 0 });
5002
5197
  React2.useLayoutEffect(() => {
5003
5198
  const root = rootRef.current;
5004
- const anchor = _optionalChain([root, 'optionalAccess', _410 => _410.parentElement]);
5005
- const viewport = _optionalChain([root, 'optionalAccess', _411 => _411.closest, 'call', _412 => _412('[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"]')]);
5006
5201
  if (!root || !anchor || !viewport) {
5007
5202
  return;
5008
5203
  }
@@ -5059,8 +5254,8 @@ function CellEditor({
5059
5254
  const canvas = canvasRef.current;
5060
5255
  if (canvas && paintCanvasText) {
5061
5256
  const dpr = window.devicePixelRatio || 1;
5062
- const offsetX = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _413 => _413.left]), () => ( 0))) * dpr % 1 / dpr;
5063
- const offsetY = (_nullishCoalesce(_optionalChain([canvasOffset, 'optionalAccess', _414 => _414.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;
5064
5259
  const width = rootRect.width / scale;
5065
5260
  const height = rootRect.height / scale;
5066
5261
  canvas.width = Math.ceil((width + offsetX) * dpr);
@@ -5071,11 +5266,11 @@ function CellEditor({
5071
5266
  canvas.style.top = `${-offsetY}px`;
5072
5267
  const context = canvas.getContext("2d");
5073
5268
  if (context) {
5074
- const node = _optionalChain([plainTextRef, 'access', _415 => _415.current, 'optionalAccess', _416 => _416.firstChild]);
5269
+ const node = _optionalChain([plainTextRef, 'access', _435 => _435.current, 'optionalAccess', _436 => _436.firstChild]);
5075
5270
  const lines = [];
5076
5271
  if (node) {
5077
5272
  const range = document.createRange();
5078
- const length = _nullishCoalesce(_optionalChain([node, 'access', _417 => _417.textContent, 'optionalAccess', _418 => _418.length]), () => ( 0));
5273
+ const length = _nullishCoalesce(_optionalChain([node, 'access', _437 => _437.textContent, 'optionalAccess', _438 => _438.length]), () => ( 0));
5079
5274
  let start = 0;
5080
5275
  while (start < length) {
5081
5276
  range.setStart(node, start);
@@ -5189,7 +5384,7 @@ function CellEditor({
5189
5384
  onKeyDown: (event) => {
5190
5385
  event.stopPropagation();
5191
5386
  if (event.nativeEvent.isComposing) return;
5192
- if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _419 => _419()])) {
5387
+ if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _439 => _439()])) {
5193
5388
  event.preventDefault();
5194
5389
  } else if (event.key === "Enter" && !event.altKey) {
5195
5390
  event.preventDefault();
@@ -5262,6 +5457,11 @@ function getCellGeneralAlignment(worksheet, row2, col) {
5262
5457
  }
5263
5458
  }
5264
5459
 
5460
+ // src/header-size-dialog.tsx
5461
+
5462
+
5463
+
5464
+
5265
5465
  // src/context-menu.tsx
5266
5466
 
5267
5467
 
@@ -5363,18 +5563,18 @@ function copyPivot(pivot) {
5363
5563
  function usePivotTableEditor(viewer, options2 = {}) {
5364
5564
  const open = viewer.pivotFieldListVisible;
5365
5565
  const setOpen = viewer.setPivotFieldListVisible;
5366
- const [draft, setDraft] = React10.useState(null);
5367
- const [dirty, setDirty] = React10.useState(false);
5368
- const [error, setError] = React10.useState(null);
5369
- const [status, setStatus] = React10.useState(null);
5370
- const [details, setDetails] = React10.useState(null);
5371
- const [detailContext, setDetailContext] = React10.useState(null);
5372
- const [loadedSource, setLoadedSource] = React10.useState("");
5373
- const [savedDefinition, setSavedDefinition] = React10.useState("");
5374
- const [pendingFocus, setPendingFocus] = React10.useState(null);
5566
+ const [draft, setDraft] = React11.useState(null);
5567
+ const [dirty, setDirty] = React11.useState(false);
5568
+ const [error, setError] = React11.useState(null);
5569
+ const [status, setStatus] = React11.useState(null);
5570
+ const [details, setDetails] = React11.useState(null);
5571
+ const [detailContext, setDetailContext] = React11.useState(null);
5572
+ const [loadedSource, setLoadedSource] = React11.useState("");
5573
+ const [savedDefinition, setSavedDefinition] = React11.useState("");
5574
+ const [pendingFocus, setPendingFocus] = React11.useState(null);
5375
5575
  const sourceNeedsLoad = Boolean(draft && JSON.stringify(draft.source) !== loadedSource);
5376
- const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _420 => _420.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
5377
- const run = React10.useCallback((action) => {
5576
+ const stale = Boolean(dirty && _optionalChain([draft, 'optionalAccess', _440 => _440.id]) && savedDefinition !== JSON.stringify(_nullishCoalesce(viewer.pivotTables.find((pivot) => pivot.id === draft.id), () => ( null))));
5577
+ const run = React11.useCallback((action) => {
5378
5578
  setError(null);
5379
5579
  setStatus(null);
5380
5580
  try {
@@ -5384,7 +5584,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5384
5584
  setOpen(true);
5385
5585
  }
5386
5586
  }, []);
5387
- React10.useEffect(() => {
5587
+ React11.useEffect(() => {
5388
5588
  if (options2.enabled === false) return;
5389
5589
  setDraft(null);
5390
5590
  setDirty(false);
@@ -5397,8 +5597,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
5397
5597
  setPendingFocus(null);
5398
5598
  if (options2.initialOpen !== void 0) setOpen(options2.initialOpen);
5399
5599
  }, [viewer.src, viewer.file]);
5400
- React10.useEffect(() => {
5401
- if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _421 => _421.id])) return;
5600
+ React11.useEffect(() => {
5601
+ if (options2.enabled === false || dirty || !_optionalChain([draft, 'optionalAccess', _441 => _441.id])) return;
5402
5602
  const current = viewer.pivotTables.find((pivot) => pivot.id === draft.id);
5403
5603
  setDraft(current ? copyPivot(current) : null);
5404
5604
  if (current) {
@@ -5406,26 +5606,26 @@ function usePivotTableEditor(viewer, options2 = {}) {
5406
5606
  setSavedDefinition(JSON.stringify(current));
5407
5607
  }
5408
5608
  }, [viewer.pivotTables]);
5409
- React10.useEffect(() => {
5609
+ React11.useEffect(() => {
5410
5610
  if (options2.enabled === false || options2.autoSelect === false || dirty || pendingFocus || !viewer.activeCell || !viewer.activeSheet) return;
5411
5611
  const current = viewer.getPivotTableAtCell(viewer.activeCell, viewer.activeSheet.name);
5412
- if (!current || current.id === _optionalChain([draft, 'optionalAccess', _422 => _422.id])) return;
5612
+ if (!current || current.id === _optionalChain([draft, 'optionalAccess', _442 => _442.id])) return;
5413
5613
  setDraft(copyPivot(current));
5414
5614
  setLoadedSource(JSON.stringify(current.source));
5415
5615
  setSavedDefinition(JSON.stringify(current));
5416
5616
  setError(null);
5417
5617
  setStatus(null);
5418
5618
  setDetails(null);
5419
- }, [_optionalChain([viewer, 'access', _423 => _423.activeCell, 'optionalAccess', _424 => _424.row]), _optionalChain([viewer, 'access', _425 => _425.activeCell, 'optionalAccess', _426 => _426.col]), _optionalChain([viewer, 'access', _427 => _427.activeSheet, 'optionalAccess', _428 => _428.name]), viewer.pivotTables, options2.autoSelect, options2.enabled]);
5420
- React10.useEffect(() => {
5421
- if (!pendingFocus || _optionalChain([viewer, 'access', _429 => _429.activeSheet, 'optionalAccess', _430 => _430.name, 'access', _431 => _431.toLowerCase, 'call', _432 => _432()]) !== pendingFocus.sheet.toLowerCase()) return;
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]);
5620
+ React11.useEffect(() => {
5621
+ if (!pendingFocus || _optionalChain([viewer, 'access', _449 => _449.activeSheet, 'optionalAccess', _450 => _450.name, 'access', _451 => _451.toLowerCase, 'call', _452 => _452()]) !== pendingFocus.sheet.toLowerCase()) return;
5422
5622
  viewer.selectCell({ row: pendingFocus.row, col: pendingFocus.col });
5423
5623
  setPendingFocus(null);
5424
- }, [pendingFocus, _optionalChain([viewer, 'access', _433 => _433.activeSheet, 'optionalAccess', _434 => _434.name]), viewer.selectCell]);
5624
+ }, [pendingFocus, _optionalChain([viewer, 'access', _453 => _453.activeSheet, 'optionalAccess', _454 => _454.name]), viewer.selectCell]);
5425
5625
  const focus = (pivot) => {
5426
5626
  const sheetIndex = viewer.sheets.findIndex((sheet) => sheet.name.toLowerCase() === pivot.target.sheet.toLowerCase());
5427
5627
  if (sheetIndex >= 0) viewer.setActiveSheetIndex(sheetIndex);
5428
- const parsed = _chunkJCSAS3M2cjs.parseXlsxRange.call(void 0, pivot.outputRange || pivot.target.cell);
5628
+ const parsed = _chunkXZJLPW64cjs.parseXlsxRange.call(void 0, pivot.outputRange || pivot.target.cell);
5429
5629
  if (parsed) setPendingFocus({ sheet: pivot.target.sheet, ...parsed.range.start });
5430
5630
  };
5431
5631
  const select = (id) => run(() => {
@@ -5441,7 +5641,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5441
5641
  focus(pivot);
5442
5642
  });
5443
5643
  const edit = (change) => {
5444
- if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _435 => _435.unsupportedFeatures, 'access', _436 => _436.length])) return;
5644
+ if (options2.enabled === false || viewer.readOnly || _optionalChain([draft, 'optionalAccess', _455 => _455.unsupportedFeatures, 'access', _456 => _456.length])) return;
5445
5645
  setDraft((current) => current ? change(current) : current);
5446
5646
  setDirty(true);
5447
5647
  setStatus(null);
@@ -5492,7 +5692,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5492
5692
  if (!draft) return;
5493
5693
  const fields = viewer.getPivotSourceFields(draft.source);
5494
5694
  setLoadedSource(JSON.stringify(draft.source));
5495
- const sameSchema = fields.length === draft.fields.length && fields.every((field, index) => field.name === _optionalChain([draft, 'access', _437 => _437.fields, 'access', _438 => _438[index], 'optionalAccess', _439 => _439.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]));
5496
5696
  edit((pivot) => ({ ...pivot, fields, ...sameSchema ? {} : { rows: [], columns: [], values: [], filters: [], reportFilters: [], calculatedItems: [] } }));
5497
5697
  setStatus(sameSchema ? "Source fields updated." : "Fields loaded. Choose the fields to summarize.");
5498
5698
  });
@@ -5514,7 +5714,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5514
5714
  if (all) {
5515
5715
  const refreshed = viewer.refreshAllPivotTables();
5516
5716
  setStatus(`${refreshed.length} PivotTable${refreshed.length === 1 ? "" : "s"} refreshed.`);
5517
- } else if (_optionalChain([draft, 'optionalAccess', _440 => _440.id])) {
5717
+ } else if (_optionalChain([draft, 'optionalAccess', _460 => _460.id])) {
5518
5718
  const refreshed = viewer.refreshPivotTable(draft.id);
5519
5719
  setDraft(copyPivot(refreshed));
5520
5720
  setLoadedSource(JSON.stringify(refreshed.source));
@@ -5526,7 +5726,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5526
5726
  });
5527
5727
  const remove = () => run(() => {
5528
5728
  if (dirty) throw new Error("Apply or discard your changes before removing the report.");
5529
- if (!_optionalChain([draft, 'optionalAccess', _441 => _441.id])) return;
5729
+ if (!_optionalChain([draft, 'optionalAccess', _461 => _461.id])) return;
5530
5730
  if (viewer.removePivotTable(draft.id)) {
5531
5731
  setDraft(null);
5532
5732
  setDirty(false);
@@ -5535,7 +5735,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5535
5735
  }
5536
5736
  });
5537
5737
  const reset = () => run(() => {
5538
- const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _442 => _442.id]));
5738
+ const saved = viewer.pivotTables.find((pivot) => pivot.id === _optionalChain([draft, 'optionalAccess', _462 => _462.id]));
5539
5739
  setDraft(saved ? copyPivot(saved) : null);
5540
5740
  setLoadedSource(saved ? JSON.stringify(saved.source) : "");
5541
5741
  setSavedDefinition(saved ? JSON.stringify(saved) : "");
@@ -5543,8 +5743,8 @@ function usePivotTableEditor(viewer, options2 = {}) {
5543
5743
  setDetails(null);
5544
5744
  });
5545
5745
  const showDetails = () => run(() => {
5546
- if (!_optionalChain([draft, 'optionalAccess', _443 => _443.id]) || !viewer.activeCell) return;
5547
- if (_optionalChain([viewer, 'access', _444 => _444.activeSheet, 'optionalAccess', _445 => _445.name, 'access', _446 => _446.toLowerCase, 'call', _447 => _447()]) !== 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.");
5548
5748
  setDetails(viewer.pivotDrillDown(draft.id, viewer.activeCell.row, viewer.activeCell.col));
5549
5749
  setDetailContext({ id: draft.id, row: viewer.activeCell.row, col: viewer.activeCell.col });
5550
5750
  setOpen(true);
@@ -5584,7 +5784,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5584
5784
  });
5585
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) });
5586
5786
  const moveField = (fromArea, fromIndex, toArea, toIndex) => {
5587
- if (fromArea === "values" && toArea !== "values" && _optionalChain([draft, 'optionalAccess', _448 => _448.values, 'access', _449 => _449[fromIndex], 'optionalAccess', _450 => _450.formula, 'optionalAccess', _451 => _451.trim, 'call', _452 => _452()])) {
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()])) {
5588
5788
  run(() => {
5589
5789
  throw new Error("Calculated fields can only be placed in Values.");
5590
5790
  });
@@ -5592,7 +5792,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5592
5792
  }
5593
5793
  edit((pivot) => {
5594
5794
  const entry = pivot[fromArea][fromIndex];
5595
- if (entry === void 0 || fromArea === "values" && toArea !== "values" && typeof entry === "object" && "formula" in entry && _optionalChain([entry, 'access', _453 => _453.formula, 'optionalAccess', _454 => _454.trim, 'call', _455 => _455()])) 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;
5596
5796
  if (fromArea === toArea) {
5597
5797
  const entries2 = [...pivot[fromArea]];
5598
5798
  entries2.splice(fromIndex, 1);
@@ -5615,7 +5815,7 @@ function usePivotTableEditor(viewer, options2 = {}) {
5615
5815
  return { ...next, [toArea]: entries };
5616
5816
  });
5617
5817
  };
5618
- return { viewer, readOnly: viewer.readOnly || Boolean(_optionalChain([draft, 'optionalAccess', _456 => _456.unsupportedFeatures, 'access', _457 => _457.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: () => {
5619
5819
  setDetails(null);
5620
5820
  setDetailContext(null);
5621
5821
  }, sourceNeedsLoad, stale, error, status, run };
@@ -5638,16 +5838,16 @@ var row = { display: "flex", alignItems: "center", gap: 6, minWidth: 0 };
5638
5838
  var hint = { color: "var(--xlsx-pivot-muted)", fontSize: 11, lineHeight: 1.5, margin: 0 };
5639
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" };
5640
5840
  function fieldName(pivot, index) {
5641
- return _nullishCoalesce(_optionalChain([pivot, 'access', _458 => _458.fields, 'access', _459 => _459.find, 'call', _460 => _460((field) => field.index === index), 'optionalAccess', _461 => _461.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}`));
5642
5842
  }
5643
5843
  function fieldIndex(pivot, area, index) {
5644
- return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _462 => _462[area], 'access', _463 => _463[index], 'optionalAccess', _464 => _464.field]);
5844
+ return area === "reportFilters" ? pivot.reportFilters[index] : _optionalChain([pivot, 'access', _482 => _482[area], 'access', _483 => _483[index], 'optionalAccess', _484 => _484.field]);
5645
5845
  }
5646
5846
  function sourceFieldIndex(pivot, area, index) {
5647
- return area === "values" && _optionalChain([pivot, 'access', _465 => _465.values, 'access', _466 => _466[index], 'optionalAccess', _467 => _467.formula, 'optionalAccess', _468 => _468.trim, 'call', _469 => _469()]) ? 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);
5648
5848
  }
5649
5849
  function groupingUnit(axis) {
5650
- return _optionalChain([axis, 'optionalAccess', _470 => _470.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;
5651
5851
  }
5652
5852
  function Action({ children: children2, primary, style, ...props }) {
5653
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 });
@@ -5680,7 +5880,7 @@ function Section({ title, children: children2 }) {
5680
5880
  ] });
5681
5881
  }
5682
5882
  function Members({ items, selected, onChange, label = "Items" }) {
5683
- const [search, setSearch] = React11.useState("");
5883
+ const [search, setSearch] = React12.useState("");
5684
5884
  const visible = items.filter((item) => item.caption.toLocaleLowerCase().includes(search.toLocaleLowerCase()));
5685
5885
  const keys = new Set(selected);
5686
5886
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, gap: 6 }, children: [
@@ -5714,10 +5914,10 @@ function ValueSettings({ pivot, value, onChange }) {
5714
5914
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5715
5915
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: value.name, onChange: (name) => onChange({ ...value, name }) }),
5716
5916
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Summarize values by", value: value.aggregation, options: AGGREGATIONS, onChange: (aggregation) => onChange({ ...value, aggregation }) }),
5717
- /* @__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', _471 => _471[0], 'optionalAccess', _472 => _472.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]))) }) }),
5718
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,
5719
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,
5720
- needsItem ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Base item", value: _nullishCoalesce(value.baseItem, () => ( "previous")), options: [["previous", "(previous)"], ["next", "(next)"], ...(_optionalChain([base, 'optionalAccess', _473 => _473.items, 'optionalAccess', _474 => _474.length]) ? base.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _475 => _475.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,
5721
5921
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Number format", value: _nullishCoalesce(value.numberFormat, () => ( "")), placeholder: "General", onChange: (numberFormat) => onChange({ ...value, numberFormat: numberFormat || null }) }),
5722
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 }) }),
5723
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." }),
@@ -5728,20 +5928,20 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
5728
5928
  const source = pivot.fields.find((field) => field.index === axis.field);
5729
5929
  const grouping = axis.grouping;
5730
5930
  const updateGrouping = (patch) => onChange({ ...axis, grouping: { ...grouping, ...patch }, items: [], collapsed: [] });
5731
- const availableUnits = DATE_UNITS.filter((unit) => ![...pivot.rows, ...pivot.columns].some((field) => field.field === axis.field && _optionalChain([field, 'access', _476 => _476.grouping, 'optionalAccess', _477 => _477.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));
5732
5932
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5733
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Text, { label: "Custom name", value: _nullishCoalesce(axis.name, () => ( "")), placeholder: _optionalChain([source, 'optionalAccess', _478 => _478.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 }) }),
5734
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)) }) }),
5735
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,
5736
5936
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show subtotals", checked: axis.subtotals, onChange: (subtotals) => onChange({ ...axis, subtotals }) }),
5737
5937
  axis.subtotals ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
5738
5938
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Custom subtotal functions" }),
5739
- /* @__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', _479 => _479.subtotalFunctions, 'optionalAccess', _480 => _480.includes, 'call', _481 => _481(value)]), () => ( false)), onChange: (checked) => onChange({ ...axis, subtotalFunctions: checked ? [..._nullishCoalesce(axis.subtotalFunctions, () => ( [])), value] : _optionalChain([axis, 'access', _482 => _482.subtotalFunctions, 'optionalAccess', _483 => _483.filter, 'call', _484 => _484((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)) }),
5740
5940
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Leave unchecked to use the value field\u2019s summary function." })
5741
5941
  ] }) : null,
5742
5942
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Check, { label: "Show items with no data", checked: _nullishCoalesce(axis.showItemsWithNoData, () => ( false)), onChange: (showItemsWithNoData) => onChange({ ...axis, showItemsWithNoData }) }),
5743
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Choice, { label: "Grouping", value: _nullishCoalesce(_optionalChain([grouping, 'optionalAccess', _485 => _485.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: [] }) }),
5744
- _optionalChain([grouping, 'optionalAccess', _486 => _486.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,
5745
5945
  grouping && grouping.kind !== "manual" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
5746
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) }) }),
5747
5947
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 8 }, children: [
@@ -5750,18 +5950,18 @@ function AxisSettings({ pivot, axis, onChange, onAddDateLevel }) {
5750
5950
  ] }),
5751
5951
  grouping.kind === "date" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { style: hint, children: "Optional bounds use Excel date serial values." }) : null
5752
5952
  ] }) : null,
5753
- _optionalChain([grouping, 'optionalAccess', _487 => _487.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,
5754
- _optionalChain([grouping, 'optionalAccess', _488 => _488.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: [
5755
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: [
5756
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) }) }),
5757
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: _nullishCoalesce(_optionalChain([source, 'optionalAccess', _489 => _489.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) }) }),
5758
5958
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: grouping.groups.filter((_, position) => position !== index) }), children: "Remove group" })
5759
5959
  ] }, index)),
5760
5960
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => updateGrouping({ groups: [...grouping.groups, { name: `Group ${grouping.groups.length + 1}`, members: [] }] }), children: "Add named group" })
5761
5961
  ] }) : null,
5762
5962
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "details", { children: [
5763
5963
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "summary", { style: { cursor: "pointer" }, children: "Collapse members" }),
5764
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { paddingTop: 8 }, children: grouping && !_optionalChain([axis, 'access', _490 => _490.items, 'optionalAccess', _491 => _491.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', _492 => _492.items, 'optionalAccess', _493 => _493.length]) ? axis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _494 => _494.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 }) }) })
5765
5965
  ] })
5766
5966
  ] });
5767
5967
  }
@@ -5769,7 +5969,7 @@ function FieldFilters({ editor, pivot, field, axis }) {
5769
5969
  const source = pivot.fields.find((item) => item.index === field);
5770
5970
  const filterAxis = _nullishCoalesce(axis, () => ( [...pivot.rows, ...pivot.columns].find((item) => item.field === field && item.grouping)));
5771
5971
  const unit = groupingUnit(filterAxis);
5772
- const members = _optionalChain([filterAxis, 'optionalAccess', _495 => _495.items, 'optionalAccess', _496 => _496.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _497 => _497.items]), () => ( []));
5972
+ const members = _optionalChain([filterAxis, 'optionalAccess', _515 => _515.items, 'optionalAccess', _516 => _516.length]) ? filterAxis.items : _nullishCoalesce(_optionalChain([source, 'optionalAccess', _517 => _517.items]), () => ( []));
5773
5973
  const filters = pivot.filters.map((filter, index) => ({ filter, index })).filter(({ filter }) => filter.field === field && (_nullishCoalesce(filter.groupingUnit, () => ( null))) === unit);
5774
5974
  const kinds = [["members", "Select items"], ["label", "Label filter"], ["value", "Value filter"], ["top10", "Top / bottom filter"]];
5775
5975
  const update = (index, next) => editor.edit((current) => ({ ...current, filters: current.filters.flatMap((filter, position) => position === index ? next ? [next] : [] : [filter]) }));
@@ -5778,10 +5978,10 @@ function FieldFilters({ editor, pivot, field, axis }) {
5778
5978
  "Field filters",
5779
5979
  unit ? ` \xB7 ${unit}` : ""
5780
5980
  ] }),
5781
- _optionalChain([filterAxis, 'optionalAccess', _498 => _498.grouping]) && !_optionalChain([filterAxis, 'access', _499 => _499.items, 'optionalAccess', _500 => _500.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,
5782
5982
  filters.map(({ filter, index }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, paddingBlock: 8, borderTop: "1px solid var(--xlsx-pivot-border)" }, children: [
5783
5983
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, justifyContent: "space-between" }, children: [
5784
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: _optionalChain([kinds, 'access', _501 => _501.find, 'call', _502 => _502(([kind]) => kind === filter.kind), 'optionalAccess', _503 => _503[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]]) }),
5785
5985
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { "aria-label": `Remove ${filter.kind} filter`, onClick: () => update(index, null), children: "\xD7" })
5786
5986
  ] }),
5787
5987
  filter.kind === "members" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Members, { items: members, selected: filter.values, onChange: (values) => update(index, { ...filter, values }) }) : null,
@@ -5801,13 +6001,13 @@ function FieldFilters({ editor, pivot, field, axis }) {
5801
6001
  ] });
5802
6002
  }
5803
6003
  function Advanced({ editor, pivot }) {
5804
- const [chartType, setChartType] = React11.useState("ColumnClustered");
5805
- const [chartCell, setChartCell] = React11.useState("I2");
5806
- const [chartTitle, setChartTitle] = React11.useState("");
5807
- const [chartMeasure, setChartMeasure] = React11.useState("");
5808
- const [chartSheet, setChartSheet] = React11.useState("");
5809
- const [chartWidth, setChartWidth] = React11.useState("560");
5810
- const [chartHeight, setChartHeight] = React11.useState("340");
6004
+ const [chartType, setChartType] = React12.useState("ColumnClustered");
6005
+ const [chartCell, setChartCell] = React12.useState("I2");
6006
+ const [chartTitle, setChartTitle] = React12.useState("");
6007
+ const [chartMeasure, setChartMeasure] = React12.useState("");
6008
+ const [chartSheet, setChartSheet] = React12.useState("");
6009
+ const [chartWidth, setChartWidth] = React12.useState("560");
6010
+ const [chartHeight, setChartHeight] = React12.useState("340");
5811
6011
  const update = (patch) => editor.edit((current) => ({ ...current, ...patch }));
5812
6012
  const sheets = editor.viewer.sheets.map((sheet) => [sheet.name, sheet.name]);
5813
6013
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
@@ -5841,10 +6041,10 @@ function Advanced({ editor, pivot }) {
5841
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) }) }),
5842
6042
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { onClick: () => update({ calculatedItems: pivot.calculatedItems.filter((_, position) => position !== index) }), children: "Remove calculated item" })
5843
6043
  ] }, index)),
5844
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: !pivot.fields.length, onClick: () => update({ calculatedItems: [...pivot.calculatedItems, { field: _nullishCoalesce(_optionalChain([pivot, 'access', _504 => _504.rows, 'access', _505 => _505[0], 'optionalAccess', _506 => _506.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" })
5845
6045
  ] }),
5846
6046
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Section, { title: "PivotChart", children: [
5847
- _optionalChain([pivot, 'access', _507 => _507.charts, 'optionalAccess', _508 => _508.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: [
5848
6048
  pivot.charts.length,
5849
6049
  " linked chart",
5850
6050
  pivot.charts.length === 1 ? "" : "s",
@@ -5868,22 +6068,22 @@ function Advanced({ editor, pivot }) {
5868
6068
  ] });
5869
6069
  }
5870
6070
  function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, style }) {
5871
- const paneRef = React11.useRef(null);
5872
- const [placement, setPlacement] = React11.useState({ overlay: false, top: 0, width: 324 });
5873
- const [search, setSearch] = React11.useState("");
5874
- const [selected, setSelected] = React11.useState(null);
5875
- const [dragOver, setDragOver] = React11.useState(null);
5876
- const [announcement, setAnnouncement] = React11.useState("");
5877
- const titleId = React11.useId();
5878
- const settingsId = React11.useId();
6071
+ const paneRef = React12.useRef(null);
6072
+ const [placement, setPlacement] = React12.useState({ overlay: false, top: 0, width: 324 });
6073
+ const [search, setSearch] = React12.useState("");
6074
+ const [selected, setSelected] = React12.useState(null);
6075
+ const [dragOver, setDragOver] = React12.useState(null);
6076
+ const [announcement, setAnnouncement] = React12.useState("");
6077
+ const titleId = React12.useId();
6078
+ const settingsId = React12.useId();
5879
6079
  const pivot = editor.draft;
5880
- const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _509 => _509.unsupportedFeatures, 'access', _510 => _510.length])) || editor.sourceNeedsLoad;
5881
- React11.useEffect(() => {
6080
+ const disabled = editor.readOnly || Boolean(_optionalChain([pivot, 'optionalAccess', _529 => _529.unsupportedFeatures, 'access', _530 => _530.length])) || editor.sourceNeedsLoad;
6081
+ React12.useEffect(() => {
5882
6082
  setSelected(null);
5883
6083
  setSearch("");
5884
- }, [_optionalChain([pivot, 'optionalAccess', _511 => _511.id])]);
5885
- React11.useEffect(() => {
5886
- const parent = _optionalChain([paneRef, 'access', _512 => _512.current, 'optionalAccess', _513 => _513.parentElement]);
6084
+ }, [_optionalChain([pivot, 'optionalAccess', _531 => _531.id])]);
6085
+ React12.useEffect(() => {
6086
+ const parent = _optionalChain([paneRef, 'access', _532 => _532.current, 'optionalAccess', _533 => _533.parentElement]);
5887
6087
  if (!parent) return;
5888
6088
  const viewer = parent.closest(".react-xlsx-viewer");
5889
6089
  const measure = () => {
@@ -5893,16 +6093,16 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5893
6093
  };
5894
6094
  measure();
5895
6095
  const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
5896
- _optionalChain([observer, 'optionalAccess', _514 => _514.observe, 'call', _515 => _515(parent)]);
5897
- if (viewer) _optionalChain([observer, 'optionalAccess', _516 => _516.observe, 'call', _517 => _517(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)]);
5898
6098
  window.addEventListener("resize", measure);
5899
6099
  return () => {
5900
- _optionalChain([observer, 'optionalAccess', _518 => _518.disconnect, 'call', _519 => _519()]);
6100
+ _optionalChain([observer, 'optionalAccess', _538 => _538.disconnect, 'call', _539 => _539()]);
5901
6101
  window.removeEventListener("resize", measure);
5902
6102
  };
5903
6103
  }, []);
5904
6104
  const selectedField = pivot && selected ? fieldIndex(pivot, selected.area, selected.index) : void 0;
5905
- const selectedCalculated = Boolean(pivot && _optionalChain([selected, 'optionalAccess', _520 => _520.area]) === "values" && _optionalChain([pivot, 'access', _521 => _521.values, 'access', _522 => _522[selected.index], 'optionalAccess', _523 => _523.formula, 'optionalAccess', _524 => _524.trim, 'call', _525 => _525()]));
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()]));
5906
6106
  const theme = {
5907
6107
  "--xlsx-pivot-bg": isDark ? "#242729" : "#fafbfa",
5908
6108
  "--xlsx-pivot-input": isDark ? "#303437" : "#ffffff",
@@ -5912,7 +6112,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5912
6112
  "--xlsx-pivot-hover": isDark ? "#35483d" : "#edf5ef"
5913
6113
  };
5914
6114
  const move = (from, to, index) => {
5915
- if (from.area === "values" && to !== "values" && _optionalChain([pivot, 'optionalAccess', _526 => _526.values, 'access', _527 => _527[from.index], 'optionalAccess', _528 => _528.formula, 'optionalAccess', _529 => _529.trim, 'call', _530 => _530()])) {
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()])) {
5916
6116
  setAnnouncement("Calculated fields stay in the Values area.");
5917
6117
  return;
5918
6118
  }
@@ -5927,7 +6127,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5927
6127
  if (disabled) return;
5928
6128
  try {
5929
6129
  const data = JSON.parse(event.dataTransfer.getData(DRAG_TYPE));
5930
- if ("field" in data && Number.isInteger(data.field) && _optionalChain([pivot, 'optionalAccess', _531 => _531.fields, 'access', _532 => _532.some, 'call', _533 => _533((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)])) {
5931
6131
  editor.addField(area, data.field);
5932
6132
  setAnnouncement(`Field added to ${AREA_NAMES[area]}.`);
5933
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);
@@ -5947,14 +6147,14 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5947
6147
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { overflowY: "auto", flex: 1, minHeight: 0 }, children: [
5948
6148
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...stack, padding: 12 }, children: [
5949
6149
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { ...row, alignItems: "end" }, children: [
5950
- /* @__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', _534 => _534.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 }) }),
5951
6151
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Action, { disabled: editor.viewer.readOnly || editor.dirty, onClick: editor.create, children: "New" })
5952
6152
  ] }),
5953
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,
5954
6154
  editor.status ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { role: "status", style: hint, children: editor.status }) : null,
5955
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,
5956
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,
5957
- _optionalChain([pivot, 'optionalAccess', _535 => _535.unsupportedFeatures, 'access', _536 => _536.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: [
5958
6158
  "This PivotTable is preserved for Excel. Editing is unavailable for: ",
5959
6159
  pivot.unsupportedFeatures.join(", "),
5960
6160
  "."
@@ -5996,7 +6196,7 @@ function DefaultXlsxPivotTableFieldList({ editor, isDark = false, className, sty
5996
6196
  pivot[area].map((_, index) => {
5997
6197
  const field = fieldIndex(pivot, area, index);
5998
6198
  const name = area === "values" ? pivot.values[index].name : area === "reportFilters" ? fieldName(pivot, field) : pivot[area][index].name || fieldName(pivot, field);
5999
- const active = _optionalChain([selected, 'optionalAccess', _537 => _537.area]) === area && selected.index === index;
6199
+ const active = _optionalChain([selected, 'optionalAccess', _557 => _557.area]) === area && selected.index === index;
6000
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) => {
6001
6201
  if (!event.altKey || !["ArrowUp", "ArrowDown"].includes(event.key)) return;
6002
6202
  event.preventDefault();
@@ -6112,7 +6312,7 @@ function createChartModule(importModule) {
6112
6312
  };
6113
6313
  }
6114
6314
  var officeChartRenderer = createChartModule(async () => {
6115
- const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-N44DT2QV.cjs")));
6315
+ const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-7E6KMGTG.cjs")));
6116
6316
  return { renderer: null, SharedChartSvg };
6117
6317
  });
6118
6318
 
@@ -6143,7 +6343,7 @@ var DEFAULT_COL_WIDTH2 = 80;
6143
6343
  var MAX_AUTOFIT_ROW_HEIGHT_PX = 409 * (4 / 3);
6144
6344
  var HEADER_HEIGHT = 24;
6145
6345
  var ROW_HEADER_WIDTH = 40;
6146
- var CANVAS_RESIZE_HIT_SLOP_PX = 8;
6346
+ var HEADER_RESIZE_HANDLE_PX = 8;
6147
6347
  var CANVAS_VIEWPORT_OVERSCAN_PX = 480;
6148
6348
  var CANVAS_SCROLL_BUFFER_PX = 480;
6149
6349
  var CANVAS_DEFERRED_VIEWPORT_SYNC_THRESHOLD_PX = CANVAS_SCROLL_BUFFER_PX - 96;
@@ -6656,7 +6856,7 @@ function parseCanvasGradientStops(value) {
6656
6856
  if (!match) {
6657
6857
  return null;
6658
6858
  }
6659
- const color = _optionalChain([match, 'access', _538 => _538[1], 'optionalAccess', _539 => _539.trim, 'call', _540 => _540()]);
6859
+ const color = _optionalChain([match, 'access', _558 => _558[1], 'optionalAccess', _559 => _559.trim, 'call', _560 => _560()]);
6660
6860
  const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
6661
6861
  if (!color) {
6662
6862
  return null;
@@ -6672,7 +6872,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
6672
6872
  if (linearMatch) {
6673
6873
  const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
6674
6874
  if (parts.length >= 2) {
6675
- const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _541 => _541[0], 'optionalAccess', _542 => _542.trim, 'call', _543 => _543()]), () => ( "180deg"));
6875
+ const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _561 => _561[0], 'optionalAccess', _562 => _562.trim, 'call', _563 => _563()]), () => ( "180deg"));
6676
6876
  const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
6677
6877
  const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
6678
6878
  const radians = (90 - cssAngle) * Math.PI / 180;
@@ -6702,7 +6902,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
6702
6902
  const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
6703
6903
  if (radialMatch) {
6704
6904
  const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
6705
- const stopParts = _optionalChain([parts, 'access', _544 => _544[0], 'optionalAccess', _545 => _545.startsWith, 'call', _546 => _546("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;
6706
6906
  const gradient = context.createRadialGradient(
6707
6907
  rect.left + rect.width / 2,
6708
6908
  rect.top + rect.height / 2,
@@ -6811,8 +7011,8 @@ function lightenColor(color, ratio) {
6811
7011
  function darkenColor(color, ratio) {
6812
7012
  return mixRgbColor(color, "#000000", ratio);
6813
7013
  }
6814
- var ViewerContext = React14.createContext(null);
6815
- var ViewerAppearanceContext = React14.createContext({ isDark: false });
7014
+ var ViewerContext = React15.createContext(null);
7015
+ var ViewerAppearanceContext = React15.createContext({ isDark: false });
6816
7016
  function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
6817
7017
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: [top && "top", bottom && "bottom"].flatMap((vertical) => vertical ? [left && "left", right && "right"].map((horizontal) => horizontal ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
6818
7018
  position: "absolute",
@@ -6828,7 +7028,7 @@ function resolveDarkModeSurface(themePalette, palette) {
6828
7028
  return "hsl(225 4% 6%)";
6829
7029
  }
6830
7030
  function resolveSheetSurface(sheet, palette) {
6831
- return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _547 => _547.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _548 => _548.themePalette, 'access', _549 => _549.colorsByIndex, 'access', _550 => _550[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));
6832
7032
  }
6833
7033
  function normalizeRange2(range) {
6834
7034
  return {
@@ -6856,23 +7056,10 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
6856
7056
  if (displayLimit <= 0) {
6857
7057
  return [];
6858
7058
  }
6859
- if (precomputed.length === 0) {
6860
- const visible2 = [];
6861
- const usedLimit = Math.min(displayLimit, Math.max(0, maxUsedIndex + 1));
6862
- for (let index = 0; index < usedLimit; index += 1) {
6863
- if (!_optionalChain([hiddenIndices, 'optionalAccess', _551 => _551.has, 'call', _552 => _552(index)])) {
6864
- visible2.push(index);
6865
- }
6866
- }
6867
- for (let index = usedLimit; index < displayLimit; index += 1) {
6868
- visible2.push(index);
6869
- }
6870
- return visible2;
6871
- }
6872
- const visible = precomputed.filter((value) => value < displayLimit);
6873
- const appendStart = Math.max(0, maxUsedIndex + 1);
6874
- for (let index = appendStart; index < displayLimit; index += 1) {
6875
- visible.push(index);
7059
+ const visible = precomputed.filter((index) => index < displayLimit);
7060
+ const appendStart = precomputed.length ? Math.max(0, maxUsedIndex + 1) : 0;
7061
+ for (let index = appendStart; index < displayLimit; index++) {
7062
+ if (!_optionalChain([hiddenIndices, 'optionalAccess', _571 => _571.has, 'call', _572 => _572(index)])) visible.push(index);
6876
7063
  }
6877
7064
  return visible;
6878
7065
  }
@@ -6905,7 +7092,7 @@ function clampPercent(value, fallback) {
6905
7092
  return Math.max(0, Math.min(100, value));
6906
7093
  }
6907
7094
  function resolveShapeAdjustment(shape, name, fallback) {
6908
- const rawValue = _optionalChain([shape, 'access', _553 => _553.geometryAdjustments, 'optionalAccess', _554 => _554[name]]);
7095
+ const rawValue = _optionalChain([shape, 'access', _573 => _573.geometryAdjustments, 'optionalAccess', _574 => _574[name]]);
6909
7096
  if (typeof rawValue !== "number") {
6910
7097
  return fallback;
6911
7098
  }
@@ -7791,7 +7978,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
7791
7978
  }
7792
7979
  }
7793
7980
  function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
7794
- return React14.useMemo(
7981
+ return React15.useMemo(
7795
7982
  () => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
7796
7983
  [headerBackgroundColor, headerTextColor, isDark]
7797
7984
  );
@@ -7805,8 +7992,8 @@ function normalizeThumbnailResolution(resolution) {
7805
7992
  }
7806
7993
  const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
7807
7994
  return {
7808
- maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _555 => _555.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
7809
- maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _556 => _556.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
7810
7997
  };
7811
7998
  }
7812
7999
  function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
@@ -7904,7 +8091,7 @@ function resolveThumbnailAxisMarkerOffset({
7904
8091
  offsetEmu,
7905
8092
  previewStartActualIndex
7906
8093
  }) {
7907
- return resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, actualIndex) - resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, previewStartActualIndex) + _chunkJCSAS3M2cjs.emuToPixels.call(void 0, offsetEmu);
8094
+ return resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, actualIndex) - resolveThumbnailAxisAbsoluteOffset(actualIndices, getSizePx, previewStartActualIndex) + _chunkXZJLPW64cjs.emuToPixels.call(void 0, offsetEmu);
7908
8095
  }
7909
8096
  function resolveThumbnailAnchoredRect(anchor, visibleRows, visibleCols, getRowHeightPx, getColWidthPx, previewRows, previewCols, options2) {
7910
8097
  const previewStartRow = _nullishCoalesce(previewRows[0], () => ( 0));
@@ -7927,18 +8114,18 @@ function resolveThumbnailAnchoredRect(anchor, visibleRows, visibleCols, getRowHe
7927
8114
  });
7928
8115
  if (anchor.kind === "absolute") {
7929
8116
  return {
7930
- height: Math.max(1, _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
7931
- left: options2.rowHeaderWidth + _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.positionEmu.x) - previewOriginX,
7932
- top: options2.headerHeight + _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.positionEmu.y) - previewOriginY,
7933
- width: Math.max(1, _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
8117
+ height: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
8118
+ left: options2.rowHeaderWidth + _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.positionEmu.x) - previewOriginX,
8119
+ top: options2.headerHeight + _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.positionEmu.y) - previewOriginY,
8120
+ width: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
7934
8121
  };
7935
8122
  }
7936
8123
  if (anchor.kind === "one-cell") {
7937
8124
  return {
7938
- height: Math.max(1, _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
8125
+ height: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cy)),
7939
8126
  left: resolveMarkerLeft(anchor.from.col, anchor.from.colOffsetEmu),
7940
8127
  top: resolveMarkerTop(anchor.from.row, anchor.from.rowOffsetEmu),
7941
- width: Math.max(1, _chunkJCSAS3M2cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
8128
+ width: Math.max(1, _chunkXZJLPW64cjs.emuToPixels.call(void 0, anchor.sizeEmu.cx))
7942
8129
  };
7943
8130
  }
7944
8131
  const left = resolveMarkerLeft(anchor.from.col, anchor.from.colOffsetEmu);
@@ -7993,7 +8180,7 @@ function decodeHtmlEntities2(value) {
7993
8180
  return value.replace(/&quot;/g, '"').replace(/&#34;/g, '"').replace(/&apos;/g, "'").replace(/&#39;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
7994
8181
  }
7995
8182
  function mapBorder2(edge, themePalette) {
7996
- const color = _nullishCoalesce(_chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, edge.color, themePalette), () => ( "#000"));
8183
+ const color = _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, edge.color, themePalette), () => ( "#000"));
7997
8184
  const widthMap = {
7998
8185
  dashed: "1px",
7999
8186
  dotted: "1px",
@@ -8125,24 +8312,24 @@ function escapeCssFontFamily(name) {
8125
8312
  return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
8126
8313
  }
8127
8314
  function resolveSpreadsheetThemeFont(font, themePalette) {
8128
- const scheme = typeof _optionalChain([font, 'optionalAccess', _557 => _557.scheme]) === "string" ? font.scheme : null;
8315
+ const scheme = typeof _optionalChain([font, 'optionalAccess', _577 => _577.scheme]) === "string" ? font.scheme : null;
8129
8316
  if (scheme === "major") {
8130
- return _optionalChain([themePalette, 'optionalAccess', _558 => _558.majorLatinFont]);
8317
+ return _optionalChain([themePalette, 'optionalAccess', _578 => _578.majorLatinFont]);
8131
8318
  }
8132
8319
  if (scheme === "minor") {
8133
- return _optionalChain([themePalette, 'optionalAccess', _559 => _559.minorLatinFont]);
8320
+ return _optionalChain([themePalette, 'optionalAccess', _579 => _579.minorLatinFont]);
8134
8321
  }
8135
8322
  return void 0;
8136
8323
  }
8137
8324
  function buildSpreadsheetFontFamily(font, themePalette) {
8138
8325
  const candidates = [
8139
- typeof _optionalChain([font, 'optionalAccess', _560 => _560.name]) === "string" ? font.name.trim() : "",
8140
- _nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _561 => _561(font, themePalette), 'optionalAccess', _562 => _562.trim, 'call', _563 => _563()]), () => ( ""))
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()]), () => ( ""))
8141
8328
  ].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
8142
8329
  if (candidates.length === 0) {
8143
8330
  return void 0;
8144
8331
  }
8145
- const primaryFont = _optionalChain([candidates, 'access', _564 => _564[0], 'optionalAccess', _565 => _565.toLowerCase, 'call', _566 => _566()]);
8332
+ const primaryFont = _optionalChain([candidates, 'access', _584 => _584[0], 'optionalAccess', _585 => _585.toLowerCase, 'call', _586 => _586()]);
8146
8333
  if (primaryFont === "calibri") {
8147
8334
  return [
8148
8335
  "Calibri",
@@ -8175,17 +8362,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
8175
8362
  }
8176
8363
  function buildGridlineShadow(color, options2) {
8177
8364
  const parts = [];
8178
- if (_optionalChain([options2, 'optionalAccess', _567 => _567.right]) !== false) {
8365
+ if (_optionalChain([options2, 'optionalAccess', _587 => _587.right]) !== false) {
8179
8366
  parts.push(`inset -1px 0 0 ${color}`);
8180
8367
  }
8181
- if (_optionalChain([options2, 'optionalAccess', _568 => _568.bottom]) !== false) {
8368
+ if (_optionalChain([options2, 'optionalAccess', _588 => _588.bottom]) !== false) {
8182
8369
  parts.push(`inset 0 -1px 0 ${color}`);
8183
8370
  }
8184
8371
  return parts.join(", ");
8185
8372
  }
8186
8373
  function buildCellStyle(style, palette, themePalette, options2) {
8187
- const showGridLines = _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _569 => _569.showGridLines]), () => ( true));
8188
- const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _570 => _570.colorsByIndex, 'access', _571 => _571[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));
8189
8376
  const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
8190
8377
  const css = {
8191
8378
  backgroundColor: baseSurface,
@@ -8198,7 +8385,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
8198
8385
  lineHeight: String(resolveSpreadsheetLineHeight(11)),
8199
8386
  overflow: "hidden",
8200
8387
  padding: DEFAULT_CELL_PADDING,
8201
- textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _572 => _572.generalAlignment]), () => ( "left")),
8388
+ textAlign: _nullishCoalesce(_optionalChain([options2, 'optionalAccess', _592 => _592.generalAlignment]), () => ( "left")),
8202
8389
  textOverflow: "clip",
8203
8390
  verticalAlign: "bottom",
8204
8391
  whiteSpace: "nowrap"
@@ -8210,7 +8397,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
8210
8397
  let resolvedFillColor = null;
8211
8398
  let hasExplicitFill = false;
8212
8399
  if (fill) {
8213
- const fillStyle = _chunkJCSAS3M2cjs.resolveWorkbookFillStyle.call(void 0, fill, themePalette);
8400
+ const fillStyle = _chunkXZJLPW64cjs.resolveWorkbookFillStyle.call(void 0, fill, themePalette);
8214
8401
  if (fillStyle.backgroundColor || fillStyle.backgroundImage) {
8215
8402
  hasExplicitFill = true;
8216
8403
  resolvedFillColor = fillStyle.backgroundColor;
@@ -8238,7 +8425,7 @@ function buildCellStyle(style, palette, themePalette, options2) {
8238
8425
  if (font.strikethrough) {
8239
8426
  css.textDecoration = `${_nullishCoalesce(css.textDecoration, () => ( ""))} line-through`.trim();
8240
8427
  }
8241
- const fontColor = _chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, font.color, themePalette);
8428
+ const fontColor = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, themePalette);
8242
8429
  if (fontColor) {
8243
8430
  resolvedFontColor = fontColor;
8244
8431
  css.color = fontColor;
@@ -8282,24 +8469,24 @@ function buildCellStyle(style, palette, themePalette, options2) {
8282
8469
  }
8283
8470
  const border = style.border;
8284
8471
  if (border) {
8285
- const hasRightBorder = Boolean(_optionalChain([border, 'access', _573 => _573.right, 'optionalAccess', _574 => _574.style]) && border.right.style !== "none");
8286
- const hasBottomBorder = Boolean(_optionalChain([border, 'access', _575 => _575.bottom, 'optionalAccess', _576 => _576.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");
8287
8474
  if (showGridLines && (hasRightBorder || hasBottomBorder)) {
8288
8475
  css.boxShadow = buildGridlineShadow(palette.border, {
8289
8476
  bottom: !hasBottomBorder,
8290
8477
  right: !hasRightBorder
8291
8478
  }) || void 0;
8292
8479
  }
8293
- if (_optionalChain([border, 'access', _577 => _577.top, 'optionalAccess', _578 => _578.style]) && border.top.style !== "none") {
8480
+ if (_optionalChain([border, 'access', _597 => _597.top, 'optionalAccess', _598 => _598.style]) && border.top.style !== "none") {
8294
8481
  css.borderTop = mapBorder2(border.top, themePalette);
8295
8482
  }
8296
- if (_optionalChain([border, 'access', _579 => _579.right, 'optionalAccess', _580 => _580.style]) && border.right.style !== "none") {
8483
+ if (_optionalChain([border, 'access', _599 => _599.right, 'optionalAccess', _600 => _600.style]) && border.right.style !== "none") {
8297
8484
  css.borderRight = mapBorder2(border.right, themePalette);
8298
8485
  }
8299
- if (_optionalChain([border, 'access', _581 => _581.bottom, 'optionalAccess', _582 => _582.style]) && border.bottom.style !== "none") {
8486
+ if (_optionalChain([border, 'access', _601 => _601.bottom, 'optionalAccess', _602 => _602.style]) && border.bottom.style !== "none") {
8300
8487
  css.borderBottom = mapBorder2(border.bottom, themePalette);
8301
8488
  }
8302
- if (_optionalChain([border, 'access', _583 => _583.left, 'optionalAccess', _584 => _584.style]) && border.left.style !== "none") {
8489
+ if (_optionalChain([border, 'access', _603 => _603.left, 'optionalAccess', _604 => _604.style]) && border.left.style !== "none") {
8303
8490
  css.borderLeft = mapBorder2(border.left, themePalette);
8304
8491
  }
8305
8492
  }
@@ -8345,10 +8532,10 @@ function measureTextWidth(value, style) {
8345
8532
  }
8346
8533
  function getCellDisplayValue(worksheet, row2, col, activeSheet, locale = "en-US") {
8347
8534
  const formula = worksheet.getFormulaAt(row2, col);
8348
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _585 => _585.cachedFormulaValues, 'optionalAccess', _586 => _586[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;
8349
8536
  const formatted = worksheet.getFormattedValueAt(row2, col);
8350
8537
  if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
8351
- return _chunkJCSAS3M2cjs.localizeCellNumber.call(void 0, worksheet, row2, col, decodeHtmlEntities2(formatted), locale);
8538
+ return _chunkXZJLPW64cjs.localizeCellNumber.call(void 0, worksheet, row2, col, decodeHtmlEntities2(formatted), locale);
8352
8539
  }
8353
8540
  const cellValue = worksheet.getCalculatedValueAt(row2, col);
8354
8541
  if (formula && cachedFormulaValue !== void 0 && cellValue.is_error) {
@@ -8592,7 +8779,7 @@ function normalizeBatchedMergeSpan(value) {
8592
8779
  }
8593
8780
  function normalizeBatchedCellValue(rawValue, formula, row2, col, activeSheet) {
8594
8781
  const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
8595
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _587 => _587.cachedFormulaValues, 'optionalAccess', _588 => _588[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;
8596
8783
  if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
8597
8784
  return cachedFormulaValue;
8598
8785
  }
@@ -8640,31 +8827,31 @@ function mergeResolvedCellStyle(base, overlay, options2) {
8640
8827
  ..._nullishCoalesce(base, () => ( {})),
8641
8828
  ..._nullishCoalesce(overlay, () => ( {}))
8642
8829
  };
8643
- const baseAlignment = _optionalChain([base, 'optionalAccess', _589 => _589.alignment]);
8644
- const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _590 => _590.alignment]);
8830
+ const baseAlignment = _optionalChain([base, 'optionalAccess', _609 => _609.alignment]);
8831
+ const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _610 => _610.alignment]);
8645
8832
  if (baseAlignment || overlayAlignment) {
8646
8833
  nextStyle.alignment = {
8647
8834
  ..._nullishCoalesce(baseAlignment, () => ( {})),
8648
8835
  ..._nullishCoalesce(overlayAlignment, () => ( {}))
8649
8836
  };
8650
8837
  }
8651
- const baseBorder = _optionalChain([base, 'optionalAccess', _591 => _591.border]);
8652
- const overlayBorder = _optionalChain([overlay, 'optionalAccess', _592 => _592.border]);
8838
+ const baseBorder = _optionalChain([base, 'optionalAccess', _611 => _611.border]);
8839
+ const overlayBorder = _optionalChain([overlay, 'optionalAccess', _612 => _612.border]);
8653
8840
  if (baseBorder || overlayBorder) {
8654
- nextStyle.border = _optionalChain([options2, 'optionalAccess', _593 => _593.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
8841
+ nextStyle.border = _optionalChain([options2, 'optionalAccess', _613 => _613.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
8655
8842
  ..._nullishCoalesce(baseBorder, () => ( {})),
8656
8843
  ..._nullishCoalesce(overlayBorder, () => ( {}))
8657
8844
  };
8658
8845
  }
8659
- const baseFill = _optionalChain([base, 'optionalAccess', _594 => _594.fill]);
8660
- const overlayFill = _optionalChain([overlay, 'optionalAccess', _595 => _595.fill]);
8846
+ const baseFill = _optionalChain([base, 'optionalAccess', _614 => _614.fill]);
8847
+ const overlayFill = _optionalChain([overlay, 'optionalAccess', _615 => _615.fill]);
8661
8848
  if (baseFill || overlayFill) {
8662
- nextStyle.fill = _optionalChain([options2, 'optionalAccess', _596 => _596.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
8849
+ nextStyle.fill = _optionalChain([options2, 'optionalAccess', _616 => _616.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
8663
8850
  }
8664
- const baseFont = _optionalChain([base, 'optionalAccess', _597 => _597.font]);
8665
- const overlayFont = _optionalChain([overlay, 'optionalAccess', _598 => _598.font]);
8851
+ const baseFont = _optionalChain([base, 'optionalAccess', _617 => _617.font]);
8852
+ const overlayFont = _optionalChain([overlay, 'optionalAccess', _618 => _618.font]);
8666
8853
  if (baseFont || overlayFont) {
8667
- nextStyle.font = _optionalChain([options2, 'optionalAccess', _599 => _599.replaceXfSubtrees]) && overlayFont ? overlayFont : {
8854
+ nextStyle.font = _optionalChain([options2, 'optionalAccess', _619 => _619.replaceXfSubtrees]) && overlayFont ? overlayFont : {
8668
8855
  ..._nullishCoalesce(baseFont, () => ( {})),
8669
8856
  ..._nullishCoalesce(overlayFont, () => ( {}))
8670
8857
  };
@@ -8910,7 +9097,7 @@ function DefaultToolbar({ controller, palette, pivotTableEditor }) {
8910
9097
  items: tabs.map((tab, index) => ({
8911
9098
  id: String(index),
8912
9099
  label: tab.name,
8913
- title: tab.visibility === "hidden" ? _chunkTMYAG7GYcjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkTMYAG7GYcjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
9100
+ title: tab.visibility === "hidden" ? _chunkYOLIVKZDcjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkYOLIVKZDcjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
8914
9101
  visibility: tab.visibility
8915
9102
  })),
8916
9103
  onValueChange: (value) => setActiveTabIndex(Number(value)),
@@ -8933,7 +9120,7 @@ function resolveRichCellRuns(raw, value, base, theme, zoom) {
8933
9120
  if (typeof font.size === "number" && font.size > 0) style.fontSize = font.size * (4 / 3) * zoom;
8934
9121
  if (typeof font.bold === "boolean") style.fontWeight = font.bold ? "bold" : "normal";
8935
9122
  if (typeof font.italic === "boolean") style.fontStyle = font.italic ? "italic" : "normal";
8936
- const color = _chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, font.color, theme);
9123
+ const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, font.color, theme);
8937
9124
  if (color) style.color = color;
8938
9125
  const decorations = new Set(String(_nullishCoalesce(base.textDecoration, () => ( ""))).split(/\s+/).filter(Boolean));
8939
9126
  if (font.underline != null) {
@@ -9178,11 +9365,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
9178
9365
  return literal;
9179
9366
  }
9180
9367
  const splitReference = splitSheetFormulaReference(normalized);
9181
- const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _600 => _600.sheetName]), () => ( null));
9182
- if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _601 => _601.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) {
9183
9370
  return literal;
9184
9371
  }
9185
- const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _602 => _602.range]), () => ( normalized));
9372
+ const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _622 => _622.range]), () => ( normalized));
9186
9373
  const cell = parseA1CellReference2(cellRef.replace(/\$/g, ""));
9187
9374
  if (!cell) {
9188
9375
  return literal;
@@ -9214,8 +9401,8 @@ function normalizeConditionalTextOperand(value) {
9214
9401
  }
9215
9402
  function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
9216
9403
  const normalizedRuleType = rule.ruleType.trim().toLowerCase();
9217
- const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _603 => _603.formulas, 'optionalAccess', _604 => _604[0]]), () => ( "")), worksheet, sheet, batchedCells);
9218
- const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _605 => _605.formulas, 'optionalAccess', _606 => _606[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);
9219
9406
  if (normalizedRuleType === "cellis") {
9220
9407
  return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
9221
9408
  }
@@ -9246,7 +9433,7 @@ function getStyledConditionalRules(rules) {
9246
9433
  return styledRules;
9247
9434
  }
9248
9435
  function resolveConditionalCellStyleForCell(row2, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
9249
- const rules = _optionalChain([sheet, 'optionalAccess', _607 => _607.conditionalFormatRules]);
9436
+ const rules = _optionalChain([sheet, 'optionalAccess', _627 => _627.conditionalFormatRules]);
9250
9437
  if (!sheet || !rules || rules.length === 0) {
9251
9438
  return null;
9252
9439
  }
@@ -9450,11 +9637,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9450
9637
  if (shape.paragraphs.length === 0) {
9451
9638
  return;
9452
9639
  }
9453
- const inset = _optionalChain([shape, 'access', _608 => _608.textBox, 'optionalAccess', _609 => _609.insetPx]);
9454
- const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _610 => _610.left]), () => ( 6))) * zoomFactor;
9455
- const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _611 => _611.right]), () => ( 6))) * zoomFactor;
9456
- const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _612 => _612.top]), () => ( 4))) * zoomFactor;
9457
- const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _613 => _613.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;
9458
9645
  const textLeft = left + paddingLeft;
9459
9646
  const textTop = top + paddingTop;
9460
9647
  const textWidth = Math.max(0, width - paddingLeft - paddingRight);
@@ -9476,9 +9663,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9476
9663
  });
9477
9664
  const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
9478
9665
  let y = textTop;
9479
- if (_optionalChain([shape, 'access', _614 => _614.textBox, 'optionalAccess', _615 => _615.verticalAlign]) === "middle") {
9666
+ if (_optionalChain([shape, 'access', _634 => _634.textBox, 'optionalAccess', _635 => _635.verticalAlign]) === "middle") {
9480
9667
  y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
9481
- } else if (_optionalChain([shape, 'access', _616 => _616.textBox, 'optionalAccess', _617 => _617.verticalAlign]) === "bottom") {
9668
+ } else if (_optionalChain([shape, 'access', _636 => _636.textBox, 'optionalAccess', _637 => _637.verticalAlign]) === "bottom") {
9482
9669
  y = textTop + Math.max(0, textHeight - totalTextHeight);
9483
9670
  }
9484
9671
  context.save();
@@ -9489,7 +9676,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9489
9676
  shape.paragraphs.forEach((paragraph, paragraphIndex) => {
9490
9677
  const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
9491
9678
  let x = textLeft;
9492
- const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _618 => _618.textBox, 'optionalAccess', _619 => _619.horizontalAlign]))), () => ( "left"));
9679
+ const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _638 => _638.textBox, 'optionalAccess', _639 => _639.horizontalAlign]))), () => ( "left"));
9493
9680
  if (align === "center") {
9494
9681
  x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
9495
9682
  } else if (align === "right") {
@@ -9518,11 +9705,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
9518
9705
  context.restore();
9519
9706
  }
9520
9707
  function drawStaticShape(context, shape, rect, zoomFactor) {
9521
- const fillColor = _optionalChain([shape, 'access', _620 => _620.fill, 'optionalAccess', _621 => _621.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _622 => _622.fill, 'optionalAccess', _623 => _623.color]), () => ( "transparent"));
9522
- const strokeColor = _optionalChain([shape, 'access', _624 => _624.stroke, 'optionalAccess', _625 => _625.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _626 => _626.stroke, 'optionalAccess', _627 => _627.color]), () => ( "transparent"));
9523
- const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _628 => _628.stroke, 'optionalAccess', _629 => _629.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);
9524
9711
  const vectorShape = resolveShapeVector(shape);
9525
- const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _630 => _630.fill, 'optionalAccess', _631 => _631.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _632 => _632.stroke, 'optionalAccess', _633 => _633.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)));
9526
9713
  context.save();
9527
9714
  context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
9528
9715
  if (shape.rotationDeg) {
@@ -9533,7 +9720,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
9533
9720
  context.lineWidth = lineWidth;
9534
9721
  context.strokeStyle = strokeColor;
9535
9722
  context.fillStyle = fillColor;
9536
- applyCanvasShapeDash(context, _optionalChain([shape, 'access', _634 => _634.stroke, 'optionalAccess', _635 => _635.dash]), lineWidth);
9723
+ applyCanvasShapeDash(context, _optionalChain([shape, 'access', _654 => _654.stroke, 'optionalAccess', _655 => _655.dash]), lineWidth);
9537
9724
  const localLeft = -rect.width / 2;
9538
9725
  const localTop = -rect.height / 2;
9539
9726
  if (vectorShape && typeof Path2D !== "undefined") {
@@ -9670,7 +9857,7 @@ function drawStaticFormControl(context, control2, rect, palette, zoomFactor, she
9670
9857
  context.restore();
9671
9858
  }
9672
9859
  function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCache) {
9673
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _636 => _636.conditionalFormatRules]), () => ( []));
9860
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _656 => _656.conditionalFormatRules]), () => ( []));
9674
9861
  const matchingRule = rules.find(
9675
9862
  (rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9676
9863
  );
@@ -9708,23 +9895,23 @@ function resolveConditionalDataBarForCell(row2, col, worksheet, sheet, metricsCa
9708
9895
  const span = maxValue - minValue;
9709
9896
  const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
9710
9897
  const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
9711
- const color = _chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _637 => _637.themePalette]));
9898
+ const color = _chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.color, _optionalChain([sheet, 'optionalAccess', _657 => _657.themePalette]));
9712
9899
  if (!color || widthPercent <= 0) {
9713
9900
  return null;
9714
9901
  }
9715
9902
  return {
9716
- axisColor: _nullishCoalesce(_chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _638 => _638.themePalette])), () => ( void 0)),
9903
+ axisColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _658 => _658.themePalette])), () => ( void 0)),
9717
9904
  border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
9718
- borderColor: _nullishCoalesce(_chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _639 => _639.themePalette])), () => ( void 0)),
9905
+ borderColor: _nullishCoalesce(_chunkXZJLPW64cjs.resolveWorkbookColor.call(void 0, matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _659 => _659.themePalette])), () => ( void 0)),
9719
9906
  color,
9720
9907
  gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
9721
- negativeBorderColor: _nullishCoalesce(_chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _640 => _640.themePalette])), () => ( void 0)),
9722
- negativeFillColor: _nullishCoalesce(_chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _641 => _641.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)),
9723
9910
  widthPercent
9724
9911
  };
9725
9912
  }
9726
9913
  function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metricsCache) {
9727
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _642 => _642.conditionalFormatRules]), () => ( []));
9914
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _662 => _662.conditionalFormatRules]), () => ( []));
9728
9915
  const matchingRule = rules.find(
9729
9916
  (rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9730
9917
  );
@@ -9752,7 +9939,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
9752
9939
  });
9753
9940
  metricsCache.set(cacheKey, ruleValues);
9754
9941
  }
9755
- const colors = matchingRule.colors.map((color) => _chunkJCSAS3M2cjs.resolveWorkbookColor.call(void 0, color, _optionalChain([sheet, 'optionalAccess', _643 => _643.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");
9756
9943
  const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
9757
9944
  if (colors.length < 2 || thresholds.length < 2) {
9758
9945
  return null;
@@ -9771,7 +9958,7 @@ function resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, metric
9771
9958
  return { color: resolvedColor };
9772
9959
  }
9773
9960
  function resolveConditionalIconForCell(row2, col, worksheet, sheet, metricsCache) {
9774
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _644 => _644.conditionalFormatRules]), () => ( []));
9961
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _664 => _664.conditionalFormatRules]), () => ( []));
9775
9962
  const matchingRule = rules.find(
9776
9963
  (rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row: row2, col }, range))
9777
9964
  );
@@ -9916,7 +10103,7 @@ function GridRow({
9916
10103
  style: {
9917
10104
  bottom: 0,
9918
10105
  cursor: "row-resize",
9919
- height: CANVAS_RESIZE_HIT_SLOP_PX,
10106
+ height: HEADER_RESIZE_HANDLE_PX,
9920
10107
  left: 0,
9921
10108
  position: "absolute",
9922
10109
  width: "100%",
@@ -10073,7 +10260,7 @@ function GridRow({
10073
10260
  whiteSpace: "nowrap",
10074
10261
  width: "max-content"
10075
10262
  } : null;
10076
- const title = [_optionalChain([cellData, 'access', _645 => _645.hyperlink, 'optionalAccess', _646 => _646.tooltip]), _optionalChain([cellData, 'access', _647 => _647.validation, 'optionalAccess', _648 => _648.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");
10077
10264
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
10078
10265
  "td",
10079
10266
  {
@@ -10258,12 +10445,12 @@ function GridRow({
10258
10445
  ) : null
10259
10446
  ] });
10260
10447
  }
10261
- var MemoGridRow = React14.memo(GridRow, (prev, next) => {
10448
+ var MemoGridRow = React15.memo(GridRow, (prev, next) => {
10262
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) {
10263
10450
  return false;
10264
10451
  }
10265
- const prevEditingCol = _optionalChain([prev, 'access', _649 => _649.editingCell, 'optionalAccess', _650 => _650.row]) === prev.actualRow ? prev.editingCell.col : -1;
10266
- const nextEditingCol = _optionalChain([next, 'access', _651 => _651.editingCell, 'optionalAccess', _652 => _652.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;
10267
10454
  if (prevEditingCol !== nextEditingCol) {
10268
10455
  return false;
10269
10456
  }
@@ -10287,7 +10474,7 @@ function XlsxViewerProvider({ children: children2, controller, isDark = false, .
10287
10474
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, XlsxViewerProviderWithInlineController, { ...options2, isDark, children: children2 });
10288
10475
  }
10289
10476
  function useXlsxViewer() {
10290
- const context = React14.useContext(ViewerContext);
10477
+ const context = React15.useContext(ViewerContext);
10291
10478
  if (!context) {
10292
10479
  throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
10293
10480
  }
@@ -10301,9 +10488,11 @@ function useXlsxViewerSelection() {
10301
10488
  selectedRangeAddress,
10302
10489
  selectCell,
10303
10490
  selectRange,
10491
+ selectRanges,
10492
+ selectionRanges,
10304
10493
  selection
10305
10494
  } = useXlsxViewer();
10306
- return React14.useMemo(
10495
+ return React15.useMemo(
10307
10496
  () => ({
10308
10497
  activeCell,
10309
10498
  activeCellAddress,
@@ -10311,9 +10500,18 @@ function useXlsxViewerSelection() {
10311
10500
  selectedRangeAddress,
10312
10501
  selectCell,
10313
10502
  selectRange,
10503
+ selectRanges,
10504
+ selectionRanges,
10314
10505
  selection
10315
10506
  }),
10316
- [activeCell, activeCellAddress, clearSelection, selectedRangeAddress, selectCell, selectRange, selection]
10507
+ [activeCell, activeCellAddress, clearSelection, selectedRangeAddress, selectCell, selectRange, selectRanges, selectionRanges, selection]
10508
+ );
10509
+ }
10510
+ function useXlsxViewerLayout() {
10511
+ const { canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes } = useXlsxViewer();
10512
+ return React15.useMemo(
10513
+ () => ({ canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes }),
10514
+ [canChangeFreezePanes, canChangeVisibility, canFreezePanes, frozenPanes, hideRows, unhideRows, hideColumns, unhideColumns, freezePanes, unfreezePanes]
10317
10515
  );
10318
10516
  }
10319
10517
  function useXlsxViewerZoom() {
@@ -10329,7 +10527,7 @@ function useXlsxViewerZoom() {
10329
10527
  zoomOut,
10330
10528
  zoomScale
10331
10529
  } = useXlsxViewer();
10332
- return React14.useMemo(
10530
+ return React15.useMemo(
10333
10531
  () => ({
10334
10532
  canZoomIn,
10335
10533
  canZoomOut,
@@ -10398,7 +10596,7 @@ function useXlsxViewerEditing() {
10398
10596
  unmergeSelection,
10399
10597
  updateFormControl
10400
10598
  } = useXlsxViewer();
10401
- return React14.useMemo(
10599
+ return React15.useMemo(
10402
10600
  () => ({
10403
10601
  addFormControl,
10404
10602
  addSheet,
@@ -10485,7 +10683,7 @@ function useXlsxViewerEditing() {
10485
10683
  }
10486
10684
  function useXlsxViewerTables() {
10487
10685
  const { sortState, sortTable, tables } = useXlsxViewer();
10488
- return React14.useMemo(
10686
+ return React15.useMemo(
10489
10687
  () => ({
10490
10688
  sortState,
10491
10689
  sortTable,
@@ -10496,7 +10694,7 @@ function useXlsxViewerTables() {
10496
10694
  }
10497
10695
  function useXlsxViewerPivots() {
10498
10696
  const { pivotTables, pivotFieldListVisible, setPivotFieldListVisible, getPivotSourceFields, getPivotTableAtCell, upsertPivotTable, refreshPivotTable, refreshAllPivotTables, removePivotTable, pivotDrillDown, showPivotDetails, createPivotChart, togglePivotGroup } = useXlsxViewer();
10499
- return React14.useMemo(() => ({
10697
+ return React15.useMemo(() => ({
10500
10698
  pivotTables,
10501
10699
  pivotFieldListVisible,
10502
10700
  setPivotFieldListVisible,
@@ -10550,7 +10748,7 @@ function useXlsxViewerImages() {
10550
10748
  setImageRect,
10551
10749
  updateChart
10552
10750
  } = useXlsxViewer();
10553
- return React14.useMemo(
10751
+ return React15.useMemo(
10554
10752
  () => ({
10555
10753
  arrangeDrawing,
10556
10754
  changeChartType,
@@ -10652,7 +10850,7 @@ function useXlsxViewerCharts() {
10652
10850
  tabs,
10653
10851
  updateChart
10654
10852
  } = useXlsxViewer();
10655
- return React14.useMemo(
10853
+ return React15.useMemo(
10656
10854
  () => ({
10657
10855
  activeTab,
10658
10856
  activeTabIndex,
@@ -10725,30 +10923,30 @@ function useXlsxViewerThumbnails(options2 = {}) {
10725
10923
  workbook,
10726
10924
  sheets
10727
10925
  } = useXlsxViewer();
10728
- const { headerBackgroundColor, headerTextColor, isDark } = React14.useContext(ViewerAppearanceContext);
10926
+ const { headerBackgroundColor, headerTextColor, isDark } = React15.useContext(ViewerAppearanceContext);
10729
10927
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
10730
10928
  const includeHeaders = _nullishCoalesce(options2.includeHeaders, () => ( true));
10731
10929
  const resolution = options2.resolution;
10732
- const thumbnailImageCacheRef = React14.useRef(/* @__PURE__ */ new Map());
10733
- const workerThumbnailRowBatchCacheRef = React14.useRef(/* @__PURE__ */ new Map());
10734
- const workerThumbnailRowBatchRequestRef = React14.useRef(
10930
+ const thumbnailImageCacheRef = React15.useRef(/* @__PURE__ */ new Map());
10931
+ const workerThumbnailRowBatchCacheRef = React15.useRef(/* @__PURE__ */ new Map());
10932
+ const workerThumbnailRowBatchRequestRef = React15.useRef(
10735
10933
  /* @__PURE__ */ new Map()
10736
10934
  );
10737
- const isMountedRef = React14.useRef(false);
10738
- const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React14.useState(0);
10739
- const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React14.useState(0);
10740
- React14.useEffect(() => {
10935
+ const isMountedRef = React15.useRef(false);
10936
+ const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React15.useState(0);
10937
+ const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React15.useState(0);
10938
+ React15.useEffect(() => {
10741
10939
  isMountedRef.current = true;
10742
10940
  return () => {
10743
10941
  isMountedRef.current = false;
10744
10942
  };
10745
10943
  }, []);
10746
- React14.useEffect(() => {
10944
+ React15.useEffect(() => {
10747
10945
  workerThumbnailRowBatchCacheRef.current.clear();
10748
10946
  workerThumbnailRowBatchRequestRef.current.clear();
10749
10947
  setWorkerThumbnailRowBatchVersion((version) => version + 1);
10750
10948
  }, [locale]);
10751
- React14.useEffect(() => {
10949
+ React15.useEffect(() => {
10752
10950
  const currentSheets = new Set(sheets);
10753
10951
  for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
10754
10952
  if (!currentSheets.has(sheet)) {
@@ -10761,7 +10959,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
10761
10959
  }
10762
10960
  }
10763
10961
  }, [sheets]);
10764
- const getWorkerThumbnailRowBatch = React14.useCallback((sheet, startRow, endRow) => {
10962
+ const getWorkerThumbnailRowBatch = React15.useCallback((sheet, startRow, endRow) => {
10765
10963
  const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
10766
10964
  if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
10767
10965
  return cachedBatch;
@@ -10772,8 +10970,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
10772
10970
  const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
10773
10971
  if (!pendingRequest) {
10774
10972
  const request = {
10775
- endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _653 => _653.endRow]), () => ( endRow))),
10776
- startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _654 => _654.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)))
10777
10975
  };
10778
10976
  workerThumbnailRowBatchRequestRef.current.set(sheet, request);
10779
10977
  void getRowsBatchAsync(
@@ -10803,7 +11001,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
10803
11001
  }
10804
11002
  return null;
10805
11003
  }, [getRowsBatchAsync]);
10806
- const getThumbnailImage = React14.useCallback((image) => {
11004
+ const getThumbnailImage = React15.useCallback((image) => {
10807
11005
  if (typeof Image === "undefined") {
10808
11006
  return null;
10809
11007
  }
@@ -10835,9 +11033,9 @@ function useXlsxViewerThumbnails(options2 = {}) {
10835
11033
  imageElement.src = image.src;
10836
11034
  return null;
10837
11035
  }, []);
10838
- const thumbnails = React14.useMemo(() => {
11036
+ const thumbnails = React15.useMemo(() => {
10839
11037
  return sheets.map((sheet, sheetIndex) => {
10840
- const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _655 => _655.getSheet, 'call', _656 => _656(sheet.workbookSheetIndex)]), () => ( null));
11038
+ const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _675 => _675.getSheet, 'call', _676 => _676(sheet.workbookSheetIndex)]), () => ( null));
10841
11039
  const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
10842
11040
  const sheetShapes = getSheetShapes(sheetIndex);
10843
11041
  const sheetFormControls = getSheetFormControls(sheetIndex).filter((control2) => !control2.hidden);
@@ -10853,18 +11051,18 @@ function useXlsxViewerThumbnails(options2 = {}) {
10853
11051
  minRow: 0
10854
11052
  }));
10855
11053
  return {
10856
- maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _657 => _657.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
10857
- maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _658 => _658.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
10858
- minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _659 => _659.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
10859
- minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _660 => _660.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)
10860
11058
  };
10861
11059
  }, null);
10862
11060
  const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
10863
11061
  const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
10864
- const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _661 => _661.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _662 => _662.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
10865
- const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _663 => _663.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _664 => _664.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
10866
- const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _665 => _665.maxRow]), () => ( -1)));
10867
- const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _666 => _666.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)));
10868
11066
  const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
10869
11067
  const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
10870
11068
  const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
@@ -10881,17 +11079,17 @@ function useXlsxViewerThumbnails(options2 = {}) {
10881
11079
  hiddenColSet
10882
11080
  );
10883
11081
  const resolveColumnWidthPx = (actualCol) => {
10884
- if (worksheet && !worksheet.isColumnHidden(actualCol)) {
11082
+ if (worksheet && !hiddenColSet.has(actualCol)) {
10885
11083
  const width = worksheet.getColumnWidth(actualCol);
10886
11084
  if (width !== void 0 && width !== null) {
10887
11085
  return Math.max(
10888
- _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkJCSAS3M2cjs.resolveSheetColumnWidthPixels.call(void 0, width, sheet.columnWidthCharacterWidthPx), showGridLines),
11086
+ _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetColumnWidthPixels.call(void 0, width, sheet.columnWidthCharacterWidthPx), showGridLines),
10889
11087
  DEFAULT_COL_WIDTH2 / 2
10890
11088
  );
10891
11089
  }
10892
11090
  }
10893
11091
  return Math.max(
10894
- _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0,
11092
+ _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
10895
11093
  _nullishCoalesce(_nullishCoalesce(sheet.colWidthOverridesPx[actualCol], () => ( sheet.defaultColWidthPx)), () => ( DEFAULT_COL_WIDTH2)),
10896
11094
  showGridLines
10897
11095
  ),
@@ -10899,17 +11097,17 @@ function useXlsxViewerThumbnails(options2 = {}) {
10899
11097
  );
10900
11098
  };
10901
11099
  const resolveRowHeightPx = (actualRow) => {
10902
- if (worksheet && !worksheet.isRowHidden(actualRow)) {
11100
+ if (worksheet && !hiddenRowSet.has(actualRow)) {
10903
11101
  const height = worksheet.getRowHeight(actualRow);
10904
11102
  if (height !== void 0 && height !== null) {
10905
11103
  return Math.max(
10906
- _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkJCSAS3M2cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines),
11104
+ _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0, _chunkXZJLPW64cjs.resolveSheetRowHeightPixels.call(void 0, height), showGridLines),
10907
11105
  DEFAULT_ROW_HEIGHT2 / 1.5
10908
11106
  );
10909
11107
  }
10910
11108
  }
10911
11109
  return Math.max(
10912
- _chunkJCSAS3M2cjs.resolveRenderedSheetAxisPixels.call(void 0,
11110
+ _chunkXZJLPW64cjs.resolveRenderedSheetAxisPixels.call(void 0,
10913
11111
  _nullishCoalesce(_nullishCoalesce(sheet.rowHeightOverridesPx[actualRow], () => ( sheet.defaultRowHeightPx)), () => ( DEFAULT_ROW_HEIGHT2)),
10914
11112
  showGridLines
10915
11113
  ),
@@ -11077,8 +11275,8 @@ function useXlsxViewerThumbnails(options2 = {}) {
11077
11275
  return cached;
11078
11276
  }
11079
11277
  const batchCoversRow = workerRowBatch ? row2 >= workerRowBatch.startRow && row2 <= workerRowBatch.endRow : false;
11080
- const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _667 => _667.cells, 'access', _668 => _668.get, 'call', _669 => _669(cacheKey)]) : void 0;
11081
- if (_optionalChain([batchedCell, 'optionalAccess', _670 => _670.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _671 => _671.isMergedSecondary, 'call', _672 => _672(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)])) {
11082
11280
  const mergedSecondaryData = {
11083
11281
  isMergedSecondary: true,
11084
11282
  style: {},
@@ -11087,23 +11285,23 @@ function useXlsxViewerThumbnails(options2 = {}) {
11087
11285
  cellRenderCache.set(cacheKey, mergedSecondaryData);
11088
11286
  return mergedSecondaryData;
11089
11287
  }
11090
- const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _673 => _673.mergeSpan]);
11288
+ const merge = worksheet ? worksheet.getMergeSpan(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _693 => _693.mergeSpan]);
11091
11289
  const inheritedStyle = resolveInheritedCellStyle2(sheet, row2, col);
11092
- const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _674 => _674.style]), () => ( null));
11290
+ const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row2, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _694 => _694.style]), () => ( null));
11093
11291
  const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
11094
11292
  const conditionalCellStyle = resolveConditionalCellStyleForCell(
11095
11293
  row2,
11096
11294
  col,
11097
11295
  sheet,
11098
11296
  () => worksheet ? getCellNumericValue(worksheet, row2, col) : getBatchedCellNumericValue(batchedCell),
11099
- () => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _675 => _675.value]), () => ( "")),
11297
+ () => worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _695 => _695.value]), () => ( "")),
11100
11298
  worksheet,
11101
- _optionalChain([workerRowBatch, 'optionalAccess', _676 => _676.cells])
11299
+ _optionalChain([workerRowBatch, 'optionalAccess', _696 => _696.cells])
11102
11300
  );
11103
11301
  const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
11104
- const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _677 => _677.alignment]);
11302
+ const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _697 => _697.alignment]);
11105
11303
  const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
11106
- const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _678 => _678.cells, 'access', _679 => _679.get, 'call', _680 => _680(`${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}`)]));
11107
11305
  const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
11108
11306
  { length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
11109
11307
  (_, index) => getNumericValue(
@@ -11117,26 +11315,26 @@ function useXlsxViewerThumbnails(options2 = {}) {
11117
11315
  sparkline.range.start.col
11118
11316
  )
11119
11317
  ) : null;
11120
- const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _681 => _681.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;
11121
11319
  const nextData = {
11122
11320
  canvas: void 0,
11123
11321
  checkboxState,
11124
- colSpan: _optionalChain([merge, 'optionalAccess', _682 => _682.colSpan]),
11322
+ colSpan: _optionalChain([merge, 'optionalAccess', _702 => _702.colSpan]),
11125
11323
  conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11126
11324
  conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11127
11325
  conditionalIcon: worksheet ? resolveConditionalIconForCell(row2, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
11128
11326
  isMergedSecondary: false,
11129
- rowSpan: _optionalChain([merge, 'optionalAccess', _683 => _683.rowSpan]),
11327
+ rowSpan: _optionalChain([merge, 'optionalAccess', _703 => _703.rowSpan]),
11130
11328
  sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
11131
11329
  style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
11132
- generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _684 => _684.generalAlignment]),
11330
+ generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row2, col) : _optionalChain([batchedCell, 'optionalAccess', _704 => _704.generalAlignment]),
11133
11331
  showGridLines
11134
11332
  }),
11135
- textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _685 => _685.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _686 => _686.textRotation])))),
11136
- value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row2, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _687 => _687.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]), () => ( ""))
11137
11335
  };
11138
11336
  nextData.richText = resolveRichCellRuns(
11139
- worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _688 => _688.richText]),
11337
+ worksheet ? worksheet.getRichTextAt(row2, col) : _optionalChain([batchedCell, 'optionalAccess', _708 => _708.richText]),
11140
11338
  nextData.value,
11141
11339
  nextData.style,
11142
11340
  sheet.themePalette,
@@ -11158,11 +11356,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
11158
11356
  let height = rowItem.size;
11159
11357
  for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
11160
11358
  const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
11161
- width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _689 => _689.size]), () => ( 0));
11359
+ width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _709 => _709.size]), () => ( 0));
11162
11360
  }
11163
11361
  for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
11164
11362
  const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
11165
- height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _690 => _690.size]), () => ( 0));
11363
+ height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _710 => _710.size]), () => ( 0));
11166
11364
  }
11167
11365
  const rect = {
11168
11366
  height,
@@ -11172,7 +11370,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
11172
11370
  };
11173
11371
  const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
11174
11372
  const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
11175
- const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _691 => _691.conditionalColorScale, 'optionalAccess', _692 => _692.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)));
11176
11374
  context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
11177
11375
  context.fillRect(rect.left, rect.top, rect.width, rect.height);
11178
11376
  if (cellData.conditionalDataBar) {
@@ -11418,11 +11616,11 @@ function useXlsxViewerThumbnails(options2 = {}) {
11418
11616
  locale,
11419
11617
  workbook
11420
11618
  ]);
11421
- const paintThumbnail = React14.useCallback(
11422
- (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _693 => _693[sheetIndex], 'optionalAccess', _694 => _694.paint, 'call', _695 => _695(canvas)]), () => ( false)),
11619
+ const paintThumbnail = React15.useCallback(
11620
+ (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _713 => _713[sheetIndex], 'optionalAccess', _714 => _714.paint, 'call', _715 => _715(canvas)]), () => ( false)),
11423
11621
  [thumbnails]
11424
11622
  );
11425
- return React14.useMemo(
11623
+ return React15.useMemo(
11426
11624
  () => ({
11427
11625
  paintThumbnail,
11428
11626
  thumbnails
@@ -11432,7 +11630,7 @@ function useXlsxViewerThumbnails(options2 = {}) {
11432
11630
  }
11433
11631
  function DefaultXlsxToolbar({ pivotTableEditor } = {}) {
11434
11632
  const controller = useXlsxViewer();
11435
- const { headerBackgroundColor, headerTextColor, isDark } = React14.useContext(ViewerAppearanceContext);
11633
+ const { headerBackgroundColor, headerTextColor, isDark } = React15.useContext(ViewerAppearanceContext);
11436
11634
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
11437
11635
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultToolbar, { controller, palette, pivotTableEditor });
11438
11636
  }
@@ -11478,7 +11676,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
11478
11676
  }
11479
11677
  destroy() {
11480
11678
  this.destroyed = true;
11481
- _optionalChain([this, 'access', _696 => _696.observer, 'optionalAccess', _697 => _697.disconnect, 'call', _698 => _698()]);
11679
+ _optionalChain([this, 'access', _716 => _716.observer, 'optionalAccess', _717 => _717.disconnect, 'call', _718 => _718()]);
11482
11680
  this.observer = null;
11483
11681
  this.slots.clear();
11484
11682
  this.listeners.clear();
@@ -11507,9 +11705,9 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init13.cal
11507
11705
  }
11508
11706
  }, _class2);
11509
11707
  function RuntimeContent({ content }) {
11510
- const hostRef = React15.useRef(null);
11511
- const rootRef = React15.useRef(null);
11512
- React15.useLayoutEffect(() => {
11708
+ const hostRef = React16.useRef(null);
11709
+ const rootRef = React16.useRef(null);
11710
+ React16.useLayoutEffect(() => {
11513
11711
  const host = hostRef.current;
11514
11712
  if (!host) return;
11515
11713
  const root = _internal.__createContentRoot.call(void 0, host);
@@ -11519,8 +11717,8 @@ function RuntimeContent({ content }) {
11519
11717
  root.destroy();
11520
11718
  };
11521
11719
  }, []);
11522
- React15.useLayoutEffect(() => {
11523
- _optionalChain([rootRef, 'access', _699 => _699.current, 'optionalAccess', _700 => _700.update, 'call', _701 => _701(content)]);
11720
+ React16.useLayoutEffect(() => {
11721
+ _optionalChain([rootRef, 'access', _719 => _719.current, 'optionalAccess', _720 => _720.update, 'call', _721 => _721(content)]);
11524
11722
  }, [content]);
11525
11723
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
11526
11724
  }
@@ -11582,13 +11780,13 @@ function renderOptions(props, controller, slots, owner) {
11582
11780
  };
11583
11781
  }
11584
11782
  function BoundViewer({ props, controller: sourceController }) {
11585
- const messages = React15.useMemo(() => _chunkTMYAG7GYcjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
11586
- const controller = React15.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
11587
- const hostRef = React15.useRef(null);
11588
- const viewerRef = React15.useRef(null);
11589
- const slots = React15.useMemo(() => new SlotStore(), []);
11590
- React15.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
11591
- React15.useLayoutEffect(() => {
11783
+ const messages = React16.useMemo(() => _chunkYOLIVKZDcjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
11784
+ const controller = React16.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
11785
+ const hostRef = React16.useRef(null);
11786
+ const viewerRef = React16.useRef(null);
11787
+ const slots = React16.useMemo(() => new SlotStore(), []);
11788
+ React16.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
11789
+ React16.useLayoutEffect(() => {
11592
11790
  const host = hostRef.current;
11593
11791
  if (!host) return;
11594
11792
  slots.observe(host);
@@ -11600,9 +11798,9 @@ function BoundViewer({ props, controller: sourceController }) {
11600
11798
  slots.destroy();
11601
11799
  };
11602
11800
  }, [slots]);
11603
- React15.useLayoutEffect(() => {
11801
+ React16.useLayoutEffect(() => {
11604
11802
  const host = hostRef.current;
11605
- if (host) _optionalChain([viewerRef, 'access', _702 => _702.current, 'optionalAccess', _703 => _703.update, 'call', _704 => _704(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))]);
11606
11804
  }, [controller, props, slots]);
11607
11805
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
11608
11806
  headerBackgroundColor: props.headerBackgroundColor,
@@ -11618,7 +11816,7 @@ function UncontrolledViewer(props) {
11618
11816
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller });
11619
11817
  }
11620
11818
  function XlsxViewer(props) {
11621
- const context = React15.useContext(ViewerContext);
11819
+ const context = React16.useContext(ViewerContext);
11622
11820
  const controller = _nullishCoalesce(props.controller, () => ( context));
11623
11821
  return controller ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UncontrolledViewer, { ...props });
11624
11822
  }
@@ -11642,5 +11840,6 @@ function XlsxViewer(props) {
11642
11840
 
11643
11841
 
11644
11842
 
11645
- exports.DefaultXlsxPivotTableFieldList = DefaultXlsxPivotTableFieldList; exports.DefaultXlsxToolbar = DefaultXlsxToolbar; exports.XlsxFileSizeLimitExceededError = _vanilla.XlsxFileSizeLimitExceededError; exports.XlsxViewer = XlsxViewer; exports.XlsxViewerProvider = XlsxViewerProvider; exports.initWasm = _vanilla.initWasm; exports.parseXlsxRange = _vanilla.parseXlsxRange; exports.setWasmSource = _vanilla.setWasmSource; exports.useXlsxPivotTableEditor = useXlsxPivotTableEditor; exports.useXlsxViewer = useXlsxViewer; exports.useXlsxViewerCharts = useXlsxViewerCharts; exports.useXlsxViewerController = useXlsxViewerController; exports.useXlsxViewerEditing = useXlsxViewerEditing; exports.useXlsxViewerImages = useXlsxViewerImages; exports.useXlsxViewerPivots = useXlsxViewerPivots; exports.useXlsxViewerSelection = useXlsxViewerSelection; exports.useXlsxViewerTables = useXlsxViewerTables; exports.useXlsxViewerThumbnails = useXlsxViewerThumbnails; exports.useXlsxViewerZoom = useXlsxViewerZoom;
11843
+
11844
+ exports.DefaultXlsxPivotTableFieldList = DefaultXlsxPivotTableFieldList; exports.DefaultXlsxToolbar = DefaultXlsxToolbar; exports.XlsxFileSizeLimitExceededError = _vanilla.XlsxFileSizeLimitExceededError; exports.XlsxViewer = XlsxViewer; exports.XlsxViewerProvider = XlsxViewerProvider; exports.initWasm = _vanilla.initWasm; exports.parseXlsxRange = _vanilla.parseXlsxRange; exports.setWasmSource = _vanilla.setWasmSource; exports.useXlsxPivotTableEditor = useXlsxPivotTableEditor; exports.useXlsxViewer = useXlsxViewer; exports.useXlsxViewerCharts = useXlsxViewerCharts; exports.useXlsxViewerController = useXlsxViewerController; exports.useXlsxViewerEditing = useXlsxViewerEditing; exports.useXlsxViewerImages = useXlsxViewerImages; exports.useXlsxViewerLayout = useXlsxViewerLayout; exports.useXlsxViewerPivots = useXlsxViewerPivots; exports.useXlsxViewerSelection = useXlsxViewerSelection; exports.useXlsxViewerTables = useXlsxViewerTables; exports.useXlsxViewerThumbnails = useXlsxViewerThumbnails; exports.useXlsxViewerZoom = useXlsxViewerZoom;
11646
11845
  //# sourceMappingURL=index.cjs.map