@toolbox-web/grid 1.12.1 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/all.js +1171 -943
  2. package/all.js.map +1 -1
  3. package/index.js +735 -737
  4. package/index.js.map +1 -1
  5. package/lib/core/grid.d.ts.map +1 -1
  6. package/lib/core/internal/row-animation.d.ts.map +1 -1
  7. package/lib/core/internal/sanitize.d.ts.map +1 -1
  8. package/lib/core/internal/validate-config.d.ts.map +1 -1
  9. package/lib/core/plugin/types.d.ts +1 -1
  10. package/lib/core/plugin/types.d.ts.map +1 -1
  11. package/lib/core/types.d.ts +48 -1
  12. package/lib/core/types.d.ts.map +1 -1
  13. package/lib/plugins/clipboard/ClipboardPlugin.d.ts +69 -8
  14. package/lib/plugins/clipboard/ClipboardPlugin.d.ts.map +1 -1
  15. package/lib/plugins/clipboard/index.d.ts +1 -1
  16. package/lib/plugins/clipboard/index.d.ts.map +1 -1
  17. package/lib/plugins/clipboard/index.js +257 -192
  18. package/lib/plugins/clipboard/index.js.map +1 -1
  19. package/lib/plugins/clipboard/types.d.ts +31 -0
  20. package/lib/plugins/clipboard/types.d.ts.map +1 -1
  21. package/lib/plugins/column-virtualization/index.js.map +1 -1
  22. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts +8 -0
  23. package/lib/plugins/context-menu/ContextMenuPlugin.d.ts.map +1 -1
  24. package/lib/plugins/context-menu/index.js +75 -60
  25. package/lib/plugins/context-menu/index.js.map +1 -1
  26. package/lib/plugins/context-menu/types.d.ts +7 -0
  27. package/lib/plugins/context-menu/types.d.ts.map +1 -1
  28. package/lib/plugins/editing/EditingPlugin.d.ts.map +1 -1
  29. package/lib/plugins/editing/editors.d.ts +2 -2
  30. package/lib/plugins/editing/editors.d.ts.map +1 -1
  31. package/lib/plugins/editing/index.d.ts +1 -1
  32. package/lib/plugins/editing/index.d.ts.map +1 -1
  33. package/lib/plugins/editing/index.js +393 -337
  34. package/lib/plugins/editing/index.js.map +1 -1
  35. package/lib/plugins/editing/types.d.ts +50 -23
  36. package/lib/plugins/editing/types.d.ts.map +1 -1
  37. package/lib/plugins/export/ExportPlugin.d.ts.map +1 -1
  38. package/lib/plugins/export/index.js +75 -66
  39. package/lib/plugins/export/index.js.map +1 -1
  40. package/lib/plugins/filtering/index.d.ts +1 -1
  41. package/lib/plugins/filtering/index.d.ts.map +1 -1
  42. package/lib/plugins/filtering/index.js +9 -9
  43. package/lib/plugins/filtering/index.js.map +1 -1
  44. package/lib/plugins/grouping-columns/index.js.map +1 -1
  45. package/lib/plugins/grouping-rows/index.js.map +1 -1
  46. package/lib/plugins/master-detail/index.js +57 -56
  47. package/lib/plugins/master-detail/index.js.map +1 -1
  48. package/lib/plugins/multi-sort/index.js.map +1 -1
  49. package/lib/plugins/pinned-columns/index.js.map +1 -1
  50. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts +1 -0
  51. package/lib/plugins/pinned-rows/PinnedRowsPlugin.d.ts.map +1 -1
  52. package/lib/plugins/pinned-rows/index.js +118 -87
  53. package/lib/plugins/pinned-rows/index.js.map +1 -1
  54. package/lib/plugins/pinned-rows/pinned-rows.d.ts +2 -1
  55. package/lib/plugins/pinned-rows/pinned-rows.d.ts.map +1 -1
  56. package/lib/plugins/pinned-rows/types.d.ts +23 -2
  57. package/lib/plugins/pinned-rows/types.d.ts.map +1 -1
  58. package/lib/plugins/pivot/index.js.map +1 -1
  59. package/lib/plugins/print/index.js.map +1 -1
  60. package/lib/plugins/reorder/index.js.map +1 -1
  61. package/lib/plugins/responsive/index.js +40 -39
  62. package/lib/plugins/responsive/index.js.map +1 -1
  63. package/lib/plugins/row-reorder/index.js.map +1 -1
  64. package/lib/plugins/selection/SelectionPlugin.d.ts +51 -0
  65. package/lib/plugins/selection/SelectionPlugin.d.ts.map +1 -1
  66. package/lib/plugins/selection/index.js +347 -145
  67. package/lib/plugins/selection/index.js.map +1 -1
  68. package/lib/plugins/selection/types.d.ts +18 -0
  69. package/lib/plugins/selection/types.d.ts.map +1 -1
  70. package/lib/plugins/server-side/index.js.map +1 -1
  71. package/lib/plugins/shared/data-collection.d.ts +33 -0
  72. package/lib/plugins/shared/data-collection.d.ts.map +1 -0
  73. package/lib/plugins/tree/index.js.map +1 -1
  74. package/lib/plugins/undo-redo/index.js.map +1 -1
  75. package/lib/plugins/visibility/index.js.map +1 -1
  76. package/package.json +1 -1
  77. package/public.d.ts +2 -0
  78. package/public.d.ts.map +1 -1
  79. package/themes/dg-theme-bootstrap.css +192 -8
  80. package/themes/dg-theme-material.css +243 -0
  81. package/umd/grid.all.umd.js +42 -42
  82. package/umd/grid.all.umd.js.map +1 -1
  83. package/umd/grid.umd.js +19 -19
  84. package/umd/grid.umd.js.map +1 -1
  85. package/umd/plugins/clipboard.umd.js +5 -5
  86. package/umd/plugins/clipboard.umd.js.map +1 -1
  87. package/umd/plugins/context-menu.umd.js +1 -1
  88. package/umd/plugins/context-menu.umd.js.map +1 -1
  89. package/umd/plugins/editing.umd.js +1 -1
  90. package/umd/plugins/editing.umd.js.map +1 -1
  91. package/umd/plugins/export.umd.js +7 -7
  92. package/umd/plugins/export.umd.js.map +1 -1
  93. package/umd/plugins/filtering.umd.js +1 -1
  94. package/umd/plugins/filtering.umd.js.map +1 -1
  95. package/umd/plugins/pinned-rows.umd.js +1 -1
  96. package/umd/plugins/pinned-rows.umd.js.map +1 -1
  97. package/umd/plugins/selection.umd.js +2 -2
  98. package/umd/plugins/selection.umd.js.map +1 -1
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function st() {
1
+ function lt() {
2
2
  return {
3
3
  rowCount: -1,
4
4
  colCount: -1,
@@ -6,32 +6,32 @@ function st() {
6
6
  ariaDescribedBy: void 0
7
7
  };
8
8
  }
9
- function lt(t, e, i, o, n) {
9
+ function at(t, e, i, o, n) {
10
10
  if (o === t.rowCount && n === t.colCount)
11
11
  return !1;
12
12
  const r = t.rowCount;
13
13
  return t.rowCount = o, t.colCount = n, e && (e.setAttribute("aria-rowcount", String(o)), e.setAttribute("aria-colcount", String(n))), o !== r && i && (o > 0 ? i.setAttribute("role", "rowgroup") : i.removeAttribute("role")), !0;
14
14
  }
15
- function at(t, e) {
15
+ function ct(t, e) {
16
16
  const i = t?.gridAriaLabel;
17
17
  return i || (t?.shell?.header?.title ?? e?.lightDomTitle ?? void 0);
18
18
  }
19
- function ct(t, e, i, o) {
19
+ function dt(t, e, i, o) {
20
20
  if (!e) return !1;
21
21
  let n = !1;
22
- const r = at(i, o);
22
+ const r = ct(i, o);
23
23
  r !== t.ariaLabel && (t.ariaLabel = r, r ? e.setAttribute("aria-label", r) : e.removeAttribute("aria-label"), n = !0);
24
24
  const s = i?.gridAriaDescribedBy;
25
25
  return s !== t.ariaDescribedBy && (t.ariaDescribedBy = s, s ? e.setAttribute("aria-describedby", s) : e.removeAttribute("aria-describedby"), n = !0), n;
26
26
  }
27
- const V = {
27
+ const B = {
28
28
  STRETCH: "stretch",
29
29
  FIXED: "fixed"
30
- }, dt = {
30
+ }, ht = {
31
31
  mode: "reduced-motion",
32
32
  duration: 200,
33
33
  easing: "ease-out"
34
- }, ye = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', M = {
34
+ }, _e = '<svg viewBox="0 0 16 16" width="12" height="12"><path fill="currentColor" d="M6 10.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5zm-2-3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/></svg>', M = {
35
35
  expand: "▶",
36
36
  collapse: "▼",
37
37
  sortAsc: "▲",
@@ -40,22 +40,22 @@ const V = {
40
40
  submenuArrow: "▶",
41
41
  dragHandle: "⋮⋮",
42
42
  toolPanel: "☰",
43
- filter: ye,
44
- filterActive: ye,
43
+ filter: _e,
44
+ filterActive: _e,
45
45
  print: "🖨️"
46
46
  };
47
- function ht(t) {
47
+ function ut(t) {
48
48
  return Array.from(t.querySelectorAll("tbw-grid-column")).map((i) => {
49
49
  const o = i.getAttribute("field") || "";
50
50
  if (!o) return null;
51
- const n = i.getAttribute("type") || void 0, s = n && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(n) ? n : void 0, l = i.getAttribute("header") || void 0, a = i.hasAttribute("sortable"), c = i.hasAttribute("editable"), d = { field: o, type: s, header: l, sortable: a, editable: c }, u = i.getAttribute("width");
52
- if (u) {
53
- const b = parseFloat(u);
54
- !isNaN(b) && /^\d+(\.\d+)?$/.test(u.trim()) ? d.width = b : d.width = u;
55
- }
56
- const f = i.getAttribute("minWidth") || i.getAttribute("min-width");
51
+ const n = i.getAttribute("type") || void 0, s = n && (/* @__PURE__ */ new Set(["number", "string", "date", "boolean", "select"])).has(n) ? n : void 0, l = i.getAttribute("header") || void 0, a = i.hasAttribute("sortable"), c = i.hasAttribute("editable"), d = { field: o, type: s, header: l, sortable: a, editable: c }, f = i.getAttribute("width");
57
52
  if (f) {
58
53
  const b = parseFloat(f);
54
+ !isNaN(b) && /^\d+(\.\d+)?$/.test(f.trim()) ? d.width = b : d.width = f;
55
+ }
56
+ const u = i.getAttribute("minWidth") || i.getAttribute("min-width");
57
+ if (u) {
58
+ const b = parseFloat(u);
59
59
  isNaN(b) || (d.minWidth = b);
60
60
  }
61
61
  i.hasAttribute("resizable") && (d.resizable = !0), i.hasAttribute("sizable") && (d.resizable = !0);
@@ -68,20 +68,20 @@ function ht(t) {
68
68
  }));
69
69
  const w = i.querySelector("tbw-grid-column-view"), C = i.querySelector("tbw-grid-column-editor"), m = i.querySelector("tbw-grid-column-header");
70
70
  w && (d.__viewTemplate = w), C && (d.__editorTemplate = C), m && (d.__headerTemplate = m);
71
- const E = globalThis.DataGridElement?.getAdapters?.() ?? [], x = w ?? i, v = E.find((b) => b.canHandle(x));
71
+ const S = globalThis.DataGridElement?.getAdapters?.() ?? [], A = w ?? i, v = S.find((b) => b.canHandle(A));
72
72
  if (v) {
73
- const b = v.createRenderer(x);
73
+ const b = v.createRenderer(A);
74
74
  b && (d.viewRenderer = b);
75
75
  }
76
- const S = C ?? i, _ = E.find((b) => b.canHandle(S));
76
+ const E = C ?? i, _ = S.find((b) => b.canHandle(E));
77
77
  if (_) {
78
- const b = _.createEditor(S);
78
+ const b = _.createEditor(E);
79
79
  b && (d.editor = b);
80
80
  }
81
81
  return d;
82
82
  }).filter((i) => !!i);
83
83
  }
84
- function _e(t, e) {
84
+ function Ee(t, e) {
85
85
  if ((!t || !t.length) && (!e || !e.length)) return [];
86
86
  if (!t || !t.length) return e || [];
87
87
  if (!e || !e.length) return t;
@@ -105,7 +105,7 @@ function _e(t, e) {
105
105
  });
106
106
  return Object.keys(i).forEach((n) => o.push(i[n])), o;
107
107
  }
108
- function Ue(t, e) {
108
+ function Ve(t, e) {
109
109
  try {
110
110
  t.part?.add?.(e);
111
111
  } catch {
@@ -113,9 +113,9 @@ function Ue(t, e) {
113
113
  const i = t.getAttribute("part");
114
114
  i ? i.split(/\s+/).includes(e) || t.setAttribute("part", i + " " + e) : t.setAttribute("part", e);
115
115
  }
116
- function Ee(t) {
117
- const e = t.effectiveConfig?.fitMode || t.fitMode || V.STRETCH;
118
- if (e !== V.STRETCH && e !== V.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
116
+ function Se(t) {
117
+ const e = t.effectiveConfig?.fitMode || t.fitMode || B.STRETCH;
118
+ if (e !== B.STRETCH && e !== B.FIXED || t.__didInitialAutoSize || !t.isConnected) return;
119
119
  const i = Array.from(t._headerRowEl?.children || []);
120
120
  if (!i.length) return;
121
121
  let o = !1;
@@ -131,32 +131,32 @@ function Ee(t) {
131
131
  }
132
132
  }
133
133
  l > 0 && (n.width = l + 2, n.__autoSized = !0, o = !0);
134
- }), o && F(t), t.__didInitialAutoSize = !0;
134
+ }), o && U(t), t.__didInitialAutoSize = !0;
135
135
  }
136
- function F(t) {
137
- (t.effectiveConfig?.fitMode || t.fitMode || V.STRETCH) === V.STRETCH ? t._gridTemplate = t._visibleColumns.map((i) => {
136
+ function U(t) {
137
+ (t.effectiveConfig?.fitMode || t.fitMode || B.STRETCH) === B.STRETCH ? t._gridTemplate = t._visibleColumns.map((i) => {
138
138
  if (i.width) return `${i.width}px`;
139
139
  const o = i.minWidth;
140
140
  return o != null ? `minmax(${o}px, 1fr)` : "1fr";
141
141
  }).join(" ").trim() : t._gridTemplate = t._visibleColumns.map((i) => i.width ? `${i.width}px` : "max-content").join(" "), t.style.setProperty("--tbw-column-template", t._gridTemplate);
142
142
  }
143
- function ut(t) {
143
+ function ft(t) {
144
144
  return t == null ? "string" : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t instanceof Date || typeof t == "string" && /\d{4}-\d{2}-\d{2}/.test(t) && !isNaN(Date.parse(t)) ? "date" : "string";
145
145
  }
146
- function ft(t, e) {
146
+ function gt(t, e) {
147
147
  const i = t[0] || {}, o = Object.keys(i).map((r) => {
148
- const s = i[r], l = ut(s);
148
+ const s = i[r], l = ft(s);
149
149
  return { field: r, header: r.charAt(0).toUpperCase() + r.slice(1), type: l };
150
150
  }), n = {};
151
151
  return o.forEach((r) => {
152
152
  n[r.field] = r.type || "string";
153
153
  }), { columns: o, typeMap: n };
154
154
  }
155
- const gt = /{{\s*([^}]+)\s*}}/g, L = "__DG_EMPTY__", pt = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, wt = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
156
- function bt(t) {
155
+ const pt = /{{\s*([^}]+)\s*}}/g, P = "__DG_EMPTY__", wt = /^[\w$. '?+\-*/%:()!<>=,&|]+$/, bt = /__(proto|defineGetter|defineSetter)|constructor|window|globalThis|global|process|Function|import|eval|Reflect|Proxy|Error|arguments|document|location|cookie|localStorage|sessionStorage|indexedDB|fetch|XMLHttpRequest|WebSocket|Worker|SharedWorker|ServiceWorker|opener|parent|top|frames|self|this\b/;
156
+ function mt(t) {
157
157
  return !t || typeof t != "string" ? "" : t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
158
158
  }
159
- const mt = /* @__PURE__ */ new Set([
159
+ const vt = /* @__PURE__ */ new Set([
160
160
  "script",
161
161
  "iframe",
162
162
  "object",
@@ -181,23 +181,23 @@ const mt = /* @__PURE__ */ new Set([
181
181
  "plaintext",
182
182
  "xmp",
183
183
  "listing"
184
- ]), Se = /^on\w+$/i, vt = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), Ct = /^\s*(javascript|vbscript|data|blob):/i;
185
- function q(t) {
184
+ ]), Re = /^on\w+$/i, Ct = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "data", "srcdoc", "xlink:href", "poster", "srcset"]), yt = /^\s*(javascript|vbscript|data|blob):/i;
185
+ function $(t) {
186
186
  if (!t || typeof t != "string") return "";
187
187
  if (t.indexOf("<") === -1) return t;
188
188
  const e = document.createElement("template");
189
- return e.innerHTML = t, yt(e.content), e.innerHTML;
189
+ return e.innerHTML = t, _t(e.content), e.innerHTML;
190
190
  }
191
- function yt(t) {
191
+ function _t(t) {
192
192
  const e = [], i = t.querySelectorAll("*");
193
193
  for (const o of i) {
194
194
  const n = o.tagName.toLowerCase();
195
- if (mt.has(n)) {
195
+ if (vt.has(n)) {
196
196
  e.push(o);
197
197
  continue;
198
198
  }
199
199
  if ((n === "svg" || o.namespaceURI === "http://www.w3.org/2000/svg") && Array.from(o.attributes).some(
200
- (l) => Se.test(l.name) || l.name === "href" || l.name === "xlink:href"
200
+ (l) => Re.test(l.name) || l.name === "href" || l.name === "xlink:href"
201
201
  )) {
202
202
  e.push(o);
203
203
  continue;
@@ -205,11 +205,11 @@ function yt(t) {
205
205
  const r = [];
206
206
  for (const s of o.attributes) {
207
207
  const l = s.name.toLowerCase();
208
- if (Se.test(l)) {
208
+ if (Re.test(l)) {
209
209
  r.push(s.name);
210
210
  continue;
211
211
  }
212
- if (vt.has(l) && Ct.test(s.value)) {
212
+ if (Ct.has(l) && yt.test(s.value)) {
213
213
  r.push(s.name);
214
214
  continue;
215
215
  }
@@ -222,52 +222,48 @@ function yt(t) {
222
222
  }
223
223
  e.forEach((o) => o.remove());
224
224
  }
225
- function Ve(t, e) {
225
+ function Be(t, e) {
226
226
  if (!t || t.indexOf("{{") === -1) return t;
227
- const i = [], o = t.replace(gt, (l, a) => {
228
- const c = _t(a, e);
227
+ const i = [], o = t.replace(pt, (l, a) => {
228
+ const c = Et(a, e);
229
229
  return i.push({ expr: a.trim(), result: c }), c;
230
- }), n = Et(o), r = i.length && i.every((l) => l.result === "" || l.result === L);
231
- return /Reflect\.|\bProxy\b|ownKeys\(/.test(t) || r ? "" : n;
230
+ }), n = St(o), r = i.length && i.every((l) => l.result === "" || l.result === P);
231
+ return I.test(t) || r ? "" : n;
232
232
  }
233
- function _t(t, e) {
234
- if (t = (t || "").trim(), !t || /\b(Reflect|Proxy|ownKeys)\b/.test(t)) return L;
235
- if (t === "value") return e.value == null ? L : String(e.value);
233
+ function Et(t, e) {
234
+ if (t = (t || "").trim(), !t || I.test(t)) return P;
235
+ if (t === "value") return e.value == null ? P : String(e.value);
236
236
  if (t.startsWith("row.") && !/[()?]/.test(t) && !t.includes(":")) {
237
237
  const o = t.slice(4), n = e.row ? e.row[o] : void 0;
238
- return n == null ? L : String(n);
238
+ return n == null ? P : String(n);
239
239
  }
240
- if (t.length > 80 || !pt.test(t) || wt.test(t)) return L;
240
+ if (t.length > 80 || !wt.test(t) || bt.test(t)) return P;
241
241
  const i = t.match(/\./g);
242
- if (i && i.length > 1) return L;
242
+ if (i && i.length > 1) return P;
243
243
  try {
244
244
  const n = new Function("value", "row", `return (${t});`)(e.value, e.row), r = n == null ? "" : String(n);
245
- return /Reflect|Proxy|ownKeys/.test(r) ? L : r || L;
245
+ return I.test(r) ? P : r || P;
246
246
  } catch {
247
- return L;
247
+ return P;
248
248
  }
249
249
  }
250
- function Et(t) {
251
- return t && t.replace(new RegExp(L, "g"), "").replace(/Reflect\.[^<>{}\s]+/g, "").replace(/\bProxy\b/g, "").replace(/ownKeys\([^)]*\)/g, "");
252
- }
250
+ const I = /Reflect|Proxy|ownKeys/;
253
251
  function St(t) {
254
- if (/Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
255
- if (Array.from(t.childNodes).forEach((e) => {
256
- e.nodeType === Node.TEXT_NODE && /Reflect|Proxy|ownKeys/.test(e.textContent || "") && (e.textContent = "");
257
- }), /Reflect|Proxy|ownKeys/.test(t.textContent || "")) {
258
- if (/Reflect|Proxy|ownKeys/.test(t.textContent || ""))
259
- for (; t.firstChild; ) t.removeChild(t.firstChild);
260
- t.textContent = (t.textContent || "").replace(/Reflect|Proxy|ownKeys/g, "");
261
- }
262
- (t.textContent || "").trim().length === 0 && (t.textContent = "");
252
+ return t && t.replace(new RegExp(P, "g"), "").replace(/Reflect\.[^<>{}\s]+|\bProxy\b|ownKeys\([^)]*\)/g, "");
253
+ }
254
+ function Rt(t) {
255
+ if (I.test(t.textContent || "")) {
256
+ for (const e of t.childNodes)
257
+ e.nodeType === Node.TEXT_NODE && I.test(e.textContent || "") && (e.textContent = "");
258
+ I.test(t.textContent || "") && (t.textContent = "");
263
259
  }
264
260
  }
265
- function Re(t) {
266
- const e = /Reflect\.|\bProxy\b|ownKeys\(/.test(t), i = ((o) => e ? "" : Ve(t, o));
261
+ function Ae(t) {
262
+ const e = I.test(t), i = ((o) => e ? "" : Be(t, o));
267
263
  return i.__blocked = e, i;
268
264
  }
269
- const Rt = 100;
270
- class xt {
265
+ const At = 100;
266
+ class Tt {
271
267
  #l;
272
268
  #n;
273
269
  #u;
@@ -350,9 +346,9 @@ class xt {
350
346
  if (!this.#f && e)
351
347
  return;
352
348
  const i = this.#k();
353
- this.#f = !1, this.#a = i, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#o = this.#A(this.#a), this.#m();
349
+ this.#f = !1, this.#a = i, Object.freeze(this.#a), this.#a.columns && Object.freeze(this.#a.columns), this.#o = this.#T(this.#a), this.#m();
354
350
  }
355
- #A(e) {
351
+ #T(e) {
356
352
  const i = { ...e };
357
353
  return e.columns && (i.columns = e.columns.map((o) => ({ ...o }))), e.shell && (i.shell = {
358
354
  ...e.shell,
@@ -382,19 +378,19 @@ class xt {
382
378
  const e = this.#l ? { ...this.#l } : {}, i = Array.isArray(e.columns) ? [...e.columns] : [], o = (this.#d ?? []).map((s) => ({
383
379
  ...s
384
380
  }));
385
- let n = _e(
381
+ let n = Ee(
386
382
  i,
387
383
  o
388
384
  );
389
- this.#n && this.#n.length && (n = _e(
385
+ this.#n && this.#n.length && (n = Ee(
390
386
  this.#n,
391
387
  o
392
388
  ));
393
389
  const r = this.#r.getRows();
394
- return n.length === 0 && r.length && (n = ft(r).columns), n.length && (n.forEach((s) => {
390
+ return n.length === 0 && r.length && (n = gt(r).columns), n.length && (n.forEach((s) => {
395
391
  s.sortable === void 0 && (s.sortable = !0), s.resizable === void 0 && (s.resizable = !0), s.__originalWidth === void 0 && typeof s.width == "number" && (s.__originalWidth = s.width);
396
392
  }), n.forEach((s) => {
397
- s.__viewTemplate && !s.__compiledView && (s.__compiledView = Re(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = Re(s.__editorTemplate.innerHTML));
393
+ s.__viewTemplate && !s.__compiledView && (s.__compiledView = Ae(s.__viewTemplate.innerHTML)), s.__editorTemplate && !s.__compiledEditor && (s.__compiledEditor = Ae(s.__editorTemplate.innerHTML));
398
394
  }), e.columns = n), this.#u && (e.fitMode = this.#u), e.fitMode || (e.fitMode = "stretch"), this.#b(e), e.columnState && !this.#C && (this.#C = e.columnState), e;
399
395
  }
400
396
  #b(e) {
@@ -405,18 +401,18 @@ class xt {
405
401
  o?.length > 0 && (e.shell.header.lightDomContent = o), this.#r.getShellHasToolButtonsContainer() && (e.shell.header.hasToolButtonsContainer = !0);
406
402
  const n = this.#r.getShellToolPanels();
407
403
  if (n.size > 0) {
408
- const u = Array.from(n.values());
409
- u.sort((f, g) => (f.order ?? 100) - (g.order ?? 100)), e.shell.toolPanels = u;
404
+ const f = Array.from(n.values());
405
+ f.sort((u, g) => (u.order ?? 100) - (g.order ?? 100)), e.shell.toolPanels = f;
410
406
  }
411
407
  const r = this.#r.getShellHeaderContents();
412
408
  if (r.size > 0) {
413
- const u = Array.from(r.values());
414
- u.sort((f, g) => (f.order ?? 100) - (g.order ?? 100)), e.shell.headerContents = u;
409
+ const f = Array.from(r.values());
410
+ f.sort((u, g) => (u.order ?? 100) - (g.order ?? 100)), e.shell.headerContents = f;
415
411
  }
416
- const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((u) => u.id)), d = [...a];
417
- for (const u of l)
418
- c.has(u.id) || d.push(u);
419
- d.sort((u, f) => (u.order ?? 0) - (f.order ?? 0)), e.shell.header.toolbarContents = d;
412
+ const s = this.#r.getShellToolbarContents(), l = Array.from(s.values()), a = this.#l?.shell?.header?.toolbarContents ?? [], c = new Set(a.map((f) => f.id)), d = [...a];
413
+ for (const f of l)
414
+ c.has(f.id) || d.push(f);
415
+ d.sort((f, u) => (f.order ?? 0) - (u.order ?? 0)), e.shell.header.toolbarContents = d;
420
416
  }
421
417
  collectState(e) {
422
418
  const i = this.columns, o = this.#y();
@@ -466,7 +462,7 @@ class xt {
466
462
  l.applyColumnState(a.field, a);
467
463
  }
468
464
  resetState(e) {
469
- this.#C = void 0, this.#r.setSortState(null), this.#o = this.#A(this.#a), this.#m();
465
+ this.#C = void 0, this.#r.setSortState(null), this.#o = this.#T(this.#a), this.#m();
470
466
  for (const i of e)
471
467
  if (i.applyColumnState)
472
468
  for (const o of this.columns)
@@ -489,7 +485,7 @@ class xt {
489
485
  this.#s = void 0;
490
486
  const i = this.collectState(e);
491
487
  this.#r.emit("column-state-change", i);
492
- }, Rt);
488
+ }, At);
493
489
  }
494
490
  setColumnVisible(e, i) {
495
491
  const o = this.columns, n = o.find((s) => s.field === e);
@@ -537,7 +533,7 @@ class xt {
537
533
  this.columns = o, this.#r.renderHeader(), this.#r.updateTemplate(), this.#r.refreshVirtualWindow();
538
534
  }
539
535
  parseLightDomColumns(e) {
540
- this.#d || (this.#h = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#h.length ? ht(e) : []);
536
+ this.#d || (this.#h = Array.from(e.querySelectorAll("tbw-grid-column")), this.#d = this.#h.length ? ut(e) : []);
541
537
  }
542
538
  clearLightDomCache() {
543
539
  this.#d = void 0;
@@ -590,7 +586,7 @@ class xt {
590
586
  this.#v?.disconnect(), this.#w = [], this.#s && clearTimeout(this.#s);
591
587
  }
592
588
  }
593
- function be() {
589
+ function me() {
594
590
  if (typeof window < "u" && window.location) {
595
591
  const t = window.location.hostname;
596
592
  if (t === "localhost" || t === "127.0.0.1" || t === "::1")
@@ -601,7 +597,7 @@ function be() {
601
597
  function Ge(t) {
602
598
  return `<span role="checkbox" aria-checked="${t}" aria-label="${t}">${t ? "&#x1F5F9;" : "&#9744;"}</span>`;
603
599
  }
604
- function Be(t) {
600
+ function Xe(t) {
605
601
  if (t == null || t === "") return "";
606
602
  if (t instanceof Date)
607
603
  return isNaN(t.getTime()) ? "" : t.toLocaleDateString();
@@ -611,7 +607,7 @@ function Be(t) {
611
607
  }
612
608
  return "";
613
609
  }
614
- function Xe(t) {
610
+ function Ye(t) {
615
611
  if (!t) return -1;
616
612
  const e = t.getAttribute("data-row");
617
613
  if (e) return parseInt(e, 10);
@@ -624,15 +620,15 @@ function Xe(t) {
624
620
  if (n[r] === i) return r;
625
621
  return -1;
626
622
  }
627
- function At(t) {
623
+ function xt(t) {
628
624
  if (!t) return -1;
629
625
  const e = t.getAttribute("data-col");
630
626
  return e ? parseInt(e, 10) : -1;
631
627
  }
632
- function me(t) {
628
+ function ve(t) {
633
629
  t && t.querySelectorAll(".cell-focus").forEach((e) => e.classList.remove("cell-focus"));
634
630
  }
635
- function Tt(t) {
631
+ function Ht(t) {
636
632
  try {
637
633
  if (getComputedStyle(t).direction === "rtl") return "rtl";
638
634
  } catch {
@@ -643,13 +639,13 @@ function Tt(t) {
643
639
  }
644
640
  return "ltr";
645
641
  }
646
- function xe(t) {
647
- return Tt(t) === "rtl";
642
+ function Te(t) {
643
+ return Ht(t) === "rtl";
648
644
  }
649
- function Ji(t, e) {
645
+ function eo(t, e) {
650
646
  return t === "left" || t === "right" ? t : e === "rtl" ? t === "start" ? "right" : "left" : t === "start" ? "left" : "right";
651
647
  }
652
- function Ye(t, e) {
648
+ function je(t, e) {
653
649
  const i = e.renderer || e.viewRenderer;
654
650
  if (i) return i;
655
651
  if (!e.type) return;
@@ -660,7 +656,7 @@ function Ye(t, e) {
660
656
  return n.renderer;
661
657
  }
662
658
  }
663
- function je(t, e) {
659
+ function Ke(t, e) {
664
660
  if (e.format) return e.format;
665
661
  if (!e.type) return;
666
662
  const i = t.__frameworkAdapter;
@@ -670,122 +666,122 @@ function je(t, e) {
670
666
  return o.format;
671
667
  }
672
668
  }
673
- const Ke = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
674
- function ne(t) {
669
+ const Qe = 'input,select,textarea,[contenteditable="true"],[contenteditable=""],[tabindex]:not([tabindex="-1"])';
670
+ function re(t) {
675
671
  return (t.__editingCellCount ?? 0) > 0;
676
672
  }
677
- function re(t) {
673
+ function se(t) {
678
674
  t.__editingCellCount = 0, t.removeAttribute("data-has-editing"), t.querySelectorAll(".cell.editing").forEach((i) => i.classList.remove("editing"));
679
675
  }
680
- const Qe = document.createElement("template");
681
- Qe.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
682
676
  const Ze = document.createElement("template");
683
- Ze.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
684
- function Ht() {
685
- return Qe.content.firstElementChild.cloneNode(!0);
677
+ Ze.innerHTML = '<div class="cell" role="gridcell" part="cell"></div>';
678
+ const Je = document.createElement("template");
679
+ Je.innerHTML = '<div class="data-grid-row" role="row" part="row"></div>';
680
+ function Lt() {
681
+ return Ze.content.firstElementChild.cloneNode(!0);
686
682
  }
687
683
  function Pt() {
688
- return Ze.content.firstElementChild.cloneNode(!0);
684
+ return Je.content.firstElementChild.cloneNode(!0);
689
685
  }
690
- function B(t) {
686
+ function X(t) {
691
687
  t.__cellDisplayCache = void 0, t.__cellCacheEpoch = void 0, t.__hasSpecialColumns = void 0;
692
688
  }
693
- function Lt(t, e, i, o, n) {
689
+ function zt(t, e, i, o, n) {
694
690
  const r = Math.max(0, i - e), s = t._bodyEl, l = t._visibleColumns, a = l.length;
695
691
  let c = t.__cachedHeaderRowCount;
696
692
  for (c === void 0 && (c = t.querySelector(".header-group-row") ? 2 : 1, t.__cachedHeaderRowCount = c); t._rowPool.length < r; ) {
697
- const f = Pt();
698
- t._rowPool.push(f);
693
+ const u = Pt();
694
+ t._rowPool.push(u);
699
695
  }
700
696
  if (t._rowPool.length > r) {
701
- for (let f = r; f < t._rowPool.length; f++) {
702
- const g = t._rowPool[f];
697
+ for (let u = r; u < t._rowPool.length; u++) {
698
+ const g = t._rowPool[u];
703
699
  g.parentNode === s && g.remove();
704
700
  }
705
701
  t._rowPool.length = r;
706
702
  }
707
- const d = n && t.__hasRenderRowPlugins !== !1, u = t._hasAfterRowRenderHook?.() ?? !1;
708
- for (let f = 0; f < r; f++) {
709
- const g = e + f, p = t._rows[g], h = t._rowPool[f];
703
+ const d = n && t.__hasRenderRowPlugins !== !1, f = t._hasAfterRowRenderHook?.() ?? !1;
704
+ for (let u = 0; u < r; u++) {
705
+ const g = e + u, p = t._rows[g], h = t._rowPool[u];
710
706
  if (h.setAttribute("aria-rowindex", String(g + c + 1)), d && n(p, h, g)) {
711
707
  h.__epoch = o, h.__rowDataRef = p, h.parentNode !== s && s.appendChild(h);
712
708
  continue;
713
709
  }
714
- const w = h.__epoch, C = h.__rowDataRef, m = h.children.length, E = w === o && m === a, x = C !== p;
710
+ const w = h.__epoch, C = h.__rowDataRef, m = h.children.length, S = w === o && m === a, A = C !== p;
715
711
  let v = !1;
716
- if (E && x) {
712
+ if (S && A) {
717
713
  for (let R = 0; R < a; R++)
718
714
  if (l[R].externalView && !h.querySelector(`.cell[data-col="${R}"] [data-external-view]`)) {
719
715
  v = !0;
720
716
  break;
721
717
  }
722
718
  }
723
- if (!E || v) {
724
- const R = ne(h), A = t._activeEditRows === g;
725
- R && !A ? (h.__isCustomRow && (h.className = "data-grid-row", h.setAttribute("role", "row"), h.__isCustomRow = !1), re(h), U(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : R && A ? (se(t, h, p, g), h.__rowDataRef = p) : (h.__isCustomRow && (h.className = "data-grid-row", h.setAttribute("role", "row"), h.__isCustomRow = !1), U(t, h, p, g), h.__epoch = o, h.__rowDataRef = p);
726
- } else if (x) {
727
- const R = ne(h), A = t._activeEditRows === g;
728
- R && !A ? (re(h), U(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : (se(t, h, p, g), h.__rowDataRef = p);
719
+ if (!S || v) {
720
+ const R = re(h), T = t._activeEditRows === g;
721
+ R && !T ? (h.__isCustomRow && (h.className = "data-grid-row", h.setAttribute("role", "row"), h.__isCustomRow = !1), se(h), V(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : R && T ? (le(t, h, p, g), h.__rowDataRef = p) : (h.__isCustomRow && (h.className = "data-grid-row", h.setAttribute("role", "row"), h.__isCustomRow = !1), V(t, h, p, g), h.__epoch = o, h.__rowDataRef = p);
722
+ } else if (A) {
723
+ const R = re(h), T = t._activeEditRows === g;
724
+ R && !T ? (se(h), V(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : (le(t, h, p, g), h.__rowDataRef = p);
729
725
  } else {
730
- const R = ne(h), A = t._activeEditRows === g;
731
- R && !A ? (re(h), U(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : se(t, h, p, g);
726
+ const R = re(h), T = t._activeEditRows === g;
727
+ R && !T ? (se(h), V(t, h, p, g), h.__epoch = o, h.__rowDataRef = p) : le(t, h, p, g);
732
728
  }
733
- let S = !1;
729
+ let E = !1;
734
730
  const _ = t.changedRowIds;
735
731
  if (_ && _.length > 0)
736
732
  try {
737
733
  const R = t.getRowId?.(p);
738
- R && (S = _.includes(R));
734
+ R && (E = _.includes(R));
739
735
  } catch {
740
736
  }
741
737
  const b = h.classList.contains("changed");
742
- S !== b && h.classList.toggle("changed", S);
738
+ E !== b && h.classList.toggle("changed", E);
743
739
  const O = t.effectiveConfig?.rowClass;
744
740
  if (O) {
745
741
  const R = h.getAttribute("data-dynamic-classes");
746
- R && R.split(" ").forEach((A) => A && h.classList.remove(A));
742
+ R && R.split(" ").forEach((T) => T && h.classList.remove(T));
747
743
  try {
748
- const A = O(p);
749
- if (A && A.length > 0) {
750
- const oe = A.filter((G) => G && typeof G == "string");
751
- oe.forEach((G) => h.classList.add(G)), h.setAttribute("data-dynamic-classes", oe.join(" "));
744
+ const T = O(p);
745
+ if (T && T.length > 0) {
746
+ const ne = T.filter((G) => G && typeof G == "string");
747
+ ne.forEach((G) => h.classList.add(G)), h.setAttribute("data-dynamic-classes", ne.join(" "));
752
748
  } else
753
749
  h.removeAttribute("data-dynamic-classes");
754
- } catch (A) {
755
- console.warn("[tbw-grid] rowClass callback error:", A), h.removeAttribute("data-dynamic-classes");
750
+ } catch (T) {
751
+ console.warn("[tbw-grid] rowClass callback error:", T), h.removeAttribute("data-dynamic-classes");
756
752
  }
757
753
  }
758
- u && t._afterRowRender?.({
754
+ f && t._afterRowRender?.({
759
755
  row: p,
760
756
  rowIndex: g,
761
757
  rowElement: h
762
758
  }), h.parentNode !== s && s.appendChild(h);
763
759
  }
764
760
  }
765
- function se(t, e, i, o) {
766
- const n = e.children, r = t._visibleColumns, s = r.length, l = n.length, a = s < l ? s : l, c = t._focusRow, d = t._focusCol, u = t._hasAfterCellRenderHook?.() ?? !1;
767
- let f = t.__hasSpecialColumns;
768
- if (f === void 0) {
769
- f = !1;
761
+ function le(t, e, i, o) {
762
+ const n = e.children, r = t._visibleColumns, s = r.length, l = n.length, a = s < l ? s : l, c = t._focusRow, d = t._focusCol, f = t._hasAfterCellRenderHook?.() ?? !1;
763
+ let u = t.__hasSpecialColumns;
764
+ if (u === void 0) {
765
+ u = !1;
770
766
  const p = t.__frameworkAdapter;
771
767
  for (let h = 0; h < s; h++) {
772
768
  const w = r[h];
773
769
  if (w.__viewTemplate || w.__compiledView || w.renderer || w.viewRenderer || w.externalView || w.format || w.type === "date" || w.type === "boolean" || w.type && p?.getTypeDefault?.(w.type)?.renderer || w.type && p?.getTypeDefault?.(w.type)?.format) {
774
- f = !0;
770
+ u = !0;
775
771
  break;
776
772
  }
777
773
  }
778
- t.__hasSpecialColumns = f;
774
+ t.__hasSpecialColumns = u;
779
775
  }
780
776
  const g = String(o);
781
- if (!f) {
777
+ if (!u) {
782
778
  for (let p = 0; p < a; p++) {
783
779
  const h = n[p];
784
780
  if (h.classList.contains("editing")) continue;
785
781
  const w = r[p], C = i[w.field];
786
782
  h.textContent = C == null ? "" : String(C), h.getAttribute("data-row") !== g && h.setAttribute("data-row", g);
787
783
  const m = c === o && d === p, y = h.classList.contains("cell-focus");
788
- m !== y && (h.classList.toggle("cell-focus", m), h.setAttribute("aria-selected", String(m))), u && t._afterCellRender?.({
784
+ m !== y && (h.classList.toggle("cell-focus", m), h.setAttribute("aria-selected", String(m))), f && t._afterCellRender?.({
789
785
  row: i,
790
786
  rowIndex: o,
791
787
  column: w,
@@ -799,7 +795,7 @@ function se(t, e, i, o) {
799
795
  }
800
796
  for (let p = 0; p < a; p++)
801
797
  if (r[p].externalView && !n[p].querySelector("[data-external-view]")) {
802
- U(t, e, i, o);
798
+ V(t, e, i, o);
803
799
  return;
804
800
  }
805
801
  for (let p = 0; p < a; p++) {
@@ -814,8 +810,8 @@ function se(t, e, i, o) {
814
810
  try {
815
811
  const b = i[h.field], O = y(b, i, h);
816
812
  if (O && O.length > 0) {
817
- const R = O.filter((A) => A && typeof A == "string");
818
- R.forEach((A) => w.classList.add(A)), w.setAttribute("data-dynamic-classes", R.join(" "));
813
+ const R = O.filter((T) => T && typeof T == "string");
814
+ R.forEach((T) => w.classList.add(T)), w.setAttribute("data-dynamic-classes", R.join(" "));
819
815
  } else
820
816
  w.removeAttribute("data-dynamic-classes");
821
817
  } catch (b) {
@@ -823,16 +819,16 @@ function se(t, e, i, o) {
823
819
  }
824
820
  }
825
821
  if (w.classList.contains("editing")) continue;
826
- const E = Ye(t, h);
827
- if (E) {
828
- const _ = i[h.field], b = E({
822
+ const S = je(t, h);
823
+ if (S) {
824
+ const _ = i[h.field], b = S({
829
825
  row: i,
830
826
  value: _,
831
827
  field: h.field,
832
828
  column: h,
833
829
  cellEl: w
834
830
  });
835
- typeof b == "string" ? w.innerHTML = q(b) : b instanceof Node ? b.parentElement !== w && (w.innerHTML = "", w.appendChild(b)) : b == null && (w.textContent = _ == null ? "" : String(_)), u && t._afterCellRender?.({
831
+ typeof b == "string" ? w.innerHTML = $(b) : b instanceof Node ? b.parentElement !== w && (w.innerHTML = "", w.appendChild(b)) : b == null && (w.textContent = _ == null ? "" : String(_)), f && t._afterCellRender?.({
836
832
  row: i,
837
833
  rowIndex: o,
838
834
  column: h,
@@ -845,57 +841,57 @@ function se(t, e, i, o) {
845
841
  }
846
842
  if (h.__viewTemplate || h.__compiledView || h.externalView)
847
843
  continue;
848
- const x = i[h.field];
844
+ const A = i[h.field];
849
845
  let v;
850
- const S = je(t, h);
851
- if (S) {
846
+ const E = Ke(t, h);
847
+ if (E) {
852
848
  try {
853
- const _ = S(x, i);
849
+ const _ = E(A, i);
854
850
  v = _ == null ? "" : String(_);
855
851
  } catch (_) {
856
- console.warn(`[tbw-grid] Format error in column '${h.field}':`, _), v = x == null ? "" : String(x);
852
+ console.warn(`[tbw-grid] Format error in column '${h.field}':`, _), v = A == null ? "" : String(A);
857
853
  }
858
854
  w.textContent = v;
859
- } else h.type === "date" ? (v = Be(x), w.textContent = v) : h.type === "boolean" ? w.innerHTML = Ge(!!x) : (v = x == null ? "" : String(x), w.textContent = v);
860
- u && t._afterCellRender?.({
855
+ } else h.type === "date" ? (v = Xe(A), w.textContent = v) : h.type === "boolean" ? w.innerHTML = Ge(!!A) : (v = A == null ? "" : String(A), w.textContent = v);
856
+ f && t._afterCellRender?.({
861
857
  row: i,
862
858
  rowIndex: o,
863
859
  column: h,
864
860
  colIndex: p,
865
- value: x,
861
+ value: A,
866
862
  cellElement: w,
867
863
  rowElement: e
868
864
  });
869
865
  }
870
866
  }
871
- function U(t, e, i, o) {
867
+ function V(t, e, i, o) {
872
868
  e.innerHTML = "";
873
869
  const n = t._visibleColumns, r = n.length, s = t._focusRow, l = t._focusCol, a = t, c = t._hasAfterCellRenderHook?.() ?? !1, d = document.createDocumentFragment();
874
- for (let u = 0; u < r; u++) {
875
- const f = n[u], g = Ht();
876
- g.setAttribute("aria-colindex", String(u + 1)), g.setAttribute("data-col", String(u)), g.setAttribute("data-row", String(o)), g.setAttribute("data-field", f.field), g.setAttribute("data-header", f.header ?? f.field), f.type && g.setAttribute("data-type", f.type);
877
- let p = i[f.field];
878
- const h = je(t, f);
870
+ for (let f = 0; f < r; f++) {
871
+ const u = n[f], g = Lt();
872
+ g.setAttribute("aria-colindex", String(f + 1)), g.setAttribute("data-col", String(f)), g.setAttribute("data-row", String(o)), g.setAttribute("data-field", u.field), g.setAttribute("data-header", u.header ?? u.field), u.type && g.setAttribute("data-type", u.type);
873
+ let p = i[u.field];
874
+ const h = Ke(t, u);
879
875
  if (h)
880
876
  try {
881
877
  p = h(p, i);
882
878
  } catch (v) {
883
- console.warn(`[tbw-grid] Format error in column '${f.field}':`, v);
879
+ console.warn(`[tbw-grid] Format error in column '${u.field}':`, v);
884
880
  }
885
- const w = f.__compiledView, C = f.__viewTemplate, m = Ye(t, f), y = f.externalView;
886
- let E = !1;
881
+ const w = u.__compiledView, C = u.__viewTemplate, m = je(t, u), y = u.externalView;
882
+ let S = !1;
887
883
  if (m) {
888
- const v = m({ row: i, value: p, field: f.field, column: f, cellEl: g });
889
- typeof v == "string" ? (g.innerHTML = q(v), E = !0) : v instanceof Node ? v.parentElement !== g && (g.textContent = "", g.appendChild(v)) : v == null && (g.textContent = p == null ? "" : String(p));
884
+ const v = m({ row: i, value: p, field: u.field, column: u, cellEl: g });
885
+ typeof v == "string" ? (g.innerHTML = $(v), S = !0) : v instanceof Node ? v.parentElement !== g && (g.textContent = "", g.appendChild(v)) : v == null && (g.textContent = p == null ? "" : String(p));
890
886
  } else if (y) {
891
- const v = y, S = document.createElement("div");
892
- S.setAttribute("data-external-view", ""), S.setAttribute("data-field", f.field), g.appendChild(S);
893
- const _ = { row: i, value: p, field: f.field, column: f };
887
+ const v = y, E = document.createElement("div");
888
+ E.setAttribute("data-external-view", ""), E.setAttribute("data-field", u.field), g.appendChild(E);
889
+ const _ = { row: i, value: p, field: u.field, column: u };
894
890
  if (v.mount)
895
891
  try {
896
- v.mount({ placeholder: S, context: _, spec: v });
892
+ v.mount({ placeholder: E, context: _, spec: v });
897
893
  } catch (b) {
898
- console.warn(`[tbw-grid] External view mount error for column '${f.field}':`, b);
894
+ console.warn(`[tbw-grid] External view mount error for column '${u.field}':`, b);
899
895
  }
900
896
  else
901
897
  queueMicrotask(() => {
@@ -904,44 +900,44 @@ function U(t, e, i, o) {
904
900
  new CustomEvent("mount-external-view", {
905
901
  bubbles: !0,
906
902
  composed: !0,
907
- detail: { placeholder: S, spec: v, context: _ }
903
+ detail: { placeholder: E, spec: v, context: _ }
908
904
  })
909
905
  );
910
906
  } catch (b) {
911
- console.warn(`[tbw-grid] External view event dispatch error for column '${f.field}':`, b);
907
+ console.warn(`[tbw-grid] External view event dispatch error for column '${u.field}':`, b);
912
908
  }
913
909
  });
914
- S.setAttribute("data-mounted", "");
910
+ E.setAttribute("data-mounted", "");
915
911
  } else if (w) {
916
- const v = w({ row: i, value: p, field: f.field, column: f }), S = w.__blocked;
917
- g.innerHTML = S ? "" : q(v), E = !0, S && (g.textContent = "", g.setAttribute("data-blocked-template", ""));
912
+ const v = w({ row: i, value: p, field: u.field, column: u }), E = w.__blocked;
913
+ g.innerHTML = E ? "" : $(v), S = !0, E && (g.textContent = "", g.setAttribute("data-blocked-template", ""));
918
914
  } else if (C) {
919
915
  const v = C.innerHTML;
920
- /Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (g.textContent = "", g.setAttribute("data-blocked-template", "")) : (g.innerHTML = q(Ve(v, { row: i, value: p })), E = !0);
916
+ /Reflect\.|\bProxy\b|ownKeys\(/.test(v) ? (g.textContent = "", g.setAttribute("data-blocked-template", "")) : (g.innerHTML = $(Be(v, { row: i, value: p })), S = !0);
921
917
  } else
922
- h ? g.textContent = p == null ? "" : String(p) : f.type === "date" ? g.textContent = Be(p) : f.type === "boolean" ? g.innerHTML = Ge(!!p) : g.textContent = p == null ? "" : String(p);
923
- if (E) {
924
- St(g);
918
+ h ? g.textContent = p == null ? "" : String(p) : u.type === "date" ? g.textContent = Xe(p) : u.type === "boolean" ? g.innerHTML = Ge(!!p) : g.textContent = p == null ? "" : String(p);
919
+ if (S) {
920
+ Rt(g);
925
921
  const v = g.textContent || "";
926
922
  /Proxy|Reflect\.ownKeys/.test(v) && (g.textContent = v.replace(/Proxy|Reflect\.ownKeys/g, "").trim(), /Proxy|Reflect\.ownKeys/.test(g.textContent || "") && (g.textContent = ""));
927
923
  }
928
- g.hasAttribute("data-blocked-template") && (g.textContent || "").trim().length && (g.textContent = ""), f.editable ? g.tabIndex = 0 : f.type === "boolean" && (g.hasAttribute("tabindex") || (g.tabIndex = 0)), s === o && l === u ? (g.classList.add("cell-focus"), g.setAttribute("aria-selected", "true")) : g.setAttribute("aria-selected", "false");
929
- const x = f.cellClass;
930
- if (x)
924
+ g.hasAttribute("data-blocked-template") && (g.textContent || "").trim().length && (g.textContent = ""), u.editable ? g.tabIndex = 0 : u.type === "boolean" && (g.hasAttribute("tabindex") || (g.tabIndex = 0)), s === o && l === f ? (g.classList.add("cell-focus"), g.setAttribute("aria-selected", "true")) : g.setAttribute("aria-selected", "false");
925
+ const A = u.cellClass;
926
+ if (A)
931
927
  try {
932
- const v = i[f.field], S = x(v, i, f);
933
- if (S && S.length > 0) {
934
- const _ = S.filter((b) => b && typeof b == "string");
928
+ const v = i[u.field], E = A(v, i, u);
929
+ if (E && E.length > 0) {
930
+ const _ = E.filter((b) => b && typeof b == "string");
935
931
  _.forEach((b) => g.classList.add(b)), g.setAttribute("data-dynamic-classes", _.join(" "));
936
932
  }
937
933
  } catch (v) {
938
- console.warn(`[tbw-grid] cellClass callback error for column '${f.field}':`, v);
934
+ console.warn(`[tbw-grid] cellClass callback error for column '${u.field}':`, v);
939
935
  }
940
936
  c && t._afterCellRender?.({
941
937
  row: i,
942
938
  rowIndex: o,
943
- column: f,
944
- colIndex: u,
939
+ column: u,
940
+ colIndex: f,
945
941
  value: p,
946
942
  cellElement: g,
947
943
  rowElement: e
@@ -949,9 +945,9 @@ function U(t, e, i, o) {
949
945
  }
950
946
  e.appendChild(d);
951
947
  }
952
- function Ae(t, e, i) {
948
+ function xe(t, e, i) {
953
949
  if (e.target?.closest(".resize-handle")) return;
954
- const o = i.querySelector(".cell[data-row]"), n = Xe(o);
950
+ const o = i.querySelector(".cell[data-row]"), n = Ye(o);
955
951
  if (n < 0) return;
956
952
  const r = t._rows[n];
957
953
  if (!r || t._dispatchRowClick?.(e, n, r, i))
@@ -964,30 +960,30 @@ function Ae(t, e, i) {
964
960
  return;
965
961
  const a = t._focusRow !== n || t._focusCol !== l;
966
962
  if (t._focusRow = n, t._focusCol = l, s.classList.contains("editing")) {
967
- a && (me(t._bodyEl ?? t), s.classList.add("cell-focus"));
968
- const c = s.querySelector(Ke);
963
+ a && (ve(t._bodyEl ?? t), s.classList.add("cell-focus"));
964
+ const c = s.querySelector(Qe);
969
965
  try {
970
966
  c?.focus({ preventScroll: !0 });
971
967
  } catch {
972
968
  }
973
969
  return;
974
970
  }
975
- I(t);
971
+ q(t);
976
972
  }
977
973
  }
978
974
  }
979
- function zt(t, e) {
975
+ function Dt(t, e) {
980
976
  if (t._dispatchKeyDown?.(e))
981
977
  return;
982
978
  const i = t._rows.length - 1, o = t._visibleColumns.length - 1, n = t._activeEditRows !== void 0 && t._activeEditRows !== -1, s = t._visibleColumns[t._focusCol]?.type, l = e.composedPath?.() ?? [], a = l.length ? l[0] : e.target, c = (d) => {
983
979
  if (!d) return !1;
984
- const u = d.tagName;
985
- return !!(u === "INPUT" || u === "SELECT" || u === "TEXTAREA" || d.isContentEditable);
980
+ const f = d.tagName;
981
+ return !!(f === "INPUT" || f === "SELECT" || f === "TEXTAREA" || d.isContentEditable);
986
982
  };
987
983
  if (!(c(a) && (e.key === "Home" || e.key === "End")) && !(c(a) && (e.key === "ArrowUp" || e.key === "ArrowDown") && a.tagName === "INPUT" && a.type === "number") && !(c(a) && (e.key === "ArrowLeft" || e.key === "ArrowRight")) && !(c(a) && (e.key === "Enter" || e.key === "Escape")) && !(n && s === "select" && (e.key === "ArrowDown" || e.key === "ArrowUp"))) {
988
984
  switch (e.key) {
989
985
  case "Tab": {
990
- e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o), I(t);
986
+ e.preventDefault(), !e.shiftKey ? t._focusCol < o ? t._focusCol += 1 : (typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow < i && (t._focusRow += 1, t._focusCol = 0)) : t._focusCol > 0 ? t._focusCol -= 1 : t._focusRow > 0 && (typeof t.commitActiveRowEdit == "function" && t._activeEditRows === t._focusRow && t.commitActiveRowEdit(), t._focusRow -= 1, t._focusCol = o), q(t);
991
987
  return;
992
988
  }
993
989
  case "ArrowDown":
@@ -997,18 +993,18 @@ function zt(t, e) {
997
993
  n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = Math.max(0, t._focusRow - 1), e.preventDefault();
998
994
  break;
999
995
  case "ArrowRight": {
1000
- xe(t) ? t._focusCol = Math.max(0, t._focusCol - 1) : t._focusCol = Math.min(o, t._focusCol + 1), e.preventDefault();
996
+ Te(t) ? t._focusCol = Math.max(0, t._focusCol - 1) : t._focusCol = Math.min(o, t._focusCol + 1), e.preventDefault();
1001
997
  break;
1002
998
  }
1003
999
  case "ArrowLeft": {
1004
- xe(t) ? t._focusCol = Math.min(o, t._focusCol + 1) : t._focusCol = Math.max(0, t._focusCol - 1), e.preventDefault();
1000
+ Te(t) ? t._focusCol = Math.min(o, t._focusCol + 1) : t._focusCol = Math.max(0, t._focusCol - 1), e.preventDefault();
1005
1001
  break;
1006
1002
  }
1007
1003
  case "Home":
1008
- (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), I(t, { forceScrollLeft: !0 });
1004
+ (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = 0), t._focusCol = 0, e.preventDefault(), q(t, { forceScrollLeft: !0 });
1009
1005
  return;
1010
1006
  case "End":
1011
- (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(), I(t, { forceScrollRight: !0 });
1007
+ (e.ctrlKey || e.metaKey) && (n && typeof t.commitActiveRowEdit == "function" && t.commitActiveRowEdit(), t._focusRow = i), t._focusCol = o, e.preventDefault(), q(t, { forceScrollRight: !0 });
1012
1008
  return;
1013
1009
  case "PageDown":
1014
1010
  t._focusRow = Math.min(i, t._focusRow + 20), e.preventDefault();
@@ -1017,11 +1013,11 @@ function zt(t, e) {
1017
1013
  t._focusRow = Math.max(0, t._focusRow - 20), e.preventDefault();
1018
1014
  break;
1019
1015
  case "Enter": {
1020
- const d = t._focusRow, u = t._focusCol, f = t._visibleColumns[u], g = t._rows[d], p = f?.field ?? "", h = p && g ? g[p] : void 0, w = t.querySelector(
1021
- `[data-row="${d}"][data-col="${u}"]`
1016
+ const d = t._focusRow, f = t._focusCol, u = t._visibleColumns[f], g = t._rows[d], p = u?.field ?? "", h = p && g ? g[p] : void 0, w = t.querySelector(
1017
+ `[data-row="${d}"][data-col="${f}"]`
1022
1018
  ), C = {
1023
1019
  rowIndex: d,
1024
- colIndex: u,
1020
+ colIndex: f,
1025
1021
  field: p,
1026
1022
  value: h,
1027
1023
  row: g,
@@ -1035,7 +1031,7 @@ function zt(t, e) {
1035
1031
  t.dispatchEvent(m);
1036
1032
  const y = new CustomEvent("activate-cell", {
1037
1033
  cancelable: !0,
1038
- detail: { row: d, col: u }
1034
+ detail: { row: d, col: f }
1039
1035
  });
1040
1036
  if (t.dispatchEvent(y), m.defaultPrevented || y.defaultPrevented) {
1041
1037
  e.preventDefault();
@@ -1046,19 +1042,19 @@ function zt(t, e) {
1046
1042
  default:
1047
1043
  return;
1048
1044
  }
1049
- I(t);
1045
+ q(t);
1050
1046
  }
1051
1047
  }
1052
- function I(t, e) {
1048
+ function q(t, e) {
1053
1049
  if (t._virtualization?.enabled) {
1054
1050
  const { rowHeight: s, container: l, viewportEl: a } = t._virtualization, c = l, d = a?.clientHeight ?? c?.clientHeight ?? 0;
1055
1051
  if (c && d > 0) {
1056
- const u = t._focusRow * s;
1057
- u < c.scrollTop ? c.scrollTop = u : u + s > c.scrollTop + d && (c.scrollTop = u - d + s);
1052
+ const f = t._focusRow * s;
1053
+ f < c.scrollTop ? c.scrollTop = f : f + s > c.scrollTop + d && (c.scrollTop = f - d + s);
1058
1054
  }
1059
1055
  }
1060
1056
  const i = t._activeEditRows !== void 0 && t._activeEditRows !== -1;
1061
- i || t.refreshVirtualWindow(!1), me(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
1057
+ i || t.refreshVirtualWindow(!1), ve(t._bodyEl), Array.from(t._bodyEl.querySelectorAll('[aria-selected="true"]')).forEach((s) => {
1062
1058
  s.setAttribute("aria-selected", "false");
1063
1059
  });
1064
1060
  const o = t._focusRow, n = t._virtualization.start ?? 0, r = t._virtualization.end ?? t._rows.length;
@@ -1076,12 +1072,12 @@ function I(t, e) {
1076
1072
  else {
1077
1073
  const c = t._getHorizontalScrollOffsets?.(s ?? void 0, l) ?? { left: 0, right: 0 };
1078
1074
  if (!c.skipScroll) {
1079
- const d = l.getBoundingClientRect(), u = a.getBoundingClientRect(), f = d.left - u.left + a.scrollLeft, g = f + d.width, p = a.scrollLeft + c.left, h = a.scrollLeft + a.clientWidth - c.right;
1080
- f < p ? a.scrollLeft = f - c.left : g > h && (a.scrollLeft = g - a.clientWidth + c.right);
1075
+ const d = l.getBoundingClientRect(), f = a.getBoundingClientRect(), u = d.left - f.left + a.scrollLeft, g = u + d.width, p = a.scrollLeft + c.left, h = a.scrollLeft + a.clientWidth - c.right;
1076
+ u < p ? a.scrollLeft = u - c.left : g > h && (a.scrollLeft = g - a.clientWidth + c.right);
1081
1077
  }
1082
1078
  }
1083
1079
  if (t._activeEditRows !== void 0 && t._activeEditRows !== -1 && l.classList.contains("editing")) {
1084
- const c = l.querySelector(Ke);
1080
+ const c = l.querySelector(Qe);
1085
1081
  if (c && document.activeElement !== c)
1086
1082
  try {
1087
1083
  c.focus({ preventScroll: !0 });
@@ -1097,12 +1093,12 @@ function I(t, e) {
1097
1093
  }
1098
1094
  }
1099
1095
  }
1100
- const ee = /* @__PURE__ */ new WeakMap();
1101
- function Dt(t, e) {
1102
- const i = Xe(e), o = At(e);
1103
- i < 0 || o < 0 || (t._focusRow = i, t._focusCol = o, me(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
1096
+ const te = /* @__PURE__ */ new WeakMap();
1097
+ function Ot(t, e) {
1098
+ const i = Ye(e), o = xt(e);
1099
+ i < 0 || o < 0 || (t._focusRow = i, t._focusCol = o, ve(t._bodyEl), e.classList.add("cell-focus"), e.setAttribute("aria-selected", "true"));
1104
1100
  }
1105
- function ve(t, e, i, o) {
1101
+ function Ce(t, e, i, o) {
1106
1102
  let n = null;
1107
1103
  const r = i.composedPath?.();
1108
1104
  if (r && r.length > 0 ? n = r[0] : n = i.target, n && !e.contains(n)) {
@@ -1110,13 +1106,13 @@ function ve(t, e, i, o) {
1110
1106
  h && (n = h);
1111
1107
  }
1112
1108
  const s = n?.closest?.("[data-col]"), l = n?.closest?.(".data-grid-row"), a = n?.closest?.(".header-row");
1113
- let c, d, u, f, g, p;
1114
- return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10), c >= 0 && d >= 0 && (u = t._rows[c], p = t._columns[d], f = p?.field, g = u && f ? u[f] : void 0)), {
1109
+ let c, d, f, u, g, p;
1110
+ return s && (c = parseInt(s.getAttribute("data-row") ?? "-1", 10), d = parseInt(s.getAttribute("data-col") ?? "-1", 10), c >= 0 && d >= 0 && (f = t._rows[c], p = t._columns[d], u = p?.field, g = f && u ? f[u] : void 0)), {
1115
1111
  type: o,
1116
- row: u,
1112
+ row: f,
1117
1113
  rowIndex: c !== void 0 && c >= 0 ? c : void 0,
1118
1114
  colIndex: d !== void 0 && d >= 0 ? d : void 0,
1119
- field: f,
1115
+ field: u,
1120
1116
  value: g,
1121
1117
  column: p,
1122
1118
  originalEvent: i,
@@ -1126,61 +1122,61 @@ function ve(t, e, i, o) {
1126
1122
  cell: c !== void 0 && d !== void 0 && c >= 0 && d >= 0 ? { row: c, col: d } : void 0
1127
1123
  };
1128
1124
  }
1129
- function Ot(t, e, i) {
1130
- const o = ve(t, e, i, "mousedown");
1131
- (t._dispatchCellMouseDown?.(o) ?? !1) && ee.set(t, !0);
1132
- }
1133
1125
  function Mt(t, e, i) {
1134
- if (!ee.get(t)) return;
1135
- const o = ve(t, e, i, "mousemove");
1136
- t._dispatchCellMouseMove?.(o);
1126
+ const o = Ce(t, e, i, "mousedown");
1127
+ (t._dispatchCellMouseDown?.(o) ?? !1) && te.set(t, !0);
1137
1128
  }
1138
1129
  function kt(t, e, i) {
1139
- if (!ee.get(t)) return;
1140
- const o = ve(t, e, i, "mouseup");
1141
- t._dispatchCellMouseUp?.(o), ee.set(t, !1);
1130
+ if (!te.get(t)) return;
1131
+ const o = Ce(t, e, i, "mousemove");
1132
+ t._dispatchCellMouseMove?.(o);
1142
1133
  }
1143
1134
  function Nt(t, e, i) {
1135
+ if (!te.get(t)) return;
1136
+ const o = Ce(t, e, i, "mouseup");
1137
+ t._dispatchCellMouseUp?.(o), te.set(t, !1);
1138
+ }
1139
+ function It(t, e, i) {
1144
1140
  e.addEventListener(
1145
1141
  "mousedown",
1146
1142
  (o) => {
1147
1143
  const n = o.target.closest(".cell[data-col]");
1148
- n && (n.classList.contains("editing") || Dt(t, n));
1144
+ n && (n.classList.contains("editing") || Ot(t, n));
1149
1145
  },
1150
1146
  { signal: i }
1151
1147
  ), e.addEventListener(
1152
1148
  "click",
1153
1149
  (o) => {
1154
1150
  const n = o.target.closest(".data-grid-row");
1155
- n && Ae(t, o, n);
1151
+ n && xe(t, o, n);
1156
1152
  },
1157
1153
  { signal: i }
1158
1154
  ), e.addEventListener(
1159
1155
  "dblclick",
1160
1156
  (o) => {
1161
1157
  const n = o.target.closest(".data-grid-row");
1162
- n && Ae(t, o, n);
1158
+ n && xe(t, o, n);
1163
1159
  },
1164
1160
  { signal: i }
1165
1161
  );
1166
1162
  }
1167
- function It(t, e, i, o) {
1168
- e.addEventListener("keydown", (n) => zt(t, n), { signal: o }), i.addEventListener("mousedown", (n) => Ot(t, i, n), { signal: o }), document.addEventListener("mousemove", (n) => Mt(t, i, n), { signal: o }), document.addEventListener("mouseup", (n) => kt(t, i, n), { signal: o });
1163
+ function qt(t, e, i, o) {
1164
+ e.addEventListener("keydown", (n) => Dt(t, n), { signal: o }), i.addEventListener("mousedown", (n) => Mt(t, i, n), { signal: o }), document.addEventListener("mousemove", (n) => kt(t, i, n), { signal: o }), document.addEventListener("mouseup", (n) => Nt(t, i, n), { signal: o });
1169
1165
  }
1170
- function qt(t, e) {
1166
+ function $t(t, e) {
1171
1167
  return t == null && e == null ? 0 : t == null ? -1 : e == null || t > e ? 1 : t < e ? -1 : 0;
1172
1168
  }
1173
- function $t(t, e, i) {
1174
- const n = i.find((l) => l.field === e.field)?.sortComparator ?? qt, { field: r, direction: s } = e;
1169
+ function Wt(t, e, i) {
1170
+ const n = i.find((l) => l.field === e.field)?.sortComparator ?? $t, { field: r, direction: s } = e;
1175
1171
  return [...t].sort((l, a) => n(l[r], a[r], l, a) * s);
1176
1172
  }
1177
- function Te(t, e, i, o) {
1178
- t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), te(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
1173
+ function He(t, e, i, o) {
1174
+ t._rows = e, t.__rowRenderEpoch++, t._rowPool.forEach((n) => n.__epoch = -1), ie(t), t.refreshVirtualWindow(!0), t.dispatchEvent(
1179
1175
  new CustomEvent("sort-change", { detail: { field: i.field, direction: o } })
1180
1176
  ), t.requestStateChange?.();
1181
1177
  }
1182
- function He(t, e) {
1183
- !t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), Pe(t, e, 1)) : t._sortState.direction === 1 ? Pe(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((o) => o.__epoch = -1), t._rows = t.__originalOrder.slice(), te(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((o) => {
1178
+ function Le(t, e) {
1179
+ !t._sortState || t._sortState.field !== e.field ? (t._sortState || (t.__originalOrder = t._rows.slice()), Pe(t, e, 1)) : t._sortState.direction === 1 ? Pe(t, e, -1) : (t._sortState = null, t.__rowRenderEpoch++, t._rowPool.forEach((o) => o.__epoch = -1), t._rows = t.__originalOrder.slice(), ie(t), t._headerRowEl?.querySelectorAll('[role="columnheader"].sortable')?.forEach((o) => {
1184
1180
  o.getAttribute("aria-sort") ? (o.getAttribute("aria-sort") === "ascending" || o.getAttribute("aria-sort") === "descending") && (t._sortState || o.setAttribute("aria-sort", "none")) : o.setAttribute("aria-sort", "none");
1185
1181
  }), t.refreshVirtualWindow(!0), t.dispatchEvent(
1186
1182
  new CustomEvent("sort-change", { detail: { field: e.field, direction: 0 } })
@@ -1188,27 +1184,27 @@ function He(t, e) {
1188
1184
  }
1189
1185
  function Pe(t, e, i) {
1190
1186
  t._sortState = { field: e.field, direction: i };
1191
- const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? $t)(t._rows, o, n);
1187
+ const o = { field: e.field, direction: i }, n = t._columns, s = (t.effectiveConfig?.sortHandler ?? Wt)(t._rows, o, n);
1192
1188
  s && typeof s.then == "function" ? s.then((l) => {
1193
- Te(t, l, e, i);
1194
- }) : Te(t, s, e, i);
1189
+ He(t, l, e, i);
1190
+ }) : He(t, s, e, i);
1195
1191
  }
1196
- function $(t, e) {
1192
+ function W(t, e) {
1197
1193
  return t.effectiveConfig?.sortable !== !1 && e.sortable === !0;
1198
1194
  }
1199
- function X(t, e) {
1195
+ function Y(t, e) {
1200
1196
  return t.effectiveConfig?.resizable !== !1 && e.resizable !== !1;
1201
1197
  }
1202
- function Wt(t, e) {
1198
+ function Ft(t, e) {
1203
1199
  typeof e == "string" ? t.textContent = e : e instanceof HTMLElement && (t.innerHTML = "", t.appendChild(e.cloneNode(!0)));
1204
1200
  }
1205
- function Y(t, e) {
1201
+ function j(t, e) {
1206
1202
  const i = document.createElement("span");
1207
- Ue(i, "sort-indicator");
1203
+ Ve(i, "sort-indicator");
1208
1204
  const o = t._sortState?.field === e.field ? t._sortState.direction : 0, n = { ...M, ...t.icons }, r = o === 1 ? n.sortAsc : o === -1 ? n.sortDesc : n.sortNone;
1209
- return Wt(i, r), i;
1205
+ return Ft(i, r), i;
1210
1206
  }
1211
- function j(t, e, i) {
1207
+ function K(t, e, i) {
1212
1208
  const o = document.createElement("div");
1213
1209
  return o.className = "resize-handle", o.setAttribute("aria-hidden", "true"), o.addEventListener("mousedown", (n) => {
1214
1210
  n.stopPropagation(), n.preventDefault(), t._resizeController.start(n, e, i);
@@ -1216,32 +1212,32 @@ function j(t, e, i) {
1216
1212
  n.stopPropagation(), n.preventDefault(), t._resizeController.resetColumn(e);
1217
1213
  }), o;
1218
1214
  }
1219
- function K(t, e, i, o) {
1215
+ function Q(t, e, i, o) {
1220
1216
  o.classList.add("sortable"), o.tabIndex = 0;
1221
1217
  const n = t._sortState?.field === e.field ? t._sortState.direction : 0;
1222
1218
  o.setAttribute("aria-sort", n === 0 ? "none" : n === 1 ? "ascending" : "descending"), o.addEventListener("click", (r) => {
1223
- t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) || He(t, e);
1219
+ t._resizeController?.isResizing || t._dispatchHeaderClick?.(r, i, o) || Le(t, e);
1224
1220
  }), o.addEventListener("keydown", (r) => {
1225
1221
  if (r.key === "Enter" || r.key === " ") {
1226
1222
  if (r.preventDefault(), t._dispatchHeaderClick?.(r, i, o)) return;
1227
- He(t, e);
1223
+ Le(t, e);
1228
1224
  }
1229
1225
  });
1230
1226
  }
1231
- function Ft(t, e) {
1227
+ function Ut(t, e) {
1232
1228
  if (e != null)
1233
1229
  if (typeof e == "string") {
1234
1230
  const i = document.createElement("span");
1235
- for (i.innerHTML = q(e); i.firstChild; )
1231
+ for (i.innerHTML = $(e); i.firstChild; )
1236
1232
  t.appendChild(i.firstChild);
1237
1233
  } else e instanceof Node && t.appendChild(e);
1238
1234
  }
1239
- function te(t) {
1235
+ function ie(t) {
1240
1236
  t._headerRowEl = t.findHeaderRow();
1241
1237
  const e = t._headerRowEl;
1242
1238
  e && (e.innerHTML = "", t._visibleColumns.forEach((i, o) => {
1243
1239
  const n = document.createElement("div");
1244
- n.className = "cell", Ue(n, "header-cell"), n.setAttribute("role", "columnheader"), n.setAttribute("aria-colindex", String(o + 1)), n.setAttribute("data-field", i.field), n.setAttribute("data-col", String(o));
1240
+ n.className = "cell", Ve(n, "header-cell"), n.setAttribute("role", "columnheader"), n.setAttribute("aria-colindex", String(o + 1)), n.setAttribute("data-field", i.field), n.setAttribute("data-col", String(o));
1245
1241
  const r = i.header ?? i.field, s = t._sortState?.field === i.field ? t._sortState.direction : 0, l = s === 1 ? "asc" : s === -1 ? "desc" : null;
1246
1242
  if (i.headerRenderer) {
1247
1243
  const a = {
@@ -1250,30 +1246,30 @@ function te(t) {
1250
1246
  sortState: l,
1251
1247
  filterActive: !1,
1252
1248
  cellEl: n,
1253
- renderSortIcon: () => $(t, i) ? Y(t, i) : null,
1249
+ renderSortIcon: () => W(t, i) ? j(t, i) : null,
1254
1250
  renderFilterButton: () => null
1255
1251
  }, c = i.headerRenderer(a);
1256
- Ft(n, c), $(t, i) && K(t, i, o, n), X(t, i) && (n.classList.add("resizable"), n.appendChild(j(t, o, n)));
1252
+ Ut(n, c), W(t, i) && Q(t, i, o, n), Y(t, i) && (n.classList.add("resizable"), n.appendChild(K(t, o, n)));
1257
1253
  } else if (i.headerLabelRenderer) {
1258
1254
  const a = {
1259
1255
  column: i,
1260
1256
  value: r
1261
1257
  }, c = i.headerLabelRenderer(a), d = document.createElement("span");
1262
- c == null ? d.textContent = r : typeof c == "string" ? d.innerHTML = q(c) : c instanceof Node && d.appendChild(c), n.appendChild(d), $(t, i) && (K(t, i, o, n), n.appendChild(Y(t, i))), X(t, i) && (n.classList.add("resizable"), n.appendChild(j(t, o, n)));
1258
+ c == null ? d.textContent = r : typeof c == "string" ? d.innerHTML = $(c) : c instanceof Node && d.appendChild(c), n.appendChild(d), W(t, i) && (Q(t, i, o, n), n.appendChild(j(t, i))), Y(t, i) && (n.classList.add("resizable"), n.appendChild(K(t, o, n)));
1263
1259
  } else if (i.__headerTemplate)
1264
- Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))), $(t, i) && (K(t, i, o, n), n.appendChild(Y(t, i))), X(t, i) && (n.classList.add("resizable"), n.appendChild(j(t, o, n)));
1260
+ Array.from(i.__headerTemplate.childNodes).forEach((a) => n.appendChild(a.cloneNode(!0))), W(t, i) && (Q(t, i, o, n), n.appendChild(j(t, i))), Y(t, i) && (n.classList.add("resizable"), n.appendChild(K(t, o, n)));
1265
1261
  else {
1266
1262
  const a = document.createElement("span");
1267
- a.textContent = r, n.appendChild(a), $(t, i) && (K(t, i, o, n), n.appendChild(Y(t, i))), X(t, i) && (n.classList.add("resizable"), n.appendChild(j(t, o, n)));
1263
+ a.textContent = r, n.appendChild(a), W(t, i) && (Q(t, i, o, n), n.appendChild(j(t, i))), Y(t, i) && (n.classList.add("resizable"), n.appendChild(K(t, o, n)));
1268
1264
  }
1269
1265
  e.appendChild(n);
1270
1266
  }), e.querySelectorAll(".cell.sortable").forEach((i) => {
1271
1267
  i.getAttribute("aria-sort") || i.setAttribute("aria-sort", "none");
1272
1268
  }), e.children.length > 0 ? (e.setAttribute("role", "row"), e.setAttribute("aria-rowindex", "1")) : (e.removeAttribute("role"), e.removeAttribute("aria-rowindex")));
1273
1269
  }
1274
- const Je = typeof requestIdleCallback == "function";
1275
- function Ut(t, e) {
1276
- return Je ? requestIdleCallback(t, e) : window.setTimeout(() => {
1270
+ const et = typeof requestIdleCallback == "function";
1271
+ function Vt(t, e) {
1272
+ return et ? requestIdleCallback(t, e) : window.setTimeout(() => {
1277
1273
  const i = Date.now();
1278
1274
  t({
1279
1275
  didTimeout: !1,
@@ -1281,10 +1277,10 @@ function Ut(t, e) {
1281
1277
  });
1282
1278
  }, 1);
1283
1279
  }
1284
- function Le(t) {
1285
- Je ? cancelIdleCallback(t) : clearTimeout(t);
1280
+ function ze(t) {
1281
+ et ? cancelIdleCallback(t) : clearTimeout(t);
1286
1282
  }
1287
- function Vt(t) {
1283
+ function Bt(t) {
1288
1284
  const e = document.createElement("div");
1289
1285
  return e.className = `tbw-spinner tbw-spinner--${t}`, e.setAttribute("role", "progressbar"), e.setAttribute("aria-label", "Loading"), e;
1290
1286
  }
@@ -1297,26 +1293,26 @@ function Gt(t, e) {
1297
1293
  }
1298
1294
  return o;
1299
1295
  }
1300
- return Vt(t);
1296
+ return Bt(t);
1301
1297
  }
1302
- function Bt(t) {
1298
+ function Xt(t) {
1303
1299
  const e = document.createElement("div");
1304
1300
  return e.className = "tbw-loading-overlay", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.appendChild(Gt("large", t)), e;
1305
1301
  }
1306
- function Xt(t, e) {
1302
+ function Yt(t, e) {
1307
1303
  t.appendChild(e);
1308
1304
  }
1309
- function Yt(t) {
1305
+ function jt(t) {
1310
1306
  t?.remove();
1311
1307
  }
1312
- function jt(t, e) {
1308
+ function Kt(t, e) {
1313
1309
  e ? (t.classList.add("tbw-row-loading"), t.setAttribute("aria-busy", "true")) : (t.classList.remove("tbw-row-loading"), t.removeAttribute("aria-busy"));
1314
1310
  }
1315
- function Kt(t, e) {
1311
+ function Qt(t, e) {
1316
1312
  e ? (t.classList.add("tbw-cell-loading"), t.setAttribute("aria-busy", "true")) : (t.classList.remove("tbw-cell-loading"), t.removeAttribute("aria-busy"));
1317
1313
  }
1318
- var T = ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(T || {});
1319
- class Qt {
1314
+ var x = ((t) => (t[t.STYLE = 1] = "STYLE", t[t.VIRTUALIZATION = 2] = "VIRTUALIZATION", t[t.HEADER = 3] = "HEADER", t[t.ROWS = 4] = "ROWS", t[t.COLUMNS = 5] = "COLUMNS", t[t.FULL = 6] = "FULL", t))(x || {});
1315
+ class Zt {
1320
1316
  #l;
1321
1317
  #n = 0;
1322
1318
  #u = 0;
@@ -1359,15 +1355,15 @@ class Qt {
1359
1355
  this.#n = 0, e >= 5 && this.#l.mergeConfig(), e >= 4 && this.#l.processRows(), e >= 5 && (this.#l.processColumns(), this.#l.updateTemplate()), e >= 3 && this.#l.renderHeader(), e >= 2 && this.#l.renderVirtualWindow(), e >= 1 && this.#l.afterRender(), !this.#o && this.#a && (this.#o = !0, this.#a()), this.#h && (this.#h(), this.#h = null, this.#d = null);
1360
1356
  }
1361
1357
  }
1362
- function ze(t) {
1358
+ function De(t) {
1363
1359
  let e = null, i = null, o = null, n = null;
1364
1360
  const r = (a) => {
1365
1361
  if (!e) return;
1366
- const c = a.clientX - e.startX, d = Math.max(40, e.startWidth + c), u = t._visibleColumns[e.colIndex];
1367
- u.width = d, u.__userResized = !0, u.__renderedWidth = d, i == null && (i = requestAnimationFrame(() => {
1362
+ const c = a.clientX - e.startX, d = Math.max(40, e.startWidth + c), f = t._visibleColumns[e.colIndex];
1363
+ f.width = d, f.__userResized = !0, f.__renderedWidth = d, i == null && (i = requestAnimationFrame(() => {
1368
1364
  i = null, t.updateTemplate?.();
1369
1365
  })), t.dispatchEvent(
1370
- new CustomEvent("column-resize", { detail: { field: u.field, width: d } })
1366
+ new CustomEvent("column-resize", { detail: { field: f.field, width: d } })
1371
1367
  );
1372
1368
  };
1373
1369
  let s = !1;
@@ -1383,7 +1379,7 @@ function ze(t) {
1383
1379
  },
1384
1380
  start(a, c, d) {
1385
1381
  a.preventDefault();
1386
- const u = t._visibleColumns[c], f = typeof u?.width == "number" ? u.width : void 0, g = u?.__renderedWidth ?? f ?? d.getBoundingClientRect().width;
1382
+ const f = t._visibleColumns[c], u = typeof f?.width == "number" ? f.width : void 0, g = f?.__renderedWidth ?? u ?? d.getBoundingClientRect().width;
1387
1383
  e = { startX: a.clientX, colIndex: c, startWidth: g }, window.addEventListener("mousemove", r), window.addEventListener("mouseup", l), o === null && (o = document.documentElement.style.cursor), document.documentElement.style.cursor = "e-resize", n === null && (n = document.body.style.userSelect), document.body.style.userSelect = "none";
1388
1384
  },
1389
1385
  resetColumn(a) {
@@ -1397,55 +1393,62 @@ function ze(t) {
1397
1393
  }
1398
1394
  };
1399
1395
  }
1400
- const le = "data-animating", Zt = {
1396
+ const ae = "data-animating", Jt = {
1401
1397
  change: "--tbw-row-change-duration",
1402
1398
  insert: "--tbw-row-insert-duration",
1403
1399
  remove: "--tbw-row-remove-duration"
1404
- }, Jt = {
1400
+ }, ei = {
1405
1401
  change: 500,
1406
1402
  insert: 300,
1407
1403
  remove: 200
1408
1404
  };
1409
- function ei(t) {
1405
+ function ti(t) {
1410
1406
  const e = t.trim().toLowerCase();
1411
1407
  return e.endsWith("ms") ? parseFloat(e) : e.endsWith("s") ? parseFloat(e) * 1e3 : parseFloat(e);
1412
1408
  }
1413
- function ti(t, e) {
1414
- const i = Zt[e], o = getComputedStyle(t).getPropertyValue(i);
1409
+ function ii(t, e) {
1410
+ const i = Jt[e], o = getComputedStyle(t).getPropertyValue(i);
1415
1411
  if (o) {
1416
- const n = ei(o);
1412
+ const n = ti(o);
1417
1413
  if (!isNaN(n) && n > 0)
1418
1414
  return n;
1419
1415
  }
1420
- return Jt[e];
1416
+ return ei[e];
1421
1417
  }
1422
- function ii(t, e, i) {
1423
- t.removeAttribute(le), t.offsetWidth, t.setAttribute(le, e);
1424
- const o = ti(t, e);
1418
+ function oi(t, e, i) {
1419
+ t.removeAttribute(ae), t.offsetWidth, t.setAttribute(ae, e);
1420
+ const o = ii(t, e);
1425
1421
  setTimeout(() => {
1426
- e !== "remove" && t.removeAttribute(le);
1422
+ e !== "remove" && t.removeAttribute(ae);
1427
1423
  }, o);
1428
1424
  }
1429
- function Ce(t, e, i) {
1425
+ function ye(t, e, i) {
1430
1426
  if (e < 0)
1431
1427
  return !1;
1432
1428
  const o = t.findRenderedRowElement?.(e);
1433
- return o ? (ii(o, i), !0) : !1;
1429
+ return o ? (oi(o, i), !0) : !1;
1434
1430
  }
1435
- function oi(t, e, i) {
1431
+ function ni(t, e, i) {
1436
1432
  let o = 0;
1437
1433
  for (const n of e)
1438
- Ce(t, n, i) && o++;
1434
+ ye(t, n, i) && o++;
1439
1435
  return o;
1440
1436
  }
1441
- function ni(t, e, i) {
1437
+ function ri(t, e, i) {
1442
1438
  const o = t._rows ?? [], n = t.getRowId;
1443
1439
  if (!n)
1444
1440
  return !1;
1445
- const r = o.findIndex((s) => n(s) === e);
1446
- return r < 0 ? !1 : Ce(t, r, i);
1441
+ const r = o.findIndex((s) => {
1442
+ if (s == null) return !1;
1443
+ try {
1444
+ return n(s) === e;
1445
+ } catch {
1446
+ return !1;
1447
+ }
1448
+ });
1449
+ return r < 0 ? !1 : ye(t, r, i);
1447
1450
  }
1448
- function Q(t, e, i) {
1451
+ function Z(t, e, i) {
1449
1452
  const o = document.createElement(t);
1450
1453
  if (e)
1451
1454
  for (const n in e) {
@@ -1454,7 +1457,7 @@ function Q(t, e, i) {
1454
1457
  }
1455
1458
  return o;
1456
1459
  }
1457
- function P(t, e) {
1460
+ function L(t, e) {
1458
1461
  const i = document.createElement("div");
1459
1462
  if (t && (i.className = t), e)
1460
1463
  for (const o in e) {
@@ -1463,7 +1466,7 @@ function P(t, e) {
1463
1466
  }
1464
1467
  return i;
1465
1468
  }
1466
- function et(t, e, i) {
1469
+ function tt(t, e, i) {
1467
1470
  const o = document.createElement("button");
1468
1471
  if (t && (o.className = t), e)
1469
1472
  for (const n in e) {
@@ -1472,8 +1475,8 @@ function et(t, e, i) {
1472
1475
  }
1473
1476
  return o;
1474
1477
  }
1475
- const tt = document.createElement("template");
1476
- tt.innerHTML = `
1478
+ const it = document.createElement("template");
1479
+ it.innerHTML = `
1477
1480
  <div class="tbw-scroll-area">
1478
1481
  <div class="rows-body-wrapper">
1479
1482
  <div class="rows-body" role="grid">
@@ -1492,38 +1495,38 @@ tt.innerHTML = `
1492
1495
  <div class="faux-vscroll-spacer"></div>
1493
1496
  </div>
1494
1497
  `;
1495
- function it() {
1496
- return tt.content.cloneNode(!0);
1498
+ function ot() {
1499
+ return it.content.cloneNode(!0);
1497
1500
  }
1498
- function De(t) {
1499
- const e = document.createDocumentFragment(), i = P(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
1501
+ function Oe(t) {
1502
+ const e = document.createDocumentFragment(), i = L(t.hasShell ? "tbw-grid-root has-shell" : "tbw-grid-root");
1500
1503
  if (t.hasShell && t.shellHeader && t.shellBody)
1501
1504
  i.appendChild(t.shellHeader), i.appendChild(t.shellBody);
1502
1505
  else {
1503
- const o = P("tbw-grid-content");
1504
- o.appendChild(it()), i.appendChild(o);
1506
+ const o = L("tbw-grid-content");
1507
+ o.appendChild(ot()), i.appendChild(o);
1505
1508
  }
1506
1509
  return e.appendChild(i), e;
1507
1510
  }
1508
- function ri(t) {
1509
- const e = P("tbw-shell-header", { part: "shell-header", role: "presentation" });
1511
+ function si(t) {
1512
+ const e = L("tbw-shell-header", { part: "shell-header", role: "presentation" });
1510
1513
  if (t.title) {
1511
- const r = P("tbw-shell-title");
1514
+ const r = L("tbw-shell-title");
1512
1515
  r.textContent = t.title, e.appendChild(r);
1513
1516
  }
1514
- const i = P("tbw-shell-content", {
1517
+ const i = L("tbw-shell-content", {
1515
1518
  part: "shell-content",
1516
1519
  role: "presentation",
1517
1520
  "data-light-dom-header-content": ""
1518
1521
  });
1519
1522
  e.appendChild(i);
1520
- const o = P("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
1523
+ const o = L("tbw-shell-toolbar", { part: "shell-toolbar", role: "presentation" });
1521
1524
  for (const r of t.configButtons)
1522
- r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
1525
+ r.hasRender && o.appendChild(L("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
1523
1526
  for (const r of t.apiButtons)
1524
- r.hasRender && o.appendChild(P("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
1525
- if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && o.appendChild(P("tbw-toolbar-separator")), t.hasPanels) {
1526
- const r = et(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
1527
+ r.hasRender && o.appendChild(L("tbw-toolbar-content-slot", { "data-toolbar-content": r.id }));
1528
+ if ((t.configButtons.some((r) => r.hasRender) || t.apiButtons.some((r) => r.hasRender)) && t.hasPanels && o.appendChild(L("tbw-toolbar-separator")), t.hasPanels) {
1529
+ const r = tt(t.isPanelOpen ? "tbw-toolbar-btn active" : "tbw-toolbar-btn", {
1527
1530
  "data-panel-toggle": "",
1528
1531
  title: "Settings",
1529
1532
  "aria-label": "Toggle settings panel",
@@ -1534,12 +1537,12 @@ function ri(t) {
1534
1537
  }
1535
1538
  return e.appendChild(o), e;
1536
1539
  }
1537
- function si(t) {
1538
- const e = P("tbw-shell-body"), i = t.panels.length > 0, o = t.panels.length === 1, n = P("tbw-grid-content");
1539
- n.appendChild(it());
1540
+ function li(t) {
1541
+ const e = L("tbw-shell-body"), i = t.panels.length > 0, o = t.panels.length === 1, n = L("tbw-grid-content");
1542
+ n.appendChild(ot());
1540
1543
  let r = null;
1541
1544
  if (i) {
1542
- r = Q("aside", {
1545
+ r = Z("aside", {
1543
1546
  class: t.isPanelOpen ? "tbw-tool-panel open" : "tbw-tool-panel",
1544
1547
  part: "tool-panel",
1545
1548
  "data-position": t.position,
@@ -1548,33 +1551,33 @@ function si(t) {
1548
1551
  });
1549
1552
  const s = t.position === "left" ? "right" : "left";
1550
1553
  r.appendChild(
1551
- P("tbw-tool-panel-resize", {
1554
+ L("tbw-tool-panel-resize", {
1552
1555
  "data-resize-handle": "",
1553
1556
  "data-handle-position": s,
1554
1557
  "aria-hidden": "true"
1555
1558
  })
1556
1559
  );
1557
- const l = P("tbw-tool-panel-content", { role: "presentation" }), a = P("tbw-accordion");
1560
+ const l = L("tbw-tool-panel-content", { role: "presentation" }), a = L("tbw-accordion");
1558
1561
  for (const c of t.panels) {
1559
- const d = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${o ? " single" : ""}`, u = P(d, { "data-section": c.id }), f = et("tbw-accordion-header", {
1562
+ const d = `tbw-accordion-section${c.isExpanded ? " expanded" : ""}${o ? " single" : ""}`, f = L(d, { "data-section": c.id }), u = tt("tbw-accordion-header", {
1560
1563
  "aria-expanded": String(c.isExpanded),
1561
1564
  "aria-controls": `tbw-section-${c.id}`
1562
1565
  });
1563
- if (o && f.setAttribute("aria-disabled", "true"), c.icon) {
1564
- const p = Q("span", { class: "tbw-accordion-icon" });
1565
- p.innerHTML = c.icon, f.appendChild(p);
1566
+ if (o && u.setAttribute("aria-disabled", "true"), c.icon) {
1567
+ const p = Z("span", { class: "tbw-accordion-icon" });
1568
+ p.innerHTML = c.icon, u.appendChild(p);
1566
1569
  }
1567
- const g = Q("span", { class: "tbw-accordion-title" });
1568
- if (g.textContent = c.title, f.appendChild(g), !o) {
1569
- const p = Q("span", { class: "tbw-accordion-chevron" });
1570
- p.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, f.appendChild(p);
1570
+ const g = Z("span", { class: "tbw-accordion-title" });
1571
+ if (g.textContent = c.title, u.appendChild(g), !o) {
1572
+ const p = Z("span", { class: "tbw-accordion-chevron" });
1573
+ p.innerHTML = c.isExpanded ? t.collapseIcon : t.expandIcon, u.appendChild(p);
1571
1574
  }
1572
- u.appendChild(f), u.appendChild(
1573
- P("tbw-accordion-content", {
1575
+ f.appendChild(u), f.appendChild(
1576
+ L("tbw-accordion-content", {
1574
1577
  id: `tbw-section-${c.id}`,
1575
1578
  role: "presentation"
1576
1579
  })
1577
- ), a.appendChild(u);
1580
+ ), a.appendChild(f);
1578
1581
  }
1579
1582
  l.appendChild(a), r.appendChild(l);
1580
1583
  }
@@ -1583,7 +1586,7 @@ function si(t) {
1583
1586
  function N(t) {
1584
1587
  return t ? typeof t == "string" ? t : t.outerHTML : "";
1585
1588
  }
1586
- function li() {
1589
+ function ai() {
1587
1590
  return {
1588
1591
  toolPanels: /* @__PURE__ */ new Map(),
1589
1592
  headerContents: /* @__PURE__ */ new Map(),
@@ -1602,24 +1605,24 @@ function li() {
1602
1605
  lightDomContentMoved: !1
1603
1606
  };
1604
1607
  }
1605
- function ot(t) {
1608
+ function nt(t) {
1606
1609
  return !!(t?.header?.title || t?.header?.toolbarContents?.length || t?.toolPanels?.length || t?.headerContents?.length || t?.header?.lightDomContent?.length || t?.header?.hasToolButtonsContainer);
1607
1610
  }
1608
- function ai(t, e, i = "☰") {
1611
+ function ci(t, e, i = "☰") {
1609
1612
  const o = t?.header?.title ?? e.lightDomTitle ?? "", n = !!o, r = N(i), s = t?.header?.toolbarContents ?? [], l = [...e.toolbarContents.values()], a = new Set(s.map((h) => h.id)), c = [...s];
1610
1613
  for (const h of l)
1611
1614
  a.has(h.id) || c.push(h);
1612
- const d = c.length > 0, u = e.toolPanels.size > 0, f = d && u, g = [...c].sort((h, w) => (h.order ?? 0) - (w.order ?? 0));
1615
+ const d = c.length > 0, f = e.toolPanels.size > 0, u = d && f, g = [...c].sort((h, w) => (h.order ?? 0) - (w.order ?? 0));
1613
1616
  let p = "";
1614
1617
  for (const h of g)
1615
1618
  p += `<div class="tbw-toolbar-content-slot" data-toolbar-content="${h.id}"></div>`;
1616
- if (f && (p += '<div class="tbw-toolbar-separator"></div>'), u) {
1619
+ if (u && (p += '<div class="tbw-toolbar-separator"></div>'), f) {
1617
1620
  const h = e.isPanelOpen;
1618
1621
  p += `<button class="${h ? "tbw-toolbar-btn active" : "tbw-toolbar-btn"}" data-panel-toggle title="Settings" aria-label="Toggle settings panel" aria-pressed="${h}" aria-controls="tbw-tool-panel">${r}</button>`;
1619
1622
  }
1620
1623
  return `
1621
1624
  <div class="tbw-shell-header" part="shell-header" role="presentation">
1622
- ${n ? `<div class="tbw-shell-title">${bt(o)}</div>` : ""}
1625
+ ${n ? `<div class="tbw-shell-title">${mt(o)}</div>` : ""}
1623
1626
  <div class="tbw-shell-content" part="shell-content" role="presentation" data-light-dom-header-content></div>
1624
1627
  <div class="tbw-shell-toolbar" part="shell-toolbar" role="presentation">
1625
1628
  ${p}
@@ -1627,7 +1630,7 @@ function ai(t, e, i = "☰") {
1627
1630
  </div>
1628
1631
  `;
1629
1632
  }
1630
- function Oe(t, e) {
1633
+ function Me(t, e) {
1631
1634
  const i = t.querySelector("tbw-grid-header");
1632
1635
  if (!i) return;
1633
1636
  if (!e.lightDomTitle) {
@@ -1637,7 +1640,7 @@ function Oe(t, e) {
1637
1640
  const o = i.querySelectorAll("tbw-grid-header-content");
1638
1641
  o.length > 0 && e.lightDomHeaderContent.length === 0 && (e.lightDomHeaderContent = Array.from(o)), i.style.display = "none";
1639
1642
  }
1640
- function Me(t, e, i) {
1643
+ function ke(t, e, i) {
1641
1644
  const o = t.querySelector(":scope > tbw-grid-tool-buttons");
1642
1645
  if (!o) return;
1643
1646
  e.hasToolButtonsContainer = !0;
@@ -1657,7 +1660,7 @@ function Me(t, e, i) {
1657
1660
  };
1658
1661
  e.toolbarContents.set(n, r), e.lightDomToolbarContentIds.add(n), o.style.display = "none";
1659
1662
  }
1660
- function ke(t, e, i) {
1663
+ function Ne(t, e, i) {
1661
1664
  t.querySelectorAll(":scope > tbw-grid-tool-panel").forEach((n) => {
1662
1665
  const r = n, s = r.getAttribute("id"), l = r.getAttribute("title");
1663
1666
  if (!s || !l) {
@@ -1667,21 +1670,21 @@ function ke(t, e, i) {
1667
1670
  return;
1668
1671
  }
1669
1672
  const a = r.getAttribute("icon") ?? void 0, c = r.getAttribute("tooltip") ?? void 0, d = parseInt(r.getAttribute("order") ?? "100", 10);
1670
- let u;
1671
- const f = i?.(r);
1672
- if (f)
1673
- u = f;
1673
+ let f;
1674
+ const u = i?.(r);
1675
+ if (u)
1676
+ f = u;
1674
1677
  else {
1675
1678
  const h = r.innerHTML.trim();
1676
- u = (w) => {
1679
+ f = (w) => {
1677
1680
  const C = document.createElement("div");
1678
1681
  return C.innerHTML = h, w.appendChild(C), () => C.remove();
1679
1682
  };
1680
1683
  }
1681
1684
  const g = e.toolPanels.get(s);
1682
1685
  if (g) {
1683
- if (f) {
1684
- g.render = u, g.order = d, g.icon = a, g.tooltip = c;
1686
+ if (u) {
1687
+ g.render = f, g.order = d, g.icon = a, g.tooltip = c;
1685
1688
  const h = e.panelCleanups.get(s);
1686
1689
  h && (h(), e.panelCleanups.delete(s));
1687
1690
  }
@@ -1693,12 +1696,12 @@ function ke(t, e, i) {
1693
1696
  icon: a,
1694
1697
  tooltip: c,
1695
1698
  order: d,
1696
- render: u
1699
+ render: f
1697
1700
  };
1698
1701
  e.toolPanels.set(s, p), e.lightDomToolPanelIds.add(s), r.style.display = "none";
1699
1702
  });
1700
1703
  }
1701
- function ci(t, e, i, o) {
1704
+ function di(t, e, i, o) {
1702
1705
  const n = t.querySelector(".tbw-shell-toolbar");
1703
1706
  n && n.addEventListener("click", (s) => {
1704
1707
  if (s.target.closest("[data-panel-toggle]")) {
@@ -1715,31 +1718,31 @@ function ci(t, e, i, o) {
1715
1718
  }
1716
1719
  });
1717
1720
  }
1718
- function di(t, e, i) {
1721
+ function hi(t, e, i) {
1719
1722
  const o = t.querySelector(".tbw-tool-panel"), n = t.querySelector("[data-resize-handle]"), r = t.querySelector(".tbw-shell-body");
1720
1723
  if (!o || !n || !r)
1721
1724
  return () => {
1722
1725
  };
1723
1726
  const s = e?.toolPanel?.position ?? "right", l = 200;
1724
- let a = 0, c = 0, d = 0, u = !1;
1725
- const f = (h) => {
1726
- if (!u) return;
1727
+ let a = 0, c = 0, d = 0, f = !1;
1728
+ const u = (h) => {
1729
+ if (!f) return;
1727
1730
  h.preventDefault();
1728
1731
  const w = s === "left" ? h.clientX - a : a - h.clientX, C = Math.min(d, Math.max(l, c + w));
1729
1732
  o.style.width = `${C}px`;
1730
1733
  }, g = () => {
1731
- if (!u) return;
1732
- u = !1, n.classList.remove("resizing"), o.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
1734
+ if (!f) return;
1735
+ f = !1, n.classList.remove("resizing"), o.style.transition = "", document.body.style.cursor = "", document.body.style.userSelect = "";
1733
1736
  const h = o.getBoundingClientRect().width;
1734
- i(h), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", g);
1737
+ i(h), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", g);
1735
1738
  }, p = (h) => {
1736
- h.preventDefault(), u = !0, a = h.clientX, c = o.getBoundingClientRect().width, d = r.getBoundingClientRect().width - 20, n.classList.add("resizing"), o.style.transition = "none", document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", f), document.addEventListener("mouseup", g);
1739
+ h.preventDefault(), f = !0, a = h.clientX, c = o.getBoundingClientRect().width, d = r.getBoundingClientRect().width - 20, n.classList.add("resizing"), o.style.transition = "none", document.body.style.cursor = "col-resize", document.body.style.userSelect = "none", document.addEventListener("mousemove", u), document.addEventListener("mouseup", g);
1737
1740
  };
1738
1741
  return n.addEventListener("mousedown", p), () => {
1739
- n.removeEventListener("mousedown", p), document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", g);
1742
+ n.removeEventListener("mousedown", p), document.removeEventListener("mousemove", u), document.removeEventListener("mouseup", g);
1740
1743
  };
1741
1744
  }
1742
- function ae(t, e, i) {
1745
+ function ce(t, e, i) {
1743
1746
  const o = e?.header?.toolbarContents ?? [], n = [...i.toolbarContents.values()], r = new Set(o.map((l) => l.id)), s = [...o];
1744
1747
  for (const l of n)
1745
1748
  r.has(l.id) || s.push(l);
@@ -1751,7 +1754,7 @@ function ae(t, e, i) {
1751
1754
  c && i.toolbarContentCleanups.set(l.id, c);
1752
1755
  }
1753
1756
  }
1754
- function ue(t, e) {
1757
+ function fe(t, e) {
1755
1758
  const i = e.lightDomHeaderContent.length > 0 && !e.lightDomContentMoved, o = e.headerContents.size > 0;
1756
1759
  if (!i && !o) return;
1757
1760
  const n = t.querySelector(".tbw-shell-content");
@@ -1771,7 +1774,7 @@ function ue(t, e) {
1771
1774
  c && e.headerContentCleanups.set(s.id, c);
1772
1775
  }
1773
1776
  }
1774
- function hi(t, e, i) {
1777
+ function ui(t, e, i) {
1775
1778
  if (!e.isPanelOpen) return;
1776
1779
  const o = N(i?.expand ?? M.expand), n = N(i?.collapse ?? M.collapse);
1777
1780
  for (const [r, s] of e.toolPanels) {
@@ -1780,32 +1783,32 @@ function hi(t, e, i) {
1780
1783
  a.classList.toggle("expanded", l);
1781
1784
  const d = a.querySelector(".tbw-accordion-header");
1782
1785
  d && d.setAttribute("aria-expanded", String(l));
1783
- const u = a.querySelector(".tbw-accordion-chevron");
1784
- if (u && (u.innerHTML = l ? n : o), l) {
1786
+ const f = a.querySelector(".tbw-accordion-chevron");
1787
+ if (f && (f.innerHTML = l ? n : o), l) {
1785
1788
  if (c.children.length === 0) {
1786
- const f = s.render(c);
1787
- f && e.panelCleanups.set(r, f);
1789
+ const u = s.render(c);
1790
+ u && e.panelCleanups.set(r, u);
1788
1791
  }
1789
1792
  } else {
1790
- const f = e.panelCleanups.get(r);
1791
- f && (f(), e.panelCleanups.delete(r)), c.innerHTML = "";
1793
+ const u = e.panelCleanups.get(r);
1794
+ u && (u(), e.panelCleanups.delete(r)), c.innerHTML = "";
1792
1795
  }
1793
1796
  }
1794
1797
  }
1795
- function Ne(t, e) {
1798
+ function Ie(t, e) {
1796
1799
  const i = t.querySelector("[data-panel-toggle]");
1797
1800
  i && (i.classList.toggle("active", e.isPanelOpen), i.setAttribute("aria-pressed", String(e.isPanelOpen)));
1798
1801
  }
1799
- function Ie(t, e) {
1802
+ function qe(t, e) {
1800
1803
  const i = t.querySelector(".tbw-tool-panel");
1801
1804
  i && (i.classList.toggle("open", e.isPanelOpen), e.isPanelOpen || (i.style.width = ""));
1802
1805
  }
1803
- function ce(t) {
1806
+ function de(t) {
1804
1807
  for (const e of t.toolbarContentCleanups.values())
1805
1808
  e();
1806
1809
  t.toolbarContentCleanups.clear();
1807
1810
  }
1808
- function ui(t) {
1811
+ function fi(t) {
1809
1812
  for (const e of t.headerContentCleanups.values())
1810
1813
  e();
1811
1814
  t.headerContentCleanups.clear();
@@ -1822,7 +1825,7 @@ function ui(t) {
1822
1825
  t.toolPanels.get(e)?.onClose?.();
1823
1826
  t.isPanelOpen = !1, t.expandedSections.clear(), t.toolPanels.clear(), t.headerContents.clear(), t.toolbarContents.clear(), t.lightDomHeaderContent = [], t.lightDomToolPanelIds.clear(), t.lightDomToolbarContentIds.clear(), t.lightDomContentMoved = !1;
1824
1827
  }
1825
- function fi(t, e) {
1828
+ function gi(t, e) {
1826
1829
  let i = !1;
1827
1830
  const o = {
1828
1831
  get isInitialized() {
@@ -1851,7 +1854,7 @@ function fi(t, e) {
1851
1854
  s && t.expandedSections.add(s.id);
1852
1855
  }
1853
1856
  const n = e.getShadow();
1854
- Ne(n, t), Ie(n, t), hi(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
1857
+ Ie(n, t), qe(n, t), ui(n, t, e.getAccordionIcons()), e.emit("tool-panel-open", { sections: o.expandedSections });
1855
1858
  },
1856
1859
  closeToolPanel() {
1857
1860
  if (!t.isPanelOpen) return;
@@ -1862,7 +1865,7 @@ function fi(t, e) {
1862
1865
  r.onClose?.();
1863
1866
  t.isPanelOpen = !1;
1864
1867
  const n = e.getShadow();
1865
- Ne(n, t), Ie(n, t), e.emit("tool-panel-close", {});
1868
+ Ie(n, t), qe(n, t), e.emit("tool-panel-close", {});
1866
1869
  },
1867
1870
  toggleToolPanel() {
1868
1871
  t.isPanelOpen ? o.closeToolPanel() : o.openToolPanel();
@@ -1878,16 +1881,16 @@ function fi(t, e) {
1878
1881
  const s = e.getShadow(), l = t.expandedSections.has(n);
1879
1882
  if (l) {
1880
1883
  const a = t.panelCleanups.get(n);
1881
- a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n), de(s, n, !1);
1884
+ a && (a(), t.panelCleanups.delete(n)), r.onClose?.(), t.expandedSections.delete(n), he(s, n, !1);
1882
1885
  } else {
1883
1886
  for (const [a, c] of t.toolPanels)
1884
1887
  if (a !== n && t.expandedSections.has(a)) {
1885
1888
  const d = t.panelCleanups.get(a);
1886
- d && (d(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), de(s, a, !1);
1887
- const u = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
1888
- u && (u.innerHTML = "");
1889
+ d && (d(), t.panelCleanups.delete(a)), c.onClose?.(), t.expandedSections.delete(a), he(s, a, !1);
1890
+ const f = s.querySelector(`[data-section="${a}"] .tbw-accordion-content`);
1891
+ f && (f.innerHTML = "");
1889
1892
  }
1890
- t.expandedSections.add(n), de(s, n, !0), gi(s, t, n);
1893
+ t.expandedSections.add(n), he(s, n, !0), pi(s, t, n);
1891
1894
  }
1892
1895
  e.emit("tool-panel-section-toggle", { id: n, expanded: !l });
1893
1896
  },
@@ -1916,7 +1919,7 @@ function fi(t, e) {
1916
1919
  console.warn(`[tbw-grid] Header content "${n.id}" already registered`);
1917
1920
  return;
1918
1921
  }
1919
- t.headerContents.set(n.id, n), i && ue(e.getShadow(), t);
1922
+ t.headerContents.set(n.id, n), i && fe(e.getShadow(), t);
1920
1923
  },
1921
1924
  unregisterHeaderContent(n) {
1922
1925
  const r = t.headerContentCleanups.get(n);
@@ -1941,11 +1944,11 @@ function fi(t, e) {
1941
1944
  };
1942
1945
  return o;
1943
1946
  }
1944
- function de(t, e, i) {
1947
+ function he(t, e, i) {
1945
1948
  const o = t.querySelector(`[data-section="${e}"]`);
1946
1949
  o && o.classList.toggle("expanded", i);
1947
1950
  }
1948
- function gi(t, e, i) {
1951
+ function pi(t, e, i) {
1949
1952
  const o = e.toolPanels.get(i);
1950
1953
  if (!o?.render) return;
1951
1954
  const n = t.querySelector(`[data-section="${i}"] .tbw-accordion-content`);
@@ -1953,8 +1956,8 @@ function gi(t, e, i) {
1953
1956
  const r = o.render(n);
1954
1957
  r && e.panelCleanups.set(i, r);
1955
1958
  }
1956
- function pi(t, e, i, o) {
1957
- const n = ot(e), r = [], s = [
1959
+ function wi(t, e, i, o) {
1960
+ const n = nt(e), r = [], s = [
1958
1961
  "tbw-grid-header",
1959
1962
  "tbw-grid-tool-buttons",
1960
1963
  "tbw-grid-tool-panel",
@@ -1968,12 +1971,12 @@ function pi(t, e, i, o) {
1968
1971
  for (const l of r)
1969
1972
  t.appendChild(l);
1970
1973
  if (n) {
1971
- const l = N(o?.toolPanel ?? M.toolPanel), a = N(o?.expand ?? M.expand), c = N(o?.collapse ?? M.collapse), u = [...e?.header?.toolbarContents ?? []].sort((y, E) => (y.order ?? 0) - (E.order ?? 0)), g = [...e?.toolPanels ?? []].sort((y, E) => (y.order ?? 100) - (E.order ?? 100)), p = {
1974
+ const l = N(o?.toolPanel ?? M.toolPanel), a = N(o?.expand ?? M.expand), c = N(o?.collapse ?? M.collapse), f = [...e?.header?.toolbarContents ?? []].sort((y, S) => (y.order ?? 0) - (S.order ?? 0)), g = [...e?.toolPanels ?? []].sort((y, S) => (y.order ?? 100) - (S.order ?? 100)), p = {
1972
1975
  title: e?.header?.title ?? void 0,
1973
1976
  hasPanels: g.length > 0,
1974
1977
  isPanelOpen: i.isPanelOpen,
1975
1978
  toolPanelIcon: l,
1976
- configButtons: u.map((y) => ({
1979
+ configButtons: f.map((y) => ({
1977
1980
  id: y.id,
1978
1981
  hasElement: !1,
1979
1982
  hasRender: !!y.render
@@ -1990,40 +1993,40 @@ function pi(t, e, i, o) {
1990
1993
  icon: N(y.icon),
1991
1994
  isExpanded: i.expandedSections.has(y.id)
1992
1995
  }))
1993
- }, w = ri(p), C = si(h), m = De({
1996
+ }, w = si(p), C = li(h), m = Oe({
1994
1997
  hasShell: !0,
1995
1998
  shellHeader: w,
1996
1999
  shellBody: C
1997
2000
  });
1998
2001
  t.appendChild(m);
1999
2002
  } else {
2000
- const l = De({ hasShell: !1 });
2003
+ const l = Oe({ hasShell: !1 });
2001
2004
  t.appendChild(l);
2002
2005
  }
2003
2006
  return n;
2004
2007
  }
2005
- const qe = "tbw-grid-styles";
2006
- let J = "";
2007
- const fe = /* @__PURE__ */ new Map();
2008
- function wi() {
2009
- let t = document.getElementById(qe);
2010
- return t || (t = document.createElement("style"), t.id = qe, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
2008
+ const $e = "tbw-grid-styles";
2009
+ let ee = "";
2010
+ const ge = /* @__PURE__ */ new Map();
2011
+ function bi() {
2012
+ let t = document.getElementById($e);
2013
+ return t || (t = document.createElement("style"), t.id = $e, t.setAttribute("data-tbw-grid", "true"), document.head.appendChild(t)), t;
2011
2014
  }
2012
- function ge() {
2013
- const t = wi(), e = Array.from(fe.values()).join(`
2015
+ function pe() {
2016
+ const t = bi(), e = Array.from(ge.values()).join(`
2014
2017
  `);
2015
- t.textContent = `${J}
2018
+ t.textContent = `${ee}
2016
2019
 
2017
2020
  /* Plugin Styles */
2018
2021
  ${e}`;
2019
2022
  }
2020
- function bi(t) {
2023
+ function mi(t) {
2021
2024
  let e = !1;
2022
2025
  for (const { name: i, styles: o } of t)
2023
- fe.has(i) || (fe.set(i, o), e = !0);
2024
- return e && ge(), e;
2026
+ ge.has(i) || (ge.set(i, o), e = !0);
2027
+ return e && pe(), e;
2025
2028
  }
2026
- function mi() {
2029
+ function vi() {
2027
2030
  try {
2028
2031
  for (const t of Array.from(document.styleSheets))
2029
2032
  try {
@@ -2039,22 +2042,22 @@ function mi() {
2039
2042
  }
2040
2043
  return null;
2041
2044
  }
2042
- async function vi(t) {
2043
- if (J)
2045
+ async function Ci(t) {
2046
+ if (ee)
2044
2047
  return;
2045
2048
  if (typeof t == "string" && t.length > 0) {
2046
- J = t, ge();
2049
+ ee = t, pe();
2047
2050
  return;
2048
2051
  }
2049
2052
  await new Promise((i) => setTimeout(i, 50));
2050
- const e = mi();
2051
- e ? (J = e, ge()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
2053
+ const e = vi();
2054
+ e ? (ee = e, pe()) : (typeof process > "u" || process.env?.NODE_ENV !== "test") && console.warn(
2052
2055
  "[tbw-grid] Could not find grid.css in document.styleSheets. Grid styling will not work.",
2053
2056
  "Available stylesheets:",
2054
2057
  Array.from(document.styleSheets).map((i) => i.href || "(inline)")
2055
2058
  );
2056
2059
  }
2057
- function Ci() {
2060
+ function yi() {
2058
2061
  return {
2059
2062
  startY: null,
2060
2063
  startX: null,
@@ -2068,19 +2071,19 @@ function Ci() {
2068
2071
  momentumRaf: 0
2069
2072
  };
2070
2073
  }
2071
- function yi(t) {
2074
+ function _i(t) {
2072
2075
  t.startY = null, t.startX = null, t.scrollTop = null, t.scrollLeft = null, t.lastY = null, t.lastX = null, t.lastTime = null;
2073
2076
  }
2074
- function nt(t) {
2077
+ function rt(t) {
2075
2078
  t.momentumRaf && (cancelAnimationFrame(t.momentumRaf), t.momentumRaf = 0);
2076
2079
  }
2077
- function _i(t, e, i) {
2080
+ function Ei(t, e, i) {
2078
2081
  if (t.touches.length !== 1) return;
2079
- nt(e);
2082
+ rt(e);
2080
2083
  const o = t.touches[0];
2081
2084
  e.startY = o.clientY, e.startX = o.clientX, e.lastY = o.clientY, e.lastX = o.clientX, e.lastTime = performance.now(), e.scrollTop = i.fauxScrollbar.scrollTop, e.scrollLeft = i.scrollArea?.scrollLeft ?? 0, e.velocityY = 0, e.velocityX = 0;
2082
2085
  }
2083
- function Ei(t, e, i) {
2086
+ function Si(t, e, i) {
2084
2087
  if (t.touches.length !== 1 || e.startY === null || e.startX === null || e.scrollTop === null || e.scrollLeft === null)
2085
2088
  return !1;
2086
2089
  const o = t.touches[0], n = o.clientY, r = o.clientX, s = performance.now(), l = e.startY - n, a = e.startX - r;
@@ -2089,7 +2092,7 @@ function Ei(t, e, i) {
2089
2092
  h > 0 && (e.velocityY = (e.lastY - n) / h, e.velocityX = (e.lastX - r) / h);
2090
2093
  }
2091
2094
  e.lastY = n, e.lastX = r, e.lastTime = s;
2092
- const { scrollTop: c, scrollHeight: d, clientHeight: u } = i.fauxScrollbar, f = d - u, g = l > 0 && c < f || l < 0 && c > 0;
2095
+ const { scrollTop: c, scrollHeight: d, clientHeight: f } = i.fauxScrollbar, u = d - f, g = l > 0 && c < u || l < 0 && c > 0;
2093
2096
  let p = !1;
2094
2097
  if (i.scrollArea) {
2095
2098
  const { scrollLeft: h, scrollWidth: w, clientWidth: C } = i.scrollArea, m = w - C;
@@ -2097,10 +2100,10 @@ function Ei(t, e, i) {
2097
2100
  }
2098
2101
  return g && (i.fauxScrollbar.scrollTop = e.scrollTop + l), p && i.scrollArea && (i.scrollArea.scrollLeft = e.scrollLeft + a), g || p;
2099
2102
  }
2100
- function Si(t, e) {
2101
- (Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Ri(t, e), yi(t);
2102
- }
2103
2103
  function Ri(t, e) {
2104
+ (Math.abs(t.velocityY) > 0.1 || Math.abs(t.velocityX) > 0.1) && Ai(t, e), _i(t);
2105
+ }
2106
+ function Ai(t, e) {
2104
2107
  const n = () => {
2105
2108
  t.velocityY *= 0.95, t.velocityX *= 0.95;
2106
2109
  const r = t.velocityY * 16, s = t.velocityX * 16;
@@ -2108,133 +2111,110 @@ function Ri(t, e) {
2108
2111
  };
2109
2112
  t.momentumRaf = requestAnimationFrame(n);
2110
2113
  }
2111
- function xi(t, e, i, o) {
2112
- t.addEventListener("touchstart", (n) => _i(n, e, i), {
2114
+ function Ti(t, e, i, o) {
2115
+ t.addEventListener("touchstart", (n) => Ei(n, e, i), {
2113
2116
  passive: !0,
2114
2117
  signal: o
2115
2118
  }), t.addEventListener(
2116
2119
  "touchmove",
2117
2120
  (n) => {
2118
- Ei(n, e, i) && n.preventDefault();
2121
+ Si(n, e, i) && n.preventDefault();
2119
2122
  },
2120
2123
  { passive: !1, signal: o }
2121
- ), t.addEventListener("touchend", () => Si(e, i), { passive: !0, signal: o });
2124
+ ), t.addEventListener("touchend", () => Ri(e, i), { passive: !0, signal: o });
2122
2125
  }
2123
- const Ai = [
2126
+ const xi = [
2124
2127
  {
2125
2128
  property: "editable",
2126
2129
  pluginName: "editing",
2127
2130
  level: "column",
2128
2131
  description: 'the "editable" column property',
2129
- importHint: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
2130
2132
  isUsed: (t) => t === !0
2131
2133
  },
2132
2134
  {
2133
2135
  property: "editor",
2134
2136
  pluginName: "editing",
2135
2137
  level: "column",
2136
- description: 'the "editor" column property',
2137
- importHint: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';"
2138
+ description: 'the "editor" column property'
2138
2139
  },
2139
2140
  {
2140
2141
  property: "editorParams",
2141
2142
  pluginName: "editing",
2142
2143
  level: "column",
2143
- description: 'the "editorParams" column property',
2144
- importHint: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';"
2144
+ description: 'the "editorParams" column property'
2145
2145
  },
2146
2146
  {
2147
2147
  property: "group",
2148
2148
  pluginName: "groupingColumns",
2149
2149
  level: "column",
2150
- description: 'the "group" column property',
2151
- importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';"
2150
+ description: 'the "group" column property'
2152
2151
  },
2153
2152
  {
2154
2153
  property: "sticky",
2155
2154
  pluginName: "pinnedColumns",
2156
2155
  level: "column",
2157
2156
  description: 'the "sticky" column property',
2158
- importHint: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
2159
2157
  isUsed: (t) => t === "left" || t === "right" || t === "start" || t === "end"
2160
2158
  }
2161
- ], Ti = [
2159
+ ], Hi = [
2162
2160
  {
2163
2161
  property: "columnGroups",
2164
2162
  pluginName: "groupingColumns",
2165
2163
  level: "config",
2166
2164
  description: 'the "columnGroups" config property',
2167
- importHint: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
2168
2165
  isUsed: (t) => Array.isArray(t) && t.length > 0
2169
2166
  }
2170
- ], Hi = {
2171
- editing: "import { EditingPlugin } from '@toolbox-web/grid/plugins/editing';",
2172
- selection: "import { SelectionPlugin } from '@toolbox-web/grid/plugins/selection';",
2173
- reorder: "import { ReorderPlugin } from '@toolbox-web/grid/plugins/reorder';",
2174
- clipboard: "import { ClipboardPlugin } from '@toolbox-web/grid/plugins/clipboard';",
2175
- filtering: "import { FilteringPlugin } from '@toolbox-web/grid/plugins/filtering';",
2176
- multiSort: "import { MultiSortPlugin } from '@toolbox-web/grid/plugins/multi-sort';",
2177
- groupingRows: "import { GroupingRowsPlugin } from '@toolbox-web/grid/plugins/grouping-rows';",
2178
- groupingColumns: "import { GroupingColumnsPlugin } from '@toolbox-web/grid/plugins/grouping-columns';",
2179
- tree: "import { TreePlugin } from '@toolbox-web/grid/plugins/tree';",
2180
- masterDetail: "import { MasterDetailPlugin } from '@toolbox-web/grid/plugins/master-detail';",
2181
- pinnedColumns: "import { PinnedColumnsPlugin } from '@toolbox-web/grid/plugins/pinned-columns';",
2182
- pinnedRows: "import { PinnedRowsPlugin } from '@toolbox-web/grid/plugins/pinned-rows';",
2183
- visibility: "import { VisibilityPlugin } from '@toolbox-web/grid/plugins/visibility';",
2184
- undoRedo: "import { UndoRedoPlugin } from '@toolbox-web/grid/plugins/undo-redo';",
2185
- export: "import { ExportPlugin } from '@toolbox-web/grid/plugins/export';",
2186
- contextMenu: "import { ContextMenuPlugin } from '@toolbox-web/grid/plugins/context-menu';",
2187
- pivot: "import { PivotPlugin } from '@toolbox-web/grid/plugins/pivot';",
2188
- serverSide: "import { ServerSidePlugin } from '@toolbox-web/grid/plugins/server-side';",
2189
- columnVirtualization: "import { ColumnVirtualizationPlugin } from '@toolbox-web/grid/plugins/column-virtualization';"
2190
- };
2191
- function pe(t) {
2192
- return Hi[t] ?? `import { ${z(t)}Plugin } from '@toolbox-web/grid/plugins/${t}';`;
2167
+ ];
2168
+ function Li(t) {
2169
+ return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
2170
+ }
2171
+ function we(t) {
2172
+ return `import { ${z(t)}Plugin } from '@toolbox-web/grid/plugins/${Li(t)}';`;
2193
2173
  }
2194
2174
  function z(t) {
2195
2175
  return t.charAt(0).toUpperCase() + t.slice(1);
2196
2176
  }
2197
- function $e(t, e) {
2177
+ function We(t, e) {
2198
2178
  return t.some((i) => i.name === e);
2199
2179
  }
2200
2180
  function Pi(t, e) {
2201
- const i = Ai, o = Ti, n = /* @__PURE__ */ new Map();
2202
- function r(l, a, c, d, u = !1) {
2203
- n.has(l) || n.set(l, { description: a, importHint: c, fields: [], isConfigProperty: u });
2204
- const f = n.get(l);
2205
- f.fields.includes(d) || f.fields.push(d);
2181
+ const i = xi, o = Hi, n = /* @__PURE__ */ new Map();
2182
+ function r(l, a, c, d, f = !1) {
2183
+ n.has(l) || n.set(l, { description: a, importHint: c, fields: [], isConfigProperty: f });
2184
+ const u = n.get(l);
2185
+ u.fields.includes(d) || u.fields.push(d);
2206
2186
  }
2207
2187
  for (const l of o) {
2208
2188
  const a = t[l.property];
2209
- (l.isUsed ? l.isUsed(a) : a !== void 0) && !$e(e, l.pluginName) && r(l.pluginName, l.description, l.importHint ?? pe(l.pluginName), l.property, !0);
2189
+ (l.isUsed ? l.isUsed(a) : a !== void 0) && !We(e, l.pluginName) && r(l.pluginName, l.description, we(l.pluginName), l.property, !0);
2210
2190
  }
2211
2191
  const s = t.columns;
2212
2192
  if (s && s.length > 0)
2213
2193
  for (const l of s)
2214
2194
  for (const a of i) {
2215
2195
  const c = l[a.property];
2216
- if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !$e(e, a.pluginName)) {
2217
- const u = l.field || "<unknown>";
2218
- r(a.pluginName, a.description, a.importHint ?? pe(a.pluginName), u);
2196
+ if ((a.isUsed ? a.isUsed(c) : c !== void 0) && !We(e, a.pluginName)) {
2197
+ const f = l.field || "<unknown>";
2198
+ r(a.pluginName, a.description, we(a.pluginName), f);
2219
2199
  }
2220
2200
  }
2221
2201
  if (n.size > 0) {
2222
2202
  const l = [];
2223
- for (const [a, { description: c, importHint: d, fields: u, isConfigProperty: f }] of n)
2224
- if (f)
2203
+ for (const [a, { description: c, importHint: d, fields: f, isConfigProperty: u }] of n)
2204
+ if (u)
2225
2205
  l.push(
2226
2206
  `Config uses ${c}, but the required plugin is not loaded.
2227
2207
  → Add the plugin to your gridConfig.plugins array:
2228
2208
  ${d}
2229
- plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
2209
+ plugins: [new ${z(a)}Plugin(), ...]`
2230
2210
  );
2231
2211
  else {
2232
- const g = u.slice(0, 3).join(", ") + (u.length > 3 ? `, ... (${u.length} total)` : "");
2212
+ const g = f.slice(0, 3).join(", ") + (f.length > 3 ? `, ... (${f.length} total)` : "");
2233
2213
  l.push(
2234
2214
  `Column(s) [${g}] use ${c}, but the required plugin is not loaded.
2235
2215
  → Add the plugin to your gridConfig.plugins array:
2236
2216
  ${d}
2237
- plugins: [new ${a.charAt(0).toUpperCase() + a.slice(1)}Plugin(), ...]`
2217
+ plugins: [new ${z(a)}Plugin(), ...]`
2238
2218
  );
2239
2219
  }
2240
2220
  throw new Error(
@@ -2248,7 +2228,7 @@ This validation helps catch misconfigurations early. The properties listed above
2248
2228
  );
2249
2229
  }
2250
2230
  }
2251
- function Li(t) {
2231
+ function zi(t) {
2252
2232
  const e = [], i = [];
2253
2233
  for (const o of t) {
2254
2234
  const r = o.constructor.manifest;
@@ -2261,7 +2241,7 @@ function Li(t) {
2261
2241
  }
2262
2242
  }
2263
2243
  }
2264
- if (i.length > 0 && be())
2244
+ if (i.length > 0 && me())
2265
2245
  for (const o of i)
2266
2246
  console.warn(o);
2267
2247
  if (e.length > 0)
@@ -2271,12 +2251,12 @@ ${e.join(`
2271
2251
 
2272
2252
  `)}`);
2273
2253
  }
2274
- function zi(t, e) {
2254
+ function Di(t, e) {
2275
2255
  const i = t.name, n = t.constructor.dependencies ?? [];
2276
2256
  for (const r of n) {
2277
2257
  const s = r.name, l = r.required ?? !0, a = r.reason;
2278
2258
  if (!e.some((d) => d.name === s)) {
2279
- const d = a ?? `${z(i)}Plugin requires ${z(s)}Plugin`, u = pe(s);
2259
+ const d = a ?? `${z(i)}Plugin requires ${z(s)}Plugin`, f = we(s);
2280
2260
  if (l)
2281
2261
  throw new Error(
2282
2262
  `[tbw-grid] Plugin dependency error:
@@ -2284,7 +2264,7 @@ function zi(t, e) {
2284
2264
  ${d}.
2285
2265
 
2286
2266
  → Add the plugin to your gridConfig.plugins array BEFORE ${z(i)}Plugin:
2287
- ${u}
2267
+ ${f}
2288
2268
  plugins: [new ${z(s)}Plugin(), new ${z(i)}Plugin()]`
2289
2269
  );
2290
2270
  console.info(
@@ -2293,8 +2273,8 @@ ${d}.
2293
2273
  }
2294
2274
  }
2295
2275
  }
2296
- function Di(t) {
2297
- if (!be()) return;
2276
+ function Oi(t) {
2277
+ if (!me()) return;
2298
2278
  const e = new Set(t.map((o) => o.name)), i = /* @__PURE__ */ new Set();
2299
2279
  for (const o of t) {
2300
2280
  const r = o.constructor.manifest;
@@ -2316,31 +2296,31 @@ ${z(o.name)}Plugin and ${z(s.name)}Plugin are both loaded, but they are currentl
2316
2296
  }
2317
2297
  }
2318
2298
  }
2319
- function rt(t, e) {
2299
+ function st(t, e) {
2320
2300
  return !t || typeof t != "object" ? t : "__rowCacheKey" in t ? t.__rowCacheKey : "rowId" in t && t.rowId != null ? `id:${t.rowId}` : e ? `id:${e(t)}` : t;
2321
2301
  }
2322
- function Oi(t, e, i) {
2323
- const o = rt(e, i);
2302
+ function Mi(t, e, i) {
2303
+ const o = st(e, i);
2324
2304
  if (typeof o == "string")
2325
2305
  return t.byKey.get(o);
2326
2306
  if (o && typeof o == "object")
2327
2307
  return t.byRef.get(o);
2328
2308
  }
2329
- function Mi(t, e, i, o) {
2330
- const n = rt(e, o);
2309
+ function ki(t, e, i, o) {
2310
+ const n = st(e, o);
2331
2311
  typeof n == "string" ? t.byKey.set(n, i) : n && typeof n == "object" && t.byRef.set(n, i);
2332
2312
  }
2333
- function ki(t, e, i, o, n) {
2313
+ function Ni(t, e, i, o, n) {
2334
2314
  const r = new Array(t.length);
2335
2315
  let s = 0;
2336
2316
  for (let l = 0; l < t.length; l++) {
2337
2317
  const a = t[l];
2338
2318
  let c = n?.(a, l), d = c !== void 0;
2339
- c === void 0 && (c = Oi(e, a, o.rowId), d = c !== void 0), c === void 0 && (c = i, d = !1), r[l] = { offset: s, height: c, measured: d }, s += c;
2319
+ c === void 0 && (c = Mi(e, a, o.rowId), d = c !== void 0), c === void 0 && (c = i, d = !1), r[l] = { offset: s, height: c, measured: d }, s += c;
2340
2320
  }
2341
2321
  return r;
2342
2322
  }
2343
- function we(t, e, i) {
2323
+ function be(t, e, i) {
2344
2324
  if (e < 0 || e >= t.length) return;
2345
2325
  const o = t[e], n = i - o.height;
2346
2326
  if (n !== 0) {
@@ -2349,12 +2329,12 @@ function we(t, e, i) {
2349
2329
  t[r].offset += n;
2350
2330
  }
2351
2331
  }
2352
- function Ni(t) {
2332
+ function Ii(t) {
2353
2333
  if (t.length === 0) return 0;
2354
2334
  const e = t[t.length - 1];
2355
2335
  return e.offset + e.height;
2356
2336
  }
2357
- function We(t, e) {
2337
+ function Fe(t, e) {
2358
2338
  if (t.length === 0) return -1;
2359
2339
  if (e <= 0) return 0;
2360
2340
  let i = 0, o = t.length - 1;
@@ -2369,42 +2349,42 @@ function We(t, e) {
2369
2349
  }
2370
2350
  return Math.max(0, Math.min(i, t.length - 1));
2371
2351
  }
2372
- function Ii(t, e) {
2352
+ function qi(t, e) {
2373
2353
  let i = 0, o = 0;
2374
2354
  for (const n of t)
2375
2355
  n.measured && (i += n.height, o++);
2376
2356
  return o > 0 ? i / o : e;
2377
2357
  }
2378
- function qi(t) {
2358
+ function $i(t) {
2379
2359
  let e = 0;
2380
2360
  for (const i of t)
2381
2361
  i.measured && e++;
2382
2362
  return e;
2383
2363
  }
2384
- function $i(t, e) {
2364
+ function Wi(t, e) {
2385
2365
  const { positionCache: i, heightCache: o, rows: n, start: r, end: s, getPluginHeight: l, getRowId: a } = t;
2386
2366
  let c = !1;
2387
- e.forEach((f) => {
2388
- const g = f.dataset.rowIndex;
2367
+ e.forEach((u) => {
2368
+ const g = u.dataset.rowIndex;
2389
2369
  if (!g) return;
2390
2370
  const p = parseInt(g, 10);
2391
2371
  if (p < r || p >= s || p >= n.length) return;
2392
2372
  const h = n[p], w = l?.(h, p);
2393
2373
  if (w !== void 0) {
2394
2374
  const m = i[p];
2395
- (!m.measured || Math.abs(m.height - w) > 1) && (we(i, p, w), c = !0);
2375
+ (!m.measured || Math.abs(m.height - w) > 1) && (be(i, p, w), c = !0);
2396
2376
  return;
2397
2377
  }
2398
- const C = f.offsetHeight;
2378
+ const C = u.offsetHeight;
2399
2379
  if (C > 0) {
2400
2380
  const m = i[p];
2401
- (!m.measured || Math.abs(m.height - C) > 1) && (we(i, p, C), Mi(o, h, C, a), c = !0);
2381
+ (!m.measured || Math.abs(m.height - C) > 1) && (be(i, p, C), ki(o, h, C, a), c = !0);
2402
2382
  }
2403
2383
  });
2404
- const d = c ? qi(i) : 0, u = c ? Ii(i, t.defaultHeight) : 0;
2405
- return { hasChanges: c, measuredCount: d, averageHeight: u };
2384
+ const d = c ? $i(i) : 0, f = c ? qi(i, t.defaultHeight) : 0;
2385
+ return { hasChanges: c, measuredCount: d, averageHeight: f };
2406
2386
  }
2407
- function Wi(t, e, i, o) {
2387
+ function Fi(t, e, i, o) {
2408
2388
  let n = 0, r = 0;
2409
2389
  for (let s = 0; s < t.length; s++) {
2410
2390
  const l = t[s];
@@ -2415,7 +2395,7 @@ function Wi(t, e, i, o) {
2415
2395
  averageHeight: n > 0 ? r / n : i
2416
2396
  };
2417
2397
  }
2418
- function eo(t) {
2398
+ function to(t) {
2419
2399
  const { totalRows: e, viewportHeight: i, scrollTop: o, rowHeight: n, overscan: r } = t, s = Math.ceil(i / n);
2420
2400
  let l = Math.floor(o / n) - r;
2421
2401
  l < 0 && (l = 0);
@@ -2427,10 +2407,10 @@ function eo(t) {
2427
2407
  totalHeight: e * n
2428
2408
  };
2429
2409
  }
2430
- function to(t, e) {
2410
+ function io(t, e) {
2431
2411
  return t <= e;
2432
2412
  }
2433
- class ie {
2413
+ class oe {
2434
2414
  constructor(e) {
2435
2415
  this.grid = e;
2436
2416
  }
@@ -2450,7 +2430,7 @@ class ie {
2450
2430
  this.attach(i);
2451
2431
  }
2452
2432
  attach(e) {
2453
- if (zi(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
2433
+ if (Di(e, this.plugins), this.pluginMap.set(e.constructor, e), this.plugins.push(e), e.cellRenderers)
2454
2434
  for (const [i, o] of Object.entries(e.cellRenderers))
2455
2435
  this.cellRenderers.set(i, o);
2456
2436
  if (e.headerRenderers)
@@ -2473,9 +2453,9 @@ class ie {
2473
2453
  }
2474
2454
  warnDeprecatedHooks(e) {
2475
2455
  const i = e.constructor;
2476
- if (ie.deprecationWarned.has(i) || !be()) return;
2456
+ if (oe.deprecationWarned.has(i) || !me()) return;
2477
2457
  const o = typeof e.getExtraHeight == "function" || typeof e.getExtraHeightBefore == "function", n = typeof e.getRowHeight == "function";
2478
- o && !n && (ie.deprecationWarned.add(i), console.warn(
2458
+ o && !n && (oe.deprecationWarned.add(i), console.warn(
2479
2459
  `[tbw-grid] Deprecation warning: "${e.name}" uses getExtraHeight() / getExtraHeightBefore() which are deprecated and will be removed in v3.0.
2480
2460
  → Migrate to getRowHeight(row, index) for better variable row height support.
2481
2461
  → See: https://toolbox-web.dev/docs/grid/plugins/migration#row-height-hooks`
@@ -2715,7 +2695,7 @@ class ie {
2715
2695
  return e.sort((i, o) => (i.content.order ?? 0) - (o.content.order ?? 0));
2716
2696
  }
2717
2697
  }
2718
- const Fi = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-spin{to{transform:rotate(360deg)}}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}", Ui = '@layer tbw-base{tbw-grid{color-scheme:inherit;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);font-feature-settings:"tnum","lnum";background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}&:has(.selected){user-select:none}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}}}', Vi = '@layer tbw-base{tbw-grid{.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0;.resize-handle{right:0;width:calc(var(--tbw-resize-handle-width) / 2)}}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}}}', Gi = '@layer tbw-base{.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);content:"";position:absolute;left:var(--tbw-spacing-md);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}}', Bi = "@layer tbw-base{@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}}", Xi = "@layer tbw-base{tbw-grid{.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}}}", Yi = "@layer tbw-base{tbw-grid{.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}}}", ji = "@layer tbw-base{tbw-grid{.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:start;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}}}", Ki = "@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-input: 1px solid var(--tbw-color-border-strong);--tbw-border-header: 1px solid var(--tbw-color-border-header);--tbw-row-divider: 1px solid var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline: 2px solid var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm)}}", Qi = `/**
2698
+ const Ui = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}.tbw-collapsing{animation:tbw-collapse var(--tbw-animation-duration) var(--tbw-animation-easing) forwards;overflow:hidden}&[data-animation-mode=off]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}tbw-grid .data-grid-row[data-animating=change]{animation:tbw-row-change var(--tbw-row-change-duration) ease-out}tbw-grid .data-grid-row[data-animating=insert]{animation:tbw-row-insert var(--tbw-row-insert-duration) ease-out;will-change:max-height,opacity}tbw-grid .data-grid-row[data-animating=remove]{animation:tbw-row-remove var(--tbw-row-remove-duration) ease-out forwards;will-change:max-height,opacity,transform;pointer-events:none}}@keyframes tbw-expand{0%{opacity:0;max-height:0;transform:translateY(-8px)}to{opacity:1;max-height:500px;transform:translateY(0)}}@keyframes tbw-collapse{0%{opacity:1;max-height:500px;transform:translateY(0)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-row-change{0%{background-color:transparent}20%{background-color:var(--tbw-row-change-color)}to{background-color:transparent}}@keyframes tbw-row-insert{0%{opacity:0;max-height:0;overflow:hidden}to{opacity:1;max-height:var(--tbw-row-height, 28px);overflow:hidden}}@keyframes tbw-row-remove{0%{opacity:1;transform:translateY(0);max-height:var(--tbw-row-height, 28px)}to{opacity:0;max-height:0;transform:translateY(-8px)}}@keyframes tbw-spin{to{transform:rotate(360deg)}}@keyframes tbw-fade-in{0%{opacity:0}to{opacity:1}}", Vi = '@layer tbw-base{tbw-grid{color-scheme:inherit;position:relative;display:block;width:100%;height:100%;min-height:0;contain:content;font-family:var(--tbw-font-family);font-size:var(--tbw-font-size);font-feature-settings:"tnum","lnum";background:var(--tbw-color-bg);color:var(--tbw-color-fg);border:1px solid var(--tbw-color-border);border-radius:var(--tbw-border-radius);overflow:clip;outline:none;&,*{box-sizing:border-box}.tbw-grid-root{position:relative;display:flex;flex-direction:column;height:100%;&.has-shell{display:flex;flex-direction:column;height:100%}&:has(.selected){user-select:none}}.rows-body-wrapper{flex:1;min-height:0;display:flex;flex-direction:row;width:100%;min-width:fit-content}.rows-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow:visible}.rows-container{display:flex;flex-direction:row;flex:1;min-height:0;overflow:visible}.rows-viewport{flex:1;min-width:0;position:relative;display:block;overflow:clip;.rows{position:absolute;top:0;left:0;min-width:100%;will-change:transform;z-index:var(--tbw-z-layer-rows, 1)}}.faux-vscroll{position:sticky;inset-inline-end:0;flex-shrink:0;width:auto;overflow-y:auto;overflow-x:hidden;z-index:var(--tbw-z-layer-header, 30)}.faux-vscroll-spacer{width:1px}&[data-has-focus]{.cell-focus,.row-focus{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}}.sticky-left,.sticky-right{position:sticky;z-index:25}.sticky-left{box-shadow:1px 0 0 var(--tbw-color-border)}.sticky-right{box-shadow:-1px 0 0 var(--tbw-color-border)}}}', Bi = '@layer tbw-base{tbw-grid{.header{display:block;flex-shrink:0;z-index:var(--tbw-z-layer-header, 30);background:var(--tbw-color-header-bg);overflow:visible}.header-group-row{display:grid;grid-template-columns:var(--tbw-column-template);background:var(--tbw-color-header-bg);z-index:var(--tbw-z-layer-header, 30)}.header-group-cell{display:flex;align-items:center;justify-content:flex-start;padding:var(--tbw-cell-padding-header, 2px 8px);color:var(--tbw-color-header-group-fg, var(--tbw-color-header-fg));font-weight:var(--tbw-font-weight-header-group, var(--tbw-font-weight-header));justify-content:var(--tbw-align-header-group, var(--tbw-align-header, flex-start));&:not(:last-child){border-right:2px solid var(--tbw-color-border)}}.header-row{display:grid;grid-template-columns:var(--tbw-column-template);color:var(--tbw-color-header-fg);font-size:var(--tbw-font-size-header);min-height:var(--tbw-header-height);border-bottom:var(--tbw-border-header);z-index:var(--tbw-z-layer-header, 30);text-transform:var(--tbw-header-text-transform);letter-spacing:var(--tbw-header-letter-spacing);>.cell{display:flex;align-items:center;gap:4px;padding:var(--tbw-cell-padding-header, 2px 8px);background-color:var(--tbw-color-header-bg);font-weight:var(--tbw-font-weight-header);border-right:1px solid var(--tbw-color-border-cell);overflow:visible;min-width:0;>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:inherit}>span[part~=sort-indicator]{flex-shrink:0;opacity:.6;color:var(--tbw-sort-indicator-color);display:var(--tbw-sort-indicator-display, inline-flex);visibility:var(--tbw-sort-indicator-visibility, visible);transition:opacity .15s,visibility 0s,display 0s allow-discrete;transition-behavior:allow-discrete}&:hover>span[part~=sort-indicator]{display:inline-flex;visibility:visible}&[aria-sort=ascending]>span[part~=sort-indicator],&[aria-sort=descending]>span[part~=sort-indicator]{display:inline-flex;visibility:visible;opacity:1;color:var(--tbw-sort-indicator-active-color)}&:last-child{border-right:0;.resize-handle{right:0;width:calc(var(--tbw-resize-handle-width) / 2)}}&.grouped.group-end:not(:last-child){border-right:2px solid var(--tbw-color-border)}&.resizable{position:relative}&.sticky-left,&.sticky-right{background:var(--tbw-color-header-bg);z-index:35}}}.sortable{cursor:pointer;user-select:none}.resize-handle{position:absolute;top:0;right:calc(var(--tbw-resize-handle-width) / -2);width:var(--tbw-resize-handle-width);height:100%;cursor:e-resize;user-select:none;touch-action:none;z-index:20;background:var(--tbw-resize-handle-color);transition:background .12s ease;border-radius:var(--tbw-resize-handle-border-radius);&:after{content:"";position:absolute;top:100%;left:50%;transform:translate(-50%);width:var(--tbw-resize-indicator-width, 2px);height:0;background:var(--tbw-resize-indicator-color, var(--tbw-color-accent));opacity:0;pointer-events:none;transition:opacity .12s ease,height 0s .12s;z-index:1000}&:hover{background:var(--tbw-resize-handle-color-hover);&:after{height:100vh;opacity:var(--tbw-resize-indicator-opacity, .6);transition:opacity .12s ease,height 0s}}}}}', Gi = '@layer tbw-base{.tbw-loading-overlay{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:1000;pointer-events:all;animation:tbw-fade-in .15s ease-out}.tbw-spinner{--tbw-spinner-size: 48px;--tbw-spinner-border-width: 3px;--tbw-spinner-color: var(--tbw-color-accent);--tbw-spinner-track-color: var(--tbw-color-border);width:var(--tbw-spinner-size);height:var(--tbw-spinner-size);border:var(--tbw-spinner-border-width) solid var(--tbw-spinner-track-color);border-top-color:var(--tbw-spinner-color);border-radius:50%;animation:tbw-spin .8s linear infinite}.tbw-spinner--large{--tbw-spinner-size: min(48px, calc(100% - 16px) )}.tbw-spinner--small{--tbw-spinner-size: calc(var(--tbw-row-height, 28px) * .6);--tbw-spinner-border-width: 2px}.data-grid-row.tbw-row-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .6);content:"";position:absolute;left:var(--tbw-spacing-md);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}.cell.tbw-cell-loading{position:relative;pointer-events:none;&:before{content:"";position:absolute;inset:0;background:light-dark(rgba(255,255,255,.7),rgba(0,0,0,.5));z-index:10;animation:tbw-fade-in .15s ease-out}&:after{--_spinner-size: calc(var(--tbw-row-height, 28px) * .5);content:"";position:absolute;left:var(--tbw-spacing-sm);top:0;bottom:0;margin:auto 0;width:var(--_spinner-size);height:var(--_spinner-size);border:2px solid var(--tbw-spinner-track-color, var(--tbw-color-border));border-top-color:var(--tbw-spinner-color, var(--tbw-color-accent));border-radius:50%;animation:tbw-spin .8s linear infinite;z-index:11}}}', Xi = "@layer tbw-base{@media(forced-colors:active){tbw-grid{--tbw-color-border: CanvasText;--tbw-color-border-strong: CanvasText;--tbw-color-border-cell: CanvasText;--tbw-color-border-header: CanvasText;--tbw-color-fg: CanvasText;--tbw-color-bg: Canvas;--tbw-color-panel-bg: Canvas;--tbw-color-header-bg: Canvas;--tbw-color-header-fg: CanvasText;--tbw-color-accent: Highlight;--tbw-color-accent-fg: HighlightText;--tbw-color-selection: Highlight;--tbw-color-row-hover: Highlight;--tbw-focus-outline: 2px solid Highlight;--tbw-range-border-color: Highlight;.cell:focus,.cell.active-cell{outline:2px solid Highlight!important;outline-offset:-2px}.data-grid-row[aria-selected=true]{background:Highlight!important;color:HighlightText!important}}}@media(prefers-reduced-motion:reduce){tbw-grid[data-animation-mode=reduced-motion]{--tbw-animation-enabled: 0;--tbw-animation-duration: 0ms;.data-grid-row[data-animating]{animation:none}}}}", Yi = "@layer tbw-base{tbw-grid{.data-grid-row{display:grid;grid-template-columns:var(--tbw-column-template);contain:layout style;&:nth-child(2n){background:var(--tbw-color-row-alt)}&:hover{background:var(--tbw-color-row-hover)}>.cell{display:block;padding:var(--tbw-cell-padding, 2px 8px);border-bottom:var(--tbw-row-divider);min-height:var(--tbw-row-height);align-content:center;border-right:1px solid var(--tbw-color-border-cell);overflow:hidden;min-width:0;white-space:var(--tbw-cell-white-space, nowrap);text-overflow:ellipsis;>*{overflow:hidden;text-overflow:ellipsis;white-space:inherit;min-width:0}&:last-child{border-right:0}&[data-type=boolean]{text-align:center;input[type=checkbox]{margin:0;width:var(--tbw-checkbox-size);height:var(--tbw-checkbox-size);vertical-align:middle}}&.selected:focus-visible,&:focus-visible:not(.cell-focus){outline:none}&.sticky-left,&.sticky-right{background:var(--tbw-color-panel-bg)}}}.selecting .data-grid-row>.cell{user-select:none}}}", ji = "@layer tbw-base{tbw-grid{.tbw-shell-header{display:flex;align-items:center;gap:8px;min-height:var(--tbw-shell-header-height);padding:0 8px;background:var(--tbw-shell-header-bg);border-bottom:1px solid var(--tbw-shell-header-border);flex-shrink:0}.tbw-shell-title{font-size:var(--tbw-shell-title-font-size);font-weight:var(--tbw-shell-title-font-weight);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-shell-content{flex:1;display:flex;align-items:center;gap:12px;min-width:0;overflow:hidden}.tbw-shell-toolbar{display:flex;align-items:center;gap:var(--tbw-toolbar-button-gap);flex-shrink:0}.tbw-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:var(--tbw-toolbar-button-size);height:var(--tbw-toolbar-button-size);padding:0;border:1px solid transparent;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg);cursor:pointer;font-size:16px;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease),border-color var(--tbw-transition-duration) var(--tbw-transition-ease);&:hover{background:var(--tbw-color-row-hover)}&:focus-visible{outline:var(--tbw-focus-outline);outline-offset:var(--tbw-focus-outline-offset)}&.active{background:var(--tbw-focus-background);border-color:var(--tbw-color-accent)}&:disabled{opacity:.5;cursor:not-allowed}}.tbw-toolbar-separator{width:1px;height:20px;background:var(--tbw-color-border);margin:0 4px}.tbw-shell-body{position:relative;display:flex;flex:1;min-height:0;overflow:visible}.tbw-grid-content{flex:1;min-width:0;min-height:0;display:flex;flex-direction:row;overflow:hidden}.tbw-scroll-area{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;overflow-x:auto;overflow-y:hidden;overflow-anchor:none}}}", Ki = "@layer tbw-base{tbw-grid{.tbw-tool-panel{position:absolute;top:0;bottom:0;right:0;width:0;overflow:hidden;background:var(--tbw-tool-panel-bg);border-left:1px solid var(--tbw-tool-panel-border);transition:width var(--tbw-tool-panel-transition);display:flex;flex-direction:column;z-index:30;box-shadow:-2px 0 8px var(--tbw-color-shadow);&[data-position=left]{right:auto;left:0;border-left:none;border-right:1px solid var(--tbw-tool-panel-border);box-shadow:2px 0 8px var(--tbw-color-shadow)}&.open{width:var(--tbw-tool-panel-width)}}.tbw-tool-panel-resize{position:absolute;top:0;bottom:0;width:6px;cursor:col-resize;background:transparent;z-index:10;transition:background var(--tbw-transition-duration) var(--tbw-transition-ease);&[data-handle-position=left]{left:0}&[data-handle-position=right]{right:0}&:hover,&.resizing{background:var(--tbw-color-accent)}}.tbw-tool-panel-header{display:flex;align-items:center;justify-content:space-between;min-height:var(--tbw-tool-panel-header-height);padding:0 12px;border-bottom:1px solid var(--tbw-tool-panel-border);flex-shrink:0}.tbw-tool-panel-title{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tbw-tool-panel-close{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:none;border-radius:var(--tbw-border-radius);background:transparent;color:var(--tbw-color-fg-muted);cursor:pointer;font-size:14px;&:hover{background:var(--tbw-color-row-hover);color:var(--tbw-color-fg)}}.tbw-tool-panel-content{flex:1;overflow:auto}.tbw-accordion{display:flex;flex-direction:column;gap:0}.tbw-accordion-section{border-bottom:1px solid var(--tbw-tool-panel-border);&:last-child{border-bottom:none}&.single .tbw-accordion-header{cursor:default;&:hover{background:transparent}}&.expanded{.tbw-accordion-chevron{transform:rotate(90deg)}.tbw-accordion-content{display:block}}}.tbw-accordion-header{display:flex;align-items:center;gap:8px;width:100%;padding:10px 12px;border:none;background:transparent;color:var(--tbw-color-fg);font-size:13px;font-weight:600;text-align:start;cursor:pointer;user-select:none;&:hover{background:var(--tbw-color-row-hover)}}.tbw-accordion-chevron{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:10px;color:var(--tbw-color-fg-muted);transition:transform .15s ease;flex-shrink:0}.tbw-accordion-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;font-size:14px;flex-shrink:0}.tbw-accordion-title{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tbw-accordion-content{display:none}}}", Qi = "@layer tbw-base{tbw-grid{--tbw-base-icon-size: 1em;--tbw-base-radius: .25em;--tbw-font-size: 1em;--tbw-font-size-sm: .9285em;--tbw-font-size-xs: .7857em;--tbw-font-size-2xs: .7142em;--tbw-spacing-xs: .25em;--tbw-spacing-sm: .375em;--tbw-spacing-md: .5em;--tbw-spacing-lg: .75em;--tbw-spacing-xl: 1em;--tbw-icon-size: var(--tbw-base-icon-size);--tbw-icon-size-sm: .875em;--tbw-checkbox-size: var(--tbw-base-icon-size);--tbw-toggle-size: 1.25em;--tbw-border-radius: var(--tbw-base-radius);--tbw-color-bg: transparent;--tbw-color-panel-bg: light-dark(#eeeeee, #222222);--tbw-color-fg: light-dark(#222222, #eeeeee);--tbw-color-fg-muted: light-dark(#555555, #aaaaaa);--tbw-color-accent: light-dark(#3b82f6, #3b82f6);--tbw-color-accent-fg: light-dark(#ffffff, #000000);--tbw-color-success: light-dark(hsl(122, 39%, 40%), hsl(122, 39%, 49%));--tbw-color-warning: light-dark(hsl(38, 92%, 50%), hsl(38, 92%, 50%));--tbw-color-error: light-dark(hsl(0, 65%, 51%), hsl(0, 65%, 55%));--tbw-color-danger: var(--tbw-color-error);--tbw-color-selection: light-dark(#fff7d6, #333333);--tbw-color-row-alt: var(--tbw-color-bg);--tbw-color-row-hover: light-dark(#f0f6ff, #1c1c1c);--tbw-color-header-bg: color-mix(in hsl, var(--tbw-color-panel-bg) 85%, var(--tbw-color-fg));--tbw-color-header-fg: color-mix(in hsl, var(--tbw-color-fg) 75%, var(--tbw-color-panel-bg));--tbw-color-border: light-dark(#d0d0d4, #454545);--tbw-color-border-strong: light-dark(#777777, #666666);--tbw-color-border-cell: var(--tbw-color-border);--tbw-color-border-header: var(--tbw-color-border);--tbw-color-shadow: light-dark(rgba(0, 0, 0, .1), rgba(0, 0, 0, .3));--tbw-font-family: inherit;--tbw-font-size-header: var(--tbw-font-size);--tbw-font-weight-header: bold;--tbw-cell-padding-header: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-cell-padding-v: var(--tbw-spacing-xs);--tbw-cell-padding-h: var(--tbw-spacing-md);--tbw-cell-padding: var(--tbw-cell-padding-v) var(--tbw-cell-padding-h);--tbw-cell-padding-input: var(--tbw-spacing-xs) var(--tbw-spacing-sm);--tbw-row-height: 1.75em;--tbw-header-height: 1.875em;--tbw-cell-white-space: nowrap;--tbw-border-width: 1px;--tbw-border-style: solid;--tbw-border-input: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-strong);--tbw-border-header: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-header);--tbw-row-divider: var(--tbw-border-width) var(--tbw-border-style) var(--tbw-color-border-cell);--tbw-row-hover-outline: 0;--tbw-color-active-row-bg: var(--tbw-color-selection);--tbw-active-row-outline: 0;--tbw-focus-outline-width: 2px;--tbw-focus-outline: var(--tbw-focus-outline-width) var(--tbw-border-style) var(--tbw-color-accent);--tbw-focus-outline-offset: -2px;--tbw-focus-background: rgba(from var(--tbw-color-accent) r g b / 12%);--tbw-range-border-color: var(--tbw-color-accent);--tbw-range-selection-bg: rgba(from var(--tbw-range-border-color) r g b / 12%);--tbw-resize-handle-width: var(--tbw-spacing-sm);--tbw-resize-handle-color: transparent;--tbw-resize-handle-color-hover: var(--tbw-color-accent);--tbw-resize-handle-border-radius: 0;--tbw-resize-indicator-width: 2px;--tbw-resize-indicator-color: var(--tbw-color-accent);--tbw-resize-indicator-opacity: .6;--tbw-transition-duration: .12s;--tbw-transition-ease: ease;--tbw-animation-duration: .2s;--tbw-animation-easing: ease-out;--tbw-animation-enabled: 1;--tbw-row-change-duration: .5s;--tbw-row-insert-duration: .3s;--tbw-row-remove-duration: .2s;--tbw-row-change-color: rgba(from var(--tbw-color-accent) r g b / 25%);--tbw-sort-indicator-color: var(--tbw-color-fg-muted);--tbw-sort-indicator-active-color: var(--tbw-color-accent);--tbw-sort-indicator-display: inline-flex;--tbw-sort-indicator-visibility: visible;--tbw-header-text-transform: none;--tbw-header-letter-spacing: normal;--tbw-color-header-separator: var(--tbw-color-border-cell);--tbw-density-scale: 1;--tbw-shell-header-height: 2.75em;--tbw-shell-header-bg: var(--tbw-color-panel-bg);--tbw-shell-header-border: var(--tbw-color-border);--tbw-shell-title-font-size: var(--tbw-font-size);--tbw-shell-title-font-weight: 600;--tbw-tool-panel-width: 17.5em;--tbw-tool-panel-bg: var(--tbw-color-panel-bg);--tbw-tool-panel-border: var(--tbw-color-border);--tbw-tool-panel-header-height: 2.5em;--tbw-tool-panel-transition: var(--tbw-animation-duration) var(--tbw-animation-easing);--tbw-toolbar-button-size: 2em;--tbw-toolbar-button-gap: var(--tbw-spacing-xs);--tbw-panel-padding: var(--tbw-spacing-lg);--tbw-panel-gap: var(--tbw-spacing-md);--tbw-menu-item-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-menu-item-gap: var(--tbw-spacing-md);--tbw-menu-min-width: 10rem;--tbw-button-padding: var(--tbw-spacing-sm) var(--tbw-spacing-lg);--tbw-button-padding-sm: var(--tbw-spacing-xs) var(--tbw-spacing-md);--tbw-input-height: var(--tbw-row-height);--tbw-input-padding: 0 var(--tbw-spacing-md);--tbw-detail-padding: var(--tbw-spacing-xl);--tbw-detail-max-height: 31.25rem;--tbw-indicator-size: var(--tbw-spacing-sm)}}", Zi = `/**
2719
2699
  * tbw-grid Light DOM Styles
2720
2700
  *
2721
2701
  * This stylesheet uses CSS nesting to scope all styles to the tbw-grid element.
@@ -2734,19 +2714,19 @@ const Fi = "@layer tbw-base{tbw-grid{.tbw-expanding{animation:tbw-expand var(--t
2734
2714
  /* Declare layer order - earlier layers have lower priority */
2735
2715
  @layer tbw-base, tbw-plugins, tbw-theme;
2736
2716
 
2737
- ${Ki}
2738
- ${Ui}
2717
+ ${Qi}
2739
2718
  ${Vi}
2740
- ${Xi}
2719
+ ${Bi}
2741
2720
  ${Yi}
2742
2721
  ${ji}
2722
+ ${Ki}
2743
2723
  ${Gi}
2744
- ${Fi}
2745
- ${Bi}
2724
+ ${Ui}
2725
+ ${Xi}
2746
2726
  `;
2747
2727
  class k extends HTMLElement {
2748
2728
  static tagName = "tbw-grid";
2749
- static version = "1.12.1";
2729
+ static version = "1.14.0";
2750
2730
  static #l = 0;
2751
2731
  static adapters = [];
2752
2732
  static registerAdapter(e) {
@@ -2783,10 +2763,10 @@ class k extends HTMLElement {
2783
2763
  #C = 0;
2784
2764
  #r = null;
2785
2765
  #g = !1;
2786
- #A = !1;
2766
+ #T = !1;
2787
2767
  #m = 0;
2788
2768
  #z;
2789
- #k = Ci();
2769
+ #k = yi();
2790
2770
  #b;
2791
2771
  #y;
2792
2772
  #p;
@@ -2806,16 +2786,16 @@ class k extends HTMLElement {
2806
2786
  #V;
2807
2787
  #O;
2808
2788
  #t;
2809
- #i = li();
2789
+ #i = ai();
2810
2790
  #c;
2811
2791
  #I;
2812
2792
  #q = !1;
2813
- #T = /* @__PURE__ */ new Set();
2793
+ #x = /* @__PURE__ */ new Set();
2814
2794
  #H = /* @__PURE__ */ new Map();
2815
2795
  #$;
2816
2796
  #S = /* @__PURE__ */ new Map();
2817
2797
  _rows = [];
2818
- #G = [];
2798
+ #B = [];
2819
2799
  get _columns() {
2820
2800
  return this.#o.columns ?? [];
2821
2801
  }
@@ -2847,7 +2827,9 @@ class k extends HTMLElement {
2847
2827
  measuredCount: 0,
2848
2828
  variableHeights: !1,
2849
2829
  cachedViewportHeight: 0,
2850
- cachedFauxHeight: 0
2830
+ cachedFauxHeight: 0,
2831
+ cachedScrollAreaHeight: 0,
2832
+ scrollAreaEl: null
2851
2833
  };
2852
2834
  _focusRow = 0;
2853
2835
  _focusCol = 0;
@@ -2907,11 +2889,11 @@ class k extends HTMLElement {
2907
2889
  }
2908
2890
  set loading(e) {
2909
2891
  const i = this.#q;
2910
- this.#q = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), i !== e && this.#Le();
2892
+ this.#q = e, e ? this.setAttribute("loading", "") : this.removeAttribute("loading"), i !== e && this.#Pe();
2911
2893
  }
2912
2894
  setRowLoading(e, i) {
2913
- const o = this.#T.has(e);
2914
- i ? this.#T.add(e) : this.#T.delete(e), o !== i && this.#de(e, i);
2895
+ const o = this.#x.has(e);
2896
+ i ? this.#x.add(e) : this.#x.delete(e), o !== i && this.#de(e, i);
2915
2897
  }
2916
2898
  setCellLoading(e, i, o) {
2917
2899
  let n = this.#H.get(e);
@@ -2919,16 +2901,16 @@ class k extends HTMLElement {
2919
2901
  o ? (n || (n = /* @__PURE__ */ new Set(), this.#H.set(e, n)), n.add(i)) : (n?.delete(i), n?.size === 0 && this.#H.delete(e)), r !== o && this.#he(e, i, o);
2920
2902
  }
2921
2903
  isRowLoading(e) {
2922
- return this.#T.has(e);
2904
+ return this.#x.has(e);
2923
2905
  }
2924
2906
  isCellLoading(e, i) {
2925
2907
  return this.#H.get(e)?.has(i) ?? !1;
2926
2908
  }
2927
2909
  clearAllLoading() {
2928
2910
  this.loading = !1;
2929
- for (const e of this.#T)
2911
+ for (const e of this.#x)
2930
2912
  this.#de(e, !1);
2931
- this.#T.clear();
2913
+ this.#x.clear();
2932
2914
  for (const [e, i] of this.#H)
2933
2915
  for (const o of i)
2934
2916
  this.#he(e, o, !1);
@@ -2941,53 +2923,53 @@ class k extends HTMLElement {
2941
2923
  return this.#b || (this.#b = new AbortController()), this.#b.signal;
2942
2924
  }
2943
2925
  constructor() {
2944
- super(), this.#we(), this.#d = new Promise((e) => this.#h = e), this.#s = new Qt({
2926
+ super(), this.#we(), this.#d = new Promise((e) => this.#h = e), this.#s = new Zt({
2945
2927
  mergeConfig: () => {
2946
- this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), Pi(this.#o, this.#e?.getPlugins() ?? []), Li(this.#e?.getPlugins() ?? []), Di(this.#e?.getPlugins() ?? []), this.#Pe(), this.#G = [...this._columns];
2928
+ this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), Pi(this.#o, this.#e?.getPlugins() ?? []), zi(this.#e?.getPlugins() ?? []), Oi(this.#e?.getPlugins() ?? []), this.#Le(), this.#B = [...this._columns];
2947
2929
  },
2948
- processColumns: () => this.#Ae(),
2949
- processRows: () => this.#Te(),
2950
- renderHeader: () => te(this),
2951
- updateTemplate: () => F(this),
2930
+ processColumns: () => this.#Te(),
2931
+ processRows: () => this.#xe(),
2932
+ renderHeader: () => ie(this),
2933
+ updateTemplate: () => U(this),
2952
2934
  renderVirtualWindow: () => this.refreshVirtualWindow(!0, !0),
2953
2935
  afterRender: () => {
2954
2936
  this.#e?.afterRender(), this._virtualization.enabled && this._virtualization.totalHeightEl && queueMicrotask(() => {
2955
2937
  if (!this._virtualization.totalHeightEl) return;
2956
- const i = this.#x(this._rows.length);
2938
+ const i = this.#A(this._rows.length);
2957
2939
  this._virtualization.totalHeightEl.style.height = `${i}px`;
2958
- }), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, Ee(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, I(this)), this._virtualization.enabled && !this.#F && this.#ve(), this.#A && (this.#A = !1, requestAnimationFrame(() => {
2940
+ }), this.#o.fitMode === "fixed" && !this.__didInitialAutoSize && (this.__didInitialAutoSize = !0, Se(this)), this._restoreFocusAfterRender && (this._restoreFocusAfterRender = !1, q(this)), this._virtualization.enabled && !this.#F && this.#ve(), this.#T && (this.#T = !1, requestAnimationFrame(() => {
2959
2941
  requestAnimationFrame(() => {
2960
2942
  this.#me();
2961
2943
  });
2962
2944
  }));
2963
2945
  },
2964
2946
  isConnected: () => this.isConnected && this.#f
2965
- }), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = fi(this.#i, {
2947
+ }), this.#s.setInitialReadyResolver(() => this.#h?.()), this.#c = gi(this.#i, {
2966
2948
  getShadow: () => this.#n,
2967
2949
  getShellConfig: () => this.#o?.shell,
2968
2950
  getAccordionIcons: () => ({
2969
2951
  expand: this.#o?.icons?.expand ?? M.expand,
2970
2952
  collapse: this.#o?.icons?.collapse ?? M.collapse
2971
2953
  }),
2972
- emit: (e, i) => this.#P(e, i),
2954
+ emit: (e, i) => this.#L(e, i),
2973
2955
  refreshShellHeader: () => this.refreshShellHeader()
2974
- }), this.#t = new xt({
2956
+ }), this.#t = new Tt({
2975
2957
  getRows: () => this.#a,
2976
2958
  getSortState: () => this._sortState,
2977
2959
  setSortState: (e) => {
2978
2960
  this._sortState = e;
2979
2961
  },
2980
2962
  onConfigChange: () => {
2981
- this.#s.requestPhase(T.FULL, "configChange");
2963
+ this.#s.requestPhase(x.FULL, "configChange");
2982
2964
  },
2983
- emit: (e, i) => this.#P(e, i),
2965
+ emit: (e, i) => this.#L(e, i),
2984
2966
  clearRowPool: () => {
2985
2967
  this._rowPool.length = 0, this._bodyEl && (this._bodyEl.innerHTML = ""), this.__rowRenderEpoch++;
2986
2968
  },
2987
- setup: () => this.#L(),
2988
- renderHeader: () => te(this),
2989
- updateTemplate: () => F(this),
2990
- refreshVirtualWindow: () => this.#s.requestPhase(T.VIRTUALIZATION, "configManager"),
2969
+ setup: () => this.#P(),
2970
+ renderHeader: () => ie(this),
2971
+ updateTemplate: () => U(this),
2972
+ refreshVirtualWindow: () => this.#s.requestPhase(x.VIRTUALIZATION, "configManager"),
2991
2973
  getVirtualization: () => this._virtualization,
2992
2974
  setRowHeight: (e) => {
2993
2975
  this._virtualization.rowHeight = e;
@@ -3002,7 +2984,7 @@ class k extends HTMLElement {
3002
2984
  });
3003
2985
  }
3004
2986
  async #we() {
3005
- await vi(Qi);
2987
+ await Ci(Zi);
3006
2988
  }
3007
2989
  getPlugin(e) {
3008
2990
  return this.#e?.getPlugin(e);
@@ -3011,28 +2993,28 @@ class k extends HTMLElement {
3011
2993
  return this.#e?.getPluginByName(e);
3012
2994
  }
3013
2995
  requestRender() {
3014
- this.#s.requestPhase(T.ROWS, "plugin:requestRender");
2996
+ this.#s.requestPhase(x.ROWS, "plugin:requestRender");
3015
2997
  }
3016
2998
  requestColumnsRender() {
3017
- this.#s.requestPhase(T.COLUMNS, "plugin:requestColumnsRender");
2999
+ this.#s.requestPhase(x.COLUMNS, "plugin:requestColumnsRender");
3018
3000
  }
3019
3001
  requestRenderWithFocus() {
3020
- this._restoreFocusAfterRender = !0, this.#s.requestPhase(T.ROWS, "plugin:requestRenderWithFocus");
3002
+ this._restoreFocusAfterRender = !0, this.#s.requestPhase(x.ROWS, "plugin:requestRenderWithFocus");
3021
3003
  }
3022
3004
  updateTemplate() {
3023
- F(this);
3005
+ U(this);
3024
3006
  }
3025
3007
  requestAfterRender() {
3026
- this.#s.requestPhase(T.STYLE, "plugin:requestAfterRender");
3008
+ this.#s.requestPhase(x.STYLE, "plugin:requestAfterRender");
3027
3009
  }
3028
3010
  #J() {
3029
- this.#e = new ie(this);
3011
+ this.#e = new oe(this);
3030
3012
  const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
3031
3013
  this.#e.attachAll(i);
3032
3014
  }
3033
3015
  #W() {
3034
3016
  const e = this.#e?.getPluginStyles() ?? [];
3035
- bi(e);
3017
+ mi(e);
3036
3018
  }
3037
3019
  #ee() {
3038
3020
  const e = this.#o?.plugins, i = Array.isArray(e) ? e : [];
@@ -3058,7 +3040,7 @@ class k extends HTMLElement {
3058
3040
  const o = this.#g;
3059
3041
  if (this.#g = this.#e?.getAll().some((n) => n.onScroll) ?? !1, !o && this.#g) {
3060
3042
  const r = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3061
- this.#B(r);
3043
+ this.#G(r);
3062
3044
  }
3063
3045
  }
3064
3046
  #be() {
@@ -3090,9 +3072,9 @@ class k extends HTMLElement {
3090
3072
  };
3091
3073
  }
3092
3074
  connectedCallback() {
3093
- this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", k.version), this.id || (this.id = `tbw-grid-${++k.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#b && (this.#b.abort(), this.#N = !1), this.#b = new AbortController(), this.#E && (Le(this.#E), this.#E = void 0), this.#M(), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#J();
3075
+ this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("version") || this.setAttribute("version", k.version), this.id || (this.id = `tbw-grid-${++k.#l}`), this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#b && (this.#b.abort(), this.#N = !1), this.#b = new AbortController(), this.#E && (ze(this.#E), this.#E = void 0), this.#M(), this.#t.parseLightDomColumns(this), this.#t.merge(), this.#J();
3094
3076
  const e = this.#o?.plugins;
3095
- this.#_ = Array.isArray(e) ? e : [], this.#te(), this.#u || (this.#Q(), this.#W(), this.#u = !0), this.#oe(), this.#E = Ut(
3077
+ this.#_ = Array.isArray(e) ? e : [], this.#te(), this.#u || (this.#Q(), this.#W(), this.#u = !0), this.#oe(), this.#E = Vt(
3096
3078
  () => {
3097
3079
  this.#Me();
3098
3080
  },
@@ -3100,7 +3082,7 @@ class k extends HTMLElement {
3100
3082
  );
3101
3083
  }
3102
3084
  disconnectedCallback() {
3103
- this.#E && (Le(this.#E), this.#E = void 0), this.#m && (clearTimeout(this.#m), this.#m = 0), this.#be(), ui(this.#i), this.#c.setInitialized(!1), this.#I?.(), this.#I = void 0, nt(this.#k), this.#b && (this.#b.abort(), this.#b = void 0), this.#D?.abort(), this.#D = void 0, this.#N = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#p && (this.#p.disconnect(), this.#p = void 0, this.#F = !1), B(this), this.#R.clear(), this.#_ = void 0;
3085
+ this.#E && (ze(this.#E), this.#E = void 0), this.#m && (clearTimeout(this.#m), this.#m = 0), this.#be(), fi(this.#i), this.#c.setInitialized(!1), this.#I?.(), this.#I = void 0, rt(this.#k), this.#b && (this.#b.abort(), this.#b = void 0), this.#D?.abort(), this.#D = void 0, this.#N = !1, this._resizeController && this._resizeController.dispose(), this.#y && (this.#y.disconnect(), this.#y = void 0), this.#p && (this.#p.disconnect(), this.#p = void 0, this.#F = !1), X(this), this.#R.clear(), this.#_ = void 0;
3104
3086
  for (const e of this._rowPool)
3105
3087
  e.remove();
3106
3088
  this._rowPool.length = 0, this.__rowsBodyEl = null, this.#f = !1;
@@ -3124,19 +3106,19 @@ class k extends HTMLElement {
3124
3106
  #oe() {
3125
3107
  const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3126
3108
  if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
3127
- ue(this.#n, this.#i), ae(this.#n, this.#o?.shell, this.#i);
3109
+ fe(this.#n, this.#i), ce(this.#n, this.#o?.shell, this.#i);
3128
3110
  const n = this.#o?.shell?.toolPanel?.defaultOpen;
3129
3111
  n && this.#i.toolPanels.has(n) && (this.openToolPanel(), this.#i.expandedSections.add(n));
3130
3112
  }
3131
- if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = ze(this), this.#L(), this.#B(i), this.#N)
3113
+ if (this.setAttribute("data-upgraded", ""), this.#f = !0, this._resizeController = De(this), this.#P(), this.#G(i), this.#N)
3132
3114
  return;
3133
3115
  this.#N = !0;
3134
3116
  const o = this.disconnectSignal;
3135
- It(this, this, this.#n, o), this.#ne(), queueMicrotask(() => this.#Ce()), this.#s.requestPhase(T.FULL, "afterConnect");
3117
+ qt(this, this, this.#n, o), this.#ne(), queueMicrotask(() => this.#Ce()), this.#s.requestPhase(x.FULL, "afterConnect");
3136
3118
  }
3137
3119
  #ne() {
3138
3120
  const e = this.#o.rowHeight, i = this.#e.hasRowHeightPlugin();
3139
- typeof e == "function" || i ? this._virtualization.variableHeights || (this._virtualization.variableHeights = !0, this._virtualization.rowHeight = typeof e == "number" && e > 0 ? e : this._virtualization.rowHeight || 28, this.#K(), typeof e != "function" && (this.#A = !0)) : !i && typeof e != "function" && this._virtualization.variableHeights ? (this._virtualization.variableHeights = !1, this._virtualization.positionCache = null) : typeof e == "number" && e > 0 ? (this._virtualization.rowHeight = e, this._virtualization.variableHeights = !1) : requestAnimationFrame(() => this.#re());
3121
+ typeof e == "function" || i ? this._virtualization.variableHeights || (this._virtualization.variableHeights = !0, this._virtualization.rowHeight = typeof e == "number" && e > 0 ? e : this._virtualization.rowHeight || 28, this.#K(), typeof e != "function" && (this.#T = !0)) : !i && typeof e != "function" && this._virtualization.variableHeights ? (this._virtualization.variableHeights = !1, this._virtualization.positionCache = null) : typeof e == "number" && e > 0 ? (this._virtualization.rowHeight = e, this._virtualization.variableHeights = !1) : requestAnimationFrame(() => this.#re());
3140
3122
  }
3141
3123
  #re() {
3142
3124
  if (this.#e.hasExtraHeight())
@@ -3150,7 +3132,7 @@ class k extends HTMLElement {
3150
3132
  l > o && (o = l);
3151
3133
  });
3152
3134
  const n = e.getBoundingClientRect(), r = Math.max(n.height, o);
3153
- r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(T.VIRTUALIZATION, "measureRowHeight"));
3135
+ r > 0 && Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r, this.#s.requestPhase(x.VIRTUALIZATION, "measureRowHeight"));
3154
3136
  }
3155
3137
  #me() {
3156
3138
  const e = this._bodyEl?.querySelector(".data-grid-row");
@@ -3163,11 +3145,11 @@ class k extends HTMLElement {
3163
3145
  });
3164
3146
  const n = e.getBoundingClientRect(), r = Math.max(n.height, o);
3165
3147
  if (r > 0 && (Math.abs(r - this._virtualization.rowHeight) > 1 && (this._virtualization.rowHeight = r), this.#K(), this._virtualization.totalHeightEl)) {
3166
- const l = this.#x(this._rows.length);
3148
+ const l = this.#A(this._rows.length);
3167
3149
  this._virtualization.totalHeightEl.style.height = `${l}px`;
3168
3150
  }
3169
3151
  }
3170
- #B(e) {
3152
+ #G(e) {
3171
3153
  this.#D?.abort(), this.#D = new AbortController();
3172
3154
  const i = this.#D.signal, o = e?.querySelector(".faux-vscroll"), n = e?.querySelector(".rows");
3173
3155
  if (this._virtualization.container = o ?? this, this.#g = this.#e?.getAll().some((r) => r.onScroll) ?? !1, o && n) {
@@ -3180,14 +3162,14 @@ class k extends HTMLElement {
3180
3162
  n.style.transform = `translateY(${-a}px)`;
3181
3163
  else {
3182
3164
  const d = this._virtualization.positionCache;
3183
- let u, f;
3165
+ let f, u;
3184
3166
  if (this._virtualization.variableHeights && d && d.length > 0) {
3185
- u = We(d, a), u === -1 && (u = 0);
3186
- const p = u - u % 2;
3187
- f = d[p]?.offset ?? p * c;
3167
+ f = Fe(d, a), f === -1 && (f = 0);
3168
+ const p = f - f % 2;
3169
+ u = d[p]?.offset ?? p * c;
3188
3170
  } else
3189
- u = Math.floor(a / c), f = (u - u % 2) * c;
3190
- const g = -(a - f);
3171
+ f = Math.floor(a / c), u = (f - f % 2) * c;
3172
+ const g = -(a - u);
3191
3173
  n.style.transform = `translateY(${g}px)`;
3192
3174
  }
3193
3175
  this.#r = a, this.#C || (this.#C = requestAnimationFrame(() => {
@@ -3197,7 +3179,7 @@ class k extends HTMLElement {
3197
3179
  { passive: !0, signal: i }
3198
3180
  );
3199
3181
  const r = this.#n.querySelector(".tbw-scroll-area");
3200
- this.#V = r, r && this.#g && r.addEventListener(
3182
+ this.#V = r, this._virtualization.scrollAreaEl = r, r && this.#g && r.addEventListener(
3201
3183
  "scroll",
3202
3184
  () => {
3203
3185
  const a = this.#Z;
@@ -3211,23 +3193,23 @@ class k extends HTMLElement {
3211
3193
  (a) => {
3212
3194
  const c = a.shiftKey || Math.abs(a.deltaX) > Math.abs(a.deltaY);
3213
3195
  if (c && l) {
3214
- const d = a.shiftKey ? a.deltaY : a.deltaX, { scrollLeft: u, scrollWidth: f, clientWidth: g } = l;
3215
- (d > 0 && u < f - g || d < 0 && u > 0) && (a.preventDefault(), l.scrollLeft += d);
3196
+ const d = a.shiftKey ? a.deltaY : a.deltaX, { scrollLeft: f, scrollWidth: u, clientWidth: g } = l;
3197
+ (d > 0 && f < u - g || d < 0 && f > 0) && (a.preventDefault(), l.scrollLeft += d);
3216
3198
  } else if (!c) {
3217
- const { scrollTop: d, scrollHeight: u, clientHeight: f } = o;
3218
- (a.deltaY > 0 && d < u - f || a.deltaY < 0 && d > 0) && (a.preventDefault(), o.scrollTop += a.deltaY);
3199
+ const { scrollTop: d, scrollHeight: f, clientHeight: u } = o;
3200
+ (a.deltaY > 0 && d < f - u || a.deltaY < 0 && d > 0) && (a.preventDefault(), o.scrollTop += a.deltaY);
3219
3201
  }
3220
3202
  },
3221
3203
  { passive: !1, signal: i }
3222
- ), xi(
3204
+ ), Ti(
3223
3205
  s,
3224
3206
  this.#k,
3225
3207
  { fauxScrollbar: o, scrollArea: l },
3226
3208
  i
3227
3209
  ));
3228
3210
  }
3229
- this._bodyEl && Nt(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
3230
- this.#ke(), this.#s.requestPhase(T.VIRTUALIZATION, "resize-observer");
3211
+ this._bodyEl && It(this, this._bodyEl, i), this.#y?.disconnect(), this._virtualization.viewportEl && (this.#y = new ResizeObserver(() => {
3212
+ this.#ke(), this.#s.requestPhase(x.VIRTUALIZATION, "resize-observer");
3231
3213
  }), this.#y.observe(this._virtualization.viewportEl)), this.#n.addEventListener(
3232
3214
  "focusin",
3233
3215
  () => {
@@ -3257,7 +3239,7 @@ class k extends HTMLElement {
3257
3239
  removeEventListener(e, i, o) {
3258
3240
  super.removeEventListener(e, i, o);
3259
3241
  }
3260
- #P(e, i) {
3242
+ #L(e, i) {
3261
3243
  this.dispatchEvent(new CustomEvent(e, { detail: i, bubbles: !0, composed: !0 }));
3262
3244
  }
3263
3245
  #Ce() {
@@ -3289,7 +3271,7 @@ class k extends HTMLElement {
3289
3271
  e.columns && this.#Ee(), e.rows && this.#se(), e.fitMode && this.#Se();
3290
3272
  }
3291
3273
  #se() {
3292
- this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(T.ROWS, "applyRowsUpdate");
3274
+ this._rows = Array.isArray(this.#a) ? [...this.#a] : [], this.#X(), this.#s.requestPhase(x.ROWS, "applyRowsUpdate");
3293
3275
  }
3294
3276
  #X() {
3295
3277
  this.#S.clear();
@@ -3315,34 +3297,34 @@ class k extends HTMLElement {
3315
3297
  return o;
3316
3298
  }
3317
3299
  #Ee() {
3318
- B(this), this.#t.merge(), this.#L();
3300
+ X(this), this.#t.merge(), this.#P();
3319
3301
  }
3320
3302
  #Se() {
3321
- this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, Ee(this)) : (this._columns.forEach((i) => {
3303
+ this.#t.merge(), this.#o.fitMode === "fixed" ? (this.__didInitialAutoSize = !1, Se(this)) : (this._columns.forEach((i) => {
3322
3304
  !i.__userResized && i.__autoSized && delete i.width;
3323
- }), F(this));
3305
+ }), U(this));
3324
3306
  }
3325
3307
  #Re() {
3326
- Oe(this, this.#i), Me(this, this.#i);
3308
+ Me(this, this.#i), ke(this, this.#i);
3327
3309
  const e = !!this.#n.querySelector(".has-shell"), i = !!this.#n.querySelector(".tbw-tool-panel"), o = this.#n.querySelectorAll(".tbw-accordion-section").length;
3328
- this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), ke(this, this.#i, this.#ie()), this.#t.markSourcesChanged(), this.#t.merge();
3329
- const n = ot(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = this.#o?.shell?.toolPanels?.length ?? 0;
3310
+ this.#t.parseLightDomColumns(this), this.#t.merge(), this.#ee(), Ne(this, this.#i, this.#ie()), this.#t.markSourcesChanged(), this.#t.merge();
3311
+ const n = nt(this.#o?.shell), r = (this.#o?.shell?.toolPanels?.length ?? 0) > 0, s = this.#o?.shell?.toolPanels?.length ?? 0;
3330
3312
  if (e !== n || !i && r || i && s !== o) {
3331
- ce(this.#i), this.#Q(), this.#W(), this.#oe(), this.#X();
3313
+ de(this.#i), this.#Q(), this.#W(), this.#oe(), this.#X();
3332
3314
  return;
3333
3315
  }
3334
- e && this.#xe(), this.#X(), this.#s.requestPhase(T.COLUMNS, "applyGridConfigUpdate");
3316
+ e && this.#Ae(), this.#X(), this.#s.requestPhase(x.COLUMNS, "applyGridConfigUpdate");
3335
3317
  }
3336
- #xe() {
3318
+ #Ae() {
3337
3319
  const e = this.#n.querySelector(".tbw-shell-header");
3338
3320
  if (!e) return;
3339
3321
  const i = this.#o.shell?.header?.title ?? this.#i.lightDomTitle;
3340
3322
  let o = e.querySelector(".tbw-shell-title");
3341
3323
  i ? (o || (o = document.createElement("h2"), o.className = "tbw-shell-title", o.setAttribute("part", "shell-title"), e.insertBefore(o, e.firstChild)), o.textContent = i) : o && o.remove();
3342
3324
  }
3343
- #Ae() {
3325
+ #Te() {
3344
3326
  if (this.#e) {
3345
- const e = this.#G.length > 0 ? this.#G : this._columns, i = e.filter((r) => !r.hidden), o = e.filter((r) => r.hidden), n = this.#e.processColumns([...i]);
3327
+ const e = this.#B.length > 0 ? this.#B : this._columns, i = e.filter((r) => !r.hidden), o = e.filter((r) => r.hidden), n = this.#e.processColumns([...i]);
3346
3328
  if (n !== i) {
3347
3329
  const r = new Set(n.map((l) => l.field));
3348
3330
  !i.some((l) => r.has(l.field)) && n.length > 0 ? this._columns = [...n, ...o] : this._columns = [...n, ...o];
@@ -3350,38 +3332,38 @@ class k extends HTMLElement {
3350
3332
  this._columns = [...e];
3351
3333
  }
3352
3334
  }
3353
- #Te() {
3354
- B(this);
3335
+ #xe() {
3336
+ X(this);
3355
3337
  const e = Array.isArray(this.#a) ? [...this.#a] : [], i = this.#e?.processRows(e) ?? e;
3356
3338
  this._rows = i, this._virtualization.variableHeights && this.#K();
3357
3339
  }
3358
3340
  #He(e) {
3359
3341
  const i = {
3360
- ...dt,
3342
+ ...ht,
3361
3343
  ...e.animation
3362
3344
  }, o = i.mode ?? "reduced-motion";
3363
3345
  let n = 1;
3364
3346
  o === !1 || o === "off" ? n = 0 : (o === !0 || o === "on") && (n = 1), this.style.setProperty("--tbw-animation-duration", `${i.duration}ms`), this.style.setProperty("--tbw-animation-easing", i.easing ?? "ease-out"), this.style.setProperty("--tbw-animation-enabled", String(n)), this.dataset.animationMode = typeof o == "boolean" ? o ? "on" : "off" : o;
3365
3347
  }
3366
3348
  #Y(e, i, o = this.__rowRenderEpoch) {
3367
- this.#z || (this.#z = (n, r, s) => this.#e?.renderRow(n, r, s) ?? !1), Lt(this, e, i, o, this.#z);
3349
+ this.#z || (this.#z = (n, r, s) => this.#e?.renderRow(n, r, s) ?? !1), zt(this, e, i, o, this.#z);
3368
3350
  }
3369
- #ae = st();
3351
+ #ae = lt();
3370
3352
  #ce(e, i) {
3371
- lt(this.#ae, this.__rowsBodyEl, this._bodyEl, e, i);
3372
- }
3373
- #Pe() {
3374
- ct(this.#ae, this.__rowsBodyEl, this.#o, this.#i);
3353
+ at(this.#ae, this.__rowsBodyEl, this._bodyEl, e, i);
3375
3354
  }
3376
3355
  #Le() {
3356
+ dt(this.#ae, this.__rowsBodyEl, this.#o, this.#i);
3357
+ }
3358
+ #Pe() {
3377
3359
  const e = this.querySelector(".tbw-grid-root");
3378
- e && (this.#q ? (this.#$ || (this.#$ = Bt(this.#o?.loadingRenderer)), Xt(e, this.#$)) : Yt(this.#$));
3360
+ e && (this.#q ? (this.#$ || (this.#$ = Xt(this.#o?.loadingRenderer)), Yt(e, this.#$)) : jt(this.#$));
3379
3361
  }
3380
3362
  #de(e, i) {
3381
3363
  const o = this.#S.get(e);
3382
3364
  if (!o) return;
3383
3365
  const n = this.findRenderedRowElement?.(o.index);
3384
- n && jt(n, i);
3366
+ n && Kt(n, i);
3385
3367
  }
3386
3368
  #he(e, i, o) {
3387
3369
  const n = this.#S.get(e);
@@ -3391,9 +3373,9 @@ class k extends HTMLElement {
3391
3373
  const s = this._visibleColumns.findIndex((a) => a.field === i);
3392
3374
  if (s < 0) return;
3393
3375
  const l = r.children[s];
3394
- l && Kt(l, o);
3376
+ l && Qt(l, o);
3395
3377
  }
3396
- #L() {
3378
+ #P() {
3397
3379
  if (this.isConnected && !(!this._headerRowEl || !this._bodyEl)) {
3398
3380
  if (this.#t.parseLightDomColumns(this), this.#O) {
3399
3381
  const e = this.#O;
@@ -3401,7 +3383,7 @@ class k extends HTMLElement {
3401
3383
  const i = this.#e?.getAll() ?? [];
3402
3384
  this.#t.applyState(e, i);
3403
3385
  }
3404
- this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(T.FULL, "setup");
3386
+ this._bodyEl && (this._bodyEl.style.display = "", this._bodyEl.style.gridTemplateColumns = ""), this.#s.requestPhase(x.FULL, "setup");
3405
3387
  }
3406
3388
  }
3407
3389
  #ze(e) {
@@ -3454,8 +3436,8 @@ class k extends HTMLElement {
3454
3436
  value: a,
3455
3437
  cellEl: n,
3456
3438
  originalEvent: e
3457
- }, u = this.#e?.onCellClick(d) ?? !1;
3458
- return this.#P("cell-click", d), u;
3439
+ }, f = this.#e?.onCellClick(d) ?? !1;
3440
+ return this.#L("cell-click", d), f;
3459
3441
  }
3460
3442
  _dispatchRowClick(e, i, o, n) {
3461
3443
  if (!o) return !1;
@@ -3465,7 +3447,7 @@ class k extends HTMLElement {
3465
3447
  rowEl: n,
3466
3448
  originalEvent: e
3467
3449
  }, s = this.#e?.onRowClick(r) ?? !1;
3468
- return this.#P("row-click", r), s;
3450
+ return this.#L("row-click", r), s;
3469
3451
  }
3470
3452
  _dispatchHeaderClick(e, i, o) {
3471
3453
  const n = this._columns[i];
@@ -3516,7 +3498,7 @@ class k extends HTMLElement {
3516
3498
  return this.#d;
3517
3499
  }
3518
3500
  async forceLayout() {
3519
- return this.#s.requestPhase(T.FULL, "forceLayout"), this.#s.whenReady();
3501
+ return this.#s.requestPhase(x.FULL, "forceLayout"), this.#s.whenReady();
3520
3502
  }
3521
3503
  async getConfig() {
3522
3504
  return Object.freeze({ ...this.#o || {} });
@@ -3539,7 +3521,7 @@ class k extends HTMLElement {
3539
3521
  d !== c && (l.push({ field: a, oldValue: d, newValue: c }), r[a] = c);
3540
3522
  }
3541
3523
  for (const { field: a, oldValue: c, newValue: d } of l)
3542
- this.#P("cell-change", {
3524
+ this.#L("cell-change", {
3543
3525
  row: r,
3544
3526
  rowId: e,
3545
3527
  rowIndex: s,
@@ -3549,7 +3531,7 @@ class k extends HTMLElement {
3549
3531
  changes: i,
3550
3532
  source: o
3551
3533
  });
3552
- l.length > 0 && this.#s.requestPhase(T.ROWS, "updateRow");
3534
+ l.length > 0 && this.#s.requestPhase(x.ROWS, "updateRow");
3553
3535
  }
3554
3536
  updateRows(e, i = "api") {
3555
3537
  let o = !1;
@@ -3561,29 +3543,29 @@ class k extends HTMLElement {
3561
3543
  );
3562
3544
  const { row: l, index: a } = s;
3563
3545
  for (const [c, d] of Object.entries(r)) {
3564
- const u = l[c];
3565
- u !== d && (o = !0, l[c] = d, this.#P("cell-change", {
3546
+ const f = l[c];
3547
+ f !== d && (o = !0, l[c] = d, this.#L("cell-change", {
3566
3548
  row: l,
3567
3549
  rowId: n,
3568
3550
  rowIndex: a,
3569
3551
  field: c,
3570
- oldValue: u,
3552
+ oldValue: f,
3571
3553
  newValue: d,
3572
3554
  changes: r,
3573
3555
  source: i
3574
3556
  }));
3575
3557
  }
3576
3558
  }
3577
- o && this.#s.requestPhase(T.ROWS, "updateRows");
3559
+ o && this.#s.requestPhase(x.ROWS, "updateRows");
3578
3560
  }
3579
3561
  animateRow(e, i) {
3580
- Ce(this, e, i);
3562
+ ye(this, e, i);
3581
3563
  }
3582
3564
  animateRows(e, i) {
3583
- oi(this, e, i);
3565
+ ni(this, e, i);
3584
3566
  }
3585
3567
  animateRowById(e, i) {
3586
- return ni(this, e, i);
3568
+ return ri(this, e, i);
3587
3569
  }
3588
3570
  setColumnVisible(e, i) {
3589
3571
  const o = this.#t.setColumnVisible(e, i);
@@ -3620,7 +3602,7 @@ class k extends HTMLElement {
3620
3602
  }
3621
3603
  #De(e) {
3622
3604
  const i = this.#e?.getAll() ?? [];
3623
- this.#t.applyState(e, i), this.#L();
3605
+ this.#t.applyState(e, i), this.#P();
3624
3606
  }
3625
3607
  requestStateChange() {
3626
3608
  const e = this.#e?.getAll() ?? [];
@@ -3629,7 +3611,7 @@ class k extends HTMLElement {
3629
3611
  resetColumnState() {
3630
3612
  this.#O = void 0, this.__originalOrder = [];
3631
3613
  const e = this.#e?.getAll() ?? [];
3632
- this.#t.resetState(e), this.#t.merge(), this.#L();
3614
+ this.#t.resetState(e), this.#t.merge(), this.#P();
3633
3615
  }
3634
3616
  get isToolPanelOpen() {
3635
3617
  return this.#c.isPanelOpen;
@@ -3682,17 +3664,17 @@ class k extends HTMLElement {
3682
3664
  #j = !1;
3683
3665
  refreshShellHeader() {
3684
3666
  this.#j || (this.#j = !0, queueMicrotask(() => {
3685
- this.#j = !1, this.isConnected && (this.#M(), this.#t.markSourcesChanged(), this.#t.merge(), ce(this.#i), this.#Q(), this.#W(), this.#Oe());
3667
+ this.#j = !1, this.isConnected && (this.#M(), this.#t.markSourcesChanged(), this.#t.merge(), de(this.#i), this.#Q(), this.#W(), this.#Oe());
3686
3668
  }));
3687
3669
  }
3688
3670
  #Oe() {
3689
3671
  const i = this.#n.querySelector(".tbw-grid-content") ?? this.#n.querySelector(".tbw-grid-root");
3690
3672
  if (this._headerRowEl = i?.querySelector(".header-row"), this._virtualization.totalHeightEl = i?.querySelector(".faux-vscroll-spacer"), this._virtualization.viewportEl = i?.querySelector(".rows-viewport"), this._bodyEl = i?.querySelector(".rows"), this.__rowsBodyEl = i?.querySelector(".rows-body"), this.#c.isInitialized) {
3691
- ue(this.#n, this.#i), ae(this.#n, this.#o?.shell, this.#i);
3673
+ fe(this.#n, this.#i), ce(this.#n, this.#o?.shell, this.#i);
3692
3674
  const o = this.#o?.shell?.toolPanel?.defaultOpen;
3693
3675
  o && this.#i.toolPanels.has(o) && (this.openToolPanel(), this.#i.expandedSections.add(o));
3694
3676
  }
3695
- this._resizeController = ze(this), this.#B(i), this.#s.requestPhase(T.COLUMNS, "shellRefresh");
3677
+ this._resizeController = De(this), this.#G(i), this.#s.requestPhase(x.COLUMNS, "shellRefresh");
3696
3678
  }
3697
3679
  #R = /* @__PURE__ */ new Map();
3698
3680
  registerStyles(e, i) {
@@ -3712,20 +3694,20 @@ class k extends HTMLElement {
3712
3694
  document.adoptedStyleSheets = [...i, ...e];
3713
3695
  }
3714
3696
  #M() {
3715
- Oe(this, this.#i), Me(this, this.#i), ke(this, this.#i, this.#ie());
3697
+ Me(this, this.#i), ke(this, this.#i), Ne(this, this.#i, this.#ie());
3716
3698
  }
3717
3699
  #fe() {
3718
3700
  const e = this.#n.querySelector(".tbw-shell-header");
3719
3701
  if (!e) return;
3720
- ce(this.#i);
3721
- const i = ai(
3702
+ de(this.#i);
3703
+ const i = ci(
3722
3704
  this.#o.shell,
3723
3705
  this.#i,
3724
3706
  this.#o.icons?.toolPanel
3725
3707
  ), o = document.createElement("div");
3726
3708
  o.innerHTML = i;
3727
3709
  const n = o.firstElementChild;
3728
- n && (e.replaceWith(n), this.#pe(), ae(this.#n, this.#o?.shell, this.#i));
3710
+ n && (e.replaceWith(n), this.#pe(), ce(this.#n, this.#o?.shell, this.#i));
3729
3711
  }
3730
3712
  #Me() {
3731
3713
  const e = () => {
@@ -3734,30 +3716,39 @@ class k extends HTMLElement {
3734
3716
  const r = this.#i.lightDomTitle, s = this.#i.hasToolButtonsContainer;
3735
3717
  (r && !o || s && !n) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#fe());
3736
3718
  }, i = () => {
3737
- this.__lightDomColumnsCache = void 0, this.#L();
3719
+ this.__lightDomColumnsCache = void 0, this.#P();
3738
3720
  };
3739
3721
  this.#t.registerLightDomHandler("tbw-grid-header", e), this.#t.registerLightDomHandler("tbw-grid-tool-buttons", e), this.#t.registerLightDomHandler("tbw-grid-tool-panel", e), this.#t.registerLightDomHandler("tbw-grid-column", i), this.#t.registerLightDomHandler("tbw-grid-detail", i), this.#t.observeLightDOM(this);
3740
3722
  }
3741
3723
  refreshColumns() {
3742
- this.__lightDomColumnsCache = void 0, B(this), this.#t.parseLightDomColumns(this);
3724
+ this.__lightDomColumnsCache = void 0, X(this), this.#t.parseLightDomColumns(this);
3743
3725
  const e = this.#i.lightDomTitle, i = this.#i.hasToolButtonsContainer;
3744
3726
  this.#M();
3745
3727
  const o = this.#i.lightDomTitle, n = this.#i.hasToolButtonsContainer;
3746
- (o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#fe()), this.#s.requestPhase(T.COLUMNS, "refreshColumns");
3728
+ (o && !e || n && !i) && (this.#t.markSourcesChanged(), this.#t.merge(), this.#fe()), this.#s.requestPhase(x.COLUMNS, "refreshColumns");
3747
3729
  }
3748
3730
  #ke() {
3749
3731
  const e = this._virtualization.container, i = this._virtualization.viewportEl ?? e;
3750
3732
  i && (this._virtualization.cachedViewportHeight = i.clientHeight), e && (this._virtualization.cachedFauxHeight = e.clientHeight);
3751
- }
3752
- #x(e) {
3753
- const i = this._virtualization.container ?? this, o = this._virtualization.viewportEl ?? i, n = i.clientHeight, r = o.clientHeight, s = this.querySelector(".tbw-scroll-area"), l = s ? s.clientHeight : n, c = l - r, d = Math.max(0, n - l);
3754
- let u, f = 0;
3755
- return this._virtualization.variableHeights && this._virtualization.positionCache ? u = Ni(this._virtualization.positionCache) : (u = e * this._virtualization.rowHeight, f = this.#e?.getExtraHeight() ?? 0), u + c + f + d;
3733
+ const o = this._virtualization.scrollAreaEl;
3734
+ o && (this._virtualization.cachedScrollAreaHeight = o.clientHeight);
3735
+ }
3736
+ #A(e, i = !1) {
3737
+ const o = this._virtualization;
3738
+ let n, r, s;
3739
+ if (i) {
3740
+ const u = o.container ?? this, g = o.viewportEl ?? u, p = o.scrollAreaEl;
3741
+ n = u.clientHeight, r = g.clientHeight, s = p ? p.clientHeight : n, o.cachedFauxHeight = n, o.cachedViewportHeight = r, o.cachedScrollAreaHeight = s;
3742
+ } else
3743
+ n = o.cachedFauxHeight, r = o.cachedViewportHeight, s = o.cachedScrollAreaHeight || n;
3744
+ const l = s - r, a = Math.max(0, n - s);
3745
+ let c, d = 0;
3746
+ return o.variableHeights && o.positionCache ? c = Ii(o.positionCache) : (c = e * o.rowHeight, d = this.#e?.getExtraHeight() ?? 0), c + l + d + a;
3756
3747
  }
3757
3748
  #K() {
3758
3749
  if (!this._virtualization.variableHeights) return;
3759
3750
  const e = this._rows, i = this._virtualization.rowHeight || 28, o = this.#o.rowHeight, n = this.#o.getRowId, r = n ? (l) => n(l) : void 0;
3760
- this._virtualization.positionCache = ki(
3751
+ this._virtualization.positionCache = Ni(
3761
3752
  e,
3762
3753
  this._virtualization.heightCache,
3763
3754
  i,
@@ -3771,7 +3762,7 @@ class k extends HTMLElement {
3771
3762
  }
3772
3763
  }
3773
3764
  );
3774
- const s = Wi(
3765
+ const s = Fi(
3775
3766
  this._virtualization.positionCache,
3776
3767
  e,
3777
3768
  i,
@@ -3785,14 +3776,14 @@ class k extends HTMLElement {
3785
3776
  let r = i;
3786
3777
  r === void 0 && (r = this.#e?.getRowHeight?.(n, e)), r === void 0 && (r = this._virtualization.rowHeight);
3787
3778
  const s = o[e];
3788
- if (!(!s || Math.abs(s.height - r) < 1) && (we(o, e, r), this._virtualization.totalHeightEl)) {
3789
- const l = this.#x(this._rows.length);
3779
+ if (!(!s || Math.abs(s.height - r) < 1) && (be(o, e, r), this._virtualization.totalHeightEl)) {
3780
+ const l = this.#A(this._rows.length);
3790
3781
  this._virtualization.totalHeightEl.style.height = `${l}px`;
3791
3782
  }
3792
3783
  }
3793
3784
  #ge(e, i) {
3794
3785
  if (!this._virtualization.variableHeights || !this._virtualization.positionCache || !this._bodyEl) return;
3795
- const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r = $i(
3786
+ const o = this._bodyEl.querySelectorAll(".data-grid-row"), n = this.#o.getRowId, r = Wi(
3796
3787
  {
3797
3788
  positionCache: this._virtualization.positionCache,
3798
3789
  heightCache: this._virtualization.heightCache,
@@ -3806,7 +3797,7 @@ class k extends HTMLElement {
3806
3797
  o
3807
3798
  );
3808
3799
  if (r.hasChanges && (this._virtualization.measuredCount = r.measuredCount, this._virtualization.averageHeight = r.averageHeight, this._virtualization.totalHeightEl)) {
3809
- const s = this.#x(this._rows.length);
3800
+ const s = this.#A(this._rows.length);
3810
3801
  this._virtualization.totalHeightEl.style.height = `${s}px`;
3811
3802
  }
3812
3803
  }
@@ -3816,45 +3807,51 @@ class k extends HTMLElement {
3816
3807
  if (!this._virtualization.enabled)
3817
3808
  return this.#Y(0, o), i || this.#e?.afterRender(), !0;
3818
3809
  if (this._rows.length <= this._virtualization.bypassThreshold)
3819
- return this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#Y(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#x(o)}px`), this.#ce(o, this._visibleColumns.length), i || this.#e?.afterRender(), !0;
3810
+ return this._virtualization.start = 0, this._virtualization.end = o, e && (this._bodyEl.style.transform = "translateY(0px)"), this.#Y(0, o, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${this.#A(o, !0)}px`), this.#ce(o, this._visibleColumns.length), i || this.#e?.afterRender(), !0;
3820
3811
  const n = this._virtualization.container ?? this, r = this._virtualization.viewportEl ?? n, s = e ? this._virtualization.cachedViewportHeight = r.clientHeight : this._virtualization.cachedViewportHeight || (this._virtualization.cachedViewportHeight = r.clientHeight), l = this._virtualization.rowHeight, a = n.scrollTop;
3821
3812
  let c;
3822
3813
  const d = this._virtualization.positionCache;
3823
3814
  if (this._virtualization.variableHeights && d && d.length > 0)
3824
- c = We(d, a), c === -1 && (c = 0);
3815
+ c = Fe(d, a), c === -1 && (c = 0);
3825
3816
  else {
3826
3817
  c = Math.floor(a / l);
3827
3818
  let m = 0;
3828
3819
  const y = 10;
3829
3820
  for (; m < y; ) {
3830
- const E = this.#e?.getExtraHeightBefore?.(c) ?? 0, x = Math.floor((a - E) / l);
3831
- if (x >= c || x < 0) break;
3832
- c = x, m++;
3821
+ const S = this.#e?.getExtraHeightBefore?.(c) ?? 0, A = Math.floor((a - S) / l);
3822
+ if (A >= c || A < 0) break;
3823
+ c = A, m++;
3833
3824
  }
3834
3825
  }
3835
3826
  c = c - c % 2, c < 0 && (c = 0);
3836
- const u = this.#e?.adjustVirtualStart(c, a, l);
3837
- u !== void 0 && u < c && (c = u, c = c - c % 2, c < 0 && (c = 0));
3838
- let f;
3827
+ const f = this.#e?.adjustVirtualStart(c, a, l);
3828
+ f !== void 0 && f < c && (c = f, c = c - c % 2, c < 0 && (c = 0));
3829
+ let u;
3839
3830
  if (this._virtualization.variableHeights && d && d.length > 0) {
3840
3831
  const m = s + l * 3;
3841
3832
  let y = 0;
3842
- for (f = c; f < o && y < m; )
3843
- y += d[f].height, f++;
3844
- const E = Math.ceil(s / l) + 3;
3845
- f - c < E && (f = Math.min(c + E, o));
3833
+ for (u = c; u < o && y < m; )
3834
+ y += d[u].height, u++;
3835
+ const S = Math.ceil(s / l) + 3;
3836
+ u - c < S && (u = Math.min(c + S, o));
3846
3837
  } else {
3847
3838
  const m = Math.ceil(s / l) + 3;
3848
- f = c + m;
3839
+ u = c + m;
3849
3840
  }
3850
- f > o && (f = o);
3841
+ u > o && (u = o);
3851
3842
  const g = this._virtualization.start, p = this._virtualization.end;
3852
- if (!e && c === g && f === p)
3843
+ if (!e && c === g && u === p)
3853
3844
  return !1;
3854
- if (this._virtualization.start = c, this._virtualization.end = f, (e ? this._virtualization.cachedFauxHeight = n.clientHeight : this._virtualization.cachedFauxHeight || (this._virtualization.cachedFauxHeight = n.clientHeight)) === 0 && s > 0)
3855
- return this.#s.requestPhase(T.VIRTUALIZATION, "stale-refs-retry"), !1;
3845
+ this._virtualization.start = c, this._virtualization.end = u;
3846
+ const h = e ? this._virtualization.cachedFauxHeight = n.clientHeight : this._virtualization.cachedFauxHeight || (this._virtualization.cachedFauxHeight = n.clientHeight);
3847
+ if (e) {
3848
+ const m = this._virtualization.scrollAreaEl;
3849
+ m && (this._virtualization.cachedScrollAreaHeight = m.clientHeight);
3850
+ }
3851
+ if (h === 0 && s > 0)
3852
+ return this.#s.requestPhase(x.VIRTUALIZATION, "stale-refs-retry"), !1;
3856
3853
  if (e && this._virtualization.totalHeightEl) {
3857
- const m = this.#x(o);
3854
+ const m = this.#A(o);
3858
3855
  this._virtualization.totalHeightEl.style.height = `${m}px`;
3859
3856
  }
3860
3857
  let w;
@@ -3865,17 +3862,16 @@ class k extends HTMLElement {
3865
3862
  w = c * l + m;
3866
3863
  }
3867
3864
  const C = -(a - w);
3868
- return this._bodyEl.style.transform = `translateY(${C}px)`, this.#Y(c, f, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.variableHeights && this.#ge(c, f), this.#ce(o, this._visibleColumns.length), e && !i && (this.#e?.afterRender(), queueMicrotask(() => {
3869
- const m = n.clientHeight, y = r.clientHeight;
3870
- if (m === 0 && y > 0) return;
3871
- const E = this.#x(o);
3872
- this._virtualization.totalHeightEl && (this._virtualization.totalHeightEl.style.height = `${E}px`);
3865
+ return this._bodyEl.style.transform = `translateY(${C}px)`, this.#Y(c, u, e ? ++this.__rowRenderEpoch : this.__rowRenderEpoch), e && this._virtualization.variableHeights && this.#ge(c, u), this.#ce(o, this._visibleColumns.length), e && !i && (this.#e?.afterRender(), queueMicrotask(() => {
3866
+ if (!this._virtualization.totalHeightEl) return;
3867
+ const m = this.#A(o);
3868
+ this._virtualization.cachedFauxHeight === 0 && this._virtualization.cachedViewportHeight > 0 || (this._virtualization.totalHeightEl.style.height = `${m}px`);
3873
3869
  })), !0;
3874
3870
  }
3875
3871
  #Q() {
3876
3872
  this.#M(), this.#t.markSourcesChanged(), this.#t.merge();
3877
3873
  const e = this.#o?.shell;
3878
- pi(
3874
+ wi(
3879
3875
  this.#n,
3880
3876
  e,
3881
3877
  { isPanelOpen: this.#i.isPanelOpen, expandedSections: this.#i.expandedSections },
@@ -3883,24 +3879,24 @@ class k extends HTMLElement {
3883
3879
  ) && (this.#pe(), this.#c.setInitialized(!0));
3884
3880
  }
3885
3881
  #pe() {
3886
- ci(this.#n, this.#o?.shell, this.#i, {
3882
+ di(this.#n, this.#o?.shell, this.#i, {
3887
3883
  onPanelToggle: () => this.toggleToolPanel(),
3888
3884
  onSectionToggle: (e) => this.toggleToolPanelSection(e)
3889
- }), this.#I?.(), this.#I = di(this.#n, this.#o?.shell, (e) => {
3885
+ }), this.#I?.(), this.#I = hi(this.#n, this.#o?.shell, (e) => {
3890
3886
  this.style.setProperty("--tbw-tool-panel-width", `${e}px`);
3891
3887
  });
3892
3888
  }
3893
3889
  }
3894
3890
  customElements.get(k.tagName) || customElements.define(k.tagName, k);
3895
3891
  globalThis.DataGridElement = k;
3896
- const io = {
3892
+ const oo = {
3897
3893
  CAN_MOVE_COLUMN: "canMoveColumn",
3898
3894
  GET_CONTEXT_MENU_ITEMS: "getContextMenuItems"
3899
3895
  };
3900
- class oo {
3896
+ class no {
3901
3897
  static dependencies;
3902
3898
  static manifest;
3903
- version = "1.12.1";
3899
+ version = "1.14.0";
3904
3900
  styles;
3905
3901
  cellRenderers;
3906
3902
  headerRenderers;
@@ -4032,14 +4028,14 @@ const H = {
4032
4028
  GROUP_COUNT: "group-count",
4033
4029
  RANGE_SELECTION: "range-selection",
4034
4030
  SELECTION_OVERLAY: "selection-overlay"
4035
- }, Z = {
4031
+ }, J = {
4036
4032
  ROW_INDEX: "data-row-index",
4037
4033
  COL_INDEX: "data-col-index",
4038
4034
  FIELD: "data-field",
4039
4035
  GROUP_KEY: "data-group-key",
4040
4036
  TREE_LEVEL: "data-tree-level",
4041
4037
  STICKY: "data-sticky"
4042
- }, no = {
4038
+ }, ro = {
4043
4039
  ROOT: `.${H.ROOT}`,
4044
4040
  HEADER: `.${H.HEADER}`,
4045
4041
  HEADER_ROW: `.${H.HEADER_ROW}`,
@@ -4049,12 +4045,12 @@ const H = {
4049
4045
  DATA_ROW: `.${H.DATA_ROW}`,
4050
4046
  DATA_CELL: `.${H.DATA_CELL}`,
4051
4047
  GROUP_ROW: `.${H.GROUP_ROW}`,
4052
- ROW_BY_INDEX: (t) => `.${H.DATA_ROW}[${Z.ROW_INDEX}="${t}"]`,
4053
- CELL_BY_FIELD: (t) => `.${H.DATA_CELL}[${Z.FIELD}="${t}"]`,
4054
- CELL_AT: (t, e) => `.${H.DATA_ROW}[${Z.ROW_INDEX}="${t}"] .${H.DATA_CELL}[${Z.COL_INDEX}="${e}"]`,
4048
+ ROW_BY_INDEX: (t) => `.${H.DATA_ROW}[${J.ROW_INDEX}="${t}"]`,
4049
+ CELL_BY_FIELD: (t) => `.${H.DATA_CELL}[${J.FIELD}="${t}"]`,
4050
+ CELL_AT: (t, e) => `.${H.DATA_ROW}[${J.ROW_INDEX}="${t}"] .${H.DATA_CELL}[${J.COL_INDEX}="${e}"]`,
4055
4051
  SELECTED_ROWS: `.${H.DATA_ROW}.${H.SELECTED}`,
4056
4052
  EDITING_CELL: `.${H.DATA_CELL}.${H.EDITING}`
4057
- }, ro = {
4053
+ }, so = {
4058
4054
  COLOR_BG: "--tbw-color-bg",
4059
4055
  COLOR_FG: "--tbw-color-fg",
4060
4056
  COLOR_FG_MUTED: "--tbw-color-fg-muted",
@@ -4073,17 +4069,19 @@ const H = {
4073
4069
  BORDER_RADIUS: "--tbw-border-radius",
4074
4070
  FOCUS_OUTLINE: "--tbw-focus-outline"
4075
4071
  };
4076
- function so(t) {
4072
+ function lo(t) {
4077
4073
  const e = document.createElement("tbw-grid");
4078
4074
  return t && (e.gridConfig = t), e;
4079
4075
  }
4080
- function lo(t, e = document) {
4076
+ function ao(t, e = document) {
4081
4077
  return e.querySelector(t);
4082
4078
  }
4083
- const ao = {
4079
+ const co = {
4084
4080
  CELL_CHANGE: "cell-change",
4085
4081
  CELL_COMMIT: "cell-commit",
4086
4082
  ROW_COMMIT: "row-commit",
4083
+ EDIT_OPEN: "edit-open",
4084
+ EDIT_CLOSE: "edit-close",
4087
4085
  CHANGED_ROWS_RESET: "changed-rows-reset",
4088
4086
  MOUNT_EXTERNAL_VIEW: "mount-external-view",
4089
4087
  MOUNT_EXTERNAL_EDITOR: "mount-external-editor",
@@ -4093,7 +4091,7 @@ const ao = {
4093
4091
  CELL_ACTIVATE: "cell-activate",
4094
4092
  GROUP_TOGGLE: "group-toggle",
4095
4093
  COLUMN_STATE_CHANGE: "column-state-change"
4096
- }, co = {
4094
+ }, ho = {
4097
4095
  SELECTION_CHANGE: "selection-change",
4098
4096
  TREE_EXPAND: "tree-expand",
4099
4097
  FILTER_CHANGE: "filter-change",
@@ -4111,7 +4109,7 @@ const ao = {
4111
4109
  COLUMN_REORDER: "column-reorder",
4112
4110
  DETAIL_EXPAND: "detail-expand",
4113
4111
  GROUP_EXPAND: "group-expand"
4114
- }, he = {
4112
+ }, ue = {
4115
4113
  sum: (t, e) => t.reduce((i, o) => i + (Number(o[e]) || 0), 0),
4116
4114
  avg: (t, e) => {
4117
4115
  const i = t.reduce((o, n) => o + (Number(n[e]) || 0), 0);
@@ -4122,28 +4120,28 @@ const ao = {
4122
4120
  max: (t, e) => t.length ? Math.max(...t.map((i) => Number(i[e]) || -1 / 0)) : 0,
4123
4121
  first: (t, e) => t[0]?.[e],
4124
4122
  last: (t, e) => t[t.length - 1]?.[e]
4125
- }, W = /* @__PURE__ */ new Map(), D = {
4123
+ }, F = /* @__PURE__ */ new Map(), D = {
4126
4124
  register(t, e) {
4127
- W.set(t, e);
4125
+ F.set(t, e);
4128
4126
  },
4129
4127
  unregister(t) {
4130
- W.delete(t);
4128
+ F.delete(t);
4131
4129
  },
4132
4130
  get(t) {
4133
4131
  if (t !== void 0)
4134
- return typeof t == "function" ? t : W.get(t) ?? he[t];
4132
+ return typeof t == "function" ? t : F.get(t) ?? ue[t];
4135
4133
  },
4136
4134
  run(t, e, i, o) {
4137
4135
  const n = this.get(t);
4138
4136
  return n ? n(e, i, o) : void 0;
4139
4137
  },
4140
4138
  has(t) {
4141
- return W.has(t) || t in he;
4139
+ return F.has(t) || t in ue;
4142
4140
  },
4143
4141
  list() {
4144
- return [...Object.keys(he), ...W.keys()];
4142
+ return [...Object.keys(ue), ...F.keys()];
4145
4143
  }
4146
- }, Fe = {
4144
+ }, Ue = {
4147
4145
  sum: (t) => t.reduce((e, i) => e + i, 0),
4148
4146
  avg: (t) => t.length ? t.reduce((e, i) => e + i, 0) / t.length : 0,
4149
4147
  count: (t) => t.length,
@@ -4152,50 +4150,50 @@ const ao = {
4152
4150
  first: (t) => t[0] ?? 0,
4153
4151
  last: (t) => t[t.length - 1] ?? 0
4154
4152
  };
4155
- function Zi(t) {
4156
- return Fe[t] ?? Fe.sum;
4153
+ function Ji(t) {
4154
+ return Ue[t] ?? Ue.sum;
4157
4155
  }
4158
- function ho(t, e) {
4159
- return Zi(t)(e);
4156
+ function uo(t, e) {
4157
+ return Ji(t)(e);
4160
4158
  }
4161
- const uo = D.register.bind(D), fo = D.unregister.bind(D), go = D.get.bind(D), po = D.run.bind(D), wo = D.list.bind(D);
4159
+ const fo = D.register.bind(D), go = D.unregister.bind(D), po = D.get.bind(D), wo = D.run.bind(D), bo = D.list.bind(D);
4162
4160
  export {
4163
- oo as BaseGridPlugin,
4164
- dt as DEFAULT_ANIMATION_CONFIG,
4161
+ no as BaseGridPlugin,
4162
+ ht as DEFAULT_ANIMATION_CONFIG,
4165
4163
  M as DEFAULT_GRID_ICONS,
4166
- ao as DGEvents,
4164
+ co as DGEvents,
4167
4165
  k as DataGridElement,
4168
- Ke as F,
4169
- V as FitModeEnum,
4170
- ro as GridCSSVars,
4166
+ Qe as F,
4167
+ B as FitModeEnum,
4168
+ so as GridCSSVars,
4171
4169
  H as GridClasses,
4172
- Z as GridDataAttrs,
4170
+ J as GridDataAttrs,
4173
4171
  k as GridElement,
4174
- no as GridSelectors,
4175
- io as PLUGIN_QUERIES,
4176
- co as PluginEvents,
4177
- ie as PluginManager,
4178
- T as RenderPhase,
4179
- Ve as a,
4172
+ ro as GridSelectors,
4173
+ oo as PLUGIN_QUERIES,
4174
+ ho as PluginEvents,
4175
+ oe as PluginManager,
4176
+ x as RenderPhase,
4177
+ Be as a,
4180
4178
  D as aggregatorRegistry,
4181
- q as b,
4182
- $t as builtInSort,
4183
- eo as c,
4184
- so as createGrid,
4185
- me as d,
4186
- qt as defaultComparator,
4187
- I as e,
4188
- Xe as f,
4189
- Tt as g,
4190
- go as getAggregator,
4191
- Zi as getValueAggregator,
4192
- wo as listAggregators,
4193
- lo as queryGrid,
4194
- Ji as r,
4195
- uo as registerAggregator,
4196
- po as runAggregator,
4197
- ho as runValueAggregator,
4198
- to as s,
4199
- fo as unregisterAggregator
4179
+ $ as b,
4180
+ Wt as builtInSort,
4181
+ to as c,
4182
+ lo as createGrid,
4183
+ Ye as d,
4184
+ $t as defaultComparator,
4185
+ q as e,
4186
+ ve as f,
4187
+ Ht as g,
4188
+ po as getAggregator,
4189
+ Ji as getValueAggregator,
4190
+ bo as listAggregators,
4191
+ ao as queryGrid,
4192
+ eo as r,
4193
+ fo as registerAggregator,
4194
+ wo as runAggregator,
4195
+ uo as runValueAggregator,
4196
+ io as s,
4197
+ go as unregisterAggregator
4200
4198
  };
4201
4199
  //# sourceMappingURL=index.js.map