@affino/datagrid-vue-app 0.1.39 → 0.1.41

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.
@@ -0,0 +1,4458 @@
1
+ import { defineComponent as Sn, h as G, inject as go, ref as Z, computed as w, watch as Y, nextTick as Qe, openBlock as Mt, createElementBlock as bn, Fragment as zl, createElementVNode as J, mergeProps as _l, unref as m, toDisplayString as Ge, createBlock as vo, Teleport as ho, renderList as bo, normalizeClass as yo, createCommentVNode as Co, onBeforeUnmount as Hl, shallowRef as dl, defineAsyncComponent as yl, markRaw as Ro, toRaw as So, onUnmounted as po } from "vue";
2
+ import { resolveDataGridCellClickAction as Io, invokeDataGridCellInteraction as xo, toggleDataGridCellValue as Mo, buildDataGridCellRenderModel as Ao, buildDataGridAdvancedFilterExpressionFromLegacyFilters as Fo, useDataGridContextMenu as Oo, cloneDataGridFilterSnapshot as Do, createClientRowModel as rl } from "@affino/datagrid-vue";
3
+ import { useDataGridAppIntentHistory as ko, createDataGridAppRowHeightMetrics as Eo, useDataGridAppViewport as To, useDataGridAppRowSizing as zo, useDataGridAppCellSelection as _o, useDataGridAppRowPresentation as Ho, useDataGridAppClipboard as Po, useDataGridAppActiveCellViewport as Vo, useDataGridAppInlineEditing as Bo, useDataGridAppInteractionController as jo, useDataGridAppHeaderResize as Go, useDataGridAppRuntimeSync as Lo, useDataGridAppViewportLifecycle as Ko, useDataGridAppColumnLayoutPanel as $o } from "@affino/datagrid-vue/app";
4
+ import { useDataGridViewportContextMenuRouter as No, useDataGridContextMenuAnchor as Wo, useDataGridContextMenuActionRouter as Uo } from "@affino/datagrid-vue/advanced";
5
+ import { c as qo, q as Yo, D as Pl, a as Vl, s as Xo } from "./DataGridGanttStageEntry-BhNAeUxC.js";
6
+ import { usePopoverController as Jo, useFloatingPopover as Zo } from "@affino/popover-vue";
7
+ import { d as Qo, r as er } from "./dataGridOverlayThemeVars-vzY74EIz.js";
8
+ import { u as tr } from "./useDataGridDraggableOverlaySurface-BgkSR_nl.js";
9
+ import { a as nr } from "./dataGridAdvancedFilter-xnME5bRa.js";
10
+ const Bl = Sn({
11
+ name: "DataGridModuleHost",
12
+ props: {
13
+ modules: {
14
+ type: Array,
15
+ default: () => []
16
+ },
17
+ variant: {
18
+ type: String,
19
+ default: "standalone"
20
+ }
21
+ },
22
+ setup(e) {
23
+ return () => e.modules.length === 0 ? null : G("div", {
24
+ class: [
25
+ "datagrid-app-toolbar",
26
+ e.variant === "integrated" ? "datagrid-app-toolbar--integrated" : null
27
+ ]
28
+ }, [
29
+ G("div", { class: "datagrid-app-toolbar__group" }, e.modules.map((l) => G(l.component, {
30
+ key: l.key,
31
+ ...l.props ?? {}
32
+ })))
33
+ ]);
34
+ }
35
+ }), jl = Sn({
36
+ name: "DataGridHistoryToolbarButton",
37
+ props: {
38
+ action: {
39
+ type: String,
40
+ required: !0
41
+ },
42
+ label: {
43
+ type: String,
44
+ required: !0
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: !1
49
+ },
50
+ onTrigger: {
51
+ type: Function,
52
+ required: !0
53
+ }
54
+ },
55
+ setup(e) {
56
+ return () => G("button", {
57
+ type: "button",
58
+ class: "datagrid-app-toolbar__button",
59
+ "data-datagrid-toolbar-action": e.action,
60
+ disabled: e.disabled,
61
+ onClick: () => {
62
+ e.onTrigger();
63
+ }
64
+ }, e.label);
65
+ }
66
+ }), Zl = "Columns", ye = Object.freeze({
67
+ buttonLabel: Zl,
68
+ eyebrow: "Column layout",
69
+ title: "Order and visibility",
70
+ close: "Close",
71
+ cancel: "Cancel",
72
+ apply: "Apply",
73
+ moveUp: "Move up",
74
+ moveDown: "Move down"
75
+ });
76
+ function be(e, l) {
77
+ return typeof e == "string" && e.trim().length > 0 ? e.trim() : l;
78
+ }
79
+ function al(e, l) {
80
+ const r = be(l, be(e?.buttonLabel, Zl));
81
+ return Object.freeze({
82
+ buttonLabel: r,
83
+ eyebrow: be(e?.eyebrow, ye.eyebrow),
84
+ title: be(e?.title, ye.title),
85
+ close: be(e?.close, ye.close),
86
+ cancel: be(e?.cancel, ye.cancel),
87
+ apply: be(e?.apply, ye.apply),
88
+ moveUp: be(e?.moveUp, ye.moveUp),
89
+ moveDown: be(e?.moveDown, ye.moveDown)
90
+ });
91
+ }
92
+ function Ga(e) {
93
+ if (typeof e == "boolean") {
94
+ const r = al(void 0);
95
+ return {
96
+ enabled: e,
97
+ buttonLabel: r.buttonLabel,
98
+ labels: r
99
+ };
100
+ }
101
+ if (!e) {
102
+ const r = al(void 0);
103
+ return {
104
+ enabled: !1,
105
+ buttonLabel: r.buttonLabel,
106
+ labels: r
107
+ };
108
+ }
109
+ const l = al(e.labels, e.buttonLabel);
110
+ return {
111
+ enabled: e.enabled ?? !0,
112
+ buttonLabel: l.buttonLabel,
113
+ labels: l
114
+ };
115
+ }
116
+ const lr = ["data-datagrid-overlay-dragging"], or = { class: "datagrid-column-layout__header" }, rr = { class: "datagrid-column-layout__eyebrow" }, ar = { class: "datagrid-column-layout__title" }, ir = { class: "datagrid-column-layout__list" }, sr = ["onDragstart", "onDragover", "onDrop"], ur = { class: "datagrid-column-layout__visibility" }, cr = /* @__PURE__ */ J("span", {
117
+ class: "datagrid-column-layout__drag-handle",
118
+ "aria-hidden": "true"
119
+ }, "::", -1), dr = ["name", "checked", "onChange"], mr = { class: "datagrid-column-layout__label" }, fr = { class: "datagrid-column-layout__move-actions" }, wr = ["disabled", "aria-label", "title", "onClick"], gr = ["disabled", "aria-label", "title", "onClick"], vr = { class: "datagrid-column-layout__footer" }, hr = /* @__PURE__ */ Sn({
120
+ __name: "DataGridColumnLayoutPopover",
121
+ props: {
122
+ isOpen: { type: Boolean },
123
+ items: {},
124
+ buttonLabel: {},
125
+ labels: { default: () => ye },
126
+ active: { type: Boolean, default: !1 }
127
+ },
128
+ emits: ["open", "toggle-visibility", "move-up", "move-down", "move-to-position", "apply", "cancel"],
129
+ setup(e, { emit: l }) {
130
+ const r = e, o = l, u = go(Qo, Z(null)), i = Z({}), f = Jo(
131
+ {
132
+ id: "column-layout",
133
+ role: "dialog",
134
+ closeOnEscape: !0,
135
+ closeOnInteractOutside: !0
136
+ },
137
+ {
138
+ onOpen: () => {
139
+ r.isOpen || o("open"), U();
140
+ },
141
+ onClose: () => {
142
+ r.isOpen && o("cancel");
143
+ }
144
+ }
145
+ ), h = Zo(f, {
146
+ placement: "bottom",
147
+ align: "start",
148
+ gutter: 10,
149
+ viewportPadding: 12,
150
+ zIndex: 180,
151
+ lockScroll: !1,
152
+ returnFocus: !0
153
+ }), R = tr({
154
+ surfaceId: "column-layout",
155
+ rootElementRef: u,
156
+ floating: h
157
+ }), A = w(() => f.getTriggerProps({ role: "dialog" })), H = w(() => f.getContentProps({ role: "dialog", tabIndex: -1 })), T = w(() => f.state.value.open), x = w(() => h.teleportTarget.value), v = w(() => r.labels ?? ye), M = w(() => typeof r.buttonLabel == "string" && r.buttonLabel.trim().length > 0 ? r.buttonLabel.trim() : v.value.buttonLabel), O = Z(null), y = Z(null), I = Z(null);
158
+ Y(
159
+ () => r.isOpen,
160
+ async (j) => {
161
+ if (j) {
162
+ U(), f.state.value.open || f.open("programmatic"), await Qe(), h.contentRef.value?.querySelector('input[type="checkbox"]')?.focus({ preventScroll: !0 }), await h.updatePosition();
163
+ return;
164
+ }
165
+ f.state.value.open && f.close("programmatic");
166
+ },
167
+ { immediate: !0 }
168
+ ), Y(u, () => {
169
+ f.state.value.open && U();
170
+ }), Y(
171
+ () => r.items.length,
172
+ async () => {
173
+ f.state.value.open && (await Qe(), await h.updatePosition());
174
+ }
175
+ );
176
+ function U() {
177
+ i.value = er(u.value);
178
+ }
179
+ function V(j, z) {
180
+ o("toggle-visibility", { key: j, visible: z });
181
+ }
182
+ function ne(j) {
183
+ const E = (j.currentTarget instanceof HTMLElement ? j.currentTarget : null)?.getBoundingClientRect();
184
+ return !E || E.height <= 0 ? "after" : j.clientY < E.top + E.height / 2 ? "before" : "after";
185
+ }
186
+ function pe(j, z) {
187
+ O.value = z, y.value = null, I.value = null, j.dataTransfer && (j.dataTransfer.effectAllowed = "move", j.dataTransfer.setData("text/plain", z));
188
+ }
189
+ function tt(j, z) {
190
+ if (!O.value || O.value === z) {
191
+ y.value = null, I.value = null;
192
+ return;
193
+ }
194
+ j.preventDefault(), j.dataTransfer && (j.dataTransfer.dropEffect = "move"), y.value = z, I.value = ne(j);
195
+ }
196
+ function nt(j, z) {
197
+ if (!O.value || O.value === z) {
198
+ Ie();
199
+ return;
200
+ }
201
+ j.preventDefault(), o("move-to-position", {
202
+ key: O.value,
203
+ targetKey: z,
204
+ placement: ne(j)
205
+ }), Ie();
206
+ }
207
+ function Ie() {
208
+ O.value = null, y.value = null, I.value = null;
209
+ }
210
+ return (j, z) => (Mt(), bn(zl, null, [
211
+ J("button", _l({
212
+ ref: m(h).triggerRef,
213
+ type: "button",
214
+ class: ["datagrid-app-toolbar__button", { "datagrid-app-toolbar__button--active": j.active }],
215
+ "data-datagrid-toolbar-action": "column-layout",
216
+ style: i.value
217
+ }, A.value), Ge(M.value), 17),
218
+ (Mt(), vo(ho, { to: x.value }, [
219
+ T.value ? (Mt(), bn("section", _l({
220
+ key: 0,
221
+ ref: m(h).contentRef,
222
+ class: "datagrid-column-layout",
223
+ "data-datagrid-overlay-surface": "true",
224
+ "data-datagrid-overlay-surface-id": "column-layout",
225
+ "data-datagrid-overlay-dragging": m(R).dragging.value ? "true" : "false",
226
+ style: [m(R).surfaceStyle.value, i.value]
227
+ }, H.value), [
228
+ J("header", or, [
229
+ J("div", {
230
+ class: "datagrid-overlay-drag-handle",
231
+ "data-datagrid-overlay-drag-handle": "true",
232
+ onPointerdown: z[0] || (z[0] = //@ts-ignore
233
+ (...E) => m(R).handlePointerDown && m(R).handlePointerDown(...E))
234
+ }, [
235
+ J("div", rr, Ge(v.value.eyebrow), 1),
236
+ J("h3", ar, Ge(v.value.title), 1)
237
+ ], 32),
238
+ J("button", {
239
+ type: "button",
240
+ class: "datagrid-column-layout__ghost",
241
+ onClick: z[1] || (z[1] = (E) => o("cancel"))
242
+ }, Ge(v.value.close), 1)
243
+ ]),
244
+ J("div", ir, [
245
+ (Mt(!0), bn(zl, null, bo(j.items, (E) => (Mt(), bn("div", {
246
+ key: E.key,
247
+ class: yo(["datagrid-column-layout__row", {
248
+ "datagrid-column-layout__row--drag-source": O.value === E.key,
249
+ "datagrid-column-layout__row--drop-before": y.value === E.key && I.value === "before",
250
+ "datagrid-column-layout__row--drop-after": y.value === E.key && I.value === "after"
251
+ }]),
252
+ draggable: !0,
253
+ onDragstart: (le) => pe(le, E.key),
254
+ onDragover: (le) => tt(le, E.key),
255
+ onDrop: (le) => nt(le, E.key),
256
+ onDragend: Ie
257
+ }, [
258
+ J("label", ur, [
259
+ cr,
260
+ J("input", {
261
+ name: `datagrid-column-layout-visible-${E.key}`,
262
+ type: "checkbox",
263
+ checked: E.visible,
264
+ onChange: (le) => V(E.key, le.target.checked)
265
+ }, null, 40, dr),
266
+ J("span", mr, Ge(E.label), 1)
267
+ ]),
268
+ J("div", fr, [
269
+ J("button", {
270
+ type: "button",
271
+ class: "datagrid-column-layout__icon-button",
272
+ disabled: !E.canMoveUp,
273
+ "aria-label": `${v.value.moveUp}: ${E.label}`,
274
+ title: `${v.value.moveUp}: ${E.label}`,
275
+ onClick: (le) => o("move-up", E.key)
276
+ }, " ↑ ", 8, wr),
277
+ J("button", {
278
+ type: "button",
279
+ class: "datagrid-column-layout__icon-button",
280
+ disabled: !E.canMoveDown,
281
+ "aria-label": `${v.value.moveDown}: ${E.label}`,
282
+ title: `${v.value.moveDown}: ${E.label}`,
283
+ onClick: (le) => o("move-down", E.key)
284
+ }, " ↓ ", 8, gr)
285
+ ])
286
+ ], 42, sr))), 128))
287
+ ]),
288
+ J("footer", vr, [
289
+ J("button", {
290
+ type: "button",
291
+ class: "datagrid-column-layout__secondary",
292
+ onClick: z[2] || (z[2] = (E) => o("cancel"))
293
+ }, Ge(v.value.cancel), 1),
294
+ J("button", {
295
+ type: "button",
296
+ class: "datagrid-column-layout__primary",
297
+ onClick: z[3] || (z[3] = (E) => o("apply"))
298
+ }, Ge(v.value.apply), 1)
299
+ ])
300
+ ], 16, lr)) : Co("", !0)
301
+ ], 8, ["to"]))
302
+ ], 64));
303
+ }
304
+ }), Ce = ["sort", "group", "pin", "filter"], br = ["button", "contextmenu", "button+contextmenu"], Ql = [
305
+ "sortAsc",
306
+ "sortDesc",
307
+ "clearSort",
308
+ "toggleGroup",
309
+ "pinMenu",
310
+ "pinLeft",
311
+ "pinRight",
312
+ "unpin",
313
+ "clearFilter",
314
+ "addCurrentSelectionToFilter",
315
+ "selectAllValues",
316
+ "clearAllValues",
317
+ "applyFilter",
318
+ "cancelFilter"
319
+ ], il = 120, ml = "button+contextmenu";
320
+ function Cl(e) {
321
+ const l = new Set(Ce), r = Array.isArray(e) ? e : Ce, o = [];
322
+ for (const u of r)
323
+ !l.has(u) || o.includes(u) || o.push(u);
324
+ return o.length > 0 ? o : [...Ce];
325
+ }
326
+ function fl(e) {
327
+ if (!Array.isArray(e))
328
+ return [];
329
+ const l = new Set(Ce), r = [];
330
+ for (const o of e)
331
+ !l.has(o) || r.includes(o) || r.push(o);
332
+ return r;
333
+ }
334
+ function eo(e) {
335
+ if (!e)
336
+ return Object.freeze({});
337
+ const l = Object.entries(e).filter(([r, o]) => Ce.includes(r) && typeof o == "string").map(([r, o]) => [r, o.trim()]).filter(([, r]) => r.length > 0);
338
+ return Object.freeze(Object.fromEntries(l));
339
+ }
340
+ function to(e) {
341
+ if (!e)
342
+ return Object.freeze({});
343
+ const l = Object.entries(e).filter(([r, o]) => Ce.includes(r) && typeof o == "string").map(([r, o]) => [r, o.trim()]).filter(([, r]) => r.length > 0);
344
+ return Object.freeze(Object.fromEntries(l));
345
+ }
346
+ function yr(e) {
347
+ return br.includes(e) ? e : ml;
348
+ }
349
+ function Cr(e) {
350
+ if (e === "start" || e === "end")
351
+ return !0;
352
+ if (!e.includes(":"))
353
+ return !1;
354
+ const [l, r] = e.split(":");
355
+ return (l === "before" || l === "after") && Ce.includes(r);
356
+ }
357
+ function Rl(e) {
358
+ if (!Array.isArray(e))
359
+ return Object.freeze([]);
360
+ const l = [], r = /* @__PURE__ */ new Set();
361
+ for (const o of e) {
362
+ const u = typeof o?.key == "string" ? o.key.trim() : "", i = typeof o?.label == "string" ? o.label.trim() : "";
363
+ if (u.length === 0 || i.length === 0 || r.has(u))
364
+ continue;
365
+ r.add(u);
366
+ const f = typeof o.placement == "string" && Cr(o.placement) ? o.placement : void 0, h = {
367
+ key: u,
368
+ label: i,
369
+ ...f ? { placement: f } : {},
370
+ ...o.hidden === !0 ? { hidden: !0 } : {},
371
+ ...o.disabled === !0 ? { disabled: !0 } : {},
372
+ ...typeof o.disabledReason == "string" && o.disabledReason.trim().length > 0 ? { disabledReason: o.disabledReason.trim() } : {}
373
+ };
374
+ if (o.kind === "submenu") {
375
+ const R = Rl(o.items);
376
+ if (R.length === 0)
377
+ continue;
378
+ l.push(Object.freeze({
379
+ ...h,
380
+ kind: "submenu",
381
+ items: R
382
+ }));
383
+ continue;
384
+ }
385
+ l.push(Object.freeze({
386
+ ...h,
387
+ ...typeof o.onSelect == "function" ? { onSelect: o.onSelect } : {}
388
+ }));
389
+ }
390
+ return Object.freeze(l);
391
+ }
392
+ function no(e) {
393
+ if (!e)
394
+ return Object.freeze({});
395
+ const l = Object.entries(e).filter(([r, o]) => Ql.includes(r) && !!o).map(([r, o]) => {
396
+ const u = o, i = {
397
+ ...u.hidden === !0 ? { hidden: !0 } : {},
398
+ ...u.disabled === !0 ? { disabled: !0 } : {},
399
+ ...typeof u.disabledReason == "string" && u.disabledReason.trim().length > 0 ? { disabledReason: u.disabledReason.trim() } : {},
400
+ ...typeof u.label == "string" && u.label.trim().length > 0 ? { label: u.label.trim() } : {}
401
+ };
402
+ return [r, Object.freeze(i)];
403
+ }).filter(([, r]) => Object.keys(r).length > 0);
404
+ return Object.freeze(Object.fromEntries(l));
405
+ }
406
+ function Rr(e) {
407
+ if (!e)
408
+ return {};
409
+ const l = Object.entries(e).filter(([r]) => r.trim().length > 0).map(([r, o]) => {
410
+ const u = o?.items ? Cl(o.items) : void 0, i = fl(o?.hide), f = fl(o?.disabled), h = to(o?.disabledReasons), R = eo(o?.labels), A = no(o?.actions), H = Rl(o?.customItems);
411
+ return [
412
+ r,
413
+ {
414
+ ...u ? { items: u } : {},
415
+ ...i.length > 0 ? { hide: i } : {},
416
+ ...f.length > 0 ? { disabled: f } : {},
417
+ ...Object.keys(h).length > 0 ? { disabledReasons: h } : {},
418
+ ...Object.keys(R).length > 0 ? { labels: R } : {},
419
+ ...Object.keys(A).length > 0 ? { actions: A } : {},
420
+ ...H.length > 0 ? { customItems: H } : {}
421
+ }
422
+ ];
423
+ });
424
+ return Object.fromEntries(l);
425
+ }
426
+ function La(e) {
427
+ return typeof e == "boolean" ? {
428
+ enabled: e,
429
+ trigger: ml,
430
+ maxFilterValues: il,
431
+ items: [...Ce],
432
+ disabled: [],
433
+ disabledReasons: Object.freeze({}),
434
+ labels: Object.freeze({}),
435
+ actions: Object.freeze({}),
436
+ customItems: Object.freeze([]),
437
+ columns: {}
438
+ } : e ? {
439
+ enabled: e.enabled ?? !0,
440
+ trigger: yr(e.trigger),
441
+ maxFilterValues: Number.isFinite(e.maxFilterValues) ? Math.max(20, Math.trunc(e.maxFilterValues)) : il,
442
+ items: Cl(e.items),
443
+ disabled: fl(e.disabled),
444
+ disabledReasons: to(e.disabledReasons),
445
+ labels: eo(e.labels),
446
+ actions: no(e.actions),
447
+ customItems: Rl(e.customItems),
448
+ columns: Rr(e.columns)
449
+ } : {
450
+ enabled: !1,
451
+ trigger: ml,
452
+ maxFilterValues: il,
453
+ items: [...Ce],
454
+ disabled: [],
455
+ disabledReasons: Object.freeze({}),
456
+ labels: Object.freeze({}),
457
+ actions: Object.freeze({}),
458
+ customItems: Object.freeze([]),
459
+ columns: {}
460
+ };
461
+ }
462
+ function lo(e, l) {
463
+ const r = e.columns[l], o = r?.items ? Cl(r.items) : e.items, u = new Set(r?.hide ?? []), i = o.filter((f) => !u.has(f));
464
+ return i.length > 0 ? i : [];
465
+ }
466
+ function Sr(e, l) {
467
+ const r = lo(e, l), o = new Set(e.columns[l]?.disabled ?? []), u = new Set(e.disabled);
468
+ return r.filter((i) => u.has(i) || o.has(i));
469
+ }
470
+ function pr(e, l) {
471
+ return Object.freeze({
472
+ ...e.labels,
473
+ ...e.columns[l]?.labels ?? {}
474
+ });
475
+ }
476
+ function Ir(e, l) {
477
+ return Object.freeze({
478
+ ...e.disabledReasons,
479
+ ...e.columns[l]?.disabledReasons ?? {}
480
+ });
481
+ }
482
+ function xr(e, l) {
483
+ const r = e.columns[l]?.actions ?? {}, o = Ql.map((u) => {
484
+ const i = {
485
+ ...e.actions[u] ?? {},
486
+ ...r[u] ?? {}
487
+ };
488
+ return [u, Object.freeze(i)];
489
+ }).filter(([, u]) => Object.keys(u).length > 0);
490
+ return Object.freeze(Object.fromEntries(o));
491
+ }
492
+ function Mr(e, l) {
493
+ const r = /* @__PURE__ */ new Map();
494
+ for (const o of e.customItems)
495
+ r.set(o.key, o);
496
+ for (const o of e.columns[l]?.customItems ?? [])
497
+ r.set(o.key, o);
498
+ return Object.freeze(Array.from(r.values()));
499
+ }
500
+ const ie = ["clipboard", "pasteSpecial", "edit"], Sl = ["cut", "copy", "paste", "pasteValues", "clear"], Je = ["insert", "clipboard", "selection"], oo = [
501
+ "insertAbove",
502
+ "insertBelow",
503
+ "cut",
504
+ "copy",
505
+ "paste",
506
+ "deleteSelected"
507
+ ];
508
+ function pn(e, l) {
509
+ const r = new Set(l), o = Array.isArray(e) ? e : l, u = [];
510
+ for (const i of o)
511
+ !r.has(i) || u.includes(i) || u.push(i);
512
+ return u.length > 0 ? u : [...l];
513
+ }
514
+ function Rn(e, l) {
515
+ if (!Array.isArray(e))
516
+ return [];
517
+ const r = new Set(l), o = [];
518
+ for (const u of e)
519
+ !r.has(u) || o.includes(u) || o.push(u);
520
+ return o;
521
+ }
522
+ function et(e, l) {
523
+ if (!e)
524
+ return Object.freeze({});
525
+ const r = Object.entries(e).filter((o) => l.includes(o[0]) && typeof o[1] == "string").map(([o, u]) => [o, u.trim()]).filter(([, o]) => o.length > 0);
526
+ return Object.freeze(Object.fromEntries(r));
527
+ }
528
+ function pl(e, l) {
529
+ if (!e)
530
+ return Object.freeze({});
531
+ const r = Object.entries(e).filter(([o, u]) => l.includes(o) && !!u).map(([o, u]) => {
532
+ const i = u, f = {
533
+ ...i.hidden === !0 ? { hidden: !0 } : {},
534
+ ...i.disabled === !0 ? { disabled: !0 } : {},
535
+ ...typeof i.disabledReason == "string" && i.disabledReason.trim().length > 0 ? { disabledReason: i.disabledReason.trim() } : {},
536
+ ...typeof i.label == "string" && i.label.trim().length > 0 ? { label: i.label.trim() } : {}
537
+ };
538
+ return [o, Object.freeze(f)];
539
+ }).filter(([, o]) => Object.keys(o).length > 0);
540
+ return Object.freeze(Object.fromEntries(r));
541
+ }
542
+ function Ar(e) {
543
+ if (e === "start" || e === "end")
544
+ return !0;
545
+ if (!e.includes(":"))
546
+ return !1;
547
+ const [l, r] = e.split(":");
548
+ return (l === "before" || l === "after") && ie.includes(r);
549
+ }
550
+ function Il(e) {
551
+ if (!Array.isArray(e))
552
+ return Object.freeze([]);
553
+ const l = [], r = /* @__PURE__ */ new Set();
554
+ for (const o of e) {
555
+ const u = typeof o?.key == "string" ? o.key.trim() : "", i = typeof o?.label == "string" ? o.label.trim() : "";
556
+ if (u.length === 0 || i.length === 0 || r.has(u))
557
+ continue;
558
+ r.add(u);
559
+ const f = typeof o.placement == "string" && Ar(o.placement) ? o.placement : void 0, h = {
560
+ key: u,
561
+ label: i,
562
+ ...f ? { placement: f } : {},
563
+ ...o.hidden === !0 ? { hidden: !0 } : {},
564
+ ...o.disabled === !0 ? { disabled: !0 } : {},
565
+ ...typeof o.disabledReason == "string" && o.disabledReason.trim().length > 0 ? { disabledReason: o.disabledReason.trim() } : {}
566
+ };
567
+ if (o.kind === "submenu") {
568
+ const R = Il(o.items);
569
+ if (R.length === 0)
570
+ continue;
571
+ l.push(Object.freeze({
572
+ ...h,
573
+ kind: "submenu",
574
+ items: R
575
+ }));
576
+ continue;
577
+ }
578
+ l.push(Object.freeze({
579
+ ...h,
580
+ ...typeof o.onSelect == "function" ? { onSelect: o.onSelect } : {}
581
+ }));
582
+ }
583
+ return Object.freeze(l);
584
+ }
585
+ function Fr(e) {
586
+ if (!e)
587
+ return {};
588
+ const l = Object.entries(e).filter(([r]) => r.trim().length > 0).map(([r, o]) => {
589
+ const u = o?.items ? pn(o.items, ie) : void 0, i = Rn(o?.hide, ie), f = Rn(o?.disabled, ie), h = et(o?.disabledReasons, ie), R = et(o?.labels, ie), A = pl(o?.actions, Sl), H = Il(o?.customItems);
590
+ return [
591
+ r,
592
+ {
593
+ ...u ? { items: u } : {},
594
+ ...i.length > 0 ? { hide: i } : {},
595
+ ...f.length > 0 ? { disabled: f } : {},
596
+ ...Object.keys(h).length > 0 ? { disabledReasons: h } : {},
597
+ ...Object.keys(R).length > 0 ? { labels: R } : {},
598
+ ...Object.keys(A).length > 0 ? { actions: A } : {},
599
+ ...H.length > 0 ? { customItems: H } : {}
600
+ }
601
+ ];
602
+ });
603
+ return Object.freeze(Object.fromEntries(l));
604
+ }
605
+ function Ka(e) {
606
+ return typeof e == "boolean" ? {
607
+ enabled: e,
608
+ items: [...ie],
609
+ disabled: [],
610
+ disabledReasons: Object.freeze({}),
611
+ labels: Object.freeze({}),
612
+ actions: Object.freeze({}),
613
+ customItems: Object.freeze([]),
614
+ columns: {}
615
+ } : e ? {
616
+ enabled: e.enabled ?? !0,
617
+ items: pn(e.items, ie),
618
+ disabled: Rn(e.disabled, ie),
619
+ disabledReasons: et(e.disabledReasons, ie),
620
+ labels: et(e.labels, ie),
621
+ actions: pl(e.actions, Sl),
622
+ customItems: Il(e.customItems),
623
+ columns: Fr(e.columns)
624
+ } : {
625
+ enabled: !1,
626
+ items: [...ie],
627
+ disabled: [],
628
+ disabledReasons: Object.freeze({}),
629
+ labels: Object.freeze({}),
630
+ actions: Object.freeze({}),
631
+ customItems: Object.freeze([]),
632
+ columns: {}
633
+ };
634
+ }
635
+ function Cn(e, l) {
636
+ const r = e.columns[l], o = r?.items ? pn(r.items, ie) : e.items, u = new Set(r?.hide ?? []), i = o.filter((f) => !u.has(f));
637
+ return i.length > 0 ? i : [];
638
+ }
639
+ function Or(e, l) {
640
+ const r = Cn(e, l), o = new Set(e.columns[l]?.disabled ?? []), u = new Set(e.disabled);
641
+ return r.filter((i) => u.has(i) || o.has(i));
642
+ }
643
+ function Dr(e, l) {
644
+ return Object.freeze({
645
+ ...e.labels,
646
+ ...e.columns[l]?.labels ?? {}
647
+ });
648
+ }
649
+ function kr(e, l) {
650
+ return Object.freeze({
651
+ ...e.disabledReasons,
652
+ ...e.columns[l]?.disabledReasons ?? {}
653
+ });
654
+ }
655
+ function Er(e, l) {
656
+ const r = e.columns[l]?.actions ?? {}, o = Sl.map((u) => {
657
+ const i = {
658
+ ...e.actions[u] ?? {},
659
+ ...r[u] ?? {}
660
+ };
661
+ return [u, Object.freeze(i)];
662
+ }).filter(([, u]) => Object.keys(u).length > 0);
663
+ return Object.freeze(Object.fromEntries(o));
664
+ }
665
+ function Tr(e, l) {
666
+ const r = /* @__PURE__ */ new Map();
667
+ for (const o of e.customItems)
668
+ r.set(o.key, o);
669
+ for (const o of e.columns[l]?.customItems ?? [])
670
+ r.set(o.key, o);
671
+ return Object.freeze(Array.from(r.values()));
672
+ }
673
+ function $a(e) {
674
+ return typeof e == "boolean" ? {
675
+ enabled: e,
676
+ items: [...Je],
677
+ disabled: [],
678
+ disabledReasons: Object.freeze({}),
679
+ labels: Object.freeze({}),
680
+ actions: Object.freeze({})
681
+ } : e ? {
682
+ enabled: e.enabled ?? !0,
683
+ items: pn(e.items, Je),
684
+ disabled: Rn(e.disabled, Je),
685
+ disabledReasons: et(e.disabledReasons, Je),
686
+ labels: et(e.labels, Je),
687
+ actions: pl(e.actions, oo)
688
+ } : {
689
+ enabled: !1,
690
+ items: [...Je],
691
+ disabled: [],
692
+ disabledReasons: Object.freeze({}),
693
+ labels: Object.freeze({}),
694
+ actions: Object.freeze({})
695
+ };
696
+ }
697
+ function zr(e) {
698
+ return e.items;
699
+ }
700
+ function _r(e) {
701
+ return e.disabled;
702
+ }
703
+ function Hr(e) {
704
+ return e.disabledReasons;
705
+ }
706
+ function Pr(e) {
707
+ const l = oo.map((r) => [r, Object.freeze({ ...e.actions[r] ?? {} })]).filter(([, r]) => Object.keys(r).length > 0);
708
+ return Object.freeze(Object.fromEntries(l));
709
+ }
710
+ function Gl(e) {
711
+ return (l) => {
712
+ e.value = l instanceof HTMLElement ? l : null;
713
+ };
714
+ }
715
+ function Vr(e) {
716
+ const l = Gl(e.headerViewportRef), r = Gl(e.bodyViewportRef), o = (M) => {
717
+ e.editingCellValueRef.value = M;
718
+ }, u = w(() => ({
719
+ gridContentStyle: m(e.gridContentStyle),
720
+ mainTrackStyle: m(e.mainTrackStyle),
721
+ indexColumnStyle: m(e.indexColumnStyle),
722
+ stageStyle: m(e.stageStyle),
723
+ bodyShellStyle: m(e.bodyShellStyle),
724
+ columnStyle: m(e.columnStyle)
725
+ })), i = w(() => ({
726
+ topSpacerHeight: m(e.topSpacerHeight),
727
+ bottomSpacerHeight: m(e.bottomSpacerHeight),
728
+ viewportRowStart: m(e.viewportRowStart),
729
+ columnWindowStart: m(e.columnWindowStart),
730
+ leftColumnSpacerWidth: m(e.leftColumnSpacerWidth),
731
+ rightColumnSpacerWidth: m(e.rightColumnSpacerWidth),
732
+ headerViewportRef: l,
733
+ bodyViewportRef: r,
734
+ handleHeaderWheel: m(e.handleHeaderWheel),
735
+ handleHeaderScroll: m(e.handleHeaderScroll),
736
+ handleViewportScroll: m(e.handleViewportScroll),
737
+ handleViewportKeydown: m(e.handleViewportKeydown)
738
+ })), f = w(() => ({
739
+ visibleColumns: m(e.visibleColumns),
740
+ renderedColumns: m(e.renderedColumns),
741
+ columnFilterTextByKey: m(e.columnFilterTextByKey),
742
+ reorderColumnsByHeader: m(e.reorderColumnsByHeader),
743
+ toggleSortForColumn: m(e.toggleSortForColumn),
744
+ handleHeaderColumnClick: m(e.handleHeaderColumnClick),
745
+ sortIndicator: m(e.sortIndicator),
746
+ setColumnFilterText: m(e.setColumnFilterText),
747
+ columnMenuEnabled: m(e.columnMenuEnabled),
748
+ columnMenuTrigger: m(e.columnMenuTrigger),
749
+ columnMenuValueFilterEnabled: m(e.columnMenuValueFilterEnabled),
750
+ columnMenuValueFilterRowLimit: m(e.columnMenuValueFilterRowLimit),
751
+ columnMenuMaxFilterValues: m(e.columnMenuMaxFilterValues),
752
+ resolveColumnMenuItems: m(e.resolveColumnMenuItems),
753
+ resolveColumnMenuDisabledItems: m(e.resolveColumnMenuDisabledItems),
754
+ resolveColumnMenuDisabledReasons: m(e.resolveColumnMenuDisabledReasons),
755
+ resolveColumnMenuLabels: m(e.resolveColumnMenuLabels),
756
+ resolveColumnMenuActionOptions: m(e.resolveColumnMenuActionOptions),
757
+ resolveColumnMenuCustomItems: m(e.resolveColumnMenuCustomItems),
758
+ isColumnFilterActive: m(e.isColumnFilterActive),
759
+ isColumnGrouped: m(e.isColumnGrouped),
760
+ resolveColumnGroupOrder: m(e.resolveColumnGroupOrder),
761
+ resolveColumnMenuSortDirection: m(e.resolveColumnMenuSortDirection),
762
+ resolveColumnMenuSelectedTokens: m(e.resolveColumnMenuSelectedTokens),
763
+ resolveColumnMenuValueEntries: m(e.resolveColumnMenuValueEntries),
764
+ applyColumnMenuSort: m(e.applyColumnMenuSort),
765
+ applyColumnMenuPin: m(e.applyColumnMenuPin),
766
+ applyColumnMenuGroupBy: m(e.applyColumnMenuGroupBy),
767
+ applyColumnMenuFilter: m(e.applyColumnMenuFilter),
768
+ clearColumnMenuFilter: m(e.clearColumnMenuFilter),
769
+ startResize: m(e.startResize),
770
+ handleResizeDoubleClick: m(e.handleResizeDoubleClick)
771
+ })), h = w(() => ({
772
+ displayRows: m(e.displayRows),
773
+ pinnedBottomRows: m(e.pinnedBottomRows),
774
+ sourceRows: m(e.sourceRows),
775
+ showRowIndex: m(e.showRowIndex),
776
+ rowHover: m(e.rowHover),
777
+ stripedRows: m(e.stripedRows),
778
+ rowClass: m(e.rowClass),
779
+ isRowAutosizeProbe: m(e.isRowAutosizeProbe),
780
+ rowStyle: m(e.rowStyle),
781
+ isRowInPendingClipboardCut: m(e.isRowInPendingClipboardCut),
782
+ isRowFocused: m(e.isRowFocused),
783
+ isRowCheckboxSelected: m(e.isRowCheckboxSelected),
784
+ allVisibleRowsSelected: m(e.allVisibleRowsSelected),
785
+ someVisibleRowsSelected: m(e.someVisibleRowsSelected),
786
+ handleRowClick: m(e.handleRowClick),
787
+ handleRowIndexClick: m(e.handleRowIndexClick),
788
+ handleRowIndexKeydown: m(e.handleRowIndexKeydown),
789
+ reorderRowsByIndex: m(e.reorderRowsByIndex),
790
+ handleToggleAllVisibleRows: m(e.handleToggleAllVisibleRows),
791
+ toggleGroupRow: m(e.toggleGroupRow),
792
+ rowIndexLabel: m(e.rowIndexLabel),
793
+ startRowResize: m(e.startRowResize),
794
+ autosizeRow: m(e.autosizeRow)
795
+ })), R = w(() => ({
796
+ selectionRange: m(e.selectionRange),
797
+ selectionRanges: m(e.selectionRanges),
798
+ selectionAnchorCell: m(e.selectionAnchorCell),
799
+ totalRowCount: m(e.totalRowCount),
800
+ fillPreviewRange: m(e.fillPreviewRange),
801
+ rangeMovePreviewRange: m(e.rangeMovePreviewRange),
802
+ fillHandleEnabled: m(e.fillHandleEnabled),
803
+ rangeMoveEnabled: m(e.rangeMoveEnabled),
804
+ isFillDragging: m(e.isFillDragging),
805
+ isRangeMoving: m(e.isRangeMoving),
806
+ fillActionAnchorCell: m(e.fillActionAnchorCell),
807
+ fillActionBehavior: m(e.fillActionBehavior),
808
+ applyFillActionBehavior: m(e.applyFillActionBehavior),
809
+ isFillHandleCell: m(e.isFillHandleCell),
810
+ startFillHandleDrag: m(e.startFillHandleDrag),
811
+ startFillHandleDoubleClick: m(e.startFillHandleDoubleClick)
812
+ })), A = w(() => ({
813
+ editingCellValue: e.editingCellValueRef.value,
814
+ editingCellInitialFilter: m(e.editingCellInitialFilter),
815
+ editingCellOpenOnMount: m(e.editingCellOpenOnMount),
816
+ isEditingCell: m(e.isEditingCell),
817
+ startInlineEdit: m(e.startInlineEdit),
818
+ updateEditingCellValue: o,
819
+ handleEditorKeydown: m(e.handleEditorKeydown),
820
+ handleEditorBlur: m(e.handleEditorBlur),
821
+ commitInlineEdit: m(e.commitInlineEdit),
822
+ cancelInlineEdit: m(e.cancelInlineEdit)
823
+ })), H = w(() => ({
824
+ cellClass: m(e.cellClass),
825
+ cellStyle: m(e.cellStyle),
826
+ isCellSelected: m(e.isCellSelected),
827
+ isSelectionAnchorCell: m(e.isSelectionAnchorCell),
828
+ shouldHighlightSelectedCell: m(e.shouldHighlightSelectedCell),
829
+ isCellOnSelectionEdge: m(e.isCellOnSelectionEdge),
830
+ isCellInFillPreview: m(e.isCellInFillPreview),
831
+ isCellInPendingClipboardRange: m(e.isCellInPendingClipboardRange),
832
+ isCellOnPendingClipboardEdge: m(e.isCellOnPendingClipboardEdge),
833
+ isCellEditable: m(e.isCellEditable),
834
+ readCell: m(e.readCell),
835
+ readDisplayCell: m(e.readDisplayCell)
836
+ })), T = w(() => ({
837
+ handleCellMouseDown: m(e.handleCellMouseDown),
838
+ handleCellClick: m(e.handleCellClick),
839
+ handleCellKeydown: m(e.handleCellKeydown)
840
+ })), x = w(() => ({
841
+ mode: m(e.mode),
842
+ rowHeightMode: m(e.rowHeightMode),
843
+ layoutMode: m(e.layoutMode),
844
+ chromeSignature: m(e.chromeSignature),
845
+ layout: u.value,
846
+ viewport: i.value,
847
+ columns: f.value,
848
+ rows: h.value,
849
+ selection: R.value,
850
+ editing: A.value,
851
+ cells: H.value,
852
+ interaction: T.value
853
+ })), v = qo({
854
+ mode: w(() => m(e.mode)),
855
+ rowHeightMode: w(() => m(e.rowHeightMode)),
856
+ layoutMode: w(() => m(e.layoutMode)),
857
+ layout: u,
858
+ viewport: i,
859
+ columns: f,
860
+ rows: h,
861
+ selection: R,
862
+ editing: A,
863
+ cells: H,
864
+ interaction: T
865
+ });
866
+ return {
867
+ tableStageProps: x,
868
+ tableStageContext: v,
869
+ captureHeaderViewportRef: l,
870
+ captureBodyViewportRef: r,
871
+ updateEditingCellValue: o
872
+ };
873
+ }
874
+ function Br(e) {
875
+ const l = (i, f) => Number.isFinite(i.displayIndex) ? Math.max(0, Math.trunc(i.displayIndex)) : e.viewportRowStart.value + f;
876
+ return {
877
+ readStageCell: (i, f) => e.isRowSelectionColumnKey(f) ? e.readRowSelectionCell(i) : e.readCell(i, f),
878
+ readStageDisplayCell: (i, f) => e.isRowSelectionColumnKey(f) ? e.readRowSelectionDisplayCell(i) : e.readDisplayCell(i, f),
879
+ handleCellClick: (i, f, h, R) => {
880
+ if (e.isRowSelectionColumn(h)) {
881
+ e.toggleRowCheckboxSelected(i);
882
+ return;
883
+ }
884
+ const A = l(i, f), H = e.isCellEditableByKey(i, A, h.key, R), T = Io({
885
+ column: h.column,
886
+ row: i.kind !== "group" ? i.data : void 0,
887
+ rowId: i.rowId,
888
+ editable: H
889
+ });
890
+ if (T === "invoke") {
891
+ xo({
892
+ column: h.column,
893
+ row: i.kind !== "group" ? i.data : void 0,
894
+ rowId: i.rowId,
895
+ editable: H,
896
+ trigger: "click"
897
+ });
898
+ return;
899
+ }
900
+ if (T !== "toggle" || i.kind === "group" || i.rowId == null)
901
+ return;
902
+ const x = e.captureHistorySnapshot(), v = e.ensureEditableRowAtIndex?.(A) ?? i;
903
+ v.kind === "group" || v.rowId == null || (e.runtime.api.rows.applyEdits([
904
+ {
905
+ rowId: v.rowId,
906
+ data: {
907
+ [h.key]: Mo({
908
+ column: h.column,
909
+ row: v.data
910
+ })
911
+ }
912
+ }
913
+ ]), e.recordHistoryIntentTransaction({
914
+ intent: "edit",
915
+ label: `Toggle ${h.key}`,
916
+ affectedRange: {
917
+ startRow: A,
918
+ endRow: A,
919
+ startColumn: R,
920
+ endColumn: R
921
+ }
922
+ }, x), e.syncViewport());
923
+ }
924
+ };
925
+ }
926
+ const Ll = 140, yn = 108, sl = "__datagrid_row_selection__";
927
+ function jr(e) {
928
+ const l = w(() => (e.showRowSelection?.value ?? !0) && e.runtime.api.rowSelection.hasSupport()), r = w(() => l.value ? {
929
+ key: sl,
930
+ state: {
931
+ visible: !0,
932
+ pin: "left",
933
+ width: yn
934
+ },
935
+ visible: !0,
936
+ pin: "left",
937
+ width: yn,
938
+ column: {
939
+ key: sl,
940
+ label: "",
941
+ cellType: "checkbox",
942
+ cellInteraction: {
943
+ click: !0,
944
+ keyboard: ["enter", "space"],
945
+ role: "checkbox",
946
+ label: "Toggle row selection",
947
+ checked: ({ rowId: v }) => v != null && e.runtime.api.rowSelection.isSelected(v),
948
+ onInvoke: ({ rowId: v }) => {
949
+ v == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setSelected(
950
+ v,
951
+ !e.runtime.api.rowSelection.isSelected(v)
952
+ );
953
+ }
954
+ },
955
+ minWidth: yn,
956
+ maxWidth: yn,
957
+ capabilities: {
958
+ editable: !0,
959
+ sortable: !1,
960
+ filterable: !1,
961
+ groupable: !1,
962
+ pivotable: !1,
963
+ aggregatable: !1
964
+ },
965
+ presentation: {
966
+ align: "center",
967
+ headerAlign: "center"
968
+ },
969
+ meta: {
970
+ isSystem: !0,
971
+ rowSelection: !0
972
+ }
973
+ }
974
+ } : null), o = (v) => v === sl, u = (v) => o(v.key), i = w(() => {
975
+ const v = r.value, M = e.visibleColumns.value.filter((I) => I.pin === "left"), O = e.visibleColumns.value.filter((I) => I.pin !== "left" && I.pin !== "right"), y = e.visibleColumns.value.filter((I) => I.pin === "right");
976
+ return v ? [v, ...M, ...O, ...y] : [...M, ...O, ...y];
977
+ }), f = w(() => i.value.filter((v) => v.pin !== "left" && v.pin !== "right")), h = (v) => v.width ?? Ll, R = (v) => {
978
+ const M = i.value.find((I) => I.key === v), y = `${M ? h(M) : Ll}px`;
979
+ return {
980
+ width: y,
981
+ minWidth: y,
982
+ maxWidth: y
983
+ };
984
+ }, A = (v) => v.column.capabilities?.editable !== !1, H = (v, M, O) => u(O) ? v.kind !== "group" && v.rowId != null : v.kind === "group" || v.rowId == null || !A(O) ? !1 : e.isCellEditable ? e.isCellEditable({
985
+ row: v.data,
986
+ rowId: v.rowId,
987
+ rowIndex: M,
988
+ column: O.column,
989
+ columnKey: O.key
990
+ }) : !0, T = (v, M) => {
991
+ const O = i.value[M];
992
+ if (O?.key === v)
993
+ return { column: O, columnIndex: M };
994
+ const y = i.value.findIndex((I) => I.key === v);
995
+ return y < 0 ? null : {
996
+ column: i.value[y],
997
+ columnIndex: y
998
+ };
999
+ };
1000
+ return {
1001
+ orderedVisibleColumns: i,
1002
+ centerColumns: f,
1003
+ resolveColumnWidth: h,
1004
+ stageColumnStyle: R,
1005
+ isRowSelectionColumnKey: o,
1006
+ isRowSelectionColumn: u,
1007
+ isCellEditable: H,
1008
+ isCellEditableByKey: (v, M, O, y) => {
1009
+ const I = T(O, y);
1010
+ return I ? H(v, M, I.column) : !1;
1011
+ },
1012
+ rowSelectionColumn: r
1013
+ };
1014
+ }
1015
+ function Gr(e) {
1016
+ const l = w(() => {
1017
+ const o = e.lastAppliedFill.value, u = e.selectionRange.value;
1018
+ return !o || !u || e.isFillDragging.value || o.allowBehaviorToggle === !1 || o.previewRange.startRow !== u.startRow || o.previewRange.endRow !== u.endRow || o.previewRange.startColumn !== u.startColumn || o.previewRange.endColumn !== u.endColumn ? null : {
1019
+ rowIndex: o.previewRange.endRow,
1020
+ columnIndex: o.previewRange.endColumn
1021
+ };
1022
+ }), r = w(() => e.lastAppliedFill.value?.behavior ?? null);
1023
+ return {
1024
+ fillActionAnchorCell: l,
1025
+ fillActionBehavior: r
1026
+ };
1027
+ }
1028
+ function Lr(e) {
1029
+ const l = e.enabled === !1 || e.history ? null : ko({
1030
+ runtime: e.runtime,
1031
+ cloneRowData: e.cloneRowData,
1032
+ syncViewport: e.syncViewport,
1033
+ maxHistoryDepth: e.maxHistoryDepth
1034
+ }), r = () => e.enabled === !1 ? null : e.history ? e.history.captureSnapshot() : l?.captureRowsSnapshot() ?? null, o = (A) => e.enabled === !1 ? null : e.history ? e.history.captureSnapshotForRowIds?.(A) ?? e.history.captureSnapshot() : l?.captureRowsSnapshotByIds(A) ?? null, u = (A, H) => {
1035
+ if (e.enabled !== !1) {
1036
+ if (e.history) {
1037
+ e.history.recordIntentTransaction(A, H);
1038
+ return;
1039
+ }
1040
+ l?.recordIntentTransaction(
1041
+ A,
1042
+ H
1043
+ );
1044
+ }
1045
+ }, i = () => e.enabled === !1 ? !1 : e.history ? e.history.canUndo() : l?.canUndo.value ?? !1, f = () => e.enabled === !1 ? !1 : e.history ? e.history.canRedo() : l?.canRedo.value ?? !1;
1046
+ return {
1047
+ captureHistorySnapshot: r,
1048
+ captureHistorySnapshotForRowIds: o,
1049
+ recordHistoryIntentTransaction: u,
1050
+ canUndoHistory: i,
1051
+ canRedoHistory: f,
1052
+ canUndo: i,
1053
+ canRedo: f,
1054
+ runHistoryAction: (A) => e.enabled === !1 ? Promise.resolve(null) : e.history ? e.history.runHistoryAction(A) : l?.runHistoryAction(A) ?? Promise.resolve(null),
1055
+ disposeIntentHistory: () => {
1056
+ l?.dispose();
1057
+ }
1058
+ };
1059
+ }
1060
+ function Kr(e) {
1061
+ const l = e.isPlaceholderRow ?? (() => !1), r = e.applyRowSelectionMutation ?? ((y) => {
1062
+ e.runtime.api.rowSelection.hasSupport() && y(e.runtime.api.rowSelection);
1063
+ }), o = w(() => new Set(e.rowSelectionSnapshot.value?.selectedRows ?? [])), u = (y) => !l(y) && y.rowId != null && e.rowSelectionSnapshot.value?.focusedRow === y.rowId, i = (y) => !l(y) && y.kind !== "group" && y.rowId != null && o.value.has(y.rowId), f = (y) => i(y), h = (y) => f(y) ? "true" : "false", R = (y) => {
1064
+ const I = e.rowSelectionColumn.value?.column;
1065
+ return !I || y.kind === "group" || l(y) ? "" : Ao({
1066
+ column: I,
1067
+ value: f(y)
1068
+ }).displayValue;
1069
+ }, A = w(() => {
1070
+ const y = e.runtime.api.rows.getCount(), I = [];
1071
+ for (let U = 0; U < y; U += 1) {
1072
+ const V = e.runtime.api.rows.get(U);
1073
+ !V || V.kind === "group" || V.rowId == null || I.push(V.rowId);
1074
+ }
1075
+ return I;
1076
+ }), H = w(() => {
1077
+ const y = A.value;
1078
+ return y.length > 0 && y.every((I) => o.value.has(I));
1079
+ }), T = w(() => A.value.some((I) => o.value.has(I))), x = (y) => {
1080
+ l(y) || y.rowId == null || !e.runtime.api.rowSelection.hasSupport() || e.runtime.api.rowSelection.setFocusedRow(y.rowId);
1081
+ };
1082
+ return {
1083
+ rowSelectionSet: o,
1084
+ isRowFocused: u,
1085
+ isRowCheckboxSelected: i,
1086
+ readRowSelectionCell: h,
1087
+ readRowSelectionDisplayCell: R,
1088
+ areAllVisibleRowsSelected: H,
1089
+ areSomeVisibleRowsSelected: T,
1090
+ focusRow: x,
1091
+ toggleRowCheckboxSelected: (y) => {
1092
+ l(y) || y.kind === "group" || y.rowId == null || !e.runtime.api.rowSelection.hasSupport() || r((I) => {
1093
+ I.setSelected(y.rowId, !o.value.has(y.rowId));
1094
+ });
1095
+ },
1096
+ toggleVisibleRowsSelected: () => {
1097
+ if (!e.runtime.api.rowSelection.hasSupport())
1098
+ return;
1099
+ const y = A.value;
1100
+ if (!H.value) {
1101
+ r((I) => {
1102
+ I.selectRows(y);
1103
+ });
1104
+ return;
1105
+ }
1106
+ r((I) => {
1107
+ I.deselectRows(y);
1108
+ });
1109
+ },
1110
+ selectRowRange: (y, I, U) => {
1111
+ x(y);
1112
+ const V = e.orderedVisibleColumns.value.length - 1;
1113
+ if (V < 0)
1114
+ return;
1115
+ const ne = e.viewportRowStart.value + I;
1116
+ if (!U) {
1117
+ e.applySelectionRange({
1118
+ startRow: ne,
1119
+ endRow: ne,
1120
+ startColumn: 0,
1121
+ endColumn: V
1122
+ });
1123
+ return;
1124
+ }
1125
+ const pe = e.selectionAnchorCell.value?.rowIndex ?? ne;
1126
+ e.applySelectionRange({
1127
+ startRow: Math.min(pe, ne),
1128
+ endRow: Math.max(pe, ne),
1129
+ startColumn: 0,
1130
+ endColumn: V
1131
+ });
1132
+ }
1133
+ };
1134
+ }
1135
+ function $r(e) {
1136
+ const l = (f) => ({ target: f });
1137
+ return {
1138
+ handleWindowMouseMove: (f) => {
1139
+ if (e.isColumnResizing.value) {
1140
+ e.applyColumnResizeFromPointer(f.clientX);
1141
+ return;
1142
+ }
1143
+ e.handleInteractionWindowMouseMove(f);
1144
+ },
1145
+ handleHeaderWheel: (f) => {
1146
+ const h = e.bodyViewportRef.value;
1147
+ if (!h)
1148
+ return;
1149
+ const R = Math.abs(f.deltaX) > 0 ? f.deltaX : f.shiftKey ? f.deltaY : 0, A = R === 0 ? f.deltaY : 0;
1150
+ R === 0 && A === 0 || (f.preventDefault(), R !== 0 && (h.scrollLeft += R), A !== 0 && (h.scrollTop += A), e.syncViewport(l(h)));
1151
+ },
1152
+ handleHeaderScroll: (f) => {
1153
+ const h = f.target, R = e.bodyViewportRef.value;
1154
+ !h || !R || (R.scrollLeft !== h.scrollLeft && (R.scrollLeft = h.scrollLeft), e.syncViewport(l(R)));
1155
+ },
1156
+ handleWindowMouseUp: () => {
1157
+ e.stopColumnResize(), e.handleInteractionWindowMouseUp();
1158
+ }
1159
+ };
1160
+ }
1161
+ function Nr(e) {
1162
+ const l = (i) => i.ctrlKey || i.metaKey || i.altKey ? !1 : i.key.startsWith("Arrow") || i.key === "Home" || i.key === "End" || i.key === "PageUp" || i.key === "PageDown" || i.key === "Tab" || i.key === "Enter" || i.key === " " || i.key === "Spacebar" || i.key === "F2" || i.key === "Escape" || i.key.length === 1, r = (i) => (i.ctrlKey || i.metaKey) && !i.altKey && !i.shiftKey && i.key.toLowerCase() === "a", o = () => {
1163
+ const i = e.totalRows.value - 1, f = e.orderedVisibleColumns.value.length - 1;
1164
+ i < 0 || f < 0 || e.applySelectionRange({
1165
+ startRow: 0,
1166
+ endRow: i,
1167
+ startColumn: 0,
1168
+ endColumn: f
1169
+ });
1170
+ };
1171
+ return {
1172
+ handleViewportKeydown: (i) => {
1173
+ (l(i) || r(i)) && i.preventDefault();
1174
+ const f = e.selectionSnapshot.value?.activeCell;
1175
+ if (!f) {
1176
+ r(i) && o();
1177
+ return;
1178
+ }
1179
+ const h = e.runtime.getBodyRowAtIndex(f.rowIndex);
1180
+ h && e.handleCellKeydown(
1181
+ i,
1182
+ h,
1183
+ f.rowIndex - e.viewportRowStart.value,
1184
+ f.colIndex
1185
+ );
1186
+ }
1187
+ };
1188
+ }
1189
+ function Wr(e) {
1190
+ const l = w(() => e.interactionSelectionRange.value ?? e.resolveCommittedSelectionRange()), r = w(() => {
1191
+ const x = e.interactionSelectionRange.value;
1192
+ return x ? [x] : e.resolveCommittedSelectionRanges();
1193
+ }), o = () => {
1194
+ const x = l.value;
1195
+ return x && x.startRow === x.endRow && x.startColumn === x.endColumn ? {
1196
+ rowIndex: x.startRow,
1197
+ columnIndex: x.startColumn
1198
+ } : e.selectionAnchorCell.value;
1199
+ }, u = () => l.value, i = () => r.value, f = () => e.mode.value === "base" && e.isFillDragging.value && !!e.fillPreviewRange.value, h = (x, v, M) => {
1200
+ const O = e.viewportRowStart.value + v;
1201
+ return O >= x.startRow && O <= x.endRow && M >= x.startColumn && M <= x.endColumn;
1202
+ }, R = (x, v) => {
1203
+ const M = o();
1204
+ return M ? M.rowIndex === e.viewportRowStart.value + x && M.columnIndex === v : e.isCommittedSelectionAnchorCell(x, v);
1205
+ };
1206
+ return {
1207
+ selectionRange: l,
1208
+ selectionRanges: r,
1209
+ isSelectionAnchorCell: R,
1210
+ isCellSelected: (x, v) => {
1211
+ if (!f())
1212
+ return i().some((O) => h(O, x, v));
1213
+ const M = u();
1214
+ return M ? h(M, x, v) : !1;
1215
+ },
1216
+ shouldHighlightSelectedCell: (x, v) => {
1217
+ if (!f()) {
1218
+ const y = i();
1219
+ return y.length === 0 || !y.some((I) => h(I, x, v)) || y.length === 1 && y[0] && y[0].startRow === y[0].endRow && y[0].startColumn === y[0].endColumn ? !1 : !R(x, v);
1220
+ }
1221
+ const M = u();
1222
+ return !M || !h(M, x, v) || M.startRow === M.endRow && M.startColumn === M.endColumn ? !1 : !R(x, v);
1223
+ },
1224
+ isCellOnSelectionEdge: (x, v, M) => {
1225
+ if (!f())
1226
+ return i().some((I) => {
1227
+ if (!h(I, x, v))
1228
+ return !1;
1229
+ const U = e.viewportRowStart.value + x;
1230
+ switch (M) {
1231
+ case "top":
1232
+ return U === I.startRow;
1233
+ case "right":
1234
+ return v === I.endColumn;
1235
+ case "bottom":
1236
+ return U === I.endRow;
1237
+ case "left":
1238
+ return v === I.startColumn;
1239
+ }
1240
+ });
1241
+ const O = u();
1242
+ if (!O || !h(O, x, v))
1243
+ return !1;
1244
+ const y = e.viewportRowStart.value + x;
1245
+ switch (M) {
1246
+ case "top":
1247
+ return y === O.startRow;
1248
+ case "right":
1249
+ return v === O.endColumn;
1250
+ case "bottom":
1251
+ return y === O.endRow;
1252
+ case "left":
1253
+ return v === O.startColumn;
1254
+ }
1255
+ }
1256
+ };
1257
+ }
1258
+ const ul = 140, Ur = 72, qr = 80, Yr = 24, Xr = 400;
1259
+ function Jr(e) {
1260
+ const l = e.syncRowSelectionSnapshotFromRuntime ?? (() => {
1261
+ }), r = e.flushRowSelectionSnapshotUpdates ?? (() => {
1262
+ }), o = e.rowSelectionSnapshot ?? Z(null), u = w(() => e.showRowIndex?.value !== !1), i = w(() => e.runtime.rowPartition.value.bodyRowCount), f = Yo({
1263
+ runtime: e.runtime,
1264
+ sourceRows: e.sourceRows ?? e.rows,
1265
+ totalBodyRows: i,
1266
+ placeholderRows: e.placeholderRows,
1267
+ cloneRowData: e.cloneRowData
1268
+ }), h = w(() => Math.max(0, f.totalVisualRows.value)), R = w(() => Math.max(0, h.value + e.runtime.rowPartition.value.pinnedBottomRows.length)), A = w(() => u.value ? Ur : 0), H = jr({
1269
+ runtime: e.runtime,
1270
+ visibleColumns: e.visibleColumns,
1271
+ showRowSelection: e.showRowSelection,
1272
+ isCellEditable: e.isCellEditable
1273
+ }), {
1274
+ orderedVisibleColumns: T,
1275
+ centerColumns: x,
1276
+ resolveColumnWidth: v,
1277
+ isRowSelectionColumnKey: M,
1278
+ isRowSelectionColumn: O,
1279
+ isCellEditable: y,
1280
+ isCellEditableByKey: I,
1281
+ rowSelectionColumn: U
1282
+ } = H, V = Eo({
1283
+ totalRows: () => h.value,
1284
+ resolveBaseRowHeight: () => e.normalizedBaseRowHeight.value,
1285
+ resolveRowHeightOverride: (b) => e.runtime.api.view.getRowHeightOverride(b),
1286
+ resolveRowHeightVersion: () => e.runtime.api.view.getRowHeightVersion(),
1287
+ hasRowHeightOverrides: () => e.runtime.api.view.getRowHeightVersion() > 0,
1288
+ resolveRowHeightOverridesSnapshot: () => e.runtime.api.view.getRowHeightOverridesSnapshot?.() ?? null,
1289
+ resolveLastRowHeightMutation: () => e.runtime.api.view.getLastRowHeightMutation?.() ?? null
1290
+ }), ne = (b) => {
1291
+ const S = Math.max(0, Math.trunc(b));
1292
+ if (S <= 0)
1293
+ return 0;
1294
+ const F = V.resolveTotalHeight();
1295
+ return S <= i.value ? V.resolveRowOffset(S) : F + (S - i.value) * e.normalizedBaseRowHeight.value;
1296
+ }, pe = w(() => {
1297
+ if (e.layoutMode.value !== "auto-height")
1298
+ return null;
1299
+ let b = V.resolveTotalHeight();
1300
+ return e.minRows.value !== null && (b = Math.max(b, ne(e.minRows.value))), e.maxRows.value !== null && (b = Math.min(b, ne(e.maxRows.value))), Math.max(0, Math.trunc(b));
1301
+ }), tt = w(() => e.layoutMode.value !== "auto-height" ? {} : {
1302
+ height: "auto"
1303
+ }), nt = w(() => {
1304
+ if (e.layoutMode.value !== "auto-height")
1305
+ return {};
1306
+ const b = pe.value ?? 0;
1307
+ return {
1308
+ height: `${b}px`,
1309
+ maxHeight: `${b}px`
1310
+ };
1311
+ });
1312
+ let Ie = () => !1;
1313
+ const {
1314
+ headerViewportRef: j,
1315
+ bodyViewportRef: z,
1316
+ displayRows: E,
1317
+ pinnedBottomRows: le,
1318
+ renderedColumns: In,
1319
+ viewportRowStart: Q,
1320
+ viewportColumnStart: ee,
1321
+ topSpacerHeight: Ft,
1322
+ bottomSpacerHeight: xn,
1323
+ leftColumnSpacerWidth: Mn,
1324
+ rightColumnSpacerWidth: Le,
1325
+ gridContentStyle: An,
1326
+ mainTrackStyle: Fn,
1327
+ indexColumnStyle: On,
1328
+ columnStyle: Dn,
1329
+ handleViewportScroll: Ot,
1330
+ syncViewportFromDom: oe,
1331
+ scheduleViewportSync: kn,
1332
+ cancelScheduledViewportSync: En
1333
+ } = To({
1334
+ runtime: f.visualRuntime,
1335
+ mode: e.mode,
1336
+ rowRenderMode: e.rowRenderMode,
1337
+ rowVirtualizationEnabled: w(() => e.virtualization.value.rows),
1338
+ columnVirtualizationEnabled: w(() => e.virtualization.value.columns),
1339
+ totalRows: h,
1340
+ visibleColumns: x,
1341
+ sizingColumns: T,
1342
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1343
+ resolveColumnWidth: v,
1344
+ defaultColumnWidth: ul,
1345
+ indexColumnWidth: 0,
1346
+ flexFillOffsetWidth: A.value,
1347
+ rowOverscan: w(() => e.virtualization.value.rowOverscan),
1348
+ columnOverscan: w(() => e.virtualization.value.columnOverscan),
1349
+ measureVisibleRowHeights: () => ze(),
1350
+ resolveRowHeight: V.resolveRowHeight,
1351
+ resolveRowOffset: V.resolveRowOffset,
1352
+ resolveRowIndexAtOffset: V.resolveRowIndexAtOffset,
1353
+ resolveTotalRowHeight: V.resolveTotalHeight
1354
+ }), xe = (b) => Dn(b), B = f.visualRuntime, Te = B.resolveBodyRowIndexById, Ke = (b) => {
1355
+ if (!Number.isFinite(b))
1356
+ return null;
1357
+ const S = Math.max(0, Math.trunc(b));
1358
+ if (S < h.value)
1359
+ return B.getBodyRowAtIndex(S);
1360
+ const F = S - h.value;
1361
+ return e.runtime.rowPartition.value.pinnedBottomRows[F] ?? null;
1362
+ }, {
1363
+ rowStyle: Dt,
1364
+ isRowAutosizeProbe: Tn,
1365
+ measureVisibleRowHeights: ze,
1366
+ startRowResize: kt,
1367
+ autosizeRow: Et,
1368
+ consumeRecentRowResizeInteraction: Ml,
1369
+ dispose: Tt
1370
+ } = zo({
1371
+ mode: e.mode,
1372
+ rowHeightMode: e.rowHeightMode,
1373
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1374
+ viewportRowStart: Q,
1375
+ bodyViewportRef: z,
1376
+ runtime: e.runtime,
1377
+ minRowHeight: Yr,
1378
+ syncViewport: () => oe()
1379
+ }), _e = _o({
1380
+ mode: e.mode,
1381
+ runtime: {
1382
+ api: B.api,
1383
+ getBodyRowAtIndex: Ke
1384
+ },
1385
+ totalRows: R,
1386
+ visibleColumns: T,
1387
+ viewportRowStart: Q,
1388
+ resolveRowIndex: (b) => {
1389
+ const S = E.value[b];
1390
+ return S && Number.isFinite(S.displayIndex) ? Math.max(0, Math.trunc(S.displayIndex)) : Q.value + b;
1391
+ },
1392
+ selectionSnapshot: e.selectionSnapshot,
1393
+ selectionAnchor: e.selectionAnchor,
1394
+ isEditingCell: (b, S) => Ie(b, S)
1395
+ }), {
1396
+ normalizeRowId: zt,
1397
+ normalizeCellCoord: _t,
1398
+ resolveSelectionRange: $e,
1399
+ resolveSelectionRanges: lt,
1400
+ resolveCurrentCellCoord: ot,
1401
+ applySelectionRange: Me,
1402
+ applyCellSelectionByCoord: se,
1403
+ setCellSelection: Ht,
1404
+ clearCellSelection: rt,
1405
+ isCellSelected: at
1406
+ } = _e, it = _e.isSelectionAnchorCell ?? (() => !1), zn = _e.shouldHighlightSelectedCell ?? ((b, S) => at(b, S)), _n = _e.isCellOnSelectionEdge ?? (() => !1), st = w(() => {
1407
+ const b = e.selectionSnapshot.value;
1408
+ if (!b || b.ranges.length === 0)
1409
+ return null;
1410
+ const S = b.activeRangeIndex ?? 0, F = b.ranges[S]?.anchor ?? b.ranges[0]?.anchor ?? null;
1411
+ return !F || typeof F.rowIndex != "number" || typeof F.colIndex != "number" || !Number.isFinite(F.rowIndex) || !Number.isFinite(F.colIndex) ? null : {
1412
+ rowIndex: Math.trunc(F.rowIndex),
1413
+ columnIndex: Math.trunc(F.colIndex)
1414
+ };
1415
+ }), Pt = Kr({
1416
+ runtime: e.runtime,
1417
+ isPlaceholderRow: f.isPlaceholderRow,
1418
+ rowSelectionColumn: U,
1419
+ orderedVisibleColumns: T,
1420
+ displayRows: E,
1421
+ rowSelectionSnapshot: o,
1422
+ applyRowSelectionMutation: (b) => {
1423
+ e.runtime.api.rowSelection.hasSupport() && (b(e.runtime.api.rowSelection), l(), r());
1424
+ },
1425
+ viewportRowStart: Q,
1426
+ selectionAnchorCell: st,
1427
+ applySelectionRange: Me
1428
+ }), {
1429
+ readRowSelectionCell: Hn,
1430
+ readRowSelectionDisplayCell: Pn,
1431
+ toggleRowCheckboxSelected: Vn
1432
+ } = Pt, Bn = w(() => {
1433
+ const b = `${A.value}px`;
1434
+ return {
1435
+ ...On.value,
1436
+ width: b,
1437
+ minWidth: b,
1438
+ maxWidth: b
1439
+ };
1440
+ }), ut = Lr({
1441
+ runtime: e.runtime,
1442
+ cloneRowData: e.cloneRowData,
1443
+ syncViewport: () => oe(),
1444
+ enabled: e.historyEnabled?.value !== !1,
1445
+ maxHistoryDepth: e.historyMaxDepth?.value,
1446
+ history: e.history
1447
+ }), {
1448
+ captureHistorySnapshot: Ae,
1449
+ captureHistorySnapshotForRowIds: He,
1450
+ recordHistoryIntentTransaction: Fe,
1451
+ canUndoHistory: Vt,
1452
+ canRedoHistory: Bt,
1453
+ runHistoryAction: ct
1454
+ } = ut, {
1455
+ rowIndexLabel: jt,
1456
+ readCell: Gt,
1457
+ readDisplayCell: Lt,
1458
+ rowClass: Kt,
1459
+ toggleGroupRow: dt
1460
+ } = Ho({
1461
+ mode: e.mode,
1462
+ runtime: e.runtime,
1463
+ viewportRowStart: Q,
1464
+ firstColumnKey: e.firstColumnKey
1465
+ }), ce = Br({
1466
+ runtime: e.runtime,
1467
+ viewportRowStart: Q,
1468
+ ensureEditableRowAtIndex: (b) => f.ensureMaterializedRowAt(b, "toggle"),
1469
+ isRowSelectionColumnKey: M,
1470
+ isRowSelectionColumn: O,
1471
+ isCellEditableByKey: I,
1472
+ readRowSelectionCell: Hn,
1473
+ readRowSelectionDisplayCell: Pn,
1474
+ readCell: Gt,
1475
+ readDisplayCell: Lt,
1476
+ toggleRowCheckboxSelected: Vn,
1477
+ captureHistorySnapshot: Ae,
1478
+ captureHistorySnapshotForRowIds: He,
1479
+ recordHistoryIntentTransaction: Fe,
1480
+ syncViewport: () => oe()
1481
+ }), {
1482
+ readStageCell: q
1483
+ } = ce, mt = (b, S, F) => f.isPlaceholderRow(b) ? f.isPlaceholderCellEditable(S) : F(), Pe = (b, S, F, D) => mt(
1484
+ b,
1485
+ T.value[D],
1486
+ () => I(b, S, F, D)
1487
+ ), ft = Po({
1488
+ mode: e.mode,
1489
+ runtime: B,
1490
+ totalRows: h,
1491
+ visibleColumns: T,
1492
+ viewportRowStart: Q,
1493
+ resolveSelectionRange: $e,
1494
+ resolveSelectionRanges: lt,
1495
+ resolveCurrentCellCoord: ot,
1496
+ applySelectionRange: Me,
1497
+ clearCellSelection: rt,
1498
+ captureRowsSnapshot: Ae,
1499
+ captureRowsSnapshotForRowIds: He,
1500
+ recordEditTransaction: (b) => {
1501
+ Fe({
1502
+ intent: "edit",
1503
+ label: "Cell edit"
1504
+ }, b);
1505
+ },
1506
+ readCell: (b, S) => q(b, S),
1507
+ readClipboardCell: e.readClipboardCell ? (b, S) => e.readClipboardCell?.(b, S) ?? "" : void 0,
1508
+ isCellEditable: Pe,
1509
+ syncViewport: () => oe(),
1510
+ applyClipboardEdits: e.applyClipboardEdits,
1511
+ buildFillMatrixFromRange: e.buildFillMatrixFromRange,
1512
+ buildPasteSpecialMatrixFromRange: e.buildPasteSpecialMatrixFromRange,
1513
+ ensureEditableRowAtIndex: (b) => f.ensureMaterializedRowAt(b, "paste")
1514
+ }), {
1515
+ normalizeClipboardRange: Ne,
1516
+ applyClipboardEdits: $t,
1517
+ rangesEqual: Nt,
1518
+ buildFillMatrixFromRange: Wt,
1519
+ clearPendingClipboardOperation: Ve,
1520
+ copySelectedCells: Oe,
1521
+ pasteSelectedCells: Ut,
1522
+ cutSelectedCells: qt,
1523
+ isCellInPendingClipboardRange: jn,
1524
+ isCellOnPendingClipboardEdge: Gn
1525
+ } = ft, {
1526
+ ensureKeyboardActiveCellVisible: Yt,
1527
+ revealCellInComfortZone: Xt
1528
+ } = Vo({
1529
+ bodyViewportRef: z,
1530
+ visibleColumns: T,
1531
+ resolveColumnWidth: v,
1532
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1533
+ resolveRowHeight: V.resolveRowHeight,
1534
+ resolveRowOffset: V.resolveRowOffset,
1535
+ indexColumnWidth: A.value,
1536
+ defaultColumnWidth: ul,
1537
+ syncViewport: () => oe()
1538
+ }), {
1539
+ editingCell: Ln,
1540
+ editingCellValue: wt,
1541
+ editingCellInitialFilter: gt,
1542
+ editingCellOpenOnMount: Kn,
1543
+ isEditingCell: Jt,
1544
+ startInlineEdit: vt,
1545
+ appendInlineEditTextInput: Zt,
1546
+ commitInlineEdit: de,
1547
+ cancelInlineEdit: he,
1548
+ handleEditorKeydown: We,
1549
+ handleEditorBlur: me
1550
+ } = Bo({
1551
+ mode: e.mode,
1552
+ bodyViewportRef: z,
1553
+ visibleColumns: T,
1554
+ totalRows: h,
1555
+ runtime: B,
1556
+ readCell: (b, S) => q(b, S),
1557
+ resolveRowIndexById: Te,
1558
+ applyCellSelection: (b) => {
1559
+ se(b, !1);
1560
+ },
1561
+ ensureActiveCellVisible: (b, S) => {
1562
+ Yt(b, S);
1563
+ },
1564
+ isCellEditable: Pe,
1565
+ captureRowsSnapshot: Ae,
1566
+ captureRowsSnapshotForRowIds: He,
1567
+ recordEditTransaction: (b) => {
1568
+ Fe({
1569
+ intent: "edit",
1570
+ label: "Cell edit"
1571
+ }, b);
1572
+ },
1573
+ ensureEditableRowAtIndex: (b) => f.ensureMaterializedRowAt(b, "edit")
1574
+ });
1575
+ Ie = Jt;
1576
+ const De = w(() => Ln.value), ht = (b, S) => {
1577
+ const F = Ne(b), D = Ne(S);
1578
+ if (!F || !D || Nt(F, D))
1579
+ return !1;
1580
+ const te = Wt(F), mn = F.endRow - F.startRow + 1, nl = F.endColumn - F.startColumn + 1, ve = /* @__PURE__ */ new Map();
1581
+ for (let _ = 0; _ < mn; _ += 1) {
1582
+ let K = !1;
1583
+ for (let X = 0; X < nl; X += 1)
1584
+ if ((te[_]?.[X] ?? "").length > 0) {
1585
+ K = !0;
1586
+ break;
1587
+ }
1588
+ ve.set(D.startRow + _, K);
1589
+ }
1590
+ const It = Ae(), Ye = /* @__PURE__ */ new Map();
1591
+ let xt = 0, Xe = 0;
1592
+ const fn = (_) => {
1593
+ const K = Ye.get(_);
1594
+ if (K)
1595
+ return K;
1596
+ const X = {};
1597
+ return Ye.set(_, X), X;
1598
+ };
1599
+ for (let _ = F.startRow; _ <= F.endRow; _ += 1) {
1600
+ const K = B.getBodyRowAtIndex(_);
1601
+ if (!(!K || K.kind === "group" || K.rowId == null || f.isPlaceholderRow(K)))
1602
+ for (let X = F.startColumn; X <= F.endColumn; X += 1) {
1603
+ const re = T.value[X]?.key;
1604
+ !re || M(re) || (fn(K.rowId)[re] = "");
1605
+ }
1606
+ }
1607
+ for (let _ = D.startRow; _ <= D.endRow; _ += 1) {
1608
+ let K = B.getBodyRowAtIndex(_);
1609
+ f.isPlaceholderRow(K) && ve.get(_) === !0 && (K = f.ensureMaterializedRowAt(_, "paste"));
1610
+ for (let X = D.startColumn; X <= D.endColumn; X += 1) {
1611
+ const re = T.value[X]?.key;
1612
+ if (!re || M(re))
1613
+ continue;
1614
+ const wn = _ - D.startRow, ll = X - D.startColumn, ol = te[wn]?.[ll] ?? "";
1615
+ if (!K || K.kind === "group" || K.rowId == null || f.isPlaceholderRow(K)) {
1616
+ xt += 1;
1617
+ continue;
1618
+ }
1619
+ fn(K.rowId)[re] = ol, Xe += 1;
1620
+ }
1621
+ }
1622
+ return Xe <= 0 || Ye.size === 0 ? !1 : (e.runtime.api.rows.applyEdits(Array.from(Ye.entries()).map(([_, K]) => ({
1623
+ rowId: _,
1624
+ data: K
1625
+ }))), Me(D), Fe({
1626
+ intent: "move",
1627
+ label: xt > 0 ? `Move ${Xe} cells (blocked ${xt})` : `Move ${Xe} cells`,
1628
+ affectedRange: D
1629
+ }, It), oe(), !0);
1630
+ }, $n = {
1631
+ mode: e.mode,
1632
+ enableFillHandle: e.enableFillHandle,
1633
+ enableRangeMove: e.enableRangeMove,
1634
+ runtime: B,
1635
+ totalRows: h,
1636
+ visibleColumns: T,
1637
+ viewportRowStart: Q,
1638
+ selectionSnapshot: e.selectionSnapshot,
1639
+ bodyViewportRef: z,
1640
+ indexColumnWidth: A.value,
1641
+ resolveColumnWidth: v,
1642
+ resolveRowHeight: V.resolveRowHeight,
1643
+ resolveRowIndexAtOffset: V.resolveRowIndexAtOffset,
1644
+ normalizeRowId: zt,
1645
+ normalizeCellCoord: _t,
1646
+ resolveSelectionRange: $e,
1647
+ applySelectionRange: Me,
1648
+ applyCellSelectionByCoord: se,
1649
+ setCellSelection: Ht,
1650
+ clearCellSelection: rt,
1651
+ readCell: (b, S) => q(b, S),
1652
+ isCellEditable: Pe,
1653
+ cloneRowData: e.cloneRowData,
1654
+ resolveRowIndexById: Te,
1655
+ ensureEditableRowAtIndex: (b) => f.ensureMaterializedRowAt(b, "toggle"),
1656
+ captureRowsSnapshot: Ae,
1657
+ captureRowsSnapshotForRowIds: He,
1658
+ recordIntentTransaction: (b, S) => {
1659
+ Fe(b, S);
1660
+ },
1661
+ clearPendingClipboardOperation: Ve,
1662
+ clearExternalPendingClipboardOperation: e.clearExternalPendingClipboardOperation,
1663
+ copySelectedCells: Oe,
1664
+ pasteSelectedCells: Ut,
1665
+ cutSelectedCells: qt,
1666
+ normalizeClipboardRange: Ne,
1667
+ applyClipboardEdits: $t,
1668
+ rangesEqual: Nt,
1669
+ buildFillMatrixFromRange: Wt,
1670
+ applyRangeMove: e.applyRangeMove ?? ht,
1671
+ syncViewport: () => oe(),
1672
+ editingCell: De,
1673
+ startInlineEdit: vt,
1674
+ appendInlineEditTextInput: Zt,
1675
+ cancelInlineEdit: he,
1676
+ commitInlineEdit: de,
1677
+ canUndo: () => (e.historyShortcuts?.value ?? "grid") === "grid" && Vt(),
1678
+ canRedo: () => (e.historyShortcuts?.value ?? "grid") === "grid" && Bt(),
1679
+ runHistoryAction: (b) => (e.historyShortcuts?.value ?? "grid") === "grid" ? ct(b) : Promise.resolve(null),
1680
+ ensureKeyboardActiveCellVisible: Yt,
1681
+ isContextMenuVisible: e.isContextMenuVisible,
1682
+ closeContextMenu: e.closeContextMenu,
1683
+ openContextMenuFromCurrentCell: e.openContextMenuFromCurrentCell,
1684
+ runRowIndexKeyboardAction: e.runRowIndexKeyboardAction
1685
+ }, Nn = jo($n), {
1686
+ isPointerSelectingCells: bt,
1687
+ isFillDragging: Be,
1688
+ fillPreviewRange: yt,
1689
+ lastAppliedFill: Ct,
1690
+ isRangeMoving: Qt,
1691
+ selectionRange: Wn,
1692
+ rangeMovePreviewRange: je,
1693
+ stopPointerSelection: ge,
1694
+ stopFillSelection: ke,
1695
+ startFillHandleDrag: en,
1696
+ startFillHandleDoubleClick: tn,
1697
+ applyLastFillBehavior: Rt,
1698
+ handleCellMouseDown: Un,
1699
+ handleCellKeydown: nn,
1700
+ handleRowIndexKeydown: qn,
1701
+ handleWindowMouseMove: Yn,
1702
+ handleWindowMouseUp: Xn,
1703
+ isCellInFillPreview: ln,
1704
+ isFillHandleCell: on,
1705
+ clearSelectedCells: rn,
1706
+ dispose: an
1707
+ } = Nn, sn = w(() => bt.value ? Wn.value : null), St = Nr({
1708
+ runtime: B,
1709
+ selectionSnapshot: e.selectionSnapshot,
1710
+ totalRows: h,
1711
+ orderedVisibleColumns: T,
1712
+ viewportRowStart: Q,
1713
+ applySelectionRange: Me,
1714
+ handleCellKeydown: nn
1715
+ }), {
1716
+ isColumnResizing: Jn,
1717
+ startResize: Ue,
1718
+ handleResizeDoubleClick: qe,
1719
+ applyColumnResizeFromPointer: Ee,
1720
+ stopColumnResize: Zn,
1721
+ dispose: Qn
1722
+ } = Go({
1723
+ visibleColumns: T,
1724
+ rows: e.rows,
1725
+ persistColumnWidth: (b, S) => {
1726
+ e.runtime.api.columns.setWidth(b, S);
1727
+ },
1728
+ defaultColumnWidth: ul,
1729
+ minColumnWidth: qr,
1730
+ autoSizeSampleLimit: Xr,
1731
+ autoSizeCharWidth: 7.2,
1732
+ autoSizeHorizontalPadding: 42,
1733
+ autoSizeMaxWidth: 640,
1734
+ isFillDragging: () => Be.value,
1735
+ stopFillSelection: () => {
1736
+ ke(!1);
1737
+ },
1738
+ isDragSelecting: () => bt.value,
1739
+ stopDragSelection: () => {
1740
+ ge();
1741
+ },
1742
+ readCellText: (b, S) => {
1743
+ const F = b[S];
1744
+ return F == null ? "" : String(F);
1745
+ }
1746
+ }), un = Wr({
1747
+ mode: e.mode,
1748
+ viewportRowStart: Q,
1749
+ selectionAnchorCell: st,
1750
+ fillPreviewRange: yt,
1751
+ isFillDragging: Be,
1752
+ interactionSelectionRange: sn,
1753
+ resolveCommittedSelectionRange: $e,
1754
+ resolveCommittedSelectionRanges: lt,
1755
+ isCommittedSelectionAnchorCell: it,
1756
+ isCommittedCellSelected: at,
1757
+ shouldHighlightCommittedSelectedCell: zn,
1758
+ isCommittedCellOnSelectionEdge: _n
1759
+ }), { selectionRange: cn, selectionRanges: ue } = un, el = Gr({
1760
+ lastAppliedFill: Ct,
1761
+ selectionRange: cn,
1762
+ isFillDragging: Be
1763
+ }), dn = $r({
1764
+ bodyViewportRef: z,
1765
+ isColumnResizing: Jn,
1766
+ applyColumnResizeFromPointer: Ee,
1767
+ stopColumnResize: Zn,
1768
+ handleInteractionWindowMouseMove: Yn,
1769
+ handleInteractionWindowMouseUp: Xn,
1770
+ syncViewport: Ot
1771
+ }), L = {
1772
+ rowSelection: Pt,
1773
+ history: ut,
1774
+ cellIo: ce,
1775
+ viewportKeyboard: St,
1776
+ visualSelection: un,
1777
+ fillAction: el,
1778
+ scrollSync: dn
1779
+ }, {
1780
+ tableStageProps: tl,
1781
+ tableStageContext: pt
1782
+ } = Vr({
1783
+ mode: e.mode,
1784
+ rowHeightMode: e.rowHeightMode,
1785
+ layoutMode: e.layoutMode,
1786
+ chromeSignature: e.chromeSignature,
1787
+ visibleColumns: T,
1788
+ renderedColumns: In,
1789
+ displayRows: E,
1790
+ pinnedBottomRows: le,
1791
+ sourceRows: e.sourceRows ?? e.rows,
1792
+ showRowIndex: u,
1793
+ rowHover: w(() => e.rowHover?.value === !0),
1794
+ stripedRows: w(() => e.stripedRows?.value === !0),
1795
+ columnFilterTextByKey: e.columnFilterTextByKey,
1796
+ gridContentStyle: An,
1797
+ mainTrackStyle: Fn,
1798
+ indexColumnStyle: Bn,
1799
+ stageStyle: tt,
1800
+ bodyShellStyle: nt,
1801
+ topSpacerHeight: Ft,
1802
+ bottomSpacerHeight: xn,
1803
+ viewportRowStart: Q,
1804
+ columnWindowStart: ee,
1805
+ leftColumnSpacerWidth: Mn,
1806
+ rightColumnSpacerWidth: Le,
1807
+ editingCellValueRef: wt,
1808
+ editingCellInitialFilter: gt,
1809
+ editingCellOpenOnMount: Kn,
1810
+ selectionRange: cn,
1811
+ selectionRanges: ue,
1812
+ selectionAnchorCell: st,
1813
+ totalRowCount: h,
1814
+ fillPreviewRange: yt,
1815
+ rangeMovePreviewRange: je,
1816
+ fillHandleEnabled: w(() => e.enableFillHandle.value),
1817
+ rangeMoveEnabled: w(() => e.enableRangeMove.value),
1818
+ isFillDragging: Be,
1819
+ isRangeMoving: Qt,
1820
+ headerViewportRef: j,
1821
+ bodyViewportRef: z,
1822
+ columnStyle: xe,
1823
+ reorderColumnsByHeader: e.reorderColumnsByHeader,
1824
+ toggleSortForColumn: e.toggleSortForColumn,
1825
+ handleHeaderColumnClick: e.handleHeaderColumnClick,
1826
+ sortIndicator: e.sortIndicator,
1827
+ setColumnFilterText: e.setColumnFilterText,
1828
+ columnMenuEnabled: e.columnMenuEnabled,
1829
+ columnMenuTrigger: e.columnMenuTrigger,
1830
+ columnMenuValueFilterEnabled: e.columnMenuValueFilterEnabled,
1831
+ columnMenuValueFilterRowLimit: e.columnMenuValueFilterRowLimit,
1832
+ columnMenuMaxFilterValues: e.columnMenuMaxFilterValues,
1833
+ resolveColumnMenuItems: e.resolveColumnMenuItems,
1834
+ resolveColumnMenuDisabledItems: e.resolveColumnMenuDisabledItems,
1835
+ resolveColumnMenuDisabledReasons: e.resolveColumnMenuDisabledReasons,
1836
+ resolveColumnMenuLabels: e.resolveColumnMenuLabels,
1837
+ resolveColumnMenuActionOptions: e.resolveColumnMenuActionOptions,
1838
+ resolveColumnMenuCustomItems: e.resolveColumnMenuCustomItems,
1839
+ isColumnFilterActive: e.isColumnFilterActive,
1840
+ isColumnGrouped: e.isColumnGrouped,
1841
+ resolveColumnGroupOrder: e.resolveColumnGroupOrder,
1842
+ resolveColumnMenuSortDirection: e.resolveColumnMenuSortDirection,
1843
+ resolveColumnMenuSelectedTokens: e.resolveColumnMenuSelectedTokens,
1844
+ resolveColumnMenuValueEntries: e.resolveColumnMenuValueEntries,
1845
+ applyColumnMenuSort: e.applyColumnMenuSort,
1846
+ applyColumnMenuPin: e.applyColumnMenuPin,
1847
+ applyColumnMenuGroupBy: e.applyColumnMenuGroupBy,
1848
+ applyColumnMenuFilter: e.applyColumnMenuFilter,
1849
+ clearColumnMenuFilter: e.clearColumnMenuFilter,
1850
+ handleHeaderWheel: L.scrollSync.handleHeaderWheel,
1851
+ handleHeaderScroll: L.scrollSync.handleHeaderScroll,
1852
+ handleViewportScroll: Ot,
1853
+ handleViewportKeydown: L.viewportKeyboard.handleViewportKeydown,
1854
+ rowClass: Kt,
1855
+ isRowAutosizeProbe: Tn,
1856
+ rowStyle: Dt,
1857
+ isRowInPendingClipboardCut: e.isRowInPendingClipboardCut,
1858
+ isRowFocused: L.rowSelection.isRowFocused,
1859
+ isRowCheckboxSelected: L.rowSelection.isRowCheckboxSelected,
1860
+ allVisibleRowsSelected: L.rowSelection.areAllVisibleRowsSelected,
1861
+ someVisibleRowsSelected: L.rowSelection.areSomeVisibleRowsSelected,
1862
+ handleRowClick: L.rowSelection.focusRow,
1863
+ handleRowIndexClick: L.rowSelection.selectRowRange,
1864
+ handleRowIndexKeydown: qn,
1865
+ reorderRowsByIndex: e.reorderRowsByIndex,
1866
+ handleToggleAllVisibleRows: L.rowSelection.toggleVisibleRowsSelected,
1867
+ toggleGroupRow: dt,
1868
+ rowIndexLabel: jt,
1869
+ startResize: Ue,
1870
+ handleResizeDoubleClick: qe,
1871
+ startRowResize: kt,
1872
+ autosizeRow: Et,
1873
+ isCellSelected: L.visualSelection.isCellSelected,
1874
+ isSelectionAnchorCell: L.visualSelection.isSelectionAnchorCell,
1875
+ shouldHighlightSelectedCell: L.visualSelection.shouldHighlightSelectedCell,
1876
+ isCellOnSelectionEdge: L.visualSelection.isCellOnSelectionEdge,
1877
+ isCellInFillPreview: ln,
1878
+ isCellInPendingClipboardRange: jn,
1879
+ isCellOnPendingClipboardEdge: Gn,
1880
+ isEditingCell: Jt,
1881
+ isCellEditable: (b, S, F, D) => mt(
1882
+ b,
1883
+ F,
1884
+ () => y(b, Q.value + S, F)
1885
+ ),
1886
+ handleCellMouseDown: Un,
1887
+ handleCellClick: L.cellIo.handleCellClick,
1888
+ handleCellKeydown: nn,
1889
+ startInlineEdit: vt,
1890
+ isFillHandleCell: on,
1891
+ startFillHandleDrag: en,
1892
+ startFillHandleDoubleClick: tn,
1893
+ fillActionAnchorCell: L.fillAction.fillActionAnchorCell,
1894
+ fillActionBehavior: L.fillAction.fillActionBehavior,
1895
+ applyFillActionBehavior: Rt,
1896
+ handleEditorKeydown: We,
1897
+ handleEditorBlur: me,
1898
+ commitInlineEdit: de,
1899
+ cancelInlineEdit: he,
1900
+ readCell: L.cellIo.readStageCell,
1901
+ readDisplayCell: L.cellIo.readStageDisplayCell,
1902
+ cellClass: e.cellClass ? (b, S, F, D) => e.cellClass?.(
1903
+ b,
1904
+ Q.value + S,
1905
+ F,
1906
+ D
1907
+ ) : void 0,
1908
+ cellStyle: e.cellStyle ? (b, S, F, D) => e.cellStyle?.(
1909
+ b,
1910
+ Q.value + S,
1911
+ F,
1912
+ D
1913
+ ) : void 0
1914
+ });
1915
+ return Lo({
1916
+ mode: e.mode,
1917
+ rows: e.rows,
1918
+ runtime: e.runtime,
1919
+ totalRows: h,
1920
+ rowVersion: e.rowVersion,
1921
+ rowHeightMode: e.rowHeightMode,
1922
+ normalizedBaseRowHeight: e.normalizedBaseRowHeight,
1923
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
1924
+ syncRowSelectionSnapshotFromRuntime: l,
1925
+ syncViewport: oe,
1926
+ scheduleViewportSync: kn,
1927
+ measureVisibleRowHeights: ze,
1928
+ applyRowHeightSettings: e.applyRowHeightSettings
1929
+ }), Ko({
1930
+ bodyViewportRef: z,
1931
+ syncViewport: oe,
1932
+ handleWindowMouseMove: L.scrollSync.handleWindowMouseMove,
1933
+ handleWindowMouseUp: L.scrollSync.handleWindowMouseUp,
1934
+ cancelScheduledViewportSync: En,
1935
+ onAfterMount: () => {
1936
+ e.syncSelectionSnapshotFromRuntime(), l(), Qe(() => {
1937
+ e.applyRowHeightSettings(), oe();
1938
+ });
1939
+ },
1940
+ dispose: [
1941
+ Tt,
1942
+ Qn,
1943
+ an,
1944
+ L.history.disposeIntentHistory
1945
+ ]
1946
+ }), {
1947
+ tableStageProps: tl,
1948
+ tableStageContext: pt,
1949
+ historyController: {
1950
+ canUndo: Vt,
1951
+ canRedo: Bt,
1952
+ runHistoryAction: ct
1953
+ },
1954
+ syncViewportFromDom: oe,
1955
+ copySelectedCells: Oe,
1956
+ pasteSelectedCells: Ut,
1957
+ cutSelectedCells: qt,
1958
+ clearSelectedCells: rn,
1959
+ captureHistorySnapshot: Ae,
1960
+ captureHistorySnapshotForRowIds: He,
1961
+ recordHistoryIntentTransaction: Fe,
1962
+ revealCellInComfortZone: Xt
1963
+ };
1964
+ }
1965
+ function wl(e) {
1966
+ return e === "or" ? "or" : "and";
1967
+ }
1968
+ function xl(e) {
1969
+ return e == null ? "" : e instanceof Date ? e.toISOString() : Array.isArray(e) ? e.map((l) => xl(l)).filter((l) => l.length > 0).join(", ") : String(e);
1970
+ }
1971
+ function Zr(e) {
1972
+ const l = e.indexOf(":");
1973
+ if (l > 0) {
1974
+ const r = e.slice(0, l);
1975
+ if (/^[a-z-]+$/i.test(r))
1976
+ return e.slice(l + 1);
1977
+ }
1978
+ return e;
1979
+ }
1980
+ function Qr(e) {
1981
+ const l = [];
1982
+ for (const [r, o] of Object.entries(e.columnFilters ?? {})) {
1983
+ if (!o)
1984
+ continue;
1985
+ if (o.kind === "valueSet") {
1986
+ const i = Array.from(new Set(
1987
+ (o.tokens ?? []).map((f) => Zr(String(f ?? ""))).map((f) => f.trim()).filter((f) => f.length > 0)
1988
+ ));
1989
+ if (i.length === 0)
1990
+ continue;
1991
+ l.push({
1992
+ id: l.length,
1993
+ join: "and",
1994
+ columnKey: r,
1995
+ operator: "in",
1996
+ value: i.join(", ")
1997
+ });
1998
+ continue;
1999
+ }
2000
+ const u = [o.value, o.value2].map((i) => xl(i)).filter((i) => i.length > 0);
2001
+ u.length !== 0 && l.push({
2002
+ id: l.length,
2003
+ join: "and",
2004
+ columnKey: r,
2005
+ operator: String(o.operator ?? "contains"),
2006
+ value: u.join(", ")
2007
+ });
2008
+ }
2009
+ return l;
2010
+ }
2011
+ function ro(e) {
2012
+ if (!e || e.kind === "not")
2013
+ return [];
2014
+ if (e.kind === "condition")
2015
+ return [{
2016
+ id: 0,
2017
+ join: "and",
2018
+ columnKey: String(e.key ?? e.field ?? ""),
2019
+ operator: String(e.operator ?? "contains"),
2020
+ value: xl(e.value)
2021
+ }];
2022
+ const l = [];
2023
+ for (let r = 0; r < e.children.length; r += 1) {
2024
+ const o = e.children[r];
2025
+ if (!o)
2026
+ continue;
2027
+ const u = ro(o);
2028
+ if (u.length === 0)
2029
+ continue;
2030
+ const i = u[0];
2031
+ r > 0 && i && (u[0] = {
2032
+ ...i,
2033
+ id: i.id,
2034
+ join: wl(e.operator)
2035
+ }), l.push(...u);
2036
+ }
2037
+ return l;
2038
+ }
2039
+ function Kl(e) {
2040
+ if (!e)
2041
+ return [];
2042
+ const l = Qr(e), r = e.advancedExpression ?? Fo(e.advancedFilters), o = ro(r ?? null);
2043
+ return [
2044
+ ...l,
2045
+ ...o.map((i, f) => l.length > 0 && f === 0 ? {
2046
+ ...i,
2047
+ join: wl("and")
2048
+ } : i)
2049
+ ].map((i, f) => ({
2050
+ ...i,
2051
+ id: f,
2052
+ join: f === 0 ? wl("and") : i.join
2053
+ }));
2054
+ }
2055
+ const ea = yl(() => import("./DataGridAdvancedFilterPopover-C_MjEKFo.js")), ta = yl(() => import("./DataGridAggregationsPopover-C8kdwv0O.js")), na = yl(() => import("./DataGridFindReplacePopover-Dou8Fsm3.js"));
2056
+ function la(e) {
2057
+ return {
2058
+ ...e,
2059
+ component: Ro(So(e.component))
2060
+ };
2061
+ }
2062
+ function oa(e, l) {
2063
+ if (!e)
2064
+ return l ?? null;
2065
+ if (!l)
2066
+ return e;
2067
+ const r = {}, o = (u) => {
2068
+ if (typeof u == "string") {
2069
+ for (const i of u.split(/\s+/).filter(Boolean))
2070
+ r[i] = !0;
2071
+ return;
2072
+ }
2073
+ if (Array.isArray(u)) {
2074
+ for (const i of u)
2075
+ if (typeof i == "string")
2076
+ for (const f of i.split(/\s+/).filter(Boolean))
2077
+ r[f] = !0;
2078
+ return;
2079
+ }
2080
+ for (const [i, f] of Object.entries(u))
2081
+ r[i] = f === !0 || r[i] === !0;
2082
+ };
2083
+ return o(e), o(l), Object.keys(r).length > 0 ? r : null;
2084
+ }
2085
+ function ra(e) {
2086
+ return Number.isFinite(e) ? Math.max(24, Math.trunc(e)) : 31;
2087
+ }
2088
+ function $l(e) {
2089
+ return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/\\/g, "\\\\").replace(/\"/g, '\\"');
2090
+ }
2091
+ function Nl(e) {
2092
+ return (e ?? []).map((l) => ({
2093
+ key: l.key,
2094
+ direction: l.direction
2095
+ }));
2096
+ }
2097
+ function gl() {
2098
+ return {
2099
+ columnFilters: {},
2100
+ advancedFilters: {},
2101
+ advancedExpression: null
2102
+ };
2103
+ }
2104
+ function Ze(e) {
2105
+ return Do(e ?? gl()) ?? gl();
2106
+ }
2107
+ function vl(e) {
2108
+ return e.startsWith("string:") ? `string:${e.slice(7).toLowerCase()}` : e;
2109
+ }
2110
+ function aa(e) {
2111
+ const l = {};
2112
+ for (const [u, i] of Object.entries(e.columnFilters ?? {})) {
2113
+ if (i.kind === "valueSet") {
2114
+ const f = Array.from(new Set(
2115
+ (i.tokens ?? []).map((h) => vl(String(h ?? ""))).filter((h) => h.length > 0)
2116
+ ));
2117
+ if (f.length === 0)
2118
+ continue;
2119
+ l[u] = {
2120
+ kind: "valueSet",
2121
+ tokens: f
2122
+ };
2123
+ continue;
2124
+ }
2125
+ l[u] = {
2126
+ kind: "predicate",
2127
+ operator: i.operator,
2128
+ value: i.value,
2129
+ value2: i.value2,
2130
+ caseSensitive: i.caseSensitive
2131
+ };
2132
+ }
2133
+ const r = { ...e.advancedFilters ?? {} }, o = e.advancedExpression ?? null;
2134
+ return Object.keys(l).length === 0 && Object.keys(r).length === 0 && !o ? null : {
2135
+ columnFilters: l,
2136
+ advancedFilters: r,
2137
+ advancedExpression: o
2138
+ };
2139
+ }
2140
+ function ia(e) {
2141
+ const l = {}, r = e?.columnFilters ?? {};
2142
+ for (const [o, u] of Object.entries(r))
2143
+ u?.kind === "predicate" && typeof u.value == "string" && (l[o] = u.value);
2144
+ return l;
2145
+ }
2146
+ function we(e) {
2147
+ if (typeof globalThis.structuredClone == "function")
2148
+ try {
2149
+ return globalThis.structuredClone(e);
2150
+ } catch {
2151
+ }
2152
+ return hl(e, /* @__PURE__ */ new WeakMap());
2153
+ }
2154
+ function hl(e, l) {
2155
+ if (e == null || typeof e != "object")
2156
+ return e;
2157
+ if (e instanceof Date)
2158
+ return new Date(e.getTime());
2159
+ if (Array.isArray(e)) {
2160
+ if (l.has(e))
2161
+ return l.get(e);
2162
+ const r = [];
2163
+ l.set(e, r);
2164
+ for (const o of e)
2165
+ r.push(hl(o, l));
2166
+ return r;
2167
+ }
2168
+ if (ao(e)) {
2169
+ if (l.has(e))
2170
+ return l.get(e);
2171
+ const r = {};
2172
+ l.set(e, r);
2173
+ for (const [o, u] of Object.entries(e))
2174
+ r[o] = hl(u, l);
2175
+ return r;
2176
+ }
2177
+ return e && typeof e == "object" ? { ...e } : e;
2178
+ }
2179
+ function ao(e) {
2180
+ if (!e || typeof e != "object")
2181
+ return !1;
2182
+ const l = Object.getPrototypeOf(e);
2183
+ return l === Object.prototype || l === null;
2184
+ }
2185
+ function sa(e) {
2186
+ const l = /* @__PURE__ */ new WeakSet();
2187
+ try {
2188
+ return JSON.stringify(e, (r, o) => {
2189
+ if (o == null || typeof o != "object")
2190
+ return o;
2191
+ if (o instanceof Date)
2192
+ return o.toISOString();
2193
+ if (Array.isArray(o) || ao(o))
2194
+ return l.has(o) ? void 0 : (l.add(o), o);
2195
+ });
2196
+ } catch {
2197
+ return null;
2198
+ }
2199
+ }
2200
+ function At(e) {
2201
+ return e ? {
2202
+ columns: e.columns.map((l) => ({ ...l })),
2203
+ basis: e.basis === "source" ? "source" : "filtered"
2204
+ } : null;
2205
+ }
2206
+ function ua(e) {
2207
+ return e ? {
2208
+ fields: [...e.fields],
2209
+ expandedByDefault: e.expandedByDefault
2210
+ } : null;
2211
+ }
2212
+ function Re(e) {
2213
+ return e == null ? "blank" : e instanceof Date ? e.toISOString() : typeof e == "string" ? `"${e}"` : String(e);
2214
+ }
2215
+ function Se(e, l) {
2216
+ return nr(l, e);
2217
+ }
2218
+ function ca(e, l) {
2219
+ const r = String(e ?? "");
2220
+ if (r === "null")
2221
+ return l.blankValueLabel;
2222
+ const o = r.indexOf(":");
2223
+ if (o < 0)
2224
+ return r;
2225
+ const u = r.slice(0, o), i = r.slice(o + 1);
2226
+ return u === "string" || u === "number" || u === "boolean" || u === "bigint" || u === "date" || u === "repr" || u === "json" ? i : r;
2227
+ }
2228
+ function da(e, l, r) {
2229
+ return l.kind === "valueSet" ? l.tokens.length === 1 ? `${e}: ${ca(l.tokens[0] ?? "", r)}` : `${e}: ${l.tokens.length} ${r.valuesSummaryLabel}` : l.operator === "between" ? `${e} ${Se(l.operator, r)} ${Re(l.value)} ${r.betweenJoiner} ${Re(l.value2)}` : l.operator === "isEmpty" || l.operator === "notEmpty" || l.operator === "isNull" || l.operator === "notNull" ? `${e} ${Se(l.operator, r)}` : `${e} ${Se(l.operator, r)} ${Re(l.value)}`;
2230
+ }
2231
+ function ma(e, l, r) {
2232
+ const o = l.clauses.map((u, i) => {
2233
+ const f = u.join === "or" ? r.joins.or : r.joins.and, h = i === 0 ? "" : `${f} `;
2234
+ return u.operator === "between" ? `${h}${Se(u.operator, r)} ${Re(u.value)} ${r.betweenJoiner} ${Re(u.value2)}` : u.operator === "isEmpty" || u.operator === "notEmpty" || u.operator === "isNull" || u.operator === "notNull" ? `${h}${Se(u.operator, r)}` : `${h}${Se(u.operator, r)} ${Re(u.value)}`;
2235
+ }).filter((u) => u.length > 0);
2236
+ return o.length === 0 ? `${e}: ${r.activeSummaryFallback}` : `${e} ${o.join(" ")}`;
2237
+ }
2238
+ function bl(e, l, r) {
2239
+ if (e.kind === "condition") {
2240
+ const u = l(e.key);
2241
+ return e.operator === "between" ? `${u} ${Se(e.operator, r)} ${Re(e.value)} ${r.betweenJoiner} ${Re(e.value2)}` : e.operator === "isEmpty" || e.operator === "notEmpty" || e.operator === "isNull" || e.operator === "notNull" ? `${u} ${Se(e.operator, r)}` : `${u} ${Se(e.operator, r)} ${Re(e.value)}`;
2242
+ }
2243
+ if (e.kind === "not")
2244
+ return `${r.notOperatorLabel} (${bl(e.child, l, r)})`;
2245
+ const o = e.operator === "or" ? r.joins.or : r.joins.and;
2246
+ return e.children.map((u) => bl(u, l, r)).filter((u) => u.length > 0).join(` ${o} `);
2247
+ }
2248
+ function Wl(e, l) {
2249
+ return l.activeSummaryPrefix.length > 0 ? `${l.activeSummaryPrefix}: ${e}` : e;
2250
+ }
2251
+ const fa = [
2252
+ "sum",
2253
+ "avg",
2254
+ "min",
2255
+ "max",
2256
+ "count",
2257
+ "countNonNull",
2258
+ "first",
2259
+ "last"
2260
+ ], wa = [
2261
+ "min",
2262
+ "max",
2263
+ "count",
2264
+ "countNonNull",
2265
+ "first",
2266
+ "last"
2267
+ ], ga = [
2268
+ "count",
2269
+ "countNonNull",
2270
+ "first",
2271
+ "last"
2272
+ ];
2273
+ function va(e) {
2274
+ return e === "number" || e === "currency" || e === "percent" ? fa : e === "date" || e === "datetime" ? wa : ga;
2275
+ }
2276
+ const ha = {
2277
+ clipboard: ["cut", "copy", "paste"],
2278
+ pasteSpecial: ["paste-values"],
2279
+ edit: ["clear"]
2280
+ }, ba = {
2281
+ insert: ["insert-row-above", "insert-row-below"],
2282
+ clipboard: ["cut-row", "copy-row", "paste-row"],
2283
+ selection: ["delete-selected-rows"]
2284
+ }, Ul = {
2285
+ cut: "Cut",
2286
+ copy: "Copy",
2287
+ paste: "Paste",
2288
+ "paste-values": "Values only",
2289
+ clear: "Clear values",
2290
+ "insert-row-above": "Insert above",
2291
+ "insert-row-below": "Insert below",
2292
+ "copy-row": "Copy row",
2293
+ "paste-row": "Paste row",
2294
+ "cut-row": "Cut row",
2295
+ "delete-selected-rows": "Delete selected rows",
2296
+ "sort-asc": "Sort ascending",
2297
+ "sort-desc": "Sort descending",
2298
+ "sort-clear": "Clear sort",
2299
+ filter: "Filter column",
2300
+ "auto-size": "Auto size column"
2301
+ }, ya = {
2302
+ "insert-row-above": "Insert / Ctrl/Cmd+I",
2303
+ "copy-row": "Ctrl/Cmd+C",
2304
+ "paste-row": "Ctrl/Cmd+V",
2305
+ "cut-row": "Ctrl/Cmd+X"
2306
+ }, Na = Sn({
2307
+ name: "DataGridDefaultRenderer",
2308
+ props: {
2309
+ mode: {
2310
+ type: String,
2311
+ required: !0
2312
+ },
2313
+ rows: {
2314
+ type: Array,
2315
+ default: () => []
2316
+ },
2317
+ runtime: {
2318
+ type: Object,
2319
+ required: !0
2320
+ },
2321
+ runtimeRowModel: {
2322
+ type: Object,
2323
+ required: !0
2324
+ },
2325
+ selectionSnapshot: {
2326
+ type: Object,
2327
+ required: !0
2328
+ },
2329
+ selectionAnchor: {
2330
+ type: Object,
2331
+ required: !0
2332
+ },
2333
+ rowSelectionSnapshot: {
2334
+ type: Object,
2335
+ required: !0
2336
+ },
2337
+ syncSelectionSnapshotFromRuntime: {
2338
+ type: Function,
2339
+ required: !0
2340
+ },
2341
+ syncRowSelectionSnapshotFromRuntime: {
2342
+ type: Function,
2343
+ default: () => {
2344
+ }
2345
+ },
2346
+ flushRowSelectionSnapshotUpdates: {
2347
+ type: Function,
2348
+ default: () => {
2349
+ }
2350
+ },
2351
+ sortModel: {
2352
+ type: Array,
2353
+ default: void 0
2354
+ },
2355
+ filterModel: {
2356
+ type: Object,
2357
+ default: void 0
2358
+ },
2359
+ groupBy: {
2360
+ type: Object,
2361
+ default: void 0
2362
+ },
2363
+ pivotModel: {
2364
+ type: Object,
2365
+ default: void 0
2366
+ },
2367
+ renderMode: {
2368
+ type: String,
2369
+ default: "virtualization"
2370
+ },
2371
+ virtualization: {
2372
+ type: Object,
2373
+ required: !0
2374
+ },
2375
+ columnMenu: {
2376
+ type: Object,
2377
+ required: !0
2378
+ },
2379
+ cellMenu: {
2380
+ type: Object,
2381
+ required: !0
2382
+ },
2383
+ rowIndexMenu: {
2384
+ type: Object,
2385
+ required: !0
2386
+ },
2387
+ columnLayout: {
2388
+ type: Object,
2389
+ required: !0
2390
+ },
2391
+ columnReorder: {
2392
+ type: Object,
2393
+ required: !0
2394
+ },
2395
+ aggregations: {
2396
+ type: Object,
2397
+ required: !0
2398
+ },
2399
+ advancedFilter: {
2400
+ type: Object,
2401
+ required: !0
2402
+ },
2403
+ findReplace: {
2404
+ type: Object,
2405
+ required: !0
2406
+ },
2407
+ gridLines: {
2408
+ type: Object,
2409
+ required: !0
2410
+ },
2411
+ rowHeightMode: {
2412
+ type: String,
2413
+ default: "fixed"
2414
+ },
2415
+ baseRowHeight: {
2416
+ type: Number,
2417
+ default: 31
2418
+ },
2419
+ layoutMode: {
2420
+ type: String,
2421
+ default: "fill"
2422
+ },
2423
+ minRows: {
2424
+ type: Number,
2425
+ default: null
2426
+ },
2427
+ maxRows: {
2428
+ type: Number,
2429
+ default: null
2430
+ },
2431
+ placeholderRows: {
2432
+ type: Object,
2433
+ required: !0
2434
+ },
2435
+ fillHandle: {
2436
+ type: Boolean,
2437
+ default: !1
2438
+ },
2439
+ rangeMove: {
2440
+ type: Boolean,
2441
+ default: !1
2442
+ },
2443
+ rowHover: {
2444
+ type: Boolean,
2445
+ default: !1
2446
+ },
2447
+ stripedRows: {
2448
+ type: Boolean,
2449
+ default: !1
2450
+ },
2451
+ readSelectionCell: {
2452
+ type: Function,
2453
+ default: void 0
2454
+ },
2455
+ cellClass: {
2456
+ type: Function,
2457
+ default: void 0
2458
+ },
2459
+ cellStyle: {
2460
+ type: Function,
2461
+ default: void 0
2462
+ },
2463
+ showRowIndex: {
2464
+ type: Boolean,
2465
+ default: !0
2466
+ },
2467
+ rowSelection: {
2468
+ type: Boolean,
2469
+ default: !0
2470
+ },
2471
+ rowReorder: {
2472
+ type: Object,
2473
+ required: !0
2474
+ },
2475
+ isCellEditable: {
2476
+ type: Function,
2477
+ default: void 0
2478
+ },
2479
+ viewMode: {
2480
+ type: String,
2481
+ default: "table"
2482
+ },
2483
+ gantt: {
2484
+ type: [Boolean, Object],
2485
+ default: void 0
2486
+ },
2487
+ toolbarModules: {
2488
+ type: Array,
2489
+ default: () => []
2490
+ },
2491
+ customOverlays: {
2492
+ type: Array,
2493
+ default: void 0
2494
+ },
2495
+ history: {
2496
+ type: Object,
2497
+ required: !0
2498
+ },
2499
+ chrome: {
2500
+ type: Object,
2501
+ required: !0
2502
+ },
2503
+ registerHistoryController: {
2504
+ type: Function,
2505
+ default: () => {
2506
+ }
2507
+ },
2508
+ reportToolbarModules: {
2509
+ type: Function,
2510
+ default: () => {
2511
+ }
2512
+ },
2513
+ runStructuralRowAction: {
2514
+ type: Function,
2515
+ default: void 0
2516
+ },
2517
+ registerStructuralRowActionRunner: {
2518
+ type: Function,
2519
+ default: () => {
2520
+ }
2521
+ },
2522
+ inspectorPanel: {
2523
+ type: Object,
2524
+ default: null
2525
+ }
2526
+ },
2527
+ setup(e) {
2528
+ const l = w(() => ({
2529
+ "--datagrid-row-divider-size": e.gridLines.bodyRows ? "1px" : "0px",
2530
+ "--datagrid-column-divider-size": e.gridLines.bodyColumns ? "1px" : "0px",
2531
+ "--datagrid-header-column-divider-size": e.gridLines.headerColumns ? "1px" : "0px",
2532
+ "--datagrid-pinned-pane-separator-size": e.gridLines.pinnedSeparators ? "2px" : "0px",
2533
+ "--datagrid-app-layout-gap": `${e.chrome.toolbarGap}px`,
2534
+ "--datagrid-app-workspace-gap": `${e.chrome.workspaceGap}px`,
2535
+ "--datagrid-app-toolbar-gap": e.chrome.density === "compact" ? "10px" : "12px",
2536
+ "--datagrid-app-toolbar-group-gap": e.chrome.density === "compact" ? "6px" : "8px",
2537
+ "--datagrid-app-toolbar-button-gap": e.chrome.density === "compact" ? "6px" : "8px",
2538
+ "--datagrid-app-toolbar-button-height": e.chrome.density === "compact" ? "28px" : "32px",
2539
+ "--datagrid-app-toolbar-button-padding-inline": e.chrome.density === "compact" ? "10px" : "12px",
2540
+ "--datagrid-app-toolbar-button-font-size": e.chrome.density === "compact" ? "11px" : "12px",
2541
+ "--datagrid-app-toolbar-surface-padding-block": e.chrome.density === "compact" ? "8px" : "10px",
2542
+ "--datagrid-app-toolbar-surface-padding-inline": e.chrome.density === "compact" ? "10px" : "12px"
2543
+ })), r = w(() => [
2544
+ e.gridLines.body,
2545
+ e.gridLines.header,
2546
+ e.gridLines.pinnedSeparators ? "sep:1" : "sep:0"
2547
+ ].join("|")), o = Z(0), u = Z(Nl(e.sortModel)), i = Z(Ze(e.filterModel)), f = w(() => ia(i.value));
2548
+ let h = "";
2549
+ const R = () => {
2550
+ const t = e.runtimeRowModel.getSnapshot();
2551
+ return [
2552
+ t.kind,
2553
+ t.revision ?? "",
2554
+ t.rowCount,
2555
+ t.loading ? 1 : 0,
2556
+ t.projection?.recomputeVersion ?? t.projection?.version ?? ""
2557
+ ].join("|");
2558
+ };
2559
+ h = R();
2560
+ const A = e.runtimeRowModel.subscribe(() => {
2561
+ const t = R();
2562
+ t !== h && (h = t, o.value += 1);
2563
+ });
2564
+ Hl(() => {
2565
+ A();
2566
+ }), Y(
2567
+ () => e.sortModel,
2568
+ (t) => {
2569
+ u.value = Nl(t);
2570
+ },
2571
+ { deep: !0 }
2572
+ ), Y(
2573
+ () => e.filterModel,
2574
+ (t) => {
2575
+ i.value = Ze(t);
2576
+ },
2577
+ { deep: !0 }
2578
+ );
2579
+ const H = w(() => e.mode), T = w(() => e.rows), x = w(() => (o.value, e.runtime.api.rows.getSnapshot().rowCount)), v = w(() => e.runtime.columnSnapshot.value.visibleColumns), M = w(() => e.runtime.columnSnapshot.value.columns ?? []), O = w(() => v.value.filter((t) => t.visible !== !1).map((t) => ({
2580
+ key: t.key,
2581
+ label: t.column.label ?? t.key
2582
+ }))), y = w(() => M.value.map((t) => ({
2583
+ key: t.key,
2584
+ label: t.column.label ?? t.key,
2585
+ visible: t.visible !== !1
2586
+ }))), I = w(() => M.value.filter((t) => t.column.capabilities?.aggregatable === !0).map((t) => ({
2587
+ key: t.key,
2588
+ label: t.column.label ?? t.key,
2589
+ allowedOps: va(t.column.dataType)
2590
+ }))), U = Z(e.rowHeightMode), V = w(() => ra(e.baseRowHeight)), ne = w(() => v.value[0]?.key ?? "name"), pe = w(() => {
2591
+ const t = /* @__PURE__ */ new Map();
2592
+ for (const n of M.value)
2593
+ t.set(n.key, n.column.label ?? n.key);
2594
+ return t;
2595
+ }), {
2596
+ isColumnLayoutPanelOpen: tt,
2597
+ columnLayoutPanelItems: nt,
2598
+ openColumnLayoutPanel: Ie,
2599
+ cancelColumnLayoutPanel: j,
2600
+ applyColumnLayoutPanel: z,
2601
+ moveColumnUp: E,
2602
+ moveColumnDown: le,
2603
+ moveColumnToPosition: In,
2604
+ updateColumnVisibility: Q
2605
+ } = $o({
2606
+ resolveColumns: () => y.value,
2607
+ applyColumnLayout: (t) => {
2608
+ e.runtime.api.columns.setOrder(t.order);
2609
+ for (const [n, a] of Object.entries(t.visibilityByKey))
2610
+ e.runtime.api.columns.setVisibility(n, a);
2611
+ }
2612
+ }), ee = dl(null), Ft = w(() => ee.value?.isAdvancedFilterPanelOpen.value ?? !1), xn = w(() => ee.value?.advancedFilterDraftClauses.value ?? []), Mn = w(() => ee.value?.appliedAdvancedFilterExpression.value ?? null), Le = async () => {
2613
+ if (ee.value)
2614
+ return ee.value;
2615
+ const { useDataGridAppAdvancedFilterBuilder: t } = await import("@affino/datagrid-vue/app"), n = t({
2616
+ resolveColumns: () => O.value
2617
+ });
2618
+ return n.hydrateAdvancedFilterClauses(Kl(i.value)), ee.value = n, n;
2619
+ }, An = (t) => {
2620
+ ee.value?.hydrateAdvancedFilterClauses(t);
2621
+ }, Fn = async () => {
2622
+ (await Le()).openAdvancedFilterPanel();
2623
+ }, On = async () => {
2624
+ const t = ee.value;
2625
+ if (t) {
2626
+ t.addAdvancedFilterClause();
2627
+ return;
2628
+ }
2629
+ (await Le()).addAdvancedFilterClause();
2630
+ }, Dn = async (t) => {
2631
+ const n = ee.value;
2632
+ if (n) {
2633
+ n.removeAdvancedFilterClause(t);
2634
+ return;
2635
+ }
2636
+ (await Le()).removeAdvancedFilterClause(t);
2637
+ }, Ot = async (t) => {
2638
+ const n = ee.value;
2639
+ if (n) {
2640
+ n.updateAdvancedFilterClause(t);
2641
+ return;
2642
+ }
2643
+ (await Le()).updateAdvancedFilterClause(t);
2644
+ }, oe = () => {
2645
+ ee.value?.cancelAdvancedFilterPanel();
2646
+ }, kn = () => {
2647
+ ee.value?.applyAdvancedFilterPanel();
2648
+ }, En = () => {
2649
+ ee.value?.clearAdvancedFilterPanel();
2650
+ }, xe = Z(!1), B = Z(null), Te = w(() => !!e.groupBy?.fields?.length), Ke = w(() => (o.value, At(e.runtime.api.rows.getAggregationModel()))), Dt = w(() => (o.value, ua(e.runtime.api.rows.getSnapshot().groupBy))), Tn = w(() => {
2651
+ const t = new Map(
2652
+ (B.value?.columns ?? []).map((n) => [n.key, n.op])
2653
+ );
2654
+ return I.value.map((n) => {
2655
+ const a = n.allowedOps[0] ?? "count", s = t.get(n.key), c = s && n.allowedOps.includes(s) ? s : a;
2656
+ return {
2657
+ key: n.key,
2658
+ label: n.label,
2659
+ enabled: t.has(n.key),
2660
+ op: c,
2661
+ allowedOps: n.allowedOps
2662
+ };
2663
+ });
2664
+ }), ze = w(() => B.value?.basis === "source" ? "source" : "filtered");
2665
+ Y(
2666
+ Ke,
2667
+ (t) => {
2668
+ xe.value || (B.value = At(t));
2669
+ },
2670
+ { immediate: !0, deep: !0 }
2671
+ ), Y(
2672
+ () => e.rowHeightMode,
2673
+ (t) => {
2674
+ U.value = t;
2675
+ }
2676
+ );
2677
+ const kt = (t) => {
2678
+ const n = i.value.columnFilters?.[t];
2679
+ return n ? n.kind === "valueSet" ? n.tokens.length > 0 : !0 : !1;
2680
+ }, Et = (t) => {
2681
+ const n = i.value.columnFilters?.[t];
2682
+ return !n || n.kind !== "valueSet" ? [] : n.tokens.map((a) => vl(String(a ?? "")));
2683
+ }, Ml = (t, n) => e.runtime.api.columns.getHistogram(t, {
2684
+ ignoreSelfFilter: !0,
2685
+ orderBy: "valueAsc",
2686
+ search: n
2687
+ }), Tt = (t) => lo(e.columnMenu, t), _e = (t) => Sr(e.columnMenu, t), zt = (t) => Ir(e.columnMenu, t), _t = (t) => pr(e.columnMenu, t), $e = (t) => xr(e.columnMenu, t), lt = (t) => Mr(e.columnMenu, t), ot = (t) => {
2688
+ const n = Dt.value?.fields.findIndex((a) => a === t) ?? -1;
2689
+ return n >= 0 ? n : null;
2690
+ }, Me = (t) => ot(t) !== null, se = () => {
2691
+ const t = u.value.map((s) => ({
2692
+ key: s.key,
2693
+ direction: s.direction
2694
+ })), n = i.value.advancedExpression ?? null, a = e.advancedFilter.enabled ? {
2695
+ ...i.value,
2696
+ advancedFilters: {},
2697
+ advancedExpression: n
2698
+ } : {
2699
+ ...i.value,
2700
+ advancedExpression: n
2701
+ };
2702
+ e.runtime.api.rows.setSortAndFilterModel({
2703
+ sortModel: t,
2704
+ filterModel: aa(a)
2705
+ });
2706
+ }, Ht = () => {
2707
+ An(Kl(i.value));
2708
+ }, rt = w(() => i.value.advancedExpression ?? null), at = w(() => {
2709
+ const t = (s) => pe.value.get(s) ?? s, n = e.advancedFilter.labels, a = [];
2710
+ for (const [s, c] of Object.entries(i.value.columnFilters ?? {}))
2711
+ c && a.push(da(t(s), c, n));
2712
+ for (const [s, c] of Object.entries(i.value.advancedFilters ?? {}))
2713
+ c && a.push(Wl(
2714
+ ma(t(s), c, n),
2715
+ n
2716
+ ));
2717
+ return rt.value && a.push(Wl(
2718
+ bl(rt.value, t, n),
2719
+ n
2720
+ )), Object.freeze(a);
2721
+ }), it = w(() => at.value.length > 0), zn = () => {
2722
+ i.value = gl(), En(), se();
2723
+ };
2724
+ Y(
2725
+ i,
2726
+ () => {
2727
+ !e.advancedFilter.enabled || Ft.value || Ht();
2728
+ },
2729
+ { immediate: !0, deep: !0 }
2730
+ );
2731
+ const _n = () => {
2732
+ Ht(), Fn();
2733
+ }, st = () => {
2734
+ kn(), i.value = {
2735
+ ...Ze(i.value),
2736
+ columnFilters: {},
2737
+ advancedFilters: {},
2738
+ advancedExpression: Mn.value
2739
+ }, se();
2740
+ }, Pt = (t, n = !1) => {
2741
+ const a = u.value.findIndex((c) => c.key === t), s = a >= 0 ? u.value[a] : null;
2742
+ if (!s) {
2743
+ const c = { key: t, direction: "asc" };
2744
+ u.value = n ? [...u.value, c] : [c], se();
2745
+ return;
2746
+ }
2747
+ if (s.direction === "asc") {
2748
+ const c = { key: t, direction: "desc" };
2749
+ n ? u.value = u.value.map((g) => g.key === t ? c : g) : u.value = [c], se();
2750
+ return;
2751
+ }
2752
+ u.value = n ? u.value.filter((c) => c.key !== t) : [], se();
2753
+ }, Hn = (t) => {
2754
+ const n = u.value.findIndex((c) => c.key === t);
2755
+ if (n < 0)
2756
+ return "";
2757
+ const a = u.value[n];
2758
+ if (!a)
2759
+ return "";
2760
+ const s = a.direction === "asc" ? "↑" : "↓";
2761
+ return u.value.length > 1 ? `${s}${n + 1}` : s;
2762
+ }, Pn = (t, n) => {
2763
+ const a = Ze(i.value), s = n.trim();
2764
+ s ? a.columnFilters[t] = {
2765
+ kind: "predicate",
2766
+ operator: "contains",
2767
+ value: s,
2768
+ caseSensitive: !1
2769
+ } : delete a.columnFilters[t], i.value = a, se();
2770
+ }, Vn = () => {
2771
+ e.runtime.api.view.setRowHeightMode(U.value), e.runtime.api.view.setBaseRowHeight(V.value);
2772
+ }, Bn = () => {
2773
+ B.value = At(Ke.value), xe.value = !0;
2774
+ }, ut = () => {
2775
+ B.value = At(Ke.value), xe.value = !1;
2776
+ };
2777
+ Y(
2778
+ Te,
2779
+ (t) => {
2780
+ t || ut();
2781
+ },
2782
+ { immediate: !0 }
2783
+ );
2784
+ const Ae = () => {
2785
+ B.value = null;
2786
+ }, He = (t) => {
2787
+ B.value = {
2788
+ basis: t,
2789
+ columns: B.value?.columns ?? []
2790
+ };
2791
+ }, Fe = (t, n) => {
2792
+ const a = I.value.find((d) => d.key === t);
2793
+ if (!a)
2794
+ return;
2795
+ const s = B.value?.columns ?? [];
2796
+ if (!n) {
2797
+ const d = s.filter((C) => C.key !== t);
2798
+ B.value = d.length > 0 ? { basis: ze.value, columns: d } : null;
2799
+ return;
2800
+ }
2801
+ const g = s.find((d) => d.key === t) ?? {
2802
+ key: t,
2803
+ op: a.allowedOps[0] ?? "count"
2804
+ };
2805
+ B.value = {
2806
+ basis: ze.value,
2807
+ columns: [
2808
+ ...s.filter((d) => d.key !== t),
2809
+ g
2810
+ ]
2811
+ };
2812
+ }, Vt = (t, n) => {
2813
+ const a = I.value.find((c) => c.key === t);
2814
+ if (!a || !a.allowedOps.includes(n))
2815
+ return;
2816
+ const s = (B.value?.columns ?? []).map((c) => c.key !== t ? c : {
2817
+ ...c,
2818
+ op: n
2819
+ });
2820
+ B.value = {
2821
+ basis: ze.value,
2822
+ columns: s
2823
+ };
2824
+ }, Bt = () => {
2825
+ const t = B.value && B.value.columns.length > 0 ? B.value : null;
2826
+ e.runtime.api.rows.setAggregationModel(t), B.value = At(t), xe.value = !1;
2827
+ }, ct = (t) => u.value.find((n) => n.key === t)?.direction ?? null, jt = (t, n) => {
2828
+ const a = v.value.find((s) => s.key === t);
2829
+ !a || a.column.capabilities?.sortable === !1 || (u.value = n === null ? u.value.filter((s) => s.key !== t) : [{ key: t, direction: n }], se());
2830
+ }, Gt = (t, n) => {
2831
+ e.runtime.api.columns.setPin(t, n);
2832
+ }, Lt = (t, n) => {
2833
+ const a = Dt.value, s = n ? Array.from(/* @__PURE__ */ new Set([...a?.fields ?? [], t])) : (a?.fields ?? []).filter((c) => c !== t);
2834
+ e.runtime.api.rows.setGroupBy(s.length > 0 ? {
2835
+ fields: s,
2836
+ expandedByDefault: a?.expandedByDefault ?? !0
2837
+ } : null);
2838
+ }, Kt = (t, n) => {
2839
+ const a = Array.from(new Set(
2840
+ n.map((c) => vl(String(c ?? ""))).filter((c) => c.length > 0)
2841
+ ));
2842
+ if (a.length === 0) {
2843
+ dt(t);
2844
+ return;
2845
+ }
2846
+ const s = Ze(i.value);
2847
+ s.columnFilters[t] = {
2848
+ kind: "valueSet",
2849
+ tokens: a
2850
+ }, i.value = s, se();
2851
+ }, dt = (t) => {
2852
+ const n = Ze(i.value);
2853
+ delete n.columnFilters[t], i.value = n, se();
2854
+ }, ce = Z(null), q = Z(null);
2855
+ let mt = 0;
2856
+ const Pe = () => {
2857
+ const t = e.selectionSnapshot.value, n = t?.ranges[t.activeRangeIndex] ?? null;
2858
+ return n ? {
2859
+ startRow: n.startRow,
2860
+ endRow: n.endRow,
2861
+ startColumn: n.startCol,
2862
+ endColumn: n.endCol
2863
+ } : null;
2864
+ }, ft = () => {
2865
+ const t = e.selectionSnapshot.value?.activeCell;
2866
+ return t ? {
2867
+ rowIndex: t.rowIndex,
2868
+ columnIndex: t.colIndex
2869
+ } : null;
2870
+ }, Ne = (t) => t ? t.startRow !== t.endRow || t.startColumn !== t.endColumn : !1, $t = (t, n) => t.rowIndex >= Math.min(n.startRow, n.endRow) && t.rowIndex <= Math.max(n.startRow, n.endRow) && t.columnIndex >= Math.min(n.startColumn, n.endColumn) && t.columnIndex <= Math.max(n.startColumn, n.endColumn), Nt = (t, n) => {
2871
+ const a = e.runtime.resolveBodyRowIndexById(t), s = v.value.findIndex((c) => c.key === n);
2872
+ return a < 0 || s < 0 ? null : { rowIndex: a, columnIndex: s };
2873
+ }, Wt = (t) => ({
2874
+ ranges: [{
2875
+ startRow: t.rowIndex,
2876
+ endRow: t.rowIndex,
2877
+ startCol: t.columnIndex,
2878
+ endCol: t.columnIndex,
2879
+ anchor: {
2880
+ rowIndex: t.rowIndex,
2881
+ colIndex: t.columnIndex,
2882
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2883
+ },
2884
+ focus: {
2885
+ rowIndex: t.rowIndex,
2886
+ colIndex: t.columnIndex,
2887
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2888
+ },
2889
+ startRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null,
2890
+ endRowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2891
+ }],
2892
+ activeRangeIndex: 0,
2893
+ activeCell: {
2894
+ rowIndex: t.rowIndex,
2895
+ colIndex: t.columnIndex,
2896
+ rowId: e.runtime.getBodyRowAtIndex(t.rowIndex)?.rowId ?? null
2897
+ }
2898
+ }), Ve = (t, n) => {
2899
+ if (!Number.isFinite(n))
2900
+ return null;
2901
+ const a = Math.trunc(n);
2902
+ return t[a] ?? null;
2903
+ }, Oe = (t) => typeof t == "string" || typeof t == "number" ? t : null, Ut = () => {
2904
+ const t = e.selectionSnapshot.value, n = v.value.map((c) => c.key);
2905
+ if (!t || n.length === 0)
2906
+ return null;
2907
+ const a = t.ranges.map((c) => {
2908
+ const g = Ve(n, c.startCol), d = Ve(n, c.endCol);
2909
+ if (!g || !d)
2910
+ return null;
2911
+ const C = Ve(n, c.anchor?.colIndex ?? c.startCol) ?? g, p = Ve(n, c.focus?.colIndex ?? c.endCol) ?? d;
2912
+ return {
2913
+ startRow: c.startRow,
2914
+ endRow: c.endRow,
2915
+ startColumnKey: g,
2916
+ endColumnKey: d,
2917
+ startRowId: Oe(c.startRowId),
2918
+ endRowId: Oe(c.endRowId),
2919
+ anchor: {
2920
+ rowIndex: c.anchor?.rowIndex ?? c.startRow,
2921
+ rowId: Oe(c.anchor?.rowId),
2922
+ columnKey: C
2923
+ },
2924
+ focus: {
2925
+ rowIndex: c.focus?.rowIndex ?? c.endRow,
2926
+ rowId: Oe(c.focus?.rowId),
2927
+ columnKey: p
2928
+ }
2929
+ };
2930
+ }).filter((c) => c != null);
2931
+ if (a.length === 0)
2932
+ return null;
2933
+ const s = t.activeCell ? Ve(n, t.activeCell.colIndex) : null;
2934
+ return {
2935
+ ranges: a,
2936
+ activeRangeIndex: Math.max(0, Math.trunc(t.activeRangeIndex ?? 0)),
2937
+ activeCell: t.activeCell && s ? {
2938
+ rowIndex: t.activeCell.rowIndex,
2939
+ rowId: Oe(t.activeCell.rowId),
2940
+ columnKey: s
2941
+ } : null
2942
+ };
2943
+ }, qt = (t) => {
2944
+ const n = v.value.map((d) => d.key);
2945
+ if (n.length === 0)
2946
+ return null;
2947
+ const a = [];
2948
+ for (const d of t.ranges) {
2949
+ const C = n.indexOf(d.startColumnKey), p = n.indexOf(d.endColumnKey), P = n.indexOf(d.anchor.columnKey), k = n.indexOf(d.focus.columnKey);
2950
+ C < 0 || p < 0 || P < 0 || k < 0 || a.push({
2951
+ startRow: d.startRow,
2952
+ endRow: d.endRow,
2953
+ startCol: C,
2954
+ endCol: p,
2955
+ startRowId: d.startRowId,
2956
+ endRowId: d.endRowId,
2957
+ anchor: {
2958
+ rowIndex: d.anchor.rowIndex,
2959
+ colIndex: P,
2960
+ rowId: d.anchor.rowId
2961
+ },
2962
+ focus: {
2963
+ rowIndex: d.focus.rowIndex,
2964
+ colIndex: k,
2965
+ rowId: d.focus.rowId
2966
+ }
2967
+ });
2968
+ }
2969
+ if (a.length === 0)
2970
+ return null;
2971
+ const s = Math.min(a.length - 1, Math.max(0, t.activeRangeIndex)), c = a[s] ?? a[0] ?? null;
2972
+ if (!c)
2973
+ return null;
2974
+ const g = t.activeCell ? n.indexOf(t.activeCell.columnKey) : -1;
2975
+ return {
2976
+ ranges: a,
2977
+ activeRangeIndex: s,
2978
+ activeCell: g >= 0 && t.activeCell ? {
2979
+ rowIndex: t.activeCell.rowIndex,
2980
+ colIndex: g,
2981
+ rowId: t.activeCell.rowId
2982
+ } : {
2983
+ rowIndex: c.focus.rowIndex,
2984
+ colIndex: c.focus.colIndex,
2985
+ rowId: c.focus.rowId
2986
+ }
2987
+ };
2988
+ }, jn = (t) => {
2989
+ const n = t ? qt(t) : null;
2990
+ n && (e.runtime.api.selection.setSnapshot(n), e.syncSelectionSnapshotFromRuntime()), Xt();
2991
+ }, Gn = (t) => {
2992
+ if (t.length === 0)
2993
+ return null;
2994
+ const n = new Set(t), a = e.selectionSnapshot.value?.activeCell?.rowId;
2995
+ if (a != null) {
2996
+ const d = String(a);
2997
+ if (n.has(d))
2998
+ return d;
2999
+ }
3000
+ const c = (e.selectionSnapshot.value?.ranges[e.selectionSnapshot.value?.activeRangeIndex ?? 0] ?? null)?.anchor?.rowId;
3001
+ if (c != null) {
3002
+ const d = String(c);
3003
+ if (n.has(d))
3004
+ return d;
3005
+ }
3006
+ const g = e.rowSelectionSnapshot.value?.focusedRow;
3007
+ if (g != null) {
3008
+ const d = String(g);
3009
+ if (n.has(d))
3010
+ return d;
3011
+ }
3012
+ return t[0] ?? null;
3013
+ }, Yt = (t, n) => {
3014
+ const a = v.value.length - 1;
3015
+ if (t.length === 0 || a < 0)
3016
+ return null;
3017
+ const s = t.map((C) => ({ rowId: C, rowIndex: e.runtime.resolveBodyRowIndexById(C) })).filter((C) => C.rowIndex >= 0).sort((C, p) => C.rowIndex - p.rowIndex);
3018
+ if (s.length === 0)
3019
+ return null;
3020
+ const c = s[0] ?? null, g = e.runtime.resolveBodyRowIndexById(n), d = g >= 0 ? { rowId: n, rowIndex: g } : c;
3021
+ return !d || d.rowIndex < 0 ? null : {
3022
+ ranges: [{
3023
+ startRow: s[0]?.rowIndex ?? d.rowIndex,
3024
+ endRow: s[s.length - 1]?.rowIndex ?? d.rowIndex,
3025
+ startCol: 0,
3026
+ endCol: a,
3027
+ anchor: {
3028
+ rowIndex: d.rowIndex,
3029
+ colIndex: 0,
3030
+ rowId: d.rowId
3031
+ },
3032
+ focus: {
3033
+ rowIndex: d.rowIndex,
3034
+ colIndex: 0,
3035
+ rowId: d.rowId
3036
+ },
3037
+ startRowId: s[0]?.rowId ?? d.rowId,
3038
+ endRowId: s[s.length - 1]?.rowId ?? d.rowId
3039
+ }],
3040
+ activeRangeIndex: 0,
3041
+ activeCell: {
3042
+ rowIndex: d.rowIndex,
3043
+ colIndex: 0,
3044
+ rowId: d.rowId
3045
+ }
3046
+ };
3047
+ }, Xt = () => {
3048
+ const t = () => {
3049
+ const a = ce.value?.querySelector(".grid-body-viewport");
3050
+ if (!a)
3051
+ return !1;
3052
+ try {
3053
+ a.focus({ preventScroll: !0 });
3054
+ } catch {
3055
+ a.focus();
3056
+ }
3057
+ return document.activeElement === a;
3058
+ }, n = (a) => {
3059
+ Qe(() => {
3060
+ if (!(t() || a >= 3)) {
3061
+ if (typeof window < "u") {
3062
+ window.requestAnimationFrame(() => {
3063
+ n(a + 1);
3064
+ });
3065
+ return;
3066
+ }
3067
+ n(a + 1);
3068
+ }
3069
+ });
3070
+ };
3071
+ n(0);
3072
+ }, Ln = (t) => {
3073
+ const n = Gn(t);
3074
+ if (!n)
3075
+ return;
3076
+ e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.setFocusedRow(n), e.syncRowSelectionSnapshotFromRuntime?.(), e.flushRowSelectionSnapshotUpdates?.());
3077
+ const a = Yt(t, n);
3078
+ a && (e.runtime.api.selection.setSnapshot(a), e.syncSelectionSnapshotFromRuntime()), Xt();
3079
+ }, wt = (t) => {
3080
+ const n = e.runtime.api.rows.getCount();
3081
+ for (let a = 0; a < n; a += 1) {
3082
+ const s = e.runtime.api.rows.get(a);
3083
+ if (s && String(s.rowId) === t)
3084
+ return s;
3085
+ }
3086
+ return null;
3087
+ }, gt = (t) => {
3088
+ if (!e.placeholderRows.enabled || !e.placeholderRows.createRowAt || wt(t))
3089
+ return null;
3090
+ const n = `.datagrid-stage__row-index-cell[data-row-id="${$l(t)}"]`, a = ce.value?.querySelector(n), s = Number.parseInt(a?.dataset.rowIndex ?? "", 10);
3091
+ if (!Number.isFinite(s))
3092
+ return null;
3093
+ const c = Math.max(0, Math.trunc(s));
3094
+ return c < e.runtime.api.rows.getCount() ? null : c;
3095
+ }, Kn = async (t) => {
3096
+ try {
3097
+ return globalThis.navigator?.clipboard?.writeText ? (await globalThis.navigator.clipboard.writeText(t), !0) : !1;
3098
+ } catch {
3099
+ return !1;
3100
+ }
3101
+ }, Jt = async () => {
3102
+ try {
3103
+ return globalThis.navigator?.clipboard?.readText ? await globalThis.navigator.clipboard.readText() : "";
3104
+ } catch {
3105
+ return "";
3106
+ }
3107
+ }, vt = async () => {
3108
+ if (q.value?.rows.length)
3109
+ return q.value.rows.map((n) => we(n));
3110
+ const t = (await Jt()).trim();
3111
+ if (!t)
3112
+ return null;
3113
+ try {
3114
+ const n = JSON.parse(t);
3115
+ if (Array.isArray(n))
3116
+ return n.filter((a) => !!a && typeof a == "object").map((a) => we(a));
3117
+ if (n && typeof n == "object")
3118
+ return [we(n)];
3119
+ } catch {
3120
+ return null;
3121
+ }
3122
+ return null;
3123
+ }, Zt = async (t, n, a = []) => {
3124
+ const s = t.map((g) => we(g));
3125
+ q.value = {
3126
+ rows: s,
3127
+ operation: n,
3128
+ sourceRowIds: a.map((g) => String(g))
3129
+ };
3130
+ const c = sa(s);
3131
+ return c && await Kn(c), !0;
3132
+ }, de = () => e.runtime.api.rows.hasInsertSupport(), he = () => e.runtime.api.rows.hasDataMutationSupport(), We = (t) => !t || typeof t != "object" ? !1 : "data" in t || "row" in t || "kind" in t || "state" in t || "sourceIndex" in t || "originalIndex" in t || "displayIndex" in t, me = (t) => {
3133
+ const n = t;
3134
+ return n.rowId != null ? String(n.rowId) : n.id != null ? String(n.id) : null;
3135
+ }, De = (t) => {
3136
+ for (const n of e.rows) {
3137
+ if (!n || typeof n != "object")
3138
+ continue;
3139
+ const a = n;
3140
+ if ((a.rowId != null ? String(a.rowId) : a.rowKey != null ? String(a.rowKey) : null) === t && We(a))
3141
+ return a;
3142
+ }
3143
+ for (const n of e.rows) {
3144
+ if (!n || typeof n != "object")
3145
+ continue;
3146
+ const a = n;
3147
+ if (We(a))
3148
+ return a;
3149
+ }
3150
+ return null;
3151
+ }, ht = () => (mt += 1, `datagrid-row-${Date.now()}-${mt}`), $n = (t) => {
3152
+ const n = we(t), a = ht();
3153
+ let s = !1;
3154
+ return "id" in n && (n.id = a, s = !0), "rowId" in n && (n.rowId = a, s = !0), s || (n.id = a), n;
3155
+ }, Nn = (t) => {
3156
+ const n = ht(), a = {};
3157
+ for (const [s, c] of Object.entries(t)) {
3158
+ if (s === "id" || s === "rowId") {
3159
+ a[s] = n;
3160
+ continue;
3161
+ }
3162
+ a[s] = typeof c == "number" ? null : "";
3163
+ }
3164
+ return !("id" in a) && !("rowId" in a) && (a.id = n), a;
3165
+ }, bt = (t, n, a) => {
3166
+ const s = ht(), c = a === "clone" ? we(t) : Object.entries(t).reduce((d, [C, p]) => (d[C] = typeof p == "number" ? null : "", d), {});
3167
+ ("id" in c || !("rowId" in c) && !("id" in c)) && (c.id = s), "rowId" in c && (c.rowId = s), "rowKey" in c && (c.rowKey = s);
3168
+ const g = typeof n.state == "object" && n.state != null ? n.state : null;
3169
+ return {
3170
+ kind: n.kind === "group" ? "leaf" : n.kind ?? "leaf",
3171
+ rowId: s,
3172
+ rowKey: s,
3173
+ state: {
3174
+ ...g ?? {},
3175
+ selected: !1,
3176
+ group: !1,
3177
+ pinned: "none",
3178
+ expanded: !1
3179
+ },
3180
+ data: c,
3181
+ row: we(c)
3182
+ };
3183
+ }, Be = (t, n = null) => n && We(n) ? bt(t, n, "clone") : $n(t), yt = (t, n = null) => n && We(n) ? bt(t, n, "blank") : Nn(t), Ct = (t, n, a) => {
3184
+ if (!e.placeholderRows.enabled || !e.placeholderRows.createRowAt)
3185
+ return null;
3186
+ const s = e.placeholderRows.createRowAt({
3187
+ visualRowIndex: t,
3188
+ materializedRowCount: n,
3189
+ sourceRows: a,
3190
+ reason: "edit"
3191
+ });
3192
+ return s ? we(s) : null;
3193
+ }, Qt = (t, n) => {
3194
+ if (!de())
3195
+ return !1;
3196
+ const a = ge().map((d) => we(d));
3197
+ let s = e.runtime.api.rows.getCount();
3198
+ for (; s < n; ) {
3199
+ const d = Ct(
3200
+ s,
3201
+ s,
3202
+ a
3203
+ );
3204
+ if (!d || !e.runtime.api.rows.insertDataAt(s, [d]))
3205
+ return !1;
3206
+ a.push(d), s += 1;
3207
+ }
3208
+ const c = Math.max(0, Math.min(s, Math.trunc(t))), g = Ct(
3209
+ c,
3210
+ s,
3211
+ a
3212
+ );
3213
+ return g ? e.runtime.api.rows.insertDataAt(c, [g]) : !1;
3214
+ }, Wn = (t) => {
3215
+ if (!de())
3216
+ return null;
3217
+ const n = ge().map((c) => we(c));
3218
+ let a = e.runtime.api.rows.getCount();
3219
+ const s = Math.max(0, Math.trunc(t));
3220
+ for (; a < s; ) {
3221
+ const c = Ct(
3222
+ a,
3223
+ a,
3224
+ n
3225
+ );
3226
+ if (!c || !e.runtime.api.rows.insertDataAt(a, [c]))
3227
+ return null;
3228
+ n.push(c), a += 1;
3229
+ }
3230
+ return n;
3231
+ }, je = (t) => {
3232
+ const n = (d) => {
3233
+ const C = e.runtime.resolveBodyRowIndexById(d);
3234
+ if (C < 0 || C >= e.runtime.api.rows.getCount())
3235
+ return !1;
3236
+ const p = e.runtime.getBodyRowAtIndex(C);
3237
+ return p != null && p.kind !== "group" && !Xo(p);
3238
+ }, s = (e.rowSelectionSnapshot.value?.selectedRows ?? []).map((d) => String(d)).filter((d) => d.length > 0 && n(d));
3239
+ if (s.length > 0)
3240
+ return s;
3241
+ const c = Pe(), g = v.value.length - 1;
3242
+ if (c && g >= 0) {
3243
+ const d = Math.min(c.startColumn, c.endColumn), C = Math.max(c.startColumn, c.endColumn), p = Math.min(c.startRow, c.endRow), P = Math.max(c.startRow, c.endRow), k = t.length > 0 ? e.runtime.resolveBodyRowIndexById(t) : -1;
3244
+ if (d === 0 && C === g && (k < 0 || k >= p && k <= P)) {
3245
+ const $ = [];
3246
+ for (let N = p; N <= P; N += 1) {
3247
+ const ae = e.runtime.getBodyRowAtIndex(N);
3248
+ if (!ae || ae.kind === "group" || ae.rowId == null)
3249
+ continue;
3250
+ const fe = String(ae.rowId);
3251
+ n(fe) && $.push(fe);
3252
+ }
3253
+ if ($.length > 0)
3254
+ return $;
3255
+ }
3256
+ }
3257
+ return t.length > 0 && n(t) ? [t] : [];
3258
+ }, ge = () => {
3259
+ const t = [], n = e.runtime.api.rows.getCount();
3260
+ for (let a = 0; a < n; a += 1) {
3261
+ const s = e.runtime.api.rows.get(a);
3262
+ !s || s.kind === "group" || t.push(s.data);
3263
+ }
3264
+ return t;
3265
+ }, ke = (t) => {
3266
+ const n = new Set(
3267
+ ge().map((a) => me(a)).filter((a) => a != null)
3268
+ );
3269
+ return Array.from(new Set(t.map((a) => String(a)).filter((a) => n.has(a))));
3270
+ }, en = (t) => {
3271
+ if (t.length === 0)
3272
+ return [];
3273
+ const n = new Set(t.map((a) => String(a)));
3274
+ return ge().filter((a) => {
3275
+ const s = me(a);
3276
+ return s != null && n.has(s);
3277
+ });
3278
+ }, tn = (t) => {
3279
+ if (!he() || t.length === 0)
3280
+ return !1;
3281
+ const n = new Set(t), a = ge().filter((s) => {
3282
+ const c = me(s);
3283
+ return c == null || !n.has(c);
3284
+ });
3285
+ return a.length === e.runtime.api.rows.getCount() ? !1 : (e.runtime.api.rows.replaceData(a), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.clearSelectedRows(), e.syncRowSelectionSnapshotFromRuntime?.()), !0);
3286
+ }, Rt = (t, n) => {
3287
+ if (!he() || t.length === 0)
3288
+ return !1;
3289
+ const a = ge(), s = new Set(t.map((C) => String(C))), c = a.filter((C) => {
3290
+ const p = me(C);
3291
+ return p != null && s.has(p);
3292
+ });
3293
+ if (c.length === 0)
3294
+ return !1;
3295
+ const g = a.filter((C) => {
3296
+ const p = me(C);
3297
+ return p == null || !s.has(p);
3298
+ }), d = Number.isFinite(n) ? Math.max(0, Math.min(g.length, Math.trunc(n))) : g.length;
3299
+ return e.runtime.api.rows.replaceData([
3300
+ ...g.slice(0, d),
3301
+ ...c,
3302
+ ...g.slice(d)
3303
+ ]), e.runtime.api.rowSelection.hasSupport() && (e.runtime.api.rowSelection.selectRows(t), e.syncRowSelectionSnapshotFromRuntime?.()), !0;
3304
+ }, Un = (t, n) => {
3305
+ if (!he() || t.length === 0 || !n)
3306
+ return !1;
3307
+ const a = new Set(t.map((d) => String(d)));
3308
+ if (a.has(String(n)))
3309
+ return !1;
3310
+ const g = ge().filter((d) => {
3311
+ const C = me(d);
3312
+ return C == null || !a.has(C);
3313
+ }).findIndex((d) => me(d) === n);
3314
+ return g < 0 ? !1 : Rt(t, g + 1);
3315
+ }, nn = (t) => {
3316
+ if (!he())
3317
+ return !1;
3318
+ const n = String(t.sourceRowId), a = String(t.targetRowId);
3319
+ if (!n || !a || n === a)
3320
+ return !1;
3321
+ const s = ke(je(n)), c = s.includes(n) ? s : ke([n]);
3322
+ if (c.length === 0 || c.includes(a))
3323
+ return !1;
3324
+ const g = ge(), d = new Set(c), p = g.filter(($) => {
3325
+ const N = me($);
3326
+ return N == null || !d.has(N);
3327
+ }).findIndex(($) => me($) === a);
3328
+ if (p < 0)
3329
+ return !1;
3330
+ const P = ue(), k = Rt(
3331
+ c,
3332
+ t.placement === "after" ? p + 1 : p
3333
+ );
3334
+ return k && (Ln(c), _(P, c.length > 1 ? `Move ${c.length} rows` : "Move row")), k;
3335
+ }, qn = (t) => {
3336
+ const n = String(t.sourceColumnKey), a = String(t.targetColumnKey);
3337
+ if (!n || !a || n === a)
3338
+ return !1;
3339
+ const s = M.value, c = s.find((W) => W.key === n), g = s.find((W) => W.key === a);
3340
+ if (!c || !g)
3341
+ return !1;
3342
+ const d = s.map((W) => W.key), C = d.indexOf(n), p = d.indexOf(a);
3343
+ if (C < 0 || p < 0)
3344
+ return !1;
3345
+ const P = d[C];
3346
+ if (!P)
3347
+ return !1;
3348
+ d.splice(C, 1);
3349
+ const k = d.indexOf(a);
3350
+ if (k < 0)
3351
+ return !1;
3352
+ const $ = t.placement === "after" ? k + 1 : k;
3353
+ d.splice($, 0, P);
3354
+ const N = Ut(), ae = g.pin ?? "none";
3355
+ return (c.pin ?? "none") !== ae && e.runtime.api.columns.setPin(n, ae), e.runtime.api.columns.setOrder(d), jn(N), !0;
3356
+ }, Yn = () => q.value ? (q.value = null, !0) : !1, Xn = (t) => {
3357
+ if (t.kind === "group")
3358
+ return !1;
3359
+ const n = q.value;
3360
+ return n ? n.sourceRowIds.includes(String(t.rowId)) : !1;
3361
+ }, ln = () => typeof e.runStructuralRowAction == "function";
3362
+ let on = () => !1, rn = () => {
3363
+ }, an = () => {
3364
+ };
3365
+ const sn = Z(null);
3366
+ let St = async (t, n) => !1;
3367
+ const Jn = (t, n) => {
3368
+ if (n)
3369
+ return n;
3370
+ const a = Ul[t], s = ya[t];
3371
+ return s ? `${a} (${s})` : a;
3372
+ }, {
3373
+ tableStageProps: Ue,
3374
+ tableStageContext: qe,
3375
+ historyController: Ee,
3376
+ copySelectedCells: Zn,
3377
+ pasteSelectedCells: Qn,
3378
+ cutSelectedCells: un,
3379
+ clearSelectedCells: cn,
3380
+ captureHistorySnapshot: ue,
3381
+ captureHistorySnapshotForRowIds: el,
3382
+ recordHistoryIntentTransaction: dn,
3383
+ revealCellInComfortZone: L
3384
+ } = Jr({
3385
+ mode: H,
3386
+ layoutMode: w(() => e.layoutMode),
3387
+ minRows: w(() => e.minRows),
3388
+ maxRows: w(() => e.maxRows),
3389
+ placeholderRows: w(() => e.placeholderRows),
3390
+ enableFillHandle: w(() => e.fillHandle),
3391
+ enableRangeMove: w(() => e.rangeMove),
3392
+ rows: T,
3393
+ sourceRows: T,
3394
+ runtime: e.runtime,
3395
+ rowVersion: o,
3396
+ totalRuntimeRows: x,
3397
+ visibleColumns: v,
3398
+ rowRenderMode: w(() => e.renderMode),
3399
+ rowHeightMode: U,
3400
+ normalizedBaseRowHeight: V,
3401
+ selectionSnapshot: e.selectionSnapshot,
3402
+ selectionAnchor: e.selectionAnchor,
3403
+ rowSelectionSnapshot: e.rowSelectionSnapshot,
3404
+ rowHover: w(() => e.rowHover),
3405
+ stripedRows: w(() => e.stripedRows),
3406
+ chromeSignature: r,
3407
+ showRowIndex: w(() => e.showRowIndex),
3408
+ showRowSelection: w(() => e.rowSelection),
3409
+ isRowInPendingClipboardCut: Xn,
3410
+ syncSelectionSnapshotFromRuntime: e.syncSelectionSnapshotFromRuntime,
3411
+ syncRowSelectionSnapshotFromRuntime: e.syncRowSelectionSnapshotFromRuntime,
3412
+ flushRowSelectionSnapshotUpdates: e.flushRowSelectionSnapshotUpdates,
3413
+ clearExternalPendingClipboardOperation: Yn,
3414
+ firstColumnKey: ne,
3415
+ columnFilterTextByKey: f,
3416
+ virtualization: w(() => e.virtualization),
3417
+ toggleSortForColumn: Pt,
3418
+ sortIndicator: Hn,
3419
+ setColumnFilterText: Pn,
3420
+ columnMenuEnabled: w(() => e.columnMenu.enabled),
3421
+ columnMenuTrigger: w(() => e.columnMenu.trigger),
3422
+ columnMenuMaxFilterValues: w(() => e.columnMenu.maxFilterValues),
3423
+ resolveColumnMenuItems: Tt,
3424
+ resolveColumnMenuDisabledItems: _e,
3425
+ resolveColumnMenuDisabledReasons: zt,
3426
+ resolveColumnMenuLabels: _t,
3427
+ resolveColumnMenuActionOptions: $e,
3428
+ resolveColumnMenuCustomItems: lt,
3429
+ isColumnFilterActive: kt,
3430
+ isColumnGrouped: Me,
3431
+ resolveColumnGroupOrder: ot,
3432
+ resolveColumnMenuSortDirection: ct,
3433
+ resolveColumnMenuSelectedTokens: Et,
3434
+ resolveColumnMenuValueEntries: Ml,
3435
+ applyColumnMenuSort: jt,
3436
+ applyColumnMenuPin: Gt,
3437
+ applyColumnMenuGroupBy: Lt,
3438
+ applyColumnMenuFilter: Kt,
3439
+ clearColumnMenuFilter: dt,
3440
+ applyRowHeightSettings: Vn,
3441
+ cloneRowData: we,
3442
+ readSelectionCell: e.readSelectionCell,
3443
+ historyEnabled: w(() => e.history.enabled),
3444
+ historyMaxDepth: w(() => e.history.depth),
3445
+ historyShortcuts: w(() => e.history.shortcuts),
3446
+ history: e.history.adapter,
3447
+ isCellEditable: e.isCellEditable,
3448
+ isContextMenuVisible: () => on(),
3449
+ closeContextMenu: () => rn(),
3450
+ openContextMenuFromCurrentCell: () => {
3451
+ an();
3452
+ },
3453
+ runRowIndexKeyboardAction: (t, n) => St(t, n),
3454
+ reorderColumnsByHeader: e.columnReorder.enabled ? qn : void 0,
3455
+ reorderRowsByIndex: e.rowReorder.enabled ? nn : void 0,
3456
+ cellClass: (t, n, a, s) => {
3457
+ const c = sn.value, g = !c || t.kind === "group" || t.rowId == null || t.rowId !== c.rowId || a.key !== c.columnKey ? null : {
3458
+ "grid-cell--find-match-active": !0,
3459
+ "grid-cell--find-match-flash-a": c.flashPhase === 0,
3460
+ "grid-cell--find-match-flash-b": c.flashPhase === 1
3461
+ };
3462
+ return oa(
3463
+ g,
3464
+ e.cellClass?.(t, n, a, s)
3465
+ );
3466
+ },
3467
+ cellStyle: e.cellStyle
3468
+ });
3469
+ Y(
3470
+ () => e.registerHistoryController,
3471
+ (t) => {
3472
+ t?.(Ee);
3473
+ },
3474
+ { immediate: !0 }
3475
+ ), Y(
3476
+ () => e.registerStructuralRowActionRunner,
3477
+ (t) => {
3478
+ t?.(K);
3479
+ },
3480
+ { immediate: !0 }
3481
+ ), Y(
3482
+ () => e.history.shortcuts,
3483
+ (t, n, a) => {
3484
+ if (t !== "window" || typeof window > "u")
3485
+ return;
3486
+ const s = (c) => {
3487
+ if (c.defaultPrevented || c.altKey || !(c.ctrlKey || c.metaKey))
3488
+ return;
3489
+ const g = c.key.toLowerCase(), d = g === "z" ? c.shiftKey ? "redo" : "undo" : g === "y" && !c.shiftKey ? "redo" : null;
3490
+ d && (c.preventDefault(), Ee.runHistoryAction(d));
3491
+ };
3492
+ window.addEventListener("keydown", s), a(() => {
3493
+ window.removeEventListener("keydown", s);
3494
+ });
3495
+ },
3496
+ { immediate: !0 }
3497
+ ), Hl(() => {
3498
+ e.registerHistoryController?.(null), e.registerStructuralRowActionRunner?.(null);
3499
+ });
3500
+ const tl = w(() => Ue.value.columns.visibleColumns), pt = (t) => {
3501
+ e.runtime.api.selection.setSnapshot(Wt(t)), e.syncSelectionSnapshotFromRuntime();
3502
+ }, b = (t, n, a, s) => t.kind === "group" || t.rowId == null || a.column.capabilities?.editable === !1 ? !1 : e.isCellEditable ? e.isCellEditable({
3503
+ row: t.data,
3504
+ rowId: t.rowId,
3505
+ rowIndex: n,
3506
+ column: a.column,
3507
+ columnKey: a.key
3508
+ }) : !0, S = dl(null), F = async () => {
3509
+ if (S.value)
3510
+ return S.value;
3511
+ const { useDataGridAppFindReplace: t } = await import("./useDataGridAppFindReplace-DTSLds4f.js"), n = t({
3512
+ runtime: e.runtime,
3513
+ visibleColumns: v,
3514
+ stageVisibleColumns: tl,
3515
+ resolveCurrentCellCoord: ft,
3516
+ applyActiveCell: pt,
3517
+ revealCellInComfortZone: L,
3518
+ captureRowsSnapshot: ue,
3519
+ captureRowsSnapshotForRowIds: el,
3520
+ recordHistoryIntentTransaction: dn,
3521
+ isCellEditable: b
3522
+ });
3523
+ return S.value = n, n;
3524
+ }, D = {
3525
+ isPanelOpen: w(() => S.value?.isPanelOpen.value ?? !1),
3526
+ findText: w(() => S.value?.findText.value ?? ""),
3527
+ replaceText: w(() => S.value?.replaceText.value ?? ""),
3528
+ matchCase: w(() => S.value?.matchCase.value ?? !1),
3529
+ statusText: w(() => S.value?.statusText.value ?? ""),
3530
+ active: w(() => S.value?.active.value ?? !1),
3531
+ canFind: w(() => S.value?.canFind.value ?? !1),
3532
+ canReplaceCurrent: w(() => S.value?.canReplaceCurrent.value ?? !1),
3533
+ canReplaceAll: w(() => S.value?.canReplaceAll.value ?? !1),
3534
+ highlightedCell: w(() => S.value?.highlightedCell.value ?? null),
3535
+ openPanel: async () => {
3536
+ (await F()).openPanel();
3537
+ },
3538
+ closePanel: () => {
3539
+ S.value?.closePanel();
3540
+ },
3541
+ updateFindText: async (t) => {
3542
+ (await F()).updateFindText(t);
3543
+ },
3544
+ updateReplaceText: async (t) => {
3545
+ (await F()).updateReplaceText(t);
3546
+ },
3547
+ updateMatchCase: async (t) => {
3548
+ (await F()).updateMatchCase(t);
3549
+ },
3550
+ findNext: async () => (await F()).findNext(),
3551
+ findPrevious: async () => (await F()).findPrevious(),
3552
+ replaceCurrent: async () => (await F()).replaceCurrent(),
3553
+ replaceAll: async () => (await F()).replaceAll()
3554
+ };
3555
+ Y(
3556
+ () => D.highlightedCell.value,
3557
+ (t) => {
3558
+ sn.value = t;
3559
+ },
3560
+ { immediate: !0 }
3561
+ );
3562
+ const {
3563
+ contextMenu: te,
3564
+ contextMenuRef: mn,
3565
+ contextMenuStyle: nl,
3566
+ closeContextMenu: ve,
3567
+ openContextMenu: It,
3568
+ onContextMenuKeyDown: Ye
3569
+ } = Oo();
3570
+ on = () => te.value.visible, rn = ve;
3571
+ const xt = No({
3572
+ isInteractionBlocked: () => !1,
3573
+ isRangeMoveModifierActive: () => !1,
3574
+ resolveSelectionRange: Pe,
3575
+ resolveCellCoordFromDataset: Nt,
3576
+ applyCellSelection: (t) => {
3577
+ pt(t);
3578
+ },
3579
+ resolveActiveCellCoord: ft,
3580
+ setActiveCellCoord: (t) => {
3581
+ pt(t);
3582
+ },
3583
+ cellCoordsEqual: (t, n) => t?.rowIndex === n?.rowIndex && t?.columnIndex === n?.columnIndex,
3584
+ isMultiCellSelection: Ne,
3585
+ isCoordInsideRange: $t,
3586
+ openContextMenu: It,
3587
+ closeContextMenu: ve,
3588
+ isColumnContextEnabled: (t) => e.cellMenu.enabled ? Cn(e.cellMenu, t).length > 0 : !1,
3589
+ isRowIndexContextEnabled: () => e.rowIndexMenu.enabled && e.showRowIndex
3590
+ }), Xe = Wo({
3591
+ resolveCurrentCellCoord: ft,
3592
+ resolveViewportElement: () => ce.value,
3593
+ resolveRowAtIndex: (t) => e.runtime.getBodyRowAtIndex(t) ?? void 0,
3594
+ resolveColumnAtIndex: (t) => v.value[t] ?? void 0,
3595
+ resolveSelectionRange: Pe,
3596
+ isMultiCellSelection: (t) => Ne(t),
3597
+ isCoordInsideRange: $t,
3598
+ openContextMenu: It,
3599
+ isColumnContextEnabled: (t) => e.cellMenu.enabled && Cn(e.cellMenu, t.key).length > 0
3600
+ });
3601
+ an = () => {
3602
+ Xe.openContextMenuFromCurrentCell();
3603
+ };
3604
+ const fn = (t) => {
3605
+ if (!e.rowIndexMenu.enabled || !e.showRowIndex || !ce.value)
3606
+ return !1;
3607
+ const n = String(t), a = `.datagrid-stage__row-index-cell[data-row-id="${$l(n)}"]`, s = ce.value.querySelector(a);
3608
+ if (!s)
3609
+ return !1;
3610
+ const c = s.getBoundingClientRect();
3611
+ return It(
3612
+ c.left + Math.max(10, Math.min(c.width / 2, Math.max(10, c.width - 10))),
3613
+ c.bottom - 4,
3614
+ {
3615
+ zone: "row-index",
3616
+ rowId: n
3617
+ }
3618
+ ), !0;
3619
+ }, _ = (t, n) => {
3620
+ dn({
3621
+ intent: "edit",
3622
+ label: n
3623
+ }, t);
3624
+ };
3625
+ async function K(t, n) {
3626
+ const a = String(n), s = gt(a), c = s == null ? wt(a) : null, g = ke(je(a)), d = await e.runStructuralRowAction?.({
3627
+ action: t,
3628
+ rowId: n,
3629
+ row: c && c.kind !== "group" ? c : null,
3630
+ rowIndex: s ?? e.runtime.resolveBodyRowIndexById(a),
3631
+ placeholderVisualRowIndex: s,
3632
+ selectedRowIds: g
3633
+ });
3634
+ if (typeof d == "boolean")
3635
+ return d;
3636
+ if (s != null) {
3637
+ if (t === "delete-selected-rows") {
3638
+ if (g.length === 0)
3639
+ return !1;
3640
+ const C = ue(), p = tn(g);
3641
+ return p && _(C, g.length > 1 ? `Delete ${g.length} rows` : "Delete row"), p;
3642
+ }
3643
+ if (t === "insert-row-above") {
3644
+ const C = ue(), p = Qt(
3645
+ s,
3646
+ s
3647
+ );
3648
+ return p && _(C, "Insert row above"), p;
3649
+ }
3650
+ if (t === "insert-row-below") {
3651
+ const C = ue(), p = Qt(
3652
+ s + 1,
3653
+ s + 1
3654
+ );
3655
+ return p && _(C, "Insert row below"), p;
3656
+ }
3657
+ return !1;
3658
+ }
3659
+ if (!c || c.kind === "group")
3660
+ return !1;
3661
+ if (t === "delete-selected-rows") {
3662
+ if (g.length === 0)
3663
+ return !1;
3664
+ const C = ue(), p = tn(g);
3665
+ return p && _(C, g.length > 1 ? `Delete ${g.length} rows` : "Delete row"), p;
3666
+ }
3667
+ if (t === "insert-row-above") {
3668
+ if (!de())
3669
+ return !1;
3670
+ const C = ue(), p = e.runtime.api.rows.insertDataBefore(
3671
+ n,
3672
+ [yt(c.data, De(a))]
3673
+ );
3674
+ return p && _(C, "Insert row above"), p;
3675
+ }
3676
+ if (t === "insert-row-below") {
3677
+ if (!de())
3678
+ return !1;
3679
+ const C = ue(), p = e.runtime.api.rows.insertDataAfter(
3680
+ n,
3681
+ [yt(c.data, De(a))]
3682
+ );
3683
+ return p && _(C, "Insert row below"), p;
3684
+ }
3685
+ return !1;
3686
+ }
3687
+ St = async (t, n) => {
3688
+ const a = String(n);
3689
+ if (t === "open-row-menu")
3690
+ return fn(a);
3691
+ if (t === "insert-row-above" || t === "insert-row-below" || t === "delete-selected-rows")
3692
+ return K(t, n);
3693
+ const s = gt(a);
3694
+ if (s != null) {
3695
+ if (t === "paste-row") {
3696
+ if (!de())
3697
+ return !1;
3698
+ const g = await vt();
3699
+ if (!g || g.length === 0)
3700
+ return !1;
3701
+ const d = ue(), C = q.value?.operation === "cut" ? q.value.sourceRowIds : [];
3702
+ if (!Wn(s + 1))
3703
+ return !1;
3704
+ const P = Math.max(0, s + 1), k = De(
3705
+ C[0] ?? a
3706
+ ) ?? De(a), $ = C.length > 0 ? Rt(C, P) : e.runtime.api.rows.insertDataAt(
3707
+ P,
3708
+ g.map((N) => Be(N, k))
3709
+ );
3710
+ return $ && q.value?.operation === "cut" && (q.value = null), $ && _(
3711
+ d,
3712
+ C.length > 0 ? C.length > 1 ? `Move ${C.length} rows` : "Move row" : g.length > 1 ? `Paste ${g.length} rows` : "Paste row"
3713
+ ), $;
3714
+ }
3715
+ return !1;
3716
+ }
3717
+ const c = wt(a);
3718
+ if (!c || c.kind === "group")
3719
+ return !1;
3720
+ if (t === "copy-row") {
3721
+ const g = ke(je(a)), d = en(g);
3722
+ return Zt(
3723
+ d.length > 0 ? d : [c.data],
3724
+ "copy",
3725
+ g.length > 0 ? g : [a]
3726
+ );
3727
+ }
3728
+ if (t === "cut-row") {
3729
+ const g = ke(je(a)), d = en(g);
3730
+ return Zt(
3731
+ d.length > 0 ? d : [c.data],
3732
+ "cut",
3733
+ g.length > 0 ? g : [a]
3734
+ );
3735
+ }
3736
+ if (t === "paste-row") {
3737
+ if (!de())
3738
+ return !1;
3739
+ const g = await vt();
3740
+ if (!g || g.length === 0)
3741
+ return !1;
3742
+ const d = ue(), C = q.value?.operation === "cut" ? q.value.sourceRowIds : [], p = De(
3743
+ C[0] ?? a
3744
+ ) ?? De(a), P = C.length > 0 ? Un(C, a) : e.runtime.api.rows.insertDataAfter(
3745
+ n,
3746
+ g.map((k) => Be(k, p))
3747
+ );
3748
+ return P && q.value?.operation === "cut" && (q.value = null), P && _(
3749
+ d,
3750
+ C.length > 0 ? C.length > 1 ? `Move ${C.length} rows` : "Move row" : g.length > 1 ? `Paste ${g.length} rows` : "Paste row"
3751
+ ), P;
3752
+ }
3753
+ return !1;
3754
+ };
3755
+ const X = Uo({
3756
+ resolveContextMenuState: () => ({
3757
+ zone: te.value.zone,
3758
+ columnKey: te.value.columnKey,
3759
+ rowId: te.value.rowId
3760
+ }),
3761
+ runHeaderContextAction: () => !1,
3762
+ runRowIndexContextAction: St,
3763
+ copySelection: Zn,
3764
+ pasteSelection: Qn,
3765
+ cutSelection: un,
3766
+ clearCurrentSelection: cn,
3767
+ closeContextMenu: ve
3768
+ }), re = Z([]), wn = (t) => re.value.includes(t), ll = (t) => {
3769
+ re.value = re.value.filter((n) => n !== t && !n.startsWith(`${t}/`));
3770
+ }, ol = (t, n = []) => {
3771
+ if (wn(t)) {
3772
+ ll(t);
3773
+ return;
3774
+ }
3775
+ re.value = Array.from(/* @__PURE__ */ new Set([...n, t]));
3776
+ }, io = (t, n, a, s, c) => {
3777
+ const d = c[n === "paste-values" ? "pasteValues" : n];
3778
+ if (d?.hidden)
3779
+ return null;
3780
+ const C = a.has(t) || d?.disabled === !0;
3781
+ return {
3782
+ kind: "action",
3783
+ id: n,
3784
+ label: d?.label ?? Ul[n],
3785
+ disabled: C,
3786
+ title: d?.disabledReason ?? s[t],
3787
+ actionId: n
3788
+ };
3789
+ }, Al = (t, n, a) => {
3790
+ if (t.hidden === !0)
3791
+ return null;
3792
+ const s = n.length > 0 ? `${n}/${t.key}` : t.key, c = `custom:${s}`, g = t.disabledReason?.trim() || void 0;
3793
+ if (t.kind === "submenu") {
3794
+ const d = t.items.flatMap((C) => {
3795
+ const p = Al(C, s, a);
3796
+ return p ? [p] : [];
3797
+ });
3798
+ return d.length === 0 ? null : {
3799
+ kind: "submenu",
3800
+ id: c,
3801
+ label: t.label,
3802
+ disabled: t.disabled === !0,
3803
+ title: g,
3804
+ entries: d
3805
+ };
3806
+ }
3807
+ return {
3808
+ kind: "action",
3809
+ id: c,
3810
+ label: t.label,
3811
+ disabled: t.disabled === !0,
3812
+ title: g,
3813
+ onSelect: async () => {
3814
+ t.disabled !== !0 && await t.onSelect?.({
3815
+ zone: a.zone,
3816
+ columnKey: a.columnKey,
3817
+ rowId: a.rowId,
3818
+ closeMenu: ve
3819
+ });
3820
+ }
3821
+ };
3822
+ }, so = (t, n, a) => {
3823
+ const s = /* @__PURE__ */ new Map(), c = (d, C) => {
3824
+ if (!C)
3825
+ return;
3826
+ const p = s.get(d) ?? [];
3827
+ p.push([C]), s.set(d, p);
3828
+ };
3829
+ for (const d of n)
3830
+ c(d.placement ?? "end", Al(d, "", a));
3831
+ const g = [
3832
+ ...s.get("start") ?? []
3833
+ ];
3834
+ for (const d of t)
3835
+ g.push(...s.get(`before:${d.itemKey}`) ?? []), g.push([...d.entries]), g.push(...s.get(`after:${d.itemKey}`) ?? []);
3836
+ return g.push(...s.get("end") ?? []), g.filter((d) => d.length > 0);
3837
+ }, Fl = w(() => {
3838
+ if (!te.value.visible)
3839
+ return [];
3840
+ const t = te.value.zone;
3841
+ if (t === "cell" || t === "range") {
3842
+ const n = te.value.columnKey ?? "";
3843
+ if (!e.cellMenu.enabled || !n)
3844
+ return [];
3845
+ const a = Cn(e.cellMenu, n), s = new Set(Or(e.cellMenu, n)), c = kr(e.cellMenu, n), g = Dr(e.cellMenu, n), d = Er(e.cellMenu, n), C = Tr(e.cellMenu, n), p = [];
3846
+ for (const P of a) {
3847
+ const $ = (ha[P] ?? []).flatMap((N) => {
3848
+ const ae = io(P, N, s, c, d);
3849
+ return ae ? [ae] : [];
3850
+ });
3851
+ if ($.length !== 0) {
3852
+ if (P === "pasteSpecial") {
3853
+ const N = s.has(P) || $.every((ae) => ae.disabled);
3854
+ p.push({
3855
+ itemKey: P,
3856
+ entries: [{
3857
+ kind: "submenu",
3858
+ id: "paste-special-submenu",
3859
+ label: g.pasteSpecial ?? "Paste special",
3860
+ disabled: N,
3861
+ title: c[P] ?? ($.length === 1 ? $[0]?.title : void 0),
3862
+ entries: $
3863
+ }]
3864
+ });
3865
+ continue;
3866
+ }
3867
+ p.push({
3868
+ itemKey: P,
3869
+ entries: $
3870
+ });
3871
+ }
3872
+ }
3873
+ return so(p, C, {
3874
+ zone: t,
3875
+ columnKey: n,
3876
+ rowId: te.value.rowId
3877
+ });
3878
+ }
3879
+ if (t === "row-index") {
3880
+ if (!e.rowIndexMenu.enabled)
3881
+ return [];
3882
+ const n = gt(te.value.rowId ?? ""), a = zr(e.rowIndexMenu), s = new Set(_r(e.rowIndexMenu)), c = Hr(e.rowIndexMenu), g = Pr(e.rowIndexMenu), d = [];
3883
+ for (const C of a) {
3884
+ const P = (ba[C] ?? []).flatMap((k) => {
3885
+ const N = g[k === "insert-row-above" ? "insertAbove" : k === "insert-row-below" ? "insertBelow" : k === "copy-row" ? "copy" : k === "paste-row" ? "paste" : k === "delete-selected-rows" ? "deleteSelected" : "cut"];
3886
+ if (N?.hidden)
3887
+ return [];
3888
+ let fe = s.has(C) || N?.disabled === !0, W = N?.disabledReason ?? c[C];
3889
+ return n != null && k !== "delete-selected-rows" && k !== "insert-row-above" && k !== "insert-row-below" && k !== "paste-row" && (fe = !0, W = W ?? "Placeholder rows must be materialized before this action is available"), (k === "insert-row-above" || k === "insert-row-below") && !de() && !ln() && (fe = !0, W = W ?? "Row insertion is not supported by the current row model"), k === "paste-row" && !de() && (fe = !0, W = W ?? "Row insertion is not supported by the current row model"), k === "cut-row" && !he() && (fe = !0, W = W ?? "Row deletion is not supported by the current row model"), k === "delete-selected-rows" && !he() && !ln() && (fe = !0, W = W ?? "Row deletion is not supported by the current row model"), k === "delete-selected-rows" && ke(
3890
+ je(te.value.rowId ?? "")
3891
+ ).length === 0 && (fe = !0, W = W ?? "No deletable rows are selected"), [{
3892
+ kind: "action",
3893
+ id: k,
3894
+ label: Jn(k, N?.label),
3895
+ disabled: fe,
3896
+ title: W,
3897
+ actionId: k
3898
+ }];
3899
+ });
3900
+ P.length > 0 && d.push(P);
3901
+ }
3902
+ return d;
3903
+ }
3904
+ return [];
3905
+ }), Ol = (t) => {
3906
+ xt.dispatchViewportContextMenu(t);
3907
+ }, gn = () => {
3908
+ ce.value?.querySelector(".grid-body-viewport")?.focus({ preventScroll: !0 });
3909
+ }, uo = () => {
3910
+ Qe(() => {
3911
+ if (typeof window < "u") {
3912
+ window.requestAnimationFrame(() => {
3913
+ gn();
3914
+ });
3915
+ return;
3916
+ }
3917
+ gn();
3918
+ });
3919
+ }, co = async (t) => {
3920
+ await X.runContextMenuAction(t) && (gn(), ve(), uo());
3921
+ }, mo = async (t) => {
3922
+ if (!t.disabled && t.kind !== "submenu") {
3923
+ if (t.actionId) {
3924
+ await co(t.actionId);
3925
+ return;
3926
+ }
3927
+ await t.onSelect?.();
3928
+ }
3929
+ }, Dl = (t, n = [], a = 0) => t.flatMap((s) => {
3930
+ if (s.kind === "submenu") {
3931
+ const c = wn(s.id), g = c ? G("div", {
3932
+ class: "datagrid-context-menu__submenu-panel",
3933
+ role: "menu",
3934
+ "data-datagrid-menu-parent-action": s.id
3935
+ }, Dl(s.entries, [...n, s.id], a + 1)) : null;
3936
+ return [G("div", {
3937
+ class: [
3938
+ "datagrid-context-menu__submenu",
3939
+ c ? "datagrid-context-menu__submenu--open" : null
3940
+ ]
3941
+ }, [
3942
+ G("button", {
3943
+ type: "button",
3944
+ class: [
3945
+ "datagrid-context-menu__item",
3946
+ "datagrid-context-menu__item--submenu"
3947
+ ],
3948
+ "data-datagrid-menu-action": s.id,
3949
+ "data-datagrid-menu-depth": String(a),
3950
+ "data-datagrid-menu-open": c ? "true" : void 0,
3951
+ "aria-haspopup": "menu",
3952
+ "aria-expanded": c ? "true" : "false",
3953
+ disabled: s.disabled,
3954
+ title: s.title,
3955
+ onClick: () => {
3956
+ ol(s.id, n);
3957
+ }
3958
+ }, [
3959
+ G("span", s.label),
3960
+ G("span", {
3961
+ class: "datagrid-context-menu__submenu-arrow",
3962
+ "aria-hidden": "true"
3963
+ }, ">")
3964
+ ]),
3965
+ ...g ? [g] : []
3966
+ ])];
3967
+ }
3968
+ return [G("button", {
3969
+ type: "button",
3970
+ class: "datagrid-context-menu__item",
3971
+ "data-datagrid-menu-action": s.id,
3972
+ "data-datagrid-menu-depth": String(a),
3973
+ disabled: s.disabled,
3974
+ title: s.title,
3975
+ onClick: () => {
3976
+ mo(s);
3977
+ }
3978
+ }, s.label)];
3979
+ }), kl = () => !te.value.visible || Fl.value.length === 0 ? null : G("div", {
3980
+ ref: mn,
3981
+ class: "datagrid-context-menu",
3982
+ style: nl.value,
3983
+ role: "menu",
3984
+ tabindex: -1,
3985
+ onKeydown: (t) => {
3986
+ Ye(t, {
3987
+ onEscape: () => {
3988
+ gn();
3989
+ }
3990
+ });
3991
+ }
3992
+ }, Fl.value.flatMap((t, n) => {
3993
+ const a = [];
3994
+ return n > 0 && a.push(G("div", {
3995
+ class: "datagrid-context-menu__separator",
3996
+ "aria-hidden": "true"
3997
+ })), a.push(...Dl(t)), a;
3998
+ }));
3999
+ Y(
4000
+ () => te.value.visible,
4001
+ (t, n, a) => {
4002
+ if (t || (re.value = []), !t || typeof window > "u")
4003
+ return;
4004
+ const s = (g) => {
4005
+ const d = g.target;
4006
+ d && mn.value?.contains(d) || ve();
4007
+ }, c = () => {
4008
+ ve();
4009
+ };
4010
+ window.addEventListener("mousedown", s, !0), window.addEventListener("blur", c), a(() => {
4011
+ window.removeEventListener("mousedown", s, !0), window.removeEventListener("blur", c);
4012
+ });
4013
+ }
4014
+ );
4015
+ const El = w(() => ({
4016
+ ...Ue.value,
4017
+ customOverlays: e.customOverlays,
4018
+ columns: {
4019
+ ...Ue.value.columns,
4020
+ columnMenuEnabled: e.columnMenu.enabled,
4021
+ columnMenuTrigger: e.columnMenu.trigger,
4022
+ columnMenuMaxFilterValues: e.columnMenu.maxFilterValues,
4023
+ resolveColumnMenuItems: Tt,
4024
+ resolveColumnMenuDisabledItems: _e,
4025
+ resolveColumnMenuDisabledReasons: zt,
4026
+ resolveColumnMenuLabels: _t,
4027
+ resolveColumnMenuActionOptions: $e,
4028
+ resolveColumnMenuCustomItems: lt,
4029
+ isColumnFilterActive: kt,
4030
+ isColumnGrouped: Me,
4031
+ resolveColumnGroupOrder: ot,
4032
+ resolveColumnMenuSortDirection: ct,
4033
+ resolveColumnMenuSelectedTokens: Et,
4034
+ applyColumnMenuSort: jt,
4035
+ applyColumnMenuPin: Gt,
4036
+ applyColumnMenuGroupBy: Lt,
4037
+ applyColumnMenuFilter: Kt,
4038
+ clearColumnMenuFilter: dt
4039
+ },
4040
+ rows: {
4041
+ ...Ue.value.rows,
4042
+ sourceRows: e.rows,
4043
+ rowHover: e.rowHover,
4044
+ stripedRows: e.stripedRows
4045
+ }
4046
+ })), vn = w(() => {
4047
+ const t = [];
4048
+ return e.history.enabled && e.history.controls === "toolbar" && (t.push({
4049
+ key: "history-undo",
4050
+ component: jl,
4051
+ props: {
4052
+ action: "undo",
4053
+ label: "Undo",
4054
+ disabled: !Ee.canUndo(),
4055
+ onTrigger: () => Ee.runHistoryAction("undo")
4056
+ }
4057
+ }), t.push({
4058
+ key: "history-redo",
4059
+ component: jl,
4060
+ props: {
4061
+ action: "redo",
4062
+ label: "Redo",
4063
+ disabled: !Ee.canRedo(),
4064
+ onTrigger: () => Ee.runHistoryAction("redo")
4065
+ }
4066
+ })), e.columnLayout.enabled && t.push({
4067
+ key: "column-layout",
4068
+ component: hr,
4069
+ props: {
4070
+ isOpen: tt.value,
4071
+ items: nt.value,
4072
+ buttonLabel: e.columnLayout.buttonLabel,
4073
+ labels: e.columnLayout.labels,
4074
+ active: !1,
4075
+ onOpen: Ie,
4076
+ onToggleVisibility: Q,
4077
+ onMoveUp: E,
4078
+ onMoveDown: le,
4079
+ onMoveToPosition: (n) => {
4080
+ In(n.key, n.targetKey, n.placement);
4081
+ },
4082
+ onApply: z,
4083
+ onCancel: j
4084
+ }
4085
+ }), e.advancedFilter.enabled && t.push({
4086
+ key: "advanced-filter",
4087
+ component: ea,
4088
+ props: {
4089
+ isOpen: Ft.value,
4090
+ clauses: xn.value,
4091
+ columns: O.value,
4092
+ appliedFilterSummaryItems: at.value,
4093
+ hasAnyFilters: it.value,
4094
+ buttonLabel: e.advancedFilter.buttonLabel,
4095
+ labels: e.advancedFilter.labels,
4096
+ active: it.value,
4097
+ showActiveIcon: it.value,
4098
+ onOpen: _n,
4099
+ onAdd: On,
4100
+ onRemove: Dn,
4101
+ onUpdateClause: Ot,
4102
+ onApply: st,
4103
+ onCancel: oe,
4104
+ onResetAll: zn
4105
+ }
4106
+ }), e.findReplace.enabled && t.push({
4107
+ key: "find-replace",
4108
+ component: na,
4109
+ props: {
4110
+ isOpen: D.isPanelOpen.value,
4111
+ findText: D.findText.value,
4112
+ replaceText: D.replaceText.value,
4113
+ matchCase: D.matchCase.value,
4114
+ statusText: D.statusText.value,
4115
+ buttonLabel: e.findReplace.buttonLabel,
4116
+ active: D.active.value,
4117
+ canFind: D.canFind.value,
4118
+ canReplaceCurrent: D.canReplaceCurrent.value,
4119
+ canReplaceAll: D.canReplaceAll.value,
4120
+ onOpen: D.openPanel,
4121
+ onCancel: D.closePanel,
4122
+ onUpdateFindText: D.updateFindText,
4123
+ onUpdateReplaceText: D.updateReplaceText,
4124
+ onUpdateMatchCase: D.updateMatchCase,
4125
+ onFindNext: D.findNext,
4126
+ onFindPrevious: D.findPrevious,
4127
+ onReplaceCurrent: D.replaceCurrent,
4128
+ onReplaceAll: D.replaceAll
4129
+ }
4130
+ }), e.aggregations.enabled && e.mode !== "pivot" && t.push({
4131
+ key: "aggregations",
4132
+ component: ta,
4133
+ props: {
4134
+ isOpen: xe.value,
4135
+ basis: ze.value,
4136
+ items: Tn.value,
4137
+ buttonLabel: e.aggregations.buttonLabel,
4138
+ active: Te.value && (xe.value || !!Ke.value?.columns.length),
4139
+ disabled: !Te.value,
4140
+ disabledReason: Te.value ? "" : "Aggregations require an active group-by model.",
4141
+ onOpen: Bn,
4142
+ onUpdateBasis: He,
4143
+ onToggleColumn: Fe,
4144
+ onUpdateOp: Vt,
4145
+ onClear: Ae,
4146
+ onApply: Bt,
4147
+ onCancel: ut
4148
+ }
4149
+ }), [...t, ...e.toolbarModules].map(la);
4150
+ });
4151
+ Y(
4152
+ vn,
4153
+ (t) => {
4154
+ e.reportToolbarModules?.(t);
4155
+ },
4156
+ { immediate: !0, flush: "post" }
4157
+ );
4158
+ const hn = w(() => e.viewMode === "gantt" && e.chrome.toolbarPlacement === "integrated" ? "stacked" : e.chrome.toolbarPlacement), Tl = w(() => vn.value.length > 0 && hn.value !== "hidden"), fo = w(() => Tl.value && hn.value === "stacked"), wo = w(() => Tl.value && hn.value === "integrated");
4159
+ return () => G("div", {
4160
+ class: [
4161
+ "datagrid-app-layout",
4162
+ `datagrid-app-layout--toolbar-${hn.value}`,
4163
+ `datagrid-app-layout--density-${e.chrome.density}`,
4164
+ e.layoutMode === "auto-height" ? "datagrid-app-layout--auto-height" : "datagrid-app-layout--fill"
4165
+ ],
4166
+ style: l.value
4167
+ }, [
4168
+ fo.value ? G(Bl, {
4169
+ modules: vn.value,
4170
+ variant: "standalone"
4171
+ }) : null,
4172
+ G("div", {
4173
+ class: [
4174
+ "datagrid-app-workspace",
4175
+ e.layoutMode === "auto-height" ? "datagrid-app-workspace--auto-height" : "datagrid-app-workspace--fill"
4176
+ ]
4177
+ }, [
4178
+ wo.value ? G("div", {
4179
+ class: [
4180
+ "datagrid-app-stage-surface",
4181
+ e.layoutMode === "auto-height" ? "datagrid-app-stage-surface--auto-height" : "datagrid-app-stage-surface--fill",
4182
+ "datagrid-app-stage-surface--integrated"
4183
+ ]
4184
+ }, [
4185
+ G(Bl, {
4186
+ modules: vn.value,
4187
+ variant: "integrated"
4188
+ }),
4189
+ G("div", {
4190
+ class: [
4191
+ "datagrid-app-stage",
4192
+ "datagrid-app-stage--integrated",
4193
+ e.layoutMode === "auto-height" ? "datagrid-app-stage--auto-height" : "datagrid-app-stage--fill"
4194
+ ],
4195
+ ref: ce
4196
+ }, [
4197
+ e.viewMode === "gantt" ? G(Pl, {
4198
+ stageContext: qe,
4199
+ runtime: e.runtime,
4200
+ gantt: e.gantt,
4201
+ baseRowHeight: V.value,
4202
+ rowVersion: o.value
4203
+ }) : G(Vl, {
4204
+ ...El.value,
4205
+ stageContext: qe,
4206
+ onViewportContextMenu: Ol
4207
+ }),
4208
+ kl()
4209
+ ])
4210
+ ]) : G("div", {
4211
+ class: [
4212
+ "datagrid-app-stage",
4213
+ e.layoutMode === "auto-height" ? "datagrid-app-stage--auto-height" : "datagrid-app-stage--fill"
4214
+ ],
4215
+ ref: ce
4216
+ }, [
4217
+ e.viewMode === "gantt" ? G(Pl, {
4218
+ stageContext: qe,
4219
+ runtime: e.runtime,
4220
+ gantt: e.gantt,
4221
+ baseRowHeight: V.value,
4222
+ rowVersion: o.value
4223
+ }) : G(Vl, {
4224
+ ...El.value,
4225
+ stageContext: qe,
4226
+ onViewportContextMenu: Ol
4227
+ }),
4228
+ kl()
4229
+ ]),
4230
+ e.inspectorPanel ? G("aside", {
4231
+ class: "datagrid-app-inspector-shell"
4232
+ }, [
4233
+ G(e.inspectorPanel.component, {
4234
+ ...e.inspectorPanel.props ?? {}
4235
+ })
4236
+ ]) : null
4237
+ ])
4238
+ ]);
4239
+ }
4240
+ });
4241
+ function Wa() {
4242
+ return (e) => e;
4243
+ }
4244
+ const cl = /* @__PURE__ */ new WeakMap(), ql = /* @__PURE__ */ new WeakMap();
4245
+ function Ca(e) {
4246
+ if (!e)
4247
+ return;
4248
+ const l = cl.get(e);
4249
+ if (l)
4250
+ return l;
4251
+ const r = e.initialTreeData?.expandedByDefault ?? !1;
4252
+ if (e.initialTreeData?.expandedByDefault === r)
4253
+ return cl.set(e, e), e;
4254
+ const o = {
4255
+ ...e
4256
+ };
4257
+ return e.initialTreeData && (o.initialTreeData = {
4258
+ ...e.initialTreeData,
4259
+ expandedByDefault: r
4260
+ }), cl.set(e, o), o;
4261
+ }
4262
+ function Ra(e) {
4263
+ return !e || e.length === 0 ? [] : e.map((l) => ({ ...l }));
4264
+ }
4265
+ function Sa(e) {
4266
+ return !e || e.length === 0 ? [] : e.map((l) => ({ ...l }));
4267
+ }
4268
+ function pa(e) {
4269
+ return !e || e.length === 0 ? [] : e.map(({ formula: l, ...r }) => ({ ...r }));
4270
+ }
4271
+ function Ia(e) {
4272
+ return !e || e.length === 0 ? [] : e.flatMap((l) => {
4273
+ const r = typeof l.formula == "string" ? l.formula.trim() : "";
4274
+ return r ? [{
4275
+ name: l.key,
4276
+ formula: r
4277
+ }] : [];
4278
+ });
4279
+ }
4280
+ function xa(e, l) {
4281
+ const r = /* @__PURE__ */ new Map();
4282
+ for (const o of e)
4283
+ r.set(o.name, { ...o });
4284
+ for (const o of Ra(l))
4285
+ r.set(o.name, o);
4286
+ return Array.from(r.values());
4287
+ }
4288
+ function Ua(e) {
4289
+ return pa(e);
4290
+ }
4291
+ function qa(e) {
4292
+ const l = Ca(e.clientRowModelOptions), r = e.enterpriseClientRowModelOptions, o = Ia(e.columns), u = e.formulas !== void 0, i = e.computedFields !== void 0, f = e.formulaFunctions !== void 0, h = o.length > 0, R = u || h ? xa(o, e.formulas) : void 0, A = i ? Sa(e.computedFields) : void 0, H = f ? e.formulaFunctions ?? {} : void 0, T = !!(h || u || i || f);
4293
+ if (!l && !T)
4294
+ return r ? {
4295
+ ...r
4296
+ } : void 0;
4297
+ if (!T) {
4298
+ if (l && !r)
4299
+ return l;
4300
+ if (!l && r)
4301
+ return r;
4302
+ if (l && r) {
4303
+ let x = ql.get(l);
4304
+ x || (x = /* @__PURE__ */ new WeakMap(), ql.set(l, x));
4305
+ const v = x.get(r);
4306
+ if (v)
4307
+ return v;
4308
+ const M = {
4309
+ ...l,
4310
+ ...r
4311
+ };
4312
+ return x.set(
4313
+ r,
4314
+ M
4315
+ ), M;
4316
+ }
4317
+ }
4318
+ return {
4319
+ ...l ?? {},
4320
+ ...i ? { initialComputedFields: A } : {},
4321
+ ...u || h ? { initialFormulaFields: R } : {},
4322
+ ...f ? { initialFormulaFunctionRegistry: H } : {},
4323
+ ...r?.computeMode ? { computeMode: r.computeMode } : {},
4324
+ ...r?.workerPatchDispatchThreshold !== void 0 ? { workerPatchDispatchThreshold: r.workerPatchDispatchThreshold } : {},
4325
+ ...r?.formulaColumnCacheMaxColumns !== void 0 ? { formulaColumnCacheMaxColumns: r.formulaColumnCacheMaxColumns } : {}
4326
+ };
4327
+ }
4328
+ const Ma = "comfortable", Aa = {
4329
+ comfortable: {
4330
+ toolbarGap: 10,
4331
+ workspaceGap: 12
4332
+ },
4333
+ compact: {
4334
+ toolbarGap: 6,
4335
+ workspaceGap: 8
4336
+ }
4337
+ };
4338
+ function Fa(e) {
4339
+ return e === "compact" ? "compact" : Ma;
4340
+ }
4341
+ function Oa(e) {
4342
+ return e === "integrated" || e === "hidden" || e === "stacked" ? e : "stacked";
4343
+ }
4344
+ function Yl(e, l) {
4345
+ return Number.isFinite(e) ? Math.max(0, e) : l;
4346
+ }
4347
+ function Ya(e) {
4348
+ const l = typeof e == "object" && e !== null ? e : null, r = Fa(typeof e == "string" ? e : l?.density), o = Aa[r];
4349
+ return {
4350
+ density: r,
4351
+ toolbarPlacement: Oa(l?.toolbarPlacement),
4352
+ toolbarGap: Yl(l?.toolbarGap, o.toolbarGap),
4353
+ workspaceGap: Yl(l?.workspaceGap, o.workspaceGap)
4354
+ };
4355
+ }
4356
+ function Xa(e) {
4357
+ return typeof e == "boolean" ? {
4358
+ enabled: e
4359
+ } : e ? {
4360
+ enabled: e.enabled ?? !0
4361
+ } : {
4362
+ enabled: !1
4363
+ };
4364
+ }
4365
+ function Ja(e) {
4366
+ return typeof e == "boolean" ? {
4367
+ enabled: e
4368
+ } : e ? {
4369
+ enabled: e.enabled ?? !0
4370
+ } : {
4371
+ enabled: !1
4372
+ };
4373
+ }
4374
+ function Xl() {
4375
+ const e = globalThis.performance;
4376
+ return e && typeof e.now == "function" ? e.now() : Date.now();
4377
+ }
4378
+ const Da = (e, l) => {
4379
+ const r = Xl();
4380
+ return {
4381
+ result: l(),
4382
+ duration: Math.max(0, Xl() - r)
4383
+ };
4384
+ };
4385
+ function Jl(e) {
4386
+ return {
4387
+ projectionStageTimer: Da,
4388
+ ...e ?? {}
4389
+ };
4390
+ }
4391
+ function Za(e) {
4392
+ const l = Z(0), r = rl(), o = dl(
4393
+ e.rowModel.value ? null : rl({
4394
+ rows: e.rows.value,
4395
+ ...Jl(e.clientRowModelOptions.value)
4396
+ })
4397
+ ), u = (R) => {
4398
+ !R || R === e.rowModel.value || "dispose" in R && typeof R.dispose == "function" && R.dispose();
4399
+ }, i = (R) => {
4400
+ !R || R === e.rowModel.value || Qe(() => {
4401
+ u(R);
4402
+ });
4403
+ }, f = () => {
4404
+ if (e.rowModel.value)
4405
+ return;
4406
+ const R = o.value;
4407
+ o.value = rl({
4408
+ rows: e.rows.value,
4409
+ ...Jl(e.clientRowModelOptions.value)
4410
+ }), l.value += 1, e.onOwnedRowModelRecreated?.(), i(R);
4411
+ }, h = w(() => e.rowModel.value ?? o.value ?? r);
4412
+ return Y(
4413
+ e.rows,
4414
+ (R) => {
4415
+ o.value && o.value.setRows(R);
4416
+ },
4417
+ { deep: !1 }
4418
+ ), Y(
4419
+ e.clientRowModelOptions,
4420
+ () => {
4421
+ f();
4422
+ },
4423
+ { deep: !0 }
4424
+ ), Y(
4425
+ e.rowModel,
4426
+ (R) => {
4427
+ if (R) {
4428
+ const A = o.value;
4429
+ o.value = null, l.value += 1, i(A);
4430
+ return;
4431
+ }
4432
+ o.value || f();
4433
+ }
4434
+ ), po(() => {
4435
+ u(o.value), u(r);
4436
+ }), {
4437
+ dataGridInstanceKey: l,
4438
+ resolvedRowModel: h,
4439
+ disposeOwnedRowModel: u
4440
+ };
4441
+ }
4442
+ export {
4443
+ Na as D,
4444
+ Bl as a,
4445
+ Xa as b,
4446
+ qa as c,
4447
+ Ja as d,
4448
+ Vr as e,
4449
+ Jr as f,
4450
+ La as g,
4451
+ Ka as h,
4452
+ $a as i,
4453
+ Ga as j,
4454
+ Ua as k,
4455
+ Wa as l,
4456
+ Ya as r,
4457
+ Za as u
4458
+ };