@nivaro/react 0.3.103 → 0.3.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +15 -3
  4. package/dist/shared/components/CollectionBrowserView.js +1694 -1639
  5. package/dist/shared/components/ItemEditForm.js +2867 -2845
  6. package/dist/shared/components/imports/CollectionImportPanel.js +483 -459
  7. package/dist/shared/components/integrations/IntegrationStatusLines.js +71 -68
  8. package/dist/shared/components/item-edit/InlineTableField.js +88 -88
  9. package/dist/shared/components/item-edit/UserChip.js +38 -38
  10. package/dist/shared/components/layout-editor/DesignNode.js +16 -14
  11. package/dist/shared/components/layout-editor/LayoutEditor.js +445 -441
  12. package/dist/shared/components/layout-editor/inspector/Inspector.js +18 -18
  13. package/dist/shared/components/layout-editor/inspector/SlotInspector.js +80 -52
  14. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  15. package/dist/shared/components/layout-editor/settings/ButtonsSection.js +54 -26
  16. package/dist/shared/components/layout-editor/settings/settings-registry.js +23 -15
  17. package/dist/shared/components/layout-editor/useLayoutDraft.js +211 -196
  18. package/dist/shared/components/panels/ExternalRequestsChip.js +141 -122
  19. package/dist/shared/components/quick-filters/QuickFilterBarEditor.js +334 -0
  20. package/dist/shared/components/quick-filters/QuickFilterFieldPicker.js +151 -0
  21. package/dist/shared/components/quick-filters/QuickFilterForm.js +371 -0
  22. package/dist/shared/components/quick-filters/config.js +63 -0
  23. package/dist/shared/components/quick-filters/facets.js +55 -0
  24. package/dist/shared/components/quick-filters/useQuickFilterEditing.js +95 -0
  25. package/dist/shared/lib/entry-config.js +7 -7
  26. package/dist/shared/lib/integration-chip.js +10 -6
  27. package/dist/shared/lib/owners-header-tile.js +63 -0
  28. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
- import { jsx as e, jsxs as a, Fragment as Be } from "react/jsx-runtime";
2
- import { useQueryClient as Je, useQuery as U, useMutation as Q } from "@tanstack/react-query";
3
- import { Upload as Ve, Plus as qe, ArrowLeft as Me, FileUp as je, Link2 as We, Loader2 as me, Sparkles as He, ArrowRight as $e, MoreHorizontal as Ge, Trash2 as Ze, ChevronsUpDown as Xe, Check as Ye } from "lucide-react";
4
- import { useState as x, useMemo as V, useEffect as Fe, useRef as Te } from "react";
5
- import { useNivaroClient as re, useNavigation as et } from "../../context.js";
6
- import { get as W, del as tt, post as I } from "../../lib/commands.js";
7
- import { errorSentence as at, rowErrorSentence as De } from "../../lib/error-message.js";
8
- import { formatNumber as _, toLocalDateString as rt, cn as N, formatRelative as st, formatDateTime as te } from "../../lib/utils.js";
9
- import { DataTable as lt } from "../DataTable.js";
1
+ import { jsx as e, jsxs as r, Fragment as Ve } from "react/jsx-runtime";
2
+ import { useQueryClient as je, useQuery as U, useMutation as K } from "@tanstack/react-query";
3
+ import { Upload as We, Plus as $e, ArrowLeft as Re, FileUp as He, Link2 as Ge, Loader2 as me, Sparkles as Ze, ArrowRight as Ee, MoreHorizontal as Xe, Trash2 as Ye, ChevronsUpDown as et, Check as tt } from "lucide-react";
4
+ import { useState as f, useMemo as V, useEffect as Ie, useRef as Te } from "react";
5
+ import { useNivaroClient as ae, useNavigation as rt } from "../../context.js";
6
+ import { get as W, del as at, post as L } from "../../lib/commands.js";
7
+ import { errorSentence as st, rowErrorSentence as De } from "../../lib/error-message.js";
8
+ import { formatNumber as C, toLocalDateString as lt, cn as k, formatRelative as ot, formatDateTime as te } from "../../lib/utils.js";
9
+ import { DataTable as nt } from "../DataTable.js";
10
10
  import { Button as F } from "../ui/button.js";
11
- import { Command as nt, CommandInput as ot, CommandList as dt, CommandEmpty as it, CommandItem as ct } from "../ui/command.js";
12
- import { DropdownMenu as mt, DropdownMenuTrigger as pt, DropdownMenuContent as ut, DropdownMenuItem as he } from "../ui/dropdown-menu.js";
13
- import { Input as Re } from "../ui/input.js";
11
+ import { Command as dt, CommandInput as it, CommandList as ct, CommandEmpty as mt, CommandItem as pt } from "../ui/command.js";
12
+ import { DropdownMenu as ut, DropdownMenuTrigger as xt, DropdownMenuContent as ht, DropdownMenuItem as xe } from "../ui/dropdown-menu.js";
13
+ import { Input as Ae } from "../ui/input.js";
14
14
  import { Label as J } from "../ui/label.js";
15
- import { Popover as ht, PopoverTrigger as xt, PopoverContent as bt } from "../ui/popover.js";
16
- import { SimpleSelect as ft } from "../ui/SimpleSelect.js";
17
- import { Sheet as gt, SheetContent as vt } from "../ui/sheet.js";
15
+ import { Popover as bt, PopoverTrigger as ft, PopoverContent as gt } from "../ui/popover.js";
16
+ import { SimpleSelect as vt } from "../ui/SimpleSelect.js";
17
+ import { Sheet as kt, SheetContent as wt } from "../ui/sheet.js";
18
18
  import { Switch as Nt } from "../ui/switch.js";
19
- import { Textarea as kt } from "../ui/textarea.js";
19
+ import { Textarea as yt } from "../ui/textarea.js";
20
20
  const pe = 25, ue = ["Source", "Map columns", "Options", "Confirm"], j = {
21
21
  pending: { dot: "bg-slate-400", text: "text-slate-600 dark:text-slate-300", label: "Pending" },
22
22
  processing: {
@@ -30,19 +30,19 @@ const pe = 25, ue = ["Source", "Map columns", "Options", "Confirm"], j = {
30
30
  label: "Complete"
31
31
  },
32
32
  failed: { dot: "bg-red-500", text: "text-red-700 dark:text-red-400", label: "Failed" }
33
- }, wt = "Roll back this import? Created rows are deleted (to trash) and overwritten rows restored to their prior values. One-shot.";
34
- function yt({
35
- disabled: o,
33
+ }, _t = "Roll back this import? Created rows are deleted (to trash) and overwritten rows restored to their prior values. One-shot.";
34
+ function Ct({
35
+ disabled: d,
36
36
  rolledBack: n,
37
37
  onConfirm: l
38
38
  }) {
39
- const [m, i] = x(!1);
39
+ const [m, i] = f(!1);
40
40
  return /* @__PURE__ */ e(
41
- he,
41
+ xe,
42
42
  {
43
- disabled: o,
43
+ disabled: d,
44
44
  "data-armed": m ? "" : void 0,
45
- className: N(
45
+ className: k(
46
46
  m && "max-w-[300px] whitespace-normal bg-red-50 font-medium text-red-700 focus:bg-red-100 focus:text-red-800 dark:bg-red-500/10 dark:text-red-400 dark:focus:bg-red-500/20 dark:focus:text-red-300"
47
47
  ),
48
48
  onSelect: (s) => {
@@ -52,84 +52,84 @@ function yt({
52
52
  }
53
53
  i(!1), l();
54
54
  },
55
- children: m ? /* @__PURE__ */ a("span", { className: "block", children: [
56
- wt,
55
+ children: m ? /* @__PURE__ */ r("span", { className: "block", children: [
56
+ _t,
57
57
  /* @__PURE__ */ e("span", { className: "mt-1 block text-[11px] font-semibold", children: "Choose again to roll back" })
58
58
  ] }) : n ? "Rolled back" : "Roll back this import"
59
59
  }
60
60
  );
61
61
  }
62
- function Ee({ status: o }) {
63
- const n = j[o] ?? j.pending;
64
- return /* @__PURE__ */ a("span", { className: N("flex items-center gap-1.5 text-[12px] font-medium", n.text), children: [
65
- /* @__PURE__ */ a("span", { className: "relative flex h-1.5 w-1.5 shrink-0", children: [
66
- o === "processing" && /* @__PURE__ */ e(
62
+ function Le({ status: d }) {
63
+ const n = j[d] ?? j.pending;
64
+ return /* @__PURE__ */ r("span", { className: k("flex items-center gap-1.5 text-[12px] font-medium", n.text), children: [
65
+ /* @__PURE__ */ r("span", { className: "relative flex h-1.5 w-1.5 shrink-0", children: [
66
+ d === "processing" && /* @__PURE__ */ e(
67
67
  "span",
68
68
  {
69
- className: N(
69
+ className: k(
70
70
  "absolute inline-flex h-full w-full rounded-full opacity-75 motion-safe:animate-ping",
71
71
  n.dot
72
72
  )
73
73
  }
74
74
  ),
75
- /* @__PURE__ */ e("span", { className: N("relative inline-flex h-1.5 w-1.5 rounded-full", n.dot) })
75
+ /* @__PURE__ */ e("span", { className: k("relative inline-flex h-1.5 w-1.5 rounded-full", n.dot) })
76
76
  ] }),
77
77
  n.label
78
78
  ] });
79
79
  }
80
- function Ct({
81
- processed: o,
80
+ function St({
81
+ processed: d,
82
82
  total: n,
83
83
  failed: l
84
84
  }) {
85
85
  if (!n) return /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-300", children: "—" });
86
- const m = Math.min(100, Math.round((o ?? 0) / n * 100));
87
- return /* @__PURE__ */ a("div", { className: "flex min-w-[92px] items-center gap-2", children: [
86
+ const m = Math.min(100, Math.round((d ?? 0) / n * 100));
87
+ return /* @__PURE__ */ r("div", { className: "flex min-w-[92px] items-center gap-2", children: [
88
88
  /* @__PURE__ */ e("div", { className: "h-1.5 flex-1 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
89
89
  "div",
90
90
  {
91
- className: N(
91
+ className: k(
92
92
  "h-full rounded-full transition-[width] duration-500",
93
93
  l ? "bg-red-500" : "bg-nvr-cyan"
94
94
  ),
95
95
  style: { width: `${m}%` }
96
96
  }
97
97
  ) }),
98
- /* @__PURE__ */ a("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: [
98
+ /* @__PURE__ */ r("span", { className: "w-8 text-right text-[11px] tabular-nums text-slate-400", children: [
99
99
  m,
100
100
  "%"
101
101
  ] })
102
102
  ] });
103
103
  }
104
- function ae(o) {
104
+ function re(d) {
105
105
  const n = [];
106
106
  let l = "", m = !1;
107
- for (let i = 0; i < o.length; i++) {
108
- const s = o[i];
109
- m ? s === '"' && o[i + 1] === '"' ? (l += '"', i++) : s === '"' ? m = !1 : l += s : s === '"' ? m = !0 : s === "," ? (n.push(l), l = "") : l += s;
107
+ for (let i = 0; i < d.length; i++) {
108
+ const s = d[i];
109
+ m ? s === '"' && d[i + 1] === '"' ? (l += '"', i++) : s === '"' ? m = !1 : l += s : s === '"' ? m = !0 : s === "," ? (n.push(l), l = "") : l += s;
110
110
  }
111
111
  return n.push(l), n.map((i) => i.trim());
112
112
  }
113
- function _t(o) {
114
- const n = o.split(/\r?\n/).filter((i) => i.trim());
113
+ function Pt(d) {
114
+ const n = d.split(/\r?\n/).filter((i) => i.trim());
115
115
  if (n.length === 0) return { headers: [], rows: [], rowCount: 0 };
116
- const l = ae(n[0]), m = n.slice(1, 6).map(ae);
116
+ const l = re(n[0]), m = n.slice(1, 6).map(re);
117
117
  return { headers: l, rows: m, rowCount: Math.max(0, n.length - 1) };
118
118
  }
119
119
  function X({
120
- value: o,
120
+ value: d,
121
121
  onChange: n,
122
122
  options: l,
123
123
  placeholder: m = "Select…",
124
124
  className: i
125
125
  }) {
126
- const [s, g] = x(!1), C = l.find((h) => h.value === o);
127
- return /* @__PURE__ */ a(ht, { open: s, onOpenChange: g, children: [
128
- /* @__PURE__ */ e(xt, { asChild: !0, children: /* @__PURE__ */ a(
126
+ const [s, g] = f(!1), S = l.find((x) => x.value === d);
127
+ return /* @__PURE__ */ r(bt, { open: s, onOpenChange: g, children: [
128
+ /* @__PURE__ */ e(ft, { asChild: !0, children: /* @__PURE__ */ r(
129
129
  "button",
130
130
  {
131
131
  type: "button",
132
- className: N(
132
+ className: k(
133
133
  "flex h-8 w-full items-center justify-between gap-2 rounded-md border border-slate-200 bg-white px-2.5 text-left text-[12px] transition-colors hover:border-slate-300 dark:border-border dark:bg-card",
134
134
  i
135
135
  ),
@@ -137,54 +137,54 @@ function X({
137
137
  /* @__PURE__ */ e(
138
138
  "span",
139
139
  {
140
- className: N(
140
+ className: k(
141
141
  "truncate font-mono",
142
- C ? "text-slate-800 dark:text-foreground" : "text-slate-400"
142
+ S ? "text-slate-800 dark:text-foreground" : "text-slate-400"
143
143
  ),
144
- children: (C == null ? void 0 : C.label) ?? m
144
+ children: (S == null ? void 0 : S.label) ?? m
145
145
  }
146
146
  ),
147
- /* @__PURE__ */ e(Xe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
147
+ /* @__PURE__ */ e(et, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" })
148
148
  ]
149
149
  }
150
150
  ) }),
151
- /* @__PURE__ */ e(bt, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ a(nt, { children: [
152
- /* @__PURE__ */ e(ot, { placeholder: "Search…", className: "h-8 text-[12px]" }),
153
- /* @__PURE__ */ a(dt, { children: [
154
- /* @__PURE__ */ e(it, { children: "Nothing matches." }),
155
- l.map((h) => /* @__PURE__ */ a(
156
- ct,
151
+ /* @__PURE__ */ e(gt, { className: "w-[240px] p-0", align: "start", children: /* @__PURE__ */ r(dt, { children: [
152
+ /* @__PURE__ */ e(it, { placeholder: "Search…", className: "h-8 text-[12px]" }),
153
+ /* @__PURE__ */ r(ct, { children: [
154
+ /* @__PURE__ */ e(mt, { children: "Nothing matches." }),
155
+ l.map((x) => /* @__PURE__ */ r(
156
+ pt,
157
157
  {
158
- value: h.label,
158
+ value: x.label,
159
159
  onSelect: () => {
160
- n(h.value), g(!1);
160
+ n(x.value), g(!1);
161
161
  },
162
162
  className: "text-[12px]",
163
163
  children: [
164
164
  /* @__PURE__ */ e(
165
- Ye,
165
+ tt,
166
166
  {
167
- className: N(
167
+ className: k(
168
168
  "h-3.5 w-3.5",
169
- h.value === o ? "text-nvr-cyan opacity-100" : "opacity-0"
169
+ x.value === d ? "text-nvr-cyan opacity-100" : "opacity-0"
170
170
  )
171
171
  }
172
172
  ),
173
- /* @__PURE__ */ e("span", { className: "font-mono", children: h.label })
173
+ /* @__PURE__ */ e("span", { className: "font-mono", children: x.label })
174
174
  ]
175
175
  },
176
- h.value || "__skip__"
176
+ x.value || "__skip__"
177
177
  ))
178
178
  ] })
179
179
  ] }) })
180
180
  ] });
181
181
  }
182
- function St({ confidence: o }) {
183
- const n = Math.round(o * 100), l = n >= 80 ? "text-emerald-700 dark:text-emerald-400" : n >= 50 ? "text-amber-700 dark:text-amber-400" : "text-slate-500";
184
- return /* @__PURE__ */ a(
182
+ function Mt({ confidence: d }) {
183
+ const n = Math.round(d * 100), l = n >= 80 ? "text-emerald-700 dark:text-emerald-400" : n >= 50 ? "text-amber-700 dark:text-amber-400" : "text-slate-500";
184
+ return /* @__PURE__ */ r(
185
185
  "span",
186
186
  {
187
- className: N("shrink-0 text-[10.5px] font-medium tabular-nums", l),
187
+ className: k("shrink-0 text-[10.5px] font-medium tabular-nums", l),
188
188
  title: "AI mapping confidence",
189
189
  children: [
190
190
  "AI ",
@@ -194,74 +194,74 @@ function St({ confidence: o }) {
194
194
  }
195
195
  );
196
196
  }
197
- function Xt({
198
- initialJobId: o,
197
+ function Yt({
198
+ initialJobId: d,
199
199
  onJobOpen: n
200
200
  }) {
201
- var K;
202
- const l = re(), m = Je(), [i, s] = x("list"), [g, C] = x(o ?? null), [h, D] = x("all"), [p, c] = x(1), [v, k] = x(null), u = U({
201
+ var Q;
202
+ const l = ae(), m = je(), [i, s] = f("list"), [g, S] = f(d ?? null), [x, T] = f("all"), [p, c] = f(1), [v, w] = f(null), u = U({
203
203
  queryKey: ["collection-import-jobs"],
204
204
  // The endpoint returns every job the caller may see, so the counters below
205
205
  // are exact rather than page-scoped.
206
206
  queryFn: () => l.request(W("/imports")),
207
- refetchInterval: (r) => {
208
- var w;
209
- return (((w = r.state.data) == null ? void 0 : w.data) ?? []).some(($) => $.status === "pending" || $.status === "processing") ? 3e3 : !1;
207
+ refetchInterval: (a) => {
208
+ var N;
209
+ return (((N = a.state.data) == null ? void 0 : N.data) ?? []).some((A) => A.status === "pending" || A.status === "processing") ? 3e3 : !1;
210
210
  },
211
- placeholderData: (r) => r
212
- }), P = V(() => {
213
- var r;
214
- return ((r = u.data) == null ? void 0 : r.data) ?? [];
215
- }, [(K = u.data) == null ? void 0 : K.data]), S = V(() => {
216
- const r = {};
217
- for (const w of P) r[w.status] = (r[w.status] ?? 0) + 1;
218
- return r;
219
- }, [P]), A = V(
220
- () => P.reduce(
221
- (r, w) => ({
222
- created: r.created + (w.created_rows ?? 0),
223
- updated: r.updated + (w.updated_rows ?? 0),
224
- skipped: r.skipped + (w.skipped_rows ?? 0),
225
- errors: r.errors + (w.error_rows ?? 0)
211
+ placeholderData: (a) => a
212
+ }), $ = V(() => {
213
+ var a;
214
+ return ((a = u.data) == null ? void 0 : a.data) ?? [];
215
+ }, [(Q = u.data) == null ? void 0 : Q.data]), P = V(() => {
216
+ const a = {};
217
+ for (const N of $) a[N.status] = (a[N.status] ?? 0) + 1;
218
+ return a;
219
+ }, [$]), D = V(
220
+ () => $.reduce(
221
+ (a, N) => ({
222
+ created: a.created + (N.created_rows ?? 0),
223
+ updated: a.updated + (N.updated_rows ?? 0),
224
+ skipped: a.skipped + (N.skipped_rows ?? 0),
225
+ errors: a.errors + (N.error_rows ?? 0)
226
226
  }),
227
227
  { created: 0, updated: 0, skipped: 0, errors: 0 }
228
228
  ),
229
- [P]
230
- ), O = h === "all" ? P : P.filter((r) => r.status === h), H = O.slice((p - 1) * pe, p * pe);
231
- Fe(() => c(1), [h]);
232
- const E = Q({
233
- mutationFn: (r) => l.request(tt(`/imports/${r}`)),
229
+ [$]
230
+ ), O = x === "all" ? $ : $.filter((a) => a.status === x), H = O.slice((p - 1) * pe, p * pe);
231
+ Ie(() => c(1), [x]);
232
+ const E = K({
233
+ mutationFn: (a) => l.request(at(`/imports/${a}`)),
234
234
  onSuccess: () => {
235
- k(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
235
+ w(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
236
236
  },
237
- onError: (r) => k(r.message)
238
- }), G = Q({
239
- mutationFn: (r) => l.request(I(`/imports/${r}/rollback`, {})),
237
+ onError: (a) => w(a.message)
238
+ }), G = K({
239
+ mutationFn: (a) => l.request(L(`/imports/${a}/rollback`, {})),
240
240
  onSuccess: () => {
241
- k(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
241
+ w(null), m.invalidateQueries({ queryKey: ["collection-import-jobs"] });
242
242
  },
243
- onError: (r) => k(r.message)
243
+ onError: (a) => w(a.message)
244
244
  });
245
- function M(r) {
246
- C(r), n == null || n(r);
245
+ function R(a) {
246
+ S(a), n == null || n(a);
247
247
  }
248
248
  const Z = [
249
249
  {
250
250
  key: "status",
251
251
  header: "Status",
252
252
  className: "w-[110px]",
253
- render: (r) => /* @__PURE__ */ e(Ee, { status: r.status })
253
+ render: (a) => /* @__PURE__ */ e(Le, { status: a.status })
254
254
  },
255
255
  {
256
256
  key: "file_name",
257
257
  header: "File",
258
258
  className: "max-w-[220px]",
259
- render: (r) => /* @__PURE__ */ e(
259
+ render: (a) => /* @__PURE__ */ e(
260
260
  "span",
261
261
  {
262
262
  className: "block truncate font-mono text-[11.5px] text-slate-800 dark:text-foreground",
263
- title: r.file_name,
264
- children: r.file_name
263
+ title: a.file_name,
264
+ children: a.file_name
265
265
  }
266
266
  )
267
267
  },
@@ -269,18 +269,18 @@ function Xt({
269
269
  key: "collection",
270
270
  header: "Collection",
271
271
  className: "w-[170px]",
272
- render: (r) => /* @__PURE__ */ e("span", { className: "truncate font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: r.collection })
272
+ render: (a) => /* @__PURE__ */ e("span", { className: "truncate font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: a.collection })
273
273
  },
274
274
  {
275
275
  key: "progress",
276
276
  header: "Progress",
277
277
  className: "w-[130px]",
278
- render: (r) => /* @__PURE__ */ e(
279
- Ct,
278
+ render: (a) => /* @__PURE__ */ e(
279
+ St,
280
280
  {
281
- processed: r.processed_rows,
282
- total: r.total_rows,
283
- failed: r.status === "failed"
281
+ processed: a.processed_rows,
282
+ total: a.total_rows,
283
+ failed: a.status === "failed"
284
284
  }
285
285
  )
286
286
  },
@@ -289,39 +289,39 @@ function Xt({
289
289
  header: "Created",
290
290
  className: "w-[76px] text-right",
291
291
  headerClassName: "text-right",
292
- render: (r) => /* @__PURE__ */ e(Y, { n: r.created_rows })
292
+ render: (a) => /* @__PURE__ */ e(Y, { n: a.created_rows })
293
293
  },
294
294
  {
295
295
  key: "updated_rows",
296
296
  header: "Updated",
297
297
  className: "w-[76px] text-right",
298
298
  headerClassName: "text-right",
299
- render: (r) => /* @__PURE__ */ e(Y, { n: r.updated_rows })
299
+ render: (a) => /* @__PURE__ */ e(Y, { n: a.updated_rows })
300
300
  },
301
301
  {
302
302
  key: "skipped_rows",
303
303
  header: "Skipped",
304
304
  className: "w-[76px] text-right",
305
305
  headerClassName: "text-right",
306
- render: (r) => /* @__PURE__ */ e(Y, { n: r.skipped_rows })
306
+ render: (a) => /* @__PURE__ */ e(Y, { n: a.skipped_rows })
307
307
  },
308
308
  {
309
309
  key: "error_rows",
310
310
  header: "Errors",
311
311
  className: "w-[70px] text-right",
312
312
  headerClassName: "text-right",
313
- render: (r) => (r.error_rows ?? 0) > 0 ? /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] font-medium tabular-nums text-red-600 dark:text-red-400", children: _(r.error_rows ?? 0) }) : /* @__PURE__ */ e(Y, { n: 0 })
313
+ render: (a) => (a.error_rows ?? 0) > 0 ? /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] font-medium tabular-nums text-red-600 dark:text-red-400", children: C(a.error_rows ?? 0) }) : /* @__PURE__ */ e(Y, { n: 0 })
314
314
  },
315
315
  {
316
316
  key: "created_at",
317
317
  header: "Queued",
318
318
  className: "w-[110px]",
319
- render: (r) => /* @__PURE__ */ e(
319
+ render: (a) => /* @__PURE__ */ e(
320
320
  "span",
321
321
  {
322
322
  className: "text-[12px] text-slate-500 dark:text-muted-foreground",
323
- title: te(r.created_at),
324
- children: st(r.created_at)
323
+ title: te(a.created_at),
324
+ children: ot(a.created_at)
325
325
  }
326
326
  )
327
327
  },
@@ -329,33 +329,33 @@ function Xt({
329
329
  key: "__actions__",
330
330
  header: "",
331
331
  className: "w-[44px]",
332
- render: (r) => /* @__PURE__ */ e("div", { onClick: (w) => w.stopPropagation(), onKeyDown: (w) => w.stopPropagation(), children: /* @__PURE__ */ a(mt, { children: [
333
- /* @__PURE__ */ e(pt, { asChild: !0, children: /* @__PURE__ */ e(
332
+ render: (a) => /* @__PURE__ */ e("div", { onClick: (N) => N.stopPropagation(), onKeyDown: (N) => N.stopPropagation(), children: /* @__PURE__ */ r(ut, { children: [
333
+ /* @__PURE__ */ e(xt, { asChild: !0, children: /* @__PURE__ */ e(
334
334
  "button",
335
335
  {
336
336
  type: "button",
337
337
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
338
- "aria-label": `Actions for ${r.file_name}`,
339
- children: /* @__PURE__ */ e(Ge, { className: "h-4 w-4" })
338
+ "aria-label": `Actions for ${a.file_name}`,
339
+ children: /* @__PURE__ */ e(Xe, { className: "h-4 w-4" })
340
340
  }
341
341
  ) }),
342
- /* @__PURE__ */ a(ut, { align: "end", className: "text-[12.5px]", children: [
343
- /* @__PURE__ */ e(he, { onSelect: () => M(r.id), children: "View details" }),
342
+ /* @__PURE__ */ r(ht, { align: "end", className: "text-[12.5px]", children: [
343
+ /* @__PURE__ */ e(xe, { onSelect: () => R(a.id), children: "View details" }),
344
344
  /* @__PURE__ */ e(
345
- yt,
345
+ Ct,
346
346
  {
347
- disabled: r.status !== "complete" || !!r.rolled_back_at,
348
- rolledBack: !!r.rolled_back_at,
349
- onConfirm: () => G.mutate(r.id)
347
+ disabled: a.status !== "complete" || !!a.rolled_back_at,
348
+ rolledBack: !!a.rolled_back_at,
349
+ onConfirm: () => G.mutate(a.id)
350
350
  }
351
351
  ),
352
- /* @__PURE__ */ a(
353
- he,
352
+ /* @__PURE__ */ r(
353
+ xe,
354
354
  {
355
- disabled: r.status !== "complete" && r.status !== "failed",
356
- onSelect: () => E.mutate(r.id),
355
+ disabled: a.status !== "complete" && a.status !== "failed",
356
+ onSelect: () => E.mutate(a.id),
357
357
  children: [
358
- /* @__PURE__ */ e(Ze, { className: "h-3.5 w-3.5" }),
358
+ /* @__PURE__ */ e(Ye, { className: "h-3.5 w-3.5" }),
359
359
  " Delete job"
360
360
  ]
361
361
  }
@@ -365,93 +365,93 @@ function Xt({
365
365
  }
366
366
  ];
367
367
  return i === "wizard" ? /* @__PURE__ */ e(
368
- Pt,
368
+ qt,
369
369
  {
370
370
  onCancel: () => s("list"),
371
- onCreated: (r) => {
372
- s("list"), m.invalidateQueries({ queryKey: ["collection-import-jobs"] }), M(r);
371
+ onCreated: (a) => {
372
+ s("list"), m.invalidateQueries({ queryKey: ["collection-import-jobs"] }), R(a);
373
373
  }
374
374
  }
375
- ) : /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
375
+ ) : /* @__PURE__ */ r("div", { className: "flex min-h-0 flex-1 flex-col gap-3", children: [
376
376
  v && /* @__PURE__ */ e("p", { className: "rounded-md border border-red-200 bg-red-50 px-3 py-2 text-[12px] text-red-700 dark:border-red-900 dark:bg-red-950/40 dark:text-red-400", children: v }),
377
- /* @__PURE__ */ a("div", { className: "flex flex-wrap items-stretch divide-x divide-slate-200 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children: [
377
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap items-stretch divide-x divide-slate-200 overflow-hidden rounded-lg border border-slate-200 bg-white dark:divide-border dark:border-border dark:bg-card", children: [
378
378
  /* @__PURE__ */ e(
379
- Ae,
379
+ Fe,
380
380
  {
381
381
  label: "All",
382
- count: P.length,
383
- active: h === "all",
384
- onClick: () => D("all")
382
+ count: $.length,
383
+ active: x === "all",
384
+ onClick: () => T("all")
385
385
  }
386
386
  ),
387
- Object.keys(j).map((r) => /* @__PURE__ */ e(
388
- Ae,
387
+ Object.keys(j).map((a) => /* @__PURE__ */ e(
388
+ Fe,
389
389
  {
390
- label: j[r].label,
391
- dot: j[r].dot,
392
- count: S[r] ?? 0,
393
- active: h === r,
394
- onClick: () => D(h === r ? "all" : r)
390
+ label: j[a].label,
391
+ dot: j[a].dot,
392
+ count: P[a] ?? 0,
393
+ active: x === a,
394
+ onClick: () => T(x === a ? "all" : a)
395
395
  },
396
- r
396
+ a
397
397
  )),
398
- /* @__PURE__ */ a("div", { className: "ml-auto flex items-stretch divide-x divide-slate-200 dark:divide-border", children: [
399
- /* @__PURE__ */ e(ee, { label: "Records created", value: _(A.created) }),
400
- /* @__PURE__ */ e(ee, { label: "Records updated", value: _(A.updated) }),
401
- /* @__PURE__ */ e(ee, { label: "Skipped", value: _(A.skipped) }),
398
+ /* @__PURE__ */ r("div", { className: "ml-auto flex items-stretch divide-x divide-slate-200 dark:divide-border", children: [
399
+ /* @__PURE__ */ e(ee, { label: "Records created", value: C(D.created) }),
400
+ /* @__PURE__ */ e(ee, { label: "Records updated", value: C(D.updated) }),
401
+ /* @__PURE__ */ e(ee, { label: "Skipped", value: C(D.skipped) }),
402
402
  /* @__PURE__ */ e(
403
403
  ee,
404
404
  {
405
405
  label: "Row errors",
406
- value: _(A.errors),
407
- tone: A.errors > 0 ? "red" : void 0
406
+ value: C(D.errors),
407
+ tone: D.errors > 0 ? "red" : void 0
408
408
  }
409
409
  )
410
410
  ] })
411
411
  ] }),
412
- P.length === 0 && !u.isLoading ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-dashed border-slate-300 bg-white px-6 py-12 dark:border-border dark:bg-card", children: /* @__PURE__ */ a("div", { className: "max-w-[58ch]", children: [
413
- /* @__PURE__ */ e(Ve, { className: "h-5 w-5 text-slate-300" }),
412
+ $.length === 0 && !u.isLoading ? /* @__PURE__ */ e("div", { className: "rounded-lg border border-dashed border-slate-300 bg-white px-6 py-12 dark:border-border dark:bg-card", children: /* @__PURE__ */ r("div", { className: "max-w-[58ch]", children: [
413
+ /* @__PURE__ */ e(We, { className: "h-5 w-5 text-slate-300" }),
414
414
  /* @__PURE__ */ e("h3", { className: "mt-3 text-[15px] font-semibold text-slate-900 dark:text-foreground", children: "No collection imports yet" }),
415
415
  /* @__PURE__ */ e("p", { className: "mt-1.5 text-[12.5px] leading-relaxed text-slate-500 dark:text-muted-foreground", children: "This is the row-by-row importer: a CSV's columns are mapped onto a collection's fields, and each row is created or updated through the normal item API — so validation, hooks and permissions all apply. Use it when you want records, not a staging table." }),
416
- /* @__PURE__ */ a(F, { size: "sm", className: "mt-4", onClick: () => s("wizard"), children: [
417
- /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
416
+ /* @__PURE__ */ r(F, { size: "sm", className: "mt-4", onClick: () => s("wizard"), children: [
417
+ /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" }),
418
418
  " Start an import"
419
419
  ] })
420
420
  ] }) }) : /* @__PURE__ */ e("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ e(
421
- lt,
421
+ nt,
422
422
  {
423
423
  columns: Z,
424
424
  rows: H,
425
- rowKey: (r) => r.id,
425
+ rowKey: (a) => a.id,
426
426
  total: O.length,
427
427
  page: p,
428
428
  limit: pe,
429
429
  onPageChange: c,
430
430
  isLoading: u.isLoading,
431
- onRowClick: (r) => M(r.id),
431
+ onRowClick: (a) => R(a.id),
432
432
  nowrapCells: !0,
433
433
  minBodyHeight: 280,
434
434
  emptyMessage: "No import jobs match this filter.",
435
- rowClassName: (r) => r.status === "processing" ? "bg-nvr-cyan/5 dark:bg-nvr-cyan/10" : void 0,
436
- toolbarRight: /* @__PURE__ */ a(F, { size: "sm", className: "h-7", onClick: () => s("wizard"), children: [
437
- /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5" }),
435
+ rowClassName: (a) => a.status === "processing" ? "bg-nvr-cyan/5 dark:bg-nvr-cyan/10" : void 0,
436
+ toolbarRight: /* @__PURE__ */ r(F, { size: "sm", className: "h-7", onClick: () => s("wizard"), children: [
437
+ /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" }),
438
438
  " New collection import"
439
439
  ] })
440
440
  }
441
441
  ) }),
442
- /* @__PURE__ */ e(Mt, { jobId: g, onClose: () => M(null) })
442
+ /* @__PURE__ */ e(Rt, { jobId: g, onClose: () => R(null) })
443
443
  ] });
444
444
  }
445
- function Y({ n: o }) {
446
- return /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] tabular-nums text-slate-600 dark:text-muted-foreground", children: _(o ?? 0) });
445
+ function Y({ n: d }) {
446
+ return /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px] tabular-nums text-slate-600 dark:text-muted-foreground", children: C(d ?? 0) });
447
447
  }
448
- function ee({ label: o, value: n, tone: l }) {
449
- return /* @__PURE__ */ a("div", { className: "px-3.5 py-2", children: [
450
- /* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium text-slate-400 dark:text-muted-foreground", children: o }),
448
+ function ee({ label: d, value: n, tone: l }) {
449
+ return /* @__PURE__ */ r("div", { className: "px-3.5 py-2", children: [
450
+ /* @__PURE__ */ e("p", { className: "text-[10.5px] font-medium text-slate-400 dark:text-muted-foreground", children: d }),
451
451
  /* @__PURE__ */ e(
452
452
  "p",
453
453
  {
454
- className: N(
454
+ className: k(
455
455
  "mt-0.5 text-[15px] font-semibold leading-none tabular-nums",
456
456
  l === "red" ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
457
457
  ),
@@ -460,50 +460,50 @@ function ee({ label: o, value: n, tone: l }) {
460
460
  )
461
461
  ] });
462
462
  }
463
- function Ae({
464
- label: o,
463
+ function Fe({
464
+ label: d,
465
465
  count: n,
466
466
  dot: l,
467
467
  active: m,
468
468
  onClick: i
469
469
  }) {
470
- return /* @__PURE__ */ a(
470
+ return /* @__PURE__ */ r(
471
471
  "button",
472
472
  {
473
473
  type: "button",
474
474
  onClick: i,
475
475
  "aria-pressed": m,
476
- className: N(
476
+ className: k(
477
477
  "flex items-center gap-1.5 px-3 py-2 transition-colors hover:bg-slate-50 dark:hover:bg-muted/40",
478
478
  m && "bg-nvr-cyan/10 ring-1 ring-inset ring-nvr-cyan dark:bg-nvr-cyan/15",
479
479
  !m && n === 0 && "opacity-45"
480
480
  ),
481
481
  children: [
482
- l && /* @__PURE__ */ e("span", { className: N("h-1.5 w-1.5 shrink-0 rounded-full", l) }),
483
- /* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: _(n) }),
484
- /* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children: o })
482
+ l && /* @__PURE__ */ e("span", { className: k("h-1.5 w-1.5 shrink-0 rounded-full", l) }),
483
+ /* @__PURE__ */ e("span", { className: "text-[14px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: C(n) }),
484
+ /* @__PURE__ */ e("span", { className: "text-[11px] font-medium leading-none text-slate-400 dark:text-muted-foreground", children: d })
485
485
  ]
486
486
  }
487
487
  );
488
488
  }
489
- function Pt({
490
- onCancel: o,
489
+ function qt({
490
+ onCancel: d,
491
491
  onCreated: n
492
492
  }) {
493
- var ke, we, ye, Ce;
494
- const l = re(), m = Te(null), [i, s] = x(0), [g, C] = x(""), [h, D] = x({}), [p, c] = x(""), [v, k] = x(""), [u, P] = x(""), [S, A] = x({}), [O, H] = x({}), [E, G] = x("skip"), [M, Z] = x(""), [K, r] = x(!1), [w, $] = x(null), [Ie, se] = x(!1), [Oe, Le] = x(null), xe = Te(null), { headers: y, rows: be, rowCount: le } = V(() => _t(g), [g]);
495
- Fe(() => {
493
+ var ye, _e, Ce, Se;
494
+ const l = ae(), m = Te(null), [i, s] = f(0), [g, S] = f(""), [x, T] = f({}), [p, c] = f(""), [v, w] = f(""), [u, $] = f(""), [P, D] = f({}), [O, H] = f({}), [E, G] = f("skip"), [R, Z] = f(""), [Q, a] = f(!1), [N, A] = f(null), [Oe, se] = f(!1), [ze, Ue] = f(null), he = Te(null), { headers: y, rows: be, rowCount: le } = V(() => Pt(g), [g]);
495
+ Ie(() => {
496
496
  if (!u || y.length === 0) return;
497
497
  const t = `${u}|${y.join("")}`;
498
- xe.current !== t && (xe.current = t, l.request(I("/imports/mappings/lookup", { collection: u, headers: y })).then((d) => {
499
- const f = d.data;
500
- f && A((q) => {
501
- if (Object.values(q).some((b) => b == null ? void 0 : b.trim())) return q;
502
- const R = {};
503
- for (const b of y) f.column_map[b] && (R[b] = f.column_map[b]);
504
- return Object.keys(R).length === 0 ? q : (Le(
505
- f.updated_at ? `Applied your saved mapping from ${rt(f.updated_at)}` : "Applied your saved mapping"
506
- ), f.id_field && Z((b) => b || f.id_field || ""), f.duplicate_strategy && G((b) => b === "skip" && f.duplicate_strategy || b), R);
498
+ he.current !== t && (he.current = t, l.request(L("/imports/mappings/lookup", { collection: u, headers: y })).then((o) => {
499
+ const b = o.data;
500
+ b && D((M) => {
501
+ if (Object.values(M).some((h) => h == null ? void 0 : h.trim())) return M;
502
+ const q = {};
503
+ for (const h of y) b.column_map[h] && (q[h] = b.column_map[h]);
504
+ return Object.keys(q).length === 0 ? M : (Ue(
505
+ b.updated_at ? `Applied your saved mapping from ${lt(b.updated_at)}` : "Applied your saved mapping"
506
+ ), b.id_field && Z((h) => h || b.id_field || ""), b.duplicate_strategy && G((h) => h === "skip" && b.duplicate_strategy || h), q);
507
507
  });
508
508
  }).catch(() => {
509
509
  }));
@@ -512,135 +512,137 @@ function Pt({
512
512
  queryKey: [
513
513
  "import-diff-preview",
514
514
  u,
515
- M,
515
+ R,
516
516
  E,
517
517
  g.length,
518
- JSON.stringify(S)
518
+ JSON.stringify(P)
519
519
  ],
520
520
  queryFn: () => l.request(
521
- I("/imports/preview", {
521
+ L("/imports/preview", {
522
522
  collection: u,
523
523
  csv_data: g,
524
- column_map: S,
525
- id_field: M || null,
524
+ column_map: P,
525
+ id_field: R || null,
526
526
  duplicate_strategy: E
527
527
  })
528
528
  ),
529
529
  enabled: i === 3 && !!u && !!g,
530
530
  staleTime: 3e4,
531
531
  retry: !1
532
- }), T = (ke = fe.data) == null ? void 0 : ke.data, ze = (((we = U({
532
+ }), _ = (ye = fe.data) == null ? void 0 : ye.data, Ke = (((_e = U({
533
533
  queryKey: ["import-collections"],
534
534
  queryFn: () => l.request(W("/collections")),
535
535
  staleTime: 6e4
536
- }).data) == null ? void 0 : we.data) ?? []).filter((t) => !t.collection.toLowerCase().startsWith("nivaro_")).map((t) => ({ value: t.collection, label: t.collection })), ne = (((Ce = (ye = U({
536
+ }).data) == null ? void 0 : _e.data) ?? []).filter((t) => !t.collection.toLowerCase().startsWith("nivaro_")).map((t) => ({ value: t.collection, label: t.collection })), ge = U({
537
537
  queryKey: ["import-collection-meta", u],
538
538
  queryFn: () => l.request(
539
- W(
540
- `/collections/${u}`
541
- )
539
+ W(`/collections/${u}`)
542
540
  ),
543
541
  enabled: !!u,
544
542
  staleTime: 6e4
545
- }).data) == null ? void 0 : ye.data) == null ? void 0 : Ce.fields) ?? []).filter((t) => !t.hidden).map((t) => t.field), oe = Q({
543
+ }), oe = (((Se = (Ce = ge.data) == null ? void 0 : Ce.data) == null ? void 0 : Se.fields) ?? []).filter((t) => !t.hidden).map((t) => t.field), ve = (t) => {
544
+ var M, q, h;
545
+ const o = t ? (h = (q = (M = ge.data) == null ? void 0 : M.data) == null ? void 0 : q.fields) == null ? void 0 : h.find((I) => I.field === t) : void 0, b = `${(o == null ? void 0 : o.special) ?? ""} ${(o == null ? void 0 : o.interface) ?? ""}`.toLowerCase();
546
+ return /m2m|many-to-many/.test(b) ? "Links several: separate names (or ids) with commas" : /m2o|many-to-one/.test(b) ? "Matched by name or id" : null;
547
+ }, ne = K({
546
548
  mutationFn: (t) => l.request(
547
- I("/imports/from-url", {
549
+ L("/imports/from-url", {
548
550
  url: t,
549
551
  preview: !0
550
552
  })
551
553
  ),
552
554
  onSuccess: (t) => {
553
- $(null), C(t.data.csv_data), c(t.data.file_name);
555
+ A(null), S(t.data.csv_data), c(t.data.file_name);
554
556
  },
555
- onError: (t) => $(t.message)
556
- }), de = Q({
557
+ onError: (t) => A(t.message)
558
+ }), de = K({
557
559
  mutationFn: () => l.request(
558
- I("/ai/map-columns", {
560
+ L("/ai/map-columns", {
559
561
  collection: u,
560
562
  columns: y,
561
563
  sample_rows: be.slice(0, 5)
562
564
  })
563
565
  ),
564
566
  onSuccess: (t) => {
565
- var R;
566
- const d = ((R = t.data) == null ? void 0 : R.mappings) ?? t.mappings ?? [], f = { ...S }, q = {};
567
- for (const b of d)
568
- y.includes(b.column) && (f[b.column] = b.field ?? "", b.field && (q[b.column] = b.confidence ?? 0));
569
- A(f), H(q), $(null);
567
+ var q;
568
+ const o = ((q = t.data) == null ? void 0 : q.mappings) ?? t.mappings ?? [], b = { ...P }, M = {};
569
+ for (const h of o)
570
+ y.includes(h.column) && (b[h.column] = h.field ?? "", h.field && (M[h.column] = h.confidence ?? 0));
571
+ D(b), H(M), A(null);
570
572
  },
571
- onError: (t) => $(
573
+ onError: (t) => A(
572
574
  t.status === 503 ? "AI mapping needs an Anthropic API key — add one in Settings, or map the columns by hand." : t.message
573
575
  )
574
- }), ie = Q({
576
+ }), ie = K({
575
577
  mutationFn: () => l.request(
576
- I("/imports", {
578
+ L("/imports", {
577
579
  collection: u,
578
580
  csv_data: g,
579
- column_map: S,
580
- transforms: Object.fromEntries(Object.entries(h).filter(([, t]) => t)),
581
+ column_map: P,
582
+ transforms: Object.fromEntries(Object.entries(x).filter(([, t]) => t)),
581
583
  duplicate_strategy: E,
582
- id_field: M || void 0,
584
+ id_field: R || void 0,
583
585
  file_name: p || "import.csv",
584
- through_items: K
586
+ through_items: Q
585
587
  })
586
588
  ),
587
589
  onSuccess: (t) => n(t.data.id),
588
- onError: (t) => $(t.message)
590
+ onError: (t) => A(t.message)
589
591
  });
590
- function ge(t, d) {
591
- A((f) => ({ ...f, [t]: d })), O[t] !== void 0 && H((f) => {
592
- const q = { ...f };
593
- return delete q[t], q;
592
+ function ke(t, o) {
593
+ D((b) => ({ ...b, [t]: o })), O[t] !== void 0 && H((b) => {
594
+ const M = { ...b };
595
+ return delete M[t], M;
594
596
  });
595
597
  }
596
- async function ve(t) {
597
- t && ($(null), C(await t.text()), c(t.name));
598
+ async function we(t) {
599
+ t && (A(null), S(await t.text()), c(t.name));
598
600
  }
599
- const L = V(() => {
600
- const t = g.split(/\r?\n/).filter((R) => R.trim());
601
+ const z = V(() => {
602
+ const t = g.split(/\r?\n/).filter((q) => q.trim());
601
603
  if (t.length < 2) return {};
602
- const d = ae(t[0]), f = t.slice(1, 2001).map(ae), q = {};
603
- return d.forEach((R, b) => {
604
- let z = 0, _e = 0, Se = 0, Pe = 0;
605
- for (const Ke of f) {
606
- const B = (Ke[b] ?? "").trim();
607
- B && (z++, /^-?\$?[\d,]+(\.\d+)?$/.test(B) ? _e++ : /^\d{4}-\d{2}-\d{2}/.test(B) || /^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(B) ? Se++ : /^(true|false|yes|no|y|n)$/i.test(B) && Pe++);
604
+ const o = re(t[0]), b = t.slice(1, 2001).map(re), M = {};
605
+ return o.forEach((q, h) => {
606
+ let I = 0, Pe = 0, Me = 0, qe = 0;
607
+ for (const Je of b) {
608
+ const B = (Je[h] ?? "").trim();
609
+ B && (I++, /^-?\$?[\d,]+(\.\d+)?$/.test(B) ? Pe++ : /^\d{4}-\d{2}-\d{2}/.test(B) || /^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(B) ? Me++ : /^(true|false|yes|no|y|n)$/i.test(B) && qe++);
608
610
  }
609
- const Qe = z === 0 ? "empty" : _e / z > 0.9 ? "number" : Se / z > 0.9 ? "date" : Pe / z > 0.9 ? "boolean" : "text";
610
- q[R] = { fill: Math.round(z / f.length * 100), guess: Qe };
611
- }), q;
611
+ const Be = I === 0 ? "empty" : Pe / I > 0.9 ? "number" : Me / I > 0.9 ? "date" : qe / I > 0.9 ? "boolean" : "text";
612
+ M[q] = { fill: Math.round(I / b.length * 100), guess: Be };
613
+ }), M;
612
614
  }, [g]), ce = y.filter((t) => {
613
- var d;
614
- return (d = S[t]) == null ? void 0 : d.trim();
615
- }).length, Ne = Oe, Ue = i === 0 ? y.length > 0 : i === 1 ? !!u && ce > 0 : !0;
616
- return /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [
617
- /* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
618
- /* @__PURE__ */ a(F, { variant: "ghost", size: "sm", className: "h-7 px-2", onClick: o, children: [
619
- /* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
615
+ var o;
616
+ return (o = P[t]) == null ? void 0 : o.trim();
617
+ }).length, Ne = ze, Qe = i === 0 ? y.length > 0 : i === 1 ? !!u && ce > 0 : !0;
618
+ return /* @__PURE__ */ r("div", { className: "flex min-h-0 flex-1 flex-col gap-4", children: [
619
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
620
+ /* @__PURE__ */ r(F, { variant: "ghost", size: "sm", className: "h-7 px-2", onClick: d, children: [
621
+ /* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" }),
620
622
  " Back to jobs"
621
623
  ] }),
622
- /* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children: ue.map((t, d) => /* @__PURE__ */ a("li", { className: "flex items-center gap-1.5", children: [
623
- /* @__PURE__ */ a(
624
+ /* @__PURE__ */ e("ol", { className: "flex items-center gap-1.5", children: ue.map((t, o) => /* @__PURE__ */ r("li", { className: "flex items-center gap-1.5", children: [
625
+ /* @__PURE__ */ r(
624
626
  "button",
625
627
  {
626
628
  type: "button",
627
- onClick: () => d < i && s(d),
628
- disabled: d > i,
629
- className: N(
629
+ onClick: () => o < i && s(o),
630
+ disabled: o > i,
631
+ className: k(
630
632
  "flex items-center gap-1.5 rounded-md px-2 py-1 text-[12px] font-medium transition-colors",
631
- d === i ? "bg-nvr-cyan/15 text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan" : d < i ? "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted" : "text-slate-300 dark:text-slate-600"
633
+ o === i ? "bg-nvr-cyan/15 text-nvr-navy dark:bg-nvr-cyan/20 dark:text-nvr-cyan" : o < i ? "text-slate-600 hover:bg-slate-100 dark:text-muted-foreground dark:hover:bg-muted" : "text-slate-300 dark:text-slate-600"
632
634
  ),
633
635
  children: [
634
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: d + 1 }),
636
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: o + 1 }),
635
637
  t
636
638
  ]
637
639
  }
638
640
  ),
639
- d < ue.length - 1 && /* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" })
641
+ o < ue.length - 1 && /* @__PURE__ */ e("span", { className: "text-slate-300", children: "›" })
640
642
  ] }, t)) })
641
643
  ] }),
642
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 overflow-y-auto rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
643
- i === 0 && /* @__PURE__ */ a("div", { className: "max-w-[980px] space-y-5", children: [
644
+ /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 overflow-y-auto rounded-lg border border-slate-200 bg-white p-5 dark:border-border dark:bg-card", children: [
645
+ i === 0 && /* @__PURE__ */ r("div", { className: "max-w-[980px] space-y-5", children: [
644
646
  /* @__PURE__ */ e(
645
647
  "input",
646
648
  {
@@ -649,13 +651,13 @@ function Pt({
649
651
  accept: ".csv,text/csv",
650
652
  className: "hidden",
651
653
  onChange: (t) => {
652
- var d;
653
- ve(((d = t.target.files) == null ? void 0 : d[0]) ?? null), t.target.value = "";
654
+ var o;
655
+ we(((o = t.target.files) == null ? void 0 : o[0]) ?? null), t.target.value = "";
654
656
  }
655
657
  }
656
658
  ),
657
- /* @__PURE__ */ a("div", { className: "grid gap-4 lg:grid-cols-2", children: [
658
- /* @__PURE__ */ a(
659
+ /* @__PURE__ */ r("div", { className: "grid gap-4 lg:grid-cols-2", children: [
660
+ /* @__PURE__ */ r(
659
661
  "button",
660
662
  {
661
663
  type: "button",
@@ -668,38 +670,38 @@ function Pt({
668
670
  },
669
671
  onDragLeave: () => se(!1),
670
672
  onDrop: (t) => {
671
- var d;
672
- t.preventDefault(), se(!1), ve(((d = t.dataTransfer.files) == null ? void 0 : d[0]) ?? null);
673
+ var o;
674
+ t.preventDefault(), se(!1), we(((o = t.dataTransfer.files) == null ? void 0 : o[0]) ?? null);
673
675
  },
674
- className: N(
676
+ className: k(
675
677
  "flex flex-col items-center justify-center gap-1.5 rounded-md border border-dashed px-4 py-8 transition-colors",
676
- Ie ? "border-nvr-cyan bg-nvr-cyan/10" : "border-slate-300 hover:border-slate-400 hover:bg-slate-50 dark:border-border dark:hover:bg-muted/30"
678
+ Oe ? "border-nvr-cyan bg-nvr-cyan/10" : "border-slate-300 hover:border-slate-400 hover:bg-slate-50 dark:border-border dark:hover:bg-muted/30"
677
679
  ),
678
680
  children: [
679
- /* @__PURE__ */ e(je, { className: "h-4 w-4 text-slate-400" }),
681
+ /* @__PURE__ */ e(He, { className: "h-4 w-4 text-slate-400" }),
680
682
  /* @__PURE__ */ e("span", { className: "text-[12.5px] font-medium text-slate-700 dark:text-foreground", children: "Drop a CSV, or click to choose" }),
681
683
  p && /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-500", children: p })
682
684
  ]
683
685
  }
684
686
  ),
685
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
686
- /* @__PURE__ */ a(J, { className: "flex items-center gap-1.5 text-[11.5px]", children: [
687
- /* @__PURE__ */ e(We, { className: "h-3.5 w-3.5 text-slate-400" }),
687
+ /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
688
+ /* @__PURE__ */ r(J, { className: "flex items-center gap-1.5 text-[11.5px]", children: [
689
+ /* @__PURE__ */ e(Ge, { className: "h-3.5 w-3.5 text-slate-400" }),
688
690
  " Or fetch from a URL"
689
691
  ] }),
690
- /* @__PURE__ */ a(
692
+ /* @__PURE__ */ r(
691
693
  "form",
692
694
  {
693
695
  className: "flex items-center gap-2",
694
696
  onSubmit: (t) => {
695
- t.preventDefault(), v.trim() && oe.mutate(v.trim());
697
+ t.preventDefault(), v.trim() && ne.mutate(v.trim());
696
698
  },
697
699
  children: [
698
700
  /* @__PURE__ */ e(
699
- Re,
701
+ Ae,
700
702
  {
701
703
  value: v,
702
- onChange: (t) => k(t.target.value),
704
+ onChange: (t) => w(t.target.value),
703
705
  placeholder: "https://example.com/data.csv",
704
706
  className: "h-8 font-mono text-[12px]"
705
707
  }
@@ -711,8 +713,8 @@ function Pt({
711
713
  variant: "outline",
712
714
  size: "sm",
713
715
  className: "h-8 shrink-0",
714
- disabled: !v.trim() || oe.isPending,
715
- children: oe.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : "Fetch"
716
+ disabled: !v.trim() || ne.isPending,
717
+ children: ne.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : "Fetch"
716
718
  }
717
719
  )
718
720
  ]
@@ -721,14 +723,14 @@ function Pt({
721
723
  /* @__PURE__ */ e("p", { className: "text-[11px] leading-snug text-slate-400", children: "The server fetches it (25MB max, CSV or plain text) so the file never has to round-trip through your machine." })
722
724
  ] })
723
725
  ] }),
724
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
726
+ /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
725
727
  /* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Or paste the rows" }),
726
728
  /* @__PURE__ */ e(
727
- kt,
729
+ yt,
728
730
  {
729
731
  value: g,
730
732
  onChange: (t) => {
731
- C(t.target.value), p || c("pasted.csv");
733
+ S(t.target.value), p || c("pasted.csv");
732
734
  },
733
735
  rows: 5,
734
736
  spellCheck: !1,
@@ -738,9 +740,9 @@ val1,val2,val3`,
738
740
  }
739
741
  )
740
742
  ] }),
741
- y.length > 0 && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
742
- /* @__PURE__ */ a("p", { className: "text-[12px] text-slate-600 dark:text-muted-foreground", children: [
743
- /* @__PURE__ */ e("span", { className: "font-semibold text-slate-900 dark:text-foreground", children: _(le) }),
743
+ y.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-2", children: [
744
+ /* @__PURE__ */ r("p", { className: "text-[12px] text-slate-600 dark:text-muted-foreground", children: [
745
+ /* @__PURE__ */ e("span", { className: "font-semibold text-slate-900 dark:text-foreground", children: C(le) }),
744
746
  " ",
745
747
  "data rows ×",
746
748
  " ",
@@ -748,28 +750,28 @@ val1,val2,val3`,
748
750
  " ",
749
751
  "columns"
750
752
  ] }),
751
- /* @__PURE__ */ e(qt, { headers: y, rows: be })
753
+ /* @__PURE__ */ e($t, { headers: y, rows: be })
752
754
  ] })
753
755
  ] }),
754
756
  i === 1 && // Bounded width: a mapping row is a form field, and stretching the
755
757
  // pickers to a 1600px viewport puts the CSV column and the field it
756
758
  // maps to half a screen apart.
757
- /* @__PURE__ */ a("div", { className: "max-w-[860px] space-y-4", children: [
758
- /* @__PURE__ */ a("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [
759
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
759
+ /* @__PURE__ */ r("div", { className: "max-w-[860px] space-y-4", children: [
760
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap items-end justify-between gap-3", children: [
761
+ /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
760
762
  /* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Target collection" }),
761
763
  /* @__PURE__ */ e("div", { className: "w-[260px]", children: /* @__PURE__ */ e(
762
764
  X,
763
765
  {
764
766
  value: u,
765
- onChange: P,
766
- options: ze,
767
+ onChange: $,
768
+ options: Ke,
767
769
  placeholder: "Choose a collection…"
768
770
  }
769
771
  ) }),
770
772
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Rows are written through the item API, so this collection's validation, hooks and permissions all apply." })
771
773
  ] }),
772
- /* @__PURE__ */ a(
774
+ /* @__PURE__ */ r(
773
775
  F,
774
776
  {
775
777
  variant: "outline",
@@ -778,86 +780,89 @@ val1,val2,val3`,
778
780
  disabled: !u || y.length === 0 || de.isPending,
779
781
  onClick: () => de.mutate(),
780
782
  children: [
781
- de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(He, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
783
+ de.isPending ? /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ e(Ze, { className: "h-3.5 w-3.5 text-nvr-cyan" }),
782
784
  "Match columns with AI"
783
785
  ]
784
786
  }
785
787
  )
786
788
  ] }),
787
- /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ a("table", { className: "w-full border-collapse", children: [
788
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "bg-slate-50 dark:bg-muted/40", children: [
789
+ /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ r("table", { className: "w-full border-collapse", children: [
790
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "bg-slate-50 dark:bg-muted/40", children: [
789
791
  /* @__PURE__ */ e("th", { className: "w-[45%] border-b border-slate-200 px-3 py-1.5 text-left text-[10.5px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: "CSV column" }),
790
792
  /* @__PURE__ */ e("th", { className: "border-b border-slate-200 px-3 py-1.5 text-left text-[10.5px] font-medium uppercase tracking-wide text-slate-400 dark:border-border", children: "Collection field" })
791
793
  ] }) }),
792
- /* @__PURE__ */ e("tbody", { children: y.map((t) => /* @__PURE__ */ a(
794
+ /* @__PURE__ */ e("tbody", { children: y.map((t) => /* @__PURE__ */ r(
793
795
  "tr",
794
796
  {
795
797
  className: "border-b border-slate-100 last:border-b-0 dark:border-border/60",
796
798
  children: [
797
- /* @__PURE__ */ a("td", { className: "px-3 py-1.5 font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
799
+ /* @__PURE__ */ r("td", { className: "px-3 py-1.5 font-mono text-[11.5px] text-slate-600 dark:text-muted-foreground", children: [
798
800
  t,
799
- L[t] && /* @__PURE__ */ a(
801
+ z[t] && /* @__PURE__ */ r(
800
802
  "span",
801
803
  {
802
- className: N(
804
+ className: k(
803
805
  "ml-2 rounded px-1 py-0.5 font-sans text-[9.5px] font-medium",
804
- L[t].fill < 50 ? "bg-amber-100 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400"
806
+ z[t].fill < 50 ? "bg-amber-100 text-amber-700 dark:bg-amber-400/15 dark:text-amber-400" : "bg-slate-100 text-slate-500 dark:bg-muted dark:text-slate-400"
805
807
  ),
806
- "data-tip": `${L[t].fill}% of rows have a value · looks like ${L[t].guess}`,
808
+ "data-tip": `${z[t].fill}% of rows have a value · looks like ${z[t].guess}`,
807
809
  children: [
808
- L[t].guess,
810
+ z[t].guess,
809
811
  " · ",
810
- L[t].fill,
812
+ z[t].fill,
811
813
  "%"
812
814
  ]
813
815
  }
814
816
  )
815
817
  ] }),
816
- /* @__PURE__ */ e("td", { className: "px-3 py-1.5", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
817
- /* @__PURE__ */ e("div", { className: "w-[220px]", children: ne.length > 0 ? /* @__PURE__ */ e(
818
- X,
819
- {
820
- value: S[t] ?? "",
821
- onChange: (d) => ge(t, d),
822
- options: [
823
- { value: "", label: "— skip this column —" },
824
- ...ne.map((d) => ({ value: d, label: d }))
825
- ],
826
- placeholder: "— skip this column —"
827
- }
828
- ) : /* @__PURE__ */ e(
829
- Re,
830
- {
831
- value: S[t] ?? "",
832
- onChange: (d) => ge(t, d.target.value),
833
- placeholder: "field_name",
834
- className: "h-8 font-mono text-[12px]"
835
- }
836
- ) }),
837
- O[t] !== void 0 && S[t] && /* @__PURE__ */ e(St, { confidence: O[t] }),
838
- S[t] && /* @__PURE__ */ e("div", { className: "w-[120px]", children: /* @__PURE__ */ e(
839
- X,
840
- {
841
- value: h[t] ?? "",
842
- onChange: (d) => D((f) => ({ ...f, [t]: d })),
843
- options: [
844
- { value: "", label: "As-is" },
845
- { value: "trim", label: "Trim" },
846
- { value: "upper", label: "UPPERCASE" },
847
- { value: "lower", label: "lowercase" },
848
- { value: "title", label: "Title Case" },
849
- { value: "null_empty", label: "Empty → null" }
850
- ],
851
- placeholder: "As-is"
852
- }
853
- ) })
854
- ] }) })
818
+ /* @__PURE__ */ r("td", { className: "px-3 py-1.5", children: [
819
+ /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
820
+ /* @__PURE__ */ e("div", { className: "w-[220px]", children: oe.length > 0 ? /* @__PURE__ */ e(
821
+ X,
822
+ {
823
+ value: P[t] ?? "",
824
+ onChange: (o) => ke(t, o),
825
+ options: [
826
+ { value: "", label: "— skip this column —" },
827
+ ...oe.map((o) => ({ value: o, label: o }))
828
+ ],
829
+ placeholder: "— skip this column —"
830
+ }
831
+ ) : /* @__PURE__ */ e(
832
+ Ae,
833
+ {
834
+ value: P[t] ?? "",
835
+ onChange: (o) => ke(t, o.target.value),
836
+ placeholder: "field_name",
837
+ className: "h-8 font-mono text-[12px]"
838
+ }
839
+ ) }),
840
+ O[t] !== void 0 && P[t] && /* @__PURE__ */ e(Mt, { confidence: O[t] }),
841
+ P[t] && /* @__PURE__ */ e("div", { className: "w-[120px]", children: /* @__PURE__ */ e(
842
+ X,
843
+ {
844
+ value: x[t] ?? "",
845
+ onChange: (o) => T((b) => ({ ...b, [t]: o })),
846
+ options: [
847
+ { value: "", label: "As-is" },
848
+ { value: "trim", label: "Trim" },
849
+ { value: "upper", label: "UPPERCASE" },
850
+ { value: "lower", label: "lowercase" },
851
+ { value: "title", label: "Title Case" },
852
+ { value: "null_empty", label: "Empty → null" }
853
+ ],
854
+ placeholder: "As-is"
855
+ }
856
+ ) })
857
+ ] }),
858
+ ve(P[t]) && /* @__PURE__ */ e("p", { className: "mt-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: ve(P[t]) })
859
+ ] })
855
860
  ]
856
861
  },
857
862
  t
858
863
  )) })
859
864
  ] }) }),
860
- /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
865
+ /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
861
866
  ce,
862
867
  " of ",
863
868
  y.length,
@@ -865,11 +870,11 @@ val1,val2,val3`,
865
870
  Ne && /* @__PURE__ */ e("span", { className: "ml-1.5 rounded bg-sky-500/10 px-1.5 py-0.5 text-[10.5px] font-medium text-sky-700 dark:text-sky-400", children: Ne })
866
871
  ] })
867
872
  ] }),
868
- i === 2 && /* @__PURE__ */ a("div", { className: "max-w-[520px] space-y-4", children: [
869
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
873
+ i === 2 && /* @__PURE__ */ r("div", { className: "max-w-[520px] space-y-4", children: [
874
+ /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
870
875
  /* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "When a record already exists" }),
871
876
  /* @__PURE__ */ e(
872
- ft,
877
+ vt,
873
878
  {
874
879
  value: E,
875
880
  onChange: G,
@@ -882,32 +887,32 @@ val1,val2,val3`,
882
887
  }
883
888
  )
884
889
  ] }),
885
- /* @__PURE__ */ a("div", { className: "flex items-start gap-2.5 rounded-md border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card", children: [
890
+ /* @__PURE__ */ r("div", { className: "flex items-start gap-2.5 rounded-md border border-slate-200 bg-white px-3 py-2 dark:border-border dark:bg-card", children: [
886
891
  /* @__PURE__ */ e(
887
892
  Nt,
888
893
  {
889
894
  id: "csv-through-items",
890
- checked: K,
891
- onCheckedChange: r,
895
+ checked: Q,
896
+ onCheckedChange: a,
892
897
  className: "mt-0.5",
893
898
  "data-csv-through-items": !0
894
899
  }
895
900
  ),
896
- /* @__PURE__ */ a("label", { htmlFor: "csv-through-items", className: "cursor-pointer", children: [
901
+ /* @__PURE__ */ r("label", { htmlFor: "csv-through-items", className: "cursor-pointer", children: [
897
902
  /* @__PURE__ */ e("span", { className: "block text-[12px] font-medium text-slate-800 dark:text-foreground", children: "Apply rules and keep history" }),
898
903
  /* @__PURE__ */ e("span", { className: "block text-[11px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Each row is saved the way the form saves it: field rules, validation, automations, and a revision on every record, credited to you. Rows that break a rule are reported instead of written. Unchanged fields are left alone. Slower on large files." })
899
904
  ] })
900
905
  ] }),
901
- /* @__PURE__ */ a("div", { className: "space-y-1.5", children: [
906
+ /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
902
907
  /* @__PURE__ */ e(J, { className: "text-[11.5px]", children: "Match records on" }),
903
908
  /* @__PURE__ */ e(
904
909
  X,
905
910
  {
906
- value: M,
911
+ value: R,
907
912
  onChange: Z,
908
913
  options: [
909
914
  { value: "", label: "— always create new records —" },
910
- ...ne.map((t) => ({ value: t, label: t }))
915
+ ...oe.map((t) => ({ value: t, label: t }))
911
916
  ],
912
917
  placeholder: "— always create new records —",
913
918
  className: "w-[260px]"
@@ -916,62 +921,62 @@ val1,val2,val3`,
916
921
  /* @__PURE__ */ e("p", { className: "text-[11px] leading-snug text-slate-400", children: "The field used to decide whether a row is a duplicate. Leave it empty and every row becomes a new record." })
917
922
  ] })
918
923
  ] }),
919
- i === 3 && /* @__PURE__ */ a("div", { className: "max-w-[620px] space-y-4", children: [
924
+ i === 3 && /* @__PURE__ */ r("div", { className: "max-w-[620px] space-y-4", children: [
920
925
  fe.isLoading && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Comparing against the live data…" }),
921
- T && /* @__PURE__ */ a("div", { className: "space-y-2", children: [
922
- /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: [
926
+ _ && /* @__PURE__ */ r("div", { className: "space-y-2", children: [
927
+ /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-2", children: [
923
928
  [
924
929
  {
925
930
  label: "new",
926
- n: T.new,
931
+ n: _.new,
927
932
  cls: "border-emerald-300 text-emerald-700 dark:border-emerald-500/40 dark:text-emerald-400"
928
933
  },
929
934
  {
930
935
  label: "changed",
931
- n: T.changed,
936
+ n: _.changed,
932
937
  cls: "border-amber-300 text-amber-700 dark:border-amber-500/40 dark:text-amber-400"
933
938
  },
934
939
  {
935
- label: T.conflicts === 1 ? "conflict" : "conflicts",
936
- n: T.conflicts,
940
+ label: _.conflicts === 1 ? "conflict" : "conflicts",
941
+ n: _.conflicts,
937
942
  cls: "border-red-300 text-red-700 dark:border-red-500/40 dark:text-red-400"
938
943
  },
939
944
  {
940
945
  label: "unchanged",
941
- n: T.unchanged,
946
+ n: _.unchanged,
942
947
  cls: "border-slate-200 text-slate-500 dark:border-border dark:text-slate-400"
943
948
  }
944
- ].map((t) => /* @__PURE__ */ a(
949
+ ].map((t) => /* @__PURE__ */ r(
945
950
  "span",
946
951
  {
947
- className: N(
952
+ className: k(
948
953
  "inline-flex items-center gap-1.5 rounded-full border bg-white px-2.5 py-1 text-[12px] font-medium dark:bg-card",
949
954
  t.cls
950
955
  ),
951
956
  children: [
952
- /* @__PURE__ */ e("span", { className: "tabular-nums", children: _(t.n) }),
957
+ /* @__PURE__ */ e("span", { className: "tabular-nums", children: C(t.n) }),
953
958
  " ",
954
959
  t.label
955
960
  ]
956
961
  },
957
962
  t.label
958
963
  )),
959
- T.truncated && /* @__PURE__ */ a("span", { className: "self-center text-[11px] text-slate-400", children: [
964
+ _.truncated && /* @__PURE__ */ r("span", { className: "self-center text-[11px] text-slate-400", children: [
960
965
  "(first ",
961
- _(T.total),
966
+ C(_.total),
962
967
  " rows scanned)"
963
968
  ] })
964
969
  ] }),
965
- T.diffs.length > 0 && /* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: T.diffs.map((t) => /* @__PURE__ */ a(
970
+ _.diffs.length > 0 && /* @__PURE__ */ e("div", { className: "max-h-56 overflow-y-auto rounded-md border border-slate-200 dark:border-border", children: _.diffs.map((t) => /* @__PURE__ */ r(
966
971
  "div",
967
972
  {
968
973
  className: "border-b border-slate-100 px-3 py-2 text-[12px] last:border-b-0 dark:border-border/60",
969
974
  children: [
970
- /* @__PURE__ */ a("p", { className: "flex items-center gap-2", children: [
975
+ /* @__PURE__ */ r("p", { className: "flex items-center gap-2", children: [
971
976
  /* @__PURE__ */ e(
972
977
  "span",
973
978
  {
974
- className: N(
979
+ className: k(
975
980
  "rounded px-1.5 py-0.5 text-[10.5px] font-semibold uppercase tracking-wide",
976
981
  t.kind === "conflict" ? "bg-red-500/10 text-red-600 dark:text-red-400" : "bg-amber-400/10 text-amber-600 dark:text-amber-400"
977
982
  ),
@@ -979,32 +984,51 @@ val1,val2,val3`,
979
984
  }
980
985
  ),
981
986
  /* @__PURE__ */ e("span", { className: "font-mono text-[11.5px]", children: t.id }),
982
- /* @__PURE__ */ a("span", { className: "text-[11px] text-slate-400", children: [
987
+ /* @__PURE__ */ r("span", { className: "text-[11px] text-slate-400", children: [
983
988
  "row ",
984
989
  t.row
985
990
  ] })
986
991
  ] }),
987
992
  t.reason && /* @__PURE__ */ e("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: t.reason }),
988
- t.fields.map((d) => /* @__PURE__ */ a("p", { className: "mt-0.5 font-mono text-[11px]", children: [
989
- /* @__PURE__ */ a("span", { className: "text-slate-400", children: [
990
- d.field,
993
+ t.fields.map((o) => /* @__PURE__ */ r("p", { className: "mt-0.5 font-mono text-[11px]", children: [
994
+ /* @__PURE__ */ r("span", { className: "text-slate-400", children: [
995
+ o.field,
991
996
  ":"
992
997
  ] }),
993
998
  " ",
994
- /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: String(d.old ?? "—") }),
999
+ /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: String(o.old ?? "—") }),
995
1000
  " ",
996
- /* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: String(d.new ?? "—") })
997
- ] }, d.field))
1001
+ /* @__PURE__ */ e("span", { className: "text-emerald-600 dark:text-emerald-400", children: String(o.new ?? "—") })
1002
+ ] }, o.field))
998
1003
  ]
999
1004
  },
1000
1005
  `${t.row}-${t.id}`
1001
1006
  )) }),
1002
- T.conflicts > 0 && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: "Conflicts need a look before you start — they are rows the import will silently drop or resolve by last-write-wins." })
1007
+ _.conflicts > 0 && /* @__PURE__ */ e("p", { className: "text-[11.5px] text-red-600 dark:text-red-400", children: "Conflicts need a look before you start — they are rows the import will silently drop or resolve by last-write-wins." }),
1008
+ (_.link_error_rows ?? 0) > 0 && /* @__PURE__ */ r("div", { className: "rounded-md border border-red-200 bg-red-50 px-3 py-2 dark:border-red-500/30 dark:bg-red-500/10", children: [
1009
+ /* @__PURE__ */ r("p", { className: "text-[12px] font-medium text-red-700 dark:text-red-300", children: [
1010
+ C(_.link_error_rows ?? 0),
1011
+ " ",
1012
+ _.link_error_rows === 1 ? "row names" : "rows name",
1013
+ " a record that does not exist — ",
1014
+ _.link_error_rows === 1 ? "it" : "they",
1015
+ " will not be imported"
1016
+ ] }),
1017
+ /* @__PURE__ */ e("ul", { className: "mt-1 max-h-32 space-y-0.5 overflow-y-auto text-[11.5px] text-red-700 dark:text-red-300", children: (_.link_problems ?? []).map((t) => /* @__PURE__ */ r("li", { children: [
1018
+ /* @__PURE__ */ r("span", { className: "text-red-500/80 dark:text-red-400/70", children: [
1019
+ "Row ",
1020
+ t.row,
1021
+ ":"
1022
+ ] }),
1023
+ " ",
1024
+ t.error
1025
+ ] }, `${t.row}-${t.error}`)) })
1026
+ ] })
1003
1027
  ] }),
1004
1028
  /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: [
1005
1029
  { label: "File", value: p || "pasted.csv", mono: !0 },
1006
1030
  { label: "Collection", value: u, mono: !0 },
1007
- { label: "Data rows", value: _(le) },
1031
+ { label: "Data rows", value: C(le) },
1008
1032
  { label: "Mapped columns", value: `${ce} of ${y.length}` },
1009
1033
  {
1010
1034
  label: "Duplicates",
@@ -1012,10 +1036,10 @@ val1,val2,val3`,
1012
1036
  },
1013
1037
  {
1014
1038
  label: "Matched on",
1015
- value: M || "nothing — every row is new",
1016
- mono: !!M
1039
+ value: R || "nothing — every row is new",
1040
+ mono: !!R
1017
1041
  }
1018
- ].map((t) => /* @__PURE__ */ a(
1042
+ ].map((t) => /* @__PURE__ */ r(
1019
1043
  "div",
1020
1044
  {
1021
1045
  className: "flex items-center gap-4 border-b border-slate-100 px-3.5 py-2 last:border-b-0 dark:border-border/60",
@@ -1024,7 +1048,7 @@ val1,val2,val3`,
1024
1048
  /* @__PURE__ */ e(
1025
1049
  "span",
1026
1050
  {
1027
- className: N(
1051
+ className: k(
1028
1052
  "truncate text-[12.5px] text-slate-800 dark:text-foreground",
1029
1053
  t.mono && "font-mono text-[12px]"
1030
1054
  ),
@@ -1035,9 +1059,9 @@ val1,val2,val3`,
1035
1059
  },
1036
1060
  t.label
1037
1061
  )) }),
1038
- /* @__PURE__ */ a("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-muted-foreground", children: [
1062
+ /* @__PURE__ */ r("p", { className: "text-[12px] leading-relaxed text-slate-500 dark:text-muted-foreground", children: [
1039
1063
  "Starting the import writes ",
1040
- _(le),
1064
+ C(le),
1041
1065
  " rows into",
1042
1066
  " ",
1043
1067
  /* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: u }),
@@ -1046,18 +1070,18 @@ val1,val2,val3`,
1046
1070
  ] })
1047
1071
  ] })
1048
1072
  ] }),
1049
- /* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-2", children: [
1050
- i > 0 && /* @__PURE__ */ a(F, { variant: "ghost", size: "sm", onClick: () => s((t) => t - 1), children: [
1051
- /* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5" }),
1073
+ /* @__PURE__ */ r("div", { className: "flex shrink-0 items-center gap-2", children: [
1074
+ i > 0 && /* @__PURE__ */ r(F, { variant: "ghost", size: "sm", onClick: () => s((t) => t - 1), children: [
1075
+ /* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" }),
1052
1076
  " Back"
1053
1077
  ] }),
1054
- w && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: w }),
1055
- /* @__PURE__ */ a("div", { className: "ml-auto flex items-center gap-2", children: [
1056
- /* @__PURE__ */ e(F, { variant: "ghost", size: "sm", onClick: o, children: "Cancel" }),
1057
- i < ue.length - 1 ? /* @__PURE__ */ a(F, { size: "sm", disabled: !Ue, onClick: () => s((t) => t + 1), children: [
1078
+ N && /* @__PURE__ */ e("p", { className: "text-[12px] text-red-600 dark:text-red-400", children: N }),
1079
+ /* @__PURE__ */ r("div", { className: "ml-auto flex items-center gap-2", children: [
1080
+ /* @__PURE__ */ e(F, { variant: "ghost", size: "sm", onClick: d, children: "Cancel" }),
1081
+ i < ue.length - 1 ? /* @__PURE__ */ r(F, { size: "sm", disabled: !Qe, onClick: () => s((t) => t + 1), children: [
1058
1082
  "Next ",
1059
- /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5" })
1060
- ] }) : /* @__PURE__ */ e(F, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */ a(Be, { children: [
1083
+ /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" })
1084
+ ] }) : /* @__PURE__ */ e(F, { size: "sm", disabled: ie.isPending, onClick: () => ie.mutate(), children: ie.isPending ? /* @__PURE__ */ r(Ve, { children: [
1061
1085
  /* @__PURE__ */ e(me, { className: "h-3.5 w-3.5 animate-spin" }),
1062
1086
  " Starting…"
1063
1087
  ] }) : "Start import" })
@@ -1065,9 +1089,9 @@ val1,val2,val3`,
1065
1089
  ] })
1066
1090
  ] });
1067
1091
  }
1068
- function qt({ headers: o, rows: n }) {
1069
- return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ a("table", { className: "w-full border-collapse", children: [
1070
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children: o.map((l) => /* @__PURE__ */ e(
1092
+ function $t({ headers: d, rows: n }) {
1093
+ return /* @__PURE__ */ e("div", { className: "overflow-x-auto rounded-md border border-slate-200 dark:border-border", children: /* @__PURE__ */ r("table", { className: "w-full border-collapse", children: [
1094
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-slate-50 dark:bg-muted/40", children: d.map((l) => /* @__PURE__ */ e(
1071
1095
  "th",
1072
1096
  {
1073
1097
  className: "whitespace-nowrap border-b border-slate-200 px-2.5 py-1.5 text-left font-mono text-[10.5px] font-medium text-slate-500 dark:border-border dark:text-muted-foreground",
@@ -1077,7 +1101,7 @@ function qt({ headers: o, rows: n }) {
1077
1101
  )) }) }),
1078
1102
  /* @__PURE__ */ e("tbody", { children: n.map((l, m) => (
1079
1103
  // eslint-disable-next-line react/no-array-index-key
1080
- /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: o.map((i, s) => /* @__PURE__ */ e(
1104
+ /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 last:border-b-0 dark:border-border/60", children: d.map((i, s) => /* @__PURE__ */ e(
1081
1105
  "td",
1082
1106
  {
1083
1107
  className: "max-w-[200px] truncate whitespace-nowrap px-2.5 py-1 font-mono text-[11px] text-slate-700 dark:text-foreground",
@@ -1089,22 +1113,22 @@ function qt({ headers: o, rows: n }) {
1089
1113
  )) })
1090
1114
  ] }) });
1091
1115
  }
1092
- function Mt({ jobId: o, onClose: n }) {
1093
- var h, D;
1094
- const l = et(), m = re(), s = (h = U({
1095
- queryKey: ["collection-import-job", o],
1096
- queryFn: () => m.request(W(`/imports/${o}`)),
1097
- enabled: !!o,
1116
+ function Rt({ jobId: d, onClose: n }) {
1117
+ var x, T;
1118
+ const l = rt(), m = ae(), s = (x = U({
1119
+ queryKey: ["collection-import-job", d],
1120
+ queryFn: () => m.request(W(`/imports/${d}`)),
1121
+ enabled: !!d,
1098
1122
  refetchInterval: (p) => {
1099
- var c, v, k, u;
1100
- return ((v = (c = p.state.data) == null ? void 0 : c.data) == null ? void 0 : v.status) === "processing" || ((u = (k = p.state.data) == null ? void 0 : k.data) == null ? void 0 : u.status) === "pending" ? 2e3 : !1;
1123
+ var c, v, w, u;
1124
+ return ((v = (c = p.state.data) == null ? void 0 : c.data) == null ? void 0 : v.status) === "processing" || ((u = (w = p.state.data) == null ? void 0 : w.data) == null ? void 0 : u.status) === "pending" ? 2e3 : !1;
1101
1125
  }
1102
- }).data) == null ? void 0 : h.data, g = Array.isArray(s == null ? void 0 : s.errors) ? s.errors : [], C = s != null && s.total_rows ? Math.min(100, Math.round((s.processed_rows ?? 0) / s.total_rows * 100)) : (s == null ? void 0 : s.status) === "complete" ? 100 : 0;
1103
- return /* @__PURE__ */ e(gt, { open: !!o, onOpenChange: (p) => !p && n(), children: /* @__PURE__ */ e(vt, { side: "right", className: "w-[min(560px,94vw)] p-0 sm:max-w-none", children: s ? /* @__PURE__ */ a("div", { className: "flex h-full flex-col", children: [
1104
- /* @__PURE__ */ a("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
1105
- /* @__PURE__ */ e(Ee, { status: s.status }),
1126
+ }).data) == null ? void 0 : x.data, g = Array.isArray(s == null ? void 0 : s.errors) ? s.errors : [], S = s != null && s.total_rows ? Math.min(100, Math.round((s.processed_rows ?? 0) / s.total_rows * 100)) : (s == null ? void 0 : s.status) === "complete" ? 100 : 0;
1127
+ return /* @__PURE__ */ e(kt, { open: !!d, onOpenChange: (p) => !p && n(), children: /* @__PURE__ */ e(wt, { side: "right", className: "w-[min(560px,94vw)] p-0 sm:max-w-none", children: s ? /* @__PURE__ */ r("div", { className: "flex h-full flex-col", children: [
1128
+ /* @__PURE__ */ r("header", { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: [
1129
+ /* @__PURE__ */ e(Le, { status: s.status }),
1106
1130
  /* @__PURE__ */ e("h2", { className: "mt-1.5 truncate font-mono text-[15px] font-semibold text-slate-900 dark:text-foreground", children: s.file_name }),
1107
- /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-400", children: [
1131
+ /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-400", children: [
1108
1132
  "into ",
1109
1133
  /* @__PURE__ */ e("span", { className: "font-mono", children: s.collection }),
1110
1134
  " ·",
@@ -1112,30 +1136,30 @@ function Mt({ jobId: o, onClose: n }) {
1112
1136
  te(s.created_at)
1113
1137
  ] })
1114
1138
  ] }),
1115
- /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4", children: [
1116
- /* @__PURE__ */ a("section", { className: "space-y-2", children: [
1117
- /* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
1139
+ /* @__PURE__ */ r("div", { className: "min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-4", children: [
1140
+ /* @__PURE__ */ r("section", { className: "space-y-2", children: [
1141
+ /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
1118
1142
  /* @__PURE__ */ e("h3", { className: "text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Progress" }),
1119
- /* @__PURE__ */ a("span", { className: "text-[12px] font-medium tabular-nums text-slate-700 dark:text-foreground", children: [
1120
- C,
1143
+ /* @__PURE__ */ r("span", { className: "text-[12px] font-medium tabular-nums text-slate-700 dark:text-foreground", children: [
1144
+ S,
1121
1145
  "%"
1122
1146
  ] })
1123
1147
  ] }),
1124
1148
  /* @__PURE__ */ e("div", { className: "h-2 overflow-hidden rounded-full bg-slate-100 dark:bg-muted", children: /* @__PURE__ */ e(
1125
1149
  "div",
1126
1150
  {
1127
- className: N(
1151
+ className: k(
1128
1152
  "h-full rounded-full transition-[width] duration-500",
1129
1153
  s.status === "failed" ? "bg-red-500" : "bg-nvr-cyan"
1130
1154
  ),
1131
- style: { width: `${C}%` }
1155
+ style: { width: `${S}%` }
1132
1156
  }
1133
1157
  ) }),
1134
- /* @__PURE__ */ a("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
1135
- _(s.processed_rows ?? 0),
1158
+ /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
1159
+ C(s.processed_rows ?? 0),
1136
1160
  " of",
1137
1161
  " ",
1138
- s.total_rows == null ? "?" : _(s.total_rows),
1162
+ s.total_rows == null ? "?" : C(s.total_rows),
1139
1163
  " rows processed"
1140
1164
  ] })
1141
1165
  ] }),
@@ -1144,20 +1168,20 @@ function Mt({ jobId: o, onClose: n }) {
1144
1168
  { label: "Updated", value: s.updated_rows ?? 0 },
1145
1169
  { label: "Skipped", value: s.skipped_rows ?? 0 },
1146
1170
  { label: "Errors", value: s.error_rows ?? 0, bad: (s.error_rows ?? 0) > 0 }
1147
- ].map((p) => /* @__PURE__ */ a("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
1171
+ ].map((p) => /* @__PURE__ */ r("div", { className: "bg-white px-3 py-2 dark:bg-card", children: [
1148
1172
  /* @__PURE__ */ e("p", { className: "text-[10.5px] text-slate-400", children: p.label }),
1149
1173
  /* @__PURE__ */ e(
1150
1174
  "p",
1151
1175
  {
1152
- className: N(
1176
+ className: k(
1153
1177
  "text-[15px] font-semibold tabular-nums",
1154
1178
  p.bad ? "text-red-600 dark:text-red-400" : "text-slate-900 dark:text-foreground"
1155
1179
  ),
1156
- children: _(p.value)
1180
+ children: C(p.value)
1157
1181
  }
1158
1182
  )
1159
1183
  ] }, p.label)) }),
1160
- /* @__PURE__ */ a("section", { children: [
1184
+ /* @__PURE__ */ r("section", { children: [
1161
1185
  /* @__PURE__ */ e("h3", { className: "mb-1 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Settings" }),
1162
1186
  [
1163
1187
  { label: "Duplicates", value: s.duplicate_strategy },
@@ -1174,7 +1198,7 @@ function Mt({ jobId: o, onClose: n }) {
1174
1198
  label: "Completed",
1175
1199
  value: s.completed_at ? te(s.completed_at) : "—"
1176
1200
  }
1177
- ].map((p) => /* @__PURE__ */ a(
1201
+ ].map((p) => /* @__PURE__ */ r(
1178
1202
  "div",
1179
1203
  {
1180
1204
  className: "flex items-baseline justify-between gap-4 border-b border-slate-100 py-1.5 last:border-b-0 dark:border-border/60",
@@ -1186,22 +1210,22 @@ function Mt({ jobId: o, onClose: n }) {
1186
1210
  p.label
1187
1211
  ))
1188
1212
  ] }),
1189
- s.column_map && Object.keys(s.column_map).length > 0 && /* @__PURE__ */ a("section", { children: [
1213
+ s.column_map && Object.keys(s.column_map).length > 0 && /* @__PURE__ */ r("section", { children: [
1190
1214
  /* @__PURE__ */ e("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-slate-500 dark:text-muted-foreground", children: "Column mapping" }),
1191
- /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: Object.entries(s.column_map).map(([p, c]) => /* @__PURE__ */ a(
1215
+ /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-slate-200 dark:border-border", children: Object.entries(s.column_map).map(([p, c]) => /* @__PURE__ */ r(
1192
1216
  "div",
1193
1217
  {
1194
1218
  className: "flex items-center gap-2 border-b border-slate-100 px-3 py-1.5 font-mono text-[11.5px] last:border-b-0 dark:border-border/60",
1195
1219
  children: [
1196
1220
  /* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-500 dark:text-muted-foreground", children: p }),
1197
- /* @__PURE__ */ e($e, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1221
+ /* @__PURE__ */ e(Ee, { className: "h-3 w-3 shrink-0 text-slate-300" }),
1198
1222
  /* @__PURE__ */ e("span", { className: "flex-1 truncate text-slate-800 dark:text-foreground", children: c || /* @__PURE__ */ e("span", { className: "font-sans text-slate-400", children: "skipped" }) })
1199
1223
  ]
1200
1224
  },
1201
1225
  p
1202
1226
  )) })
1203
1227
  ] }),
1204
- s.created_ids && (((D = s.created_ids) == null ? void 0 : D.length) ?? 0) > 0 && /* @__PURE__ */ e("section", { children: /* @__PURE__ */ a(
1228
+ s.created_ids && (((T = s.created_ids) == null ? void 0 : T.length) ?? 0) > 0 && /* @__PURE__ */ e("section", { children: /* @__PURE__ */ r(
1205
1229
  "button",
1206
1230
  {
1207
1231
  type: "button",
@@ -1228,22 +1252,22 @@ function Mt({ jobId: o, onClose: n }) {
1228
1252
  ] }) : /* @__PURE__ */ e("div", { className: "p-5 text-[12.5px] text-slate-400", children: "Loading job…" }) }) });
1229
1253
  }
1230
1254
  function Tt({
1231
- jobId: o,
1255
+ jobId: d,
1232
1256
  errors: n
1233
1257
  }) {
1234
- const l = re(), [m, i] = x({}), [s, g] = x({}), { data: C } = U({
1235
- queryKey: ["import-failed-rows", o],
1258
+ const l = ae(), [m, i] = f({}), [s, g] = f({}), { data: S } = U({
1259
+ queryKey: ["import-failed-rows", d],
1236
1260
  queryFn: () => l.request(
1237
- W(`/imports/${o}/failed-rows`)
1261
+ W(`/imports/${d}/failed-rows`)
1238
1262
  ).then((c) => c.data ?? []),
1239
1263
  staleTime: 3e4
1240
- }), h = C ?? [], D = h[0] ? Object.keys(h[0].values) : [], p = Q({
1241
- mutationFn: ({ row: c, values: v }) => l.request(I(`/imports/${o}/repair-row`, { values: v })).then(() => c),
1264
+ }), x = S ?? [], T = x[0] ? Object.keys(x[0].values) : [], p = K({
1265
+ mutationFn: ({ row: c, values: v }) => l.request(L(`/imports/${d}/repair-row`, { values: v })).then(() => c),
1242
1266
  onSuccess: (c) => g((v) => ({ ...v, [c]: "ok" })),
1243
- onError: (c, v) => g((k) => ({ ...k, [v.row]: at(c, "The row was not created") }))
1267
+ onError: (c, v) => g((w) => ({ ...w, [v.row]: st(c, "The row was not created") }))
1244
1268
  });
1245
- return h.length === 0 ? /* @__PURE__ */ a("section", { children: [
1246
- /* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
1269
+ return x.length === 0 ? /* @__PURE__ */ r("section", { children: [
1270
+ /* @__PURE__ */ r("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
1247
1271
  "Row errors (",
1248
1272
  n.length,
1249
1273
  ")"
@@ -1252,8 +1276,8 @@ function Tt({
1252
1276
  "div",
1253
1277
  {
1254
1278
  className: "flex gap-3 border-b border-red-100 px-3 py-1.5 text-[11.5px] last:border-b-0 dark:border-red-900/60",
1255
- children: /* @__PURE__ */ a("span", { className: "text-red-700 dark:text-red-400", children: [
1256
- /* @__PURE__ */ a("span", { className: "font-medium tabular-nums", children: [
1279
+ children: /* @__PURE__ */ r("span", { className: "text-red-700 dark:text-red-400", children: [
1280
+ /* @__PURE__ */ r("span", { className: "font-medium tabular-nums", children: [
1257
1281
  "Row ",
1258
1282
  c.row,
1259
1283
  ":"
@@ -1264,39 +1288,39 @@ function Tt({
1264
1288
  },
1265
1289
  `${c.row}-${c.error}`
1266
1290
  )) })
1267
- ] }) : /* @__PURE__ */ a("section", { children: [
1268
- /* @__PURE__ */ a("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
1291
+ ] }) : /* @__PURE__ */ r("section", { children: [
1292
+ /* @__PURE__ */ r("h3", { className: "mb-1.5 text-[11.5px] font-semibold text-red-700 dark:text-red-400", children: [
1269
1293
  "Failed rows (",
1270
- h.length,
1294
+ x.length,
1271
1295
  ") — fix and resubmit"
1272
1296
  ] }),
1273
- /* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: /* @__PURE__ */ a("table", { className: "w-full text-[11.5px]", children: [
1274
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ a("tr", { className: "bg-red-50/60 text-left text-[10px] uppercase tracking-wide text-slate-400 dark:bg-red-950/30", children: [
1297
+ /* @__PURE__ */ e("div", { className: "max-h-[320px] overflow-auto rounded-md border border-red-200 dark:border-red-900", children: /* @__PURE__ */ r("table", { className: "w-full text-[11.5px]", children: [
1298
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ r("tr", { className: "bg-red-50/60 text-left text-[10px] uppercase tracking-wide text-slate-400 dark:bg-red-950/30", children: [
1275
1299
  /* @__PURE__ */ e("th", { className: "px-2 py-1", children: "Row" }),
1276
- D.map((c) => /* @__PURE__ */ e("th", { className: "px-2 py-1 font-mono normal-case", children: c }, c)),
1300
+ T.map((c) => /* @__PURE__ */ e("th", { className: "px-2 py-1 font-mono normal-case", children: c }, c)),
1277
1301
  /* @__PURE__ */ e("th", { className: "px-2 py-1" })
1278
1302
  ] }) }),
1279
- /* @__PURE__ */ e("tbody", { children: h.map((c) => {
1280
- const v = m[c.row] ?? c.values, k = s[c.row];
1281
- return /* @__PURE__ */ a(
1303
+ /* @__PURE__ */ e("tbody", { children: x.map((c) => {
1304
+ const v = m[c.row] ?? c.values, w = s[c.row];
1305
+ return /* @__PURE__ */ r(
1282
1306
  "tr",
1283
1307
  {
1284
1308
  className: "border-t border-red-100 align-top dark:border-red-900/50",
1285
1309
  children: [
1286
- /* @__PURE__ */ a("td", { className: "px-2 py-1 font-mono tabular-nums text-slate-400", children: [
1310
+ /* @__PURE__ */ r("td", { className: "px-2 py-1 font-mono tabular-nums text-slate-400", children: [
1287
1311
  c.row,
1288
1312
  /* @__PURE__ */ e("p", { className: "max-w-[120px] whitespace-normal text-[10px] text-red-500", children: De(c.error) })
1289
1313
  ] }),
1290
- D.map((u) => /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
1314
+ T.map((u) => /* @__PURE__ */ e("td", { className: "px-1 py-1", children: /* @__PURE__ */ e(
1291
1315
  "input",
1292
1316
  {
1293
1317
  value: String(v[u] ?? ""),
1294
- disabled: k === "ok",
1295
- onChange: (P) => i((S) => ({ ...S, [c.row]: { ...v, [u]: P.target.value } })),
1318
+ disabled: w === "ok",
1319
+ onChange: ($) => i((P) => ({ ...P, [c.row]: { ...v, [u]: $.target.value } })),
1296
1320
  className: "h-6 w-full min-w-[80px] rounded border border-slate-200 bg-background px-1 text-[11px] dark:border-border"
1297
1321
  }
1298
1322
  ) }, u)),
1299
- /* @__PURE__ */ e("td", { className: "px-2 py-1", children: k === "ok" ? /* @__PURE__ */ e("span", { className: "text-[10.5px] font-medium text-emerald-600", children: "✓ Created" }) : /* @__PURE__ */ a("div", { children: [
1323
+ /* @__PURE__ */ e("td", { className: "px-2 py-1", children: w === "ok" ? /* @__PURE__ */ e("span", { className: "text-[10.5px] font-medium text-emerald-600", children: "✓ Created" }) : /* @__PURE__ */ r("div", { children: [
1300
1324
  /* @__PURE__ */ e(
1301
1325
  "button",
1302
1326
  {
@@ -1307,7 +1331,7 @@ function Tt({
1307
1331
  children: "Resubmit"
1308
1332
  }
1309
1333
  ),
1310
- k && k !== "ok" && /* @__PURE__ */ e("p", { className: "max-w-[140px] whitespace-normal text-[9.5px] text-red-500", children: k })
1334
+ w && w !== "ok" && /* @__PURE__ */ e("p", { className: "max-w-[140px] whitespace-normal text-[9.5px] text-red-500", children: w })
1311
1335
  ] }) })
1312
1336
  ]
1313
1337
  },
@@ -1318,7 +1342,7 @@ function Tt({
1318
1342
  ] });
1319
1343
  }
1320
1344
  export {
1321
- Xt as CollectionImportPanel,
1322
- wt as ROLLBACK_QUESTION,
1323
- yt as RollbackJobItem
1345
+ Yt as CollectionImportPanel,
1346
+ _t as ROLLBACK_QUESTION,
1347
+ Ct as RollbackJobItem
1324
1348
  };