@sheetxl/grid-react 0.2.0 → 0.2.6

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.
@@ -1,21 +1,21 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_11irg_13{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_11irg_13 *{box-sizing:border-box!important}._sheetxl-grid_11irg_13 *:focus{outline:none}._sheetxl-grid_11irg_13 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_11irg_13 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_11irg_13 .sheetxl-stage{contain:strict}._sheetxl-grid_11irg_13 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-grid_h9wwa_7{position:relative;box-sizing:border-box;user-select:none}._sheetxl-grid_h9wwa_7 *{box-sizing:border-box!important}._sheetxl-grid_h9wwa_7 *:focus{outline:none}._sheetxl-grid_h9wwa_7 .cell-container{position:absolute;overflow:visible;white-space:pre}._sheetxl-grid_h9wwa_7 .cell-container>*{inset:0;position:absolute}._sheetxl-grid_h9wwa_7 .sheetxl-stage{contain:strict}._sheetxl-grid_h9wwa_7 .sheetxl-stage>*{contain:strict}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  import { jsx as Y, jsxs as Ht, Fragment as wn } from "react/jsx-runtime";
3
- import Sn, { memo as Dt, useCallback as O, useRef as J, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as Ee, useLayoutEffect as nn, useState as Je, version as qr, createElement as Jo, useReducer as Qo } from "react";
3
+ import Sn, { memo as Dt, useCallback as O, useRef as J, useEffect as st, useImperativeHandle as Ur, forwardRef as Ut, useMemo as Ee, useLayoutEffect as nn, useState as Je, version as Kr, createElement as Jo, useReducer as Qo } from "react";
4
4
  import { createRoot as Oi } from "react-dom/client";
5
- import { unstable_batchedUpdates as Li, createPortal as Kr } from "react-dom";
5
+ import { unstable_batchedUpdates as Li, createPortal as qr } from "react-dom";
6
6
  /**
7
- * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.2.0
7
+ * @license @sheetxl/grid-react - Grid - Advanced data grid component for React - v0.2.6
8
8
  *
9
9
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
10
10
  * License: The license can be found at https://www.sheetxl.com/license.
11
11
  */
12
12
  /**
13
- * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.2.0
13
+ * @license @sheetxl/utils - Utils - Utilities used by most SheetXL components. - v0.2.6
14
14
  *
15
15
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
16
16
  * License: The license can be found at https://www.sheetxl.com/license.
17
17
  */
18
- const it = "up", lt = "down", ot = "left", Ke = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Bt = "text/html", fn = "text/plain", Mo = "image/png", Di = Object.freeze({ left: 0, top: 0 }), zi = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ai = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
18
+ const it = "up", lt = "down", ot = "left", qe = "right", uo = "tl", Hn = "t", Nn = "l", Xt = "c", Bt = "text/html", fn = "text/plain", Mo = "image/png", Di = Object.freeze({ left: 0, top: 0 }), zi = Object.freeze({ left: 0, top: 0, bottom: 0, right: 0 }), Ai = Object.freeze({ x: 0, y: 0, width: 0, height: 0 });
19
19
  Object.freeze(Object.defineProperty({ __proto__: null, EmptyBounds: Ai, EmptyRect: zi, EmptyTopLeft: Di }, Symbol.toStringTag, { value: "Module" }));
20
20
  const Nt = "column", cn = "row", $i = Object.freeze({ colIndex: 0, rowIndex: 0 }), Bi = Object.freeze({ colStart: 0, rowStart: 0, colEnd: 0, rowEnd: 0 }), Yr = (e, t) => e.colStart === t.colStart ? e.rowStart - t.rowStart : e.colStart - t.colStart, Xr = (e, t) => e.rowStart === t.rowStart ? e.colStart - t.colStart : e.rowStart - t.rowStart, Fi = (e, t) => e.rowEnd === t.rowEnd ? t.colEnd - e.colEnd : t.rowEnd - e.rowEnd, ji = (e, t) => e.colEnd === t.colEnd ? t.rowEnd - e.rowEnd : t.colEnd - e.colEnd, or = (e, t) => e.colIndex === t.colIndex ? e.rowIndex - t.rowIndex : e.colIndex - t.colIndex, rr = (e, t) => e.rowIndex === t.rowIndex ? e.colIndex - t.colIndex : e.rowIndex - t.rowIndex, Gr = (e = cn, t = !1) => t ? e !== Nt ? Fi : ji : e !== Nt ? Xr : Yr, ir = (e, t) => e === t || !(!e || !t) && e.rowIndex === t.rowIndex && e.colIndex === t.colIndex, jo = (e, t) => e === t || !(!e || !t) && e.rowStart === t.rowStart && e.rowEnd === t.rowEnd && e.colStart === t.colStart && e.colEnd === t.colEnd, Vo = (e, t) => !(!e || !t || e.colStart > t.colEnd || t.colStart > e.colEnd || e.rowStart > t.rowEnd || t.rowStart > e.rowEnd), lr = (e, t) => {
21
21
  if (e === t) return !0;
@@ -164,7 +164,7 @@ _n.all = function(e, t) {
164
164
  return _n(n, o, t);
165
165
  }, {});
166
166
  };
167
- const qi = Object.freeze([]), Ki = Object.freeze({}), ur = (e) => e, so = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
167
+ const Ki = Object.freeze([]), qi = Object.freeze({}), ur = (e) => e, so = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
168
168
  let t = 16 * Math.random() | 0;
169
169
  return (e === "x" ? t : 3 & t | 8).toString(16);
170
170
  }), Zr = (e, t) => e === t || !(!Array.isArray(e) || !Array.isArray(t) || e.length !== t.length) && e.every((n, o) => n === t[o]), Fn = (e) => typeof e == "object" && !Array.isArray(e) && e !== null, Jr = (e) => typeof e != "object" || Array.isArray(e) || e === null ? e : (Object.keys(e).forEach(function(t) {
@@ -188,7 +188,7 @@ const qi = Object.freeze([]), Ki = Object.freeze({}), ur = (e) => e, so = () =>
188
188
  function ei() {
189
189
  return typeof process < "u" && process.release?.name === "node" || (typeof process < "u" && process.browser, !1);
190
190
  }
191
- const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: qi, EmptyObject: Ki, OSType: Ft, arrayMove: function(e, t, n) {
191
+ const wr = (e, t = !1) => (document.hasFocus() || t) && (e === document.activeElement || e?.contains(document.activeElement)), Ct = Object.freeze(Object.defineProperty({ __proto__: null, EmptyArray: Ki, EmptyObject: qi, OSType: Ft, arrayMove: function(e, t, n) {
192
192
  const o = e.slice();
193
193
  return o.splice(n < 0 ? o.length + n : n, 0, o.splice(t, 1)[0]), o;
194
194
  }, asNumber: (e) => {
@@ -618,11 +618,11 @@ const Ho = async (e, t = Bt) => new Promise(async (n, o) => {
618
618
  console.warn("Can't parse html from clipboard.");
619
619
  }
620
620
  return o;
621
- }, qn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${qn}="${e}"/>`, Xi = (e, t) => {
621
+ }, Kn = "clipboard-uuid", Tn = "web text/uuid", Sr = (e) => `<div style="display:none" ${Kn}="${e}"/>`, Xi = (e, t) => {
622
622
  let n = null;
623
623
  try {
624
624
  const o = new DOMParser().parseFromString(t, Bt);
625
- o.body.firstElementChild.setAttribute(qn, e), n = o.getElementsByTagName("body")[0].innerHTML;
625
+ o.body.firstElementChild.setAttribute(Kn, e), n = o.getElementsByTagName("body")[0].innerHTML;
626
626
  } catch (o) {
627
627
  console.warn("Can't embed uuid.", o);
628
628
  }
@@ -630,7 +630,7 @@ const Ho = async (e, t = Bt) => new Promise(async (n, o) => {
630
630
  }, Er = (e, t) => {
631
631
  if (!t || !e) return !1;
632
632
  try {
633
- const n = t.querySelectorAll(`[${qn}="${e}"]`);
633
+ const n = t.querySelectorAll(`[${Kn}="${e}"]`);
634
634
  if (n && n.length === 1) return !0;
635
635
  if (t.querySelector("parsererror")) throw new Error("We are unable to parse node");
636
636
  return !1;
@@ -707,12 +707,12 @@ let ho = class {
707
707
  const f = await s.getType(fn);
708
708
  if (f) {
709
709
  let x = null;
710
- typeof f == "string" ? (console.warn("text as string", f), x = f) : x = await Wo(f), x && (d = `<div ${qn}="${o}">${x}</div>`);
710
+ typeof f == "string" ? (console.warn("text as string", f), x = f) : x = await Wo(f), x && (d = `<div ${Kn}="${o}">${x}</div>`);
711
711
  }
712
712
  }
713
713
  if (!d && s.types.includes(Mo)) {
714
714
  const f = await s.getType(Mo), x = ti(await f.arrayBuffer());
715
- d = `<div ${qn}="${o}"><img src="${ni + x}"/></div>`;
715
+ d = `<div ${Kn}="${o}"><img src="${ni + x}"/></div>`;
716
716
  }
717
717
  !d && o && (d = Sr(o));
718
718
  const g = new Blob([d ?? ""], { type: Bt }), m = {};
@@ -816,14 +816,14 @@ var Lo;
816
816
  try {
817
817
  if (typeof document < "u") {
818
818
  var e = document.createElement("style");
819
- e.appendChild(document.createTextNode("._sheetxl-scrollbar_18qzf_11 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_5qk7s_7{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_5qk7s_7>*{pointer-events:auto}")), document.head.appendChild(e);
819
+ e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")), document.head.appendChild(e);
820
820
  }
821
821
  } catch (t) {
822
822
  console.error("vite-plugin-css-injected-by-js", t);
823
823
  }
824
824
  }();
825
825
  /**
826
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.2.0
826
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.2.6
827
827
  *
828
828
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
829
829
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -889,27 +889,27 @@ const er = Dt(Ut((e, t) => {
889
889
  }, [C, U]);
890
890
  const W = O((S, ue = !1) => {
891
891
  if (!R.current) return 0;
892
- const K = R.current.querySelector(".scrollbar-viewport"), pe = K.getBoundingClientRect(), te = K.children, Re = ue ? 0 : No(S, pe[H], te, !0, Math.max(0, S - m));
892
+ const q = R.current.querySelector(".scrollbar-viewport"), pe = q.getBoundingClientRect(), te = q.children, Re = ue ? 0 : No(S, pe[H], te, !0, Math.max(0, S - m));
893
893
  return ee(Re), Math.max(0, Re);
894
894
  }, []), A = O((S, ue = !1) => {
895
895
  if (!R.current) return 0;
896
- const K = R.current.querySelector(".scrollbar-viewport"), pe = K.getBoundingClientRect(), te = K.children, Re = Math.ceil(u - k), at = ue ? Re : No(S, pe[H], te, !1, Math.max(0, S + m));
896
+ const q = R.current.querySelector(".scrollbar-viewport"), pe = q.getBoundingClientRect(), te = q.children, Re = Math.ceil(u - k), at = ue ? Re : No(S, pe[H], te, !1, Math.max(0, S + m));
897
897
  return ee(at), Math.min(Re, at);
898
- }, [u, k]), q = J(null), N = O((S) => {
899
- q.current = n;
898
+ }, [u, k]), K = J(null), N = O((S) => {
899
+ K.current = n;
900
900
  const ue = S.target[X];
901
901
  a(ue, r, o), ae?.(S);
902
902
  }, [a, r, o, n]);
903
903
  st(() => {
904
- const S = q.current;
905
- q.current = null, n !== S && (R.current[X] = n);
904
+ const S = K.current;
905
+ K.current = null, n !== S && (R.current[X] = n);
906
906
  }, [n, X]);
907
907
  const xe = J(null), G = J(null), He = O(() => {
908
908
  xe.current && (clearTimeout(xe.current), xe.current = null, G.current = null);
909
- }, []), Ue = O((S, ue, K, pe = f) => {
909
+ }, []), Ue = O((S, ue, q, pe = f) => {
910
910
  G.current = S, xe.current = setTimeout(() => {
911
- const te = K ? W(G.current || S) : A(G.current || S);
912
- te !== G.current ? Ue(te, !1, K, x) : He();
911
+ const te = q ? W(G.current || S) : A(G.current || S);
912
+ te !== G.current ? Ue(te, !1, q, x) : He();
913
913
  }, ue ? 0 : pe);
914
914
  }, [W, A, He]);
915
915
  st(() => () => He(), [He]);
@@ -922,7 +922,7 @@ const er = Dt(Ut((e, t) => {
922
922
  const S = { orientation: s, disabled: Math.floor(u - k) <= Math.ceil(We), onMouseUp: He, onMouseLeave: He, onMouseDown: () => Ue(We, !0, !1) };
923
923
  return I?.(S);
924
924
  }, [g, s, We, C, u, k]);
925
- return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: U ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_18qzf_11", l), ...M, children: [ht, Y("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: U ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: _, children: Y("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: U ? "scroll" : "hidden", overflowX: U ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N, ref: R, children: Y("div", { ref: $, style: { position: "absolute", height: U ? o - r + (le ?? 0) : 1, width: U ? 1 : o - r + (L ?? 0) }, className: "scrollbar-viewport" }) }) }), _e] });
925
+ return Ht("div", { ref: t, style: { display: "flex", flex: "1", flexDirection: U ? "column" : "row", padding: "0", ...i }, className: Rn("_sheetxl-scrollbar_eblx4_6", l), ...M, children: [ht, Y("div", { className: "pseudo-scrollbar", style: { flex: "1 1 100%", display: "flex", boxSizing: "content-box", flexDirection: U ? "column" : "row", justifyContent: "center", alignItems: "center" }, ref: _, children: Y("div", { tabIndex: -1, style: { flex: "1 1 100%", overflowY: U ? "scroll" : "hidden", overflowX: U ? "hidden" : "scroll", position: "relative", willChange: "transform" }, onScroll: N, ref: R, children: Y("div", { ref: $, style: { position: "absolute", height: U ? o - r + (le ?? 0) : 1, width: U ? 1 : o - r + (L ?? 0) }, className: "scrollbar-viewport" }) }) }), _e] });
926
926
  }));
927
927
  er.displayName = "Scrollbar";
928
928
  let Cr = Date.now, gn = {}, cl = 1;
@@ -1096,7 +1096,7 @@ var Gt = typeof window < "u" ? window : { screen: {}, navigator: {} }, Ln = (Gt.
1096
1096
  Gt.addEventListener && Gt.addEventListener("p", Tr, hl), Gt.removeEventListener && Gt.removeEventListener("p", Tr, !1);
1097
1097
  var fl = ai, pl = "PointerEvent" in Gt, tr = "ontouchstart" in Gt, di = tr || "TouchEvent" in Gt && Ln("(any-pointer: coarse)").matches, Rr = (Gt.navigator.maxTouchPoints || 0) > 0 || di, ui = Gt.navigator.userAgent || "", gl = Ln("(pointer: coarse)").matches && /iPad|Macintosh/.test(ui) && Math.min(Gt.screen.width || 0, Gt.screen.height || 0) >= 768, hi = (Ln("(pointer: coarse)").matches || !Ln("(pointer: fine)").matches && tr) && !/Windows.*Firefox/.test(ui), wl = Ln("(any-pointer: fine)").matches || Ln("(any-hover: hover)").matches || gl || !tr, Uo = !Rr || !wl && hi ? Rr ? "touchOnly" : "mouseOnly" : "hybrid", ml = Uo === "mouseOnly" ? "mouse" : Uo === "touchOnly" || hi ? "touch" : "mouse";
1098
1098
  const xl = Object.freeze(Object.defineProperty({ __proto__: null, deviceType: Uo, primaryInput: ml, supportsPassiveEvents: fl, supportsPointerEvents: pl, supportsTouchEvents: di }, Symbol.toStringTag, { value: "Module" })), vl = /* @__PURE__ */ new Set(["INPUT", "TEXTAREA", "SELECT"]), fi = {};
1099
- function qo() {
1099
+ function Ko() {
1100
1100
  return xl;
1101
1101
  }
1102
1102
  const me = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProperties: fi, boundPixel: function(e, t = !1, n = 0) {
@@ -1109,7 +1109,7 @@ const me = Object.freeze(Object.defineProperty({ __proto__: null, EmptyCssProper
1109
1109
  n = !0, e.stopPropagation();
1110
1110
  }, isPropagationStopped: () => n, persist: () => {
1111
1111
  }, timeStamp: e.timeStamp, type: e.type };
1112
- }, detectIt: qo, focusableNodeNames: vl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
1112
+ }, detectIt: Ko, focusableNodeNames: vl, toPrettyKeyCode: (e) => e === "BracketLeft" ? "[" : e === "BracketRight" ? "]" : Ct.camelToPrettyCase(e) }, Symbol.toStringTag, { value: "Module" })), yl = [];
1113
1113
  function wo(e, t, n = yl) {
1114
1114
  const o = J(null);
1115
1115
  return Ur(e, () => {
@@ -1142,12 +1142,12 @@ const kr = (e) => Y(er, { ...e }), bl = ({ width: e, height: t }) => Y("div", {
1142
1142
  }, []);
1143
1143
  st(() => {
1144
1144
  const k = m ?? I.current;
1145
- if (!f && qo().supportsTouchEvents && k && o) {
1145
+ if (!f && Ko().supportsTouchEvents && k && o) {
1146
1146
  if (!M.current) {
1147
1147
  const u = { scrollingX: !0, scrollingY: !0, decelerationRate: 0.95, penetrationAcceleration: 0.08 };
1148
1148
  M.current = new ci(ae, u);
1149
1149
  }
1150
- qo().supportsTouchEvents && (k.addEventListener("touchstart", R), k.addEventListener("touchend", L), k.addEventListener("touchmove", _)), le({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
1150
+ Ko().supportsTouchEvents && (k.addEventListener("touchstart", R), k.addEventListener("touchend", L), k.addEventListener("touchmove", _)), le({ containerWidth: o?.width, containerHeight: o?.height, totalWidth: o?.totalWidth, totalHeight: o?.totalHeight });
1151
1151
  }
1152
1152
  return () => {
1153
1153
  k?.removeEventListener("touchstart", R), k?.removeEventListener("touchend", L), k?.removeEventListener("touchmove", _);
@@ -1176,7 +1176,7 @@ function gi() {
1176
1176
  const t = document.fullscreenElement;
1177
1177
  if (!t) return;
1178
1178
  let n = t.querySelector(".fullscreen-portal-root");
1179
- n || (n = document.createElement("div"), n.className = "fullscreen-portal-root _fullscreen-portal-root_5qk7s_7", t.appendChild(n));
1179
+ n || (n = document.createElement("div"), n.className = "fullscreen-portal-root _fullscreen-portal-root_1mjsr_4", t.appendChild(n));
1180
1180
  }
1181
1181
  return no++, e(), document.addEventListener("fullscreenchange", e), () => {
1182
1182
  document.removeEventListener("fullscreenchange", e), no--, no <= 0 && (document.querySelectorAll(".fullscreen-portal-root").forEach((t) => {
@@ -1197,7 +1197,7 @@ const El = 100, _l = 100, Il = 1e6, Cl = 100, Ml = 50, Tl = Dt(Ut((e, t) => {
1197
1197
  _(W);
1198
1198
  }
1199
1199
  }, [r, o, n, H, i, l, s]);
1200
- const u = T((W, A, q) => {
1200
+ const u = T((W, A, K) => {
1201
1201
  const N = k.current;
1202
1202
  k.current = null, N && N.propTotalSize === r && N.propViewportSize === o && N.propOffset === n || (Math.abs(W - oe) < le && (W = oe), g?.(W * L, oe, be));
1203
1203
  }, [g, L, le, oe, be]), C = O((W) => {
@@ -1212,7 +1212,7 @@ function Do(e, t) {
1212
1212
  e && (e.current = t);
1213
1213
  }
1214
1214
  Tl.displayName = "VirtualScrollbar";
1215
- var fo = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
1215
+ var fo = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
1216
1216
  return (t) => {
1217
1217
  const n = [];
1218
1218
  for (const o of e) {
@@ -1250,7 +1250,7 @@ Dt(Ut((e, t) => {
1250
1250
  return function(le, $, oe = !1) {
1251
1251
  if ($ === 0) return le;
1252
1252
  function be(C, ee, W) {
1253
- let A = ee.x - C.x, q = ee.y - C.y, N = Math.sqrt(A * A + q * q);
1253
+ let A = ee.x - C.x, K = ee.y - C.y, N = Math.sqrt(A * A + K * K);
1254
1254
  return U(C, ee, Math.min(1, W / N));
1255
1255
  }
1256
1256
  function U(C, ee, W) {
@@ -1272,13 +1272,13 @@ Dt(Ut((e, t) => {
1272
1272
  let C = X(k[0]), ee = null;
1273
1273
  k[k.length - 1][0] === "Z" && k[0].length > 2 && (ee = ["L", C.x, C.y], k[k.length - 1] = ee), u.push(k[0]);
1274
1274
  for (let W = 1; W < k.length; W++) {
1275
- let A = u[u.length - 1], q = k[W], N = q === ee ? k[1] : k[W + 1];
1276
- if (N && A && A.length > 2 && q[0] === "L" && N.length > 2 && N[0] === "L") {
1277
- let xe, G, He = X(A), Ue = X(q), We = X(N);
1278
- oe ? (xe = U(Ue, A.origPoint || He, $), G = U(Ue, N.origPoint || We, $)) : (xe = be(Ue, He, $), G = be(Ue, We, $)), H(q, xe), q.origPoint = Ue, u.push(q);
1275
+ let A = u[u.length - 1], K = k[W], N = K === ee ? k[1] : k[W + 1];
1276
+ if (N && A && A.length > 2 && K[0] === "L" && N.length > 2 && N[0] === "L") {
1277
+ let xe, G, He = X(A), Ue = X(K), We = X(N);
1278
+ oe ? (xe = U(Ue, A.origPoint || He, $), G = U(Ue, N.origPoint || We, $)) : (xe = be(Ue, He, $), G = be(Ue, We, $)), H(K, xe), K.origPoint = Ue, u.push(K);
1279
1279
  let ht = U(xe, Ue, 0.5), _e = U(Ue, G, 0.5), S = ["C", ht.x, ht.y, _e.x, _e.y, G.x, G.y];
1280
1280
  S.origPoint = Ue, u.push(S);
1281
- } else u.push(q);
1281
+ } else u.push(K);
1282
1282
  }
1283
1283
  if (ee) {
1284
1284
  let W = X(u[u.length - 1]);
@@ -1352,21 +1352,21 @@ Dt(Ut((e, t) => {
1352
1352
  st(() => {
1353
1353
  k(pn(l, i === null));
1354
1354
  }, [l, i]);
1355
- const [u, { width: C, height: ee }] = In(), [W, { width: A, height: q }] = In(), N = r === "row" ? A : q, xe = r === "row" ? C : ee, G = Ee(() => ((Q, et, qe, dt) => {
1355
+ const [u, { width: C, height: ee }] = In(), [W, { width: A, height: K }] = In(), N = r === "row" ? A : K, xe = r === "row" ? C : ee, G = Ee(() => ((Q, et, Ke, dt) => {
1356
1356
  const Ie = [null, null], Le = [null, null];
1357
- if (Q || (Q = { percent: dt.fixedPaneOffset === null ? 50 : null, pixels: dt.fixedPaneOffset === null ? null : 0 }), et === 0) return Q?.pixels != null ? dt.fixedPaneOffset !== 1 ? (Ie[0] = Q?.pixels, Le[1] = 100) : (Ie[1] = Q?.pixels - qe, Le[0] = 100) : Q?.percent != null && (dt.fixedPaneOffset !== 1 ? (Le[0] = Q?.percent, Le[1] = 100 - Q?.percent) : (Le[1] = Q?.percent, Le[0] = 100 - Q?.percent)), { percents: Le, pixels: Ie, minBefore: ro(dt.minBefore, !0), maxBefore: ro(dt.maxBefore, !0), minAfter: ro(dt.minAfter), maxAfter: ro(dt.maxAfter) };
1358
- let rt = bn(Q, et, dt.fixedPaneOffset !== 1), tt = et - qe, Ae = bn(dt.minBefore, tt, !0) ?? 0, rn = bn(dt.maxBefore, tt, !0) ?? tt, Mt = 0, nt = 0, Tt = 0, kt = tt;
1359
- Mt = (bn(dt.maxAfter, et, !1) ?? qe) - qe, nt = bn(dt.minAfter, et, !1) ?? et, Tt = Math.max(Ae, Mt), kt = Math.min(rn, nt), rt = Math.max(Tt, Math.min(rt, kt)), nt = Math.min(tt - rt, bn(dt.maxAfter, tt - rt, !0) ?? tt), Mt = Math.min(tt - rt, bn(dt.minAfter, tt - rt, !0) ?? tt), Ie[0] = rt, Ie[1] = tt - Ie[0];
1357
+ if (Q || (Q = { percent: dt.fixedPaneOffset === null ? 50 : null, pixels: dt.fixedPaneOffset === null ? null : 0 }), et === 0) return Q?.pixels != null ? dt.fixedPaneOffset !== 1 ? (Ie[0] = Q?.pixels, Le[1] = 100) : (Ie[1] = Q?.pixels - Ke, Le[0] = 100) : Q?.percent != null && (dt.fixedPaneOffset !== 1 ? (Le[0] = Q?.percent, Le[1] = 100 - Q?.percent) : (Le[1] = Q?.percent, Le[0] = 100 - Q?.percent)), { percents: Le, pixels: Ie, minBefore: ro(dt.minBefore, !0), maxBefore: ro(dt.maxBefore, !0), minAfter: ro(dt.minAfter), maxAfter: ro(dt.maxAfter) };
1358
+ let rt = bn(Q, et, dt.fixedPaneOffset !== 1), tt = et - Ke, Ae = bn(dt.minBefore, tt, !0) ?? 0, rn = bn(dt.maxBefore, tt, !0) ?? tt, Mt = 0, nt = 0, Tt = 0, kt = tt;
1359
+ Mt = (bn(dt.maxAfter, et, !1) ?? Ke) - Ke, nt = bn(dt.minAfter, et, !1) ?? et, Tt = Math.max(Ae, Mt), kt = Math.min(rn, nt), rt = Math.max(Tt, Math.min(rt, kt)), nt = Math.min(tt - rt, bn(dt.maxAfter, tt - rt, !0) ?? tt), Mt = Math.min(tt - rt, bn(dt.minAfter, tt - rt, !0) ?? tt), Ie[0] = rt, Ie[1] = tt - Ie[0];
1360
1360
  const hn = Math.max(0, Math.min(100, rt / tt * 100));
1361
1361
  return Le[0] = hn, Le[1] = 100 - Le[0], { percents: Le, pixels: Ie, minBefore: `${Ae}px`, minAfter: `${Mt}px`, maxBefore: `${Ie[0]}px`, maxAfter: `${Ie[1]}px` };
1362
- })(X, xe, N, U), [U, X, xe, N, r]), [He, Ue] = Je(!1), We = T(M, [M]), ht = T(ae, [ae]), _e = T(R, [R]), S = J(null), ue = J(null), K = J(null), { style: pe, className: te, ...Re } = L, at = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: pt, style: zt, ...gt } = le, { className: Zt, style: Be, ...z } = $, ke = { flex: "1 1 100%", width: "100%", ...E, flexDirection: r, display: "flex" }, { className: Qe, style: Xe, onPointerDown: wt, ...an } = _, Jt = T((Q) => {
1362
+ })(X, xe, N, U), [U, X, xe, N, r]), [He, Ue] = Je(!1), We = T(M, [M]), ht = T(ae, [ae]), _e = T(R, [R]), S = J(null), ue = J(null), q = J(null), { style: pe, className: te, ...Re } = L, at = { minWidth: 0, minHeight: 0, maxWidth: "100%", maxHeight: "100%", display: "flex", overflow: "hidden", ...pe }, { className: pt, style: zt, ...gt } = le, { className: Zt, style: Be, ...z } = $, ke = { flex: "1 1 100%", width: "100%", ...E, flexDirection: r, display: "flex" }, { className: Qe, style: Xe, onPointerDown: wt, ...an } = _, Jt = T((Q) => {
1363
1363
  const et = pn(Q, i === null);
1364
1364
  k(et);
1365
1365
  }, [i]), jt = T((Q) => {
1366
1366
  if (I || !He) return;
1367
1367
  const et = ze.current?.getBoundingClientRect();
1368
- let qe = 0;
1369
- qe = r === "row" ? (Q.clientX ?? Q.touches?.[0]?.clientX) - et.x : (Q.clientY ?? Q.touches?.[0]?.clientY) - et.y, qe = Math.max(0, Math.min(xe, qe)), U.fixedPaneOffset === 1 && (qe = xe - qe), l && X.pixels === qe || k({ pixels: qe, percent: null }), ht?.(qe), Q.stopPropagation(), Q.preventDefault();
1368
+ let Ke = 0;
1369
+ Ke = r === "row" ? (Q.clientX ?? Q.touches?.[0]?.clientX) - et.x : (Q.clientY ?? Q.touches?.[0]?.clientY) - et.y, Ke = Math.max(0, Math.min(xe, Ke)), U.fixedPaneOffset === 1 && (Ke = xe - Ke), l && X.pixels === Ke || k({ pixels: Ke, percent: null }), ht?.(Ke), Q.stopPropagation(), Q.preventDefault();
1370
1370
  }, [U, r, I, He, X, xe]), dn = T((Q) => {
1371
1371
  if (document.removeEventListener("pointermove", jt), document.removeEventListener("touchmove", jt), document.removeEventListener("pointerup", dn), He && (Ue(!1), X)) {
1372
1372
  if (_e(X.pixels), !pn(l, i === null) || X.pixels !== l) {
@@ -1377,8 +1377,8 @@ Dt(Ut((e, t) => {
1377
1377
  }
1378
1378
  }, [X, He, l, i, xe]), on = T((Q) => {
1379
1379
  wt?.(Q), Q.defaultPrevented || I || He || (Ue(!0), We(), document.addEventListener("pointermove", jt, { passive: !1 }), document.addEventListener("touchmove", jt, { passive: !1 }), document.addEventListener("pointerup", dn, { passive: !1 }));
1380
- }, [wt]), ze = wo(t, () => ({ setPosition: Jt, isSplitPane: () => !0 }), []), qt = Ee(() => be ? oe?.({ key: "resizer", ref: fo([W, ue]), className: Rn("resizer", Qe), onPointerDownCapture: on, style: { cursor: I ? void 0 : r === "row" ? "ew-resize" : "ns-resize", minWidth: r === "row" ? "2px" : void 0, minHeight: r !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...Xe }, splitDirection: r, disabled: I, ...an }) : null, [be, Qe, an, r, Xe, I]), vt = r === "row" ? "Width" : "Height", Vt = { ...at, ...zt, flex: U.fixedPaneOffset === 0 && G?.pixels[0] !== null ? `0 0 ${Math.round(G?.pixels[0])}px` : `1 1 ${Math.round(G?.percents[0] ?? 100)}%`, [`min${vt}`]: G?.minBefore, [`max${vt}`]: o ? G?.maxBefore : "100%" }, Cn = { ...at, ...Be, flex: U.fixedPaneOffset === 1 && G?.pixels[1] !== null ? `0 0 ${Math.round(G?.pixels[1])}px` : `1 1 ${Math.round(G?.percents[1] ?? 100)}%`, [`min${vt}`]: G?.minAfter, [`max${vt}`]: n ? G?.maxAfter : "100%" }, un = Ee(() => n ? Y("div", { ref: S, className: Rn("before", te, pt), style: Vt, ...Re, ...gt, children: n }, "before") : null, [n, L, le, U, G]), Ne = Ee(() => o ? Y("div", { ref: K, className: Rn("after", te, Zt), style: Cn, ...Re, ...z, children: o }, "after") : null, [o, L, $, U, G]);
1381
- return Ht("div", { ref: fo([u, ze]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ke, children: [un, qt, Ne] });
1380
+ }, [wt]), ze = wo(t, () => ({ setPosition: Jt, isSplitPane: () => !0 }), []), Kt = Ee(() => be ? oe?.({ key: "resizer", ref: fo([W, ue]), className: Rn("resizer", Qe), onPointerDownCapture: on, style: { cursor: I ? void 0 : r === "row" ? "ew-resize" : "ns-resize", minWidth: r === "row" ? "2px" : void 0, minHeight: r !== "row" ? "2px" : void 0, boxSizing: "border-box", pointerEvents: "all", zIndex: 1, ...Xe }, splitDirection: r, disabled: I, ...an }) : null, [be, Qe, an, r, Xe, I]), vt = r === "row" ? "Width" : "Height", Vt = { ...at, ...zt, flex: U.fixedPaneOffset === 0 && G?.pixels[0] !== null ? `0 0 ${Math.round(G?.pixels[0])}px` : `1 1 ${Math.round(G?.percents[0] ?? 100)}%`, [`min${vt}`]: G?.minBefore, [`max${vt}`]: o ? G?.maxBefore : "100%" }, Cn = { ...at, ...Be, flex: U.fixedPaneOffset === 1 && G?.pixels[1] !== null ? `0 0 ${Math.round(G?.pixels[1])}px` : `1 1 ${Math.round(G?.percents[1] ?? 100)}%`, [`min${vt}`]: G?.minAfter, [`max${vt}`]: n ? G?.maxAfter : "100%" }, un = Ee(() => n ? Y("div", { ref: S, className: Rn("before", te, pt), style: Vt, ...Re, ...gt, children: n }, "before") : null, [n, L, le, U, G]), Ne = Ee(() => o ? Y("div", { ref: q, className: Rn("after", te, Zt), style: Cn, ...Re, ...z, children: o }, "after") : null, [o, L, $, U, G]);
1381
+ return Ht("div", { ref: fo([u, ze]), className: Rn("splitPane", r === "row" ? "vertical" : "horizontal", { dragging: He }, x), style: ke, children: [un, Kt, Ne] });
1382
1382
  }));
1383
1383
  const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
1384
1384
  const o = J(e);
@@ -1387,7 +1387,7 @@ const Pl = ({ initValue: e, useHookBody: t, applyStateChange: n }) => {
1387
1387
  return nn(() => {
1388
1388
  o.current !== r && (o.current = r, n(r));
1389
1389
  }, [n, r]), null;
1390
- }, Ko = (e) => {
1390
+ }, qo = (e) => {
1391
1391
  console && console.warn && console.warn(e);
1392
1392
  }, zo = typeof self == "object" && self.self === self && self || typeof global == "object" && global.global === global && global || void 0;
1393
1393
  let Ol = 1, Yo = !1, wi = !1;
@@ -1398,10 +1398,10 @@ const co = [], kn = [], po = () => {
1398
1398
  return o.current = t, e || Yo !== !1 || (wi = !0), st(() => {
1399
1399
  let r = !0;
1400
1400
  function i() {
1401
- if (r) return kn[0] !== i ? (e || Yo !== !0 || Ko("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((l) => [])) : void n([...co]);
1401
+ if (r) return kn[0] !== i ? (e || Yo !== !0 || qo("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."), void n((l) => [])) : void n([...co]);
1402
1402
  }
1403
1403
  return kn.push(i), po(), () => {
1404
- r = !1, o.current?.length > 0 && Ko("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), kn.splice(kn.indexOf(i), 1), po();
1404
+ r = !1, o.current?.length > 0 && qo("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"), kn.splice(kn.indexOf(i), 1), po();
1405
1405
  };
1406
1406
  }, [e]), Y(wn, { children: t.map(({ hook: r, key: i }) => Jo(Pl, { ...r, key: i })) });
1407
1407
  }, mi = (e, t, n = {}) => {
@@ -1417,7 +1417,7 @@ const co = [], kn = [], po = () => {
1417
1417
  if (zo.document && zo.document.createElement) {
1418
1418
  const M = zo.document.createElement("div");
1419
1419
  Oi(M).render(Y(I, { automaticContainerInternalUseOnly: !0 }));
1420
- } else Ko("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
1420
+ } else qo("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.");
1421
1421
  })(Ll)), po(), () => {
1422
1422
  co.splice(co.findIndex((I) => I.key === E), 1), po();
1423
1423
  };
@@ -1635,18 +1635,18 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1635
1635
  }, []), $ = n.current && Z.isEqualCells(n.current, R), oe = l && $ && M, be = s({ autoFocus: !!t.startEvent?.autoFocus, ...a, onSubmitEdit: L, onCancelEdit: le, ref: I }, R), U = i.x + me.boundPixel(-g / 2), H = me.boundPixel(i.width + g / 2, !0);
1636
1636
  return Y("div", { tabIndex: 0, ref: E, style: { background: void 0, ...f, opacity: oe ? f?.opacity ?? 1 : 0, pointerEvents: "auto", position: "absolute", boxSizing: "border-box", top: `${i.y + me.boundPixel(-g / 2)}px`, height: me.boundPixel(i.height + g / 2, !0), left: `${U}px`, width: H }, ...x, children: Y("div", { className: "editor-container", style: { position: "absolute", boxSizing: "border-box", left: `${me.boundPixel(1)}px`, top: `${me.boundPixel(1)}px`, width: me.boundPixel(i.width - 2, !0), height: me.boundPixel(i.height - 2, !0), outline: `${g}px ${d} solid`, boxShadow: "rgba(60,64,67,.35) 2px 2px 6px 3px", maxHeight: "100%", overflow: "hidden", display: "flex" }, children: be }) });
1637
1637
  }, gs = (e) => {
1638
- const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: E = null, activeCoords: I, alignment: M = Wn.Left } = e, [ae, R] = Je(!1), [_, L] = Je(void 0), le = T((S, ue, K, pe, te, Re) => {
1638
+ const { view: t, canEdit: n = jl, getCellEditor: o, onBeforeStartEdit: r, onStartEdit: i, onSubmitEdit: l, onCancelEdit: s, onDoneEdit: a, isEditorStartKeyEvent: d = Vl, isEditorStartPointerEvent: g = Wl, containerProps: m, borderStrokeFill: f, borderStrokeWidth: x = 2, getRangeCoords: E = null, activeCoords: I, alignment: M = Wn.Left } = e, [ae, R] = Je(!1), [_, L] = Je(void 0), le = T((S, ue, q, pe, te, Re) => {
1639
1639
  if (!ue) return null;
1640
1640
  const at = te?.(ue, S), pt = S.getRangeCoordsBounds(at), zt = S.toClipBounds(pt), gt = pt, Zt = S.getZoom();
1641
1641
  if (!zt) return null;
1642
- K && (K *= Zt), pe && (pe *= Zt);
1642
+ q && (q *= Zt), pe && (pe *= Zt);
1643
1643
  let Be = gt, z = !1;
1644
- if (K !== void 0) {
1644
+ if (q !== void 0) {
1645
1645
  let Xe = { ...at }, wt = 0;
1646
- for (; !z && Be.width <= K && wt < 20; ) {
1646
+ for (; !z && Be.width <= q && wt < 20; ) {
1647
1647
  wt++, wt > 19 && console.warn("max width reached");
1648
1648
  const an = S.getTotalRangeCoords(), Jt = S.getLayout();
1649
- Re === Wn.Left ? Xe.colEnd + 1 < an.colEnd ? Xe.colEnd = Jt.getColIndex(Be.x + K) : z = !0 : Re === Wn.Right ? Xe.colStart - 1 >= 0 ? Xe.colStart = Jt.getColIndex(Be.x - (K - Be.width)) : z = !0 : Re === Wn.Center && Xe.colEnd + 1 < an.colEnd && Xe.colStart - 1 >= 0 ? (Xe.colStart = Jt.getColIndex(Be.x - (K - Be.width) / 2), Xe.colEnd = Jt.getColIndex(Be.x + Be.width + (K - Be.width) / 2)) : z = !0, z || (Be = S.getRangeCoordsBounds(Xe));
1649
+ Re === Wn.Left ? Xe.colEnd + 1 < an.colEnd ? Xe.colEnd = Jt.getColIndex(Be.x + q) : z = !0 : Re === Wn.Right ? Xe.colStart - 1 >= 0 ? Xe.colStart = Jt.getColIndex(Be.x - (q - Be.width)) : z = !0 : Re === Wn.Center && Xe.colEnd + 1 < an.colEnd && Xe.colStart - 1 >= 0 ? (Xe.colStart = Jt.getColIndex(Be.x - (q - Be.width) / 2), Xe.colEnd = Jt.getColIndex(Be.x + Be.width + (q - Be.width) / 2)) : z = !0, z || (Be = S.getRangeCoordsBounds(Xe));
1650
1650
  }
1651
1651
  }
1652
1652
  Be.height = gt.height, pe !== void 0 && (Be.height = Math.max(pe + 1, gt.height));
@@ -1669,8 +1669,8 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1669
1669
  }
1670
1670
  }, [l]), k = T((S) => {
1671
1671
  R(!1), a?.(S.coords), N();
1672
- }, [a]), u = J(null), C = J(null), ee = J(null), W = J([]), [A, q] = Qo((S) => S + 1, 0), N = O((S) => {
1673
- S && W.current.push(S), q();
1672
+ }, [a]), u = J(null), C = J(null), ee = J(null), W = J([]), [A, K] = Qo((S) => S + 1, 0), N = O((S) => {
1673
+ S && W.current.push(S), K();
1674
1674
  }, []), xe = T((S) => {
1675
1675
  if (S.defaultPrevented || S.isSynthetic || !t) return;
1676
1676
  const ue = t?.getCellCoordsFromClient(S.clientX, S.clientY);
@@ -1721,7 +1721,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1721
1721
  te.push(Lr(pt));
1722
1722
  }
1723
1723
  })(W.current), u.current, u.current;
1724
- let K = u.current;
1724
+ let q = u.current;
1725
1725
  if (u.current) {
1726
1726
  if (u.current.isDone) u.current = null;
1727
1727
  else if (u.current.isSubmitted || u.current.isCancelled) {
@@ -1778,7 +1778,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1778
1778
  }
1779
1779
  }
1780
1780
  }
1781
- W.current.length > 0 && (W.current.shift(), N()), W.current.length === 0 && (!u.current || u.current.isEditorClosing || u.current.isEditorClosed ? !u.current && K && oe() : u.current.isMounted && !u.current.isStarted && (u.current.isStarted = !0, u.current.startEvent.autoFocus && (typeof u.current.startEvent.autoFocus == "string" ? u.current.editorRefs[0]?.autoFocus(u.current.startEvent.autoFocus) : u.current.editorRefs[0]?.autoFocus()), U?.(u.current), requestAnimationFrame(() => {
1781
+ W.current.length > 0 && (W.current.shift(), N()), W.current.length === 0 && (!u.current || u.current.isEditorClosing || u.current.isEditorClosed ? !u.current && q && oe() : u.current.isMounted && !u.current.isStarted && (u.current.isStarted = !0, u.current.startEvent.autoFocus && (typeof u.current.startEvent.autoFocus == "string" ? u.current.editorRefs[0]?.autoFocus(u.current.startEvent.autoFocus) : u.current.editorRefs[0]?.autoFocus()), U?.(u.current), requestAnimationFrame(() => {
1782
1782
  t && u.current?.coords && t.scrollCellCoordsIntoView(u.current.coords);
1783
1783
  })));
1784
1784
  }, [A]), st(() => {
@@ -1792,10 +1792,10 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1792
1792
  return { overlay: T((S) => {
1793
1793
  if (!u.current || u.current.isEditorClosed) return u.current, null;
1794
1794
  u.current.coords;
1795
- let ue = le(S, u.current.coords, We, ht, E, M), K = !0;
1796
- ue && ue.width !== 0 && ue.height !== 0 || (ue = { x: 0, y: 0, width: We, height: We }, K = !1);
1795
+ let ue = le(S, u.current.coords, We, ht, E, M), q = !0;
1796
+ ue && ue.width !== 0 && ue.height !== 0 || (ue = { x: 0, y: 0, width: We, height: We }, q = !1);
1797
1797
  const pe = S.getZoom(), te = { containerBounds: { x: 0, y: 0, width: ue.width / pe, height: ue.height / pe }, setNaturalDimensions: L, zoom: pe };
1798
- return Y(Hl, { session: u.current, refLatestCoords: ee, handleSubmitEdit: X, handleCancelEdit: H, cellBounds: ue, borderStrokeWidth: x, borderStrokeFill: f, isInBounds: K, getCellEditor: _e, propsEditor: te, alignment: M, ...m }, "editor:" + u.current.uuid);
1798
+ return Y(Hl, { session: u.current, refLatestCoords: ee, handleSubmitEdit: X, handleCancelEdit: H, cellBounds: ue, borderStrokeWidth: x, borderStrokeFill: f, isInBounds: q, getCellEditor: _e, propsEditor: te, alignment: M, ...m }, "editor:" + u.current.uuid);
1799
1799
  }, [o, E, A, We, ht, M, x, f]), startEdit: O((S) => {
1800
1800
  N({ eventType: "start", startEvent: S });
1801
1801
  }, []), submitEdit: O(() => {
@@ -1821,15 +1821,15 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1821
1821
  const ee = u.nativeEvent.shiftKey, W = u.nativeEvent.ctrlKey || u.nativeEvent.metaKey;
1822
1822
  if (d?.(u, C) === !1) return;
1823
1823
  X?.(), _.current = !0;
1824
- const A = t.current?.getViewFromClient(u.nativeEvent.clientX, u.nativeEvent.clientY), q = ((N, xe) => n === Nt ? { ...N, rowIndex: xe.rowStart } : { ...N, colIndex: xe.colStart })(C, A.getVisibleRangeCoords());
1824
+ const A = t.current?.getViewFromClient(u.nativeEvent.clientX, u.nativeEvent.clientY), K = ((N, xe) => n === Nt ? { ...N, rowIndex: xe.rowStart } : { ...N, colIndex: xe.colStart })(C, A.getVisibleRangeCoords());
1825
1825
  if (ee) oe(C);
1826
1826
  else {
1827
1827
  if (W) return ((N, xe = N, G) => {
1828
1828
  ae.current = le(N), R.current = $(xe), E(ae.current, R.current, G);
1829
- })(C, C, q), void (l && U(q, !0));
1829
+ })(C, C, K), void (l && U(K, !0));
1830
1830
  ((N, xe = N, G) => {
1831
1831
  ae.current = le(N), R.current = $(xe), f(ae.current, R.current, G);
1832
- })(C, C, q), oe(C), l && U(q, !0);
1832
+ })(C, C, K), oe(C), l && U(K, !0);
1833
1833
  }
1834
1834
  }, onPointerMoveOrWait: Ct.throttle((u) => {
1835
1835
  if (!_.current || !e?.current) return;
@@ -1845,7 +1845,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1845
1845
  }, Ye = (e, t, n) => {
1846
1846
  if (!e) return t;
1847
1847
  let o = t;
1848
- const r = n === Ke || n === lt;
1848
+ const r = n === qe || n === lt;
1849
1849
  for (; ; ) {
1850
1850
  const i = e(o, !r);
1851
1851
  if (i === 0) return o;
@@ -1875,7 +1875,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1875
1875
  for (; !a && l > i; ) l = Ye(n, Math.max(--l, i), o), a = t({ rowIndex: l, colIndex: s });
1876
1876
  return l;
1877
1877
  }
1878
- case Ke: {
1878
+ case qe: {
1879
1879
  s = Ye(n, Math.min(s + 1, i), o);
1880
1880
  let a = t({ rowIndex: l, colIndex: s });
1881
1881
  for (; !a && s < i; ) s = Ye(n, Math.min(++s, i), o), a = t({ rowIndex: l, colIndex: s });
@@ -1905,7 +1905,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1905
1905
  for (; a && l > i; ) l = Ye(n, Math.max(--l, i), o), a = t?.({ rowIndex: l, colIndex: s });
1906
1906
  return t?.({ rowIndex: l, colIndex: s }) ? l : l + 1;
1907
1907
  }
1908
- case Ke: {
1908
+ case qe: {
1909
1909
  s = Ye(n, Math.min(s + 1, i), o);
1910
1910
  let a = t?.({ rowIndex: l, colIndex: s });
1911
1911
  for (; a && s < i; ) s = Ye(n, Math.min(++s, i), o), a = t?.({ rowIndex: l, colIndex: s });
@@ -1920,10 +1920,10 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1920
1920
  default:
1921
1921
  return null;
1922
1922
  }
1923
- }, ql = (e, t, n, o, r, i) => {
1923
+ }, Kl = (e, t, n, o, r, i) => {
1924
1924
  if (!t) return i;
1925
1925
  let l, { rowIndex: s, colIndex: a } = e;
1926
- o === lt ? l = { rowIndex: s + 1, colIndex: a } : o === it ? l = { rowIndex: s - 1, colIndex: a } : o === Ke ? l = { rowIndex: s, colIndex: a + 1 } : o === ot && (l = { rowIndex: s, colIndex: a - 1 });
1926
+ o === lt ? l = { rowIndex: s + 1, colIndex: a } : o === it ? l = { rowIndex: s - 1, colIndex: a } : o === qe ? l = { rowIndex: s, colIndex: a + 1 } : o === ot && (l = { rowIndex: s, colIndex: a - 1 });
1927
1927
  const d = t(e), g = t(l);
1928
1928
  var m, f;
1929
1929
  return (f = g, !(m = d) && !f || !m && f || m && !f ? Nl : Ul)(e, t, n, o, !1, i) ?? i;
@@ -1931,13 +1931,13 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1931
1931
  if (n - t >= r - o) return o;
1932
1932
  let l = o;
1933
1933
  return e === "nearest" && (o - t > 0 ? e = "start" : n - r > 0 && (e = "end")), e === "start" ? l = t : e === "end" ? l = n - (r - o) : e === "center" && (l = t + (n - t) / 2 - (r - o) / 2), Math.max(0, Math.min(l, i - (r - o)));
1934
- }, Ar = (e, t, n, o) => (console.log("todo: implement convertToVisibleRanges"), e), Xo = (e, t = Ke, n, o, r, i = null) => {
1934
+ }, Ar = (e, t, n, o) => (console.log("todo: implement convertToVisibleRanges"), e), Xo = (e, t = qe, n, o, r, i = null) => {
1935
1935
  if (i && Z.isEqualSelectionCoords(i, e)) return e;
1936
1936
  const l = e.ranges[e.rangeIndex];
1937
1937
  if (!Z.isRangesIntersect({ rowStart: e.cell.rowIndex, colStart: e.cell.colIndex, rowEnd: e.cell.rowIndex, colEnd: e.cell.colIndex }, l)) return e;
1938
1938
  let s = { ...e.cell }, a = e.rangeIndex;
1939
1939
  switch (t) {
1940
- case Ke:
1940
+ case qe:
1941
1941
  s.colIndex = Ye(r, s.colIndex + 1, t);
1942
1942
  break;
1943
1943
  case ot:
@@ -1960,14 +1960,14 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1960
1960
  s = { colIndex: x.colEnd, rowIndex: x.rowEnd };
1961
1961
  }
1962
1962
  };
1963
- if (t === Ke && s.colIndex > l.colEnd && s.rowIndex === l.rowEnd) d(!0);
1963
+ if (t === qe && s.colIndex > l.colEnd && s.rowIndex === l.rowEnd) d(!0);
1964
1964
  else if (t === ot && s.colIndex < l.colStart && s.rowIndex === l.rowStart) d(!1);
1965
1965
  else if (t === lt && s.colIndex === l.colEnd && s.rowIndex > l.rowEnd) d(!0);
1966
1966
  else if (t === it && s.colIndex === l.colStart && s.rowIndex < l.rowStart) d(!1);
1967
1967
  else {
1968
1968
  let f = s.rowIndex, x = s.colIndex;
1969
1969
  switch (t) {
1970
- case Ke:
1970
+ case qe:
1971
1971
  x > l.colEnd && (f = Ye(o, f + 1, t), x = l.colStart, f > l.rowEnd && (f = l.rowStart));
1972
1972
  break;
1973
1973
  case ot:
@@ -1986,10 +1986,10 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
1986
1986
  const f = Z.intersectRanges(g, l);
1987
1987
  f && (g = f);
1988
1988
  }
1989
- let m = { rowStart: Ye(o, g.rowStart, lt), colStart: Ye(r, g.colStart, Ke), rowEnd: Ye(o, g.rowEnd, it), colEnd: Ye(r, g.colEnd, ot) };
1989
+ let m = { rowStart: Ye(o, g.rowStart, lt), colStart: Ye(r, g.colStart, qe), rowEnd: Ye(o, g.rowEnd, it), colEnd: Ye(r, g.colEnd, ot) };
1990
1990
  if (m.rowStart !== s.rowIndex || m.colStart !== s.colIndex) {
1991
1991
  switch (t) {
1992
- case Ke:
1992
+ case qe:
1993
1993
  e.ranges[a].colStart === m.colStart && e.ranges[a].colEnd === m.colEnd && (s.rowIndex = m.rowEnd), s.colIndex = m.colEnd;
1994
1994
  break;
1995
1995
  case ot:
@@ -2006,7 +2006,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
2006
2006
  return { ranges: e.ranges, cell: s, rangeIndex: a };
2007
2007
  }, $r = (e, t) => {
2008
2008
  let n, o = 0, r = 0;
2009
- return t.colStart < e.colStart ? (n = ot, o = e.colStart - t.colStart, r = t.colStart) : t.colEnd > e.colEnd ? (n = Ke, o = t.colEnd - e.colEnd, r = t.colEnd) : t.rowStart < e.rowStart ? (n = it, o = e.rowStart - t.rowStart, r = t.rowStart) : t.rowEnd > e.rowEnd && (n = lt, o = t.rowEnd - e.rowEnd, r = t.rowEnd), { direction: n, amount: o, index: r };
2009
+ return t.colStart < e.colStart ? (n = ot, o = e.colStart - t.colStart, r = t.colStart) : t.colEnd > e.colEnd ? (n = qe, o = t.colEnd - e.colEnd, r = t.colEnd) : t.rowStart < e.rowStart ? (n = it, o = e.rowStart - t.rowStart, r = t.rowStart) : t.rowEnd > e.rowEnd && (n = lt, o = t.rowEnd - e.rowEnd, r = t.rowEnd), { direction: n, amount: o, index: r };
2010
2010
  }, go = (e, t = !1, n, o) => {
2011
2011
  if (!n) return 0;
2012
2012
  const r = !t, i = r ? 1 : -1;
@@ -2029,7 +2029,7 @@ const Pr = () => "sheetxl-ui-" + zl++, $l = Sn.useId ?? function() {
2029
2029
  }, Fr = (e, t, n) => {
2030
2030
  const o = e.getColOffset(t.colStart) + (n?.left ?? 0), r = e.getRowOffset(t.rowStart) + (n?.top ?? 0);
2031
2031
  return { x: o, y: r, width: e.getColOffset(t.colEnd + 1) + (n?.right ?? 0) - (n?.left ?? 0) - o, height: e.getRowOffset(t.rowEnd + 1) + (n?.bottom ?? 0) - (n?.top ?? 0) - r };
2032
- }, Kl = (e, t, n) => !!n && !(e < n.x || e > n.x + n.width) && !(t < n.y || t > n.y + n.height), $o = (e, t = !0) => `M ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} ${t ? "Z" : ""}`, jr = (e) => {
2032
+ }, ql = (e, t, n) => !!n && !(e < n.x || e > n.x + n.width) && !(t < n.y || t > n.y + n.height), $o = (e, t = !0) => `M ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.top)} L ${me.boundPixel(e.right, !0)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.bottom, !0)} L ${me.boundPixel(e.left)} ${me.boundPixel(e.top)} ${t ? "Z" : ""}`, jr = (e) => {
2033
2033
  const { linePoints: t, bounds: n, pathProps: o, style: r, ...i } = e;
2034
2034
  return Y("svg", { width: `${me.boundPixel(n.width, !0)}`, height: `${me.boundPixel(n.height, !0)}`, viewBox: `0 0 ${me.boundPixel(n.width, !0)} ${me.boundPixel(n.height, !0)}`, style: { position: "absolute", left: `${me.boundPixel(n.x)}px`, top: `${me.boundPixel(n.y)}px`, width: `${me.boundPixel(n.width, !0)}px`, height: `${me.boundPixel(n.height, !0)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...r }, ...i, children: Y("path", { d: `M ${me.boundPixel(t[0])} ${me.boundPixel(t[1])} L ${me.boundPixel(t[2])} ${me.boundPixel(t[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...o }) });
2035
2035
  }, Yl = (e) => {
@@ -2117,7 +2117,7 @@ function Bo(e, t) {
2117
2117
  if (typeof e == "function") return e(t);
2118
2118
  e && (e.current = t);
2119
2119
  }
2120
- var Jl = parseInt(qr.split(".")[0], 10) >= 19 ? function(e) {
2120
+ var Jl = parseInt(Kr.split(".")[0], 10) >= 19 ? function(e) {
2121
2121
  return (t) => {
2122
2122
  const n = [];
2123
2123
  for (const o of e) {
@@ -2154,44 +2154,44 @@ const Go = Dt(Ut((e, t) => {
2154
2154
  case "r":
2155
2155
  W = { colIndex: n.colStart, rowIndex: n.rowEnd };
2156
2156
  }
2157
- let q = o.getRangeCoordsBounds(A ? { rowStart: A.rowIndex, colStart: A.colIndex, rowEnd: A.rowIndex, colEnd: A.colIndex } : n);
2157
+ let K = o.getRangeCoordsBounds(A ? { rowStart: A.rowIndex, colStart: A.colIndex, rowEnd: A.rowIndex, colEnd: A.colIndex } : n);
2158
2158
  const N = o.getBounds(), xe = o.getViewportSize(), G = N.x, He = N.y, Ue = xe.width, We = xe.height;
2159
2159
  switch (r) {
2160
2160
  case "tl":
2161
2161
  break;
2162
2162
  case "br":
2163
- q.x = q.x + q.width, q.y = q.y + q.height;
2163
+ K.x = K.x + K.width, K.y = K.y + K.height;
2164
2164
  break;
2165
2165
  case "t":
2166
- q.x = Ue / 2 - G;
2166
+ K.x = Ue / 2 - G;
2167
2167
  break;
2168
2168
  case "b":
2169
- q.x = Ue / 2 - G, q.y = q.y + q.height;
2169
+ K.x = Ue / 2 - G, K.y = K.y + K.height;
2170
2170
  break;
2171
2171
  case "l":
2172
- q.y = We / 2 - He;
2172
+ K.y = We / 2 - He;
2173
2173
  break;
2174
2174
  case "r":
2175
- q.x = q.x + q.width, q.y = We / 2 - He;
2175
+ K.x = K.x + K.width, K.y = We / 2 - He;
2176
2176
  }
2177
- const ht = o.toClipBounds(q, 0);
2178
- return !ht || ht.width <= 0 || ht.height <= 0 || q.x < 0 || q.y < 0 || q.x > Ue || q.y > We ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: q, coordsAnchor: null, coordsPivot: W, key: "touchSelect-" + o.getAnchor() + "-" + r };
2177
+ const ht = o.toClipBounds(K, 0);
2178
+ return !ht || ht.width <= 0 || ht.height <= 0 || K.x < 0 || K.y < 0 || K.x > Ue || K.y > We ? { bounds: null, coordsAnchor: null, coordsPivot: null, key: null } : { bounds: K, coordsAnchor: null, coordsPivot: W, key: "touchSelect-" + o.getAnchor() + "-" + r };
2179
2179
  }, [n, o, r]), oe = J(null), be = On(Ee(() => {
2180
2180
  const W = (A) => r === "t" || r === "b" ? { ...A, colIndex: void 0 } : r === "l" || r === "r" ? { ...A, rowIndex: void 0 } : A;
2181
- return { processTouch: !0, consumeTouch: !0, onPointerDown: (A, q) => {
2181
+ return { processTouch: !0, consumeTouch: !0, onPointerDown: (A, K) => {
2182
2182
  const N = W(o.getCellCoordsFromClient(A.clientX, A.clientY));
2183
- return oe.current = { coordsPivot: le }, R?.(r), m.onSelectionPointerDown(A, q, o, N, le, !1, !0);
2184
- }, onPointerMoveOrWait: (A, q, N) => {
2183
+ return oe.current = { coordsPivot: le }, R?.(r), m.onSelectionPointerDown(A, K, o, N, le, !1, !0);
2184
+ }, onPointerMoveOrWait: (A, K, N) => {
2185
2185
  const xe = W(o.getCellCoordsFromClient(A.clientX, A.clientY));
2186
- return m.onSelectionPointerMoveOrWait(A, q, N, o, xe, oe.current?.coordsPivot, !0, !0);
2187
- }, onPointerUp: (A, q, N) => (oe.current = null, _?.(r), m.onPointerUp(A, q, N)) };
2186
+ return m.onSelectionPointerMoveOrWait(A, K, N, o, xe, oe.current?.coordsPivot, !0, !0);
2187
+ }, onPointerUp: (A, K, N) => (oe.current = null, _?.(r), m.onPointerUp(A, K, N)) };
2188
2188
  }, [m, n, o, r])), [U, { y: H, x: X }] = _i(), k = J(null), { getPortalContainer: u } = gi(), [C, ee] = Je(null);
2189
2189
  return st(() => {
2190
2190
  const W = k.current?.getBoundingClientRect();
2191
2191
  if (!W || !L) return void ee(null);
2192
- let A = 0, q = 0, N = I;
2193
- for (; N; ) A += N.scrollLeft, q += N.scrollTop, N = M && N === M.parentElement ? null : N.parentElement;
2194
- ee(Kr(Y("div", { className: En("touch-select-handle", g), ref: t, style: { position: "absolute", left: A + (W?.x ?? 0) - (a + s) / 2, top: q + (W?.y ?? 0) - (a + s) / 2, width: a, height: a, borderWidth: `${s}px`, border: i, borderRadius: "50%", background: l, boxShadow: `0 0 0 1.5px ${l}`, cursor: "grab", pointerEvents: "all", opacity: E ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: be, ...ae }), M ?? u(), $));
2192
+ let A = 0, K = 0, N = I;
2193
+ for (; N; ) A += N.scrollLeft, K += N.scrollTop, N = M && N === M.parentElement ? null : N.parentElement;
2194
+ ee(qr(Y("div", { className: En("touch-select-handle", g), ref: t, style: { position: "absolute", left: A + (W?.x ?? 0) - (a + s) / 2, top: K + (W?.y ?? 0) - (a + s) / 2, width: a, height: a, borderWidth: `${s}px`, border: i, borderRadius: "50%", background: l, boxShadow: `0 0 0 1.5px ${l}`, cursor: "grab", pointerEvents: "all", opacity: E ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...d }, tabIndex: -1, onPointerDown: be, ...ae }), M ?? u(), $));
2195
2195
  }, [H, X, L?.x, L?.y, L?.width, L?.height, g, E, l, a, s, i, I]), L ? Ht(wn, { children: [Y("div", { ref: Jl([U, k]), style: { position: "absolute", left: L.x, top: L.y, opacity: 0 } }), C] }) : null;
2196
2196
  }));
2197
2197
  Go.displayName = "TouchSelectHandle";
@@ -2202,8 +2202,8 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2202
2202
  }, lo = (e, t, n) => {
2203
2203
  const o = e.getVisibleRangeCoords(), r = e.getScrollOrientation();
2204
2204
  !r.horizontal && (t.colIndex > o.colEnd || t.colIndex < o.colStart) && (t = { ...t, colIndex: t.colIndex > o.colEnd ? o.colEnd + 1 : o.colEnd - 1 }, e = n.current.getViewFromLocation(Xt)), !r.vertical && (t.rowIndex > o.rowEnd || t.rowIndex < o.rowStart) && (t = { ...t, rowIndex: t.rowIndex > o.rowEnd ? o.rowEnd + 1 : o.rowEnd - 1 }, e = n.current.getViewFromLocation(Xt)), e.scrollCellCoordsIntoView(t);
2205
- }, es = () => !1, ms = ({ gridRef: e, commands: t, layout: n, selection: o, onSelectionChange: r, onSelectionDragStart: i, onSelectionDragEnd: l, selectionPolicy: s = "multiple", newSelectionMode: a = "clear", allowDeselectSelection: d = !0, onFillPreview: g, onFillCancel: m, onFillDone: f, onFill: x, disableFillDrag: E = !x, fillHandleBorderColor: I = "white", hiddenRowsAt: M, hiddenColumnsAt: ae, isContentfulCell: R, contentfulCellFinder: _ = ql, getDataCoords: L, alwaysScrollToActiveCoords: le = !1, selectionBounds: $, pointerDownInterceptor: oe, pointerMoveInterceptor: be, mergedRanges: U, canSelectionSpanMergedCells: H = es, onMoveDragStart: X, onMoveDragUpdate: k, onMoveDragEnd: u, onMoveDragDone: C, selectionRenderer: ee = Xl, disableMoveDrag: W = !u, getCellCoordsAsRangeCoords: A = Z.cellToRange, moveDragHitSize: q = 6, moveDragOutlineSize: N = 4, selectionBackgroundColor: xe = "rgba(16, 124, 65, 0.1)", selectionBorderColor: G = "rgb(33, 115, 70)", selectionRemoveBorderColor: He = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Ue = "rgba(250, 10, 10, 0.1)", disableTouchSelection: We = !1, touchSelectHandleProps: ht }) => {
2206
- const _e = O(() => ({ top: $?.top ?? 0, left: $?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), S = T(x, [x]), ue = T(g, [g]), K = T(m, [m]), pe = T(f, [f]), te = T(R, [R]), Re = T(ee, [ee]), at = T((c, h = !1) => go(c, h, n.getRowOffset, h ? _e().bottom : _e().top), [n?.getRowOffset]), pt = T(M ?? at, [M]), zt = T((c, h = !1) => go(c, h, n.getColOffset, h ? _e().right : _e().left), [n?.getColOffset]), gt = T(ae ?? zt, [ae]), [Zt, Be] = Je(() => Yt(o)), z = Ee(() => Yt(Zt), [Zt]), ke = J(z), Qe = J(!0);
2205
+ }, es = () => !1, ms = ({ gridRef: e, commands: t, layout: n, selection: o, onSelectionChange: r, onSelectionDragStart: i, onSelectionDragEnd: l, selectionPolicy: s = "multiple", newSelectionMode: a = "clear", allowDeselectSelection: d = !0, onFillPreview: g, onFillCancel: m, onFillDone: f, onFill: x, disableFillDrag: E = !x, fillHandleBorderColor: I = "white", hiddenRowsAt: M, hiddenColumnsAt: ae, isContentfulCell: R, contentfulCellFinder: _ = Kl, getDataCoords: L, alwaysScrollToActiveCoords: le = !1, selectionBounds: $, pointerDownInterceptor: oe, pointerMoveInterceptor: be, mergedRanges: U, canSelectionSpanMergedCells: H = es, onMoveDragStart: X, onMoveDragUpdate: k, onMoveDragEnd: u, onMoveDragDone: C, selectionRenderer: ee = Xl, disableMoveDrag: W = !u, getCellCoordsAsRangeCoords: A = Z.cellToRange, moveDragHitSize: K = 6, moveDragOutlineSize: N = 4, selectionBackgroundColor: xe = "rgba(16, 124, 65, 0.1)", selectionBorderColor: G = "rgb(33, 115, 70)", selectionRemoveBorderColor: He = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: Ue = "rgba(250, 10, 10, 0.1)", disableTouchSelection: We = !1, touchSelectHandleProps: ht }) => {
2206
+ const _e = O(() => ({ top: $?.top ?? 0, left: $?.left ?? 0, bottom: e.current?.rowCount - 1 || 0, right: e.current?.columnCount - 1 || 0 }), []), S = T(x, [x]), ue = T(g, [g]), q = T(m, [m]), pe = T(f, [f]), te = T(R, [R]), Re = T(ee, [ee]), at = T((c, h = !1) => go(c, h, n.getRowOffset, h ? _e().bottom : _e().top), [n?.getRowOffset]), pt = T(M ?? at, [M]), zt = T((c, h = !1) => go(c, h, n.getColOffset, h ? _e().right : _e().left), [n?.getColOffset]), gt = T(ae ?? zt, [ae]), [Zt, Be] = Je(() => Yt(o)), z = Ee(() => Yt(Zt), [Zt]), ke = J(z), Qe = J(!0);
2207
2207
  nn(Ct.throttle(() => {
2208
2208
  Be((c) => {
2209
2209
  Qe.current = !0;
@@ -2236,11 +2236,11 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2236
2236
  const b = { ranges: y, rangeIndex: V, cell: w };
2237
2237
  return Z.isEqualSelectionCoords(b, h) ? h : b;
2238
2238
  });
2239
- }, [A]), [an, Jt] = Je(null), [jt, dn] = Je(null), on = J(null), [ze, qt] = Je(null), vt = J(null), Vt = J(null), [Cn, un] = Je(null), Ne = J(null), Q = J(null), et = J(U);
2239
+ }, [A]), [an, Jt] = Je(null), [jt, dn] = Je(null), on = J(null), [ze, Kt] = Je(null), vt = J(null), Vt = J(null), [Cn, un] = Je(null), Ne = J(null), Q = J(null), et = J(U);
2240
2240
  st(() => {
2241
2241
  et.current = U;
2242
2242
  }, [U]);
2243
- const qe = T((c, h = { inline: "nearest", block: "nearest" }) => {
2243
+ const Ke = T((c, h = { inline: "nearest", block: "nearest" }) => {
2244
2244
  let { rowIndex: w, colIndex: p } = c;
2245
2245
  w === void 0 && z?.cell && (w = z.cell.rowIndex), p === void 0 && z?.cell && (p = z.cell.colIndex), w !== void 0 && p !== void 0 && e.current?.scrollCellCoordsIntoView({ rowIndex: w, colIndex: p }, h);
2246
2246
  }, [z]), dt = O((c) => {
@@ -2303,11 +2303,11 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2303
2303
  if (b && Z.indexOfCoords(p, z.ranges) !== -1 && ne) {
2304
2304
  vt.current = p;
2305
2305
  const ie = Ie(p, p);
2306
- return Vt.current = ie, qt(ie), De;
2306
+ return Vt.current = ie, Kt(ie), De;
2307
2307
  }
2308
2308
  return Ae(p), De;
2309
2309
  }
2310
- le && qe(p), de && z.ranges.length === 0 || tt(p);
2310
+ le && Ke(p), de && z.ranges.length === 0 || tt(p);
2311
2311
  }, onPointerMoveOrWait: Ct.throttle((c, h) => {
2312
2312
  if (!e?.current || c.pointerType === "touch" || c.type === "touchmove" || !nt.current) return;
2313
2313
  const w = nt.current.anchor;
@@ -2317,7 +2317,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2317
2317
  const V = { rowStart: Math.min(y.rowIndex, vt.current.rowIndex), colStart: Math.min(y.colIndex, vt.current.colIndex), rowEnd: Math.max(y.rowIndex, vt.current.rowIndex), colEnd: Math.max(y.colIndex, vt.current.colIndex) }, b = { rowIndex: V.rowStart, colIndex: V.colStart }, he = { rowIndex: V.rowEnd, colIndex: V.colEnd };
2318
2318
  if (dt(b) || dt(he)) return;
2319
2319
  const ne = Ie(b, he);
2320
- Vt.current = ne, qt(ne);
2320
+ Vt.current = ne, Kt(ne);
2321
2321
  } else rt(y);
2322
2322
  kt.current = h, lo(p, y, e);
2323
2323
  }
@@ -2339,7 +2339,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2339
2339
  }
2340
2340
  if (!vt.current) return;
2341
2341
  const h = Vt.current;
2342
- vt.current = null, Vt.current = null, qt(null), Be((w) => {
2342
+ vt.current = null, Vt.current = null, Kt(null), Be((w) => {
2343
2343
  if (Qe.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2344
2344
  let p = [], y = -1, V = w.cell;
2345
2345
  for (let he = 0; he < w.ranges.length; he++) {
@@ -2376,11 +2376,11 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2376
2376
  if (B && Z.indexOfCoords(re, z.ranges) !== -1 && ie) {
2377
2377
  vt.current = re;
2378
2378
  const Te = Ie(re, re);
2379
- return Vt.current = Te, qt(Te), Pe;
2379
+ return Vt.current = Te, Kt(Te), Pe;
2380
2380
  }
2381
2381
  return Ae(re), Pe;
2382
2382
  }
2383
- V && qe(re), Rt && z.ranges.length === 0 || tt(re);
2383
+ V && Ke(re), Rt && z.ranges.length === 0 || tt(re);
2384
2384
  }, onSelectionPointerMoveOrWait: (c, h, w, p, y, V = z.cell, b = !0, he = !1) => {
2385
2385
  if (!e?.current || (c.stopPropagation(), c.preventDefault(), c.stopImmediatePropagation(), !nt.current)) return;
2386
2386
  const ne = nt.current.anchor;
@@ -2390,7 +2390,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2390
2390
  const De = { rowStart: Math.min(we.rowIndex, vt.current.rowIndex), colStart: Math.min(we.colIndex, vt.current.colIndex), rowEnd: Math.max(we.rowIndex, vt.current.rowIndex), colEnd: Math.max(we.colIndex, vt.current.colIndex) }, de = { rowIndex: De.rowStart, colIndex: De.colStart }, ie = { rowIndex: De.rowEnd, colIndex: De.colEnd };
2391
2391
  if (dt(de) || dt(ie)) return;
2392
2392
  const _t = Ie(de, ie);
2393
- Vt.current = _t, qt(_t);
2393
+ Vt.current = _t, Kt(_t);
2394
2394
  } else rt(we, V, he);
2395
2395
  b && lo(re, we, e);
2396
2396
  }
@@ -2403,7 +2403,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2403
2403
  }
2404
2404
  if (!vt.current) return;
2405
2405
  const h = Vt.current;
2406
- vt.current = null, Vt.current = null, qt(null), Be((w) => {
2406
+ vt.current = null, Vt.current = null, Kt(null), Be((w) => {
2407
2407
  if (Qe.current = !1, (w = Yt(w)).ranges.length === 0) return w;
2408
2408
  let p = [], y = -1, V = w.cell;
2409
2409
  for (let he = 0; he < w.ranges.length; he++) {
@@ -2435,7 +2435,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2435
2435
  case ot:
2436
2436
  V = { rowIndex: B.rowEnd, colIndex: Pe.colIndex === B.colStart ? B.colEnd : B.colStart }, y = { rowIndex: B.rowStart, colIndex: Pe.colIndex === B.colStart ? B.colStart : B.colEnd };
2437
2437
  break;
2438
- case Ke:
2438
+ case qe:
2439
2439
  V = { rowIndex: B.rowEnd, colIndex: Pe.colIndex === B.colEnd ? B.colStart : B.colEnd }, y = { rowIndex: B.rowStart, colIndex: Pe.colIndex === B.colEnd ? B.colEnd : B.colStart };
2440
2440
  }
2441
2441
  }
@@ -2448,7 +2448,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2448
2448
  Q.current.colIndex >= b.colStart && Q.current.colIndex <= b.colEnd && (ne = Q.current.colIndex);
2449
2449
  break;
2450
2450
  case ot:
2451
- case Ke:
2451
+ case qe:
2452
2452
  Q.current.rowIndex >= b.rowStart && Q.current.rowIndex <= b.rowEnd && (he = Q.current.rowIndex);
2453
2453
  }
2454
2454
  if (!p) {
@@ -2462,7 +2462,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2462
2462
  case ot:
2463
2463
  ne = Ye(gt, Math.max(b.colStart - 1, re.left), c);
2464
2464
  break;
2465
- case Ke:
2465
+ case qe:
2466
2466
  ne = Ye(gt, Math.min(b.colEnd + 1, re.right), c);
2467
2467
  }
2468
2468
  if (w) switch (c) {
@@ -2475,7 +2475,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2475
2475
  case ot:
2476
2476
  ne = _({ ...V, rowIndex: z.cell.rowIndex }, te, gt, c, !1, Math.max(re.left, gt(re.left, !1)));
2477
2477
  break;
2478
- case Ke:
2478
+ case qe:
2479
2479
  ne = _({ ...V, rowIndex: z.cell.rowIndex }, te, gt, c, !1, Math.min(re.right, re.right - gt(re.right, !0)));
2480
2480
  }
2481
2481
  }
@@ -2492,7 +2492,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2492
2492
  case ot:
2493
2493
  B = n.getColOffset(ne + 1), ne = Math.max(re.left, n.getColIndex(B - p)), we = { left: n.getColOffset(ne + 1) - (B - e.current.getScrollPosition().left) };
2494
2494
  break;
2495
- case Ke:
2495
+ case qe:
2496
2496
  B = n.getColOffset(ne), ne = Math.min(re.right, n.getColIndex(B + p)), we = { left: n.getColOffset(ne) - (B - e.current.getScrollPosition().left) };
2497
2497
  }
2498
2498
  }
@@ -2503,9 +2503,9 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2503
2503
  else {
2504
2504
  if (h && Ne.current) {
2505
2505
  const B = _e();
2506
- if (c === Ke && Ne.current.colIndex === B.left || c === ot && Ne.current.colIndex === B.right || c === it && Ne.current.rowIndex === B.bottom || c === lt && Ne.current.rowIndex === B.top) return;
2506
+ if (c === qe && Ne.current.colIndex === B.left || c === ot && Ne.current.colIndex === B.right || c === it && Ne.current.rowIndex === B.bottom || c === lt && Ne.current.rowIndex === B.top) return;
2507
2507
  }
2508
- c === ot || c === Ke ? qe({ colIndex: De.colIndex }) : c !== it && c !== lt || qe({ rowIndex: De.rowIndex });
2508
+ c === ot || c === qe ? Ke({ colIndex: De.colIndex }) : c !== it && c !== lt || Ke({ rowIndex: De.rowIndex });
2509
2509
  }
2510
2510
  }, [z, A]), ln = T((c) => {
2511
2511
  if (!e.current) return;
@@ -2517,7 +2517,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2517
2517
  Qe.current = !1, p = Yt(p);
2518
2518
  const y = { ...p, cell: w.cell, rangeIndex: w.rangeIndex };
2519
2519
  return Z.isEqualSelectionCoords(y, p) ? p : y;
2520
- }), w.cell && qe(w.cell);
2520
+ }), w.cell && Ke(w.cell);
2521
2521
  }, [z, A]), vo = O(() => {
2522
2522
  const c = _e();
2523
2523
  rt({ rowIndex: c.top }, { rowIndex: c.bottom });
@@ -2525,43 +2525,43 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2525
2525
  const c = _e();
2526
2526
  rt({ colIndex: c.left }, { colIndex: c.right });
2527
2527
  }, []), xn = T(() => {
2528
- z.cell && e?.current && qe(z.cell);
2529
- }, [z.cell]), Kn = O((c = !1) => {
2528
+ z.cell && e?.current && Ke(z.cell);
2529
+ }, [z.cell]), qn = O((c = !1) => {
2530
2530
  const h = { rowIndex: _e().top };
2531
- c ? rt(h) : tt(h), qe(h);
2531
+ c ? rt(h) : tt(h), Ke(h);
2532
2532
  }, []), Yn = O((c = !1) => {
2533
2533
  const h = { rowIndex: _e().bottom };
2534
- c ? rt(h) : tt(h), qe(h);
2534
+ c ? rt(h) : tt(h), Ke(h);
2535
2535
  }, []), Dn = O((c = !1) => {
2536
2536
  const h = { colIndex: _e().left };
2537
- c ? rt(h) : tt(h), qe(h);
2537
+ c ? rt(h) : tt(h), Ke(h);
2538
2538
  }, []), Mn = O((c = !1) => {
2539
2539
  const h = _e(), w = { rowIndex: h.top, colIndex: h.left };
2540
- c ? rt(w) : tt(w), qe(w);
2540
+ c ? rt(w) : tt(w), Ke(w);
2541
2541
  }, []), zn = O((c = !1) => {
2542
2542
  const h = _e(), w = { colIndex: L?.()?.colEnd ?? h.right };
2543
- c ? rt(w) : tt(w), qe(w);
2543
+ c ? rt(w) : tt(w), Ke(w);
2544
2544
  }, [L]), vn = O((c = !1) => {
2545
2545
  const h = _e(), w = { rowIndex: L?.()?.rowEnd ?? h.bottom, colIndex: L?.()?.colEnd ?? h.right };
2546
- c ? rt(w) : tt(w), qe(w);
2546
+ c ? rt(w) : tt(w), Ke(w);
2547
2547
  }, [L]), An = T((c) => {
2548
2548
  if (!e.current || z.ranges.length <= 1) return;
2549
2549
  const h = c === ot || c === it;
2550
2550
  let w = z.rangeIndex + (h ? -1 : 1);
2551
2551
  w < 0 ? w = z.ranges.length - 1 : w > z.ranges.length - 1 && (w = 0);
2552
- const p = z.ranges[w], y = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, Ke, A, pt, gt);
2552
+ const p = z.ranges[w], y = Xo({ cell: { rowIndex: p.rowEnd, colIndex: p.colEnd }, rangeIndex: 0, ranges: [p] }, qe, A, pt, gt);
2553
2553
  Be((V) => {
2554
2554
  Qe.current = !1, V = Yt(V);
2555
2555
  const b = { ...V, cell: y.cell, rangeIndex: w };
2556
2556
  return Z.isEqualSelectionCoords(b, V) ? V : b;
2557
- }), y.cell && qe(y.cell);
2557
+ }), y.cell && Ke(y.cell);
2558
2558
  }, [z, A]), bo = T(() => {
2559
2559
  const c = Ar(z);
2560
2560
  Be((h) => {
2561
2561
  Qe.current = !1, h = Yt(h);
2562
2562
  const w = { ...h, visibleSelection: c };
2563
2563
  return Z.isEqualSelectionCoords(w, h) ? h : w;
2564
- }), c.cell && qe(c.cell);
2564
+ }), c.cell && Ke(c.cell);
2565
2565
  }, [z, A]), So = T(() => {
2566
2566
  if (!e.current || z.ranges.length === 0) return;
2567
2567
  const c = z.cell, h = z.ranges[z.rangeIndex], w = Ar({ cell: c, rangeIndex: 0, ranges: [h] }), p = w.ranges[w.rangeIndex];
@@ -2570,19 +2570,19 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2570
2570
  V = Yt(V);
2571
2571
  const b = { ...V, cell: y };
2572
2572
  return Z.isEqualSelectionCoords(b, V) ? V : b;
2573
- }), y && qe(y);
2573
+ }), y && Ke(y);
2574
2574
  }, [z, A]), Xn = O((c = !1) => {
2575
2575
  ft(lt, c, !1, e.current.getDimensions().containerHeight);
2576
2576
  }, []), Qt = O((c = !1) => {
2577
2577
  ft(it, c, !1, e.current.getDimensions().containerHeight);
2578
2578
  }, []), Gn = O((c = !1) => {
2579
- ft(Ke, c, !1, e.current.getDimensions().containerWidth);
2579
+ ft(qe, c, !1, e.current.getDimensions().containerWidth);
2580
2580
  }, []), $n = O((c = !1) => {
2581
2581
  ft(ot, c, !1, e.current.getDimensions().containerWidth);
2582
2582
  }, []), Zn = O(() => {
2583
2583
  ln(ot);
2584
2584
  }, []), Jn = O(() => {
2585
- ln(Ke);
2585
+ ln(qe);
2586
2586
  }, []), Eo = O(() => {
2587
2587
  ln(it);
2588
2588
  }, []), _o = O(() => {
@@ -2590,7 +2590,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2590
2590
  }, []), Bn = O(() => {
2591
2591
  An(ot);
2592
2592
  }, []), Io = O(() => {
2593
- An(Ke);
2593
+ An(qe);
2594
2594
  }, []), Co = O(() => {
2595
2595
  So();
2596
2596
  }, []), Qn = O(() => {
@@ -2602,13 +2602,13 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2602
2602
  }, []), D = O(() => {
2603
2603
  ft(ot, !0, !0);
2604
2604
  }, []), F = O(() => {
2605
- ft(Ke, !1, !1);
2605
+ ft(qe, !1, !1);
2606
2606
  }, []), j = O(() => {
2607
- ft(Ke, !0, !1);
2607
+ ft(qe, !0, !1);
2608
2608
  }, []), fe = O(() => {
2609
- ft(Ke, !1, !0);
2609
+ ft(qe, !1, !0);
2610
2610
  }, []), se = O(() => {
2611
- ft(Ke, !0, !0);
2611
+ ft(qe, !0, !0);
2612
2612
  }, []), ve = O(() => {
2613
2613
  ft(it, !1, !1);
2614
2614
  }, []), ye = O(() => {
@@ -2637,7 +2637,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2637
2637
  return !1;
2638
2638
  })(z.ranges, c.top, c.left, c.bottom, c.right);
2639
2639
  }, [$, z.ranges]), yt = O((c, h = !0) => {
2640
- Ne.current = c, wt(c), h && c && e?.current && qe(c);
2640
+ Ne.current = c, wt(c), h && c && e?.current && Ke(c);
2641
2641
  }, []), ge = T((c = !0) => {
2642
2642
  const h = on.current;
2643
2643
  if (!ke.current?.cell) return;
@@ -2670,8 +2670,8 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2670
2670
  if (!b) return;
2671
2671
  const he = V.length > 0, ne = he ? V[V.length - 1] : A(ke.current.cell);
2672
2672
  if (!b) return;
2673
- const re = b.rowStart < ne.rowStart ? it : b.rowEnd > ne.rowEnd ? lt : b.colEnd > ne.colEnd ? Ke : ot, we = _e();
2674
- re === ot && (b = { ...ne, colStart: Math.max(we.left, b.colStart) }), re === it && (b = { ...ne, rowStart: Math.max(we.top, b.rowStart) }), re === Ke && (b = { ...ne, colEnd: Math.min(we.right, b.colEnd) }), re === lt && (b = { ...ne, rowEnd: Math.min(we.bottom, b.rowEnd) });
2673
+ const re = b.rowStart < ne.rowStart ? it : b.rowEnd > ne.rowEnd ? lt : b.colEnd > ne.colEnd ? qe : ot, we = _e();
2674
+ re === ot && (b = { ...ne, colStart: Math.max(we.left, b.colStart) }), re === it && (b = { ...ne, rowStart: Math.max(we.top, b.rowStart) }), re === qe && (b = { ...ne, colEnd: Math.min(we.right, b.colEnd) }), re === lt && (b = { ...ne, rowEnd: Math.min(we.bottom, b.rowEnd) });
2675
2675
  const De = $r(ne, b);
2676
2676
  if (!H?.(ne)) {
2677
2677
  let de;
@@ -2681,7 +2681,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2681
2681
  if (Rt === ot) {
2682
2682
  const St = ie.colEnd + 1 - ie.colStart;
2683
2683
  Me.colStart = ie.colStart - Math.ceil(Te / St) * St, Me.colStart < Pe.left && (Me.colStart = Me.colStart + Math.ceil((Pe.left - Me.colStart) / St) * St);
2684
- } else if (Rt === Ke) {
2684
+ } else if (Rt === qe) {
2685
2685
  const St = ie.colEnd + 1 - ie.colStart;
2686
2686
  Me.colEnd = ie.colEnd + Math.ceil(Te / St) * St, Me.colEnd > Pe.right && (Me.colEnd = Me.colEnd - Math.ceil((Pe.right - Me.colEnd) / St) * St);
2687
2687
  } else if (Rt === it) {
@@ -2697,7 +2697,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2697
2697
  if (he && Z.isRangeWithinRange(b, ne) && (b = null), !Z.isEqualRanges(b, on.current)) {
2698
2698
  if (dn(b), on.current = b, !b) {
2699
2699
  try {
2700
- K?.();
2700
+ q?.();
2701
2701
  } catch {
2702
2702
  }
2703
2703
  return void pe?.();
@@ -2739,7 +2739,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2739
2739
  } }), [Ce]), Oe = On(ct), Et = Ee(() => ({ onPointerDown: Oe }), [Oe]), bt = J(null), $t = Ee(() => {
2740
2740
  const c = Z.isEqualSelectionCoords(z, bt.current) ? bt.current : z;
2741
2741
  return bt.current = c, c;
2742
- }, [z]), Kt = O((c) => {
2742
+ }, [z]), qt = O((c) => {
2743
2743
  let h = null, w = "br";
2744
2744
  const p = [], y = { stroke: I, fill: xe, strokeWidth: 0.5 }, V = (de, ie, _t) => {
2745
2745
  const B = c.toClipBounds(c.getRangeCoordsBounds(de), tn);
@@ -2766,7 +2766,7 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2766
2766
  if (b.ranges.length === 1) {
2767
2767
  const Te = c.toClipBounds(c.getRangeCoordsBounds(ie), tn);
2768
2768
  if (Te) {
2769
- W || p.push(Re({ range: ie, key: `move-selection-hit-box-${de}`, x: Te.width > 1 ? Te.x : Te.x - (q / 2 + 1), y: Te.height > 1 ? Te.y : Te.y - (q / 2 + 1), width: Math.max(Te.width + 2, 1), height: Math.max(Te.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: Ce ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: q, ...Et }));
2769
+ W || p.push(Re({ range: ie, key: `move-selection-hit-box-${de}`, x: Te.width > 1 ? Te.x : Te.x - (K / 2 + 1), y: Te.height > 1 ? Te.y : Te.y - (K / 2 + 1), width: Math.max(Te.width + 2, 1), height: Math.max(Te.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: Ce ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: K, ...Et }));
2770
2770
  const Me = B;
2771
2771
  p.push(Re({ range: ie, key: `selection-single-${de}`, x: Te.x - Me / 2, y: Te.y - Me / 2, width: Math.max(Te.width + Me / 2, 1), height: Math.max(Te.height + Me / 2, 1), stroke: G, strokeWidth: Me }));
2772
2772
  }
@@ -2816,31 +2816,31 @@ const tn = -10, Ql = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
2816
2816
  return Y("div", { children: De }, "selection");
2817
2817
  }, [$t, ze, E, jt, W, Ce, _e, I, G, xe, He, Ue, We, ht, Cn]), Ot = Ee(() => {
2818
2818
  const c = () => e.current;
2819
- return [new Se("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new Se("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new Se("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn] }] }, () => Gn(!1)), new Se("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn, It] }] }, () => Gn(!0)), new Se("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Qt(!1)), new Se("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Qt(!0)), new Se("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn] }] }, () => $n(!1)), new Se("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn, It] }] }, () => $n(!0)), new Se("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [Lt] } }, vo), new Se("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, yo), new Se("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => Kn(!0)), new Se("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new Se("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new Se("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new Se("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt] }] }, () => Mn(!1)), new Se("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt, It] }] }, () => Mn(!0)), new Se("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new Se("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new Se("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt] }] }, () => vn(!1)), new Se("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt, It] }] }, () => vn(!0)), new Se("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [Lt] } }, xn), new Se("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
2819
+ return [new Se("moveToPageDown", c, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Xn(!1)), new Se("selectToPageDown", c, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [It] }] }, () => Xn(!0)), new Se("moveToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn] }] }, () => Gn(!1)), new Se("selectToPageRight", c, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [yn, It] }] }, () => Gn(!0)), new Se("moveToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Qt(!1)), new Se("selectToPageUp", c, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [It] }] }, () => Qt(!0)), new Se("moveToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn] }] }, () => $n(!1)), new Se("selectToPageLeft", c, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [yn, It] }] }, () => $n(!0)), new Se("selectColumn", c, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [Lt] } }, vo), new Se("selectRow", c, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [It] } }, yo), new Se("selectToColumnStart", c, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => qn(!0)), new Se("selectToColumnEnd", c, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => Yn(!0)), new Se("moveToRowStart", c, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => Dn(!1)), new Se("selectToRowStart", c, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [It] }] }, () => Dn(!0)), new Se("moveToSheetStart", c, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt] }] }, () => Mn(!1)), new Se("selectToSheetStart", c, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [Lt, It] }] }, () => Mn(!0)), new Se("moveToRowEnd", c, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => zn(!1)), new Se("selectToRowEnd", c, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [It] }] }, () => zn(!0)), new Se("moveToSheetEnd", c, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt] }] }, () => vn(!1)), new Se("selectToSheetEnd", c, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [Lt, It] }] }, () => vn(!0)), new Se("scrollToActiveCoords", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [Lt] } }, xn), new Se("scrollToActiveCoordsClearSelection", c, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [It] } }, () => {
2820
2820
  rn(), yt(z.cell, !0);
2821
2821
  }), new Se("traverseSelectionRight", c, { label: "Traverse Right", description: "Traverse the selection moving rightward.", shortcut: { key: "Tab" } }, Jn), new Se("traverseSelectionLeft", c, { label: "Traverse Left", description: "Traverse the selection moving leftward.", shortcut: { key: "Tab", modifiers: [It] } }, Zn), new Se("traverseSelectionDown", c, { label: "Traverse Down", description: "Traverse the selection moving downward.", shortcut: [{ key: "Enter" }, { key: "NumpadEnter" }] }, _o), new Se("traverseSelectionUp", c, { label: "Traverse Up", description: "Traverse the selection moving upward.", shortcut: [{ key: "Enter", modifiers: [It] }, { key: "NumpadEnter", modifiers: [It] }] }, Eo), new Se("moveLeft", c, { label: "Move Left", description: "Move active cell to the left.", shortcut: [{ key: "ArrowLeft" }] }, Qn), new Se("selectLeft", c, { label: "Select Left", description: "Extend selection left.", shortcut: [{ key: "ArrowLeft", modifiers: [It] }] }, v), new Se("moveContentfulLeft", c, { label: "Move Left Contentful", description: "Move left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [Lt] }] }, P), new Se("selectContentfulLeft", c, { label: "Select Left Contentful", description: "Extend selection left to the next cell with content.", shortcut: [{ key: "ArrowLeft", modifiers: [Lt, It] }] }, D), new Se("moveRight", c, { label: "Move Right", description: "Move active cell to the right.", shortcut: [{ key: "ArrowRight" }] }, F), new Se("selectRight", c, { label: "Select Right", description: "Extend selection right.", shortcut: [{ key: "ArrowRight", modifiers: [It] }] }, j), new Se("moveContentfulRight", c, { label: "Move Right Contentful", description: "Move right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [Lt] }] }, fe), new Se("selectContentfulRight", c, { label: "Select Right Contentful", description: "Extend selection right to the next cell with content.", shortcut: [{ key: "ArrowRight", modifiers: [Lt, It] }] }, se), new Se("moveUp", c, { label: "Move Up", description: "Move active cell to the up.", shortcut: [{ key: "ArrowUp" }] }, ve), new Se("selectUp", c, { label: "Select Up", description: "Extend selection up.", shortcut: [{ key: "ArrowUp", modifiers: [It] }] }, ye), new Se("moveContentfulUp", c, { label: "Move Up Contentful", description: "Move up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [Lt] }] }, ce), new Se("selectContentfulUp", c, { label: "Select Up Contentful", description: "Extend selection up to the next cell with content.", shortcut: [{ key: "ArrowUp", modifiers: [Lt, It] }] }, Ve), new Se("moveDown", c, { label: "Move Down", description: "Move active cell to the down.", shortcut: [{ key: "ArrowDown" }] }, ut), new Se("selectDown", c, { label: "Select Down", description: "Extend selection down.", shortcut: [{ key: "ArrowDown", modifiers: [It] }] }, Fe), new Se("moveContentfulDown", c, { label: "Move Down Contentful", description: "Move down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [Lt] }] }, je), new Se("selectContentfulDown", c, { label: "Select Down Contentful", description: "Extend selection down to the next cell with content.", shortcut: [{ key: "ArrowDown", modifiers: [Lt, It] }] }, mt), new Se("selectVisible", c, { label: "Select Visible", description: "Select visible cells only.", shortcut: { key: ";", modifiers: [yn] } }, bo), new Se("traverseSelectionPreviousRange", c, { label: "Traverse Previous Range", description: "Traverse the selection to the previous range.", shortcut: { key: "ArrowLeft", modifiers: [Lt, yn] } }, Bn), new Se("traverseSelectionNextRange", c, { label: "Traverse Next Range", description: "Traverse the selection to the next range.", shortcut: { key: "ArrowRight", modifiers: [Lt, yn] } }, Io), new Se("traverseSelectionCorners", c, { label: "Traverse Corners", description: "Traverse the selection through the corners of the selected range.", shortcut: { key: ".", modifiers: [Lt] } }, Co)];
2822
2822
  }, []);
2823
2823
  return Ee(() => {
2824
2824
  t?.addCommands(Ot, !0);
2825
- }, [t]), { selection: $t, setSelectionCell: yt, setSelectionRanges: Xe, overlay: Kt, cursor: an, onPointerDown: mo, clearLastSelection: Ge, newSelection: tt, modifySelection: rt, appendSelection: Ae, clearSelections: rn, isEntire: Pt, navigate: ft, navigateSelection: ln };
2825
+ }, [t]), { selection: $t, setSelectionCell: yt, setSelectionRanges: Xe, overlay: qt, cursor: an, onPointerDown: mo, clearLastSelection: Ge, newSelection: tt, modifySelection: rt, appendSelection: Ae, clearSelections: rn, isEntire: Pt, navigate: ft, navigateSelection: ln };
2826
2826
  };
2827
2827
  function ao(e, t) {
2828
2828
  if (!e) throw new Error("Invariant failed");
2829
2829
  }
2830
- const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {}, Ci = Dt(Ut((e, t) => {
2831
- const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: f, showGridLines: x = !0, gridLineColor: E = "rgb(224, 224, 224)", gridLineRowsProps: I, gridLineColumnsProps: M, clipCells: ae = !0, cursor: R, freezeLeft: _ = 0, freezeTop: L = 0, freezeLeftProps: le, freezeTopProps: $, cellRenderer: oe, onViewportChange: be, onFirstRender: U, overlayRenderer: H, overlayProps: X, overlays: k, overlaysProps: u, allowOverlaysOverflow: C = !1, stageProps: ee, stageWrapper: W = null, hiddenRowsAt: A, hiddenColumnsAt: q, hiddenCellAt: N, getVisibleCells: xe, zoom: G = 1, enableMouseWheel: He = !0, onWheelScroll: Ue, getCellCoordsAsRangeCoords: We = Z.cellToRange, scrollPoint: ht = ts, style: _e = {}, ...S } = e;
2830
+ const Wr = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, ts = Object.freeze({ top: 0, left: 0 }), ns = Object.freeze({ bottom: -4, right: -4 }), os = Object.freeze({ horizontal: !0, vertical: !0 }), Hr = [uo, Hn, Nn, Xt], xs = 150, sn = 3e3, Fo = {}, Ci = Dt(Ut((e, t) => {
2831
+ const { width: n, height: o, rowCount: r = 1, columnCount: i = 1, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d, layout: g, onViewportScroll: m, onImmediateScroll: f, showGridLines: x = !0, gridLineColor: E = "rgb(224, 224, 224)", gridLineRowsProps: I, gridLineColumnsProps: M, clipCells: ae = !0, cursor: R, freezeLeft: _ = 0, freezeTop: L = 0, freezeLeftProps: le, freezeTopProps: $, cellRenderer: oe, onViewportChange: be, onFirstRender: U, overlayRenderer: H, overlayProps: X, overlays: k, overlaysProps: u, allowOverlaysOverflow: C = !1, stageProps: ee, stageWrapper: W = null, hiddenRowsAt: A, hiddenColumnsAt: K, hiddenCellAt: N, getVisibleCells: xe, zoom: G = 1, enableMouseWheel: He = !0, onWheelScroll: Ue, getCellCoordsAsRangeCoords: We = Z.cellToRange, scrollPoint: ht = ts, style: _e = {}, ...S } = e;
2832
2832
  ao(oe), ao(!e?.children);
2833
- const ue = T(f, [f]), K = T(be, [be]), pe = T(m, [m]), te = T(Ue, [Ue]), Re = T(U, [U]), at = J(null), pt = J(null), zt = J(null), [gt, Zt] = Qo((v) => v + 1, 0), [Be, z] = Je({ left: ht?.left ?? 0, top: ht?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ke = J(null), Qe = J(Be), { top: Xe, left: wt, verticalScrollDirection: an, horizontalScrollDirection: Jt } = Be, jt = J(!1), dn = Fl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), on = J(null), ze = Ee(() => {
2833
+ const ue = T(f, [f]), q = T(be, [be]), pe = T(m, [m]), te = T(Ue, [Ue]), Re = T(U, [U]), at = J(null), pt = J(null), zt = J(null), [gt, Zt] = Qo((v) => v + 1, 0), [Be, z] = Je({ left: ht?.left ?? 0, top: ht?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), ke = J(null), Qe = J(Be), { top: Xe, left: wt, verticalScrollDirection: an, horizontalScrollDirection: Jt } = Be, jt = J(!1), dn = Fl({ rowCount: r, columnCount: i, defaultRowHeight: l, defaultColumnWidth: s, getRowHeight: a, getColumnWidth: d }), on = J(null), ze = Ee(() => {
2834
2834
  const v = g || dn;
2835
2835
  return on.current = null, { getColOffset: (P) => v.getColOffset(P) * G, getColIndex: (P) => v.getColIndex(P / G), getRowOffset: (P) => v.getRowOffset(P) * G, getRowIndex: (P) => v.getRowIndex(P / G) };
2836
- }, [dn, g, G]), qt = (v, P, D) => {
2836
+ }, [dn, g, G]), Kt = (v, P, D) => {
2837
2837
  const F = (P?.left ?? 0) + 0, j = (P?.top ?? 0) + 0;
2838
2838
  return { getColOffset: (fe) => v.getColOffset(fe) - F, getColIndex: (fe) => v.getColIndex(fe + F), getRowOffset: (fe) => v.getRowOffset(fe) - j, getRowIndex: (fe) => v.getRowIndex(fe + j) };
2839
- }, vt = O((v, P = !1) => go(v, P, ze.getRowOffset, P ? 0 : r), [r, ze?.getRowOffset]), Vt = T(A ?? vt, [A]), Cn = O((v, P = !1) => go(v, P, ze.getColOffset, P ? i : 0), [i, ze?.getColOffset]), un = T(q ?? Cn, [q]), Ne = Ee(() => Math.min(n ?? 800, ze.getColOffset(i)), [ze.getColOffset, i, n]), Q = Ee(() => Math.min(o ?? 600, ze.getRowOffset(r)), [ze.getRowOffset, r, o]), et = O((v) => {
2839
+ }, vt = O((v, P = !1) => go(v, P, ze.getRowOffset, P ? 0 : r), [r, ze?.getRowOffset]), Vt = T(A ?? vt, [A]), Cn = O((v, P = !1) => go(v, P, ze.getColOffset, P ? i : 0), [i, ze?.getColOffset]), un = T(K ?? Cn, [K]), Ne = Ee(() => Math.min(n ?? 800, ze.getColOffset(i)), [ze.getColOffset, i, n]), Q = Ee(() => Math.min(o ?? 600, ze.getRowOffset(r)), [ze.getRowOffset, r, o]), et = O((v) => {
2840
2840
  Ct.canUseDOM && setTimeout(() => {
2841
2841
  at.current?.focus({ preventScroll: !0, ...v });
2842
2842
  }, 0);
2843
- }, []), qe = O((v) => at.current?.contains(v) || pt.current?.contains(v), []);
2843
+ }, []), Ke = O((v) => at.current?.contains(v) || pt.current?.contains(v), []);
2844
2844
  st(() => {
2845
2845
  jt.current && (ke.current && ke.current.left !== Qe.current?.left && ke.current.top !== Qe.current?.top || (ke.current = null, pe?.({ left: wt, top: Xe })));
2846
2846
  }, [wt, Xe]);
@@ -2850,11 +2850,11 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2850
2850
  typeof L == "number" ? P = L : (P = L.index ?? 0, D = (L.scrollOffset ?? 0) * G);
2851
2851
  const F = D, j = ze.getRowOffset(P), fe = j - F;
2852
2852
  if (P > 0) {
2853
- const ut = qt(ze, { top: D + ze.getRowOffset(0) }), Fe = ze.getRowIndex(F), je = ze.getRowIndex(j - 1);
2853
+ const ut = Kt(ze, { top: D + ze.getRowOffset(0) }), Fe = ze.getRowIndex(F), je = ze.getRowIndex(j - 1);
2854
2854
  let mt;
2855
2855
  v[1] = { minIndex: Fe, maxIndex: je, minCoord: 0, maxCoord: P - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => mt || (mt = Object.freeze(io(Vt, Fe, je)), mt), layout: ut, maxVirtualBounds: j, scrollOffset: D, freezeOffset: D };
2856
2856
  }
2857
- const se = Math.max(0, Q - fe), ve = qt(ze, { top: Xe + fe }), ye = ve.getRowIndex(0), ce = ve.getRowIndex(se);
2857
+ const se = Math.max(0, Q - fe), ve = Kt(ze, { top: Xe + fe }), ye = ve.getRowIndex(0), ce = ve.getRowIndex(se);
2858
2858
  let Ve;
2859
2859
  return v[0] = { minIndex: ye, maxIndex: ce, minCoord: P, maxCoord: r - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Ve || (Ve = Object.freeze(io(Vt, ye, ce)), Ve), layout: ve, maxVirtualBounds: ze.getRowOffset(r), scrollOffset: Xe, freezeOffset: (P > 0 ? ze.getRowOffset(P) : 0) - D }, v;
2860
2860
  }, [ze.getRowIndex, ze.getRowOffset, Vt, Q, r, L, Xe, G]), Le = Ee(() => {
@@ -2863,11 +2863,11 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2863
2863
  typeof _ == "number" ? P = _ : (P = _.index ?? 0, D = (_.scrollOffset ?? 0) * G);
2864
2864
  const F = D, j = ze.getColOffset(P), fe = j - F;
2865
2865
  if (P > 0) {
2866
- const ut = qt(ze, { left: D + ze.getColOffset(0) }), Fe = ze.getColIndex(F), je = ze.getColIndex(j - 1);
2866
+ const ut = Kt(ze, { left: D + ze.getColOffset(0) }), Fe = ze.getColIndex(F), je = ze.getColIndex(j - 1);
2867
2867
  let mt;
2868
2868
  v[1] = { minIndex: Fe, maxIndex: je, minCoord: 0, maxCoord: P - 1, minBounds: 0, maxBounds: fe, visibleIndices: () => mt || (mt = Object.freeze(io(un, Fe, je)), mt), layout: ut, maxVirtualBounds: j, scrollOffset: D, freezeOffset: D };
2869
2869
  }
2870
- const se = Math.max(0, Ne - fe), ve = qt(ze, { left: wt + fe }), ye = ve.getColIndex(0), ce = ve.getColIndex(se);
2870
+ const se = Math.max(0, Ne - fe), ve = Kt(ze, { left: wt + fe }), ye = ve.getColIndex(0), ce = ve.getColIndex(se);
2871
2871
  let Ve;
2872
2872
  return v[0] = { minIndex: ye, maxIndex: ce, minCoord: P, maxCoord: i - 1, minBounds: fe, maxBounds: se, visibleIndices: () => Ve || (Ve = Object.freeze(io(un, ye, ce)), Ve), layout: ve, maxVirtualBounds: ze.getColOffset(i), scrollOffset: wt, freezeOffset: (P > 0 ? ze.getColOffset(P) : 0) - D }, v;
2873
2873
  }, [ze.getColIndex, ze.getColOffset, un, Ne, i, _, wt, G]), rt = J({}), tt = J([]), Ae = Ee(() => {
@@ -2884,7 +2884,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2884
2884
  let $e, ct = 0;
2885
2885
  return Ze === void 0 || typeof Ze == "number" ? ($e = je(ce), ct = Ze) : $e = Ze, ((Oe, Et, bt = 0) => {
2886
2886
  if (Oe.x > Et.width || Oe.y > Et.height) return null;
2887
- const $t = { left: Oe.x, top: Oe.y, bottom: Oe.height + Oe.y, right: Oe.width + Oe.x }, Kt = { left: Et.x + bt, top: Et.y + bt, bottom: Et.height - 2 * bt + Et.y, right: Et.width - 2 * bt + Et.x }, Ot = { left: Math.max($t.left, Kt.left), top: Math.max($t.top, Kt.top), bottom: Math.min($t.bottom, Kt.bottom), right: Math.min($t.right, Kt.right) }, c = { x: Ot.left, y: Ot.top, width: Ot.right - Ot.left, height: Ot.bottom - Ot.top };
2887
+ const $t = { left: Oe.x, top: Oe.y, bottom: Oe.height + Oe.y, right: Oe.width + Oe.x }, qt = { left: Et.x + bt, top: Et.y + bt, bottom: Et.height - 2 * bt + Et.y, right: Et.width - 2 * bt + Et.x }, Ot = { left: Math.max($t.left, qt.left), top: Math.max($t.top, qt.top), bottom: Math.min($t.bottom, qt.bottom), right: Math.min($t.right, qt.right) }, c = { x: Ot.left, y: Ot.top, width: Ot.right - Ot.left, height: Ot.bottom - Ot.top };
2888
2888
  return c.height < 0 || c.width < 0 ? null : c;
2889
2889
  })(Ce ?? { x: 0, y: 0, width: Fe.width, height: Fe.height }, $e, ct);
2890
2890
  }, toViewBounds: (Ce) => Wt === 0 && At === 0 && G === 1 ? Ce : { x: (Ce.x - Wt) * G, y: (Ce.y - At) * G, width: Ce.width * G, height: Ce.height * G }, toAbsoluteBounds: (Ce) => Wt === 0 && At === 0 && G === 1 ? Ce : { x: Ce.x / G + Wt, y: Ce.y / G + At, width: Ce.width / G, height: Ce.height / G }, getRelativePointFromClient: (Ce, Ze) => {
@@ -2910,9 +2910,9 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2910
2910
  }, [Ae]);
2911
2911
  const kt = T(() => ({ containerWidth: Ne, containerHeight: Q, totalWidth: Mt, totalHeight: nt }), [Ne, Q, ze]);
2912
2912
  st(() => {
2913
- !ke.current && jt.current && K({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2913
+ !ke.current && jt.current && q({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2914
2914
  }, [Xe, wt, Mt, nt]), st(() => {
2915
- jt.current && K({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2915
+ jt.current && q({ top: Xe, left: wt, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt });
2916
2916
  }, [Ne, Q]);
2917
2917
  const hn = O((v, P) => {
2918
2918
  ao(typeof v == "number" && typeof P == "number");
@@ -2927,7 +2927,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2927
2927
  const se = Hr;
2928
2928
  for (let ve = 0; !fe && ve < se.length; ve++) {
2929
2929
  const ye = Ae[se[ve]];
2930
- ye && Kl(F, j, ye.getBounds()) && (fe = ye);
2930
+ ye && ql(F, j, ye.getBounds()) && (fe = ye);
2931
2931
  }
2932
2932
  return fe || (fe = Ae[Xt]), fe;
2933
2933
  }, [Ae, We]), ft = T(() => Ae[Xt].getVisibleRangeCoords(), [Ae[Xt]]), ln = J(null), vo = O(() => {
@@ -2941,19 +2941,19 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2941
2941
  const P = v?.left ?? v?.[0], D = v?.top ?? v?.[1], F = P !== void 0 ? Math.min(Mt - Ne, Math.max(Le?.[1]?.scrollOffset ?? 0, P)) : Qe.current.left, j = D !== void 0 ? Math.min(nt - Q, Math.max(Ie?.[1]?.scrollOffset ?? 0, D)) : Qe.current.top;
2942
2942
  if (Qe.current.left === F && Qe.current.top === j) return;
2943
2943
  let fe = null, se = null;
2944
- Qe.current.left > F ? fe = ot : Qe.current.left < F && (fe = Ke), Qe.current.top > j ? se = it : Qe.current.top < j && (se = lt), Ct.throttle(() => {
2944
+ Qe.current.left > F ? fe = ot : Qe.current.left < F && (fe = qe), Qe.current.top > j ? se = it : Qe.current.top < j && (se = lt), Ct.throttle(() => {
2945
2945
  z((ve) => {
2946
2946
  const ye = { ...ve, left: F, top: j, horizontalScrollDirection: fe, verticalScrollDirection: se };
2947
2947
  return Qe.current = ye, ye;
2948
2948
  });
2949
- }, 17)(), ke.current?.top === j && ke.current?.left === F || (ke.current = { left: F, top: j }, ue({ left: F, top: j }), K({ left: F, top: j, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt })), vo();
2949
+ }, 17)(), ke.current?.top === j && ke.current?.left === F || (ke.current = { left: F, top: j }, ue({ left: F, top: j }), q({ left: F, top: j, width: Ne, height: Q, totalWidth: Mt, totalHeight: nt })), vo();
2950
2950
  }, [Mt, nt, Ie, Le]);
2951
2951
  st(() => {
2952
2952
  ke.current || xn({ left: wt, top: Xe });
2953
2953
  }, [Mt, Ne, nt, Q]), nn(() => {
2954
2954
  ke.current = { left: ht?.left, top: ht?.top }, xn(ke.current);
2955
2955
  }, [ht?.left, ht?.top]);
2956
- const Kn = T((v) => {
2956
+ const qn = T((v) => {
2957
2957
  const P = v?.left ?? v?.[0], D = v?.top ?? v?.[1], F = v?.behavior ?? "auto", j = { left: Qe.current.left + (P ?? 0), top: Qe.current.top + (D ?? 0) };
2958
2958
  F && (j.behavior = F), xn(j);
2959
2959
  }, [Mt, Ne, nt, Q]), Yn = O((v) => {
@@ -2992,7 +2992,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
2992
2992
  let se = P ? F : D, ve = F;
2993
2993
  const ye = P || Math.abs(se) > Math.abs(ve);
2994
2994
  j === 1 && (ve *= 0), zt.current = window.requestAnimationFrame(() => {
2995
- zt.current = null, Kn(ye ? { left: se } : { top: ve });
2995
+ zt.current = null, qn(ye ? { left: se } : { top: ve });
2996
2996
  });
2997
2997
  }, [Mt, Ne, nt, Q, te]), zn = O((v = null) => {
2998
2998
  on.current = null, rt.current = null, Zt();
@@ -3000,7 +3000,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
3000
3000
  nn(() => {
3001
3001
  zn();
3002
3002
  }, [oe]);
3003
- const vn = wo(t, () => ({ stage: at.current, focus: et, contains: qe, invalidate: zn, scrollTo: xn, scrollBy: Kn, scrollCellCoordsIntoView: Dn, getScrollPosition: dt, getDimensions: kt, getViewport: ft, handleWheel: Mn, rowCount: r, columnCount: i, getLayout: () => ze, getRelativePointFromClient: hn, getViewFromClient: xo, getViewFromCellCoords: Yn, getViewFromLocation: mo, onViewChangeOnce: (v) => {
3003
+ const vn = wo(t, () => ({ stage: at.current, focus: et, contains: Ke, invalidate: zn, scrollTo: xn, scrollBy: qn, scrollCellCoordsIntoView: Dn, getScrollPosition: dt, getDimensions: kt, getViewport: ft, handleWheel: Mn, rowCount: r, columnCount: i, getLayout: () => ze, getRelativePointFromClient: hn, getViewFromClient: xo, getViewFromCellCoords: Yn, getViewFromLocation: mo, onViewChangeOnce: (v) => {
3004
3004
  tt.current.push(v);
3005
3005
  } }), [r, i, Ae]);
3006
3006
  st(() => (He && vn.current?.addEventListener("wheel", Mn, { passive: !1 }), jt.current = !0, ke.current = null, () => {
@@ -3036,13 +3036,13 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
3036
3036
  }
3037
3037
  }
3038
3038
  const Ve = v.getVisibleColumnOffsets(), ut = v.getVisibleRowOffsets(), Fe = v.getScrollTopLeft(), je = v.getFreezeTopLeft(), mt = Fe.left + je.left, Ge = Fe.top + je.top, Pt = Math.trunc(mt / sn), yt = Math.trunc(Ge / sn), ge = {}, xt = (Ze, $e, ct, Oe, Et) => {
3039
- const bt = `view:${Ze.getAnchor()}:cell:${Dr($e.rowIndex, $e.colIndex)}`, $t = Oe.x, Kt = Oe.y, Ot = Math.trunc((mt + $t) / sn) - Pt, c = Math.trunc((Ge + Kt) / sn) - yt;
3039
+ const bt = `view:${Ze.getAnchor()}:cell:${Dr($e.rowIndex, $e.colIndex)}`, $t = Oe.x, qt = Oe.y, Ot = Math.trunc((mt + $t) / sn) - Pt, c = Math.trunc((Ge + qt) / sn) - yt;
3040
3040
  ge[c] || (ge[c] = {});
3041
3041
  let h = ge[c][Ot];
3042
3042
  h || (h = ge[c][Ot] = []);
3043
3043
  let w = fe?.get(bt);
3044
3044
  if (!w) {
3045
- const p = (mt + $t) % sn, y = (Ge + Kt) % sn;
3045
+ const p = (mt + $t) % sn, y = (Ge + qt) % sn;
3046
3046
  w = oe({ key: bt, coords: $e, bounds: Oe, zoom: G, range: ct, view: Ze, value: Et, style: { left: me.boundPixel(p), top: me.boundPixel(y), width: me.boundPixel(Oe.width, !0), height: me.boundPixel(Oe.height, !0) } });
3047
3047
  }
3048
3048
  se?.set(bt, w), h.push(w);
@@ -3054,7 +3054,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
3054
3054
  if (!Z.isRangesIntersect(Oe, Et) && !Z.isRangeWithinRange(Oe, Et)) continue;
3055
3055
  const bt = Oe && !Z.isSingleCell(Oe);
3056
3056
  if (!bt && N?.(ct)) continue;
3057
- const $t = ct.rowIndex, Kt = ct.colIndex, Ot = ut[$t], c = Ve[Kt];
3057
+ const $t = ct.rowIndex, qt = ct.colIndex, Ot = ut[$t], c = Ve[qt];
3058
3058
  let h = null;
3059
3059
  Ot && c && (h = { x: c.offset, y: Ot.offset, width: c.size, height: Ot.size });
3060
3060
  const w = Dr(Oe.rowStart, Oe.colStart);
@@ -3077,7 +3077,7 @@ const Wr = { "sheetxl-grid": "_sheetxl-grid_11irg_13" }, ts = Object.freeze({ to
3077
3077
  for (let Oe = 0; Oe < ct.length; Oe++) {
3078
3078
  const Et = $e[ct[Oe]];
3079
3079
  if (!Et) continue;
3080
- const bt = parseInt(Ce[Ze]), $t = parseInt(ct[Oe]), Kt = bt + yt, Ot = $t + Pt, c = `view:${v.getAnchor()}:segment:${Ot}:${Kt}`;
3080
+ const bt = parseInt(Ce[Ze]), $t = parseInt(ct[Oe]), qt = bt + yt, Ot = $t + Pt, c = `view:${v.getAnchor()}:segment:${Ot}:${qt}`;
3081
3081
  P.push(Y("div", { className: "cell-container", style: { transform: `translate(${me.boundPixel($t * sn - At, !0)}px, ${me.boundPixel(bt * sn - Wt, !0)}px)`, willChange: "transform" }, children: Et }, c));
3082
3082
  }
3083
3083
  }
@@ -3229,18 +3229,18 @@ const Ti = "ew-resize", Ri = "ns-resize", ls = Dt(Ut((e, t) => {
3229
3229
  const { orientation: n, view: o, index: r, disabled: i = !1, disabledResize: l = !1, resizeThreshold: s = 1, dividerRenderer: a = ss, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x, onDividerAutoFit: E, onPointerDown: I, ...M } = e, ae = T(I, [I]), R = T(E, [E]), _ = n === Nt;
3230
3230
  let L = _ ? o.getVisibleColumns() : o.getVisibleRows(), le = null;
3231
3231
  L.length > 0 && (_ ? le = o.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: L[0], colEnd: L[L.length - 1] }) : o.getRangeCoordsBounds({ rowStart: L[0], rowEnd: L[L.length - 1], colStart: 0, colEnd: 0 }), le = o.toClipBounds(le, tn));
3232
- const $ = J(null), [oe, be] = Je(null), U = (A, q) => _ ? A.clientX - q.clientX : A.clientY - q.clientY, H = o.getLayout(), X = _ ? H.getColOffset(r + 1) : H.getRowOffset(r + 1), k = On({ processTouch: !0, onPointerDown: (A) => {
3232
+ const $ = J(null), [oe, be] = Je(null), U = (A, K) => _ ? A.clientX - K.clientX : A.clientY - K.clientY, H = o.getLayout(), X = _ ? H.getColOffset(r + 1) : H.getRowOffset(r + 1), k = On({ processTouch: !0, onPointerDown: (A) => {
3233
3233
  if (ae?.(A), !i && !l) {
3234
- const q = _ ? H.getColOffset(r) : H.getRowOffset(r), N = X - q;
3234
+ const K = _ ? H.getColOffset(r) : H.getRowOffset(r), N = X - K;
3235
3235
  $.current = { isResizing: !1, startSize: N, index: r, view: o, orientation: n, onDividerMouseDown: d, onDividerResizeStart: g, onDividerResize: m, onDividerResizeEnd: f, onDividerMouseUp: x }, be($.current), d?.(r, N);
3236
3236
  }
3237
3237
  A.stopPropagation(), A.preventDefault();
3238
- }, onPointerUp: (A, q, N) => {
3238
+ }, onPointerUp: (A, K, N) => {
3239
3239
  if (!$.current) return;
3240
3240
  $.current.isResizing && $.current.onDividerResizeEnd?.($.current.index, Math.max(0, $.current.startSize + U(A, N)), $.current.startSize);
3241
3241
  const xe = $.current;
3242
3242
  $.current = null, be($.current), xe.onDividerMouseUp?.(xe.index);
3243
- }, onPointerMoveOrWait: (A, q, N) => {
3243
+ }, onPointerMoveOrWait: (A, K, N) => {
3244
3244
  if (!$.current) return;
3245
3245
  const xe = U(A, N);
3246
3246
  $.current.isResizing ? $.current.onDividerResize?.($.current.index, Math.max(0, $.current.startSize + xe), $.current.startSize) : Math.abs(xe) > Math.max(1, s) && ($.current = { ...$.current, isResizing: !0 }, be($.current), $.current.onDividerResizeStart?.($.current.index, Math.max(0, $.current.startSize + xe))), A.stopPropagation(), A.preventDefault();
@@ -3252,7 +3252,7 @@ const Ti = "ew-resize", Ri = "ns-resize", ls = Dt(Ut((e, t) => {
3252
3252
  if (!C) return;
3253
3253
  const { getPortalContainer: ee } = gi();
3254
3254
  let W = null;
3255
- return oe && oe.isResizing && oe.index === r && (W = Kr(Y("div", { style: { position: "absolute", cursor: _ ? Ti : Ri, left: 0, top: 0, width: "100%", height: "100%" } }), ee(), "divider:" + r)), Ht(wn, { children: [W, Y("div", { className: En("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${_ ? le.y : X}px`, left: `${_ ? X : le.x}px`, width: (_ ? 0 : le.width - 1) + "px", height: (_ ? le.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: C })] });
3255
+ return oe && oe.isResizing && oe.index === r && (W = qr(Y("div", { style: { position: "absolute", cursor: _ ? Ti : Ri, left: 0, top: 0, width: "100%", height: "100%" } }), ee(), "divider:" + r)), Ht(wn, { children: [W, Y("div", { className: En("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${_ ? le.y : X}px`, left: `${_ ? X : le.x}px`, width: (_ ? 0 : le.width - 1) + "px", height: (_ ? le.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: C })] });
3256
3256
  }));
3257
3257
  class cs {
3258
3258
  naturalDimensions(t, n = {}) {
@@ -3281,20 +3281,20 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
3281
3281
  let u = 2;
3282
3282
  const C = 96 * U / 72, ee = 1.2 * C;
3283
3283
  le === "right" && (u += 1);
3284
- const W = Ee(() => new cs().naturalDimensions(k, { maxWidth: oe === "wrap" ? ae - u : void 0, lineHeight: `${ee}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [k, oe, u, C, be, H, X, g, ae]), A = O(() => W.maxLineHeight ? W.maxLineHeight + "px" : "1.2", [W]), [q, N] = Je(A);
3284
+ const W = Ee(() => new cs().naturalDimensions(k, { maxWidth: oe === "wrap" ? ae - u : void 0, lineHeight: `${ee}px`, paintableText: { fontStyle: X, wrap: oe, letterSpacing: -0.25 } }), [k, oe, u, C, be, H, X, g, ae]), A = O(() => W.maxLineHeight ? W.maxLineHeight + "px" : "1.2", [W]), [K, N] = Je(A);
3285
3285
  nn(() => {
3286
3286
  N(A());
3287
3287
  }, [d, W]), nn(() => {
3288
3288
  g?.({ width: oe === "wrap" ? void 0 : W.width + u, height: W.height });
3289
3289
  }, [W, g]);
3290
- const xe = T(i, [i]), G = T((K) => {
3291
- if (R.dirty === K) return;
3290
+ const xe = T(i, [i]), G = T((q) => {
3291
+ if (R.dirty === q) return;
3292
3292
  const pe = { ...R };
3293
- pe.dirty = K, M.current, _(pe), xe?.(pe);
3294
- }, [R]), He = T((K) => {
3295
- if (R.editMode === K) return;
3293
+ pe.dirty = q, M.current, _(pe), xe?.(pe);
3294
+ }, [R]), He = T((q) => {
3295
+ if (R.editMode === q) return;
3296
3296
  const pe = { ...R };
3297
- pe.editMode = K, _(pe), xe?.(pe);
3297
+ pe.editMode = q, _(pe), xe?.(pe);
3298
3298
  }, [R]), Ue = T(() => {
3299
3299
  try {
3300
3300
  return l?.(R), a?.(), !0;
@@ -3303,24 +3303,24 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
3303
3303
  }
3304
3304
  }, [l, R]), We = T(() => {
3305
3305
  _(n), s?.(), a?.();
3306
- }, [s, n]), ht = T((K) => {
3306
+ }, [s, n]), ht = T((q) => {
3307
3307
  if (!M.current) return;
3308
- if (K.isDefaultPrevented(), !(K.isTrusted || K.nativeEvent.ctrlKey || K.nativeEvent.metaKey || K.nativeEvent.altKey || K.nativeEvent.isComposing) && vi.indexOf(K.nativeEvent.key) !== -1) {
3308
+ if (q.isDefaultPrevented(), !(q.isTrusted || q.nativeEvent.ctrlKey || q.nativeEvent.metaKey || q.nativeEvent.altKey || q.nativeEvent.isComposing) && vi.indexOf(q.nativeEvent.key) !== -1) {
3309
3309
  const te = { ...R };
3310
- return te.dirty = K.nativeEvent.key === "Backspace" ? "" : (te.dirty ?? "") + K.key, _(te), xe?.(te), void K.preventDefault();
3310
+ return te.dirty = q.nativeEvent.key === "Backspace" ? "" : (te.dirty ?? "") + q.key, _(te), xe?.(te), void q.preventDefault();
3311
3311
  }
3312
- const pe = K.nativeEvent.shiftKey;
3313
- if (K.which === Ji) return K.preventDefault(), void We();
3314
- if (K.which === ol) return He(!0), void K.preventDefault();
3315
- if (K.which === Zi && (K.preventDefault(), Ue() && m?.(pe ? it : lt)), K.which === Gi) return K.preventDefault(), void (Ue() && m?.(pe ? ot : Ke));
3312
+ const pe = q.nativeEvent.shiftKey;
3313
+ if (q.which === Ji) return q.preventDefault(), void We();
3314
+ if (q.which === ol) return He(!0), void q.preventDefault();
3315
+ if (q.which === Zi && (q.preventDefault(), Ue() && m?.(pe ? it : lt)), q.which === Gi) return q.preventDefault(), void (Ue() && m?.(pe ? ot : qe));
3316
3316
  if (!R.editMode) {
3317
3317
  let te = null;
3318
- switch (K.which) {
3318
+ switch (q.which) {
3319
3319
  case Qi:
3320
3320
  te = ot;
3321
3321
  break;
3322
3322
  case tl:
3323
- te = Ke;
3323
+ te = qe;
3324
3324
  break;
3325
3325
  case el:
3326
3326
  te = it;
@@ -3334,25 +3334,25 @@ const as = (e = void 0) => Object.freeze({ clean: e, dirty: void 0, editMode: !1
3334
3334
  st(() => {
3335
3335
  S(!1);
3336
3336
  }, []);
3337
- const ue = wo(t, () => ({ startEdit(K) {
3338
- let pe = K?.initialSelection;
3337
+ const ue = wo(t, () => ({ startEdit(q) {
3338
+ let pe = q?.initialSelection;
3339
3339
  if (!pe) {
3340
3340
  const Re = M.current.value.length ?? 0;
3341
3341
  pe = { start: Re, end: Re, direction: "forward" };
3342
3342
  }
3343
3343
  M.current?.setSelectionRange(pe.start, pe.end, pe.direction);
3344
- const te = { ...n, editMode: K?.editMode ?? !1 };
3345
- K?.text !== void 0 && (te.dirty = K.text), te.editMode === n.editMode && te.dirty === n.dirty || (_(te), xe?.(te));
3344
+ const te = { ...n, editMode: q?.editMode ?? !1 };
3345
+ q?.text !== void 0 && (te.dirty = q.text), te.editMode === n.editMode && te.dirty === n.dirty || (_(te), xe?.(te));
3346
3346
  }, submitEdit: () => Ue(), cancelEdit() {
3347
3347
  We();
3348
3348
  }, autoFocus() {
3349
3349
  M.current?.focus();
3350
- }, getLineHeight: () => W?.maxLineHeight ?? ee, dispatchEvent: (K) => M.current.dispatchEvent(K) }), [n, r]);
3351
- return Y("div", { ref: ue, ...I, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: W.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: Y("textarea", { spellCheck: "false", ref: M, value: k, autoFocus: !1, disabled: _e, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${C}px`, fontFamily: `${be}`, fontWeight: `${H}`, fontStyle: `${X}`, padding: "0px", marginRight: L === "right" ? "3px" : "0px", marginLeft: L === "left" ? "2px" : "0px", lineHeight: q, height: W.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: L, background: "transparent", color: $, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: oe === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (K) => {
3352
- G(K.target.value);
3353
- }, onDoubleClick: (K) => {
3354
- K.isTrusted;
3355
- }, onMouseDown: (K) => {
3350
+ }, getLineHeight: () => W?.maxLineHeight ?? ee, dispatchEvent: (q) => M.current.dispatchEvent(q) }), [n, r]);
3351
+ return Y("div", { ref: ue, ...I, style: { background: "transparent", display: "flex", flexGrow: 1, alignSelf: "center", height: W.height, maxWidth: "100%", maxHeight: "100%", ...x }, children: Y("textarea", { spellCheck: "false", ref: M, value: k, autoFocus: !1, disabled: _e, name: "cell-editor", autoComplete: "off", autoCapitalize: "off", style: { flex: "1 1 100%", position: "relative", fontSize: `${C}px`, fontFamily: `${be}`, fontWeight: `${H}`, fontStyle: `${X}`, padding: "0px", marginRight: L === "right" ? "3px" : "0px", marginLeft: L === "left" ? "2px" : "0px", lineHeight: K, height: W.height, textRendering: "geometricPrecision", letterSpacing: "-0.25px", boxSizing: "border-box", borderWidth: 0, outline: "none", resize: "none", overflow: "hidden", verticalAlign: "baseline", textAlign: L, background: "transparent", color: $, marginBottom: "0px", userSelect: "text", maxHeight: "100%", whiteSpace: oe === "wrap" ? "break-spaces" : "pre", wordWrap: "break-word" }, onChange: (q) => {
3352
+ G(q.target.value);
3353
+ }, onDoubleClick: (q) => {
3354
+ q.isTrusted;
3355
+ }, onMouseDown: (q) => {
3356
3356
  He(!0);
3357
3357
  }, onKeyDown: ht }) });
3358
3358
  })), bs = Dt((e) => {