@gridsheet/react-core 3.0.3 → 3.0.5

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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { calcSideStyle as Vn, clampPopup as Jt, clampLeft as qn, zoneToArea as de, focus as H, Lexer as qe, getFunctionHelps as $t, expandInput as Gn, y2r as ve, x2c as me, resetInput as Qn, handleFormulaQuoteAutoClose as en, areaToZone as Ge, insertTextAtCursor as tn, operations as O, isRefInsertable as nn, COLOR_PALETTE as De, DEFAULT_WIDTH as yt, DEFAULT_HEIGHT as vt, between as Te, makeSequence as Pt, p2a as Ne, MIN_HEIGHT as Xt, MIN_WIDTH as Ot, zoneShape as te, getLabel as bt, FormulaError as Jn, Pending as es, insertRef as Me, areaToRange as sn, calcBelowPosition as ts, hAlignTransform as ns, among as ss, getAreaInTabular as Ht, isFocus as rs, Autofill as os, getCellRectPositions as Ie, a2p as wt, virtualize as Lt, stripAddressAbsolute as is, stripSheetName as ls, preventSafariBounce as as, smartScroll as cs, isZoneNotSelected as us, Sheet as ds, embedStyle as gs, getMaxSizesFromCells as rn, HEADER_HEIGHT as hs, DEFAULT_ROW_KEY as fs, SHEET_HEIGHT as Bt, HEADER_WIDTH as ms, DEFAULT_COL_KEY as ps, SHEET_WIDTH as Kt } from "@gridsheet/core";
2
- import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as zr, ThousandSeparatorPolicyMixin as Wr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as Eo, toCellObject as xo, toCellRows as ko, toValueCols as To, toValueMatrix as Ao, toValueObject as Mo, toValueRows as Do, x2c as Io, y2r as Fo, zoneToArea as Yo } from "@gridsheet/core";
1
+ import { calcSideStyle as Vn, clampPopup as Jt, clampLeft as qn, zoneToArea as ge, focus as L, Lexer as qe, getFunctionHelps as $t, expandInput as Gn, y2r as ve, x2c as me, resetInput as Qn, handleFormulaQuoteAutoClose as en, areaToZone as Ge, insertTextAtCursor as tn, operations as H, isRefInsertable as nn, COLOR_PALETTE as De, DEFAULT_WIDTH as yt, DEFAULT_HEIGHT as vt, between as Te, makeSequence as Pt, p2a as Ne, MIN_HEIGHT as Xt, MIN_WIDTH as Ot, zoneShape as ne, getLabel as bt, FormulaError as Jn, Pending as es, insertRef as Me, areaToRange as sn, calcBelowPosition as ts, hAlignTransform as ns, among as ss, getAreaInTabular as Ht, isFocus as rs, Autofill as os, getCellRectPositions as Ie, a2p as wt, virtualize as Lt, stripAddressAbsolute as is, stripSheetName as ls, preventSafariBounce as as, smartScroll as cs, isZoneNotSelected as us, Sheet as ds, embedStyle as gs, getMaxSizesFromCells as rn, HEADER_HEIGHT as hs, DEFAULT_ROW_KEY as fs, SHEET_HEIGHT as Bt, HEADER_WIDTH as ms, DEFAULT_COL_KEY as ps, SHEET_WIDTH as Kt } from "@gridsheet/core";
2
+ import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as Wr, ThousandSeparatorPolicyMixin as zr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as xo, toCellObject as Eo, toCellRows as ko, toValueCols as To, toValueMatrix as Ao, toValueObject as Mo, toValueRows as Do, x2c as Io, y2r as Fo, zoneToArea as Yo } from "@gridsheet/core";
3
3
  import { jsxs as F, jsx as c, Fragment as we } from "react/jsx-runtime";
4
- import lt, { createContext as on, useRef as oe, useContext as ie, useLayoutEffect as at, useState as J, useMemo as Ye, useCallback as M, memo as tt, useEffect as Z, createRef as ln, useReducer as ys } from "react";
5
- import { u as vs, s as ue, w as Ze, a as re, b as Ue, r as ct, c as an, d as cn, e as $e, f as un, g as dn, h as be, i as _e, j as bs, k as Zt, l as ut, p as dt, m as Qe, n as Se, o as gt, q as ht, t as Fe, v as Rt, x as gn, y as hn, z as fn, A as mn, B as pn, C as yn, D as ze, E as Je, F as ft, G as nt, H as ws, I as Pe, J as fe, K as xe, L as vn, M as Ke, N as Ut, O as bn, P as zt, Q as Wt, R as Rs, S as Cs, T as _t, U as Ss, V as Ns } from "./hooks-Y7BI_RNj.mjs";
4
+ import lt, { createContext as on, useRef as ie, useContext as le, useLayoutEffect as at, useState as te, useMemo as Ye, useCallback as A, memo as tt, useEffect as W, createRef as ln, useReducer as ys } from "react";
5
+ import { u as vs, s as de, w as Ze, a as oe, b as Ue, r as ct, c as an, d as cn, e as $e, f as un, g as dn, h as be, i as _e, j as bs, k as Zt, l as ut, p as dt, m as Qe, n as Se, o as gt, q as ht, t as Fe, v as Rt, x as gn, y as hn, z as fn, A as mn, B as pn, C as yn, D as We, E as Je, F as ft, G as nt, H as ws, I as Pe, J as fe, K as Ee, L as vn, M as Ke, N as Ut, O as bn, P as Wt, Q as zt, R as Rs, S as Cs, T as _t, U as Ss, V as Ns } from "./hooks-Y7BI_RNj.mjs";
6
6
  import { W as Po } from "./hooks-Y7BI_RNj.mjs";
7
7
  import { createPortal as Ct } from "react-dom";
8
- const le = on(
8
+ const ae = on(
9
9
  {}
10
10
  ), St = ({
11
11
  option: e,
@@ -14,7 +14,7 @@ const le = on(
14
14
  top: s,
15
15
  left: r
16
16
  }) => {
17
- const o = oe(null), i = oe(null), { store: h } = ie(le), f = !h.editorHovering;
17
+ const o = ie(null), i = ie(null), { store: h } = le(ae), f = !h.editorHovering;
18
18
  return at(() => {
19
19
  const a = i.current;
20
20
  a && Vn(a);
@@ -35,7 +35,7 @@ const le = on(
35
35
  e.isFunction && /* @__PURE__ */ F(we, { children: [
36
36
  /* @__PURE__ */ c("div", { className: "gs-fn-guide1-example", children: e.example }),
37
37
  e.description && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-desc", style: { whiteSpace: "pre-line" }, children: e.description }),
38
- e.defs && e.defs.length > 0 && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-args", children: e.defs.map((a, u) => {
38
+ e.defs && e.defs.length > 0 && /* @__PURE__ */ c("div", { className: "gs-fn-guide1-args", children: e.defs.map((a, d) => {
39
39
  var w;
40
40
  return /* @__PURE__ */ F("div", { className: "gs-fn-guide1-arg", children: [
41
41
  /* @__PURE__ */ c("span", { className: "gs-fn-guide1-arg-name", children: a.name }),
@@ -46,7 +46,7 @@ const le = on(
46
46
  " — ",
47
47
  a.description
48
48
  ] })
49
- ] }, u);
49
+ ] }, d);
50
50
  }) })
51
51
  ] })
52
52
  ]
@@ -61,46 +61,46 @@ const le = on(
61
61
  n.category && /* @__PURE__ */ c("span", { className: `gs-fn-guide-category gs-fn-guide-category-${n.category}`, children: n.category }),
62
62
  /* @__PURE__ */ c("div", { className: "gs-fn-guide2-name", children: n.example }),
63
63
  /* @__PURE__ */ c("div", { className: "gs-fn-guide2-args-inline", children: (() => {
64
- const a = n.defs ?? [], u = a.filter((b) => b.variadic).length, w = a.length - u;
65
- return a.map((b, d) => {
64
+ const a = n.defs ?? [], d = a.filter((b) => b.variadic).length, w = a.length - d;
65
+ return a.map((b, g) => {
66
66
  let m;
67
67
  if (t < w)
68
- m = t === d;
69
- else if (u > 0 && d >= w) {
70
- const y = (t - w) % u;
71
- m = d === w + y;
68
+ m = t === g;
69
+ else if (d > 0 && g >= w) {
70
+ const y = (t - w) % d;
71
+ m = g === w + y;
72
72
  } else
73
73
  m = !1;
74
74
  return /* @__PURE__ */ F(lt.Fragment, { children: [
75
- d > 0 ? ", " : "",
75
+ g > 0 ? ", " : "",
76
76
  /* @__PURE__ */ F("span", { className: m ? "gs-active-arg" : "", children: [
77
77
  b.optional ? "[" : "",
78
78
  b.name,
79
79
  b.variadic ? ", ..." : "",
80
80
  b.optional ? "]" : ""
81
81
  ] })
82
- ] }, d);
82
+ ] }, g);
83
83
  });
84
84
  })() }),
85
85
  (() => {
86
86
  var m;
87
- const a = n.defs ?? [], u = a.filter((y) => y.variadic).length, w = a.length - u;
87
+ const a = n.defs ?? [], d = a.filter((y) => y.variadic).length, w = a.length - d;
88
88
  let b;
89
- if (t < w || u === 0)
89
+ if (t < w || d === 0)
90
90
  b = Math.min(t, a.length - 1);
91
91
  else {
92
- const y = (t - w) % u;
92
+ const y = (t - w) % d;
93
93
  b = w + y;
94
94
  }
95
- const d = a[b];
96
- return d != null && d.description ? /* @__PURE__ */ c("div", { className: "gs-fn-guide2-desc", style: { marginTop: 8, fontSize: 12, color: "#888" }, children: /* @__PURE__ */ F("p", { children: [
95
+ const g = a[b];
96
+ return g != null && g.description ? /* @__PURE__ */ c("div", { className: "gs-fn-guide2-desc", style: { marginTop: 8, fontSize: 12, color: "#888" }, children: /* @__PURE__ */ F("p", { children: [
97
97
  /* @__PURE__ */ F("strong", { children: [
98
- d.name,
98
+ g.name,
99
99
  ":"
100
100
  ] }),
101
101
  " ",
102
- /* @__PURE__ */ c("code", { className: "gs-fn-guide2-arg-type", children: ((m = d.acceptedTypes) == null ? void 0 : m.join(" | ")) || "any" }),
103
- d.description
102
+ /* @__PURE__ */ c("code", { className: "gs-fn-guide2-arg-type", children: ((m = g.acceptedTypes) == null ? void 0 : m.join(" | ")) || "any" }),
103
+ g.description
104
104
  ] }) }) : null;
105
105
  })(),
106
106
  n.description && /* @__PURE__ */ c("div", { className: "gs-fn-guide2-desc", style: { whiteSpace: "pre-line" }, children: n.description })
@@ -114,7 +114,7 @@ const le = on(
114
114
  selected: s,
115
115
  onOptionMouseDown: r
116
116
  }) => {
117
- const o = oe(null), [i, h] = J(t);
117
+ const o = ie(null), [i, h] = te(t);
118
118
  return at(() => {
119
119
  if (!o.current)
120
120
  return;
@@ -124,7 +124,7 @@ const le = on(
124
124
  "li",
125
125
  {
126
126
  className: `gs-editor-option ${s === a ? " gs-editor-option-selected" : ""}`,
127
- onMouseDown: (u) => r(u, a),
127
+ onMouseDown: (d) => r(d, a),
128
128
  children: [
129
129
  /* @__PURE__ */ F("div", { className: "gs-editor-option-content", children: [
130
130
  /* @__PURE__ */ c("span", { children: f.label ?? f.value }),
@@ -140,24 +140,24 @@ const le = on(
140
140
  if (!o)
141
141
  return { top: 0, left: 0, bottom: 0, right: 0 };
142
142
  const { y: i, x: h } = t;
143
- let a = de(n);
143
+ let a = ge(n);
144
144
  a.left === -1 && (a = { top: i, left: h, bottom: i, right: h });
145
- const u = s.current, w = o.trim(a), b = Es(w, {
145
+ const d = s.current, w = o.trim(a), b = xs(w, {
146
146
  getter: (m, y) => m.getPolicy(y).serializeForClipboard({ point: y, sheet: m })
147
- }), d = xs(w, {
147
+ }), g = Es(w, {
148
148
  getter: (m, y) => m.getPolicy(y).serializeForClipboard({ point: y, sheet: m })
149
149
  });
150
150
  if (navigator.clipboard) {
151
- const m = new Blob([b], { type: "text/plain" }), y = new Blob([d], { type: "text/html" });
151
+ const m = new Blob([b], { type: "text/plain" }), y = new Blob([g], { type: "text/html" });
152
152
  navigator.clipboard.write([
153
153
  new ClipboardItem({
154
154
  "text/plain": m,
155
155
  "text/html": y
156
156
  })
157
157
  ]);
158
- } else u != null && (u.value = b, H(u), u.select(), document.execCommand("copy"), u.value = "", u.blur());
158
+ } else d != null && (d.value = b, L(d), d.select(), document.execCommand("copy"), d.value = "", d.blur());
159
159
  return a;
160
- }, Es = (e, {
160
+ }, xs = (e, {
161
161
  getter: n = (i, h) => {
162
162
  var f;
163
163
  return String(((f = i.getCell(h)) == null ? void 0 : f.value) ?? "");
@@ -174,8 +174,8 @@ const le = on(
174
174
  continue;
175
175
  const f = [];
176
176
  let a = !0;
177
- for (let u = e.left; u <= e.right; u++) {
178
- const b = n(e, { y: h, x: u });
177
+ for (let d = e.left; d <= e.right; d++) {
178
+ const b = n(e, { y: h, x: d });
179
179
  b !== "" && (a = !1), b.indexOf(`
180
180
  `) !== -1 ? f.push(`"${b.replace(/"/g, '""')}"`) : f.push(b);
181
181
  }
@@ -185,7 +185,7 @@ const le = on(
185
185
  for (; i.length > 0 && i[i.length - 1].isEmpty; )
186
186
  i.pop();
187
187
  return i.map((h) => h.line).join(o);
188
- }, xs = (e, {
188
+ }, Es = (e, {
189
189
  getter: n = (r, o) => {
190
190
  var i;
191
191
  return String(((i = r.getCell(o)) == null ? void 0 : i.value) ?? "");
@@ -200,9 +200,9 @@ const le = on(
200
200
  const i = [];
201
201
  let h = !0;
202
202
  for (let f = e.left; f <= e.right; f++) {
203
- const u = n(e, { y: o, x: f });
204
- u !== "" && (h = !1);
205
- const w = u.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
203
+ const d = n(e, { y: o, x: f });
204
+ d !== "" && (h = !1);
205
+ const w = d.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&apos;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
206
206
  i.push(`<td>${w}</td>`);
207
207
  }
208
208
  r.push({ isEmpty: h, html: `<tr>${i.join("")}</tr>` });
@@ -212,77 +212,77 @@ const le = on(
212
212
  r.pop();
213
213
  return `<table>${r.map((o) => o.html).join("")}</table>`;
214
214
  }, Rn = ({ inputting: e, selectionStart: n, optionsAll: t, functions: s }) => {
215
- const [r, o] = J(0), { filteredOptions: i, matchParams: h, activeFunctionHelp: f, activeArgIndex: a } = Ye(() => {
216
- var S, p;
217
- const d = e.startsWith("=");
215
+ const [r, o] = te(0), { filteredOptions: i, matchParams: h, activeFunctionHelp: f, activeArgIndex: a } = Ye(() => {
216
+ var C, p;
217
+ const g = e.startsWith("=");
218
218
  let m = null, y = 0;
219
- const D = e.slice(0, n), T = e.slice(n);
220
- if (d && D.length > 1)
219
+ const D = e.slice(0, n), E = e.slice(n);
220
+ if (g && D.length > 1)
221
221
  try {
222
- const l = D.slice(1), g = new qe(l);
223
- g.tokenize();
222
+ const l = D.slice(1), u = new qe(l);
223
+ u.tokenize();
224
224
  const v = [];
225
- for (let x = 0; x < g.tokens.length; x++) {
226
- const A = g.tokens[x];
227
- if (A.type === "FUNCTION") {
228
- const C = g.tokens[x + 1];
229
- (C == null ? void 0 : C.type) === "OPEN" ? (v.push({ name: A.entity, argIndex: 0, hasWaitComma: !1 }), x++) : g.tokens.length - 1;
230
- } else A.type === "COMMA" ? v.length > 0 && (v[v.length - 1].argIndex++, v[v.length - 1].hasWaitComma = !0) : A.type === "CLOSE" ? v.length > 0 && v.pop() : A.type !== "SPACE" && v.length > 0 && (v[v.length - 1].hasWaitComma = !1);
225
+ for (let x = 0; x < u.tokens.length; x++) {
226
+ const T = u.tokens[x];
227
+ if (T.type === "FUNCTION") {
228
+ const R = u.tokens[x + 1];
229
+ (R == null ? void 0 : R.type) === "OPEN" ? (v.push({ name: T.entity, argIndex: 0, hasWaitComma: !1 }), x++) : u.tokens.length - 1;
230
+ } else T.type === "COMMA" ? v.length > 0 && (v[v.length - 1].argIndex++, v[v.length - 1].hasWaitComma = !0) : T.type === "CLOSE" ? v.length > 0 && v.pop() : T.type !== "SPACE" && v.length > 0 && (v[v.length - 1].hasWaitComma = !1);
231
231
  }
232
232
  if (v.length > 0) {
233
- const x = v[v.length - 1], A = $t(s);
234
- y = x.argIndex, m = A.find((C) => C.name === x.name.toUpperCase()) || null;
233
+ const x = v[v.length - 1], T = $t(s);
234
+ y = x.argIndex, m = T.find((R) => R.name === x.name.toUpperCase()) || null;
235
235
  }
236
236
  } catch {
237
237
  }
238
- const N = ((S = D.match(/[a-zA-Z0-9_.]+$/)) == null ? void 0 : S[0]) || "", Y = ((p = T.match(/^[a-zA-Z0-9_.]+/)) == null ? void 0 : p[0]) || "", E = d ? (N + Y).toLowerCase() : e.toLocaleLowerCase(), I = d && T.slice(Y.length).trimStart().startsWith("(");
239
- let $ = [], P = !1;
240
- if (d)
238
+ const S = ((C = D.match(/[a-zA-Z0-9_.]+$/)) == null ? void 0 : C[0]) || "", $ = ((p = E.match(/^[a-zA-Z0-9_.]+/)) == null ? void 0 : p[0]) || "", N = g ? (S + $).toLowerCase() : e.toLocaleLowerCase(), M = g && E.slice($.length).trimStart().startsWith("(");
239
+ let P = [], X = !1;
240
+ if (g)
241
241
  try {
242
242
  const l = new qe(e.slice(1));
243
243
  l.tokenize();
244
- let g = 1;
244
+ let u = 1;
245
245
  for (const v of l.tokens) {
246
246
  const x = v.length();
247
- if (n > g && n < g + x) {
248
- ["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (P = !0), v.type === "VALUE" && typeof v.entity == "string" && (P = !0);
247
+ if (n > u && n < u + x) {
248
+ ["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (X = !0), v.type === "VALUE" && typeof v.entity == "string" && (X = !0);
249
249
  break;
250
250
  }
251
- (n === g || n === g + x) && ["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (P = !0), g += x;
251
+ (n === u || n === u + x) && ["REF", "RANGE", "ID", "ID_RANGE", "UNREFERENCED"].includes(v.type) && (X = !0), u += x;
252
252
  }
253
253
  } catch {
254
254
  }
255
- return d && !P ? E.length > 0 && !I && ($ = $t(s).map((l) => {
256
- const g = l.name.toLowerCase(), v = g.startsWith(E), x = v ? 0 : -1, A = l.defs.length === 0;
255
+ return g && !X ? N.length > 0 && !M && (P = $t(s).map((l) => {
256
+ const u = l.name.toLowerCase(), v = u.startsWith(N), x = v ? 0 : -1, T = l.defs.length === 0;
257
257
  return {
258
- option: { ...l, value: l.name + (A ? "()" : "("), isFunction: !0, label: l.name },
258
+ option: { ...l, value: l.name + (T ? "()" : "("), isFunction: !0, label: l.name },
259
259
  index: x,
260
260
  startsWith: v,
261
261
  keywordCount: 1,
262
- keyword: g
262
+ keyword: u
263
263
  };
264
- }).filter(({ startsWith: l }) => l).sort((l, g) => l.startsWith !== g.startsWith ? g.startsWith ? 1 : -1 : l.index !== g.index ? l.index - g.index : l.keyword.localeCompare(g.keyword)).map(({ option: l }) => l)) : $ = t.map((l) => {
265
- const g = l.keywords ?? [String(l.value)];
264
+ }).filter(({ startsWith: l }) => l).sort((l, u) => l.startsWith !== u.startsWith ? u.startsWith ? 1 : -1 : l.index !== u.index ? l.index - u.index : l.keyword.localeCompare(u.keyword)).map(({ option: l }) => l)) : P = t.map((l) => {
265
+ const u = l.keywords ?? [String(l.value)];
266
266
  let v = { index: -1, startsWith: !1, keyword: "" };
267
- for (const x of g) {
268
- const A = x.toLowerCase(), C = A.indexOf(E);
269
- if (C !== -1) {
270
- const L = A.startsWith(E);
271
- (v.index === -1 || C < v.index || C === v.index && L && !v.startsWith) && (v = { index: C, startsWith: L, keyword: x });
267
+ for (const x of u) {
268
+ const T = x.toLowerCase(), R = T.indexOf(N);
269
+ if (R !== -1) {
270
+ const B = T.startsWith(N);
271
+ (v.index === -1 || R < v.index || R === v.index && B && !v.startsWith) && (v = { index: R, startsWith: B, keyword: x });
272
272
  }
273
273
  }
274
274
  return {
275
275
  option: l,
276
276
  ...v,
277
- keywordCount: g.length
277
+ keywordCount: u.length
278
278
  };
279
- }).filter(({ index: l }) => l !== -1).sort((l, g) => l.startsWith !== g.startsWith ? g.startsWith ? 1 : -1 : l.index !== g.index ? l.index - g.index : l.keywordCount !== g.keywordCount ? g.keywordCount - l.keywordCount : l.keyword.localeCompare(g.keyword)).map(({ option: l }) => l), {
280
- filteredOptions: $,
279
+ }).filter(({ index: l }) => l !== -1).sort((l, u) => l.startsWith !== u.startsWith ? u.startsWith ? 1 : -1 : l.index !== u.index ? l.index - u.index : l.keywordCount !== u.keywordCount ? u.keywordCount - l.keywordCount : l.keyword.localeCompare(u.keyword)).map(({ option: l }) => l), {
280
+ filteredOptions: P,
281
281
  matchParams: {
282
- isFormula: d,
283
- currentWord: E,
284
- matchLengthBefore: N.length,
285
- matchLengthAfter: Y.length
282
+ isFormula: g,
283
+ currentWord: N,
284
+ matchLengthBefore: S.length,
285
+ matchLengthAfter: $.length
286
286
  },
287
287
  activeFunctionHelp: m,
288
288
  activeArgIndex: y
@@ -291,29 +291,29 @@ const le = on(
291
291
  Ye(() => {
292
292
  r >= i.length && o(0);
293
293
  }, [i.length, r]);
294
- const u = M(
295
- (d) => {
296
- if (!d)
294
+ const d = A(
295
+ (g) => {
296
+ if (!g)
297
297
  return { value: e, selectionStart: n };
298
298
  if (h.isFormula) {
299
299
  const m = e.slice(0, n - h.matchLengthBefore), y = e.slice(n + h.matchLengthAfter);
300
- return { value: m + d.value + y, selectionStart: m.length + d.value.length };
300
+ return { value: m + g.value + y, selectionStart: m.length + g.value.length };
301
301
  } else
302
- return { value: String(d.value), selectionStart: String(d.value).length };
302
+ return { value: String(g.value), selectionStart: String(g.value).length };
303
303
  },
304
304
  [e, n, h]
305
- ), w = M(
306
- (d) => i.length > 1 ? (o((m) => m <= 0 ? i.length - 1 : m - 1), d.preventDefault(), !0) : !1,
305
+ ), w = A(
306
+ (g) => i.length > 1 ? (o((m) => m <= 0 ? i.length - 1 : m - 1), g.preventDefault(), !0) : !1,
307
307
  [i.length]
308
- ), b = M(
309
- (d) => i.length > 1 ? (o((m) => m >= i.length - 1 ? 0 : m + 1), d.preventDefault(), !0) : !1,
308
+ ), b = A(
309
+ (g) => i.length > 1 ? (o((m) => m >= i.length - 1 ? 0 : m + 1), g.preventDefault(), !0) : !1,
310
310
  [i.length]
311
311
  );
312
312
  return {
313
313
  filteredOptions: i,
314
314
  selected: r,
315
315
  setSelected: o,
316
- replaceWithOption: u,
316
+ replaceWithOption: d,
317
317
  handleArrowUp: w,
318
318
  handleArrowDown: b,
319
319
  isFormula: h.isFormula,
@@ -329,40 +329,40 @@ const le = on(
329
329
  }, Cn = (e, n = !1) => {
330
330
  const s = new DOMParser().parseFromString(e, "text/html"), r = [], o = (f) => {
331
331
  var w, b;
332
- const a = /* @__PURE__ */ new Set(), u = f.querySelectorAll("tr,caption");
333
- for (let d = 0; d < u.length; d++) {
334
- const m = u[d];
332
+ const a = /* @__PURE__ */ new Set(), d = f.querySelectorAll("tr,caption");
333
+ for (let g = 0; g < d.length; g++) {
334
+ const m = d[g];
335
335
  if (m.tagName === "CAPTION") {
336
- const N = ((w = m.textContent) == null ? void 0 : w.trim()) ?? "";
337
- N && r.push([{ value: N }]);
336
+ const S = ((w = m.textContent) == null ? void 0 : w.trim()) ?? "";
337
+ S && r.push([{ value: S }]);
338
338
  continue;
339
339
  }
340
340
  const y = Array.from(m.querySelectorAll("td, th")), D = [];
341
- let T = 0;
342
- for (const N of y) {
343
- const Y = ((b = N.textContent) == null ? void 0 : b.trim()) ?? "", E = n ? void 0 : (() => {
344
- const P = jt(N.firstElementChild);
345
- return { ...jt(N), ...P };
341
+ let E = 0;
342
+ for (const S of y) {
343
+ const $ = ((b = S.textContent) == null ? void 0 : b.trim()) ?? "", N = n ? void 0 : (() => {
344
+ const X = jt(S.firstElementChild);
345
+ return { ...jt(S), ...X };
346
346
  })();
347
- for (; a.has(`${d}-${++T}`); )
348
- D.push({ value: "", style: E, skip: !0 });
349
- D.push({ value: Y, style: E });
350
- const I = parseInt(N.getAttribute("rowspan") ?? "1", 10), $ = parseInt(N.getAttribute("colspan") ?? "1", 10);
351
- for (let P = 0; P < I; P++)
352
- for (let S = 0; S < $; S++)
353
- a.add(`${d + P}-${T + S}`);
347
+ for (; a.has(`${g}-${++E}`); )
348
+ D.push({ value: "", style: N, skip: !0 });
349
+ D.push({ value: $, style: N });
350
+ const M = parseInt(S.getAttribute("rowspan") ?? "1", 10), P = parseInt(S.getAttribute("colspan") ?? "1", 10);
351
+ for (let X = 0; X < M; X++)
352
+ for (let C = 0; C < P; C++)
353
+ a.add(`${g + X}-${E + C}`);
354
354
  }
355
355
  r.push(D);
356
356
  }
357
357
  }, i = (f, a = []) => {
358
358
  if (f.nodeType === Node.ELEMENT_NODE) {
359
- const u = f, w = u.tagName;
360
- w === "TABLE" ? (a.length > 0 && (r.push(a.slice()), a.length = 0), o(u)) : w === "BR" ? (r.push(a.slice()), a.length = 0) : ks.has(w) ? (a.length > 0 && (r.push(a.slice()), a.length = 0), u.childNodes.forEach((b) => i(b, a)), a.length > 0 && (r.push(a.slice()), a.length = 0)) : u.childNodes.forEach((b) => i(b, a));
359
+ const d = f, w = d.tagName;
360
+ w === "TABLE" ? (a.length > 0 && (r.push(a.slice()), a.length = 0), o(d)) : w === "BR" ? (r.push(a.slice()), a.length = 0) : ks.has(w) ? (a.length > 0 && (r.push(a.slice()), a.length = 0), d.childNodes.forEach((b) => i(b, a)), a.length > 0 && (r.push(a.slice()), a.length = 0)) : d.childNodes.forEach((b) => i(b, a));
361
361
  } else if (f.nodeType === Node.TEXT_NODE) {
362
362
  const w = (f.textContent ?? "").split(/\r?\n/);
363
363
  for (const b of w) {
364
- const d = b.trim();
365
- d && a.push({ value: d });
364
+ const g = b.trim();
365
+ g && a.push({ value: g });
366
366
  }
367
367
  }
368
368
  }, h = [];
@@ -480,157 +480,157 @@ const Sn = (e, n = " ") => {
480
480
  "UL"
481
481
  ]), Ts = ({ mode: e }) => {
482
482
  var It, Ft;
483
- const { store: n, dispatch: t } = ie(le), [s, r] = J(!1), [o, i] = J(0), [h, f] = J(!1), {
483
+ const { store: n, dispatch: t } = le(ae), [s, r] = te(!1), [o, i] = te(0), [h, f] = te(!1), {
484
484
  choosing: a,
485
- inputting: u,
485
+ inputting: d,
486
486
  selectingZone: w,
487
487
  editorRect: b,
488
- editingAddress: d,
488
+ editingAddress: g,
489
489
  entering: m,
490
490
  matchingCells: y,
491
491
  matchingCellIndex: D,
492
- searchQuery: T,
493
- editorRef: N,
494
- largeEditorRef: Y,
495
- searchInputRef: E,
496
- editingOnEnter: I,
497
- sheetReactive: $,
498
- sheetId: P,
499
- dragging: S
500
- } = n, p = $.current, l = () => {
501
- var ce;
502
- if (!h || !X || typeof document > "u" || N.current !== document.activeElement)
492
+ searchQuery: E,
493
+ editorRef: S,
494
+ largeEditorRef: $,
495
+ searchInputRef: N,
496
+ editingOnEnter: M,
497
+ sheetReactive: P,
498
+ sheetId: X,
499
+ dragging: C
500
+ } = n, p = P.current, l = () => {
501
+ var ue;
502
+ if (!h || !O || typeof document > "u" || S.current !== document.activeElement)
503
503
  return null;
504
- const k = (ce = N.current) == null ? void 0 : ce.getBoundingClientRect();
504
+ const k = (ue = S.current) == null ? void 0 : ue.getBoundingClientRect();
505
505
  if (!k)
506
506
  return null;
507
- const { bottom: j, left: se } = k;
507
+ const { bottom: j, left: re } = k;
508
508
  return Ct(
509
509
  /* @__PURE__ */ F(we, { children: [
510
- ae && A.length === 0 && (!w || w.endY === -1 && w.endX === -1) && /* @__PURE__ */ c(
510
+ ce && T.length === 0 && (!w || w.endY === -1 && w.endX === -1) && /* @__PURE__ */ c(
511
511
  St,
512
512
  {
513
- activeFunctionGuide: ae,
514
- activeArgIndex: B,
513
+ activeFunctionGuide: ce,
514
+ activeArgIndex: K,
515
515
  top: j,
516
- left: se
516
+ left: re
517
517
  }
518
518
  ),
519
- A.length > 0 && /* @__PURE__ */ c(
519
+ T.length > 0 && /* @__PURE__ */ c(
520
520
  wn,
521
521
  {
522
- filteredOptions: A,
522
+ filteredOptions: T,
523
523
  top: j,
524
- left: se,
525
- selected: C,
524
+ left: re,
525
+ selected: R,
526
526
  onOptionMouseDown: jn
527
527
  }
528
528
  )
529
529
  ] }),
530
530
  document.body
531
531
  );
532
- }, g = p == null ? void 0 : p.getPolicy(a), v = (g == null ? void 0 : g.getSelectOptions()) ?? [], x = M((k) => {
532
+ }, u = p == null ? void 0 : p.getPolicy(a), v = (u == null ? void 0 : u.getSelectOptions()) ?? [], x = A((k) => {
533
533
  i(k.currentTarget.selectionStart);
534
534
  }, []), {
535
- filteredOptions: A,
536
- selected: C,
537
- setSelected: L,
535
+ filteredOptions: T,
536
+ selected: R,
537
+ setSelected: B,
538
538
  replaceWithOption: q,
539
- handleArrowUp: W,
540
- handleArrowDown: ne,
541
- activeFunctionHelp: ae,
542
- activeArgIndex: B
539
+ handleArrowUp: _,
540
+ handleArrowDown: se,
541
+ activeFunctionHelp: ce,
542
+ activeArgIndex: K
543
543
  } = Rn({
544
- inputting: u,
544
+ inputting: d,
545
545
  selectionStart: o,
546
546
  optionsAll: v,
547
547
  functions: p == null ? void 0 : p.registry.functions
548
548
  });
549
- Z(() => {
550
- H(N == null ? void 0 : N.current);
551
- }, [N]), Z(() => {
552
- p && p.registry.lastFocused != null && p.registry.lastFocused === N.current && p.registry.lastFocused === Y.current && t(ue(""));
553
- }, [p == null ? void 0 : p.registry.lastFocused, p, N, Y, t]), Z(() => {
554
- p && (p.registry.editingSheetId = P, p.registry.editingAddress = d);
555
- }, [d, p, P]), Z(() => {
556
- Gn(N.current);
557
- }, [u, d, N]);
558
- const { y: z, x: K } = a, G = `${ve(z)}`, U = `${me(K)}${G}`, X = d === U, Q = p == null ? void 0 : p.getCell({ y: z, x: K }, { resolution: "RAW" }), R = p ? p.getSerializedValue({ point: a, cell: Q, resolution: "RAW" }) : "", [_, ge] = J(R), ee = M(
549
+ W(() => {
550
+ L(S == null ? void 0 : S.current);
551
+ }, [S]), W(() => {
552
+ p && p.registry.lastFocused != null && p.registry.lastFocused === S.current && p.registry.lastFocused === $.current && t(de(""));
553
+ }, [p == null ? void 0 : p.registry.lastFocused, p, S, $, t]), W(() => {
554
+ p && (p.registry.editingSheetId = X, p.registry.editingAddress = g);
555
+ }, [g, p, X]), W(() => {
556
+ Gn(S.current);
557
+ }, [d, g, S]);
558
+ const { y: Z, x: U } = a, G = `${ve(Z)}`, z = `${me(U)}${G}`, O = g === z, Q = p == null ? void 0 : p.getCell({ y: Z, x: U }, { resolution: "RAW" }), Y = p ? p.getSerializedValue({ point: a, cell: Q, resolution: "RAW" }) : "", [I, ee] = te(Y), J = A(
559
559
  (k) => {
560
- _ !== k && t(Ze({ value: k })), ge(k);
560
+ I !== k && t(Ze({ value: k })), ee(k);
561
561
  },
562
- [_, t]
563
- ), pe = M(
562
+ [I, t]
563
+ ), pe = A(
564
564
  (k) => {
565
565
  if (!p)
566
566
  return;
567
- const j = A[k];
567
+ const j = T[k];
568
568
  if (j) {
569
569
  if (j.isFunction) {
570
- const { value: se, selectionStart: ce } = q(j);
571
- t(re(se)), setTimeout(() => {
572
- N.current && (H(N.current), N.current.setSelectionRange(ce, ce));
570
+ const { value: re, selectionStart: ue } = q(j);
571
+ t(oe(re)), setTimeout(() => {
572
+ S.current && (L(S.current), S.current.setSelectionRange(ue, ue));
573
573
  }, 0);
574
574
  } else {
575
- const se = p.update({
576
- diff: { [U]: { value: j.value } },
575
+ const re = p.update({
576
+ diff: { [z]: { value: j.value } },
577
577
  partial: !0
578
578
  });
579
- t(Ue(se.clone())), t(ue("")), t(re(""));
579
+ t(Ue(re.clone())), t(de("")), t(oe(""));
580
580
  }
581
- L(0);
581
+ B(0);
582
582
  }
583
583
  },
584
- [A, p, U, u, ee, t, N]
584
+ [T, p, z, d, J, t, S]
585
585
  );
586
- Z(() => {
587
- p && (ge(R), t(re(R)), Qn(N.current, p, a));
588
- }, [a, R, t, N, p]);
589
- const { y: Ee, x: We, height: Tt, width: At } = b, Ln = R.split(`
590
- `).length, [Mt, Dt] = J(!1), Bn = M(
586
+ W(() => {
587
+ p && (ee(Y), t(oe(Y)), Qn(S.current, p, a));
588
+ }, [a, Y, t, S, p]);
589
+ const { y: xe, x: ze, height: Tt, width: At } = b, Ln = Y.split(`
590
+ `).length, [Mt, Dt] = te(!1), Bn = A(
591
591
  (k) => {
592
- var ce, Oe, Ae, He, Le, Yt;
592
+ var ue, Oe, Ae, He, Le, Yt;
593
593
  if (!p || Mt)
594
594
  return;
595
595
  k.key === "Meta" || k.key === "Control" || (Dt(!0), requestAnimationFrame(() => {
596
596
  Dt(!1);
597
597
  }));
598
598
  const j = k.currentTarget;
599
- if (en(k, u))
600
- return t(re(j.value)), !1;
601
- const se = k.shiftKey;
599
+ if (en(k, d))
600
+ return t(oe(j.value)), !1;
601
+ const re = k.shiftKey;
602
602
  switch (k.key) {
603
603
  case "Tab":
604
- if (k.preventDefault(), X)
605
- if (A.length) {
606
- const ye = (ce = A[C]) == null ? void 0 : ce.isFunction;
607
- if (pe(C), ye)
604
+ if (k.preventDefault(), O)
605
+ if (T.length) {
606
+ const ye = (ue = T[R]) == null ? void 0 : ue.isFunction;
607
+ if (pe(R), ye)
608
608
  return !1;
609
609
  } else
610
- ee(j.value), t(ue("")), t(re(""));
610
+ J(j.value), t(de("")), t(oe(""));
611
611
  return t(
612
612
  ut({
613
613
  numRows: p.numRows,
614
614
  numCols: p.numCols,
615
615
  deltaY: 0,
616
- deltaX: se ? -1 : 1
616
+ deltaX: re ? -1 : 1
617
617
  })
618
- ), t(ue("")), !1;
618
+ ), t(de("")), !1;
619
619
  case "Enter":
620
- if (X)
621
- if (A.length) {
622
- const ye = (Oe = A[C]) == null ? void 0 : Oe.isFunction;
623
- if (pe(C), ye)
620
+ if (O)
621
+ if (T.length) {
622
+ const ye = (Oe = T[R]) == null ? void 0 : Oe.isFunction;
623
+ if (pe(R), ye)
624
624
  return k.preventDefault(), !1;
625
625
  } else {
626
626
  if (k.altKey)
627
627
  return tn(j, `
628
- `), t(re(j.value)), k.preventDefault(), !1;
628
+ `), t(oe(j.value)), k.preventDefault(), !1;
629
629
  if (k.nativeEvent.isComposing)
630
630
  return !1;
631
- ee(j.value), t(ue("")), t(re(""));
631
+ J(j.value), t(de("")), t(oe(""));
632
632
  }
633
- else if (I && w.endY === -1) {
633
+ else if (M && w.endY === -1) {
634
634
  const ye = document.createEvent("MouseEvents");
635
635
  return ye.initEvent("dblclick", !0, !0), j.dispatchEvent(ye), k.preventDefault(), !1;
636
636
  }
@@ -638,17 +638,17 @@ const Sn = (e, n = " ") => {
638
638
  ut({
639
639
  numRows: p.numRows,
640
640
  numCols: p.numCols,
641
- deltaY: se ? -1 : 1,
641
+ deltaY: re ? -1 : 1,
642
642
  deltaX: 0
643
643
  })
644
644
  ), k.preventDefault(), !1;
645
645
  case "Backspace":
646
- if (!X)
647
- return ((Ae = p.getSystem({ y: z, x: K })) == null ? void 0 : Ae.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(re("")), !1);
646
+ if (!O)
647
+ return ((Ae = p.getSystem({ y: Z, x: U })) == null ? void 0 : Ae.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
648
648
  break;
649
649
  case "Delete":
650
- if (!X)
651
- return ((He = p.getSystem({ y: z, x: K })) == null ? void 0 : He.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(re("")), !1);
650
+ if (!O)
651
+ return ((He = p.getSystem({ y: Z, x: U })) == null ? void 0 : He.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
652
652
  break;
653
653
  case "Shift":
654
654
  return r(!0), !1;
@@ -661,12 +661,12 @@ const Sn = (e, n = " ") => {
661
661
  case "NumLock":
662
662
  return !1;
663
663
  case "Escape":
664
- return t(bs(null)), t($e(void 0)), t(re(_)), !1;
664
+ return t(bs(null)), t($e(void 0)), t(oe(I)), !1;
665
665
  case "ArrowLeft":
666
- if (!X)
666
+ if (!O)
667
667
  return t(
668
668
  _e({
669
- shiftKey: se,
669
+ shiftKey: re,
670
670
  numRows: p.numRows,
671
671
  numCols: p.numCols,
672
672
  deltaY: 0,
@@ -675,24 +675,24 @@ const Sn = (e, n = " ") => {
675
675
  ), !1;
676
676
  break;
677
677
  case "ArrowUp":
678
- if (!X)
678
+ if (!O)
679
679
  return t(
680
680
  _e({
681
- shiftKey: se,
681
+ shiftKey: re,
682
682
  numRows: p.numRows,
683
683
  numCols: p.numCols,
684
684
  deltaY: -1,
685
685
  deltaX: 0
686
686
  })
687
687
  ), !1;
688
- if (W(k))
688
+ if (_(k))
689
689
  return !0;
690
690
  break;
691
691
  case "ArrowRight":
692
- if (!X)
692
+ if (!O)
693
693
  return t(
694
694
  _e({
695
- shiftKey: se,
695
+ shiftKey: re,
696
696
  numRows: p.numRows,
697
697
  numCols: p.numCols,
698
698
  deltaY: 0,
@@ -701,21 +701,21 @@ const Sn = (e, n = " ") => {
701
701
  ), !1;
702
702
  break;
703
703
  case "ArrowDown":
704
- if (!X)
704
+ if (!O)
705
705
  return t(
706
706
  _e({
707
- shiftKey: se,
707
+ shiftKey: re,
708
708
  numRows: p.numRows,
709
709
  numCols: p.numCols,
710
710
  deltaY: 1,
711
711
  deltaX: 0
712
712
  })
713
713
  ), !1;
714
- if (ne(k))
714
+ if (se(k))
715
715
  return !0;
716
716
  break;
717
717
  case "a":
718
- if ((k.ctrlKey || k.metaKey) && !X)
718
+ if ((k.ctrlKey || k.metaKey) && !O)
719
719
  return k.preventDefault(), t(
720
720
  be({
721
721
  startY: 1,
@@ -727,26 +727,26 @@ const Sn = (e, n = " ") => {
727
727
  break;
728
728
  case "c":
729
729
  if (k.ctrlKey || k.metaKey) {
730
- if (!X) {
730
+ if (!O) {
731
731
  k.preventDefault();
732
732
  const ye = et(n);
733
- return t(dn(Ge(ye))), H(j), !1;
733
+ return t(dn(Ge(ye))), L(j), !1;
734
734
  }
735
735
  return !0;
736
736
  }
737
737
  break;
738
738
  case "f":
739
- if ((k.ctrlKey || k.metaKey) && !X)
740
- return k.preventDefault(), typeof T > "u" && t($e("")), t(un(!1)), requestAnimationFrame(() => H(E.current)), !1;
739
+ if ((k.ctrlKey || k.metaKey) && !O)
740
+ return k.preventDefault(), typeof E > "u" && t($e("")), t(un(!1)), requestAnimationFrame(() => L(N.current)), !1;
741
741
  break;
742
742
  case "r":
743
743
  // R
744
744
  case "y":
745
- if ((k.ctrlKey || k.metaKey) && !X)
746
- return k.preventDefault(), t(ct(null)), requestAnimationFrame(() => t(re(""))), !1;
745
+ if ((k.ctrlKey || k.metaKey) && !O)
746
+ return k.preventDefault(), t(ct(null)), requestAnimationFrame(() => t(oe(""))), !1;
747
747
  break;
748
748
  case "s":
749
- if ((k.ctrlKey || k.metaKey) && !X)
749
+ if ((k.ctrlKey || k.metaKey) && !O)
750
750
  return k.preventDefault(), (Yt = (Le = p.registry).onSave) == null || Yt.call(Le, {
751
751
  sheet: p,
752
752
  points: {
@@ -767,91 +767,91 @@ const Sn = (e, n = " ") => {
767
767
  return k.stopPropagation(), !1;
768
768
  break;
769
769
  case "x":
770
- if ((k.ctrlKey || k.metaKey) && !X) {
770
+ if ((k.ctrlKey || k.metaKey) && !O) {
771
771
  k.preventDefault();
772
772
  const ye = et(n);
773
- return t(cn(Ge(ye))), H(j), !1;
773
+ return t(cn(Ge(ye))), L(j), !1;
774
774
  }
775
775
  break;
776
776
  case "z":
777
- if ((k.ctrlKey || k.metaKey) && !X)
777
+ if ((k.ctrlKey || k.metaKey) && !O)
778
778
  return k.preventDefault(), k.shiftKey ? t(ct(null)) : t(an(null)), !1;
779
779
  break;
780
780
  case ";":
781
- (k.ctrlKey || k.metaKey) && (X || (k.preventDefault(), ee((/* @__PURE__ */ new Date()).toDateString())));
781
+ (k.ctrlKey || k.metaKey) && (O || (k.preventDefault(), J((/* @__PURE__ */ new Date()).toDateString())));
782
782
  break;
783
783
  }
784
- return k.ctrlKey || k.metaKey ? !1 : O.hasOperation(Q == null ? void 0 : Q.prevention, O.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(ue(U)), X || t(re("")), L(0), !1);
784
+ return k.ctrlKey || k.metaKey ? !1 : H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(de(z)), O || t(oe("")), B(0), !1);
785
785
  },
786
786
  [
787
787
  Mt,
788
- X,
789
- A,
790
- C,
791
- I,
788
+ O,
789
+ T,
790
+ R,
791
+ M,
792
792
  w,
793
- _,
793
+ I,
794
794
  p,
795
795
  a,
796
796
  n,
797
797
  Q,
798
- U,
799
- ee,
800
- T,
801
- u
798
+ z,
799
+ J,
800
+ E,
801
+ d
802
802
  ]
803
- ), Kn = M(
803
+ ), Kn = A(
804
804
  (k) => {
805
805
  f(!0), p && (p.registry.lastFocused = k.currentTarget);
806
806
  },
807
807
  [p]
808
- ), Zn = M(
808
+ ), Zn = A(
809
809
  (k) => {
810
- if (O.hasOperation(Q == null ? void 0 : Q.prevention, O.Write)) {
810
+ if (H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write)) {
811
811
  console.warn("This cell is protected from writing.");
812
812
  return;
813
813
  }
814
814
  const j = k.currentTarget;
815
- X || (t(re(R)), t(ue(U)), requestAnimationFrame(() => {
815
+ O || (t(oe(Y)), t(de(z)), requestAnimationFrame(() => {
816
816
  j.style.width = `${j.scrollWidth}px`, j.style.height = `${j.scrollHeight}px`;
817
- const se = new String(R).length;
818
- j.setSelectionRange(se, se);
817
+ const re = new String(Y).length;
818
+ j.setSelectionRange(re, re);
819
819
  }));
820
820
  },
821
- [Q, X, R, U]
822
- ), Un = M(
821
+ [Q, O, Y, z]
822
+ ), Un = A(
823
823
  (k) => {
824
824
  if (f(!1), nn(k.currentTarget))
825
825
  return !0;
826
- X && ee(k.currentTarget.value), t(ue(""));
826
+ O && J(k.currentTarget.value), t(de(""));
827
827
  },
828
- [X, ee, t]
829
- ), zn = M(
828
+ [O, J, t]
829
+ ), Wn = A(
830
830
  (k) => {
831
- O.hasOperation(Q == null ? void 0 : Q.prevention, O.Write) || (t(re(k.currentTarget.value)), i(k.currentTarget.selectionStart), L(0));
831
+ H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) || (t(oe(k.currentTarget.value)), i(k.currentTarget.selectionStart), B(0));
832
832
  },
833
833
  [Q]
834
- ), Wn = M(
834
+ ), zn = A(
835
835
  (k) => {
836
- var ce, Oe, Ae, He;
837
- if (X)
836
+ var ue, Oe, Ae, He;
837
+ if (O)
838
838
  return !0;
839
- const j = s, se = (Oe = (ce = k.clipboardData) == null ? void 0 : ce.getData) == null ? void 0 : Oe.call(ce, "text/html");
840
- if (se)
841
- t(dt({ matrix: Cn(se), onlyValue: j }));
839
+ const j = s, re = (Oe = (ue = k.clipboardData) == null ? void 0 : ue.getData) == null ? void 0 : Oe.call(ue, "text/html");
840
+ if (re)
841
+ t(dt({ matrix: Cn(re), onlyValue: j }));
842
842
  else {
843
843
  const Le = (He = (Ae = k.clipboardData) == null ? void 0 : Ae.getData) == null ? void 0 : He.call(Ae, "text/plain");
844
844
  Le ? t(dt({ matrix: Sn(Le), onlyValue: j })) : console.warn("No clipboard data found.");
845
845
  }
846
846
  return k.preventDefault(), k.stopPropagation(), !1;
847
847
  },
848
- [X, s]
849
- ), _n = M(
848
+ [O, s]
849
+ ), _n = A(
850
850
  (k) => {
851
- var se, ce;
851
+ var re, ue;
852
852
  r(!1);
853
- const j = de(n.selectingZone);
854
- (ce = p == null ? void 0 : (se = p.registry).onKeyUp) == null || ce.call(se, {
853
+ const j = ge(n.selectingZone);
854
+ (ue = p == null ? void 0 : (re = p.registry).onKeyUp) == null || ue.call(re, {
855
855
  e: k,
856
856
  points: {
857
857
  pointing: a,
@@ -861,19 +861,19 @@ const Sn = (e, n = " ") => {
861
861
  });
862
862
  },
863
863
  [n.selectingZone, a, p]
864
- ), jn = M(
864
+ ), jn = A(
865
865
  (k, j) => (pe(j), k.preventDefault(), k.stopPropagation(), !1),
866
866
  [pe]
867
867
  );
868
868
  return p ? /* @__PURE__ */ F(
869
869
  st,
870
870
  {
871
- className: `gs-editor ${X ? "gs-editing" : ""}`,
872
- style: X ? { top: Ee, left: We, height: Tt } : {},
871
+ className: `gs-editor ${O ? "gs-editing" : ""}`,
872
+ style: O ? { top: xe, left: ze, height: Tt } : {},
873
873
  "data-mode": e,
874
- "data-sheet-id": P,
874
+ "data-sheet-id": X,
875
875
  children: [
876
- /* @__PURE__ */ c("div", { className: `gs-cell-label ${X ? " gs-hidden" : ""}`, children: U }),
876
+ /* @__PURE__ */ c("div", { className: `gs-cell-label ${O ? " gs-hidden" : ""}`, children: z }),
877
877
  /* @__PURE__ */ F("div", { className: "gs-editor-inner", style: { width: At }, children: [
878
878
  /* @__PURE__ */ c(
879
879
  "pre",
@@ -881,31 +881,31 @@ const Sn = (e, n = " ") => {
881
881
  className: "gs-editor-hl",
882
882
  style: {
883
883
  //...cell?.style,
884
- height: (It = N.current) == null ? void 0 : It.scrollHeight,
885
- width: (((Ft = N.current) == null ? void 0 : Ft.scrollWidth) ?? 0) - 4
884
+ height: (It = S.current) == null ? void 0 : It.scrollHeight,
885
+ width: (((Ft = S.current) == null ? void 0 : Ft.scrollWidth) ?? 0) - 4
886
886
  },
887
- children: (Q == null ? void 0 : Q.formulaEnabled) ?? !0 ? Nn(u) : u
887
+ children: (Q == null ? void 0 : Q.formulaEnabled) ?? !0 ? Nn(d) : d
888
888
  }
889
889
  ),
890
890
  /* @__PURE__ */ c(
891
891
  "textarea",
892
892
  {
893
- "data-sheet-id": P,
893
+ "data-sheet-id": X,
894
894
  name: "gs-editor-input",
895
895
  "data-size": "small",
896
896
  autoFocus: !0,
897
897
  spellCheck: !1,
898
898
  draggable: !1,
899
- ref: N,
899
+ ref: S,
900
900
  rows: Ln,
901
901
  onFocus: Kn,
902
902
  style: { minWidth: At, minHeight: Tt },
903
903
  onDoubleClick: Zn,
904
904
  onBlur: Un,
905
- value: u,
906
- onChange: zn,
905
+ value: d,
906
+ onChange: Wn,
907
907
  onSelect: x,
908
- onPaste: Wn,
908
+ onPaste: zn,
909
909
  onKeyDown: Bn,
910
910
  onKeyUp: _n,
911
911
  onMouseEnter: () => {
@@ -949,13 +949,13 @@ const Sn = (e, n = " ") => {
949
949
  },
950
950
  h
951
951
  );
952
- const u = De[t % De.length];
952
+ const d = De[t % De.length];
953
953
  return s[f] = t++, /* @__PURE__ */ c(
954
954
  ot,
955
955
  {
956
956
  token: o,
957
957
  tokenKey: h,
958
- color: u,
958
+ color: d,
959
959
  className: `gs-token-type-${o.type}`
960
960
  },
961
961
  h
@@ -972,9 +972,9 @@ const Sn = (e, n = " ") => {
972
972
  );
973
973
  })
974
974
  ] });
975
- }, En = on({});
975
+ }, xn = on({});
976
976
  function Cr() {
977
- const [e, n] = J(void 0), [t, s] = J();
977
+ const [e, n] = te(void 0), [t, s] = te();
978
978
  return {
979
979
  provided: !0,
980
980
  store: e,
@@ -983,13 +983,13 @@ function Cr() {
983
983
  setApply: s
984
984
  };
985
985
  }
986
- function xn() {
987
- const e = ie(En);
986
+ function En() {
987
+ const e = le(xn);
988
988
  return (e == null ? void 0 : e.provided) == null ? [!1, e] : [!0, e];
989
989
  }
990
990
  function Sr({ children: e, context: n }) {
991
- const [t] = xn();
992
- return t ? /* @__PURE__ */ c(we, { children: e }) : /* @__PURE__ */ c(En.Provider, { value: n, children: e });
991
+ const [t] = En();
992
+ return t ? /* @__PURE__ */ c(we, { children: e }) : /* @__PURE__ */ c(xn.Provider, { value: n, children: e });
993
993
  }
994
994
  const As = ({
995
995
  sheetName: e,
@@ -1000,15 +1000,15 @@ const As = ({
1000
1000
  editingOnEnter: o,
1001
1001
  mode: i
1002
1002
  }) => {
1003
- const { store: h, dispatch: f } = ie(le), { sheetReactive: a } = h, u = a.current;
1004
- Z(() => {
1005
- u && e && e !== u.name && (u.name = e, u.registry.sheetIdsByName[e] = u.id, delete u.registry.sheetIdsByName[u.prevName], u.prevName = e);
1006
- }, [e]), Z(() => {
1007
- if (!u)
1003
+ const { store: h, dispatch: f } = le(ae), { sheetReactive: a } = h, d = a.current;
1004
+ W(() => {
1005
+ d && e && e !== d.name && (d.name = e, d.registry.sheetIdsByName[e] = d.id, delete d.registry.sheetIdsByName[d.prevName], d.prevName = e);
1006
+ }, [e]), W(() => {
1007
+ if (!d)
1008
1008
  return;
1009
- const { registry: d } = u;
1010
- requestAnimationFrame(() => d.boot()), d.contextsBySheetId[u.id] = { store: h, dispatch: f }, d.transmit(), s && (s.current = {
1011
- sheet: u,
1009
+ const { registry: g } = d;
1010
+ requestAnimationFrame(() => g.boot()), g.contextsBySheetId[d.id] = { store: h, dispatch: f }, g.transmit(), s && (s.current = {
1011
+ sheet: d,
1012
1012
  apply: (m) => {
1013
1013
  f(Ue(m));
1014
1014
  }
@@ -1019,21 +1019,21 @@ const As = ({
1019
1019
  },
1020
1020
  dispatch: f
1021
1021
  });
1022
- }, [h, u, s, r]), Z(() => {
1022
+ }, [h, d, s, r]), W(() => {
1023
1023
  n && f(Se({ sheetHeight: n }));
1024
- }, [n, f]), Z(() => {
1024
+ }, [n, f]), W(() => {
1025
1025
  t && f(Se({ sheetWidth: t }));
1026
- }, [t]), Z(() => {
1026
+ }, [t]), W(() => {
1027
1027
  typeof o < "u" && f(Se({ editingOnEnter: o }));
1028
- }, [o]), Z(() => {
1028
+ }, [o]), W(() => {
1029
1029
  i && f(Se({ mode: i }));
1030
1030
  }, [i]);
1031
- const [w, b] = xn();
1032
- return Z(() => {
1031
+ const [w, b] = En();
1032
+ return W(() => {
1033
1033
  w && (b.setStore(h), b.setApply(() => f));
1034
1034
  }, [h, w, b]), /* @__PURE__ */ c(we, {});
1035
1035
  }, Ms = () => {
1036
- const { store: e, dispatch: n } = ie(le), {
1036
+ const { store: e, dispatch: n } = le(ae), {
1037
1037
  resizingPositionY: t,
1038
1038
  resizingPositionX: s,
1039
1039
  sheetReactive: r,
@@ -1042,65 +1042,65 @@ const As = ({
1042
1042
  selectingZone: h,
1043
1043
  editorRef: f,
1044
1044
  mainRef: a
1045
- } = e, u = r.current, [w, b, d] = t, [m, y, D] = s;
1046
- if (a.current == null || f.current == null || !u)
1045
+ } = e, d = r.current, [w, b, g] = t, [m, y, D] = s;
1046
+ if (a.current == null || f.current == null || !d)
1047
1047
  return /* @__PURE__ */ c("div", { className: "gs-resizing gs-hidden" });
1048
- const T = u.getCell({ y: w === -1 ? 0 : w, x: m === -1 ? 0 : m }, { resolution: "SYSTEM" }), { y: N, x: Y } = a.current.getBoundingClientRect(), E = (T == null ? void 0 : T.width) || yt, I = (T == null ? void 0 : T.height) || vt, $ = E + (D - y), P = I + (d - b);
1048
+ const E = d.getCell({ y: w === -1 ? 0 : w, x: m === -1 ? 0 : m }, { resolution: "SYSTEM" }), { y: S, x: $ } = a.current.getBoundingClientRect(), N = (E == null ? void 0 : E.width) || yt, M = (E == null ? void 0 : E.height) || vt, P = N + (D - y), X = M + (g - b);
1049
1049
  return /* @__PURE__ */ F(
1050
1050
  "div",
1051
1051
  {
1052
1052
  className: `gs-resizing ${w === -1 && m === -1 ? "gs-hidden" : ""}`,
1053
1053
  onMouseUp: () => {
1054
- const l = de(h), { top: g, left: v, bottom: x, right: A } = l, C = {};
1054
+ const l = ge(h), { top: u, left: v, bottom: x, right: T } = l, R = {};
1055
1055
  if (m !== -1) {
1056
- let L = [m];
1057
- i && Te({ start: v, end: A }, m) && (L = Pt(v, A + 1)), L.forEach((q) => {
1058
- C[Ne({ y: 0, x: q })] = { width: $ };
1056
+ let B = [m];
1057
+ i && Te({ start: v, end: T }, m) && (B = Pt(v, T + 1)), B.forEach((q) => {
1058
+ R[Ne({ y: 0, x: q })] = { width: P };
1059
1059
  });
1060
1060
  }
1061
1061
  if (w !== -1) {
1062
- let L = [w];
1063
- o && Te({ start: g, end: x }, w) && (L = Pt(g, x + 1)), L.forEach((q) => {
1064
- C[Ne({ y: q, x: 0 })] = { height: P };
1062
+ let B = [w];
1063
+ o && Te({ start: u, end: x }, w) && (B = Pt(u, x + 1)), B.forEach((q) => {
1064
+ R[Ne({ y: q, x: 0 })] = { height: X };
1065
1065
  });
1066
1066
  }
1067
- u.update({
1068
- diff: C,
1067
+ d.update({
1068
+ diff: R,
1069
1069
  partial: !0,
1070
1070
  operator: "USER",
1071
- undoReflection: { selectingZone: h, sheetId: u.id }
1071
+ undoReflection: { selectingZone: h, sheetId: d.id }
1072
1072
  }), n(
1073
1073
  Se({
1074
- sheetReactive: { current: u }
1074
+ sheetReactive: { current: d }
1075
1075
  })
1076
- ), n(gt([-1, -1, -1])), n(ht([-1, -1, -1])), H(f.current);
1076
+ ), n(gt([-1, -1, -1])), n(ht([-1, -1, -1])), L(f.current);
1077
1077
  },
1078
1078
  onMouseMove: (l) => {
1079
1079
  if (w !== -1) {
1080
- let g = l.clientY;
1081
- const v = I + (g - b);
1082
- v < Xt && (g += Xt - v), n(gt([w, b, g]));
1080
+ let u = l.clientY;
1081
+ const v = M + (u - b);
1082
+ v < Xt && (u += Xt - v), n(gt([w, b, u]));
1083
1083
  } else if (m !== -1) {
1084
- let g = l.clientX;
1085
- const v = E + (g - y);
1086
- v < Ot && (g += Ot - v), n(ht([m, y, g]));
1084
+ let u = l.clientX;
1085
+ const v = N + (u - y);
1086
+ v < Ot && (u += Ot - v), n(ht([m, y, u]));
1087
1087
  }
1088
1088
  },
1089
1089
  children: [
1090
- /* @__PURE__ */ c("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: 1, height: "100%", left: D - Y }, children: /* @__PURE__ */ F("span", { style: { left: "-50%" }, children: [
1091
- $,
1090
+ /* @__PURE__ */ c("div", { className: `gs-line-vertical ${m === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: 1, height: "100%", left: D - $ }, children: /* @__PURE__ */ F("span", { style: { left: "-50%" }, children: [
1091
+ P,
1092
1092
  "px"
1093
1093
  ] }) }) }),
1094
- /* @__PURE__ */ c("div", { className: `gs-line-horizontal ${w === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: "100%", height: 1, top: d - N }, children: /* @__PURE__ */ F("span", { style: { top: "-50%" }, children: [
1095
- P,
1094
+ /* @__PURE__ */ c("div", { className: `gs-line-horizontal ${w === -1 ? "gs-hidden" : ""}`, children: /* @__PURE__ */ c("div", { className: "gs-line", style: { width: "100%", height: 1, top: g - S }, children: /* @__PURE__ */ F("span", { style: { top: "-50%" }, children: [
1095
+ X,
1096
1096
  "px"
1097
1097
  ] }) }) })
1098
1098
  ]
1099
1099
  }
1100
1100
  );
1101
1101
  }, Ds = () => {
1102
- const { store: e } = ie(le), { choosing: n, selectingZone: t, sheetReactive: s } = e, r = s.current;
1103
- return Z(() => {
1102
+ const { store: e } = le(ae), { choosing: n, selectingZone: t, sheetReactive: s } = e, r = s.current;
1103
+ return W(() => {
1104
1104
  r != null && r.isInitialized && r.currentVersion > 0 && r.registry.onChange && r.registry.onChange({
1105
1105
  sheet: r,
1106
1106
  points: {
@@ -1109,7 +1109,7 @@ const As = ({
1109
1109
  selectingTo: { y: t.endY, x: t.endX }
1110
1110
  }
1111
1111
  });
1112
- }, [s]), Z(() => {
1112
+ }, [s]), W(() => {
1113
1113
  r && r.registry.onSelect && r.registry.onSelect({
1114
1114
  sheet: r,
1115
1115
  points: {
@@ -1121,10 +1121,10 @@ const As = ({
1121
1121
  }, [n, t]), null;
1122
1122
  }, kn = async ({ store: e, dispatch: n }) => {
1123
1123
  const { editorRef: t } = e, s = et(e);
1124
- n(dn(Ge(s))), H(t.current);
1124
+ n(dn(Ge(s))), L(t.current);
1125
1125
  }, Tn = async ({ store: e, dispatch: n }) => {
1126
1126
  const { editorRef: t } = e, s = et(e);
1127
- n(cn(Ge(s))), H(t.current);
1127
+ n(cn(Ge(s))), L(t.current);
1128
1128
  }, An = async ({ store: e, dispatch: n }, t = !1) => {
1129
1129
  const { editorRef: s } = e, r = await navigator.clipboard.read();
1130
1130
  let o = [];
@@ -1144,56 +1144,56 @@ const As = ({
1144
1144
  }
1145
1145
  }
1146
1146
  }
1147
- n(dt({ matrix: o, onlyValue: t })), H(s.current);
1147
+ n(dt({ matrix: o, onlyValue: t })), L(s.current);
1148
1148
  }, Mn = async ({ store: e, dispatch: n }) => {
1149
1149
  const { editorRef: t } = e;
1150
- n(an(null)), H(t.current);
1150
+ n(an(null)), L(t.current);
1151
1151
  }, Dn = async ({ store: e, dispatch: n }) => {
1152
1152
  const { editorRef: t } = e;
1153
- n(ct(null)), H(t.current);
1153
+ n(ct(null)), L(t.current);
1154
1154
  }, Is = async ({ store: e, dispatch: n }) => {
1155
- const { selectingZone: t, editorRef: s } = e, { top: r } = de(t), o = te(t).rows;
1156
- n(yn({ numRows: o, y: r, operator: "USER" })), H(s.current);
1155
+ const { selectingZone: t, editorRef: s } = e, { top: r } = ge(t), o = ne(t).rows;
1156
+ n(yn({ numRows: o, y: r, operator: "USER" })), L(s.current);
1157
1157
  }, Fs = async ({ store: e, dispatch: n }) => {
1158
- const { selectingZone: t, editorRef: s } = e, { bottom: r } = de(t), o = te(t).rows;
1159
- n(pn({ numRows: o, y: r, operator: "USER" })), H(s.current);
1158
+ const { selectingZone: t, editorRef: s } = e, { bottom: r } = ge(t), o = ne(t).rows;
1159
+ n(pn({ numRows: o, y: r, operator: "USER" })), L(s.current);
1160
1160
  }, Ys = async ({ store: e, dispatch: n }) => {
1161
- const { selectingZone: t, editorRef: s } = e, { left: r } = de(t), o = te(t).cols;
1162
- n(mn({ numCols: o, x: r, operator: "USER" })), H(s.current);
1161
+ const { selectingZone: t, editorRef: s } = e, { left: r } = ge(t), o = ne(t).cols;
1162
+ n(mn({ numCols: o, x: r, operator: "USER" })), L(s.current);
1163
1163
  }, $s = async ({ store: e, dispatch: n }) => {
1164
- const { selectingZone: t, editorRef: s } = e, { right: r } = de(t), o = te(t).cols;
1165
- n(fn({ numCols: o, x: r, operator: "USER" })), H(s.current);
1164
+ const { selectingZone: t, editorRef: s } = e, { right: r } = ge(t), o = ne(t).cols;
1165
+ n(fn({ numCols: o, x: r, operator: "USER" })), L(s.current);
1166
1166
  }, Ps = async ({ store: e, dispatch: n }) => {
1167
- const { selectingZone: t, editorRef: s } = e, { top: r } = de(t), o = te(t).rows;
1168
- n(hn({ numRows: o, y: r, operator: "USER" })), H(s.current);
1167
+ const { selectingZone: t, editorRef: s } = e, { top: r } = ge(t), o = ne(t).rows;
1168
+ n(hn({ numRows: o, y: r, operator: "USER" })), L(s.current);
1169
1169
  }, Xs = async ({ store: e, dispatch: n }) => {
1170
- const { selectingZone: t, editorRef: s } = e, { left: r } = de(t), o = te(t).cols;
1171
- n(gn({ numCols: o, x: r, operator: "USER" })), H(s.current);
1170
+ const { selectingZone: t, editorRef: s } = e, { left: r } = ge(t), o = ne(t).cols;
1171
+ n(gn({ numCols: o, x: r, operator: "USER" })), L(s.current);
1172
1172
  }, In = async ({ store: e, dispatch: n }, t) => {
1173
1173
  const s = e.sheetReactive.current;
1174
- s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "asc" })), H(e.editorRef.current);
1174
+ s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "asc" })), L(e.editorRef.current);
1175
1175
  }, Fn = async ({ store: e, dispatch: n }, t) => {
1176
1176
  const s = e.sheetReactive.current;
1177
- s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "desc" })), H(e.editorRef.current);
1177
+ s && (s.hasPendingCells() || s.registry.asyncPending.size > 0) && await s.waitForPending(), n(Rt({ x: t, direction: "desc" })), L(e.editorRef.current);
1178
1178
  }, Yn = async ({ store: e, dispatch: n }, t, s) => {
1179
1179
  const r = e.sheetReactive.current;
1180
- r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), n(Fe({ x: t, filter: s })), H(e.editorRef.current);
1180
+ r && (r.hasPendingCells() || r.registry.asyncPending.size > 0) && await r.waitForPending(), n(Fe({ x: t, filter: s })), L(e.editorRef.current);
1181
1181
  }, mt = async ({ store: e, dispatch: n }, t) => {
1182
- n(Fe({ x: t })), H(e.editorRef.current);
1182
+ n(Fe({ x: t })), L(e.editorRef.current);
1183
1183
  }, $n = ({ store: e, dispatch: n }, t) => {
1184
1184
  const s = e.sheetReactive.current;
1185
1185
  if (!s)
1186
1186
  return;
1187
1187
  const r = Ne({ y: t, x: 0 }), o = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.sortFixed) || void 0;
1188
- s.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), n(Ue(s)), H(e.editorRef.current);
1188
+ s.update({ diff: { [r]: { sortFixed: i } }, partial: !0 }), n(Ue(s)), L(e.editorRef.current);
1189
1189
  }, Pn = ({ store: e, dispatch: n }, t) => {
1190
1190
  const s = e.sheetReactive.current;
1191
1191
  if (!s)
1192
1192
  return;
1193
1193
  const r = Ne({ y: t, x: 0 }), o = s.getCell({ y: t, x: 0 }, { resolution: "SYSTEM" }), i = !(o != null && o.filterFixed) || void 0;
1194
- s.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), n(Ue(s)), H(e.editorRef.current);
1194
+ s.update({ diff: { [r]: { filterFixed: i } }, partial: !0 }), n(Ue(s)), L(e.editorRef.current);
1195
1195
  }, Xn = async ({ store: e, dispatch: n }) => {
1196
- typeof e.searchQuery > "u" && n($e("")), n(un(!1)), requestAnimationFrame(() => H(e.searchInputRef.current));
1196
+ typeof e.searchQuery > "u" && n($e("")), n(un(!1)), requestAnimationFrame(() => L(e.searchInputRef.current));
1197
1197
  }, Nr = {
1198
1198
  copy: kn,
1199
1199
  cut: Tn,
@@ -1248,80 +1248,80 @@ const As = ({
1248
1248
  {
1249
1249
  id: "insert-rows-above",
1250
1250
  label: (e) => {
1251
- const n = te(e.selectingZone).rows;
1251
+ const n = ne(e.selectingZone).rows;
1252
1252
  return `Insert ${n} row${n > 1 ? "s" : ""} above`;
1253
1253
  },
1254
1254
  visible: (e) => e.leftHeaderSelecting,
1255
1255
  disabled: (e) => {
1256
- const n = te(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1257
- return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || O.hasOperation(s == null ? void 0 : s.prevention, O.InsertRowsAbove);
1256
+ const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1257
+ return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertRowsAbove);
1258
1258
  },
1259
- onClick: (e) => e.insertRowsAbove(e.choosing.y, te(e.selectingZone).rows)
1259
+ onClick: (e) => e.insertRowsAbove(e.choosing.y, ne(e.selectingZone).rows)
1260
1260
  },
1261
1261
  {
1262
1262
  id: "insert-rows-below",
1263
1263
  label: (e) => {
1264
- const n = te(e.selectingZone).rows;
1264
+ const n = ne(e.selectingZone).rows;
1265
1265
  return `Insert ${n} row${n > 1 ? "s" : ""} below`;
1266
1266
  },
1267
1267
  visible: (e) => e.leftHeaderSelecting,
1268
1268
  disabled: (e) => {
1269
- const n = te(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1270
- return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || O.hasOperation(s == null ? void 0 : s.prevention, O.InsertRowsBelow);
1269
+ const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1270
+ return t.maxNumRows !== -1 && t.numRows + n > t.maxNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertRowsBelow);
1271
1271
  },
1272
- onClick: (e) => e.insertRowsBelow(e.choosing.y, te(e.selectingZone).rows)
1272
+ onClick: (e) => e.insertRowsBelow(e.choosing.y, ne(e.selectingZone).rows)
1273
1273
  },
1274
1274
  {
1275
1275
  id: "insert-cols-left",
1276
1276
  label: (e) => {
1277
- const n = te(e.selectingZone).cols;
1277
+ const n = ne(e.selectingZone).cols;
1278
1278
  return `Insert ${n} column${n > 1 ? "s" : ""} left`;
1279
1279
  },
1280
1280
  visible: (e) => e.topHeaderSelecting,
1281
1281
  disabled: (e) => {
1282
- const n = te(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1283
- return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || O.hasOperation(s == null ? void 0 : s.prevention, O.InsertColsLeft);
1282
+ const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1283
+ return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertColsLeft);
1284
1284
  },
1285
- onClick: (e) => e.insertColsLeft(e.choosing.x, te(e.selectingZone).cols)
1285
+ onClick: (e) => e.insertColsLeft(e.choosing.x, ne(e.selectingZone).cols)
1286
1286
  },
1287
1287
  {
1288
1288
  id: "insert-cols-right",
1289
1289
  label: (e) => {
1290
- const n = te(e.selectingZone).cols;
1290
+ const n = ne(e.selectingZone).cols;
1291
1291
  return `Insert ${n} column${n > 1 ? "s" : ""} right`;
1292
1292
  },
1293
1293
  visible: (e) => e.topHeaderSelecting,
1294
1294
  disabled: (e) => {
1295
- const n = te(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1296
- return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || O.hasOperation(s == null ? void 0 : s.prevention, O.InsertColsRight);
1295
+ const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1296
+ return t.maxNumCols !== -1 && t.numCols + n > t.maxNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.InsertColsRight);
1297
1297
  },
1298
- onClick: (e) => e.insertColsRight(e.choosing.x, te(e.selectingZone).cols)
1298
+ onClick: (e) => e.insertColsRight(e.choosing.x, ne(e.selectingZone).cols)
1299
1299
  },
1300
1300
  {
1301
1301
  id: "remove-rows",
1302
1302
  label: (e) => {
1303
- const n = te(e.selectingZone).rows;
1303
+ const n = ne(e.selectingZone).rows;
1304
1304
  return `Remove ${n} row${n > 1 ? "s" : ""}`;
1305
1305
  },
1306
1306
  visible: (e) => e.leftHeaderSelecting,
1307
1307
  disabled: (e) => {
1308
- const n = te(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1309
- return t.minNumRows !== -1 && t.numRows - n < t.minNumRows || O.hasOperation(s == null ? void 0 : s.prevention, O.RemoveRows);
1308
+ const n = ne(e.selectingZone).rows, t = e.sheet, s = t.getCell({ y: e.choosing.y, x: 0 }, { resolution: "SYSTEM" });
1309
+ return t.minNumRows !== -1 && t.numRows - n < t.minNumRows || H.hasOperation(s == null ? void 0 : s.prevention, H.RemoveRows);
1310
1310
  },
1311
- onClick: (e) => e.removeRows(e.choosing.y, te(e.selectingZone).rows)
1311
+ onClick: (e) => e.removeRows(e.choosing.y, ne(e.selectingZone).rows)
1312
1312
  },
1313
1313
  {
1314
1314
  id: "remove-cols",
1315
1315
  label: (e) => {
1316
- const n = te(e.selectingZone).cols;
1316
+ const n = ne(e.selectingZone).cols;
1317
1317
  return `Remove ${n} column${n > 1 ? "s" : ""}`;
1318
1318
  },
1319
1319
  visible: (e) => e.topHeaderSelecting,
1320
1320
  disabled: (e) => {
1321
- const n = te(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1322
- return t.minNumCols !== -1 && t.numCols - n < t.minNumCols || O.hasOperation(s == null ? void 0 : s.prevention, O.RemoveCols);
1321
+ const n = ne(e.selectingZone).cols, t = e.sheet, s = t.getCell({ y: 0, x: e.choosing.x }, { resolution: "SYSTEM" });
1322
+ return t.minNumCols !== -1 && t.numCols - n < t.minNumCols || H.hasOperation(s == null ? void 0 : s.prevention, H.RemoveCols);
1323
1323
  },
1324
- onClick: (e) => e.removeCols(e.choosing.x, te(e.selectingZone).cols)
1324
+ onClick: (e) => e.removeCols(e.choosing.x, ne(e.selectingZone).cols)
1325
1325
  },
1326
1326
  { type: "divider" },
1327
1327
  {
@@ -1379,7 +1379,7 @@ const As = ({
1379
1379
  },
1380
1380
  disabled: (e, n) => {
1381
1381
  const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
1382
- return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || O.hasOperation(r == null ? void 0 : r.prevention, O.InsertRowsAbove);
1382
+ return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertRowsAbove);
1383
1383
  },
1384
1384
  onClick: (e, n) => e.insertRowsAbove(n, Re(e, n))
1385
1385
  },
@@ -1391,7 +1391,7 @@ const As = ({
1391
1391
  },
1392
1392
  disabled: (e, n) => {
1393
1393
  const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
1394
- return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || O.hasOperation(r == null ? void 0 : r.prevention, O.InsertRowsBelow);
1394
+ return s.maxNumRows !== -1 && s.numRows + t > s.maxNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertRowsBelow);
1395
1395
  },
1396
1396
  onClick: (e, n) => e.insertRowsBelow(n, Re(e, n))
1397
1397
  },
@@ -1403,7 +1403,7 @@ const As = ({
1403
1403
  },
1404
1404
  disabled: (e, n) => {
1405
1405
  const t = Re(e, n), s = e.sheet, r = s.getCell({ y: n, x: 0 }, { resolution: "SYSTEM" });
1406
- return s.minNumRows !== -1 && s.numRows - t < s.minNumRows || O.hasOperation(r == null ? void 0 : r.prevention, O.RemoveRows);
1406
+ return s.minNumRows !== -1 && s.numRows - t < s.minNumRows || H.hasOperation(r == null ? void 0 : r.prevention, H.RemoveRows);
1407
1407
  },
1408
1408
  onClick: (e, n) => e.removeRows(n, Re(e, n))
1409
1409
  },
@@ -1471,7 +1471,7 @@ const As = ({
1471
1471
  },
1472
1472
  disabled: (e, n) => {
1473
1473
  const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
1474
- return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || O.hasOperation(r == null ? void 0 : r.prevention, O.InsertColsLeft);
1474
+ return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertColsLeft);
1475
1475
  },
1476
1476
  onClick: (e, n) => e.insertColsLeft(n, Ce(e, n))
1477
1477
  },
@@ -1483,7 +1483,7 @@ const As = ({
1483
1483
  },
1484
1484
  disabled: (e, n) => {
1485
1485
  const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
1486
- return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || O.hasOperation(r == null ? void 0 : r.prevention, O.InsertColsRight);
1486
+ return s.maxNumCols !== -1 && s.numCols + t > s.maxNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.InsertColsRight);
1487
1487
  },
1488
1488
  onClick: (e, n) => e.insertColsRight(n, Ce(e, n))
1489
1489
  },
@@ -1495,7 +1495,7 @@ const As = ({
1495
1495
  },
1496
1496
  disabled: (e, n) => {
1497
1497
  const t = Ce(e, n), s = e.sheet, r = s.getCell({ y: 0, x: n }, { resolution: "SYSTEM" });
1498
- return s.minNumCols !== -1 && s.numCols - t < s.minNumCols || O.hasOperation(r == null ? void 0 : r.prevention, O.RemoveCols);
1498
+ return s.minNumCols !== -1 && s.numCols - t < s.minNumCols || H.hasOperation(r == null ? void 0 : r.prevention, H.RemoveCols);
1499
1499
  },
1500
1500
  onClick: (e, n) => e.removeCols(n, Ce(e, n))
1501
1501
  },
@@ -1573,13 +1573,13 @@ function Nt(e, n, t) {
1573
1573
  };
1574
1574
  }
1575
1575
  const On = /* @__PURE__ */ new Map();
1576
- function Et(e, n) {
1576
+ function xt(e, n) {
1577
1577
  On.set(e, n);
1578
1578
  }
1579
1579
  function Bs(e) {
1580
1580
  return On.get(e);
1581
1581
  }
1582
- const xt = ({
1582
+ const Et = ({
1583
1583
  label: e,
1584
1584
  shortcuts: n,
1585
1585
  disabled: t = !1,
@@ -1603,45 +1603,45 @@ const xt = ({
1603
1603
  n != null && n.length > 0 && /* @__PURE__ */ c("div", { className: "gs-menu-shortcut", children: n.map((f, a) => /* @__PURE__ */ F("span", { children: [
1604
1604
  a > 0 && /* @__PURE__ */ c("span", { className: "gs-menu-shortcut-sep", children: ", " }),
1605
1605
  /* @__PURE__ */ c("span", { className: "gs-menu-shortcut-badge", children: f.split("+").map(
1606
- (u, w, b) => w < b.length - 1 ? /* @__PURE__ */ F("span", { children: [
1607
- u,
1606
+ (d, w, b) => w < b.length - 1 ? /* @__PURE__ */ F("span", { children: [
1607
+ d,
1608
1608
  "+"
1609
- ] }, w) : /* @__PURE__ */ c("span", { className: "gs-menu-underline", children: u }, w)
1609
+ ] }, w) : /* @__PURE__ */ c("span", { className: "gs-menu-underline", children: d }, w)
1610
1610
  ) })
1611
1611
  ] }, a)) })
1612
1612
  ]
1613
1613
  }
1614
1614
  );
1615
1615
  }, kt = () => /* @__PURE__ */ c("li", { className: "gs-menu-divider" }), Ks = () => {
1616
- const { store: e, dispatch: n } = ie(le), { contextMenuPosition: t, contextMenu: s } = e, { y: r, x: o } = t, i = oe(null);
1617
- if (Z(() => {
1616
+ const { store: e, dispatch: n } = le(ae), { contextMenuPosition: t, contextMenu: s } = e, { y: r, x: o } = t, i = ie(null);
1617
+ if (W(() => {
1618
1618
  i.current && Jt(i.current);
1619
1619
  }), r === -1)
1620
1620
  return null;
1621
- const h = () => n(ze({ y: -1, x: -1 })), f = Nt(e, n, h);
1621
+ const h = () => n(We({ y: -1, x: -1 })), f = Nt(e, n, h);
1622
1622
  return /* @__PURE__ */ c(
1623
1623
  st,
1624
1624
  {
1625
1625
  className: "gs-menu-modal gs-context-menu-modal",
1626
1626
  onClick: (a) => (a.preventDefault(), h(), !1),
1627
- children: /* @__PURE__ */ c("div", { ref: i, className: "gs-context-menu", style: { top: r, left: o }, children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: s.map((a, u) => {
1628
- var D, T;
1627
+ children: /* @__PURE__ */ c("div", { ref: i, className: "gs-context-menu", style: { top: r, left: o }, children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: s.map((a, d) => {
1628
+ var D, E;
1629
1629
  if (a.type === "divider")
1630
- return a.visible && !a.visible(f) ? null : /* @__PURE__ */ c(kt, {}, u);
1630
+ return a.visible && !a.visible(f) ? null : /* @__PURE__ */ c(kt, {}, d);
1631
1631
  if (a.type === "component" || !(!a.visible || a.visible(f)))
1632
1632
  return null;
1633
- const b = ((D = a.disabled) == null ? void 0 : D.call(a, f)) ?? !1, d = typeof a.label == "function" ? a.label(f) : a.label, m = typeof a.shortcuts == "function" ? a.shortcuts(f) : a.shortcuts, y = (T = a.checked) == null ? void 0 : T.call(a, f);
1633
+ const b = ((D = a.disabled) == null ? void 0 : D.call(a, f)) ?? !1, g = typeof a.label == "function" ? a.label(f) : a.label, m = typeof a.shortcuts == "function" ? a.shortcuts(f) : a.shortcuts, y = (E = a.checked) == null ? void 0 : E.call(a, f);
1634
1634
  return /* @__PURE__ */ c(
1635
- xt,
1635
+ Et,
1636
1636
  {
1637
- label: d,
1637
+ label: g,
1638
1638
  shortcuts: m,
1639
1639
  disabled: b,
1640
1640
  checked: y,
1641
1641
  testId: a.id ? `${a.id}-item` : void 0,
1642
1642
  onClick: () => a.onClick(f)
1643
1643
  },
1644
- u
1644
+ d
1645
1645
  );
1646
1646
  }) }) })
1647
1647
  }
@@ -1658,62 +1658,62 @@ const xt = ({
1658
1658
  includes: "Includes",
1659
1659
  excludes: "Excludes"
1660
1660
  }, qt = ["blank", "nonblank"], je = { method: "eq", value: [""] }, Zs = ({ x: e, close: n, onWaiting: t }) => {
1661
- const { store: s, dispatch: r } = ie(le), { sheetReactive: o } = s, i = o.current, [h, f] = J([{ ...je }]), [a, u] = J("or"), [w, b] = J(null), d = M(
1662
- (S) => {
1663
- S && S.focus();
1661
+ const { store: s, dispatch: r } = le(ae), { sheetReactive: o } = s, i = o.current, [h, f] = te([{ ...je }]), [a, d] = te("or"), [w, b] = te(null), g = A(
1662
+ (C) => {
1663
+ C && C.focus();
1664
1664
  },
1665
1665
  // eslint-disable-next-line react-hooks/exhaustive-deps
1666
1666
  [e]
1667
1667
  );
1668
- Z(() => {
1668
+ W(() => {
1669
1669
  if (i) {
1670
- const S = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), p = S == null ? void 0 : S.filter;
1671
- p && p.conditions.length > 0 ? (f(p.conditions.map((l) => ({ ...l, value: [...l.value] }))), u(p.mode || "or")) : (f([{ ...je, value: [""] }]), u("or"));
1670
+ const C = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), p = C == null ? void 0 : C.filter;
1671
+ p && p.conditions.length > 0 ? (f(p.conditions.map((l) => ({ ...l, value: [...l.value] }))), d(p.mode || "or")) : (f([{ ...je, value: [""] }]), d("or"));
1672
1672
  }
1673
1673
  }, [e, i]);
1674
- const m = M(() => {
1674
+ const m = A(() => {
1675
1675
  b(null), t == null || t(null), n();
1676
1676
  }, [n, t]);
1677
- Z(() => {
1677
+ W(() => {
1678
1678
  w && (t == null || t("Filtering…", m));
1679
- }, [w]), Z(() => {
1679
+ }, [w]), W(() => {
1680
1680
  if (!w)
1681
1681
  return;
1682
- let S = !1;
1682
+ let C = !1;
1683
1683
  const p = () => {
1684
- if (S || !o.current)
1684
+ if (C || !o.current)
1685
1685
  return;
1686
- const { x: v, conditions: x, mode: A } = w;
1687
- x.length > 0 ? r(Fe({ x: v, filter: { mode: A, conditions: x } })) : r(Fe({ x: v })), t == null || t(null), b(null), n();
1686
+ const { x: v, conditions: x, mode: T } = w;
1687
+ x.length > 0 ? r(Fe({ x: v, filter: { mode: T, conditions: x } })) : r(Fe({ x: v })), t == null || t(null), b(null), n();
1688
1688
  }, l = o.current;
1689
1689
  return l && (l.hasPendingCells() || l.registry.asyncPending.size > 0) ? l.waitForPending().then(p) : p(), () => {
1690
- S = !0;
1690
+ C = !0;
1691
1691
  };
1692
1692
  }, [w]);
1693
- const y = M((S, p) => {
1693
+ const y = A((C, p) => {
1694
1694
  f((l) => {
1695
- const g = [...l];
1696
- return g[S] = { ...g[S], ...p }, g;
1695
+ const u = [...l];
1696
+ return u[C] = { ...u[C], ...p }, u;
1697
1697
  });
1698
- }, []), D = M(() => {
1699
- f((S) => [...S, { ...je, value: [""] }]);
1700
- }, []), T = M((S) => {
1701
- f((p) => p.length <= 1 ? [{ ...je, value: [""] }] : p.filter((l, g) => g !== S));
1702
- }, []), N = M(() => {
1703
- const S = h.filter((p) => qt.includes(p.method) ? !0 : p.value.some((l) => l.trim() !== ""));
1704
- b({ x: e, conditions: S, mode: a });
1705
- }, [e, h, a]), Y = M(() => {
1698
+ }, []), D = A(() => {
1699
+ f((C) => [...C, { ...je, value: [""] }]);
1700
+ }, []), E = A((C) => {
1701
+ f((p) => p.length <= 1 ? [{ ...je, value: [""] }] : p.filter((l, u) => u !== C));
1702
+ }, []), S = A(() => {
1703
+ const C = h.filter((p) => qt.includes(p.method) ? !0 : p.value.some((l) => l.trim() !== ""));
1704
+ b({ x: e, conditions: C, mode: a });
1705
+ }, [e, h, a]), $ = A(() => {
1706
1706
  b(null), r(Fe({ x: e })), n();
1707
- }, [r, e, n]), E = M(() => {
1707
+ }, [r, e, n]), N = A(() => {
1708
1708
  b(null), r(Fe({})), n();
1709
1709
  }, [r, n]);
1710
1710
  if (!i)
1711
1711
  return null;
1712
- const I = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), $ = O.hasOperation(I == null ? void 0 : I.prevention, O.Filter), P = i.hasActiveFilters();
1713
- return /* @__PURE__ */ c("li", { className: `gs-column-menu-filter${$ ? " gs-disabled" : ""}`, children: /* @__PURE__ */ F(we, { children: [
1712
+ const M = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), P = H.hasOperation(M == null ? void 0 : M.prevention, H.Filter), X = i.hasActiveFilters();
1713
+ return /* @__PURE__ */ c("li", { className: `gs-column-menu-filter${P ? " gs-disabled" : ""}`, children: /* @__PURE__ */ F(we, { children: [
1714
1714
  /* @__PURE__ */ F("div", { className: "gs-filter-header", children: [
1715
1715
  /* @__PURE__ */ c("div", { className: "gs-menu-name", children: "Filter:" }),
1716
- /* @__PURE__ */ c("button", { className: "gs-filter-add-btn", onClick: D, disabled: $, children: "+ ADD" }),
1716
+ /* @__PURE__ */ c("button", { className: "gs-filter-add-btn", onClick: D, disabled: P, children: "+ ADD" }),
1717
1717
  /* @__PURE__ */ F("div", { className: `gs-filter-mode-toggle${h.length <= 1 ? " gs-disabled" : ""}`, children: [
1718
1718
  /* @__PURE__ */ F("label", { className: a === "and" ? "gs-active" : "", children: [
1719
1719
  /* @__PURE__ */ c(
@@ -1722,8 +1722,8 @@ const xt = ({
1722
1722
  type: "radio",
1723
1723
  name: "gs-filter-mode",
1724
1724
  checked: a === "and",
1725
- onChange: () => u("and"),
1726
- disabled: $ || h.length <= 1
1725
+ onChange: () => d("and"),
1726
+ disabled: P || h.length <= 1
1727
1727
  }
1728
1728
  ),
1729
1729
  "AND"
@@ -1735,39 +1735,39 @@ const xt = ({
1735
1735
  type: "radio",
1736
1736
  name: "gs-filter-mode",
1737
1737
  checked: a === "or",
1738
- onChange: () => u("or"),
1739
- disabled: $ || h.length <= 1
1738
+ onChange: () => d("or"),
1739
+ disabled: P || h.length <= 1
1740
1740
  }
1741
1741
  ),
1742
1742
  "OR"
1743
1743
  ] })
1744
1744
  ] })
1745
1745
  ] }),
1746
- /* @__PURE__ */ c("div", { className: "gs-filter-conditions", children: h.map((S, p) => /* @__PURE__ */ F("div", { className: "gs-filter-condition-row", children: [
1746
+ /* @__PURE__ */ c("div", { className: "gs-filter-conditions", children: h.map((C, p) => /* @__PURE__ */ F("div", { className: "gs-filter-condition-row", children: [
1747
1747
  /* @__PURE__ */ c(
1748
1748
  "select",
1749
1749
  {
1750
1750
  className: "gs-filter-method-select",
1751
- value: S.method,
1752
- disabled: $,
1751
+ value: C.method,
1752
+ disabled: P,
1753
1753
  tabIndex: p * 2 + 1,
1754
1754
  onChange: (l) => y(p, { method: l.target.value }),
1755
1755
  children: Object.keys(Vt).map((l) => /* @__PURE__ */ c("option", { value: l, children: Vt[l] }, l))
1756
1756
  }
1757
1757
  ),
1758
- !qt.includes(S.method) && /* @__PURE__ */ c(
1758
+ !qt.includes(C.method) && /* @__PURE__ */ c(
1759
1759
  "input",
1760
1760
  {
1761
- ref: p === 0 ? d : void 0,
1761
+ ref: p === 0 ? g : void 0,
1762
1762
  className: "gs-filter-value-input",
1763
1763
  type: "text",
1764
1764
  placeholder: "Value",
1765
- value: S.value[0] || "",
1766
- disabled: $,
1765
+ value: C.value[0] || "",
1766
+ disabled: P,
1767
1767
  tabIndex: p * 2 + 2,
1768
1768
  onChange: (l) => y(p, { value: [l.target.value] }),
1769
1769
  onKeyDown: (l) => {
1770
- l.nativeEvent.isComposing || (l.key === "Enter" && N(), l.key === "Escape" && n());
1770
+ l.nativeEvent.isComposing || (l.key === "Enter" && S(), l.key === "Escape" && n());
1771
1771
  }
1772
1772
  }
1773
1773
  ),
@@ -1775,42 +1775,42 @@ const xt = ({
1775
1775
  "button",
1776
1776
  {
1777
1777
  className: "gs-filter-remove-btn",
1778
- onClick: () => T(p),
1779
- disabled: $,
1778
+ onClick: () => E(p),
1779
+ disabled: P,
1780
1780
  title: "Remove condition",
1781
1781
  children: "✕"
1782
1782
  }
1783
1783
  )
1784
1784
  ] }, p)) }),
1785
1785
  /* @__PURE__ */ F("div", { className: "gs-filter-actions", children: [
1786
- P && /* @__PURE__ */ c("button", { className: "gs-filter-reset-all-btn", onClick: E, children: "RESET ALL" }),
1786
+ X && /* @__PURE__ */ c("button", { className: "gs-filter-reset-all-btn", onClick: N, children: "RESET ALL" }),
1787
1787
  /* @__PURE__ */ F("div", { className: "gs-filter-actions-right", children: [
1788
- (I == null ? void 0 : I.filter) && /* @__PURE__ */ c("button", { className: "gs-filter-reset-btn", onClick: Y, children: "RESET" }),
1789
- /* @__PURE__ */ c("button", { className: "gs-filter-apply-btn", onClick: N, disabled: $, children: "APPLY" })
1788
+ (M == null ? void 0 : M.filter) && /* @__PURE__ */ c("button", { className: "gs-filter-reset-btn", onClick: $, children: "RESET" }),
1789
+ /* @__PURE__ */ c("button", { className: "gs-filter-apply-btn", onClick: S, disabled: P, children: "APPLY" })
1790
1790
  ] })
1791
1791
  ] })
1792
1792
  ] }) });
1793
1793
  };
1794
- Et("col-filter", Zs);
1794
+ xt("col-filter", Zs);
1795
1795
  const Us = ({ x: e, close: n, onWaiting: t }) => {
1796
- const { store: s, dispatch: r } = ie(le), { sheetReactive: o } = s, i = o.current, [h, f] = J(null), a = M(() => {
1796
+ const { store: s, dispatch: r } = le(ae), { sheetReactive: o } = s, i = o.current, [h, f] = te(null), a = A(() => {
1797
1797
  f(null), t == null || t(null), n();
1798
1798
  }, [n, t]);
1799
- if (Z(() => {
1799
+ if (W(() => {
1800
1800
  h && (t == null || t("Sorting…", a));
1801
- }, [h]), Z(() => {
1801
+ }, [h]), W(() => {
1802
1802
  if (!h)
1803
1803
  return;
1804
1804
  let b = !1;
1805
- const d = () => {
1805
+ const g = () => {
1806
1806
  b || !o.current || (r(Rt({ x: h.x, direction: h.direction })), t == null || t(null), f(null), n());
1807
1807
  }, m = o.current;
1808
- return m && (m.hasPendingCells() || m.registry.asyncPending.size > 0) ? m.waitForPending().then(d) : d(), () => {
1808
+ return m && (m.hasPendingCells() || m.registry.asyncPending.size > 0) ? m.waitForPending().then(g) : g(), () => {
1809
1809
  b = !0;
1810
1810
  };
1811
1811
  }, [h]), !i)
1812
1812
  return null;
1813
- const u = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = O.hasOperation(u == null ? void 0 : u.prevention, O.Sort);
1813
+ const d = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = H.hasOperation(d == null ? void 0 : d.prevention, H.Sort);
1814
1814
  return /* @__PURE__ */ F("li", { className: `gs-menu-item gs-column-menu-sort${w ? " gs-disabled" : ""}`, children: [
1815
1815
  /* @__PURE__ */ c("div", { className: "gs-menu-name", children: "Sort:" }),
1816
1816
  /* @__PURE__ */ F("div", { className: "gs-sort-buttons", children: [
@@ -1839,21 +1839,21 @@ const Us = ({ x: e, close: n, onWaiting: t }) => {
1839
1839
  ] })
1840
1840
  ] });
1841
1841
  };
1842
- Et("col-sort", Us);
1843
- const zs = ({ x: e, close: n }) => {
1844
- const { store: t, dispatch: s } = ie(le), { sheetReactive: r } = t, o = r.current, i = oe(null), [h, f] = J("");
1845
- Z(() => {
1842
+ xt("col-sort", Us);
1843
+ const Ws = ({ x: e, close: n }) => {
1844
+ const { store: t, dispatch: s } = le(ae), { sheetReactive: r } = t, o = r.current, i = ie(null), [h, f] = te("");
1845
+ W(() => {
1846
1846
  if (o) {
1847
- const d = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" });
1848
- f((d == null ? void 0 : d.label) ?? "");
1847
+ const g = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" });
1848
+ f((g == null ? void 0 : g.label) ?? "");
1849
1849
  }
1850
1850
  }, [e, o]);
1851
- const a = M(() => {
1851
+ const a = A(() => {
1852
1852
  if (!o)
1853
1853
  return;
1854
- const d = Ne({ y: 0, x: e });
1854
+ const g = Ne({ y: 0, x: e });
1855
1855
  o.update({
1856
- diff: { [d]: { label: h || void 0 } },
1856
+ diff: { [g]: { label: h || void 0 } },
1857
1857
  partial: !0,
1858
1858
  ignoreFields: [],
1859
1859
  undoReflection: {
@@ -1870,7 +1870,7 @@ const zs = ({ x: e, close: n }) => {
1870
1870
  }, [s, e, h, n, o, t.selectingZone, t.choosing]);
1871
1871
  if (!o)
1872
1872
  return null;
1873
- const u = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = O.hasOperation(u == null ? void 0 : u.prevention, O.SetLabel), b = bt(o, u == null ? void 0 : u.label, { y: 0, x: e }, e) ?? me(e);
1873
+ const d = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), w = H.hasOperation(d == null ? void 0 : d.prevention, H.SetLabel), b = bt(o, d == null ? void 0 : d.label, { y: 0, x: e }, e) ?? me(e);
1874
1874
  return /* @__PURE__ */ c("li", { className: `gs-menu-item gs-column-menu-label${w ? " gs-disabled" : ""}`, children: /* @__PURE__ */ F("label", { className: "gs-label-input-row", children: [
1875
1875
  /* @__PURE__ */ c("div", { className: "gs-label-input-label", children: "Label:" }),
1876
1876
  /* @__PURE__ */ c(
@@ -1882,62 +1882,62 @@ const zs = ({ x: e, close: n }) => {
1882
1882
  placeholder: b,
1883
1883
  value: h,
1884
1884
  disabled: w,
1885
- onChange: (d) => f(d.target.value),
1886
- onKeyDown: (d) => {
1887
- d.nativeEvent.isComposing || (d.key === "Enter" && a(), d.key === "Escape" && n());
1885
+ onChange: (g) => f(g.target.value),
1886
+ onKeyDown: (g) => {
1887
+ g.nativeEvent.isComposing || (g.key === "Enter" && a(), g.key === "Escape" && n());
1888
1888
  }
1889
1889
  }
1890
1890
  ),
1891
1891
  /* @__PURE__ */ c("button", { className: "gs-label-apply-btn", onClick: a, disabled: w, children: "UPDATE" })
1892
1892
  ] }) });
1893
1893
  };
1894
- Et("col-label", zs);
1895
- const Ws = () => {
1896
- const { store: e, dispatch: n } = ie(le), { columnMenuState: t, editorRef: s, colMenu: r } = e, o = e.sheetReactive.current, i = t == null ? void 0 : t.x, h = t == null ? void 0 : t.position, [f, a] = J(null), u = M(() => {
1897
- n(Je(null)), H(s.current);
1898
- }, [n, s]), w = M(
1899
- (d, m) => {
1900
- a(d ? { message: d, cancel: m ?? u } : null);
1901
- },
1902
- [u]
1894
+ xt("col-label", Ws);
1895
+ const zs = () => {
1896
+ const { store: e, dispatch: n } = le(ae), { columnMenuState: t, editorRef: s, colMenu: r } = e, o = e.sheetReactive.current, i = t == null ? void 0 : t.x, h = t == null ? void 0 : t.position, [f, a] = te(null), d = A(() => {
1897
+ n(Je(null)), L(s.current);
1898
+ }, [n, s]), w = A(
1899
+ (g, m) => {
1900
+ a(g ? { message: g, cancel: m ?? d } : null);
1901
+ },
1902
+ [d]
1903
1903
  );
1904
1904
  if (!t || !o || i == null || !h)
1905
1905
  return null;
1906
- const b = Nt(e, n, u);
1906
+ const b = Nt(e, n, d);
1907
1907
  return /* @__PURE__ */ F(
1908
1908
  st,
1909
1909
  {
1910
1910
  className: "gs-menu-modal gs-column-menu-modal",
1911
- onClick: (d) => (d.preventDefault(), f || u(), !1),
1911
+ onClick: (g) => (g.preventDefault(), f || d(), !1),
1912
1912
  children: [
1913
1913
  /* @__PURE__ */ c(
1914
1914
  "div",
1915
1915
  {
1916
1916
  className: "gs-column-menu",
1917
1917
  style: { top: h.y, left: h.x, display: f ? "none" : void 0 },
1918
- onClick: (d) => d.stopPropagation(),
1919
- children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: r.map((d, m) => {
1920
- var Y;
1921
- if (d.type === "component") {
1922
- if (!(!d.visible || d.visible(b, i)))
1918
+ onClick: (g) => g.stopPropagation(),
1919
+ children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: r.map((g, m) => {
1920
+ var $;
1921
+ if (g.type === "component") {
1922
+ if (!(!g.visible || g.visible(b, i)))
1923
1923
  return null;
1924
- const I = Bs(d.componentId);
1925
- return I ? /* @__PURE__ */ c(I, { x: i, close: u, onWaiting: w }, m) : null;
1924
+ const M = Bs(g.componentId);
1925
+ return M ? /* @__PURE__ */ c(M, { x: i, close: d, onWaiting: w }, m) : null;
1926
1926
  }
1927
- if (d.type === "divider")
1928
- return d.visible && !d.visible(b) ? null : /* @__PURE__ */ c(kt, {}, m);
1929
- if (!(!d.visible || d.visible(b, i)))
1927
+ if (g.type === "divider")
1928
+ return g.visible && !g.visible(b) ? null : /* @__PURE__ */ c(kt, {}, m);
1929
+ if (!(!g.visible || g.visible(b, i)))
1930
1930
  return null;
1931
- const D = ((Y = d.disabled) == null ? void 0 : Y.call(d, b, i)) ?? !1, T = typeof d.label == "function" ? d.label(b, i) : d.label, N = typeof d.shortcuts == "function" ? d.shortcuts(b, i) : d.shortcuts;
1931
+ const D = (($ = g.disabled) == null ? void 0 : $.call(g, b, i)) ?? !1, E = typeof g.label == "function" ? g.label(b, i) : g.label, S = typeof g.shortcuts == "function" ? g.shortcuts(b, i) : g.shortcuts;
1932
1932
  return /* @__PURE__ */ c(
1933
- xt,
1933
+ Et,
1934
1934
  {
1935
- label: T,
1936
- shortcuts: N,
1935
+ label: E,
1936
+ shortcuts: S,
1937
1937
  disabled: D,
1938
- testId: d.id ? `${d.id}-item` : void 0,
1938
+ testId: g.id ? `${g.id}-item` : void 0,
1939
1939
  onClick: () => {
1940
- d.onClick(b, i), n(Je(null));
1940
+ g.onClick(b, i), n(Je(null));
1941
1941
  }
1942
1942
  },
1943
1943
  m
@@ -1950,7 +1950,7 @@ const Ws = () => {
1950
1950
  {
1951
1951
  className: "gs-column-menu gs-column-menu-waiting",
1952
1952
  style: { top: h.y, left: h.x },
1953
- onClick: (d) => d.stopPropagation(),
1953
+ onClick: (g) => g.stopPropagation(),
1954
1954
  children: [
1955
1955
  /* @__PURE__ */ c("div", { className: "gs-waiting-message", children: f.message }),
1956
1956
  /* @__PURE__ */ c("div", { className: "gs-waiting-spinner" }),
@@ -1963,14 +1963,14 @@ const Ws = () => {
1963
1963
  );
1964
1964
  };
1965
1965
  function _s(e, n, t, s, r) {
1966
- var u;
1966
+ var d;
1967
1967
  if (e.type === "divider")
1968
1968
  return /* @__PURE__ */ c(kt, {}, s);
1969
1969
  if (e.type === "component" || !(!e.visible || e.visible(n, t)))
1970
1970
  return null;
1971
- const i = ((u = e.disabled) == null ? void 0 : u.call(e, n, t)) ?? !1, h = typeof e.label == "function" ? e.label(n, t) : e.label, f = typeof e.shortcuts == "function" ? e.shortcuts(n, t) : e.shortcuts, a = e.checked != null ? e.checked(n, t) : void 0;
1971
+ const i = ((d = e.disabled) == null ? void 0 : d.call(e, n, t)) ?? !1, h = typeof e.label == "function" ? e.label(n, t) : e.label, f = typeof e.shortcuts == "function" ? e.shortcuts(n, t) : e.shortcuts, a = e.checked != null ? e.checked(n, t) : void 0;
1972
1972
  return /* @__PURE__ */ c(
1973
- xt,
1973
+ Et,
1974
1974
  {
1975
1975
  label: h,
1976
1976
  shortcuts: f,
@@ -1985,18 +1985,18 @@ function _s(e, n, t, s, r) {
1985
1985
  );
1986
1986
  }
1987
1987
  const js = () => {
1988
- const { store: e, dispatch: n } = ie(le), { rowMenuState: t, sheetReactive: s, editorRef: r, rowMenu: o } = e, i = s.current, h = t == null ? void 0 : t.y, f = t == null ? void 0 : t.position, a = () => {
1989
- n(ft(null)), H(r.current);
1988
+ const { store: e, dispatch: n } = le(ae), { rowMenuState: t, sheetReactive: s, editorRef: r, rowMenu: o } = e, i = s.current, h = t == null ? void 0 : t.y, f = t == null ? void 0 : t.position, a = () => {
1989
+ n(ft(null)), L(r.current);
1990
1990
  };
1991
1991
  if (!t || !i || h == null || !f)
1992
1992
  return null;
1993
- const u = Nt(e, n, a);
1993
+ const d = Nt(e, n, a);
1994
1994
  return /* @__PURE__ */ c(
1995
1995
  st,
1996
1996
  {
1997
1997
  className: "gs-menu-modal gs-row-menu-modal",
1998
1998
  onClick: (w) => (w.preventDefault(), a(), !1),
1999
- children: /* @__PURE__ */ c("div", { className: "gs-row-menu", style: { top: f.y, left: f.x }, onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: o.map((w, b) => _s(w, u, h, b, a)) }) })
1999
+ children: /* @__PURE__ */ c("div", { className: "gs-row-menu", style: { top: f.y, left: f.x }, onClick: (w) => w.stopPropagation(), children: /* @__PURE__ */ c("ul", { className: "gs-menu-items", children: o.map((w, b) => _s(w, d, h, b, a)) }) })
2000
2000
  }
2001
2001
  );
2002
2002
  }, Xe = (e) => {
@@ -2010,157 +2010,158 @@ const js = () => {
2010
2010
  }, he = (e) => {
2011
2011
  e.type.startsWith("touch") || e.preventDefault();
2012
2012
  }, Vs = tt(({ y: e, x: n }) => {
2013
- const t = ve(e), r = `${me(n)}${t}`, { store: o, dispatch: i } = ie(le), h = oe(!0), f = oe(null), [a, u] = J(null), {
2013
+ var Y;
2014
+ const t = ve(e), r = `${me(n)}${t}`, { store: o, dispatch: i } = le(ae), h = ie(!0), f = ie(null), [a, d] = te(null), {
2014
2015
  sheetReactive: w,
2015
2016
  editingAddress: b,
2016
- choosing: d,
2017
+ choosing: g,
2017
2018
  selectingZone: m,
2018
2019
  leftHeaderSelecting: y,
2019
2020
  topHeaderSelecting: D,
2020
- editorRef: T,
2021
- autofillDraggingTo: N,
2022
- contextMenu: Y
2023
- } = o, E = w.current, I = nt(o), $ = E == null ? void 0 : E.registry.lastFocused, P = de(m), S = b === r, p = d.y === e && d.x === n, l = M(() => {
2024
- var _;
2025
- const R = (_ = f.current) == null ? void 0 : _.getBoundingClientRect();
2026
- if (R == null)
2021
+ editorRef: E,
2022
+ autofillDraggingTo: S,
2023
+ contextMenu: $
2024
+ } = o, N = w.current, M = nt(o), P = N == null ? void 0 : N.registry.lastFocused, X = ge(m), C = b === r, p = g.y === e && g.x === n, l = A(() => {
2025
+ var ee;
2026
+ const I = (ee = f.current) == null ? void 0 : ee.getBoundingClientRect();
2027
+ if (I == null)
2027
2028
  return null;
2028
2029
  i(
2029
2030
  ws({
2030
- y: R.y,
2031
- x: R.x,
2032
- height: R.height,
2033
- width: R.width
2031
+ y: I.y,
2032
+ x: I.x,
2033
+ height: I.height,
2034
+ width: I.width
2034
2035
  })
2035
2036
  );
2036
2037
  }, [i]);
2037
- Z(() => {
2038
+ W(() => {
2038
2039
  if (p && !h.current) {
2039
2040
  l();
2040
2041
  return;
2041
2042
  }
2042
2043
  h.current = !1;
2043
- }, [p, S, l]);
2044
- const g = E == null ? void 0 : E.getCell({ y: e, x: n }, { resolution: "SYSTEM" }), v = M(
2045
- (R) => {
2046
- i(Ze({ value: R }));
2044
+ }, [p, C, l]);
2045
+ const u = N == null ? void 0 : N.getCell({ y: e, x: n }, { resolution: "SYSTEM" }), v = A(
2046
+ (I) => {
2047
+ i(Ze({ value: I }));
2047
2048
  },
2048
2049
  [i]
2049
- ), x = M(
2050
- (R) => {
2051
- i(Se({ sheetReactive: { current: R.__raw__ } }));
2050
+ ), x = A(
2051
+ (I) => {
2052
+ i(Se({ sheetReactive: { current: I.__raw__ } }));
2052
2053
  },
2053
2054
  [i]
2054
2055
  );
2055
- let A = "", C;
2056
+ let T = "", R;
2056
2057
  try {
2057
- E && (C = E.render({ sheet: E, point: { y: e, x: n }, apply: x, value: void 0 }));
2058
- } catch (R) {
2059
- Jn.is(R) ? (A = R.message, C = R.code) : (A = R.message, C = "#UNKNOWN");
2058
+ N && (R = N.render({ sheet: N, point: { y: e, x: n }, apply: x, value: void 0 }));
2059
+ } catch (I) {
2060
+ Jn.is(I) ? (T = I.message, R = I.code) : (T = I.message, R = "#UNKNOWN");
2060
2061
  }
2061
- const [, L] = (E == null ? void 0 : E.getSolvedCache({ y: e, x: n })) ?? [void 0, void 0], q = es.is(L), W = T.current, ne = !!(E != null && E.registry.editingAddress || b), ae = M(
2062
- (R) => {
2063
- if (R.stopPropagation(), he(R), !E || !Xe(R) || !W)
2062
+ const [, B] = (N == null ? void 0 : N.getSolvedCache({ y: e, x: n })) ?? [void 0, void 0], q = es.is(B), _ = E.current, se = !!(N != null && N.registry.editingAddress || b), ce = A(
2063
+ (I) => {
2064
+ if (I.stopPropagation(), he(I), !N || !Xe(I) || !_)
2064
2065
  return !1;
2065
- if (R.type.startsWith("touch"))
2066
- return ne && W && W.blur(), i(Pe({ y: e, x: n })), i(be({ startY: e, startX: n, endY: e, endX: n })), !0;
2067
- R.shiftKey ? i(fe({ y: e, x: n })) : i(be({ startY: e, startX: n, endY: -1, endX: -1 })), i(xe(!0));
2068
- const _ = `${E.sheetPrefix(!I)}${r}`;
2069
- return ne && Me({ input: $ || null, ref: _ }) || (E.registry.lastFocused = W, H(W), i(ue("")), N) ? !1 : (ne && v(W.value), R.shiftKey || i(Pe({ y: e, x: n })), !0);
2070
- },
2071
- [ne, W, r, I, $, N, v, E]
2072
- ), B = M(
2073
- (R) => {
2074
- if (R.stopPropagation(), !R.type.startsWith("touch")) {
2075
- if (he(R), i(xe(!1)), N)
2076
- return i(vn(N)), H(W), !1;
2077
- ne && i(fe({ y: -1, x: -1 }));
2066
+ if (I.type.startsWith("touch"))
2067
+ return se && _ && _.blur(), i(Pe({ y: e, x: n })), i(be({ startY: e, startX: n, endY: e, endX: n })), !0;
2068
+ I.shiftKey ? i(fe({ y: e, x: n })) : i(be({ startY: e, startX: n, endY: -1, endX: -1 })), i(Ee(!0));
2069
+ const ee = `${N.sheetPrefix(!M)}${r}`;
2070
+ return se && Me({ input: P || null, ref: ee }) || (N.registry.lastFocused = _, L(_), i(de("")), S) ? !1 : (se && v(_.value), I.shiftKey || i(Pe({ y: e, x: n })), !0);
2071
+ },
2072
+ [se, _, r, M, P, S, v, N]
2073
+ ), K = A(
2074
+ (I) => {
2075
+ if (I.stopPropagation(), !I.type.startsWith("touch")) {
2076
+ if (he(I), i(Ee(!1)), S)
2077
+ return i(vn(S)), L(_), !1;
2078
+ se && i(fe({ y: -1, x: -1 }));
2078
2079
  }
2079
2080
  },
2080
- [N, ne, W]
2081
- ), z = M(
2082
- (R) => {
2083
- if (!Xe(R) || R.type.startsWith("touch") || !E)
2081
+ [S, se, _]
2082
+ ), Z = A(
2083
+ (I) => {
2084
+ if (!Xe(I) || I.type.startsWith("touch") || !N)
2084
2085
  return !1;
2085
- if (he(R), R.stopPropagation(), N)
2086
+ if (he(I), I.stopPropagation(), S)
2086
2087
  return i(Ke({ x: n, y: e })), !1;
2087
2088
  if (y)
2088
- return i(fe({ y: e, x: E.numCols })), !1;
2089
+ return i(fe({ y: e, x: N.numCols })), !1;
2089
2090
  if (D)
2090
- return i(fe({ y: E.numRows, x: n })), !1;
2091
- if (ne && !nn($ || null))
2091
+ return i(fe({ y: N.numRows, x: n })), !1;
2092
+ if (se && !nn(P || null))
2092
2093
  return !1;
2093
- if (i(fe({ y: e, x: n })), ne) {
2094
- const _ = de({ ...m, endY: e, endX: n }), ge = `${E.sheetPrefix(!I)}${sn(_)}`;
2095
- Me({ input: $ || null, ref: ge });
2094
+ if (i(fe({ y: e, x: n })), se) {
2095
+ const ee = ge({ ...m, endY: e, endX: n }), J = `${N.sheetPrefix(!M)}${sn(ee)}`;
2096
+ Me({ input: P || null, ref: J });
2096
2097
  }
2097
2098
  return !0;
2098
2099
  },
2099
2100
  [
2100
- N,
2101
+ S,
2101
2102
  y,
2102
2103
  D,
2103
- E,
2104
- ne,
2105
- $,
2104
+ N,
2105
+ se,
2106
+ P,
2106
2107
  m,
2107
- I
2108
+ M
2108
2109
  ]
2109
- ), K = M(
2110
- (R) => {
2111
- i(Ke({ x: n, y: e })), i(xe(!0)), R.stopPropagation();
2110
+ ), U = A(
2111
+ (I) => {
2112
+ i(Ke({ x: n, y: e })), i(Ee(!0)), I.stopPropagation();
2112
2113
  },
2113
2114
  [i, n, e]
2114
- ), G = M(() => {
2115
- var _;
2116
- const R = (_ = f.current) == null ? void 0 : _.getBoundingClientRect();
2117
- R && u(ts(R));
2118
- }, []), V = M(() => {
2119
- u(null);
2120
- }, []), U = M(
2121
- (R) => Y.length > 0 ? (R.stopPropagation(), he(R), i(ze({ y: R.clientY, x: R.clientX })), !1) : !0,
2122
- [Y.length]
2123
- ), X = M(
2124
- (R) => {
2125
- R.stopPropagation(), he(R), ue(r);
2126
- const _ = document.createEvent("MouseEvents");
2127
- return _.initEvent("dblclick", !0, !0), W == null || W.dispatchEvent(_), !1;
2128
- },
2129
- [r, W]
2130
- ), Q = Ye(() => !S && p && P.bottom === -1 || P.bottom === e && P.right === n ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [S, p, P]);
2131
- return E ? W ? /* @__PURE__ */ c(
2115
+ ), G = A(() => {
2116
+ var ee;
2117
+ const I = (ee = f.current) == null ? void 0 : ee.getBoundingClientRect();
2118
+ I && d(ts(I));
2119
+ }, []), V = A(() => {
2120
+ d(null);
2121
+ }, []), z = A(
2122
+ (I) => $.length > 0 ? (I.stopPropagation(), he(I), i(We({ y: I.clientY, x: I.clientX })), !1) : !0,
2123
+ [$.length]
2124
+ ), O = A(
2125
+ (I) => {
2126
+ I.stopPropagation(), he(I), de(r);
2127
+ const ee = document.createEvent("MouseEvents");
2128
+ return ee.initEvent("dblclick", !0, !0), _ == null || _.dispatchEvent(ee), !1;
2129
+ },
2130
+ [r, _]
2131
+ ), Q = Ye(() => !C && p && X.bottom === -1 || X.bottom === e && X.right === n ? "gs-autofill-drag" : "gs-autofill-drag gs-hidden", [C, p, X]);
2132
+ return N ? _ ? /* @__PURE__ */ c(
2132
2133
  "td",
2133
2134
  {
2134
2135
  ref: f,
2135
2136
  "data-x": n,
2136
2137
  "data-y": e,
2137
2138
  "data-address": r,
2138
- className: `gs-cell ${ss(P, { y: e, x: n }) ? "gs-selecting" : ""} ${p ? "gs-choosing" : ""} ${S ? "gs-editing" : ""} ${q ? "gs-pending" : ""}`,
2139
+ className: `gs-cell ${ss(X, { y: e, x: n }) ? "gs-selecting" : ""} ${p ? "gs-choosing" : ""} ${C ? "gs-editing" : ""} ${q ? "gs-pending" : ""}`,
2139
2140
  style: {
2140
- ...g == null ? void 0 : g.style
2141
+ ...u == null ? void 0 : u.style
2141
2142
  },
2142
- onContextMenu: U,
2143
- onDoubleClick: X,
2143
+ onContextMenu: z,
2144
+ onDoubleClick: O,
2144
2145
  children: /* @__PURE__ */ F(
2145
2146
  "div",
2146
2147
  {
2147
2148
  className: "gs-cell-inner-wrap",
2148
- onMouseDown: ae,
2149
- onTouchStart: ae,
2150
- onMouseEnter: z,
2151
- onMouseUp: B,
2149
+ onMouseDown: ce,
2150
+ onTouchStart: ce,
2151
+ onMouseEnter: Z,
2152
+ onMouseUp: K,
2152
2153
  children: [
2153
2154
  /* @__PURE__ */ F(
2154
2155
  "div",
2155
2156
  {
2156
2157
  className: "gs-cell-inner",
2157
2158
  style: {
2158
- ...g == null ? void 0 : g.style,
2159
- justifyContent: (g == null ? void 0 : g.justifyContent) || "left",
2160
- alignItems: (g == null ? void 0 : g.alignItems) || "start"
2159
+ ...u == null ? void 0 : u.style,
2160
+ textAlign: ((Y = u == null ? void 0 : u.style) == null ? void 0 : Y.textAlign) || (u == null ? void 0 : u.justifyContent) || "left",
2161
+ alignItems: (u == null ? void 0 : u.alignItems) || "start"
2161
2162
  },
2162
2163
  children: [
2163
- A && /* @__PURE__ */ c(
2164
+ T && /* @__PURE__ */ c(
2164
2165
  "div",
2165
2166
  {
2166
2167
  className: "gs-formula-error-triangle",
@@ -2168,11 +2169,22 @@ const js = () => {
2168
2169
  onMouseLeave: V
2169
2170
  }
2170
2171
  ),
2171
- /* @__PURE__ */ c("div", { className: "gs-cell-rendered", children: C })
2172
+ /* @__PURE__ */ c(
2173
+ "div",
2174
+ {
2175
+ className: "gs-cell-rendered",
2176
+ style: u != null && u.alignItems ? {
2177
+ display: "flex",
2178
+ flexDirection: "column",
2179
+ justifyContent: u.alignItems === "center" ? "center" : u.alignItems === "end" ? "flex-end" : void 0
2180
+ } : void 0,
2181
+ children: R
2182
+ }
2183
+ )
2172
2184
  ]
2173
2185
  }
2174
2186
  ),
2175
- A && a && /* @__PURE__ */ c(
2187
+ T && a && /* @__PURE__ */ c(
2176
2188
  "div",
2177
2189
  {
2178
2190
  className: "gs-formula-error-tooltip",
@@ -2181,10 +2193,10 @@ const js = () => {
2181
2193
  left: a.x,
2182
2194
  transform: ns(a.hAlign)
2183
2195
  },
2184
- children: A
2196
+ children: T
2185
2197
  }
2186
2198
  ),
2187
- /* @__PURE__ */ c("div", { className: Q, onMouseDown: K })
2199
+ /* @__PURE__ */ c("div", { className: Q, onMouseDown: U })
2188
2200
  ]
2189
2201
  }
2190
2202
  )
@@ -2197,51 +2209,51 @@ const js = () => {
2197
2209
  }), qs = 0.4, Gs = 200;
2198
2210
  let Gt = (/* @__PURE__ */ new Date()).getTime(), Be = 0;
2199
2211
  function ke({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" }) {
2200
- const r = oe(null), { store: o, dispatch: i } = ie(le), {
2212
+ const r = ie(null), { store: o, dispatch: i } = le(ae), {
2201
2213
  tabularRef: h,
2202
2214
  autofillDraggingTo: f,
2203
2215
  dragging: a,
2204
- selectingZone: u,
2216
+ selectingZone: d,
2205
2217
  editorRef: w,
2206
2218
  sheetReactive: b,
2207
- searchInputRef: d,
2219
+ searchInputRef: g,
2208
2220
  editingAddress: m
2209
2221
  } = o, y = b.current;
2210
2222
  let D = !1;
2211
- const T = nt(o), N = !!(y != null && y.registry.editingAddress || m), Y = M(
2223
+ const E = nt(o), S = !!(y != null && y.registry.editingAddress || m), $ = A(
2212
2224
  (l) => {
2213
2225
  if (!y)
2214
2226
  return { x: -1, y: -1 };
2215
2227
  if (n == 0 && t == 0) {
2216
- const A = h.current.getBoundingClientRect(), { left: C, top: L, right: q, bottom: W } = A;
2217
- n = l.pageX > q ? 1 : l.pageX < C ? -1 : 0, n === 0 && (t = l.pageY > W ? 1 : l.pageY < L ? -1 : 0);
2228
+ const T = h.current.getBoundingClientRect(), { left: R, top: B, right: q, bottom: _ } = T;
2229
+ n = l.pageX > q ? 1 : l.pageX < R ? -1 : 0, n === 0 && (t = l.pageY > _ ? 1 : l.pageY < B ? -1 : 0);
2218
2230
  }
2219
- const g = Ht(h.current);
2220
- let { endX: v, endY: x } = u;
2221
- return n ? v = n > 0 ? g.right : g.left : t && (x = t > 0 ? g.bottom : g.top), { x: v, y: x };
2231
+ const u = Ht(h.current);
2232
+ let { endX: v, endY: x } = d;
2233
+ return n ? v = n > 0 ? u.right : u.left : t && (x = t > 0 ? u.bottom : u.top), { x: v, y: x };
2222
2234
  },
2223
- [y, n, t, u]
2224
- ), E = M(
2235
+ [y, n, t, d]
2236
+ ), N = A(
2225
2237
  (l) => {
2226
2238
  if (!D || h.current === null || !y)
2227
2239
  return;
2228
- const g = (/* @__PURE__ */ new Date()).getTime();
2229
- g - Gt > 1e3 && (Be = 0), Gt = g, h.current.scrollBy({
2240
+ const u = (/* @__PURE__ */ new Date()).getTime();
2241
+ u - Gt > 1e3 && (Be = 0), Gt = u, h.current.scrollBy({
2230
2242
  left: Be * n,
2231
2243
  top: Be * t
2232
- }), H(w.current);
2233
- const { x: v, y: x } = Y(l);
2244
+ }), L(w.current);
2245
+ const { x: v, y: x } = $(l);
2234
2246
  if (f) {
2235
- const { y: A, x: C } = f;
2236
- i(Ke({ y: x === -1 ? A : x, x: v === -1 ? C : v }));
2247
+ const { y: T, x: R } = f;
2248
+ i(Ke({ y: x === -1 ? T : x, x: v === -1 ? R : v }));
2237
2249
  } else {
2238
- if (N) {
2239
- const A = de({ ...u, endY: x, endX: v }), C = y.sheetPrefix(!T), L = sn(A), q = `${C}${L}`;
2250
+ if (S) {
2251
+ const T = ge({ ...d, endY: x, endX: v }), R = y.sheetPrefix(!E), B = sn(T), q = `${R}${B}`;
2240
2252
  Me({ input: w.current, ref: q });
2241
2253
  }
2242
2254
  i(fe({ y: x, x: v }));
2243
2255
  }
2244
- Be = Math.min(Be + qs, Gs), r.current = requestAnimationFrame(() => E(l));
2256
+ Be = Math.min(Be + qs, Gs), r.current = requestAnimationFrame(() => N(l));
2245
2257
  },
2246
2258
  [
2247
2259
  D,
@@ -2249,87 +2261,87 @@ function ke({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" })
2249
2261
  n,
2250
2262
  t,
2251
2263
  f,
2252
- N,
2253
- u,
2254
- T,
2255
- Y
2264
+ S,
2265
+ d,
2266
+ E,
2267
+ $
2256
2268
  ]
2257
- ), I = M(
2269
+ ), M = A(
2258
2270
  (l) => {
2259
2271
  if (l.preventDefault(), l.stopPropagation(), !D) {
2260
2272
  if (D = !0, n === 0 || t === 0) {
2261
- const g = h.current.getBoundingClientRect(), { left: v, top: x, right: A, bottom: C } = g;
2262
- n || (n = l.pageX > A ? 1 : l.pageX < v ? -1 : 0), n === 0 && (t || (t = l.pageY > C ? 1 : l.pageY < x ? -1 : 0));
2273
+ const u = h.current.getBoundingClientRect(), { left: v, top: x, right: T, bottom: R } = u;
2274
+ n || (n = l.pageX > T ? 1 : l.pageX < v ? -1 : 0), n === 0 && (t || (t = l.pageY > R ? 1 : l.pageY < x ? -1 : 0));
2263
2275
  }
2264
- r.current = requestAnimationFrame(() => E(l));
2276
+ r.current = requestAnimationFrame(() => N(l));
2265
2277
  }
2266
2278
  },
2267
- [D, n, t, E]
2268
- ), $ = M(() => {
2269
- r.current !== null && (cancelAnimationFrame(r.current), r.current = null), D = !1, rs(d.current) || H(w.current);
2270
- }, []), P = M(
2279
+ [D, n, t, N]
2280
+ ), P = A(() => {
2281
+ r.current !== null && (cancelAnimationFrame(r.current), r.current = null), D = !1, rs(g.current) || L(w.current);
2282
+ }, []), X = A(
2271
2283
  (l) => {
2272
2284
  l.preventDefault(), l.stopPropagation();
2273
- const g = Ht(h.current);
2274
- if (g.bottom === -1 || g.right === -1)
2285
+ const u = Ht(h.current);
2286
+ if (u.bottom === -1 || u.right === -1)
2275
2287
  return;
2276
- const { x: v, y: x } = Y(l);
2288
+ const { x: v, y: x } = $(l);
2277
2289
  if (f) {
2278
- const { y: A, x: C } = f;
2279
- i(vn({ y: x === -1 ? A : x, x: v === -1 ? C : v })), H(w.current);
2290
+ const { y: T, x: R } = f;
2291
+ i(vn({ y: x === -1 ? T : x, x: v === -1 ? R : v })), L(w.current);
2280
2292
  } else
2281
- N && i(fe({ y: -1, x: -1 }));
2293
+ S && i(fe({ y: -1, x: -1 }));
2282
2294
  },
2283
- [f, N, Y]
2284
- ), S = M(
2295
+ [f, S, $]
2296
+ ), C = A(
2285
2297
  (l) => {
2286
- $(), i(xe(!1)), requestAnimationFrame(() => P(l));
2298
+ P(), i(Ee(!1)), requestAnimationFrame(() => X(l));
2287
2299
  },
2288
- [$, P]
2289
- ), p = M(() => {
2290
- $();
2291
- }, [$]);
2292
- return Z(() => $, [$]), !w.current || !a && !f ? /* @__PURE__ */ c("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ c(
2300
+ [P, X]
2301
+ ), p = A(() => {
2302
+ P();
2303
+ }, [P]);
2304
+ return W(() => P, [P]), !w.current || !a && !f ? /* @__PURE__ */ c("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ c(
2293
2305
  "div",
2294
2306
  {
2295
2307
  style: e,
2296
2308
  className: `gs-scroll-handle ${s}`,
2297
2309
  onMouseUp: (l) => {
2298
- S(l);
2310
+ C(l);
2299
2311
  },
2300
- onMouseEnter: I,
2312
+ onMouseEnter: M,
2301
2313
  onMouseLeave: p
2302
2314
  }
2303
2315
  );
2304
2316
  }
2305
2317
  const Qs = tt(({ x: e }) => {
2306
- const n = me(e), { store: t, dispatch: s } = ie(le), {
2318
+ const n = me(e), { store: t, dispatch: s } = le(ae), {
2307
2319
  sheetReactive: r,
2308
2320
  editingAddress: o,
2309
2321
  choosing: i,
2310
2322
  selectingZone: h,
2311
2323
  topHeaderSelecting: f,
2312
2324
  editorRef: a,
2313
- autofillDraggingTo: u,
2325
+ autofillDraggingTo: d,
2314
2326
  dragging: w,
2315
2327
  contextMenu: b,
2316
- columnMenuState: d
2317
- } = t, m = r.current, y = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.width) || yt, T = !!(y != null && y.filter && y.filter.conditions.length > 0), N = nt(t), Y = m == null ? void 0 : m.registry.lastFocused, E = !!(m != null && m.registry.editingAddress || o), I = M(
2328
+ columnMenuState: g
2329
+ } = t, m = r.current, y = m == null ? void 0 : m.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.width) || yt, E = !!(y != null && y.filter && y.filter.conditions.length > 0), S = nt(t), $ = m == null ? void 0 : m.registry.lastFocused, N = !!(m != null && m.registry.editingAddress || o), M = A(
2318
2330
  (l) => {
2319
2331
  s(Ze({ value: l, point: i }));
2320
2332
  },
2321
2333
  [i]
2322
- ), $ = M((l) => {
2334
+ ), P = A((l) => {
2323
2335
  s(ht([e, l.clientX, l.clientX])), l.stopPropagation(), he(l);
2324
- }, []), P = M(
2336
+ }, []), X = A(
2325
2337
  (l) => {
2326
2338
  if (l.stopPropagation(), he(l), !Xe(l) || !m || w)
2327
2339
  return !1;
2328
2340
  if (l.type.startsWith("touch"))
2329
- return E && a.current && a.current.blur(), s(Pe({ y: 1, x: e })), s(be({ startY: 1, startX: e, endY: m.numRows, endX: e })), !0;
2341
+ return N && a.current && a.current.blur(), s(Pe({ y: 1, x: e })), s(be({ startY: 1, startX: e, endY: m.numRows, endX: e })), !0;
2330
2342
  s(be({ startY: 1, startX: e, endY: -1, endX: e }));
2331
- const g = `${m.sheetPrefix(!N)}${n}:${n}`;
2332
- if (E && Me({ input: Y || null, ref: g }))
2343
+ const u = `${m.sheetPrefix(!S)}${n}:${n}`;
2344
+ if (N && Me({ input: $ || null, ref: u }))
2333
2345
  return s(be({ startY: m.numRows, startX: e, endY: 0, endX: e })), !1;
2334
2346
  let v = l.shiftKey ? h.startX : e;
2335
2347
  return v === -1 && (v = i.x), s(
@@ -2337,37 +2349,37 @@ const Qs = tt(({ x: e }) => {
2337
2349
  range: { start: v, end: e },
2338
2350
  numRows: m.numRows
2339
2351
  })
2340
- ), E && I((Y == null ? void 0 : Y.value) ?? ""), s(ue("")), s(xe(!0)), H(a.current), !u;
2352
+ ), N && M(($ == null ? void 0 : $.value) ?? ""), s(de("")), s(Ee(!0)), L(a.current), !d;
2341
2353
  },
2342
2354
  [
2343
2355
  w,
2344
- E,
2345
2356
  N,
2357
+ S,
2346
2358
  n,
2347
- Y,
2359
+ $,
2348
2360
  h,
2349
2361
  i,
2350
- u,
2362
+ d,
2351
2363
  a
2352
2364
  ]
2353
- ), S = M(
2365
+ ), C = A(
2354
2366
  (l) => {
2355
- if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(xe(!1)), u))
2356
- return H(a.current), !1;
2367
+ if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(Ee(!1)), d))
2368
+ return L(a.current), !1;
2357
2369
  },
2358
- [u]
2370
+ [d]
2359
2371
  ), p = bn((l) => {
2360
2372
  if (!Xe(l) || !m || l.type.startsWith("touch"))
2361
2373
  return !1;
2362
- if (he(l), l.stopPropagation(), u)
2374
+ if (he(l), l.stopPropagation(), d)
2363
2375
  return s(Ke({ y: 1, x: e })), !1;
2364
- if (E) {
2365
- const g = de({ ...h, endY: 1, endX: e }), [v, x] = [me(g.left), me(g.right)], A = `${m.sheetPrefix(!N)}${v}:${x}`;
2366
- Me({ input: Y || null, ref: A });
2376
+ if (N) {
2377
+ const u = ge({ ...h, endY: 1, endX: e }), [v, x] = [me(u.left), me(u.right)], T = `${m.sheetPrefix(!S)}${v}:${x}`;
2378
+ Me({ input: $ || null, ref: T });
2367
2379
  }
2368
- if (u == null) {
2369
- const { startY: g } = h;
2370
- s(g === 1 ? fe({ y: m.numRows, x: e }) : fe({ y: 1, x: e }));
2380
+ if (d == null) {
2381
+ const { startY: u } = h;
2382
+ s(u === 1 ? fe({ y: m.numRows, x: e }) : fe({ y: 1, x: e }));
2371
2383
  }
2372
2384
  return !1;
2373
2385
  }, 100);
@@ -2377,15 +2389,15 @@ const Qs = tt(({ x: e }) => {
2377
2389
  "data-x": e,
2378
2390
  className: `gs-th gs-th-top ${i.x === e ? "gs-choosing" : ""} ${Te({ start: h.startX, end: h.endX }, e) ? f ? "gs-th-selecting" : "gs-selecting" : ""}`,
2379
2391
  style: { ...y == null ? void 0 : y.style, width: D, minWidth: D, maxWidth: D },
2380
- onContextMenu: (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(ze({ y: l.clientY, x: l.clientX })), !1) : !0,
2392
+ onContextMenu: (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(We({ y: l.clientY, x: l.clientX })), !1) : !0,
2381
2393
  children: /* @__PURE__ */ c(
2382
2394
  "div",
2383
2395
  {
2384
2396
  className: "gs-th-inner-wrap",
2385
- onMouseDown: P,
2386
- onTouchStart: P,
2397
+ onMouseDown: X,
2398
+ onTouchStart: X,
2387
2399
  onMouseEnter: p,
2388
- onMouseUp: S,
2400
+ onMouseUp: C,
2389
2401
  children: /* @__PURE__ */ F("div", { className: "gs-th-inner", style: { height: m.headerHeight, position: "relative" }, children: [
2390
2402
  /* @__PURE__ */ c(
2391
2403
  ke,
@@ -2404,20 +2416,20 @@ const Qs = tt(({ x: e }) => {
2404
2416
  l
2405
2417
  ] }) : l;
2406
2418
  })(),
2407
- !O.hasOperation(y == null ? void 0 : y.prevention, O.ColumnMenu) && /* @__PURE__ */ c(
2419
+ !H.hasOperation(y == null ? void 0 : y.prevention, H.ColumnMenu) && /* @__PURE__ */ c(
2408
2420
  "button",
2409
2421
  {
2410
- className: `gs-menu-btn gs-column-menu-btn ${T ? "gs-filtered" : ""} ${(d == null ? void 0 : d.x) === e ? "gs-active" : ""}`,
2422
+ className: `gs-menu-btn gs-column-menu-btn ${E ? "gs-filtered" : ""} ${(g == null ? void 0 : g.x) === e ? "gs-active" : ""}`,
2411
2423
  onMouseDown: (l) => {
2412
2424
  l.stopPropagation(), l.preventDefault(), l.currentTarget.dataset.pressX = String(l.clientX), l.currentTarget.dataset.pressY = String(l.clientY);
2413
2425
  },
2414
2426
  onMouseUp: (l) => {
2415
2427
  l.stopPropagation();
2416
- const g = l.currentTarget, v = Number(g.dataset.pressX ?? l.clientX), x = Number(g.dataset.pressY ?? l.clientY);
2428
+ const u = l.currentTarget, v = Number(u.dataset.pressX ?? l.clientX), x = Number(u.dataset.pressY ?? l.clientY);
2417
2429
  if (Math.abs(l.clientX - v) > 4 || Math.abs(l.clientY - x) > 4)
2418
2430
  return;
2419
- const C = g.getBoundingClientRect();
2420
- (d == null ? void 0 : d.x) === e ? s(Je(null)) : (Te({ start: h.startX, end: h.endX }, e) && h.startY === 1 && h.endY === m.numRows || s(Ut({ range: { start: e, end: e }, numRows: m.numRows })), s(Je({ x: e, position: { y: C.bottom, x: C.left } })));
2431
+ const R = u.getBoundingClientRect();
2432
+ (g == null ? void 0 : g.x) === e ? s(Je(null)) : (Te({ start: h.startX, end: h.endX }, e) && h.startY === 1 && h.endY === m.numRows || s(Ut({ range: { start: e, end: e }, numRows: m.numRows })), s(Je({ x: e, position: { y: R.bottom, x: R.left } })));
2421
2433
  },
2422
2434
  children: "⋮"
2423
2435
  }
@@ -2427,10 +2439,10 @@ const Qs = tt(({ x: e }) => {
2427
2439
  {
2428
2440
  className: `
2429
2441
  gs-resizer
2430
- ${O.hasOperation(y == null ? void 0 : y.prevention, O.Resize) ? "gs-protected" : ""}
2442
+ ${H.hasOperation(y == null ? void 0 : y.prevention, H.Resize) ? "gs-protected" : ""}
2431
2443
  ${w ? "gs-hidden" : ""}`,
2432
2444
  style: { height: m.headerHeight },
2433
- onMouseDown: $,
2445
+ onMouseDown: P,
2434
2446
  children: /* @__PURE__ */ c("i", {})
2435
2447
  }
2436
2448
  )
@@ -2443,75 +2455,75 @@ const Qs = tt(({ x: e }) => {
2443
2455
  /* @__PURE__ */ c("div", { className: "gs-resizer" })
2444
2456
  ] }) }) });
2445
2457
  }), Js = tt(({ y: e }) => {
2446
- const n = `${ve(e)}`, { store: t, dispatch: s } = ie(le), {
2458
+ const n = `${ve(e)}`, { store: t, dispatch: s } = le(ae), {
2447
2459
  choosing: r,
2448
2460
  editingAddress: o,
2449
2461
  selectingZone: i,
2450
2462
  leftHeaderSelecting: h,
2451
2463
  editorRef: f,
2452
2464
  sheetReactive: a,
2453
- autofillDraggingTo: u,
2465
+ autofillDraggingTo: d,
2454
2466
  dragging: w,
2455
2467
  contextMenu: b,
2456
- rowMenuState: d
2457
- } = t, m = a.current, y = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.height) || vt, T = nt(t), N = m == null ? void 0 : m.registry.lastFocused, Y = !!(m != null && m.registry.editingAddress || o), E = M(
2468
+ rowMenuState: g
2469
+ } = t, m = a.current, y = m == null ? void 0 : m.getCell({ y: e, x: 0 }, { resolution: "SYSTEM" }), D = (y == null ? void 0 : y.height) || vt, E = nt(t), S = m == null ? void 0 : m.registry.lastFocused, $ = !!(m != null && m.registry.editingAddress || o), N = A(
2458
2470
  (l) => {
2459
2471
  s(Ze({ value: l, point: r }));
2460
2472
  },
2461
2473
  [r]
2462
- ), I = M((l) => {
2474
+ ), M = A((l) => {
2463
2475
  s(gt([e, l.clientY, l.clientY])), l.stopPropagation(), he(l);
2464
- }, []), $ = M(
2476
+ }, []), P = A(
2465
2477
  (l) => {
2466
2478
  if (l.stopPropagation(), he(l), !Xe(l) || !m || w)
2467
2479
  return !1;
2468
2480
  if (l.type.startsWith("touch"))
2469
- return Y && f.current && f.current.blur(), s(Pe({ y: e, x: 1 })), s(be({ startY: e, startX: 1, endY: e, endX: m.numCols })), !0;
2481
+ return $ && f.current && f.current.blur(), s(Pe({ y: e, x: 1 })), s(be({ startY: e, startX: 1, endY: e, endX: m.numCols })), !0;
2470
2482
  s(be({ startY: e, startX: 1, endY: e, endX: -1 }));
2471
- const g = `${m.sheetPrefix(!T)}${n}:${n}`;
2472
- if (Y && Me({ input: N || null, ref: g }))
2483
+ const u = `${m.sheetPrefix(!E)}${n}:${n}`;
2484
+ if ($ && Me({ input: S || null, ref: u }))
2473
2485
  return s(be({ startY: e, startX: m.numCols, endY: e, endX: 0 })), !1;
2474
2486
  let v = l.shiftKey ? i.startY : e;
2475
2487
  return v === -1 && (v = r.y), s(
2476
- zt({
2488
+ Wt({
2477
2489
  range: { start: v, end: e },
2478
2490
  numCols: m.numCols
2479
2491
  })
2480
- ), Y && E((N == null ? void 0 : N.value) ?? ""), s(ue("")), s(xe(!0)), H(f.current), !u;
2492
+ ), $ && N((S == null ? void 0 : S.value) ?? ""), s(de("")), s(Ee(!0)), L(f.current), !d;
2481
2493
  },
2482
2494
  [
2483
2495
  w,
2484
- Y,
2485
- T,
2496
+ $,
2497
+ E,
2486
2498
  n,
2487
- N,
2499
+ S,
2488
2500
  i,
2489
2501
  r,
2490
- u,
2502
+ d,
2491
2503
  f
2492
2504
  ]
2493
- ), P = M(
2505
+ ), X = A(
2494
2506
  (l) => {
2495
- if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(xe(!1)), u))
2496
- return H(f.current), !1;
2507
+ if (l.stopPropagation(), !l.type.startsWith("touch") && (he(l), s(Ee(!1)), d))
2508
+ return L(f.current), !1;
2497
2509
  },
2498
- [u]
2499
- ), S = bn((l) => {
2510
+ [d]
2511
+ ), C = bn((l) => {
2500
2512
  if (!Xe(l) || !m || l.type.startsWith("touch"))
2501
2513
  return !1;
2502
- if (he(l), l.stopPropagation(), u)
2514
+ if (he(l), l.stopPropagation(), d)
2503
2515
  return s(Ke({ y: e, x: 1 })), !1;
2504
- if (Y) {
2505
- const g = de({ ...i, endY: e, endX: 1 }), [v, x] = [ve(g.top), ve(g.bottom)], A = `${m.sheetPrefix(!T)}${v}:${x}`;
2506
- Me({ input: N || null, ref: A });
2516
+ if ($) {
2517
+ const u = ge({ ...i, endY: e, endX: 1 }), [v, x] = [ve(u.top), ve(u.bottom)], T = `${m.sheetPrefix(!E)}${v}:${x}`;
2518
+ Me({ input: S || null, ref: T });
2507
2519
  }
2508
- if (u == null) {
2509
- const { startX: g } = i;
2510
- s(g === 1 ? fe({ y: e, x: m.numCols }) : fe({ y: e, x: 1 }));
2520
+ if (d == null) {
2521
+ const { startX: u } = i;
2522
+ s(u === 1 ? fe({ y: e, x: m.numCols }) : fe({ y: e, x: 1 }));
2511
2523
  }
2512
2524
  return !1;
2513
- }, 100), p = M(
2514
- (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(ze({ y: l.clientY, x: l.clientX })), !1) : !0,
2525
+ }, 100), p = A(
2526
+ (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(We({ y: l.clientY, x: l.clientX })), !1) : !0,
2515
2527
  [b.length]
2516
2528
  );
2517
2529
  return m ? /* @__PURE__ */ c(
@@ -2525,10 +2537,10 @@ const Qs = tt(({ x: e }) => {
2525
2537
  "div",
2526
2538
  {
2527
2539
  className: "gs-th-inner-wrap",
2528
- onMouseDown: $,
2529
- onTouchStart: $,
2530
- onMouseEnter: S,
2531
- onMouseUp: P,
2540
+ onMouseDown: P,
2541
+ onTouchStart: P,
2542
+ onMouseEnter: C,
2543
+ onMouseUp: X,
2532
2544
  children: /* @__PURE__ */ F("div", { className: "gs-th-inner", style: { width: m.headerWidth, position: "relative" }, children: [
2533
2545
  /* @__PURE__ */ c(
2534
2546
  ke,
@@ -2541,20 +2553,20 @@ const Qs = tt(({ x: e }) => {
2541
2553
  }
2542
2554
  ),
2543
2555
  bt(m, y == null ? void 0 : y.label, { y: e, x: 0 }, e) ?? n,
2544
- !O.hasOperation(y == null ? void 0 : y.prevention, O.RowMenu) && /* @__PURE__ */ c(
2556
+ !H.hasOperation(y == null ? void 0 : y.prevention, H.RowMenu) && /* @__PURE__ */ c(
2545
2557
  "button",
2546
2558
  {
2547
- className: `gs-menu-btn gs-row-menu-btn ${(d == null ? void 0 : d.y) === e ? "gs-active" : ""}`,
2559
+ className: `gs-menu-btn gs-row-menu-btn ${(g == null ? void 0 : g.y) === e ? "gs-active" : ""}`,
2548
2560
  onMouseDown: (l) => {
2549
2561
  l.stopPropagation(), l.preventDefault(), l.currentTarget.dataset.pressX = String(l.clientX), l.currentTarget.dataset.pressY = String(l.clientY);
2550
2562
  },
2551
2563
  onMouseUp: (l) => {
2552
2564
  l.stopPropagation();
2553
- const g = l.currentTarget, v = Number(g.dataset.pressX ?? l.clientX), x = Number(g.dataset.pressY ?? l.clientY);
2565
+ const u = l.currentTarget, v = Number(u.dataset.pressX ?? l.clientX), x = Number(u.dataset.pressY ?? l.clientY);
2554
2566
  if (Math.abs(l.clientX - v) > 4 || Math.abs(l.clientY - x) > 4)
2555
2567
  return;
2556
- const C = g.getBoundingClientRect();
2557
- (d == null ? void 0 : d.y) === e ? s(ft(null)) : (Te({ start: i.startY, end: i.endY }, e) && i.startX === 1 && i.endX === m.numCols || s(zt({ range: { start: e, end: e }, numCols: m.numCols })), s(ft({ y: e, position: { y: C.bottom, x: C.right } })));
2568
+ const R = u.getBoundingClientRect();
2569
+ (g == null ? void 0 : g.y) === e ? s(ft(null)) : (Te({ start: i.startY, end: i.endY }, e) && i.startX === 1 && i.endX === m.numCols || s(Wt({ range: { start: e, end: e }, numCols: m.numCols })), s(ft({ y: e, position: { y: R.bottom, x: R.right } })));
2558
2570
  },
2559
2571
  children: "⋮"
2560
2572
  }
@@ -2564,10 +2576,10 @@ const Qs = tt(({ x: e }) => {
2564
2576
  {
2565
2577
  className: `
2566
2578
  gs-resizer
2567
- ${O.hasOperation(y == null ? void 0 : y.prevention, O.Resize) ? "gs-protected" : ""}
2579
+ ${H.hasOperation(y == null ? void 0 : y.prevention, H.Resize) ? "gs-protected" : ""}
2568
2580
  ${w ? "gs-hidden" : ""}`,
2569
2581
  style: { width: m.headerWidth },
2570
- onMouseDown: I
2582
+ onMouseDown: M
2571
2583
  }
2572
2584
  )
2573
2585
  ] })
@@ -2579,14 +2591,14 @@ const Qs = tt(({ x: e }) => {
2579
2591
  e.fillStyle = o, e.fillRect(n, t, s, r);
2580
2592
  }, pt = (e, n, t, s, r, o, i = 2, h = [], f) => {
2581
2593
  f && (e.fillStyle = f, e.fillRect(n, t, s, r)), e.strokeStyle = o, e.lineWidth = i, e.setLineDash(h), e.strokeRect(n + i / 2, t + i / 2, s - i, r - i), e.setLineDash([]);
2582
- }, Ve = (e, n, t, s, r, o, i, h, f = 2, a = [], u) => {
2583
- const { top: w, left: b, bottom: d, right: m } = i;
2584
- if (w === -1 || b === -1 || d === -1 || m === -1)
2594
+ }, Ve = (e, n, t, s, r, o, i, h, f = 2, a = [], d) => {
2595
+ const { top: w, left: b, bottom: g, right: m } = i;
2596
+ if (w === -1 || b === -1 || g === -1 || m === -1)
2585
2597
  return;
2586
- const y = Ie(n, { y: w, x: b }), D = Ie(n, { y: d, x: m }), T = y.left - s, N = y.top - t, Y = D.right - s, E = D.bottom - t;
2587
- Y < 0 || T > r || E < 0 || N > o || pt(e, T, N, Y - T, E - N, h, f, a, u);
2598
+ const y = Ie(n, { y: w, x: b }), D = Ie(n, { y: g, x: m }), E = y.left - s, S = y.top - t, $ = D.right - s, N = D.bottom - t;
2599
+ $ < 0 || E > r || N < 0 || S > o || pt(e, E, S, $ - E, N - S, h, f, a, d);
2588
2600
  }, lr = ({ refs: e = {} }) => {
2589
- const { store: n } = ie(le), {
2601
+ const { store: n } = le(ae), {
2590
2602
  sheetReactive: t,
2591
2603
  tabularRef: s,
2592
2604
  choosing: r,
@@ -2595,54 +2607,54 @@ const Qs = tt(({ x: e }) => {
2595
2607
  matchingCellIndex: h,
2596
2608
  autofillDraggingTo: f,
2597
2609
  topHeaderSelecting: a,
2598
- leftHeaderSelecting: u,
2610
+ leftHeaderSelecting: d,
2599
2611
  mode: w,
2600
2612
  dragging: b
2601
- } = n, d = t.current, m = oe(null), y = oe(0), D = oe(n);
2613
+ } = n, g = t.current, m = ie(null), y = ie(0), D = ie(n);
2602
2614
  D.current = n;
2603
- const T = M(() => {
2604
- if (!d || !s.current || !m.current)
2615
+ const E = A(() => {
2616
+ if (!g || !s.current || !m.current)
2605
2617
  return;
2606
- const E = m.current, I = E.getContext("2d");
2607
- if (!I)
2618
+ const N = m.current, M = N.getContext("2d");
2619
+ if (!M)
2608
2620
  return;
2609
- const $ = s.current, P = window.devicePixelRatio || 1, S = $.clientWidth, p = $.clientHeight;
2610
- (E.width !== S * P || E.height !== p * P) && (E.style.width = `${S}px`, E.style.height = `${p}px`, E.width = S * P, E.height = p * P), I.setTransform(P, 0, 0, P, 0, 0), I.clearRect(0, 0, S, p);
2611
- const { registry: l } = d, g = $.scrollTop, v = $.scrollLeft, x = d.headerWidth, A = d.headerHeight;
2612
- I.save(), I.beginPath(), I.rect(x, A, S - x, p - A), I.clip();
2613
- const C = de(o);
2614
- if (Ve(I, d, g, v, S, p, C, er, 1, [], tr), f) {
2615
- const B = new os(D.current, f);
2616
- Ve(I, d, g, v, S, p, B.wholeArea, ir, 1, [5, 5]);
2621
+ const P = s.current, X = window.devicePixelRatio || 1, C = P.clientWidth, p = P.clientHeight;
2622
+ (N.width !== C * X || N.height !== p * X) && (N.style.width = `${C}px`, N.style.height = `${p}px`, N.width = C * X, N.height = p * X), M.setTransform(X, 0, 0, X, 0, 0), M.clearRect(0, 0, C, p);
2623
+ const { registry: l } = g, u = P.scrollTop, v = P.scrollLeft, x = g.headerWidth, T = g.headerHeight;
2624
+ M.save(), M.beginPath(), M.rect(x, T, C - x, p - T), M.clip();
2625
+ const R = ge(o);
2626
+ if (Ve(M, g, u, v, C, p, R, er, 1, [], tr), f) {
2627
+ const K = new os(D.current, f);
2628
+ Ve(M, g, u, v, C, p, K.wholeArea, ir, 1, [5, 5]);
2617
2629
  }
2618
2630
  {
2619
- const { y: B, x: z } = r;
2620
- if (B !== -1 && z !== -1) {
2621
- const K = Ie(d, { y: B, x: z }), G = K.left - v, V = K.top - g;
2622
- pt(I, G, V, K.width, K.height, it, 2, []);
2631
+ const { y: K, x: Z } = r;
2632
+ if (K !== -1 && Z !== -1) {
2633
+ const U = Ie(g, { y: K, x: Z }), G = U.left - v, V = U.top - u;
2634
+ pt(M, G, V, U.width, U.height, it, 2, []);
2623
2635
  }
2624
2636
  }
2625
- const { copyingSheetId: L, copyingZone: q, cutting: W } = l;
2626
- if (d.id === L) {
2627
- const B = de(q);
2628
- Ve(I, d, g, v, S, p, B, W ? sr : nr, 2.5, W ? [4, 4] : [6, 4]);
2637
+ const { copyingSheetId: B, copyingZone: q, cutting: _ } = l;
2638
+ if (g.id === B) {
2639
+ const K = ge(q);
2640
+ Ve(M, g, u, v, C, p, K, _ ? sr : nr, 2.5, _ ? [4, 4] : [6, 4]);
2629
2641
  }
2630
- Object.entries(e).forEach(([B, z]) => {
2631
- const K = De[z % De.length];
2642
+ Object.entries(e).forEach(([K, Z]) => {
2643
+ const U = De[Z % De.length];
2632
2644
  try {
2633
- const G = d.rangeToArea(B);
2634
- Ve(I, d, g, v, S, p, G, K, 2, [5, 5]);
2645
+ const G = g.rangeToArea(K);
2646
+ Ve(M, g, u, v, C, p, G, U, 2, [5, 5]);
2635
2647
  } catch {
2636
2648
  }
2637
- }), i.forEach((B, z) => {
2638
- const { y: K, x: G } = wt(B), V = Ie(d, { y: K, x: G }), U = V.left - v, X = V.top - g;
2639
- if (U + V.width < 0 || U > S || X + V.height < 0 || X > p)
2649
+ }), i.forEach((K, Z) => {
2650
+ const { y: U, x: G } = wt(K), V = Ie(g, { y: U, x: G }), z = V.left - v, O = V.top - u;
2651
+ if (z + V.width < 0 || z > C || O + V.height < 0 || O > p)
2640
2652
  return;
2641
- const Q = z === h;
2653
+ const Q = Z === h;
2642
2654
  pt(
2643
- I,
2644
- U,
2645
- X,
2655
+ M,
2656
+ z,
2657
+ O,
2646
2658
  V.width,
2647
2659
  V.height,
2648
2660
  Q ? or : "transparent",
@@ -2650,32 +2662,32 @@ const Qs = tt(({ x: e }) => {
2650
2662
  [],
2651
2663
  rr
2652
2664
  );
2653
- }), I.restore();
2654
- const ne = d.numCols, ae = d.numRows;
2655
- for (let B = 1; B <= ne; B++) {
2656
- let z = null, K = null;
2657
- if (Te({ start: o.startX, end: o.endX }, B) && (z = "rgba(80, 180, 255, 1)", K = a ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === B && (z = it, K = a ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !z)
2665
+ }), M.restore();
2666
+ const se = g.numCols, ce = g.numRows;
2667
+ for (let K = 1; K <= se; K++) {
2668
+ let Z = null, U = null;
2669
+ if (Te({ start: o.startX, end: o.endX }, K) && (Z = "rgba(80, 180, 255, 1)", U = a ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === K && (Z = it, U = a ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !Z)
2658
2670
  continue;
2659
- const G = Ie(d, { y: 1, x: B }), V = G.left - v;
2660
- if (V + G.width < x || V > S)
2671
+ const G = Ie(g, { y: 1, x: K }), V = G.left - v;
2672
+ if (V + G.width < x || V > C)
2661
2673
  continue;
2662
- const U = Math.max(V, x), X = Math.min(V + G.width, S) - U;
2663
- X > 0 && (K && Qt(I, U, 0, X, A, K), I.strokeStyle = z, I.lineWidth = 2, I.beginPath(), I.moveTo(U, A + 1), I.lineTo(U + X, A + 1), I.stroke());
2674
+ const z = Math.max(V, x), O = Math.min(V + G.width, C) - z;
2675
+ O > 0 && (U && Qt(M, z, 0, O, T, U), M.strokeStyle = Z, M.lineWidth = 2, M.beginPath(), M.moveTo(z, T + 1), M.lineTo(z + O, T + 1), M.stroke());
2664
2676
  }
2665
- for (let B = 1; B <= ae; B++) {
2666
- if (d.isRowFiltered(B))
2677
+ for (let K = 1; K <= ce; K++) {
2678
+ if (g.isRowFiltered(K))
2667
2679
  continue;
2668
- let z = null, K = null;
2669
- if (Te({ start: o.startY, end: o.endY }, B) && (z = "rgba(80, 180, 255, 1)", K = u ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === B && (z = it, K = u ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !z)
2680
+ let Z = null, U = null;
2681
+ if (Te({ start: o.startY, end: o.endY }, K) && (Z = "rgba(80, 180, 255, 1)", U = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === K && (Z = it, U = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !Z)
2670
2682
  continue;
2671
- const G = Ie(d, { y: B, x: 1 }), V = G.top - g;
2672
- if (V + G.height < A || V > p)
2683
+ const G = Ie(g, { y: K, x: 1 }), V = G.top - u;
2684
+ if (V + G.height < T || V > p)
2673
2685
  continue;
2674
- const U = Math.max(V, A), X = Math.min(V + G.height, p) - U;
2675
- X > 0 && (K && Qt(I, 0, U, x, X, K), I.strokeStyle = z, I.lineWidth = 2, I.beginPath(), I.moveTo(x + 1, U), I.lineTo(x + 1, U + X), I.stroke());
2686
+ const z = Math.max(V, T), O = Math.min(V + G.height, p) - z;
2687
+ O > 0 && (U && Qt(M, 0, z, x, O, U), M.strokeStyle = Z, M.lineWidth = 2, M.beginPath(), M.moveTo(x + 1, z), M.lineTo(x + 1, z + O), M.stroke());
2676
2688
  }
2677
2689
  }, [
2678
- d,
2690
+ g,
2679
2691
  s,
2680
2692
  r,
2681
2693
  o,
@@ -2683,22 +2695,25 @@ const Qs = tt(({ x: e }) => {
2683
2695
  h,
2684
2696
  f,
2685
2697
  a,
2686
- u,
2698
+ d,
2687
2699
  w,
2688
2700
  b,
2689
2701
  e
2690
- ]), N = M(() => {
2691
- cancelAnimationFrame(y.current), y.current = requestAnimationFrame(T);
2692
- }, [T]), Y = M(() => {
2693
- T();
2694
- }, [T]);
2695
- return Z(() => (N(), () => cancelAnimationFrame(y.current)), [N]), Z(() => {
2696
- const E = s.current;
2697
- if (E)
2698
- return E.addEventListener("scroll", Y), () => {
2699
- E.removeEventListener("scroll", Y);
2700
- };
2701
- }, [s, Y]), /* @__PURE__ */ c(
2702
+ ]), S = A(() => {
2703
+ cancelAnimationFrame(y.current), y.current = requestAnimationFrame(E);
2704
+ }, [E]), $ = A(() => {
2705
+ E();
2706
+ }, [E]);
2707
+ return W(() => (S(), () => cancelAnimationFrame(y.current)), [S]), W(() => {
2708
+ const N = s.current;
2709
+ if (!N)
2710
+ return;
2711
+ N.addEventListener("scroll", $);
2712
+ const M = new ResizeObserver(() => E());
2713
+ return M.observe(N), () => {
2714
+ N.removeEventListener("scroll", $), M.disconnect();
2715
+ };
2716
+ }, [s, $, E]), /* @__PURE__ */ c(
2702
2717
  "div",
2703
2718
  {
2704
2719
  style: {
@@ -2725,27 +2740,27 @@ const Qs = tt(({ x: e }) => {
2725
2740
  }
2726
2741
  );
2727
2742
  }, ar = () => {
2728
- var $, P, S, p, l, g, v, x, A;
2729
- const [e, n] = J({}), { store: t, dispatch: s } = ie(le), {
2743
+ var P, X, C, p, l, u, v, x, T;
2744
+ const [e, n] = te({}), { store: t, dispatch: s } = le(ae), {
2730
2745
  sheetReactive: r,
2731
2746
  choosing: o,
2732
2747
  editingAddress: i,
2733
2748
  tabularRef: h,
2734
2749
  mainRef: f,
2735
2750
  sheetWidth: a,
2736
- sheetHeight: u,
2751
+ sheetHeight: d,
2737
2752
  inputting: w,
2738
2753
  leftHeaderSelecting: b,
2739
- topHeaderSelecting: d,
2754
+ topHeaderSelecting: g,
2740
2755
  contextMenu: m
2741
- } = t, y = r.current, [D, T] = J(null), N = M((C) => {
2742
- C.preventDefault(), C.stopPropagation();
2743
- }, []), Y = M(
2744
- (C) => {
2745
- y && T(Lt(y, C.currentTarget));
2756
+ } = t, y = r.current, [D, E] = te(null), S = A((R) => {
2757
+ R.preventDefault(), R.stopPropagation();
2758
+ }, []), $ = A(
2759
+ (R) => {
2760
+ y && E(Lt(y, R.currentTarget));
2746
2761
  },
2747
2762
  [r]
2748
- ), E = M(() => {
2763
+ ), N = A(() => {
2749
2764
  y && (s(Pe({ y: -1, x: -1 })), requestAnimationFrame(() => {
2750
2765
  s(Pe({ y: 1, x: 1 })), s(
2751
2766
  be({
@@ -2757,38 +2772,38 @@ const Qs = tt(({ x: e }) => {
2757
2772
  );
2758
2773
  }));
2759
2774
  }, [r]);
2760
- Z(() => {
2775
+ W(() => {
2761
2776
  if (!y)
2762
2777
  return;
2763
2778
  if (!(i && w.startsWith("="))) {
2764
2779
  n({}), y.registry.paletteBySheetName = {};
2765
2780
  return;
2766
2781
  }
2767
- const L = {}, q = {}, W = new qe(w.substring(1));
2768
- W.tokenize();
2769
- let ne = 0;
2770
- for (const ae of W.tokens)
2771
- if (ae.type === "REF" || ae.type === "RANGE") {
2772
- const B = is(ae.stringify()), z = B.indexOf("!");
2773
- if (z !== -1) {
2774
- const K = B.substring(0, z), G = B.substring(z + 1), V = ls(K), U = G.toUpperCase();
2775
- q[V] == null && (q[V] = {}), q[V][U] == null && (q[V][U] = ne++);
2782
+ const B = {}, q = {}, _ = new qe(w.substring(1));
2783
+ _.tokenize();
2784
+ let se = 0;
2785
+ for (const ce of _.tokens)
2786
+ if (ce.type === "REF" || ce.type === "RANGE") {
2787
+ const K = is(ce.stringify()), Z = K.indexOf("!");
2788
+ if (Z !== -1) {
2789
+ const U = K.substring(0, Z), G = K.substring(Z + 1), V = ls(U), z = G.toUpperCase();
2790
+ q[V] == null && (q[V] = {}), q[V][z] == null && (q[V][z] = se++);
2776
2791
  } else {
2777
- const K = B.toUpperCase();
2778
- L[K] == null && (L[K] = ne++);
2792
+ const U = K.toUpperCase();
2793
+ B[U] == null && (B[U] = se++);
2779
2794
  }
2780
2795
  }
2781
- n(L), y.registry.paletteBySheetName = q;
2782
- }, [t.inputting, t.editingAddress, r]), Z(() => {
2796
+ n(B), y.registry.paletteBySheetName = q;
2797
+ }, [t.inputting, t.editingAddress, r]), W(() => {
2783
2798
  y && (y.registry.choosingAddress = Ne(o), y.registry.choosingSheetId = y.id);
2784
- }, [o]), Z(() => {
2785
- y && T(Lt(y, h.current));
2786
- }, [h.current, r, ($ = f.current) == null ? void 0 : $.clientHeight, (P = f.current) == null ? void 0 : P.clientWidth]), Z(() => {
2787
- const C = h.current;
2788
- if (C)
2789
- return as(C);
2799
+ }, [o]), W(() => {
2800
+ y && E(Lt(y, h.current));
2801
+ }, [h.current, r, (P = f.current) == null ? void 0 : P.clientHeight, (X = f.current) == null ? void 0 : X.clientWidth]), W(() => {
2802
+ const R = h.current;
2803
+ if (R)
2804
+ return as(R);
2790
2805
  }, [r]);
2791
- const I = {
2806
+ const M = {
2792
2807
  ...e,
2793
2808
  ...y ? y.registry.paletteBySheetName[y.name] : {}
2794
2809
  };
@@ -2798,21 +2813,22 @@ const Qs = tt(({ x: e }) => {
2798
2813
  className: "gs-tabular",
2799
2814
  style: {
2800
2815
  width: a === -1 ? void 0 : a,
2801
- height: u === -1 ? void 0 : u
2816
+ height: d === -1 ? void 0 : d
2802
2817
  },
2803
2818
  ref: h,
2804
- onMouseMove: N,
2805
- onScroll: Y,
2819
+ onMouseMove: S,
2820
+ onScroll: $,
2806
2821
  children: /* @__PURE__ */ F(
2807
2822
  "div",
2808
2823
  {
2809
2824
  className: "gs-tabular-inner",
2810
2825
  style: {
2811
- width: y.totalWidth + 1,
2812
- height: y.totalHeight + 1
2826
+ width: y.totalWidth,
2827
+ height: y.totalHeight,
2828
+ overflow: "clip"
2813
2829
  },
2814
2830
  children: [
2815
- /* @__PURE__ */ c(lr, { refs: I }),
2831
+ /* @__PURE__ */ c(lr, { refs: M }),
2816
2832
  /* @__PURE__ */ F("table", { className: "gs-table", children: [
2817
2833
  /* @__PURE__ */ c("thead", { className: "gs-thead", style: { height: y.headerHeight }, children: /* @__PURE__ */ F("tr", { className: "gs-row", children: [
2818
2834
  /* @__PURE__ */ c(
@@ -2820,32 +2836,32 @@ const Qs = tt(({ x: e }) => {
2820
2836
  {
2821
2837
  className: "gs-th gs-th-left gs-th-top",
2822
2838
  style: { position: "sticky", width: y.headerWidth, height: y.headerHeight },
2823
- onClick: E,
2839
+ onClick: N,
2824
2840
  children: /* @__PURE__ */ F("div", { className: "gs-th-inner", children: [
2825
2841
  /* @__PURE__ */ c(
2826
2842
  ke,
2827
2843
  {
2828
- className: b || d ? "gs-hidden" : "",
2844
+ className: b || g ? "gs-hidden" : "",
2829
2845
  style: { position: "absolute" },
2830
2846
  horizontal: b ? 0 : -1,
2831
- vertical: d ? 0 : -1
2847
+ vertical: g ? 0 : -1
2832
2848
  }
2833
2849
  ),
2834
2850
  m.length > 0 && /* @__PURE__ */ c(
2835
2851
  "button",
2836
2852
  {
2837
2853
  className: "gs-menu-btn gs-corner-menu-btn",
2838
- onClick: (C) => C.stopPropagation(),
2839
- onMouseDown: (C) => {
2840
- C.preventDefault(), C.currentTarget.dataset.pressX = String(C.clientX), C.currentTarget.dataset.pressY = String(C.clientY);
2854
+ onClick: (R) => R.stopPropagation(),
2855
+ onMouseDown: (R) => {
2856
+ R.preventDefault(), R.currentTarget.dataset.pressX = String(R.clientX), R.currentTarget.dataset.pressY = String(R.clientY);
2841
2857
  },
2842
- onMouseUp: (C) => {
2843
- C.stopPropagation();
2844
- const L = C.currentTarget, q = Number(L.dataset.pressX ?? C.clientX), W = Number(L.dataset.pressY ?? C.clientY);
2845
- if (Math.abs(C.clientX - q) > 4 || Math.abs(C.clientY - W) > 4)
2858
+ onMouseUp: (R) => {
2859
+ R.stopPropagation();
2860
+ const B = R.currentTarget, q = Number(B.dataset.pressX ?? R.clientX), _ = Number(B.dataset.pressY ?? R.clientY);
2861
+ if (Math.abs(R.clientX - q) > 4 || Math.abs(R.clientY - _) > 4)
2846
2862
  return;
2847
- const ae = L.getBoundingClientRect();
2848
- s(ze({ y: ae.bottom, x: ae.left }));
2863
+ const ce = B.getBoundingClientRect();
2864
+ s(We({ y: ce.bottom, x: ce.left }));
2849
2865
  },
2850
2866
  children: "⋮"
2851
2867
  }
@@ -2857,15 +2873,15 @@ const Qs = tt(({ x: e }) => {
2857
2873
  "th",
2858
2874
  {
2859
2875
  className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left",
2860
- style: { width: ((S = D == null ? void 0 : D.adjuster) == null ? void 0 : S.left) ?? 1 }
2876
+ style: { width: ((C = D == null ? void 0 : D.adjuster) == null ? void 0 : C.left) ?? 1 }
2861
2877
  }
2862
2878
  ),
2863
- (l = (p = D == null ? void 0 : D.xs) == null ? void 0 : p.map) == null ? void 0 : l.call(p, (C) => /* @__PURE__ */ c(Qs, { x: C }, C)),
2879
+ (l = (p = D == null ? void 0 : D.xs) == null ? void 0 : p.map) == null ? void 0 : l.call(p, (R) => /* @__PURE__ */ c(Qs, { x: R }, R)),
2864
2880
  /* @__PURE__ */ c(
2865
2881
  "th",
2866
2882
  {
2867
2883
  className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right",
2868
- style: { width: (g = D == null ? void 0 : D.adjuster) == null ? void 0 : g.right }
2884
+ style: { width: (u = D == null ? void 0 : D.adjuster) == null ? void 0 : u.right }
2869
2885
  }
2870
2886
  )
2871
2887
  ] }) }),
@@ -2878,17 +2894,17 @@ const Qs = tt(({ x: e }) => {
2878
2894
  }
2879
2895
  ),
2880
2896
  /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-vertical" }),
2881
- (x = D == null ? void 0 : D.xs) == null ? void 0 : x.map((C) => /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-vertical" }, C)),
2897
+ (x = D == null ? void 0 : D.xs) == null ? void 0 : x.map((R) => /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-vertical" }, R)),
2882
2898
  /* @__PURE__ */ c("th", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-vertical" })
2883
2899
  ] }) }),
2884
- /* @__PURE__ */ c("tbody", { className: "gs-sheet-body-data", children: (A = D == null ? void 0 : D.ys) == null ? void 0 : A.map((C) => {
2885
- var L;
2886
- return /* @__PURE__ */ F("tr", { className: `gs-row ${C % 2 === 0 ? "gs-row-even" : "gs-row-odd"}`, children: [
2887
- /* @__PURE__ */ c(Js, { y: C }),
2900
+ /* @__PURE__ */ c("tbody", { className: "gs-sheet-body-data", children: (T = D == null ? void 0 : D.ys) == null ? void 0 : T.map((R) => {
2901
+ var B;
2902
+ return /* @__PURE__ */ F("tr", { className: `gs-row ${R % 2 === 0 ? "gs-row-even" : "gs-row-odd"}`, children: [
2903
+ /* @__PURE__ */ c(Js, { y: R }),
2888
2904
  /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-left" }),
2889
- (L = D == null ? void 0 : D.xs) == null ? void 0 : L.map((q) => /* @__PURE__ */ c(Vs, { y: C, x: q }, q)),
2905
+ (B = D == null ? void 0 : D.xs) == null ? void 0 : B.map((q) => /* @__PURE__ */ c(Vs, { y: R, x: q }, q)),
2890
2906
  /* @__PURE__ */ c("td", { className: "gs-adjuster gs-adjuster-horizontal gs-adjuster-horizontal-right" })
2891
- ] }, C);
2907
+ ] }, R);
2892
2908
  }) })
2893
2909
  ] })
2894
2910
  ]
@@ -2897,202 +2913,202 @@ const Qs = tt(({ x: e }) => {
2897
2913
  }
2898
2914
  ) });
2899
2915
  }, cr = ({ ready: e }) => {
2900
- var X, Q;
2901
- const { store: n, dispatch: t } = ie(le), [s, r] = J(""), [o, i] = J(0), [h, f] = J(!1), {
2916
+ var O, Q;
2917
+ const { store: n, dispatch: t } = le(ae), [s, r] = te(""), [o, i] = te(0), [h, f] = te(!1), {
2902
2918
  choosing: a,
2903
- selectingZone: u,
2919
+ selectingZone: d,
2904
2920
  editorRef: w,
2905
2921
  largeEditorRef: b,
2906
- sheetReactive: d,
2922
+ sheetReactive: g,
2907
2923
  inputting: m,
2908
2924
  editingAddress: y,
2909
2925
  dragging: D
2910
- } = n, T = d.current, N = oe(null), Y = a.x === -1 ? "" : Ne(a), E = T == null ? void 0 : T.getCell(a, { resolution: "SYSTEM" }), I = (X = T == null ? void 0 : T.getSystem(a)) == null ? void 0 : X.spilledFrom, $ = I ? wt(I) : void 0, P = $ != null ? Ne($) : void 0;
2911
- Z(() => {
2912
- var _;
2913
- if (!T)
2926
+ } = n, E = g.current, S = ie(null), $ = a.x === -1 ? "" : Ne(a), N = E == null ? void 0 : E.getCell(a, { resolution: "SYSTEM" }), M = (O = E == null ? void 0 : E.getSystem(a)) == null ? void 0 : O.spilledFrom, P = M ? wt(M) : void 0, X = P != null ? Ne(P) : void 0;
2927
+ W(() => {
2928
+ var I;
2929
+ if (!E)
2914
2930
  return;
2915
- let R = ((_ = T.getCell(a, { resolution: "SYSTEM" })) == null ? void 0 : _.value) ?? "";
2916
- R = T.getSerializedValue({ point: a, cell: { ...E, value: R }, resolution: "RAW" }), b.current.value = R, r(R);
2917
- }, [Y, T]);
2918
- const S = M(
2919
- (R) => {
2920
- s !== R && t(Ze({ value: R })), t(ue("")), H(w.current);
2931
+ let Y = ((I = E.getCell(a, { resolution: "SYSTEM" })) == null ? void 0 : I.value) ?? "";
2932
+ Y = E.getSerializedValue({ point: a, cell: { ...N, value: Y }, resolution: "RAW" }), b.current.value = Y, r(Y);
2933
+ }, [$, E]);
2934
+ const C = A(
2935
+ (Y) => {
2936
+ s !== Y && t(Ze({ value: Y })), t(de("")), L(w.current);
2921
2937
  },
2922
2938
  [s]
2923
2939
  );
2924
- Z(() => {
2925
- const R = new ResizeObserver((_) => {
2926
- _.forEach(B);
2940
+ W(() => {
2941
+ const Y = new ResizeObserver((I) => {
2942
+ I.forEach(K);
2927
2943
  });
2928
- return b.current && R.observe(b.current), () => {
2929
- R.disconnect();
2944
+ return b.current && Y.observe(b.current), () => {
2945
+ Y.disconnect();
2930
2946
  };
2931
2947
  }, []);
2932
- const p = T == null ? void 0 : T.getPolicy(a), l = (p == null ? void 0 : p.getSelectOptions()) || [], {
2933
- filteredOptions: g,
2948
+ const p = E == null ? void 0 : E.getPolicy(a), l = (p == null ? void 0 : p.getSelectOptions()) || [], {
2949
+ filteredOptions: u,
2934
2950
  selected: v,
2935
2951
  replaceWithOption: x,
2936
- handleArrowUp: A,
2937
- handleArrowDown: C,
2938
- activeFunctionHelp: L,
2952
+ handleArrowUp: T,
2953
+ handleArrowDown: R,
2954
+ activeFunctionHelp: B,
2939
2955
  activeArgIndex: q
2940
2956
  } = Rn({
2941
2957
  inputting: m,
2942
2958
  selectionStart: o,
2943
2959
  optionsAll: l,
2944
- functions: T == null ? void 0 : T.registry.functions
2945
- }), W = b.current, ne = M((R) => {
2946
- t(re(R.currentTarget.value)), i(R.currentTarget.selectionStart);
2947
- }, []), ae = M((R) => {
2948
- i(R.currentTarget.selectionStart);
2949
- }, []), B = M(() => {
2950
- !N.current || !b.current || (N.current.style.height = `${b.current.clientHeight}px`, N.current.scrollLeft = b.current.scrollLeft, N.current.scrollTop = b.current.scrollTop);
2951
- }, []), z = M(
2952
- (R) => {
2953
- !W || !T || (f(!0), t(ue(Y)), T.registry.lastFocused = R.currentTarget);
2954
- },
2955
- [W, Y, T]
2960
+ functions: E == null ? void 0 : E.registry.functions
2961
+ }), _ = b.current, se = A((Y) => {
2962
+ t(oe(Y.currentTarget.value)), i(Y.currentTarget.selectionStart);
2963
+ }, []), ce = A((Y) => {
2964
+ i(Y.currentTarget.selectionStart);
2965
+ }, []), K = A(() => {
2966
+ !S.current || !b.current || (S.current.style.height = `${b.current.clientHeight}px`, S.current.scrollLeft = b.current.scrollLeft, S.current.scrollTop = b.current.scrollTop);
2967
+ }, []), Z = A(
2968
+ (Y) => {
2969
+ !_ || !E || (f(!0), t(de($)), E.registry.lastFocused = Y.currentTarget);
2970
+ },
2971
+ [_, $, E]
2956
2972
  );
2957
- M(
2958
- (R) => {
2959
- if (f(!1), R.currentTarget.value.startsWith("="))
2973
+ A(
2974
+ (Y) => {
2975
+ if (f(!1), Y.currentTarget.value.startsWith("="))
2960
2976
  return !0;
2961
- y && S(R.currentTarget.value);
2977
+ y && C(Y.currentTarget.value);
2962
2978
  },
2963
- [y, S]
2979
+ [y, C]
2964
2980
  );
2965
- const K = M(
2966
- (R) => {
2967
- if (R.ctrlKey || !T)
2981
+ const U = A(
2982
+ (Y) => {
2983
+ if (Y.ctrlKey || !E)
2968
2984
  return !0;
2969
- const _ = R.currentTarget;
2970
- if (en(R, m))
2971
- return t(re(_.value)), !1;
2972
- switch (R.key) {
2985
+ const I = Y.currentTarget;
2986
+ if (en(Y, m))
2987
+ return t(oe(I.value)), !1;
2988
+ switch (Y.key) {
2973
2989
  case "Tab":
2974
- if (R.preventDefault(), g.length) {
2975
- const ee = g[v];
2976
- if (ee == null ? void 0 : ee.isFunction) {
2977
- const { value: Ee, selectionStart: We } = x(ee);
2978
- return t(re(Ee)), setTimeout(() => {
2979
- b.current && (H(b.current), b.current.setSelectionRange(We, We));
2990
+ if (Y.preventDefault(), u.length) {
2991
+ const J = u[v];
2992
+ if (J == null ? void 0 : J.isFunction) {
2993
+ const { value: xe, selectionStart: ze } = x(J);
2994
+ return t(oe(xe)), setTimeout(() => {
2995
+ b.current && (L(b.current), b.current.setSelectionRange(ze, ze));
2980
2996
  }, 0), !1;
2981
2997
  } else {
2982
- const Ee = T.update({ diff: { [Y]: { value: ee.value } }, partial: !0 });
2983
- t(Ue(Ee.clone())), t(ue("")), t(re(""));
2998
+ const xe = E.update({ diff: { [$]: { value: J.value } }, partial: !0 });
2999
+ t(Ue(xe.clone())), t(de("")), t(oe(""));
2984
3000
  }
2985
3001
  }
2986
3002
  break;
2987
3003
  case "ArrowUp":
2988
- if (A(R))
3004
+ if (T(Y))
2989
3005
  return !0;
2990
3006
  break;
2991
3007
  case "ArrowDown":
2992
- if (C(R))
3008
+ if (R(Y))
2993
3009
  return !0;
2994
3010
  break;
2995
3011
  case "Enter": {
2996
- if (g.length) {
2997
- const ee = g[v];
2998
- if (ee != null && ee.isFunction) {
2999
- const { value: pe, selectionStart: Ee } = x(ee);
3000
- return t(re(pe)), setTimeout(() => {
3001
- b.current && (H(b.current), b.current.setSelectionRange(Ee, Ee));
3002
- }, 0), R.preventDefault(), !1;
3012
+ if (u.length) {
3013
+ const J = u[v];
3014
+ if (J != null && J.isFunction) {
3015
+ const { value: pe, selectionStart: xe } = x(J);
3016
+ return t(oe(pe)), setTimeout(() => {
3017
+ b.current && (L(b.current), b.current.setSelectionRange(xe, xe));
3018
+ }, 0), Y.preventDefault(), !1;
3003
3019
  }
3004
3020
  }
3005
- if (R.altKey)
3006
- tn(_, `
3021
+ if (Y.altKey)
3022
+ tn(I, `
3007
3023
  `);
3008
3024
  else
3009
- return S(_.value), t(re("")), t(
3025
+ return C(I.value), t(oe("")), t(
3010
3026
  ut({
3011
- numRows: T.numRows,
3012
- numCols: T.numCols,
3027
+ numRows: E.numRows,
3028
+ numCols: E.numCols,
3013
3029
  deltaY: 1,
3014
3030
  deltaX: 0
3015
3031
  })
3016
- ), R.preventDefault(), !1;
3032
+ ), Y.preventDefault(), !1;
3017
3033
  break;
3018
3034
  }
3019
3035
  case "Escape": {
3020
- _.value = s, t(re(s)), t(ue("")), R.preventDefault(), H(w.current);
3036
+ I.value = s, t(oe(s)), t(de("")), Y.preventDefault(), L(w.current);
3021
3037
  break;
3022
3038
  }
3023
3039
  case "a":
3024
- if (R.ctrlKey || R.metaKey)
3040
+ if (Y.ctrlKey || Y.metaKey)
3025
3041
  return !0;
3026
3042
  case "c":
3027
- if (R.ctrlKey || R.metaKey)
3043
+ if (Y.ctrlKey || Y.metaKey)
3028
3044
  return !0;
3029
3045
  break;
3030
3046
  case "v":
3031
- if (R.ctrlKey || R.metaKey)
3047
+ if (Y.ctrlKey || Y.metaKey)
3032
3048
  return !0;
3033
3049
  break;
3034
3050
  }
3035
- const ge = T.getCell(a, { resolution: "SYSTEM" });
3036
- return O.hasOperation(ge == null ? void 0 : ge.prevention, O.Write) && (console.warn("This cell is protected from writing."), R.preventDefault()), B(), !1;
3051
+ const ee = E.getCell(a, { resolution: "SYSTEM" });
3052
+ return H.hasOperation(ee == null ? void 0 : ee.prevention, H.Write) && (console.warn("This cell is protected from writing."), Y.preventDefault()), K(), !1;
3037
3053
  },
3038
3054
  [
3039
- T,
3055
+ E,
3040
3056
  a,
3041
- Y,
3057
+ $,
3042
3058
  s,
3043
- S,
3044
- B,
3045
- g,
3059
+ C,
3060
+ K,
3061
+ u,
3046
3062
  v,
3047
3063
  x,
3048
- A,
3049
- C,
3064
+ T,
3065
+ R,
3050
3066
  m
3051
3067
  ]
3052
- ), G = M(
3053
- (R, _) => {
3054
- R.preventDefault(), R.stopPropagation();
3055
- const ge = g[_];
3056
- if (ge.isFunction) {
3057
- const { value: ee, selectionStart: pe } = x(ge);
3058
- S(ee), t(re(ee)), setTimeout(() => {
3059
- b.current && (H(b.current), b.current.setSelectionRange(pe, pe));
3068
+ ), G = A(
3069
+ (Y, I) => {
3070
+ Y.preventDefault(), Y.stopPropagation();
3071
+ const ee = u[I];
3072
+ if (ee.isFunction) {
3073
+ const { value: J, selectionStart: pe } = x(ee);
3074
+ C(J), t(oe(J)), setTimeout(() => {
3075
+ b.current && (L(b.current), b.current.setSelectionRange(pe, pe));
3060
3076
  }, 0);
3061
3077
  }
3062
3078
  },
3063
- [g, x, S, t]
3079
+ [u, x, C, t]
3064
3080
  ), V = e ? {} : { visibility: "hidden" };
3065
- if (!T)
3081
+ if (!E)
3066
3082
  return /* @__PURE__ */ F("label", { className: "gs-formula-bar gs-hidden", style: V, children: [
3067
3083
  /* @__PURE__ */ c("div", { className: "gs-selecting-address" }),
3068
3084
  /* @__PURE__ */ c("div", { className: "gs-fx", children: "Fx" }),
3069
3085
  /* @__PURE__ */ c("div", { className: "gs-formula-bar-editor-inner", children: /* @__PURE__ */ c("textarea", {}) })
3070
3086
  ] });
3071
- const U = () => {
3072
- var ee;
3087
+ const z = () => {
3088
+ var J;
3073
3089
  if (!h || typeof document > "u" || b.current !== document.activeElement)
3074
3090
  return null;
3075
- const R = (ee = b.current) == null ? void 0 : ee.getBoundingClientRect();
3076
- if (!R)
3091
+ const Y = (J = b.current) == null ? void 0 : J.getBoundingClientRect();
3092
+ if (!Y)
3077
3093
  return null;
3078
- const _ = R.bottom, ge = R.left;
3094
+ const I = Y.bottom, ee = Y.left;
3079
3095
  return Ct(
3080
3096
  /* @__PURE__ */ F(we, { children: [
3081
- L && g.length === 0 && (!u || u.endY === -1 && u.endX === -1) && /* @__PURE__ */ c(
3097
+ B && u.length === 0 && (!d || d.endY === -1 && d.endX === -1) && /* @__PURE__ */ c(
3082
3098
  St,
3083
3099
  {
3084
- activeFunctionGuide: L,
3100
+ activeFunctionGuide: B,
3085
3101
  activeArgIndex: q,
3086
- top: _,
3087
- left: ge
3102
+ top: I,
3103
+ left: ee
3088
3104
  }
3089
3105
  ),
3090
- g.length > 0 && a.x !== -1 && /* @__PURE__ */ c(
3106
+ u.length > 0 && a.x !== -1 && /* @__PURE__ */ c(
3091
3107
  wn,
3092
3108
  {
3093
- filteredOptions: g,
3094
- top: _,
3095
- left: ge,
3109
+ filteredOptions: u,
3110
+ top: I,
3111
+ left: ee,
3096
3112
  selected: v,
3097
3113
  onOptionMouseDown: G
3098
3114
  }
@@ -3106,23 +3122,23 @@ const Qs = tt(({ x: e }) => {
3106
3122
  {
3107
3123
  className: "gs-formula-bar",
3108
3124
  "data-sheet-id": n.sheetId,
3109
- "data-spill": P != null ? "true" : void 0,
3125
+ "data-spill": X != null ? "true" : void 0,
3110
3126
  style: V,
3111
3127
  children: [
3112
3128
  /* @__PURE__ */ c(ke, { style: { position: "absolute", left: 0, top: 0, zIndex: 2 }, vertical: -1 }),
3113
- /* @__PURE__ */ c("div", { className: "gs-selecting-address", children: P ?? Y }),
3129
+ /* @__PURE__ */ c("div", { className: "gs-selecting-address", children: X ?? $ }),
3114
3130
  /* @__PURE__ */ c("div", { className: "gs-fx", children: "Fx" }),
3115
3131
  /* @__PURE__ */ F("div", { className: "gs-formula-bar-editor-inner", children: [
3116
3132
  /* @__PURE__ */ c(
3117
3133
  "div",
3118
3134
  {
3119
3135
  className: "gs-editor-hl",
3120
- ref: N,
3136
+ ref: S,
3121
3137
  style: {
3122
3138
  height: (Q = b.current) == null ? void 0 : Q.clientHeight,
3123
3139
  width: "100%"
3124
3140
  },
3125
- children: (E == null ? void 0 : E.formulaEnabled) ?? !0 ? Nn(m) : m
3141
+ children: (N == null ? void 0 : N.formulaEnabled) ?? !0 ? Nn(m) : m
3126
3142
  }
3127
3143
  ),
3128
3144
  /* @__PURE__ */ c(
@@ -3135,25 +3151,25 @@ const Qs = tt(({ x: e }) => {
3135
3151
  spellCheck: !1,
3136
3152
  ref: b,
3137
3153
  value: m,
3138
- readOnly: P != null,
3139
- onInput: ne,
3140
- onFocus: z,
3141
- onSelect: ae,
3142
- onPaste: (R) => {
3143
- R.stopPropagation();
3154
+ readOnly: X != null,
3155
+ onInput: se,
3156
+ onFocus: Z,
3157
+ onSelect: ce,
3158
+ onPaste: (Y) => {
3159
+ Y.stopPropagation();
3144
3160
  },
3145
- onKeyDown: K,
3146
- onKeyUp: B,
3147
- onScroll: B,
3148
- onMouseEnter: (R) => {
3161
+ onKeyDown: U,
3162
+ onKeyUp: K,
3163
+ onScroll: K,
3164
+ onMouseEnter: (Y) => {
3149
3165
  t(Qe(!0));
3150
3166
  },
3151
- onMouseLeave: (R) => {
3167
+ onMouseLeave: (Y) => {
3152
3168
  t(Qe(!1));
3153
3169
  }
3154
3170
  }
3155
3171
  ),
3156
- U()
3172
+ z()
3157
3173
  ] })
3158
3174
  ]
3159
3175
  }
@@ -3183,7 +3199,7 @@ const Qs = tt(({ x: e }) => {
3183
3199
  /* @__PURE__ */ c("path", { d: "M18 6l-12 12", fill: n }),
3184
3200
  /* @__PURE__ */ c("path", { d: "M6 6l12 12", fill: n })
3185
3201
  ] }), gr = () => {
3186
- const { store: e, dispatch: n } = ie(le), {
3202
+ const { store: e, dispatch: n } = le(ae), {
3187
3203
  rootRef: t,
3188
3204
  editorRef: s,
3189
3205
  searchInputRef: r,
@@ -3192,68 +3208,68 @@ const Qs = tt(({ x: e }) => {
3192
3208
  searchCaseSensitive: h,
3193
3209
  searchRegex: f,
3194
3210
  searchRange: a,
3195
- selectingZone: u,
3211
+ selectingZone: d,
3196
3212
  matchingCellIndex: w,
3197
3213
  matchingCells: b,
3198
- sheetReactive: d
3199
- } = e, m = d.current, y = b[w];
3200
- Z(() => {
3214
+ sheetReactive: g
3215
+ } = e, m = g.current, y = b[w];
3216
+ W(() => {
3201
3217
  if (!y || !m)
3202
3218
  return;
3203
- const g = wt(y);
3204
- typeof g > "u" || cs(m, o.current, g);
3219
+ const u = wt(y);
3220
+ typeof u > "u" || cs(m, o.current, u);
3205
3221
  }, [i, w, h, f, m, o]);
3206
- const D = M((g) => {
3207
- const v = g.currentTarget.previousSibling;
3208
- (v == null ? void 0 : v.nodeName) === "INPUT" && H(v);
3209
- }, []), T = M(() => {
3210
- n(Wt(1));
3211
- }, []), N = M((g) => {
3212
- n($e(g.currentTarget.value));
3213
- }, []), Y = M(
3214
- (g) => {
3215
- if (g.key === "Escape") {
3222
+ const D = A((u) => {
3223
+ const v = u.currentTarget.previousSibling;
3224
+ (v == null ? void 0 : v.nodeName) === "INPUT" && L(v);
3225
+ }, []), E = A(() => {
3226
+ n(zt(1));
3227
+ }, []), S = A((u) => {
3228
+ n($e(u.currentTarget.value));
3229
+ }, []), $ = A(
3230
+ (u) => {
3231
+ if (u.key === "Escape") {
3216
3232
  const v = s == null ? void 0 : s.current;
3217
- v && H(v), n($e(void 0));
3233
+ v && L(v), n($e(void 0));
3218
3234
  }
3219
- return g.key === "f" && (g.ctrlKey || g.metaKey) ? (g.preventDefault(), !1) : g.key === "Enter" ? (n(Wt(g.shiftKey ? -1 : 1)), g.preventDefault(), !1) : !0;
3235
+ return u.key === "f" && (u.ctrlKey || u.metaKey) ? (u.preventDefault(), !1) : u.key === "Enter" ? (n(zt(u.shiftKey ? -1 : 1)), u.preventDefault(), !1) : !0;
3220
3236
  },
3221
3237
  [s]
3222
- ), E = M(() => {
3238
+ ), N = A(() => {
3223
3239
  n(Rs(!h));
3224
- }, [h]), I = M(() => {
3240
+ }, [h]), M = A(() => {
3225
3241
  n(Cs(!f));
3226
- }, [f]), $ = Ye(() => {
3227
- if (!u || us(u))
3242
+ }, [f]), P = Ye(() => {
3243
+ if (!d || us(d))
3228
3244
  return !1;
3229
- const { startY: g, startX: v, endY: x, endX: A } = u;
3230
- return !(g === x && v === A);
3231
- }, [u]), P = Ye(() => {
3232
- if (!u || !$)
3245
+ const { startY: u, startX: v, endY: x, endX: T } = d;
3246
+ return !(u === x && v === T);
3247
+ }, [d]), X = Ye(() => {
3248
+ if (!d || !P)
3233
3249
  return "";
3234
- const { startY: g, startX: v, endY: x, endX: A } = u, C = `${me(Math.min(v, A))}${ve(Math.min(g, x))}`, L = `${me(Math.max(v, A))}${ve(Math.max(g, x))}`;
3235
- return `${C}:${L}`;
3236
- }, [u, $]), S = M(() => {
3250
+ const { startY: u, startX: v, endY: x, endX: T } = d, R = `${me(Math.min(v, T))}${ve(Math.min(u, x))}`, B = `${me(Math.max(v, T))}${ve(Math.max(u, x))}`;
3251
+ return `${R}:${B}`;
3252
+ }, [d, P]), C = A(() => {
3237
3253
  if (a)
3238
3254
  n(_t(void 0));
3239
- else if (u && $) {
3240
- const { startY: g, startX: v, endY: x, endX: A } = u;
3255
+ else if (d && P) {
3256
+ const { startY: u, startX: v, endY: x, endX: T } = d;
3241
3257
  n(
3242
3258
  _t({
3243
- startY: Math.min(g, x),
3244
- startX: Math.min(v, A),
3245
- endY: Math.max(g, x),
3246
- endX: Math.max(v, A)
3259
+ startY: Math.min(u, x),
3260
+ startX: Math.min(v, T),
3261
+ endY: Math.max(u, x),
3262
+ endX: Math.max(v, T)
3247
3263
  })
3248
3264
  );
3249
3265
  }
3250
- }, [a, u, $]), p = Ye(() => {
3266
+ }, [a, d, P]), p = Ye(() => {
3251
3267
  if (!a)
3252
3268
  return "";
3253
- const { startY: g, startX: v, endY: x, endX: A } = a, C = `${me(v)}${ve(g)}`, L = `${me(A)}${ve(x)}`;
3254
- return `${C}:${L}`;
3255
- }, [a]), l = M(() => {
3256
- n($e(void 0)), H(s.current);
3269
+ const { startY: u, startX: v, endY: x, endX: T } = a, R = `${me(v)}${ve(u)}`, B = `${me(T)}${ve(x)}`;
3270
+ return `${R}:${B}`;
3271
+ }, [a]), l = A(() => {
3272
+ n($e(void 0)), L(s.current);
3257
3273
  }, [s]);
3258
3274
  return typeof i > "u" || t.current === null ? null : /* @__PURE__ */ F("label", { className: `gs-search-bar ${b.length > 0 ? "gs-search-found" : ""}`, children: [
3259
3275
  /* @__PURE__ */ F("div", { className: "gs-search-progress", onClick: D, children: [
@@ -3261,7 +3277,7 @@ const Qs = tt(({ x: e }) => {
3261
3277
  " / ",
3262
3278
  b.length
3263
3279
  ] }),
3264
- /* @__PURE__ */ c("div", { className: "gs-search-bar-icon", onClick: T, children: /* @__PURE__ */ c(ur, { style: { verticalAlign: "middle", marginLeft: "5px" } }) }),
3280
+ /* @__PURE__ */ c("div", { className: "gs-search-bar-icon", onClick: E, children: /* @__PURE__ */ c(ur, { style: { verticalAlign: "middle", marginLeft: "5px" } }) }),
3265
3281
  /* @__PURE__ */ F("div", { className: "gs-search-input-wrapper", children: [
3266
3282
  /* @__PURE__ */ F("div", { className: "gs-search-input-ghost", children: [
3267
3283
  /* @__PURE__ */ c("span", { className: "gs-search-ghost-text", children: i }),
@@ -3272,8 +3288,8 @@ const Qs = tt(({ x: e }) => {
3272
3288
  {
3273
3289
  ref: r,
3274
3290
  value: i,
3275
- onChange: N,
3276
- onKeyDown: Y,
3291
+ onChange: S,
3292
+ onKeyDown: $,
3277
3293
  placeholder: "Search",
3278
3294
  title: "Press Enter to next, Shift+Enter to previous"
3279
3295
  }
@@ -3284,7 +3300,7 @@ const Qs = tt(({ x: e }) => {
3284
3300
  "span",
3285
3301
  {
3286
3302
  className: "gs-search-button-on",
3287
- onClick: S,
3303
+ onClick: C,
3288
3304
  title: `Search range: ${p}`,
3289
3305
  children: [
3290
3306
  "in ",
@@ -3292,15 +3308,15 @@ const Qs = tt(({ x: e }) => {
3292
3308
  ]
3293
3309
  }
3294
3310
  ) }),
3295
- !a && $ && /* @__PURE__ */ c("div", { className: "gs-search-button gs-search-range", children: /* @__PURE__ */ F("span", { onClick: S, title: `Limit to range: ${P}`, children: [
3311
+ !a && P && /* @__PURE__ */ c("div", { className: "gs-search-button gs-search-range", children: /* @__PURE__ */ F("span", { onClick: C, title: `Limit to range: ${X}`, children: [
3296
3312
  "in ",
3297
- P
3313
+ X
3298
3314
  ] }) }),
3299
3315
  /* @__PURE__ */ c("div", { className: "gs-search-button gs-search-casesensitive", children: /* @__PURE__ */ c(
3300
3316
  "span",
3301
3317
  {
3302
3318
  className: `${h ? "gs-search-button-on" : ""}`,
3303
- onClick: E,
3319
+ onClick: N,
3304
3320
  title: "Case sensitive",
3305
3321
  children: "Aa"
3306
3322
  }
@@ -3309,7 +3325,7 @@ const Qs = tt(({ x: e }) => {
3309
3325
  "span",
3310
3326
  {
3311
3327
  className: `${f ? "gs-search-button-on" : ""}`,
3312
- onClick: I,
3328
+ onClick: M,
3313
3329
  title: "Regular expression",
3314
3330
  children: ".*"
3315
3331
  }
@@ -3317,7 +3333,7 @@ const Qs = tt(({ x: e }) => {
3317
3333
  ] }),
3318
3334
  /* @__PURE__ */ c("a", { className: "gs-search-close", onClick: l, children: /* @__PURE__ */ c(dr, { style: { verticalAlign: "middle" } }) })
3319
3335
  ] });
3320
- }, Er = () => ln(), hr = () => oe(null), xr = () => ln(), fr = () => oe(null);
3336
+ }, xr = () => ln(), hr = () => ie(null), Er = () => ln(), fr = () => ie(null);
3321
3337
  function kr({
3322
3338
  initialCells: e,
3323
3339
  sheetName: n = "",
@@ -3328,25 +3344,25 @@ function kr({
3328
3344
  style: i,
3329
3345
  book: h
3330
3346
  }) {
3331
- var W, ne, ae, B;
3332
- const { sheetResize: f, showFormulaBar: a = !0, mode: u = "light" } = r, w = oe(null), b = oe(null), d = oe(null), m = oe(null), y = oe(null), D = oe(null), T = oe(null), N = hr(), Y = t ?? N, E = fr(), I = s ?? E, $ = Ss({}), P = h ?? $, { registry: S } = P, [p] = J(() => n ? (S._componentSheetIds.has(n) || S._componentSheetIds.set(n, ++S.sheetHead), S._componentSheetIds.get(n)) : ++S.sheetHead), l = oe(null), [g] = J(() => {
3347
+ var _, se, ce, K;
3348
+ const { sheetResize: f, showFormulaBar: a = !0, mode: d = "light" } = r, w = ie(null), b = ie(null), g = ie(null), m = ie(null), y = ie(null), D = ie(null), E = ie(null), S = hr(), $ = t ?? S, N = fr(), M = s ?? N, P = Ss({}), X = h ?? P, { registry: C } = X, [p] = te(() => n ? (C._componentSheetIds.has(n) || C._componentSheetIds.set(n, ++C.sheetHead), C._componentSheetIds.get(n)) : ++C.sheetHead), l = ie(null), [u] = te(() => {
3333
3349
  var Q;
3334
3350
  n || (n = `Sheet${p}`, console.debug("GridSheet: sheetName is not provided, using default name:", n));
3335
- const { limits: z, contextMenu: K, rowMenu: G, colMenu: V } = r, U = new ds({
3336
- limits: z,
3351
+ const { limits: Z, contextMenu: U, rowMenu: G, colMenu: V } = r, z = new ds({
3352
+ limits: Z,
3337
3353
  name: n,
3338
- registry: S
3354
+ registry: C
3339
3355
  });
3340
- return U.id = p, S.sheetIdsByName[n] = p, U.initialize(e), (Q = S.onInit) == null || Q.call(S, { sheet: U }), U.setTotalSize(), l.current = U, {
3356
+ return z.id = p, C.sheetIdsByName[n] = p, z.initialize(e), (Q = C.onInit) == null || Q.call(C, { sheet: z }), z.setTotalSize(), l.current = z, {
3341
3357
  sheetId: p,
3342
3358
  sheetReactive: l,
3343
3359
  rootRef: w,
3344
3360
  flashRef: b,
3345
- mainRef: d,
3361
+ mainRef: g,
3346
3362
  searchInputRef: m,
3347
3363
  editorRef: y,
3348
3364
  largeEditorRef: D,
3349
- tabularRef: T,
3365
+ tabularRef: E,
3350
3366
  choosing: { y: 1, x: 1 },
3351
3367
  inputting: "",
3352
3368
  selectingZone: { startY: 1, startX: 1, endY: -1, endX: -1 },
@@ -3365,7 +3381,7 @@ function kr({
3365
3381
  searchRegex: !1,
3366
3382
  editingOnEnter: !0,
3367
3383
  contextMenuPosition: { y: -1, x: -1 },
3368
- contextMenu: K ?? Os,
3384
+ contextMenu: U ?? Os,
3369
3385
  rowMenu: G ?? Hs,
3370
3386
  colMenu: V ?? Ls,
3371
3387
  resizingPositionY: [-1, -1, -1],
@@ -3377,57 +3393,63 @@ function kr({
3377
3393
  };
3378
3394
  }), [v, x] = ys(
3379
3395
  Ns,
3380
- g,
3381
- () => g
3396
+ u,
3397
+ () => u
3382
3398
  );
3383
- Z(() => {
3399
+ W(() => {
3384
3400
  gs();
3385
3401
  }, []);
3386
- const [A, C] = J((r == null ? void 0 : r.sheetHeight) || mr(e)), [L, q] = J((r == null ? void 0 : r.sheetWidth) || pr(e));
3387
- return Z(() => {
3388
- const z = window.setInterval(() => {
3389
- var K, G;
3390
- C(((K = d.current) == null ? void 0 : K.clientHeight) || 0), q(((G = d.current) == null ? void 0 : G.clientWidth) || 0);
3391
- }, 1e3);
3392
- return () => window.clearInterval(z);
3393
- }, []), Z(() => {
3394
- r.sheetHeight && C(r.sheetHeight);
3395
- }, [r.sheetHeight]), Z(() => {
3402
+ const [T, R] = te((r == null ? void 0 : r.sheetHeight) || mr(e)), [B, q] = te((r == null ? void 0 : r.sheetWidth) || pr(e));
3403
+ return W(() => {
3404
+ const Z = g.current;
3405
+ if (!Z)
3406
+ return;
3407
+ let U = !0;
3408
+ const G = new ResizeObserver(() => {
3409
+ if (U) {
3410
+ U = !1;
3411
+ return;
3412
+ }
3413
+ R(r.sheetHeight ? Math.min(r.sheetHeight, Z.clientHeight) : Z.clientHeight), q(r.sheetWidth ? Math.min(r.sheetWidth, Z.clientWidth) : Z.clientWidth);
3414
+ });
3415
+ return G.observe(Z), () => G.disconnect();
3416
+ }, []), W(() => {
3417
+ r.sheetHeight && R(r.sheetHeight);
3418
+ }, [r.sheetHeight]), W(() => {
3396
3419
  r.sheetWidth && q(r.sheetWidth);
3397
- }, [r.sheetWidth]), /* @__PURE__ */ c(le.Provider, { value: { store: v, dispatch: x }, children: /* @__PURE__ */ F(
3420
+ }, [r.sheetWidth]), /* @__PURE__ */ c(ae.Provider, { value: { store: v, dispatch: x }, children: /* @__PURE__ */ F(
3398
3421
  "div",
3399
3422
  {
3400
- className: `gs-root1 ${S.ready ? "gs-initialized" : ""}`,
3423
+ className: `gs-root1 ${C.ready ? "gs-initialized" : ""}`,
3401
3424
  ref: w,
3402
3425
  "data-sheet-name": n,
3403
- "data-mode": u,
3404
- "data-rows": ((W = v.sheetReactive.current) == null ? void 0 : W.numRows) ?? 0,
3405
- "data-cols": ((ne = v.sheetReactive.current) == null ? void 0 : ne.numCols) ?? 0,
3426
+ "data-mode": d,
3427
+ "data-rows": ((_ = v.sheetReactive.current) == null ? void 0 : _.numRows) ?? 0,
3428
+ "data-cols": ((se = v.sheetReactive.current) == null ? void 0 : se.numCols) ?? 0,
3406
3429
  children: [
3407
3430
  /* @__PURE__ */ c("div", { className: "gs-flash-overlay", ref: b }),
3408
3431
  /* @__PURE__ */ c(ke, { style: { position: "fixed", top: 0, left: 0 } }),
3409
3432
  /* @__PURE__ */ c(ke, { style: { position: "absolute", zIndex: 4, right: 0, top: 0, width: 5 }, horizontal: 1 }),
3410
3433
  /* @__PURE__ */ c(ke, { style: { position: "absolute", zIndex: 4, left: 0, bottom: 0, height: 5 }, vertical: 1 }),
3411
- typeof v.searchQuery > "u" ? a && /* @__PURE__ */ c(cr, { ready: S.ready }) : /* @__PURE__ */ c(gr, {}),
3434
+ typeof v.searchQuery > "u" ? a && /* @__PURE__ */ c(cr, { ready: C.ready }) : /* @__PURE__ */ c(gr, {}),
3412
3435
  /* @__PURE__ */ F(
3413
3436
  "div",
3414
3437
  {
3415
3438
  className: `gs-main ${o || ""}`,
3416
- ref: d,
3439
+ ref: g,
3417
3440
  style: {
3418
3441
  //width: '100%',
3419
- maxWidth: (((ae = v.sheetReactive.current) == null ? void 0 : ae.totalWidth) || 0) + 2,
3420
- maxHeight: (((B = v.sheetReactive.current) == null ? void 0 : B.fullHeight) || 0) + 2,
3421
- overflow: "auto",
3442
+ maxWidth: (((ce = v.sheetReactive.current) == null ? void 0 : ce.totalWidth) || 0) + 2,
3443
+ maxHeight: (((K = v.sheetReactive.current) == null ? void 0 : K.fullHeight) || 0) + 2,
3422
3444
  resize: f,
3423
3445
  ...i
3424
3446
  },
3425
3447
  children: [
3426
- /* @__PURE__ */ c(Ts, { mode: u }),
3448
+ /* @__PURE__ */ c(Ts, { mode: d }),
3427
3449
  /* @__PURE__ */ c(ar, {}),
3428
- /* @__PURE__ */ c(As, { ...r, sheetHeight: A, sheetWidth: L, sheetName: n, sheetRef: Y, storeRef: I }),
3450
+ /* @__PURE__ */ c(As, { ...r, sheetHeight: T, sheetWidth: B, sheetName: n, sheetRef: $, storeRef: M }),
3429
3451
  /* @__PURE__ */ c(Ks, {}),
3430
- /* @__PURE__ */ c(Ws, {}),
3452
+ /* @__PURE__ */ c(zs, {}),
3431
3453
  /* @__PURE__ */ c(js, {}),
3432
3454
  /* @__PURE__ */ c(Ms, {}),
3433
3455
  /* @__PURE__ */ c(Ds, {})
@@ -3443,10 +3465,10 @@ const mr = (e) => {
3443
3465
  const n = rn(e);
3444
3466
  let t = ((s = e[0]) == null ? void 0 : s.height) ?? hs;
3445
3467
  for (let f = 1; f <= n.numRows; f++) {
3446
- const a = ve(f), u = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.height) || ((o = e == null ? void 0 : e["0" + a]) == null ? void 0 : o.height) || ((i = e == null ? void 0 : e[fs]) == null ? void 0 : i.height) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.height) || vt;
3447
- if (t + u > Bt)
3468
+ const a = ve(f), d = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.height) || ((o = e == null ? void 0 : e["0" + a]) == null ? void 0 : o.height) || ((i = e == null ? void 0 : e[fs]) == null ? void 0 : i.height) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.height) || vt;
3469
+ if (t + d > Bt)
3448
3470
  return Bt;
3449
- t += u;
3471
+ t += d;
3450
3472
  }
3451
3473
  return t + 3;
3452
3474
  }, pr = (e) => {
@@ -3454,10 +3476,10 @@ const mr = (e) => {
3454
3476
  const n = rn(e);
3455
3477
  let t = ((s = e[0]) == null ? void 0 : s.width) ?? ms;
3456
3478
  for (let f = 1; f <= n.numCols; f++) {
3457
- const a = me(f), u = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.width) || ((o = e == null ? void 0 : e[a + "0"]) == null ? void 0 : o.width) || ((i = e == null ? void 0 : e[ps]) == null ? void 0 : i.width) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.width) || yt;
3458
- if (t + u > Kt)
3479
+ const a = me(f), d = ((r = e == null ? void 0 : e[a]) == null ? void 0 : r.width) || ((o = e == null ? void 0 : e[a + "0"]) == null ? void 0 : o.width) || ((i = e == null ? void 0 : e[ps]) == null ? void 0 : i.width) || ((h = e == null ? void 0 : e.default) == null ? void 0 : h.width) || yt;
3480
+ if (t + d > Kt)
3459
3481
  return Kt;
3460
- t += u;
3482
+ t += d;
3461
3483
  }
3462
3484
  return t + 3;
3463
3485
  }, Tr = {
@@ -3488,7 +3510,7 @@ export {
3488
3510
  kr as GridSheet,
3489
3511
  Xr as Lexer,
3490
3512
  kt as MenuDivider,
3491
- xt as MenuItem,
3513
+ Et as MenuItem,
3492
3514
  Or as Pending,
3493
3515
  Hr as PercentagePolicyMixin,
3494
3516
  Sr as PluginBase,
@@ -3497,8 +3519,8 @@ export {
3497
3519
  Kr as RefEntity,
3498
3520
  Zr as Registry,
3499
3521
  Ur as Sheet,
3500
- zr as Spilling,
3501
- Wr as ThousandSeparatorPolicyMixin,
3522
+ Wr as Spilling,
3523
+ zr as ThousandSeparatorPolicyMixin,
3502
3524
  _r as Time,
3503
3525
  jr as ValueEntity,
3504
3526
  Vr as a2p,
@@ -3519,8 +3541,8 @@ export {
3519
3541
  ao as createBook,
3520
3542
  co as createBooleanMask,
3521
3543
  uo as createRegistry,
3522
- Er as createSheetRef,
3523
- xr as createStoreRef,
3544
+ xr as createSheetRef,
3545
+ Er as createStoreRef,
3524
3546
  Ls as defaultColMenuDescriptors,
3525
3547
  Os as defaultContextMenuDescriptors,
3526
3548
  Hs as defaultRowMenuDescriptors,
@@ -3535,13 +3557,13 @@ export {
3535
3557
  bo as operations,
3536
3558
  wo as p2a,
3537
3559
  Ro as r2y,
3538
- Et as registerMenuComponent,
3560
+ xt as registerMenuComponent,
3539
3561
  Co as rh,
3540
- Es as sheet2csv,
3562
+ xs as sheet2csv,
3541
3563
  So as stripMatrix,
3542
3564
  No as toCellCols,
3543
- Eo as toCellMatrix,
3544
- xo as toCellObject,
3565
+ xo as toCellMatrix,
3566
+ Eo as toCellObject,
3545
3567
  ko as toCellRows,
3546
3568
  To as toValueCols,
3547
3569
  Ao as toValueMatrix,
@@ -3550,7 +3572,7 @@ export {
3550
3572
  Ue as updateSheet,
3551
3573
  Ss as useBook,
3552
3574
  Cr as useInitialPluginContext,
3553
- xn as usePluginContext,
3575
+ En as usePluginContext,
3554
3576
  hr as useSheetRef,
3555
3577
  fr as useStoreRef,
3556
3578
  Po as userActions,