@extend-ai/react-xlsx 0.20.11 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.md +171 -4
  2. package/dist/{chunk-VSM7WKLM.js → chunk-2UFSVI5Z.js} +565 -142
  3. package/dist/chunk-2UFSVI5Z.js.map +1 -0
  4. package/dist/{chunk-SXHHFUXA.cjs → chunk-7IL4KLCD.cjs} +1729 -1306
  5. package/dist/chunk-7IL4KLCD.cjs.map +1 -0
  6. package/dist/{chunk-OGZ6ROZC.cjs → chunk-A3S3QKJN.cjs} +445 -3
  7. package/dist/chunk-A3S3QKJN.cjs.map +1 -0
  8. package/dist/chunk-IRC7BQ6E.js +538 -0
  9. package/dist/chunk-IRC7BQ6E.js.map +1 -0
  10. package/dist/{chunk-CVMHJO5H.js → chunk-WHTV6N6S.js} +443 -1
  11. package/dist/chunk-WHTV6N6S.js.map +1 -0
  12. package/dist/chunk-ZPDHTVL6.cjs +538 -0
  13. package/dist/chunk-ZPDHTVL6.cjs.map +1 -0
  14. package/dist/index.cjs +245 -159
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +135 -2
  17. package/dist/index.d.ts +135 -2
  18. package/dist/index.js +203 -117
  19. package/dist/index.js.map +1 -1
  20. package/dist/{internal-BBaC9yCh.d.cts → internal-BO70EPFy.d.cts} +130 -2
  21. package/dist/{internal-BBaC9yCh.d.ts → internal-BO70EPFy.d.ts} +130 -2
  22. package/dist/internal.cjs +3 -3
  23. package/dist/internal.d.cts +1 -1
  24. package/dist/internal.d.ts +1 -1
  25. package/dist/internal.js +2 -2
  26. package/dist/{shared-chart-XOCTF7KQ.js → shared-chart-7RUN5IKZ.js} +6 -4
  27. package/dist/shared-chart-7RUN5IKZ.js.map +1 -0
  28. package/dist/{shared-chart-CIRSCWTO.cjs → shared-chart-P3KU6TQR.cjs} +15 -13
  29. package/dist/shared-chart-P3KU6TQR.cjs.map +1 -0
  30. package/dist/{shared-chart-BLOOGI7S.js → shared-chart-UTUK46E4.js} +6 -4
  31. package/dist/shared-chart-UTUK46E4.js.map +1 -0
  32. package/dist/{shared-chart-4LUQQI2B.cjs → shared-chart-VRXD57MU.cjs} +6 -4
  33. package/dist/shared-chart-VRXD57MU.cjs.map +1 -0
  34. package/dist/vanilla.cjs +3 -3
  35. package/dist/vanilla.d.cts +2 -2
  36. package/dist/vanilla.d.ts +2 -2
  37. package/dist/vanilla.js +2 -2
  38. package/package.json +1 -1
  39. package/dist/chunk-7GBCRNGO.js +0 -94
  40. package/dist/chunk-7GBCRNGO.js.map +0 -1
  41. package/dist/chunk-CVMHJO5H.js.map +0 -1
  42. package/dist/chunk-MFOGLSFJ.cjs +0 -94
  43. package/dist/chunk-MFOGLSFJ.cjs.map +0 -1
  44. package/dist/chunk-OGZ6ROZC.cjs.map +0 -1
  45. package/dist/chunk-SXHHFUXA.cjs.map +0 -1
  46. package/dist/chunk-VSM7WKLM.js.map +0 -1
  47. package/dist/shared-chart-4LUQQI2B.cjs.map +0 -1
  48. package/dist/shared-chart-BLOOGI7S.js.map +0 -1
  49. package/dist/shared-chart-CIRSCWTO.cjs.map +0 -1
  50. package/dist/shared-chart-XOCTF7KQ.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,6 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;
2
2
 
3
- var _chunkMFOGLSFJcjs = require('./chunk-MFOGLSFJ.cjs');
3
+
4
+
5
+
6
+
7
+ var _chunkZPDHTVL6cjs = require('./chunk-ZPDHTVL6.cjs');
4
8
 
5
9
 
6
10
  var _chunkAD4CGQN2cjs = require('./chunk-AD4CGQN2.cjs');
@@ -326,11 +330,11 @@ async function loadSpreadsheetFonts(buffer) {
326
330
  }
327
331
  } catch (e) {
328
332
  }
329
- await _chunkMFOGLSFJcjs.loadOfficeFonts.call(void 0, void 0, families).catch(() => void 0);
333
+ await _chunkZPDHTVL6cjs.loadOfficeFonts.call(void 0, void 0, families).catch(() => void 0);
330
334
  }
331
335
 
332
336
  // src/controller.tsx
333
- var _react = require('react'); var React = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react);
337
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React10 = _interopRequireWildcard(_react); var React9 = _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);
334
338
  var _internal = require('@extend-ai/react-xlsx/internal');
335
339
 
336
340
 
@@ -9430,6 +9434,7 @@ function useXlsxViewerController(options) {
9430
9434
  file,
9431
9435
  fileName,
9432
9436
  locale = "en-US",
9437
+ messages: messageOverrides,
9433
9438
  maxFileSizeBytes = DEFAULT_MAX_FILE_SIZE_BYTES,
9434
9439
  readOnly: requestedReadOnly = false,
9435
9440
  readOnlyAboveBytes = 0,
@@ -9438,6 +9443,7 @@ function useXlsxViewerController(options) {
9438
9443
  src,
9439
9444
  useWorker = true
9440
9445
  } = options;
9446
+ const messages = React.useMemo(() => _chunkZPDHTVL6cjs.resolveMessages.call(void 0, locale, messageOverrides), [locale, messageOverrides]);
9441
9447
  const [isLoading, setIsLoading] = React.useState(Boolean(_nullishCoalesce(file, () => ( src))));
9442
9448
  const [error, setError] = React.useState(null);
9443
9449
  const [workbook, setWorkbook] = React.useState(null);
@@ -11574,6 +11580,28 @@ function useXlsxViewerController(options) {
11574
11580
  refreshWorkbookState(workbook);
11575
11581
  recordCellEditHistory(cell, before, after);
11576
11582
  }, [captureCellMutationState, getActiveWorksheet, readOnly, recordCellEditHistory, refreshWorkbookState, workbook]);
11583
+ const setCellStyles = React.useCallback((updates) => {
11584
+ const worksheet = getActiveWorksheet();
11585
+ if (readOnly || !worksheet || !workbook) return;
11586
+ const beforeStates = /* @__PURE__ */ new Map();
11587
+ for (const { cell, style } of updates) {
11588
+ const key = `${cell.row}:${cell.col}`;
11589
+ if (!beforeStates.has(key)) {
11590
+ const before = captureCellMutationState(cell);
11591
+ if (!before) continue;
11592
+ beforeStates.set(key, { cell: { ...cell }, before });
11593
+ }
11594
+ worksheet.setCellStyleAt(cell.row, cell.col, style);
11595
+ }
11596
+ if (!beforeStates.size) return;
11597
+ const mutations = [];
11598
+ for (const { cell, before } of beforeStates.values()) {
11599
+ const after = captureCellMutationState(cell);
11600
+ if (after) mutations.push({ cell, before, after });
11601
+ }
11602
+ refreshWorkbookState(workbook);
11603
+ recordRangeEditHistory(mutations, selection, activeCell);
11604
+ }, [activeCell, captureCellMutationState, getActiveWorksheet, readOnly, recordRangeEditHistory, refreshWorkbookState, selection, workbook]);
11577
11605
  const setSelectedCellValue = React.useCallback((value) => {
11578
11606
  if (!activeCell) {
11579
11607
  return;
@@ -12180,6 +12208,7 @@ function useXlsxViewerController(options) {
12180
12208
  defineNamedRange,
12181
12209
  displayFileName,
12182
12210
  locale,
12211
+ messages,
12183
12212
  download,
12184
12213
  exportCsv,
12185
12214
  exportXlsx,
@@ -12229,6 +12258,7 @@ function useXlsxViewerController(options) {
12229
12258
  resizeRow,
12230
12259
  setCellFormula,
12231
12260
  setCellStyle,
12261
+ setCellStyles,
12232
12262
  setCellValue,
12233
12263
  setRangeStyle,
12234
12264
  setSelectedFormula,
@@ -12304,6 +12334,7 @@ function useXlsxViewerController(options) {
12304
12334
  defineNamedRange,
12305
12335
  displayFileName,
12306
12336
  locale,
12337
+ messages,
12307
12338
  download,
12308
12339
  error,
12309
12340
  exportCsv,
@@ -12352,6 +12383,7 @@ function useXlsxViewerController(options) {
12352
12383
  resizeRow,
12353
12384
  setCellFormula,
12354
12385
  setCellStyle,
12386
+ setCellStyles,
12355
12387
  setCellValue,
12356
12388
  setRangeStyle,
12357
12389
  setSelectedFormula,
@@ -12419,6 +12451,8 @@ function CellEditor({
12419
12451
  value,
12420
12452
  references,
12421
12453
  inputRef,
12454
+ editorRef,
12455
+ onFocusOverlay,
12422
12456
  canvasText = false,
12423
12457
  canvasOffset,
12424
12458
  paintCanvasText,
@@ -12430,6 +12464,7 @@ function CellEditor({
12430
12464
  onNavigate
12431
12465
  }) {
12432
12466
  const rootRef = React2.useRef(null);
12467
+ const messages = _chunkZPDHTVL6cjs.useXlsxMessages.call(void 0, );
12433
12468
  const mirrorRef = React2.useRef(null);
12434
12469
  const textRef = React2.useRef(null);
12435
12470
  const baselineRef = React2.useRef(null);
@@ -12557,7 +12592,12 @@ function CellEditor({
12557
12592
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
12558
12593
  "div",
12559
12594
  {
12560
- ref: rootRef,
12595
+ ref: (element) => {
12596
+ rootRef.current = element;
12597
+ if (typeof editorRef === "function") editorRef(element);
12598
+ else if (editorRef) editorRef.current = element;
12599
+ },
12600
+ "data-xlsx-cell-editor": "",
12561
12601
  onPointerDown: (event) => event.stopPropagation(),
12562
12602
  onClick: (event) => event.stopPropagation(),
12563
12603
  onDoubleClick: (event) => event.stopPropagation(),
@@ -12606,7 +12646,7 @@ function CellEditor({
12606
12646
  ] })
12607
12647
  }
12608
12648
  ),
12609
- paintCanvasText ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "canvas", { ref: canvasRef, "aria-hidden": "true", style: { position: "absolute", pointerEvents: "none" } }) : null,
12649
+ paintCanvasText ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "canvas", { ref: canvasRef, "data-xlsx-formula-text": "", "aria-hidden": "true", style: { position: "absolute", pointerEvents: "none" } }) : null,
12610
12650
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
12611
12651
  "textarea",
12612
12652
  {
@@ -12615,7 +12655,8 @@ function CellEditor({
12615
12655
  if (typeof inputRef === "function") inputRef(element);
12616
12656
  else if (inputRef) inputRef.current = element;
12617
12657
  },
12618
- "aria-label": "Edit cell",
12658
+ "aria-label": messages.editCell,
12659
+ "aria-keyshortcuts": onFocusOverlay ? "Alt+ArrowDown" : void 0,
12619
12660
  autoFocus: true,
12620
12661
  autoComplete: "off",
12621
12662
  spellCheck: false,
@@ -12629,7 +12670,9 @@ function CellEditor({
12629
12670
  onKeyDown: (event) => {
12630
12671
  event.stopPropagation();
12631
12672
  if (event.nativeEvent.isComposing) return;
12632
- if (event.key === "Enter" && !event.altKey) {
12673
+ if (event.key === "ArrowDown" && event.altKey && _optionalChain([onFocusOverlay, 'optionalCall', _1079 => _1079()])) {
12674
+ event.preventDefault();
12675
+ } else if (event.key === "Enter" && !event.altKey) {
12633
12676
  event.preventDefault();
12634
12677
  onCommit();
12635
12678
  } else if (event.key === "Escape") {
@@ -12675,6 +12718,19 @@ function CellEditor({
12675
12718
  );
12676
12719
  }
12677
12720
 
12721
+ // src/cell-editor-overlay.tsx
12722
+
12723
+
12724
+
12725
+
12726
+ // src/selection-popover.tsx
12727
+
12728
+
12729
+
12730
+
12731
+ // src/cell-editor-session.ts
12732
+
12733
+
12678
12734
  // src/cell-alignment.ts
12679
12735
  function getCellGeneralAlignment(worksheet, row, col) {
12680
12736
  const value = worksheet.getCalculatedValueAt(row, col);
@@ -12789,18 +12845,18 @@ function createChartModule(importModule) {
12789
12845
  var officeChartRenderer = createChartModule(async () => {
12790
12846
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
12791
12847
  Promise.resolve().then(() => _interopRequireWildcard(require("./browser-E3IVCNDO.cjs"))),
12792
- Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-4LUQQI2B.cjs")))
12848
+ Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-VRXD57MU.cjs")))
12793
12849
  ]);
12794
12850
  return { renderer: await loadOfficeCharts(), SharedChartSvg };
12795
12851
  });
12796
12852
  var suppliedOfficeChartRenderer = createChartModule(async () => {
12797
- const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-4LUQQI2B.cjs")));
12853
+ const { SharedChartSvg } = await Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-VRXD57MU.cjs")));
12798
12854
  return { renderer: null, SharedChartSvg };
12799
12855
  });
12800
12856
  var officeExtendedChartRenderer = createChartModule(async () => {
12801
12857
  const [{ loadOfficeCharts }, { SharedChartSvg }] = await Promise.all([
12802
12858
  Promise.resolve().then(() => _interopRequireWildcard(require("./full-V7S6GLRU.cjs"))),
12803
- Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-4LUQQI2B.cjs")))
12859
+ Promise.resolve().then(() => _interopRequireWildcard(require("./shared-chart-VRXD57MU.cjs")))
12804
12860
  ]);
12805
12861
  return { renderer: await loadOfficeCharts(typeof DecompressionStream === "function" ? void 0 : new URL("./office_charts_full_bg.wasm", _chunkAD4CGQN2cjs.importMetaUrl)), SharedChartSvg };
12806
12862
  });
@@ -13305,7 +13361,7 @@ function parseCanvasGradientStops(value) {
13305
13361
  if (!match) {
13306
13362
  return null;
13307
13363
  }
13308
- const color = _optionalChain([match, 'access', _1079 => _1079[1], 'optionalAccess', _1080 => _1080.trim, 'call', _1081 => _1081()]);
13364
+ const color = _optionalChain([match, 'access', _1080 => _1080[1], 'optionalAccess', _1081 => _1081.trim, 'call', _1082 => _1082()]);
13309
13365
  const percent = match[2] ? Number.parseFloat(match[2]) : Number.NaN;
13310
13366
  if (!color) {
13311
13367
  return null;
@@ -13321,7 +13377,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
13321
13377
  if (linearMatch) {
13322
13378
  const parts = splitCssGradientArgs(_nullishCoalesce(linearMatch[1], () => ( "")));
13323
13379
  if (parts.length >= 2) {
13324
- const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _1082 => _1082[0], 'optionalAccess', _1083 => _1083.trim, 'call', _1084 => _1084()]), () => ( "180deg"));
13380
+ const rawAngle = _nullishCoalesce(_optionalChain([parts, 'access', _1083 => _1083[0], 'optionalAccess', _1084 => _1084.trim, 'call', _1085 => _1085()]), () => ( "180deg"));
13325
13381
  const angleMatch = rawAngle.match(/(-?\d*\.?\d+)deg/i);
13326
13382
  const cssAngle = angleMatch ? Number.parseFloat(_nullishCoalesce(angleMatch[1], () => ( "180"))) : 180;
13327
13383
  const radians = (90 - cssAngle) * Math.PI / 180;
@@ -13351,7 +13407,7 @@ function resolveCanvasGradientFill(context, rect, backgroundImage) {
13351
13407
  const radialMatch = backgroundImage.match(/^radial-gradient\((.*)\)$/i);
13352
13408
  if (radialMatch) {
13353
13409
  const parts = splitCssGradientArgs(_nullishCoalesce(radialMatch[1], () => ( "")));
13354
- const stopParts = _optionalChain([parts, 'access', _1085 => _1085[0], 'optionalAccess', _1086 => _1086.startsWith, 'call', _1087 => _1087("circle")]) ? parts.slice(1) : parts;
13410
+ const stopParts = _optionalChain([parts, 'access', _1086 => _1086[0], 'optionalAccess', _1087 => _1087.startsWith, 'call', _1088 => _1088("circle")]) ? parts.slice(1) : parts;
13355
13411
  const gradient = context.createRadialGradient(
13356
13412
  rect.left + rect.width / 2,
13357
13413
  rect.top + rect.height / 2,
@@ -13424,8 +13480,8 @@ function drawCanvasConditionalIcon(context, icon, centerX, centerY, size) {
13424
13480
  context.fill();
13425
13481
  context.restore();
13426
13482
  }
13427
- function formatZoomScale(zoomScale) {
13428
- return `${Math.round(zoomScale)}%`;
13483
+ function formatZoomScale(zoomScale, locale) {
13484
+ return new Intl.NumberFormat(locale, { style: "percent", maximumFractionDigits: 0 }).format(zoomScale / 100);
13429
13485
  }
13430
13486
  function parseRgbColor(color) {
13431
13487
  const match = /^#?([0-9a-f]{6})$/i.exec(color);
@@ -13458,8 +13514,8 @@ function lightenColor(color, ratio) {
13458
13514
  function darkenColor(color, ratio) {
13459
13515
  return mixRgbColor(color, "#000000", ratio);
13460
13516
  }
13461
- var ViewerContext = React6.createContext(null);
13462
- var ViewerAppearanceContext = React6.createContext({ isDark: false });
13517
+ var ViewerContext = React9.createContext(null);
13518
+ var ViewerAppearanceContext = React9.createContext({ isDark: false });
13463
13519
  function ReferenceRangeHandles({ color, top = true, bottom = true, left = true, right = true }) {
13464
13520
  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: {
13465
13521
  position: "absolute",
@@ -13475,7 +13531,7 @@ function resolveDarkModeSurface(themePalette, palette) {
13475
13531
  return "hsl(225 4% 6%)";
13476
13532
  }
13477
13533
  function resolveSheetSurface(sheet, palette) {
13478
- return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _1088 => _1088.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1089 => _1089.themePalette, 'access', _1090 => _1090.colorsByIndex, 'access', _1091 => _1091[0]]), () => ( SHEET_SURFACE));
13534
+ return paletteIsDark(palette) ? resolveDarkModeSurface(_optionalChain([sheet, 'optionalAccess', _1089 => _1089.themePalette]), palette) : _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1090 => _1090.themePalette, 'access', _1091 => _1091.colorsByIndex, 'access', _1092 => _1092[0]]), () => ( SHEET_SURFACE));
13479
13535
  }
13480
13536
  function normalizeRange2(range) {
13481
13537
  return {
@@ -13507,7 +13563,7 @@ function buildVisibleAxisIndices(precomputed, displayLimit, maxUsedIndex, hidden
13507
13563
  const visible2 = [];
13508
13564
  const usedLimit = Math.min(displayLimit, Math.max(0, maxUsedIndex + 1));
13509
13565
  for (let index = 0; index < usedLimit; index += 1) {
13510
- if (!_optionalChain([hiddenIndices, 'optionalAccess', _1092 => _1092.has, 'call', _1093 => _1093(index)])) {
13566
+ if (!_optionalChain([hiddenIndices, 'optionalAccess', _1093 => _1093.has, 'call', _1094 => _1094(index)])) {
13511
13567
  visible2.push(index);
13512
13568
  }
13513
13569
  }
@@ -13549,7 +13605,7 @@ function clampPercent(value, fallback) {
13549
13605
  return Math.max(0, Math.min(100, value));
13550
13606
  }
13551
13607
  function resolveShapeAdjustment(shape, name, fallback) {
13552
- const rawValue = _optionalChain([shape, 'access', _1094 => _1094.geometryAdjustments, 'optionalAccess', _1095 => _1095[name]]);
13608
+ const rawValue = _optionalChain([shape, 'access', _1095 => _1095.geometryAdjustments, 'optionalAccess', _1096 => _1096[name]]);
13553
13609
  if (typeof rawValue !== "number") {
13554
13610
  return fallback;
13555
13611
  }
@@ -14435,7 +14491,7 @@ function applyCanvasShapeDash(context, dash, lineWidth) {
14435
14491
  }
14436
14492
  }
14437
14493
  function useViewerPalette(isDark = false, headerBackgroundColor, headerTextColor) {
14438
- return React6.useMemo(
14494
+ return React9.useMemo(
14439
14495
  () => resolveViewerPalette(isDark, headerBackgroundColor, headerTextColor),
14440
14496
  [headerBackgroundColor, headerTextColor, isDark]
14441
14497
  );
@@ -14449,8 +14505,8 @@ function normalizeThumbnailResolution(resolution) {
14449
14505
  }
14450
14506
  const resolvedObject = typeof resolution === "object" && resolution ? resolution : void 0;
14451
14507
  return {
14452
- maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _1096 => _1096.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
14453
- maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _1097 => _1097.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
14508
+ maxHeight: _optionalChain([resolvedObject, 'optionalAccess', _1097 => _1097.maxHeight]) && Number.isFinite(resolvedObject.maxHeight) && resolvedObject.maxHeight > 0 ? resolvedObject.maxHeight : THUMBNAIL_DEFAULT_MAX_DIMENSION,
14509
+ maxWidth: _optionalChain([resolvedObject, 'optionalAccess', _1098 => _1098.maxWidth]) && Number.isFinite(resolvedObject.maxWidth) && resolvedObject.maxWidth > 0 ? resolvedObject.maxWidth : THUMBNAIL_DEFAULT_MAX_DIMENSION
14454
14510
  };
14455
14511
  }
14456
14512
  function resolveThumbnailOutputSize(sourceWidth, sourceHeight, resolution) {
@@ -14769,24 +14825,24 @@ function escapeCssFontFamily(name) {
14769
14825
  return /[\s"'(),]/.test(name) ? `"${name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : name;
14770
14826
  }
14771
14827
  function resolveSpreadsheetThemeFont(font, themePalette) {
14772
- const scheme = typeof _optionalChain([font, 'optionalAccess', _1098 => _1098.scheme]) === "string" ? font.scheme : null;
14828
+ const scheme = typeof _optionalChain([font, 'optionalAccess', _1099 => _1099.scheme]) === "string" ? font.scheme : null;
14773
14829
  if (scheme === "major") {
14774
- return _optionalChain([themePalette, 'optionalAccess', _1099 => _1099.majorLatinFont]);
14830
+ return _optionalChain([themePalette, 'optionalAccess', _1100 => _1100.majorLatinFont]);
14775
14831
  }
14776
14832
  if (scheme === "minor") {
14777
- return _optionalChain([themePalette, 'optionalAccess', _1100 => _1100.minorLatinFont]);
14833
+ return _optionalChain([themePalette, 'optionalAccess', _1101 => _1101.minorLatinFont]);
14778
14834
  }
14779
14835
  return void 0;
14780
14836
  }
14781
14837
  function buildSpreadsheetFontFamily(font, themePalette) {
14782
14838
  const candidates = [
14783
- typeof _optionalChain([font, 'optionalAccess', _1101 => _1101.name]) === "string" ? font.name.trim() : "",
14784
- _nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _1102 => _1102(font, themePalette), 'optionalAccess', _1103 => _1103.trim, 'call', _1104 => _1104()]), () => ( ""))
14839
+ typeof _optionalChain([font, 'optionalAccess', _1102 => _1102.name]) === "string" ? font.name.trim() : "",
14840
+ _nullishCoalesce(_optionalChain([resolveSpreadsheetThemeFont, 'call', _1103 => _1103(font, themePalette), 'optionalAccess', _1104 => _1104.trim, 'call', _1105 => _1105()]), () => ( ""))
14785
14841
  ].filter((value, index, array) => value.length > 0 && array.indexOf(value) === index);
14786
14842
  if (candidates.length === 0) {
14787
14843
  return void 0;
14788
14844
  }
14789
- const primaryFont = _optionalChain([candidates, 'access', _1105 => _1105[0], 'optionalAccess', _1106 => _1106.toLowerCase, 'call', _1107 => _1107()]);
14845
+ const primaryFont = _optionalChain([candidates, 'access', _1106 => _1106[0], 'optionalAccess', _1107 => _1107.toLowerCase, 'call', _1108 => _1108()]);
14790
14846
  if (primaryFont === "calibri") {
14791
14847
  return [
14792
14848
  "Calibri",
@@ -14819,17 +14875,17 @@ function resolveSpreadsheetLineHeight(fontSizePt) {
14819
14875
  }
14820
14876
  function buildGridlineShadow(color, options) {
14821
14877
  const parts = [];
14822
- if (_optionalChain([options, 'optionalAccess', _1108 => _1108.right]) !== false) {
14878
+ if (_optionalChain([options, 'optionalAccess', _1109 => _1109.right]) !== false) {
14823
14879
  parts.push(`inset -1px 0 0 ${color}`);
14824
14880
  }
14825
- if (_optionalChain([options, 'optionalAccess', _1109 => _1109.bottom]) !== false) {
14881
+ if (_optionalChain([options, 'optionalAccess', _1110 => _1110.bottom]) !== false) {
14826
14882
  parts.push(`inset 0 -1px 0 ${color}`);
14827
14883
  }
14828
14884
  return parts.join(", ");
14829
14885
  }
14830
14886
  function buildCellStyle(style, palette, themePalette, options) {
14831
- const showGridLines = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1110 => _1110.showGridLines]), () => ( true));
14832
- const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _1111 => _1111.colorsByIndex, 'access', _1112 => _1112[0]]), () => ( SHEET_SURFACE));
14887
+ const showGridLines = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1111 => _1111.showGridLines]), () => ( true));
14888
+ const baseSurface = paletteIsDark(palette) ? resolveDarkModeSurface(themePalette, palette) : _nullishCoalesce(_optionalChain([themePalette, 'optionalAccess', _1112 => _1112.colorsByIndex, 'access', _1113 => _1113[0]]), () => ( SHEET_SURFACE));
14833
14889
  const gridlineShadow = showGridLines ? buildGridlineShadow(palette.border) : void 0;
14834
14890
  const css = {
14835
14891
  backgroundColor: baseSurface,
@@ -14842,7 +14898,7 @@ function buildCellStyle(style, palette, themePalette, options) {
14842
14898
  lineHeight: String(resolveSpreadsheetLineHeight(11)),
14843
14899
  overflow: "hidden",
14844
14900
  padding: DEFAULT_CELL_PADDING,
14845
- textAlign: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1113 => _1113.generalAlignment]), () => ( "left")),
14901
+ textAlign: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _1114 => _1114.generalAlignment]), () => ( "left")),
14846
14902
  textOverflow: "clip",
14847
14903
  verticalAlign: "bottom",
14848
14904
  whiteSpace: "nowrap"
@@ -14926,24 +14982,24 @@ function buildCellStyle(style, palette, themePalette, options) {
14926
14982
  }
14927
14983
  const border = style.border;
14928
14984
  if (border) {
14929
- const hasRightBorder = Boolean(_optionalChain([border, 'access', _1114 => _1114.right, 'optionalAccess', _1115 => _1115.style]) && border.right.style !== "none");
14930
- const hasBottomBorder = Boolean(_optionalChain([border, 'access', _1116 => _1116.bottom, 'optionalAccess', _1117 => _1117.style]) && border.bottom.style !== "none");
14985
+ const hasRightBorder = Boolean(_optionalChain([border, 'access', _1115 => _1115.right, 'optionalAccess', _1116 => _1116.style]) && border.right.style !== "none");
14986
+ const hasBottomBorder = Boolean(_optionalChain([border, 'access', _1117 => _1117.bottom, 'optionalAccess', _1118 => _1118.style]) && border.bottom.style !== "none");
14931
14987
  if (showGridLines && (hasRightBorder || hasBottomBorder)) {
14932
14988
  css.boxShadow = buildGridlineShadow(palette.border, {
14933
14989
  bottom: !hasBottomBorder,
14934
14990
  right: !hasRightBorder
14935
14991
  }) || void 0;
14936
14992
  }
14937
- if (_optionalChain([border, 'access', _1118 => _1118.top, 'optionalAccess', _1119 => _1119.style]) && border.top.style !== "none") {
14993
+ if (_optionalChain([border, 'access', _1119 => _1119.top, 'optionalAccess', _1120 => _1120.style]) && border.top.style !== "none") {
14938
14994
  css.borderTop = mapBorder2(border.top, themePalette);
14939
14995
  }
14940
- if (_optionalChain([border, 'access', _1120 => _1120.right, 'optionalAccess', _1121 => _1121.style]) && border.right.style !== "none") {
14996
+ if (_optionalChain([border, 'access', _1121 => _1121.right, 'optionalAccess', _1122 => _1122.style]) && border.right.style !== "none") {
14941
14997
  css.borderRight = mapBorder2(border.right, themePalette);
14942
14998
  }
14943
- if (_optionalChain([border, 'access', _1122 => _1122.bottom, 'optionalAccess', _1123 => _1123.style]) && border.bottom.style !== "none") {
14999
+ if (_optionalChain([border, 'access', _1123 => _1123.bottom, 'optionalAccess', _1124 => _1124.style]) && border.bottom.style !== "none") {
14944
15000
  css.borderBottom = mapBorder2(border.bottom, themePalette);
14945
15001
  }
14946
- if (_optionalChain([border, 'access', _1124 => _1124.left, 'optionalAccess', _1125 => _1125.style]) && border.left.style !== "none") {
15002
+ if (_optionalChain([border, 'access', _1125 => _1125.left, 'optionalAccess', _1126 => _1126.style]) && border.left.style !== "none") {
14947
15003
  css.borderLeft = mapBorder2(border.left, themePalette);
14948
15004
  }
14949
15005
  }
@@ -14989,7 +15045,7 @@ function measureTextWidth(value, style) {
14989
15045
  }
14990
15046
  function getCellDisplayValue(worksheet, row, col, activeSheet, locale = "en-US") {
14991
15047
  const formula = worksheet.getFormulaAt(row, col);
14992
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _1126 => _1126.cachedFormulaValues, 'optionalAccess', _1127 => _1127[cellAddressToA12({ row, col })]]) : void 0;
15048
+ const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _1127 => _1127.cachedFormulaValues, 'optionalAccess', _1128 => _1128[cellAddressToA12({ row, col })]]) : void 0;
14993
15049
  const formatted = worksheet.getFormattedValueAt(row, col);
14994
15050
  if (formatted && !(formula && cachedFormulaValue !== void 0 && formatted.startsWith("#"))) {
14995
15051
  return localizeCellNumber(worksheet, row, col, decodeHtmlEntities2(formatted), locale);
@@ -15236,7 +15292,7 @@ function normalizeBatchedMergeSpan(value) {
15236
15292
  }
15237
15293
  function normalizeBatchedCellValue(rawValue, formula, row, col, activeSheet) {
15238
15294
  const value = typeof rawValue === "string" ? decodeHtmlEntities2(rawValue) : rawValue === null || rawValue === void 0 ? "" : String(rawValue);
15239
- const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _1128 => _1128.cachedFormulaValues, 'optionalAccess', _1129 => _1129[cellAddressToA12({ row, col })]]) : void 0;
15295
+ const cachedFormulaValue = formula ? _optionalChain([activeSheet, 'optionalAccess', _1129 => _1129.cachedFormulaValues, 'optionalAccess', _1130 => _1130[cellAddressToA12({ row, col })]]) : void 0;
15240
15296
  if (formula && cachedFormulaValue !== void 0 && value.startsWith("#")) {
15241
15297
  return cachedFormulaValue;
15242
15298
  }
@@ -15283,31 +15339,31 @@ function mergeResolvedCellStyle(base, overlay, options) {
15283
15339
  ..._nullishCoalesce(base, () => ( {})),
15284
15340
  ..._nullishCoalesce(overlay, () => ( {}))
15285
15341
  };
15286
- const baseAlignment = _optionalChain([base, 'optionalAccess', _1130 => _1130.alignment]);
15287
- const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _1131 => _1131.alignment]);
15342
+ const baseAlignment = _optionalChain([base, 'optionalAccess', _1131 => _1131.alignment]);
15343
+ const overlayAlignment = _optionalChain([overlay, 'optionalAccess', _1132 => _1132.alignment]);
15288
15344
  if (baseAlignment || overlayAlignment) {
15289
15345
  nextStyle.alignment = {
15290
15346
  ..._nullishCoalesce(baseAlignment, () => ( {})),
15291
15347
  ..._nullishCoalesce(overlayAlignment, () => ( {}))
15292
15348
  };
15293
15349
  }
15294
- const baseBorder = _optionalChain([base, 'optionalAccess', _1132 => _1132.border]);
15295
- const overlayBorder = _optionalChain([overlay, 'optionalAccess', _1133 => _1133.border]);
15350
+ const baseBorder = _optionalChain([base, 'optionalAccess', _1133 => _1133.border]);
15351
+ const overlayBorder = _optionalChain([overlay, 'optionalAccess', _1134 => _1134.border]);
15296
15352
  if (baseBorder || overlayBorder) {
15297
- nextStyle.border = _optionalChain([options, 'optionalAccess', _1134 => _1134.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
15353
+ nextStyle.border = _optionalChain([options, 'optionalAccess', _1135 => _1135.replaceXfSubtrees]) && overlayBorder ? overlayBorder : {
15298
15354
  ..._nullishCoalesce(baseBorder, () => ( {})),
15299
15355
  ..._nullishCoalesce(overlayBorder, () => ( {}))
15300
15356
  };
15301
15357
  }
15302
- const baseFill = _optionalChain([base, 'optionalAccess', _1135 => _1135.fill]);
15303
- const overlayFill = _optionalChain([overlay, 'optionalAccess', _1136 => _1136.fill]);
15358
+ const baseFill = _optionalChain([base, 'optionalAccess', _1136 => _1136.fill]);
15359
+ const overlayFill = _optionalChain([overlay, 'optionalAccess', _1137 => _1137.fill]);
15304
15360
  if (baseFill || overlayFill) {
15305
- nextStyle.fill = _optionalChain([options, 'optionalAccess', _1137 => _1137.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
15361
+ nextStyle.fill = _optionalChain([options, 'optionalAccess', _1138 => _1138.replaceXfSubtrees]) && overlayFill ? overlayFill : _nullishCoalesce(overlayFill, () => ( baseFill));
15306
15362
  }
15307
- const baseFont = _optionalChain([base, 'optionalAccess', _1138 => _1138.font]);
15308
- const overlayFont = _optionalChain([overlay, 'optionalAccess', _1139 => _1139.font]);
15363
+ const baseFont = _optionalChain([base, 'optionalAccess', _1139 => _1139.font]);
15364
+ const overlayFont = _optionalChain([overlay, 'optionalAccess', _1140 => _1140.font]);
15309
15365
  if (baseFont || overlayFont) {
15310
- nextStyle.font = _optionalChain([options, 'optionalAccess', _1140 => _1140.replaceXfSubtrees]) && overlayFont ? overlayFont : {
15366
+ nextStyle.font = _optionalChain([options, 'optionalAccess', _1141 => _1141.replaceXfSubtrees]) && overlayFont ? overlayFont : {
15311
15367
  ..._nullishCoalesce(baseFont, () => ( {})),
15312
15368
  ..._nullishCoalesce(overlayFont, () => ( {}))
15313
15369
  };
@@ -15316,6 +15372,7 @@ function mergeResolvedCellStyle(base, overlay, options) {
15316
15372
  }
15317
15373
  function SegmentedControl({
15318
15374
  items,
15375
+ messages,
15319
15376
  onValueChange,
15320
15377
  palette,
15321
15378
  value
@@ -15323,7 +15380,7 @@ function SegmentedControl({
15323
15380
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15324
15381
  "div",
15325
15382
  {
15326
- "aria-label": "Workbook sheets",
15383
+ "aria-label": messages.workbookSheets,
15327
15384
  role: "tablist",
15328
15385
  style: {
15329
15386
  alignItems: "center",
@@ -15375,6 +15432,8 @@ function DefaultToolbar({ controller, palette }) {
15375
15432
  canZoomIn,
15376
15433
  canZoomOut,
15377
15434
  defaultZoomScale,
15435
+ locale,
15436
+ messages,
15378
15437
  displayFileName,
15379
15438
  download,
15380
15439
  resetZoom,
@@ -15430,6 +15489,7 @@ function DefaultToolbar({ controller, palette }) {
15430
15489
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15431
15490
  "button",
15432
15491
  {
15492
+ "aria-label": messages.zoomOut,
15433
15493
  disabled: !canZoomOut,
15434
15494
  onClick: zoomOut,
15435
15495
  style: {
@@ -15448,6 +15508,7 @@ function DefaultToolbar({ controller, palette }) {
15448
15508
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15449
15509
  "button",
15450
15510
  {
15511
+ "aria-label": messages.resetZoom,
15451
15512
  onClick: resetZoom,
15452
15513
  style: {
15453
15514
  background: Math.round(zoomScale) === Math.round(defaultZoomScale) ? "transparent" : palette.subtleSurface,
@@ -15462,12 +15523,13 @@ function DefaultToolbar({ controller, palette }) {
15462
15523
  padding: "6px 10px"
15463
15524
  },
15464
15525
  type: "button",
15465
- children: formatZoomScale(zoomScale)
15526
+ children: formatZoomScale(zoomScale, locale)
15466
15527
  }
15467
15528
  ),
15468
15529
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15469
15530
  "button",
15470
15531
  {
15532
+ "aria-label": messages.zoomIn,
15471
15533
  disabled: !canZoomIn,
15472
15534
  onClick: zoomIn,
15473
15535
  style: {
@@ -15489,7 +15551,7 @@ function DefaultToolbar({ controller, palette }) {
15489
15551
  canDownload ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15490
15552
  "button",
15491
15553
  {
15492
- "aria-label": "Download workbook",
15554
+ "aria-label": messages.downloadWorkbook,
15493
15555
  onClick: download,
15494
15556
  style: {
15495
15557
  alignItems: "center",
@@ -15506,7 +15568,7 @@ function DefaultToolbar({ controller, palette }) {
15506
15568
  padding: 0,
15507
15569
  width: 32
15508
15570
  },
15509
- title: "Download workbook",
15571
+ title: messages.downloadWorkbook,
15510
15572
  type: "button",
15511
15573
  children: "\u2193"
15512
15574
  }
@@ -15527,10 +15589,11 @@ function DefaultToolbar({ controller, palette }) {
15527
15589
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
15528
15590
  SegmentedControl,
15529
15591
  {
15592
+ messages,
15530
15593
  items: tabs.map((tab, index) => ({
15531
15594
  id: String(index),
15532
15595
  label: tab.name,
15533
- title: tab.visibility === "hidden" ? `${tab.name} (hidden)` : tab.visibility === "veryHidden" ? `${tab.name} (very hidden)` : tab.name,
15596
+ title: tab.visibility === "hidden" ? _chunkZPDHTVL6cjs.formatMessage.call(void 0, messages.hiddenSheet, { sheet: tab.name }) : tab.visibility === "veryHidden" ? _chunkZPDHTVL6cjs.formatMessage.call(void 0, messages.veryHiddenSheet, { sheet: tab.name }) : tab.name,
15534
15597
  visibility: tab.visibility
15535
15598
  })),
15536
15599
  onValueChange: (value) => setActiveTabIndex(Number(value)),
@@ -15663,11 +15726,11 @@ function resolveConditionalFormulaComparable(formula, worksheet, sheet, batchedC
15663
15726
  return literal;
15664
15727
  }
15665
15728
  const splitReference = splitSheetFormulaReference(normalized);
15666
- const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _1141 => _1141.sheetName]), () => ( null));
15667
- if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _1142 => _1142.name]) && targetSheetName !== sheet.name) {
15729
+ const targetSheetName = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _1142 => _1142.sheetName]), () => ( null));
15730
+ if (targetSheetName && _optionalChain([sheet, 'optionalAccess', _1143 => _1143.name]) && targetSheetName !== sheet.name) {
15668
15731
  return literal;
15669
15732
  }
15670
- const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _1143 => _1143.range]), () => ( normalized));
15733
+ const cellRef = _nullishCoalesce(_optionalChain([splitReference, 'optionalAccess', _1144 => _1144.range]), () => ( normalized));
15671
15734
  const cell = parseA1CellReference3(cellRef.replace(/\$/g, ""));
15672
15735
  if (!cell) {
15673
15736
  return literal;
@@ -15699,8 +15762,8 @@ function normalizeConditionalTextOperand(value) {
15699
15762
  }
15700
15763
  function resolveConditionalStyledRuleMatch(rule, numericValue, textValue, worksheet, sheet, batchedCells) {
15701
15764
  const normalizedRuleType = rule.ruleType.trim().toLowerCase();
15702
- const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _1144 => _1144.formulas, 'optionalAccess', _1145 => _1145[0]]), () => ( "")), worksheet, sheet, batchedCells);
15703
- const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _1146 => _1146.formulas, 'optionalAccess', _1147 => _1147[1]]), () => ( "")), worksheet, sheet, batchedCells);
15765
+ const left = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _1145 => _1145.formulas, 'optionalAccess', _1146 => _1146[0]]), () => ( "")), worksheet, sheet, batchedCells);
15766
+ const right = resolveConditionalFormulaComparable(_nullishCoalesce(_optionalChain([rule, 'access', _1147 => _1147.formulas, 'optionalAccess', _1148 => _1148[1]]), () => ( "")), worksheet, sheet, batchedCells);
15704
15767
  if (normalizedRuleType === "cellis") {
15705
15768
  return resolveConditionalCellIsMatch(_nullishCoalesce(rule.operator, () => ( "equal")), left, right, numericValue, textValue);
15706
15769
  }
@@ -15731,7 +15794,7 @@ function getStyledConditionalRules(rules) {
15731
15794
  return styledRules;
15732
15795
  }
15733
15796
  function resolveConditionalCellStyleForCell(row, col, sheet, readNumericValue, readTextValue, worksheet, batchedCells) {
15734
- const rules = _optionalChain([sheet, 'optionalAccess', _1148 => _1148.conditionalFormatRules]);
15797
+ const rules = _optionalChain([sheet, 'optionalAccess', _1149 => _1149.conditionalFormatRules]);
15735
15798
  if (!sheet || !rules || rules.length === 0) {
15736
15799
  return null;
15737
15800
  }
@@ -15935,11 +15998,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
15935
15998
  if (shape.paragraphs.length === 0) {
15936
15999
  return;
15937
16000
  }
15938
- const inset = _optionalChain([shape, 'access', _1149 => _1149.textBox, 'optionalAccess', _1150 => _1150.insetPx]);
15939
- const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1151 => _1151.left]), () => ( 6))) * zoomFactor;
15940
- const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1152 => _1152.right]), () => ( 6))) * zoomFactor;
15941
- const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1153 => _1153.top]), () => ( 4))) * zoomFactor;
15942
- const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1154 => _1154.bottom]), () => ( 4))) * zoomFactor;
16001
+ const inset = _optionalChain([shape, 'access', _1150 => _1150.textBox, 'optionalAccess', _1151 => _1151.insetPx]);
16002
+ const paddingLeft = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1152 => _1152.left]), () => ( 6))) * zoomFactor;
16003
+ const paddingRight = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1153 => _1153.right]), () => ( 6))) * zoomFactor;
16004
+ const paddingTop = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1154 => _1154.top]), () => ( 4))) * zoomFactor;
16005
+ const paddingBottom = (_nullishCoalesce(_optionalChain([inset, 'optionalAccess', _1155 => _1155.bottom]), () => ( 4))) * zoomFactor;
15943
16006
  const textLeft = left + paddingLeft;
15944
16007
  const textTop = top + paddingTop;
15945
16008
  const textWidth = Math.max(0, width - paddingLeft - paddingRight);
@@ -15961,9 +16024,9 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
15961
16024
  });
15962
16025
  const totalTextHeight = lineMetrics.reduce((total, metric) => total + metric.lineHeight, 0);
15963
16026
  let y = textTop;
15964
- if (_optionalChain([shape, 'access', _1155 => _1155.textBox, 'optionalAccess', _1156 => _1156.verticalAlign]) === "middle") {
16027
+ if (_optionalChain([shape, 'access', _1156 => _1156.textBox, 'optionalAccess', _1157 => _1157.verticalAlign]) === "middle") {
15965
16028
  y = textTop + Math.max(0, (textHeight - totalTextHeight) / 2);
15966
- } else if (_optionalChain([shape, 'access', _1157 => _1157.textBox, 'optionalAccess', _1158 => _1158.verticalAlign]) === "bottom") {
16029
+ } else if (_optionalChain([shape, 'access', _1158 => _1158.textBox, 'optionalAccess', _1159 => _1159.verticalAlign]) === "bottom") {
15967
16030
  y = textTop + Math.max(0, textHeight - totalTextHeight);
15968
16031
  }
15969
16032
  context.save();
@@ -15974,7 +16037,7 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
15974
16037
  shape.paragraphs.forEach((paragraph, paragraphIndex) => {
15975
16038
  const metric = _nullishCoalesce(lineMetrics[paragraphIndex], () => ( { lineHeight: 14 * zoomFactor, widthPx: 0 }));
15976
16039
  let x = textLeft;
15977
- const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _1159 => _1159.textBox, 'optionalAccess', _1160 => _1160.horizontalAlign]))), () => ( "left"));
16040
+ const align = _nullishCoalesce(_nullishCoalesce(paragraph.align, () => ( _optionalChain([shape, 'access', _1160 => _1160.textBox, 'optionalAccess', _1161 => _1161.horizontalAlign]))), () => ( "left"));
15978
16041
  if (align === "center") {
15979
16042
  x = textLeft + Math.max(0, (textWidth - metric.widthPx) / 2);
15980
16043
  } else if (align === "right") {
@@ -16003,11 +16066,11 @@ function drawStaticShapeText(context, shape, left, top, width, height, zoomFacto
16003
16066
  context.restore();
16004
16067
  }
16005
16068
  function drawStaticShape(context, shape, rect, zoomFactor) {
16006
- const fillColor = _optionalChain([shape, 'access', _1161 => _1161.fill, 'optionalAccess', _1162 => _1162.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _1163 => _1163.fill, 'optionalAccess', _1164 => _1164.color]), () => ( "transparent"));
16007
- const strokeColor = _optionalChain([shape, 'access', _1165 => _1165.stroke, 'optionalAccess', _1166 => _1166.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _1167 => _1167.stroke, 'optionalAccess', _1168 => _1168.color]), () => ( "transparent"));
16008
- const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _1169 => _1169.stroke, 'optionalAccess', _1170 => _1170.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
16069
+ const fillColor = _optionalChain([shape, 'access', _1162 => _1162.fill, 'optionalAccess', _1163 => _1163.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _1164 => _1164.fill, 'optionalAccess', _1165 => _1165.color]), () => ( "transparent"));
16070
+ const strokeColor = _optionalChain([shape, 'access', _1166 => _1166.stroke, 'optionalAccess', _1167 => _1167.none]) ? "transparent" : _nullishCoalesce(_optionalChain([shape, 'access', _1168 => _1168.stroke, 'optionalAccess', _1169 => _1169.color]), () => ( "transparent"));
16071
+ const lineWidth = Math.max(0, (_nullishCoalesce(_optionalChain([shape, 'access', _1170 => _1170.stroke, 'optionalAccess', _1171 => _1171.widthPx]), () => ( (shape.geometry === "line" ? 2 : 1)))) * zoomFactor);
16009
16072
  const vectorShape = resolveShapeVector(shape);
16010
- const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _1171 => _1171.fill, 'optionalAccess', _1172 => _1172.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _1173 => _1173.stroke, 'optionalAccess', _1174 => _1174.opacity]), () => ( 1)));
16073
+ const opacity = Math.min(_nullishCoalesce(_optionalChain([shape, 'access', _1172 => _1172.fill, 'optionalAccess', _1173 => _1173.opacity]), () => ( 1)), _nullishCoalesce(_optionalChain([shape, 'access', _1174 => _1174.stroke, 'optionalAccess', _1175 => _1175.opacity]), () => ( 1)));
16011
16074
  context.save();
16012
16075
  context.translate(rect.left + rect.width / 2, rect.top + rect.height / 2);
16013
16076
  if (shape.rotationDeg) {
@@ -16018,7 +16081,7 @@ function drawStaticShape(context, shape, rect, zoomFactor) {
16018
16081
  context.lineWidth = lineWidth;
16019
16082
  context.strokeStyle = strokeColor;
16020
16083
  context.fillStyle = fillColor;
16021
- applyCanvasShapeDash(context, _optionalChain([shape, 'access', _1175 => _1175.stroke, 'optionalAccess', _1176 => _1176.dash]), lineWidth);
16084
+ applyCanvasShapeDash(context, _optionalChain([shape, 'access', _1176 => _1176.stroke, 'optionalAccess', _1177 => _1177.dash]), lineWidth);
16022
16085
  const localLeft = -rect.width / 2;
16023
16086
  const localTop = -rect.height / 2;
16024
16087
  if (vectorShape && typeof Path2D !== "undefined") {
@@ -16155,7 +16218,7 @@ function drawStaticFormControl(context, control, rect, palette, zoomFactor, shee
16155
16218
  context.restore();
16156
16219
  }
16157
16220
  function resolveConditionalDataBarForCell(row, col, worksheet, sheet, metricsCache) {
16158
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1177 => _1177.conditionalFormatRules]), () => ( []));
16221
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1178 => _1178.conditionalFormatRules]), () => ( []));
16159
16222
  const matchingRule = rules.find(
16160
16223
  (rule) => rule.kind === "dataBar" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
16161
16224
  );
@@ -16193,23 +16256,23 @@ function resolveConditionalDataBarForCell(row, col, worksheet, sheet, metricsCac
16193
16256
  const span = maxValue - minValue;
16194
16257
  const ratio = span === 0 ? numericValue >= maxValue ? 1 : 0 : (numericValue - minValue) / span;
16195
16258
  const widthPercent = minLength + Math.max(0, Math.min(1, ratio)) * (maxLength - minLength);
16196
- const color = resolveWorkbookColor(matchingRule.color, _optionalChain([sheet, 'optionalAccess', _1178 => _1178.themePalette]));
16259
+ const color = resolveWorkbookColor(matchingRule.color, _optionalChain([sheet, 'optionalAccess', _1179 => _1179.themePalette]));
16197
16260
  if (!color || widthPercent <= 0) {
16198
16261
  return null;
16199
16262
  }
16200
16263
  return {
16201
- axisColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _1179 => _1179.themePalette])), () => ( void 0)),
16264
+ axisColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.axisColor, _optionalChain([sheet, 'optionalAccess', _1180 => _1180.themePalette])), () => ( void 0)),
16202
16265
  border: _nullishCoalesce(matchingRule.border, () => ( void 0)),
16203
- borderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _1180 => _1180.themePalette])), () => ( void 0)),
16266
+ borderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.borderColor, _optionalChain([sheet, 'optionalAccess', _1181 => _1181.themePalette])), () => ( void 0)),
16204
16267
  color,
16205
16268
  gradient: _nullishCoalesce(matchingRule.gradient, () => ( void 0)),
16206
- negativeBorderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _1181 => _1181.themePalette])), () => ( void 0)),
16207
- negativeFillColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _1182 => _1182.themePalette])), () => ( void 0)),
16269
+ negativeBorderColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeBorderColor, _optionalChain([sheet, 'optionalAccess', _1182 => _1182.themePalette])), () => ( void 0)),
16270
+ negativeFillColor: _nullishCoalesce(resolveWorkbookColor(matchingRule.negativeFillColor, _optionalChain([sheet, 'optionalAccess', _1183 => _1183.themePalette])), () => ( void 0)),
16208
16271
  widthPercent
16209
16272
  };
16210
16273
  }
16211
16274
  function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metricsCache) {
16212
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1183 => _1183.conditionalFormatRules]), () => ( []));
16275
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1184 => _1184.conditionalFormatRules]), () => ( []));
16213
16276
  const matchingRule = rules.find(
16214
16277
  (rule) => rule.kind === "colorScale" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
16215
16278
  );
@@ -16237,7 +16300,7 @@ function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metrics
16237
16300
  });
16238
16301
  metricsCache.set(cacheKey, ruleValues);
16239
16302
  }
16240
- const colors = matchingRule.colors.map((color) => resolveWorkbookColor(color, _optionalChain([sheet, 'optionalAccess', _1184 => _1184.themePalette]))).filter((color) => typeof color === "string");
16303
+ const colors = matchingRule.colors.map((color) => resolveWorkbookColor(color, _optionalChain([sheet, 'optionalAccess', _1185 => _1185.themePalette]))).filter((color) => typeof color === "string");
16241
16304
  const thresholds = matchingRule.cfvos.map((threshold) => resolveConditionalRuleThreshold(threshold, ruleValues)).filter((value) => typeof value === "number" && Number.isFinite(value));
16242
16305
  if (colors.length < 2 || thresholds.length < 2) {
16243
16306
  return null;
@@ -16256,7 +16319,7 @@ function resolveConditionalColorScaleForCell(row, col, worksheet, sheet, metrics
16256
16319
  return { color: resolvedColor };
16257
16320
  }
16258
16321
  function resolveConditionalIconForCell(row, col, worksheet, sheet, metricsCache) {
16259
- const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1185 => _1185.conditionalFormatRules]), () => ( []));
16322
+ const rules = _nullishCoalesce(_optionalChain([sheet, 'optionalAccess', _1186 => _1186.conditionalFormatRules]), () => ( []));
16260
16323
  const matchingRule = rules.find(
16261
16324
  (rule) => rule.kind === "iconSet" && rule.ranges.some((range) => isCellInRange({ row, col }, range))
16262
16325
  );
@@ -16319,6 +16382,10 @@ function GridRow({
16319
16382
  editingValue,
16320
16383
  formulaReferences,
16321
16384
  editorBoxShadow,
16385
+ editorRef,
16386
+ editorInputRef,
16387
+ cellEditorStyle,
16388
+ onFocusEditorOverlay,
16322
16389
  frozenRowHeaderZIndex,
16323
16390
  getCellData,
16324
16391
  headerLabelLiveScale,
@@ -16548,7 +16615,7 @@ function GridRow({
16548
16615
  whiteSpace: "nowrap",
16549
16616
  width: "max-content"
16550
16617
  } : null;
16551
- const title = [_optionalChain([cellData, 'access', _1186 => _1186.hyperlink, 'optionalAccess', _1187 => _1187.tooltip]), _optionalChain([cellData, 'access', _1188 => _1188.validation, 'optionalAccess', _1189 => _1189.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
16618
+ const title = [_optionalChain([cellData, 'access', _1187 => _1187.hyperlink, 'optionalAccess', _1188 => _1188.tooltip]), _optionalChain([cellData, 'access', _1189 => _1189.validation, 'optionalAccess', _1190 => _1190.message]), cellData.value].filter((value, index, values) => typeof value === "string" && value.length > 0 && values.indexOf(value) === index).join("\n");
16552
16619
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
16553
16620
  "td",
16554
16621
  {
@@ -16654,6 +16721,9 @@ function GridRow({
16654
16721
  isEditing ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
16655
16722
  CellEditor,
16656
16723
  {
16724
+ editorRef,
16725
+ inputRef: editorInputRef,
16726
+ onFocusOverlay: onFocusEditorOverlay,
16657
16727
  value: editingValue,
16658
16728
  references: formulaReferences,
16659
16729
  onBlur: onEditingBlur,
@@ -16668,7 +16738,8 @@ function GridRow({
16668
16738
  font: "inherit",
16669
16739
  lineHeight: cellData.style.lineHeight,
16670
16740
  verticalAlign: cellData.style.verticalAlign,
16671
- padding: cellData.style.padding
16741
+ padding: cellData.style.padding,
16742
+ ...cellEditorStyle
16672
16743
  }
16673
16744
  }
16674
16745
  ) : isSpilling ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -16731,12 +16802,12 @@ function GridRow({
16731
16802
  ) : null
16732
16803
  ] });
16733
16804
  }
16734
- var MemoGridRow = React6.memo(GridRow, (prev, next) => {
16735
- 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.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment) {
16805
+ var MemoGridRow = React9.memo(GridRow, (prev, next) => {
16806
+ 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.onRowResizePointerDown !== next.onRowResizePointerDown || prev.renderCellAdornment !== next.renderCellAdornment || prev.cellEditorStyle !== next.cellEditorStyle || prev.onFocusEditorOverlay !== next.onFocusEditorOverlay) {
16736
16807
  return false;
16737
16808
  }
16738
- const prevEditingCol = _optionalChain([prev, 'access', _1190 => _1190.editingCell, 'optionalAccess', _1191 => _1191.row]) === prev.actualRow ? prev.editingCell.col : -1;
16739
- const nextEditingCol = _optionalChain([next, 'access', _1192 => _1192.editingCell, 'optionalAccess', _1193 => _1193.row]) === next.actualRow ? next.editingCell.col : -1;
16809
+ const prevEditingCol = _optionalChain([prev, 'access', _1191 => _1191.editingCell, 'optionalAccess', _1192 => _1192.row]) === prev.actualRow ? prev.editingCell.col : -1;
16810
+ const nextEditingCol = _optionalChain([next, 'access', _1193 => _1193.editingCell, 'optionalAccess', _1194 => _1194.row]) === next.actualRow ? next.editingCell.col : -1;
16740
16811
  if (prevEditingCol !== nextEditingCol) {
16741
16812
  return false;
16742
16813
  }
@@ -16760,7 +16831,7 @@ function XlsxViewerProvider({ children, controller, isDark = false, ...options }
16760
16831
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, XlsxViewerProviderWithInlineController, { ...options, isDark, children });
16761
16832
  }
16762
16833
  function useXlsxViewer() {
16763
- const context = React6.useContext(ViewerContext);
16834
+ const context = React9.useContext(ViewerContext);
16764
16835
  if (!context) {
16765
16836
  throw new Error("useXlsxViewer must be used inside XlsxViewer or XlsxViewerProvider.");
16766
16837
  }
@@ -16776,7 +16847,7 @@ function useXlsxViewerSelection() {
16776
16847
  selectRange,
16777
16848
  selection
16778
16849
  } = useXlsxViewer();
16779
- return React6.useMemo(
16850
+ return React9.useMemo(
16780
16851
  () => ({
16781
16852
  activeCell,
16782
16853
  activeCellAddress,
@@ -16802,7 +16873,7 @@ function useXlsxViewerZoom() {
16802
16873
  zoomOut,
16803
16874
  zoomScale
16804
16875
  } = useXlsxViewer();
16805
- return React6.useMemo(
16876
+ return React9.useMemo(
16806
16877
  () => ({
16807
16878
  canZoomIn,
16808
16879
  canZoomOut,
@@ -16860,6 +16931,7 @@ function useXlsxViewerEditing() {
16860
16931
  selectedValue,
16861
16932
  setCellFormula,
16862
16933
  setCellStyle,
16934
+ setCellStyles,
16863
16935
  setCellValue,
16864
16936
  setRangeStyle,
16865
16937
  setSelectedFormula,
@@ -16870,7 +16942,7 @@ function useXlsxViewerEditing() {
16870
16942
  unmergeSelection,
16871
16943
  updateFormControl
16872
16944
  } = useXlsxViewer();
16873
- return React6.useMemo(
16945
+ return React9.useMemo(
16874
16946
  () => ({
16875
16947
  addFormControl,
16876
16948
  addSheet,
@@ -16901,6 +16973,7 @@ function useXlsxViewerEditing() {
16901
16973
  selectedValue,
16902
16974
  setCellFormula,
16903
16975
  setCellStyle,
16976
+ setCellStyles,
16904
16977
  setCellValue,
16905
16978
  setRangeStyle,
16906
16979
  setSelectedFormula,
@@ -16941,6 +17014,7 @@ function useXlsxViewerEditing() {
16941
17014
  selectedValue,
16942
17015
  setCellFormula,
16943
17016
  setCellStyle,
17017
+ setCellStyles,
16944
17018
  setCellValue,
16945
17019
  setRangeStyle,
16946
17020
  setSelectedFormula,
@@ -16955,7 +17029,7 @@ function useXlsxViewerEditing() {
16955
17029
  }
16956
17030
  function useXlsxViewerTables() {
16957
17031
  const { sortState, sortTable, tables } = useXlsxViewer();
16958
- return React6.useMemo(
17032
+ return React9.useMemo(
16959
17033
  () => ({
16960
17034
  sortState,
16961
17035
  sortTable,
@@ -16996,7 +17070,7 @@ function useXlsxViewerImages() {
16996
17070
  setImageRect,
16997
17071
  updateChart
16998
17072
  } = useXlsxViewer();
16999
- return React6.useMemo(
17073
+ return React9.useMemo(
17000
17074
  () => ({
17001
17075
  charts,
17002
17076
  clearSelectedChart,
@@ -17089,7 +17163,7 @@ function useXlsxViewerCharts() {
17089
17163
  tabs,
17090
17164
  updateChart
17091
17165
  } = useXlsxViewer();
17092
- return React6.useMemo(
17166
+ return React9.useMemo(
17093
17167
  () => ({
17094
17168
  activeTab,
17095
17169
  activeTabIndex,
@@ -17156,30 +17230,30 @@ function useXlsxViewerThumbnails(options = {}) {
17156
17230
  workbook,
17157
17231
  sheets
17158
17232
  } = useXlsxViewer();
17159
- const { headerBackgroundColor, headerTextColor, isDark } = React6.useContext(ViewerAppearanceContext);
17233
+ const { headerBackgroundColor, headerTextColor, isDark } = React9.useContext(ViewerAppearanceContext);
17160
17234
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
17161
17235
  const includeHeaders = _nullishCoalesce(options.includeHeaders, () => ( true));
17162
17236
  const resolution = options.resolution;
17163
- const thumbnailImageCacheRef = React6.useRef(/* @__PURE__ */ new Map());
17164
- const workerThumbnailRowBatchCacheRef = React6.useRef(/* @__PURE__ */ new Map());
17165
- const workerThumbnailRowBatchRequestRef = React6.useRef(
17237
+ const thumbnailImageCacheRef = React9.useRef(/* @__PURE__ */ new Map());
17238
+ const workerThumbnailRowBatchCacheRef = React9.useRef(/* @__PURE__ */ new Map());
17239
+ const workerThumbnailRowBatchRequestRef = React9.useRef(
17166
17240
  /* @__PURE__ */ new Map()
17167
17241
  );
17168
- const isMountedRef = React6.useRef(false);
17169
- const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React6.useState(0);
17170
- const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React6.useState(0);
17171
- React6.useEffect(() => {
17242
+ const isMountedRef = React9.useRef(false);
17243
+ const [thumbnailImageLoadVersion, setThumbnailImageLoadVersion] = React9.useState(0);
17244
+ const [workerThumbnailRowBatchVersion, setWorkerThumbnailRowBatchVersion] = React9.useState(0);
17245
+ React9.useEffect(() => {
17172
17246
  isMountedRef.current = true;
17173
17247
  return () => {
17174
17248
  isMountedRef.current = false;
17175
17249
  };
17176
17250
  }, []);
17177
- React6.useEffect(() => {
17251
+ React9.useEffect(() => {
17178
17252
  workerThumbnailRowBatchCacheRef.current.clear();
17179
17253
  workerThumbnailRowBatchRequestRef.current.clear();
17180
17254
  setWorkerThumbnailRowBatchVersion((version) => version + 1);
17181
17255
  }, [locale]);
17182
- React6.useEffect(() => {
17256
+ React9.useEffect(() => {
17183
17257
  const currentSheets = new Set(sheets);
17184
17258
  for (const sheet of workerThumbnailRowBatchCacheRef.current.keys()) {
17185
17259
  if (!currentSheets.has(sheet)) {
@@ -17192,7 +17266,7 @@ function useXlsxViewerThumbnails(options = {}) {
17192
17266
  }
17193
17267
  }
17194
17268
  }, [sheets]);
17195
- const getWorkerThumbnailRowBatch = React6.useCallback((sheet, startRow, endRow) => {
17269
+ const getWorkerThumbnailRowBatch = React9.useCallback((sheet, startRow, endRow) => {
17196
17270
  const cachedBatch = workerThumbnailRowBatchCacheRef.current.get(sheet);
17197
17271
  if (cachedBatch && startRow >= cachedBatch.startRow && endRow <= cachedBatch.endRow) {
17198
17272
  return cachedBatch;
@@ -17203,8 +17277,8 @@ function useXlsxViewerThumbnails(options = {}) {
17203
17277
  const pendingRequest = workerThumbnailRowBatchRequestRef.current.get(sheet);
17204
17278
  if (!pendingRequest) {
17205
17279
  const request = {
17206
- endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _1194 => _1194.endRow]), () => ( endRow))),
17207
- startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _1195 => _1195.startRow]), () => ( startRow)))
17280
+ endRow: Math.max(endRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _1195 => _1195.endRow]), () => ( endRow))),
17281
+ startRow: Math.min(startRow, _nullishCoalesce(_optionalChain([cachedBatch, 'optionalAccess', _1196 => _1196.startRow]), () => ( startRow)))
17208
17282
  };
17209
17283
  workerThumbnailRowBatchRequestRef.current.set(sheet, request);
17210
17284
  void getRowsBatchAsync(
@@ -17234,7 +17308,7 @@ function useXlsxViewerThumbnails(options = {}) {
17234
17308
  }
17235
17309
  return null;
17236
17310
  }, [getRowsBatchAsync]);
17237
- const getThumbnailImage = React6.useCallback((image) => {
17311
+ const getThumbnailImage = React9.useCallback((image) => {
17238
17312
  if (typeof Image === "undefined") {
17239
17313
  return null;
17240
17314
  }
@@ -17266,9 +17340,9 @@ function useXlsxViewerThumbnails(options = {}) {
17266
17340
  imageElement.src = image.src;
17267
17341
  return null;
17268
17342
  }, []);
17269
- const thumbnails = React6.useMemo(() => {
17343
+ const thumbnails = React9.useMemo(() => {
17270
17344
  return sheets.map((sheet, sheetIndex) => {
17271
- const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _1196 => _1196.getSheet, 'call', _1197 => _1197(sheet.workbookSheetIndex)]), () => ( null));
17345
+ const worksheet = _nullishCoalesce(_optionalChain([workbook, 'optionalAccess', _1197 => _1197.getSheet, 'call', _1198 => _1198(sheet.workbookSheetIndex)]), () => ( null));
17272
17346
  const sheetImages = getSheetImages(sheetIndex).filter((image) => image.src).sort((left, right) => left.zIndex - right.zIndex);
17273
17347
  const sheetShapes = getSheetShapes(sheetIndex);
17274
17348
  const sheetFormControls = getSheetFormControls(sheetIndex).filter((control) => !control.hidden);
@@ -17284,18 +17358,18 @@ function useXlsxViewerThumbnails(options = {}) {
17284
17358
  minRow: 0
17285
17359
  }));
17286
17360
  return {
17287
- maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1198 => _1198.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
17288
- maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1199 => _1199.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
17289
- minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1200 => _1200.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
17290
- minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1201 => _1201.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
17361
+ maxCol: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1199 => _1199.maxCol]), () => ( drawingBound.maxCol)), drawingBound.maxCol),
17362
+ maxRow: Math.max(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1200 => _1200.maxRow]), () => ( drawingBound.maxRow)), drawingBound.maxRow),
17363
+ minCol: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1201 => _1201.minCol]), () => ( drawingBound.minCol)), drawingBound.minCol),
17364
+ minRow: Math.min(_nullishCoalesce(_optionalChain([bounds, 'optionalAccess', _1202 => _1202.minRow]), () => ( drawingBound.minRow)), drawingBound.minRow)
17291
17365
  };
17292
17366
  }, null);
17293
17367
  const sheetMinUsedRow = (_nullishCoalesce(sheet.maxUsedRow, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedRow, () => ( 0))) ? _nullishCoalesce(sheet.minUsedRow, () => ( 0)) : void 0;
17294
17368
  const sheetMinUsedCol = (_nullishCoalesce(sheet.maxUsedCol, () => ( -1))) >= (_nullishCoalesce(sheet.minUsedCol, () => ( 0))) ? _nullishCoalesce(sheet.minUsedCol, () => ( 0)) : void 0;
17295
- const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _1202 => _1202.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1203 => _1203.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
17296
- const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _1204 => _1204.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1205 => _1205.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
17297
- const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1206 => _1206.maxRow]), () => ( -1)));
17298
- const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1207 => _1207.maxCol]), () => ( -1)));
17369
+ const effectiveMinUsedRow = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedRow, () => ( _optionalChain([drawingBounds, 'optionalAccess', _1203 => _1203.minRow]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1204 => _1204.minRow]), () => ( sheetMinUsedRow)), () => ( 0))));
17370
+ const effectiveMinUsedCol = Math.max(0, Math.min(_nullishCoalesce(_nullishCoalesce(sheetMinUsedCol, () => ( _optionalChain([drawingBounds, 'optionalAccess', _1205 => _1205.minCol]))), () => ( 0)), _nullishCoalesce(_nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1206 => _1206.minCol]), () => ( sheetMinUsedCol)), () => ( 0))));
17371
+ const effectiveMaxUsedRow = Math.max(_nullishCoalesce(sheet.maxUsedRow, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1207 => _1207.maxRow]), () => ( -1)));
17372
+ const effectiveMaxUsedCol = Math.max(_nullishCoalesce(sheet.maxUsedCol, () => ( -1)), _nullishCoalesce(_optionalChain([drawingBounds, 'optionalAccess', _1208 => _1208.maxCol]), () => ( -1)));
17299
17373
  const showGridLines = _nullishCoalesce(sheet.showGridLines, () => ( true));
17300
17374
  const hiddenRowSet = new Set(_nullishCoalesce(sheet.hiddenRows, () => ( [])));
17301
17375
  const hiddenColSet = new Set(_nullishCoalesce(sheet.hiddenCols, () => ( [])));
@@ -17508,8 +17582,8 @@ function useXlsxViewerThumbnails(options = {}) {
17508
17582
  return cached;
17509
17583
  }
17510
17584
  const batchCoversRow = workerRowBatch ? row >= workerRowBatch.startRow && row <= workerRowBatch.endRow : false;
17511
- const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _1208 => _1208.cells, 'access', _1209 => _1209.get, 'call', _1210 => _1210(cacheKey)]) : void 0;
17512
- if (_optionalChain([batchedCell, 'optionalAccess', _1211 => _1211.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _1212 => _1212.isMergedSecondary, 'call', _1213 => _1213(row, col)])) {
17585
+ const batchedCell = batchCoversRow ? _optionalChain([workerRowBatch, 'optionalAccess', _1209 => _1209.cells, 'access', _1210 => _1210.get, 'call', _1211 => _1211(cacheKey)]) : void 0;
17586
+ if (_optionalChain([batchedCell, 'optionalAccess', _1212 => _1212.isMergedSecondary]) || _optionalChain([worksheet, 'optionalAccess', _1213 => _1213.isMergedSecondary, 'call', _1214 => _1214(row, col)])) {
17513
17587
  const mergedSecondaryData = {
17514
17588
  isMergedSecondary: true,
17515
17589
  style: {},
@@ -17518,23 +17592,23 @@ function useXlsxViewerThumbnails(options = {}) {
17518
17592
  cellRenderCache.set(cacheKey, mergedSecondaryData);
17519
17593
  return mergedSecondaryData;
17520
17594
  }
17521
- const merge = worksheet ? worksheet.getMergeSpan(row, col) : _optionalChain([batchedCell, 'optionalAccess', _1214 => _1214.mergeSpan]);
17595
+ const merge = worksheet ? worksheet.getMergeSpan(row, col) : _optionalChain([batchedCell, 'optionalAccess', _1215 => _1215.mergeSpan]);
17522
17596
  const inheritedStyle = resolveInheritedCellStyle2(sheet, row, col);
17523
- const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1215 => _1215.style]), () => ( null));
17597
+ const worksheetStyle = worksheet ? _nullishCoalesce(worksheet.getCellStyleAt(row, col), () => ( null)) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1216 => _1216.style]), () => ( null));
17524
17598
  const mergedStyle = mergeResolvedCellStyle(inheritedStyle, worksheetStyle, { replaceXfSubtrees: true });
17525
17599
  const conditionalCellStyle = resolveConditionalCellStyleForCell(
17526
17600
  row,
17527
17601
  col,
17528
17602
  sheet,
17529
17603
  () => worksheet ? getCellNumericValue(worksheet, row, col) : getBatchedCellNumericValue(batchedCell),
17530
- () => worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1216 => _1216.value]), () => ( "")),
17604
+ () => worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1217 => _1217.value]), () => ( "")),
17531
17605
  worksheet,
17532
- _optionalChain([workerRowBatch, 'optionalAccess', _1217 => _1217.cells])
17606
+ _optionalChain([workerRowBatch, 'optionalAccess', _1218 => _1218.cells])
17533
17607
  );
17534
17608
  const finalResolvedStyle = mergeResolvedCellStyle(mergedStyle, conditionalCellStyle);
17535
- const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _1218 => _1218.alignment]);
17609
+ const alignment = _optionalChain([finalResolvedStyle, 'optionalAccess', _1219 => _1219.alignment]);
17536
17610
  const sparkline = _nullishCoalesce(sparklineByCell.get(cacheKey), () => ( null));
17537
- const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _1219 => _1219.cells, 'access', _1220 => _1220.get, 'call', _1221 => _1221(`${targetRow}:${targetCol}`)]));
17611
+ const getNumericValue = (targetRow, targetCol) => worksheet ? getCellNumericValue(worksheet, targetRow, targetCol) : getBatchedCellNumericValue(_optionalChain([workerRowBatch, 'optionalAccess', _1220 => _1220.cells, 'access', _1221 => _1221.get, 'call', _1222 => _1222(`${targetRow}:${targetCol}`)]));
17538
17612
  const sparklineValues = sparkline ? sparkline.range.start.row === sparkline.range.end.row ? Array.from(
17539
17613
  { length: Math.abs(sparkline.range.end.col - sparkline.range.start.col) + 1 },
17540
17614
  (_, index) => getNumericValue(
@@ -17548,23 +17622,23 @@ function useXlsxViewerThumbnails(options = {}) {
17548
17622
  sparkline.range.start.col
17549
17623
  )
17550
17624
  ) : null;
17551
- const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _1222 => _1222.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row, col) : getBatchedCellBooleanValue(batchedCell) : null;
17625
+ const checkboxState = _optionalChain([finalResolvedStyle, 'optionalAccess', _1223 => _1223.cellControl]) ? worksheet ? getCellBooleanValue(worksheet, row, col) : getBatchedCellBooleanValue(batchedCell) : null;
17552
17626
  const nextData = {
17553
17627
  canvas: void 0,
17554
17628
  checkboxState,
17555
- colSpan: _optionalChain([merge, 'optionalAccess', _1223 => _1223.colSpan]),
17629
+ colSpan: _optionalChain([merge, 'optionalAccess', _1224 => _1224.colSpan]),
17556
17630
  conditionalColorScale: worksheet ? resolveConditionalColorScaleForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
17557
17631
  conditionalDataBar: worksheet ? resolveConditionalDataBarForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
17558
17632
  conditionalIcon: worksheet ? resolveConditionalIconForCell(row, col, worksheet, sheet, conditionalFormatMetricsCache) : null,
17559
17633
  isMergedSecondary: false,
17560
- rowSpan: _optionalChain([merge, 'optionalAccess', _1224 => _1224.rowSpan]),
17634
+ rowSpan: _optionalChain([merge, 'optionalAccess', _1225 => _1225.rowSpan]),
17561
17635
  sparkline: sparkline && sparklineValues ? { config: sparkline, values: sparklineValues } : null,
17562
17636
  style: buildCellStyle(finalResolvedStyle, palette, sheet.themePalette, {
17563
- generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row, col) : _optionalChain([batchedCell, 'optionalAccess', _1225 => _1225.generalAlignment]),
17637
+ generalAlignment: worksheet ? getCellGeneralAlignment(worksheet, row, col) : _optionalChain([batchedCell, 'optionalAccess', _1226 => _1226.generalAlignment]),
17564
17638
  showGridLines
17565
17639
  }),
17566
- textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _1226 => _1226.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _1227 => _1227.textRotation])))),
17567
- value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1228 => _1228.value]), () => ( ""))
17640
+ textRotationDeg: resolveSpreadsheetTextRotation(_nullishCoalesce(_optionalChain([alignment, 'optionalAccess', _1227 => _1227.rotation]), () => ( _optionalChain([alignment, 'optionalAccess', _1228 => _1228.textRotation])))),
17641
+ value: sparkline ? "" : checkboxState !== null ? "" : worksheet ? getCellDisplayValue(worksheet, row, col, sheet, locale) : _nullishCoalesce(_optionalChain([batchedCell, 'optionalAccess', _1229 => _1229.value]), () => ( ""))
17568
17642
  };
17569
17643
  nextData.canvas = buildCanvasCellStyleCache(nextData.style);
17570
17644
  cellRenderCache.set(cacheKey, nextData);
@@ -17582,11 +17656,11 @@ function useXlsxViewerThumbnails(options = {}) {
17582
17656
  let height = rowItem.size;
17583
17657
  for (let colOffset = 1; colOffset < colSpan; colOffset += 1) {
17584
17658
  const nextCol = colItemByActual.get(colItem.actualIndex + colOffset);
17585
- width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _1229 => _1229.size]), () => ( 0));
17659
+ width += _nullishCoalesce(_optionalChain([nextCol, 'optionalAccess', _1230 => _1230.size]), () => ( 0));
17586
17660
  }
17587
17661
  for (let rowOffset = 1; rowOffset < rowSpan; rowOffset += 1) {
17588
17662
  const nextRow = rowItemByActual.get(rowItem.actualIndex + rowOffset);
17589
- height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _1230 => _1230.size]), () => ( 0));
17663
+ height += _nullishCoalesce(_optionalChain([nextRow, 'optionalAccess', _1231 => _1231.size]), () => ( 0));
17590
17664
  }
17591
17665
  const rect = {
17592
17666
  height,
@@ -17596,7 +17670,7 @@ function useXlsxViewerThumbnails(options = {}) {
17596
17670
  };
17597
17671
  const canvasCellStyle = _nullishCoalesce(cellData.canvas, () => ( buildCanvasCellStyleCache(cellData.style)));
17598
17672
  const gradientFill = typeof cellData.style.backgroundImage === "string" ? resolveCanvasGradientFill(context, rect, cellData.style.backgroundImage) : null;
17599
- const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _1231 => _1231.conditionalColorScale, 'optionalAccess', _1232 => _1232.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
17673
+ const fillColor = _nullishCoalesce(_optionalChain([cellData, 'access', _1232 => _1232.conditionalColorScale, 'optionalAccess', _1233 => _1233.color]), () => ( (typeof cellData.style.backgroundColor === "string" ? cellData.style.backgroundColor : thumbnailSheetSurface)));
17600
17674
  context.fillStyle = _nullishCoalesce(gradientFill, () => ( fillColor));
17601
17675
  context.fillRect(rect.left, rect.top, rect.width, rect.height);
17602
17676
  if (cellData.conditionalDataBar) {
@@ -17840,11 +17914,11 @@ function useXlsxViewerThumbnails(options = {}) {
17840
17914
  locale,
17841
17915
  workbook
17842
17916
  ]);
17843
- const paintThumbnail = React6.useCallback(
17844
- (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _1233 => _1233[sheetIndex], 'optionalAccess', _1234 => _1234.paint, 'call', _1235 => _1235(canvas)]), () => ( false)),
17917
+ const paintThumbnail = React9.useCallback(
17918
+ (sheetIndex, canvas) => _nullishCoalesce(_optionalChain([thumbnails, 'access', _1234 => _1234[sheetIndex], 'optionalAccess', _1235 => _1235.paint, 'call', _1236 => _1236(canvas)]), () => ( false)),
17845
17919
  [thumbnails]
17846
17920
  );
17847
- return React6.useMemo(
17921
+ return React9.useMemo(
17848
17922
  () => ({
17849
17923
  paintThumbnail,
17850
17924
  thumbnails
@@ -17854,7 +17928,7 @@ function useXlsxViewerThumbnails(options = {}) {
17854
17928
  }
17855
17929
  function DefaultXlsxToolbar() {
17856
17930
  const controller = useXlsxViewer();
17857
- const { headerBackgroundColor, headerTextColor, isDark } = React6.useContext(ViewerAppearanceContext);
17931
+ const { headerBackgroundColor, headerTextColor, isDark } = React9.useContext(ViewerAppearanceContext);
17858
17932
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
17859
17933
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultToolbar, { controller, palette });
17860
17934
  }
@@ -17900,7 +17974,7 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init8.call
17900
17974
  }
17901
17975
  destroy() {
17902
17976
  this.destroyed = true;
17903
- _optionalChain([this, 'access', _1236 => _1236.observer, 'optionalAccess', _1237 => _1237.disconnect, 'call', _1238 => _1238()]);
17977
+ _optionalChain([this, 'access', _1237 => _1237.observer, 'optionalAccess', _1238 => _1238.disconnect, 'call', _1239 => _1239()]);
17904
17978
  this.observer = null;
17905
17979
  this.slots.clear();
17906
17980
  this.listeners.clear();
@@ -17929,9 +18003,9 @@ var SlotStore = (_class2 = class {constructor() { _class2.prototype.__init8.call
17929
18003
  }
17930
18004
  }, _class2);
17931
18005
  function RuntimeContent({ content }) {
17932
- const hostRef = React7.useRef(null);
17933
- const rootRef = React7.useRef(null);
17934
- React7.useLayoutEffect(() => {
18006
+ const hostRef = React10.useRef(null);
18007
+ const rootRef = React10.useRef(null);
18008
+ React10.useLayoutEffect(() => {
17935
18009
  const host = hostRef.current;
17936
18010
  if (!host) return;
17937
18011
  const root = _internal.__createContentRoot.call(void 0, host);
@@ -17941,8 +18015,8 @@ function RuntimeContent({ content }) {
17941
18015
  root.destroy();
17942
18016
  };
17943
18017
  }, []);
17944
- React7.useLayoutEffect(() => {
17945
- _optionalChain([rootRef, 'access', _1239 => _1239.current, 'optionalAccess', _1240 => _1240.update, 'call', _1241 => _1241(content)]);
18018
+ React10.useLayoutEffect(() => {
18019
+ _optionalChain([rootRef, 'access', _1240 => _1240.current, 'optionalAccess', _1241 => _1241.update, 'call', _1242 => _1242(content)]);
17946
18020
  }, [content]);
17947
18021
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { ref: hostRef, style: { display: "contents" } });
17948
18022
  }
@@ -17956,6 +18030,8 @@ function renderOptions(props, controller, slots, owner) {
17956
18030
  loadingComponent,
17957
18031
  loadingState,
17958
18032
  renderActiveCellOverlay,
18033
+ renderCellEditorOverlay,
18034
+ renderSelectionPopover,
17959
18035
  renderChartLoading,
17960
18036
  renderContextMenu,
17961
18037
  renderFormControl,
@@ -17976,6 +18052,14 @@ function renderOptions(props, controller, slots, owner) {
17976
18052
  fileTooLargeState: fileTooLargeState === void 0 ? void 0 : typeof fileTooLargeState === "function" ? ({ defaultNode, ...rest }) => slot("too-large", fileTooLargeState({ ...rest, defaultNode: runtime(defaultNode) })) : slot("too-large", fileTooLargeState),
17977
18053
  toolbar: toolbar === void 0 ? void 0 : typeof toolbar === "function" ? (current) => slot("toolbar", toolbar(current)) : slot("toolbar", toolbar),
17978
18054
  renderActiveCellOverlay: renderActiveCellOverlay ? (value) => slot(`active:${value.cell.row}:${value.cell.col}`, renderActiveCellOverlay(value)) : void 0,
18055
+ renderSelectionPopover: renderSelectionPopover ? (value) => {
18056
+ const content = renderSelectionPopover(value);
18057
+ return content == null || content === false ? null : slot("selection-popover", content);
18058
+ } : void 0,
18059
+ renderCellEditorOverlay: renderCellEditorOverlay ? (value) => {
18060
+ const content = renderCellEditorOverlay(value);
18061
+ return content == null || content === false ? null : slot("cell-editor-overlay", content);
18062
+ } : void 0,
17979
18063
  renderChartLoading: renderChartLoading ? ({ defaultNode, ...value }) => slot(`chart:${value.chart.id}`, renderChartLoading({ ...value, defaultNode: runtime(defaultNode) })) : void 0,
17980
18064
  renderContextMenu: renderContextMenu ? ({ defaultNode, ...value }) => slot("context-menu", renderContextMenu({ ...value, defaultNode: runtime(defaultNode) })) : void 0,
17981
18065
  renderFormControl: renderFormControl ? (value) => slot(`control:${value.control.id}`, renderFormControl(value)) : void 0,
@@ -17985,12 +18069,14 @@ function renderOptions(props, controller, slots, owner) {
17985
18069
  renderTableHeaderMenu: renderTableHeaderMenu ? (value) => slot(`table:${value.table.name}:${value.cell.row}:${value.cell.col}`, renderTableHeaderMenu(value)) : void 0
17986
18070
  };
17987
18071
  }
17988
- function BoundViewer({ props, controller }) {
17989
- const hostRef = React7.useRef(null);
17990
- const viewerRef = React7.useRef(null);
17991
- const slots = React7.useMemo(() => new SlotStore(), []);
17992
- React7.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
17993
- React7.useLayoutEffect(() => {
18072
+ function BoundViewer({ props, controller: sourceController }) {
18073
+ const messages = React10.useMemo(() => _chunkZPDHTVL6cjs.mergeMessages.call(void 0, sourceController.messages, props.messages), [sourceController.messages, props.messages]);
18074
+ const controller = React10.useMemo(() => ({ ...sourceController, messages }), [sourceController, messages]);
18075
+ const hostRef = React10.useRef(null);
18076
+ const viewerRef = React10.useRef(null);
18077
+ const slots = React10.useMemo(() => new SlotStore(), []);
18078
+ React10.useSyncExternalStore(slots.subscribe, slots.getSnapshot, slots.getServerSnapshot);
18079
+ React10.useLayoutEffect(() => {
17994
18080
  const host = hostRef.current;
17995
18081
  if (!host) return;
17996
18082
  slots.observe(host);
@@ -18002,9 +18088,9 @@ function BoundViewer({ props, controller }) {
18002
18088
  slots.destroy();
18003
18089
  };
18004
18090
  }, [slots]);
18005
- React7.useLayoutEffect(() => {
18091
+ React10.useLayoutEffect(() => {
18006
18092
  const host = hostRef.current;
18007
- if (host) _optionalChain([viewerRef, 'access', _1242 => _1242.current, 'optionalAccess', _1243 => _1243.update, 'call', _1244 => _1244(renderOptions(props, controller, slots, host.ownerDocument))]);
18093
+ if (host) _optionalChain([viewerRef, 'access', _1243 => _1243.current, 'optionalAccess', _1244 => _1244.update, 'call', _1245 => _1245(renderOptions(props, controller, slots, host.ownerDocument))]);
18008
18094
  }, [controller, props, slots]);
18009
18095
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ViewerAppearanceContext.Provider, { value: {
18010
18096
  headerBackgroundColor: props.headerBackgroundColor,
@@ -18020,7 +18106,7 @@ function UncontrolledViewer(props) {
18020
18106
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller });
18021
18107
  }
18022
18108
  function XlsxViewer(props) {
18023
- const context = React7.useContext(ViewerContext);
18109
+ const context = React10.useContext(ViewerContext);
18024
18110
  const controller = _nullishCoalesce(props.controller, () => ( context));
18025
18111
  return controller ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BoundViewer, { props, controller }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, UncontrolledViewer, { ...props });
18026
18112
  }