@sheetxl/grid-react 0.7.6 → 0.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.6
2
+ * @license @sheetxl/grid-react - Grid React - Advanced grid component for React - v0.7.8
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -112,37 +112,37 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
112
112
  }, [R2]), L2 = o(i2, [i2]), $2 = v(() => {
113
113
  n2?.getStage()?.focus();
114
114
  }, [n2]), B2 = w(null), F2 = o((e2) => {
115
- s2?.(e2), Q2(), T2(true), B2.current = null;
115
+ s2?.(e2), ee2(), T2(true), B2.current = null;
116
116
  }, [s2]), A2 = o((e2) => {
117
117
  a2?.(e2.coords);
118
118
  }, [a2]), W2 = o((e2) => {
119
- e2.isSubmitted || e2.isCancelled || (X2.current.isEditorClosed = true, $2(), e2.isCancelled = true, u2?.(e2.coords), Q2());
119
+ e2.isSubmitted || e2.isCancelled || (X2.current.isEditorClosed = true, $2(), e2.isCancelled = true, u2?.(e2.coords), ee2());
120
120
  }, [u2]), V2 = o((e2) => {
121
121
  if (e2.isSubmitted || e2.isCancelled) return false;
122
122
  try {
123
- return B2.current = e2.coords, e2.isEditorClosing = true, e2.isSubmitted = true, e2.isEditorSubmitted || (e2.isEditorSubmitted = true, e2.editorRefs[0]?.submitEdit?.()), e2.coords, d2?.(e2.coords), e2.isEditorClosed = true, $2(), Q2(), true;
123
+ return B2.current = e2.coords, e2.isEditorClosing = true, e2.isSubmitted = true, e2.isEditorSubmitted || (e2.isEditorSubmitted = true, e2.editorRefs[0]?.submitEdit?.()), e2.coords, d2?.(e2.coords), e2.isEditorClosed = true, $2(), ee2(), true;
124
124
  } catch (t3) {
125
125
  throw e2.isEditorClosing = false, e2.isSubmitted = false, t3;
126
126
  }
127
127
  }, [d2]), U2 = o((e2) => {
128
- T2(false), h2?.(e2.coords), Q2();
129
- }, [h2]), X2 = w(null), Y2 = w(null), G2 = w(null), Z2 = w([]), [_2, J2] = x((e2) => e2 + 1, 0), Q2 = v((e2) => {
130
- e2 && Z2.current.push(e2), J2();
131
- }, []), ee2 = o((e2) => {
128
+ T2(false), h2?.(e2.coords), ee2();
129
+ }, [h2]), X2 = w(null), G2 = w(null), Z2 = w(null), _2 = w([]), [J2, Q2] = x((e2) => e2 + 1, 0), ee2 = v((e2) => {
130
+ e2 && _2.current.push(e2), Q2();
131
+ }, []), te2 = o((e2) => {
132
132
  if (e2.defaultPrevented || e2.isSynthetic) return;
133
133
  if (!n2) return;
134
134
  const t3 = n2?.getCellCoordsFromClient(e2.clientX, e2.clientY);
135
135
  if (!t3) return;
136
- Q2({ eventType: "pointer", event: e2, coords: t3 });
137
- }, [n2]), te2 = o((e2) => {
138
- const t3 = e2.nativeEvent;
139
- ee2(t3);
136
+ ee2({ eventType: "pointer", event: e2, coords: t3 });
140
137
  }, [n2]), ne2 = o((e2) => {
138
+ const t3 = e2.nativeEvent;
139
+ te2(t3);
140
+ }, [n2]), oe2 = o((e2) => {
141
141
  if (e2.defaultPrevented || e2.isSynthetic) return;
142
142
  if (!n2?.getStage()) return;
143
- const t3 = Y2.current;
143
+ const t3 = G2.current;
144
144
  g2(e2, t3) && (e2.stopPropagation(), e2.preventDefault()), e2.key;
145
- Q2({ eventType: "keyboard", event: e2, coords: t3 });
145
+ ee2({ eventType: "keyboard", event: e2, coords: t3 });
146
146
  }, [n2]);
147
147
  S(() => {
148
148
  const e2 = (e3, t4) => {
@@ -152,36 +152,36 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
152
152
  if (!L2(o3)) return null;
153
153
  F2?.(o3);
154
154
  const l2 = P.uuidV4();
155
- t4 = Object.freeze({ autoFocus: true, ...t4 }), G2.current = o3;
155
+ t4 = Object.freeze({ autoFocus: true, ...t4 }), Z2.current = o3;
156
156
  const i3 = { coords: r2, startEvent: t4, uuid: l2, isMounted: false, isStarted: false, isSubmitted: false, isEditorSubmitted: false, isEditorClosing: false, isEditorClosed: false, isCancelled: false, events: [], editorRefsDispatchEditorEvent: [], editorRefs: [], onMount: (e4) => {
157
- i3.isMounted || (i3.isMounted = true, Q2());
157
+ i3.isMounted || (i3.isMounted = true, ee2());
158
158
  }, onUnmount: (e4) => {
159
159
  if (0 === i3.editorRefs.length) {
160
160
  const e5 = () => {
161
- i3.isMounted = false, Q2();
161
+ i3.isMounted = false, ee2();
162
162
  };
163
163
  if (document.activeElement !== document.body) e5();
164
164
  else {
165
165
  const t5 = (e6) => {
166
- e6.defaultPrevented || e6.target !== document.body || ne2(e6);
166
+ e6.defaultPrevented || e6.target !== document.body || oe2(e6);
167
167
  };
168
168
  window.addEventListener("keydown", t5, true), n2.getStage()?.addEventListener("focusin", () => {
169
169
  window.removeEventListener("keydown", t5), e5();
170
- }, { once: true }), $2();
170
+ }, Y), $2();
171
171
  }
172
172
  }
173
173
  } };
174
174
  return i3;
175
175
  };
176
- if (Z2.current.length <= 0 && !X2.current) return;
177
- const t3 = Z2.current[0];
176
+ if (_2.current.length <= 0 && !X2.current) return;
177
+ const t3 = _2.current[0];
178
178
  H(t3), ((e3) => {
179
179
  const t4 = [], n3 = e3?.length ?? 0;
180
180
  for (let o3 = 0; o3 < n3; o3++) {
181
181
  const n4 = e3[o3];
182
182
  t4.push(H(n4));
183
183
  }
184
- })(Z2.current), X2.current, X2.current;
184
+ })(_2.current), X2.current, X2.current;
185
185
  let o2 = X2.current;
186
186
  if (X2.current) {
187
187
  if (X2.current.isDone) X2.current = null;
@@ -192,7 +192,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
192
192
  }
193
193
  if (t3) {
194
194
  if ("start" === t3.eventType) {
195
- const n3 = t3, o3 = n3.startEvent?.cell ?? Y2.current;
195
+ const n3 = t3, o3 = n3.startEvent?.cell ?? G2.current;
196
196
  X2.current && k.isEqualCells(X2.current.coords, o3) || (X2.current = e2(o3, n3.startEvent));
197
197
  } else if ("keyboard" === t3.eventType) {
198
198
  const n3 = t3.event;
@@ -214,7 +214,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
214
214
  } else {
215
215
  if (g2(n3, t3.coords)) {
216
216
  let n4;
217
- const o3 = e2(n4?.cell ?? Y2.current, n4);
217
+ const o3 = e2(n4?.cell ?? G2.current, n4);
218
218
  o3 && o3.events.push(t3), X2.current = o3;
219
219
  }
220
220
  }
@@ -224,7 +224,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
224
224
  X2.current.events.push(t3);
225
225
  for (let e3 = 0; e3 < X2.current.editorRefsDispatchEditorEvent.length; e3++) X2.current.editorRefsDispatchEditorEvent[e3](t3);
226
226
  } else {
227
- const o3 = t3?.coords ?? Y2.current, r2 = f2(n3, o3);
227
+ const o3 = t3?.coords ?? G2.current, r2 = f2(n3, o3);
228
228
  if (r2) {
229
229
  let n4;
230
230
  "boolean" != typeof n4 && (n4 = r2);
@@ -244,7 +244,7 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
244
244
  }
245
245
  } else if ("coordsChange" === t3.eventType) {
246
246
  const e3 = t3;
247
- if (Y2.current = e3.activeCoords, X2.current, X2.current && !X2.current.isSubmitted && !X2.current.isCancelled) {
247
+ if (G2.current = e3.activeCoords, X2.current, X2.current && !X2.current.isSubmitted && !X2.current.isCancelled) {
248
248
  if (!X2.current.isMounted) return;
249
249
  try {
250
250
  V2(X2.current);
@@ -253,37 +253,37 @@ const B = ({ itemType: e2, index: t2, itemSize: n2, instanceProps: o2, scale: r2
253
253
  }
254
254
  }
255
255
  }
256
- Z2.current.length > 0 && (Z2.current.shift(), Q2()), 0 === Z2.current.length && (!X2.current || X2.current.isEditorClosing || X2.current.isEditorClosed ? !X2.current && o2 && $2() : X2.current.isMounted && !X2.current.isStarted && (X2.current.isStarted = true, X2.current.startEvent.autoFocus && ("string" == typeof X2.current.startEvent.autoFocus ? X2.current.editorRefs[0]?.autoFocus(X2.current.startEvent.autoFocus) : X2.current.editorRefs[0]?.autoFocus()), A2?.(X2.current), requestAnimationFrame(() => {
256
+ _2.current.length > 0 && (_2.current.shift(), ee2()), 0 === _2.current.length && (!X2.current || X2.current.isEditorClosing || X2.current.isEditorClosed ? !X2.current && o2 && $2() : X2.current.isMounted && !X2.current.isStarted && (X2.current.isStarted = true, X2.current.startEvent.autoFocus && ("string" == typeof X2.current.startEvent.autoFocus ? X2.current.editorRefs[0]?.autoFocus(X2.current.startEvent.autoFocus) : X2.current.editorRefs[0]?.autoFocus()), A2?.(X2.current), requestAnimationFrame(() => {
257
257
  n2 && X2.current?.coords && n2.scrollCellCoordsIntoView(X2.current.coords);
258
258
  })));
259
- }, [_2]), m(() => {
260
- G2.current = E2;
259
+ }, [J2]), m(() => {
260
+ Z2.current = E2;
261
261
  const e2 = X2.current?.coords;
262
262
  if (!k.isEqualCells(e2, E2)) {
263
263
  X2.current && (X2.current.isEditorClosing = true);
264
- Q2({ eventType: "coordsChange", activeCoords: E2 });
264
+ ee2({ eventType: "coordsChange", activeCoords: E2 });
265
265
  }
266
266
  }, [E2]);
267
- const oe2 = v((e2) => {
268
- ne2(e2.nativeEvent);
269
- }, []), { width: re2 = 0, height: le2 = 0 } = D2 ?? { width: 0, height: 0 }, ie2 = o(c2, [c2]);
267
+ const re2 = v((e2) => {
268
+ oe2(e2.nativeEvent);
269
+ }, []), { width: le2 = 0, height: ie2 = 0 } = D2 ?? { width: 0, height: 0 }, ce2 = o(c2, [c2]);
270
270
  return { overlay: o((t3) => {
271
271
  if (!X2.current || X2.current.isEditorClosed) return X2.current, null;
272
272
  X2.current.coords;
273
- let n3 = z2(t3, X2.current.coords, re2, le2, I2, R2), o2 = true;
274
- n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: re2, height: re2 }, o2 = false);
273
+ let n3 = z2(t3, X2.current.coords, le2, ie2, I2, R2), o2 = true;
274
+ n3 && 0 !== n3.width && 0 !== n3.height || (n3 = { x: 0, y: 0, width: le2, height: le2 }, o2 = false);
275
275
  const r2 = t3.getZoom(), l2 = { containerBounds: { x: 0, y: 0, width: n3.width / r2, height: n3.height / r2 }, setNaturalSize: O2, zoom: r2 };
276
- return e(j, { session: X2.current, refLatestCoords: G2, handleSubmitEdit: V2, handleCancelEdit: W2, cellBounds: n3, borderStrokeWidth: C2, borderStrokeFill: b2, isInBounds: o2, getCellEditor: ie2, propsEditor: l2, alignment: R2, ...y2 }, "editor:" + X2.current.uuid);
277
- }, [c2, I2, _2, re2, le2, R2, C2, b2]), startEdit: v((e2) => {
278
- Q2({ eventType: "start", startEvent: e2 });
276
+ return e(j, { session: X2.current, refLatestCoords: Z2, handleSubmitEdit: V2, handleCancelEdit: W2, cellBounds: n3, borderStrokeWidth: C2, borderStrokeFill: b2, isInBounds: o2, getCellEditor: ce2, propsEditor: l2, alignment: R2, ...y2 }, "editor:" + X2.current.uuid);
277
+ }, [c2, I2, J2, le2, ie2, R2, C2, b2]), startEdit: v((e2) => {
278
+ ee2({ eventType: "start", startEvent: e2 });
279
279
  }, []), submitEdit: v(() => {
280
- Q2({ eventType: "submit" });
280
+ ee2({ eventType: "submit" });
281
281
  }, []), cancelEdit: v(() => {
282
- Q2({ eventType: "cancel" });
283
- }, []), onKeyboardEvent: oe2, onPointerEvent: te2, onKeyboardEventNative: ne2, onPointerEventNative: ee2, isEditing: M2 };
284
- }, Y = 3, G = 0.5, Z = 50, _ = (e2) => ({ x: e2.x, y: e2.y, width: e2.width, height: e2.height, top: e2.top, left: e2.left, right: e2.right, bottom: e2.bottom });
285
- function J(e2 = {}) {
286
- const { threshold: t2 = G, stillnessThreshold: n2 = Y, maxHierarchyDepth: o2 = Z } = e2, [r2, l2] = z(), i2 = w(null), [c2, s2] = x((e3) => e3 + 1, 0), a2 = w(void 0), d2 = w({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), u2 = v((e3) => {
282
+ ee2({ eventType: "cancel" });
283
+ }, []), onKeyboardEvent: re2, onPointerEvent: ne2, onKeyboardEventNative: oe2, onPointerEventNative: te2, isEditing: M2 };
284
+ }, Y = Object.freeze({ once: true }), G = 3, Z = 0.5, _ = 50, J = (e2) => ({ x: e2.x, y: e2.y, width: e2.width, height: e2.height, top: e2.top, left: e2.left, right: e2.right, bottom: e2.bottom });
285
+ function Q(e2 = {}) {
286
+ const { threshold: t2 = Z, stillnessThreshold: n2 = G, maxHierarchyDepth: o2 = _ } = e2, [r2, l2] = z(), i2 = w(null), [c2, s2] = x((e3) => e3 + 1, 0), a2 = w(void 0), d2 = w({ x: 0, y: 0, width: 0, height: 0, top: 0, left: 0, right: 0, bottom: 0 }), u2 = v((e3) => {
287
287
  i2.current = e3, "function" == typeof r2 && r2(e3);
288
288
  }, [r2]), [h2, g2] = p(l2);
289
289
  return m(() => {
@@ -295,7 +295,7 @@ function J(e2 = {}) {
295
295
  const c3 = () => {
296
296
  if (!e3) return;
297
297
  const o3 = e3.getBoundingClientRect(), i3 = d2.current;
298
- Math.abs(o3.x - i3.x) > t2 || Math.abs(o3.y - i3.y) > t2 || Math.abs(o3.width - i3.width) > t2 || Math.abs(o3.height - i3.height) > t2 ? (r3 || (r3 = true, g2(_(o3)), s2()), l3 = 0) : l3++, r3 && l3 >= n2 && (r3 = false, g2(_(o3)), s2()), d2.current = _(o3), a2.current = requestAnimationFrame(c3);
298
+ Math.abs(o3.x - i3.x) > t2 || Math.abs(o3.y - i3.y) > t2 || Math.abs(o3.width - i3.width) > t2 || Math.abs(o3.height - i3.height) > t2 ? (r3 || (r3 = true, g2(J(o3)), s2()), l3 = 0) : l3++, r3 && l3 >= n2 && (r3 = false, g2(J(o3)), s2()), d2.current = J(o3), a2.current = requestAnimationFrame(c3);
299
299
  };
300
300
  a2.current = requestAnimationFrame(c3);
301
301
  const u3 = (e4) => {
@@ -313,7 +313,7 @@ function J(e2 = {}) {
313
313
  };
314
314
  }, [c2, l2, t2, n2, o2]), [u2, h2];
315
315
  }
316
- const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: x2, modifySelection: p2, appendSelection: m2, clearSelections: S2 }) => {
316
+ const ee = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount: r2, selectionPolicy: l2 = "multiple", newSelectionMode: i2 = "clear", alwaysScrollToActiveCoords: a2 = true, onDragStart: d2, onDragEnd: u2, pointerDownInterceptor: h2, pointerMoveInterceptor: g2, onPointerUp: f2, newSelection: x2, modifySelection: p2, appendSelection: m2, clearSelections: S2 }) => {
317
317
  const b2 = r2 ?? ((n2 === T.Row ? e2.current?.rowCount : e2.current?.columnCount) || 0), C2 = w(null), I2 = w(null), E2 = w(false), R2 = w(null), M2 = v((e3) => n2 === T.Column ? { rowIndex: 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: 0 }, [n2]), D2 = v((e3) => n2 === T.Column ? { rowIndex: t2.current ? t2.current.rowCount - 1 : 0, colIndex: e3.colIndex } : { rowIndex: e3.rowIndex, colIndex: t2.current ? t2.current.columnCount - 1 : 0 }, [n2]), O2 = (e3) => {
318
318
  I2.current = D2(e3), p2(I2.current, C2.current);
319
319
  }, z2 = v((o2, r3) => {
@@ -353,7 +353,7 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
353
353
  E2.current = false, $2?.(), f2?.(e3);
354
354
  }, processTouch: true, consumeTouch: true }), [l2, a2, b2, i2, S2, h2, f2]);
355
355
  return { onPointerDown: o(s(F2), []), getCellCoordsFromClient: z2 };
356
- }, ee = (e2, t2, n2) => {
356
+ }, te = (e2, t2, n2) => {
357
357
  if (!e2) return t2;
358
358
  let o2 = t2;
359
359
  const r2 = n2 === D.Right || n2 === D.Down;
@@ -362,7 +362,7 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
362
362
  if (0 === t3) return o2;
363
363
  r2 ? o2 += t3 : o2 -= t3;
364
364
  }
365
- }, te = (e2, t2, n2) => {
365
+ }, ne = (e2, t2, n2) => {
366
366
  const o2 = [];
367
367
  let r2 = t2;
368
368
  for (; r2 <= n2; ) {
@@ -370,75 +370,75 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
370
370
  0 === t3 ? (o2.push(r2), r2++) : r2 += t3;
371
371
  }
372
372
  return o2;
373
- }, ne = (e2, t2, n2, o2, r2, l2) => {
373
+ }, oe = (e2, t2, n2, o2, r2, l2) => {
374
374
  if (!t2) return l2;
375
375
  let { rowIndex: i2, colIndex: c2 } = e2;
376
376
  switch (o2) {
377
377
  case D.Down: {
378
- i2 = ee(n2, Math.min(i2 + 1, l2), o2);
378
+ i2 = te(n2, Math.min(i2 + 1, l2), o2);
379
379
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
380
- for (; !e3 && i2 < l2; ) i2 = ee(n2, Math.min(++i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
380
+ for (; !e3 && i2 < l2; ) i2 = te(n2, Math.min(++i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
381
381
  return i2;
382
382
  }
383
383
  case D.Up: {
384
- i2 = ee(n2, Math.max(i2 - 1, l2), o2);
384
+ i2 = te(n2, Math.max(i2 - 1, l2), o2);
385
385
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
386
- for (; !e3 && i2 > l2; ) i2 = ee(n2, Math.max(--i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
386
+ for (; !e3 && i2 > l2; ) i2 = te(n2, Math.max(--i2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
387
387
  return i2;
388
388
  }
389
389
  case D.Right: {
390
- c2 = ee(n2, Math.min(c2 + 1, l2), o2);
390
+ c2 = te(n2, Math.min(c2 + 1, l2), o2);
391
391
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
392
- for (; !e3 && c2 < l2; ) c2 = ee(n2, Math.min(++c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
392
+ for (; !e3 && c2 < l2; ) c2 = te(n2, Math.min(++c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
393
393
  return c2;
394
394
  }
395
395
  case D.Left: {
396
- c2 = ee(n2, Math.max(c2 - 1, l2), o2);
396
+ c2 = te(n2, Math.max(c2 - 1, l2), o2);
397
397
  let e3 = t2({ rowIndex: i2, colIndex: c2 });
398
- for (; !e3 && c2 > l2; ) c2 = ee(n2, Math.max(--c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
398
+ for (; !e3 && c2 > l2; ) c2 = te(n2, Math.max(--c2, l2), o2), e3 = t2({ rowIndex: i2, colIndex: c2 });
399
399
  return c2;
400
400
  }
401
401
  default:
402
402
  return l2;
403
403
  }
404
- }, oe = (e2, t2 = () => true, n2, o2, r2, l2) => {
404
+ }, re = (e2, t2 = () => true, n2, o2, r2, l2) => {
405
405
  let { rowIndex: i2, colIndex: c2 } = e2;
406
406
  switch (o2) {
407
407
  case D.Down: {
408
- i2 = ee(n2, Math.min(i2 + 1, l2), o2);
408
+ i2 = te(n2, Math.min(i2 + 1, l2), o2);
409
409
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
410
- for (; e3 && i2 < l2; ) i2 = ee(n2, Math.min(++i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
410
+ for (; e3 && i2 < l2; ) i2 = te(n2, Math.min(++i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
411
411
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 - 1;
412
412
  }
413
413
  case D.Up: {
414
- i2 = ee(n2, Math.max(i2 - 1, l2), o2);
414
+ i2 = te(n2, Math.max(i2 - 1, l2), o2);
415
415
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
416
- for (; e3 && i2 > l2; ) i2 = ee(n2, Math.max(--i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
416
+ for (; e3 && i2 > l2; ) i2 = te(n2, Math.max(--i2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
417
417
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? i2 : i2 + 1;
418
418
  }
419
419
  case D.Right: {
420
- c2 = ee(n2, Math.min(c2 + 1, l2), o2);
420
+ c2 = te(n2, Math.min(c2 + 1, l2), o2);
421
421
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
422
- for (; e3 && c2 < l2; ) c2 = ee(n2, Math.min(++c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
422
+ for (; e3 && c2 < l2; ) c2 = te(n2, Math.min(++c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
423
423
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 - 1;
424
424
  }
425
425
  case D.Left: {
426
- c2 = ee(n2, Math.max(c2 - 1, l2), o2);
426
+ c2 = te(n2, Math.max(c2 - 1, l2), o2);
427
427
  let e3 = t2?.({ rowIndex: i2, colIndex: c2 });
428
- for (; e3 && c2 > l2; ) c2 = ee(n2, Math.max(--c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
428
+ for (; e3 && c2 > l2; ) c2 = te(n2, Math.max(--c2, l2), o2), e3 = t2?.({ rowIndex: i2, colIndex: c2 });
429
429
  return t2?.({ rowIndex: i2, colIndex: c2 }) ? c2 : c2 + 1;
430
430
  }
431
431
  default:
432
432
  return null;
433
433
  }
434
- }, re = (e2, t2, n2, o2, r2, l2) => {
434
+ }, le = (e2, t2, n2, o2, r2, l2) => {
435
435
  if (!t2) return l2;
436
436
  let i2, { rowIndex: c2, colIndex: s2 } = e2;
437
437
  o2 === D.Down ? i2 = { rowIndex: c2 + 1, colIndex: s2 } : o2 === D.Up ? i2 = { rowIndex: c2 - 1, colIndex: s2 } : o2 === D.Right ? i2 = { rowIndex: c2, colIndex: s2 + 1 } : o2 === D.Left && (i2 = { rowIndex: c2, colIndex: s2 - 1 });
438
438
  const a2 = t2(e2), d2 = t2(i2);
439
439
  var u2, h2;
440
- return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? ne : oe)(e2, t2, n2, o2, false, l2) ?? l2;
441
- }, le = (e2, t2) => `${e2}:${t2}`, ie = (e2, t2, n2, o2, r2, l2) => {
440
+ return (h2 = d2, !(u2 = a2) && !h2 || !u2 && h2 || u2 && !h2 ? oe : re)(e2, t2, n2, o2, false, l2) ?? l2;
441
+ }, ie = (e2, t2) => `${e2}:${t2}`, ce = (e2, t2, n2, o2, r2, l2) => {
442
442
  if (n2 - t2 >= r2 - o2) return o2;
443
443
  let i2 = o2;
444
444
  if ("nearest" === e2 && (o2 - t2 > 0 ? e2 = "start" : n2 - r2 > 0 && (e2 = "end")), "start" === e2) i2 = t2;
@@ -446,24 +446,24 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
446
446
  else if ("center" === e2) {
447
447
  i2 = t2 + (n2 - t2) / 2 - (r2 - o2) / 2;
448
448
  }
449
- return Math.max(0, Math.min(i2, l2 - (r2 - o2)));
450
- }, ce = (e2, t2, n2, o2) => (console.log("todo: implement convertToVisibleRanges"), e2), se = (e2, t2 = D.Right, n2, o2, r2, l2 = null) => {
449
+ return i2 < o2 ? Math.max(0, i2) : i2 > o2 ? Math.min(i2, l2 - (r2 - o2)) : void 0;
450
+ }, se = (e2, t2, n2, o2) => (console.log("todo: implement convertToVisibleRanges"), e2), ae = (e2, t2 = D.Right, n2, o2, r2, l2 = null) => {
451
451
  if (l2 && k.isEqualSelectionCoords(l2, e2)) return e2;
452
452
  const i2 = e2.ranges[e2.rangeIndex];
453
453
  if (!k.isRangesIntersect({ rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, i2)) return e2;
454
454
  let c2 = { ...e2.cell }, s2 = e2.rangeIndex;
455
455
  switch (t2) {
456
456
  case D.Right:
457
- c2.colIndex = ee(r2, c2.colIndex + 1, t2);
457
+ c2.colIndex = te(r2, c2.colIndex + 1, t2);
458
458
  break;
459
459
  case D.Left:
460
- c2.colIndex = ee(r2, c2.colIndex - 1, t2);
460
+ c2.colIndex = te(r2, c2.colIndex - 1, t2);
461
461
  break;
462
462
  case D.Down:
463
- c2.rowIndex = ee(o2, c2.rowIndex + 1, t2);
463
+ c2.rowIndex = te(o2, c2.rowIndex + 1, t2);
464
464
  break;
465
465
  case D.Up:
466
- c2.rowIndex = ee(o2, c2.rowIndex - 1, t2);
466
+ c2.rowIndex = te(o2, c2.rowIndex - 1, t2);
467
467
  }
468
468
  const a2 = (t3) => {
469
469
  if (t3) {
@@ -484,16 +484,16 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
484
484
  let e3 = c2.rowIndex, n3 = c2.colIndex;
485
485
  switch (t2) {
486
486
  case D.Right:
487
- n3 > i2.colEnd && (e3 = ee(o2, e3 + 1, t2), n3 = i2.colStart, e3 > i2.rowEnd && (e3 = i2.rowStart));
487
+ n3 > i2.colEnd && (e3 = te(o2, e3 + 1, t2), n3 = i2.colStart, e3 > i2.rowEnd && (e3 = i2.rowStart));
488
488
  break;
489
489
  case D.Left:
490
- n3 < i2.colStart && (e3 = ee(o2, e3 - 1, t2), n3 = i2.colEnd, e3 < i2.rowStart && (e3 = i2.rowEnd));
490
+ n3 < i2.colStart && (e3 = te(o2, e3 - 1, t2), n3 = i2.colEnd, e3 < i2.rowStart && (e3 = i2.rowEnd));
491
491
  break;
492
492
  case D.Down:
493
- e3 > i2.rowEnd && (n3 = ee(r2, n3 + 1, t2), e3 = i2.rowStart, n3 > i2.colEnd && (n3 = i2.colStart));
493
+ e3 > i2.rowEnd && (n3 = te(r2, n3 + 1, t2), e3 = i2.rowStart, n3 > i2.colEnd && (n3 = i2.colStart));
494
494
  break;
495
495
  case D.Up:
496
- e3 < i2.rowStart && (n3 = ee(r2, n3 - 1, t2), e3 = i2.rowEnd, n3 < i2.colStart && (n3 = i2.colEnd));
496
+ e3 < i2.rowStart && (n3 = te(r2, n3 - 1, t2), e3 = i2.rowEnd, n3 < i2.colStart && (n3 = i2.colEnd));
497
497
  }
498
498
  c2 = { rowIndex: e3, colIndex: n3 };
499
499
  }
@@ -502,7 +502,7 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
502
502
  const e3 = k.intersectRanges(d2, i2);
503
503
  e3 && (d2 = e3);
504
504
  }
505
- let u2 = { rowStart: ee(o2, d2.rowStart, D.Down), colStart: ee(r2, d2.colStart, D.Right), rowEnd: ee(o2, d2.rowEnd, D.Up), colEnd: ee(r2, d2.colEnd, D.Left) };
505
+ let u2 = { rowStart: te(o2, d2.rowStart, D.Down), colStart: te(r2, d2.colStart, D.Right), rowEnd: te(o2, d2.rowEnd, D.Up), colEnd: te(r2, d2.colEnd, D.Left) };
506
506
  if (u2.rowStart !== c2.rowIndex || u2.colStart !== c2.colIndex) {
507
507
  switch (t2) {
508
508
  case D.Right:
@@ -517,13 +517,13 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
517
517
  case D.Up:
518
518
  e2.ranges[s2].rowStart === u2.rowStart && e2.ranges[s2].rowEnd === u2.rowEnd && (c2.colIndex = u2.colStart), c2.colIndex === u2.colStart ? c2.rowIndex = u2.rowStart + 1 : c2.rowIndex = u2.rowStart;
519
519
  }
520
- return se({ cell: c2, ranges: e2.ranges, rangeIndex: s2 }, t2, n2, o2, r2, l2 ?? e2);
520
+ return ae({ cell: c2, ranges: e2.ranges, rangeIndex: s2 }, t2, n2, o2, r2, l2 ?? e2);
521
521
  }
522
522
  return { ranges: e2.ranges, cell: c2, rangeIndex: s2 };
523
- }, ae = (e2, t2) => {
523
+ }, de = (e2, t2) => {
524
524
  let n2, o2 = 0, r2 = 0;
525
525
  return t2.colStart < e2.colStart ? (n2 = D.Left, o2 = e2.colStart - t2.colStart, r2 = t2.colStart) : t2.colEnd > e2.colEnd ? (n2 = D.Right, o2 = t2.colEnd - e2.colEnd, r2 = t2.colEnd) : t2.rowStart < e2.rowStart ? (n2 = D.Up, o2 = e2.rowStart - t2.rowStart, r2 = t2.rowStart) : t2.rowEnd > e2.rowEnd && (n2 = D.Down, o2 = t2.rowEnd - e2.rowEnd, r2 = t2.rowEnd), { direction: n2, amount: o2, index: r2 };
526
- }, de = (e2, t2 = false, n2, o2) => {
526
+ }, ue = (e2, t2 = false, n2, o2) => {
527
527
  if (!n2) return 0;
528
528
  const r2 = !t2, l2 = r2 ? 1 : -1;
529
529
  let i2 = n2(r2 ? e2 : e2 + 1), c2 = n2(r2 ? e2 + 1 : e2), s2 = e2 + (r2 ? 2 : -1), a2 = 0;
@@ -532,34 +532,41 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
532
532
  i2 = c2, c2 = n2(s2), s2 += l2, a2++;
533
533
  }
534
534
  return a2;
535
- }, ue = (e2, t2, n2, o2, r2) => {
535
+ }, he = (e2, t2, n2, o2, r2) => {
536
536
  const l2 = {};
537
537
  let i2 = null, c2 = null;
538
- for (let s2 = 0; s2 <= n2.length && n2[s2] <= r2; s2++) {
539
- const r3 = n2[s2];
538
+ const s2 = n2.length;
539
+ for (let a2 = 0; a2 < s2 && n2[a2] <= r2; a2++) {
540
+ const r3 = n2[a2];
540
541
  if (r3 < o2) continue;
541
- const a2 = i2 === r3 ? c2 : t2 ? e2.getColOffset(r3) : e2.getRowOffset(r3), d2 = t2 ? e2.getColOffset(r3 + 1) : e2.getRowOffset(r3 + 1);
542
- i2 = r3 + 1, c2 = d2, l2[r3] = Object.freeze({ offset: a2, size: d2 - a2, spanIndex: s2 });
542
+ const s3 = i2 === r3 ? c2 : t2 ? e2.getColOffset(r3) : e2.getRowOffset(r3), d2 = t2 ? e2.getColOffset(r3 + 1) : e2.getRowOffset(r3 + 1);
543
+ i2 = r3 + 1, c2 = d2, l2[r3] = Object.freeze({ offset: s3, size: d2 - s3, spanIndex: a2 });
543
544
  }
544
545
  return Object.freeze(l2);
545
- }, he = (e2, t2, n2) => {
546
+ }, ge = (e2, t2, n2) => {
546
547
  const o2 = e2.getColOffset(t2.colStart) + (n2?.left ?? 0), r2 = e2.getRowOffset(t2.rowStart) + (n2?.top ?? 0);
547
548
  return { x: o2, y: r2, width: e2.getColOffset(t2.colEnd + 1) + (n2?.right ?? 0) - (n2?.left ?? 0) - o2, height: e2.getRowOffset(t2.rowEnd + 1) + (n2?.bottom ?? 0) - (n2?.top ?? 0) - r2 };
548
- }, ge = (e2, t2, n2) => !!n2 && (!(e2 < n2.x || e2 > n2.x + n2.width) && !(t2 < n2.y || t2 > n2.y + n2.height)), fe = (e2, t2 = true) => `M ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} ${t2 ? "Z" : ""}`, we = (t2) => {
549
+ }, fe = (e2, t2, n2) => {
550
+ if (!n2) return false;
551
+ const o2 = n2.x;
552
+ if (e2 < o2 || e2 > o2 + n2.width) return false;
553
+ const r2 = n2.y;
554
+ return !(t2 < r2 || t2 > r2 + n2.height);
555
+ }, we = (e2, t2 = true) => `M ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.top)} L ${i.boundPixel(e2.right, true)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.bottom, true)} L ${i.boundPixel(e2.left)} ${i.boundPixel(e2.top)} ${t2 ? "Z" : ""}`, xe = (t2) => {
549
556
  const { linePoints: n2, bounds: o2, pathProps: r2, style: l2, ...c2 } = t2;
550
557
  return e("svg", { width: `${i.boundPixel(o2.width, true)}`, height: `${i.boundPixel(o2.height, true)}`, viewBox: `0 0 ${i.boundPixel(o2.width, true)} ${i.boundPixel(o2.height, true)}`, style: { position: "absolute", left: `${i.boundPixel(o2.x)}px`, top: `${i.boundPixel(o2.y)}px`, width: `${i.boundPixel(o2.width, true)}px`, height: `${i.boundPixel(o2.height, true)}px`, pointerEvents: "none", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", ...l2 }, ...c2, children: e("path", { d: `M ${i.boundPixel(n2[0])} ${i.boundPixel(n2[1])} L ${i.boundPixel(n2[2])} ${i.boundPixel(n2[3])}`, fill: "none", vectorEffect: "non-scaling-stroke", stroke: "black", ...r2 }) });
551
- }, xe = (n2) => {
558
+ }, pe = (n2) => {
552
559
  const { x: o2 = 0, y: r2 = 0, width: l2 = 0, height: c2 = 0, fill: s2, stroke: a2, strokeWidth: d2 = 0, strokeDasharray: u2, strokeDashoffset: h2, clipPath: g2, pathBounds: f2, pathProps: w2, style: x2, ...p2 } = n2, m2 = r2, v2 = o2, S2 = l2, y2 = c2;
553
560
  let b2 = null;
554
561
  if (s2) {
555
- let t2 = fe({ top: 0, left: 0, bottom: y2, right: S2 });
556
- f2 && (t2 = t2 + " " + fe({ top: f2.y - m2, left: f2.x - v2, bottom: f2.height + f2.y - m2, right: f2.width + f2.x - v2 })), b2 = [e("path", { d: t2, fill: s2, stroke: "none", fillRule: "evenodd" }, "fill")];
562
+ let t2 = we({ top: 0, left: 0, bottom: y2, right: S2 });
563
+ f2 && (t2 = t2 + " " + we({ top: f2.y - m2, left: f2.x - v2, bottom: f2.height + f2.y - m2, right: f2.width + f2.x - v2 })), b2 = [e("path", { d: t2, fill: s2, stroke: "none", fillRule: "evenodd" }, "fill")];
557
564
  }
558
- return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x2 }, ...p2, children: [b2, e("path", { d: fe({ top: 0, left: 0, right: S2, bottom: y2 }), fill: "none", strokeDasharray: u2, strokeDashoffset: h2, stroke: a2, vectorEffect: "non-scaling-stroke", strokeWidth: d2, ...w2 })] });
559
- }, pe = (t2) => {
565
+ return t("svg", { width: `${i.boundPixel(l2, true)}`, height: `${i.boundPixel(c2, true)}`, viewBox: `0 0 ${i.boundPixel(l2, true)} ${i.boundPixel(c2, true)}`, preserveAspectRatio: "none", style: { position: "absolute", left: `${i.boundPixel(o2)}px`, top: `${i.boundPixel(r2)}px`, pointerEvents: "none", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top, width, height", willChange: "left, top, width, height, stroke-dashoffset", boxShadow: "rgb(60 64 67 / 5%) 0px 1px 4px 2px, rgb(255 255 255 / 15%) 0px 0px 2px 1px", overflow: "visible", ...x2 }, ...p2, children: [b2, e("path", { d: we({ top: 0, left: 0, right: S2, bottom: y2 }), fill: "none", strokeDasharray: u2, strokeDashoffset: h2, stroke: a2, vectorEffect: "non-scaling-stroke", strokeWidth: d2, ...w2 })] });
566
+ }, me = (t2) => {
560
567
  const { key: n2, ...o2 } = t2;
561
- return e(me, { ...o2 }, n2);
562
- }, me = b((t2) => {
568
+ return e(ve, { ...o2 }, n2);
569
+ }, ve = b((t2) => {
563
570
  const { stroke: n2, fill: o2, x: r2 = 0, y: l2 = 0, width: i2 = 0, height: c2 = 0, style: s2, isAnimatedStroke: d2, animatedStrokeProps: u2, range: h2, cell: g2, ...f2 } = t2, w2 = d2 || !!u2, x2 = { name: "walking-offset", dashGap: 2, speed: 50, dashLength: 8, ...u2 };
564
571
  let p2 = x2.dashGap + x2.dashLength;
565
572
  const v2 = x2.speed * p2, S2 = a().replaceAll(":", ""), y2 = `${x2.name}-${S2}`;
@@ -575,10 +582,10 @@ const Q = ({ gridRef: e2, gridMainRef: t2, orientation: n2 = T.Row, headerCount:
575
582
  return t3.sheet.insertRule(e2, 0), () => {
576
583
  document.head.removeChild(t3);
577
584
  };
578
- }, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${v2}ms linear infinite`, willChange: "stroke-dashoffset" }), e(xe, { x: r2, y: l2, width: i2, height: c2, stroke: n2, fill: o2, shapeRendering: "crispEdges", style: { ...b2, ...s2 }, ...f2 });
585
+ }, [w2]), w2 && (b2 = { strokeDasharray: `${x2.dashLength}px ${x2.dashGap}px`, strokeDashoffset: `${p2}px`, animation: `${y2} ${v2}ms linear infinite`, willChange: "stroke-dashoffset" }), e(pe, { x: r2, y: l2, width: i2, height: c2, stroke: n2, fill: o2, shapeRendering: "crispEdges", style: { ...b2, ...s2 }, ...f2 });
579
586
  });
580
- me.displayName = "Selection";
581
- const ve = b(C((t2, n2) => {
587
+ ve.displayName = "Selection";
588
+ const Se = b(C((t2, n2) => {
582
589
  const { x: o2 = 0, y: r2 = 0, borderWidth: l2 = 1, size: i2 = 6, borderStroke: c2, corner: s2, style: a2, className: d2, background: u2, ...h2 } = t2;
583
590
  if (0 === o2 || 0 === r2) return null;
584
591
  let g2 = true, f2 = true, w2 = true, x2 = true;
@@ -597,10 +604,10 @@ const ve = b(C((t2, n2) => {
597
604
  }
598
605
  return e("div", { className: M("fill-handle", d2), style: { position: "absolute", left: o2 - (i2 + (g2 ? l2 : 0)) / 2, top: r2 - (i2 + (f2 ? l2 : 0)) / 2, width: i2, height: i2, borderLeft: g2 ? `${l2}px ${c2}` : void 0, borderTop: f2 ? `${l2}px ${c2}` : void 0, borderRight: w2 ? `${l2}px ${c2}` : void 0, borderBottom: x2 ? `${l2}px ${c2}` : void 0, background: u2, cursor: "crosshair", pointerEvents: "all", transitionDuration: "0ms", transitionTimingFunction: "linear", transitionDelay: "0", transitionProperty: "left, top", willChange: "left, top", ...a2 }, tabIndex: -1, ...h2 });
599
606
  }));
600
- ve.displayName = "FillHandle";
601
- const Se = i.detectIt().supportsTouchEvents, ye = b(C((r2, l2) => {
607
+ Se.displayName = "FillHandle";
608
+ const ye = i.detectIt().supportsTouchEvents, be = b(C((r2, l2) => {
602
609
  const { range: i2, view: c2, anchor: a2, borderStroke: u2 = "rgb(33, 115, 70)", background: h2 = "white", borderWidth: g2 = 1.5, size: f2 = 22, style: x2, className: v2, selectionTouchPointerHandler: S2, onTouchSelectStart: b2, onTouchSelectEnd: C2, currentTouchAnchor: I2, scrollableElement: E2, scrollableRoot: R2, ...k2 } = r2;
603
- if (!Se) return null;
610
+ if (!ye) return null;
604
611
  const P2 = o(b2, [b2]), T2 = o(C2, [C2]), { bounds: D2, coordsPivot: O2, key: z2 } = y(() => {
605
612
  if (!i2 || !c2) return null;
606
613
  let e2 = null, t2 = null;
@@ -652,7 +659,7 @@ const Se = i.detectIt().supportsTouchEvents, ye = b(C((r2, l2) => {
652
659
  const r3 = e2(c2.getCellCoordsFromClient(t2.clientX, t2.clientY));
653
660
  return S2.onSelectionPointerMoveOrWait(t2, n2, o2, c2, r3, B2.current?.coordsPivot, true, true);
654
661
  }, onPointerUp: (e3, t2, n2) => (B2.current = null, T2?.(a2), S2.onPointerUp(e3, t2, n2)) };
655
- }, [S2, i2, c2, a2]), A2 = s(F2), [W2, { y: V2, x: U2 }] = J(), H2 = w(null), { getPortalContainer: K2, isFullscreen: N2 } = d(), [q2, j2] = p(null);
662
+ }, [S2, i2, c2, a2]), A2 = s(F2), [W2, { y: V2, x: U2 }] = Q(), H2 = w(null), { getPortalContainer: K2, isFullscreen: N2 } = d(), [q2, j2] = p(null);
656
663
  return m(() => {
657
664
  const t2 = H2.current?.getBoundingClientRect();
658
665
  if (!t2 || !D2) return void j2(null);
@@ -661,20 +668,20 @@ const Se = i.detectIt().supportsTouchEvents, ye = b(C((r2, l2) => {
661
668
  j2(L(e("div", { className: M("touch-select-handle", v2), ref: l2, style: { position: "absolute", left: n2 + (t2?.x ?? 0) - (f2 + g2) / 2, top: o2 + (t2?.y ?? 0) - (f2 + g2) / 2, width: f2, height: f2, borderWidth: `${g2}px`, border: u2, borderRadius: "50%", background: h2, boxShadow: `0 0 0 1.5px ${h2}`, cursor: "grab", pointerEvents: "all", opacity: I2 ? 0 : 1, transitionDuration: "160ms", transitionProperty: "opacity", ...x2 }, tabIndex: -1, onPointerDown: A2, ...k2 }), R2 ?? K2(), z2));
662
669
  }, [V2, U2, D2?.x, D2?.y, D2?.width, D2?.height, v2, I2, h2, f2, g2, u2, E2, N2]), D2 ? t(n, { children: [e("div", { ref: $([W2, H2]), style: { position: "absolute", left: D2.x, top: D2.y, opacity: 0 } }), q2] }) : null;
663
670
  }));
664
- ye.displayName = "TouchSelectHandle";
665
- const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Ie = Object.freeze({ colIndex: 0, rowIndex: 0 }), Ee = Object.freeze([]), Re = (e2) => {
671
+ be.displayName = "TouchSelectHandle";
672
+ const Ce = -10, Ie = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd: 0 }), Ee = Object.freeze({ colIndex: 0, rowIndex: 0 }), Re = Object.freeze([]), Me = (e2) => {
666
673
  if (e2 && e2.cell && e2.ranges && e2.rangeIndex > -1 && e2.rangeIndex <= e2.ranges.length) return e2;
667
- const t2 = { cell: null, ranges: e2?.ranges ?? Ee };
668
- return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell = Ie), k.isEqualSelectionCoords(t2, e2) ? e2 : t2;
669
- }, Me = (e2, t2, n2) => {
674
+ const t2 = { cell: null, ranges: e2?.ranges ?? Re };
675
+ return t2.rangeIndex = e2?.rangeIndex ?? t2.ranges.length - 1, t2.cell = e2?.cell, !t2.cell && t2.ranges.length > 0 && (t2.cell = { rowIndex: t2.ranges[t2.rangeIndex].rowStart, colIndex: t2.ranges[t2.rangeIndex].colStart }), t2.cell || (t2.cell = Ee), k.isEqualSelectionCoords(t2, e2) ? e2 : t2;
676
+ }, ke = (e2, t2, n2) => {
670
677
  const o2 = e2.getVisibleRangeCoords(), r2 = e2.getScrollOrientation();
671
678
  !r2.horizontal && (t2.colIndex > o2.colEnd || t2.colIndex < o2.colStart) && (t2 = { ...t2, colIndex: t2.colIndex > o2.colEnd ? o2.colEnd + 1 : o2.colEnd - 1 }, e2 = n2.current.getViewFromLocation(O.Center)), !r2.vertical && (t2.rowIndex > o2.rowEnd || t2.rowIndex < o2.rowStart) && (t2 = { ...t2, rowIndex: t2.rowIndex > o2.rowEnd ? o2.rowEnd + 1 : o2.rowEnd - 1 }, e2 = n2.current.getViewFromLocation(O.Center)), e2.scrollCellCoordsIntoView(t2);
672
- }, ke = () => false, Pe = ({ gridRef: t2, commands: n2, layout: r2, selection: l2, onSelectionChange: a2, onSelectionDragStart: d2, onSelectionDragEnd: g2, selectionPolicy: f2 = "multiple", newSelectionMode: x2 = "clear", allowDeselectSelection: b2 = true, onFillPreview: C2, onFillCancel: E2, onFillDone: R2, onFill: M2, disableFillDrag: T2 = !M2, fillHandleBorderColor: z2 = "white", hiddenRowsAt: L2, hiddenColumnsAt: $2, isContentfulCell: B2, contentfulCellFinder: F2 = re, getDataCoords: A2, alwaysScrollToActiveCoords: W2 = false, selectionBounds: V2, pointerDownInterceptor: U2, pointerMoveInterceptor: H2, mergedRanges: K2, canSelectionSpanMergedCells: N2 = ke, onMoveDragStart: q2, onMoveDragUpdate: j2, onMoveDragEnd: X2, onMoveDragDone: Y2, selectionRenderer: G2 = pe, disableMoveDrag: Z2 = !X2, getCellCoordsAsRangeCoords: _2 = k.cellToRange, moveDragHitSize: J2 = 6, moveDragOutlineSize: Q2 = 4, selectionBackgroundColor: te2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: ne2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: oe2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: le2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: ie2 = false, touchSelectHandleProps: ue2 }) => {
673
- const he2 = v(() => ({ top: V2?.top ?? 0, left: V2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), ge2 = o(M2, [M2]), fe2 = o(C2, [C2]), we2 = o(E2, [E2]), xe2 = o(R2, [R2]), me2 = o(B2, [B2]), Se2 = o(G2, [G2]), Pe2 = o((e2, t3 = false) => de(e2, t3, r2.getRowOffset, t3 ? he2().bottom : he2().top), [r2?.getRowOffset]), Te2 = o(L2 ?? Pe2, [L2]), De2 = o((e2, t3 = false) => de(e2, t3, r2.getColOffset, t3 ? he2().right : he2().left), [r2?.getColOffset]), Oe2 = o($2 ?? De2, [$2]), [ze2, Le2] = p(() => Re(l2)), $e2 = y(() => Re(ze2), [ze2]), Be2 = w($e2), Fe2 = w(true);
679
+ }, Pe = () => false, Te = ({ gridRef: t2, commands: n2, layout: r2, selection: l2, onSelectionChange: a2, onSelectionDragStart: d2, onSelectionDragEnd: g2, selectionPolicy: f2 = "multiple", newSelectionMode: x2 = "clear", allowDeselectSelection: b2 = true, onFillPreview: C2, onFillCancel: E2, onFillDone: R2, onFill: M2, disableFillDrag: T2 = !M2, fillHandleBorderColor: z2 = "white", hiddenRowsAt: L2, hiddenColumnsAt: $2, isContentfulCell: B2, contentfulCellFinder: F2 = le, getDataCoords: A2, alwaysScrollToActiveCoords: W2 = false, selectionBounds: V2, pointerDownInterceptor: U2, pointerMoveInterceptor: H2, mergedRanges: K2, canSelectionSpanMergedCells: N2 = Pe, onMoveDragStart: q2, onMoveDragUpdate: j2, onMoveDragEnd: X2, onMoveDragDone: Y2, selectionRenderer: G2 = me, disableMoveDrag: Z2 = !X2, getCellCoordsAsRangeCoords: _2 = k.cellToRange, moveDragHitSize: J2 = 6, moveDragOutlineSize: Q2 = 4, selectionBackgroundColor: ee2 = "rgba(16, 124, 65, 0.1)", selectionBorderColor: ne2 = "rgb(33, 115, 70)", selectionRemoveBorderColor: oe2 = "rgb(255, 0, 0)", selectionRemoveBackgroundColor: re2 = "rgba(250, 10, 10, 0.1)", disableTouchSelection: ie2 = false, touchSelectHandleProps: ce2 }) => {
680
+ const he2 = v(() => ({ top: V2?.top ?? 0, left: V2?.left ?? 0, bottom: t2.current?.rowCount - 1 || 0, right: t2.current?.columnCount - 1 || 0 }), []), ge2 = o(M2, [M2]), fe2 = o(C2, [C2]), we2 = o(E2, [E2]), xe2 = o(R2, [R2]), pe2 = o(B2, [B2]), ve2 = o(G2, [G2]), ye2 = o((e2, t3 = false) => ue(e2, t3, r2.getRowOffset, t3 ? he2().bottom : he2().top), [r2?.getRowOffset]), Te2 = o(L2 ?? ye2, [L2]), De2 = o((e2, t3 = false) => ue(e2, t3, r2.getColOffset, t3 ? he2().right : he2().left), [r2?.getColOffset]), Oe2 = o($2 ?? De2, [$2]), [ze2, Le2] = p(() => Me(l2)), $e2 = y(() => Me(ze2), [ze2]), Be2 = w($e2), Fe2 = w(true);
674
681
  S(P.throttle(() => {
675
682
  Le2((e2) => {
676
683
  Fe2.current = true;
677
- const t3 = Re(l2);
684
+ const t3 = Me(l2);
678
685
  return k.isEqualSelectionCoords(t3, e2) ? e2 : t3;
679
686
  });
680
687
  }, 0), [l2]), S(() => {
@@ -684,8 +691,8 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
684
691
  }, [$e2]);
685
692
  const Ae2 = v((e2) => {
686
693
  Le2((t3) => {
687
- Fe2.current = false, t3 = Re(t3);
688
- let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ?? Ee;
694
+ Fe2.current = false, t3 = Me(t3);
695
+ let n3 = "function" == typeof e2 ? e2(t3.ranges) : e2 ?? Re;
689
696
  if (k.isEqualRangesArrays(n3, t3.ranges)) return t3;
690
697
  let o2 = Math.max(n3.length ? 0 : -1, Math.min(t3.rangeIndex, n3.length - 1)), r3 = t3.cell;
691
698
  -1 === o2 || k.isCellWithinRange(r3, n3[o2]) || (r3 = { rowIndex: n3[o2].rowStart, colIndex: n3[o2].colStart }), 1 === n3.length && k.isSingleCell(n3[0]) && k.isCellWithinRange(r3, n3[0]) && (n3 = [], o2 = -1);
@@ -694,8 +701,8 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
694
701
  });
695
702
  }, []), We2 = o((e2) => {
696
703
  Le2((t3) => {
697
- Fe2.current = false, t3 = Re(t3);
698
- const n3 = e2 ?? Ie, o2 = _2(n3);
704
+ Fe2.current = false, t3 = Me(t3);
705
+ const n3 = e2 ?? Ee, o2 = _2(n3);
699
706
  if (!k.isSingleCell(o2) && 0 === t3.ranges.length) return { ranges: [o2], rangeIndex: 0, cell: n3 };
700
707
  if (k.isEqualCells(n3, t3.cell)) return t3;
701
708
  let r3 = t3.ranges, l3 = t3.rangeIndex;
@@ -703,9 +710,9 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
703
710
  const i2 = { ranges: r3, rangeIndex: l3, cell: n3 };
704
711
  return k.isEqualSelectionCoords(i2, t3) ? t3 : i2;
705
712
  });
706
- }, [_2]), [Ve2, Ue2] = p(null), [He2, Ke2] = p(null), Ne2 = w(null), [qe2, je2] = p(null), Xe2 = w(null), Ye2 = w(null), [Ge2, Ze2] = p(null), _e2 = w(null), Je2 = w(null), Qe = w(K2);
713
+ }, [_2]), [Ve2, Ue2] = p(null), [He2, Ke2] = p(null), Ne2 = w(null), [qe2, je2] = p(null), Xe2 = w(null), Ye2 = w(null), [Ge2, Ze2] = p(null), _e2 = w(null), Je2 = w(null), Qe2 = w(K2);
707
714
  m(() => {
708
- Qe.current = K2;
715
+ Qe2.current = K2;
709
716
  }, [K2]);
710
717
  const et = o((e2, n3 = { inline: "nearest", block: "nearest" }) => {
711
718
  let { rowIndex: o2, colIndex: r3 } = e2;
@@ -719,7 +726,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
719
726
  if (r3) return o2;
720
727
  const l3 = _2(e2), i2 = _2(n3), c2 = { rowStart: Math.min(l3.rowStart, i2.rowStart), colStart: Math.min(l3.colStart, i2.colStart), rowEnd: Math.max(l3.rowEnd, i2.rowEnd), colEnd: Math.max(l3.colEnd, i2.colEnd) };
721
728
  let s2;
722
- return "function" == typeof Qe.current ? s2 = Qe.current(c2) : K2 && (s2 = K2), s2 ? k.extendRangeToUnionRanges(c2, s2) : c2;
729
+ return "function" == typeof Qe2.current ? s2 = Qe2.current(c2) : K2 && (s2 = K2), s2 ? k.extendRangeToUnionRanges(c2, s2) : c2;
723
730
  }, [N2, _2]), ot = o((e2, t3, n3) => {
724
731
  const o2 = e2.ranges.length > 0 ? e2.ranges[e2.rangeIndex] : { rowStart: e2.cell.rowIndex, colStart: e2.cell.colIndex, rowEnd: e2.cell.rowIndex, colEnd: e2.cell.colIndex }, r3 = { rowStart: Math.min(t3.rowIndex ?? o2.rowStart, n3.rowIndex ?? o2.rowStart), colStart: Math.min(t3.colIndex ?? o2.colStart, n3.colIndex ?? o2.colStart), rowEnd: Math.max(t3.rowIndex ?? o2.rowEnd, n3.rowIndex ?? o2.rowEnd), colEnd: Math.max(t3.colIndex ?? o2.colEnd, n3.colIndex ?? o2.colEnd) }, l3 = { rowIndex: r3.rowStart, colIndex: r3.colStart }, i2 = { rowIndex: r3.rowEnd, colIndex: r3.colEnd };
725
732
  if (tt(l3) || tt(i2)) return;
@@ -740,7 +747,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
740
747
  "clear" === x2 ? (_e2.current = l3, ct()) : "modify" === x2 ? rt(r3) : it(r3), We2(l3);
741
748
  }, []), it = v((e2, t3 = e2, n3) => {
742
749
  "multiple" !== f2 || !e2 || tt(e2) || tt(t3) || Le2((o2) => {
743
- Fe2.current = false, o2 = Re(o2);
750
+ Fe2.current = false, o2 = Me(o2);
744
751
  const r3 = nt(e2, t3);
745
752
  if (!r3) return o2;
746
753
  let l3 = o2.ranges.length > 0 ? [...o2.ranges] : [nt(o2.cell, o2.cell)];
@@ -749,7 +756,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
749
756
  return k.isEqualSelectionCoords(i2, o2) ? o2 : i2;
750
757
  });
751
758
  }, []), ct = () => {
752
- Ae2(Ee);
759
+ Ae2(Re);
753
760
  }, st = "touch" === i.detectIt().primaryInput, at = w(null), dt = w(null), ut = w(null), ht = y(() => ({ onPointerDown: (e2) => {
754
761
  if (!t2 || !t2.current) return false;
755
762
  const n3 = e2.nativeEvent, o2 = t2.current.getViewFromClient(n3.clientX, n3.clientY);
@@ -792,7 +799,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
792
799
  const o3 = nt(t3, n4);
793
800
  Ye2.current = o3, je2(o3);
794
801
  } else rt(l3);
795
- ut.current = n3, Me(r3, l3, t2);
802
+ ut.current = n3, ke(r3, l3, t2);
796
803
  }
797
804
  }, 60), onPointerUp: (e2) => {
798
805
  if (at.current = null, "touch" === e2.pointerType || "touchend" === e2.type) {
@@ -813,7 +820,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
813
820
  if (!Xe2.current) return;
814
821
  const n3 = Ye2.current;
815
822
  Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
816
- if (Fe2.current = false, 0 === (e3 = Re(e3)).ranges.length) return e3;
823
+ if (Fe2.current = false, 0 === (e3 = Me(e3)).ranges.length) return e3;
817
824
  let t3 = [], o2 = -1, r3 = e3.cell;
818
825
  for (let l4 = 0; l4 < e3.ranges.length; l4++) {
819
826
  const i2 = e3.ranges[l4];
@@ -869,7 +876,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
869
876
  const o3 = nt(t3, n4);
870
877
  Ye2.current = o3, je2(o3);
871
878
  } else rt(u2, i2, s2);
872
- c2 && Me(d3, u2, t2);
879
+ c2 && ke(d3, u2, t2);
873
880
  }
874
881
  }, onPointerUp: (e2) => {
875
882
  at.current = null, e2.stopPropagation(), e2.preventDefault(), e2.stopImmediatePropagation();
@@ -881,7 +888,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
881
888
  if (!Xe2.current) return;
882
889
  const t3 = Ye2.current;
883
890
  Xe2.current = null, Ye2.current = null, je2(null), Le2((e3) => {
884
- if (Fe2.current = false, 0 === (e3 = Re(e3)).ranges.length) return e3;
891
+ if (Fe2.current = false, 0 === (e3 = Me(e3)).ranges.length) return e3;
885
892
  let n3 = [], o2 = -1, r3 = e3.cell;
886
893
  for (let l4 = 0; l4 < e3.ranges.length; l4++) {
887
894
  const i2 = e3.ranges[l4];
@@ -931,29 +938,29 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
931
938
  if (!l3) {
932
939
  switch (e2) {
933
940
  case D.Up:
934
- a3 = ee(Te2, Math.max(s2.rowStart - 1, u2.top), e2);
941
+ a3 = te(Te2, Math.max(s2.rowStart - 1, u2.top), e2);
935
942
  break;
936
943
  case D.Down:
937
- a3 = ee(Te2, Math.min(s2.rowEnd + 1, u2.bottom), e2);
944
+ a3 = te(Te2, Math.min(s2.rowEnd + 1, u2.bottom), e2);
938
945
  break;
939
946
  case D.Left:
940
- d3 = ee(Oe2, Math.max(s2.colStart - 1, u2.left), e2);
947
+ d3 = te(Oe2, Math.max(s2.colStart - 1, u2.left), e2);
941
948
  break;
942
949
  case D.Right:
943
- d3 = ee(Oe2, Math.min(s2.colEnd + 1, u2.right), e2);
950
+ d3 = te(Oe2, Math.min(s2.colEnd + 1, u2.right), e2);
944
951
  }
945
952
  if (o2) switch (e2) {
946
953
  case D.Up:
947
- a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, me2, Te2, e2, false, Math.max(u2.top, Te2(u2.top, false)));
954
+ a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, pe2, Te2, e2, false, Math.max(u2.top, Te2(u2.top, false)));
948
955
  break;
949
956
  case D.Down:
950
- a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, me2, Te2, e2, false, Math.min(u2.bottom, u2.bottom - Te2(u2.bottom, true)));
957
+ a3 = F2({ ...c2, colIndex: $e2.cell.colIndex }, pe2, Te2, e2, false, Math.min(u2.bottom, u2.bottom - Te2(u2.bottom, true)));
951
958
  break;
952
959
  case D.Left:
953
- d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, me2, Oe2, e2, false, Math.max(u2.left, Oe2(u2.left, false)));
960
+ d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, pe2, Oe2, e2, false, Math.max(u2.left, Oe2(u2.left, false)));
954
961
  break;
955
962
  case D.Right:
956
- d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, me2, Oe2, e2, false, Math.min(u2.right, u2.right - Oe2(u2.right, true)));
963
+ d3 = F2({ ...c2, rowIndex: $e2.cell.rowIndex }, pe2, Oe2, e2, false, Math.min(u2.right, u2.right - Oe2(u2.right, true)));
957
964
  }
958
965
  }
959
966
  let h2 = null;
@@ -989,9 +996,9 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
989
996
  if (0 === $e2.ranges.length) return void wt(e2);
990
997
  const n3 = _2($e2.cell);
991
998
  if (k.isEqualRangesArrays([n3], $e2.ranges)) return void wt(e2);
992
- const o2 = se($e2, e2, _2, Te2, Oe2);
999
+ const o2 = ae($e2, e2, _2, Te2, Oe2);
993
1000
  Le2((e3) => {
994
- Fe2.current = false, e3 = Re(e3);
1001
+ Fe2.current = false, e3 = Me(e3);
995
1002
  const t3 = { ...e3, cell: o2.cell, rangeIndex: o2.rangeIndex };
996
1003
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
997
1004
  }), o2.cell && et(o2.cell);
@@ -1027,26 +1034,26 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1027
1034
  const n3 = e2 === D.Left || e2 === D.Up;
1028
1035
  let o2 = $e2.rangeIndex + (n3 ? -1 : 1);
1029
1036
  o2 < 0 ? o2 = $e2.ranges.length - 1 : o2 > $e2.ranges.length - 1 && (o2 = 0);
1030
- const r3 = $e2.ranges[o2], l3 = se({ cell: { rowIndex: r3.rowEnd, colIndex: r3.colEnd }, rangeIndex: 0, ranges: [r3] }, D.Right, _2, Te2, Oe2);
1037
+ const r3 = $e2.ranges[o2], l3 = ae({ cell: { rowIndex: r3.rowEnd, colIndex: r3.colEnd }, rangeIndex: 0, ranges: [r3] }, D.Right, _2, Te2, Oe2);
1031
1038
  Le2((e3) => {
1032
- Fe2.current = false, e3 = Re(e3);
1039
+ Fe2.current = false, e3 = Me(e3);
1033
1040
  const t3 = { ...e3, cell: l3.cell, rangeIndex: o2 };
1034
1041
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
1035
1042
  }), l3.cell && et(l3.cell);
1036
1043
  }, [$e2, _2]), Mt = o(() => {
1037
- const e2 = ce($e2);
1044
+ const e2 = se($e2);
1038
1045
  Le2((t3) => {
1039
- Fe2.current = false, t3 = Re(t3);
1046
+ Fe2.current = false, t3 = Me(t3);
1040
1047
  const n3 = { ...t3, visibleSelection: e2 };
1041
1048
  return k.isEqualSelectionCoords(n3, t3) ? t3 : n3;
1042
1049
  }), e2.cell && et(e2.cell);
1043
1050
  }, [$e2, _2]), kt = o(() => {
1044
1051
  if (!t2.current) return;
1045
1052
  if (0 === $e2.ranges.length) return;
1046
- const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 = ce({ cell: e2, rangeIndex: 0, ranges: [n3] }), r3 = o2.ranges[o2.rangeIndex];
1053
+ const e2 = $e2.cell, n3 = $e2.ranges[$e2.rangeIndex], o2 = se({ cell: e2, rangeIndex: 0, ranges: [n3] }), r3 = o2.ranges[o2.rangeIndex];
1047
1054
  let l3;
1048
1055
  l3 = r3.rowStart === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowStart, colIndex: r3.colEnd } : r3.rowStart === e2.rowIndex && r3.colEnd === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colStart } : r3.rowEnd === e2.rowIndex && r3.colStart === e2.colIndex ? { rowIndex: r3.rowEnd, colIndex: r3.colEnd } : { rowIndex: r3.rowStart, colIndex: r3.colStart }, Le2((e3) => {
1049
- e3 = Re(e3);
1056
+ e3 = Me(e3);
1050
1057
  const t3 = { ...e3, cell: l3 };
1051
1058
  return k.isEqualSelectionCoords(t3, e3) ? e3 : t3;
1052
1059
  }), l3 && et(l3);
@@ -1109,9 +1116,10 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1109
1116
  }, []), on = y(() => {
1110
1117
  const e2 = he2();
1111
1118
  return ((e3, t3, n3, o2, r3) => {
1112
- for (let l3 = 0; l3 < e3.length; l3++) {
1113
- const i2 = e3[l3];
1114
- if (i2.rowStart === t3 && i2.colStart === n3 && i2.rowEnd === o2 && i2.colEnd === r3) return true;
1119
+ const l3 = e3.length;
1120
+ for (let i2 = 0; i2 < l3; i2++) {
1121
+ const l4 = e3[i2];
1122
+ if (l4.rowStart === t3 && l4.colStart === n3 && l4.rowEnd === o2 && l4.colEnd === r3) return true;
1115
1123
  }
1116
1124
  return false;
1117
1125
  })($e2.ranges, e2.top, e2.left, e2.bottom, e2.right);
@@ -1125,7 +1133,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1125
1133
  if (!t3) return;
1126
1134
  let r3 = null;
1127
1135
  if (r3 = n3.length > 0 ? n3[n3.length - 1] : _2(o2), r3.colEnd >= r3.colStart && r3.rowEnd >= r3.rowStart) {
1128
- const n4 = ae(r3, t3);
1136
+ const n4 = de(r3, t3);
1129
1137
  let o3 = e2 ? ge2 : fe2;
1130
1138
  try {
1131
1139
  o3?.(r3, t3, n4.direction);
@@ -1152,10 +1160,10 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1152
1160
  if (!c2) return;
1153
1161
  const d3 = c2.rowStart < a3.rowStart ? D.Up : c2.rowEnd > a3.rowEnd ? D.Down : c2.colEnd > a3.colEnd ? D.Right : D.Left, u2 = he2();
1154
1162
  d3 === D.Left && (c2 = { ...a3, colStart: Math.max(u2.left, c2.colStart) }), d3 === D.Up && (c2 = { ...a3, rowStart: Math.max(u2.top, c2.rowStart) }), d3 === D.Right && (c2 = { ...a3, colEnd: Math.min(u2.right, c2.colEnd) }), d3 === D.Down && (c2 = { ...a3, rowEnd: Math.min(u2.bottom, c2.rowEnd) });
1155
- const h2 = ae(a3, c2);
1163
+ const h2 = de(a3, c2);
1156
1164
  if (!N2?.(a3)) {
1157
1165
  let e3;
1158
- "function" == typeof Qe.current ? e3 = Qe.current(a3) : K2 && (e3 = K2), c2 = ((e4, t3, n4, o3, r4, l4) => {
1166
+ "function" == typeof Qe2.current ? e3 = Qe2.current(a3) : K2 && (e3 = K2), c2 = ((e4, t3, n4, o3, r4, l4) => {
1159
1167
  const i3 = { ...t3 };
1160
1168
  if (0 === n4.length) return i3;
1161
1169
  if (r4 === D.Left) {
@@ -1184,7 +1192,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1184
1192
  }
1185
1193
  ln(false);
1186
1194
  }
1187
- ut.current = n3, Me(r3, l3, t2);
1195
+ ut.current = n3, ke(r3, l3, t2);
1188
1196
  }, onPointerUp: (e2, n3) => {
1189
1197
  ut.current = n3, Promise.resolve(ln(true)).finally(() => {
1190
1198
  xe2?.(), Ke2(null), Ne2.current = null, cn.current = null, Ue2(null), t2.current?.focus();
@@ -1205,7 +1213,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1205
1213
  let s2 = t2.current.getViewFromLocation(i2), a3 = s2.getCellCoordsFromClient(e2.clientX - c2.x, e2.clientY - c2.y, true);
1206
1214
  if (!a3) return;
1207
1215
  const d3 = gn.current.cell, u2 = gn.current.range, h2 = he2(), g3 = u2.colEnd - u2.colStart + 1, f3 = Math.min(Math.max(0, d3.colIndex - u2.colStart), g3 - 1), w2 = Math.min(h2.right - g3 + 1, Math.max(h2.left, a3.colIndex - f3)), x3 = u2.rowEnd - u2.rowStart + 1, p2 = Math.min(Math.max(0, d3.rowIndex - u2.rowStart), x3 - 1), m2 = Math.min(h2.bottom - x3 + 1, Math.max(h2.top, a3.rowIndex - p2)), v2 = { colStart: w2, colEnd: w2 + g3 - 1, rowStart: m2, rowEnd: m2 + x3 - 1 };
1208
- k.isEqualRanges(un, v2) && !((e3) => !e3 || !ut.current || ut.current.ctrlKey !== e3.ctrlKey || ut.current.shiftKey !== e3.shiftKey || ut.current.altKey !== e3.altKey || ut.current.metaKey !== e3.metaKey)(e2) || (hn(v2), j2?.(v2, e2, n3)), ut.current = n3, Me(s2, a3, t2);
1216
+ k.isEqualRanges(un, v2) && !((e3) => !e3 || !ut.current || ut.current.ctrlKey !== e3.ctrlKey || ut.current.shiftKey !== e3.shiftKey || ut.current.altKey !== e3.altKey || ut.current.metaKey !== e3.metaKey)(e2) || (hn(v2), j2?.(v2, e2, n3)), ut.current = n3, ke(s2, a3, t2);
1209
1217
  }, onPointerUp: (e2, n3) => {
1210
1218
  ut.current = n3;
1211
1219
  const o2 = () => {
@@ -1221,86 +1229,86 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1221
1229
  return pn.current = e2, e2;
1222
1230
  }, [$e2]), vn = v((n3) => {
1223
1231
  let o2 = null, r3 = "br";
1224
- const l3 = [], i2 = { stroke: z2, fill: te2, strokeWidth: 0.5 }, c2 = (e2, t3, o3) => {
1225
- const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2), be);
1232
+ const l3 = [], i2 = { stroke: z2, fill: ee2, strokeWidth: 0.5 }, c2 = (e2, t3, o3) => {
1233
+ const r4 = n3.toClipBounds(n3.getRangeCoordsBounds(e2), Ce);
1226
1234
  if (!r4) return;
1227
1235
  r4.x = r4.width > 0 ? r4.x : r4.x - i2.strokeWidth / 2, r4.y = r4.height > 0 ? r4.y : r4.y - i2.strokeWidth / 2, r4.width = Math.max(r4.width, i2.strokeWidth), r4.height = Math.max(r4.height, i2.strokeWidth);
1228
1236
  const l4 = { key: `selection-fill-${t3}`, range: e2, ...r4, ...i2 };
1229
1237
  if (o3) {
1230
1238
  const e3 = n3.getCellCoordsAsRangeCoords(o3);
1231
- l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3), be), l4.pathBounds && (l4.pathBounds.width <= 0 || l4.pathBounds.height <= 0) && (delete l4.pathBounds, delete l4.cell);
1239
+ l4.cell = o3, l4.pathBounds = n3.toClipBounds(n3.getRangeCoordsBounds(e3), Ce), l4.pathBounds && (l4.pathBounds.width <= 0 || l4.pathBounds.height <= 0) && (delete l4.pathBounds, delete l4.cell);
1232
1240
  }
1233
- return Se2(l4);
1241
+ return ve2(l4);
1234
1242
  };
1235
- let s2 = $e2 ? Re($e2) : null;
1236
- const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) : Ce;
1243
+ let s2 = $e2 ? Me($e2) : null;
1244
+ const a3 = s2?.cell ? n3.getCellCoordsAsRangeCoords(s2?.cell) : Ie;
1237
1245
  !s2 || s2.ranges && 0 !== s2.ranges.length || (s2 = { ranges: [a3], rangeIndex: 0, cell: s2.cell });
1238
1246
  for (let e2 = 0; s2 && e2 < s2.ranges.length; e2++) {
1239
1247
  const t3 = s2.ranges[e2], i3 = c2(t3, e2, e2 === s2.rangeIndex ? s2.cell : null);
1240
1248
  i3 && l3.push(i3);
1241
- const a4 = 2, d4 = 0.5, u3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1249
+ const a4 = 2, d4 = 0.5, u3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: 0, left: 0, right: 0, bottom: 0 }), Ce);
1242
1250
  if (u3) {
1243
1251
  const n4 = (s2.ranges.length, 4);
1244
- l3.push(Se2({ range: t3, key: `selection-inside-edge-${e2}`, x: u3.x - 1, y: u3.y - 1, width: Math.max(u3.width + 1, 0), height: Math.max(u3.height + 1, 0), style: { overflow: "hidden" }, stroke: z2, strokeWidth: n4 }));
1252
+ l3.push(ve2({ range: t3, key: `selection-inside-edge-${e2}`, x: u3.x - 1, y: u3.y - 1, width: Math.max(u3.width + 1, 0), height: Math.max(u3.height + 1, 0), style: { overflow: "hidden" }, stroke: z2, strokeWidth: n4 }));
1245
1253
  }
1246
1254
  if (1 === s2.ranges.length) {
1247
- const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3), be);
1255
+ const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3), Ce);
1248
1256
  if (o3) {
1249
- Z2 || l3.push(Se2({ range: t3, key: `move-selection-hit-box-${e2}`, x: o3.width > 1 ? o3.x : o3.x - (J2 / 2 + 1), y: o3.height > 1 ? o3.y : o3.y - (J2 / 2 + 1), width: Math.max(o3.width + 2, 1), height: Math.max(o3.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: un ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: J2, ...xn }));
1257
+ Z2 || l3.push(ve2({ range: t3, key: `move-selection-hit-box-${e2}`, x: o3.width > 1 ? o3.x : o3.x - (J2 / 2 + 1), y: o3.height > 1 ? o3.y : o3.y - (J2 / 2 + 1), width: Math.max(o3.width + 2, 1), height: Math.max(o3.height + 2, 1), stroke: "transparent", style: { boxShadow: "none" }, pathProps: { cursor: un ? void 0 : "move", pointerEvents: "stroke" }, strokeWidth: J2, ...xn }));
1250
1258
  const n4 = a4;
1251
- l3.push(Se2({ range: t3, key: `selection-single-${e2}`, x: o3.x - n4 / 2, y: o3.y - n4 / 2, width: Math.max(o3.width + n4 / 2, 1), height: Math.max(o3.height + n4 / 2, 1), stroke: ne2, strokeWidth: n4 }));
1259
+ l3.push(ve2({ range: t3, key: `selection-single-${e2}`, x: o3.x - n4 / 2, y: o3.y - n4 / 2, width: Math.max(o3.width + n4 / 2, 1), height: Math.max(o3.height + n4 / 2, 1), stroke: ne2, strokeWidth: n4 }));
1252
1260
  }
1253
1261
  } else {
1254
- const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }), be);
1255
- o3 && l3.push(Se2({ range: t3, key: `selection-multi-${e2}`, x: o3.width > 1 ? o3.x : o3.x - d4 / 2, y: o3.height > 1 ? o3.y : o3.y - d4 / 2, width: Math.max(o3.width, d4) + 1, height: Math.max(o3.height, d4) + 1, stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1262
+ const o3 = n3.toClipBounds(n3.getRangeCoordsBounds(t3, { top: -1, left: -1, right: -2, bottom: -2 }), Ce);
1263
+ o3 && l3.push(ve2({ range: t3, key: `selection-multi-${e2}`, x: o3.width > 1 ? o3.x : o3.x - d4 / 2, y: o3.height > 1 ? o3.y : o3.y - d4 / 2, width: Math.max(o3.width, d4) + 1, height: Math.max(o3.height, d4) + 1, stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1256
1264
  }
1257
1265
  if (s2.ranges.length > 1 && e2 === s2.rangeIndex) {
1258
- const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }), be);
1259
- r4 && l3.push(Se2({ range: t3, key: `selection-anchor-${e2}`, x: r4.x, y: r4.y, width: Math.max(r4.width, d4), height: Math.max(r4.height, d4), stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1266
+ const o3 = n3.getCellCoordsAsRangeCoords(s2.cell), r4 = n3.toClipBounds(n3.getRangeCoordsBounds(o3, { top: 1, left: 1, right: -1, bottom: -1 }), Ce);
1267
+ r4 && l3.push(ve2({ range: t3, key: `selection-anchor-${e2}`, x: r4.x, y: r4.y, width: Math.max(r4.width, d4), height: Math.max(r4.height, d4), stroke: ne2, style: { overflow: "hidden" }, strokeWidth: 2 }));
1260
1268
  }
1261
1269
  if (e2 === s2.ranges.length - 1) {
1262
1270
  o2 = null, r3 = null;
1263
1271
  const e3 = t3.rowStart === he2().top && t3.rowEnd === he2().bottom, l4 = t3.colStart === he2().left && t3.colEnd === he2().right, i4 = n3.getRangeCoordsBounds(t3);
1264
1272
  let c3 = null;
1265
1273
  if (e3 || l4) {
1266
- if (c3 = n3.toClipBounds(i4, be), Object.keys(n3.allViews()).length > 1) {
1274
+ if (c3 = n3.toClipBounds(i4, Ce), Object.keys(n3.allViews()).length > 1) {
1267
1275
  const o3 = n3.getVisibleRangeCoords(), r4 = n3.allViews()[O.TopLeft], i5 = n3.allViews()[O.Top], s3 = n3.allViews()[O.Left], a5 = n3.getAnchor();
1268
1276
  (l4 && (a5 === O.Top && r4 || a5 === O.Center && s3 || !k.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd }, o3) && !k.isCellWithinRange({ colIndex: t3.colStart, rowIndex: t3.rowEnd + 1 }, o3)) || e3 && (a5 === O.Left && r4 || a5 === O.Center && i5 || !k.isCellWithinRange({ colIndex: t3.colEnd, rowIndex: t3.rowStart }, o3) && !k.isCellWithinRange({ colIndex: t3.colEnd + 1, rowIndex: t3.rowStart }, o3))) && (c3 = null);
1269
1277
  }
1270
- } else c3 = n3.toClipBounds(i4, be);
1278
+ } else c3 = n3.toClipBounds(i4, Ce);
1271
1279
  if (!c3 || 0 === c3.width || 0 === c3.height) continue;
1272
1280
  o2 = { x: c3.x + c3.width + 1, y: c3.y + c3.height + 1 }, 0 === c3.width || 0 === c3.height || t3.rowStart === he2().top && t3.colStart === he2().left && t3.rowEnd === he2().bottom && t3.colEnd === he2().right || (e3 ? (o2.y = a4, r3 = "tr") : l4 && (o2.x = a4, r3 = "bl"));
1273
1281
  }
1274
1282
  }
1275
1283
  let d3 = null;
1276
1284
  if (qe2) {
1277
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1285
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(qe2, { top: 0, left: 0, right: 0, bottom: 0 }), Ce);
1278
1286
  if (e2) {
1279
1287
  const t3 = 2;
1280
- d3 = Se2({ ...i2, range: qe2, key: "remove-selection", x: e2.x, y: e2.y, width: e2.width, height: e2.height, strokeWidth: t3, stroke: oe2, fill: le2 });
1288
+ d3 = ve2({ ...i2, range: qe2, key: "remove-selection", x: e2.x, y: e2.y, width: e2.width, height: e2.height, strokeWidth: t3, stroke: oe2, fill: re2 });
1281
1289
  }
1282
1290
  }
1283
1291
  let u2 = null;
1284
1292
  if (He2) {
1285
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }), be);
1293
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(He2, { top: 0, left: 0, right: 0, bottom: 0 }), Ce);
1286
1294
  if (e2) {
1287
1295
  const t3 = 2;
1288
- u2 = Se2({ range: He2, key: "selection-fill-outline", x: e2.x - t3 / 2, y: e2.y - t3 / 2, width: e2.width + t3 / 2, height: e2.height + t3 / 2, strokeWidth: t3, stroke: ne2, strokeDasharray: "3 2" });
1296
+ u2 = ve2({ range: He2, key: "selection-fill-outline", x: e2.x - t3 / 2, y: e2.y - t3 / 2, width: e2.width + t3 / 2, height: e2.height + t3 / 2, strokeWidth: t3, stroke: ne2, strokeDasharray: "3 2" });
1289
1297
  }
1290
1298
  }
1291
1299
  let h2 = null;
1292
- !T2 && o2 && !un && (h2 = I(ve, { ...o2, corner: r3, size: 7.5, borderStroke: `${z2} solid`, style: { borderRadius: 1 }, background: ne2, ...dn, key: "fillHandle" }));
1300
+ !T2 && o2 && !un && (h2 = I(Se, { ...o2, corner: r3, size: 7.5, borderStroke: `${z2} solid`, style: { borderRadius: 1 }, background: ne2, ...dn, key: "fillHandle" }));
1293
1301
  const g3 = [...l3];
1294
1302
  if (d3 && g3.push(d3), u2 && g3.push(u2), h2 && g3.push(h2), !ie2 && st && 1 === s2?.ranges.length && s2.ranges[s2.ranges.length - 1]) {
1295
- const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === he2().top && o3.rowEnd === he2().bottom, l4 = o3.colStart === he2().left && o3.colEnd === he2().right, i3 = { view: n3, range: o3, borderStroke: `${ne2} solid`, background: z2, selectionTouchPointerHandler: ft, ...ue2, onTouchSelectStart: (e2) => Ze2(e2), onTouchSelectEnd: () => Ze2(null), currentTouchAnchor: Ge2 };
1296
- g3.push(e(ye, { anchor: l4 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...i3 }, "touch-select-handle-after")), g3.push(e(ye, { anchor: l4 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...i3 }, "touch-select-handle-before"));
1303
+ const o3 = s2.ranges[s2.ranges.length - 1], r4 = o3.rowStart === he2().top && o3.rowEnd === he2().bottom, l4 = o3.colStart === he2().left && o3.colEnd === he2().right, i3 = { view: n3, range: o3, borderStroke: `${ne2} solid`, background: z2, selectionTouchPointerHandler: ft, ...ce2, onTouchSelectStart: (e2) => Ze2(e2), onTouchSelectEnd: () => Ze2(null), currentTouchAnchor: Ge2 };
1304
+ g3.push(e(be, { anchor: l4 ? "b" : r4 ? "r" : "br", scrollableElement: t2.current, ...i3 }, "touch-select-handle-after")), g3.push(e(be, { anchor: l4 ? "t" : r4 ? "l" : "tl", scrollableElement: t2.current, ...i3 }, "touch-select-handle-before"));
1297
1305
  }
1298
1306
  if (un) {
1299
- const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }), be);
1300
- e2 && g3.push(Se2({ range: un, key: "selection-move-outline", x: e2.x - Q2 / 2, y: e2.y - Q2 / 2, width: Math.max(e2.width + Q2 / 2, 1), height: Math.max(e2.height + Q2 / 2, 1), stroke: ne2, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: Q2 }));
1307
+ const e2 = n3.toClipBounds(n3.getRangeCoordsBounds(un, { top: 1, left: 1, right: 1, bottom: 1 }), Ce);
1308
+ e2 && g3.push(ve2({ range: un, key: "selection-move-outline", x: e2.x - Q2 / 2, y: e2.y - Q2 / 2, width: Math.max(e2.width + Q2 / 2, 1), height: Math.max(e2.height + Q2 / 2, 1), stroke: ne2, style: { boxShadow: "none", transitionDuration: "70ms", transitionTimingFunction: "ease-in", transitionProperty: "left, top, width, height", willChange: "left, top, width, height" }, strokeWidth: Q2 }));
1301
1309
  }
1302
1310
  return e("div", { children: g3 }, "selection");
1303
- }, [mn, qe2, T2, He2, Z2, un, he2, z2, ne2, te2, oe2, le2, ie2, ue2, Ge2]), Sn = y(() => {
1311
+ }, [mn, qe2, T2, He2, Z2, un, he2, z2, ne2, ee2, oe2, re2, ie2, ce2, Ge2]), Sn = y(() => {
1304
1312
  const e2 = () => t2.current;
1305
1313
  return [new u("moveToPageDown", e2, { label: "Page Down", description: "Shift viewport down one page.", shortcut: [{ key: "PageDown" }] }, () => Pt(false)), new u("selectToPageDown", e2, { label: "Select To Page Down", description: "Shift viewport and select down one page.", shortcut: [{ key: "PageDown", modifiers: [h.Shift] }] }, () => Pt(true)), new u("moveToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [h.Alt] }] }, () => Dt(false)), new u("selectToPageRight", e2, { label: "Page Right", description: "Shift viewport right one page.", shortcut: [{ key: "PageDown", modifiers: [h.Alt, h.Shift] }] }, () => Dt(true)), new u("moveToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp" }] }, () => Tt(false)), new u("selectToPageUp", e2, { label: "Page Up", description: "Shift viewport up one page.", shortcut: [{ key: "PageUp", modifiers: [h.Shift] }] }, () => Tt(true)), new u("moveToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [h.Alt] }] }, () => Ot(false)), new u("selectToPageLeft", e2, { label: "Page Left", description: "Shift viewport left one page.", shortcut: [{ key: "PageUp", modifiers: [h.Alt, h.Shift] }] }, () => Ot(true)), new u("selectColumn", e2, { label: "Select Column", description: "Select the columns for the selected cells.", shortcut: { key: "Space", modifiers: [h.Ctrl] } }, pt), new u("selectRow", e2, { label: "Select Row", description: "Select the rows for the selected cells.", shortcut: { key: "Space", modifiers: [h.Shift] } }, mt), new u("selectToColumnStart", e2, { label: "Select To Column Start", description: "Select the columns to the beginning of the sheet." }, () => St(true)), new u("selectToColumnEnd", e2, { label: "Select To Column End", description: "Select the columns to the end of the sheet." }, () => yt(true)), new u("moveToRowStart", e2, { label: "Move to Row Home", description: "Move to the beginning of the row.", shortcut: [{ key: "Home" }] }, () => bt(false)), new u("selectToRowStart", e2, { label: "Select to Row Home", description: "Select to the beginning of the row.", shortcut: [{ key: "Home", modifiers: [h.Shift] }] }, () => bt(true)), new u("moveToSheetStart", e2, { label: "Move to Sheet Home", description: "Move to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [h.Ctrl] }] }, () => Ct(false)), new u("selectToSheetStart", e2, { label: "Select to Sheet Home", description: "Select to the beginning of the sheet.", shortcut: [{ key: "Home", modifiers: [h.Ctrl, h.Shift] }] }, () => Ct(true)), new u("moveToRowEnd", e2, { label: "Move to Row End", description: "Move to the end of the row.", shortcut: [{ key: "End" }] }, () => It(false)), new u("selectToRowEnd", e2, { label: "Select to Row End", description: "Select to the end of the row.", shortcut: [{ key: "End", modifiers: [h.Shift] }] }, () => It(true)), new u("moveToSheetEnd", e2, { label: "Move to Sheet End", description: "Move to the end of the sheet.", shortcut: [{ key: "End", modifiers: [h.Ctrl] }] }, () => Et(false)), new u("selectToSheetEnd", e2, { label: "Select to Sheet End", description: "Select to the end of the sheet.", shortcut: [{ key: "End", modifiers: [h.Ctrl, h.Shift] }] }, () => Et(true)), new u("scrollToActiveCoords", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell.", shortcut: { key: "Backspace", modifiers: [h.Ctrl] } }, vt), new u("scrollToActiveCoordsClearSelection", e2, { label: "Scroll to Active Cell", description: "Scroll to the Active Cell and clear selection.", shortcut: { key: "Backspace", modifiers: [h.Shift] } }, () => {
1306
1314
  ct(), rn($e2.cell, true);
@@ -1309,59 +1317,59 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1309
1317
  return y(() => {
1310
1318
  n2?.addCommands(Sn, true);
1311
1319
  }, [n2]), { selection: mn, setSelectionCell: rn, setSelectionRanges: Ae2, overlay: vn, cursor: Ve2, onPointerDown: gt, clearLastSelection: nn, newSelection: lt, modifySelection: rt, appendSelection: it, clearSelections: ct, isEntire: on, navigate: wt, navigateSelection: xt };
1312
- }, Te = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, De = Object.freeze({ top: 0, left: 0 }), Oe = Object.freeze({ bottom: -4, right: -4 }), ze = Object.freeze({ horizontal: true, vertical: true }), Le = [O.TopLeft, O.Top, O.Left, O.Center], $e = 150, Be = 3e3, Fe = {}, Ae = b(C((r2, l2) => {
1313
- const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2, layout: C2, onViewportScroll: E2, onImmediateScroll: T2, showGridLines: z2 = true, gridLineColor: L2 = "rgb(224, 224, 224)", gridLineRowsProps: $2, gridLineColumnsProps: B2, clipCells: F2 = true, cursor: A2, freezeLeft: W2 = 0, freezeTop: U2 = 0, freezeLeftProps: H2, freezeTopProps: K2, cellRenderer: N2, onViewportChange: q2, onFirstRender: j2, overlayRenderer: X2, overlayProps: Y2, overlays: G2, overlaysProps: Z2, allowOverlaysOverflow: _2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: ne2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: ce2 = 1, enableMouseWheel: se2 = true, onWheelScroll: ae2, getCellCoordsAsRangeCoords: fe2 = k.cellToRange, scrollPoint: xe2 = De, style: pe2 = {}, ...me2 } = r2;
1320
+ }, De = { "sheetxl-grid": "_sheetxl-grid_h9wwa_7" }, Oe = Object.freeze({ top: 0, left: 0 }), ze = Object.freeze({ bottom: -4, right: -4 }), Le = Object.freeze({ horizontal: true, vertical: true }), $e = [O.TopLeft, O.Top, O.Left, O.Center], Be = 150, Fe = 3e3, Ae = {}, We = b(C((r2, l2) => {
1321
+ const { width: c2, height: s2, rowCount: a2 = 1, columnCount: d2 = 1, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2, layout: C2, onViewportScroll: E2, onImmediateScroll: T2, showGridLines: z2 = true, gridLineColor: L2 = "rgb(224, 224, 224)", gridLineRowsProps: $2, gridLineColumnsProps: B2, clipCells: F2 = true, cursor: A2, freezeLeft: W2 = 0, freezeTop: U2 = 0, freezeLeftProps: H2, freezeTopProps: K2, cellRenderer: N2, onViewportChange: q2, onFirstRender: j2, overlayRenderer: X2, overlayProps: Y2, overlays: G2, overlaysProps: Z2, allowOverlaysOverflow: _2 = false, stageProps: J2, stageWrapper: Q2 = null, hiddenRowsAt: ee2, hiddenColumnsAt: te2, hiddenCellAt: oe2, getVisibleCells: re2, zoom: le2 = 1, enableMouseWheel: se2 = true, onWheelScroll: ae2, getCellCoordsAsRangeCoords: de2 = k.cellToRange, scrollPoint: we2 = Oe, style: pe2 = {}, ...me2 } = r2;
1314
1322
  R(N2, "No cellRenderer specified. This is probably not what you wanted"), R(!r2?.children, "Grid does not support children elements");
1315
- const ve2 = o(T2, [T2]), Se2 = o(q2, [q2]), ye2 = o(E2, [E2]), be2 = o(ae2, [ae2]), Ce2 = o(j2, [j2]), Ie2 = w(null), Ee2 = w(null), Re2 = w(null), [Me2, ke2] = x((e2) => e2 + 1, 0), [Pe2, $e2] = p({ left: xe2?.left ?? 0, top: xe2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), Ae2 = w(null), We2 = w(Pe2), { top: Ve2, left: Ue2, verticalScrollDirection: He2, horizontalScrollDirection: Ke2 } = Pe2, Ne2 = w(false), qe2 = V({ rowCount: a2, columnCount: d2, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2 }), je2 = w(null), Xe2 = y(() => {
1323
+ const ve2 = o(T2, [T2]), Se2 = o(q2, [q2]), ye2 = o(E2, [E2]), be2 = o(ae2, [ae2]), Ce2 = o(j2, [j2]), Ie2 = w(null), Ee2 = w(null), Re2 = w(null), [Me2, ke2] = x((e2) => e2 + 1, 0), [Pe2, Te2] = p({ left: we2?.left ?? 0, top: we2?.top ?? 0, horizontalScrollDirection: null, verticalScrollDirection: null }), Be2 = w(null), We2 = w(Pe2), { top: Ve2, left: Ue2, verticalScrollDirection: He2, horizontalScrollDirection: Ke2 } = Pe2, Ne2 = w(false), qe2 = V({ rowCount: a2, columnCount: d2, defaultRowHeight: u2, defaultColumnWidth: h2, getRowHeight: f2, getColumnWidth: b2 }), je2 = w(null), Xe2 = y(() => {
1316
1324
  const e2 = C2 || qe2;
1317
- return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) * ce2, getColIndex: (t2) => e2.getColIndex(t2 / ce2), getRowOffset: (t2) => e2.getRowOffset(t2) * ce2, getRowIndex: (t2) => e2.getRowIndex(t2 / ce2) };
1318
- }, [qe2, C2, ce2]), Ye2 = (e2, t2, n2) => {
1325
+ return je2.current = null, { getColOffset: (t2) => e2.getColOffset(t2) * le2, getColIndex: (t2) => e2.getColIndex(t2 / le2), getRowOffset: (t2) => e2.getRowOffset(t2) * le2, getRowIndex: (t2) => e2.getRowIndex(t2 / le2) };
1326
+ }, [qe2, C2, le2]), Ye2 = (e2, t2, n2) => {
1319
1327
  const o2 = (t2?.left ?? 0) + 0, r3 = (t2?.top ?? 0) + 0;
1320
1328
  return { getColOffset: (t3) => e2.getColOffset(t3) - o2, getColIndex: (t3) => e2.getColIndex(t3 + o2), getRowOffset: (t3) => e2.getRowOffset(t3) - r3, getRowIndex: (t3) => e2.getRowIndex(t3 + r3) };
1321
- }, Ge2 = v((e2, t2 = false) => de(e2, t2, Xe2.getRowOffset, t2 ? 0 : a2), [a2, Xe2?.getRowOffset]), Ze2 = o(ee2 ?? Ge2, [ee2]), _e2 = v((e2, t2 = false) => de(e2, t2, Xe2.getColOffset, t2 ? d2 : 0), [d2, Xe2?.getColOffset]), Je2 = o(ne2 ?? _e2, [ne2]), Qe = y(() => Math.min(c2 ?? 800, Xe2.getColOffset(d2)), [Xe2.getColOffset, d2, c2]), et = y(() => Math.min(s2 ?? 600, Xe2.getRowOffset(a2)), [Xe2.getRowOffset, a2, s2]), tt = v((e2) => {
1329
+ }, Ge2 = o((e2, t2 = false) => ue(e2, t2, Xe2.getRowOffset, t2 ? 0 : a2), [a2, Xe2?.getRowOffset]), Ze2 = o(ee2 ?? Ge2, [ee2]), _e2 = o((e2, t2 = false) => ue(e2, t2, Xe2.getColOffset, t2 ? d2 : 0), [d2, Xe2?.getColOffset]), Je2 = o(te2 ?? _e2, [te2]), Qe2 = y(() => Math.min(c2 ?? 800, Xe2.getColOffset(d2)), [Xe2.getColOffset, d2, c2]), et = y(() => Math.min(s2 ?? 600, Xe2.getRowOffset(a2)), [Xe2.getRowOffset, a2, s2]), tt = v((e2) => {
1322
1330
  P.canUseDOM && setTimeout(() => {
1323
1331
  Ie2.current?.focus({ preventScroll: true, ...e2 });
1324
1332
  }, 0);
1325
1333
  }, []), nt = v((e2) => Ie2.current?.contains(e2) || Ee2.current?.contains(e2), []);
1326
1334
  m(() => {
1327
- Ne2.current && (Ae2.current && Ae2.current.left !== We2.current?.left && Ae2.current.top !== We2.current?.top || (Ae2.current = null, ye2?.({ left: Ue2, top: Ve2 })));
1335
+ Ne2.current && (Be2.current && Be2.current.left !== We2.current?.left && Be2.current.top !== We2.current?.top || (Be2.current = null, ye2?.({ left: Ue2, top: Ve2 })));
1328
1336
  }, [Ue2, Ve2]);
1329
1337
  const ot = o(() => ({ top: Ve2, left: Ue2 }), [Ve2, Ue2]), rt = y(() => {
1330
1338
  const e2 = [];
1331
1339
  let t2 = 0, n2 = 0;
1332
- "number" == typeof U2 ? t2 = U2 : (t2 = U2.index ?? 0, n2 = (U2.scrollOffset ?? 0) * ce2);
1340
+ "number" == typeof U2 ? t2 = U2 : (t2 = U2.index ?? 0, n2 = (U2.scrollOffset ?? 0) * le2);
1333
1341
  const o2 = n2, r3 = Xe2.getRowOffset(t2), l3 = r3 - o2;
1334
1342
  if (t2 > 0) {
1335
1343
  const i3 = Ye2(Xe2, { top: n2 + Xe2.getRowOffset(0) }), c4 = Xe2.getRowIndex(o2), s4 = Xe2.getRowIndex(r3 - 1);
1336
1344
  let a3;
1337
- e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(te(Ze2, c4, s4)), a3), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1345
+ e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a3 || (a3 = Object.freeze(ne(Ze2, c4, s4)), a3), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1338
1346
  }
1339
1347
  const i2 = Math.max(0, et - l3), c3 = Ye2(Xe2, { top: Ve2 + l3 }), s3 = c3.getRowIndex(0), d3 = c3.getRowIndex(i2);
1340
1348
  let u3;
1341
- return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(te(Ze2, s3, d3)), u3), layout: c3, maxVirtualBounds: Xe2.getRowOffset(a2), scrollOffset: Ve2, freezeOffset: (t2 > 0 ? Xe2.getRowOffset(t2) : 0) - n2 }, e2;
1342
- }, [Xe2.getRowIndex, Xe2.getRowOffset, Ze2, et, a2, U2, Ve2, ce2]), lt = y(() => {
1349
+ return e2[0] = { minIndex: s3, maxIndex: d3, minCoord: t2, maxCoord: a2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(ne(Ze2, s3, d3)), u3), layout: c3, maxVirtualBounds: Xe2.getRowOffset(a2), scrollOffset: Ve2, freezeOffset: (t2 > 0 ? Xe2.getRowOffset(t2) : 0) - n2 }, e2;
1350
+ }, [Xe2.getRowIndex, Xe2.getRowOffset, Ze2, et, a2, U2, Ve2, le2]), lt = y(() => {
1343
1351
  const e2 = [];
1344
1352
  let t2 = 0, n2 = 0;
1345
- "number" == typeof W2 ? t2 = W2 : (t2 = W2.index ?? 0, n2 = (W2.scrollOffset ?? 0) * ce2);
1353
+ "number" == typeof W2 ? t2 = W2 : (t2 = W2.index ?? 0, n2 = (W2.scrollOffset ?? 0) * le2);
1346
1354
  const o2 = n2, r3 = Xe2.getColOffset(t2), l3 = r3 - o2;
1347
1355
  if (t2 > 0) {
1348
1356
  const i3 = Ye2(Xe2, { left: n2 + Xe2.getColOffset(0) }), c4 = Xe2.getColIndex(o2), s4 = Xe2.getColIndex(r3 - 1);
1349
1357
  let a4;
1350
- e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(te(Je2, c4, s4)), a4), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1358
+ e2[1] = { minIndex: c4, maxIndex: s4, minCoord: 0, maxCoord: t2 - 1, minBounds: 0, maxBounds: l3, visibleIndices: () => a4 || (a4 = Object.freeze(ne(Je2, c4, s4)), a4), layout: i3, maxVirtualBounds: r3, scrollOffset: n2, freezeOffset: n2 };
1351
1359
  }
1352
- const i2 = Math.max(0, Qe - l3), c3 = Ye2(Xe2, { left: Ue2 + l3 }), s3 = c3.getColIndex(0), a3 = c3.getColIndex(i2);
1360
+ const i2 = Math.max(0, Qe2 - l3), c3 = Ye2(Xe2, { left: Ue2 + l3 }), s3 = c3.getColIndex(0), a3 = c3.getColIndex(i2);
1353
1361
  let u3;
1354
- return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(te(Je2, s3, a3)), u3), layout: c3, maxVirtualBounds: Xe2.getColOffset(d2), scrollOffset: Ue2, freezeOffset: (t2 > 0 ? Xe2.getColOffset(t2) : 0) - n2 }, e2;
1355
- }, [Xe2.getColIndex, Xe2.getColOffset, Je2, Qe, d2, W2, Ue2, ce2]), it = w({}), ct = w([]), st = y(() => {
1362
+ return e2[0] = { minIndex: s3, maxIndex: a3, minCoord: t2, maxCoord: d2 - 1, minBounds: l3, maxBounds: i2, visibleIndices: () => u3 || (u3 = Object.freeze(ne(Je2, s3, a3)), u3), layout: c3, maxVirtualBounds: Xe2.getColOffset(d2), scrollOffset: Ue2, freezeOffset: (t2 > 0 ? Xe2.getColOffset(t2) : 0) - n2 }, e2;
1363
+ }, [Xe2.getColIndex, Xe2.getColOffset, Je2, Qe2, d2, W2, Ue2, le2]), it = w({}), ct = w([]), st = y(() => {
1356
1364
  let e2 = {};
1357
1365
  const t2 = (t3, n3, o2, r3, l3) => {
1358
1366
  const i2 = { vertical: r3?.vertical || false, horizontal: r3?.horizontal || false };
1359
1367
  if (t3 >= lt.length || n3 >= rt.length) return null;
1360
1368
  const c3 = { rowStart: rt[n3].minIndex, colStart: lt[t3].minIndex, rowEnd: rt[n3].maxIndex, colEnd: lt[t3].maxIndex };
1361
1369
  if (c3.rowStart > c3.rowEnd || c3.colStart > c3.colEnd) return null;
1362
- const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) => he(s3, e3 ?? c3, t4), h3 = { width: lt[t3].maxVirtualBounds, height: rt[n3].maxVirtualBounds }, g2 = { left: lt[t3].scrollOffset, top: rt[n3].scrollOffset }, f3 = { left: lt[t3].freezeOffset, top: rt[n3].freezeOffset }, w2 = { width: Qe, height: et };
1370
+ const s3 = { getColIndex: (e3) => lt[t3].layout.getColIndex(e3), getColOffset: (e3) => lt[t3].layout.getColOffset(e3), getRowIndex: (e3) => rt[n3].layout.getRowIndex(e3), getRowOffset: (e3) => rt[n3].layout.getRowOffset(e3) }, a3 = Object.freeze({ left: l3?.left ?? 0, top: l3?.top ?? 0, right: l3?.right ?? 0, bottom: l3?.bottom ?? 0 }), d3 = Object.freeze({ x: lt[t3].minBounds, y: rt[n3].minBounds, width: lt[t3].maxBounds, height: rt[n3].maxBounds }), u3 = (e3, t4) => ge(s3, e3 ?? c3, t4), h3 = { width: lt[t3].maxVirtualBounds, height: rt[n3].maxVirtualBounds }, g2 = { left: lt[t3].scrollOffset, top: rt[n3].scrollOffset }, f3 = { left: lt[t3].freezeOffset, top: rt[n3].freezeOffset }, w2 = { width: Qe2, height: et };
1363
1371
  let x2 = null, p2 = null;
1364
- const m2 = (f3.top + (r3.vertical ? g2.top : 0)) / ce2, v2 = (f3.left + (r3.horizontal ? g2.left : 0)) / ce2;
1372
+ const m2 = (f3.top + (r3.vertical ? g2.top : 0)) / le2, v2 = (f3.left + (r3.horizontal ? g2.left : 0)) / le2;
1365
1373
  return { getStage: () => Ie2.current ?? null, getVisibleRangeCoords: () => c3, toClipBounds: (e3, t4) => {
1366
1374
  let n4, o3 = 0;
1367
1375
  return void 0 === t4 || "number" == typeof t4 ? (n4 = u3(c3), o3 = t4) : n4 = t4, ((e4, t5, n5 = 0) => {
@@ -1369,33 +1377,33 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1369
1377
  const o4 = { left: e4.x, top: e4.y, bottom: e4.height + e4.y, right: e4.width + e4.x }, r4 = { left: t5.x + n5, top: t5.y + n5, bottom: t5.height - 2 * n5 + t5.y, right: t5.width - 2 * n5 + t5.x }, l4 = { left: Math.max(o4.left, r4.left), top: Math.max(o4.top, r4.top), bottom: Math.min(o4.bottom, r4.bottom), right: Math.min(o4.right, r4.right) }, i3 = { x: l4.left, y: l4.top, width: l4.right - l4.left, height: l4.bottom - l4.top };
1370
1378
  return i3.height < 0 || i3.width < 0 ? null : i3;
1371
1379
  })(e3 ?? { x: 0, y: 0, width: d3.width, height: d3.height }, n4, o3);
1372
- }, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ce2 ? e3 : { x: (e3.x - v2) * ce2, y: (e3.y - m2) * ce2, width: e3.width * ce2, height: e3.height * ce2 }, toAbsoluteBounds: (e3) => 0 === v2 && 0 === m2 && 1 === ce2 ? e3 : { x: e3.x / ce2 + v2, y: e3.y / ce2 + m2, width: e3.width / ce2, height: e3.height / ce2 }, getRelativePointFromClient: (e3, t4) => {
1380
+ }, toViewBounds: (e3) => 0 === v2 && 0 === m2 && 1 === le2 ? e3 : { x: (e3.x - v2) * le2, y: (e3.y - m2) * le2, width: e3.width * le2, height: e3.height * le2 }, toAbsoluteBounds: (e3) => 0 === v2 && 0 === m2 && 1 === le2 ? e3 : { x: e3.x / le2 + v2, y: e3.y / le2 + m2, width: e3.width / le2, height: e3.height / le2 }, getRelativePointFromClient: (e3, t4) => {
1373
1381
  const n4 = ft(e3, t4);
1374
1382
  return { x: n4.x - d3.x, y: n4.y - d3.y };
1375
- }, getLayout: () => s3, getCellCoordsAsRangeCoords: fe2, getVisibleColumns: () => lt[t3].visibleIndices(), getVisibleRows: () => rt[n3].visibleIndices(), getVisibleColumnOffsets: () => (x2 || (x2 = ue(lt[t3].layout, true, lt[t3].visibleIndices(), c3.colStart, c3.colEnd)), x2), getVisibleRowOffsets: () => (p2 || (p2 = ue(rt[n3].layout, false, rt[n3].visibleIndices(), c3.rowStart, c3.rowEnd)), p2), getTotalRangeCoords: () => ({ colStart: lt[t3].minCoord, colEnd: lt[t3].maxCoord, rowStart: rt[n3].minCoord, rowEnd: rt[n3].maxCoord }), getRangeCoordsBounds: u3, scrollCellCoordsIntoView: (e3, t4) => It(e3, t4, o2), getCellCoordsFromClient: (e3, t4, n4 = false) => {
1383
+ }, getLayout: () => s3, getCellCoordsAsRangeCoords: de2, getVisibleColumns: () => lt[t3].visibleIndices(), getVisibleRows: () => rt[n3].visibleIndices(), getVisibleColumnOffsets: () => (x2 || (x2 = he(lt[t3].layout, true, lt[t3].visibleIndices(), c3.colStart, c3.colEnd)), x2), getVisibleRowOffsets: () => (p2 || (p2 = he(rt[n3].layout, false, rt[n3].visibleIndices(), c3.rowStart, c3.rowEnd)), p2), getTotalRangeCoords: () => ({ colStart: lt[t3].minCoord, colEnd: lt[t3].maxCoord, rowStart: rt[n3].minCoord, rowEnd: rt[n3].maxCoord }), getRangeCoordsBounds: u3, scrollCellCoordsIntoView: (e3, t4) => It(e3, t4, o2), getCellCoordsFromClient: (e3, t4, n4 = false) => {
1376
1384
  const o3 = ft(e3, t4);
1377
1385
  if (!o3) return null;
1378
1386
  const r4 = s3.getColIndex(o3.x - d3.x), l4 = { rowIndex: s3.getRowIndex(o3.y - d3.y), colIndex: r4 };
1379
1387
  if (n4) return l4;
1380
- const i3 = fe2(l4);
1388
+ const i3 = de2(l4);
1381
1389
  return { rowIndex: i3.rowStart, colIndex: i3.colStart };
1382
- }, getZoom: () => ce2, getAnchor: () => o2, getBounds: () => d3, getInsets: () => a3, getTotalSize: () => h3, getViewportSize: () => w2, getScrollTopLeft: () => g2, getFreezeTopLeft: () => f3, getScrollOrientation: () => i2, allViews: () => e2 };
1390
+ }, getZoom: () => le2, getAnchor: () => o2, getBounds: () => d3, getInsets: () => a3, getTotalSize: () => h3, getViewportSize: () => w2, getScrollTopLeft: () => g2, getFreezeTopLeft: () => f3, getScrollOrientation: () => i2, allViews: () => e2 };
1383
1391
  };
1384
- let n2 = e2[O.Center] = t2(0, 0, O.Center, ze, Oe);
1392
+ let n2 = e2[O.Center] = t2(0, 0, O.Center, Le, ze);
1385
1393
  return n2 && (e2[O.Center] = n2), n2 = t2(0, 1, O.Top, { horizontal: true }), n2 && (e2[O.Top] = n2), n2 = t2(1, 0, O.Left, { vertical: true }), n2 && (e2[O.Left] = n2), n2 = t2(1, 1, O.TopLeft, {}), n2 && (e2[O.TopLeft] = n2), it.current = null, e2 = Object.freeze(e2);
1386
- }, [rt, lt, fe2]), at = Object.keys(st), dt = lt[0]?.maxVirtualBounds ?? 0, ut = rt[0]?.maxVirtualBounds ?? 0, ht = y(() => ({ left: lt[1] ? lt[1].layout.getColOffset(lt[1].maxIndex + 1) : 0, top: rt[1] ? rt[1].layout.getRowOffset(rt[1].maxIndex + 1) : 0 }), [st]);
1394
+ }, [rt, lt, de2]), at = Object.keys(st), dt = lt[0]?.maxVirtualBounds ?? 0, ut = rt[0]?.maxVirtualBounds ?? 0, ht = y(() => ({ left: lt[1] ? lt[1].layout.getColOffset(lt[1].maxIndex + 1) : 0, top: rt[1] ? rt[1].layout.getRowOffset(rt[1].maxIndex + 1) : 0 }), [st]);
1387
1395
  m(() => {
1388
1396
  if (ct.current.length > 0) {
1389
1397
  for (let e2 = 0; e2 < ct.current.length; e2++) ct.current[e2]();
1390
1398
  ct.current = [];
1391
1399
  }
1392
1400
  }, [st]);
1393
- const gt = o(() => ({ containerWidth: Qe, containerHeight: et, totalWidth: dt, totalHeight: ut }), [Qe, et, Xe2]);
1401
+ const gt = o(() => ({ containerWidth: Qe2, containerHeight: et, totalWidth: dt, totalHeight: ut }), [Qe2, et, Xe2]);
1394
1402
  m(() => {
1395
- !Ae2.current && Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
1403
+ !Be2.current && Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe2, height: et, totalWidth: dt, totalHeight: ut });
1396
1404
  }, [Ve2, Ue2, dt, ut]), m(() => {
1397
- Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe, height: et, totalWidth: dt, totalHeight: ut });
1398
- }, [Qe, et]);
1405
+ Ne2.current && Se2({ top: Ve2, left: Ue2, width: Qe2, height: et, totalWidth: dt, totalHeight: ut });
1406
+ }, [Qe2, et]);
1399
1407
  const ft = v((e2, t2) => {
1400
1408
  R("number" == typeof e2 && "number" == typeof t2, "Top and left should be a number.");
1401
1409
  const n2 = Ie2.current?.getBoundingClientRect();
@@ -1406,42 +1414,51 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1406
1414
  if (!n2) return null;
1407
1415
  const { x: o2, y: r3 } = n2;
1408
1416
  let l3 = null;
1409
- const i2 = Le, c3 = i2.length;
1417
+ const i2 = $e, c3 = i2.length;
1410
1418
  for (let e3 = 0; !l3 && e3 < c3; e3++) {
1411
1419
  const t3 = st[i2[e3]];
1412
- t3 && ge(o2, r3, t3.getBounds()) && (l3 = t3);
1420
+ t3 && fe(o2, r3, t3.getBounds()) && (l3 = t3);
1413
1421
  }
1414
1422
  return l3 || (l3 = st[O.Center]), l3;
1415
- }, [st, fe2]), pt = o(() => st[O.Center].getVisibleRangeCoords(), [st[O.Center]]), mt = w(null), vt = v(() => {
1423
+ }, [st, de2]), pt = o(() => st[O.Center].getVisibleRangeCoords(), [st[O.Center]]), mt = w(null), vt = v(() => {
1416
1424
  null !== mt.current && P.cancelTimeout(mt.current), mt.current = P.requestTimeout(St, 150);
1417
1425
  }, []), St = v(() => {
1418
- mt.current = null, $e2((e2) => {
1426
+ mt.current = null, Te2((e2) => {
1419
1427
  const t2 = { ...e2, verticalScrollDirection: null, horizontalScrollDirection: null };
1420
1428
  return We2.current = t2, t2;
1421
1429
  });
1422
1430
  }, []), yt = o((e2) => {
1423
- const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = void 0 !== t2 ? Math.min(dt - Qe, Math.max(lt?.[1]?.scrollOffset ?? 0, t2)) : We2.current.left, r3 = void 0 !== n2 ? Math.min(ut - et, Math.max(rt?.[1]?.scrollOffset ?? 0, n2)) : We2.current.top;
1424
- if (We2.current.left === o2 && We2.current.top === r3) return;
1431
+ const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1];
1432
+ let o2 = We2.current.left;
1433
+ void 0 !== t2 && t2 !== o2 && (t2 > o2 ? (o2 = Math.max(lt?.[1]?.scrollOffset ?? 0, t2), o2 = Math.min(dt - Qe2, o2)) : o2 = Math.max(lt?.[1]?.scrollOffset ?? 0, t2));
1434
+ let r3 = We2.current.top;
1435
+ if (void 0 !== n2 && n2 !== r3 && (n2 > r3 ? (r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2), r3 = Math.min(ut - et, r3)) : r3 = Math.max(rt?.[1]?.scrollOffset ?? 0, n2)), We2.current.left === o2 && We2.current.top === r3) return;
1425
1436
  let l3 = null, i2 = null;
1426
1437
  We2.current.left > o2 ? l3 = D.Left : We2.current.left < o2 && (l3 = D.Right), We2.current.top > r3 ? i2 = D.Up : We2.current.top < r3 && (i2 = D.Down), P.throttle(() => {
1427
- $e2((e3) => {
1438
+ Te2((e3) => {
1428
1439
  const t3 = { ...e3, left: o2, top: r3, horizontalScrollDirection: l3, verticalScrollDirection: i2 };
1429
1440
  return We2.current = t3, t3;
1430
1441
  });
1431
- }, 17)(), Ae2.current?.top === r3 && Ae2.current?.left === o2 || (Ae2.current = { left: o2, top: r3 }, ve2({ left: o2, top: r3 }), Se2({ left: o2, top: r3, width: Qe, height: et, totalWidth: dt, totalHeight: ut })), vt();
1442
+ }, 17)(), Be2.current?.top === r3 && Be2.current?.left === o2 || (Be2.current = { left: o2, top: r3 }, ve2({ left: o2, top: r3 }), Se2({ left: o2, top: r3, width: Qe2, height: et, totalWidth: dt, totalHeight: ut })), vt();
1432
1443
  }, [dt, ut, rt, lt]);
1433
1444
  m(() => {
1434
- Ae2.current || yt({ left: Ue2, top: Ve2 });
1435
- }, [dt, Qe, ut, et]), S(() => {
1436
- Ae2.current = { left: xe2?.left, top: xe2?.top }, yt(Ae2.current);
1437
- }, [xe2?.left, xe2?.top]);
1445
+ Be2.current || yt({ left: Ue2, top: Ve2 });
1446
+ }, [Qe2, et]), m(() => {
1447
+ let e2, t2, n2 = false;
1448
+ We2.current.left > dt && (e2 = 0, n2 = true), We2.current.top > ut && (t2 = 0, n2 = true), n2 && yt({ left: e2, top: t2 });
1449
+ }, [dt, ut]), S(() => {
1450
+ Be2.current = { left: we2?.left, top: we2?.top }, yt(Be2.current);
1451
+ }, [we2?.left, we2?.top]);
1438
1452
  const bt = o((e2) => {
1439
- const t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1], o2 = e2?.behavior ?? "auto", r3 = { left: We2.current.left + (t2 ?? 0), top: We2.current.top + (n2 ?? 0) };
1440
- o2 && (r3.behavior = o2), yt(r3);
1441
- }, [dt, Qe, ut, et]), Ct = v((e2) => {
1453
+ let t2 = e2?.left ?? e2?.[0], n2 = e2?.top ?? e2?.[1];
1454
+ if (void 0 === t2 && void 0 === n2) return;
1455
+ const o2 = e2?.behavior ?? "auto";
1456
+ if (void 0 !== t2 && (t2 = We2.current.left + (t2 ?? 0)), void 0 !== n2 && (n2 = We2.current.top + (n2 ?? 0)), We2.current.left === t2 && We2.current.top === n2) return;
1457
+ yt({ left: t2, top: n2, behavior: o2 });
1458
+ }, []), Ct = v((e2) => {
1442
1459
  let t2 = null;
1443
1460
  if (Object.keys(st).length > 1) {
1444
- const n2 = Le, o2 = n2.length;
1461
+ const n2 = $e, o2 = n2.length;
1445
1462
  for (let r3 = 0; !t2 && r3 < o2; r3++) {
1446
1463
  const o3 = st[n2[r3]];
1447
1464
  o3 && k.isCellWithinRange(e2, o3.getVisibleRangeCoords()) && (t2 = o3);
@@ -1456,7 +1473,13 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1456
1473
  t3("Invalid view");
1457
1474
  });
1458
1475
  } else r3 = Ct(o2);
1459
- const l3 = fe2(o2), i2 = r3.getLayout(), c3 = i2.getColOffset(l3.colStart), s3 = i2.getRowOffset(l3.rowStart), a3 = i2.getColOffset(l3.colEnd + 1), d3 = i2.getRowOffset(l3.rowEnd + 1), u3 = r3.getBounds(), h3 = r3.getTotalSize(), g2 = r3.getScrollTopLeft(), f3 = ((e3, t3, n3 = true) => (n3 = true === n3 ? { block: "start", inline: "end" } : false === n3 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...n3 }, { left: ie(n3.inline, e3.x, e3.x + e3.width, t3.left, t3.left + t3.width, t3.totalWidth), top: ie(n3.block, e3.y, e3.y + e3.height, t3.top, t3.top + t3.height, t3.totalHeight) }))({ x: c3 + g2.left, y: s3 + g2.top, width: a3 - c3, height: d3 - s3 }, { left: g2.left, top: g2.top, width: u3.width, height: u3.height, totalWidth: h3.width, totalHeight: h3.height }, t2), w2 = { ...f3 };
1476
+ const l3 = de2(o2), i2 = r3.getLayout(), c3 = i2.getColOffset(l3.colStart), s3 = i2.getRowOffset(l3.rowStart), a3 = i2.getColOffset(l3.colEnd + 1), d3 = i2.getRowOffset(l3.rowEnd + 1), u3 = r3.getBounds(), h3 = r3.getTotalSize(), g2 = r3.getScrollTopLeft(), f3 = ((e3, t3, n3 = true) => {
1477
+ n3 = true === n3 ? { block: "start", inline: "end" } : false === n3 ? { block: "end", inline: "end" } : { block: "end", inline: "end", ...n3 };
1478
+ const o3 = ce(n3.inline, e3.x, e3.x + e3.width, t3.left, t3.left + t3.width, t3.totalWidth), r4 = ce(n3.block, e3.y, e3.y + e3.height, t3.top, t3.top + t3.height, t3.totalHeight);
1479
+ if (void 0 !== o3 || void 0 !== r4) return { left: o3, top: r4 };
1480
+ })({ x: c3 + g2.left, y: s3 + g2.top, width: a3 - c3, height: d3 - s3 }, { left: g2.left, top: g2.top, width: u3.width, height: u3.height, totalWidth: h3.width, totalHeight: h3.height }, t2);
1481
+ if (!f3) return Promise.resolve({ ...g2 });
1482
+ const w2 = { ...f3 };
1460
1483
  w2.left > Ue2 ? w2.left += 20 : w2.left < Ue2 && (w2.left -= 0), w2.top > Ve2 ? w2.top += 20 : w2.top < Ve2 && (w2.top -= 0);
1461
1484
  const x2 = r3.getScrollOrientation();
1462
1485
  return x2.horizontal && void 0 !== e2.colIndex || delete w2.left, x2.vertical && void 0 !== e2.rowIndex || delete w2.top, new Promise((e3, t3) => {
@@ -1466,7 +1489,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1466
1489
  t3(e4);
1467
1490
  }
1468
1491
  });
1469
- }, [dt, ut, st, fe2]), Et = o((e2) => {
1492
+ }, [dt, ut, st, de2]), Et = o((e2) => {
1470
1493
  const t2 = e2.shiftKey;
1471
1494
  e2.preventDefault();
1472
1495
  const { deltaX: n2, deltaY: o2, deltaMode: r3 } = e2;
@@ -1478,7 +1501,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1478
1501
  1 === r3 && (c3 *= 0), Re2.current = window.requestAnimationFrame(() => {
1479
1502
  Re2.current = null, bt(s3 ? { left: i2 } : { top: c3 });
1480
1503
  });
1481
- }, [dt, Qe, ut, et, be2]), Rt = v((e2 = null) => {
1504
+ }, [be2]), Rt = v((e2 = null) => {
1482
1505
  je2.current = null, it.current = null, ke2();
1483
1506
  }, []);
1484
1507
  S(() => {
@@ -1487,7 +1510,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1487
1510
  const Mt = g(l2, () => ({ stage: Ie2.current, focus: tt, contains: nt, invalidate: Rt, scrollTo: yt, scrollBy: bt, scrollCellCoordsIntoView: It, getScrollPosition: ot, getDimensions: gt, getViewport: pt, handleWheel: Et, rowCount: a2, columnCount: d2, getLayout: () => Xe2, getRelativePointFromClient: ft, getViewFromClient: xt, getViewFromCellCoords: Ct, getViewFromLocation: wt, onViewChangeOnce: (e2) => {
1488
1511
  ct.current.push(e2);
1489
1512
  } }), [a2, d2, st]);
1490
- m(() => (se2 && Mt.current?.addEventListener("wheel", Et, { passive: false }), Ne2.current = true, Ae2.current = null, () => {
1513
+ m(() => (se2 && Mt.current?.addEventListener("wheel", Et, { passive: false }), Ne2.current = true, Be2.current = null, () => {
1491
1514
  Mt.current?.removeEventListener("wheel", Et);
1492
1515
  }), [se2]);
1493
1516
  const kt = w([]), Pt = (t2, n2) => {
@@ -1520,20 +1543,20 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1520
1543
  for (let n4 = 0; n4 < t3; n4++) {
1521
1544
  const t4 = { rowIndex: e3, colIndex: a3[n4] };
1522
1545
  if (oe2?.(t4)) continue;
1523
- const o3 = { coords: t4, range: fe2(t4) };
1546
+ const o3 = { coords: t4, range: de2(t4) };
1524
1547
  u3.push(o3);
1525
1548
  }
1526
1549
  }
1527
1550
  }
1528
- const h3 = t2.getVisibleColumnOffsets(), g2 = t2.getVisibleRowOffsets(), f3 = t2.getScrollTopLeft(), w2 = t2.getFreezeTopLeft(), x2 = f3.left + w2.left, p2 = f3.top + w2.top, m2 = Math.trunc(x2 / Be), v2 = Math.trunc(p2 / Be), S2 = {}, y2 = (e2, t3, n3, o3, r4) => {
1529
- const l4 = `view:${e2.getAnchor()}:cell:${le(t3.rowIndex, t3.colIndex)}`, a4 = o3.x, d4 = o3.y, u4 = Math.trunc((x2 + a4) / Be) - m2, h4 = Math.trunc((p2 + d4) / Be) - v2;
1551
+ const h3 = t2.getVisibleColumnOffsets(), g2 = t2.getVisibleRowOffsets(), f3 = t2.getScrollTopLeft(), w2 = t2.getFreezeTopLeft(), x2 = f3.left + w2.left, p2 = f3.top + w2.top, m2 = Math.trunc(x2 / Fe), v2 = Math.trunc(p2 / Fe), S2 = {}, y2 = (e2, t3, n3, o3, r4) => {
1552
+ const l4 = `view:${e2.getAnchor()}:cell:${ie(t3.rowIndex, t3.colIndex)}`, a4 = o3.x, d4 = o3.y, u4 = Math.trunc((x2 + a4) / Fe) - m2, h4 = Math.trunc((p2 + d4) / Fe) - v2;
1530
1553
  S2[h4] || (S2[h4] = {});
1531
1554
  let g3 = S2[h4][u4];
1532
1555
  g3 || (g3 = S2[h4][u4] = []);
1533
1556
  let f4 = c3?.get(l4);
1534
1557
  if (!f4) {
1535
- const c4 = (x2 + a4) % Be, s4 = (p2 + d4) % Be;
1536
- f4 = N2({ key: l4, coords: t3, bounds: o3, zoom: ce2, range: n3, view: e2, value: r4, style: { left: i.boundPixel(c4), top: i.boundPixel(s4), width: i.boundPixel(o3.width, true), height: i.boundPixel(o3.height, true) } });
1558
+ const c4 = (x2 + a4) % Fe, s4 = (p2 + d4) % Fe;
1559
+ f4 = N2({ key: l4, coords: t3, bounds: o3, zoom: le2, range: n3, view: e2, value: r4, style: { left: i.boundPixel(c4), top: i.boundPixel(s4), width: i.boundPixel(o3.width, true), height: i.boundPixel(o3.height, true) } });
1537
1560
  }
1538
1561
  s3?.set(l4, f4), g3.push(f4);
1539
1562
  }, b3 = u3.length;
@@ -1547,19 +1570,19 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1547
1570
  const d4 = i2.rowIndex, f4 = i2.colIndex, w3 = g2[d4], x3 = h3[f4];
1548
1571
  let p3 = null;
1549
1572
  w3 && x3 && (p3 = { x: x3.offset, y: w3.offset, width: x3.size, height: w3.size });
1550
- const m3 = le(c4.rowStart, c4.colStart);
1573
+ const m3 = ie(c4.rowStart, c4.colStart);
1551
1574
  if (a4) {
1552
1575
  if (l3.has(m3)) continue;
1553
1576
  l3.add(m3), c4.rowEnd - c4.rowStart > 0 && o2.push(c4), c4.colEnd - c4.colStart > 0 && r3.push(c4);
1554
1577
  }
1555
- if (a4 && (p3 = he(t2.getLayout(), c4)), !p3) {
1578
+ if (a4 && (p3 = ge(t2.getLayout(), c4)), !p3) {
1556
1579
  console.warn("no bounds for cell", m3);
1557
1580
  continue;
1558
1581
  }
1559
1582
  const v3 = n3?.value;
1560
1583
  y2(t2, i2, c4, p3, v3);
1561
1584
  }
1562
- const C3 = x2 % Be, I2 = p2 % Be, E3 = Object.keys(S2), R2 = E3.length;
1585
+ const C3 = x2 % Fe, I2 = p2 % Fe, E3 = Object.keys(S2), R2 = E3.length;
1563
1586
  for (let o3 = 0; o3 < R2; o3++) {
1564
1587
  const r4 = E3[o3], l4 = S2[r4];
1565
1588
  if (!l4) continue;
@@ -1568,7 +1591,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1568
1591
  const s5 = c4[o4], a4 = l4[s5];
1569
1592
  if (!a4) continue;
1570
1593
  const d4 = parseInt(r4), u4 = parseInt(s5), h4 = d4 + v2, g3 = u4 + m2, f4 = `view:${t2.getAnchor()}:segment:${g3}:${h4}`;
1571
- n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(u4 * Be - C3, true)}px, ${i.boundPixel(d4 * Be - I2, true)}px)`, willChange: "transform" }, children: a4 }, f4));
1594
+ n2.push(e("div", { className: "cell-container", style: { transform: `translate(${i.boundPixel(u4 * Fe - C3, true)}px, ${i.boundPixel(d4 * Fe - I2, true)}px)`, willChange: "transform" }, children: a4 }, f4));
1572
1595
  }
1573
1596
  }
1574
1597
  }, Ot = y(() => {
@@ -1578,58 +1601,56 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1578
1601
  Dt(st[r4], s3, i2, c3, /* @__PURE__ */ new Set(), e2, t2), n2[r4] = { cells: s3, rangesH: i2, rangesV: c3 };
1579
1602
  }
1580
1603
  return je2.current = t2, n2;
1581
- }, [Me2, a2, d2, rt, lt, z2, pe2, F2, oe2, re2, fe2]), zt = (t2, n2, o2, r3, l3) => {
1582
- if (t2) if (n2) {
1604
+ }, [Me2, a2, d2, rt, lt, z2, pe2, F2, oe2, re2, te2, ee2, de2]), zt = (t2, n2, o2, r3, l3) => {
1605
+ if (!t2) return;
1606
+ const c3 = t2.getLayout();
1607
+ if (n2) {
1583
1608
  const e2 = `view:${t2.getAnchor()}:hl:`, n3 = t2.getVisibleRows();
1584
- if (!n3 || 0 === n3.length) return;
1585
- const c3 = 0, s3 = t2.getBounds().width;
1586
- let a3 = [];
1587
- const d3 = l3.sort(k.rowFirstRangeComparator), u3 = t2.getVisibleRangeCoords();
1588
- for (let l4 = 0; l4 < n3.length && n3[l4] <= u3.rowEnd; l4++) {
1589
- const h3 = n3[l4];
1590
- if (h3 < u3.rowStart) continue;
1609
+ if (0 === (n3 ? n3.length : 0)) return;
1610
+ const s3 = l3.sort(k.rowFirstRangeComparator), a3 = t2.getVisibleRangeCoords(), d3 = 0, u3 = Math.min(t2.getBounds().width, c3.getColOffset(a3.colEnd + 1));
1611
+ let h3 = [];
1612
+ for (let t3 = 0; t3 < n3.length && n3[t3] <= a3.rowEnd; t3++) {
1613
+ const l4 = n3[t3];
1614
+ if (l4 < a3.rowStart) continue;
1591
1615
  let g2 = false;
1592
- for (; d3.length > 0 && d3[0].rowStart <= h3; ) {
1593
- const e3 = d3.shift();
1594
- e3.rowEnd > h3 && (a3.push(e3), g2 = true);
1616
+ for (; s3.length > 0 && s3[0].rowStart <= l4; ) {
1617
+ const e3 = s3.shift();
1618
+ e3.rowEnd > l4 && (h3.push(e3), g2 = true);
1595
1619
  }
1596
- g2 && (a3 = a3.sort(k.columnFirstRangeComparator));
1597
- const f3 = t2.getLayout(), w2 = f3.getRowOffset(h3 + 1);
1598
- let x2 = c3;
1599
- const p2 = a3.length;
1600
- for (let t3 = 0; t3 < p2 + 1; t3++) {
1601
- let n4 = x2, l5 = s3;
1602
- const c4 = a3[t3];
1603
- t3 < p2 && (l5 = Math.min(s3, f3.getColOffset(c4.colStart)), x2 = Math.min(s3, f3.getColOffset(c4.colEnd + 1))), r3.push(I("path", { d: `M ${i.boundPixel(n4)} ${i.boundPixel(w2, false, o2)} L ${i.boundPixel(l5)} ${i.boundPixel(w2, false, o2)}`, stroke: L2, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...$2, key: e2 + h3 + ":" + t3 }));
1620
+ g2 && (h3 = h3.sort(k.columnFirstRangeComparator));
1621
+ const f3 = c3.getRowOffset(l4 + 1);
1622
+ let w2 = d3;
1623
+ const x2 = h3.length;
1624
+ for (let t4 = 0; t4 < x2 + 1; t4++) {
1625
+ let n4 = w2, s4 = u3;
1626
+ const a4 = h3[t4];
1627
+ t4 < x2 && (s4 = Math.min(u3, c3.getColOffset(a4.colStart)), w2 = Math.min(u3, c3.getColOffset(a4.colEnd + 1))), r3.push(I("path", { d: `M ${i.boundPixel(n4)} ${i.boundPixel(f3, false, o2)} L ${i.boundPixel(s4)} ${i.boundPixel(f3, false, o2)}`, stroke: L2, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...$2, key: e2 + l4 + ":" + t4 }));
1604
1628
  }
1605
- for (let e3 = p2 - 1; e3 >= 0; e3--) a3[e3].rowEnd <= n3[l4 + 1] && a3.splice(e3, 1);
1629
+ for (let e3 = x2 - 1; e3 >= 0; e3--) h3[e3].rowEnd <= n3[t3 + 1] && h3.splice(e3, 1);
1606
1630
  }
1607
1631
  } else {
1608
- const n3 = `view:${t2.getAnchor()}:vl:`, c3 = t2.getVisibleColumns();
1609
- if (!c3 || 0 === c3.length) return;
1610
- const s3 = 0, a3 = t2.getBounds().height;
1611
- let d3 = [];
1612
- const u3 = l3.sort(k.columnFirstRangeComparator), h3 = t2.getVisibleRangeCoords(), g2 = c3.length;
1613
- for (let l4 = 0; l4 < g2 && c3[l4] <= h3.colEnd; l4++) {
1614
- const g3 = c3[l4];
1615
- if (g3 < h3.colStart) continue;
1616
- let f3 = false;
1617
- for (; u3.length > 0 && u3[0].colStart <= g3; ) {
1618
- const e2 = u3.shift();
1619
- e2.colEnd > g3 && (d3.push(e2), f3 = true);
1632
+ const n3 = `view:${t2.getAnchor()}:vl:`, s3 = t2.getVisibleColumns(), a3 = s3 ? s3.length : 0;
1633
+ if (0 === a3) return;
1634
+ const d3 = l3.sort(k.columnFirstRangeComparator), u3 = t2.getVisibleRangeCoords(), h3 = 0, g2 = Math.min(t2.getBounds().height, c3.getRowOffset(u3.rowEnd + 1));
1635
+ let f3 = [];
1636
+ for (let t3 = 0; t3 < a3 && s3[t3] <= u3.colEnd; t3++) {
1637
+ const l4 = s3[t3];
1638
+ if (l4 < u3.colStart) continue;
1639
+ let a4 = false;
1640
+ for (; d3.length > 0 && d3[0].colStart <= l4; ) {
1641
+ const e2 = d3.shift();
1642
+ e2.colEnd > l4 && (f3.push(e2), a4 = true);
1620
1643
  }
1621
- f3 && (d3 = d3.sort(k.rowFirstRangeComparator));
1622
- const w2 = t2.getLayout(), x2 = w2.getColOffset(g3 + 1);
1623
- let p2 = s3;
1624
- const m2 = d3.length;
1625
- for (let t3 = 0; t3 < m2 + 1; t3++) {
1626
- let l5 = p2, c4 = a3;
1627
- const s4 = d3[t3];
1628
- t3 < m2 && (c4 = Math.min(a3, w2.getRowOffset(s4.rowStart)), p2 = Math.min(a3, w2.getRowOffset(s4.rowEnd + 1)));
1629
- let u4 = L2;
1630
- r3.push(e("path", { d: `M ${i.boundPixel(x2, false, o2)} ${i.boundPixel(l5)} L ${i.boundPixel(x2, false, o2)} ${i.boundPixel(c4)}`, stroke: u4, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...B2 }, n3 + g3 + ":" + t3));
1644
+ a4 && (f3 = f3.sort(k.rowFirstRangeComparator));
1645
+ const w2 = c3.getColOffset(l4 + 1);
1646
+ let x2 = h3;
1647
+ const p2 = f3.length;
1648
+ for (let t4 = 0; t4 < p2 + 1; t4++) {
1649
+ let s4 = x2, a5 = g2;
1650
+ const d4 = f3[t4];
1651
+ t4 < p2 && (a5 = Math.min(g2, c3.getRowOffset(d4.rowStart)), x2 = Math.min(g2, c3.getRowOffset(d4.rowEnd + 1))), r3.push(e("path", { d: `M ${i.boundPixel(w2, false, o2)} ${i.boundPixel(s4)} L ${i.boundPixel(w2, false, o2)} ${i.boundPixel(a5)}`, stroke: L2, strokeWidth: 1, vectorEffect: "non-scaling-stroke", ...B2 }, n3 + l4 + ":" + t4));
1631
1652
  }
1632
- for (let e2 = m2 - 1; e2 >= 0; e2--) d3[e2].colEnd <= c3[l4 + 1] && d3.splice(e2, 1);
1653
+ for (let e2 = p2 - 1; e2 >= 0; e2--) f3[e2].colEnd <= s3[t3 + 1] && f3.splice(e2, 1);
1633
1654
  }
1634
1655
  }
1635
1656
  }, Lt = (t2) => {
@@ -1642,7 +1663,7 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1642
1663
  n2[o3] = e("svg", { width: `${s3}`, height: `${a3}`, viewBox: `0 0 ${s3} ${a3}`, preserveAspectRatio: "none", shapeRendering: "crispEdges", style: { position: "absolute" }, children: i2 });
1643
1664
  }
1644
1665
  return n2;
1645
- }, $t = y(() => true === z2 || true === z2?.horizontal ? Lt(true) : null, [Me2, z2, rt, U2, W2, L2, $2, a2, d2, Qe, dt, Ot]), Bt = y(() => true === z2 || true === z2?.vertical ? Lt(false) : null, [Me2, z2, lt, U2, W2, L2, B2, a2, d2, et, ut, Ot]), Ft = y(() => 0 === ht.left ? null : e(we, { linePoints: [0, 0, 0, et + 1], bounds: { x: ht.left, y: 0, width: 1, height: et + 1 }, ...H2 }), [Me2, ht.left, et, H2]), At = y(() => 0 === ht.top ? null : e(we, { linePoints: [0, 0, Qe + 1, 0], bounds: { x: 0, y: ht.top, width: Qe + 1, height: 1 }, ...K2 }), [Me2, ht.top, Qe, K2]), Wt = y(() => {
1666
+ }, $t = y(() => true === z2 || true === z2?.horizontal ? Lt(true) : null, [Me2, z2, rt, U2, W2, L2, $2, a2, d2, Qe2, dt, st, Ot]), Bt = y(() => true === z2 || true === z2?.vertical ? Lt(false) : null, [Me2, z2, lt, U2, W2, L2, B2, a2, d2, et, ut, st, Ot]), Ft = y(() => 0 === ht.left ? null : e(xe, { linePoints: [0, 0, 0, et + 1], bounds: { x: ht.left, y: 0, width: 1, height: et + 1 }, ...H2 }), [Me2, ht.left, et, H2]), At = y(() => 0 === ht.top ? null : e(xe, { linePoints: [0, 0, Qe2 + 1, 0], bounds: { x: 0, y: ht.top, width: Qe2 + 1, height: 1 }, ...K2 }), [Me2, ht.top, Qe2, K2]), Wt = y(() => {
1646
1667
  const o2 = [], r3 = (e2) => {
1647
1668
  if (!e2 || !st[e2]) return;
1648
1669
  const n2 = st[e2].getBounds();
@@ -1658,13 +1679,13 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1658
1679
  for (let i3 = 0; i3 < l3; i3++) {
1659
1680
  const l4 = o3[i3];
1660
1681
  let c4 = e3?.get(l4);
1661
- c4 !== Fe && (c4 = l4(n3) ?? Fe), t2.set(l4, c4), c4 && c4 !== Fe && r4.push(c4);
1682
+ c4 !== Ae && (c4 = l4(n3) ?? Ae), t2.set(l4, c4), c4 && c4 !== Ae && r4.push(c4);
1662
1683
  }
1663
1684
  return r4;
1664
1685
  }, n2 = (n3, o3, r4) => {
1665
1686
  if (!r4) return;
1666
1687
  const l3 = r4.getBounds(), i3 = r4.getInsets(), c4 = r4.getAnchor();
1667
- return t("div", { className: M("view", `view-${c4}`, Te.view), style: { position: "absolute", pointerEvents: "none", left: l3.x - i3.left, top: l3.y - i3.top, width: l3.width - (i3.left + i3.right), height: l3.height - (i3.top + i3.bottom), clipPath: _2 ? "inset(-2px)" : "inset(0px)" }, children: [e2(n3, o3, r4, G2), Tt?.[c4].overlays] }, `view:${c4}`);
1688
+ return t("div", { className: M("view", `view-${c4}`, De.view), style: { position: "absolute", pointerEvents: "none", left: l3.x - i3.left, top: l3.y - i3.top, width: l3.width - (i3.left + i3.right), height: l3.height - (i3.top + i3.bottom), clipPath: _2 ? "inset(-2px)" : "inset(0px)" }, children: [e2(n3, o3, r4, G2), Tt?.[c4].overlays] }, `view:${c4}`);
1668
1689
  }, o2 = it.current, r3 = {}, i2 = [], c3 = Object.keys(st), s3 = c3.length;
1669
1690
  for (let e3 = 0; e3 < s3; e3++) {
1670
1691
  const t2 = c3[e3], l3 = o2?.[t2], s4 = r3[t2] = /* @__PURE__ */ new Map();
@@ -1673,29 +1694,29 @@ const be = -10, Ce = Object.freeze({ rowStart: 0, colStart: 0, rowEnd: 0, colEnd
1673
1694
  return it.current = r3, i2;
1674
1695
  }, [Me2, st, _2, G2]), Ut = y(() => {
1675
1696
  const { style: t2, ...n2 } = J2 ?? {};
1676
- return e("div", { style: { width: Qe, height: et, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: Ie2, ...n2, ...me2, children: Q2 ? Q2(Wt) : Wt });
1677
- }, [Qe, et, Wt, J2, Q2]), Ht = w(false);
1697
+ return e("div", { style: { width: Qe2, height: et, ...t2 }, className: "sheetxl-stage", tabIndex: 0, ref: Ie2, ...n2, ...me2, children: Q2 ? Q2(Wt) : Wt });
1698
+ }, [Qe2, et, Wt, J2, Q2]), Ht = w(false);
1678
1699
  return m(() => {
1679
1700
  !Ht.current && Ot && (Ht.current = true, Ce2?.(Mt.current));
1680
- }, [Ot]), t("div", { className: M("sheetxl-grid", Te["sheetxl-grid"]), style: { overflow: "visible", cursor: A2, maxWidth: Qe, maxHeight: et, width: Qe, height: et, ...pe2 }, ref: Mt, children: [Ut, t("div", { className: M("sheetxl-overlays"), ref: Ee2, ...Z2, children: [Vt, Ft, At] })] });
1701
+ }, [Ot]), t("div", { className: M("sheetxl-grid", De["sheetxl-grid"]), style: { overflow: "visible", cursor: A2, maxWidth: Qe2, maxHeight: et, width: Qe2, height: et, ...pe2 }, ref: Mt, children: [Ut, t("div", { className: M("sheetxl-overlays"), ref: Ee2, ...Z2, children: [Vt, Ft, At] })] });
1681
1702
  }));
1682
- Ae.displayName = "BaseGrid";
1683
- const We = b(C((t2, n2) => {
1703
+ We.displayName = "BaseGrid";
1704
+ const Ve = b(C((t2, n2) => {
1684
1705
  const { width: o2, height: r2, style: l2 = {}, className: i2, ...c2 } = t2, [s2, { width: a2, height: d2 }] = z();
1685
- return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e(Ae, { ref: n2, width: o2 ?? a2, height: r2 ?? d2, ...c2 }) }) });
1706
+ return e("div", { className: i2, style: { ...l2 }, children: e("div", { style: { position: "relative", top: "0px", left: "0px", width: "100%", height: "100%", maxWidth: "100%", maxHeight: "100%", boxSizing: "content-box" }, ref: s2, children: e(We, { ref: n2, width: o2 ?? a2, height: r2 ?? d2, ...c2 }) }) });
1686
1707
  }));
1687
- We.displayName = "Grid";
1688
- const Ve = b(C((t2, n2) => {
1708
+ Ve.displayName = "Grid";
1709
+ const Ue = b(C((t2, n2) => {
1689
1710
  const { showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: s2, onScrollViewport: a2, style: d2 = {}, className: u2, onScroll: h2, ...g2 } = t2, [x2, m2] = p(null), S2 = w(null), y2 = w(null);
1690
1711
  R(!s2, "Viewport can not be specified"), E(n2, () => y2.current && S2.current ? Object.assign(y2.current, S2.current) : null);
1691
1712
  const b2 = v((e2) => {
1692
1713
  y2.current?.scrollTo(e2), a2?.(e2);
1693
1714
  }, []);
1694
- return e(f, { className: u2, style: d2, ref: S2, showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: x2, onScrollViewport: b2, children: e(We, { style: { width: "100%", height: "100%" }, ...g2, onViewportChange: (e2) => m2(e2), ref: y2 }) });
1715
+ return e(f, { className: u2, style: d2, ref: S2, showVerticalScrollbar: o2, showHorizontalScrollbar: r2, createHorizontalScrollbar: l2, createVerticalScrollbar: i2, createScrollCorner: c2, viewport: x2, onScrollViewport: b2, children: e(Ve, { style: { width: "100%", height: "100%" }, ...g2, onViewportChange: (e2) => m2(e2), ref: y2 }) });
1695
1716
  }));
1696
- Ve.displayName = "ScrollableGrid";
1697
- const Ue = () => false, He = b((t2) => {
1698
- const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 = Ue, isSelectedAll: x2 = Ue, coords: m2, bounds: v2, range: S2, orientation: y2, view: b2, style: C2, ...I2 } = t2, E2 = l2 / 100, R2 = w(null), [M2, k2] = p(false), D2 = f2?.(n2) || false, O2 = x2?.(n2) || false ? d2 : D2 ? a2 : s2;
1717
+ Ue.displayName = "ScrollableGrid";
1718
+ const He = () => false, Ke = b((t2) => {
1719
+ const { index: n2, value: o2, zoom: r2, zoomScale: l2 = 100, headerText: c2 = (e2) => `${e2}`, headerStyle: s2, headerStyleSelect: a2 = s2, headerStyleSelectAll: d2 = a2, headerStyleHover: u2 = d2, verticalPadding: h2 = 0, horizontalPadding: g2 = 0, isSelected: f2 = He, isSelectedAll: x2 = He, coords: m2, bounds: v2, range: S2, orientation: y2, view: b2, style: C2, ...I2 } = t2, E2 = l2 / 100, R2 = w(null), [M2, k2] = p(false), D2 = f2?.(n2) || false, O2 = x2?.(n2) || false ? d2 : D2 ? a2 : s2;
1699
1720
  let z2 = O2;
1700
1721
  if (M2) {
1701
1722
  let e2 = u2;
@@ -1707,8 +1728,8 @@ const Ue = () => false, He = b((t2) => {
1707
1728
  k2(false);
1708
1729
  }, children: c2(n2) });
1709
1730
  });
1710
- He.displayName = "HeaderRenderer";
1711
- const Ke = "ew-resize", Ne = "ns-resize", qe = b(C((n2, o2) => {
1731
+ Ke.displayName = "HeaderRenderer";
1732
+ const Ne = "ew-resize", qe = "ns-resize", je = b(C((n2, o2) => {
1712
1733
  const { orientation: r2, view: l2, index: c2, className: s2, style: a2, disabled: d2 = false, disabledResize: u2 = false, isNextHidden: h2, isHidden: g2, isSelected: f2, isSelectedAll: w2, showTouchDivider: x2, headerStyle: p2, headerStyleSelect: m2, headerStyleSelectAll: v2, headerStyleHover: S2, bounds: y2, onPointerDown: b2, onAutoFit: C2, ...I2 } = n2, E2 = r2 === T.Column;
1713
1734
  let R2 = p2;
1714
1735
  f2 && m2 && (R2 = m2), w2 && v2 && (R2 = v2);
@@ -1716,11 +1737,11 @@ const Ke = "ew-resize", Ne = "ns-resize", qe = b(C((n2, o2) => {
1716
1737
  let P2 = E2 ? 14 : 8, D2 = P2 / 2, O2 = 0;
1717
1738
  h2 && (O2 = -2), g2 && (O2 = 2), g2 && (P2 = P2 / 2 + O2, D2 = 2 * O2);
1718
1739
  let z2 = R2.dividerStrokeFill ?? R2.strokeFill;
1719
- return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className: M("header-divider", { disabled: d2 }, s2, `index-${c2}`), ref: o2, onPointerDown: k2 ? void 0 : b2, onDoubleClick: k2 ? void 0 : () => C2?.(), style: { top: (E2 ? 0 : -P2 / 2 + (O2 - 1)) + "px", left: (E2 ? -P2 / 2 + (O2 - 1) : 0) + "px", width: E2 ? P2 : "calc(100% + 1px)", height: E2 ? "calc(100% + 1px)" : P2, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: d2 || u2 || k2 ? void 0 : E2 ? Ke : Ne, ...a2 }, ...I2, children: [e("div", { style: { position: "relative", top: `${E2 ? 0 : D2}px`, left: `${E2 ? D2 : 0}px`, width: E2 ? 1 : "100%", height: E2 ? "100%" : 1, background: z2 }, onDoubleClick: () => C2?.() }), x2 && k2 ? e("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: E2 ? "-6px" : "2px", bottom: E2 ? "2px" : "-9px", height: "24px", width: E2 ? "24px" : "18px", maxHeight: E2 ? "calc(100% - 4px)" : void 0, maxWidth: E2 ? void 0 : "calc(100% - 4px)", background: R2.fill, border: `${v2.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${p2.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: b2, children: e("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(m2.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: E2 ? void 0 : "rotate(90deg)" } }) }) : null] });
1720
- })), je = (t2, n2) => e(qe, { ...t2, ref: n2 }), Xe = b(C((r2, l2) => {
1721
- const { orientation: i2, view: c2, index: a2, disabled: u2 = false, disabledResize: h2 = false, resizeThreshold: g2 = 1, dividerRenderer: f2 = je, onDividerMouseDown: x2, onDividerResizeStart: m2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2, onDividerAutoFit: b2, onPointerDown: C2, ...I2 } = r2, E2 = o(C2, [C2]), R2 = o(b2, [b2]), k2 = i2 === T.Column;
1740
+ return !(f2 || w2) && 0 === O2 && (z2 = `linear-gradient(${E2 ? 180 : 90}deg, ${R2.fill}, ${z2} 55%, ${z2} 100%)`), t("div", { className: M("header-divider", { disabled: d2 }, s2, `index-${c2}`), ref: o2, onPointerDown: k2 ? void 0 : b2, onDoubleClick: k2 ? void 0 : () => C2?.(), style: { top: (E2 ? 0 : -P2 / 2 + (O2 - 1)) + "px", left: (E2 ? -P2 / 2 + (O2 - 1) : 0) + "px", width: E2 ? P2 : "calc(100% + 1px)", height: E2 ? "calc(100% + 1px)" : P2, position: "absolute", overflow: "visible", pointerEvents: "all", cursor: d2 || u2 || k2 ? void 0 : E2 ? Ne : qe, ...a2 }, ...I2, children: [e("div", { style: { position: "relative", top: `${E2 ? 0 : D2}px`, left: `${E2 ? D2 : 0}px`, width: E2 ? 1 : "100%", height: E2 ? "100%" : 1, background: z2 }, onDoubleClick: () => C2?.() }), x2 && k2 ? e("div", { style: { position: "absolute", cursor: "grab", zIndex: 1, borderRadius: "4px", right: E2 ? "-6px" : "2px", bottom: E2 ? "2px" : "-9px", height: "24px", width: E2 ? "24px" : "18px", maxHeight: E2 ? "calc(100% - 4px)" : void 0, maxWidth: E2 ? void 0 : "calc(100% - 4px)", background: R2.fill, border: `${v2.edgeStrokeFill} solid 1px`, boxShadow: `0.5px 0.5px 0px 0px ${p2.text.fill}`, display: "flex", alignItems: "center", justifyContent: "center" }, onPointerDown: b2, children: e("div", { style: { width: "6.4px", height: "12px", backgroundImage: `url("data:image/svg+xml,%3Csvg width='6.4' height='12' viewBox='0 0 9.6 16' version='1.1' fill='${encodeURIComponent(m2.text.fill)}' xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg'%3E%3Cpath d='M 9.60008,14.40009 C 9.60008,15.28374 8.88368,16 8.00003,16 7.11639,16 6.40012,15.28374 6.40012,14.40009 c 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40012 c 0,0.88364 -0.7164,1.60004 -1.60005,1.60004 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60004 0,-0.88365 0.71627,-1.60005 1.59991,-1.60005 0.88365,0 1.60005,0.7164 1.60005,1.60005 m 0,-6.40006 c 0,0.88365 -0.7164,1.60005 -1.60005,1.60005 -0.88364,0 -1.59991,-0.7164 -1.59991,-1.60005 C 6.40012,0.71626 7.11639,0 8.00003,0 8.88368,0 9.60008,0.71626 9.60008,1.59991 M 3.19996,14.40009 C 3.19996,15.28374 2.48369,16 1.60005,16 0.7164,16 0,15.28374 0,14.40009 c 0,-0.88365 0.7164,-1.60005 1.60005,-1.60005 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40012 c 0,0.88364 -0.71627,1.60004 -1.59991,1.60004 C 0.7164,9.60001 0,8.88361 0,7.99997 0,7.11632 0.7164,6.39992 1.60005,6.39992 c 0.88364,0 1.59991,0.7164 1.59991,1.60005 m 0,-6.40006 c 0,0.88365 -0.71627,1.60005 -1.59991,1.60005 C 0.7164,3.19996 0,2.48356 0,1.59991 0,0.71626 0.7164,0 1.60005,0 2.48369,0 3.19996,0.71626 3.19996,1.59991' /%3E%3C/svg%3E%0A")`, backgroundRepeat: "no-repeat", backgroundPosition: "center", transform: E2 ? void 0 : "rotate(90deg)" } }) }) : null] });
1741
+ })), Xe = (t2, n2) => e(je, { ...t2, ref: n2 }), Ye = b(C((r2, l2) => {
1742
+ const { orientation: i2, view: c2, index: a2, disabled: u2 = false, disabledResize: h2 = false, resizeThreshold: g2 = 1, dividerRenderer: f2 = Xe, onDividerMouseDown: x2, onDividerResizeStart: m2, onDividerResize: v2, onDividerResizeEnd: S2, onDividerMouseUp: y2, onDividerAutoFit: b2, onPointerDown: C2, ...I2 } = r2, E2 = o(C2, [C2]), R2 = o(b2, [b2]), k2 = i2 === T.Column;
1722
1743
  let P2 = k2 ? c2.getVisibleColumns() : c2.getVisibleRows(), D2 = null;
1723
- P2.length > 0 && (k2 ? D2 = c2.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: P2[0], colEnd: P2[P2.length - 1] }) : c2.getRangeCoordsBounds({ rowStart: P2[0], rowEnd: P2[P2.length - 1], colStart: 0, colEnd: 0 }), D2 = c2.toClipBounds(D2, be));
1744
+ P2.length > 0 && (k2 ? D2 = c2.getRangeCoordsBounds({ rowStart: 0, rowEnd: 0, colStart: P2[0], colEnd: P2[P2.length - 1] }) : c2.getRangeCoordsBounds({ rowStart: P2[0], rowEnd: P2[P2.length - 1], colStart: 0, colEnd: 0 }), D2 = c2.toClipBounds(D2, Ce));
1724
1745
  const O2 = w(null), [z2, $2] = p(null), B2 = (e2, t2) => k2 ? e2.clientX - t2.clientX : e2.clientY - t2.clientY, F2 = c2.getLayout(), A2 = k2 ? F2.getColOffset(a2 + 1) : F2.getRowOffset(a2 + 1), W2 = s({ processTouch: true, onPointerDown: (e2) => {
1725
1746
  if (E2?.(e2), !u2 && !h2) {
1726
1747
  const e3 = k2 ? F2.getColOffset(a2) : F2.getRowOffset(a2), t2 = A2 - e3;
@@ -1744,9 +1765,9 @@ const Ke = "ew-resize", Ne = "ns-resize", qe = b(C((n2, o2) => {
1744
1765
  if (!U2) return;
1745
1766
  const { getPortalContainer: H2 } = d();
1746
1767
  let K2 = null;
1747
- return z2 && z2.isResizing && z2.index === a2 && (K2 = L(e("div", { style: { position: "absolute", cursor: k2 ? Ke : Ne, left: 0, top: 0, width: "100%", height: "100%" } }), H2(), "divider:" + a2)), t(n, { children: [K2, e("div", { className: M("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${k2 ? D2.y : A2}px`, left: `${k2 ? A2 : D2.x}px`, width: (k2 ? 0 : D2.width - 1) + "px", height: (k2 ? D2.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: U2 })] });
1768
+ return z2 && z2.isResizing && z2.index === a2 && (K2 = L(e("div", { style: { position: "absolute", cursor: k2 ? Ne : qe, left: 0, top: 0, width: "100%", height: "100%" } }), H2(), "divider:" + a2)), t(n, { children: [K2, e("div", { className: M("header-divider-anchor"), style: { position: "absolute", pointerEvents: "auto", top: `${k2 ? D2.y : A2}px`, left: `${k2 ? A2 : D2.x}px`, width: (k2 ? 0 : D2.width - 1) + "px", height: (k2 ? D2.height - 1 : 0) + "px", display: "flex" }, tabIndex: -1, children: U2 })] });
1748
1769
  }));
1749
- class Ye {
1770
+ class Ge {
1750
1771
  naturalDimensions(e2, t2 = {}) {
1751
1772
  const n2 = document.createElement("div");
1752
1773
  let o2 = t2?.lineHeight ?? "1";
@@ -1763,8 +1784,8 @@ class Ye {
1763
1784
  return r2.remove(), { width: i2.width, height: i2.height, maxLineHeight: 1.2 * (t2.paintableText?.fontSize || 1056 / 72) };
1764
1785
  }
1765
1786
  }
1766
- const Ge = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode: false }), Ze = Ge(), _e = b(C((t2, n2) => {
1767
- const { editState: r2 = Ze, defaultTextStyle: i2, onStartEdit: c2, onChangeEdit: s2, onSubmitEdit: a2, onCancelEdit: d2, onDoneEdit: u2, containerBounds: h2, setNaturalSize: f2, onNavigate: x2, textProperties: b2, style: C2, autoFocus: I2, ...E2 } = t2, R2 = w(null), { width: M2 = 0 } = h2 ?? {}, [k2, P2] = p(() => r2);
1787
+ const Ze = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode: false }), _e = Ze(), Je = b(C((t2, n2) => {
1788
+ const { editState: r2 = _e, defaultTextStyle: i2, onStartEdit: c2, onChangeEdit: s2, onSubmitEdit: a2, onCancelEdit: d2, onDoneEdit: u2, containerBounds: h2, setNaturalSize: f2, onNavigate: x2, textProperties: b2, style: C2, autoFocus: I2, ...E2 } = t2, R2 = w(null), { width: M2 = 0 } = h2 ?? {}, [k2, P2] = p(() => r2);
1768
1789
  m(() => {
1769
1790
  P2(r2);
1770
1791
  }, [r2]);
@@ -1772,7 +1793,7 @@ const Ge = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode:
1772
1793
  let V2 = 2;
1773
1794
  const H2 = 96 * B2 / 72, K2 = 1.2 * H2;
1774
1795
  "right" === O2 && (V2 += 1);
1775
- const N2 = y(() => new Ye().naturalDimensions(W2, { maxWidth: "wrap" === L2 ? M2 - V2 : void 0, lineHeight: `${K2}px`, paintableText: { fontStyle: A2, wrap: L2, letterSpacing: -0.25 } }), [W2, L2, V2, H2, $2, F2, A2, f2, M2]), q2 = v(() => N2.maxLineHeight ? N2.maxLineHeight + "px" : "1.2", [N2]), [j2, X2] = p(q2);
1796
+ const N2 = y(() => new Ge().naturalDimensions(W2, { maxWidth: "wrap" === L2 ? M2 - V2 : void 0, lineHeight: `${K2}px`, paintableText: { fontStyle: A2, wrap: L2, letterSpacing: -0.25 } }), [W2, L2, V2, H2, $2, F2, A2, f2, M2]), q2 = v(() => N2.maxLineHeight ? N2.maxLineHeight + "px" : "1.2", [N2]), [j2, X2] = p(q2);
1776
1797
  S(() => {
1777
1798
  X2(q2());
1778
1799
  }, [h2, N2]), S(() => {
@@ -1846,33 +1867,33 @@ const Ge = (e2 = void 0) => Object.freeze({ clean: e2, dirty: void 0, editMode:
1846
1867
  }, onMouseDown: (e2) => {
1847
1868
  Z2(true);
1848
1869
  }, onKeyDown: Q2 }) });
1849
- })), Je = b((t2) => {
1870
+ })), Qe = b((t2) => {
1850
1871
  const { value: n2, view: o2, bounds: r2, range: l2, zoom: i2, children: c2, style: s2, ...a2 } = t2;
1851
1872
  return e("div", { style: { padding: "2px 4px", fontFamily: "Calibri", letterSpacing: -0.25, lineHeight: 1.2, fontSize: s2?.fontSize || 1056 / 72, ...s2 }, ...a2, children: n2 });
1852
1873
  });
1853
1874
  export {
1854
- Ae as BaseGrid,
1855
- _e as DefaultCellEditor,
1856
- Je as DefaultCellRenderer,
1857
- qe as DefaultHeaderDivider,
1858
- ve as FillHandle,
1859
- We as Grid,
1860
- Xe as HeaderDivider,
1861
- He as HeaderRenderer,
1862
- $e as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
1863
- be as SELECTION_CLIP_INSETS,
1875
+ We as BaseGrid,
1876
+ Je as DefaultCellEditor,
1877
+ Qe as DefaultCellRenderer,
1878
+ je as DefaultHeaderDivider,
1879
+ Se as FillHandle,
1880
+ Ve as Grid,
1881
+ Ye as HeaderDivider,
1882
+ Ke as HeaderRenderer,
1883
+ Be as RESET_SCROLL_EVENTS_DEBOUNCE_INTERVAL,
1884
+ Ce as SELECTION_CLIP_INSETS,
1864
1885
  U as STANDARD_KEY_CHARS,
1865
- we as SVGLine,
1866
- xe as SVGRect,
1867
- Ve as ScrollableGrid,
1868
- me as Selection,
1869
- ye as TouchSelectHandle,
1870
- pe as defaultSelectionRenderer,
1871
- Ge as getDefaultStringEditState,
1872
- Re as safeSelectionCoords,
1873
- J as useAnimatedMeasure,
1886
+ xe as SVGLine,
1887
+ pe as SVGRect,
1888
+ Ue as ScrollableGrid,
1889
+ ve as Selection,
1890
+ be as TouchSelectHandle,
1891
+ me as defaultSelectionRenderer,
1892
+ Ze as getDefaultStringEditState,
1893
+ Me as safeSelectionCoords,
1894
+ Q as useAnimatedMeasure,
1874
1895
  V as useCellLayout,
1875
- Q as useHeaderSelection,
1896
+ ee as useHeaderSelection,
1876
1897
  X as useKeyboardEditorOverlay,
1877
- Pe as useSelection
1898
+ Te as useSelection
1878
1899
  };