@toolbox-web/grid 1.12.0 → 1.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/all.js +806 -785
  2. package/all.js.map +1 -1
  3. package/index.js +1459 -1431
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts +2 -1
  6. package/lib/core/grid.d.ts.map +1 -1
  7. package/lib/core/types.d.ts +5 -1
  8. package/lib/core/types.d.ts.map +1 -1
  9. package/lib/plugins/clipboard/index.js.map +1 -1
  10. package/lib/plugins/column-virtualization/index.js.map +1 -1
  11. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  12. package/lib/plugins/context-menu/index.js +1 -1
  13. package/lib/plugins/context-menu/index.js.map +1 -1
  14. package/lib/plugins/editing/index.js.map +1 -1
  15. package/lib/plugins/export/index.js.map +1 -1
  16. package/lib/plugins/filtering/index.js.map +1 -1
  17. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts +8 -1
  18. package/lib/plugins/grouping-columns/GroupingColumnsPlugin.d.ts.map +1 -1
  19. package/lib/plugins/grouping-columns/index.js +59 -60
  20. package/lib/plugins/grouping-columns/index.js.map +1 -1
  21. package/lib/plugins/grouping-rows/index.js.map +1 -1
  22. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts +7 -0
  23. package/lib/plugins/master-detail/MasterDetailPlugin.d.ts.map +1 -1
  24. package/lib/plugins/master-detail/index.js +183 -144
  25. package/lib/plugins/master-detail/index.js.map +1 -1
  26. package/lib/plugins/multi-sort/index.js.map +1 -1
  27. package/lib/plugins/pinned-columns/index.js.map +1 -1
  28. package/lib/plugins/pinned-rows/index.js.map +1 -1
  29. package/lib/plugins/pivot/index.js.map +1 -1
  30. package/lib/plugins/print/index.js.map +1 -1
  31. package/lib/plugins/reorder/index.js.map +1 -1
  32. package/lib/plugins/responsive/index.js.map +1 -1
  33. package/lib/plugins/row-reorder/index.js.map +1 -1
  34. package/lib/plugins/selection/index.js +5 -5
  35. package/lib/plugins/selection/index.js.map +1 -1
  36. package/lib/plugins/server-side/index.js.map +1 -1
  37. package/lib/plugins/tree/index.js.map +1 -1
  38. package/lib/plugins/undo-redo/index.js.map +1 -1
  39. package/lib/plugins/visibility/index.js.map +1 -1
  40. package/package.json +1 -1
  41. package/umd/grid.all.umd.js +24 -24
  42. package/umd/grid.all.umd.js.map +1 -1
  43. package/umd/grid.umd.js +18 -18
  44. package/umd/grid.umd.js.map +1 -1
  45. package/umd/plugins/context-menu.umd.js +1 -1
  46. package/umd/plugins/context-menu.umd.js.map +1 -1
  47. package/umd/plugins/grouping-columns.umd.js +1 -1
  48. package/umd/plugins/grouping-columns.umd.js.map +1 -1
  49. package/umd/plugins/master-detail.umd.js +1 -1
  50. package/umd/plugins/master-detail.umd.js.map +1 -1
  51. package/umd/plugins/selection.umd.js +2 -2
  52. package/umd/plugins/selection.umd.js.map +1 -1
package/all.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { BaseGridPlugin as _, DEFAULT_GRID_ICONS as ht, F as M, e as F, s as ft, c as gt, runAggregator as te, a as Je, b as et, g as ue, r as pt, getAggregator as ye, getValueAggregator as mt, d as xe, f as wt } from "./index.js";
2
2
  import { DEFAULT_ANIMATION_CONFIG as Dn, DGEvents as Mn, DataGridElement as Nn, FitModeEnum as qn, GridCSSVars as Hn, GridClasses as Kn, GridDataAttrs as zn, DataGridElement as On, GridSelectors as Gn, PLUGIN_QUERIES as Bn, PluginEvents as Vn, PluginManager as Wn, RenderPhase as $n, builtInSort as jn, createGrid as Un, defaultComparator as Yn, queryGrid as Xn } from "./index.js";
3
3
  const tt = "__tbw_expander", bt = 32;
4
- function pe(a) {
5
- return a.field === tt;
4
+ function pe(s) {
5
+ return s.field === tt;
6
6
  }
7
- function H(a) {
8
- return a.meta?.utility === !0;
7
+ function H(s) {
8
+ return s.meta?.utility === !0;
9
9
  }
10
- function vt(a) {
11
- return a.find(pe);
10
+ function vt(s) {
11
+ return s.find(pe);
12
12
  }
13
- function yt(a) {
13
+ function yt(s) {
14
14
  return {
15
15
  field: tt,
16
16
  header: "",
@@ -22,32 +22,32 @@ function yt(a) {
22
22
  lockPosition: !0,
23
23
  suppressMovable: !0,
24
24
  expanderColumn: !0,
25
- expanderPlugin: a,
25
+ expanderPlugin: s,
26
26
  utility: !0
27
27
  }
28
28
  };
29
29
  }
30
- async function ie(a) {
30
+ async function ie(s) {
31
31
  try {
32
- return await navigator.clipboard.writeText(a), !0;
32
+ return await navigator.clipboard.writeText(s), !0;
33
33
  } catch {
34
34
  const e = document.createElement("textarea");
35
- e.value = a, e.style.position = "fixed", e.style.opacity = "0", e.style.pointerEvents = "none", document.body.appendChild(e), e.select();
35
+ e.value = s, e.style.position = "fixed", e.style.opacity = "0", e.style.pointerEvents = "none", document.body.appendChild(e), e.select();
36
36
  const t = document.execCommand("copy");
37
37
  return document.body.removeChild(e), t;
38
38
  }
39
39
  }
40
- function Ce(a, e) {
40
+ function Ce(s, e) {
41
41
  const t = e.delimiter ?? " ", i = e.newline ?? `
42
- `, n = a.replace(/\r\n/g, `
42
+ `, n = s.replace(/\r\n/g, `
43
43
  `).replace(/\r/g, `
44
44
  `), r = [];
45
- let o = [], s = "", l = !1;
45
+ let o = [], a = "", l = !1;
46
46
  for (let d = 0; d < n.length; d++) {
47
47
  const c = n[d];
48
- c === '"' && !l ? l = !0 : c === '"' && l ? n[d + 1] === '"' ? (s += '"', d++) : l = !1 : c === t && !l ? (o.push(s), s = "") : c === i && !l ? (o.push(s), s = "", (o.length > 1 || o.some((u) => u.trim() !== "")) && r.push(o), o = []) : s += c;
48
+ c === '"' && !l ? l = !0 : c === '"' && l ? n[d + 1] === '"' ? (a += '"', d++) : l = !1 : c === t && !l ? (o.push(a), a = "") : c === i && !l ? (o.push(a), a = "", (o.length > 1 || o.some((u) => u.trim() !== "")) && r.push(o), o = []) : a += c;
49
49
  }
50
- return o.push(s), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
50
+ return o.push(a), (o.length > 1 || o.some((d) => d.trim() !== "")) && r.push(o), r;
51
51
  }
52
52
  async function xt() {
53
53
  try {
@@ -56,10 +56,10 @@ async function xt() {
56
56
  return "";
57
57
  }
58
58
  }
59
- function Ct(a, e) {
60
- const { rows: t, target: i, fields: n } = a;
59
+ function Ct(s, e) {
60
+ const { rows: t, target: i, fields: n } = s;
61
61
  if (!i) return;
62
- const r = e.rows, o = e.effectiveConfig.columns ?? [], s = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
62
+ const r = e.rows, o = e.effectiveConfig.columns ?? [], a = o.map((u) => u.field), l = /* @__PURE__ */ new Map();
63
63
  o.forEach((u) => {
64
64
  l.set(u.field, u.editable === !0);
65
65
  });
@@ -72,7 +72,7 @@ function Ct(a, e) {
72
72
  return;
73
73
  } else for (; f >= d.length; ) {
74
74
  const g = {};
75
- s.forEach((p) => g[p] = ""), d.push(g);
75
+ a.forEach((p) => g[p] = ""), d.push(g);
76
76
  }
77
77
  d[f] = { ...d[f] }, u.forEach((g, p) => {
78
78
  const w = n[p];
@@ -113,8 +113,8 @@ class pn extends _ {
113
113
  const t = this.#o(), i = this.columns.length - 1, n = this.rows.length - 1;
114
114
  let r;
115
115
  if (t && t.ranges.length > 0) {
116
- const { mode: s, ranges: l } = t, d = l[l.length - 1];
117
- s === "row" ? r = {
116
+ const { mode: a, ranges: l } = t, d = l[l.length - 1];
117
+ a === "row" ? r = {
118
118
  startRow: d.from.row,
119
119
  startCol: 0,
120
120
  endRow: d.to.row,
@@ -128,9 +128,9 @@ class pn extends _ {
128
128
  } else if (!t)
129
129
  r = { startRow: 0, startCol: 0, endRow: n, endCol: i };
130
130
  else {
131
- const s = this.#n(e);
132
- if (!s) return;
133
- r = { startRow: s.row, startCol: s.col, endRow: s.row, endCol: s.col };
131
+ const a = this.#n(e);
132
+ if (!a) return;
133
+ r = { startRow: a.row, startCol: a.col, endRow: a.row, endCol: a.col };
134
134
  }
135
135
  const o = this.#i(r);
136
136
  ie(o.text).then(() => {
@@ -145,9 +145,9 @@ class pn extends _ {
145
145
  const t = e.clipboardData?.getData("text/plain");
146
146
  if (!t) return;
147
147
  e.preventDefault();
148
- const i = Ce(t, this.config), n = this.#o(), r = n?.ranges?.[0], o = r?.from.row ?? 0, s = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[s], h = u ? { row: o, col: s, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
149
- for (let w = 0; w < g && s + w <= c; w++) {
150
- const b = this.columns[s + w];
148
+ const i = Ce(t, this.config), n = this.#o(), r = n?.ranges?.[0], o = r?.from.row ?? 0, a = r?.from.col ?? 0, d = r && (n?.mode === "range" || n?.mode === "row") && (r.from.row !== r.to.row || r.from.col !== r.to.col) ? { endRow: r.to.row, endCol: r.to.col } : null, c = d?.endCol ?? this.columns.length - 1, u = this.columns[a], h = u ? { row: o, col: a, field: u.field, bounds: d } : null, f = [], g = i[0]?.length ?? 0;
149
+ for (let w = 0; w < g && a + w <= c; w++) {
150
+ const b = this.columns[a + w];
151
151
  b && !b.hidden && f.push(b.field);
152
152
  }
153
153
  const p = { rows: i, text: t, target: h, fields: f };
@@ -163,13 +163,13 @@ class pn extends _ {
163
163
  return this.grid?.query("getSelection", void 0)?.[0];
164
164
  }
165
165
  #i(e) {
166
- const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), s = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
166
+ const { startRow: t, startCol: i, endRow: n, endCol: r } = e, o = Math.min(t, n), a = Math.max(t, n), l = Math.min(i, r), d = Math.max(i, r), c = this.config.delimiter ?? " ", u = this.config.newline ?? `
167
167
  `, h = [], f = this.columns.slice(l, d + 1).filter((g) => !H(g));
168
168
  if (this.config.includeHeaders) {
169
169
  const g = f.map((p) => p.header || p.field);
170
170
  h.push(g.join(c));
171
171
  }
172
- for (let g = o; g <= s; g++) {
172
+ for (let g = o; g <= a; g++) {
173
173
  const p = this.rows[g];
174
174
  if (!p) continue;
175
175
  const w = f.map((b) => {
@@ -180,7 +180,7 @@ class pn extends _ {
180
180
  }
181
181
  return {
182
182
  text: h.join(u),
183
- rowCount: s - o + 1,
183
+ rowCount: a - o + 1,
184
184
  columnCount: d - l + 1
185
185
  };
186
186
  }
@@ -191,7 +191,7 @@ class pn extends _ {
191
191
  if (!i || !n) return null;
192
192
  const r = parseInt(n, 10);
193
193
  if (isNaN(r)) return null;
194
- const o = this.columns.findIndex((s) => s.field === i);
194
+ const o = this.columns.findIndex((a) => a.field === i);
195
195
  return o === -1 ? null : { row: r, col: o };
196
196
  }
197
197
  async copy() {
@@ -211,7 +211,7 @@ class pn extends _ {
211
211
  }
212
212
  async copyRows(e) {
213
213
  if (e.length === 0) return "";
214
- const t = [...e].sort((o, s) => o - s), i = this.columns.length - 1, n = {
214
+ const t = [...e].sort((o, a) => o - a), i = this.columns.length - 1, n = {
215
215
  startRow: t[0],
216
216
  startCol: 0,
217
217
  endRow: t[t.length - 1],
@@ -228,37 +228,37 @@ class pn extends _ {
228
228
  }
229
229
  }
230
230
  const Ee = 100;
231
- function me(a) {
232
- if (a == null)
231
+ function me(s) {
232
+ if (s == null)
233
233
  return Ee;
234
- if (typeof a == "number")
235
- return a;
236
- const e = parseFloat(a);
234
+ if (typeof s == "number")
235
+ return s;
236
+ const e = parseFloat(s);
237
237
  return isNaN(e) ? Ee : e;
238
238
  }
239
- function Re(a) {
240
- return a.map((e) => me(e.width));
239
+ function Re(s) {
240
+ return s.map((e) => me(e.width));
241
241
  }
242
- function Se(a) {
242
+ function Se(s) {
243
243
  const e = [];
244
244
  let t = 0;
245
- for (const i of a)
245
+ for (const i of s)
246
246
  e.push(t), t += me(i.width);
247
247
  return e;
248
248
  }
249
- function ke(a) {
250
- return a.reduce((e, t) => e + me(t.width), 0);
249
+ function ke(s) {
250
+ return s.reduce((e, t) => e + me(t.width), 0);
251
251
  }
252
- function Et(a, e, t, i, n) {
252
+ function Et(s, e, t, i, n) {
253
253
  const r = t.length;
254
254
  if (r === 0)
255
255
  return { startCol: 0, endCol: 0, visibleColumns: [] };
256
- let o = Rt(a, t, i);
256
+ let o = Rt(s, t, i);
257
257
  o = Math.max(0, o - n);
258
- const s = a + e;
258
+ const a = s + e;
259
259
  let l = o;
260
260
  for (let c = o; c < r; c++) {
261
- if (t[c] >= s) {
261
+ if (t[c] >= a) {
262
262
  l = c - 1;
263
263
  break;
264
264
  }
@@ -270,16 +270,16 @@ function Et(a, e, t, i, n) {
270
270
  d.push(c);
271
271
  return { startCol: o, endCol: l, visibleColumns: d };
272
272
  }
273
- function Rt(a, e, t) {
273
+ function Rt(s, e, t) {
274
274
  let i = 0, n = e.length - 1;
275
275
  for (; i < n; ) {
276
276
  const r = Math.floor((i + n) / 2);
277
- e[r] + t[r] <= a ? i = r + 1 : n = r;
277
+ e[r] + t[r] <= s ? i = r + 1 : n = r;
278
278
  }
279
279
  return i;
280
280
  }
281
- function St(a, e, t) {
282
- return t ? a > e : !1;
281
+ function St(s, e, t) {
282
+ return t ? s > e : !1;
283
283
  }
284
284
  class mn extends _ {
285
285
  name = "columnVirtualization";
@@ -334,15 +334,15 @@ class mn extends _ {
334
334
  this.columnWidths,
335
335
  this.config.overscan ?? 3
336
336
  );
337
- return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((s) => i[s]);
337
+ return this.startCol = o.startCol, this.endCol = o.endCol, o.visibleColumns.map((a) => i[a]);
338
338
  }
339
339
  afterRender() {
340
340
  if (!this.isVirtualized) return;
341
341
  const e = this.gridElement;
342
342
  if (!e) return;
343
343
  const t = this.columnOffsets[this.startCol] ?? 0, i = e.querySelector(".header-row"), n = e.querySelectorAll(".data-grid-row");
344
- i && (i.style.paddingLeft = `${t}px`, i.style.minWidth = `${this.totalWidth}px`), n.forEach((s) => {
345
- s.style.paddingLeft = `${t}px`;
344
+ i && (i.style.paddingLeft = `${t}px`, i.style.minWidth = `${this.totalWidth}px`), n.forEach((a) => {
345
+ a.style.paddingLeft = `${t}px`;
346
346
  });
347
347
  const r = e.querySelector(".rows-viewport .rows");
348
348
  r && (r.style.width = `${this.totalWidth}px`);
@@ -370,16 +370,16 @@ class mn extends _ {
370
370
  }
371
371
  }
372
372
  const ne = "@layer tbw-plugins{.tbw-context-menu{position:fixed;background:var(--tbw-context-menu-bg, var(--tbw-color-panel-bg));color:var(--tbw-context-menu-fg, var(--tbw-color-fg));border:1px solid var(--tbw-context-menu-border, var(--tbw-color-border));border-radius:var(--tbw-context-menu-radius, var(--tbw-border-radius));box-shadow:var(--tbw-context-menu-shadow, 0 2px 10px var(--tbw-color-shadow));min-width:var(--tbw-context-menu-min-width, var(--tbw-menu-min-width));padding:var(--tbw-spacing-xs) 0;z-index:10000;font-size:var(--tbw-context-menu-font-size, var(--tbw-font-size-sm));font-family:var(--tbw-context-menu-font-family, var(--tbw-font-family))}.tbw-context-menu-item{display:flex;align-items:center;padding:var(--tbw-context-menu-item-padding, var(--tbw-menu-item-padding));cursor:pointer;gap:var(--tbw-context-menu-item-gap, var(--tbw-menu-item-gap))}.tbw-context-menu-item:hover:not(.disabled){background:var(--tbw-context-menu-hover, var(--tbw-color-row-hover))}.tbw-context-menu-item.disabled{opacity:.5;cursor:default}.tbw-context-menu-item.danger{color:var(--tbw-context-menu-danger, var(--tbw-color-danger))}.tbw-context-menu-icon{width:var(--tbw-context-menu-icon-size, var(--tbw-icon-size));text-align:center}.tbw-context-menu-label{flex:1}.tbw-context-menu-shortcut{color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted));font-size:var(--tbw-context-menu-shortcut-size, var(--tbw-font-size-xs))}.tbw-context-menu-arrow{font-size:var(--tbw-context-menu-arrow-size, var(--tbw-font-size-2xs));color:var(--tbw-context-menu-muted, var(--tbw-color-fg-muted))}.tbw-context-menu-separator{height:1px;background:var(--tbw-context-menu-border, var(--tbw-color-border));margin:var(--tbw-spacing-xs) 0}}";
373
- function he(a, e) {
374
- return (typeof a == "function" ? a(e) : a).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
373
+ function he(s, e) {
374
+ return (typeof s == "function" ? s(e) : s).filter((i) => !(i.hidden === !0 || typeof i.hidden == "function" && i.hidden(e)));
375
375
  }
376
- function kt(a, e) {
377
- return a.disabled === !0 ? !0 : typeof a.disabled == "function" ? a.disabled(e) : !1;
376
+ function kt(s, e) {
377
+ return s.disabled === !0 ? !0 : typeof s.disabled == "function" ? s.disabled(e) : !1;
378
378
  }
379
- function fe(a, e, t, i = ht.submenuArrow) {
379
+ function fe(s, e, t, i = ht.submenuArrow) {
380
380
  const n = document.createElement("div");
381
381
  n.className = "tbw-context-menu", n.setAttribute("role", "menu");
382
- for (const r of a) {
382
+ for (const r of s) {
383
383
  if (r.separator) {
384
384
  const d = document.createElement("div");
385
385
  d.className = "tbw-context-menu-separator", d.setAttribute("role", "separator"), n.appendChild(d);
@@ -387,8 +387,8 @@ function fe(a, e, t, i = ht.submenuArrow) {
387
387
  }
388
388
  const o = document.createElement("div");
389
389
  o.className = "tbw-context-menu-item", r.cssClass && o.classList.add(r.cssClass), o.setAttribute("role", "menuitem"), o.setAttribute("data-id", r.id);
390
- const s = kt(r, e);
391
- if (s && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
390
+ const a = kt(r, e);
391
+ if (a && (o.classList.add("disabled"), o.setAttribute("aria-disabled", "true")), r.icon) {
392
392
  const d = document.createElement("span");
393
393
  d.className = "tbw-context-menu-icon", d.innerHTML = r.icon, o.appendChild(d);
394
394
  }
@@ -408,17 +408,17 @@ function fe(a, e, t, i = ht.submenuArrow) {
408
408
  c && c.remove();
409
409
  });
410
410
  }
411
- !s && r.action && !r.subMenu && o.addEventListener("click", (d) => {
411
+ !a && r.action && !r.subMenu && o.addEventListener("click", (d) => {
412
412
  d.stopPropagation(), t(r);
413
413
  }), n.appendChild(o);
414
414
  }
415
415
  return n;
416
416
  }
417
- function Ae(a, e, t) {
418
- a.style.position = "fixed", a.style.left = `${e}px`, a.style.top = `${t}px`, a.style.visibility = "hidden", a.style.zIndex = "10000";
419
- const i = a.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
420
- let o = e, s = t;
421
- e + i.width > n && (o = e - i.width), t + i.height > r && (s = t - i.height), o = Math.max(0, o), s = Math.max(0, s), a.style.left = `${o}px`, a.style.top = `${s}px`, a.style.visibility = "visible";
417
+ function Ae(s, e, t) {
418
+ s.style.position = "fixed", s.style.left = `${e}px`, s.style.top = `${t}px`, s.style.visibility = "hidden", s.style.zIndex = "10000";
419
+ const i = s.getBoundingClientRect(), n = window.innerWidth, r = window.innerHeight;
420
+ let o = e, a = t;
421
+ e + i.width > n && (o = e - i.width), t + i.height > r && (a = t - i.height), o = Math.max(0, o), a = Math.max(0, a), s.style.left = `${o}px`, s.style.top = `${a}px`, s.style.visibility = "visible";
422
422
  }
423
423
  let O = null, G = null, N = null, re = 0;
424
424
  const oe = [
@@ -426,16 +426,16 @@ const oe = [
426
426
  id: "copy",
427
427
  name: "Copy",
428
428
  shortcut: "Ctrl+C",
429
- action: (a) => {
430
- a.grid?.plugins?.clipboard?.copy?.();
429
+ action: (s) => {
430
+ s.grid?.plugins?.clipboard?.copy?.();
431
431
  }
432
432
  },
433
433
  { separator: !0, id: "sep1", name: "" },
434
434
  {
435
435
  id: "export-csv",
436
436
  name: "Export CSV",
437
- action: (a) => {
438
- a.grid?.plugins?.export?.exportCsv?.();
437
+ action: (s) => {
438
+ s.grid?.plugins?.export?.exportCsv?.();
439
439
  }
440
440
  }
441
441
  ];
@@ -497,8 +497,8 @@ class it extends _ {
497
497
  const i = getComputedStyle(t), n = [], r = i.getPropertyValue("color-scheme").trim();
498
498
  r && n.push(`color-scheme: ${r}`);
499
499
  for (const o of it.CSS_VARS_TO_COPY) {
500
- const s = i.getPropertyValue(o).trim();
501
- s && n.push(`${o}: ${s}`);
500
+ const a = i.getPropertyValue(o).trim();
501
+ a && n.push(`${o}: ${a}`);
502
502
  }
503
503
  if (n.length > 0) {
504
504
  const o = e.getAttribute("style") || "";
@@ -518,11 +518,11 @@ class it extends _ {
518
518
  afterRender() {
519
519
  const e = this.gridElement;
520
520
  if (!e) return;
521
- const t = e.children[0];
521
+ const t = e.querySelector(".tbw-grid-root");
522
522
  t && t.getAttribute("data-context-menu-bound") !== "true" && (t.setAttribute("data-context-menu-bound", "true"), t.addEventListener("contextmenu", (i) => {
523
523
  const n = i;
524
524
  n.preventDefault();
525
- const r = n.target, o = r.closest("[data-row][data-col]"), s = r.closest(".header-cell");
525
+ const r = n.target, o = r.closest("[data-row][data-col]"), a = r.closest(".header-cell");
526
526
  let l;
527
527
  if (o) {
528
528
  const c = parseInt(o.getAttribute("data-row") ?? "-1", 10), u = parseInt(o.getAttribute("data-col") ?? "-1", 10), h = this.columns[u], f = this.rows[c];
@@ -536,8 +536,8 @@ class it extends _ {
536
536
  isHeader: !1,
537
537
  event: n
538
538
  };
539
- } else if (s) {
540
- const c = parseInt(s.getAttribute("data-col") ?? "-1", 10), u = this.columns[c];
539
+ } else if (a) {
540
+ const c = parseInt(a.getAttribute("data-col") ?? "-1", 10), u = this.columns[c];
541
541
  l = {
542
542
  row: null,
543
543
  rowIndex: -1,
@@ -590,13 +590,13 @@ class it extends _ {
590
590
  }
591
591
  }
592
592
  const At = "@layer tbw-plugins{tbw-grid{--tbw-editing-bg: var(--tbw-color-selection);--tbw-editing-row-bg: var(--tbw-editing-bg);--tbw-editing-border: var(--tbw-border-input, 1px solid var(--tbw-color-border-strong));--tbw-padding-editing-input: var(--tbw-cell-padding-input, 2px 6px);--tbw-font-size-editor: inherit;--tbw-editing-row-outline-color: var(--tbw-color-accent);--tbw-editing-row-outline-width: 1px;&:not(.tbw-grid-mode) .data-grid-row:has(.editing){background:var(--tbw-editing-row-bg);outline:var(--tbw-editing-row-outline-width) solid var(--tbw-editing-row-outline-color);outline-offset:calc(-1 * var(--tbw-editing-row-outline-width))}.data-grid-row>.cell.editing{overflow:hidden;padding:0;display:flex;min-height:calc(var(--tbw-row-height) + 2px);align-items:center;justify-content:center}.data-grid-row>.cell.editing input:not([type=checkbox]),.data-grid-row>.cell.editing select,.data-grid-row>.cell.editing textarea{width:100%;height:100%;flex:1 1 auto;min-width:0;border:var(--tbw-editing-border);padding:var(--tbw-padding-editing-input);font-size:var(--tbw-font-size-editor)}.tbw-editor-host{display:contents}--tbw-invalid-bg: light-dark(#fef2f2, #450a0a);--tbw-invalid-border-color: light-dark(#ef4444, #f87171);.data-grid-row>.cell[data-invalid=true]{background:var(--tbw-invalid-bg);outline:1px solid var(--tbw-invalid-border-color);outline-offset:-1px}}}";
593
- function _t(a) {
594
- const e = a.options;
593
+ function _t(s) {
594
+ const e = s.options;
595
595
  return e ? typeof e == "function" ? e() : e : [];
596
596
  }
597
- function Lt(a) {
597
+ function Tt(s) {
598
598
  return (e) => {
599
- const t = a.editorParams, i = document.createElement("input");
599
+ const t = s.editorParams, i = document.createElement("input");
600
600
  i.type = "number", i.value = e.value != null ? String(e.value) : "", t?.min !== void 0 && (i.min = String(t.min)), t?.max !== void 0 && (i.max = String(t.max)), t?.step !== void 0 && (i.step = String(t.step)), t?.placeholder && (i.placeholder = t.placeholder);
601
601
  const n = () => e.commit(i.value === "" ? null : Number(i.value));
602
602
  return i.addEventListener("blur", n), i.addEventListener("keydown", (r) => {
@@ -604,15 +604,15 @@ function Lt(a) {
604
604
  }), i;
605
605
  };
606
606
  }
607
- function Tt() {
608
- return (a) => {
607
+ function Lt() {
608
+ return (s) => {
609
609
  const e = document.createElement("input");
610
- return e.type = "checkbox", e.checked = !!a.value, e.addEventListener("change", () => a.commit(e.checked)), e;
610
+ return e.type = "checkbox", e.checked = !!s.value, e.addEventListener("change", () => s.commit(e.checked)), e;
611
611
  };
612
612
  }
613
- function It(a) {
613
+ function It(s) {
614
614
  return (e) => {
615
- const t = a.editorParams, i = document.createElement("input");
615
+ const t = s.editorParams, i = document.createElement("input");
616
616
  i.type = "date", e.value instanceof Date ? i.valueAsDate = e.value : typeof e.value == "string" && e.value && (i.value = e.value.split("T")[0]), t?.min && (i.min = t.min), t?.max && (i.max = t.max), t?.placeholder && (i.placeholder = t.placeholder);
617
617
  const n = () => {
618
618
  typeof e.value == "string" ? e.commit(i.value) : e.commit(i.valueAsDate);
@@ -622,20 +622,20 @@ function It(a) {
622
622
  }), i;
623
623
  };
624
624
  }
625
- function Ft(a) {
625
+ function Ft(s) {
626
626
  return (e) => {
627
- const t = a.editorParams, i = document.createElement("select");
628
- if (a.multi && (i.multiple = !0), t?.includeEmpty) {
627
+ const t = s.editorParams, i = document.createElement("select");
628
+ if (s.multi && (i.multiple = !0), t?.includeEmpty) {
629
629
  const o = document.createElement("option");
630
630
  o.value = "", o.textContent = t.emptyLabel ?? "", i.appendChild(o);
631
631
  }
632
- _t(a).forEach((o) => {
633
- const s = document.createElement("option");
634
- s.value = String(o.value), s.textContent = o.label, (a.multi && Array.isArray(e.value) && e.value.includes(o.value) || !a.multi && e.value === o.value) && (s.selected = !0), i.appendChild(s);
632
+ _t(s).forEach((o) => {
633
+ const a = document.createElement("option");
634
+ a.value = String(o.value), a.textContent = o.label, (s.multi && Array.isArray(e.value) && e.value.includes(o.value) || !s.multi && e.value === o.value) && (a.selected = !0), i.appendChild(a);
635
635
  });
636
636
  const r = () => {
637
- if (a.multi) {
638
- const o = Array.from(i.selectedOptions).map((s) => s.value);
637
+ if (s.multi) {
638
+ const o = Array.from(i.selectedOptions).map((a) => a.value);
639
639
  e.commit(o);
640
640
  } else
641
641
  e.commit(i.value);
@@ -645,9 +645,9 @@ function Ft(a) {
645
645
  }), i;
646
646
  };
647
647
  }
648
- function Pt(a) {
648
+ function Pt(s) {
649
649
  return (e) => {
650
- const t = a.editorParams, i = document.createElement("input");
650
+ const t = s.editorParams, i = document.createElement("input");
651
651
  i.type = "text", i.value = e.value != null ? String(e.value) : "", t?.maxLength !== void 0 && (i.maxLength = t.maxLength), t?.pattern && (i.pattern = t.pattern), t?.placeholder && (i.placeholder = t.placeholder);
652
652
  const n = () => {
653
653
  const r = i.value;
@@ -658,51 +658,51 @@ function Pt(a) {
658
658
  }), i;
659
659
  };
660
660
  }
661
- function Dt(a) {
662
- switch (a.type) {
661
+ function Dt(s) {
662
+ switch (s.type) {
663
663
  case "number":
664
- return Lt(a);
664
+ return Tt(s);
665
665
  case "boolean":
666
- return Tt();
666
+ return Lt();
667
667
  case "date":
668
- return It(a);
668
+ return It(s);
669
669
  case "select":
670
- return Ft(a);
670
+ return Ft(s);
671
671
  default:
672
- return Pt(a);
672
+ return Pt(s);
673
673
  }
674
674
  }
675
- function Mt(a, e) {
675
+ function Mt(s, e) {
676
676
  if (e.editor) return e.editor;
677
677
  if (e.__editorTemplate) return "template";
678
678
  if (!e.type) return;
679
- const i = a.effectiveConfig?.typeDefaults;
679
+ const i = s.effectiveConfig?.typeDefaults;
680
680
  if (i?.[e.type]?.editor)
681
681
  return i[e.type].editor;
682
- const n = a.__frameworkAdapter;
682
+ const n = s.__frameworkAdapter;
683
683
  if (n?.getTypeDefault) {
684
684
  const r = n.getTypeDefault(e.type);
685
685
  if (r?.editor)
686
686
  return r.editor;
687
687
  }
688
688
  }
689
- function U(a) {
690
- return !(typeof a != "string" || a === "__proto__" || a === "constructor" || a === "prototype");
689
+ function U(s) {
690
+ return !(typeof s != "string" || s === "__proto__" || s === "constructor" || s === "prototype");
691
691
  }
692
- function Nt(a) {
693
- const e = (a.__editingCellCount ?? 0) + 1;
694
- a.__editingCellCount = e, a.setAttribute("data-has-editing", "");
692
+ function Nt(s) {
693
+ const e = (s.__editingCellCount ?? 0) + 1;
694
+ s.__editingCellCount = e, s.setAttribute("data-has-editing", "");
695
695
  }
696
- function qt(a) {
697
- a.__editingCellCount = 0, a.removeAttribute("data-has-editing");
696
+ function qt(s) {
697
+ s.__editingCellCount = 0, s.removeAttribute("data-has-editing");
698
698
  }
699
- function W(a, e, t) {
700
- return a instanceof HTMLInputElement ? a.type === "checkbox" ? a.checked : a.type === "number" ? a.value === "" ? null : Number(a.value) : a.type === "date" ? typeof t == "string" ? a.value : a.valueAsDate : typeof t == "number" ? a.value === "" ? null : Number(a.value) : t == null && a.value === "" ? t : a.value : e?.type === "number" && a.value !== "" || typeof t == "number" && a.value !== "" ? Number(a.value) : t == null && a.value === "" ? t : a.value;
699
+ function W(s, e, t) {
700
+ return s instanceof HTMLInputElement ? s.type === "checkbox" ? s.checked : s.type === "number" ? s.value === "" ? null : Number(s.value) : s.type === "date" ? typeof t == "string" ? s.value : s.valueAsDate : typeof t == "number" ? s.value === "" ? null : Number(s.value) : t == null && s.value === "" ? t : s.value : e?.type === "number" && s.value !== "" || typeof t == "number" && s.value !== "" ? Number(s.value) : t == null && s.value === "" ? t : s.value;
701
701
  }
702
- function _e(a) {
702
+ function _e(s) {
703
703
  }
704
- function Ht(a, e, t, i) {
705
- const n = a.querySelector("input,textarea,select");
704
+ function Ht(s, e, t, i) {
705
+ const n = s.querySelector("input,textarea,select");
706
706
  n && (n.addEventListener("blur", () => {
707
707
  t(W(n, e, i));
708
708
  }), n instanceof HTMLInputElement && n.type === "checkbox" ? n.addEventListener("change", () => t(n.checked)) : n instanceof HTMLSelectElement && n.addEventListener("change", () => t(W(n, e, i))));
@@ -843,7 +843,7 @@ class wn extends _ {
843
843
  const n = e.originalEvent.type === "dblclick";
844
844
  if (i === "click" && n || i === "dblclick" && !n) return !1;
845
845
  const { rowIndex: r } = e;
846
- return t._columns?.some((s) => s.editable) ? (e.originalEvent.stopPropagation(), this.beginBulkEdit(r), !0) : !1;
846
+ return t._columns?.some((a) => a.editable) ? (e.originalEvent.stopPropagation(), this.beginBulkEdit(r), !0) : !1;
847
847
  }
848
848
  onKeyDown(e) {
849
849
  const t = this.grid;
@@ -875,9 +875,9 @@ class wn extends _ {
875
875
  if (i >= 0 && n >= 0) {
876
876
  const r = t._visibleColumns[n], o = t._rows[i];
877
877
  if (r?.editable && r.type === "boolean" && o) {
878
- const s = r.field;
879
- if (U(s)) {
880
- const d = !o[s];
878
+ const a = r.field;
879
+ if (U(a)) {
880
+ const d = !o[a];
881
881
  return this.#b(i, r, d, o), e.preventDefault(), this.requestRender(), !0;
882
882
  }
883
883
  }
@@ -892,8 +892,8 @@ class wn extends _ {
892
892
  const i = this.config.editOn ?? t.effectiveConfig?.editOn;
893
893
  if (i === !1 || i === "manual") return !1;
894
894
  const n = t._focusRow, r = t._focusCol;
895
- if (n >= 0 && t._columns?.some((s) => s.editable)) {
896
- const s = t._visibleColumns[r], l = t._rows[n], d = s?.field ?? "", c = d && l ? l[d] : void 0, u = this.gridElement.querySelector(`[data-row="${n}"][data-col="${r}"]`), h = new CustomEvent("cell-activate", {
895
+ if (n >= 0 && t._columns?.some((a) => a.editable)) {
896
+ const a = t._visibleColumns[r], l = t._rows[n], d = a?.field ?? "", c = d && l ? l[d] : void 0, u = this.gridElement.querySelector(`[data-row="${n}"][data-col="${r}"]`), h = new CustomEvent("cell-activate", {
897
897
  cancelable: !0,
898
898
  bubbles: !0,
899
899
  detail: {
@@ -925,8 +925,8 @@ class wn extends _ {
925
925
  if (!r.type) return r;
926
926
  let o;
927
927
  if (i?.[r.type]?.editorParams && (o = i[r.type].editorParams), !o && n?.getTypeDefault) {
928
- const s = n.getTypeDefault(r.type);
929
- s?.editorParams && (o = s.editorParams);
928
+ const a = n.getTypeDefault(r.type);
929
+ a?.editorParams && (o = a.editorParams);
930
930
  }
931
931
  return o ? {
932
932
  ...r,
@@ -942,9 +942,9 @@ class wn extends _ {
942
942
  }
943
943
  if (!this.#t && this.#n.size !== 0)
944
944
  for (const t of this.#n) {
945
- const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), s = e.findRenderedRowElement?.(r);
946
- if (!s) continue;
947
- const l = s.querySelector(`.cell[data-col="${o}"]`);
945
+ const [i, n] = t.split(":"), r = parseInt(i, 10), o = parseInt(n, 10), a = e.findRenderedRowElement?.(r);
946
+ if (!a) continue;
947
+ const l = a.querySelector(`.cell[data-col="${o}"]`);
948
948
  if (!l || l.classList.contains("editing")) continue;
949
949
  const d = e._rows[r], c = e._visibleColumns[o];
950
950
  d && c && this.#m(d, r, c, o, l, !0);
@@ -1031,15 +1031,15 @@ class wn extends _ {
1031
1031
  #p(e, t, i) {
1032
1032
  const n = this.grid, r = n._visibleColumns?.findIndex((c) => c.field === t);
1033
1033
  if (r === -1 || r === void 0) return;
1034
- const s = n._rows?.findIndex((c) => {
1034
+ const a = n._rows?.findIndex((c) => {
1035
1035
  try {
1036
1036
  return n.getRowId?.(c) === e;
1037
1037
  } catch {
1038
1038
  return !1;
1039
1039
  }
1040
1040
  });
1041
- if (s === -1 || s === void 0) return;
1042
- const d = n.findRenderedRowElement?.(s)?.querySelector(`.cell[data-col="${r}"]`);
1041
+ if (a === -1 || a === void 0) return;
1042
+ const d = n.findRenderedRowElement?.(a)?.querySelector(`.cell[data-col="${r}"]`);
1043
1043
  if (d)
1044
1044
  if (i) {
1045
1045
  d.setAttribute("data-invalid", "true");
@@ -1055,25 +1055,25 @@ class wn extends _ {
1055
1055
  beginCellEdit(e, t) {
1056
1056
  const i = this.grid, n = i._visibleColumns.findIndex((l) => l.field === t);
1057
1057
  if (n === -1 || !i._visibleColumns[n]?.editable) return;
1058
- const s = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
1059
- s && this.#v(e, n, s);
1058
+ const a = i.findRenderedRowElement?.(e)?.querySelector(`.cell[data-col="${n}"]`);
1059
+ a && this.#v(e, n, a);
1060
1060
  }
1061
1061
  beginBulkEdit(e) {
1062
1062
  const t = this.grid;
1063
- if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((s) => s.editable)) return;
1063
+ if ((this.config.editOn ?? t.effectiveConfig?.editOn) === !1 || !t._columns?.some((a) => a.editable)) return;
1064
1064
  const r = t.findRenderedRowElement?.(e);
1065
1065
  if (!r) return;
1066
1066
  const o = t._rows[e];
1067
- this.#g(e, o), Array.from(r.children).forEach((s, l) => {
1067
+ this.#g(e, o), Array.from(r.children).forEach((a, l) => {
1068
1068
  const d = t._visibleColumns[l];
1069
1069
  if (d?.editable) {
1070
- const c = s;
1070
+ const c = a;
1071
1071
  c.classList.contains("editing") || this.#m(o, e, d, l, c, !0);
1072
1072
  }
1073
1073
  }), setTimeout(() => {
1074
- let s = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
1075
- if (s?.classList.contains("editing") || (s = r.querySelector(".cell.editing")), s?.classList.contains("editing")) {
1076
- const l = s.querySelector(M);
1074
+ let a = r.querySelector(`.cell[data-col="${t._focusCol}"]`);
1075
+ if (a?.classList.contains("editing") || (a = r.querySelector(".cell.editing")), a?.classList.contains("editing")) {
1076
+ const l = a.querySelector(M);
1077
1077
  try {
1078
1078
  l?.focus({ preventScroll: !0 });
1079
1079
  } catch {
@@ -1103,10 +1103,10 @@ class wn extends _ {
1103
1103
  #w(e) {
1104
1104
  const t = this.grid, i = t._rows, n = this.#t ? t._focusRow : this.#e, r = t._visibleColumns.map((d, c) => d.editable ? c : -1).filter((d) => d >= 0);
1105
1105
  if (r.length === 0) return;
1106
- const s = r.indexOf(t._focusCol) + (e ? 1 : -1);
1107
- if (s >= 0 && s < r.length) {
1108
- t._focusCol = r[s];
1109
- const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[s]}"]`);
1106
+ const a = r.indexOf(t._focusCol) + (e ? 1 : -1);
1107
+ if (a >= 0 && a < r.length) {
1108
+ t._focusCol = r[a];
1109
+ const c = t.findRenderedRowElement?.(n)?.querySelector(`.cell[data-col="${r[a]}"]`);
1110
1110
  c?.classList.contains("editing") && c.querySelector(M)?.focus({ preventScroll: !0 }), F(t, { forceHorizontalScroll: !0 });
1111
1111
  return;
1112
1112
  }
@@ -1126,10 +1126,10 @@ class wn extends _ {
1126
1126
  #a(e, t) {
1127
1127
  if (this.#e !== e) return;
1128
1128
  const i = this.grid, n = this.#o.get(e), r = i._rows[e], o = i.findRenderedRowElement?.(e);
1129
- let s;
1129
+ let a;
1130
1130
  if (r)
1131
1131
  try {
1132
- s = i.getRowId?.(r);
1132
+ a = i.getRowId?.(r);
1133
1133
  } catch {
1134
1134
  }
1135
1135
  if (!t && o && r && o.querySelectorAll(".cell.editing").forEach((d) => {
@@ -1146,11 +1146,11 @@ class wn extends _ {
1146
1146
  }), t && n && r)
1147
1147
  Object.keys(n).forEach((l) => {
1148
1148
  r[l] = n[l];
1149
- }), s && (this.#i.delete(s), this.clearRowInvalid(s));
1149
+ }), a && (this.#i.delete(a), this.clearRowInvalid(a));
1150
1150
  else if (!t && r) {
1151
- const l = this.#C(n, r), d = s ? this.#i.has(s) : l, c = this.emitCancelable("row-commit", {
1151
+ const l = this.#C(n, r), d = a ? this.#i.has(a) : l, c = this.emitCancelable("row-commit", {
1152
1152
  rowIndex: e,
1153
- rowId: s ?? "",
1153
+ rowId: a ?? "",
1154
1154
  row: r,
1155
1155
  oldValue: n,
1156
1156
  newValue: r,
@@ -1160,7 +1160,7 @@ class wn extends _ {
1160
1160
  });
1161
1161
  c && n ? (Object.keys(n).forEach((u) => {
1162
1162
  r[u] = n[u];
1163
- }), s && (this.#i.delete(s), this.clearRowInvalid(s))) : !c && l && this.isAnimationEnabled && (this.#l = e);
1163
+ }), a && (this.#i.delete(a), this.clearRowInvalid(a))) : !c && l && this.isAnimationEnabled && (this.#l = e);
1164
1164
  }
1165
1165
  this.#o.delete(e), this.#e = -1, this.#s = -1, this.#c();
1166
1166
  for (const l of this.#n)
@@ -1174,7 +1174,7 @@ class wn extends _ {
1174
1174
  if (!U(r)) return;
1175
1175
  const o = n[r];
1176
1176
  if (o === i) return;
1177
- const s = this.grid;
1177
+ const a = this.grid;
1178
1178
  let l;
1179
1179
  try {
1180
1180
  l = this.grid.getRowId(n);
@@ -1205,17 +1205,17 @@ class wn extends _ {
1205
1205
  oldValue: o,
1206
1206
  newValue: i
1207
1207
  });
1208
- const g = s.findRenderedRowElement?.(e);
1208
+ const g = a.findRenderedRowElement?.(e);
1209
1209
  g && g.classList.add("changed");
1210
1210
  }
1211
1211
  #m(e, t, i, n, r, o) {
1212
1212
  if (!i.editable || r.classList.contains("editing")) return;
1213
- let s;
1213
+ let a;
1214
1214
  try {
1215
- s = this.grid.getRowId(e);
1215
+ a = this.grid.getRowId(e);
1216
1216
  } catch {
1217
1217
  }
1218
- const l = s ? (v) => this.grid.updateRow(s, v, "cascade") : _e, d = U(i.field) ? e[i.field] : void 0;
1218
+ const l = a ? (v) => this.grid.updateRow(a, v, "cascade") : _e, d = U(i.field) ? e[i.field] : void 0;
1219
1219
  r.classList.add("editing"), this.#n.add(`${t}:${n}`);
1220
1220
  const c = r.parentElement;
1221
1221
  c && Nt(c);
@@ -1258,7 +1258,7 @@ class wn extends _ {
1258
1258
  } else if (typeof b == "function") {
1259
1259
  const v = {
1260
1260
  row: e,
1261
- rowId: s ?? "",
1261
+ rowId: a ?? "",
1262
1262
  value: y,
1263
1263
  field: i.field,
1264
1264
  column: i,
@@ -1274,7 +1274,7 @@ class wn extends _ {
1274
1274
  v.setAttribute("data-external-editor", ""), v.setAttribute("data-field", i.field), g.appendChild(v), r.setAttribute("data-editor-managed", "");
1275
1275
  const E = {
1276
1276
  row: e,
1277
- rowId: s ?? "",
1277
+ rowId: a ?? "",
1278
1278
  value: y,
1279
1279
  field: i.field,
1280
1280
  column: i,
@@ -1294,7 +1294,7 @@ class wn extends _ {
1294
1294
  );
1295
1295
  }
1296
1296
  }
1297
- #y(e, t, i, n, r, o, s, l) {
1297
+ #y(e, t, i, n, r, o, a, l) {
1298
1298
  const d = t.__editorTemplate;
1299
1299
  if (!d) return;
1300
1300
  const c = d.cloneNode(!0), u = t.__compiledEditor;
@@ -1332,7 +1332,7 @@ class wn extends _ {
1332
1332
  return;
1333
1333
  p.stopPropagation(), p.preventDefault(), o(), this.#a(l, !0);
1334
1334
  }
1335
- }), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), s || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
1335
+ }), h instanceof HTMLInputElement && h.type === "checkbox" && h.addEventListener("change", () => r(h.checked)), a || setTimeout(() => h.focus({ preventScroll: !0 }), 0);
1336
1336
  }
1337
1337
  e.appendChild(c);
1338
1338
  }
@@ -1360,45 +1360,45 @@ class wn extends _ {
1360
1360
  });
1361
1361
  }
1362
1362
  }
1363
- function Le(a, e = !0) {
1364
- if (a == null) return "";
1365
- if (a instanceof Date) return a.toISOString();
1366
- if (typeof a == "object") return JSON.stringify(a);
1367
- const t = String(a);
1363
+ function Te(s, e = !0) {
1364
+ if (s == null) return "";
1365
+ if (s instanceof Date) return s.toISOString();
1366
+ if (typeof s == "object") return JSON.stringify(s);
1367
+ const t = String(s);
1368
1368
  return e && (t.includes(",") || t.includes('"') || t.includes(`
1369
1369
  `) || t.includes("\r")) ? `"${t.replace(/"/g, '""')}"` : t;
1370
1370
  }
1371
- function Kt(a, e, t, i = {}) {
1371
+ function Kt(s, e, t, i = {}) {
1372
1372
  const n = i.delimiter ?? ",", r = i.newline ?? `
1373
- `, o = [], s = i.bom ? "\uFEFF" : "";
1373
+ `, o = [], a = i.bom ? "\uFEFF" : "";
1374
1374
  if (t.includeHeaders !== !1) {
1375
1375
  const l = e.map((d) => {
1376
1376
  const c = d.header || d.field, u = t.processHeader ? t.processHeader(c, d.field) : c;
1377
- return Le(u);
1377
+ return Te(u);
1378
1378
  });
1379
1379
  o.push(l.join(n));
1380
1380
  }
1381
- for (const l of a) {
1381
+ for (const l of s) {
1382
1382
  const d = e.map((c) => {
1383
1383
  let u = l[c.field];
1384
- return t.processCell && (u = t.processCell(u, c.field, l)), Le(u);
1384
+ return t.processCell && (u = t.processCell(u, c.field, l)), Te(u);
1385
1385
  });
1386
1386
  o.push(d.join(n));
1387
1387
  }
1388
- return s + o.join(r);
1388
+ return a + o.join(r);
1389
1389
  }
1390
- function we(a, e) {
1391
- const t = URL.createObjectURL(a), i = document.createElement("a");
1390
+ function we(s, e) {
1391
+ const t = URL.createObjectURL(s), i = document.createElement("a");
1392
1392
  i.href = t, i.download = e, i.style.display = "none", document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(t);
1393
1393
  }
1394
- function zt(a, e) {
1395
- const t = new Blob([a], { type: "text/csv;charset=utf-8;" });
1394
+ function zt(s, e) {
1395
+ const t = new Blob([s], { type: "text/csv;charset=utf-8;" });
1396
1396
  we(t, e);
1397
1397
  }
1398
- function Te(a) {
1399
- return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1398
+ function Le(s) {
1399
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
1400
1400
  }
1401
- function Ot(a, e, t) {
1401
+ function Ot(s, e, t) {
1402
1402
  let i = `<?xml version="1.0" encoding="UTF-8"?>
1403
1403
  <?mso-application progid="Excel.Sheet"?>
1404
1404
  <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
@@ -1410,18 +1410,18 @@ function Ot(a, e, t) {
1410
1410
  <Row>`;
1411
1411
  for (const n of e) {
1412
1412
  const r = n.header || n.field, o = t.processHeader ? t.processHeader(r, n.field) : r;
1413
- i += `<Cell><Data ss:Type="String">${Te(o)}</Data></Cell>`;
1413
+ i += `<Cell><Data ss:Type="String">${Le(o)}</Data></Cell>`;
1414
1414
  }
1415
1415
  i += "</Row>";
1416
1416
  }
1417
- for (const n of a) {
1417
+ for (const n of s) {
1418
1418
  i += `
1419
1419
  <Row>`;
1420
1420
  for (const r of e) {
1421
1421
  let o = n[r.field];
1422
1422
  t.processCell && (o = t.processCell(o, r.field, n));
1423
- let s = "String", l = "";
1424
- o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (s = "Number", l = String(o)) : o instanceof Date ? (s = "DateTime", l = o.toISOString()) : l = Te(String(o)), i += `<Cell><Data ss:Type="${s}">${l}</Data></Cell>`;
1423
+ let a = "String", l = "";
1424
+ o == null ? l = "" : typeof o == "number" && !isNaN(o) ? (a = "Number", l = String(o)) : o instanceof Date ? (a = "DateTime", l = o.toISOString()) : l = Le(String(o)), i += `<Cell><Data ss:Type="${a}">${l}</Data></Cell>`;
1425
1425
  }
1426
1426
  i += "</Row>";
1427
1427
  }
@@ -1430,8 +1430,8 @@ function Ot(a, e, t) {
1430
1430
  </Worksheet>
1431
1431
  </Workbook>`, i;
1432
1432
  }
1433
- function Gt(a, e) {
1434
- const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([a], {
1433
+ function Gt(s, e) {
1434
+ const t = e.endsWith(".xls") ? e : `${e}.xls`, i = new Blob([s], {
1435
1435
  type: "application/vnd.ms-excel;charset=utf-8;"
1436
1436
  });
1437
1437
  we(i, t);
@@ -1469,17 +1469,17 @@ class bn extends _ {
1469
1469
  l?.selected?.size && (o = [...l.selected].sort((c, u) => c - u).map((c) => this.rows[c]).filter(Boolean));
1470
1470
  }
1471
1471
  t?.rowIndices && (o = t.rowIndices.map((l) => this.rows[l]).filter(Boolean)), this.isExportingFlag = !0;
1472
- let s = n.fileName;
1472
+ let a = n.fileName;
1473
1473
  try {
1474
1474
  switch (e) {
1475
1475
  case "csv": {
1476
1476
  const l = Kt(o, r, n, { bom: !0 });
1477
- s = s.endsWith(".csv") ? s : `${s}.csv`, zt(l, s);
1477
+ a = a.endsWith(".csv") ? a : `${a}.csv`, zt(l, a);
1478
1478
  break;
1479
1479
  }
1480
1480
  case "excel": {
1481
1481
  const l = Ot(o, r, n);
1482
- s = s.endsWith(".xls") ? s : `${s}.xls`, Gt(l, s);
1482
+ a = a.endsWith(".xls") ? a : `${a}.xls`, Gt(l, a);
1483
1483
  break;
1484
1484
  }
1485
1485
  case "json": {
@@ -1491,15 +1491,15 @@ class bn extends _ {
1491
1491
  }
1492
1492
  return h;
1493
1493
  }), d = JSON.stringify(l, null, 2);
1494
- s = s.endsWith(".json") ? s : `${s}.json`;
1494
+ a = a.endsWith(".json") ? a : `${a}.json`;
1495
1495
  const c = new Blob([d], { type: "application/json" });
1496
- we(c, s);
1496
+ we(c, a);
1497
1497
  break;
1498
1498
  }
1499
1499
  }
1500
1500
  this.lastExportInfo = { format: e, timestamp: /* @__PURE__ */ new Date() }, this.emit("export-complete", {
1501
1501
  format: e,
1502
- fileName: s,
1502
+ fileName: a,
1503
1503
  rowCount: o.length,
1504
1504
  columnCount: r.length
1505
1505
  });
@@ -1530,8 +1530,8 @@ class bn extends _ {
1530
1530
  return this.lastExportInfo;
1531
1531
  }
1532
1532
  }
1533
- function Bt(a, e, t = !1) {
1534
- const i = a[e.field];
1533
+ function Bt(s, e, t = !1) {
1534
+ const i = s[e.field];
1535
1535
  if (e.operator === "blank")
1536
1536
  return i == null || i === "";
1537
1537
  if (e.operator === "notBlank")
@@ -1569,12 +1569,12 @@ function Bt(a, e, t = !1) {
1569
1569
  return !0;
1570
1570
  }
1571
1571
  }
1572
- function Vt(a, e, t = !1) {
1573
- return e.length ? a.filter((i) => e.every((n) => Bt(i, n, t))) : a;
1572
+ function Vt(s, e, t = !1) {
1573
+ return e.length ? s.filter((i) => e.every((n) => Bt(i, n, t))) : s;
1574
1574
  }
1575
- function Wt(a) {
1575
+ function Wt(s) {
1576
1576
  return JSON.stringify(
1577
- a.map((e) => ({
1577
+ s.map((e) => ({
1578
1578
  field: e.field,
1579
1579
  operator: e.operator,
1580
1580
  value: e.value,
@@ -1582,9 +1582,9 @@ function Wt(a) {
1582
1582
  }))
1583
1583
  );
1584
1584
  }
1585
- function Ie(a, e) {
1585
+ function Ie(s, e) {
1586
1586
  const t = /* @__PURE__ */ new Set();
1587
- for (const i of a) {
1587
+ for (const i of s) {
1588
1588
  const n = i[e];
1589
1589
  n != null && t.add(n);
1590
1590
  }
@@ -1670,19 +1670,19 @@ class q extends _ {
1670
1670
  if (!r || !this.isColumnFilterable(r) || H(r)) return;
1671
1671
  const o = r.field;
1672
1672
  if (!o) return;
1673
- const s = this.filters.has(o);
1673
+ const a = this.filters.has(o);
1674
1674
  let l = i.querySelector(".tbw-filter-btn");
1675
1675
  if (l) {
1676
1676
  const u = l.classList.contains("active");
1677
- if (l.classList.toggle("active", s), i.classList.toggle("filtered", s), u !== s) {
1678
- const h = s ? "filterActive" : "filter";
1677
+ if (l.classList.toggle("active", a), i.classList.toggle("filtered", a), u !== a) {
1678
+ const h = a ? "filterActive" : "filter";
1679
1679
  this.setIcon(l, this.resolveIcon(h));
1680
1680
  }
1681
1681
  return;
1682
1682
  }
1683
1683
  l = document.createElement("button"), l.className = "tbw-filter-btn", l.setAttribute("aria-label", `Filter ${r.header ?? o}`);
1684
- const d = s ? "filterActive" : "filter";
1685
- this.setIcon(l, this.resolveIcon(d)), s && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
1684
+ const d = a ? "filterActive" : "filter";
1685
+ this.setIcon(l, this.resolveIcon(d)), a && (l.classList.add("active"), i.classList.add("filtered")), l.addEventListener("click", (u) => {
1686
1686
  u.stopPropagation(), this.toggleFilterPanel(o, r, l);
1687
1687
  });
1688
1688
  const c = i.querySelector(".resize-handle");
@@ -1773,7 +1773,7 @@ class q extends _ {
1773
1773
  renderPanelContent(e, t, i, n) {
1774
1774
  let r = this.excludedValues.get(e);
1775
1775
  r || (r = /* @__PURE__ */ new Set(), this.excludedValues.set(e, r));
1776
- const o = this.searchText.get(e) ?? "", s = {
1776
+ const o = this.searchText.get(e) ?? "", a = {
1777
1777
  field: e,
1778
1778
  column: t,
1779
1779
  uniqueValues: n,
@@ -1791,13 +1791,13 @@ class q extends _ {
1791
1791
  closePanel: () => this.closeFilterPanel()
1792
1792
  };
1793
1793
  let l = !1;
1794
- if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, s), l = i.children.length > 0), !l && t.type) {
1794
+ if (this.config.filterPanelRenderer && (this.config.filterPanelRenderer(i, a), l = i.children.length > 0), !l && t.type) {
1795
1795
  const d = this.grid.effectiveConfig.typeDefaults?.[t.type];
1796
- d?.filterPanelRenderer && (d.filterPanelRenderer(i, s), l = i.children.length > 0);
1796
+ d?.filterPanelRenderer && (d.filterPanelRenderer(i, a), l = i.children.length > 0);
1797
1797
  }
1798
1798
  if (!l) {
1799
1799
  const d = t.type;
1800
- d === "number" ? this.renderNumberFilterPanel(i, s, n) : d === "date" ? this.renderDateFilterPanel(i, s, n) : this.renderDefaultFilterPanel(i, s, n, r);
1800
+ d === "number" ? this.renderNumberFilterPanel(i, a, n) : d === "date" ? this.renderDateFilterPanel(i, a, n) : this.renderDefaultFilterPanel(i, a, n, r);
1801
1801
  }
1802
1802
  }
1803
1803
  setupPanelCloseHandler(e, t) {
@@ -1823,8 +1823,8 @@ class q extends _ {
1823
1823
  const n = t.closest(".cell") ?? t;
1824
1824
  if (n.style.anchorName = "--tbw-filter-anchor", this.panelAnchorElement = n, q.checkAnchorPositioningSupport()) {
1825
1825
  requestAnimationFrame(() => {
1826
- const o = e.getBoundingClientRect(), s = n.getBoundingClientRect();
1827
- o.top < s.top && e.classList.add("tbw-filter-panel-above");
1826
+ const o = e.getBoundingClientRect(), a = n.getBoundingClientRect();
1827
+ o.top < a.top && e.classList.add("tbw-filter-panel-above");
1828
1828
  });
1829
1829
  return;
1830
1830
  }
@@ -1835,10 +1835,10 @@ class q extends _ {
1835
1835
  });
1836
1836
  }
1837
1837
  renderDefaultFilterPanel(e, t, i, n) {
1838
- const { field: r } = t, o = this.getListItemHeight(), s = document.createElement("div");
1839
- s.className = "tbw-filter-search";
1838
+ const { field: r } = t, o = this.getListItemHeight(), a = document.createElement("div");
1839
+ a.className = "tbw-filter-search";
1840
1840
  const l = document.createElement("input");
1841
- l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", s.appendChild(l), e.appendChild(s);
1841
+ l.type = "text", l.placeholder = "Search...", l.className = "tbw-filter-search-input", l.value = this.searchText.get(r) ?? "", a.appendChild(l), e.appendChild(a);
1842
1842
  const d = document.createElement("div");
1843
1843
  d.className = "tbw-filter-actions";
1844
1844
  const c = document.createElement("label");
@@ -1848,8 +1848,8 @@ class q extends _ {
1848
1848
  const h = document.createElement("span");
1849
1849
  h.textContent = "Select All", c.appendChild(u), c.appendChild(h), d.appendChild(c);
1850
1850
  const f = () => {
1851
- const C = [...b.values()], k = C.every((m) => m), L = C.every((m) => !m);
1852
- u.checked = k, u.indeterminate = !k && !L;
1851
+ const C = [...b.values()], k = C.every((m) => m), T = C.every((m) => !m);
1852
+ u.checked = k, u.indeterminate = !k && !T;
1853
1853
  };
1854
1854
  u.addEventListener("change", () => {
1855
1855
  const C = u.checked;
@@ -1870,26 +1870,26 @@ class q extends _ {
1870
1870
  }), f();
1871
1871
  let y = [];
1872
1872
  const v = (C, k) => {
1873
- const L = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
1873
+ const T = C == null ? "(Blank)" : String(C), m = C == null ? "__null__" : String(C), x = document.createElement("label");
1874
1874
  x.className = "tbw-filter-value-item", x.style.position = "absolute", x.style.top = `calc(var(--tbw-filter-item-height, 28px) * ${k})`, x.style.left = "0", x.style.right = "0", x.style.boxSizing = "border-box";
1875
- const T = document.createElement("input");
1876
- T.type = "checkbox", T.className = "tbw-filter-checkbox", T.checked = b.get(m) ?? !0, T.dataset.value = m, T.addEventListener("change", () => {
1877
- b.set(m, T.checked), f();
1875
+ const L = document.createElement("input");
1876
+ L.type = "checkbox", L.className = "tbw-filter-checkbox", L.checked = b.get(m) ?? !0, L.dataset.value = m, L.addEventListener("change", () => {
1877
+ b.set(m, L.checked), f();
1878
1878
  });
1879
1879
  const K = document.createElement("span");
1880
- return K.textContent = L, x.appendChild(T), x.appendChild(K), x;
1880
+ return K.textContent = T, x.appendChild(L), x.appendChild(K), x;
1881
1881
  }, E = () => {
1882
- const C = y.length, k = g.clientHeight, L = g.scrollTop;
1882
+ const C = y.length, k = g.clientHeight, T = g.scrollTop;
1883
1883
  if (p.style.height = `${C * o}px`, ft(C, q.LIST_BYPASS_THRESHOLD / 3)) {
1884
- w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, T) => {
1885
- w.appendChild(v(x, T));
1884
+ w.innerHTML = "", w.style.transform = "translateY(0px)", y.forEach((x, L) => {
1885
+ w.appendChild(v(x, L));
1886
1886
  });
1887
1887
  return;
1888
1888
  }
1889
1889
  const m = gt({
1890
1890
  totalRows: C,
1891
1891
  viewportHeight: k,
1892
- scrollTop: L,
1892
+ scrollTop: T,
1893
1893
  rowHeight: o,
1894
1894
  overscan: q.LIST_OVERSCAN
1895
1895
  });
@@ -1897,10 +1897,10 @@ class q extends _ {
1897
1897
  for (let x = m.start; x < m.end; x++)
1898
1898
  w.appendChild(v(y[x], x - m.start));
1899
1899
  }, R = (C) => {
1900
- const k = this.config.caseSensitive ?? !1, L = k ? C : C.toLowerCase();
1900
+ const k = this.config.caseSensitive ?? !1, T = k ? C : C.toLowerCase();
1901
1901
  if (y = i.filter((m) => {
1902
- const x = m == null ? "(Blank)" : String(m), T = k ? x : x.toLowerCase();
1903
- return !C || T.includes(L);
1902
+ const x = m == null ? "(Blank)" : String(m), L = k ? x : x.toLowerCase();
1903
+ return !C || L.includes(T);
1904
1904
  }), y.length === 0) {
1905
1905
  p.style.height = "0px", w.innerHTML = "";
1906
1906
  const m = document.createElement("div");
@@ -1927,8 +1927,8 @@ class q extends _ {
1927
1927
  const P = document.createElement("button");
1928
1928
  P.className = "tbw-filter-apply-btn", P.textContent = "Apply", P.addEventListener("click", () => {
1929
1929
  const C = [];
1930
- for (const [k, L] of b)
1931
- if (!L)
1930
+ for (const [k, T] of b)
1931
+ if (!T)
1932
1932
  if (k === "__null__")
1933
1933
  C.push(null);
1934
1934
  else {
@@ -1943,14 +1943,14 @@ class q extends _ {
1943
1943
  }), I.appendChild(S), e.appendChild(I);
1944
1944
  }
1945
1945
  renderNumberFilterPanel(e, t, i) {
1946
- const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = (A, z) => {
1946
+ const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = (A, z) => {
1947
1947
  if (typeof A == "number") return A;
1948
1948
  if (typeof A == "string") {
1949
1949
  const j = parseFloat(A);
1950
1950
  return isNaN(j) ? z : j;
1951
1951
  }
1952
1952
  return z;
1953
- }, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? s?.min, c), f = l(o?.max ?? s?.max, u), g = o?.step ?? s?.step ?? 1, p = this.filters.get(n);
1953
+ }, d = i.filter((A) => typeof A == "number" && !isNaN(A)), c = d.length > 0 ? Math.min(...d) : 0, u = d.length > 0 ? Math.max(...d) : 100, h = l(o?.min ?? a?.min, c), f = l(o?.max ?? a?.max, u), g = o?.step ?? a?.step ?? 1, p = this.filters.get(n);
1954
1954
  let w = h, b = f;
1955
1955
  p?.operator === "between" ? (w = l(p.value, h), b = l(p.valueTo, f)) : p?.operator === "greaterThanOrEqual" ? w = l(p.value, h) : p?.operator === "lessThanOrEqual" && (b = l(p.value, f));
1956
1956
  const y = document.createElement("div");
@@ -1973,29 +1973,29 @@ class q extends _ {
1973
1973
  C.className = "tbw-filter-range-slider";
1974
1974
  const k = document.createElement("div");
1975
1975
  k.className = "tbw-filter-range-track";
1976
- const L = document.createElement("div");
1977
- L.className = "tbw-filter-range-fill";
1976
+ const T = document.createElement("div");
1977
+ T.className = "tbw-filter-range-fill";
1978
1978
  const m = document.createElement("input");
1979
1979
  m.type = "range", m.className = "tbw-filter-range-thumb tbw-filter-range-thumb-min", m.min = String(h), m.max = String(f), m.step = String(g), m.value = String(w);
1980
1980
  const x = document.createElement("input");
1981
- x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(L), C.appendChild(m), C.appendChild(x), e.appendChild(C);
1982
- const T = () => {
1981
+ x.type = "range", x.className = "tbw-filter-range-thumb tbw-filter-range-thumb-max", x.min = String(h), x.max = String(f), x.step = String(g), x.value = String(b), C.appendChild(k), C.appendChild(T), C.appendChild(m), C.appendChild(x), e.appendChild(C);
1982
+ const L = () => {
1983
1983
  const A = parseFloat(m.value), z = parseFloat(x.value), j = f - h, ve = (A - h) / j * 100, ut = (z - h) / j * 100;
1984
- L.style.left = `${ve}%`, L.style.width = `${ut - ve}%`;
1984
+ T.style.left = `${ve}%`, T.style.width = `${ut - ve}%`;
1985
1985
  };
1986
1986
  m.addEventListener("input", () => {
1987
1987
  const A = Math.min(parseFloat(m.value), parseFloat(x.value));
1988
- m.value = String(A), R.value = String(A), T();
1988
+ m.value = String(A), R.value = String(A), L();
1989
1989
  }), x.addEventListener("input", () => {
1990
1990
  const A = Math.max(parseFloat(x.value), parseFloat(m.value));
1991
- x.value = String(A), S.value = String(A), T();
1991
+ x.value = String(A), S.value = String(A), L();
1992
1992
  }), R.addEventListener("input", () => {
1993
1993
  let A = parseFloat(R.value) || h;
1994
- A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), T();
1994
+ A = Math.max(h, Math.min(A, parseFloat(S.value))), m.value = String(A), L();
1995
1995
  }), S.addEventListener("input", () => {
1996
1996
  let A = parseFloat(S.value) || f;
1997
- A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), T();
1998
- }), T();
1997
+ A = Math.min(f, Math.max(A, parseFloat(R.value))), x.value = String(A), L();
1998
+ }), L();
1999
1999
  const K = document.createElement("div");
2000
2000
  K.className = "tbw-filter-buttons";
2001
2001
  const X = document.createElement("button");
@@ -2009,7 +2009,7 @@ class q extends _ {
2009
2009
  }), K.appendChild(Z), e.appendChild(K);
2010
2010
  }
2011
2011
  renderDateFilterPanel(e, t, i) {
2012
- const { field: n, column: r } = t, o = r.filterParams, s = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", f = h(o?.min) || h(s?.min) || u(d), g = h(o?.max) || h(s?.max) || u(c), p = this.filters.get(n);
2012
+ const { field: n, column: r } = t, o = r.filterParams, a = r.editorParams, l = i.filter((m) => m instanceof Date || typeof m == "string" && !isNaN(Date.parse(m))).map((m) => m instanceof Date ? m : new Date(m)).filter((m) => !isNaN(m.getTime())), d = l.length > 0 ? new Date(Math.min(...l.map((m) => m.getTime()))) : null, c = l.length > 0 ? new Date(Math.max(...l.map((m) => m.getTime()))) : null, u = (m) => m ? m.toISOString().split("T")[0] : "", h = (m) => m ? typeof m == "string" ? m : typeof m == "number" ? u(new Date(m)) : "" : "", f = h(o?.min) || h(a?.min) || u(d), g = h(o?.max) || h(a?.max) || u(c), p = this.filters.get(n);
2013
2013
  let w = "", b = "";
2014
2014
  p?.operator === "between" ? (w = h(p.value) || "", b = h(p.valueTo) || "") : p?.operator === "greaterThanOrEqual" ? w = h(p.value) || "" : p?.operator === "lessThanOrEqual" && (b = h(p.value) || "");
2015
2015
  const y = document.createElement("div");
@@ -2035,10 +2035,10 @@ class q extends _ {
2035
2035
  const m = R.value, x = S.value;
2036
2036
  m && x ? t.applyTextFilter("between", m, x) : m ? t.applyTextFilter("greaterThanOrEqual", m) : x ? t.applyTextFilter("lessThanOrEqual", x) : t.clearFilter();
2037
2037
  }), C.appendChild(k);
2038
- const L = document.createElement("button");
2039
- L.className = "tbw-filter-clear-btn", L.textContent = "Clear Filter", L.addEventListener("click", () => {
2038
+ const T = document.createElement("button");
2039
+ T.className = "tbw-filter-clear-btn", T.textContent = "Clear Filter", T.addEventListener("click", () => {
2040
2040
  t.clearFilter();
2041
- }), C.appendChild(L), e.appendChild(C);
2041
+ }), C.appendChild(T), e.appendChild(C);
2042
2042
  }
2043
2043
  applySetFilter(e, t) {
2044
2044
  this.excludedValues.set(e, new Set(t)), t.length === 0 ? this.filters.delete(e) : this.filters.set(e, {
@@ -2104,28 +2104,28 @@ class q extends _ {
2104
2104
  this.filters.set(e, i), this.cachedResult = null, this.cacheKey = null;
2105
2105
  }
2106
2106
  }
2107
- function Fe(a) {
2108
- if (!a.length) return [];
2109
- const e = /* @__PURE__ */ new Map(), t = [], i = (o, s) => {
2110
- if (!s.length) return;
2107
+ function Fe(s) {
2108
+ if (!s.length) return [];
2109
+ const e = /* @__PURE__ */ new Map(), t = [], i = (o, a) => {
2110
+ if (!a.length) return;
2111
2111
  const l = t[t.length - 1];
2112
2112
  if (l && l.implicit && l.firstIndex + l.columns.length === o) {
2113
- l.columns.push(...s);
2113
+ l.columns.push(...a);
2114
2114
  return;
2115
2115
  }
2116
2116
  t.push({
2117
2117
  id: "__implicit__" + o,
2118
2118
  label: void 0,
2119
- columns: s,
2119
+ columns: a,
2120
2120
  firstIndex: o,
2121
2121
  implicit: !0
2122
2122
  });
2123
2123
  };
2124
2124
  let n = [], r = 0;
2125
- return a.forEach((o, s) => {
2125
+ return s.forEach((o, a) => {
2126
2126
  const l = o.group;
2127
2127
  if (!l) {
2128
- n.length === 0 && (r = s), n.push(o);
2128
+ n.length === 0 && (r = a), n.push(o);
2129
2129
  return;
2130
2130
  }
2131
2131
  n.length && (i(r, n.slice()), n = []);
@@ -2135,40 +2135,40 @@ function Fe(a) {
2135
2135
  id: d,
2136
2136
  label: typeof l == "string" ? void 0 : l.label,
2137
2137
  columns: [],
2138
- firstIndex: s
2138
+ firstIndex: a
2139
2139
  }, e.set(d, c), t.push(c)), c.columns.push(o);
2140
- }), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === a.length ? [] : t;
2140
+ }), n.length && i(r, n), t.length === 1 && t[0].implicit && t[0].columns.length === s.length ? [] : t;
2141
2141
  }
2142
- function Ut(a, e, t) {
2143
- if (!e.length || !a) return;
2142
+ function Ut(s, e, t) {
2143
+ if (!e.length || !s) return;
2144
2144
  const i = /* @__PURE__ */ new Map();
2145
2145
  for (const r of e)
2146
2146
  for (const o of r.columns)
2147
2147
  o.field && i.set(o.field, r.id);
2148
- const n = Array.from(a.querySelectorAll(".cell[data-field]"));
2148
+ const n = Array.from(s.querySelectorAll(".cell[data-field]"));
2149
2149
  n.forEach((r) => {
2150
- const o = r.getAttribute("data-field") || "", s = i.get(o);
2151
- s && (r.classList.add("grouped"), r.getAttribute("data-group") || r.setAttribute("data-group", s));
2150
+ const o = r.getAttribute("data-field") || "", a = i.get(o);
2151
+ a && (r.classList.add("grouped"), r.getAttribute("data-group") || r.setAttribute("data-group", a));
2152
2152
  });
2153
2153
  for (const r of e) {
2154
- const o = r.columns[r.columns.length - 1], s = n.find((l) => l.getAttribute("data-field") === o.field);
2155
- s && s.classList.add("group-end");
2154
+ const o = r.columns[r.columns.length - 1], a = n.find((l) => l.getAttribute("data-field") === o.field);
2155
+ a && a.classList.add("group-end");
2156
2156
  }
2157
2157
  }
2158
- function Yt(a, e) {
2159
- if (a.length === 0) return null;
2158
+ function Yt(s, e) {
2159
+ if (s.length === 0) return null;
2160
2160
  const t = document.createElement("div");
2161
2161
  t.className = "header-group-row", t.setAttribute("role", "row");
2162
- for (const i of a) {
2162
+ for (const i of s) {
2163
2163
  const n = i.columns[0], r = n ? e.findIndex((d) => d.field === n.field) : -1;
2164
2164
  if (r === -1) continue;
2165
- const o = String(i.id).startsWith("__implicit__"), s = o ? "" : i.label || i.id, l = document.createElement("div");
2166
- l.className = "cell header-group-cell", o && l.classList.add("implicit-group"), l.setAttribute("data-group", String(i.id)), l.style.gridColumn = `${r + 1} / span ${i.columns.length}`, l.textContent = s, t.appendChild(l);
2165
+ const o = String(i.id).startsWith("__implicit__"), a = o ? "" : i.label || i.id, l = document.createElement("div");
2166
+ l.className = "cell header-group-cell", o && l.classList.add("implicit-group"), l.setAttribute("data-group", String(i.id)), l.style.gridColumn = `${r + 1} / span ${i.columns.length}`, l.textContent = a, t.appendChild(l);
2167
2167
  }
2168
2168
  return t;
2169
2169
  }
2170
- function Xt(a) {
2171
- return a.some((e) => e.group != null);
2170
+ function Xt(s) {
2171
+ return s.some((e) => e.group != null);
2172
2172
  }
2173
2173
  const Zt = "@layer tbw-plugins{.header-group-row{display:grid;grid-auto-flow:column;background:var(--tbw-grouping-columns-header-bg, var(--tbw-color-header-bg));border-bottom:1px solid var(--tbw-grouping-columns-border, var(--tbw-color-border))}.header-group-cell{display:flex;align-items:center;justify-content:center;padding:var(--tbw-button-padding-sm, .25rem .5rem);font-weight:600;font-size:var(--tbw-font-size-sm, .9em);text-transform:uppercase;letter-spacing:.5px;border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-group-cell:last-child{border-right:none}.header-row .cell.grouped{border-top:none}.header-row .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.header-row .cell.group-end:last-child{border-right:none}.rows .cell.group-end{border-right:2px solid var(--tbw-grouping-columns-separator, var(--tbw-color-border-strong, var(--tbw-color-border)))}.rows .cell.group-end:last-child{border-right:none}.header-group-row.no-borders{border-bottom:none}.header-group-row.no-borders .header-group-cell{border-right:none}.header-row.no-group-borders .cell.group-end{border-right:1px solid var(--tbw-color-border)}}";
2174
2174
  class vn extends _ {
@@ -2196,8 +2196,9 @@ class vn extends _ {
2196
2196
  }
2197
2197
  groups = [];
2198
2198
  isActive = !1;
2199
+ #t = /* @__PURE__ */ new Set();
2199
2200
  detach() {
2200
- this.groups = [], this.isActive = !1;
2201
+ this.groups = [], this.isActive = !1, this.#t.clear();
2201
2202
  }
2202
2203
  static detect(e, t) {
2203
2204
  if (t?.columnGroups && Array.isArray(t.columnGroups) && t.columnGroups.length > 0)
@@ -2211,16 +2212,23 @@ class vn extends _ {
2211
2212
  if (t && Array.isArray(t) && t.length > 0) {
2212
2213
  const r = /* @__PURE__ */ new Map();
2213
2214
  for (const o of t)
2214
- for (const s of o.children)
2215
- r.set(s, { id: o.id, label: o.header });
2215
+ for (const a of o.children)
2216
+ r.set(a, { id: o.id, label: o.header });
2216
2217
  i = e.map((o) => {
2217
- const s = r.get(o.field);
2218
- return s && !o.group ? { ...o, group: s } : o;
2218
+ const a = r.get(o.field);
2219
+ return a && !o.group ? { ...o, group: a } : o;
2219
2220
  });
2220
2221
  } else
2221
2222
  i = [...e];
2222
2223
  const n = Fe(i);
2223
- return n.length === 0 ? (this.isActive = !1, this.groups = [], i) : (this.isActive = !0, this.groups = n, i);
2224
+ if (n.length === 0)
2225
+ return this.isActive = !1, this.groups = [], i;
2226
+ this.isActive = !0, this.groups = n, this.#t.clear();
2227
+ for (const r of n) {
2228
+ const o = r.columns[r.columns.length - 1];
2229
+ o?.field && this.#t.add(o.field);
2230
+ }
2231
+ return i;
2224
2232
  }
2225
2233
  afterRender() {
2226
2234
  if (!this.isActive) {
@@ -2237,26 +2245,14 @@ class vn extends _ {
2237
2245
  const r = Yt(n, i);
2238
2246
  if (r) {
2239
2247
  r.classList.toggle("no-borders", !this.config.showGroupBorders);
2240
- const s = e.querySelector(".header-row");
2241
- s ? e.insertBefore(r, s) : e.appendChild(r);
2248
+ const a = e.querySelector(".header-row");
2249
+ a ? e.insertBefore(r, a) : e.appendChild(r);
2242
2250
  }
2243
2251
  const o = e.querySelector(".header-row");
2244
- o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n)), this.#t(n);
2252
+ o && (o.classList.toggle("no-group-borders", !this.config.showGroupBorders), Ut(o, n));
2245
2253
  }
2246
- #t(e) {
2247
- if (!this.config.showGroupBorders) return;
2248
- const t = this.gridElement;
2249
- if (!t) return;
2250
- const i = /* @__PURE__ */ new Set();
2251
- for (const r of e) {
2252
- const o = r.columns[r.columns.length - 1];
2253
- o?.field && i.add(o.field);
2254
- }
2255
- const n = t.querySelectorAll(".rows .cell[data-field]");
2256
- for (const r of n) {
2257
- const o = r.getAttribute("data-field");
2258
- o && i.has(o) ? r.classList.add("group-end") : r.classList.remove("group-end");
2259
- }
2254
+ afterCellRender(e) {
2255
+ !this.isActive || !this.config.showGroupBorders || e.cellElement.classList.toggle("group-end", this.#t.has(e.column.field));
2260
2256
  }
2261
2257
  isGroupingActive() {
2262
2258
  return this.isActive;
@@ -2272,12 +2268,12 @@ class vn extends _ {
2272
2268
  this.requestRender();
2273
2269
  }
2274
2270
  }
2275
- function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
2271
+ function Pe({ rows: s, config: e, expanded: t, initialExpanded: i }) {
2276
2272
  const n = e.groupOn;
2277
2273
  if (typeof n != "function")
2278
2274
  return [];
2279
2275
  const r = { key: "__root__", value: null, depth: -1, rows: [], children: /* @__PURE__ */ new Map() };
2280
- if (a.forEach((d) => {
2276
+ if (s.forEach((d) => {
2281
2277
  let c = n(d);
2282
2278
  c == null || c === !1 ? c = ["__ungrouped__"] : Array.isArray(c) || (c = [c]);
2283
2279
  let u = r;
@@ -2286,54 +2282,54 @@ function Pe({ rows: a, config: e, expanded: t, initialExpanded: i }) {
2286
2282
  let w = u.children.get(g);
2287
2283
  w || (w = { key: p, value: h, depth: f, rows: [], children: /* @__PURE__ */ new Map(), parent: u }, u.children.set(g, w)), u = w;
2288
2284
  }), u.rows.push(d);
2289
- }), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === a.length)
2285
+ }), r.children.size === 1 && r.children.has("__ungrouped__") && r.children.get("__ungrouped__").rows.length === s.length)
2290
2286
  return [];
2291
- const o = /* @__PURE__ */ new Set([...t, ...i ?? []]), s = [], l = (d) => {
2287
+ const o = /* @__PURE__ */ new Set([...t, ...i ?? []]), a = [], l = (d) => {
2292
2288
  if (d === r) {
2293
2289
  d.children.forEach((u) => l(u));
2294
2290
  return;
2295
2291
  }
2296
2292
  const c = o.has(d.key);
2297
- s.push({
2293
+ a.push({
2298
2294
  kind: "group",
2299
2295
  key: d.key,
2300
2296
  value: d.value,
2301
2297
  depth: d.depth,
2302
2298
  rows: d.rows,
2303
2299
  expanded: c
2304
- }), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) => s.push({ kind: "data", row: u, rowIndex: a.indexOf(u) })));
2300
+ }), c && (d.children.size ? d.children.forEach((u) => l(u)) : d.rows.forEach((u) => a.push({ kind: "data", row: u, rowIndex: s.indexOf(u) })));
2305
2301
  };
2306
- return l(r), s;
2302
+ return l(r), a;
2307
2303
  }
2308
- function Qt(a, e) {
2309
- const t = new Set(a);
2304
+ function Qt(s, e) {
2305
+ const t = new Set(s);
2310
2306
  return t.has(e) ? t.delete(e) : t.add(e), t;
2311
2307
  }
2312
- function Jt(a) {
2308
+ function Jt(s) {
2313
2309
  const e = /* @__PURE__ */ new Set();
2314
- for (const t of a)
2310
+ for (const t of s)
2315
2311
  t.kind === "group" && e.add(t.key);
2316
2312
  return e;
2317
2313
  }
2318
2314
  function ei() {
2319
2315
  return /* @__PURE__ */ new Set();
2320
2316
  }
2321
- function ti(a, e) {
2322
- if (a === !0)
2317
+ function ti(s, e) {
2318
+ if (s === !0)
2323
2319
  return new Set(e);
2324
- if (a === !1 || a == null)
2320
+ if (s === !1 || s == null)
2325
2321
  return /* @__PURE__ */ new Set();
2326
- if (typeof a == "number") {
2327
- const t = e[a];
2322
+ if (typeof s == "number") {
2323
+ const t = e[s];
2328
2324
  return t ? /* @__PURE__ */ new Set([t]) : /* @__PURE__ */ new Set();
2329
2325
  }
2330
- return typeof a == "string" ? /* @__PURE__ */ new Set([a]) : Array.isArray(a) ? new Set(a) : /* @__PURE__ */ new Set();
2326
+ return typeof s == "string" ? /* @__PURE__ */ new Set([s]) : Array.isArray(s) ? new Set(s) : /* @__PURE__ */ new Set();
2331
2327
  }
2332
- function ii(a) {
2333
- return a.filter((e) => e.kind === "group").map((e) => e.key);
2328
+ function ii(s) {
2329
+ return s.filter((e) => e.kind === "group").map((e) => e.key);
2334
2330
  }
2335
- function ni(a) {
2336
- return a.kind !== "group" ? 0 : a.rows.length;
2331
+ function ni(s) {
2332
+ return s.kind !== "group" ? 0 : s.rows.length;
2337
2333
  }
2338
2334
  const ri = "@layer tbw-plugins{.group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-grouping-rows-bg, var(--tbw-color-panel-bg));font-weight:500;border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height)}.group-row .cell{display:flex;align-items:center;padding:var(--tbw-cell-padding, .125rem .5rem)}.group-row:hover{background:var(--tbw-grouping-rows-bg-hover, var(--tbw-color-row-hover))}.group-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toggle-size, 1.25rem);height:var(--tbw-toggle-size, 1.25rem);margin-right:.25rem;background:none;border:0;font:inherit}.group-toggle:hover{background:var(--tbw-grouping-rows-toggle-hover, var(--tbw-color-row-hover));border-radius:var(--tbw-border-radius, .125rem)}.group-label{display:inline-flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem))}.group-count{color:var(--tbw-grouping-rows-count-color, var(--tbw-color-fg-muted));font-size:var(--tbw-font-size-xs, .85em);font-weight:400}.group-aggregates{display:inline-flex;align-items:center;gap:var(--tbw-spacing-lg, 1rem);margin-left:var(--tbw-spacing-lg, 1rem);font-weight:400;font-size:var(--tbw-font-size-sm, .875em);color:var(--tbw-grouping-rows-aggregate-color, var(--tbw-color-fg-muted))}.group-aggregate{white-space:nowrap}.group-row{padding-left:calc(var(--tbw-group-depth, 0) * var(--tbw-group-indent-width, 1.25em))}.data-grid-row.tbw-group-slide-in{animation:tbw-group-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}.data-grid-row.tbw-group-fade-in{animation:tbw-group-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}@keyframes tbw-group-fade-in{0%{opacity:0}to{opacity:1}}}";
2339
2335
  class yn extends _ {
@@ -2410,8 +2406,8 @@ class yn extends _ {
2410
2406
  return this.isActive = !1, this.flattenedRows = [], [...e];
2411
2407
  let n;
2412
2408
  if (!this.hasAppliedDefaultExpanded && this.expandedKeys.size === 0 && t.defaultExpanded !== !1) {
2413
- const s = ii(i);
2414
- n = ti(t.defaultExpanded ?? !1, s), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
2409
+ const a = ii(i);
2410
+ n = ti(t.defaultExpanded ?? !1, a), n.size > 0 && (this.expandedKeys = new Set(n), this.hasAppliedDefaultExpanded = !0);
2415
2411
  }
2416
2412
  const r = Pe({
2417
2413
  rows: [...e],
@@ -2421,21 +2417,21 @@ class yn extends _ {
2421
2417
  });
2422
2418
  this.isActive = !0, this.flattenedRows = r, this.keysToAnimate.clear();
2423
2419
  const o = /* @__PURE__ */ new Set();
2424
- return r.forEach((s, l) => {
2425
- if (s.kind === "data") {
2420
+ return r.forEach((a, l) => {
2421
+ if (a.kind === "data") {
2426
2422
  const d = `data-${l}`;
2427
2423
  o.add(d), this.previousVisibleKeys.has(d) || this.keysToAnimate.add(d);
2428
2424
  }
2429
- }), this.previousVisibleKeys = o, r.map((s) => s.kind === "group" ? {
2425
+ }), this.previousVisibleKeys = o, r.map((a) => a.kind === "group" ? {
2430
2426
  __isGroupRow: !0,
2431
- __groupKey: s.key,
2432
- __groupValue: s.value,
2433
- __groupDepth: s.depth,
2434
- __groupRows: s.rows,
2435
- __groupExpanded: s.expanded,
2436
- __groupRowCount: ni(s),
2437
- __rowCacheKey: `group:${s.key}`
2438
- } : s.row);
2427
+ __groupKey: a.key,
2428
+ __groupValue: a.value,
2429
+ __groupDepth: a.depth,
2430
+ __groupRows: a.rows,
2431
+ __groupExpanded: a.expanded,
2432
+ __groupRowCount: ni(a),
2433
+ __rowCacheKey: `group:${a.key}`
2434
+ } : a.row);
2439
2435
  }
2440
2436
  onCellClick(e) {
2441
2437
  const t = e.row;
@@ -2453,7 +2449,7 @@ class yn extends _ {
2453
2449
  return !1;
2454
2450
  const n = this.config;
2455
2451
  if (n.groupRowRenderer) {
2456
- const s = () => {
2452
+ const a = () => {
2457
2453
  this.toggle(e.__groupKey);
2458
2454
  }, l = n.groupRowRenderer({
2459
2455
  key: e.__groupKey,
@@ -2461,7 +2457,7 @@ class yn extends _ {
2461
2457
  depth: e.__groupDepth,
2462
2458
  rows: e.__groupRows,
2463
2459
  expanded: e.__groupExpanded,
2464
- toggleExpand: s
2460
+ toggleExpand: a
2465
2461
  });
2466
2462
  if (l)
2467
2463
  return t.className = "data-grid-row group-row", t.__isCustomRow = !0, t.setAttribute("data-group-depth", String(e.__groupDepth)), typeof l == "string" ? t.innerHTML = l : (t.innerHTML = "", t.appendChild(l)), !0;
@@ -2494,12 +2490,12 @@ class yn extends _ {
2494
2490
  return n.formatLabel ? n.formatLabel(e, t, i) : String(e);
2495
2491
  }
2496
2492
  renderFullWidthGroupRow(e, t, i) {
2497
- const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [], s = document.createElement("div");
2498
- s.className = "cell group-full", s.style.gridColumn = "1 / -1", s.setAttribute("role", "gridcell"), s.setAttribute("data-col", "0"), s.appendChild(this.createToggleButton(e.__groupExpanded, i));
2493
+ const n = this.config, r = n.aggregators ?? {}, o = e.__groupRows ?? [], a = document.createElement("div");
2494
+ a.className = "cell group-full", a.style.gridColumn = "1 / -1", a.setAttribute("role", "gridcell"), a.setAttribute("data-col", "0"), a.appendChild(this.createToggleButton(e.__groupExpanded, i));
2499
2495
  const l = document.createElement("span");
2500
- if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), s.appendChild(l), n.showRowCount !== !1) {
2496
+ if (l.className = "group-label", l.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey), a.appendChild(l), n.showRowCount !== !1) {
2501
2497
  const c = document.createElement("span");
2502
- c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, s.appendChild(c);
2498
+ c.className = "group-count", c.textContent = `(${e.__groupRowCount ?? e.__groupRows?.length ?? 0})`, a.appendChild(c);
2503
2499
  }
2504
2500
  const d = Object.entries(r);
2505
2501
  if (d.length > 0) {
@@ -2514,12 +2510,12 @@ class yn extends _ {
2514
2510
  p.textContent = `${w}: ${g}`, c.appendChild(p);
2515
2511
  }
2516
2512
  }
2517
- c.children.length > 0 && s.appendChild(c);
2513
+ c.children.length > 0 && a.appendChild(c);
2518
2514
  }
2519
- t.appendChild(s);
2515
+ t.appendChild(a);
2520
2516
  }
2521
2517
  renderPerColumnGroupRow(e, t, i) {
2522
- const n = this.config, r = n.aggregators ?? {}, o = this.columns, s = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
2518
+ const n = this.config, r = n.aggregators ?? {}, o = this.columns, a = e.__groupRows ?? [], d = this.gridElement?.querySelector(".body")?.style.gridTemplateColumns || "";
2523
2519
  d && (t.style.display = "grid", t.style.gridTemplateColumns = d);
2524
2520
  let c = !1;
2525
2521
  o.forEach((u, h) => {
@@ -2531,7 +2527,7 @@ class yn extends _ {
2531
2527
  if (c) {
2532
2528
  const g = r[u.field];
2533
2529
  if (g) {
2534
- const p = te(g, s, u.field, u);
2530
+ const p = te(g, a, u.field, u);
2535
2531
  f.textContent = p != null ? String(p) : "";
2536
2532
  } else
2537
2533
  f.textContent = "";
@@ -2539,13 +2535,13 @@ class yn extends _ {
2539
2535
  c = !0, f.appendChild(this.createToggleButton(e.__groupExpanded, i));
2540
2536
  const g = document.createElement("span"), p = r[u.field];
2541
2537
  if (p) {
2542
- const w = te(p, s, u.field, u);
2538
+ const w = te(p, a, u.field, u);
2543
2539
  g.textContent = w != null ? String(w) : String(e.__groupValue);
2544
2540
  } else
2545
2541
  g.textContent = this.getGroupLabelText(e.__groupValue, e.__groupDepth || 0, e.__groupKey);
2546
2542
  if (f.appendChild(g), n.showRowCount !== !1) {
2547
2543
  const w = document.createElement("span");
2548
- w.className = "group-count", w.textContent = ` (${s.length})`, f.appendChild(w);
2544
+ w.className = "group-count", w.textContent = ` (${a.length})`, f.appendChild(w);
2549
2545
  }
2550
2546
  }
2551
2547
  t.appendChild(f);
@@ -2565,8 +2561,8 @@ class yn extends _ {
2565
2561
  if (e.startsWith(o + "||") || o.startsWith(e + "||"))
2566
2562
  e.startsWith(o + "||") && r.add(o);
2567
2563
  else {
2568
- const s = this.flattenedRows.find((l) => l.kind === "group" && l.key === o);
2569
- s && s.depth !== n.depth && r.add(o);
2564
+ const a = this.flattenedRows.find((l) => l.kind === "group" && l.key === o);
2565
+ a && a.depth !== n.depth && r.add(o);
2570
2566
  }
2571
2567
  r.add(e), this.expandedKeys = r;
2572
2568
  } else
@@ -2620,27 +2616,27 @@ class yn extends _ {
2620
2616
  this.config.groupOn = e, this.requestRender();
2621
2617
  }
2622
2618
  }
2623
- function De(a, e) {
2624
- const t = new Set(a);
2619
+ function De(s, e) {
2620
+ const t = new Set(s);
2625
2621
  return t.has(e) ? t.delete(e) : t.add(e), t;
2626
2622
  }
2627
- function oi(a, e) {
2628
- const t = new Set(a);
2623
+ function oi(s, e) {
2624
+ const t = new Set(s);
2629
2625
  return t.add(e), t;
2630
2626
  }
2631
- function si(a, e) {
2632
- const t = new Set(a);
2627
+ function si(s, e) {
2628
+ const t = new Set(s);
2633
2629
  return t.delete(e), t;
2634
2630
  }
2635
- function ai(a, e) {
2636
- return a.has(e);
2631
+ function ai(s, e) {
2632
+ return s.has(e);
2637
2633
  }
2638
- function li(a, e, t, i) {
2634
+ function li(s, e, t, i) {
2639
2635
  const n = document.createElement("div");
2640
2636
  n.className = "master-detail-row", n.setAttribute("data-detail-for", String(e)), n.setAttribute("role", "row");
2641
2637
  const r = document.createElement("div");
2642
2638
  r.className = "master-detail-cell", r.setAttribute("role", "cell"), r.style.gridColumn = `1 / ${i + 1}`;
2643
- const o = t(a, e);
2639
+ const o = t(s, e);
2644
2640
  return typeof o == "string" ? r.innerHTML = o : o instanceof HTMLElement && r.appendChild(o), n.appendChild(r), n;
2645
2641
  }
2646
2642
  const di = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-right:none!important;padding:0;display:flex;align-items:center;justify-content:center}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.master-detail-expander{display:flex;align-items:center;justify-content:center;width:100%;height:100%}.master-detail-toggle{cursor:pointer;opacity:.7;user-select:none;display:inline-flex;align-items:center;justify-content:center}.master-detail-toggle:hover{opacity:1}.master-detail-row{grid-column:1 / -1;display:grid;background:var(--tbw-master-detail-bg, var(--tbw-color-row-alt));border-bottom:1px solid var(--tbw-master-detail-border, var(--tbw-color-border));overflow:hidden}.master-detail-cell{padding:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));overflow:auto}.master-detail-row.tbw-expanding{animation:tbw-detail-expand var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.master-detail-row.tbw-collapsing{animation:tbw-detail-collapse var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-detail-expand{0%{opacity:0;max-height:0;padding-top:0;padding-bottom:0}to{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem);padding-top:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem));padding-bottom:var(--tbw-detail-padding, var(--tbw-spacing-xl, 1rem))}}@keyframes tbw-detail-collapse{0%{opacity:1;max-height:var(--tbw-detail-max-height, 31.25rem)}to{opacity:0;max-height:0}}}";
@@ -2671,8 +2667,8 @@ class nt extends _ {
2671
2667
  return;
2672
2668
  }
2673
2669
  }
2674
- const n = t.getAttribute("animation"), r = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"), s = t.getAttribute("collapse-on-click-outside"), l = t.getAttribute("height"), d = {};
2675
- n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), s !== null && (d.collapseOnClickOutside = s === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
2670
+ const n = t.getAttribute("animation"), r = t.getAttribute("show-expand-column"), o = t.getAttribute("expand-on-row-click"), a = t.getAttribute("collapse-on-click-outside"), l = t.getAttribute("height"), d = {};
2671
+ n !== null && (d.animation = n === "false" ? !1 : n), r !== null && (d.showExpandColumn = r !== "false"), o !== null && (d.expandOnRowClick = o === "true"), a !== null && (d.collapseOnClickOutside = a === "true"), l !== null && (d.detailHeight = l === "auto" ? "auto" : parseInt(l, 10));
2676
2672
  const c = t.innerHTML.trim();
2677
2673
  c && !this.config.detailRenderer && (d.detailRenderer = (u, h) => {
2678
2674
  const f = Je(c, { value: u, row: u });
@@ -2682,14 +2678,14 @@ class nt extends _ {
2682
2678
  get animationStyle() {
2683
2679
  return this.isAnimationEnabled ? this.config.animation ?? "slide" : !1;
2684
2680
  }
2685
- animateExpand(e) {
2686
- !this.isAnimationEnabled || this.animationStyle === !1 || (e.classList.add("tbw-expanding"), e.addEventListener(
2687
- "animationend",
2688
- () => {
2689
- e.classList.remove("tbw-expanding");
2690
- },
2691
- { once: !0 }
2692
- ));
2681
+ animateExpand(e, t, i) {
2682
+ if (!this.isAnimationEnabled || this.animationStyle === !1) return !1;
2683
+ e.classList.add("tbw-expanding");
2684
+ let n = !1;
2685
+ const r = () => {
2686
+ n || (n = !0, e.classList.remove("tbw-expanding"), t !== void 0 && i !== void 0 && this.#t(e, t, i));
2687
+ };
2688
+ return e.addEventListener("animationend", r, { once: !0 }), setTimeout(r, this.animationDuration + 50), !0;
2693
2689
  }
2694
2690
  animateCollapse(e, t) {
2695
2691
  if (!this.isAnimationEnabled || this.animationStyle === !1) {
@@ -2702,29 +2698,40 @@ class nt extends _ {
2702
2698
  };
2703
2699
  e.addEventListener("animationend", i, { once: !0 }), setTimeout(i, this.animationDuration + 50);
2704
2700
  }
2701
+ #t(e, t, i) {
2702
+ if (!e.isConnected) return;
2703
+ const n = e.offsetHeight;
2704
+ if (n > 0) {
2705
+ const r = this.measuredDetailHeights.get(t);
2706
+ this.measuredDetailHeights.set(t, n), r !== n && this.grid.invalidateRowHeight(i);
2707
+ }
2708
+ }
2705
2709
  expandedRows = /* @__PURE__ */ new Set();
2706
2710
  detailElements = /* @__PURE__ */ new Map();
2707
2711
  measuredDetailHeights = /* @__PURE__ */ new Map();
2712
+ rowsToAnimate = /* @__PURE__ */ new Set();
2708
2713
  static DEFAULT_DETAIL_HEIGHT = 150;
2709
2714
  getDetailHeight(e) {
2710
2715
  const t = this.detailElements.get(e);
2711
- if (t) {
2712
- const n = t.offsetHeight;
2713
- if (n > 0)
2714
- return this.measuredDetailHeights.set(e, n), n;
2716
+ if (t && !(t.classList.contains("tbw-expanding") || t.classList.contains("tbw-collapsing"))) {
2717
+ const r = t.offsetHeight;
2718
+ if (r > 0)
2719
+ return this.measuredDetailHeights.set(e, r), r;
2715
2720
  }
2716
2721
  const i = this.measuredDetailHeights.get(e);
2717
2722
  return i && i > 0 ? i : typeof this.config?.detailHeight == "number" ? this.config.detailHeight : nt.DEFAULT_DETAIL_HEIGHT;
2718
2723
  }
2719
2724
  toggleAndEmit(e, t) {
2720
- this.expandedRows = De(this.expandedRows, e), this.emit("detail-expand", {
2725
+ this.expandedRows = De(this.expandedRows, e);
2726
+ const i = this.expandedRows.has(e);
2727
+ i && this.rowsToAnimate.add(e), this.emit("detail-expand", {
2721
2728
  rowIndex: t,
2722
2729
  row: e,
2723
- expanded: this.expandedRows.has(e)
2730
+ expanded: i
2724
2731
  }), this.requestRender();
2725
2732
  }
2726
2733
  detach() {
2727
- this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear();
2734
+ this.expandedRows.clear(), this.detailElements.clear(), this.measuredDetailHeights.clear(), this.rowsToAnimate.clear();
2728
2735
  }
2729
2736
  processColumns(e) {
2730
2737
  if (!(this.config.showExpandColumn === !0 || this.config.showExpandColumn !== !1 && !!this.config.detailRenderer))
@@ -2734,7 +2741,7 @@ class nt extends _ {
2734
2741
  return i;
2735
2742
  const r = yt(this.name);
2736
2743
  return r.viewRenderer = (o) => {
2737
- const { row: s } = o, l = this.expandedRows.has(s), d = document.createElement("span");
2744
+ const { row: a } = o, l = this.expandedRows.has(a), d = document.createElement("span");
2738
2745
  d.className = "master-detail-expander expander-cell";
2739
2746
  const c = document.createElement("span");
2740
2747
  return c.className = `master-detail-toggle${l ? " expanded" : ""}`, this.setIcon(c, this.resolveIcon(l ? "collapse" : "expand")), c.setAttribute("role", "button"), c.setAttribute("tabindex", "0"), c.setAttribute("aria-expanded", String(l)), c.setAttribute("aria-label", l ? "Collapse details" : "Expand details"), d.appendChild(c), d;
@@ -2747,7 +2754,7 @@ class nt extends _ {
2747
2754
  onCellClick(e) {
2748
2755
  if (e.originalEvent?.target?.classList.contains("master-detail-toggle"))
2749
2756
  return this.toggleAndEmit(e.row, e.rowIndex), !0;
2750
- this.expandedRows.size > 0 && queueMicrotask(() => this.#t());
2757
+ this.expandedRows.size > 0 && queueMicrotask(() => this.#e());
2751
2758
  }
2752
2759
  onKeyDown(e) {
2753
2760
  if (e.key !== " ") return;
@@ -2758,43 +2765,47 @@ class nt extends _ {
2758
2765
  return e.preventDefault(), this.toggleAndEmit(r, i), this.requestRenderWithFocus(), !0;
2759
2766
  }
2760
2767
  afterRender() {
2761
- this.#t();
2768
+ this.#e();
2762
2769
  }
2763
2770
  onScrollRender() {
2764
- !this.config.detailRenderer || this.expandedRows.size === 0 || this.#t();
2771
+ !this.config.detailRenderer || this.expandedRows.size === 0 || this.#e();
2765
2772
  }
2766
- #t() {
2773
+ #e() {
2767
2774
  if (!this.config.detailRenderer) return;
2768
2775
  const e = this.gridElement?.querySelector(".rows");
2769
2776
  if (!e) return;
2770
- const t = /* @__PURE__ */ new Map(), i = e.querySelectorAll(".data-grid-row"), n = this.columns.length;
2771
- for (const o of i) {
2772
- const s = o.querySelector(".cell[data-row]"), l = s ? parseInt(s.getAttribute("data-row") ?? "-1", 10) : -1;
2773
- l >= 0 && t.set(l, o);
2774
- }
2775
- const r = e.querySelectorAll(".master-detail-row");
2776
- for (const o of r) {
2777
- const s = parseInt(o.getAttribute("data-detail-for") ?? "-1", 10), l = s >= 0 ? this.rows[s] : void 0, d = l && this.expandedRows.has(l), c = t.has(s);
2778
- (!d || !c) && (o.remove(), l && this.detailElements.delete(l));
2779
- }
2780
- for (const [o, s] of t) {
2781
- const l = this.rows[o];
2782
- if (!l || !this.expandedRows.has(l)) continue;
2783
- const d = this.detailElements.get(l);
2784
- if (d) {
2785
- d.previousElementSibling !== s && s.after(d);
2777
+ const t = this.grid, i = t._rowPool, n = t._virtualization?.start ?? 0, r = t._virtualization?.end ?? 0, o = this.columns.length, a = n, l = r, d = /* @__PURE__ */ new Map();
2778
+ if (i) {
2779
+ const c = Math.min(i.length, l - a);
2780
+ for (let u = 0; u < c; u++) {
2781
+ const h = i[u];
2782
+ h.parentNode === e && d.set(a + u, h);
2783
+ }
2784
+ } else {
2785
+ const c = e.querySelectorAll(".data-grid-row");
2786
+ for (const u of c) {
2787
+ const h = u.querySelector(".cell[data-row]"), f = h ? parseInt(h.getAttribute("data-row") ?? "-1", 10) : -1;
2788
+ f >= 0 && d.set(f, u);
2789
+ }
2790
+ }
2791
+ for (const [c, u] of this.detailElements) {
2792
+ const h = this.rows.indexOf(c), f = this.expandedRows.has(c), g = h >= 0 && d.has(h);
2793
+ (!f || !g) && (u.parentNode && u.remove(), this.detailElements.delete(c));
2794
+ }
2795
+ for (const [c, u] of d) {
2796
+ const h = this.rows[c];
2797
+ if (!h || !this.expandedRows.has(h)) continue;
2798
+ const f = this.detailElements.get(h);
2799
+ if (f) {
2800
+ f.previousElementSibling !== u && u.after(f);
2786
2801
  continue;
2787
2802
  }
2788
- const c = li(l, o, this.config.detailRenderer, n);
2789
- typeof this.config.detailHeight == "number" && (c.style.height = `${this.config.detailHeight}px`), s.after(c), this.detailElements.set(l, c), requestAnimationFrame(() => {
2790
- if (c.isConnected) {
2791
- const u = c.offsetHeight;
2792
- if (u > 0) {
2793
- const h = this.measuredDetailHeights.get(l);
2794
- this.measuredDetailHeights.set(l, u), h !== u && this.grid.invalidateRowHeight(o);
2795
- }
2796
- }
2797
- }), this.animateExpand(c);
2803
+ const g = li(h, c, this.config.detailRenderer, o);
2804
+ typeof this.config.detailHeight == "number" && (g.style.height = `${this.config.detailHeight}px`), u.after(g), this.detailElements.set(h, g);
2805
+ const p = this.rowsToAnimate.has(h);
2806
+ p && this.rowsToAnimate.delete(h), p && this.animateExpand(g, h, c) || requestAnimationFrame(() => {
2807
+ this.#t(g, h, c);
2808
+ });
2798
2809
  }
2799
2810
  }
2800
2811
  getExtraHeight() {
@@ -2819,22 +2830,32 @@ class nt extends _ {
2819
2830
  }
2820
2831
  adjustVirtualStart(e, t, i) {
2821
2832
  if (this.expandedRows.size === 0) return e;
2822
- const n = [];
2823
- for (const s of this.expandedRows) {
2824
- const l = this.rows.indexOf(s);
2825
- l >= 0 && n.push({ index: l, row: s });
2826
- }
2827
- n.sort((s, l) => s.index - l.index);
2828
- let r = e, o = 0;
2829
- for (const { index: s, row: l } of n) {
2830
- const d = s * i + o, c = this.getDetailHeight(l), u = d + i + c;
2831
- o += c, !(s >= e) && u > t && s < r && (r = s);
2833
+ const n = this.grid?._virtualization?.positionCache;
2834
+ let r = e;
2835
+ if (n && n.length > 0)
2836
+ for (const o of this.expandedRows) {
2837
+ const a = this.rows.indexOf(o);
2838
+ if (a < 0 || a >= e) continue;
2839
+ n[a].offset + n[a].height > t && a < r && (r = a);
2840
+ }
2841
+ else {
2842
+ const o = [];
2843
+ for (const l of this.expandedRows) {
2844
+ const d = this.rows.indexOf(l);
2845
+ d >= 0 && o.push({ index: d, row: l });
2846
+ }
2847
+ o.sort((l, d) => l.index - d.index);
2848
+ let a = 0;
2849
+ for (const { index: l, row: d } of o) {
2850
+ const c = l * i + a, u = this.getDetailHeight(d), h = c + i + u;
2851
+ a += u, !(l >= e) && h > t && l < r && (r = l);
2852
+ }
2832
2853
  }
2833
2854
  return r;
2834
2855
  }
2835
2856
  expand(e) {
2836
2857
  const t = this.rows[e];
2837
- t && (this.expandedRows = oi(this.expandedRows, t), this.requestRender());
2858
+ t && (this.rowsToAnimate.add(t), this.expandedRows = oi(this.expandedRows, t), this.requestRender());
2838
2859
  }
2839
2860
  collapse(e) {
2840
2861
  const t = this.rows[e];
@@ -2842,7 +2863,7 @@ class nt extends _ {
2842
2863
  }
2843
2864
  toggle(e) {
2844
2865
  const t = this.rows[e];
2845
- t && (this.expandedRows = De(this.expandedRows, t), this.requestRender());
2866
+ t && (this.expandedRows = De(this.expandedRows, t), this.expandedRows.has(t) && this.rowsToAnimate.add(t), this.requestRender());
2846
2867
  }
2847
2868
  isExpanded(e) {
2848
2869
  const t = this.rows[e];
@@ -2850,7 +2871,7 @@ class nt extends _ {
2850
2871
  }
2851
2872
  expandAll() {
2852
2873
  for (const e of this.rows)
2853
- this.expandedRows.add(e);
2874
+ this.rowsToAnimate.add(e), this.expandedRows.add(e);
2854
2875
  this.requestRender();
2855
2876
  }
2856
2877
  collapseAll() {
@@ -2876,29 +2897,29 @@ class nt extends _ {
2876
2897
  }
2877
2898
  }
2878
2899
  }
2879
- function ci(a, e, t) {
2880
- return e.length ? [...a].sort((i, n) => {
2900
+ function ci(s, e, t) {
2901
+ return e.length ? [...s].sort((i, n) => {
2881
2902
  for (const r of e) {
2882
- const s = t.find((u) => u.field === r.field)?.sortComparator ?? ui, l = i[r.field], d = n[r.field], c = s(l, d, i, n);
2903
+ const a = t.find((u) => u.field === r.field)?.sortComparator ?? ui, l = i[r.field], d = n[r.field], c = a(l, d, i, n);
2883
2904
  if (c !== 0)
2884
2905
  return r.direction === "asc" ? c : -c;
2885
2906
  }
2886
2907
  return 0;
2887
- }) : [...a];
2908
+ }) : [...s];
2888
2909
  }
2889
- function ui(a, e) {
2890
- return a == null && e == null ? 0 : a == null ? 1 : e == null ? -1 : typeof a == "number" && typeof e == "number" ? a - e : a instanceof Date && e instanceof Date ? a.getTime() - e.getTime() : typeof a == "boolean" && typeof e == "boolean" ? a === e ? 0 : a ? -1 : 1 : String(a).localeCompare(String(e));
2910
+ function ui(s, e) {
2911
+ return s == null && e == null ? 0 : s == null ? 1 : e == null ? -1 : typeof s == "number" && typeof e == "number" ? s - e : s instanceof Date && e instanceof Date ? s.getTime() - e.getTime() : typeof s == "boolean" && typeof e == "boolean" ? s === e ? 0 : s ? -1 : 1 : String(s).localeCompare(String(e));
2891
2912
  }
2892
- function hi(a, e, t, i) {
2893
- const n = a.find((r) => r.field === e);
2894
- return t ? n ? n.direction === "asc" ? a.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : a.filter((r) => r.field !== e) : a.length < i ? [...a, { field: e, direction: "asc" }] : a : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2913
+ function hi(s, e, t, i) {
2914
+ const n = s.find((r) => r.field === e);
2915
+ return t ? n ? n.direction === "asc" ? s.map((r) => r.field === e ? { ...r, direction: "desc" } : r) : s.filter((r) => r.field !== e) : s.length < i ? [...s, { field: e, direction: "asc" }] : s : n?.direction === "asc" ? [{ field: e, direction: "desc" }] : n?.direction === "desc" ? [] : [{ field: e, direction: "asc" }];
2895
2916
  }
2896
- function Me(a, e) {
2897
- const t = a.findIndex((i) => i.field === e);
2917
+ function Me(s, e) {
2918
+ const t = s.findIndex((i) => i.field === e);
2898
2919
  return t >= 0 ? t + 1 : void 0;
2899
2920
  }
2900
- function Ne(a, e) {
2901
- return a.find((t) => t.field === e)?.direction;
2921
+ function Ne(s, e) {
2922
+ return s.find((t) => t.field === e)?.direction;
2902
2923
  }
2903
2924
  const fi = '@layer tbw-plugins{.header-cell[data-sort=asc]:after{content:"↑";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.header-cell[data-sort=desc]:after{content:"↓";margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-indicator{margin-left:var(--tbw-spacing-xs, .25em);opacity:.8}.sort-index{font-size:var(--tbw-font-size-2xs, .7em);background:var(--tbw-multi-sort-badge-bg, var(--tbw-color-panel-bg));color:var(--tbw-multi-sort-badge-color, var(--tbw-color-fg));border-radius:50%;width:var(--tbw-multi-sort-badge-size, 1em);height:var(--tbw-multi-sort-badge-size, 1em);display:inline-flex;align-items:center;justify-content:center;margin-left:var(--tbw-spacing-xs, .125em);font-weight:600}}';
2904
2925
  class xn extends _ {
@@ -2929,11 +2950,11 @@ class xn extends _ {
2929
2950
  e.querySelectorAll(".header-row .cell[data-field]").forEach((n) => {
2930
2951
  const r = n.getAttribute("data-field");
2931
2952
  if (!r) return;
2932
- const o = Me(this.sortModel, r), s = Ne(this.sortModel, r);
2933
- if (n.querySelector(".sort-index")?.remove(), s) {
2934
- n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", s);
2953
+ const o = Me(this.sortModel, r), a = Ne(this.sortModel, r);
2954
+ if (n.querySelector(".sort-index")?.remove(), a) {
2955
+ n.querySelector('[part~="sort-indicator"], .sort-indicator')?.remove(), n.setAttribute("data-sort", a);
2935
2956
  const c = document.createElement("span");
2936
- c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(s === "asc" ? "sortAsc" : "sortDesc"));
2957
+ c.className = "sort-indicator", this.setIcon(c, this.resolveIcon(a === "asc" ? "sortAsc" : "sortDesc"));
2937
2958
  const u = n.querySelector(".tbw-filter-btn"), h = n.querySelector(".resize-handle"), f = u ?? h;
2938
2959
  if (f ? n.insertBefore(c, f) : n.appendChild(c), t && this.sortModel.length > 1 && o !== void 0) {
2939
2960
  const g = document.createElement("span");
@@ -2979,54 +3000,54 @@ class xn extends _ {
2979
3000
  i !== -1 ? this.sortModel[i] = n : this.sortModel.splice(t.sort.priority, 0, n);
2980
3001
  }
2981
3002
  }
2982
- function rt(a, e) {
2983
- return pt(a, e);
3003
+ function rt(s, e) {
3004
+ return pt(s, e);
2984
3005
  }
2985
- function ot(a, e) {
2986
- const t = a.sticky;
3006
+ function ot(s, e) {
3007
+ const t = s.sticky;
2987
3008
  return t ? rt(t, e) === "left" : !1;
2988
3009
  }
2989
- function st(a, e) {
2990
- const t = a.sticky;
3010
+ function st(s, e) {
3011
+ const t = s.sticky;
2991
3012
  return t ? rt(t, e) === "right" : !1;
2992
3013
  }
2993
- function gi(a, e = "ltr") {
2994
- return a.filter((t) => ot(t, e));
3014
+ function gi(s, e = "ltr") {
3015
+ return s.filter((t) => ot(t, e));
2995
3016
  }
2996
- function pi(a, e = "ltr") {
2997
- return a.filter((t) => st(t, e));
3017
+ function pi(s, e = "ltr") {
3018
+ return s.filter((t) => st(t, e));
2998
3019
  }
2999
- function se(a) {
3000
- return a.some(
3020
+ function se(s) {
3021
+ return s.some(
3001
3022
  (e) => e.sticky === "left" || e.sticky === "right" || e.sticky === "start" || e.sticky === "end"
3002
3023
  );
3003
3024
  }
3004
- function qe(a, e) {
3005
- const t = Array.from(a.querySelectorAll(".header-row .cell"));
3025
+ function qe(s, e) {
3026
+ const t = Array.from(s.querySelectorAll(".header-row .cell"));
3006
3027
  if (!t.length) return;
3007
- const i = ue(a), n = /* @__PURE__ */ new Map();
3008
- e.forEach((s, l) => {
3009
- s.field && n.set(s.field, l);
3028
+ const i = ue(s), n = /* @__PURE__ */ new Map();
3029
+ e.forEach((a, l) => {
3030
+ a.field && n.set(a.field, l);
3010
3031
  });
3011
3032
  let r = 0;
3012
- for (const s of e)
3013
- if (ot(s, i)) {
3014
- const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
3015
- d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3033
+ for (const a of e)
3034
+ if (ot(a, i)) {
3035
+ const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
3036
+ d && (d.classList.add("sticky-left"), d.style.position = "sticky", d.style.left = r + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3016
3037
  c.classList.add("sticky-left"), c.style.position = "sticky", c.style.left = r + "px";
3017
3038
  }), r += d.offsetWidth);
3018
3039
  }
3019
3040
  let o = 0;
3020
- for (const s of [...e].reverse())
3021
- if (st(s, i)) {
3022
- const l = n.get(s.field), d = t.find((c) => c.getAttribute("data-field") === s.field);
3023
- d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && a.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3041
+ for (const a of [...e].reverse())
3042
+ if (st(a, i)) {
3043
+ const l = n.get(a.field), d = t.find((c) => c.getAttribute("data-field") === a.field);
3044
+ d && (d.classList.add("sticky-right"), d.style.position = "sticky", d.style.right = o + "px", l !== void 0 && s.querySelectorAll(`.data-grid-row .cell[data-col="${l}"]`).forEach((c) => {
3024
3045
  c.classList.add("sticky-right"), c.style.position = "sticky", c.style.right = o + "px";
3025
3046
  }), o += d.offsetWidth);
3026
3047
  }
3027
3048
  }
3028
- function He(a) {
3029
- a.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
3049
+ function He(s) {
3050
+ s.querySelectorAll(".sticky-left, .sticky-right").forEach((t) => {
3030
3051
  t.classList.remove("sticky-left", "sticky-right"), t.style.position = "", t.style.left = "", t.style.right = "";
3031
3052
  });
3032
3053
  }
@@ -3119,10 +3140,10 @@ class Cn extends _ {
3119
3140
  return;
3120
3141
  let i = 0, n = 0;
3121
3142
  if (e) {
3122
- const o = e.querySelectorAll(".sticky-left"), s = e.querySelectorAll(".sticky-right");
3143
+ const o = e.querySelectorAll(".sticky-left"), a = e.querySelectorAll(".sticky-right");
3123
3144
  o.forEach((l) => {
3124
3145
  i += l.offsetWidth;
3125
- }), s.forEach((l) => {
3146
+ }), a.forEach((l) => {
3126
3147
  n += l.offsetWidth;
3127
3148
  });
3128
3149
  } else
@@ -3133,10 +3154,10 @@ class Cn extends _ {
3133
3154
  return { left: i, right: n, skipScroll: r };
3134
3155
  }
3135
3156
  }
3136
- function mi(a) {
3137
- return typeof a == "object" && a !== null && "aggFunc" in a;
3157
+ function mi(s) {
3158
+ return typeof s == "object" && s !== null && "aggFunc" in s;
3138
3159
  }
3139
- function ae(a, e) {
3160
+ function ae(s, e) {
3140
3161
  const t = document.createElement("div");
3141
3162
  t.className = "tbw-pinned-rows", t.setAttribute("role", "presentation"), t.setAttribute("aria-live", "polite");
3142
3163
  const i = document.createElement("div");
@@ -3144,41 +3165,41 @@ function ae(a, e) {
3144
3165
  const n = document.createElement("div");
3145
3166
  n.className = "tbw-pinned-rows-center";
3146
3167
  const r = document.createElement("div");
3147
- if (r.className = "tbw-pinned-rows-right", a.showRowCount !== !1) {
3168
+ if (r.className = "tbw-pinned-rows-right", s.showRowCount !== !1) {
3148
3169
  const o = document.createElement("span");
3149
3170
  o.className = "tbw-status-panel tbw-status-panel-row-count", o.textContent = `Total: ${e.totalRows} rows`, i.appendChild(o);
3150
3171
  }
3151
- if (a.showFilteredCount && e.filteredRows !== e.totalRows) {
3172
+ if (s.showFilteredCount && e.filteredRows !== e.totalRows) {
3152
3173
  const o = document.createElement("span");
3153
3174
  o.className = "tbw-status-panel tbw-status-panel-filtered-count", o.textContent = `Filtered: ${e.filteredRows}`, i.appendChild(o);
3154
3175
  }
3155
- if (a.showSelectedCount && e.selectedRows > 0) {
3176
+ if (s.showSelectedCount && e.selectedRows > 0) {
3156
3177
  const o = document.createElement("span");
3157
3178
  o.className = "tbw-status-panel tbw-status-panel-selected-count", o.textContent = `Selected: ${e.selectedRows}`, r.appendChild(o);
3158
3179
  }
3159
- if (a.customPanels)
3160
- for (const o of a.customPanels) {
3161
- const s = wi(o, e);
3180
+ if (s.customPanels)
3181
+ for (const o of s.customPanels) {
3182
+ const a = wi(o, e);
3162
3183
  switch (o.position) {
3163
3184
  case "left":
3164
- i.appendChild(s);
3185
+ i.appendChild(a);
3165
3186
  break;
3166
3187
  case "center":
3167
- n.appendChild(s);
3188
+ n.appendChild(a);
3168
3189
  break;
3169
3190
  case "right":
3170
- r.appendChild(s);
3191
+ r.appendChild(a);
3171
3192
  break;
3172
3193
  }
3173
3194
  }
3174
3195
  return t.appendChild(i), t.appendChild(n), t.appendChild(r), t;
3175
3196
  }
3176
- function ze(a) {
3197
+ function ze(s) {
3177
3198
  const e = document.createElement("div");
3178
- return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${a}`, e.setAttribute("role", "presentation"), e;
3199
+ return e.className = `tbw-aggregation-rows tbw-aggregation-rows-${s}`, e.setAttribute("role", "presentation"), e;
3179
3200
  }
3180
- function Oe(a, e, t, i) {
3181
- a.innerHTML = "";
3201
+ function Oe(s, e, t, i) {
3202
+ s.innerHTML = "";
3182
3203
  for (const n of e) {
3183
3204
  const r = document.createElement("div");
3184
3205
  if (r.className = "tbw-aggregation-row", r.setAttribute("role", "presentation"), n.id && r.setAttribute("data-aggregation-id", n.id), n.fullWidth) {
@@ -3186,8 +3207,8 @@ function Oe(a, e, t, i) {
3186
3207
  o.className = "tbw-aggregation-cell tbw-aggregation-cell-full", o.style.gridColumn = "1 / -1", o.textContent = n.label || "", r.appendChild(o);
3187
3208
  } else
3188
3209
  for (const o of t) {
3189
- const s = document.createElement("div");
3190
- s.className = "tbw-aggregation-cell", s.setAttribute("data-field", o.field);
3210
+ const a = document.createElement("div");
3211
+ a.className = "tbw-aggregation-cell", a.setAttribute("data-field", o.field);
3191
3212
  let l, d;
3192
3213
  const c = n.aggregators?.[o.field];
3193
3214
  if (c)
@@ -3202,24 +3223,24 @@ function Oe(a, e, t, i) {
3202
3223
  const u = n.cells[o.field];
3203
3224
  typeof u == "function" ? l = u(i, o.field, o) : l = u;
3204
3225
  }
3205
- l != null ? s.textContent = d ? d(l, o.field, o) : String(l) : s.textContent = "", r.appendChild(s);
3226
+ l != null ? a.textContent = d ? d(l, o.field, o) : String(l) : a.textContent = "", r.appendChild(a);
3206
3227
  }
3207
- a.appendChild(r);
3228
+ s.appendChild(r);
3208
3229
  }
3209
3230
  }
3210
- function wi(a, e) {
3231
+ function wi(s, e) {
3211
3232
  const t = document.createElement("div");
3212
- t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${a.id}`;
3213
- const i = a.render(e);
3233
+ t.className = "tbw-status-panel tbw-status-panel-custom", t.id = `status-panel-${s.id}`;
3234
+ const i = s.render(e);
3214
3235
  return typeof i == "string" ? t.innerHTML = i : t.appendChild(i), t;
3215
3236
  }
3216
- function Ge(a, e, t, i, n) {
3237
+ function Ge(s, e, t, i, n) {
3217
3238
  return {
3218
- totalRows: a.length,
3219
- filteredRows: n?.cachedResult?.length ?? a.length,
3239
+ totalRows: s.length,
3240
+ filteredRows: n?.cachedResult?.length ?? s.length,
3220
3241
  selectedRows: i?.selected?.size ?? 0,
3221
3242
  columns: e,
3222
- rows: a,
3243
+ rows: s,
3223
3244
  grid: t
3224
3245
  };
3225
3246
  }
@@ -3254,8 +3275,8 @@ class En extends _ {
3254
3275
  this.grid,
3255
3276
  i,
3256
3277
  n
3257
- ), o = this.config.aggregationRows || [], s = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
3258
- if (s.length > 0) {
3278
+ ), o = this.config.aggregationRows || [], a = o.filter((h) => h.position === "top"), l = o.filter((h) => h.position !== "top");
3279
+ if (a.length > 0) {
3259
3280
  if (!this.topAggregationContainer) {
3260
3281
  this.topAggregationContainer = ze("top");
3261
3282
  const h = e.querySelector(".header");
@@ -3263,7 +3284,7 @@ class En extends _ {
3263
3284
  }
3264
3285
  Oe(
3265
3286
  this.topAggregationContainer,
3266
- s,
3287
+ a,
3267
3288
  this.visibleColumns,
3268
3289
  this.sourceRows
3269
3290
  );
@@ -3331,62 +3352,62 @@ class En extends _ {
3331
3352
  }
3332
3353
  }
3333
3354
  const vi = mt;
3334
- function yi(a) {
3355
+ function yi(s) {
3335
3356
  const e = [];
3336
- return !a.rowGroupFields?.length && !a.columnGroupFields?.length && e.push("At least one row or column group field is required"), a.valueFields?.length || e.push("At least one value field is required"), e;
3357
+ return !s.rowGroupFields?.length && !s.columnGroupFields?.length && e.push("At least one row or column group field is required"), s.valueFields?.length || e.push("At least one value field is required"), e;
3337
3358
  }
3338
- function be(a, e) {
3339
- return [...a, e].join("|");
3359
+ function be(s, e) {
3360
+ return [...s, e].join("|");
3340
3361
  }
3341
- function xi(a, e) {
3342
- const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(a, i), o = at(
3343
- a,
3362
+ function xi(s, e) {
3363
+ const t = e.rowGroupFields ?? [], i = e.columnGroupFields ?? [], n = e.valueFields ?? [], r = Ci(s, i), o = at(
3364
+ s,
3344
3365
  t,
3345
3366
  i,
3346
3367
  r,
3347
3368
  n,
3348
3369
  0,
3349
3370
  ""
3350
- ), s = Ri(o, r, n), l = Object.values(s).reduce((d, c) => d + c, 0);
3371
+ ), a = Ri(o, r, n), l = Object.values(a).reduce((d, c) => d + c, 0);
3351
3372
  return {
3352
3373
  rows: o,
3353
3374
  columnKeys: r,
3354
- totals: s,
3375
+ totals: a,
3355
3376
  grandTotal: l
3356
3377
  };
3357
3378
  }
3358
- function Ci(a, e) {
3379
+ function Ci(s, e) {
3359
3380
  if (e.length === 0) return ["value"];
3360
3381
  const t = /* @__PURE__ */ new Set();
3361
- for (const i of a) {
3382
+ for (const i of s) {
3362
3383
  const n = e.map((r) => String(i[r] ?? "")).join("|");
3363
3384
  t.add(n);
3364
3385
  }
3365
3386
  return [...t].sort();
3366
3387
  }
3367
- function Ei(a, e) {
3388
+ function Ei(s, e) {
3368
3389
  const t = /* @__PURE__ */ new Map();
3369
- for (const i of a) {
3390
+ for (const i of s) {
3370
3391
  const n = String(i[e] ?? ""), r = t.get(n);
3371
3392
  r ? r.push(i) : t.set(n, [i]);
3372
3393
  }
3373
3394
  return t;
3374
3395
  }
3375
- function at(a, e, t, i, n, r, o) {
3376
- const s = [];
3396
+ function at(s, e, t, i, n, r, o) {
3397
+ const a = [];
3377
3398
  if (e.length === 0) {
3378
- const h = Be(a, t, i, n), f = Ve(h);
3379
- return s.push({
3399
+ const h = Be(s, t, i, n), f = Ve(h);
3400
+ return a.push({
3380
3401
  rowKey: o || "all",
3381
3402
  rowLabel: o || "All",
3382
3403
  depth: r,
3383
3404
  values: h,
3384
3405
  total: f,
3385
3406
  isGroup: !1,
3386
- rowCount: a.length
3387
- }), s;
3407
+ rowCount: s.length
3408
+ }), a;
3388
3409
  }
3389
- const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(a, l);
3410
+ const l = e[0], d = e.slice(1), c = d.length > 0, u = Ei(s, l);
3390
3411
  for (const [h, f] of u) {
3391
3412
  const g = o ? `${o}|${h}` : h, p = Be(f, t, i, n), w = Ve(p);
3392
3413
  let b;
@@ -3398,7 +3419,7 @@ function at(a, e, t, i, n, r, o) {
3398
3419
  n,
3399
3420
  r + 1,
3400
3421
  g
3401
- )), s.push({
3422
+ )), a.push({
3402
3423
  rowKey: g,
3403
3424
  rowLabel: h || "(blank)",
3404
3425
  depth: r,
@@ -3409,90 +3430,90 @@ function at(a, e, t, i, n, r, o) {
3409
3430
  rowCount: f.length
3410
3431
  });
3411
3432
  }
3412
- return s;
3433
+ return a;
3413
3434
  }
3414
- function Be(a, e, t, i) {
3435
+ function Be(s, e, t, i) {
3415
3436
  const n = {};
3416
3437
  for (const r of t)
3417
3438
  for (const o of i) {
3418
- const l = (e.length > 0 ? a.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : a).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
3439
+ const l = (e.length > 0 ? s.filter((h) => e.map((f) => String(h[f] ?? "")).join("|") === r) : s).map((h) => Number(h[o.field]) || 0), d = vi(o.aggFunc), c = l.length > 0 ? d(l) : null, u = be([r], o.field);
3419
3440
  n[u] = c;
3420
3441
  }
3421
3442
  return n;
3422
3443
  }
3423
- function Ve(a) {
3444
+ function Ve(s) {
3424
3445
  let e = 0;
3425
- for (const t of Object.values(a))
3446
+ for (const t of Object.values(s))
3426
3447
  e += t ?? 0;
3427
3448
  return e;
3428
3449
  }
3429
- function Ri(a, e, t) {
3450
+ function Ri(s, e, t) {
3430
3451
  const i = {};
3431
3452
  function n(r) {
3432
3453
  for (const o of r)
3433
3454
  if (!o.isGroup || !o.children?.length)
3434
- for (const s of e)
3455
+ for (const a of e)
3435
3456
  for (const l of t) {
3436
- const d = be([s], l.field);
3457
+ const d = be([a], l.field);
3437
3458
  i[d] = (i[d] ?? 0) + (o.values[d] ?? 0);
3438
3459
  }
3439
3460
  else o.children && n(o.children);
3440
3461
  }
3441
- return n(a), i;
3462
+ return n(s), i;
3442
3463
  }
3443
- function Si(a, e, t = !0) {
3464
+ function Si(s, e, t = !0) {
3444
3465
  const i = [];
3445
3466
  function n(r) {
3446
3467
  i.push(r);
3447
3468
  const o = e ? e.has(r.rowKey) : t;
3448
3469
  if (r.children && o)
3449
- for (const s of r.children)
3450
- n(s);
3470
+ for (const a of r.children)
3471
+ n(a);
3451
3472
  }
3452
- for (const r of a)
3473
+ for (const r of s)
3453
3474
  n(r);
3454
3475
  return i;
3455
3476
  }
3456
- function ki(a) {
3477
+ function ki(s) {
3457
3478
  const e = [];
3458
3479
  function t(i) {
3459
3480
  if (i.isGroup && e.push(i.rowKey), i.children)
3460
3481
  for (const n of i.children)
3461
3482
  t(n);
3462
3483
  }
3463
- for (const i of a)
3484
+ for (const i of s)
3464
3485
  t(i);
3465
3486
  return e;
3466
3487
  }
3467
3488
  const Ai = ["sum", "avg", "count", "min", "max", "first", "last"];
3468
- function _i(a, e, t, i) {
3489
+ function _i(s, e, t, i) {
3469
3490
  const n = new AbortController(), r = { config: e, callbacks: i, signal: n.signal }, o = document.createElement("div");
3470
- return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => We("rowGroups", r))), o.appendChild(Y("Column Groups", () => We("columnGroups", r))), o.appendChild(Y("Values", () => Ti(r))), o.appendChild(Y("Available Fields", () => Fi(r))), a.appendChild(o), () => {
3491
+ return o.className = "tbw-pivot-panel", o.appendChild(Y("Options", () => Pi(t, r))), o.appendChild(Y("Row Groups", () => We("rowGroups", r))), o.appendChild(Y("Column Groups", () => We("columnGroups", r))), o.appendChild(Y("Values", () => Li(r))), o.appendChild(Y("Available Fields", () => Fi(r))), s.appendChild(o), () => {
3471
3492
  n.abort(), o.remove();
3472
3493
  };
3473
3494
  }
3474
- function Y(a, e) {
3495
+ function Y(s, e) {
3475
3496
  const t = document.createElement("div");
3476
3497
  t.className = "tbw-pivot-section";
3477
3498
  const i = document.createElement("div");
3478
- i.className = "tbw-pivot-section-header", i.textContent = a;
3499
+ i.className = "tbw-pivot-section-header", i.textContent = s;
3479
3500
  const n = document.createElement("div");
3480
3501
  return n.className = "tbw-pivot-section-content", n.appendChild(e()), t.appendChild(i), t.appendChild(n), t;
3481
3502
  }
3482
- function We(a, e) {
3503
+ function We(s, e) {
3483
3504
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3484
- r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", a);
3485
- const o = a === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
3505
+ r.className = "tbw-pivot-drop-zone", r.setAttribute("data-zone", s);
3506
+ const o = s === "rowGroups" ? t.rowGroupFields ?? [] : t.columnGroupFields ?? [];
3486
3507
  if (o.length === 0) {
3487
- const s = document.createElement("div");
3488
- s.className = "tbw-pivot-placeholder", s.textContent = "Drag fields here or click to add", r.appendChild(s);
3508
+ const a = document.createElement("div");
3509
+ a.className = "tbw-pivot-placeholder", a.textContent = "Drag fields here or click to add", r.appendChild(a);
3489
3510
  } else
3490
- for (const s of o)
3491
- r.appendChild(Li(s, a, e));
3511
+ for (const a of o)
3512
+ r.appendChild(Ti(a, s, e));
3492
3513
  return r.addEventListener(
3493
3514
  "dragover",
3494
- (s) => {
3495
- s.preventDefault(), r.classList.add("drag-over");
3515
+ (a) => {
3516
+ a.preventDefault(), r.classList.add("drag-over");
3496
3517
  },
3497
3518
  { signal: n }
3498
3519
  ), r.addEventListener(
@@ -3503,30 +3524,30 @@ function We(a, e) {
3503
3524
  { signal: n }
3504
3525
  ), r.addEventListener(
3505
3526
  "drop",
3506
- (s) => {
3507
- s.preventDefault(), r.classList.remove("drag-over");
3508
- const l = s.dataTransfer?.getData("text/plain");
3509
- l && i.onAddFieldToZone(l, a);
3527
+ (a) => {
3528
+ a.preventDefault(), r.classList.remove("drag-over");
3529
+ const l = a.dataTransfer?.getData("text/plain");
3530
+ l && i.onAddFieldToZone(l, s);
3510
3531
  },
3511
3532
  { signal: n }
3512
3533
  ), r;
3513
3534
  }
3514
- function Li(a, e, t) {
3535
+ function Ti(s, e, t) {
3515
3536
  const { callbacks: i, signal: n } = t, r = document.createElement("div");
3516
3537
  r.className = "tbw-pivot-field-chip", r.draggable = !0;
3517
- const o = i.getAvailableFields().find((d) => d.field === a), s = document.createElement("span");
3518
- s.className = "tbw-pivot-chip-label", s.textContent = o?.header ?? a;
3538
+ const o = i.getAvailableFields().find((d) => d.field === s), a = document.createElement("span");
3539
+ a.className = "tbw-pivot-chip-label", a.textContent = o?.header ?? s;
3519
3540
  const l = document.createElement("button");
3520
3541
  return l.className = "tbw-pivot-chip-remove", l.innerHTML = "×", l.title = "Remove field", l.addEventListener(
3521
3542
  "click",
3522
3543
  (d) => {
3523
- d.stopPropagation(), i.onRemoveFieldFromZone(a, e);
3544
+ d.stopPropagation(), i.onRemoveFieldFromZone(s, e);
3524
3545
  },
3525
3546
  { signal: n }
3526
- ), r.appendChild(s), r.appendChild(l), r.addEventListener(
3547
+ ), r.appendChild(a), r.appendChild(l), r.addEventListener(
3527
3548
  "dragstart",
3528
3549
  (d) => {
3529
- d.dataTransfer?.setData("text/plain", a), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
3550
+ d.dataTransfer?.setData("text/plain", s), d.dataTransfer?.setData("source-zone", e), r.classList.add("dragging");
3530
3551
  },
3531
3552
  { signal: n }
3532
3553
  ), r.addEventListener(
@@ -3537,8 +3558,8 @@ function Li(a, e, t) {
3537
3558
  { signal: n }
3538
3559
  ), r;
3539
3560
  }
3540
- function Ti(a) {
3541
- const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
3561
+ function Li(s) {
3562
+ const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3542
3563
  n.className = "tbw-pivot-drop-zone tbw-pivot-values-zone", n.setAttribute("data-zone", "values");
3543
3564
  const r = e.valueFields ?? [];
3544
3565
  if (r.length === 0) {
@@ -3546,7 +3567,7 @@ function Ti(a) {
3546
3567
  o.className = "tbw-pivot-placeholder", o.textContent = "Drag numeric fields here for aggregation", n.appendChild(o);
3547
3568
  } else
3548
3569
  for (const o of r)
3549
- n.appendChild(Ii(o, a));
3570
+ n.appendChild(Ii(o, s));
3550
3571
  return n.addEventListener(
3551
3572
  "dragover",
3552
3573
  (o) => {
@@ -3563,29 +3584,29 @@ function Ti(a) {
3563
3584
  "drop",
3564
3585
  (o) => {
3565
3586
  o.preventDefault(), n.classList.remove("drag-over");
3566
- const s = o.dataTransfer?.getData("text/plain");
3567
- s && t.onAddValueField(s, "sum");
3587
+ const a = o.dataTransfer?.getData("text/plain");
3588
+ a && t.onAddValueField(a, "sum");
3568
3589
  },
3569
3590
  { signal: i }
3570
3591
  ), n;
3571
3592
  }
3572
- function Ii(a, e) {
3593
+ function Ii(s, e) {
3573
3594
  const { callbacks: t, signal: i } = e, n = document.createElement("div");
3574
3595
  n.className = "tbw-pivot-field-chip tbw-pivot-value-chip";
3575
- const r = t.getAvailableFields().find((c) => c.field === a.field), o = document.createElement("div");
3596
+ const r = t.getAvailableFields().find((c) => c.field === s.field), o = document.createElement("div");
3576
3597
  o.className = "tbw-pivot-value-label-wrapper";
3577
- const s = document.createElement("span");
3578
- s.className = "tbw-pivot-chip-label", s.textContent = r?.header ?? a.field;
3598
+ const a = document.createElement("span");
3599
+ a.className = "tbw-pivot-chip-label", a.textContent = r?.header ?? s.field;
3579
3600
  const l = document.createElement("select");
3580
3601
  l.className = "tbw-pivot-agg-select", l.title = "Aggregation function";
3581
3602
  for (const c of Ai) {
3582
3603
  const u = document.createElement("option");
3583
- u.value = c, u.textContent = c.toUpperCase(), u.selected = c === a.aggFunc, l.appendChild(u);
3604
+ u.value = c, u.textContent = c.toUpperCase(), u.selected = c === s.aggFunc, l.appendChild(u);
3584
3605
  }
3585
3606
  l.addEventListener(
3586
3607
  "change",
3587
3608
  () => {
3588
- t.onUpdateValueAggFunc(a.field, l.value);
3609
+ t.onUpdateValueAggFunc(s.field, l.value);
3589
3610
  },
3590
3611
  { signal: i }
3591
3612
  );
@@ -3593,24 +3614,24 @@ function Ii(a, e) {
3593
3614
  return d.className = "tbw-pivot-chip-remove", d.innerHTML = "×", d.title = "Remove value field", d.addEventListener(
3594
3615
  "click",
3595
3616
  (c) => {
3596
- c.stopPropagation(), t.onRemoveValueField(a.field);
3617
+ c.stopPropagation(), t.onRemoveValueField(s.field);
3597
3618
  },
3598
3619
  { signal: i }
3599
- ), o.appendChild(s), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
3620
+ ), o.appendChild(a), o.appendChild(l), n.appendChild(o), n.appendChild(d), n;
3600
3621
  }
3601
- function Fi(a) {
3602
- const { config: e, callbacks: t, signal: i } = a, n = document.createElement("div");
3622
+ function Fi(s) {
3623
+ const { config: e, callbacks: t, signal: i } = s, n = document.createElement("div");
3603
3624
  n.className = "tbw-pivot-available-fields";
3604
3625
  const r = t.getAvailableFields(), o = /* @__PURE__ */ new Set([
3605
3626
  ...e.rowGroupFields ?? [],
3606
3627
  ...e.columnGroupFields ?? [],
3607
3628
  ...e.valueFields?.map((l) => l.field) ?? []
3608
- ]), s = r.filter((l) => !o.has(l.field));
3609
- if (s.length === 0) {
3629
+ ]), a = r.filter((l) => !o.has(l.field));
3630
+ if (a.length === 0) {
3610
3631
  const l = document.createElement("div");
3611
3632
  l.className = "tbw-pivot-placeholder", l.textContent = "All fields are in use", n.appendChild(l);
3612
3633
  } else
3613
- for (const l of s) {
3634
+ for (const l of a) {
3614
3635
  const d = document.createElement("div");
3615
3636
  d.className = "tbw-pivot-field-chip available", d.textContent = l.header, d.draggable = !0, d.title = `Drag to add "${l.field}" to a zone`, d.addEventListener(
3616
3637
  "dragstart",
@@ -3628,12 +3649,12 @@ function Fi(a) {
3628
3649
  }
3629
3650
  return n;
3630
3651
  }
3631
- function Pi(a, e) {
3652
+ function Pi(s, e) {
3632
3653
  const { config: t, callbacks: i, signal: n } = e, r = document.createElement("div");
3633
3654
  return r.className = "tbw-pivot-options", r.appendChild(
3634
3655
  le(
3635
3656
  "Enable Pivot View",
3636
- a,
3657
+ s,
3637
3658
  (o) => {
3638
3659
  i.onTogglePivot(o);
3639
3660
  },
@@ -3659,58 +3680,58 @@ function Pi(a, e) {
3659
3680
  )
3660
3681
  ), r;
3661
3682
  }
3662
- function le(a, e, t, i) {
3683
+ function le(s, e, t, i) {
3663
3684
  const n = document.createElement("label");
3664
3685
  n.className = "tbw-pivot-checkbox";
3665
3686
  const r = document.createElement("input");
3666
3687
  r.type = "checkbox", r.checked = e, r.addEventListener("change", () => t(r.checked), { signal: i });
3667
3688
  const o = document.createElement("span");
3668
- return o.textContent = a, n.appendChild(r), n.appendChild(o), n;
3689
+ return o.textContent = s, n.appendChild(r), n.appendChild(o), n;
3669
3690
  }
3670
- function Di(a, e, t) {
3671
- return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
3691
+ function Di(s, e, t) {
3692
+ return e.className = "data-grid-row pivot-group-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.setAttribute("role", "row"), e.innerHTML = "", t.columns.forEach((i, n) => {
3672
3693
  const r = document.createElement("div");
3673
3694
  if (r.className = "cell", r.setAttribute("data-col", String(n)), r.setAttribute("data-row", String(t.rowIndex)), r.setAttribute("role", "gridcell"), n === 0) {
3674
- const o = Number(a.__pivotIndent) || 0;
3695
+ const o = Number(s.__pivotIndent) || 0;
3675
3696
  r.style.paddingLeft = `${o}px`;
3676
- const s = String(a.__pivotRowKey), l = document.createElement("button");
3677
- l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label", a.__pivotExpanded ? "Collapse group" : "Expand group"), t.setIcon(l, t.resolveIcon(a.__pivotExpanded ? "collapse" : "expand")), l.addEventListener("click", (u) => {
3678
- u.stopPropagation(), t.onToggle(s);
3697
+ const a = String(s.__pivotRowKey), l = document.createElement("button");
3698
+ l.type = "button", l.className = "pivot-toggle", l.setAttribute("aria-label", s.__pivotExpanded ? "Collapse group" : "Expand group"), t.setIcon(l, t.resolveIcon(s.__pivotExpanded ? "collapse" : "expand")), l.addEventListener("click", (u) => {
3699
+ u.stopPropagation(), t.onToggle(a);
3679
3700
  }), r.appendChild(l);
3680
3701
  const d = document.createElement("span");
3681
- d.className = "pivot-label", d.textContent = String(a.__pivotLabel ?? ""), r.appendChild(d);
3702
+ d.className = "pivot-label", d.textContent = String(s.__pivotLabel ?? ""), r.appendChild(d);
3682
3703
  const c = document.createElement("span");
3683
- c.className = "pivot-count", c.textContent = ` (${Number(a.__pivotRowCount) || 0})`, r.appendChild(c);
3704
+ c.className = "pivot-count", c.textContent = ` (${Number(s.__pivotRowCount) || 0})`, r.appendChild(c);
3684
3705
  } else {
3685
- const o = a[i.field];
3706
+ const o = s[i.field];
3686
3707
  r.textContent = o != null ? String(o) : "";
3687
3708
  }
3688
3709
  e.appendChild(r);
3689
3710
  }), !0;
3690
3711
  }
3691
- function Mi(a, e, t, i) {
3692
- return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(a.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(a.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
3712
+ function Mi(s, e, t, i) {
3713
+ return e.className = "data-grid-row pivot-leaf-row", e.setAttribute("data-pivot-depth", String(s.__pivotDepth ?? 0)), e.setAttribute("data-pivot-key", String(s.__pivotRowKey ?? "")), e.innerHTML = "", t.forEach((n, r) => {
3693
3714
  const o = document.createElement("div");
3694
3715
  if (o.className = "cell", o.setAttribute("data-col", String(r)), o.setAttribute("data-row", String(i)), o.setAttribute("role", "gridcell"), r === 0) {
3695
- const s = Number(a.__pivotIndent) || 0;
3696
- o.style.paddingLeft = `${s + 20}px`;
3716
+ const a = Number(s.__pivotIndent) || 0;
3717
+ o.style.paddingLeft = `${a + 20}px`;
3697
3718
  const l = document.createElement("span");
3698
- l.className = "pivot-label", l.textContent = String(a.__pivotLabel ?? ""), o.appendChild(l);
3719
+ l.className = "pivot-label", l.textContent = String(s.__pivotLabel ?? ""), o.appendChild(l);
3699
3720
  } else {
3700
- const s = a[n.field];
3701
- o.textContent = s != null ? String(s) : "";
3721
+ const a = s[n.field];
3722
+ o.textContent = a != null ? String(a) : "";
3702
3723
  }
3703
3724
  e.appendChild(o);
3704
3725
  }), !0;
3705
3726
  }
3706
- function Ni(a, e, t) {
3727
+ function Ni(s, e, t) {
3707
3728
  return e.className = "pivot-grand-total-row", e.setAttribute("role", "presentation"), e.innerHTML = "", t.forEach((i, n) => {
3708
3729
  const r = document.createElement("div");
3709
3730
  if (r.className = "cell", r.setAttribute("data-col", String(n)), n === 0) {
3710
3731
  const o = document.createElement("span");
3711
3732
  o.className = "pivot-label", o.textContent = "Grand Total", r.appendChild(o);
3712
3733
  } else {
3713
- const o = a[i.field];
3734
+ const o = s[i.field];
3714
3735
  r.textContent = o != null ? String(o) : "";
3715
3736
  }
3716
3737
  e.appendChild(r);
@@ -3788,8 +3809,8 @@ class B extends _ {
3788
3809
  this.keysToAnimate.clear();
3789
3810
  const r = /* @__PURE__ */ new Set();
3790
3811
  for (const o of n) {
3791
- const s = o.__pivotRowKey;
3792
- r.add(s), !this.previousVisibleKeys.has(s) && o.__pivotDepth > 0 && this.keysToAnimate.add(s);
3812
+ const a = o.__pivotRowKey;
3813
+ r.add(a), !this.previousVisibleKeys.has(a) && o.__pivotDepth > 0 && this.keysToAnimate.add(a);
3793
3814
  }
3794
3815
  return this.previousVisibleKeys = r, n;
3795
3816
  }
@@ -3804,10 +3825,10 @@ class B extends _ {
3804
3825
  });
3805
3826
  for (const n of this.pivotResult.columnKeys)
3806
3827
  for (const r of this.config.valueFields ?? []) {
3807
- const o = be([n], r.field), s = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3828
+ const o = be([n], r.field), a = r.header || this.fieldHeaderMap.get(r.field) || r.field;
3808
3829
  t.push({
3809
3830
  field: o,
3810
- header: `${n} - ${s} (${r.aggFunc})`,
3831
+ header: `${n} - ${a} (${r.aggFunc})`,
3811
3832
  width: 120,
3812
3833
  type: "number"
3813
3834
  });
@@ -4006,18 +4027,18 @@ class B extends _ {
4006
4027
  }
4007
4028
  }
4008
4029
  const J = "tbw-print-isolation-style";
4009
- function Hi(a, e) {
4030
+ function Hi(s, e) {
4010
4031
  const t = document.createElement("style");
4011
4032
  return t.id = J, t.textContent = `
4012
4033
  /* Print isolation: hide everything except the target grid */
4013
4034
  @media print {
4014
4035
  /* Hide all body children by default */
4015
- body > *:not(#${a}) {
4036
+ body > *:not(#${s}) {
4016
4037
  display: none !important;
4017
4038
  }
4018
4039
 
4019
4040
  /* But show the grid and ensure it's not hidden by ancestor rules */
4020
- #${a} {
4041
+ #${s} {
4021
4042
  display: block !important;
4022
4043
  position: static !important;
4023
4044
  visibility: visible !important;
@@ -4032,14 +4053,14 @@ function Hi(a, e) {
4032
4053
  }
4033
4054
 
4034
4055
  /* If grid is nested, we need to show its ancestors too */
4035
- #${a},
4036
- #${a} * {
4056
+ #${s},
4057
+ #${s} * {
4037
4058
  visibility: visible !important;
4038
4059
  }
4039
4060
 
4040
4061
  /* Walk up the DOM and show all ancestors of the grid */
4041
- body *:has(> #${a}),
4042
- body *:has(#${a}) {
4062
+ body *:has(> #${s}),
4063
+ body *:has(#${s}) {
4043
4064
  display: block !important;
4044
4065
  visibility: visible !important;
4045
4066
  opacity: 1 !important;
@@ -4054,7 +4075,7 @@ function Hi(a, e) {
4054
4075
  }
4055
4076
 
4056
4077
  /* Hide siblings of ancestors (everything that's not in the path to the grid) */
4057
- body *:has(#${a}) > *:not(:has(#${a})):not(#${a}) {
4078
+ body *:has(#${s}) > *:not(:has(#${s})):not(#${s}) {
4058
4079
  display: none !important;
4059
4080
  }
4060
4081
 
@@ -4080,18 +4101,18 @@ function Hi(a, e) {
4080
4101
  }
4081
4102
  `, t;
4082
4103
  }
4083
- async function Ki(a, e = {}) {
4084
- const { orientation: t = "landscape" } = e, i = a.id;
4104
+ async function Ki(s, e = {}) {
4105
+ const { orientation: t = "landscape" } = e, i = s.id;
4085
4106
  document.querySelectorAll(`#${CSS.escape(i)}`).length > 1 && console.warn(
4086
4107
  `[tbw-grid:print] Multiple elements found with id="${i}". Print isolation may not work correctly. Ensure each grid has a unique ID.`
4087
4108
  ), document.getElementById(J)?.remove();
4088
4109
  const r = Hi(i, t);
4089
4110
  return document.head.appendChild(r), new Promise((o) => {
4090
- const s = () => {
4091
- window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
4111
+ const a = () => {
4112
+ window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
4092
4113
  };
4093
- window.addEventListener("afterprint", s), window.print(), setTimeout(() => {
4094
- window.removeEventListener("afterprint", s), document.getElementById(J)?.remove(), o();
4114
+ window.addEventListener("afterprint", a), window.print(), setTimeout(() => {
4115
+ window.removeEventListener("afterprint", a), document.getElementById(J)?.remove(), o();
4095
4116
  }, 5e3);
4096
4117
  });
4097
4118
  }
@@ -4133,7 +4154,7 @@ class Rn extends _ {
4133
4154
  return;
4134
4155
  }
4135
4156
  const i = { ...Oi, ...this.config, ...e }, r = this.rows.length;
4136
- let o = r, s = !1;
4157
+ let o = r, a = !1;
4137
4158
  if (i.warnThreshold > 0 && r > i.warnThreshold) {
4138
4159
  const d = i.maxRows > 0 ? `
4139
4160
 
@@ -4145,18 +4166,18 @@ Click OK to continue, or Cancel to abort.`
4145
4166
  ))
4146
4167
  return;
4147
4168
  }
4148
- i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, s = !0), this.#t = !0;
4169
+ i.maxRows > 0 && r > i.maxRows && (o = i.maxRows, a = !0), this.#t = !0;
4149
4170
  const l = performance.now();
4150
4171
  this.emit("print-start", {
4151
4172
  rowCount: o,
4152
- limitApplied: s,
4173
+ limitApplied: a,
4153
4174
  originalRowCount: r
4154
4175
  });
4155
4176
  try {
4156
4177
  const d = this.#l;
4157
4178
  this.#s = {
4158
4179
  bypassThreshold: d._virtualization?.bypassThreshold ?? 24
4159
- }, this.#v(), s && (this.#o = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#r(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
4180
+ }, this.#v(), a && (this.#o = this.sourceRows, this.grid.rows = this.sourceRows.slice(0, o), await new Promise((c) => setTimeout(c, 50))), (i.includeTitle || i.includeTimestamp) && this.#r(i), await this.#d(), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), t.classList.add(`print-${i.orientation}`), await new Promise((c) => requestAnimationFrame(c)), await new Promise((c) => requestAnimationFrame(c)), i.isolate ? await this.#p(i) : await this.#f(), this.emit("print-complete", {
4160
4181
  success: !0,
4161
4182
  rowCount: o,
4162
4183
  duration: Math.round(performance.now() - l)
@@ -4252,13 +4273,13 @@ Click OK to continue, or Cancel to abort.`
4252
4273
  });
4253
4274
  }
4254
4275
  }
4255
- function Gi(a) {
4256
- const e = a.meta ?? {};
4276
+ function Gi(s) {
4277
+ const e = s.meta ?? {};
4257
4278
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
4258
4279
  }
4259
- function $e(a, e, t) {
4260
- if (e === t || e < 0 || e >= a.length || t < 0 || t > a.length) return a;
4261
- const i = [...a], [n] = i.splice(e, 1);
4280
+ function $e(s, e, t) {
4281
+ if (e === t || e < 0 || e >= s.length || t < 0 || t > s.length) return s;
4282
+ const i = [...s], [n] = i.splice(e, 1);
4262
4283
  return i.splice(t, 0, n), i;
4263
4284
  }
4264
4285
  const Bi = '@layer tbw-plugins{.header-row>.cell[draggable=true]{cursor:grab;position:relative}.header-row>.cell.dragging{opacity:.5;cursor:grabbing}.header-row>.cell.drop-before:before{content:"";position:absolute;left:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.header-row>.cell.drop-after:after{content:"";position:absolute;right:0;top:0;bottom:0;width:2px;background:var(--tbw-reorder-indicator, var(--tbw-color-accent));z-index:1}.cell.flip-animating{transition:transform var(--tbw-animation-duration, .2s) ease-out;will-change:transform;z-index:1}@keyframes reorder-fade-in{0%{opacity:0}to{opacity:1}}.cell.fade-animating{animation:reorder-fade-in var(--tbw-animation-duration, .2s) ease-out backwards}}';
@@ -4307,24 +4328,24 @@ class Sn extends _ {
4307
4328
  e.querySelectorAll(".header-row > .cell").forEach((i) => {
4308
4329
  const n = i, r = n.getAttribute("data-field");
4309
4330
  if (!r) return;
4310
- const o = this.columns.find((s) => s.field === r);
4331
+ const o = this.columns.find((a) => a.field === r);
4311
4332
  if (!this.canMoveColumnWithPlugins(o)) {
4312
4333
  n.draggable = !1;
4313
4334
  return;
4314
4335
  }
4315
- n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (s) => {
4336
+ n.draggable = !0, !n.getAttribute("data-dragstart-bound") && (n.setAttribute("data-dragstart-bound", "true"), n.addEventListener("dragstart", (a) => {
4316
4337
  const d = this.getColumnOrder().indexOf(r);
4317
- this.isDragging = !0, this.draggedField = r, this.draggedIndex = d, s.dataTransfer && (s.dataTransfer.effectAllowed = "move", s.dataTransfer.setData("text/plain", r)), n.classList.add("dragging");
4338
+ this.isDragging = !0, this.draggedField = r, this.draggedIndex = d, a.dataTransfer && (a.dataTransfer.effectAllowed = "move", a.dataTransfer.setData("text/plain", r)), n.classList.add("dragging");
4318
4339
  }), n.addEventListener("dragend", () => {
4319
4340
  this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses();
4320
- }), n.addEventListener("dragover", (s) => {
4321
- if (s.preventDefault(), !this.isDragging || this.draggedField === r) return;
4341
+ }), n.addEventListener("dragover", (a) => {
4342
+ if (a.preventDefault(), !this.isDragging || this.draggedField === r) return;
4322
4343
  const l = n.getBoundingClientRect(), d = l.left + l.width / 2, u = this.getColumnOrder().indexOf(r);
4323
- this.dropIndex = s.clientX < d ? u : u + 1, n.classList.add("drop-target"), n.classList.toggle("drop-before", s.clientX < d), n.classList.toggle("drop-after", s.clientX >= d);
4344
+ this.dropIndex = a.clientX < d ? u : u + 1, n.classList.add("drop-target"), n.classList.toggle("drop-before", a.clientX < d), n.classList.toggle("drop-after", a.clientX >= d);
4324
4345
  }), n.addEventListener("dragleave", () => {
4325
4346
  n.classList.remove("drop-target", "drop-before", "drop-after");
4326
- }), n.addEventListener("drop", (s) => {
4327
- s.preventDefault();
4347
+ }), n.addEventListener("drop", (a) => {
4348
+ a.preventDefault();
4328
4349
  const l = this.draggedField, d = this.draggedIndex, c = this.dropIndex;
4329
4350
  if (!this.isDragging || l === null || d === null || c === null)
4330
4351
  return;
@@ -4345,9 +4366,9 @@ class Sn extends _ {
4345
4366
  if (i < 0 || i >= n.length) return;
4346
4367
  const r = n[i];
4347
4368
  if (!this.canMoveColumnWithPlugins(r)) return;
4348
- const o = this.getColumnOrder(), s = o.indexOf(r.field);
4349
- if (s === -1) return;
4350
- const l = e.key === "ArrowLeft" ? s - 1 : s + 1;
4369
+ const o = this.getColumnOrder(), a = o.indexOf(r.field);
4370
+ if (a === -1) return;
4371
+ const l = e.key === "ArrowLeft" ? a - 1 : a + 1;
4351
4372
  if (l < 0 || l >= o.length) return;
4352
4373
  const d = n.find((c) => c.field === o[l]);
4353
4374
  if (this.canMoveColumnWithPlugins(d))
@@ -4386,19 +4407,19 @@ class Sn extends _ {
4386
4407
  if (!t || e.size === 0) return;
4387
4408
  const i = /* @__PURE__ */ new Map();
4388
4409
  if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((o) => {
4389
- const s = o.getAttribute("data-field");
4390
- if (!s) return;
4391
- const l = e.get(s);
4410
+ const a = o.getAttribute("data-field");
4411
+ if (!a) return;
4412
+ const l = e.get(a);
4392
4413
  if (l === void 0) return;
4393
4414
  const d = l - o.getBoundingClientRect().left;
4394
- Math.abs(d) > 1 && i.set(s, d);
4415
+ Math.abs(d) > 1 && i.set(a, d);
4395
4416
  }), i.size === 0) return;
4396
4417
  const n = [];
4397
4418
  if (t.querySelectorAll(".cell[data-field]").forEach((o) => {
4398
- const s = i.get(o.getAttribute("data-field") ?? "");
4399
- if (s !== void 0) {
4419
+ const a = i.get(o.getAttribute("data-field") ?? "");
4420
+ if (a !== void 0) {
4400
4421
  const l = o;
4401
- l.style.transform = `translateX(${s}px)`, n.push(l);
4422
+ l.style.transform = `translateX(${a}px)`, n.push(l);
4402
4423
  }
4403
4424
  }), n.length === 0) return;
4404
4425
  this.gridElement.offsetHeight;
@@ -4422,25 +4443,25 @@ class Sn extends _ {
4422
4443
  const i = this.captureHeaderPositions();
4423
4444
  e();
4424
4445
  const n = /* @__PURE__ */ new Set();
4425
- if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((s) => {
4426
- const l = s.getAttribute("data-field");
4446
+ if (t.querySelectorAll(".header-row > .cell[data-field]").forEach((a) => {
4447
+ const l = a.getAttribute("data-field");
4427
4448
  if (!l) return;
4428
4449
  const d = i.get(l);
4429
4450
  if (d === void 0) return;
4430
- const c = s.getBoundingClientRect().left;
4451
+ const c = a.getBoundingClientRect().left;
4431
4452
  Math.abs(d - c) > 1 && n.add(l);
4432
4453
  }), n.size === 0) return;
4433
4454
  const r = [];
4434
- if (t.querySelectorAll(".cell[data-field]").forEach((s) => {
4435
- const l = s.getAttribute("data-field");
4455
+ if (t.querySelectorAll(".cell[data-field]").forEach((a) => {
4456
+ const l = a.getAttribute("data-field");
4436
4457
  if (l && n.has(l)) {
4437
- const d = s;
4458
+ const d = a;
4438
4459
  d.classList.add("fade-animating"), r.push(d);
4439
4460
  }
4440
4461
  }), r.length === 0) return;
4441
4462
  const o = this.animationDuration;
4442
4463
  setTimeout(() => {
4443
- r.forEach((s) => s.classList.remove("fade-animating"));
4464
+ r.forEach((a) => a.classList.remove("fade-animating"));
4444
4465
  }, o + 50);
4445
4466
  }
4446
4467
  updateColumnOrder(e) {
@@ -4522,12 +4543,12 @@ class kn extends _ {
4522
4543
  const u = i.__frameworkAdapter.parseResponsiveCardElement(t);
4523
4544
  u && (this.config = { ...this.config, cardRenderer: u });
4524
4545
  }
4525
- const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"), s = t.getAttribute("hide-header"), l = t.getAttribute("debounce-ms"), d = {};
4546
+ const n = t.getAttribute("breakpoint"), r = t.getAttribute("card-row-height"), o = t.getAttribute("hidden-columns"), a = t.getAttribute("hide-header"), l = t.getAttribute("debounce-ms"), d = {};
4526
4547
  if (n !== null) {
4527
4548
  const u = parseInt(n, 10);
4528
4549
  isNaN(u) || (d.breakpoint = u);
4529
4550
  }
4530
- if (r !== null && (d.cardRowHeight = r === "auto" ? "auto" : parseInt(r, 10)), o !== null && (d.hiddenColumns = o.split(",").map((u) => u.trim()).filter((u) => u.length > 0)), s !== null && (d.hideHeader = s !== "false"), l !== null) {
4551
+ if (r !== null && (d.cardRowHeight = r === "auto" ? "auto" : parseInt(r, 10)), o !== null && (d.hiddenColumns = o.split(",").map((u) => u.trim()).filter((u) => u.length > 0)), a !== null && (d.hideHeader = a !== "false"), l !== null) {
4531
4552
  const u = parseInt(l, 10);
4532
4553
  isNaN(u) || (d.debounceMs = u);
4533
4554
  }
@@ -4672,18 +4693,18 @@ class kn extends _ {
4672
4693
  getExtraHeight() {
4673
4694
  if (!this.#e || !this.config.cardRenderer || !this.#y())
4674
4695
  return 0;
4675
- const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), s = r * Math.max(0, i - e);
4676
- return o + s;
4696
+ const e = this.#h ?? 28, t = this.#m(), i = this.#b(), { groupCount: n, cardCount: r } = this.#C(), o = n * Math.max(0, t - e), a = r * Math.max(0, i - e);
4697
+ return o + a;
4677
4698
  }
4678
4699
  getExtraHeightBefore(e) {
4679
4700
  if (!this.#e || !this.config.cardRenderer || !this.#y())
4680
4701
  return 0;
4681
4702
  const t = this.#h ?? 28, i = this.#m(), n = this.#b(), r = Math.max(0, i - t), o = Math.max(0, n - t);
4682
- let s = 0, l = 0;
4703
+ let a = 0, l = 0;
4683
4704
  const d = this.rows, c = Math.min(e, d.length);
4684
4705
  for (let u = 0; u < c; u++)
4685
- d[u].__isGroupRow ? s++ : l++;
4686
- return s * r + l * o;
4706
+ d[u].__isGroupRow ? a++ : l++;
4707
+ return a * r + l * o;
4687
4708
  }
4688
4709
  getRowHeight(e, t) {
4689
4710
  if (!(!this.#e || !this.config.cardRenderer))
@@ -4704,8 +4725,8 @@ class kn extends _ {
4704
4725
  if (n !== this.#a && (this.#a = n, e = !0), i) {
4705
4726
  const o = this.gridElement.querySelector(".data-grid-row.group-row");
4706
4727
  if (o) {
4707
- const s = o.getBoundingClientRect().height;
4708
- s > 0 && s !== this.#g && (this.#g = s, e = !0);
4728
+ const a = o.getBoundingClientRect().height;
4729
+ a > 0 && a !== this.#g && (this.#g = a, e = !0);
4709
4730
  }
4710
4731
  }
4711
4732
  const r = this.gridElement.querySelector(".data-grid-row.responsive-card");
@@ -4788,9 +4809,9 @@ class An extends _ {
4788
4809
  if (i < 0 || i >= n.length) return;
4789
4810
  const r = e.key === "ArrowUp" ? "up" : "down", o = r === "up" ? i - 1 : i + 1;
4790
4811
  if (o < 0 || o >= n.length) return;
4791
- const s = n[i];
4792
- if (!(this.config.canMove && !this.config.canMove(s, i, o, r)))
4793
- return this.handleKeyboardMove(s, i, o, r, t._focusCol), e.preventDefault(), e.stopPropagation(), !0;
4812
+ const a = n[i];
4813
+ if (!(this.config.canMove && !this.config.canMove(a, i, o, r)))
4814
+ return this.handleKeyboardMove(a, i, o, r, t._focusCol), e.preventDefault(), e.stopPropagation(), !0;
4794
4815
  }
4795
4816
  onCellClick() {
4796
4817
  this.flushPendingMove();
@@ -4830,8 +4851,8 @@ class An extends _ {
4830
4851
  const i = this.draggedRowIndex;
4831
4852
  let n = this.dropRowIndex;
4832
4853
  if (!(!this.isDragging || i === null || n === null) && (n > i && n--, i !== n)) {
4833
- const o = this.sourceRows[i], s = n < i ? "up" : "down";
4834
- (!this.config.canMove || this.config.canMove(o, i, n, s)) && this.executeMove(o, i, n, "drag");
4854
+ const o = this.sourceRows[i], a = n < i ? "up" : "down";
4855
+ (!this.config.canMove || this.config.canMove(o, i, n, a)) && this.executeMove(o, i, n, "drag");
4835
4856
  }
4836
4857
  });
4837
4858
  }
@@ -4841,8 +4862,8 @@ class An extends _ {
4841
4862
  currentIndex: i,
4842
4863
  row: e
4843
4864
  }, this.lastFocusCol = r;
4844
- const o = this.grid, s = [...o._rows ?? this.sourceRows], [l] = s.splice(t, 1);
4845
- s.splice(i, 0, l), o._rows = s, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), F(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4865
+ const o = this.grid, a = [...o._rows ?? this.sourceRows], [l] = a.splice(t, 1);
4866
+ a.splice(i, 0, l), o._rows = a, o._focusRow = i, o._focusCol = r, o.refreshVirtualWindow(!0), F(o), this.clearDebounceTimer(), this.debounceTimer = setTimeout(() => {
4846
4867
  this.flushPendingMove();
4847
4868
  }, this.config.debounceMs ?? 300);
4848
4869
  }
@@ -4858,8 +4879,8 @@ class An extends _ {
4858
4879
  source: "keyboard"
4859
4880
  };
4860
4881
  if (this.emitCancelable("row-move", n)) {
4861
- const o = [...this.sourceRows], [s] = o.splice(t, 1);
4862
- o.splice(e, 0, s);
4882
+ const o = [...this.sourceRows], [a] = o.splice(t, 1);
4883
+ o.splice(e, 0, a);
4863
4884
  const l = this.grid;
4864
4885
  l._rows = o, l._focusRow = e, l._focusCol = this.lastFocusCol, l.refreshVirtualWindow(!0), F(l);
4865
4886
  }
@@ -4867,14 +4888,14 @@ class An extends _ {
4867
4888
  executeMove(e, t, i, n) {
4868
4889
  const r = [...this.sourceRows], [o] = r.splice(t, 1);
4869
4890
  r.splice(i, 0, o);
4870
- const s = {
4891
+ const a = {
4871
4892
  row: e,
4872
4893
  fromIndex: t,
4873
4894
  toIndex: i,
4874
4895
  rows: r,
4875
4896
  source: n
4876
4897
  };
4877
- if (!this.emitCancelable("row-move", s))
4898
+ if (!this.emitCancelable("row-move", a))
4878
4899
  if (this.animationType === "flip" && this.gridElement) {
4879
4900
  const d = this.captureRowPositions();
4880
4901
  this.grid.rows = r, requestAnimationFrame(() => {
@@ -4893,7 +4914,7 @@ class An extends _ {
4893
4914
  animateFLIP(e, t, i) {
4894
4915
  const n = this.gridElement;
4895
4916
  if (!n || e.size === 0) return;
4896
- const r = Math.min(t, i), o = Math.max(t, i), s = [];
4917
+ const r = Math.min(t, i), o = Math.max(t, i), a = [];
4897
4918
  if (n.querySelectorAll(".data-grid-row").forEach((d) => {
4898
4919
  const c = d, u = this.getRowIndex(c);
4899
4920
  if (u < 0 || u < r || u > o) return;
@@ -4902,17 +4923,17 @@ class An extends _ {
4902
4923
  const f = e.get(h);
4903
4924
  if (f === void 0) return;
4904
4925
  const g = c.getBoundingClientRect().top, p = f - g;
4905
- Math.abs(p) > 1 && s.push({ el: c, deltaY: p });
4906
- }), s.length === 0) return;
4907
- s.forEach(({ el: d, deltaY: c }) => {
4926
+ Math.abs(p) > 1 && a.push({ el: c, deltaY: p });
4927
+ }), a.length === 0) return;
4928
+ a.forEach(({ el: d, deltaY: c }) => {
4908
4929
  d.style.transform = `translateY(${c}px)`;
4909
4930
  }), n.offsetHeight;
4910
4931
  const l = this.animationDuration;
4911
4932
  requestAnimationFrame(() => {
4912
- s.forEach(({ el: d }) => {
4933
+ a.forEach(({ el: d }) => {
4913
4934
  d.classList.add("flip-animating"), d.style.transform = "";
4914
4935
  }), setTimeout(() => {
4915
- s.forEach(({ el: d }) => {
4936
+ a.forEach(({ el: d }) => {
4916
4937
  d.style.transform = "", d.classList.remove("flip-animating");
4917
4938
  });
4918
4939
  }, l + 50);
@@ -4931,62 +4952,62 @@ class An extends _ {
4931
4952
  this.debounceTimer && (clearTimeout(this.debounceTimer), this.debounceTimer = null);
4932
4953
  }
4933
4954
  }
4934
- function $(a) {
4955
+ function $(s) {
4935
4956
  return {
4936
- startRow: Math.min(a.startRow, a.endRow),
4937
- startCol: Math.min(a.startCol, a.endCol),
4938
- endRow: Math.max(a.startRow, a.endRow),
4939
- endCol: Math.max(a.startCol, a.endCol)
4957
+ startRow: Math.min(s.startRow, s.endRow),
4958
+ startCol: Math.min(s.startCol, s.endCol),
4959
+ endRow: Math.max(s.startRow, s.endRow),
4960
+ endCol: Math.max(s.startCol, s.endCol)
4940
4961
  };
4941
4962
  }
4942
- function ji(a) {
4943
- const e = $(a);
4963
+ function ji(s) {
4964
+ const e = $(s);
4944
4965
  return {
4945
4966
  from: { row: e.startRow, col: e.startCol },
4946
4967
  to: { row: e.endRow, col: e.endCol }
4947
4968
  };
4948
4969
  }
4949
- function lt(a) {
4950
- return a.map(ji);
4970
+ function lt(s) {
4971
+ return s.map(ji);
4951
4972
  }
4952
- function Ui(a, e, t) {
4973
+ function Ui(s, e, t) {
4953
4974
  const i = $(t);
4954
- return a >= i.startRow && a <= i.endRow && e >= i.startCol && e <= i.endCol;
4975
+ return s >= i.startRow && s <= i.endRow && e >= i.startCol && e <= i.endCol;
4955
4976
  }
4956
- function je(a, e, t) {
4957
- return t.some((i) => Ui(a, e, i));
4977
+ function je(s, e, t) {
4978
+ return t.some((i) => Ui(s, e, i));
4958
4979
  }
4959
- function Yi(a) {
4960
- const e = [], t = $(a);
4980
+ function Yi(s) {
4981
+ const e = [], t = $(s);
4961
4982
  for (let i = t.startRow; i <= t.endRow; i++)
4962
4983
  for (let n = t.startCol; n <= t.endCol; n++)
4963
4984
  e.push({ row: i, col: n });
4964
4985
  return e;
4965
4986
  }
4966
- function Xi(a) {
4987
+ function Xi(s) {
4967
4988
  const e = /* @__PURE__ */ new Map();
4968
- for (const t of a)
4989
+ for (const t of s)
4969
4990
  for (const i of Yi(t))
4970
4991
  e.set(`${i.row},${i.col}`, i);
4971
4992
  return [...e.values()];
4972
4993
  }
4973
- function de(a, e) {
4994
+ function de(s, e) {
4974
4995
  return {
4975
- startRow: a.row,
4976
- startCol: a.col,
4996
+ startRow: s.row,
4997
+ startCol: s.col,
4977
4998
  endRow: e.row,
4978
4999
  endCol: e.col
4979
5000
  };
4980
5001
  }
4981
- function Q(a, e) {
4982
- const t = $(a), i = $(e);
5002
+ function Q(s, e) {
5003
+ const t = $(s), i = $(e);
4983
5004
  return t.startRow === i.startRow && t.startCol === i.startCol && t.endRow === i.endRow && t.endCol === i.endCol;
4984
5005
  }
4985
- const Zi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color)}&.first{border-left:2px solid var(--tbw-range-border-color)}&.last{border-right:2px solid var(--tbw-range-border-color)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
4986
- function Qi(a, e, t) {
4987
- if (a === "cell" && e.selectedCell)
5006
+ const Zi = "@layer tbw-plugins{tbw-grid{&.selecting .data-grid-row>.cell{user-select:none}&:has(.selection){user-select:none}&[data-has-focus] .data-grid-row.row-focus{background-color:var(--tbw-focus-background, rgba(from var(--tbw-color-accent) r g b / 12%))}&[data-selection-mode=row] .cell-focus{outline:none}.data-grid-row>.cell.selected{background-color:var(--tbw-range-selection-bg);&.top{border-top:2px solid var(--tbw-range-border-color);padding-top:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.bottom{border-bottom:2px solid var(--tbw-range-border-color);padding-bottom:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.first{border-left:2px solid var(--tbw-range-border-color);padding-left:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}&.last{border-right:2px solid var(--tbw-range-border-color);padding-right:calc(var(--tbw-cell-padding, 2px 8px) - 2px)}}.data-grid-row[data-selectable=false]{cursor:not-allowed;opacity:.6;&.row-focus{background-color:var(--tbw-color-row-alt)}}.data-grid-row>.cell[data-selectable=false]{cursor:not-allowed;opacity:.6;&.selected{background-color:var(--tbw-selection-warning-bg, rgba(from var(--tbw-color-error) r g b / 50%))}}.tbw-selection-summary{font-size:var(--tbw-font-size-sm, .8125rem);color:var(--tbw-color-fg-muted);white-space:nowrap}}}";
5007
+ function Qi(s, e, t) {
5008
+ if (s === "cell" && e.selectedCell)
4988
5009
  return {
4989
- mode: a,
5010
+ mode: s,
4990
5011
  ranges: [
4991
5012
  {
4992
5013
  from: { row: e.selectedCell.row, col: e.selectedCell.col },
@@ -4994,14 +5015,14 @@ function Qi(a, e, t) {
4994
5015
  }
4995
5016
  ]
4996
5017
  };
4997
- if (a === "row" && e.selected.size > 0) {
5018
+ if (s === "row" && e.selected.size > 0) {
4998
5019
  const i = [...e.selected].map((n) => ({
4999
5020
  from: { row: n, col: 0 },
5000
5021
  to: { row: n, col: t - 1 }
5001
5022
  }));
5002
- return { mode: a, ranges: i };
5023
+ return { mode: s, ranges: i };
5003
5024
  }
5004
- return a === "range" && e.ranges.length > 0 ? { mode: a, ranges: lt(e.ranges) } : { mode: a, ranges: [] };
5025
+ return s === "range" && e.ranges.length > 0 ? { mode: s, ranges: lt(e.ranges) } : { mode: s, ranges: [] };
5005
5026
  }
5006
5027
  class _n extends _ {
5007
5028
  static manifest = {
@@ -5070,7 +5091,7 @@ class _n extends _ {
5070
5091
  const { rowIndex: t, colIndex: i, originalEvent: n } = e, { mode: r, triggerOn: o = "click" } = this.config;
5071
5092
  if (n.type !== o)
5072
5093
  return !1;
5073
- const s = this.columns[i], l = s && H(s);
5094
+ const a = this.columns[i], l = a && H(a);
5074
5095
  if (r === "cell") {
5075
5096
  if (l || !this.isCellSelectable(t, i))
5076
5097
  return !1;
@@ -5134,13 +5155,13 @@ class _n extends _ {
5134
5155
  const r = this.rows.length, o = this.columns.length;
5135
5156
  if (r > 0 && o > 0) {
5136
5157
  e.preventDefault(), e.stopPropagation();
5137
- const s = {
5158
+ const a = {
5138
5159
  startRow: 0,
5139
5160
  startCol: 0,
5140
5161
  endRow: r - 1,
5141
5162
  endCol: o - 1
5142
5163
  };
5143
- return this.ranges = [s], this.activeRange = s, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
5164
+ return this.ranges = [a], this.activeRange = a, this.emit("selection-change", this.#e()), this.requestAfterRender(), !0;
5144
5165
  }
5145
5166
  }
5146
5167
  return !1;
@@ -5164,7 +5185,7 @@ class _n extends _ {
5164
5185
  let t = e.colIndex;
5165
5186
  const i = this.columns[t];
5166
5187
  if (i && H(i)) {
5167
- const o = this.columns.findIndex((s) => !H(s));
5188
+ const o = this.columns.findIndex((a) => !H(a));
5168
5189
  o >= 0 && (t = o);
5169
5190
  }
5170
5191
  const n = de(this.cellAnchor, { row: e.rowIndex, col: t }), r = this.ranges.length > 0 ? this.ranges[this.ranges.length - 1] : null;
@@ -5185,14 +5206,14 @@ class _n extends _ {
5185
5206
  if (r.forEach((o) => {
5186
5207
  o.classList.remove("selected", "row-focus"), i && o.removeAttribute("data-selectable");
5187
5208
  }), t === "row" && (xe(e), r.forEach((o) => {
5188
- const s = o.querySelector(".cell[data-row]"), l = wt(s);
5209
+ const a = o.querySelector(".cell[data-row]"), l = wt(a);
5189
5210
  l >= 0 && (i && !this.isRowSelectable(l) && o.setAttribute("data-selectable", "false"), this.selected.has(l) && o.classList.add("selected", "row-focus"));
5190
- })), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((s) => {
5191
- const l = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10);
5192
- l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || s.setAttribute("data-selectable", "false"));
5211
+ })), (t === "cell" || t === "range") && i && e.querySelectorAll(".cell[data-row][data-col]").forEach((a) => {
5212
+ const l = parseInt(a.getAttribute("data-row") ?? "-1", 10), d = parseInt(a.getAttribute("data-col") ?? "-1", 10);
5213
+ l >= 0 && d >= 0 && (this.isCellSelectable(l, d) || a.setAttribute("data-selectable", "false"));
5193
5214
  }), t === "range" && this.ranges.length > 0) {
5194
5215
  xe(e);
5195
- const o = this.activeRange ? $(this.activeRange) : null, s = this.columns.findIndex((d) => !H(d));
5216
+ const o = this.activeRange ? $(this.activeRange) : null, a = this.columns.findIndex((d) => !H(d));
5196
5217
  this.columns.length - 1, e.querySelectorAll(".cell[data-row][data-col]").forEach((d) => {
5197
5218
  const c = parseInt(d.getAttribute("data-row") ?? "-1", 10), u = parseInt(d.getAttribute("data-col") ?? "-1", 10);
5198
5219
  if (c >= 0 && u >= 0) {
@@ -5201,7 +5222,7 @@ class _n extends _ {
5201
5222
  return;
5202
5223
  if (je(c, u, this.ranges) && (d.classList.add("selected"), o)) {
5203
5224
  c === o.startRow && d.classList.add("top"), c === o.endRow && d.classList.add("bottom");
5204
- const g = Math.max(o.startCol, s);
5225
+ const g = Math.max(o.startCol, a);
5205
5226
  u === g && d.classList.add("first"), u === o.endCol && d.classList.add("last");
5206
5227
  }
5207
5228
  }
@@ -5218,8 +5239,8 @@ class _n extends _ {
5218
5239
  this.pendingKeyboardUpdate = null;
5219
5240
  const r = this.grid._focusRow, o = this.grid._focusCol;
5220
5241
  if (n && this.cellAnchor) {
5221
- const s = de(this.cellAnchor, { row: r, col: o });
5222
- this.ranges = [s], this.activeRange = s;
5242
+ const a = de(this.cellAnchor, { row: r, col: o });
5243
+ this.ranges = [a], this.activeRange = a;
5223
5244
  } else n || (this.ranges = [], this.activeRange = null, this.cellAnchor = { row: r, col: o });
5224
5245
  this.emit("selection-change", this.#e());
5225
5246
  }
@@ -5267,38 +5288,38 @@ class _n extends _ {
5267
5288
  );
5268
5289
  }
5269
5290
  }
5270
- function ee(a, e) {
5271
- return Math.floor(a / e);
5291
+ function ee(s, e) {
5292
+ return Math.floor(s / e);
5272
5293
  }
5273
- function Ji(a, e) {
5294
+ function Ji(s, e) {
5274
5295
  return {
5275
- start: a * e,
5276
- end: (a + 1) * e
5296
+ start: s * e,
5297
+ end: (s + 1) * e
5277
5298
  };
5278
5299
  }
5279
- function en(a, e, t) {
5280
- const i = ee(a, t), n = ee(e - 1, t), r = [];
5300
+ function en(s, e, t) {
5301
+ const i = ee(s, t), n = ee(e - 1, t), r = [];
5281
5302
  for (let o = i; o <= n; o++)
5282
5303
  r.push(o);
5283
5304
  return r;
5284
5305
  }
5285
- async function Ue(a, e, t, i) {
5306
+ async function Ue(s, e, t, i) {
5286
5307
  const n = Ji(e, t);
5287
- return a.getRows({
5308
+ return s.getRows({
5288
5309
  startRow: n.start,
5289
5310
  endRow: n.end,
5290
5311
  sortModel: i.sortModel,
5291
5312
  filterModel: i.filterModel
5292
5313
  });
5293
5314
  }
5294
- function tn(a, e, t) {
5295
- const i = ee(a, e), n = t.get(i);
5315
+ function tn(s, e, t) {
5316
+ const i = ee(s, e), n = t.get(i);
5296
5317
  if (!n) return;
5297
- const r = a % e;
5318
+ const r = s % e;
5298
5319
  return n[r];
5299
5320
  }
5300
5321
  const nn = 100;
5301
- class Ln extends _ {
5322
+ class Tn extends _ {
5302
5323
  name = "serverSide";
5303
5324
  get defaultConfig() {
5304
5325
  return {
@@ -5368,17 +5389,17 @@ class Ln extends _ {
5368
5389
  return this.loadedBlocks.size;
5369
5390
  }
5370
5391
  }
5371
- function dt(a, e, t) {
5372
- return a.id !== void 0 ? String(a.id) : t ? `${t}-${e}` : String(e);
5392
+ function dt(s, e, t) {
5393
+ return s.id !== void 0 ? String(s.id) : t ? `${t}-${e}` : String(e);
5373
5394
  }
5374
- function ce(a, e) {
5375
- const t = new Set(a);
5395
+ function ce(s, e) {
5396
+ const t = new Set(s);
5376
5397
  return t.has(e) ? t.delete(e) : t.add(e), t;
5377
5398
  }
5378
- function ge(a, e, t = null, i = 0) {
5399
+ function ge(s, e, t = null, i = 0) {
5379
5400
  const n = e.childrenField ?? "children", r = /* @__PURE__ */ new Set();
5380
- for (let o = 0; o < a.length; o++) {
5381
- const s = a[o], l = dt(s, o, t), d = s[n];
5401
+ for (let o = 0; o < s.length; o++) {
5402
+ const a = s[o], l = dt(a, o, t), d = a[n];
5382
5403
  if (Array.isArray(d) && d.length > 0) {
5383
5404
  r.add(l);
5384
5405
  const c = ge(d, e, l, i + 1);
@@ -5390,13 +5411,13 @@ function ge(a, e, t = null, i = 0) {
5390
5411
  function rn() {
5391
5412
  return /* @__PURE__ */ new Set();
5392
5413
  }
5393
- function ct(a, e, t, i = null, n = 0) {
5414
+ function ct(s, e, t, i = null, n = 0) {
5394
5415
  const r = t.childrenField ?? "children";
5395
- for (let o = 0; o < a.length; o++) {
5396
- const s = a[o], l = dt(s, o, i);
5416
+ for (let o = 0; o < s.length; o++) {
5417
+ const a = s[o], l = dt(a, o, i);
5397
5418
  if (l === e)
5398
5419
  return [l];
5399
- const d = s[r];
5420
+ const d = a[r];
5400
5421
  if (Array.isArray(d) && d.length > 0) {
5401
5422
  const c = ct(d, e, t, l, n + 1);
5402
5423
  if (c)
@@ -5405,17 +5426,17 @@ function ct(a, e, t, i = null, n = 0) {
5405
5426
  }
5406
5427
  return null;
5407
5428
  }
5408
- function on(a, e, t, i) {
5409
- const n = ct(a, e, t);
5429
+ function on(s, e, t, i) {
5430
+ const n = ct(s, e, t);
5410
5431
  if (!n) return i;
5411
5432
  const r = new Set(i);
5412
5433
  for (let o = 0; o < n.length - 1; o++)
5413
5434
  r.add(n[o]);
5414
5435
  return r;
5415
5436
  }
5416
- function Ye(a, e = "children") {
5417
- if (!Array.isArray(a) || a.length === 0) return !1;
5418
- for (const t of a) {
5437
+ function Ye(s, e = "children") {
5438
+ if (!Array.isArray(s) || s.length === 0) return !1;
5439
+ for (const t of s) {
5419
5440
  if (!t) continue;
5420
5441
  const i = t[e];
5421
5442
  if (Array.isArray(i) && i.length > 0)
@@ -5423,10 +5444,10 @@ function Ye(a, e = "children") {
5423
5444
  }
5424
5445
  return !1;
5425
5446
  }
5426
- function sn(a) {
5427
- if (!Array.isArray(a) || a.length === 0) return null;
5447
+ function sn(s) {
5448
+ if (!Array.isArray(s) || s.length === 0) return null;
5428
5449
  const e = ["children", "items", "nodes", "subRows", "nested"];
5429
- for (const t of a)
5450
+ for (const t of s)
5430
5451
  if (!(!t || typeof t != "object"))
5431
5452
  for (const i of e) {
5432
5453
  const n = t[i];
@@ -5436,7 +5457,7 @@ function sn(a) {
5436
5457
  return null;
5437
5458
  }
5438
5459
  const an = "@layer tbw-plugins{tbw-grid{.cell[data-field=__tbw_expander]{border-inline-end:none!important;padding:0;display:flex;align-items:center;justify-content:flex-start}.header-row .cell[data-field=__tbw_expander]{display:none}.header-row .cell[data-field=__tbw_expander]+.cell{grid-column:1 / 3}.tree-cell-wrapper{display:inline-flex;align-items:center;padding-inline-start:calc(var(--tbw-tree-depth, 0) * var(--tbw-tree-indent-width, var(--tbw-tree-toggle-size, 1.25em)))}.tree-expander{display:flex;align-items:center;justify-content:flex-start;width:100%;height:100%;box-sizing:border-box}.tree-toggle{cursor:pointer;user-select:none;display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-tree-toggle-size, 1.25em);height:var(--tbw-tree-toggle-size, 1.25em);flex-shrink:0}.tree-toggle:hover{color:var(--tbw-tree-accent, var(--tbw-color-accent))}.tree-spacer{width:var(--tbw-tree-toggle-size, 1.25em);display:inline-block;flex-shrink:0}.data-grid-row.tbw-tree-slide-in{animation:tbw-tree-slide-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}.data-grid-row.tbw-tree-fade-in{animation:tbw-tree-fade-in var(--tbw-animation-duration, .2s) var(--tbw-animation-easing, ease-out) forwards}}@keyframes tbw-tree-slide-in{0%{opacity:0;transform:translate(-8px)}to{opacity:1;transform:translate(0)}}@keyframes tbw-tree-fade-in{0%{opacity:0}to{opacity:1}}}";
5439
- class Tn extends _ {
5460
+ class Ln extends _ {
5440
5461
  static manifest = {
5441
5462
  events: [
5442
5463
  {
@@ -5508,11 +5529,11 @@ class Tn extends _ {
5508
5529
  withStableKeys(e, t = null) {
5509
5530
  const i = this.config.childrenField ?? "children";
5510
5531
  return e.map((n, r) => {
5511
- const o = n.__stableKey, s = n.id !== void 0 ? String(n.id) : o ?? (t ? `${t}-${r}` : String(r)), l = n[i], d = Array.isArray(l) && l.length > 0;
5532
+ const o = n.__stableKey, a = n.id !== void 0 ? String(n.id) : o ?? (t ? `${t}-${r}` : String(r)), l = n[i], d = Array.isArray(l) && l.length > 0;
5512
5533
  return {
5513
5534
  ...n,
5514
- __stableKey: s,
5515
- ...d ? { [i]: this.withStableKeys(l, s) } : {}
5535
+ __stableKey: a,
5536
+ ...d ? { [i]: this.withStableKeys(l, a) } : {}
5516
5537
  };
5517
5538
  });
5518
5539
  }
@@ -5533,24 +5554,24 @@ class Tn extends _ {
5533
5554
  }
5534
5555
  sortTree(e, t, i) {
5535
5556
  const n = this.config.childrenField ?? "children";
5536
- return [...e].sort((o, s) => {
5537
- const l = o[t], d = s[t];
5557
+ return [...e].sort((o, a) => {
5558
+ const l = o[t], d = a[t];
5538
5559
  return l == null && d == null ? 0 : l == null ? -1 : d == null ? 1 : l > d ? i : l < d ? -i : 0;
5539
5560
  }).map((o) => {
5540
- const s = o[n];
5541
- return Array.isArray(s) && s.length > 0 ? { ...o, [n]: this.sortTree(s, t, i) } : o;
5561
+ const a = o[n];
5562
+ return Array.isArray(a) && a.length > 0 ? { ...o, [n]: this.sortTree(a, t, i) } : o;
5542
5563
  });
5543
5564
  }
5544
5565
  processColumns(e) {
5545
5566
  if (this.flattenedRows.length === 0) return [...e];
5546
5567
  const t = [...e];
5547
5568
  if (t.length === 0) return t;
5548
- const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), s = this.resolveIcon.bind(this), l = (d) => {
5569
+ const i = t[0], n = i.viewRenderer, r = () => this.config, o = this.setIcon.bind(this), a = this.resolveIcon.bind(this), l = (d) => {
5549
5570
  const { row: c, value: u } = d, { showExpandIcons: h = !0, indentWidth: f } = r(), g = c, p = g.__treeDepth ?? 0, w = document.createElement("span");
5550
5571
  if (w.className = "tree-cell-wrapper", w.style.setProperty("--tbw-tree-depth", String(p)), f !== void 0 && w.style.setProperty("--tbw-tree-indent-width", `${f}px`), h)
5551
5572
  if (g.__treeHasChildren) {
5552
5573
  const y = document.createElement("span");
5553
- y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y, s(g.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(y);
5574
+ y.className = `tree-toggle${g.__treeExpanded ? " expanded" : ""}`, o(y, a(g.__treeExpanded ? "collapse" : "expand")), y.setAttribute("data-tree-key", String(g.__treeKey ?? "")), w.appendChild(y);
5554
5575
  } else {
5555
5576
  const y = document.createElement("span");
5556
5577
  y.className = "tree-spacer", w.appendChild(y);
@@ -5603,8 +5624,8 @@ class Tn extends _ {
5603
5624
  if (!t) return;
5604
5625
  const i = e === "fade" ? "tbw-tree-fade-in" : "tbw-tree-slide-in";
5605
5626
  for (const n of t.querySelectorAll(".data-grid-row")) {
5606
- const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1, s = this.flattenedRows[o]?.key;
5607
- s && this.keysToAnimate.has(s) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
5627
+ const r = n.querySelector(".cell[data-row]"), o = r ? parseInt(r.getAttribute("data-row") ?? "-1", 10) : -1, a = this.flattenedRows[o]?.key;
5628
+ a && this.keysToAnimate.has(a) && (n.classList.add(i), n.addEventListener("animationend", () => n.classList.remove(i), { once: !0 }));
5608
5629
  }
5609
5630
  this.keysToAnimate.clear();
5610
5631
  }
@@ -5639,8 +5660,8 @@ class Tn extends _ {
5639
5660
  this.expandedKeys = on(this.rows, e, this.config, this.expandedKeys), this.requestRender();
5640
5661
  }
5641
5662
  }
5642
- function ln(a, e, t) {
5643
- const i = [...a.undoStack, e];
5663
+ function ln(s, e, t) {
5664
+ const i = [...s.undoStack, e];
5644
5665
  for (; i.length > t; )
5645
5666
  i.shift();
5646
5667
  return {
@@ -5648,43 +5669,43 @@ function ln(a, e, t) {
5648
5669
  redoStack: []
5649
5670
  };
5650
5671
  }
5651
- function Xe(a) {
5652
- if (a.undoStack.length === 0)
5653
- return { newState: a, action: null };
5654
- const e = [...a.undoStack], t = e.pop();
5672
+ function Xe(s) {
5673
+ if (s.undoStack.length === 0)
5674
+ return { newState: s, action: null };
5675
+ const e = [...s.undoStack], t = e.pop();
5655
5676
  return t ? {
5656
5677
  newState: {
5657
5678
  undoStack: e,
5658
- redoStack: [...a.redoStack, t]
5679
+ redoStack: [...s.redoStack, t]
5659
5680
  },
5660
5681
  action: t
5661
- } : { newState: a, action: null };
5682
+ } : { newState: s, action: null };
5662
5683
  }
5663
- function Ze(a) {
5664
- if (a.redoStack.length === 0)
5665
- return { newState: a, action: null };
5666
- const e = [...a.redoStack], t = e.pop();
5684
+ function Ze(s) {
5685
+ if (s.redoStack.length === 0)
5686
+ return { newState: s, action: null };
5687
+ const e = [...s.redoStack], t = e.pop();
5667
5688
  return t ? {
5668
5689
  newState: {
5669
- undoStack: [...a.undoStack, t],
5690
+ undoStack: [...s.undoStack, t],
5670
5691
  redoStack: e
5671
5692
  },
5672
5693
  action: t
5673
- } : { newState: a, action: null };
5694
+ } : { newState: s, action: null };
5674
5695
  }
5675
- function dn(a) {
5676
- return a.undoStack.length > 0;
5696
+ function dn(s) {
5697
+ return s.undoStack.length > 0;
5677
5698
  }
5678
- function cn(a) {
5679
- return a.redoStack.length > 0;
5699
+ function cn(s) {
5700
+ return s.redoStack.length > 0;
5680
5701
  }
5681
5702
  function un() {
5682
5703
  return { undoStack: [], redoStack: [] };
5683
5704
  }
5684
- function hn(a, e, t, i) {
5705
+ function hn(s, e, t, i) {
5685
5706
  return {
5686
5707
  type: "cell-edit",
5687
- rowIndex: a,
5708
+ rowIndex: s,
5688
5709
  field: e,
5689
5710
  oldValue: t,
5690
5711
  newValue: i,
@@ -5782,8 +5803,8 @@ class In extends _ {
5782
5803
  }
5783
5804
  }
5784
5805
  const fn = '@layer tbw-plugins{.tbw-visibility-content{display:flex;flex-direction:column;height:100%}.tbw-visibility-list{flex:1;overflow-y:auto;padding:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem))}.tbw-visibility-row{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));padding:var(--tbw-menu-item-padding, .375rem .25rem);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem);border-radius:var(--tbw-border-radius, .25rem);position:relative}.tbw-visibility-row:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}.tbw-visibility-row input[type=checkbox]{cursor:pointer}.tbw-visibility-row.locked span{color:var(--tbw-color-fg-muted)}.tbw-visibility-handle{cursor:grab;color:var(--tbw-color-fg-muted);font-size:var(--tbw-font-size-2xs, .625rem);letter-spacing:-2px;user-select:none;flex-shrink:0}.tbw-visibility-row.reorderable:hover .tbw-visibility-handle{color:var(--tbw-color-fg)}.tbw-visibility-label{display:flex;align-items:center;gap:var(--tbw-panel-gap, var(--tbw-spacing-md, .5rem));flex:1;cursor:pointer}.tbw-visibility-row.dragging{opacity:.5;cursor:grabbing}.tbw-visibility-row.drop-before:before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-row.drop-after:after{content:"";position:absolute;left:0;right:0;bottom:0;height:2px;background:var(--tbw-visibility-indicator, var(--tbw-color-accent))}.tbw-visibility-show-all{margin:var(--tbw-panel-padding, var(--tbw-spacing-md, .5rem));padding:var(--tbw-button-padding, .5rem .75rem);border:1px solid var(--tbw-visibility-border, var(--tbw-color-border));border-radius:var(--tbw-border-radius, .25rem);background:var(--tbw-visibility-btn-bg, var(--tbw-color-header-bg));color:var(--tbw-color-fg);cursor:pointer;font-size:var(--tbw-font-size-sm, .8125rem)}.tbw-visibility-show-all:hover{background:var(--tbw-visibility-hover, var(--tbw-color-row-hover))}}';
5785
- function Qe(a) {
5786
- const e = a.meta ?? {};
5806
+ function Qe(s) {
5807
+ const e = s.meta ?? {};
5787
5808
  return e.lockPosition !== !0 && e.suppressMovable !== !0;
5788
5809
  }
5789
5810
  class V extends _ {
@@ -5881,8 +5902,8 @@ class V extends _ {
5881
5902
  e.innerHTML = "";
5882
5903
  const i = this.grid.getAllColumns().filter((n) => !n.utility);
5883
5904
  for (let n = 0; n < i.length; n++) {
5884
- const r = i[n], o = r.header || r.field, s = document.createElement("div");
5885
- s.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", s.setAttribute("data-field", r.field), s.setAttribute("data-index", String(n)), t && Qe(r) && (s.draggable = !0, s.classList.add("reorderable"), this.setupDragListeners(s, r.field, n, e));
5905
+ const r = i[n], o = r.header || r.field, a = document.createElement("div");
5906
+ a.className = r.lockVisible ? "tbw-visibility-row locked" : "tbw-visibility-row", a.setAttribute("data-field", r.field), a.setAttribute("data-index", String(n)), t && Qe(r) && (a.draggable = !0, a.classList.add("reorderable"), this.setupDragListeners(a, r.field, n, e));
5886
5907
  const l = document.createElement("label");
5887
5908
  l.className = "tbw-visibility-label";
5888
5909
  const d = document.createElement("input");
@@ -5892,9 +5913,9 @@ class V extends _ {
5892
5913
  const c = document.createElement("span");
5893
5914
  if (c.textContent = o, l.appendChild(d), l.appendChild(c), t && Qe(r)) {
5894
5915
  const u = document.createElement("span");
5895
- u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", s.appendChild(u);
5916
+ u.className = "tbw-visibility-handle", this.setIcon(u, this.resolveIcon("dragHandle")), u.title = "Drag to reorder", a.appendChild(u);
5896
5917
  }
5897
- s.appendChild(l), e.appendChild(s);
5918
+ a.appendChild(l), e.appendChild(a);
5898
5919
  }
5899
5920
  }
5900
5921
  setupDragListeners(e, t, i, n) {
@@ -5904,22 +5925,22 @@ class V extends _ {
5904
5925
  this.isDragging = !1, this.draggedField = null, this.draggedIndex = null, this.dropIndex = null, this.clearDragClasses(n);
5905
5926
  }), e.addEventListener("dragover", (r) => {
5906
5927
  if (r.preventDefault(), !this.isDragging || this.draggedField === t) return;
5907
- const o = e.getBoundingClientRect(), s = o.top + o.height / 2;
5908
- this.dropIndex = r.clientY < s ? i : i + 1, n.querySelectorAll(".tbw-visibility-row").forEach((l) => {
5928
+ const o = e.getBoundingClientRect(), a = o.top + o.height / 2;
5929
+ this.dropIndex = r.clientY < a ? i : i + 1, n.querySelectorAll(".tbw-visibility-row").forEach((l) => {
5909
5930
  l !== e && l.classList.remove("drop-target", "drop-before", "drop-after");
5910
- }), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY < s), e.classList.toggle("drop-after", r.clientY >= s);
5931
+ }), e.classList.add("drop-target"), e.classList.toggle("drop-before", r.clientY < a), e.classList.toggle("drop-after", r.clientY >= a);
5911
5932
  }), e.addEventListener("dragleave", () => {
5912
5933
  e.classList.remove("drop-target", "drop-before", "drop-after");
5913
5934
  }), e.addEventListener("drop", (r) => {
5914
5935
  r.preventDefault();
5915
- const o = this.draggedField, s = this.draggedIndex, l = this.dropIndex;
5916
- if (!this.isDragging || o === null || s === null || l === null)
5936
+ const o = this.draggedField, a = this.draggedIndex, l = this.dropIndex;
5937
+ if (!this.isDragging || o === null || a === null || l === null)
5917
5938
  return;
5918
- const d = l > s ? l - 1 : l;
5919
- if (d !== s) {
5939
+ const d = l > a ? l - 1 : l;
5940
+ if (d !== a) {
5920
5941
  const c = this.grid.getAllColumns(), h = c.filter((p) => !p.utility)[d]?.field, f = h ? c.findIndex((p) => p.field === h) : c.length, g = {
5921
5942
  field: o,
5922
- fromIndex: s,
5943
+ fromIndex: a,
5923
5944
  toIndex: f
5924
5945
  };
5925
5946
  this.emit("column-reorder-request", g), setTimeout(() => {
@@ -5964,8 +5985,8 @@ export {
5964
5985
  kn as ResponsivePlugin,
5965
5986
  An as RowReorderPlugin,
5966
5987
  _n as SelectionPlugin,
5967
- Ln as ServerSidePlugin,
5968
- Tn as TreePlugin,
5988
+ Tn as ServerSidePlugin,
5989
+ Ln as TreePlugin,
5969
5990
  In as UndoRedoPlugin,
5970
5991
  V as VisibilityPlugin,
5971
5992
  jn as builtInSort,