@fileflow/sdk 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2867 +0,0 @@
1
- import { jsx as p, jsxs as w, Fragment as et } from "react/jsx-runtime";
2
- import * as pe from "react";
3
- import tt, { useCallback as xe, useState as Y, useMemo as Pe, useEffect as Ne } from "react";
4
- import { f as b, h as nt, u as rt, X as me, j as L, U as Oe, A as ye, m as he, o as ot, n as ne, k as De, t as it, c as lt, V as Le, g as W, L as Ee } from "./index-CEvc89fO.mjs";
5
- /**
6
- * @license lucide-react v0.321.0 - ISC
7
- *
8
- * This source code is licensed under the ISC license.
9
- * See the LICENSE file in the root directory of this source tree.
10
- */
11
- const st = b("ArrowRight", [
12
- ["path", { d: "M5 12h14", key: "1ays0h" }],
13
- ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
14
- ]);
15
- /**
16
- * @license lucide-react v0.321.0 - ISC
17
- *
18
- * This source code is licensed under the ISC license.
19
- * See the LICENSE file in the root directory of this source tree.
20
- */
21
- const at = b("CheckSquare", [
22
- ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }],
23
- ["path", { d: "M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11", key: "1jnkn4" }]
24
- ]);
25
- /**
26
- * @license lucide-react v0.321.0 - ISC
27
- *
28
- * This source code is licensed under the ISC license.
29
- * See the LICENSE file in the root directory of this source tree.
30
- */
31
- const ut = b("Check", [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]]);
32
- /**
33
- * @license lucide-react v0.321.0 - ISC
34
- *
35
- * This source code is licensed under the ISC license.
36
- * See the LICENSE file in the root directory of this source tree.
37
- */
38
- const ft = b("ChevronLeft", [
39
- ["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
40
- ]);
41
- /**
42
- * @license lucide-react v0.321.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */
47
- const gt = b("Eye", [
48
- ["path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z", key: "rwhkz3" }],
49
- ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
50
- ]);
51
- /**
52
- * @license lucide-react v0.321.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */
57
- const dt = b("File", [
58
- ["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
59
- ["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }]
60
- ]);
61
- /**
62
- * @license lucide-react v0.321.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */
67
- const ct = b("GitBranch", [
68
- ["line", { x1: "6", x2: "6", y1: "3", y2: "15", key: "17qcm7" }],
69
- ["circle", { cx: "18", cy: "6", r: "3", key: "1h7g24" }],
70
- ["circle", { cx: "6", cy: "18", r: "3", key: "fqmcym" }],
71
- ["path", { d: "M18 9a9 9 0 0 1-9 9", key: "n2h4wq" }]
72
- ]);
73
- /**
74
- * @license lucide-react v0.321.0 - ISC
75
- *
76
- * This source code is licensed under the ISC license.
77
- * See the LICENSE file in the root directory of this source tree.
78
- */
79
- const pt = b("HelpCircle", [
80
- ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
81
- ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
82
- ["path", { d: "M12 17h.01", key: "p32p05" }]
83
- ]);
84
- /**
85
- * @license lucide-react v0.321.0 - ISC
86
- *
87
- * This source code is licensed under the ISC license.
88
- * See the LICENSE file in the root directory of this source tree.
89
- */
90
- const mt = b("Pen", [
91
- ["path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z", key: "5qss01" }]
92
- ]), He = {
93
- sessionId: null,
94
- status: "idle",
95
- step: "upload",
96
- schema: null,
97
- file: null,
98
- fileName: null,
99
- fileSize: null,
100
- headers: [],
101
- rows: [],
102
- totalRows: 0,
103
- sampleRows: [],
104
- mappings: [],
105
- unmappedSource: [],
106
- unmappedTarget: [],
107
- validationResults: null,
108
- errorsByRow: /* @__PURE__ */ new Map(),
109
- isLoading: !1,
110
- error: null,
111
- editingCell: null,
112
- editedRows: /* @__PURE__ */ new Set()
113
- }, X = nt((e, r) => ({
114
- ...He,
115
- setSchema: (t) => e({ schema: t }),
116
- setSessionId: (t) => e({ sessionId: t }),
117
- setFile: (t) => e({
118
- file: t,
119
- fileName: t.name,
120
- fileSize: t.size,
121
- error: null
122
- }),
123
- setParsedData: (t) => e({
124
- headers: t.headers,
125
- rows: t.rows,
126
- totalRows: t.totalRows,
127
- sampleRows: t.sampleRows
128
- }),
129
- setMappings: (t) => e({ mappings: t }),
130
- updateMapping: (t, n) => e((o) => ({ mappings: o.mappings.map(
131
- (l) => l.sourceColumn === t ? { ...l, targetKey: n, isAutoMapped: !1 } : l
132
- ) })),
133
- setUnmapped: (t, n) => e({
134
- unmappedSource: t,
135
- unmappedTarget: n
136
- }),
137
- setValidationResults: (t) => {
138
- const n = /* @__PURE__ */ new Map();
139
- for (const o of t.errors) {
140
- const i = n.get(o.rowIndex) || [];
141
- i.push(o), n.set(o.rowIndex, i);
142
- }
143
- e({ validationResults: t, errorsByRow: n });
144
- },
145
- setStep: (t) => e({ step: t }),
146
- nextStep: () => {
147
- const t = ["upload", "mapping", "validation", "review", "complete"], n = t.indexOf(r().step);
148
- n < t.length - 1 && e({ step: t[n + 1] });
149
- },
150
- previousStep: () => {
151
- const t = ["upload", "mapping", "validation", "review", "complete"], n = t.indexOf(r().step);
152
- n > 0 && e({ step: t[n - 1] });
153
- },
154
- startEditing: (t, n) => e({
155
- editingCell: { rowIndex: t, columnKey: n }
156
- }),
157
- stopEditing: () => e({ editingCell: null }),
158
- updateCell: (t, n, o) => e((i) => {
159
- const l = [...i.rows], a = l.find((g) => g.rowIndex === t);
160
- a && (a.data = { ...a.data, [n]: String(o) });
161
- const u = new Set(i.editedRows);
162
- return u.add(t), { rows: l, editedRows: u, editingCell: null };
163
- }),
164
- setStatus: (t) => e({ status: t }),
165
- setLoading: (t) => e({ isLoading: t }),
166
- setError: (t) => e({ error: t }),
167
- reset: () => e(He)
168
- })), ht = ({
169
- onFileSelect: e,
170
- maxSize: r = 50 * 1024 * 1024,
171
- // 50MB
172
- acceptedTypes: t = [".csv", ".xlsx", ".xls"]
173
- }) => {
174
- const { file: n, fileName: o, fileSize: i, setFile: l, error: a, setError: u, isLoading: g } = X(), d = xe(
175
- (S, R) => {
176
- if (R.length > 0) {
177
- u("Invalid file type or file too large");
178
- return;
179
- }
180
- if (S.length > 0) {
181
- const _ = S[0];
182
- l(_), e == null || e(_);
183
- }
184
- },
185
- [e, l, u]
186
- ), { getRootProps: c, getInputProps: f, isDragActive: s } = rt({
187
- onDrop: d,
188
- accept: {
189
- "text/csv": [".csv"],
190
- "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": [".xlsx"],
191
- "application/vnd.ms-excel": [".xls"]
192
- },
193
- maxSize: r,
194
- multiple: !1,
195
- disabled: g
196
- }), m = (S) => S < 1024 ? `${S} B` : S < 1024 * 1024 ? `${(S / 1024).toFixed(1)} KB` : `${(S / (1024 * 1024)).toFixed(1)} MB`, h = (S) => {
197
- S.stopPropagation(), X.getState().reset();
198
- };
199
- return n ? /* @__PURE__ */ p("div", { className: "ff-p-4 ff-bg-green-50 ff-border ff-border-green-200 ff-rounded-lg", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
200
- /* @__PURE__ */ p("div", { className: "ff-p-2 ff-bg-green-100 ff-rounded-lg", children: /* @__PURE__ */ p(dt, { className: "ff-w-6 ff-h-6 ff-text-green-600" }) }),
201
- /* @__PURE__ */ w("div", { className: "ff-flex-1 ff-min-w-0", children: [
202
- /* @__PURE__ */ p("p", { className: "ff-font-medium ff-text-green-900 ff-truncate", children: o }),
203
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-green-600", children: m(i || 0) })
204
- ] }),
205
- /* @__PURE__ */ p(
206
- "button",
207
- {
208
- onClick: h,
209
- className: "ff-p-1.5 ff-text-green-600 hover:ff-text-green-800 hover:ff-bg-green-100 ff-rounded-full ff-transition-colors",
210
- "aria-label": "Remove file",
211
- children: /* @__PURE__ */ p(me, { className: "ff-w-5 ff-h-5" })
212
- }
213
- )
214
- ] }) }) : /* @__PURE__ */ w("div", { className: "ff-space-y-3", children: [
215
- /* @__PURE__ */ w(
216
- "div",
217
- {
218
- ...c(),
219
- className: L(
220
- "ff-dropzone",
221
- s && "ff-dropzone-active",
222
- g && "ff-opacity-50 ff-cursor-not-allowed"
223
- ),
224
- children: [
225
- /* @__PURE__ */ p("input", { ...f() }),
226
- /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-gap-3", children: [
227
- /* @__PURE__ */ p("div", { className: L(
228
- "ff-p-3 ff-rounded-full",
229
- s ? "ff-bg-primary-100" : "ff-bg-gray-100"
230
- ), children: /* @__PURE__ */ p(Oe, { className: L(
231
- "ff-w-8 ff-h-8",
232
- s ? "ff-text-primary-600" : "ff-text-gray-400"
233
- ) }) }),
234
- /* @__PURE__ */ w("div", { className: "ff-text-center", children: [
235
- /* @__PURE__ */ p("p", { className: "ff-text-base ff-font-medium ff-text-gray-700", children: s ? "Drop your file here" : "Drag & drop your file here" }),
236
- /* @__PURE__ */ w("p", { className: "ff-text-sm ff-text-gray-500 ff-mt-1", children: [
237
- "or ",
238
- /* @__PURE__ */ p("span", { className: "ff-text-primary-600 ff-font-medium", children: "browse files" })
239
- ] })
240
- ] }),
241
- /* @__PURE__ */ w("p", { className: "ff-text-xs ff-text-gray-400", children: [
242
- "Supports: ",
243
- t.join(", "),
244
- " (max ",
245
- m(r),
246
- ")"
247
- ] })
248
- ] })
249
- ]
250
- }
251
- ),
252
- a && /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-2 ff-p-3 ff-bg-error-50 ff-text-error-700 ff-rounded-lg", children: [
253
- /* @__PURE__ */ p(ye, { className: "ff-w-4 ff-h-4 ff-flex-shrink-0" }),
254
- /* @__PURE__ */ p("p", { className: "ff-text-sm", children: a })
255
- ] })
256
- ] });
257
- }, wt = ({ onMappingChange: e }) => {
258
- const { mappings: r, schema: t, unmappedSource: n, updateMapping: o } = X(), i = (t == null ? void 0 : t.columns) || [], l = (c, f) => {
259
- const s = f === "" ? null : f;
260
- o(c, s), e == null || e(c, s);
261
- }, a = (c) => c >= 0.85 ? "ff-text-success-600" : c >= 0.6 ? "ff-text-warning-600" : "ff-text-error-600", u = (c) => c >= 0.85 ? "High" : c >= 0.6 ? "Medium" : "Low", d = new Set(
262
- r.filter((c) => c.targetKey !== null).map((c) => c.targetKey)
263
- );
264
- return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
265
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-mb-4", children: [
266
- /* @__PURE__ */ w("div", { children: [
267
- /* @__PURE__ */ p("h3", { className: "ff-text-lg ff-font-semibold ff-text-gray-900", children: "Column Mapping" }),
268
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-gray-500", children: "Match your file columns to the expected fields" })
269
- ] }),
270
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-4 ff-text-sm", children: [
271
- /* @__PURE__ */ w("span", { className: "ff-flex ff-items-center ff-gap-1.5", children: [
272
- /* @__PURE__ */ p("span", { className: "ff-w-2 ff-h-2 ff-rounded-full ff-bg-success-500" }),
273
- /* @__PURE__ */ p("span", { className: "ff-text-gray-600", children: "Mapped" })
274
- ] }),
275
- /* @__PURE__ */ w("span", { className: "ff-flex ff-items-center ff-gap-1.5", children: [
276
- /* @__PURE__ */ p("span", { className: "ff-w-2 ff-h-2 ff-rounded-full ff-bg-warning-500" }),
277
- /* @__PURE__ */ p("span", { className: "ff-text-gray-600", children: "Review" })
278
- ] }),
279
- /* @__PURE__ */ w("span", { className: "ff-flex ff-items-center ff-gap-1.5", children: [
280
- /* @__PURE__ */ p("span", { className: "ff-w-2 ff-h-2 ff-rounded-full ff-bg-gray-300" }),
281
- /* @__PURE__ */ p("span", { className: "ff-text-gray-600", children: "Unmapped" })
282
- ] })
283
- ] })
284
- ] }),
285
- /* @__PURE__ */ p("div", { className: "ff-space-y-2", children: r.map((c) => {
286
- i.find((m) => m.key === c.targetKey);
287
- const f = c.targetKey !== null, s = c.confidence >= 0.85;
288
- return /* @__PURE__ */ w(
289
- "div",
290
- {
291
- className: L(
292
- "ff-mapping-row",
293
- f && s && "ff-border-success-200 ff-bg-success-50/50",
294
- f && !s && "ff-border-warning-200 ff-bg-warning-50/50",
295
- !f && "ff-border-gray-200"
296
- ),
297
- children: [
298
- /* @__PURE__ */ p("div", { className: "ff-flex-1", children: /* @__PURE__ */ p("div", { className: "ff-mapping-source", children: c.sourceColumn }) }),
299
- /* @__PURE__ */ p("div", { className: "ff-mapping-arrow", children: /* @__PURE__ */ p(st, { className: "ff-w-5 ff-h-5" }) }),
300
- /* @__PURE__ */ p("div", { className: "ff-flex-1 ff-mapping-target", children: /* @__PURE__ */ w(
301
- "select",
302
- {
303
- value: c.targetKey || "",
304
- onChange: (m) => l(c.sourceColumn, m.target.value),
305
- className: L(
306
- "ff-input",
307
- !f && "ff-border-gray-300",
308
- f && s && "ff-border-success-300 ff-bg-success-50",
309
- f && !s && "ff-border-warning-300 ff-bg-warning-50"
310
- ),
311
- children: [
312
- /* @__PURE__ */ p("option", { value: "", children: "-- Do not import --" }),
313
- i.map((m) => /* @__PURE__ */ w(
314
- "option",
315
- {
316
- value: m.key,
317
- disabled: d.has(m.key) && c.targetKey !== m.key,
318
- children: [
319
- m.label,
320
- " (",
321
- m.type,
322
- ")",
323
- m.required ? " *" : ""
324
- ]
325
- },
326
- m.key
327
- ))
328
- ]
329
- }
330
- ) }),
331
- /* @__PURE__ */ p("div", { className: "ff-w-8 ff-flex ff-justify-center", children: f ? s ? /* @__PURE__ */ p(ut, { className: "ff-w-5 ff-h-5 ff-text-success-600" }) : /* @__PURE__ */ p(pt, { className: "ff-w-5 ff-h-5 ff-text-warning-600" }) : /* @__PURE__ */ p("span", { className: "ff-w-5 ff-h-5" }) }),
332
- c.confidence > 0 && /* @__PURE__ */ w("div", { className: L("ff-confidence", a(c.confidence)), children: [
333
- /* @__PURE__ */ w("span", { children: [
334
- Math.round(c.confidence * 100),
335
- "%"
336
- ] }),
337
- /* @__PURE__ */ w("span", { className: "ff-text-gray-400", children: [
338
- "(",
339
- u(c.confidence),
340
- ")"
341
- ] })
342
- ] })
343
- ]
344
- },
345
- c.sourceColumn
346
- );
347
- }) }),
348
- (() => {
349
- const c = i.filter(
350
- (f) => f.required && !d.has(f.key)
351
- );
352
- return c.length > 0 ? /* @__PURE__ */ w("div", { className: "ff-flex ff-items-start ff-gap-2 ff-p-3 ff-bg-warning-50 ff-border ff-border-warning-200 ff-rounded-lg", children: [
353
- /* @__PURE__ */ p(ye, { className: "ff-w-5 ff-h-5 ff-text-warning-600 ff-flex-shrink-0 ff-mt-0.5" }),
354
- /* @__PURE__ */ w("div", { children: [
355
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-font-medium ff-text-warning-800", children: "Required fields not mapped" }),
356
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-warning-700 ff-mt-1", children: c.map((f) => f.label).join(", ") })
357
- ] })
358
- ] }) : null;
359
- })()
360
- ] });
361
- };
362
- /**
363
- * table-core
364
- *
365
- * Copyright (c) TanStack
366
- *
367
- * This source code is licensed under the MIT license found in the
368
- * LICENSE.md file in the root directory of this source tree.
369
- *
370
- * @license MIT
371
- */
372
- function St() {
373
- return {
374
- accessor: (e, r) => typeof e == "function" ? {
375
- ...r,
376
- accessorFn: e
377
- } : {
378
- ...r,
379
- accessorKey: e
380
- },
381
- display: (e) => e,
382
- group: (e) => e
383
- };
384
- }
385
- function T(e, r) {
386
- return typeof e == "function" ? e(r) : e;
387
- }
388
- function A(e, r) {
389
- return (t) => {
390
- r.setState((n) => ({
391
- ...n,
392
- [e]: T(t, n[e])
393
- }));
394
- };
395
- }
396
- function re(e) {
397
- return e instanceof Function;
398
- }
399
- function Ct(e) {
400
- return Array.isArray(e) && e.every((r) => typeof r == "number");
401
- }
402
- function vt(e, r) {
403
- const t = [], n = (o) => {
404
- o.forEach((i) => {
405
- t.push(i);
406
- const l = r(i);
407
- l != null && l.length && n(l);
408
- });
409
- };
410
- return n(e), t;
411
- }
412
- function C(e, r, t) {
413
- let n = [], o;
414
- return (i) => {
415
- let l;
416
- t.key && t.debug && (l = Date.now());
417
- const a = e(i);
418
- if (!(a.length !== n.length || a.some((d, c) => n[c] !== d)))
419
- return o;
420
- n = a;
421
- let g;
422
- if (t.key && t.debug && (g = Date.now()), o = r(...a), t == null || t.onChange == null || t.onChange(o), t.key && t.debug && t != null && t.debug()) {
423
- const d = Math.round((Date.now() - l) * 100) / 100, c = Math.round((Date.now() - g) * 100) / 100, f = c / 16, s = (m, h) => {
424
- for (m = String(m); m.length < h; )
425
- m = " " + m;
426
- return m;
427
- };
428
- console.info(`%c⏱ ${s(c, 5)} /${s(d, 5)} ms`, `
429
- font-size: .6rem;
430
- font-weight: bold;
431
- color: hsl(${Math.max(0, Math.min(120 - 120 * f, 120))}deg 100% 31%);`, t == null ? void 0 : t.key);
432
- }
433
- return o;
434
- };
435
- }
436
- function v(e, r, t, n) {
437
- return {
438
- debug: () => {
439
- var o;
440
- return (o = e == null ? void 0 : e.debugAll) != null ? o : e[r];
441
- },
442
- key: process.env.NODE_ENV === "development" && t,
443
- onChange: n
444
- };
445
- }
446
- function Rt(e, r, t, n) {
447
- const o = () => {
448
- var l;
449
- return (l = i.getValue()) != null ? l : e.options.renderFallbackValue;
450
- }, i = {
451
- id: `${r.id}_${t.id}`,
452
- row: r,
453
- column: t,
454
- getValue: () => r.getValue(n),
455
- renderValue: o,
456
- getContext: C(() => [e, t, r, i], (l, a, u, g) => ({
457
- table: l,
458
- column: a,
459
- row: u,
460
- cell: g,
461
- getValue: g.getValue,
462
- renderValue: g.renderValue
463
- }), v(e.options, "debugCells", "cell.getContext"))
464
- };
465
- return e._features.forEach((l) => {
466
- l.createCell == null || l.createCell(i, t, r, e);
467
- }, {}), i;
468
- }
469
- function xt(e, r, t, n) {
470
- var o, i;
471
- const a = {
472
- ...e._getDefaultColumnDef(),
473
- ...r
474
- }, u = a.accessorKey;
475
- let g = (o = (i = a.id) != null ? i : u ? typeof String.prototype.replaceAll == "function" ? u.replaceAll(".", "_") : u.replace(/\./g, "_") : void 0) != null ? o : typeof a.header == "string" ? a.header : void 0, d;
476
- if (a.accessorFn ? d = a.accessorFn : u && (u.includes(".") ? d = (f) => {
477
- let s = f;
478
- for (const h of u.split(".")) {
479
- var m;
480
- s = (m = s) == null ? void 0 : m[h], process.env.NODE_ENV !== "production" && s === void 0 && console.warn(`"${h}" in deeply nested key "${u}" returned undefined.`);
481
- }
482
- return s;
483
- } : d = (f) => f[a.accessorKey]), !g)
484
- throw process.env.NODE_ENV !== "production" ? new Error(a.accessorFn ? "Columns require an id when using an accessorFn" : "Columns require an id when using a non-string header") : new Error();
485
- let c = {
486
- id: `${String(g)}`,
487
- accessorFn: d,
488
- parent: n,
489
- depth: t,
490
- columnDef: a,
491
- columns: [],
492
- getFlatColumns: C(() => [!0], () => {
493
- var f;
494
- return [c, ...(f = c.columns) == null ? void 0 : f.flatMap((s) => s.getFlatColumns())];
495
- }, v(e.options, "debugColumns", "column.getFlatColumns")),
496
- getLeafColumns: C(() => [e._getOrderColumnsFn()], (f) => {
497
- var s;
498
- if ((s = c.columns) != null && s.length) {
499
- let m = c.columns.flatMap((h) => h.getLeafColumns());
500
- return f(m);
501
- }
502
- return [c];
503
- }, v(e.options, "debugColumns", "column.getLeafColumns"))
504
- };
505
- for (const f of e._features)
506
- f.createColumn == null || f.createColumn(c, e);
507
- return c;
508
- }
509
- const D = "debugHeaders";
510
- function Ge(e, r, t) {
511
- var n;
512
- let i = {
513
- id: (n = t.id) != null ? n : r.id,
514
- column: r,
515
- index: t.index,
516
- isPlaceholder: !!t.isPlaceholder,
517
- placeholderId: t.placeholderId,
518
- depth: t.depth,
519
- subHeaders: [],
520
- colSpan: 0,
521
- rowSpan: 0,
522
- headerGroup: null,
523
- getLeafHeaders: () => {
524
- const l = [], a = (u) => {
525
- u.subHeaders && u.subHeaders.length && u.subHeaders.map(a), l.push(u);
526
- };
527
- return a(i), l;
528
- },
529
- getContext: () => ({
530
- table: e,
531
- header: i,
532
- column: r
533
- })
534
- };
535
- return e._features.forEach((l) => {
536
- l.createHeader == null || l.createHeader(i, e);
537
- }), i;
538
- }
539
- const yt = {
540
- createTable: (e) => {
541
- e.getHeaderGroups = C(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (r, t, n, o) => {
542
- var i, l;
543
- const a = (i = n == null ? void 0 : n.map((c) => t.find((f) => f.id === c)).filter(Boolean)) != null ? i : [], u = (l = o == null ? void 0 : o.map((c) => t.find((f) => f.id === c)).filter(Boolean)) != null ? l : [], g = t.filter((c) => !(n != null && n.includes(c.id)) && !(o != null && o.includes(c.id)));
544
- return Q(r, [...a, ...g, ...u], e);
545
- }, v(e.options, D, "getHeaderGroups")), e.getCenterHeaderGroups = C(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (r, t, n, o) => (t = t.filter((i) => !(n != null && n.includes(i.id)) && !(o != null && o.includes(i.id))), Q(r, t, e, "center")), v(e.options, D, "getCenterHeaderGroups")), e.getLeftHeaderGroups = C(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.left], (r, t, n) => {
546
- var o;
547
- const i = (o = n == null ? void 0 : n.map((l) => t.find((a) => a.id === l)).filter(Boolean)) != null ? o : [];
548
- return Q(r, i, e, "left");
549
- }, v(e.options, D, "getLeftHeaderGroups")), e.getRightHeaderGroups = C(() => [e.getAllColumns(), e.getVisibleLeafColumns(), e.getState().columnPinning.right], (r, t, n) => {
550
- var o;
551
- const i = (o = n == null ? void 0 : n.map((l) => t.find((a) => a.id === l)).filter(Boolean)) != null ? o : [];
552
- return Q(r, i, e, "right");
553
- }, v(e.options, D, "getRightHeaderGroups")), e.getFooterGroups = C(() => [e.getHeaderGroups()], (r) => [...r].reverse(), v(e.options, D, "getFooterGroups")), e.getLeftFooterGroups = C(() => [e.getLeftHeaderGroups()], (r) => [...r].reverse(), v(e.options, D, "getLeftFooterGroups")), e.getCenterFooterGroups = C(() => [e.getCenterHeaderGroups()], (r) => [...r].reverse(), v(e.options, D, "getCenterFooterGroups")), e.getRightFooterGroups = C(() => [e.getRightHeaderGroups()], (r) => [...r].reverse(), v(e.options, D, "getRightFooterGroups")), e.getFlatHeaders = C(() => [e.getHeaderGroups()], (r) => r.map((t) => t.headers).flat(), v(e.options, D, "getFlatHeaders")), e.getLeftFlatHeaders = C(() => [e.getLeftHeaderGroups()], (r) => r.map((t) => t.headers).flat(), v(e.options, D, "getLeftFlatHeaders")), e.getCenterFlatHeaders = C(() => [e.getCenterHeaderGroups()], (r) => r.map((t) => t.headers).flat(), v(e.options, D, "getCenterFlatHeaders")), e.getRightFlatHeaders = C(() => [e.getRightHeaderGroups()], (r) => r.map((t) => t.headers).flat(), v(e.options, D, "getRightFlatHeaders")), e.getCenterLeafHeaders = C(() => [e.getCenterFlatHeaders()], (r) => r.filter((t) => {
554
- var n;
555
- return !((n = t.subHeaders) != null && n.length);
556
- }), v(e.options, D, "getCenterLeafHeaders")), e.getLeftLeafHeaders = C(() => [e.getLeftFlatHeaders()], (r) => r.filter((t) => {
557
- var n;
558
- return !((n = t.subHeaders) != null && n.length);
559
- }), v(e.options, D, "getLeftLeafHeaders")), e.getRightLeafHeaders = C(() => [e.getRightFlatHeaders()], (r) => r.filter((t) => {
560
- var n;
561
- return !((n = t.subHeaders) != null && n.length);
562
- }), v(e.options, D, "getRightLeafHeaders")), e.getLeafHeaders = C(() => [e.getLeftHeaderGroups(), e.getCenterHeaderGroups(), e.getRightHeaderGroups()], (r, t, n) => {
563
- var o, i, l, a, u, g;
564
- return [...(o = (i = r[0]) == null ? void 0 : i.headers) != null ? o : [], ...(l = (a = t[0]) == null ? void 0 : a.headers) != null ? l : [], ...(u = (g = n[0]) == null ? void 0 : g.headers) != null ? u : []].map((d) => d.getLeafHeaders()).flat();
565
- }, v(e.options, D, "getLeafHeaders"));
566
- }
567
- };
568
- function Q(e, r, t, n) {
569
- var o, i;
570
- let l = 0;
571
- const a = function(f, s) {
572
- s === void 0 && (s = 1), l = Math.max(l, s), f.filter((m) => m.getIsVisible()).forEach((m) => {
573
- var h;
574
- (h = m.columns) != null && h.length && a(m.columns, s + 1);
575
- }, 0);
576
- };
577
- a(e);
578
- let u = [];
579
- const g = (f, s) => {
580
- const m = {
581
- depth: s,
582
- id: [n, `${s}`].filter(Boolean).join("_"),
583
- headers: []
584
- }, h = [];
585
- f.forEach((S) => {
586
- const R = [...h].reverse()[0], _ = S.column.depth === m.depth;
587
- let $, E = !1;
588
- if (_ && S.column.parent ? $ = S.column.parent : ($ = S.column, E = !0), R && (R == null ? void 0 : R.column) === $)
589
- R.subHeaders.push(S);
590
- else {
591
- const I = Ge(t, $, {
592
- id: [n, s, $.id, S == null ? void 0 : S.id].filter(Boolean).join("_"),
593
- isPlaceholder: E,
594
- placeholderId: E ? `${h.filter((P) => P.column === $).length}` : void 0,
595
- depth: s,
596
- index: h.length
597
- });
598
- I.subHeaders.push(S), h.push(I);
599
- }
600
- m.headers.push(S), S.headerGroup = m;
601
- }), u.push(m), s > 0 && g(h, s - 1);
602
- }, d = r.map((f, s) => Ge(t, f, {
603
- depth: l,
604
- index: s
605
- }));
606
- g(d, l - 1), u.reverse();
607
- const c = (f) => f.filter((m) => m.column.getIsVisible()).map((m) => {
608
- let h = 0, S = 0, R = [0];
609
- m.subHeaders && m.subHeaders.length ? (R = [], c(m.subHeaders).forEach(($) => {
610
- let {
611
- colSpan: E,
612
- rowSpan: I
613
- } = $;
614
- h += E, R.push(I);
615
- })) : h = 1;
616
- const _ = Math.min(...R);
617
- return S = S + _, m.colSpan = h, m.rowSpan = S, {
618
- colSpan: h,
619
- rowSpan: S
620
- };
621
- });
622
- return c((o = (i = u[0]) == null ? void 0 : i.headers) != null ? o : []), u;
623
- }
624
- const _e = (e, r, t, n, o, i, l) => {
625
- let a = {
626
- id: r,
627
- index: n,
628
- original: t,
629
- depth: o,
630
- parentId: l,
631
- _valuesCache: {},
632
- _uniqueValuesCache: {},
633
- getValue: (u) => {
634
- if (a._valuesCache.hasOwnProperty(u))
635
- return a._valuesCache[u];
636
- const g = e.getColumn(u);
637
- if (g != null && g.accessorFn)
638
- return a._valuesCache[u] = g.accessorFn(a.original, n), a._valuesCache[u];
639
- },
640
- getUniqueValues: (u) => {
641
- if (a._uniqueValuesCache.hasOwnProperty(u))
642
- return a._uniqueValuesCache[u];
643
- const g = e.getColumn(u);
644
- if (g != null && g.accessorFn)
645
- return g.columnDef.getUniqueValues ? (a._uniqueValuesCache[u] = g.columnDef.getUniqueValues(a.original, n), a._uniqueValuesCache[u]) : (a._uniqueValuesCache[u] = [a.getValue(u)], a._uniqueValuesCache[u]);
646
- },
647
- renderValue: (u) => {
648
- var g;
649
- return (g = a.getValue(u)) != null ? g : e.options.renderFallbackValue;
650
- },
651
- subRows: [],
652
- getLeafRows: () => vt(a.subRows, (u) => u.subRows),
653
- getParentRow: () => a.parentId ? e.getRow(a.parentId, !0) : void 0,
654
- getParentRows: () => {
655
- let u = [], g = a;
656
- for (; ; ) {
657
- const d = g.getParentRow();
658
- if (!d) break;
659
- u.push(d), g = d;
660
- }
661
- return u.reverse();
662
- },
663
- getAllCells: C(() => [e.getAllLeafColumns()], (u) => u.map((g) => Rt(e, a, g, g.id)), v(e.options, "debugRows", "getAllCells")),
664
- _getAllCellsByColumnId: C(() => [a.getAllCells()], (u) => u.reduce((g, d) => (g[d.column.id] = d, g), {}), v(e.options, "debugRows", "getAllCellsByColumnId"))
665
- };
666
- for (let u = 0; u < e._features.length; u++) {
667
- const g = e._features[u];
668
- g == null || g.createRow == null || g.createRow(a, e);
669
- }
670
- return a;
671
- }, _t = {
672
- createColumn: (e, r) => {
673
- e._getFacetedRowModel = r.options.getFacetedRowModel && r.options.getFacetedRowModel(r, e.id), e.getFacetedRowModel = () => e._getFacetedRowModel ? e._getFacetedRowModel() : r.getPreFilteredRowModel(), e._getFacetedUniqueValues = r.options.getFacetedUniqueValues && r.options.getFacetedUniqueValues(r, e.id), e.getFacetedUniqueValues = () => e._getFacetedUniqueValues ? e._getFacetedUniqueValues() : /* @__PURE__ */ new Map(), e._getFacetedMinMaxValues = r.options.getFacetedMinMaxValues && r.options.getFacetedMinMaxValues(r, e.id), e.getFacetedMinMaxValues = () => {
674
- if (e._getFacetedMinMaxValues)
675
- return e._getFacetedMinMaxValues();
676
- };
677
- }
678
- }, Be = (e, r, t) => {
679
- var n, o;
680
- const i = t == null || (n = t.toString()) == null ? void 0 : n.toLowerCase();
681
- return !!(!((o = e.getValue(r)) == null || (o = o.toString()) == null || (o = o.toLowerCase()) == null) && o.includes(i));
682
- };
683
- Be.autoRemove = (e) => z(e);
684
- const Te = (e, r, t) => {
685
- var n;
686
- return !!(!((n = e.getValue(r)) == null || (n = n.toString()) == null) && n.includes(t));
687
- };
688
- Te.autoRemove = (e) => z(e);
689
- const je = (e, r, t) => {
690
- var n;
691
- return ((n = e.getValue(r)) == null || (n = n.toString()) == null ? void 0 : n.toLowerCase()) === (t == null ? void 0 : t.toLowerCase());
692
- };
693
- je.autoRemove = (e) => z(e);
694
- const qe = (e, r, t) => {
695
- var n;
696
- return (n = e.getValue(r)) == null ? void 0 : n.includes(t);
697
- };
698
- qe.autoRemove = (e) => z(e);
699
- const Ke = (e, r, t) => !t.some((n) => {
700
- var o;
701
- return !((o = e.getValue(r)) != null && o.includes(n));
702
- });
703
- Ke.autoRemove = (e) => z(e) || !(e != null && e.length);
704
- const Ue = (e, r, t) => t.some((n) => {
705
- var o;
706
- return (o = e.getValue(r)) == null ? void 0 : o.includes(n);
707
- });
708
- Ue.autoRemove = (e) => z(e) || !(e != null && e.length);
709
- const Xe = (e, r, t) => e.getValue(r) === t;
710
- Xe.autoRemove = (e) => z(e);
711
- const We = (e, r, t) => e.getValue(r) == t;
712
- We.autoRemove = (e) => z(e);
713
- const Fe = (e, r, t) => {
714
- let [n, o] = t;
715
- const i = e.getValue(r);
716
- return i >= n && i <= o;
717
- };
718
- Fe.resolveFilterValue = (e) => {
719
- let [r, t] = e, n = typeof r != "number" ? parseFloat(r) : r, o = typeof t != "number" ? parseFloat(t) : t, i = r === null || Number.isNaN(n) ? -1 / 0 : n, l = t === null || Number.isNaN(o) ? 1 / 0 : o;
720
- if (i > l) {
721
- const a = i;
722
- i = l, l = a;
723
- }
724
- return [i, l];
725
- };
726
- Fe.autoRemove = (e) => z(e) || z(e[0]) && z(e[1]);
727
- const k = {
728
- includesString: Be,
729
- includesStringSensitive: Te,
730
- equalsString: je,
731
- arrIncludes: qe,
732
- arrIncludesAll: Ke,
733
- arrIncludesSome: Ue,
734
- equals: Xe,
735
- weakEquals: We,
736
- inNumberRange: Fe
737
- };
738
- function z(e) {
739
- return e == null || e === "";
740
- }
741
- const Ft = {
742
- getDefaultColumnDef: () => ({
743
- filterFn: "auto"
744
- }),
745
- getInitialState: (e) => ({
746
- columnFilters: [],
747
- ...e
748
- }),
749
- getDefaultOptions: (e) => ({
750
- onColumnFiltersChange: A("columnFilters", e),
751
- filterFromLeafRows: !1,
752
- maxLeafRowFilterDepth: 100
753
- }),
754
- createColumn: (e, r) => {
755
- e.getAutoFilterFn = () => {
756
- const t = r.getCoreRowModel().flatRows[0], n = t == null ? void 0 : t.getValue(e.id);
757
- return typeof n == "string" ? k.includesString : typeof n == "number" ? k.inNumberRange : typeof n == "boolean" || n !== null && typeof n == "object" ? k.equals : Array.isArray(n) ? k.arrIncludes : k.weakEquals;
758
- }, e.getFilterFn = () => {
759
- var t, n;
760
- return re(e.columnDef.filterFn) ? e.columnDef.filterFn : e.columnDef.filterFn === "auto" ? e.getAutoFilterFn() : (
761
- // @ts-ignore
762
- (t = (n = r.options.filterFns) == null ? void 0 : n[e.columnDef.filterFn]) != null ? t : k[e.columnDef.filterFn]
763
- );
764
- }, e.getCanFilter = () => {
765
- var t, n, o;
766
- return ((t = e.columnDef.enableColumnFilter) != null ? t : !0) && ((n = r.options.enableColumnFilters) != null ? n : !0) && ((o = r.options.enableFilters) != null ? o : !0) && !!e.accessorFn;
767
- }, e.getIsFiltered = () => e.getFilterIndex() > -1, e.getFilterValue = () => {
768
- var t;
769
- return (t = r.getState().columnFilters) == null || (t = t.find((n) => n.id === e.id)) == null ? void 0 : t.value;
770
- }, e.getFilterIndex = () => {
771
- var t, n;
772
- return (t = (n = r.getState().columnFilters) == null ? void 0 : n.findIndex((o) => o.id === e.id)) != null ? t : -1;
773
- }, e.setFilterValue = (t) => {
774
- r.setColumnFilters((n) => {
775
- const o = e.getFilterFn(), i = n == null ? void 0 : n.find((d) => d.id === e.id), l = T(t, i ? i.value : void 0);
776
- if (Ae(o, l, e)) {
777
- var a;
778
- return (a = n == null ? void 0 : n.filter((d) => d.id !== e.id)) != null ? a : [];
779
- }
780
- const u = {
781
- id: e.id,
782
- value: l
783
- };
784
- if (i) {
785
- var g;
786
- return (g = n == null ? void 0 : n.map((d) => d.id === e.id ? u : d)) != null ? g : [];
787
- }
788
- return n != null && n.length ? [...n, u] : [u];
789
- });
790
- };
791
- },
792
- createRow: (e, r) => {
793
- e.columnFilters = {}, e.columnFiltersMeta = {};
794
- },
795
- createTable: (e) => {
796
- e.setColumnFilters = (r) => {
797
- const t = e.getAllLeafColumns(), n = (o) => {
798
- var i;
799
- return (i = T(r, o)) == null ? void 0 : i.filter((l) => {
800
- const a = t.find((u) => u.id === l.id);
801
- if (a) {
802
- const u = a.getFilterFn();
803
- if (Ae(u, l.value, a))
804
- return !1;
805
- }
806
- return !0;
807
- });
808
- };
809
- e.options.onColumnFiltersChange == null || e.options.onColumnFiltersChange(n);
810
- }, e.resetColumnFilters = (r) => {
811
- var t, n;
812
- e.setColumnFilters(r ? [] : (t = (n = e.initialState) == null ? void 0 : n.columnFilters) != null ? t : []);
813
- }, e.getPreFilteredRowModel = () => e.getCoreRowModel(), e.getFilteredRowModel = () => (!e._getFilteredRowModel && e.options.getFilteredRowModel && (e._getFilteredRowModel = e.options.getFilteredRowModel(e)), e.options.manualFiltering || !e._getFilteredRowModel ? e.getPreFilteredRowModel() : e._getFilteredRowModel());
814
- }
815
- };
816
- function Ae(e, r, t) {
817
- return (e && e.autoRemove ? e.autoRemove(r, t) : !1) || typeof r > "u" || typeof r == "string" && !r;
818
- }
819
- const $t = (e, r, t) => t.reduce((n, o) => {
820
- const i = o.getValue(e);
821
- return n + (typeof i == "number" ? i : 0);
822
- }, 0), It = (e, r, t) => {
823
- let n;
824
- return t.forEach((o) => {
825
- const i = o.getValue(e);
826
- i != null && (n > i || n === void 0 && i >= i) && (n = i);
827
- }), n;
828
- }, Mt = (e, r, t) => {
829
- let n;
830
- return t.forEach((o) => {
831
- const i = o.getValue(e);
832
- i != null && (n < i || n === void 0 && i >= i) && (n = i);
833
- }), n;
834
- }, Vt = (e, r, t) => {
835
- let n, o;
836
- return t.forEach((i) => {
837
- const l = i.getValue(e);
838
- l != null && (n === void 0 ? l >= l && (n = o = l) : (n > l && (n = l), o < l && (o = l)));
839
- }), [n, o];
840
- }, Pt = (e, r) => {
841
- let t = 0, n = 0;
842
- if (r.forEach((o) => {
843
- let i = o.getValue(e);
844
- i != null && (i = +i) >= i && (++t, n += i);
845
- }), t) return n / t;
846
- }, Nt = (e, r) => {
847
- if (!r.length)
848
- return;
849
- const t = r.map((i) => i.getValue(e));
850
- if (!Ct(t))
851
- return;
852
- if (t.length === 1)
853
- return t[0];
854
- const n = Math.floor(t.length / 2), o = t.sort((i, l) => i - l);
855
- return t.length % 2 !== 0 ? o[n] : (o[n - 1] + o[n]) / 2;
856
- }, Dt = (e, r) => Array.from(new Set(r.map((t) => t.getValue(e))).values()), Lt = (e, r) => new Set(r.map((t) => t.getValue(e))).size, Et = (e, r) => r.length, le = {
857
- sum: $t,
858
- min: It,
859
- max: Mt,
860
- extent: Vt,
861
- mean: Pt,
862
- median: Nt,
863
- unique: Dt,
864
- uniqueCount: Lt,
865
- count: Et
866
- }, Ht = {
867
- getDefaultColumnDef: () => ({
868
- aggregatedCell: (e) => {
869
- var r, t;
870
- return (r = (t = e.getValue()) == null || t.toString == null ? void 0 : t.toString()) != null ? r : null;
871
- },
872
- aggregationFn: "auto"
873
- }),
874
- getInitialState: (e) => ({
875
- grouping: [],
876
- ...e
877
- }),
878
- getDefaultOptions: (e) => ({
879
- onGroupingChange: A("grouping", e),
880
- groupedColumnMode: "reorder"
881
- }),
882
- createColumn: (e, r) => {
883
- e.toggleGrouping = () => {
884
- r.setGrouping((t) => t != null && t.includes(e.id) ? t.filter((n) => n !== e.id) : [...t ?? [], e.id]);
885
- }, e.getCanGroup = () => {
886
- var t, n;
887
- return ((t = e.columnDef.enableGrouping) != null ? t : !0) && ((n = r.options.enableGrouping) != null ? n : !0) && (!!e.accessorFn || !!e.columnDef.getGroupingValue);
888
- }, e.getIsGrouped = () => {
889
- var t;
890
- return (t = r.getState().grouping) == null ? void 0 : t.includes(e.id);
891
- }, e.getGroupedIndex = () => {
892
- var t;
893
- return (t = r.getState().grouping) == null ? void 0 : t.indexOf(e.id);
894
- }, e.getToggleGroupingHandler = () => {
895
- const t = e.getCanGroup();
896
- return () => {
897
- t && e.toggleGrouping();
898
- };
899
- }, e.getAutoAggregationFn = () => {
900
- const t = r.getCoreRowModel().flatRows[0], n = t == null ? void 0 : t.getValue(e.id);
901
- if (typeof n == "number")
902
- return le.sum;
903
- if (Object.prototype.toString.call(n) === "[object Date]")
904
- return le.extent;
905
- }, e.getAggregationFn = () => {
906
- var t, n;
907
- if (!e)
908
- throw new Error();
909
- return re(e.columnDef.aggregationFn) ? e.columnDef.aggregationFn : e.columnDef.aggregationFn === "auto" ? e.getAutoAggregationFn() : (t = (n = r.options.aggregationFns) == null ? void 0 : n[e.columnDef.aggregationFn]) != null ? t : le[e.columnDef.aggregationFn];
910
- };
911
- },
912
- createTable: (e) => {
913
- e.setGrouping = (r) => e.options.onGroupingChange == null ? void 0 : e.options.onGroupingChange(r), e.resetGrouping = (r) => {
914
- var t, n;
915
- e.setGrouping(r ? [] : (t = (n = e.initialState) == null ? void 0 : n.grouping) != null ? t : []);
916
- }, e.getPreGroupedRowModel = () => e.getFilteredRowModel(), e.getGroupedRowModel = () => (!e._getGroupedRowModel && e.options.getGroupedRowModel && (e._getGroupedRowModel = e.options.getGroupedRowModel(e)), e.options.manualGrouping || !e._getGroupedRowModel ? e.getPreGroupedRowModel() : e._getGroupedRowModel());
917
- },
918
- createRow: (e, r) => {
919
- e.getIsGrouped = () => !!e.groupingColumnId, e.getGroupingValue = (t) => {
920
- if (e._groupingValuesCache.hasOwnProperty(t))
921
- return e._groupingValuesCache[t];
922
- const n = r.getColumn(t);
923
- return n != null && n.columnDef.getGroupingValue ? (e._groupingValuesCache[t] = n.columnDef.getGroupingValue(e.original), e._groupingValuesCache[t]) : e.getValue(t);
924
- }, e._groupingValuesCache = {};
925
- },
926
- createCell: (e, r, t, n) => {
927
- e.getIsGrouped = () => r.getIsGrouped() && r.id === t.groupingColumnId, e.getIsPlaceholder = () => !e.getIsGrouped() && r.getIsGrouped(), e.getIsAggregated = () => {
928
- var o;
929
- return !e.getIsGrouped() && !e.getIsPlaceholder() && !!((o = t.subRows) != null && o.length);
930
- };
931
- }
932
- };
933
- function Gt(e, r, t) {
934
- if (!(r != null && r.length) || !t)
935
- return e;
936
- const n = e.filter((i) => !r.includes(i.id));
937
- return t === "remove" ? n : [...r.map((i) => e.find((l) => l.id === i)).filter(Boolean), ...n];
938
- }
939
- const At = {
940
- getInitialState: (e) => ({
941
- columnOrder: [],
942
- ...e
943
- }),
944
- getDefaultOptions: (e) => ({
945
- onColumnOrderChange: A("columnOrder", e)
946
- }),
947
- createColumn: (e, r) => {
948
- e.getIndex = C((t) => [J(r, t)], (t) => t.findIndex((n) => n.id === e.id), v(r.options, "debugColumns", "getIndex")), e.getIsFirstColumn = (t) => {
949
- var n;
950
- return ((n = J(r, t)[0]) == null ? void 0 : n.id) === e.id;
951
- }, e.getIsLastColumn = (t) => {
952
- var n;
953
- const o = J(r, t);
954
- return ((n = o[o.length - 1]) == null ? void 0 : n.id) === e.id;
955
- };
956
- },
957
- createTable: (e) => {
958
- e.setColumnOrder = (r) => e.options.onColumnOrderChange == null ? void 0 : e.options.onColumnOrderChange(r), e.resetColumnOrder = (r) => {
959
- var t;
960
- e.setColumnOrder(r ? [] : (t = e.initialState.columnOrder) != null ? t : []);
961
- }, e._getOrderColumnsFn = C(() => [e.getState().columnOrder, e.getState().grouping, e.options.groupedColumnMode], (r, t, n) => (o) => {
962
- let i = [];
963
- if (!(r != null && r.length))
964
- i = o;
965
- else {
966
- const l = [...r], a = [...o];
967
- for (; a.length && l.length; ) {
968
- const u = l.shift(), g = a.findIndex((d) => d.id === u);
969
- g > -1 && i.push(a.splice(g, 1)[0]);
970
- }
971
- i = [...i, ...a];
972
- }
973
- return Gt(i, t, n);
974
- }, v(e.options, "debugTable", "_getOrderColumnsFn"));
975
- }
976
- }, se = () => ({
977
- left: [],
978
- right: []
979
- }), zt = {
980
- getInitialState: (e) => ({
981
- columnPinning: se(),
982
- ...e
983
- }),
984
- getDefaultOptions: (e) => ({
985
- onColumnPinningChange: A("columnPinning", e)
986
- }),
987
- createColumn: (e, r) => {
988
- e.pin = (t) => {
989
- const n = e.getLeafColumns().map((o) => o.id).filter(Boolean);
990
- r.setColumnPinning((o) => {
991
- var i, l;
992
- if (t === "right") {
993
- var a, u;
994
- return {
995
- left: ((a = o == null ? void 0 : o.left) != null ? a : []).filter((c) => !(n != null && n.includes(c))),
996
- right: [...((u = o == null ? void 0 : o.right) != null ? u : []).filter((c) => !(n != null && n.includes(c))), ...n]
997
- };
998
- }
999
- if (t === "left") {
1000
- var g, d;
1001
- return {
1002
- left: [...((g = o == null ? void 0 : o.left) != null ? g : []).filter((c) => !(n != null && n.includes(c))), ...n],
1003
- right: ((d = o == null ? void 0 : o.right) != null ? d : []).filter((c) => !(n != null && n.includes(c)))
1004
- };
1005
- }
1006
- return {
1007
- left: ((i = o == null ? void 0 : o.left) != null ? i : []).filter((c) => !(n != null && n.includes(c))),
1008
- right: ((l = o == null ? void 0 : o.right) != null ? l : []).filter((c) => !(n != null && n.includes(c)))
1009
- };
1010
- });
1011
- }, e.getCanPin = () => e.getLeafColumns().some((n) => {
1012
- var o, i, l;
1013
- return ((o = n.columnDef.enablePinning) != null ? o : !0) && ((i = (l = r.options.enableColumnPinning) != null ? l : r.options.enablePinning) != null ? i : !0);
1014
- }), e.getIsPinned = () => {
1015
- const t = e.getLeafColumns().map((a) => a.id), {
1016
- left: n,
1017
- right: o
1018
- } = r.getState().columnPinning, i = t.some((a) => n == null ? void 0 : n.includes(a)), l = t.some((a) => o == null ? void 0 : o.includes(a));
1019
- return i ? "left" : l ? "right" : !1;
1020
- }, e.getPinnedIndex = () => {
1021
- var t, n;
1022
- const o = e.getIsPinned();
1023
- return o ? (t = (n = r.getState().columnPinning) == null || (n = n[o]) == null ? void 0 : n.indexOf(e.id)) != null ? t : -1 : 0;
1024
- };
1025
- },
1026
- createRow: (e, r) => {
1027
- e.getCenterVisibleCells = C(() => [e._getAllVisibleCells(), r.getState().columnPinning.left, r.getState().columnPinning.right], (t, n, o) => {
1028
- const i = [...n ?? [], ...o ?? []];
1029
- return t.filter((l) => !i.includes(l.column.id));
1030
- }, v(r.options, "debugRows", "getCenterVisibleCells")), e.getLeftVisibleCells = C(() => [e._getAllVisibleCells(), r.getState().columnPinning.left], (t, n) => (n ?? []).map((i) => t.find((l) => l.column.id === i)).filter(Boolean).map((i) => ({
1031
- ...i,
1032
- position: "left"
1033
- })), v(r.options, "debugRows", "getLeftVisibleCells")), e.getRightVisibleCells = C(() => [e._getAllVisibleCells(), r.getState().columnPinning.right], (t, n) => (n ?? []).map((i) => t.find((l) => l.column.id === i)).filter(Boolean).map((i) => ({
1034
- ...i,
1035
- position: "right"
1036
- })), v(r.options, "debugRows", "getRightVisibleCells"));
1037
- },
1038
- createTable: (e) => {
1039
- e.setColumnPinning = (r) => e.options.onColumnPinningChange == null ? void 0 : e.options.onColumnPinningChange(r), e.resetColumnPinning = (r) => {
1040
- var t, n;
1041
- return e.setColumnPinning(r ? se() : (t = (n = e.initialState) == null ? void 0 : n.columnPinning) != null ? t : se());
1042
- }, e.getIsSomeColumnsPinned = (r) => {
1043
- var t;
1044
- const n = e.getState().columnPinning;
1045
- if (!r) {
1046
- var o, i;
1047
- return !!((o = n.left) != null && o.length || (i = n.right) != null && i.length);
1048
- }
1049
- return !!((t = n[r]) != null && t.length);
1050
- }, e.getLeftLeafColumns = C(() => [e.getAllLeafColumns(), e.getState().columnPinning.left], (r, t) => (t ?? []).map((n) => r.find((o) => o.id === n)).filter(Boolean), v(e.options, "debugColumns", "getLeftLeafColumns")), e.getRightLeafColumns = C(() => [e.getAllLeafColumns(), e.getState().columnPinning.right], (r, t) => (t ?? []).map((n) => r.find((o) => o.id === n)).filter(Boolean), v(e.options, "debugColumns", "getRightLeafColumns")), e.getCenterLeafColumns = C(() => [e.getAllLeafColumns(), e.getState().columnPinning.left, e.getState().columnPinning.right], (r, t, n) => {
1051
- const o = [...t ?? [], ...n ?? []];
1052
- return r.filter((i) => !o.includes(i.id));
1053
- }, v(e.options, "debugColumns", "getCenterLeafColumns"));
1054
- }
1055
- };
1056
- function kt(e) {
1057
- return e || (typeof document < "u" ? document : null);
1058
- }
1059
- const ee = {
1060
- size: 150,
1061
- minSize: 20,
1062
- maxSize: Number.MAX_SAFE_INTEGER
1063
- }, ae = () => ({
1064
- startOffset: null,
1065
- startSize: null,
1066
- deltaOffset: null,
1067
- deltaPercentage: null,
1068
- isResizingColumn: !1,
1069
- columnSizingStart: []
1070
- }), bt = {
1071
- getDefaultColumnDef: () => ee,
1072
- getInitialState: (e) => ({
1073
- columnSizing: {},
1074
- columnSizingInfo: ae(),
1075
- ...e
1076
- }),
1077
- getDefaultOptions: (e) => ({
1078
- columnResizeMode: "onEnd",
1079
- columnResizeDirection: "ltr",
1080
- onColumnSizingChange: A("columnSizing", e),
1081
- onColumnSizingInfoChange: A("columnSizingInfo", e)
1082
- }),
1083
- createColumn: (e, r) => {
1084
- e.getSize = () => {
1085
- var t, n, o;
1086
- const i = r.getState().columnSizing[e.id];
1087
- return Math.min(Math.max((t = e.columnDef.minSize) != null ? t : ee.minSize, (n = i ?? e.columnDef.size) != null ? n : ee.size), (o = e.columnDef.maxSize) != null ? o : ee.maxSize);
1088
- }, e.getStart = C((t) => [t, J(r, t), r.getState().columnSizing], (t, n) => n.slice(0, e.getIndex(t)).reduce((o, i) => o + i.getSize(), 0), v(r.options, "debugColumns", "getStart")), e.getAfter = C((t) => [t, J(r, t), r.getState().columnSizing], (t, n) => n.slice(e.getIndex(t) + 1).reduce((o, i) => o + i.getSize(), 0), v(r.options, "debugColumns", "getAfter")), e.resetSize = () => {
1089
- r.setColumnSizing((t) => {
1090
- let {
1091
- [e.id]: n,
1092
- ...o
1093
- } = t;
1094
- return o;
1095
- });
1096
- }, e.getCanResize = () => {
1097
- var t, n;
1098
- return ((t = e.columnDef.enableResizing) != null ? t : !0) && ((n = r.options.enableColumnResizing) != null ? n : !0);
1099
- }, e.getIsResizing = () => r.getState().columnSizingInfo.isResizingColumn === e.id;
1100
- },
1101
- createHeader: (e, r) => {
1102
- e.getSize = () => {
1103
- let t = 0;
1104
- const n = (o) => {
1105
- if (o.subHeaders.length)
1106
- o.subHeaders.forEach(n);
1107
- else {
1108
- var i;
1109
- t += (i = o.column.getSize()) != null ? i : 0;
1110
- }
1111
- };
1112
- return n(e), t;
1113
- }, e.getStart = () => {
1114
- if (e.index > 0) {
1115
- const t = e.headerGroup.headers[e.index - 1];
1116
- return t.getStart() + t.getSize();
1117
- }
1118
- return 0;
1119
- }, e.getResizeHandler = (t) => {
1120
- const n = r.getColumn(e.column.id), o = n == null ? void 0 : n.getCanResize();
1121
- return (i) => {
1122
- if (!n || !o || (i.persist == null || i.persist(), ue(i) && i.touches && i.touches.length > 1))
1123
- return;
1124
- const l = e.getSize(), a = e ? e.getLeafHeaders().map((R) => [R.column.id, R.column.getSize()]) : [[n.id, n.getSize()]], u = ue(i) ? Math.round(i.touches[0].clientX) : i.clientX, g = {}, d = (R, _) => {
1125
- typeof _ == "number" && (r.setColumnSizingInfo(($) => {
1126
- var E, I;
1127
- const P = r.options.columnResizeDirection === "rtl" ? -1 : 1, q = (_ - ((E = $ == null ? void 0 : $.startOffset) != null ? E : 0)) * P, N = Math.max(q / ((I = $ == null ? void 0 : $.startSize) != null ? I : 0), -0.999999);
1128
- return $.columnSizingStart.forEach((x) => {
1129
- let [y, V] = x;
1130
- g[y] = Math.round(Math.max(V + V * N, 0) * 100) / 100;
1131
- }), {
1132
- ...$,
1133
- deltaOffset: q,
1134
- deltaPercentage: N
1135
- };
1136
- }), (r.options.columnResizeMode === "onChange" || R === "end") && r.setColumnSizing(($) => ({
1137
- ...$,
1138
- ...g
1139
- })));
1140
- }, c = (R) => d("move", R), f = (R) => {
1141
- d("end", R), r.setColumnSizingInfo((_) => ({
1142
- ..._,
1143
- isResizingColumn: !1,
1144
- startOffset: null,
1145
- startSize: null,
1146
- deltaOffset: null,
1147
- deltaPercentage: null,
1148
- columnSizingStart: []
1149
- }));
1150
- }, s = kt(t), m = {
1151
- moveHandler: (R) => c(R.clientX),
1152
- upHandler: (R) => {
1153
- s == null || s.removeEventListener("mousemove", m.moveHandler), s == null || s.removeEventListener("mouseup", m.upHandler), f(R.clientX);
1154
- }
1155
- }, h = {
1156
- moveHandler: (R) => (R.cancelable && (R.preventDefault(), R.stopPropagation()), c(R.touches[0].clientX), !1),
1157
- upHandler: (R) => {
1158
- var _;
1159
- s == null || s.removeEventListener("touchmove", h.moveHandler), s == null || s.removeEventListener("touchend", h.upHandler), R.cancelable && (R.preventDefault(), R.stopPropagation()), f((_ = R.touches[0]) == null ? void 0 : _.clientX);
1160
- }
1161
- }, S = Ot() ? {
1162
- passive: !1
1163
- } : !1;
1164
- ue(i) ? (s == null || s.addEventListener("touchmove", h.moveHandler, S), s == null || s.addEventListener("touchend", h.upHandler, S)) : (s == null || s.addEventListener("mousemove", m.moveHandler, S), s == null || s.addEventListener("mouseup", m.upHandler, S)), r.setColumnSizingInfo((R) => ({
1165
- ...R,
1166
- startOffset: u,
1167
- startSize: l,
1168
- deltaOffset: 0,
1169
- deltaPercentage: 0,
1170
- columnSizingStart: a,
1171
- isResizingColumn: n.id
1172
- }));
1173
- };
1174
- };
1175
- },
1176
- createTable: (e) => {
1177
- e.setColumnSizing = (r) => e.options.onColumnSizingChange == null ? void 0 : e.options.onColumnSizingChange(r), e.setColumnSizingInfo = (r) => e.options.onColumnSizingInfoChange == null ? void 0 : e.options.onColumnSizingInfoChange(r), e.resetColumnSizing = (r) => {
1178
- var t;
1179
- e.setColumnSizing(r ? {} : (t = e.initialState.columnSizing) != null ? t : {});
1180
- }, e.resetHeaderSizeInfo = (r) => {
1181
- var t;
1182
- e.setColumnSizingInfo(r ? ae() : (t = e.initialState.columnSizingInfo) != null ? t : ae());
1183
- }, e.getTotalSize = () => {
1184
- var r, t;
1185
- return (r = (t = e.getHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, o) => n + o.getSize(), 0)) != null ? r : 0;
1186
- }, e.getLeftTotalSize = () => {
1187
- var r, t;
1188
- return (r = (t = e.getLeftHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, o) => n + o.getSize(), 0)) != null ? r : 0;
1189
- }, e.getCenterTotalSize = () => {
1190
- var r, t;
1191
- return (r = (t = e.getCenterHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, o) => n + o.getSize(), 0)) != null ? r : 0;
1192
- }, e.getRightTotalSize = () => {
1193
- var r, t;
1194
- return (r = (t = e.getRightHeaderGroups()[0]) == null ? void 0 : t.headers.reduce((n, o) => n + o.getSize(), 0)) != null ? r : 0;
1195
- };
1196
- }
1197
- };
1198
- let te = null;
1199
- function Ot() {
1200
- if (typeof te == "boolean") return te;
1201
- let e = !1;
1202
- try {
1203
- const r = {
1204
- get passive() {
1205
- return e = !0, !1;
1206
- }
1207
- }, t = () => {
1208
- };
1209
- window.addEventListener("test", t, r), window.removeEventListener("test", t);
1210
- } catch {
1211
- e = !1;
1212
- }
1213
- return te = e, te;
1214
- }
1215
- function ue(e) {
1216
- return e.type === "touchstart";
1217
- }
1218
- const Bt = {
1219
- getInitialState: (e) => ({
1220
- columnVisibility: {},
1221
- ...e
1222
- }),
1223
- getDefaultOptions: (e) => ({
1224
- onColumnVisibilityChange: A("columnVisibility", e)
1225
- }),
1226
- createColumn: (e, r) => {
1227
- e.toggleVisibility = (t) => {
1228
- e.getCanHide() && r.setColumnVisibility((n) => ({
1229
- ...n,
1230
- [e.id]: t ?? !e.getIsVisible()
1231
- }));
1232
- }, e.getIsVisible = () => {
1233
- var t, n;
1234
- const o = e.columns;
1235
- return (t = o.length ? o.some((i) => i.getIsVisible()) : (n = r.getState().columnVisibility) == null ? void 0 : n[e.id]) != null ? t : !0;
1236
- }, e.getCanHide = () => {
1237
- var t, n;
1238
- return ((t = e.columnDef.enableHiding) != null ? t : !0) && ((n = r.options.enableHiding) != null ? n : !0);
1239
- }, e.getToggleVisibilityHandler = () => (t) => {
1240
- e.toggleVisibility == null || e.toggleVisibility(t.target.checked);
1241
- };
1242
- },
1243
- createRow: (e, r) => {
1244
- e._getAllVisibleCells = C(() => [e.getAllCells(), r.getState().columnVisibility], (t) => t.filter((n) => n.column.getIsVisible()), v(r.options, "debugRows", "_getAllVisibleCells")), e.getVisibleCells = C(() => [e.getLeftVisibleCells(), e.getCenterVisibleCells(), e.getRightVisibleCells()], (t, n, o) => [...t, ...n, ...o], v(r.options, "debugRows", "getVisibleCells"));
1245
- },
1246
- createTable: (e) => {
1247
- const r = (t, n) => C(() => [n(), n().filter((o) => o.getIsVisible()).map((o) => o.id).join("_")], (o) => o.filter((i) => i.getIsVisible == null ? void 0 : i.getIsVisible()), v(e.options, "debugColumns", t));
1248
- e.getVisibleFlatColumns = r("getVisibleFlatColumns", () => e.getAllFlatColumns()), e.getVisibleLeafColumns = r("getVisibleLeafColumns", () => e.getAllLeafColumns()), e.getLeftVisibleLeafColumns = r("getLeftVisibleLeafColumns", () => e.getLeftLeafColumns()), e.getRightVisibleLeafColumns = r("getRightVisibleLeafColumns", () => e.getRightLeafColumns()), e.getCenterVisibleLeafColumns = r("getCenterVisibleLeafColumns", () => e.getCenterLeafColumns()), e.setColumnVisibility = (t) => e.options.onColumnVisibilityChange == null ? void 0 : e.options.onColumnVisibilityChange(t), e.resetColumnVisibility = (t) => {
1249
- var n;
1250
- e.setColumnVisibility(t ? {} : (n = e.initialState.columnVisibility) != null ? n : {});
1251
- }, e.toggleAllColumnsVisible = (t) => {
1252
- var n;
1253
- t = (n = t) != null ? n : !e.getIsAllColumnsVisible(), e.setColumnVisibility(e.getAllLeafColumns().reduce((o, i) => ({
1254
- ...o,
1255
- [i.id]: t || !(i.getCanHide != null && i.getCanHide())
1256
- }), {}));
1257
- }, e.getIsAllColumnsVisible = () => !e.getAllLeafColumns().some((t) => !(t.getIsVisible != null && t.getIsVisible())), e.getIsSomeColumnsVisible = () => e.getAllLeafColumns().some((t) => t.getIsVisible == null ? void 0 : t.getIsVisible()), e.getToggleAllColumnsVisibilityHandler = () => (t) => {
1258
- var n;
1259
- e.toggleAllColumnsVisible((n = t.target) == null ? void 0 : n.checked);
1260
- };
1261
- }
1262
- };
1263
- function J(e, r) {
1264
- return r ? r === "center" ? e.getCenterVisibleLeafColumns() : r === "left" ? e.getLeftVisibleLeafColumns() : e.getRightVisibleLeafColumns() : e.getVisibleLeafColumns();
1265
- }
1266
- const Tt = {
1267
- createTable: (e) => {
1268
- e._getGlobalFacetedRowModel = e.options.getFacetedRowModel && e.options.getFacetedRowModel(e, "__global__"), e.getGlobalFacetedRowModel = () => e.options.manualFiltering || !e._getGlobalFacetedRowModel ? e.getPreFilteredRowModel() : e._getGlobalFacetedRowModel(), e._getGlobalFacetedUniqueValues = e.options.getFacetedUniqueValues && e.options.getFacetedUniqueValues(e, "__global__"), e.getGlobalFacetedUniqueValues = () => e._getGlobalFacetedUniqueValues ? e._getGlobalFacetedUniqueValues() : /* @__PURE__ */ new Map(), e._getGlobalFacetedMinMaxValues = e.options.getFacetedMinMaxValues && e.options.getFacetedMinMaxValues(e, "__global__"), e.getGlobalFacetedMinMaxValues = () => {
1269
- if (e._getGlobalFacetedMinMaxValues)
1270
- return e._getGlobalFacetedMinMaxValues();
1271
- };
1272
- }
1273
- }, jt = {
1274
- getInitialState: (e) => ({
1275
- globalFilter: void 0,
1276
- ...e
1277
- }),
1278
- getDefaultOptions: (e) => ({
1279
- onGlobalFilterChange: A("globalFilter", e),
1280
- globalFilterFn: "auto",
1281
- getColumnCanGlobalFilter: (r) => {
1282
- var t;
1283
- const n = (t = e.getCoreRowModel().flatRows[0]) == null || (t = t._getAllCellsByColumnId()[r.id]) == null ? void 0 : t.getValue();
1284
- return typeof n == "string" || typeof n == "number";
1285
- }
1286
- }),
1287
- createColumn: (e, r) => {
1288
- e.getCanGlobalFilter = () => {
1289
- var t, n, o, i;
1290
- return ((t = e.columnDef.enableGlobalFilter) != null ? t : !0) && ((n = r.options.enableGlobalFilter) != null ? n : !0) && ((o = r.options.enableFilters) != null ? o : !0) && ((i = r.options.getColumnCanGlobalFilter == null ? void 0 : r.options.getColumnCanGlobalFilter(e)) != null ? i : !0) && !!e.accessorFn;
1291
- };
1292
- },
1293
- createTable: (e) => {
1294
- e.getGlobalAutoFilterFn = () => k.includesString, e.getGlobalFilterFn = () => {
1295
- var r, t;
1296
- const {
1297
- globalFilterFn: n
1298
- } = e.options;
1299
- return re(n) ? n : n === "auto" ? e.getGlobalAutoFilterFn() : (r = (t = e.options.filterFns) == null ? void 0 : t[n]) != null ? r : k[n];
1300
- }, e.setGlobalFilter = (r) => {
1301
- e.options.onGlobalFilterChange == null || e.options.onGlobalFilterChange(r);
1302
- }, e.resetGlobalFilter = (r) => {
1303
- e.setGlobalFilter(r ? void 0 : e.initialState.globalFilter);
1304
- };
1305
- }
1306
- }, qt = {
1307
- getInitialState: (e) => ({
1308
- expanded: {},
1309
- ...e
1310
- }),
1311
- getDefaultOptions: (e) => ({
1312
- onExpandedChange: A("expanded", e),
1313
- paginateExpandedRows: !0
1314
- }),
1315
- createTable: (e) => {
1316
- let r = !1, t = !1;
1317
- e._autoResetExpanded = () => {
1318
- var n, o;
1319
- if (!r) {
1320
- e._queue(() => {
1321
- r = !0;
1322
- });
1323
- return;
1324
- }
1325
- if ((n = (o = e.options.autoResetAll) != null ? o : e.options.autoResetExpanded) != null ? n : !e.options.manualExpanding) {
1326
- if (t) return;
1327
- t = !0, e._queue(() => {
1328
- e.resetExpanded(), t = !1;
1329
- });
1330
- }
1331
- }, e.setExpanded = (n) => e.options.onExpandedChange == null ? void 0 : e.options.onExpandedChange(n), e.toggleAllRowsExpanded = (n) => {
1332
- n ?? !e.getIsAllRowsExpanded() ? e.setExpanded(!0) : e.setExpanded({});
1333
- }, e.resetExpanded = (n) => {
1334
- var o, i;
1335
- e.setExpanded(n ? {} : (o = (i = e.initialState) == null ? void 0 : i.expanded) != null ? o : {});
1336
- }, e.getCanSomeRowsExpand = () => e.getPrePaginationRowModel().flatRows.some((n) => n.getCanExpand()), e.getToggleAllRowsExpandedHandler = () => (n) => {
1337
- n.persist == null || n.persist(), e.toggleAllRowsExpanded();
1338
- }, e.getIsSomeRowsExpanded = () => {
1339
- const n = e.getState().expanded;
1340
- return n === !0 || Object.values(n).some(Boolean);
1341
- }, e.getIsAllRowsExpanded = () => {
1342
- const n = e.getState().expanded;
1343
- return typeof n == "boolean" ? n === !0 : !(!Object.keys(n).length || e.getRowModel().flatRows.some((o) => !o.getIsExpanded()));
1344
- }, e.getExpandedDepth = () => {
1345
- let n = 0;
1346
- return (e.getState().expanded === !0 ? Object.keys(e.getRowModel().rowsById) : Object.keys(e.getState().expanded)).forEach((i) => {
1347
- const l = i.split(".");
1348
- n = Math.max(n, l.length);
1349
- }), n;
1350
- }, e.getPreExpandedRowModel = () => e.getSortedRowModel(), e.getExpandedRowModel = () => (!e._getExpandedRowModel && e.options.getExpandedRowModel && (e._getExpandedRowModel = e.options.getExpandedRowModel(e)), e.options.manualExpanding || !e._getExpandedRowModel ? e.getPreExpandedRowModel() : e._getExpandedRowModel());
1351
- },
1352
- createRow: (e, r) => {
1353
- e.toggleExpanded = (t) => {
1354
- r.setExpanded((n) => {
1355
- var o;
1356
- const i = n === !0 ? !0 : !!(n != null && n[e.id]);
1357
- let l = {};
1358
- if (n === !0 ? Object.keys(r.getRowModel().rowsById).forEach((a) => {
1359
- l[a] = !0;
1360
- }) : l = n, t = (o = t) != null ? o : !i, !i && t)
1361
- return {
1362
- ...l,
1363
- [e.id]: !0
1364
- };
1365
- if (i && !t) {
1366
- const {
1367
- [e.id]: a,
1368
- ...u
1369
- } = l;
1370
- return u;
1371
- }
1372
- return n;
1373
- });
1374
- }, e.getIsExpanded = () => {
1375
- var t;
1376
- const n = r.getState().expanded;
1377
- return !!((t = r.options.getIsRowExpanded == null ? void 0 : r.options.getIsRowExpanded(e)) != null ? t : n === !0 || n != null && n[e.id]);
1378
- }, e.getCanExpand = () => {
1379
- var t, n, o;
1380
- return (t = r.options.getRowCanExpand == null ? void 0 : r.options.getRowCanExpand(e)) != null ? t : ((n = r.options.enableExpanding) != null ? n : !0) && !!((o = e.subRows) != null && o.length);
1381
- }, e.getIsAllParentsExpanded = () => {
1382
- let t = !0, n = e;
1383
- for (; t && n.parentId; )
1384
- n = r.getRow(n.parentId, !0), t = n.getIsExpanded();
1385
- return t;
1386
- }, e.getToggleExpandedHandler = () => {
1387
- const t = e.getCanExpand();
1388
- return () => {
1389
- t && e.toggleExpanded();
1390
- };
1391
- };
1392
- }
1393
- }, we = 0, Se = 10, fe = () => ({
1394
- pageIndex: we,
1395
- pageSize: Se
1396
- }), Kt = {
1397
- getInitialState: (e) => ({
1398
- ...e,
1399
- pagination: {
1400
- ...fe(),
1401
- ...e == null ? void 0 : e.pagination
1402
- }
1403
- }),
1404
- getDefaultOptions: (e) => ({
1405
- onPaginationChange: A("pagination", e)
1406
- }),
1407
- createTable: (e) => {
1408
- let r = !1, t = !1;
1409
- e._autoResetPageIndex = () => {
1410
- var n, o;
1411
- if (!r) {
1412
- e._queue(() => {
1413
- r = !0;
1414
- });
1415
- return;
1416
- }
1417
- if ((n = (o = e.options.autoResetAll) != null ? o : e.options.autoResetPageIndex) != null ? n : !e.options.manualPagination) {
1418
- if (t) return;
1419
- t = !0, e._queue(() => {
1420
- e.resetPageIndex(), t = !1;
1421
- });
1422
- }
1423
- }, e.setPagination = (n) => {
1424
- const o = (i) => T(n, i);
1425
- return e.options.onPaginationChange == null ? void 0 : e.options.onPaginationChange(o);
1426
- }, e.resetPagination = (n) => {
1427
- var o;
1428
- e.setPagination(n ? fe() : (o = e.initialState.pagination) != null ? o : fe());
1429
- }, e.setPageIndex = (n) => {
1430
- e.setPagination((o) => {
1431
- let i = T(n, o.pageIndex);
1432
- const l = typeof e.options.pageCount > "u" || e.options.pageCount === -1 ? Number.MAX_SAFE_INTEGER : e.options.pageCount - 1;
1433
- return i = Math.max(0, Math.min(i, l)), {
1434
- ...o,
1435
- pageIndex: i
1436
- };
1437
- });
1438
- }, e.resetPageIndex = (n) => {
1439
- var o, i;
1440
- e.setPageIndex(n ? we : (o = (i = e.initialState) == null || (i = i.pagination) == null ? void 0 : i.pageIndex) != null ? o : we);
1441
- }, e.resetPageSize = (n) => {
1442
- var o, i;
1443
- e.setPageSize(n ? Se : (o = (i = e.initialState) == null || (i = i.pagination) == null ? void 0 : i.pageSize) != null ? o : Se);
1444
- }, e.setPageSize = (n) => {
1445
- e.setPagination((o) => {
1446
- const i = Math.max(1, T(n, o.pageSize)), l = o.pageSize * o.pageIndex, a = Math.floor(l / i);
1447
- return {
1448
- ...o,
1449
- pageIndex: a,
1450
- pageSize: i
1451
- };
1452
- });
1453
- }, e.setPageCount = (n) => e.setPagination((o) => {
1454
- var i;
1455
- let l = T(n, (i = e.options.pageCount) != null ? i : -1);
1456
- return typeof l == "number" && (l = Math.max(-1, l)), {
1457
- ...o,
1458
- pageCount: l
1459
- };
1460
- }), e.getPageOptions = C(() => [e.getPageCount()], (n) => {
1461
- let o = [];
1462
- return n && n > 0 && (o = [...new Array(n)].fill(null).map((i, l) => l)), o;
1463
- }, v(e.options, "debugTable", "getPageOptions")), e.getCanPreviousPage = () => e.getState().pagination.pageIndex > 0, e.getCanNextPage = () => {
1464
- const {
1465
- pageIndex: n
1466
- } = e.getState().pagination, o = e.getPageCount();
1467
- return o === -1 ? !0 : o === 0 ? !1 : n < o - 1;
1468
- }, e.previousPage = () => e.setPageIndex((n) => n - 1), e.nextPage = () => e.setPageIndex((n) => n + 1), e.firstPage = () => e.setPageIndex(0), e.lastPage = () => e.setPageIndex(e.getPageCount() - 1), e.getPrePaginationRowModel = () => e.getExpandedRowModel(), e.getPaginationRowModel = () => (!e._getPaginationRowModel && e.options.getPaginationRowModel && (e._getPaginationRowModel = e.options.getPaginationRowModel(e)), e.options.manualPagination || !e._getPaginationRowModel ? e.getPrePaginationRowModel() : e._getPaginationRowModel()), e.getPageCount = () => {
1469
- var n;
1470
- return (n = e.options.pageCount) != null ? n : Math.ceil(e.getRowCount() / e.getState().pagination.pageSize);
1471
- }, e.getRowCount = () => {
1472
- var n;
1473
- return (n = e.options.rowCount) != null ? n : e.getPrePaginationRowModel().rows.length;
1474
- };
1475
- }
1476
- }, ge = () => ({
1477
- top: [],
1478
- bottom: []
1479
- }), Ut = {
1480
- getInitialState: (e) => ({
1481
- rowPinning: ge(),
1482
- ...e
1483
- }),
1484
- getDefaultOptions: (e) => ({
1485
- onRowPinningChange: A("rowPinning", e)
1486
- }),
1487
- createRow: (e, r) => {
1488
- e.pin = (t, n, o) => {
1489
- const i = n ? e.getLeafRows().map((u) => {
1490
- let {
1491
- id: g
1492
- } = u;
1493
- return g;
1494
- }) : [], l = o ? e.getParentRows().map((u) => {
1495
- let {
1496
- id: g
1497
- } = u;
1498
- return g;
1499
- }) : [], a = /* @__PURE__ */ new Set([...l, e.id, ...i]);
1500
- r.setRowPinning((u) => {
1501
- var g, d;
1502
- if (t === "bottom") {
1503
- var c, f;
1504
- return {
1505
- top: ((c = u == null ? void 0 : u.top) != null ? c : []).filter((h) => !(a != null && a.has(h))),
1506
- bottom: [...((f = u == null ? void 0 : u.bottom) != null ? f : []).filter((h) => !(a != null && a.has(h))), ...Array.from(a)]
1507
- };
1508
- }
1509
- if (t === "top") {
1510
- var s, m;
1511
- return {
1512
- top: [...((s = u == null ? void 0 : u.top) != null ? s : []).filter((h) => !(a != null && a.has(h))), ...Array.from(a)],
1513
- bottom: ((m = u == null ? void 0 : u.bottom) != null ? m : []).filter((h) => !(a != null && a.has(h)))
1514
- };
1515
- }
1516
- return {
1517
- top: ((g = u == null ? void 0 : u.top) != null ? g : []).filter((h) => !(a != null && a.has(h))),
1518
- bottom: ((d = u == null ? void 0 : u.bottom) != null ? d : []).filter((h) => !(a != null && a.has(h)))
1519
- };
1520
- });
1521
- }, e.getCanPin = () => {
1522
- var t;
1523
- const {
1524
- enableRowPinning: n,
1525
- enablePinning: o
1526
- } = r.options;
1527
- return typeof n == "function" ? n(e) : (t = n ?? o) != null ? t : !0;
1528
- }, e.getIsPinned = () => {
1529
- const t = [e.id], {
1530
- top: n,
1531
- bottom: o
1532
- } = r.getState().rowPinning, i = t.some((a) => n == null ? void 0 : n.includes(a)), l = t.some((a) => o == null ? void 0 : o.includes(a));
1533
- return i ? "top" : l ? "bottom" : !1;
1534
- }, e.getPinnedIndex = () => {
1535
- var t, n;
1536
- const o = e.getIsPinned();
1537
- if (!o) return -1;
1538
- const i = (t = o === "top" ? r.getTopRows() : r.getBottomRows()) == null ? void 0 : t.map((l) => {
1539
- let {
1540
- id: a
1541
- } = l;
1542
- return a;
1543
- });
1544
- return (n = i == null ? void 0 : i.indexOf(e.id)) != null ? n : -1;
1545
- };
1546
- },
1547
- createTable: (e) => {
1548
- e.setRowPinning = (r) => e.options.onRowPinningChange == null ? void 0 : e.options.onRowPinningChange(r), e.resetRowPinning = (r) => {
1549
- var t, n;
1550
- return e.setRowPinning(r ? ge() : (t = (n = e.initialState) == null ? void 0 : n.rowPinning) != null ? t : ge());
1551
- }, e.getIsSomeRowsPinned = (r) => {
1552
- var t;
1553
- const n = e.getState().rowPinning;
1554
- if (!r) {
1555
- var o, i;
1556
- return !!((o = n.top) != null && o.length || (i = n.bottom) != null && i.length);
1557
- }
1558
- return !!((t = n[r]) != null && t.length);
1559
- }, e._getPinnedRows = (r, t, n) => {
1560
- var o;
1561
- return ((o = e.options.keepPinnedRows) == null || o ? (
1562
- //get all rows that are pinned even if they would not be otherwise visible
1563
- //account for expanded parent rows, but not pagination or filtering
1564
- (t ?? []).map((l) => {
1565
- const a = e.getRow(l, !0);
1566
- return a.getIsAllParentsExpanded() ? a : null;
1567
- })
1568
- ) : (
1569
- //else get only visible rows that are pinned
1570
- (t ?? []).map((l) => r.find((a) => a.id === l))
1571
- )).filter(Boolean).map((l) => ({
1572
- ...l,
1573
- position: n
1574
- }));
1575
- }, e.getTopRows = C(() => [e.getRowModel().rows, e.getState().rowPinning.top], (r, t) => e._getPinnedRows(r, t, "top"), v(e.options, "debugRows", "getTopRows")), e.getBottomRows = C(() => [e.getRowModel().rows, e.getState().rowPinning.bottom], (r, t) => e._getPinnedRows(r, t, "bottom"), v(e.options, "debugRows", "getBottomRows")), e.getCenterRows = C(() => [e.getRowModel().rows, e.getState().rowPinning.top, e.getState().rowPinning.bottom], (r, t, n) => {
1576
- const o = /* @__PURE__ */ new Set([...t ?? [], ...n ?? []]);
1577
- return r.filter((i) => !o.has(i.id));
1578
- }, v(e.options, "debugRows", "getCenterRows"));
1579
- }
1580
- }, Xt = {
1581
- getInitialState: (e) => ({
1582
- rowSelection: {},
1583
- ...e
1584
- }),
1585
- getDefaultOptions: (e) => ({
1586
- onRowSelectionChange: A("rowSelection", e),
1587
- enableRowSelection: !0,
1588
- enableMultiRowSelection: !0,
1589
- enableSubRowSelection: !0
1590
- // enableGroupingRowSelection: false,
1591
- // isAdditiveSelectEvent: (e: unknown) => !!e.metaKey,
1592
- // isInclusiveSelectEvent: (e: unknown) => !!e.shiftKey,
1593
- }),
1594
- createTable: (e) => {
1595
- e.setRowSelection = (r) => e.options.onRowSelectionChange == null ? void 0 : e.options.onRowSelectionChange(r), e.resetRowSelection = (r) => {
1596
- var t;
1597
- return e.setRowSelection(r ? {} : (t = e.initialState.rowSelection) != null ? t : {});
1598
- }, e.toggleAllRowsSelected = (r) => {
1599
- e.setRowSelection((t) => {
1600
- r = typeof r < "u" ? r : !e.getIsAllRowsSelected();
1601
- const n = {
1602
- ...t
1603
- }, o = e.getPreGroupedRowModel().flatRows;
1604
- return r ? o.forEach((i) => {
1605
- i.getCanSelect() && (n[i.id] = !0);
1606
- }) : o.forEach((i) => {
1607
- delete n[i.id];
1608
- }), n;
1609
- });
1610
- }, e.toggleAllPageRowsSelected = (r) => e.setRowSelection((t) => {
1611
- const n = typeof r < "u" ? r : !e.getIsAllPageRowsSelected(), o = {
1612
- ...t
1613
- };
1614
- return e.getRowModel().rows.forEach((i) => {
1615
- Ce(o, i.id, n, !0, e);
1616
- }), o;
1617
- }), e.getPreSelectedRowModel = () => e.getCoreRowModel(), e.getSelectedRowModel = C(() => [e.getState().rowSelection, e.getCoreRowModel()], (r, t) => Object.keys(r).length ? de(e, t) : {
1618
- rows: [],
1619
- flatRows: [],
1620
- rowsById: {}
1621
- }, v(e.options, "debugTable", "getSelectedRowModel")), e.getFilteredSelectedRowModel = C(() => [e.getState().rowSelection, e.getFilteredRowModel()], (r, t) => Object.keys(r).length ? de(e, t) : {
1622
- rows: [],
1623
- flatRows: [],
1624
- rowsById: {}
1625
- }, v(e.options, "debugTable", "getFilteredSelectedRowModel")), e.getGroupedSelectedRowModel = C(() => [e.getState().rowSelection, e.getSortedRowModel()], (r, t) => Object.keys(r).length ? de(e, t) : {
1626
- rows: [],
1627
- flatRows: [],
1628
- rowsById: {}
1629
- }, v(e.options, "debugTable", "getGroupedSelectedRowModel")), e.getIsAllRowsSelected = () => {
1630
- const r = e.getFilteredRowModel().flatRows, {
1631
- rowSelection: t
1632
- } = e.getState();
1633
- let n = !!(r.length && Object.keys(t).length);
1634
- return n && r.some((o) => o.getCanSelect() && !t[o.id]) && (n = !1), n;
1635
- }, e.getIsAllPageRowsSelected = () => {
1636
- const r = e.getPaginationRowModel().flatRows.filter((o) => o.getCanSelect()), {
1637
- rowSelection: t
1638
- } = e.getState();
1639
- let n = !!r.length;
1640
- return n && r.some((o) => !t[o.id]) && (n = !1), n;
1641
- }, e.getIsSomeRowsSelected = () => {
1642
- var r;
1643
- const t = Object.keys((r = e.getState().rowSelection) != null ? r : {}).length;
1644
- return t > 0 && t < e.getFilteredRowModel().flatRows.length;
1645
- }, e.getIsSomePageRowsSelected = () => {
1646
- const r = e.getPaginationRowModel().flatRows;
1647
- return e.getIsAllPageRowsSelected() ? !1 : r.filter((t) => t.getCanSelect()).some((t) => t.getIsSelected() || t.getIsSomeSelected());
1648
- }, e.getToggleAllRowsSelectedHandler = () => (r) => {
1649
- e.toggleAllRowsSelected(r.target.checked);
1650
- }, e.getToggleAllPageRowsSelectedHandler = () => (r) => {
1651
- e.toggleAllPageRowsSelected(r.target.checked);
1652
- };
1653
- },
1654
- createRow: (e, r) => {
1655
- e.toggleSelected = (t, n) => {
1656
- const o = e.getIsSelected();
1657
- r.setRowSelection((i) => {
1658
- var l;
1659
- if (t = typeof t < "u" ? t : !o, e.getCanSelect() && o === t)
1660
- return i;
1661
- const a = {
1662
- ...i
1663
- };
1664
- return Ce(a, e.id, t, (l = n == null ? void 0 : n.selectChildren) != null ? l : !0, r), a;
1665
- });
1666
- }, e.getIsSelected = () => {
1667
- const {
1668
- rowSelection: t
1669
- } = r.getState();
1670
- return $e(e, t);
1671
- }, e.getIsSomeSelected = () => {
1672
- const {
1673
- rowSelection: t
1674
- } = r.getState();
1675
- return ve(e, t) === "some";
1676
- }, e.getIsAllSubRowsSelected = () => {
1677
- const {
1678
- rowSelection: t
1679
- } = r.getState();
1680
- return ve(e, t) === "all";
1681
- }, e.getCanSelect = () => {
1682
- var t;
1683
- return typeof r.options.enableRowSelection == "function" ? r.options.enableRowSelection(e) : (t = r.options.enableRowSelection) != null ? t : !0;
1684
- }, e.getCanSelectSubRows = () => {
1685
- var t;
1686
- return typeof r.options.enableSubRowSelection == "function" ? r.options.enableSubRowSelection(e) : (t = r.options.enableSubRowSelection) != null ? t : !0;
1687
- }, e.getCanMultiSelect = () => {
1688
- var t;
1689
- return typeof r.options.enableMultiRowSelection == "function" ? r.options.enableMultiRowSelection(e) : (t = r.options.enableMultiRowSelection) != null ? t : !0;
1690
- }, e.getToggleSelectedHandler = () => {
1691
- const t = e.getCanSelect();
1692
- return (n) => {
1693
- var o;
1694
- t && e.toggleSelected((o = n.target) == null ? void 0 : o.checked);
1695
- };
1696
- };
1697
- }
1698
- }, Ce = (e, r, t, n, o) => {
1699
- var i;
1700
- const l = o.getRow(r, !0);
1701
- t ? (l.getCanMultiSelect() || Object.keys(e).forEach((a) => delete e[a]), l.getCanSelect() && (e[r] = !0)) : delete e[r], n && (i = l.subRows) != null && i.length && l.getCanSelectSubRows() && l.subRows.forEach((a) => Ce(e, a.id, t, n, o));
1702
- };
1703
- function de(e, r) {
1704
- const t = e.getState().rowSelection, n = [], o = {}, i = function(l, a) {
1705
- return l.map((u) => {
1706
- var g;
1707
- const d = $e(u, t);
1708
- if (d && (n.push(u), o[u.id] = u), (g = u.subRows) != null && g.length && (u = {
1709
- ...u,
1710
- subRows: i(u.subRows)
1711
- }), d)
1712
- return u;
1713
- }).filter(Boolean);
1714
- };
1715
- return {
1716
- rows: i(r.rows),
1717
- flatRows: n,
1718
- rowsById: o
1719
- };
1720
- }
1721
- function $e(e, r) {
1722
- var t;
1723
- return (t = r[e.id]) != null ? t : !1;
1724
- }
1725
- function ve(e, r, t) {
1726
- var n;
1727
- if (!((n = e.subRows) != null && n.length)) return !1;
1728
- let o = !0, i = !1;
1729
- return e.subRows.forEach((l) => {
1730
- if (!(i && !o) && (l.getCanSelect() && ($e(l, r) ? i = !0 : o = !1), l.subRows && l.subRows.length)) {
1731
- const a = ve(l, r);
1732
- a === "all" ? i = !0 : (a === "some" && (i = !0), o = !1);
1733
- }
1734
- }), o ? "all" : i ? "some" : !1;
1735
- }
1736
- const Re = /([0-9]+)/gm, Wt = (e, r, t) => Ze(j(e.getValue(t)).toLowerCase(), j(r.getValue(t)).toLowerCase()), Zt = (e, r, t) => Ze(j(e.getValue(t)), j(r.getValue(t))), Yt = (e, r, t) => Ie(j(e.getValue(t)).toLowerCase(), j(r.getValue(t)).toLowerCase()), Jt = (e, r, t) => Ie(j(e.getValue(t)), j(r.getValue(t))), Qt = (e, r, t) => {
1737
- const n = e.getValue(t), o = r.getValue(t);
1738
- return n > o ? 1 : n < o ? -1 : 0;
1739
- }, en = (e, r, t) => Ie(e.getValue(t), r.getValue(t));
1740
- function Ie(e, r) {
1741
- return e === r ? 0 : e > r ? 1 : -1;
1742
- }
1743
- function j(e) {
1744
- return typeof e == "number" ? isNaN(e) || e === 1 / 0 || e === -1 / 0 ? "" : String(e) : typeof e == "string" ? e : "";
1745
- }
1746
- function Ze(e, r) {
1747
- const t = e.split(Re).filter(Boolean), n = r.split(Re).filter(Boolean);
1748
- for (; t.length && n.length; ) {
1749
- const o = t.shift(), i = n.shift(), l = parseInt(o, 10), a = parseInt(i, 10), u = [l, a].sort();
1750
- if (isNaN(u[0])) {
1751
- if (o > i)
1752
- return 1;
1753
- if (i > o)
1754
- return -1;
1755
- continue;
1756
- }
1757
- if (isNaN(u[1]))
1758
- return isNaN(l) ? -1 : 1;
1759
- if (l > a)
1760
- return 1;
1761
- if (a > l)
1762
- return -1;
1763
- }
1764
- return t.length - n.length;
1765
- }
1766
- const Z = {
1767
- alphanumeric: Wt,
1768
- alphanumericCaseSensitive: Zt,
1769
- text: Yt,
1770
- textCaseSensitive: Jt,
1771
- datetime: Qt,
1772
- basic: en
1773
- }, tn = {
1774
- getInitialState: (e) => ({
1775
- sorting: [],
1776
- ...e
1777
- }),
1778
- getDefaultColumnDef: () => ({
1779
- sortingFn: "auto",
1780
- sortUndefined: 1
1781
- }),
1782
- getDefaultOptions: (e) => ({
1783
- onSortingChange: A("sorting", e),
1784
- isMultiSortEvent: (r) => r.shiftKey
1785
- }),
1786
- createColumn: (e, r) => {
1787
- e.getAutoSortingFn = () => {
1788
- const t = r.getFilteredRowModel().flatRows.slice(10);
1789
- let n = !1;
1790
- for (const o of t) {
1791
- const i = o == null ? void 0 : o.getValue(e.id);
1792
- if (Object.prototype.toString.call(i) === "[object Date]")
1793
- return Z.datetime;
1794
- if (typeof i == "string" && (n = !0, i.split(Re).length > 1))
1795
- return Z.alphanumeric;
1796
- }
1797
- return n ? Z.text : Z.basic;
1798
- }, e.getAutoSortDir = () => {
1799
- const t = r.getFilteredRowModel().flatRows[0];
1800
- return typeof (t == null ? void 0 : t.getValue(e.id)) == "string" ? "asc" : "desc";
1801
- }, e.getSortingFn = () => {
1802
- var t, n;
1803
- if (!e)
1804
- throw new Error();
1805
- return re(e.columnDef.sortingFn) ? e.columnDef.sortingFn : e.columnDef.sortingFn === "auto" ? e.getAutoSortingFn() : (t = (n = r.options.sortingFns) == null ? void 0 : n[e.columnDef.sortingFn]) != null ? t : Z[e.columnDef.sortingFn];
1806
- }, e.toggleSorting = (t, n) => {
1807
- const o = e.getNextSortingOrder(), i = typeof t < "u" && t !== null;
1808
- r.setSorting((l) => {
1809
- const a = l == null ? void 0 : l.find((s) => s.id === e.id), u = l == null ? void 0 : l.findIndex((s) => s.id === e.id);
1810
- let g = [], d, c = i ? t : o === "desc";
1811
- if (l != null && l.length && e.getCanMultiSort() && n ? a ? d = "toggle" : d = "add" : l != null && l.length && u !== l.length - 1 ? d = "replace" : a ? d = "toggle" : d = "replace", d === "toggle" && (i || o || (d = "remove")), d === "add") {
1812
- var f;
1813
- g = [...l, {
1814
- id: e.id,
1815
- desc: c
1816
- }], g.splice(0, g.length - ((f = r.options.maxMultiSortColCount) != null ? f : Number.MAX_SAFE_INTEGER));
1817
- } else d === "toggle" ? g = l.map((s) => s.id === e.id ? {
1818
- ...s,
1819
- desc: c
1820
- } : s) : d === "remove" ? g = l.filter((s) => s.id !== e.id) : g = [{
1821
- id: e.id,
1822
- desc: c
1823
- }];
1824
- return g;
1825
- });
1826
- }, e.getFirstSortDir = () => {
1827
- var t, n;
1828
- return ((t = (n = e.columnDef.sortDescFirst) != null ? n : r.options.sortDescFirst) != null ? t : e.getAutoSortDir() === "desc") ? "desc" : "asc";
1829
- }, e.getNextSortingOrder = (t) => {
1830
- var n, o;
1831
- const i = e.getFirstSortDir(), l = e.getIsSorted();
1832
- return l ? l !== i && ((n = r.options.enableSortingRemoval) == null || n) && // If enableSortRemove, enable in general
1833
- (!(t && (o = r.options.enableMultiRemove) != null) || o) ? !1 : l === "desc" ? "asc" : "desc" : i;
1834
- }, e.getCanSort = () => {
1835
- var t, n;
1836
- return ((t = e.columnDef.enableSorting) != null ? t : !0) && ((n = r.options.enableSorting) != null ? n : !0) && !!e.accessorFn;
1837
- }, e.getCanMultiSort = () => {
1838
- var t, n;
1839
- return (t = (n = e.columnDef.enableMultiSort) != null ? n : r.options.enableMultiSort) != null ? t : !!e.accessorFn;
1840
- }, e.getIsSorted = () => {
1841
- var t;
1842
- const n = (t = r.getState().sorting) == null ? void 0 : t.find((o) => o.id === e.id);
1843
- return n ? n.desc ? "desc" : "asc" : !1;
1844
- }, e.getSortIndex = () => {
1845
- var t, n;
1846
- return (t = (n = r.getState().sorting) == null ? void 0 : n.findIndex((o) => o.id === e.id)) != null ? t : -1;
1847
- }, e.clearSorting = () => {
1848
- r.setSorting((t) => t != null && t.length ? t.filter((n) => n.id !== e.id) : []);
1849
- }, e.getToggleSortingHandler = () => {
1850
- const t = e.getCanSort();
1851
- return (n) => {
1852
- t && (n.persist == null || n.persist(), e.toggleSorting == null || e.toggleSorting(void 0, e.getCanMultiSort() ? r.options.isMultiSortEvent == null ? void 0 : r.options.isMultiSortEvent(n) : !1));
1853
- };
1854
- };
1855
- },
1856
- createTable: (e) => {
1857
- e.setSorting = (r) => e.options.onSortingChange == null ? void 0 : e.options.onSortingChange(r), e.resetSorting = (r) => {
1858
- var t, n;
1859
- e.setSorting(r ? [] : (t = (n = e.initialState) == null ? void 0 : n.sorting) != null ? t : []);
1860
- }, e.getPreSortedRowModel = () => e.getGroupedRowModel(), e.getSortedRowModel = () => (!e._getSortedRowModel && e.options.getSortedRowModel && (e._getSortedRowModel = e.options.getSortedRowModel(e)), e.options.manualSorting || !e._getSortedRowModel ? e.getPreSortedRowModel() : e._getSortedRowModel());
1861
- }
1862
- }, nn = [
1863
- yt,
1864
- Bt,
1865
- At,
1866
- zt,
1867
- _t,
1868
- Ft,
1869
- Tt,
1870
- //depends on ColumnFaceting
1871
- jt,
1872
- //depends on ColumnFiltering
1873
- tn,
1874
- Ht,
1875
- //depends on RowSorting
1876
- qt,
1877
- Kt,
1878
- Ut,
1879
- Xt,
1880
- bt
1881
- ];
1882
- function rn(e) {
1883
- var r, t;
1884
- process.env.NODE_ENV !== "production" && (e.debugAll || e.debugTable) && console.info("Creating Table Instance...");
1885
- const n = [...nn, ...(r = e._features) != null ? r : []];
1886
- let o = {
1887
- _features: n
1888
- };
1889
- const i = o._features.reduce((f, s) => Object.assign(f, s.getDefaultOptions == null ? void 0 : s.getDefaultOptions(o)), {}), l = (f) => o.options.mergeOptions ? o.options.mergeOptions(i, f) : {
1890
- ...i,
1891
- ...f
1892
- };
1893
- let u = {
1894
- ...{},
1895
- ...(t = e.initialState) != null ? t : {}
1896
- };
1897
- o._features.forEach((f) => {
1898
- var s;
1899
- u = (s = f.getInitialState == null ? void 0 : f.getInitialState(u)) != null ? s : u;
1900
- });
1901
- const g = [];
1902
- let d = !1;
1903
- const c = {
1904
- _features: n,
1905
- options: {
1906
- ...i,
1907
- ...e
1908
- },
1909
- initialState: u,
1910
- _queue: (f) => {
1911
- g.push(f), d || (d = !0, Promise.resolve().then(() => {
1912
- for (; g.length; )
1913
- g.shift()();
1914
- d = !1;
1915
- }).catch((s) => setTimeout(() => {
1916
- throw s;
1917
- })));
1918
- },
1919
- reset: () => {
1920
- o.setState(o.initialState);
1921
- },
1922
- setOptions: (f) => {
1923
- const s = T(f, o.options);
1924
- o.options = l(s);
1925
- },
1926
- getState: () => o.options.state,
1927
- setState: (f) => {
1928
- o.options.onStateChange == null || o.options.onStateChange(f);
1929
- },
1930
- _getRowId: (f, s, m) => {
1931
- var h;
1932
- return (h = o.options.getRowId == null ? void 0 : o.options.getRowId(f, s, m)) != null ? h : `${m ? [m.id, s].join(".") : s}`;
1933
- },
1934
- getCoreRowModel: () => (o._getCoreRowModel || (o._getCoreRowModel = o.options.getCoreRowModel(o)), o._getCoreRowModel()),
1935
- // The final calls start at the bottom of the model,
1936
- // expanded rows, which then work their way up
1937
- getRowModel: () => o.getPaginationRowModel(),
1938
- //in next version, we should just pass in the row model as the optional 2nd arg
1939
- getRow: (f, s) => {
1940
- let m = (s ? o.getPrePaginationRowModel() : o.getRowModel()).rowsById[f];
1941
- if (!m && (m = o.getCoreRowModel().rowsById[f], !m))
1942
- throw process.env.NODE_ENV !== "production" ? new Error(`getRow could not find row with ID: ${f}`) : new Error();
1943
- return m;
1944
- },
1945
- _getDefaultColumnDef: C(() => [o.options.defaultColumn], (f) => {
1946
- var s;
1947
- return f = (s = f) != null ? s : {}, {
1948
- header: (m) => {
1949
- const h = m.header.column.columnDef;
1950
- return h.accessorKey ? h.accessorKey : h.accessorFn ? h.id : null;
1951
- },
1952
- // footer: props => props.header.column.id,
1953
- cell: (m) => {
1954
- var h, S;
1955
- return (h = (S = m.renderValue()) == null || S.toString == null ? void 0 : S.toString()) != null ? h : null;
1956
- },
1957
- ...o._features.reduce((m, h) => Object.assign(m, h.getDefaultColumnDef == null ? void 0 : h.getDefaultColumnDef()), {}),
1958
- ...f
1959
- };
1960
- }, v(e, "debugColumns", "_getDefaultColumnDef")),
1961
- _getColumnDefs: () => o.options.columns,
1962
- getAllColumns: C(() => [o._getColumnDefs()], (f) => {
1963
- const s = function(m, h, S) {
1964
- return S === void 0 && (S = 0), m.map((R) => {
1965
- const _ = xt(o, R, S, h), $ = R;
1966
- return _.columns = $.columns ? s($.columns, _, S + 1) : [], _;
1967
- });
1968
- };
1969
- return s(f);
1970
- }, v(e, "debugColumns", "getAllColumns")),
1971
- getAllFlatColumns: C(() => [o.getAllColumns()], (f) => f.flatMap((s) => s.getFlatColumns()), v(e, "debugColumns", "getAllFlatColumns")),
1972
- _getAllFlatColumnsById: C(() => [o.getAllFlatColumns()], (f) => f.reduce((s, m) => (s[m.id] = m, s), {}), v(e, "debugColumns", "getAllFlatColumnsById")),
1973
- getAllLeafColumns: C(() => [o.getAllColumns(), o._getOrderColumnsFn()], (f, s) => {
1974
- let m = f.flatMap((h) => h.getLeafColumns());
1975
- return s(m);
1976
- }, v(e, "debugColumns", "getAllLeafColumns")),
1977
- getColumn: (f) => {
1978
- const s = o._getAllFlatColumnsById()[f];
1979
- return process.env.NODE_ENV !== "production" && !s && console.error(`[Table] Column with id '${f}' does not exist.`), s;
1980
- }
1981
- };
1982
- Object.assign(o, c);
1983
- for (let f = 0; f < o._features.length; f++) {
1984
- const s = o._features[f];
1985
- s == null || s.createTable == null || s.createTable(o);
1986
- }
1987
- return o;
1988
- }
1989
- function on() {
1990
- return (e) => C(() => [e.options.data], (r) => {
1991
- const t = {
1992
- rows: [],
1993
- flatRows: [],
1994
- rowsById: {}
1995
- }, n = function(o, i, l) {
1996
- i === void 0 && (i = 0);
1997
- const a = [];
1998
- for (let g = 0; g < o.length; g++) {
1999
- const d = _e(e, e._getRowId(o[g], g, l), o[g], g, i, void 0, l == null ? void 0 : l.id);
2000
- if (t.flatRows.push(d), t.rowsById[d.id] = d, a.push(d), e.options.getSubRows) {
2001
- var u;
2002
- d.originalSubRows = e.options.getSubRows(o[g], g), (u = d.originalSubRows) != null && u.length && (d.subRows = n(d.originalSubRows, i + 1, d));
2003
- }
2004
- }
2005
- return a;
2006
- };
2007
- return t.rows = n(r), t;
2008
- }, v(e.options, "debugTable", "getRowModel", () => e._autoResetPageIndex()));
2009
- }
2010
- function ln(e) {
2011
- const r = [], t = (n) => {
2012
- var o;
2013
- r.push(n), (o = n.subRows) != null && o.length && n.getIsExpanded() && n.subRows.forEach(t);
2014
- };
2015
- return e.rows.forEach(t), {
2016
- rows: r,
2017
- flatRows: e.flatRows,
2018
- rowsById: e.rowsById
2019
- };
2020
- }
2021
- function sn(e, r, t) {
2022
- return t.options.filterFromLeafRows ? an(e, r, t) : un(e, r, t);
2023
- }
2024
- function an(e, r, t) {
2025
- var n;
2026
- const o = [], i = {}, l = (n = t.options.maxLeafRowFilterDepth) != null ? n : 100, a = function(u, g) {
2027
- g === void 0 && (g = 0);
2028
- const d = [];
2029
- for (let f = 0; f < u.length; f++) {
2030
- var c;
2031
- let s = u[f];
2032
- const m = _e(t, s.id, s.original, s.index, s.depth, void 0, s.parentId);
2033
- if (m.columnFilters = s.columnFilters, (c = s.subRows) != null && c.length && g < l) {
2034
- if (m.subRows = a(s.subRows, g + 1), s = m, r(s) && !m.subRows.length) {
2035
- d.push(s), i[s.id] = s, o.push(s);
2036
- continue;
2037
- }
2038
- if (r(s) || m.subRows.length) {
2039
- d.push(s), i[s.id] = s, o.push(s);
2040
- continue;
2041
- }
2042
- } else
2043
- s = m, r(s) && (d.push(s), i[s.id] = s, o.push(s));
2044
- }
2045
- return d;
2046
- };
2047
- return {
2048
- rows: a(e),
2049
- flatRows: o,
2050
- rowsById: i
2051
- };
2052
- }
2053
- function un(e, r, t) {
2054
- var n;
2055
- const o = [], i = {}, l = (n = t.options.maxLeafRowFilterDepth) != null ? n : 100, a = function(u, g) {
2056
- g === void 0 && (g = 0);
2057
- const d = [];
2058
- for (let f = 0; f < u.length; f++) {
2059
- let s = u[f];
2060
- if (r(s)) {
2061
- var c;
2062
- if ((c = s.subRows) != null && c.length && g < l) {
2063
- const h = _e(t, s.id, s.original, s.index, s.depth, void 0, s.parentId);
2064
- h.subRows = a(s.subRows, g + 1), s = h;
2065
- }
2066
- d.push(s), o.push(s), i[s.id] = s;
2067
- }
2068
- }
2069
- return d;
2070
- };
2071
- return {
2072
- rows: a(e),
2073
- flatRows: o,
2074
- rowsById: i
2075
- };
2076
- }
2077
- function fn() {
2078
- return (e) => C(() => [e.getPreFilteredRowModel(), e.getState().columnFilters, e.getState().globalFilter], (r, t, n) => {
2079
- if (!r.rows.length || !(t != null && t.length) && !n) {
2080
- for (let f = 0; f < r.flatRows.length; f++)
2081
- r.flatRows[f].columnFilters = {}, r.flatRows[f].columnFiltersMeta = {};
2082
- return r;
2083
- }
2084
- const o = [], i = [];
2085
- (t ?? []).forEach((f) => {
2086
- var s;
2087
- const m = e.getColumn(f.id);
2088
- if (!m)
2089
- return;
2090
- const h = m.getFilterFn();
2091
- if (!h) {
2092
- process.env.NODE_ENV !== "production" && console.warn(`Could not find a valid 'column.filterFn' for column with the ID: ${m.id}.`);
2093
- return;
2094
- }
2095
- o.push({
2096
- id: f.id,
2097
- filterFn: h,
2098
- resolvedValue: (s = h.resolveFilterValue == null ? void 0 : h.resolveFilterValue(f.value)) != null ? s : f.value
2099
- });
2100
- });
2101
- const l = (t ?? []).map((f) => f.id), a = e.getGlobalFilterFn(), u = e.getAllLeafColumns().filter((f) => f.getCanGlobalFilter());
2102
- n && a && u.length && (l.push("__global__"), u.forEach((f) => {
2103
- var s;
2104
- i.push({
2105
- id: f.id,
2106
- filterFn: a,
2107
- resolvedValue: (s = a.resolveFilterValue == null ? void 0 : a.resolveFilterValue(n)) != null ? s : n
2108
- });
2109
- }));
2110
- let g, d;
2111
- for (let f = 0; f < r.flatRows.length; f++) {
2112
- const s = r.flatRows[f];
2113
- if (s.columnFilters = {}, o.length)
2114
- for (let m = 0; m < o.length; m++) {
2115
- g = o[m];
2116
- const h = g.id;
2117
- s.columnFilters[h] = g.filterFn(s, h, g.resolvedValue, (S) => {
2118
- s.columnFiltersMeta[h] = S;
2119
- });
2120
- }
2121
- if (i.length) {
2122
- for (let m = 0; m < i.length; m++) {
2123
- d = i[m];
2124
- const h = d.id;
2125
- if (d.filterFn(s, h, d.resolvedValue, (S) => {
2126
- s.columnFiltersMeta[h] = S;
2127
- })) {
2128
- s.columnFilters.__global__ = !0;
2129
- break;
2130
- }
2131
- }
2132
- s.columnFilters.__global__ !== !0 && (s.columnFilters.__global__ = !1);
2133
- }
2134
- }
2135
- const c = (f) => {
2136
- for (let s = 0; s < l.length; s++)
2137
- if (f.columnFilters[l[s]] === !1)
2138
- return !1;
2139
- return !0;
2140
- };
2141
- return sn(r.rows, c, e);
2142
- }, v(e.options, "debugTable", "getFilteredRowModel", () => e._autoResetPageIndex()));
2143
- }
2144
- function gn(e) {
2145
- return (r) => C(() => [r.getState().pagination, r.getPrePaginationRowModel(), r.options.paginateExpandedRows ? void 0 : r.getState().expanded], (t, n) => {
2146
- if (!n.rows.length)
2147
- return n;
2148
- const {
2149
- pageSize: o,
2150
- pageIndex: i
2151
- } = t;
2152
- let {
2153
- rows: l,
2154
- flatRows: a,
2155
- rowsById: u
2156
- } = n;
2157
- const g = o * i, d = g + o;
2158
- l = l.slice(g, d);
2159
- let c;
2160
- r.options.paginateExpandedRows ? c = {
2161
- rows: l,
2162
- flatRows: a,
2163
- rowsById: u
2164
- } : c = ln({
2165
- rows: l,
2166
- flatRows: a,
2167
- rowsById: u
2168
- }), c.flatRows = [];
2169
- const f = (s) => {
2170
- c.flatRows.push(s), s.subRows.length && s.subRows.forEach(f);
2171
- };
2172
- return c.rows.forEach(f), c;
2173
- }, v(r.options, "debugTable", "getPaginationRowModel"));
2174
- }
2175
- function dn() {
2176
- return (e) => C(() => [e.getState().sorting, e.getPreSortedRowModel()], (r, t) => {
2177
- if (!t.rows.length || !(r != null && r.length))
2178
- return t;
2179
- const n = e.getState().sorting, o = [], i = n.filter((u) => {
2180
- var g;
2181
- return (g = e.getColumn(u.id)) == null ? void 0 : g.getCanSort();
2182
- }), l = {};
2183
- i.forEach((u) => {
2184
- const g = e.getColumn(u.id);
2185
- g && (l[u.id] = {
2186
- sortUndefined: g.columnDef.sortUndefined,
2187
- invertSorting: g.columnDef.invertSorting,
2188
- sortingFn: g.getSortingFn()
2189
- });
2190
- });
2191
- const a = (u) => {
2192
- const g = u.map((d) => ({
2193
- ...d
2194
- }));
2195
- return g.sort((d, c) => {
2196
- for (let s = 0; s < i.length; s += 1) {
2197
- var f;
2198
- const m = i[s], h = l[m.id], S = h.sortUndefined, R = (f = m == null ? void 0 : m.desc) != null ? f : !1;
2199
- let _ = 0;
2200
- if (S) {
2201
- const $ = d.getValue(m.id), E = c.getValue(m.id), I = $ === void 0, P = E === void 0;
2202
- if (I || P) {
2203
- if (S === "first") return I ? -1 : 1;
2204
- if (S === "last") return I ? 1 : -1;
2205
- _ = I && P ? 0 : I ? S : -S;
2206
- }
2207
- }
2208
- if (_ === 0 && (_ = h.sortingFn(d, c, m.id)), _ !== 0)
2209
- return R && (_ *= -1), h.invertSorting && (_ *= -1), _;
2210
- }
2211
- return d.index - c.index;
2212
- }), g.forEach((d) => {
2213
- var c;
2214
- o.push(d), (c = d.subRows) != null && c.length && (d.subRows = a(d.subRows));
2215
- }), g;
2216
- };
2217
- return {
2218
- rows: a(t.rows),
2219
- flatRows: o,
2220
- rowsById: t.rowsById
2221
- };
2222
- }, v(e.options, "debugTable", "getSortedRowModel", () => e._autoResetPageIndex()));
2223
- }
2224
- /**
2225
- * react-table
2226
- *
2227
- * Copyright (c) TanStack
2228
- *
2229
- * This source code is licensed under the MIT license found in the
2230
- * LICENSE.md file in the root directory of this source tree.
2231
- *
2232
- * @license MIT
2233
- */
2234
- function ze(e, r) {
2235
- return e ? cn(e) ? /* @__PURE__ */ pe.createElement(e, r) : e : null;
2236
- }
2237
- function cn(e) {
2238
- return pn(e) || typeof e == "function" || mn(e);
2239
- }
2240
- function pn(e) {
2241
- return typeof e == "function" && (() => {
2242
- const r = Object.getPrototypeOf(e);
2243
- return r.prototype && r.prototype.isReactComponent;
2244
- })();
2245
- }
2246
- function mn(e) {
2247
- return typeof e == "object" && typeof e.$$typeof == "symbol" && ["react.memo", "react.forward_ref"].includes(e.$$typeof.description);
2248
- }
2249
- function hn(e) {
2250
- const r = {
2251
- state: {},
2252
- // Dummy state
2253
- onStateChange: () => {
2254
- },
2255
- // noop
2256
- renderFallbackValue: null,
2257
- ...e
2258
- }, [t] = pe.useState(() => ({
2259
- current: rn(r)
2260
- })), [n, o] = pe.useState(() => t.current.initialState);
2261
- return t.current.setOptions((i) => ({
2262
- ...i,
2263
- ...e,
2264
- state: {
2265
- ...n,
2266
- ...e.state
2267
- },
2268
- // Similarly, we'll maintain both our internal state and any user-provided
2269
- // state.
2270
- onStateChange: (l) => {
2271
- o(l), e.onStateChange == null || e.onStateChange(l);
2272
- }
2273
- })), t.current;
2274
- }
2275
- const ke = ({
2276
- editable: e = !0,
2277
- pageSize: r = 25,
2278
- onCellEdit: t
2279
- }) => {
2280
- const {
2281
- rows: n,
2282
- schema: o,
2283
- mappings: i,
2284
- errorsByRow: l,
2285
- editingCell: a,
2286
- startEditing: u,
2287
- stopEditing: g,
2288
- updateCell: d
2289
- } = X(), [c, f] = Y([]), [s, m] = Y(""), [h, S] = Y(""), R = Pe(() => i.filter((x) => x.targetKey !== null).map((x) => {
2290
- const y = o == null ? void 0 : o.columns.find((V) => V.key === x.targetKey);
2291
- return {
2292
- sourceColumn: x.sourceColumn,
2293
- targetKey: x.targetKey,
2294
- label: (y == null ? void 0 : y.label) || x.targetKey,
2295
- type: (y == null ? void 0 : y.type) || "string"
2296
- };
2297
- }), [i, o]), _ = xe(
2298
- (x, y) => {
2299
- const V = l.get(x);
2300
- return V == null ? void 0 : V.find((K) => K.columnKey === y);
2301
- },
2302
- [l]
2303
- ), $ = (x, y, V) => {
2304
- S(V), u(x, y);
2305
- }, E = () => {
2306
- a && (d(a.rowIndex, a.columnKey, h), t == null || t(a.rowIndex, a.columnKey, h)), g();
2307
- }, I = () => {
2308
- S(""), g();
2309
- }, P = St(), q = Pe(
2310
- () => [
2311
- P.accessor("rowIndex", {
2312
- header: "#",
2313
- size: 60,
2314
- cell: (x) => /* @__PURE__ */ p("span", { className: "ff-text-gray-400 ff-font-mono ff-text-xs", children: x.getValue() + 1 })
2315
- }),
2316
- ...R.map(
2317
- (x) => P.accessor((y) => y.data[x.targetKey] || y.data[x.sourceColumn], {
2318
- id: x.targetKey,
2319
- header: x.label,
2320
- cell: (y) => {
2321
- const V = y.row.original.rowIndex, K = String(y.getValue() ?? ""), H = _(V, x.targetKey);
2322
- return (a == null ? void 0 : a.rowIndex) === V && (a == null ? void 0 : a.columnKey) === x.targetKey ? /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-1", children: [
2323
- /* @__PURE__ */ p(
2324
- "input",
2325
- {
2326
- type: "text",
2327
- value: h,
2328
- onChange: (U) => S(U.target.value),
2329
- onKeyDown: (U) => {
2330
- U.key === "Enter" && E(), U.key === "Escape" && I();
2331
- },
2332
- className: "ff-input ff-py-1 ff-text-sm",
2333
- autoFocus: !0
2334
- }
2335
- ),
2336
- /* @__PURE__ */ p(
2337
- "button",
2338
- {
2339
- onClick: E,
2340
- className: "ff-px-3 ff-py-1 ff-text-xs ff-font-medium ff-text-white ff-bg-success-500 hover:ff-bg-success-600 ff-rounded ff-transition-colors",
2341
- children: "Save"
2342
- }
2343
- ),
2344
- /* @__PURE__ */ p(
2345
- "button",
2346
- {
2347
- onClick: I,
2348
- className: "ff-px-3 ff-py-1 ff-text-xs ff-font-medium ff-text-gray-110 ff-bg-gray-30 hover:ff-bg-gray-40 ff-rounded ff-transition-colors",
2349
- children: "Cancel"
2350
- }
2351
- )
2352
- ] }) : /* @__PURE__ */ w(
2353
- "div",
2354
- {
2355
- className: L(
2356
- "ff-group ff-flex ff-items-center ff-gap-2",
2357
- (H == null ? void 0 : H.severity) === "error" && "ff-cell-error",
2358
- (H == null ? void 0 : H.severity) === "warning" && "ff-cell-warning"
2359
- ),
2360
- children: [
2361
- /* @__PURE__ */ p("span", { className: "ff-flex-1 ff-truncate", children: K || /* @__PURE__ */ p("span", { className: "ff-text-gray-300", children: "—" }) }),
2362
- H && /* @__PURE__ */ w("div", { className: "ff-relative ff-group/tooltip", children: [
2363
- H.severity === "error" ? /* @__PURE__ */ p(ye, { className: "ff-w-4 ff-h-4 ff-text-error-500" }) : /* @__PURE__ */ p(he, { className: "ff-w-4 ff-h-4 ff-text-warning-500" }),
2364
- /* @__PURE__ */ w("div", { className: "ff-tooltip ff-bottom-full ff-left-1/2 ff-transform ff--translate-x-1/2 ff-mb-2 ff-w-48 group-hover/tooltip:ff-tooltip-visible", children: [
2365
- H.message,
2366
- H.suggestion && /* @__PURE__ */ p("span", { className: "ff-block ff-mt-1 ff-text-gray-300", children: H.suggestion })
2367
- ] })
2368
- ] }),
2369
- e && !H && /* @__PURE__ */ p(
2370
- "button",
2371
- {
2372
- onClick: () => $(V, x.targetKey, K),
2373
- className: "ff-opacity-0 group-hover:ff-opacity-100 ff-p-1 ff-text-gray-400 hover:ff-text-gray-600 ff-rounded ff-transition-opacity",
2374
- children: /* @__PURE__ */ p(mt, { className: "ff-w-3 ff-h-3" })
2375
- }
2376
- )
2377
- ]
2378
- }
2379
- );
2380
- }
2381
- })
2382
- )
2383
- ],
2384
- [R, a, h, e, _, P]
2385
- ), N = hn({
2386
- data: n,
2387
- columns: q,
2388
- state: {
2389
- sorting: c,
2390
- globalFilter: s
2391
- },
2392
- onSortingChange: f,
2393
- onGlobalFilterChange: m,
2394
- getCoreRowModel: on(),
2395
- getPaginationRowModel: gn(),
2396
- getSortedRowModel: dn(),
2397
- getFilteredRowModel: fn(),
2398
- initialState: {
2399
- pagination: {
2400
- pageSize: r
2401
- }
2402
- }
2403
- });
2404
- return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
2405
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between", children: [
2406
- /* @__PURE__ */ p(
2407
- "input",
2408
- {
2409
- type: "text",
2410
- value: s,
2411
- onChange: (x) => m(x.target.value),
2412
- placeholder: "Search all columns...",
2413
- className: "ff-input ff-max-w-xs"
2414
- }
2415
- ),
2416
- /* @__PURE__ */ w("div", { className: "ff-text-sm ff-text-gray-500", children: [
2417
- N.getFilteredRowModel().rows.length,
2418
- " rows"
2419
- ] })
2420
- ] }),
2421
- /* @__PURE__ */ p("div", { className: "ff-table-container ff-max-h-[500px]", children: /* @__PURE__ */ w("table", { className: "ff-table", children: [
2422
- /* @__PURE__ */ p("thead", { children: N.getHeaderGroups().map((x) => /* @__PURE__ */ p("tr", { children: x.headers.map((y) => /* @__PURE__ */ p(
2423
- "th",
2424
- {
2425
- style: { width: y.getSize() },
2426
- onClick: y.column.getToggleSortingHandler(),
2427
- className: L(
2428
- y.column.getCanSort() && "ff-cursor-pointer ff-select-none"
2429
- ),
2430
- children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-1", children: [
2431
- ze(y.column.columnDef.header, y.getContext()),
2432
- y.column.getIsSorted() && /* @__PURE__ */ p("span", { children: y.column.getIsSorted() === "asc" ? "↑" : "↓" })
2433
- ] })
2434
- },
2435
- y.id
2436
- )) }, x.id)) }),
2437
- /* @__PURE__ */ p("tbody", { children: N.getRowModel().rows.map((x) => {
2438
- const y = l.has(x.original.rowIndex);
2439
- return /* @__PURE__ */ p(
2440
- "tr",
2441
- {
2442
- className: L(y && "ff-bg-error-50/30"),
2443
- children: x.getVisibleCells().map((V) => /* @__PURE__ */ p("td", { children: ze(V.column.columnDef.cell, V.getContext()) }, V.id))
2444
- },
2445
- x.id
2446
- );
2447
- }) })
2448
- ] }) }),
2449
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-2", children: [
2450
- /* @__PURE__ */ w("div", { className: "ff-text-sm ff-text-gray-500", children: [
2451
- "Page ",
2452
- N.getState().pagination.pageIndex + 1,
2453
- " of ",
2454
- N.getPageCount()
2455
- ] }),
2456
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-2", children: [
2457
- /* @__PURE__ */ w(
2458
- "button",
2459
- {
2460
- onClick: () => N.previousPage(),
2461
- disabled: !N.getCanPreviousPage(),
2462
- className: "ff-btn ff-btn-secondary ff-py-1.5",
2463
- children: [
2464
- /* @__PURE__ */ p(ft, { className: "ff-w-4 ff-h-4" }),
2465
- "Previous"
2466
- ]
2467
- }
2468
- ),
2469
- /* @__PURE__ */ w(
2470
- "button",
2471
- {
2472
- onClick: () => N.nextPage(),
2473
- disabled: !N.getCanNextPage(),
2474
- className: "ff-btn ff-btn-secondary ff-py-1.5",
2475
- children: [
2476
- "Next",
2477
- /* @__PURE__ */ p(ot, { className: "ff-w-4 ff-h-4" })
2478
- ]
2479
- }
2480
- )
2481
- ] })
2482
- ] })
2483
- ] });
2484
- }, be = ({
2485
- showDetails: e = !0
2486
- }) => {
2487
- const { validationResults: r } = X();
2488
- if (!r)
2489
- return null;
2490
- const { isValid: t, totalRows: n, validRows: o, errorCount: i, warningCount: l, infoCount: a, summary: u } = r, g = Math.round(o / n * 100);
2491
- return /* @__PURE__ */ w("div", { className: "ff-space-y-4", children: [
2492
- /* @__PURE__ */ w(
2493
- "div",
2494
- {
2495
- className: L(
2496
- "ff-flex ff-items-center ff-gap-4 ff-p-4 ff-rounded-lg ff-border",
2497
- t ? "ff-bg-success-50 ff-border-success-200" : "ff-bg-error-50 ff-border-error-200"
2498
- ),
2499
- children: [
2500
- t ? /* @__PURE__ */ p(ne, { className: "ff-w-8 ff-h-8 ff-text-success-600" }) : /* @__PURE__ */ p(De, { className: "ff-w-8 ff-h-8 ff-text-error-600" }),
2501
- /* @__PURE__ */ w("div", { children: [
2502
- /* @__PURE__ */ p(
2503
- "h3",
2504
- {
2505
- className: L(
2506
- "ff-text-lg ff-font-semibold",
2507
- t ? "ff-text-success-800" : "ff-text-error-800"
2508
- ),
2509
- children: t ? "Validation Passed" : "Validation Failed"
2510
- }
2511
- ),
2512
- /* @__PURE__ */ w("p", { className: L("ff-text-sm", t ? "ff-text-success-600" : "ff-text-error-600"), children: [
2513
- o,
2514
- " of ",
2515
- n,
2516
- " rows are valid (",
2517
- g,
2518
- "%)"
2519
- ] })
2520
- ] })
2521
- ]
2522
- }
2523
- ),
2524
- /* @__PURE__ */ w("div", { className: "ff-grid ff-grid-cols-4 ff-gap-4", children: [
2525
- /* @__PURE__ */ w("div", { className: "ff-bg-white ff-border ff-border-gray-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2526
- /* @__PURE__ */ p("p", { className: "ff-text-2xl ff-font-bold ff-text-gray-900", children: n }),
2527
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-gray-500", children: "Total Rows" })
2528
- ] }),
2529
- /* @__PURE__ */ w("div", { className: "ff-bg-success-50 ff-border ff-border-success-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2530
- /* @__PURE__ */ p("p", { className: "ff-text-2xl ff-font-bold ff-text-success-700", children: o }),
2531
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-success-600", children: "Valid Rows" })
2532
- ] }),
2533
- /* @__PURE__ */ w("div", { className: "ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2534
- /* @__PURE__ */ p("p", { className: "ff-text-2xl ff-font-bold ff-text-error-700", children: i }),
2535
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-error-600", children: "Errors" })
2536
- ] }),
2537
- /* @__PURE__ */ w("div", { className: "ff-bg-warning-50 ff-border ff-border-warning-200 ff-rounded-lg ff-p-4 ff-text-center", children: [
2538
- /* @__PURE__ */ p("p", { className: "ff-text-2xl ff-font-bold ff-text-warning-700", children: l }),
2539
- /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-warning-600", children: "Warnings" })
2540
- ] })
2541
- ] }),
2542
- e && u.byColumn && Object.keys(u.byColumn).length > 0 && /* @__PURE__ */ w("div", { className: "ff-bg-white ff-border ff-border-gray-200 ff-rounded-lg ff-overflow-hidden", children: [
2543
- /* @__PURE__ */ p("div", { className: "ff-px-4 ff-py-3 ff-bg-gray-50 ff-border-b ff-border-gray-200", children: /* @__PURE__ */ p("h4", { className: "ff-font-medium ff-text-gray-700", children: "Issues by Column" }) }),
2544
- /* @__PURE__ */ p("div", { className: "ff-divide-y ff-divide-gray-100", children: Object.entries(u.byColumn).filter(([, d]) => d.errorCount > 0 || d.warningCount > 0).map(([d, c]) => /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-4 ff-py-3", children: [
2545
- /* @__PURE__ */ w("div", { children: [
2546
- /* @__PURE__ */ p("p", { className: "ff-font-medium ff-text-gray-900", children: c.columnKey }),
2547
- c.mostCommonError && /* @__PURE__ */ p("p", { className: "ff-text-sm ff-text-gray-500", children: c.mostCommonError })
2548
- ] }),
2549
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-gap-3", children: [
2550
- c.errorCount > 0 && /* @__PURE__ */ w("span", { className: "ff-badge ff-badge-error", children: [
2551
- /* @__PURE__ */ p(De, { className: "ff-w-3 ff-h-3 ff-mr-1" }),
2552
- c.errorCount,
2553
- " errors"
2554
- ] }),
2555
- c.warningCount > 0 && /* @__PURE__ */ w("span", { className: "ff-badge ff-badge-warning", children: [
2556
- /* @__PURE__ */ p(he, { className: "ff-w-3 ff-h-3 ff-mr-1" }),
2557
- c.warningCount,
2558
- " warnings"
2559
- ] })
2560
- ] })
2561
- ] }, d)) })
2562
- ] }),
2563
- e && u.duplicates && u.duplicates.length > 0 && /* @__PURE__ */ p("div", { className: "ff-bg-warning-50 ff-border ff-border-warning-200 ff-rounded-lg ff-p-4", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-items-start ff-gap-3", children: [
2564
- /* @__PURE__ */ p(he, { className: "ff-w-5 ff-h-5 ff-text-warning-600 ff-flex-shrink-0 ff-mt-0.5" }),
2565
- /* @__PURE__ */ w("div", { children: [
2566
- /* @__PURE__ */ p("h4", { className: "ff-font-medium ff-text-warning-800", children: "Duplicate Values Found" }),
2567
- /* @__PURE__ */ w("ul", { className: "ff-mt-2 ff-space-y-1 ff-text-sm ff-text-warning-700", children: [
2568
- u.duplicates.slice(0, 5).map((d, c) => /* @__PURE__ */ w("li", { children: [
2569
- /* @__PURE__ */ p("span", { className: "ff-font-mono", children: d.columnKey }),
2570
- ': "',
2571
- String(d.value),
2572
- '" appears',
2573
- " ",
2574
- d.rowIndices.length,
2575
- " times (rows",
2576
- " ",
2577
- d.rowIndices.slice(0, 3).map((f) => f + 1).join(", "),
2578
- d.rowIndices.length > 3 ? "..." : "",
2579
- ")"
2580
- ] }, c)),
2581
- u.duplicates.length > 5 && /* @__PURE__ */ w("li", { className: "ff-text-warning-600", children: [
2582
- "... and ",
2583
- u.duplicates.length - 5,
2584
- " more duplicate groups"
2585
- ] })
2586
- ] })
2587
- ] })
2588
- ] }) })
2589
- ] });
2590
- }, ce = [
2591
- { key: "upload", label: "Upload", icon: Oe },
2592
- { key: "mapping", label: "Map Columns", icon: ct },
2593
- { key: "validation", label: "Validate", icon: at },
2594
- { key: "review", label: "Review", icon: gt },
2595
- { key: "complete", label: "Complete", icon: ne }
2596
- ], vn = ({
2597
- template: e,
2598
- schema: r,
2599
- onComplete: t,
2600
- onCancel: n,
2601
- onError: o
2602
- }) => {
2603
- const {
2604
- step: i,
2605
- sessionId: l,
2606
- file: a,
2607
- mappings: u,
2608
- validationResults: g,
2609
- isLoading: d,
2610
- error: c,
2611
- setSchema: f,
2612
- setSessionId: s,
2613
- setParsedData: m,
2614
- setMappings: h,
2615
- setUnmapped: S,
2616
- setValidationResults: R,
2617
- setStep: _,
2618
- nextStep: $,
2619
- previousStep: E,
2620
- setLoading: I,
2621
- setError: P,
2622
- reset: q
2623
- } = X(), [N, x] = Y(null), [y, V] = Y(null);
2624
- Ne(() => {
2625
- if (V(null), e)
2626
- if (it(e)) {
2627
- const F = lt(e);
2628
- F ? x(F) : (V(`Failed to load template "${e}"`), o == null || o(new Error(`Failed to load template "${e}"`)));
2629
- } else {
2630
- const F = `Template "${e}" not found. Available templates: ${Le.join(", ")}`;
2631
- V(F), o == null || o(new Error(F));
2632
- }
2633
- else if (r)
2634
- x(r);
2635
- else {
2636
- const F = `No template or schema provided. Please specify a template (${Le.join(", ")}) or provide a custom schema.`;
2637
- V(F), o == null || o(new Error(F));
2638
- }
2639
- }, [e, r, o]), Ne(() => {
2640
- N && (f(N), K(N));
2641
- }, [N]);
2642
- const K = async (F) => {
2643
- try {
2644
- I(!0);
2645
- const G = await W().createImportSession(F);
2646
- s(G.sessionId);
2647
- } catch (M) {
2648
- const G = M;
2649
- P(G.message), o == null || o(G);
2650
- } finally {
2651
- I(!1);
2652
- }
2653
- }, H = xe(async (F) => {
2654
- if (l)
2655
- try {
2656
- I(!0), P(null);
2657
- const G = await W().uploadFile(l, F);
2658
- m({
2659
- headers: G.data.headers,
2660
- rows: G.data.sampleRows.map((O, B) => ({
2661
- rowIndex: B,
2662
- data: O,
2663
- rawData: Object.values(O)
2664
- })),
2665
- totalRows: G.data.totalRows,
2666
- sampleRows: G.data.sampleRows.map((O, B) => ({
2667
- rowIndex: B,
2668
- data: O,
2669
- rawData: Object.values(O)
2670
- }))
2671
- }), $(), await Me();
2672
- } catch (M) {
2673
- const G = M;
2674
- P(G.message), o == null || o(G);
2675
- } finally {
2676
- I(!1);
2677
- }
2678
- }, [l]), Me = async () => {
2679
- if (l)
2680
- try {
2681
- I(!0);
2682
- const M = await W().matchColumns(l);
2683
- h(M.mappings), S(M.unmappedSource, M.unmappedTarget);
2684
- } catch (F) {
2685
- const M = F;
2686
- P(M.message), o == null || o(M);
2687
- } finally {
2688
- I(!1);
2689
- }
2690
- }, U = async () => {
2691
- if (l)
2692
- try {
2693
- I(!0), P(null);
2694
- const M = await W().validateImport(l);
2695
- R(M.validation), $();
2696
- } catch (F) {
2697
- const M = F;
2698
- P(M.message), o == null || o(M);
2699
- } finally {
2700
- I(!1);
2701
- }
2702
- }, Ye = async () => {
2703
- if (l)
2704
- try {
2705
- I(!0), P(null);
2706
- const M = await W().completeImport(l, {
2707
- skipInvalidRows: !0,
2708
- acknowledgeWarnings: !0
2709
- });
2710
- _("complete"), t == null || t(M);
2711
- } catch (F) {
2712
- const M = F;
2713
- P(M.message), o == null || o(M);
2714
- } finally {
2715
- I(!1);
2716
- }
2717
- }, Ve = () => {
2718
- q(), n == null || n();
2719
- }, oe = () => ce.findIndex((F) => F.key === i), Je = () => {
2720
- switch (i) {
2721
- case "upload":
2722
- return a !== null;
2723
- case "mapping":
2724
- return u.length > 0 && u.some((F) => F.targetKey !== null);
2725
- case "validation":
2726
- return g !== null;
2727
- case "review":
2728
- return !0;
2729
- default:
2730
- return !1;
2731
- }
2732
- }, Qe = async () => {
2733
- switch (i) {
2734
- case "mapping":
2735
- await U();
2736
- break;
2737
- case "validation":
2738
- $();
2739
- break;
2740
- case "review":
2741
- await Ye();
2742
- break;
2743
- default:
2744
- $();
2745
- }
2746
- };
2747
- return y ? /* @__PURE__ */ p("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8", children: [
2748
- /* @__PURE__ */ p("div", { className: "ff-w-16 ff-h-16 ff-bg-error-100 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4", children: /* @__PURE__ */ p(me, { className: "ff-w-10 ff-h-10 ff-text-error-600" }) }),
2749
- /* @__PURE__ */ p("h3", { className: "ff-text-xl ff-font-semibold ff-text-gray-900 ff-mb-2", children: "Configuration Error" }),
2750
- /* @__PURE__ */ p("p", { className: "ff-text-gray-500 ff-text-center ff-max-w-md ff-mb-4", children: y }),
2751
- n && /* @__PURE__ */ p("button", { onClick: Ve, className: "ff-btn ff-btn-secondary", children: "Close" })
2752
- ] }) }) : N ? /* @__PURE__ */ w("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-flex ff-flex-col ff-max-h-[90vh]", children: [
2753
- /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-b ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0", children: [
2754
- /* @__PURE__ */ p("h2", { className: "ff-text-xl ff-font-semibold ff-text-gray-900", children: "Import Data" }),
2755
- /* @__PURE__ */ p(
2756
- "button",
2757
- {
2758
- onClick: Ve,
2759
- className: "ff-p-2 ff-text-gray-400 hover:ff-text-gray-600 ff-rounded-full hover:ff-bg-gray-100",
2760
- children: /* @__PURE__ */ p(me, { className: "ff-w-5 ff-h-5" })
2761
- }
2762
- )
2763
- ] }),
2764
- /* @__PURE__ */ p("div", { className: "ff-px-6 ff-py-4 ff-border-b ff-border-gray-200 ff-flex-shrink-0", children: /* @__PURE__ */ p("div", { className: "ff-flex ff-items-center ff-justify-between", children: ce.map((F, M) => {
2765
- const G = F.icon, O = F.key === i, B = oe() > M, ie = oe() < M;
2766
- return /* @__PURE__ */ w(tt.Fragment, { children: [
2767
- /* @__PURE__ */ w(
2768
- "div",
2769
- {
2770
- className: L(
2771
- "ff-flex ff-items-center ff-gap-2",
2772
- O && "ff-text-primary-600",
2773
- B && "ff-text-success-600",
2774
- ie && "ff-text-gray-300"
2775
- ),
2776
- children: [
2777
- /* @__PURE__ */ p(
2778
- "div",
2779
- {
2780
- className: L(
2781
- "ff-flex ff-items-center ff-justify-center ff-w-8 ff-h-8 ff-rounded-full",
2782
- O && "ff-bg-primary-100",
2783
- B && "ff-bg-success-100",
2784
- ie && "ff-bg-gray-100"
2785
- ),
2786
- children: B ? /* @__PURE__ */ p(ne, { className: "ff-w-5 ff-h-5" }) : /* @__PURE__ */ p(G, { className: "ff-w-4 ff-h-4" })
2787
- }
2788
- ),
2789
- /* @__PURE__ */ p(
2790
- "span",
2791
- {
2792
- className: L(
2793
- "ff-text-sm ff-font-medium",
2794
- ie && "ff-text-gray-400"
2795
- ),
2796
- children: F.label
2797
- }
2798
- )
2799
- ]
2800
- }
2801
- ),
2802
- M < ce.length - 1 && /* @__PURE__ */ p(
2803
- "div",
2804
- {
2805
- className: L(
2806
- "ff-flex-1 ff-h-0.5 ff-mx-4",
2807
- B ? "ff-bg-success-300" : "ff-bg-gray-200"
2808
- )
2809
- }
2810
- )
2811
- ] }, F.key);
2812
- }) }) }),
2813
- /* @__PURE__ */ w("div", { className: "ff-p-6 ff-min-h-[200px] ff-overflow-y-auto ff-flex-1", children: [
2814
- c && /* @__PURE__ */ p("div", { className: "ff-mb-4 ff-p-4 ff-bg-error-50 ff-border ff-border-error-200 ff-rounded-lg ff-text-error-700", children: c }),
2815
- i === "upload" && /* @__PURE__ */ p("div", { className: "ff-max-w-xl ff-mx-auto", children: /* @__PURE__ */ p(ht, { onFileSelect: H }) }),
2816
- i === "mapping" && /* @__PURE__ */ p(wt, {}),
2817
- i === "validation" && /* @__PURE__ */ w("div", { className: "ff-space-y-6", children: [
2818
- /* @__PURE__ */ p(be, {}),
2819
- /* @__PURE__ */ p(ke, { editable: !0 })
2820
- ] }),
2821
- i === "review" && /* @__PURE__ */ w("div", { className: "ff-space-y-6", children: [
2822
- /* @__PURE__ */ p(be, { showDetails: !1 }),
2823
- /* @__PURE__ */ p(ke, { editable: !1, pageSize: 10 })
2824
- ] }),
2825
- i === "complete" && /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-12", children: [
2826
- /* @__PURE__ */ p("div", { className: "ff-w-16 ff-h-16 ff-bg-success-100 ff-rounded-full ff-flex ff-items-center ff-justify-center ff-mb-4", children: /* @__PURE__ */ p(ne, { className: "ff-w-10 ff-h-10 ff-text-success-600" }) }),
2827
- /* @__PURE__ */ p("h3", { className: "ff-text-xl ff-font-semibold ff-text-gray-900 ff-mb-2", children: "Import Complete!" }),
2828
- /* @__PURE__ */ p("p", { className: "ff-text-gray-500", children: "Your data has been successfully imported." })
2829
- ] })
2830
- ] }),
2831
- i !== "complete" && /* @__PURE__ */ w("div", { className: "ff-flex ff-items-center ff-justify-between ff-px-6 ff-py-4 ff-border-t ff-border-gray-200 ff-bg-gray-50 ff-flex-shrink-0", children: [
2832
- /* @__PURE__ */ p(
2833
- "button",
2834
- {
2835
- onClick: E,
2836
- disabled: oe() === 0 || d,
2837
- className: "ff-btn ff-btn-secondary",
2838
- children: "Back"
2839
- }
2840
- ),
2841
- /* @__PURE__ */ p(
2842
- "button",
2843
- {
2844
- onClick: Qe,
2845
- disabled: !Je() || d,
2846
- className: "ff-btn ff-btn-primary",
2847
- children: d ? /* @__PURE__ */ w(et, { children: [
2848
- /* @__PURE__ */ p(Ee, { className: "ff-w-4 ff-h-4 ff-mr-2 ff-animate-spin" }),
2849
- "Processing..."
2850
- ] }) : i === "review" ? "Complete Import" : "Continue"
2851
- }
2852
- )
2853
- ] })
2854
- ] }) : /* @__PURE__ */ p("div", { className: "ff-container ff-bg-white ff-rounded-xl ff-shadow-xl ff-overflow-hidden ff-p-6", children: /* @__PURE__ */ w("div", { className: "ff-flex ff-flex-col ff-items-center ff-justify-center ff-py-8", children: [
2855
- /* @__PURE__ */ p(Ee, { className: "ff-w-10 ff-h-10 ff-text-primary-600 ff-animate-spin ff-mb-4" }),
2856
- /* @__PURE__ */ p("p", { className: "ff-text-gray-500", children: "Loading template..." })
2857
- ] }) });
2858
- };
2859
- export {
2860
- wt as C,
2861
- ke as D,
2862
- ht as F,
2863
- vn as I,
2864
- be as V,
2865
- X as u
2866
- };
2867
- //# sourceMappingURL=ImportWizard-CtAWJz5i.mjs.map