@nivaro/react 0.3.86 → 0.3.87

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,11 +1,11 @@
1
1
  import { jsxs as c, jsx as a, Fragment as Qe } from "react/jsx-runtime";
2
2
  import { useQueryClient as Fa, useMutation as Nt, useQuery as ne, useQueries as _a } from "@tanstack/react-query";
3
- import { FileDiff as xi, RotateCw as yr, Network as vi, Map as ki, Sparkles as wr, X as _r, Rows3 as vl, ListChecks as yi, Rows2 as wi, ChevronDown as Jn, Wand2 as kl, FileText as yl, Bell as _i, BellOff as Ni, Loader2 as wl, Check as Si, Search as Wl, ChevronsLeft as Ci, ChevronsRight as $i, Pin as qi } from "lucide-react";
3
+ import { FileDiff as xi, RotateCw as yr, Network as vi, Map as ki, Sparkles as wr, X as _r, Rows3 as xl, ListChecks as yi, Rows2 as wi, ChevronDown as Jn, Wand2 as vl, FileText as kl, Bell as _i, BellOff as Ni, Loader2 as yl, Check as Si, Search as Ql, ChevronsLeft as Ci, ChevronsRight as $i, Pin as qi } from "lucide-react";
4
4
  import Ti, { useState as _, useRef as fe, useEffect as pe, useMemo as be, useLayoutEffect as Li } from "react";
5
- import { createPortal as Vl } from "react-dom";
5
+ import { createPortal as Wl } from "react-dom";
6
6
  import { toast as ge } from "sonner";
7
- import { useNivaroClient as St, useItemNavigation as Hl, useOverlayState as Fi, useItemEditAuth as $a, useApiFetchConfig as Ri } from "../context.js";
8
- import { useDebounced as _l } from "../hooks/useDebounced.js";
7
+ import { useNivaroClient as St, useItemNavigation as Vl, useOverlayState as Fi, useItemEditAuth as $a, useApiFetchConfig as Ri } from "../context.js";
8
+ import { useDebounced as wl } from "../hooks/useDebounced.js";
9
9
  import { useElapsedLoading as Ei } from "../hooks/useElapsedLoading.js";
10
10
  import { useSlowReason as Di } from "../hooks/useSlowReason.js";
11
11
  import { rowActionSentence as Pi } from "../lib/bulk-copy.js";
@@ -17,22 +17,22 @@ import { compareValueText as Wi } from "../lib/compare-value.js";
17
17
  import { parseDateFilter as qa, dateFilterBounds as Vi, describeDateFilter as Hi, DATE_FILTER_OPS as Yi, formatDateFilter as Ji } from "../lib/date-filter.js";
18
18
  import { rowDeleteOffered as Gi } from "../lib/delete-offer.js";
19
19
  import { errorSentence as Xi } from "../lib/error-message.js";
20
- import { errorToastOptions as Sa, toastError as Nl } from "../lib/error-toast.js";
21
- import { extractExpressionTokens as Zi, evaluateNumeric as Sl } from "../lib/expression.js";
20
+ import { errorToastOptions as Sa, toastError as _l } from "../lib/error-toast.js";
21
+ import { extractExpressionTokens as Zi, evaluateNumeric as Nl } from "../lib/expression.js";
22
22
  import { clauseFromCondition as Nr, clauseFromControlValue as ed, filterSentence as td } from "../lib/filter-sentence.js";
23
23
  import { deliverLive as nd, releaseLiveOwner as ad } from "../lib/focus-mode.js";
24
- import { formatValue as Hn, formatMultiValue as Cl, countFromResolved as rd } from "../lib/format-value.js";
24
+ import { formatValue as Hn, formatMultiValue as Sl, countFromResolved as rd } from "../lib/format-value.js";
25
25
  import { createCursorBook as sd, pageRequest as ld, noteNextCursor as od, isCursorRefusal as id, stopCursors as dd } from "../lib/keyset-pager.js";
26
26
  import { normalizeInlineEdit as cd, inlineM2oTarget as ud, inlineChoices as pd, inlineEditFor as md, nextInlineKey as fd } from "../lib/list-inline-edit.js";
27
27
  import { sanitizeCbvLinkState as bd, readListLinkFromLocation as hd, dropListLinkParam as gd } from "../lib/list-link.js";
28
- import { rememberedListPage as xd, pageWhileSettling as $l, rememberListPage as vd, restoreWindowOutcome as kd } from "../lib/list-page-memory.js";
28
+ import { rememberedListPage as xd, pageWhileSettling as Cl, rememberListPage as vd, restoreWindowOutcome as kd } from "../lib/list-page-memory.js";
29
29
  import { expandCoalesced as yd, LIVE_ASPECTS as _n } from "../lib/live.js";
30
30
  import { useRowChanges as wd, useRowLocks as _d, lockLabel as Nd, viewerMatches as Sd, conditionFields as Cd, mayAffectMatch as $d, writerOf as qd } from "../lib/live-list.js";
31
31
  import { loadErrorStatus as Td, listLoadErrorText as Ld } from "../lib/load-error.js";
32
- import { OPEN_IN_TABS_CAP as Fd, openInTabs as Rd, openInTabsMessage as ql } from "../lib/open-in-tabs.js";
32
+ import { OPEN_IN_TABS_CAP as Fd, openInTabs as Rd, openInTabsMessage as $l } from "../lib/open-in-tabs.js";
33
33
  import { isOwnWrite as Ed } from "../lib/own-writes.js";
34
34
  import { useIdleNextPage as Dd, intentProps as Pd, prefetchRecord as Md } from "../lib/prefetch.js";
35
- import { useRowPresence as Od, rowPresenceKey as Tl } from "../lib/presence-hooks.js";
35
+ import { useRowPresence as Od, rowPresenceKey as ql } from "../lib/presence-hooks.js";
36
36
  import { cascadeFilter as Ad, fetchCascadeRelations as Id } from "../lib/quick-filter-cascade.js";
37
37
  import { useOptionalRealtime as Kd } from "../lib/realtime.js";
38
38
  import { rowMenuRef as Lr, recordRefLabel as jd, friendlyIdOf as Sr, copyWhenReady as Bd, shareableRecordId as Ud, friendlyIdFieldOf as zd } from "../lib/record-ref.js";
@@ -42,7 +42,7 @@ import { logSearch as Vd, logSearchOpen as Hd } from "../lib/search-log.js";
42
42
  import { shapeForField as Yd } from "../lib/skeleton-shapes.js";
43
43
  import { knownTotalFrom as Jd } from "../lib/slow-reason.js";
44
44
  import { nextSortValue as Gd } from "../lib/sort-cycle.js";
45
- import { useMyScopes as Xd, matchScopeDimension as Ll, effectiveScopeSeedIds as Zd, translateScopeValues as ec } from "../lib/use-my-scopes.js";
45
+ import { useMyScopes as Xd, matchScopeDimension as Tl, effectiveScopeSeedIds as Zd, translateScopeValues as ec } from "../lib/use-my-scopes.js";
46
46
  import { useNewItemLayouts as tc } from "../lib/use-new-item-layouts.js";
47
47
  import { loadUserCard as nc, userCardQuery as ac } from "../lib/user-cards.js";
48
48
  import { cn as Xt, humanHours as rc, formatDateTime as sc } from "../lib/utils.js";
@@ -60,23 +60,23 @@ import { readExportRows as Nc, stableSort as Sc, m2oLabelPaths as Cc, resolveAll
60
60
  import { FormulaColumnAdder as Fc } from "./cbv/FormulaColumnAdder.js";
61
61
  import { useHierarchyScope as Rc, HierarchyScopePicker as Ec } from "./cbv/HierarchyScope.js";
62
62
  import { tabStopRowKey as Dc, rowFocusTarget as Pc } from "./cbv/row-focus.js";
63
- import { splitRiskFilter as Fl, riskFilterEntry as Mc } from "./cbv/saved-view-risk.js";
64
- import { isFilterRefusal as Oc, unknownFieldsOf as Rl, dropUnknownField as Ac } from "./cbv/unknown-fields.js";
63
+ import { splitRiskFilter as Ll, riskFilterEntry as Mc } from "./cbv/saved-view-risk.js";
64
+ import { isFilterRefusal as Oc, unknownFieldsOf as Fl, dropUnknownField as Ac } from "./cbv/unknown-fields.js";
65
65
  import { ViewDefaultMenu as Ic } from "./cbv/ViewDefaultMenu.js";
66
66
  import { exactCountParams as Kc, lastPageFromCount as jc } from "./cbv-pager.js";
67
67
  import { relationFilterRequests as Bc, mergeFilterOptions as Uc } from "./cbv-relation-filter.js";
68
68
  import { useRecordRoomTypes as zc, canOpenChatRoom as Qc, discussRecord as Wc } from "./chat/chat-core.js";
69
69
  import { FilterControl as Vc } from "./DataTable.js";
70
70
  import { FocusModeToggle as Hc } from "./FocusModeToggle.js";
71
- import { FULFILMENT_FILTER_OPTIONS as El, FulfilmentPill as Yc, fulfilmentFigures as Jc } from "./FulfilmentPill.js";
71
+ import { FULFILMENT_FILTER_OPTIONS as Rl, FulfilmentPill as Yc, fulfilmentFigures as Jc } from "./FulfilmentPill.js";
72
72
  import { HScrollProxy as Gc } from "./HScrollProxy.js";
73
73
  import { useDocumentAutofillConfig as Xc, startDocumentExtraction as Zc } from "./import/DocumentAutofillButton.js";
74
- import { INTEGRATIONS_FILTER_OPTIONS as Dl, IntegrationDots as eu } from "./integrations/IntegrationDots.js";
74
+ import { INTEGRATIONS_FILTER_OPTIONS as El, IntegrationDots as eu } from "./integrations/IntegrationDots.js";
75
75
  import { useQuickPickerSteps as tu, QuickPickerDialog as nu } from "./item-edit/QuickPickerDialog.js";
76
76
  import { usePickerExclusion as au } from "./item-edit/RecordGrantTools.js";
77
- import { invalidateRecordQueries as Pl } from "./item-edit/RecordLiveSync.js";
77
+ import { invalidateRecordQueries as Dl } from "./item-edit/RecordLiveSync.js";
78
78
  import { relatedMissing as ru } from "./item-edit/related-missing.js";
79
- import { UserRosterCluster as Ml, UserChip as Ol } from "./item-edit/UserChip.js";
79
+ import { UserRosterCluster as Pl, UserChip as Ml } from "./item-edit/UserChip.js";
80
80
  import { LiveRowMark as su } from "./LiveRowMark.js";
81
81
  import { CopyListLinkButton as lu } from "./list/CopyListLinkButton.js";
82
82
  import { useInlineEdit as ou, InlineEditCell as iu } from "./list/InlineEdit.js";
@@ -90,38 +90,38 @@ import { RowPresence as hu } from "./RowPresence.js";
90
90
  import { TableSkeletonRows as gu } from "./Skeletons.js";
91
91
  import { SlowNoticeView as xu } from "./SlowNotice.js";
92
92
  import { TipLayer as vu } from "./TipLayer.js";
93
- import { UnseenDot as Al } from "./UnseenDot.js";
94
- import { SimpleSelectXs as Nn, SimpleSelect as Il } from "./ui/SimpleSelect.js";
93
+ import { UnseenDot as Ol } from "./UnseenDot.js";
94
+ import { SimpleSelectXs as Nn, SimpleSelect as Al } from "./ui/SimpleSelect.js";
95
95
  import { RevisionsPanel as ku } from "./panels/RevisionsPanel.js";
96
96
  import { itemActionChoiceStep as yu, ItemActionChoiceList as wu } from "./panels/ItemActionChoices.js";
97
- function Sn(n, i, h) {
98
- const d = n.find((w) => w.one_collection === i && w.one_field === h);
97
+ function Sn(n, o, h) {
98
+ const d = n.find((w) => w.one_collection === o && w.one_field === h);
99
99
  if (d != null && d.many_collection)
100
100
  return { kind: d.junction_field ? "m2m" : "o2m", relation: d };
101
101
  }
102
- function ya(n, i) {
102
+ function ya(n, o) {
103
103
  var w;
104
- if (!i || i.kind !== "m2m") return null;
105
- const h = i.relation.many_collection, d = i.relation.junction_field;
104
+ if (!o || o.kind !== "m2m") return null;
105
+ const h = o.relation.many_collection, d = o.relation.junction_field;
106
106
  return !h || !d ? null : ((w = n.find((N) => N.many_collection === h && N.many_field === d)) == null ? void 0 : w.one_collection) ?? null;
107
107
  }
108
108
  function Yn(n) {
109
109
  if (!n) return "id";
110
- const i = new Set(n.fields.map((d) => d.field)), h = [...(n.display_template ?? "").matchAll(/\{\{(\w+)/g)].map((d) => d[1]);
111
- for (const d of h) if (i.has(d)) return d;
112
- for (const d of Er) if (i.has(d)) return d;
110
+ const o = new Set(n.fields.map((d) => d.field)), h = [...(n.display_template ?? "").matchAll(/\{\{(\w+)/g)].map((d) => d[1]);
111
+ for (const d of h) if (o.has(d)) return d;
112
+ for (const d of Hl) if (o.has(d)) return d;
113
113
  return "id";
114
114
  }
115
- const Kl = (n) => typeof n == "string" ? n : n.key, jl = {
115
+ const Il = (n) => typeof n == "string" ? n : n.key, Kl = {
116
116
  red: "text-red-600 dark:text-red-400 font-semibold",
117
117
  amber: "text-amber-600 dark:text-amber-400 font-semibold",
118
118
  green: "text-emerald-600 dark:text-emerald-400 font-semibold",
119
119
  blue: "text-sky-600 dark:text-sky-400 font-semibold"
120
120
  };
121
- function wa(n, i) {
122
- if (!i || i.length === 0) return null;
121
+ function wa(n, o) {
122
+ if (!o || o.length === 0) return null;
123
123
  const h = n == null ? "" : String(n), d = Number(h);
124
- for (const w of i) {
124
+ for (const w of o) {
125
125
  const N = Number(w.value), $ = Number.isFinite(d) && Number.isFinite(N);
126
126
  switch (w.op) {
127
127
  case "gt":
@@ -159,57 +159,57 @@ const _u = [
159
159
  { label: "Relative time", cfg: { type: "datetime", template: "relative" } },
160
160
  { label: "Yes / No", cfg: { type: "boolean", true_label: "Yes", false_label: "No" } },
161
161
  { label: "Count (related)", cfg: { type: "count" } }
162
- ], je = (n) => n.replace(/_/g, " ").replace(/\b\w/g, (i) => i.toUpperCase()), Er = ["name", "title", "label", "display_name", "subject", "email", "slug"];
163
- function Rr(n, i) {
164
- if (!n) return ["id", i, ...Er].join(",");
162
+ ], je = (n) => n.replace(/_/g, " ").replace(/\b\w/g, (o) => o.toUpperCase()), Hl = ["name", "title", "label", "display_name", "subject", "email", "slug"];
163
+ function Rr(n, o) {
164
+ if (!n) return o === "id" ? null : `id,${o}`;
165
165
  const h = [...n.matchAll(/\{\{([\w.]+)\}\}/g)].map((d) => d[1]);
166
- return h.some((d) => d.includes(".")) ? null : [.../* @__PURE__ */ new Set(["id", i, ...h])].join(",");
166
+ return h.some((d) => d.includes(".")) ? null : [.../* @__PURE__ */ new Set(["id", o, ...h])].join(",");
167
167
  }
168
- function Ta(n, i) {
168
+ function Ta(n, o) {
169
169
  if (!n) {
170
- for (const h of Er) {
171
- const d = i[h];
170
+ for (const h of Hl) {
171
+ const d = o[h];
172
172
  if (d != null && d !== "") return String(d);
173
173
  }
174
- return String(i.id ?? "");
174
+ return String(o.id ?? "");
175
175
  }
176
176
  return n.replace(/\{\{([\w.]+)\}\}/g, (h, d) => {
177
- const w = d.split(".").reduce((N, $) => N == null ? void 0 : N[$], i);
177
+ const w = d.split(".").reduce((N, $) => N == null ? void 0 : N[$], o);
178
178
  return w == null ? "" : String(w);
179
179
  });
180
180
  }
181
- function Dr(n, i, h) {
181
+ function Er(n, o, h) {
182
182
  return n.find(
183
- (d) => d.many_collection === i && d.many_field === h && // Loose: a relation list may omit junction_field rather than send null
183
+ (d) => d.many_collection === o && d.many_field === h && // Loose: a relation list may omit junction_field rather than send null
184
184
  // (record compare showed a raw "124133", army 11 staging check).
185
185
  !d.junction_field && !!d.one_collection
186
186
  );
187
187
  }
188
188
  function Nu(n) {
189
- const i = new Date(String(n));
190
- if (Number.isNaN(i.getTime())) return String(n);
191
- const h = Date.now() - i.getTime(), d = Math.floor(h / 6e4);
189
+ const o = new Date(String(n));
190
+ if (Number.isNaN(o.getTime())) return String(n);
191
+ const h = Date.now() - o.getTime(), d = Math.floor(h / 6e4);
192
192
  if (d < 1) return "just now";
193
193
  if (d < 60) return `${d}m ago`;
194
194
  const w = Math.floor(d / 60);
195
195
  if (w < 24) return `${w}h ago`;
196
196
  const N = Math.floor(w / 24);
197
- return N < 7 ? `${N}d ago` : i.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
197
+ return N < 7 ? `${N}d ago` : o.toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric" });
198
198
  }
199
199
  const bt = (n) => n.toLocaleString("en-US"), Yl = /* @__PURE__ */ new Set(["nivaro_users", "directus_users"]), Tt = (n) => n.startsWith("directus_") || n.startsWith("nivaro_"), Cr = /* @__PURE__ */ new Map();
200
- function Jl(n, i, h) {
201
- let d = Cr.get(i);
202
- d || (d = { ids: /* @__PURE__ */ new Set(), waiters: [], promise: null }, Cr.set(i, d));
200
+ function Jl(n, o, h) {
201
+ let d = Cr.get(o);
202
+ d || (d = { ids: /* @__PURE__ */ new Set(), waiters: [], promise: null }, Cr.set(o, d));
203
203
  const w = d;
204
204
  return w.ids.add(h), w.promise || (w.promise = new Promise((N) => {
205
205
  setTimeout(() => {
206
- Cr.delete(i);
206
+ Cr.delete(o);
207
207
  const $ = [...w.ids], q = [];
208
208
  for (let S = 0; S < $.length; S += 200) q.push($.slice(S, S + 200));
209
209
  Promise.all(
210
210
  q.map(
211
211
  (S) => n.request(
212
- J(`/items/${i}`, {
212
+ J(`/items/${o}`, {
213
213
  filter: JSON.stringify({ id: { _in: S } }),
214
214
  limit: S.length,
215
215
  fields: "*",
@@ -236,7 +236,7 @@ const Su = {
236
236
  };
237
237
  function Cu({ summary: n }) {
238
238
  if (!n || n.total === 0) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
239
- const i = n.latest, h = n.active > 0, d = i ? Su[i.status] ?? i.status : "", w = i == null ? void 0 : i.cost_impact, N = w != null && w !== 0 ? `${w > 0 ? "+" : "−"}$${Math.abs(w).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null, $ = i ? `${i.title ?? "Addendum"} — ${d}${n.total > 1 ? ` (${n.total} total)` : ""}` : void 0;
239
+ const o = n.latest, h = n.active > 0, d = o ? Su[o.status] ?? o.status : "", w = o == null ? void 0 : o.cost_impact, N = w != null && w !== 0 ? `${w > 0 ? "+" : "−"}$${Math.abs(w).toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}` : null, $ = o ? `${o.title ?? "Addendum"} — ${d}${n.total > 1 ? ` (${n.total} total)` : ""}` : void 0;
240
240
  return /* @__PURE__ */ c(
241
241
  "span",
242
242
  {
@@ -259,16 +259,16 @@ function Cu({ summary: n }) {
259
259
  }
260
260
  );
261
261
  }
262
- function Pr({ relatedCollection: n, id: i }) {
263
- const h = St(), d = Yl.has(n), w = i != null && i !== "", { data: N } = ne({
262
+ function Dr({ relatedCollection: n, id: o }) {
263
+ const h = St(), d = Yl.has(n), w = o != null && o !== "", { data: N } = ne({
264
264
  queryKey: ["cbv-collection-meta", n],
265
265
  queryFn: () => h.request(J(`/collections/${n}`)).then((L) => L.data),
266
266
  staleTime: 10 * 6e4,
267
267
  enabled: !Tt(n),
268
268
  retry: !1
269
269
  }), { data: $, isLoading: q } = ne({
270
- queryKey: ["cbv-relation-item", n, String(i)],
271
- queryFn: () => d ? h.request(J(`/users/${i}`)).then((L) => L.data) : Jl(h, n, String(i)),
270
+ queryKey: ["cbv-relation-item", n, String(o)],
271
+ queryFn: () => d ? h.request(J(`/users/${o}`)).then((L) => L.data) : Jl(h, n, String(o)),
272
272
  enabled: w && (d || !Tt(n)),
273
273
  staleTime: 30 * 6e4,
274
274
  retry: !1
@@ -293,8 +293,8 @@ function Pr({ relatedCollection: n, id: i }) {
293
293
  ) : Ta((N == null ? void 0 : N.display_template) ?? null, $);
294
294
  return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: S });
295
295
  }
296
- function Gl(n, i, h, d, w, N) {
297
- const $ = i.getQueryData(["cbv-collection-meta", h]);
296
+ function Gl(n, o, h, d, w, N) {
297
+ const $ = o.getQueryData(["cbv-collection-meta", h]);
298
298
  return Bd(
299
299
  Ud(n, h, $, d, w).then(
300
300
  (q) => window.location.origin + N({ collection: h, itemId: q })
@@ -302,7 +302,7 @@ function Gl(n, i, h, d, w, N) {
302
302
  ).catch(() => {
303
303
  });
304
304
  }
305
- function Ca(n, i) {
305
+ function Ca(n, o) {
306
306
  for (const h of [
307
307
  "cbv-items",
308
308
  "cbv-pipeline-instances",
@@ -312,21 +312,21 @@ function Ca(n, i) {
312
312
  "cbv-resolved",
313
313
  "cbv-row-instance"
314
314
  ])
315
- n.invalidateQueries({ queryKey: [h, i] });
315
+ n.invalidateQueries({ queryKey: [h, o] });
316
316
  }
317
- function $u(n, i) {
317
+ function $u(n, o) {
318
318
  return n ? n.is_admin ? !0 : (n.collections ?? []).some(
319
- (h) => (h.collection === i || h.collection === "*") && (h.actions.includes("update") || h.actions.includes("*"))
319
+ (h) => (h.collection === o || h.collection === "*") && (h.actions.includes("update") || h.actions.includes("*"))
320
320
  ) : !1;
321
321
  }
322
- function qu(n, i) {
322
+ function qu(n, o) {
323
323
  return n ? n.is_admin ? !0 : (n.collections ?? []).some(
324
- (h) => (h.collection === i || h.collection === "*") && (h.actions.includes("delete") || h.actions.includes("*"))
324
+ (h) => (h.collection === o || h.collection === "*") && (h.actions.includes("delete") || h.actions.includes("*"))
325
325
  ) : !1;
326
326
  }
327
327
  function Tu({
328
328
  collection: n,
329
- id: i,
329
+ id: o,
330
330
  hasPipeline: h,
331
331
  onOpen: d,
332
332
  onPeek: w,
@@ -344,7 +344,7 @@ function Tu({
344
344
  label: I,
345
345
  meta: y.getQueryData(["cbv-collection-meta", n]),
346
346
  row: L,
347
- id: i,
347
+ id: o,
348
348
  collection: n
349
349
  }), [m, E] = _(!1), [P, M] = _({ x: 0, y: 0 }), T = fe(null), de = fe(null);
350
350
  pe(() => {
@@ -355,7 +355,7 @@ function Tu({
355
355
  queryFn: () => u.request(J("/security/my/permissions")).then((g) => g.data),
356
356
  enabled: m && !Q,
357
357
  staleTime: 5 * 6e4
358
- }), we = au(n, String(i), {
358
+ }), we = au(n, String(o), {
359
359
  enabled: m && Q,
360
360
  onDone: () => E(!1)
361
361
  }), [Ae, G] = _(!1), Be = zc(m), Se = Qc() && !!(Be != null && Be.some((g) => g.collection === n));
@@ -373,8 +373,8 @@ function Tu({
373
373
  };
374
374
  }, [m]);
375
375
  const { data: X } = ne({
376
- queryKey: ["cbv-row-instance", n, String(i)],
377
- queryFn: () => u.request(J(`/pipelines/instance/${n}/${i}`)).then((g) => g.data).catch(() => null),
376
+ queryKey: ["cbv-row-instance", n, String(o)],
377
+ queryFn: () => u.request(J(`/pipelines/instance/${n}/${o}`)).then((g) => g.data).catch(() => null),
378
378
  enabled: m && h,
379
379
  staleTime: 15e3
380
380
  }), $e = be(
@@ -400,9 +400,9 @@ function Tu({
400
400
  Z && typeof Z.field == "string" && !(L && Z.field in L) && g.add(Z.field);
401
401
  return [...g].sort();
402
402
  }, [Ie, L]), { data: We } = ne({
403
- queryKey: ["row-action-guard", n, String(i), Pe.join(",")],
403
+ queryKey: ["row-action-guard", n, String(o), Pe.join(",")],
404
404
  queryFn: () => u.request(
405
- J(`/items/${encodeURIComponent(n)}/${encodeURIComponent(String(i))}`, {
405
+ J(`/items/${encodeURIComponent(n)}/${encodeURIComponent(String(o))}`, {
406
406
  fields: Pe.join(",")
407
407
  })
408
408
  ).then((g) => g.data ?? {}).catch(() => ({})),
@@ -417,7 +417,7 @@ function Tu({
417
417
  return Ie.filter((R) => uc(R.guard, g) !== !1);
418
418
  }, [Ie, Pe, We, L]), { pushActions: le, failedPartners: ee } = xc({
419
419
  collection: n,
420
- id: i,
420
+ id: o,
421
421
  open: m,
422
422
  bulkData: it,
423
423
  bulkEnabledKeys: K
@@ -455,9 +455,9 @@ function Tu({
455
455
  m || (H(null), oe(""), G(!1));
456
456
  }, [m]);
457
457
  const ae = ((qn = f == null ? void 0 : f.push) == null ? void 0 : qn.kind) === "push" && f.push.action.choose ? f.push.action : null, qe = ne({
458
- queryKey: ["item-action-choices", (ae == null ? void 0 : ae.id) ?? null, n, String(i)],
458
+ queryKey: ["item-action-choices", (ae == null ? void 0 : ae.id) ?? null, n, String(o)],
459
459
  queryFn: () => u.request(
460
- J(`/item-actions/${ae.id}/choices`, { collection: n, item: String(i) })
460
+ J(`/item-actions/${ae.id}/choices`, { collection: n, item: String(o) })
461
461
  ).then((g) => g.data ?? []),
462
462
  enabled: !!ae,
463
463
  staleTime: 0
@@ -479,7 +479,7 @@ function Tu({
479
479
  }, [m, P, f, $e.length]);
480
480
  const Ft = Nt({
481
481
  mutationFn: ({ transitionId: g, comment: R }) => u.request(
482
- he(`/pipelines/instance/${n}/${i}/transition`, {
482
+ he(`/pipelines/instance/${n}/${o}/transition`, {
483
483
  transition_id: g,
484
484
  ...R != null && R.trim() ? { comment: R.trim() } : {}
485
485
  })
@@ -487,7 +487,7 @@ function Tu({
487
487
  onSuccess: (g, R) => {
488
488
  E(!1);
489
489
  const Z = $e.find((ue) => ue.id === R.transitionId);
490
- ge.success(Z ? `${F.name} moved to ${mt(Z)}` : `${F.name} moved`), Ca(y, n), Pl(y, n, [i]), S == null || S();
490
+ ge.success(Z ? `${F.name} moved to ${mt(Z)}` : `${F.name} moved`), Ca(y, n), Dl(y, n, [o]), S == null || S();
491
491
  },
492
492
  onError: (g) => ge.error(
493
493
  Zt(g, "Transition failed"),
@@ -495,7 +495,7 @@ function Tu({
495
495
  )
496
496
  }), dn = Nt({
497
497
  mutationFn: async ({ action: g, comment: R }) => {
498
- const Z = { collection: n, ids: [i], reason: (R == null ? void 0 : R.trim()) || null }, ue = g.source === "db" ? await u.request(he("/bulk-actions/run", { ...Z, key: g.key })) : await u.request(he(`/bulk-actions/${g.key}/execute`, Z));
498
+ const Z = { collection: n, ids: [o], reason: (R == null ? void 0 : R.trim()) || null }, ue = g.source === "db" ? await u.request(he("/bulk-actions/run", { ...Z, key: g.key })) : await u.request(he(`/bulk-actions/${g.key}/execute`, Z));
499
499
  return { action: g, result: ue.data ?? {} };
500
500
  },
501
501
  onSuccess: ({ action: g, result: R }) => {
@@ -511,14 +511,14 @@ function Tu({
511
511
  ge.info(`${F.name}: ${nn ?? "nothing to change"}`);
512
512
  return;
513
513
  }
514
- ge.success(`${g.label} — done on ${F.name}`), Ca(y, n), Pl(y, n, [i]), S == null || S();
514
+ ge.success(`${g.label} — done on ${F.name}`), Ca(y, n), Dl(y, n, [o]), S == null || S();
515
515
  },
516
516
  onError: (g) => {
517
517
  const R = g.response;
518
518
  ge.error((R == null ? void 0 : R.error) ?? Zt(g, "Action failed"), Sa(g));
519
519
  }
520
520
  }), Rt = Nt({
521
- mutationFn: ({ op: g, note: R, pick: Z }) => vc(u, n, i, g, R, Z).then((ue) => ({ op: g, outcome: ue })),
521
+ mutationFn: ({ op: g, note: R, pick: Z }) => vc(u, n, o, g, R, Z).then((ue) => ({ op: g, outcome: ue })),
522
522
  onSuccess: ({ op: g, outcome: R }) => {
523
523
  E(!1);
524
524
  const Z = g.kind === "push" ? g.action.label : "Retry";
@@ -568,7 +568,7 @@ function Tu({
568
568
  ]
569
569
  }
570
570
  ),
571
- m && Vl(
571
+ m && Wl(
572
572
  /* @__PURE__ */ a(
573
573
  "div",
574
574
  {
@@ -641,14 +641,14 @@ function Tu({
641
641
  placeholder: ((xt = f.push) == null ? void 0 : xt.kind) === "push" ? ((Tn = (lt = f.push.action.confirm) == null ? void 0 : lt.input) == null ? void 0 : Tn.placeholder) ?? ((un = (cn = f.push.action.confirm) == null ? void 0 : cn.input) == null ? void 0 : un.label) ?? "" : (en = f.action) != null && en.require_reason || ((tn = $e.find((g) => g.id === f.picked)) == null ? void 0 : tn.comment_mode) === "required" ? "Reason (required — recorded on the record’s history)…" : "Reason (optional)…",
642
642
  rows: 2,
643
643
  "aria-label": ((Xn = f.push) == null ? void 0 : Xn.kind) === "push" ? ((ce = (Zn = f.push.action.confirm) == null ? void 0 : Zn.input) == null ? void 0 : ce.label) ?? "Note" : "Reason",
644
- "aria-describedby": $n ? `row-reason-hint-${String(i)}` : void 0,
644
+ "aria-describedby": $n ? `row-reason-hint-${String(o)}` : void 0,
645
645
  className: "w-full resize-none rounded-md border border-slate-200 bg-white px-2 py-1.5 text-[12px] outline-none focus:border-nvr-cyan/50 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
646
646
  }
647
647
  ),
648
648
  $n && /* @__PURE__ */ a(
649
649
  "p",
650
650
  {
651
- id: `row-reason-hint-${String(i)}`,
651
+ id: `row-reason-hint-${String(o)}`,
652
652
  className: "mt-1 px-1 text-[11px] text-slate-500 dark:text-slate-400",
653
653
  "data-row-reason-hint": !0,
654
654
  children: "Add a reason to continue."
@@ -683,13 +683,13 @@ function Tu({
683
683
  E(!1), d();
684
684
  }),
685
685
  Je("Open in new tab", () => {
686
- E(!1), window.open($({ collection: n, itemId: String(i) }), "_blank");
686
+ E(!1), window.open($({ collection: n, itemId: String(o) }), "_blank");
687
687
  }),
688
688
  w && Je("Peek details", () => {
689
689
  E(!1), w();
690
690
  }),
691
691
  Se && Je("Discuss in chat", () => {
692
- E(!1), Wc(u, n, String(i)).then((g) => {
692
+ E(!1), Wc(u, n, String(o)).then((g) => {
693
693
  g || ge.error("This record has no chat room you can open");
694
694
  }).catch(() => ge.error("Could not open the chat room"));
695
695
  }),
@@ -800,7 +800,7 @@ function Tu({
800
800
  E(!1), (g = navigator.clipboard) == null || g.writeText(F.copy ?? ""), ge.success("ID copied");
801
801
  }),
802
802
  Je("Copy link", () => {
803
- E(!1), Gl(u, y, n, L, i, $), ge.success("Link copied");
803
+ E(!1), Gl(u, y, n, L, o, $), ge.success("Link copied");
804
804
  }),
805
805
  Q && /* @__PURE__ */ c(Qe, { children: [
806
806
  jt,
@@ -868,16 +868,16 @@ function Tu({
868
868
  function $r(n) {
869
869
  return n === "id" || /(^|_)id$/i.test(n) || /(^|_)uuid$/i.test(n);
870
870
  }
871
- function Bl({
871
+ function jl({
872
872
  collection: n,
873
- field: i,
873
+ field: o,
874
874
  fieldType: h,
875
875
  value: d,
876
876
  relations: w
877
877
  }) {
878
- const N = Dr(w, n, i);
878
+ const N = Er(w, n, o);
879
879
  if (N != null && N.one_collection)
880
- return /* @__PURE__ */ a(Pr, { relatedCollection: N.one_collection, id: d });
880
+ return /* @__PURE__ */ a(Dr, { relatedCollection: N.one_collection, id: d });
881
881
  if (d == null) return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
882
882
  if (h === "boolean")
883
883
  return /* @__PURE__ */ a(
@@ -903,10 +903,10 @@ function Bl({
903
903
  {
904
904
  className: Xt(
905
905
  "block max-w-[240px] truncate text-[12px] text-slate-700 dark:text-slate-200",
906
- $r(i) && "font-mono",
906
+ $r(o) && "font-mono",
907
907
  // An id cell opens the record. Underline it so that is legible
908
908
  // before you click rather than after.
909
- $r(i) && "underline decoration-slate-300 decoration-dotted underline-offset-2 group-hover:decoration-nvr-cyan dark:decoration-slate-600"
909
+ $r(o) && "underline decoration-slate-300 decoration-dotted underline-offset-2 group-hover:decoration-nvr-cyan dark:decoration-slate-600"
910
910
  ),
911
911
  "data-tip": d.length > 28 ? d : void 0,
912
912
  children: d
@@ -916,7 +916,7 @@ function Bl({
916
916
  {
917
917
  className: Xt(
918
918
  "text-[12px] tabular-nums text-slate-700 dark:text-slate-200",
919
- $r(i) && "font-mono"
919
+ $r(o) && "font-mono"
920
920
  ),
921
921
  children: String(d)
922
922
  }
@@ -924,7 +924,7 @@ function Bl({
924
924
  }
925
925
  function Ra({
926
926
  label: n,
927
- options: i,
927
+ options: o,
928
928
  selected: h,
929
929
  onChange: d,
930
930
  loading: w,
@@ -953,7 +953,7 @@ function Ra({
953
953
  };
954
954
  return window.addEventListener("mousedown", P), () => window.removeEventListener("mousedown", P);
955
955
  }, [L]);
956
- const y = V && !S ? i.filter((P) => P.label.toLowerCase().includes(V.toLowerCase())) : i, Q = new Set(h.map(String)), F = ((E = i.find((P) => String(P.value) === String(h[0]))) == null ? void 0 : E.label) ?? String(h[0] ?? ""), m = h.length === 0 ? n : h.length === 1 ? F : `${F} +${h.length - 1}`;
956
+ const y = V && !S ? o.filter((P) => P.label.toLowerCase().includes(V.toLowerCase())) : o, Q = new Set(h.map(String)), F = ((E = o.find((P) => String(P.value) === String(h[0]))) == null ? void 0 : E.label) ?? String(h[0] ?? ""), m = h.length === 0 ? n : h.length === 1 ? F : `${F} +${h.length - 1}`;
957
957
  return /* @__PURE__ */ c("div", { ref: u, className: N ? "relative w-full" : "relative", children: [
958
958
  /* @__PURE__ */ c(
959
959
  "button",
@@ -1028,7 +1028,7 @@ function Ra({
1028
1028
  }
1029
1029
  function Lu({
1030
1030
  target: n,
1031
- label: i,
1031
+ label: o,
1032
1032
  selected: h,
1033
1033
  onChange: d,
1034
1034
  preferIds: w
@@ -1090,7 +1090,7 @@ function Lu({
1090
1090
  Ra,
1091
1091
  {
1092
1092
  block: !0,
1093
- label: i ?? "All",
1093
+ label: o ?? "All",
1094
1094
  options: M,
1095
1095
  selected: h,
1096
1096
  onChange: d,
@@ -1104,13 +1104,13 @@ function Lu({
1104
1104
  }
1105
1105
  function Fu({
1106
1106
  collection: n,
1107
- field: i,
1107
+ field: o,
1108
1108
  selected: h,
1109
1109
  onChange: d
1110
1110
  }) {
1111
1111
  const w = St(), [N, $] = _(!1), { data: q = [], isLoading: S } = ne({
1112
- queryKey: ["cbv-distinct", n, i],
1113
- queryFn: () => w.request(J(`/items/${n}/distinct`, { field: i })).then((L) => L.data ?? []),
1112
+ queryKey: ["cbv-distinct", n, o],
1113
+ queryFn: () => w.request(J(`/items/${n}/distinct`, { field: o })).then((L) => L.data ?? []),
1114
1114
  staleTime: 5 * 6e4,
1115
1115
  enabled: N,
1116
1116
  retry: !1
@@ -1132,7 +1132,7 @@ function Fu({
1132
1132
  }
1133
1133
  function Ru({
1134
1134
  value: n,
1135
- onChange: i
1135
+ onChange: o
1136
1136
  }) {
1137
1137
  const [h, d] = _(!1), [w, N] = _(""), [$, q] = _(""), S = fe(null);
1138
1138
  pe(() => {
@@ -1160,7 +1160,7 @@ function Ru({
1160
1160
  }, [h, n]);
1161
1161
  const I = () => {
1162
1162
  const u = w || $;
1163
- u && (i(Ji({ op: K, from: u, to: $ || w || u })), d(!1));
1163
+ u && (o(Ji({ op: K, from: u, to: $ || w || u })), d(!1));
1164
1164
  };
1165
1165
  return /* @__PURE__ */ c("div", { ref: S, className: "relative w-full", children: [
1166
1166
  /* @__PURE__ */ c(
@@ -1179,7 +1179,7 @@ function Ru({
1179
1179
  role: "button",
1180
1180
  tabIndex: -1,
1181
1181
  onClick: (u) => {
1182
- u.stopPropagation(), i(null);
1182
+ u.stopPropagation(), o(null);
1183
1183
  },
1184
1184
  "aria-label": "Clear date filter",
1185
1185
  className: "text-slate-400 hover:text-slate-600",
@@ -1196,7 +1196,7 @@ function Ru({
1196
1196
  {
1197
1197
  type: "button",
1198
1198
  onClick: () => {
1199
- i(u.value || null), d(!1);
1199
+ o(u.value || null), d(!1);
1200
1200
  },
1201
1201
  className: `block w-full rounded px-2 py-1 text-left text-[11.5px] font-normal normal-case tracking-normal ${n === u.value || !n && !u.value ? "bg-nvr-cyan/[0.08] font-medium text-slate-800 dark:text-slate-100" : "text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-800"}`,
1202
1202
  children: u.label
@@ -1257,7 +1257,7 @@ function Ru({
1257
1257
  }
1258
1258
  function Eu({
1259
1259
  def: n,
1260
- selected: i,
1260
+ selected: o,
1261
1261
  onChange: h,
1262
1262
  allowedIds: d,
1263
1263
  scopeDefault: w,
@@ -1273,7 +1273,7 @@ function Eu({
1273
1273
  n.label_field,
1274
1274
  n.sort ?? "",
1275
1275
  V,
1276
- i.map(String).sort().join(",")
1276
+ o.map(String).sort().join(",")
1277
1277
  ],
1278
1278
  queryFn: async () => {
1279
1279
  const F = V !== "[]" ? Ad(
@@ -1295,17 +1295,17 @@ function Eu({
1295
1295
  label: String(we[n.label_field] ?? we[S] ?? ""),
1296
1296
  id: we.id
1297
1297
  })).filter((we) => we.value != null && we.label !== "")
1298
- ), E = await m(F, !0), P = new Set(E.map((T) => String(T.value))), M = i.filter((T) => !P.has(String(T)));
1298
+ ), E = await m(F, !0), P = new Set(E.map((T) => String(T.value))), M = o.filter((T) => !P.has(String(T)));
1299
1299
  return M.length === 0 ? E : [...E, ...await m({ [S]: { _in: M } }, !1)];
1300
1300
  },
1301
1301
  staleTime: 10 * 6e4,
1302
- enabled: L || i.length > 0,
1302
+ enabled: L || o.length > 0,
1303
1303
  retry: !1
1304
1304
  }), y = d != null && d.length ? I.filter((F) => d.some((m) => String(m) === String(F.id))) : I, Q = d != null && d.length ? {
1305
1305
  label: "restricted",
1306
1306
  cls: "bg-amber-500/15 text-amber-700 dark:text-amber-300",
1307
1307
  title: `Options limited to your restricted ${n.label} scope${w ? "; selection seeded from your defaults" : ""}`
1308
- } : w && i.length > 0 ? {
1308
+ } : w && o.length > 0 ? {
1309
1309
  label: "your default",
1310
1310
  cls: "bg-nvr-cyan/[0.12] text-[#0284a8] dark:text-nvr-cyan",
1311
1311
  title: `Pre-selected from your default ${n.label} filter (Profile → Default filters) — adjust freely`
@@ -1315,7 +1315,7 @@ function Eu({
1315
1315
  {
1316
1316
  label: n.label,
1317
1317
  options: y,
1318
- selected: i,
1318
+ selected: o,
1319
1319
  onChange: h,
1320
1320
  loading: u,
1321
1321
  badge: Q,
@@ -1354,49 +1354,49 @@ const Xl = [
1354
1354
  _lte: "_gt"
1355
1355
  };
1356
1356
  function Zl(n) {
1357
- const i = /* @__PURE__ */ new Date(), h = (w) => w.toISOString().slice(0, 10), d = h(i);
1357
+ const o = /* @__PURE__ */ new Date(), h = (w) => w.toISOString().slice(0, 10), d = h(o);
1358
1358
  if (n === "today") return { from: d, to: d };
1359
1359
  if (n === "7d" || n === "30d" || n === "90d") {
1360
1360
  const w = Number(n.slice(0, -1));
1361
- return { from: h(new Date(i.getTime() - w * 864e5)), to: d };
1361
+ return { from: h(new Date(o.getTime() - w * 864e5)), to: d };
1362
1362
  }
1363
- return n === "year" ? { from: `${i.getFullYear()}-01-01`, to: d } : null;
1363
+ return n === "year" ? { from: `${o.getFullYear()}-01-01`, to: d } : null;
1364
1364
  }
1365
- function Ul(n) {
1365
+ function Bl(n) {
1366
1366
  var h;
1367
- const i = [];
1367
+ const o = [];
1368
1368
  for (const d of n) {
1369
1369
  const w = d.fieldType === "date" || d.fieldType === "datetime" || d.fieldType === "timestamp";
1370
1370
  if (d.op === "_between") {
1371
1371
  const [q, S] = String(d.value).split("..");
1372
1372
  if (d.not) {
1373
1373
  const L = [];
1374
- q && L.push({ path: d.path, op: "_lt", value: q }), S && L.push({ path: d.path, op: "_gt", value: w ? `${S}T23:59:59` : S }), L.length && i.push({ or: L });
1374
+ q && L.push({ path: d.path, op: "_lt", value: q }), S && L.push({ path: d.path, op: "_gt", value: w ? `${S}T23:59:59` : S }), L.length && o.push({ or: L });
1375
1375
  continue;
1376
1376
  }
1377
- q && i.push({ path: d.path, op: "_gte", value: q }), S && i.push({ path: d.path, op: "_lte", value: w ? `${S}T23:59:59` : S });
1377
+ q && o.push({ path: d.path, op: "_gte", value: q }), S && o.push({ path: d.path, op: "_lte", value: w ? `${S}T23:59:59` : S });
1378
1378
  continue;
1379
1379
  }
1380
1380
  if ((h = d.path[0]) != null && h.startsWith("$has_") || d.path[0] === "$missing_required" || d.path[0] === "$unseen") {
1381
- i.push({ path: d.path, op: "_eq", value: !d.not });
1381
+ o.push({ path: d.path, op: "_eq", value: !d.not });
1382
1382
  continue;
1383
1383
  }
1384
1384
  if (d.op === "_preset") {
1385
1385
  const q = Zl(String(d.value));
1386
- q && (d.not ? i.push({
1386
+ q && (d.not ? o.push({
1387
1387
  or: [
1388
1388
  { path: d.path, op: "_lt", value: q.from },
1389
1389
  { path: d.path, op: "_gt", value: `${q.to}T23:59:59` }
1390
1390
  ]
1391
- }) : (i.push({ path: d.path, op: "_gte", value: q.from }), i.push({ path: d.path, op: "_lte", value: `${q.to}T23:59:59` })));
1391
+ }) : (o.push({ path: d.path, op: "_gte", value: q.from }), o.push({ path: d.path, op: "_lte", value: `${q.to}T23:59:59` })));
1392
1392
  continue;
1393
1393
  }
1394
1394
  let N = d.op.includes(":") ? d.op.split(":")[0] : d.op, $ = d.op.includes(":") ? d.op.split(":")[1] : d.value || null;
1395
- d.fieldType === "boolean" && ($ === "true" || $ === "false") && ($ = $ === "true"), d.not && (N = Du[N] ?? N), i.push({ path: d.path, op: N, value: $ });
1395
+ d.fieldType === "boolean" && ($ === "true" || $ === "false") && ($ = $ === "true"), d.not && (N = Du[N] ?? N), o.push({ path: d.path, op: N, value: $ });
1396
1396
  }
1397
- return i;
1397
+ return o;
1398
1398
  }
1399
- const zl = [
1399
+ const Ul = [
1400
1400
  { label: "Contains", value: "_contains" },
1401
1401
  { label: "Doesn't contain", value: "_ncontains" },
1402
1402
  { label: "Equals", value: "_eq" },
@@ -1421,8 +1421,8 @@ const zl = [
1421
1421
  { label: "Is empty", value: "_null" },
1422
1422
  { label: "Is not empty", value: "_nnull" }
1423
1423
  ], Pu = {
1424
- string: zl,
1425
- text: zl,
1424
+ string: Ul,
1425
+ text: Ul,
1426
1426
  integer: qr,
1427
1427
  decimal: qr,
1428
1428
  float: qr,
@@ -1442,20 +1442,20 @@ const zl = [
1442
1442
  ]
1443
1443
  };
1444
1444
  function Mu(n) {
1445
- for (const i of Object.values(Pu)) {
1446
- const h = i.find((d) => d.value === n);
1445
+ for (const o of Object.values(Pu)) {
1446
+ const h = o.find((d) => d.value === n);
1447
1447
  if (h) return h.label;
1448
1448
  }
1449
1449
  return n;
1450
1450
  }
1451
- function ot(n, i, h) {
1451
+ function ot(n, o, h) {
1452
1452
  return n.find(
1453
- (d) => d.many_collection === i && d.many_field === h && d.one_collection
1453
+ (d) => d.many_collection === o && d.many_field === h && d.one_collection
1454
1454
  );
1455
1455
  }
1456
- function Mr({
1456
+ function Pr({
1457
1457
  relatedCollection: n,
1458
- depth: i,
1458
+ depth: o,
1459
1459
  path: h,
1460
1460
  pathLabels: d,
1461
1461
  filterText: w,
@@ -1469,8 +1469,8 @@ function Mr({
1469
1469
  retry: !1
1470
1470
  }), [L, K] = _(/* @__PURE__ */ new Set());
1471
1471
  if (!S)
1472
- return /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + i}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1473
- const V = i < 2;
1472
+ return /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1473
+ const V = o < 2;
1474
1474
  return /* @__PURE__ */ a(Qe, { children: S.fields.filter((I) => !I.hidden && (!w || I.field.includes(w))).map((I) => {
1475
1475
  const u = V ? ot(S.relations, n, I.field) : void 0, y = V && N ? Sn(S.relations, n, I.field) : void 0, Q = (u == null ? void 0 : u.one_collection) ?? null, F = L.has(I.field);
1476
1476
  return /* @__PURE__ */ c("div", { children: [
@@ -1489,7 +1489,7 @@ function Mr({
1489
1489
  );
1490
1490
  },
1491
1491
  className: "flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
1492
- style: { paddingLeft: `${0.5 + i}rem` },
1492
+ style: { paddingLeft: `${0.5 + o}rem` },
1493
1493
  children: [
1494
1494
  Q || y ? F ? "▾ " : "▸ " : "",
1495
1495
  je(I.field),
@@ -1498,10 +1498,10 @@ function Mr({
1498
1498
  }
1499
1499
  ),
1500
1500
  Q && F && /* @__PURE__ */ a(
1501
- Mr,
1501
+ Pr,
1502
1502
  {
1503
1503
  relatedCollection: Q,
1504
- depth: i + 1,
1504
+ depth: o + 1,
1505
1505
  path: [...h, I.field],
1506
1506
  pathLabels: [...d, je(I.field)],
1507
1507
  filterText: "",
@@ -1513,7 +1513,7 @@ function Mr({
1513
1513
  eo,
1514
1514
  {
1515
1515
  aliasInfo: y,
1516
- depth: i + 1,
1516
+ depth: o + 1,
1517
1517
  path: [...h, I.field],
1518
1518
  pathLabels: [...d, je(I.field)],
1519
1519
  includeAliases: N,
@@ -1525,7 +1525,7 @@ function Mr({
1525
1525
  }
1526
1526
  function eo({
1527
1527
  aliasInfo: n,
1528
- depth: i,
1528
+ depth: o,
1529
1529
  path: h,
1530
1530
  pathLabels: d,
1531
1531
  includeAliases: w,
@@ -1547,26 +1547,26 @@ function eo({
1547
1547
  L = (K == null ? void 0 : K.one_collection) ?? null;
1548
1548
  }
1549
1549
  return L ? /* @__PURE__ */ a(
1550
- Mr,
1550
+ Pr,
1551
1551
  {
1552
1552
  relatedCollection: L,
1553
- depth: i,
1553
+ depth: o,
1554
1554
  path: h,
1555
1555
  pathLabels: d,
1556
1556
  filterText: "",
1557
1557
  includeAliases: w,
1558
1558
  onPick: N
1559
1559
  }
1560
- ) : /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + i}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1560
+ ) : /* @__PURE__ */ a("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + o}rem` }, children: /* @__PURE__ */ a("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
1561
1561
  }
1562
- function Ql(n, i, h) {
1563
- if (i) return "relation";
1562
+ function zl(n, o, h) {
1563
+ if (o) return "relation";
1564
1564
  const d = n.type ?? "string";
1565
1565
  return d === "integer" || d === "decimal" || d === "float" ? "number" : d === "datetime" || d === "timestamp" ? "date" : d;
1566
1566
  }
1567
1567
  function Ou({
1568
1568
  collection: n,
1569
- path: i,
1569
+ path: o,
1570
1570
  pathLabels: h,
1571
1571
  search: d,
1572
1572
  depth: w,
@@ -1612,7 +1612,7 @@ function Ou({
1612
1612
  const I = d.trim().toLowerCase(), u = (m) => !I || m.toLowerCase().includes(I) || m.toLowerCase().replace(/ /g, "_").includes(I), y = [];
1613
1613
  for (const m of S.fields) {
1614
1614
  if (m.hidden) continue;
1615
- const E = je(m.field), P = ot(S.relations, n, m.field), M = Sn(S.relations, n, m.field), T = [...i, m.field], de = [...h, E];
1615
+ const E = je(m.field), P = ot(S.relations, n, m.field), M = Sn(S.relations, n, m.field), T = [...o, m.field], de = [...h, E];
1616
1616
  if (P != null && P.one_collection && !Tt(P.one_collection))
1617
1617
  u(E) && y.push({
1618
1618
  key: m.field,
@@ -1643,7 +1643,7 @@ function Ou({
1643
1643
  } else u(E) && y.push({
1644
1644
  key: m.field,
1645
1645
  label: E,
1646
- hint: Ql(m, void 0),
1646
+ hint: zl(m, void 0),
1647
1647
  leaf: { path: T, pathLabels: de, fieldType: m.type ?? "string" }
1648
1648
  });
1649
1649
  }
@@ -1665,9 +1665,9 @@ function Ou({
1665
1665
  key: `${m.field}.${T.field}`,
1666
1666
  label: de,
1667
1667
  breadcrumb: M,
1668
- hint: Ql(T, me ?? void 0),
1668
+ hint: zl(T, me ?? void 0),
1669
1669
  leaf: {
1670
- path: [...i, m.field, T.field],
1670
+ path: [...o, m.field, T.field],
1671
1671
  pathLabels: [...h, M, de],
1672
1672
  fieldType: me != null && me.one_collection ? "relation" : T.type ?? "string",
1673
1673
  relTarget: (me == null ? void 0 : me.one_collection) ?? void 0
@@ -1716,7 +1716,7 @@ function Ou({
1716
1716
  }
1717
1717
  function Au({
1718
1718
  target: n,
1719
- selected: i,
1719
+ selected: o,
1720
1720
  labels: h,
1721
1721
  onToggle: d
1722
1722
  }) {
@@ -1746,7 +1746,7 @@ function Au({
1746
1746
  staleTime: 10 * 6e4,
1747
1747
  enabled: !!q,
1748
1748
  retry: !1
1749
- }), I = new Set(i.map(String)), u = N ? K.filter((y) => y.label.toLowerCase().includes(N.toLowerCase())) : K;
1749
+ }), I = new Set(o.map(String)), u = N ? K.filter((y) => y.label.toLowerCase().includes(N.toLowerCase())) : K;
1750
1750
  return /* @__PURE__ */ c("div", { className: "flex max-h-64 flex-col", children: [
1751
1751
  /* @__PURE__ */ a(
1752
1752
  "input",
@@ -1776,39 +1776,39 @@ function Au({
1776
1776
  },
1777
1777
  String(y.value)
1778
1778
  )) }),
1779
- i.length > 0 && /* @__PURE__ */ c("p", { className: "shrink-0 border-t border-slate-100 px-3 py-1 text-[11px] text-slate-400 dark:border-slate-800", children: [
1780
- i.length,
1779
+ o.length > 0 && /* @__PURE__ */ c("p", { className: "shrink-0 border-t border-slate-100 px-3 py-1 text-[11px] text-slate-400 dark:border-slate-800", children: [
1780
+ o.length,
1781
1781
  " selected ·",
1782
1782
  " ",
1783
- i.map((y) => h[String(y)] ?? y).slice(0, 3).join(", "),
1784
- i.length > 3 ? "…" : ""
1783
+ o.map((y) => h[String(y)] ?? y).slice(0, 3).join(", "),
1784
+ o.length > 3 ? "…" : ""
1785
1785
  ] })
1786
1786
  ] });
1787
1787
  }
1788
1788
  function Iu(n) {
1789
1789
  var h, d;
1790
- const i = n.pathLabels.join(" › ");
1790
+ const o = n.pathLabels.join(" › ");
1791
1791
  if (Array.isArray(n.value)) {
1792
1792
  const w = n.valueLabels ?? n.value.map(String);
1793
1793
  return {
1794
- field: i,
1794
+ field: o,
1795
1795
  op: "any of",
1796
1796
  value: w.length <= 2 ? w.join(", ") : `${w[0]} +${w.length - 1}`
1797
1797
  };
1798
1798
  }
1799
1799
  if (n.op === "_between") {
1800
1800
  const [w, N] = String(n.value).split("..");
1801
- return { field: i, op: "between", value: `${w} – ${N}` };
1801
+ return { field: o, op: "between", value: `${w} – ${N}` };
1802
1802
  }
1803
1803
  if (n.op === "_preset") {
1804
1804
  const w = ((h = La.find((N) => N.value === n.value)) == null ? void 0 : h.label) ?? String(n.value);
1805
- return { field: i, op: "in the", value: `${w} (rolling)` };
1805
+ return { field: o, op: "in the", value: `${w} (rolling)` };
1806
1806
  }
1807
- return (d = n.path[0]) != null && d.startsWith("$has_") || n.path[0] === "$missing_required" ? { field: i, op: "", value: "" } : { field: i, op: Mu(n.op).toLowerCase(), value: String(n.value ?? "") };
1807
+ return (d = n.path[0]) != null && d.startsWith("$has_") || n.path[0] === "$missing_required" ? { field: o, op: "", value: "" } : { field: o, op: Mu(n.op).toLowerCase(), value: String(n.value ?? "") };
1808
1808
  }
1809
1809
  function Ku({
1810
1810
  collection: n,
1811
- meta: i,
1811
+ meta: o,
1812
1812
  search: h,
1813
1813
  onSearch: d,
1814
1814
  filters: w,
@@ -1896,7 +1896,7 @@ function Ku({
1896
1896
  /* @__PURE__ */ c("div", { className: "flex min-w-0 max-w-[24rem] flex-1 items-center gap-2", children: [
1897
1897
  /* @__PURE__ */ c("div", { className: "relative min-w-0 flex-1", children: [
1898
1898
  /* @__PURE__ */ a(
1899
- Wl,
1899
+ Ql,
1900
1900
  {
1901
1901
  "aria-hidden": !0,
1902
1902
  className: "pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-400"
@@ -2233,12 +2233,12 @@ function Ku({
2233
2233
  }
2234
2234
  function ju({
2235
2235
  collection: n,
2236
- meta: i,
2236
+ meta: o,
2237
2237
  onPick: h
2238
2238
  }) {
2239
2239
  const [d, w] = _(/* @__PURE__ */ new Set()), N = ($, q) => h($, q);
2240
- return /* @__PURE__ */ a("div", { className: "max-h-56 overflow-y-auto", children: i.fields.filter(($) => !$.hidden).map(($) => {
2241
- const q = ot(i.relations, n, $.field), S = Sn(i.relations, n, $.field);
2240
+ return /* @__PURE__ */ a("div", { className: "max-h-56 overflow-y-auto", children: o.fields.filter(($) => !$.hidden).map(($) => {
2241
+ const q = ot(o.relations, n, $.field), S = Sn(o.relations, n, $.field);
2242
2242
  if (!(q != null && q.one_collection) && !S) return null;
2243
2243
  const L = d.has($.field);
2244
2244
  return /* @__PURE__ */ c("div", { children: [
@@ -2260,7 +2260,7 @@ function ju({
2260
2260
  }
2261
2261
  ),
2262
2262
  L && (q == null ? void 0 : q.one_collection) && /* @__PURE__ */ a(
2263
- Mr,
2263
+ Pr,
2264
2264
  {
2265
2265
  relatedCollection: q.one_collection,
2266
2266
  depth: 1,
@@ -2287,11 +2287,11 @@ function ju({
2287
2287
  }
2288
2288
  function Bu({
2289
2289
  collection: n,
2290
- ids: i,
2290
+ ids: o,
2291
2291
  onDone: h,
2292
2292
  onCancel: d
2293
2293
  }) {
2294
- const w = St(), [N, $] = _(i[0]), [q, S] = _(!1), [L, K] = _(null), [V, I] = _(null), u = i.find((F) => String(F) !== String(N));
2294
+ const w = St(), [N, $] = _(o[0]), [q, S] = _(!1), [L, K] = _(null), [V, I] = _(null), u = o.find((F) => String(F) !== String(N));
2295
2295
  pe(() => {
2296
2296
  I(null);
2297
2297
  let F = !0;
@@ -2329,7 +2329,7 @@ function Bu({
2329
2329
  };
2330
2330
  return /* @__PURE__ */ c("span", { className: "flex flex-wrap items-center gap-2", children: [
2331
2331
  /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300 dark:text-muted-foreground", children: "Keep" }),
2332
- i.map((F) => /* @__PURE__ */ a(
2332
+ o.map((F) => /* @__PURE__ */ a(
2333
2333
  "button",
2334
2334
  {
2335
2335
  type: "button",
@@ -2367,7 +2367,7 @@ function Bu({
2367
2367
  }
2368
2368
  function Uu({
2369
2369
  collection: n,
2370
- selectedIds: i,
2370
+ selectedIds: o,
2371
2371
  transitions: h,
2372
2372
  states: d = [],
2373
2373
  fields: w,
@@ -2376,7 +2376,7 @@ function Uu({
2376
2376
  onClear: q,
2377
2377
  onSuccess: S
2378
2378
  }) {
2379
- const L = $a(), K = St(), V = Fa(), I = Hl(), [u, y] = _("actions"), Q = pc([n], $), { data: F = [] } = ne({
2379
+ const L = $a(), K = St(), V = Fa(), I = Vl(), [u, y] = _("actions"), Q = pc([n], $), { data: F = [] } = ne({
2380
2380
  queryKey: ["bulk-recipes", n],
2381
2381
  queryFn: () => K.request(J("/bulk-recipes", { collection: n })).then((f) => f.data ?? []).catch(() => []),
2382
2382
  staleTime: 6e4
@@ -2401,7 +2401,7 @@ function Uu({
2401
2401
  mt(async (ae) => {
2402
2402
  const qe = await K.request(
2403
2403
  he(`/items/${n}/bulk-update?progress=${ae}`, {
2404
- ids: i,
2404
+ ids: o,
2405
2405
  data: { [String(oe.field)]: oe.value ?? "" }
2406
2406
  })
2407
2407
  );
@@ -2418,7 +2418,7 @@ function Uu({
2418
2418
  mt(async (ae) => {
2419
2419
  const qe = await K.request(
2420
2420
  he(`/items/${n}/bulk-transition?progress=${ae}`, {
2421
- ids: i,
2421
+ ids: o,
2422
2422
  transition_ids: h.filter((ht) => {
2423
2423
  var It;
2424
2424
  return ht.label === ((It = f.config) == null ? void 0 : It.transition_label);
@@ -2446,11 +2446,11 @@ function Uu({
2446
2446
  }, [h]), Se = Be.find((f) => f.label === me) ?? null, [X, $e] = _(""), it = (f) => d.find((H) => String(H.id).toUpperCase() === f.toUpperCase()), at = Se ? [...Se.targets.keys()].filter(Boolean).sort((f, H) => {
2447
2447
  var te, oe;
2448
2448
  return Number(((te = it(f)) == null ? void 0 : te.sort) ?? 0) - Number(((oe = it(H)) == null ? void 0 : oe.sort) ?? 0);
2449
- }) : [], Ie = at.length > 1, Pe = Se ? Ie ? X ? Se.targets.get(X) ?? [] : [] : Se.ids : [], We = Pe.length ? `${Pe.join(",")}|${i.join(",")}` : "", { data: k, isFetching: le } = ne({
2449
+ }) : [], Ie = at.length > 1, Pe = Se ? Ie ? X ? Se.targets.get(X) ?? [] : [] : Se.ids : [], We = Pe.length ? `${Pe.join(",")}|${o.join(",")}` : "", { data: k, isFetching: le } = ne({
2450
2450
  queryKey: ["bulk-transition-preview", n, We],
2451
2451
  queryFn: () => K.request(
2452
2452
  he(`/items/${n}/bulk-transition?dry_run=1`, {
2453
- ids: i,
2453
+ ids: o,
2454
2454
  transition_ids: Pe,
2455
2455
  comment: "(preview)"
2456
2456
  })
@@ -2461,7 +2461,7 @@ function Uu({
2461
2461
  }), [ee, xe] = _(!1), [rt, Xe] = _(null), mt = async (f) => {
2462
2462
  xe(!0), Xe(null);
2463
2463
  const H = Oi();
2464
- Ai(H, i);
2464
+ Ai(H, o);
2465
2465
  try {
2466
2466
  const te = await f(H);
2467
2467
  Xe(te), S(), q(), y("actions");
@@ -2473,7 +2473,7 @@ function Uu({
2473
2473
  }, Lt = (f, H) => void mt(async (te) => {
2474
2474
  const oe = await K.request(
2475
2475
  he(`/items/${n}/bulk-update?progress=${te}`, {
2476
- ids: i,
2476
+ ids: o,
2477
2477
  data: { [f]: H ?? null },
2478
2478
  by_form: !0
2479
2479
  })
@@ -2501,9 +2501,9 @@ function Uu({
2501
2501
  }
2502
2502
  ),
2503
2503
  /* @__PURE__ */ c("span", { className: "text-[13px] font-medium text-nvr-cyan dark:text-nvr-cyan", children: [
2504
- i.length,
2504
+ o.length,
2505
2505
  " item",
2506
- i.length === 1 ? "" : "s",
2506
+ o.length === 1 ? "" : "s",
2507
2507
  " selected"
2508
2508
  ] }),
2509
2509
  rt && /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300 dark:text-muted-foreground", children: rt }),
@@ -2544,15 +2544,15 @@ function Uu({
2544
2544
  )
2545
2545
  ] }, f.id);
2546
2546
  }),
2547
- i.length >= 2 && /* @__PURE__ */ a(
2547
+ o.length >= 2 && /* @__PURE__ */ a(
2548
2548
  "button",
2549
2549
  {
2550
2550
  type: "button",
2551
2551
  onClick: () => {
2552
2552
  const f = Rd(
2553
- i.map((H) => I.urlFor({ collection: n, itemId: String(H) }))
2553
+ o.map((H) => I.urlFor({ collection: n, itemId: String(H) }))
2554
2554
  );
2555
- f.blocked > 0 || f.capped > 0 ? ge.warning(ql(f)) : ge.success(ql(f));
2555
+ f.blocked > 0 || f.capped > 0 ? ge.warning($l(f)) : ge.success($l(f));
2556
2556
  },
2557
2557
  "data-bulk-open-tabs": !0,
2558
2558
  title: `Open the selected records in new tabs (up to ${Fd})`,
@@ -2563,14 +2563,14 @@ function Uu({
2563
2563
  Q("compare") && /* @__PURE__ */ a(
2564
2564
  fc,
2565
2565
  {
2566
- targets: i.map((f) => ({ collection: n, id: f })),
2566
+ targets: o.map((f) => ({ collection: n, id: f })),
2567
2567
  fields: w,
2568
2568
  relations: N,
2569
2569
  renderValue: (f, H, te, oe) => Qu(n, f, H, te, oe),
2570
2570
  className: "h-8 rounded-md border border-white/20 dark:border-border px-3 text-[12.5px] font-medium hover:bg-white/10 dark:hover:bg-muted"
2571
2571
  }
2572
2572
  ),
2573
- Q("merge") && i.length === 2 && L.isAdmin && /* @__PURE__ */ a(
2573
+ Q("merge") && o.length === 2 && L.isAdmin && /* @__PURE__ */ a(
2574
2574
  "button",
2575
2575
  {
2576
2576
  type: "button",
@@ -2583,7 +2583,7 @@ function Uu({
2583
2583
  /* @__PURE__ */ a(
2584
2584
  mc,
2585
2585
  {
2586
- targets: i.map((f) => ({ collection: n, id: f })),
2586
+ targets: o.map((f) => ({ collection: n, id: f })),
2587
2587
  enabledKeys: $,
2588
2588
  tone: "dark",
2589
2589
  disabled: ee,
@@ -2596,7 +2596,7 @@ function Uu({
2596
2596
  bc,
2597
2597
  {
2598
2598
  collection: n,
2599
- selectedIds: i,
2599
+ selectedIds: o,
2600
2600
  disabled: ee,
2601
2601
  onApply: Lt,
2602
2602
  onSaveRecipe: (f, H) => {
@@ -2637,7 +2637,7 @@ function Uu({
2637
2637
  Bu,
2638
2638
  {
2639
2639
  collection: n,
2640
- ids: i.slice(0, 2),
2640
+ ids: o.slice(0, 2),
2641
2641
  onDone: (f) => {
2642
2642
  Xe(f), S(), q(), y("actions");
2643
2643
  },
@@ -2648,7 +2648,7 @@ function Uu({
2648
2648
  gc,
2649
2649
  {
2650
2650
  collection: n,
2651
- selectedIds: i,
2651
+ selectedIds: o,
2652
2652
  onDone: (f) => {
2653
2653
  Xe(f), y("actions");
2654
2654
  },
@@ -2665,7 +2665,7 @@ function Uu({
2665
2665
  mt(async (te) => {
2666
2666
  const oe = await K.request(
2667
2667
  he(`/items/${n}/bulk-transition?progress=${te}`, {
2668
- ids: i,
2668
+ ids: o,
2669
2669
  transition_ids: Pe,
2670
2670
  ...H ? { comment: H } : {}
2671
2671
  })
@@ -2675,7 +2675,7 @@ function Uu({
2675
2675
  },
2676
2676
  children: [
2677
2677
  /* @__PURE__ */ a(
2678
- Il,
2678
+ Al,
2679
2679
  {
2680
2680
  value: me,
2681
2681
  onChange: (f) => {
@@ -2690,7 +2690,7 @@ function Uu({
2690
2690
  }
2691
2691
  ),
2692
2692
  Se && Ie && /* @__PURE__ */ a(
2693
- Il,
2693
+ Al,
2694
2694
  {
2695
2695
  value: X,
2696
2696
  onChange: $e,
@@ -2819,9 +2819,9 @@ function Uu({
2819
2819
  u === "confirm-delete" && /* @__PURE__ */ c("span", { className: "flex items-center gap-2", children: [
2820
2820
  /* @__PURE__ */ c("span", { className: "text-[12.5px] text-slate-300 dark:text-muted-foreground", children: [
2821
2821
  "Delete ",
2822
- i.length,
2822
+ o.length,
2823
2823
  " item",
2824
- i.length === 1 ? "" : "s",
2824
+ o.length === 1 ? "" : "s",
2825
2825
  "? Deleted records move to Trash for 30 days."
2826
2826
  ] }),
2827
2827
  /* @__PURE__ */ a(
@@ -2830,7 +2830,7 @@ function Uu({
2830
2830
  type: "button",
2831
2831
  disabled: ee,
2832
2832
  onClick: () => void mt(async (f) => `Deleted ${(await K.request(
2833
- he(`/items/${n}/bulk-delete?progress=${f}`, { ids: i })
2833
+ he(`/items/${n}/bulk-delete?progress=${f}`, { ids: o })
2834
2834
  )).deleted} items`),
2835
2835
  className: "h-8 rounded-md bg-red-600 px-3 text-[12.5px] font-medium hover:bg-red-700 disabled:opacity-50",
2836
2836
  children: ee ? "Deleting…" : "Delete"
@@ -2864,7 +2864,7 @@ const zu = {
2864
2864
  };
2865
2865
  function D0({
2866
2866
  collection: n,
2867
- quickFilters: i = [],
2867
+ quickFilters: o = [],
2868
2868
  initialColumns: h,
2869
2869
  initialSort: d,
2870
2870
  pageSize: w = 25,
@@ -2877,23 +2877,23 @@ function D0({
2877
2877
  showCreate: V = !0,
2878
2878
  className: I
2879
2879
  }) {
2880
- var al, rl, sl, ll, ol, il, dl, cl, ul, pl, ml;
2881
- const u = St(), y = Fa(), { open: Q, urlFor: F } = Hl(), [m] = _(
2880
+ var nl, al, rl, sl, ll, ol, il, dl, cl, ul, pl;
2881
+ const u = St(), y = Fa(), { open: Q, urlFor: F } = Vl(), [m] = _(
2882
2882
  () => bd(hd(`cbv:${n}`))
2883
2883
  ), [E] = _(
2884
- () => m ? Fl(m.f ?? []) : null
2884
+ () => m ? Ll(m.f ?? []) : null
2885
2885
  ), [P] = _(
2886
2886
  () => m ? null : xd(`cbv:${n}`)
2887
2887
  ), [M, T] = _((m == null ? void 0 : m.p) ?? P ?? 1), de = fe(P);
2888
2888
  pe(() => {
2889
- const e = $l(de.current, M);
2889
+ const e = Cl(de.current, M);
2890
2890
  if (e !== M) {
2891
2891
  T(e);
2892
2892
  return;
2893
2893
  }
2894
2894
  vd(`cbv:${n}`, M);
2895
2895
  }, [n, M]);
2896
- const me = fe(sd()), [we, Ae] = _(m ? m.q ?? "" : N), G = _l(we.trim(), 350), [Be, Se] = _(
2896
+ const me = fe(sd()), [we, Ae] = _(m ? m.q ?? "" : N), G = wl(we.trim(), 350), [Be, Se] = _(
2897
2897
  E ? E.filters : $ ?? []
2898
2898
  ), [X, $e] = _(m ? m.s ?? "" : d ?? ""), [it, at] = _(h ?? null), [Ie, Pe] = _({}), [We, k] = _({}), [le, ee] = _(null), [xe, rt] = _({}), [Xe, mt] = _({}), [Lt, f] = _({}), [H, te] = _({}), [oe, ae] = _(null), [qe, ht] = _(!1), It = fe(null), [Cn, st] = _(
2899
2899
  () => (m == null ? void 0 : m.qf) ?? {}
@@ -2946,11 +2946,11 @@ function D0({
2946
2946
  }
2947
2947
  }), to = () => {
2948
2948
  nn(null), Ke("");
2949
- }, Or = fe(!1);
2949
+ }, Mr = fe(!1);
2950
2950
  pe(() => {
2951
- !L || Or.current || (Or.current = !0, Z(!0), Ke(L), Wt.mutate(L));
2951
+ !L || Mr.current || (Mr.current = !0, Z(!0), Ke(L), Wt.mutate(L));
2952
2952
  }, [L]);
2953
- const [ie, Vt] = _(null), [En, Ar] = _(() => (m == null ? void 0 : m.ex) ?? []);
2953
+ const [ie, Vt] = _(null), [En, Or] = _(() => (m == null ? void 0 : m.ex) ?? []);
2954
2954
  pe(() => {
2955
2955
  if (!ie) return;
2956
2956
  const e = () => Vt(null);
@@ -2960,23 +2960,23 @@ function D0({
2960
2960
  }, [ie]);
2961
2961
  const [an, rn] = _([]);
2962
2962
  Mi();
2963
- const [Ht, Dn] = _(null), [no, Ea] = _(!1), [sn, Da] = _(""), [Pa, Ir] = _(!1), [ao, Kr] = _(!1), [Ma, fn] = _(!1), jr = fe(null);
2963
+ const [Ht, Dn] = _(null), [no, Ea] = _(!1), [sn, Da] = _(""), [Pa, Ar] = _(!1), [ao, Ir] = _(!1), [Ma, fn] = _(!1), Kr = fe(null);
2964
2964
  pe(() => {
2965
2965
  if (!Ma) return;
2966
2966
  const e = (t) => {
2967
2967
  var r;
2968
- (r = jr.current) != null && r.contains(t.target) || fn(!1);
2968
+ (r = Kr.current) != null && r.contains(t.target) || fn(!1);
2969
2969
  };
2970
2970
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
2971
2971
  }, [Ma]);
2972
- const Br = fe(null), Ur = fe(null), zr = !m && ((q == null ? void 0 : q.length) ?? 0) > 0, Oa = fe(!!m || zr), { isAdmin: Ct } = $a(), Qr = fe(n);
2972
+ const jr = fe(null), Br = fe(null), Ur = !m && ((q == null ? void 0 : q.length) ?? 0) > 0, Oa = fe(!!m || Ur), { isAdmin: Ct } = $a(), zr = fe(n);
2973
2973
  pe(() => {
2974
- Qr.current !== n && (Qr.current = n, T(1), Ae(N), Se([]), $e(d ?? ""), at(h ?? null), Pe({}), k({}), rt({}), mt({}), rn([]), Dn(null), st({}), Kt({}), Qt({}), dn([]), lt != null && lt.length && xt.back(lt.length), cn(null), Oa.current = !1);
2974
+ zr.current !== n && (zr.current = n, T(1), Ae(N), Se([]), $e(d ?? ""), at(h ?? null), Pe({}), k({}), rt({}), mt({}), rn([]), Dn(null), st({}), Kt({}), Qt({}), dn([]), lt != null && lt.length && xt.back(lt.length), cn(null), Oa.current = !1);
2975
2975
  }, [n]), pe(() => {
2976
2976
  if (!un) return;
2977
2977
  const e = (t) => {
2978
2978
  var r;
2979
- (r = Br.current) != null && r.contains(t.target) || en(!1);
2979
+ (r = jr.current) != null && r.contains(t.target) || en(!1);
2980
2980
  };
2981
2981
  return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
2982
2982
  }, [un]), pe(() => {
@@ -2992,34 +2992,34 @@ function D0({
2992
2992
  queryFn: () => u.request(J(`/collections/${n}`)).then((e) => e.data),
2993
2993
  staleTime: 10 * 6e4,
2994
2994
  retry: !1
2995
- }), Et = be(() => ((A == null ? void 0 : A.fields) ?? []).filter((e) => !e.hidden), [A]), De = (A == null ? void 0 : A.browser_config) ?? {}, Fe = (al = De.fulfilment) != null && al.shipped_field && ((rl = De.fulfilment) != null && rl.requested_field) ? De.fulfilment : null, Wr = fe(!!m);
2995
+ }), Et = be(() => ((A == null ? void 0 : A.fields) ?? []).filter((e) => !e.hidden), [A]), De = (A == null ? void 0 : A.browser_config) ?? {}, Fe = (nl = De.fulfilment) != null && nl.shipped_field && ((al = De.fulfilment) != null && al.requested_field) ? De.fulfilment : null, Qr = fe(!!m);
2996
2996
  pe(() => {
2997
- Wr.current || !A || (Wr.current = !0, !d && !X && De.default_sort && $e(De.default_sort));
2997
+ Qr.current || !A || (Qr.current = !0, !d && !X && De.default_sort && $e(De.default_sort));
2998
2998
  }, [A]);
2999
- const Dt = De.checkbox_selection !== !1, Vr = De.show_actions !== !1, [vt, ro] = _(!1), so = () => {
2999
+ const Dt = De.checkbox_selection !== !1, Wr = De.show_actions !== !1, [vt, ro] = _(!1), so = () => {
3000
3000
  vt && rn([]), ro(!vt);
3001
- }, ta = V && De.allow_create !== !1, Hr = typeof De.create_label == "string" && De.create_label.trim().slice(0, 40) || "New item", na = tc(ta && !(A != null && A.singleton) ? n : null), [Aa, Pn] = _(!1), [Ia, aa] = _(null), { steps: Ka } = tu(
3001
+ }, ta = V && De.allow_create !== !1, Vr = typeof De.create_label == "string" && De.create_label.trim().slice(0, 40) || "New item", na = tc(ta && !(A != null && A.singleton) ? n : null), [Aa, Pn] = _(!1), [Ia, aa] = _(null), { steps: Ka } = tu(
3002
3002
  ta && !(A != null && A.singleton) ? n : null,
3003
3003
  null
3004
- ), Yr = (e) => {
3004
+ ), Hr = (e) => {
3005
3005
  e ? Q({ collection: n, itemId: "new", layoutSlug: e }) : on("new");
3006
- }, Mn = Xc(ta && !(A != null && A.singleton) ? n : null), lo = Ri(), Jr = fe(null), [oo, io] = _(null), [Gr, Xr] = _(!1), Zr = (e) => {
3006
+ }, Mn = Xc(ta && !(A != null && A.singleton) ? n : null), lo = Ri(), Yr = fe(null), [oo, io] = _(null), [Jr, Gr] = _(!1), Xr = (e) => {
3007
3007
  var t;
3008
- io(e), (t = Jr.current) == null || t.click();
3008
+ io(e), (t = Yr.current) == null || t.click();
3009
3009
  }, co = async (e) => {
3010
3010
  const t = Array.from(e.target.files ?? []);
3011
3011
  if (e.target.value = "", !!t.length) {
3012
- Xr(!0);
3012
+ Gr(!0);
3013
3013
  try {
3014
3014
  const r = await Zc(lo, t, n);
3015
3015
  Q({ collection: n, itemId: "new", layoutSlug: oo, query: { autofill: r } });
3016
3016
  } catch (r) {
3017
- Nl(r, "The document could not be read", { action: "New from document" });
3017
+ _l(r, "The document could not be read", { action: "New from document" });
3018
3018
  } finally {
3019
- Xr(!1);
3019
+ Gr(!1);
3020
3020
  }
3021
3021
  }
3022
- }, uo = (e) => Array.isArray(e == null ? void 0 : e.quick_picker) ? e.quick_picker.filter((t) => typeof t == "string") : [], ja = fe(null), es = fe(null);
3022
+ }, uo = (e) => Array.isArray(e == null ? void 0 : e.quick_picker) ? e.quick_picker.filter((t) => typeof t == "string") : [], ja = fe(null), Zr = fe(null);
3023
3023
  pe(() => {
3024
3024
  if (!Aa) return;
3025
3025
  const e = (t) => {
@@ -3028,22 +3028,22 @@ function D0({
3028
3028
  };
3029
3029
  return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
3030
3030
  }, [Aa]);
3031
- const He = m != null && m.ps ? m.ps : De.page_size && De.page_size > 0 ? Math.min(De.page_size, 200) : w, Pt = i.length > 0 ? i : De.quick_filters ?? [];
3031
+ const He = m != null && m.ps ? m.ps : De.page_size && De.page_size > 0 ? Math.min(De.page_size, 200) : w, Pt = o.length > 0 ? o : De.quick_filters ?? [];
3032
3032
  pe(() => {
3033
- if (Je || !$n || i.length === 0 && !A) return;
3033
+ if (Je || !$n || o.length === 0 && !A) return;
3034
3034
  const e = Rt, t = Object.values((e == null ? void 0 : e.defaults) ?? {}).some((r) => r.length > 0) || Object.values((e == null ? void 0 : e.restricted) ?? {}).some((r) => r.length > 0);
3035
- if (!e || Pt.length === 0 || !t || m || zr) {
3035
+ if (!e || Pt.length === 0 || !t || m || Ur) {
3036
3036
  jt(!0);
3037
3037
  return;
3038
3038
  }
3039
3039
  (async () => {
3040
3040
  const r = {};
3041
3041
  for (const s of Pt) {
3042
- const l = Ll(e, { key: s.key, collection: s.collection });
3042
+ const l = Tl(e, { key: s.key, collection: s.collection });
3043
3043
  if (!l) continue;
3044
- const o = Zd(e, l.name);
3045
- if (o.length === 0) continue;
3046
- const b = await ec(u, l, o, s.value_field).catch(
3044
+ const i = Zd(e, l.name);
3045
+ if (i.length === 0) continue;
3046
+ const b = await ec(u, l, i, s.value_field).catch(
3047
3047
  () => []
3048
3048
  );
3049
3049
  b.length > 0 && (r[s.key] = b);
@@ -3051,59 +3051,59 @@ function D0({
3051
3051
  if (Object.keys(r).length > 0) {
3052
3052
  const s = (l) => {
3053
3053
  var b;
3054
- const o = { ...l };
3054
+ const i = { ...l };
3055
3055
  for (const [x, v] of Object.entries(r))
3056
- (((b = o[x]) == null ? void 0 : b.length) ?? 0) > 0 || (o[x] = v);
3057
- return o;
3056
+ (((b = i[x]) == null ? void 0 : b.length) ?? 0) > 0 || (i[x] = v);
3057
+ return i;
3058
3058
  };
3059
3059
  st(s), Kt(s), Gn(new Set(Object.keys(r)));
3060
3060
  }
3061
3061
  jt(!0);
3062
3062
  })();
3063
3063
  }, [Je, $n, Rt, A, Pt]);
3064
- const ts = (e) => {
3065
- const t = Ll(Rt, { key: e.key, collection: e.collection }), r = t ? (Rt == null ? void 0 : Rt.restricted[t.name]) ?? [] : [];
3064
+ const es = (e) => {
3065
+ const t = Tl(Rt, { key: e.key, collection: e.collection }), r = t ? (Rt == null ? void 0 : Rt.restricted[t.name]) ?? [] : [];
3066
3066
  return r.length > 0 ? r : void 0;
3067
- }, kt = be(() => new Map(Et.map((e) => [e.field, e])), [Et]), Ge = (A == null ? void 0 : A.relations) ?? [], ns = be(() => cd(De.inline_edit), [De.inline_edit]), { data: po } = ne({
3067
+ }, kt = be(() => new Map(Et.map((e) => [e.field, e])), [Et]), Ge = (A == null ? void 0 : A.relations) ?? [], ts = be(() => cd(De.inline_edit), [De.inline_edit]), { data: po } = ne({
3068
3068
  queryKey: ["my-permissions"],
3069
3069
  queryFn: () => u.request(J("/security/my/permissions")).then((e) => e.data),
3070
- enabled: ns.enabled && !Ct,
3070
+ enabled: ts.enabled && !Ct,
3071
3071
  staleTime: 5 * 6e4
3072
- }), mo = Ct || $u(po, n), as = be(
3072
+ }), mo = Ct || $u(po, n), ns = be(
3073
3073
  () => new Map(((A == null ? void 0 : A.fields) ?? []).map((e) => [e.field, e])),
3074
3074
  [A]
3075
- ), rs = ou(), ss = (e) => (
3075
+ ), as = ou(), rs = (e) => (
3076
3076
  // Ask-the-table answers are a one-off overlay, not the list's own rows.
3077
3077
  re ? null : md({
3078
- config: ns,
3078
+ config: ts,
3079
3079
  key: e,
3080
- field: as.get(e),
3080
+ field: ns.get(e),
3081
3081
  collection: n,
3082
3082
  relations: Ge,
3083
3083
  mayUpdate: mo
3084
3084
  })
3085
3085
  ), fo = (e, t, r, s, l) => {
3086
- const o = e.id, b = l === 0 ? null : fd(
3087
- ve.filter((x) => !!ss(x)),
3086
+ const i = e.id, b = l === 0 ? null : fd(
3087
+ ve.filter((x) => !!rs(x)),
3088
3088
  t,
3089
3089
  l
3090
3090
  );
3091
- rs.commit({
3092
- cellKey: `${String(o)}|${t}`,
3091
+ as.commit({
3092
+ cellKey: `${String(i)}|${t}`,
3093
3093
  collection: n,
3094
- id: o,
3094
+ id: i,
3095
3095
  field: t,
3096
3096
  kind: r,
3097
3097
  before: e[t],
3098
3098
  value: s,
3099
- next: b ? `${String(o)}|${b}` : null,
3099
+ next: b ? `${String(i)}|${b}` : null,
3100
3100
  optimistic: () => {
3101
3101
  const x = y.getQueriesData({ queryKey: ["cbv-items", n] });
3102
3102
  return y.setQueriesData({ queryKey: ["cbv-items", n] }, (v) => {
3103
3103
  const U = v;
3104
3104
  return U != null && U.data ? {
3105
3105
  ...U,
3106
- data: U.data.map((j) => String(j.id) === String(o) ? { ...j, [t]: s } : j)
3106
+ data: U.data.map((j) => String(j.id) === String(i) ? { ...j, [t]: s } : j)
3107
3107
  } : v;
3108
3108
  }), () => {
3109
3109
  for (const [v, U] of x) y.setQueryData(v, U);
@@ -3113,18 +3113,18 @@ function D0({
3113
3113
  onSaved: () => void y.invalidateQueries({ queryKey: ["cbv-items", n] })
3114
3114
  });
3115
3115
  }, bo = (e, t, r, s) => {
3116
- const l = r ? null : ss(t);
3116
+ const l = r ? null : rs(t);
3117
3117
  if (!l) return s;
3118
- const o = as.get(t);
3118
+ const i = ns.get(t);
3119
3119
  return /* @__PURE__ */ a(
3120
3120
  iu,
3121
3121
  {
3122
- controller: rs,
3122
+ controller: as,
3123
3123
  cellKey: `${String(e.id)}|${t}`,
3124
3124
  kind: l,
3125
3125
  value: e[t],
3126
3126
  label: Ze(t),
3127
- choices: o ? pd(o) : void 0,
3127
+ choices: i ? pd(i) : void 0,
3128
3128
  target: l === "m2o" ? ud(Ge, n, t) : null,
3129
3129
  onCommit: (b, x) => fo(e, t, l, b, x),
3130
3130
  children: s
@@ -3138,19 +3138,19 @@ function D0({
3138
3138
  ), $t = (e) => On[e], ho = (e) => {
3139
3139
  const t = { ...On }, r = t[e];
3140
3140
  r ? r === "left" ? t[e] = "right" : delete t[e] : t[e] = "left", ra(t);
3141
- }, Ze = (e) => Ie[e] ?? (e.startsWith("__f:") ? We[e] ?? "Formula" : e.includes(".") ? e.split(".").map(je).join(" › ") : e === "id" ? "ID" : je(e)), ls = (e, t) => {
3142
- var s, l, o;
3143
- const r = t.includes(".") ? (o = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(e.id)]) == null ? void 0 : l[t]) == null ? void 0 : o.value : e[t];
3141
+ }, Ze = (e) => Ie[e] ?? (e.startsWith("__f:") ? We[e] ?? "Formula" : e.includes(".") ? e.split(".").map(je).join(" › ") : e === "id" ? "ID" : je(e)), ss = (e, t) => {
3142
+ var s, l, i;
3143
+ const r = t.includes(".") ? (i = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(e.id)]) == null ? void 0 : l[t]) == null ? void 0 : i.value : e[t];
3144
3144
  return typeof r == "string" && /^-?\d+(\.\d+)?$/.test(r.trim()) ? Number(r) : r;
3145
3145
  }, go = (e, t) => {
3146
3146
  const r = We[t];
3147
- return r ? Sl(r, (s) => ls(e, s)) : null;
3147
+ return r ? Nl(r, (s) => ss(e, s)) : null;
3148
3148
  }, xo = (e, t) => {
3149
3149
  const r = We[t];
3150
3150
  if (r)
3151
3151
  return r.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (s, l) => {
3152
- const o = ls(e, l);
3153
- return o == null || o === "" ? "—" : String(o);
3152
+ const i = ss(e, l);
3153
+ return i == null || i === "" ? "—" : String(i);
3154
3154
  });
3155
3155
  }, Yt = be(
3156
3156
  () => ve.filter((e) => !e.includes(".")).map((e) => ({ field: e, info: Sn(Ge, n, e) })).filter(
@@ -3162,7 +3162,7 @@ function D0({
3162
3162
  ...new Set(Yt.map((e) => e.info.relation.many_collection ?? "").filter(Boolean))
3163
3163
  ],
3164
3164
  [Yt]
3165
- ), os = _a({
3165
+ ), ls = _a({
3166
3166
  queries: Ua.map((e) => ({
3167
3167
  queryKey: ["cbv-collection-meta", e],
3168
3168
  queryFn: () => u.request(J(`/collections/${e}`)).then((t) => t.data),
@@ -3173,9 +3173,9 @@ function D0({
3173
3173
  const e = /* @__PURE__ */ new Map();
3174
3174
  return Ua.forEach((t, r) => {
3175
3175
  var s;
3176
- return e.set(t, (s = os[r]) == null ? void 0 : s.data);
3176
+ return e.set(t, (s = ls[r]) == null ? void 0 : s.data);
3177
3177
  }), e;
3178
- }, [Ua, os]), za = be(
3178
+ }, [Ua, ls]), za = be(
3179
3179
  () => [
3180
3180
  ...new Set(
3181
3181
  Yt.filter((e) => e.info.kind === "m2m").map((e) => {
@@ -3187,20 +3187,20 @@ function D0({
3187
3187
  )
3188
3188
  ],
3189
3189
  [Yt, ln]
3190
- ), is = _a({
3190
+ ), os = _a({
3191
3191
  queries: za.map((e) => ({
3192
3192
  queryKey: ["cbv-collection-meta", e],
3193
3193
  queryFn: () => u.request(J(`/collections/${e}`)).then((t) => t.data),
3194
3194
  staleTime: 10 * 6e4,
3195
3195
  retry: !1
3196
3196
  }))
3197
- }), ds = be(() => {
3197
+ }), is = be(() => {
3198
3198
  const e = /* @__PURE__ */ new Map();
3199
3199
  return za.forEach((t, r) => {
3200
3200
  var s;
3201
- return e.set(t, (s = is[r]) == null ? void 0 : s.data);
3201
+ return e.set(t, (s = os[r]) == null ? void 0 : s.data);
3202
3202
  }), e;
3203
- }, [za, is]), Ye = be(() => {
3203
+ }, [za, os]), Ye = be(() => {
3204
3204
  const e = {};
3205
3205
  for (const t of Yt) {
3206
3206
  const r = t.info.relation.many_collection ?? "";
@@ -3209,26 +3209,26 @@ function D0({
3209
3209
  else {
3210
3210
  const s = ln.get(r), l = s == null ? void 0 : s.relations.find(
3211
3211
  (b) => b.many_collection === r && b.many_field === t.info.relation.junction_field
3212
- ), o = (l == null ? void 0 : l.one_collection) ?? "";
3213
- e[t.field] = `${t.field}.${Yn(o ? ds.get(o) : void 0)}`;
3212
+ ), i = (l == null ? void 0 : l.one_collection) ?? "";
3213
+ e[t.field] = `${t.field}.${Yn(i ? is.get(i) : void 0)}`;
3214
3214
  }
3215
3215
  }
3216
3216
  return e;
3217
- }, [Yt, ln, ds]), cs = be(() => {
3217
+ }, [Yt, ln, is]), ds = be(() => {
3218
3218
  const e = {};
3219
3219
  for (const t of Yt)
3220
3220
  if (t.info.kind === "o2m")
3221
3221
  e[t.field] = { kind: "o2m" };
3222
3222
  else {
3223
3223
  const r = t.info.relation.many_collection ?? "", s = ln.get(r), l = s == null ? void 0 : s.relations.find(
3224
- (o) => o.many_collection === r && o.many_field === t.info.relation.junction_field
3224
+ (i) => i.many_collection === r && i.many_field === t.info.relation.junction_field
3225
3225
  );
3226
3226
  l != null && l.one_collection && (e[t.field] = { kind: "m2m", target: l.one_collection });
3227
3227
  }
3228
3228
  return e;
3229
- }, [Yt, ln]), Qa = _l(Ve, 350), [bn, vo] = _((m == null ? void 0 : m.a) === !0), [us, ko] = _(null), An = Rc(n, us), [qt, ps] = _(null), { data: In } = wc(n), [Mt, sa] = _(() => (E == null ? void 0 : E.riskIds) ?? []), _e = be(() => {
3229
+ }, [Yt, ln]), Qa = wl(Ve, 350), [bn, vo] = _((m == null ? void 0 : m.a) === !0), [cs, ko] = _(null), An = Rc(n, cs), [qt, us] = _(null), { data: In } = wc(n), [Mt, sa] = _(() => (E == null ? void 0 : E.riskIds) ?? []), _e = be(() => {
3230
3230
  var t;
3231
- const e = Ul(Be);
3231
+ const e = Bl(Be);
3232
3232
  for (const r of Pt) {
3233
3233
  const s = gt[r.key] ?? [];
3234
3234
  s.length !== 0 && ((t = r.or_paths) != null && t.length ? e.push({
@@ -3241,13 +3241,13 @@ function D0({
3241
3241
  else if (s.kind === "state" && s.value.length)
3242
3242
  e.push({ path: ["$state"], op: "_in", value: s.value });
3243
3243
  else if (s.kind === "fulfilment" && Fe) {
3244
- const l = Fe.shipped_field, o = Fe.remaining_field ?? null;
3244
+ const l = Fe.shipped_field, i = Fe.remaining_field ?? null;
3245
3245
  s.value === "none" ? e.push({
3246
3246
  or: [
3247
3247
  { path: [l], op: "_null", value: !0 },
3248
3248
  { path: [l], op: "_lte", value: 0 }
3249
3249
  ]
3250
- }) : s.value === "partial" ? (e.push({ path: [l], op: "_gt", value: 0 }), o && e.push({ path: [o], op: "_gt", value: 0 })) : s.value === "complete" && (e.push({ path: [l], op: "_gt", value: 0 }), o && e.push({ path: [o], op: "_lte", value: 0 }));
3250
+ }) : s.value === "partial" ? (e.push({ path: [l], op: "_gt", value: 0 }), i && e.push({ path: [i], op: "_gt", value: 0 })) : s.value === "complete" && (e.push({ path: [l], op: "_gt", value: 0 }), i && e.push({ path: [i], op: "_lte", value: 0 }));
3251
3251
  } else if (s.kind === "integrations")
3252
3252
  e.push({ path: ["$integrations"], op: "_eq", value: s.value });
3253
3253
  else if (s.kind === "tasks")
@@ -3257,8 +3257,8 @@ function D0({
3257
3257
  value: s.value === "none" ? !1 : s.value === "overdue" ? "overdue" : !0
3258
3258
  });
3259
3259
  else if (s.kind === "aging" && s.value.replace(":", "") !== "") {
3260
- const [l, o] = s.value.split(":");
3261
- e.push({ path: ["$aging"], op: "_between", value: `${l ?? ""}..${o ?? ""}` });
3260
+ const [l, i] = s.value.split(":");
3261
+ e.push({ path: ["$aging"], op: "_between", value: `${l ?? ""}..${i ?? ""}` });
3262
3262
  } else if (s.kind === "text" && s.value.trim())
3263
3263
  e.push({ path: s.path, op: "_contains", value: s.value.trim() });
3264
3264
  else if (s.kind === "num" && s.value !== "" && !Number.isNaN(Number(s.value)))
@@ -3295,11 +3295,11 @@ function D0({
3295
3295
  if (!t || !r) return null;
3296
3296
  const s = e.find((l) => ["name", "title", "label", "short_name"].includes(l.toLowerCase())) ?? null;
3297
3297
  return { latField: t, lngField: r, labelField: s };
3298
- }, [A]), [la, ms] = _(!1), [fs, yo] = _(!1), bs = fe(_e);
3298
+ }, [A]), [la, ps] = _(!1), [ms, yo] = _(!1), fs = fe(_e);
3299
3299
  pe(() => {
3300
- bs.current !== _e && (bs.current = _e, T($l(de.current, 1)));
3300
+ fs.current !== _e && (fs.current = _e, T(Cl(de.current, 1)));
3301
3301
  }, [_e]);
3302
- const Kn = Object.keys(Xe).filter((e) => !e.includes(".") && !e.startsWith("__")).sort().join(","), hs = (e) => [
3302
+ const Kn = Object.keys(Xe).filter((e) => !e.includes(".") && !e.startsWith("__")).sort().join(","), bs = (e) => [
3303
3303
  "cbv-items",
3304
3304
  n,
3305
3305
  G,
@@ -3308,7 +3308,7 @@ function D0({
3308
3308
  ce ? 500 : He,
3309
3309
  _e,
3310
3310
  Kn
3311
- ], gs = async (e) => {
3311
+ ], hs = async (e) => {
3312
3312
  const t = {
3313
3313
  limit: ce ? 500 : He,
3314
3314
  ...G ? { search: G } : {},
@@ -3327,17 +3327,17 @@ function D0({
3327
3327
  He,
3328
3328
  _e,
3329
3329
  Kn
3330
- ]), l = me.current, o = ld(l, s, e, X);
3331
- if (o.after === void 0 && o.sort === X) return r(e);
3330
+ ]), l = me.current, i = ld(l, s, e, X);
3331
+ if (i.after === void 0 && i.sort === X) return r(e);
3332
3332
  try {
3333
3333
  const b = await u.request(
3334
3334
  J(`/items/${n}`, {
3335
3335
  ...t,
3336
- ...o.after !== void 0 ? { after: o.after } : { page: e },
3337
- ...o.sort ? { sort: o.sort } : {}
3336
+ ...i.after !== void 0 ? { after: i.after } : { page: e },
3337
+ ...i.sort ? { sort: i.sort } : {}
3338
3338
  })
3339
3339
  );
3340
- return o.after !== void 0 && od(l, s, e, b.next_cursor), b;
3340
+ return i.after !== void 0 && od(l, s, e, b.next_cursor), b;
3341
3341
  } catch (b) {
3342
3342
  if (!id(b)) throw b;
3343
3343
  return dd(l, s), r(e);
@@ -3351,20 +3351,20 @@ function D0({
3351
3351
  refetch: Va,
3352
3352
  error: et
3353
3353
  } = ne({
3354
- queryKey: hs(M),
3355
- queryFn: () => gs(M),
3354
+ queryKey: bs(M),
3355
+ queryFn: () => hs(M),
3356
3356
  enabled: !!n && Je,
3357
3357
  placeholderData: (e) => e,
3358
3358
  // #2490 — a collection whose live record events are off polls instead (visible tabs only).
3359
3359
  refetchInterval: De.live_events === "off" ? 3e4 : !1,
3360
3360
  retry: !1
3361
- }), xs = fe(() => {
3361
+ }), gs = fe(() => {
3362
3362
  });
3363
3363
  Dd({
3364
3364
  qc: y,
3365
3365
  enabled: !!n && Je && !ce && !G && !yt && !!ke && M * He < (ke.total ?? 0),
3366
- queryKey: hs(M + 1),
3367
- queryFn: () => gs(M + 1).then((e) => (xs.current(e.data ?? []), e))
3366
+ queryKey: bs(M + 1),
3367
+ queryFn: () => hs(M + 1).then((e) => (gs.current(e.data ?? []), e))
3368
3368
  }), pe(() => {
3369
3369
  const e = kd({
3370
3370
  pending: de.current,
@@ -3380,12 +3380,12 @@ function D0({
3380
3380
  });
3381
3381
  e && (de.current = null, e.page != null && T(e.page));
3382
3382
  }, [Je, ke, yt, Wa, M, He, et]);
3383
- const Ce = re ? re.rows : (ke == null ? void 0 : ke.data) ?? [], Me = re ? re.total : (ke == null ? void 0 : ke.total) ?? 0, Bt = !re && !!ke && (ke.total_timed_out === !0 || ke.total == null), jn = !re && (ke == null ? void 0 : ke.total_approx) === !0, Ha = ke == null ? void 0 : ke.aggregates, ia = Bt ? M + (Ce.length >= He ? 1 : 0) : Math.max(1, Math.ceil(Me / He)), [Ya, vs] = _(!1), ks = async () => {
3383
+ const Ce = re ? re.rows : (ke == null ? void 0 : ke.data) ?? [], Me = re ? re.total : (ke == null ? void 0 : ke.total) ?? 0, Bt = !re && !!ke && (ke.total_timed_out === !0 || ke.total == null), jn = !re && (ke == null ? void 0 : ke.total_approx) === !0, Ha = ke == null ? void 0 : ke.aggregates, ia = Bt ? M + (Ce.length >= He ? 1 : 0) : Math.max(1, Math.ceil(Me / He)), [Ya, xs] = _(!1), vs = async () => {
3384
3384
  if (!jn && !Bt) {
3385
3385
  T(ia);
3386
3386
  return;
3387
3387
  }
3388
- vs(!0);
3388
+ xs(!0);
3389
3389
  try {
3390
3390
  const e = await u.request(
3391
3391
  J(
@@ -3401,30 +3401,30 @@ function D0({
3401
3401
  }
3402
3402
  T(t);
3403
3403
  } catch (e) {
3404
- Nl(e, "Could not find the last page", { retry: () => void ks() });
3404
+ _l(e, "Could not find the last page", { retry: () => void vs() });
3405
3405
  } finally {
3406
- vs(!1);
3406
+ xs(!1);
3407
3407
  }
3408
3408
  }, Bn = Pt.filter(
3409
3409
  (e) => {
3410
3410
  var t;
3411
- return qn.has(e.key) && (((t = gt[e.key]) == null ? void 0 : t.length) ?? 0) > 0 && !ts(e);
3411
+ return qn.has(e.key) && (((t = gt[e.key]) == null ? void 0 : t.length) ?? 0) > 0 && !es(e);
3412
3412
  }
3413
- ), ys = Bn.map((e) => e.key).join(","), Ja = be(() => {
3414
- if (!ys || !_e) return _e;
3413
+ ), ks = Bn.map((e) => e.key).join(","), Ja = be(() => {
3414
+ if (!ks || !_e) return _e;
3415
3415
  const e = new Set(
3416
3416
  Bn.map((r) => {
3417
3417
  var l;
3418
3418
  const s = gt[r.key] ?? [];
3419
3419
  return JSON.stringify(
3420
- (l = r.or_paths) != null && l.length ? { or: r.or_paths.map((o) => ({ path: o, op: "_in", value: s })) } : { path: r.path, op: "_in", value: s }
3420
+ (l = r.or_paths) != null && l.length ? { or: r.or_paths.map((i) => ({ path: i, op: "_in", value: s })) } : { path: r.path, op: "_in", value: s }
3421
3421
  );
3422
3422
  })
3423
3423
  ), t = JSON.parse(_e).filter(
3424
3424
  (r) => !e.has(JSON.stringify(r))
3425
3425
  );
3426
3426
  return t.length > 0 ? JSON.stringify(t) : void 0;
3427
- }, [ys, _e, gt]), { data: da } = ne({
3427
+ }, [ks, _e, gt]), { data: da } = ne({
3428
3428
  queryKey: ["cbv-default-hidden", n, G, Ja],
3429
3429
  enabled: !!n && !re && !!ke && !yt && Me === 0 && Bn.length > 0,
3430
3430
  staleTime: 3e4,
@@ -3445,9 +3445,9 @@ function D0({
3445
3445
  return s;
3446
3446
  };
3447
3447
  st(t), Kt(t), T(1);
3448
- }, ws = fe(Date.now()), ca = fe(null);
3448
+ }, ys = fe(Date.now()), ca = fe(null);
3449
3449
  pe(() => {
3450
- ws.current = Date.now();
3450
+ ys.current = Date.now();
3451
3451
  }, [n, G]), pe(() => {
3452
3452
  var t, r;
3453
3453
  if (!n || G.length < 2 || !ke || yt || re) return;
@@ -3459,7 +3459,7 @@ function D0({
3459
3459
  collection: n,
3460
3460
  query: G,
3461
3461
  result_count: ke.total ?? ((r = ke.data) == null ? void 0 : r.length) ?? 0,
3462
- duration_ms: Date.now() - ws.current
3462
+ duration_ms: Date.now() - ys.current
3463
3463
  })
3464
3464
  });
3465
3465
  }, [u, n, G, ke, yt, re]), lc(
@@ -3479,19 +3479,19 @@ function D0({
3479
3479
  }
3480
3480
  } : null
3481
3481
  );
3482
- const No = oc(), _s = Ei(yt), Ga = Di({
3482
+ const No = oc(), ws = Ei(yt), Ga = Di({
3483
3483
  pending: yt,
3484
3484
  request: n ? { method: "GET", url: `/items/${n}` } : null,
3485
3485
  noun: ((A == null ? void 0 : A.display_name) ?? n ?? "").replace(/_/g, " ").toLowerCase() || null,
3486
3486
  // Only a total this person has already been shown (never a raw table count).
3487
3487
  knownRows: yt ? Jd(y.getQueriesData({ queryKey: ["cbv-items", n] })) : null
3488
- }), Xa = Kd(), { userId: Un } = $a(), Ns = (e) => Ct || !!Un && String(e.user ?? "").toUpperCase() === String(Un).toUpperCase(), Ot = wd(), Za = fe(/* @__PURE__ */ new Set());
3488
+ }), Xa = Kd(), { userId: Un } = $a(), _s = (e) => Ct || !!Un && String(e.user ?? "").toUpperCase() === String(Un).toUpperCase(), Ot = wd(), Za = fe(/* @__PURE__ */ new Set());
3489
3489
  Za.current = new Set(Ce.map((e) => String(e.id)));
3490
3490
  const So = be(
3491
3491
  () => Ce.slice(0, 100).map((e) => ({ collection: n, item: String(e.id) })),
3492
3492
  [Ce, n]
3493
- ), Ss = Od(So), Cs = fe([]);
3494
- Cs.current = [
3493
+ ), Ns = Od(So), Ss = fe([]);
3494
+ Ss.current = [
3495
3495
  "cbv-items",
3496
3496
  n,
3497
3497
  G,
@@ -3501,13 +3501,13 @@ function D0({
3501
3501
  _e,
3502
3502
  Kn
3503
3503
  ];
3504
- const $s = fe({
3504
+ const Cs = fe({
3505
3505
  conditions: _e,
3506
3506
  search: G,
3507
3507
  page: M,
3508
3508
  grouped: !!ce
3509
3509
  });
3510
- $s.current = {
3510
+ Cs.current = {
3511
3511
  conditions: _e,
3512
3512
  search: G,
3513
3513
  page: M,
@@ -3526,14 +3526,14 @@ function D0({
3526
3526
  t.clear();
3527
3527
  }, 300));
3528
3528
  }, l = (D) => y.setQueryData(
3529
- Cs.current,
3529
+ Ss.current,
3530
3530
  (z) => z && { ...z, ...D(z) }
3531
3531
  );
3532
- let o = [], b = null, x = null, v = !1;
3532
+ let i = [], b = null, x = null, v = !1;
3533
3533
  const U = async () => {
3534
3534
  b = null;
3535
- const D = o;
3536
- if (o = [], D.length === 0 || v) return;
3535
+ const D = i;
3536
+ if (i = [], D.length === 0 || v) return;
3537
3537
  x || (x = setTimeout(() => {
3538
3538
  x = null, y.invalidateQueries({ queryKey: ["cbv-view-count", n] });
3539
3539
  }, 1500));
@@ -3567,7 +3567,7 @@ function D0({
3567
3567
  })), Ot.forget(At);
3568
3568
  }
3569
3569
  if (z.size === 0) return;
3570
- const ut = $s.current;
3570
+ const ut = Cs.current;
3571
3571
  let Gt;
3572
3572
  try {
3573
3573
  Gt = await Sd(
@@ -3628,9 +3628,9 @@ function D0({
3628
3628
  (String(z.item) === "*" || Za.current.has(String(z.item))) && s(Y);
3629
3629
  continue;
3630
3630
  }
3631
- o.push(z);
3631
+ i.push(z);
3632
3632
  }
3633
- o.length > 0 && !b && (b = setTimeout(() => void U(), 300));
3633
+ i.length > 0 && !b && (b = setTimeout(() => void U(), 300));
3634
3634
  }, Le = Xa.subscribeCollections(
3635
3635
  [n],
3636
3636
  (D) => nd(er, [D], j)
@@ -3676,7 +3676,7 @@ function D0({
3676
3676
  placeholderData: (e) => e,
3677
3677
  staleTime: 3e4,
3678
3678
  retry: !1
3679
- }), { data: qs = !1 } = ne({
3679
+ }), { data: $s = !1 } = ne({
3680
3680
  queryKey: ["cbv-tasks-used", n],
3681
3681
  queryFn: () => u.request(J("/tasks", { collection: n, limit: 1 })).then((e) => (e.data ?? []).length > 0).catch(() => !1),
3682
3682
  enabled: !!n && !n.startsWith("nivaro_"),
@@ -3687,7 +3687,7 @@ function D0({
3687
3687
  queryFn: () => u.request(
3688
3688
  he("/tasks/counts", { collection: n, ids: Ue.split(",") })
3689
3689
  ).then((e) => e.data ?? {}),
3690
- enabled: !!n && qs && Ue.length > 0,
3690
+ enabled: !!n && $s && Ue.length > 0,
3691
3691
  placeholderData: (e) => e,
3692
3692
  staleTime: 3e4,
3693
3693
  retry: !1
@@ -3705,12 +3705,12 @@ function D0({
3705
3705
  queryFn: () => u.request(J("/integration-obligations/collections")).then((e) => e.data ?? []).catch(() => []),
3706
3706
  staleTime: 6e4,
3707
3707
  retry: !1
3708
- }), Ts = Eo.includes(n), { data: or } = ne({
3708
+ }), qs = Eo.includes(n), { data: or } = ne({
3709
3709
  queryKey: ["cbv-integrations-summary", n, Ue],
3710
3710
  queryFn: () => u.request(
3711
3711
  he("/integration-obligations/summary", { collection: n, ids: Ue.split(",") })
3712
3712
  ).then((e) => e.data ?? {}).catch(() => ({})),
3713
- enabled: !!n && Ts && Ue.length > 0,
3713
+ enabled: !!n && qs && Ue.length > 0,
3714
3714
  placeholderData: (e) => e,
3715
3715
  staleTime: 3e4,
3716
3716
  retry: !1
@@ -3723,7 +3723,7 @@ function D0({
3723
3723
  placeholderData: (e) => e,
3724
3724
  staleTime: 3e4,
3725
3725
  retry: !1
3726
- }), pa = (sl = Re == null ? void 0 : Re.binding) == null ? void 0 : sl.template, { data: wt } = ne({
3726
+ }), pa = (rl = Re == null ? void 0 : Re.binding) == null ? void 0 : rl.template, { data: wt } = ne({
3727
3727
  queryKey: ["cbv-pipeline-template", pa, Ct ? "full" : "outline"],
3728
3728
  queryFn: () => u.request(J(Ct ? `/pipelines/${pa}` : `/pipelines/${pa}/outline`)).then((e) => e.data),
3729
3729
  enabled: !!pa,
@@ -3738,47 +3738,47 @@ function D0({
3738
3738
  enabled: Do && Ue.length > 0,
3739
3739
  staleTime: 6e4,
3740
3740
  retry: !1
3741
- }), Ls = be(
3741
+ }), Ts = be(
3742
3742
  () => ve.filter((e) => e.includes(".")),
3743
3743
  [ve]
3744
- ), Fs = be(
3744
+ ), Ls = be(
3745
3745
  () => ve.filter((e) => e.startsWith("__f:")).flatMap((e) => Zi(We[e] ?? "")).filter((e) => e.includes(".")),
3746
3746
  [ve, We]
3747
3747
  ), zn = be(
3748
- () => [.../* @__PURE__ */ new Set([...Ls, ...Object.values(Ye), ...Fs])].slice(
3748
+ () => [.../* @__PURE__ */ new Set([...Ts, ...Object.values(Ye), ...Ls])].slice(
3749
3749
  0,
3750
3750
  20
3751
3751
  ),
3752
- [Ls, Ye, Fs]
3753
- ), Rs = Ce.map((e) => String(e.id)).join(","), Es = (e) => u.request(
3752
+ [Ts, Ye, Ls]
3753
+ ), Fs = Ce.map((e) => String(e.id)).join(","), Rs = (e) => u.request(
3754
3754
  J(`/items/${n}/resolve-paths`, {
3755
3755
  ids: e,
3756
3756
  paths: zn.join(",")
3757
3757
  })
3758
3758
  ).then((t) => t.data ?? { rows: {}, targets: {} }), { data: Te } = ne({
3759
- queryKey: ["cbv-resolved", n, Rs, zn.join(",")],
3760
- queryFn: () => Es(Rs),
3759
+ queryKey: ["cbv-resolved", n, Fs, zn.join(",")],
3760
+ queryFn: () => Rs(Fs),
3761
3761
  enabled: Ce.length > 0 && zn.length > 0,
3762
3762
  staleTime: 3e4,
3763
3763
  retry: !1
3764
3764
  }), _t = (e, t) => {
3765
- var l, o, b;
3765
+ var l, i, b;
3766
3766
  const r = t.includes(".") ? t : Ye[t];
3767
3767
  if (!r) return null;
3768
- const s = (b = (o = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(e)]) == null ? void 0 : o[r]) == null ? void 0 : b.value;
3768
+ const s = (b = (i = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(e)]) == null ? void 0 : i[r]) == null ? void 0 : b.value;
3769
3769
  return s == null || s === "" ? "—" : s;
3770
- }, Ds = (e) => {
3770
+ }, Es = (e) => {
3771
3771
  var r;
3772
3772
  const t = e.includes(".") ? e : Ye[e];
3773
3773
  return t ? ((r = Te == null ? void 0 : Te.targets) == null ? void 0 : r[t]) ?? null : null;
3774
3774
  }, Po = (e, t) => {
3775
- var o, b, x, v;
3775
+ var i, b, x, v;
3776
3776
  const r = t.includes(".") ? t : Ye[t];
3777
3777
  if (!r) return null;
3778
- const s = (o = Te == null ? void 0 : Te.targets) == null ? void 0 : o[r], l = ((v = (x = (b = Te == null ? void 0 : Te.rows) == null ? void 0 : b[String(e)]) == null ? void 0 : x[r]) == null ? void 0 : v.ids) ?? [];
3778
+ const s = (i = Te == null ? void 0 : Te.targets) == null ? void 0 : i[r], l = ((v = (x = (b = Te == null ? void 0 : Te.rows) == null ? void 0 : b[String(e)]) == null ? void 0 : x[r]) == null ? void 0 : v.ids) ?? [];
3779
3779
  return !s || Tt(s) || l.length === 0 ? null : { target: s, id: String(l[0]) };
3780
3780
  }, Ut = (e) => e.includes(".") || e in Ye;
3781
- xs.current = (e) => Qi({
3781
+ gs.current = (e) => Qi({
3782
3782
  qc: y,
3783
3783
  collection: n,
3784
3784
  rows: e,
@@ -3786,7 +3786,7 @@ function D0({
3786
3786
  relations: Ge,
3787
3787
  resolveList: zn,
3788
3788
  isResolvedCol: Ut,
3789
- fetchResolved: Es,
3789
+ fetchResolved: Rs,
3790
3790
  fetchRelation: (t, r) => Jl(u, t, r),
3791
3791
  userCardQuery: (t) => ac(u, t)
3792
3792
  });
@@ -3795,7 +3795,7 @@ function D0({
3795
3795
  const t = ot(Ge, n, e);
3796
3796
  if (t != null && t.one_collection)
3797
3797
  return Tt(t.one_collection) && t.one_collection !== "nivaro_users" ? null : { kind: "in", target: t.one_collection };
3798
- const r = cs[e];
3798
+ const r = ds[e];
3799
3799
  if (r) {
3800
3800
  if (r.kind === "m2m") return { kind: "in", target: r.target };
3801
3801
  const l = Ye[e];
@@ -3816,37 +3816,37 @@ function D0({
3816
3816
  ze("__state__", { kind: "state", value: [.../* @__PURE__ */ new Set([...D, j.state_key])] });
3817
3817
  return;
3818
3818
  }
3819
- const o = gn(t);
3820
- if (o) {
3821
- if (o.kind === "in") {
3819
+ const i = gn(t);
3820
+ if (i) {
3821
+ if (i.kind === "in") {
3822
3822
  const Le = ot(Ge, n, t) ? r[t] != null ? [r[t]] : [] : ((U = (v = (x = Te == null ? void 0 : Te.rows) == null ? void 0 : x[String(l)]) == null ? void 0 : v[Ye[t]]) == null ? void 0 : U.ids) ?? [];
3823
3823
  if (Le.length === 0) return;
3824
3824
  const D = Ve[t], z = (D == null ? void 0 : D.kind) === "in" ? D.value : [];
3825
3825
  ze(t, { kind: "in", value: [.../* @__PURE__ */ new Set([...z, ...Le])] });
3826
3826
  return;
3827
3827
  }
3828
- if (o.kind === "enum") {
3828
+ if (i.kind === "enum") {
3829
3829
  if (r[t] == null || r[t] === "") return;
3830
3830
  const j = Ve[t], Le = (j == null ? void 0 : j.kind) === "in" ? j.value : [];
3831
3831
  ze(t, { kind: "in", value: [.../* @__PURE__ */ new Set([...Le, r[t]])] });
3832
3832
  return;
3833
3833
  }
3834
- if (o.kind === "text") {
3834
+ if (i.kind === "text") {
3835
3835
  const j = t.includes(".") || t in Ye ? _t(l, t) : String(r[t] ?? "");
3836
- j && j !== "—" && ze(t, { kind: "text", value: j, path: o.path });
3836
+ j && j !== "—" && ze(t, { kind: "text", value: j, path: i.path });
3837
3837
  return;
3838
3838
  }
3839
- if (o.kind === "num") {
3839
+ if (i.kind === "num") {
3840
3840
  if (r[t] == null || r[t] === "") return;
3841
3841
  ze(t, { kind: "num", op: "_eq", value: String(r[t]) });
3842
3842
  return;
3843
3843
  }
3844
- if (o.kind === "bool") {
3844
+ if (i.kind === "bool") {
3845
3845
  if (r[t] == null) return;
3846
3846
  ze(t, { kind: "bool", value: r[t] ? "true" : "false" });
3847
3847
  return;
3848
3848
  }
3849
- if (o.kind === "date") {
3849
+ if (i.kind === "date") {
3850
3850
  const j = String(r[t] ?? "").slice(0, 10);
3851
3851
  j && ze(t, { kind: "date", value: `r:${j}..${j}` });
3852
3852
  }
@@ -3856,21 +3856,21 @@ function D0({
3856
3856
  const r = gn(e);
3857
3857
  return r ? r.kind === "in" ? !!ot(Ge, n, e) && t[e] != null : r.kind === "enum" || r.kind === "num" ? t[e] != null && t[e] !== "" : r.kind === "text" : !1;
3858
3858
  }, Ao = (e) => {
3859
- const { key: t, row: r, cellText: s } = e, l = r.id, o = gn(t);
3860
- if (!o) return;
3859
+ const { key: t, row: r, cellText: s } = e, l = r.id, i = gn(t);
3860
+ if (!i) return;
3861
3861
  let b = null;
3862
3862
  const x = `${t}:${Date.now().toString(36)}`;
3863
- if (o.kind === "in" && ot(Ge, n, t) && r[t] != null)
3863
+ if (i.kind === "in" && ot(Ge, n, t) && r[t] != null)
3864
3864
  b = { id: x, path: [t], op: "_neq", value: r[t], label: s, field: t };
3865
- else if ((o.kind === "enum" || o.kind === "num") && r[t] != null && r[t] !== "")
3865
+ else if ((i.kind === "enum" || i.kind === "num") && r[t] != null && r[t] !== "")
3866
3866
  b = { id: x, path: [t], op: "_neq", value: r[t], label: s, field: t };
3867
- else if (o.kind === "text") {
3867
+ else if (i.kind === "text") {
3868
3868
  const v = t.includes(".") || t in Ye ? _t(l, t) : String(r[t] ?? "");
3869
- v && v !== "—" && (b = { id: x, path: o.path, op: "_ncontains", value: v, label: v, field: t });
3869
+ v && v !== "—" && (b = { id: x, path: i.path, op: "_ncontains", value: v, label: v, field: t });
3870
3870
  }
3871
- b && Ar((v) => [...v, b]);
3871
+ b && Or((v) => [...v, b]);
3872
3872
  }, Io = (e) => {
3873
- var s, l, o;
3873
+ var s, l, i;
3874
3874
  const t = gn(e);
3875
3875
  if (!t) return null;
3876
3876
  const r = Ve[e];
@@ -3878,7 +3878,7 @@ function D0({
3878
3878
  const b = /* @__PURE__ */ new Set(), x = Ye[e];
3879
3879
  for (const v of Ce)
3880
3880
  if (x)
3881
- for (const U of ((o = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(v.id)]) == null ? void 0 : l[x]) == null ? void 0 : o.ids) ?? [])
3881
+ for (const U of ((i = (l = (s = Te == null ? void 0 : Te.rows) == null ? void 0 : s[String(v.id)]) == null ? void 0 : l[x]) == null ? void 0 : i.ids) ?? [])
3882
3882
  b.add(U);
3883
3883
  else v[e] != null && v[e] !== "" && typeof v[e] != "object" && b.add(v[e]);
3884
3884
  return /* @__PURE__ */ a(
@@ -3971,15 +3971,15 @@ function D0({
3971
3971
  const t = String(((r = kt.get(e)) == null ? void 0 : r.type) ?? "").toLowerCase();
3972
3972
  return t === "timestamp" || t === "datetime" || t === "date";
3973
3973
  }, xn = (e, t, r) => {
3974
- var l, o, b;
3974
+ var l, i, b;
3975
3975
  const s = xe[t];
3976
3976
  if ((s == null ? void 0 : s.type) === "count") {
3977
- const x = t.includes(".") ? t : Ye[t], v = r != null && x ? (b = (o = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(r)]) == null ? void 0 : o[x]) == null ? void 0 : b.ids : void 0, U = rd(e === "—" ? "" : e, v);
3977
+ const x = t.includes(".") ? t : Ye[t], v = r != null && x ? (b = (i = (l = Te == null ? void 0 : Te.rows) == null ? void 0 : l[String(r)]) == null ? void 0 : i[x]) == null ? void 0 : b.ids : void 0, U = rd(e === "—" ? "" : e, v);
3978
3978
  return String(U);
3979
3979
  }
3980
- return s && e && e !== "—" ? Cl(e, s) : e;
3981
- }, Ps = (e) => {
3982
- const t = Ds(e);
3980
+ return s && e && e !== "—" ? Sl(e, s) : e;
3981
+ }, Ds = (e) => {
3982
+ const t = Es(e);
3983
3983
  return !!t && (t === "nivaro_files" || /_files$/.test(t));
3984
3984
  }, { data: dt = [] } = ne({
3985
3985
  queryKey: ["cbv-views", n],
@@ -3987,7 +3987,7 @@ function D0({
3987
3987
  staleTime: 3e4
3988
3988
  }), vn = () => y.invalidateQueries({ queryKey: ["cbv-views", n] }), Bo = _a({
3989
3989
  queries: dt.slice(0, 12).map((e) => {
3990
- const t = Ul(e.filters ?? []);
3990
+ const t = Bl(e.filters ?? []);
3991
3991
  return {
3992
3992
  queryKey: ["cbv-view-count", n, e.id, JSON.stringify(t)],
3993
3993
  queryFn: () => u.request(
@@ -4007,20 +4007,20 @@ function D0({
4007
4007
  var r;
4008
4008
  cr.set(e.id, ((r = Bo[t]) == null ? void 0 : r.data) ?? null);
4009
4009
  });
4010
- const [Ms, Uo] = _(() => /* @__PURE__ */ new Set()), ma = (e) => {
4010
+ const [Ps, Uo] = _(() => /* @__PURE__ */ new Set()), ma = (e) => {
4011
4011
  var r, s;
4012
4012
  Dn(e.id);
4013
- const t = Fl(e.filters ?? []);
4013
+ const t = Ll(e.filters ?? []);
4014
4014
  if (Se(t.filters), sa(t.riskIds), $e(e.sort ?? ""), (r = e.columns) != null && r.length) {
4015
4015
  const l = new Set(
4016
- e.columns.filter((p) => typeof p != "string" && p.admin_only).map(Kl)
4016
+ e.columns.filter((p) => typeof p != "string" && p.admin_only).map(Il)
4017
4017
  );
4018
4018
  Uo(l);
4019
- const o = e.columns.map(Kl).filter((p) => Ct || !l.has(p)), b = {};
4019
+ const i = e.columns.map(Il).filter((p) => Ct || !l.has(p)), b = {};
4020
4020
  for (const p of e.columns)
4021
4021
  typeof p != "string" && p.formula && p.key.startsWith("__f:") && (b[p.key] = p.formula);
4022
4022
  k(b);
4023
- const x = o.filter((p) => p.includes(".") || kt.has(p) || !!b[p]);
4023
+ const x = i.filter((p) => p.includes(".") || kt.has(p) || !!b[p]);
4024
4024
  x.length > 0 && at(x);
4025
4025
  const v = {}, U = {}, j = {};
4026
4026
  let Le = !1;
@@ -4031,7 +4031,7 @@ function D0({
4031
4031
  } else
4032
4032
  ra(null);
4033
4033
  T(1);
4034
- }, Os = () => {
4034
+ }, Ms = () => {
4035
4035
  const e = dt.find((t) => t.role_default) ?? dt.find((t) => t.is_default);
4036
4036
  if (e) {
4037
4037
  ma(e);
@@ -4044,17 +4044,17 @@ function D0({
4044
4044
  sort: X,
4045
4045
  columns: [
4046
4046
  ...ve.map((e, t) => {
4047
- const r = Ie[e], s = xe[e], l = On[e] ?? (t === 0 && Ba !== null ? "none" : void 0), o = H[e], b = Lt[e], x = Xe[e], v = We[e];
4048
- return !r && !s && !l && !(o != null && o.length) && !b && !x && !v && !Ms.has(e) ? e : {
4047
+ const r = Ie[e], s = xe[e], l = On[e] ?? (t === 0 && Ba !== null ? "none" : void 0), i = H[e], b = Lt[e], x = Xe[e], v = We[e];
4048
+ return !r && !s && !l && !(i != null && i.length) && !b && !x && !v && !Ps.has(e) ? e : {
4049
4049
  key: e,
4050
4050
  ...v ? { formula: v } : {},
4051
4051
  ...r ? { label: r } : {},
4052
4052
  ...s ? { format: s } : {},
4053
4053
  ...l ? { pin: l } : {},
4054
- ...o != null && o.length ? { tint: o } : {},
4054
+ ...i != null && i.length ? { tint: i } : {},
4055
4055
  ...b ? { width: b } : {},
4056
4056
  ...x ? { agg: x } : {},
4057
- ...Ms.has(e) ? { admin_only: !0 } : {}
4057
+ ...Ps.has(e) ? { admin_only: !0 } : {}
4058
4058
  };
4059
4059
  }),
4060
4060
  // Synthetic columns (State/Owners/Actions) persist pins as pin-only
@@ -4078,13 +4078,13 @@ function D0({
4078
4078
  const e = dt.find((t) => t.role_default) ?? dt.find((t) => t.is_default);
4079
4079
  e && Ht == null && (ma(e), P && T(P));
4080
4080
  }, [dt, Et]);
4081
- const { data: As = [] } = ne({
4081
+ const { data: Os = [] } = ne({
4082
4082
  queryKey: ["cbv-export-presets", n],
4083
4083
  queryFn: () => u.request(
4084
4084
  J("/export-presets", { collection: n })
4085
4085
  ).then((e) => e.data ?? []),
4086
4086
  staleTime: 6e4
4087
- }), [fa, Is] = _(""), Ks = async () => {
4087
+ }), [fa, As] = _(""), Is = async () => {
4088
4088
  fa.trim() && (await u.request(
4089
4089
  he("/export-presets", {
4090
4090
  collection: n,
@@ -4095,7 +4095,7 @@ function D0({
4095
4095
  },
4096
4096
  is_shared: !0
4097
4097
  })
4098
- ), Is(""), y.invalidateQueries({ queryKey: ["cbv-export-presets", n] }));
4098
+ ), As(""), y.invalidateQueries({ queryKey: ["cbv-export-presets", n] }));
4099
4099
  }, zo = (e) => {
4100
4100
  const t = new URLSearchParams();
4101
4101
  G && t.set("search", G), _e && t.set("conditions", _e), X && t.set("sort", X), window.open(`/api/export-presets/${e}/run?${t.toString()}`, "_blank");
@@ -4107,10 +4107,10 @@ function D0({
4107
4107
  ...X ? { sort: X } : {}
4108
4108
  })
4109
4109
  ).then(() => ge.info(`Exporting “${t}” in the background — follow it in the Jobs tray`)).catch((r) => ge.error(Zt(r, "Could not start the export")));
4110
- }, js = fe(!1);
4110
+ }, Ks = fe(!1);
4111
4111
  pe(() => {
4112
4112
  var e;
4113
- js.current || !m || Et.length === 0 || (js.current = !0, (e = m.c) != null && e.length && (ma({
4113
+ Ks.current || !m || Et.length === 0 || (Ks.current = !0, (e = m.c) != null && e.length && (ma({
4114
4114
  id: -1,
4115
4115
  filters: m.f ?? [],
4116
4116
  sort: m.s ?? null,
@@ -4142,11 +4142,11 @@ function D0({
4142
4142
  onSuccess: (e) => {
4143
4143
  Ea(!1), Da(""), Dn(e.data.id), vn();
4144
4144
  }
4145
- }), [ur, Bs] = _(null), zt = Nt({
4145
+ }), [ur, js] = _(null), zt = Nt({
4146
4146
  mutationFn: (e) => u.request(ka(`/saved-views/${e}`, Qn())),
4147
4147
  onSuccess: (e, t) => {
4148
4148
  var s;
4149
- vn(), Bs(t), setTimeout(() => Bs((l) => l === t ? null : l), 2e3);
4149
+ vn(), js(t), setTimeout(() => js((l) => l === t ? null : l), 2e3);
4150
4150
  const r = (s = dt.find((l) => l.id === t)) == null ? void 0 : s.name;
4151
4151
  ge.success(r ? `Saved "${r}" with the current columns and filters` : "View saved");
4152
4152
  },
@@ -4158,7 +4158,7 @@ function D0({
4158
4158
  mutationFn: ({ id: e, role: t }) => u.request(ka(`/saved-views/${e}`, { default_for_role: t })),
4159
4159
  onSuccess: vn,
4160
4160
  onError: (e) => ge.error(`Could not set the role default: ${e.message}`)
4161
- }), Us = Nt({
4161
+ }), Bs = Nt({
4162
4162
  mutationFn: () => {
4163
4163
  const e = dt.find((t) => t.is_default);
4164
4164
  return e ? u.request(ka(`/saved-views/${e.id}`, { ...Qn(), is_default: !0 })) : u.request(
@@ -4168,7 +4168,7 @@ function D0({
4168
4168
  onSuccess: () => {
4169
4169
  en(!1), vn();
4170
4170
  }
4171
- }), zs = Nt({
4171
+ }), Us = Nt({
4172
4172
  mutationFn: (e) => u.request(Na(`/items/${n}/${e}`)),
4173
4173
  onSuccess: () => {
4174
4174
  ge.success("Moved to the trash"), y.invalidateQueries({ queryKey: ["cbv-items", n] });
@@ -4181,7 +4181,7 @@ function D0({
4181
4181
  }), Yo = Nt({
4182
4182
  mutationFn: (e) => u.request(Na(`/saved-views/${e}`)),
4183
4183
  onSuccess: (e, t) => {
4184
- Ht === t && Os(), vn();
4184
+ Ht === t && Ms(), vn();
4185
4185
  }
4186
4186
  }), { data: Jo = [] } = ne({
4187
4187
  queryKey: ["cbv-view-subs"],
@@ -4196,7 +4196,7 @@ function D0({
4196
4196
  }), Xo = async () => {
4197
4197
  var e, t;
4198
4198
  if (!Pa) {
4199
- Ir(!0);
4199
+ Ar(!0);
4200
4200
  try {
4201
4201
  const { rows: r, truncated: s } = await Nc(
4202
4202
  (C, B) => u.request(
@@ -4208,7 +4208,7 @@ function D0({
4208
4208
  ..._e ? { conditions: _e } : {}
4209
4209
  })
4210
4210
  )
4211
- ), l = ve, o = [], b = [];
4211
+ ), l = ve, i = [], b = [];
4212
4212
  for (const C of l) {
4213
4213
  if (C.includes(".") || C.startsWith("__") || C in Ye) continue;
4214
4214
  const B = (e = ot(Ge, n, C)) == null ? void 0 : e.one_collection;
@@ -4224,13 +4224,13 @@ function D0({
4224
4224
  staleTime: 10 * 6e4
4225
4225
  }).catch(() => {
4226
4226
  });
4227
- o.push({
4227
+ i.push({
4228
4228
  column: C,
4229
4229
  template: (Ne == null ? void 0 : Ne.display_template) ?? null,
4230
4230
  labelField: Yn(Ne)
4231
4231
  });
4232
4232
  }
4233
- const x = [.../* @__PURE__ */ new Set([...zn, ...o.flatMap(Cc)])], v = await $c(
4233
+ const x = [.../* @__PURE__ */ new Set([...zn, ...i.flatMap(Cc)])], v = await $c(
4234
4234
  r.map((C) => String(C.id)),
4235
4235
  x,
4236
4236
  (C, B) => u.request(
@@ -4252,26 +4252,26 @@ function D0({
4252
4252
  (C) => nc(u, C).then((B) => j.set(C.toUpperCase(), qc(B, C))).catch(() => j.set(C.toUpperCase(), C))
4253
4253
  )
4254
4254
  );
4255
- const Le = new Map(o.map((C) => [C.column, C])), D = new Set(b), z = (C) => {
4255
+ const Le = new Map(i.map((C) => [C.column, C])), D = new Set(b), z = (C) => {
4256
4256
  const B = C == null ? "" : String(typeof C == "object" ? JSON.stringify(C) : C);
4257
4257
  return /[",\n]/.test(B) ? `"${B.replace(/"/g, '""')}"` : B;
4258
4258
  }, Y = (C, B) => {
4259
- var bl, hl;
4259
+ var fl, bl;
4260
4260
  const Ne = xe[B];
4261
4261
  if (B.startsWith("__f:")) {
4262
- const xa = We[B], wn = xa ? Sl(xa, (kr) => {
4263
- var gl, xl;
4264
- const va = kr.includes(".") ? (xl = (gl = v[String(C.id)]) == null ? void 0 : gl[kr]) == null ? void 0 : xl.value : C[kr];
4262
+ const xa = We[B], wn = xa ? Nl(xa, (kr) => {
4263
+ var hl, gl;
4264
+ const va = kr.includes(".") ? (gl = (hl = v[String(C.id)]) == null ? void 0 : hl[kr]) == null ? void 0 : gl.value : C[kr];
4265
4265
  return typeof va == "string" && /^-?\d+(\.\d+)?$/.test(va.trim()) ? Number(va) : va;
4266
4266
  }) : null;
4267
4267
  return wn == null ? "" : Math.round(wn * 100) / 100;
4268
4268
  }
4269
4269
  if (B.includes(".") || B in Ye) {
4270
- const xa = B.includes(".") ? B : Ye[B], wn = ((hl = (bl = v[String(C.id)]) == null ? void 0 : bl[xa]) == null ? void 0 : hl.value) ?? "";
4271
- return Ne && wn ? Cl(wn, Ne) : wn;
4270
+ const xa = B.includes(".") ? B : Ye[B], wn = ((bl = (fl = v[String(C.id)]) == null ? void 0 : fl[xa]) == null ? void 0 : bl.value) ?? "";
4271
+ return Ne && wn ? Sl(wn, Ne) : wn;
4272
4272
  }
4273
- const Ee = C[B], fl = Le.get(B);
4274
- return fl && Ee != null && Ee !== "" ? Tc(fl, v[String(C.id)]) || Ee : D.has(B) && Ee != null && Ee !== "" ? j.get(String(Ee).toUpperCase()) ?? Ee : Ee != null && Ee !== "" && ((Ne == null ? void 0 : Ne.type) === "number" || dr(B)) ? Ki(Ee) : Ee != null && Ee !== "" && ((Ne == null ? void 0 : Ne.type) === "datetime" || jo(B)) ? ji(Ee) : B === "id" ? Sr(A, C) ?? Ee : Ne && Ee != null ? Hn(String(Ee), Ne) : Ee;
4273
+ const Ee = C[B], ml = Le.get(B);
4274
+ return ml && Ee != null && Ee !== "" ? Tc(ml, v[String(C.id)]) || Ee : D.has(B) && Ee != null && Ee !== "" ? j.get(String(Ee).toUpperCase()) ?? Ee : Ee != null && Ee !== "" && ((Ne == null ? void 0 : Ne.type) === "number" || dr(B)) ? Ki(Ee) : Ee != null && Ee !== "" && ((Ne == null ? void 0 : Ne.type) === "datetime" || jo(B)) ? ji(Ee) : B === "id" ? Sr(A, C) ?? Ee : Ne && Ee != null ? Hn(String(Ee), Ne) : Ee;
4275
4275
  }, p = Jt.filter((C) => C.kind !== "actions"), ft = new Set(
4276
4276
  p.filter((C) => C.kind !== "data" && C.kind !== "formula").map((C) => C.kind)
4277
4277
  ), tt = r.map((C) => String(C.id)), At = await Bi(tt, ft, {
@@ -4332,7 +4332,7 @@ function D0({
4332
4332
  } catch (r) {
4333
4333
  ge.error(Zt(r, "Export failed"));
4334
4334
  } finally {
4335
- Ir(!1);
4335
+ Ar(!1);
4336
4336
  }
4337
4337
  }
4338
4338
  }, Zo = (e) => {
@@ -4370,8 +4370,8 @@ function D0({
4370
4370
  ...((b = r.currentTarget.parentElement) == null ? void 0 : b.querySelectorAll(
4371
4371
  ":scope > [data-row-open]"
4372
4372
  )) ?? []
4373
- ], l = Pc(s.length, s.indexOf(r.currentTarget), r.key), o = l === null ? null : s[l];
4374
- o && (o.focus(), (x = o.scrollIntoView) == null || x.call(o, { block: "nearest" }));
4373
+ ], l = Pc(s.length, s.indexOf(r.currentTarget), r.key), i = l === null ? null : s[l];
4374
+ i && (i.focus(), (x = i.scrollIntoView) == null || x.call(i, { block: "nearest" }));
4375
4375
  }
4376
4376
  };
4377
4377
  }, on = (e) => {
@@ -4381,7 +4381,7 @@ function D0({
4381
4381
  collection: n,
4382
4382
  item: e === "new" ? null : e
4383
4383
  }), S ? S(e) : Q({ collection: n, itemId: String(e) });
4384
- }, Qs = (e) => {
4384
+ }, zs = (e) => {
4385
4385
  const t = ot(Ge, n, e), r = (s) => {
4386
4386
  $e(Gd(X, s, De.default_sort ?? "")), T(1);
4387
4387
  };
@@ -4403,8 +4403,8 @@ function D0({
4403
4403
  r(e);
4404
4404
  }, pr = Ce.length > 0 && Ce.every((e) => an.includes(e.id)), ti = () => rn(
4405
4405
  pr ? an.filter((e) => !Ce.some((t) => t.id === e)) : [.../* @__PURE__ */ new Set([...an, ...Ce.map((e) => e.id)])]
4406
- ), ni = (e) => rn((t) => t.includes(e) ? t.filter((r) => r !== e) : [...t, e]), ga = 2e3, [Ws, Vs] = _(!1), ai = async () => {
4407
- Vs(!0);
4406
+ ), ni = (e) => rn((t) => t.includes(e) ? t.filter((r) => r !== e) : [...t, e]), ga = 2e3, [Qs, Ws] = _(!1), ai = async () => {
4407
+ Ws(!0);
4408
4408
  try {
4409
4409
  const e = await u.request(
4410
4410
  J(`/items/${n}`, {
@@ -4416,9 +4416,9 @@ function D0({
4416
4416
  );
4417
4417
  rn(e.data.map((t) => t.id));
4418
4418
  } finally {
4419
- Vs(!1);
4419
+ Ws(!1);
4420
4420
  }
4421
- }, ri = Me === 0 && !Bt ? 0 : (M - 1) * He + 1, si = Bt ? (M - 1) * He + Ce.length : Math.min(M * He, Me), Wn = !!(Re != null && Re.instances), Hs = (Dt ? 1 : 0) + (Wn ? 2 : 0) + (Vr ? 1 : 0), mr = [
4421
+ }, ri = Me === 0 && !Bt ? 0 : (M - 1) * He + 1, si = Bt ? (M - 1) * He + Ce.length : Math.min(M * He, Me), Wn = !!(Re != null && Re.instances), Vs = (Dt ? 1 : 0) + (Wn ? 2 : 0) + (Wr ? 1 : 0), mr = [
4422
4422
  ...ve.map(
4423
4423
  (e) => e.startsWith("__f:") ? { key: e, kind: "formula" } : { key: e, kind: "data" }
4424
4424
  ),
@@ -4432,9 +4432,9 @@ function D0({
4432
4432
  ] : [],
4433
4433
  ...ar ? [{ key: "__addendums__", kind: "addendums" }] : [],
4434
4434
  ...Fe ? [{ key: "__fulfilment__", kind: "fulfilment" }] : [],
4435
- ...Ts ? [{ key: "__integrations__", kind: "integrations" }] : [],
4436
- ...qs ? [{ key: "__tasks__", kind: "tasks" }] : [],
4437
- ...Vr ? [{ key: "__actions__", kind: "actions" }] : []
4435
+ ...qs ? [{ key: "__integrations__", kind: "integrations" }] : [],
4436
+ ...$s ? [{ key: "__tasks__", kind: "tasks" }] : [],
4437
+ ...Wr ? [{ key: "__actions__", kind: "actions" }] : []
4438
4438
  ], Jt = [
4439
4439
  ...mr.filter((e) => $t(e.key) === "left"),
4440
4440
  ...mr.filter((e) => !$t(e.key)),
@@ -4445,7 +4445,7 @@ function D0({
4445
4445
  return { key: e.key, shape: Yd(t == null ? void 0 : t.type, t == null ? void 0 : t.interface) };
4446
4446
  }
4447
4447
  return { key: e.key, shape: zu[e.kind] ?? "short" };
4448
- }), Ys = [
4448
+ }), Hs = [
4449
4449
  ...Wn ? [{ key: "__state__", label: "State" }] : [],
4450
4450
  ...ve.filter((e) => Ut(e) || !ot(Ge, n, e)).map((e) => ({ key: e, label: Ze(e) }))
4451
4451
  ], oi = (e) => {
@@ -4459,20 +4459,20 @@ function D0({
4459
4459
  if (Ut(ce)) return _t(t, ce) || "(empty)";
4460
4460
  const r = e[ce];
4461
4461
  return r == null || r === "" ? "(empty)" : typeof r == "boolean" ? r ? "Yes" : "No" : xn(String(r), ce) || String(r);
4462
- }, Js = (() => {
4462
+ }, Ys = (() => {
4463
4463
  if (!ce) return Ce.map((s) => ({ kind: "row", row: s }));
4464
4464
  const e = /* @__PURE__ */ new Map();
4465
4465
  for (const s of Ce) {
4466
- const l = oi(s), o = e.get(l) ?? [];
4467
- o.push(s), e.set(l, o);
4466
+ const l = oi(s), i = e.get(l) ?? [];
4467
+ i.push(s), e.set(l, i);
4468
4468
  }
4469
4469
  const t = [...e.keys()].sort((s, l) => s === "(empty)" ? 1 : l === "(empty)" ? -1 : s.localeCompare(l, void 0, { numeric: !0 })), r = [];
4470
4470
  for (const s of t) {
4471
4471
  const l = e.get(s) ?? [];
4472
- if (r.push({ kind: "header", gkey: s, label: s, count: l.length }), !Fn.has(s)) for (const o of l) r.push({ kind: "row", row: o });
4472
+ if (r.push({ kind: "header", gkey: s, label: s, count: l.length }), !Fn.has(s)) for (const i of l) r.push({ kind: "row", row: i });
4473
4473
  }
4474
4474
  return r;
4475
- })(), [ii, di] = _(null), ci = Dc(Js, ii), fr = Jt.filter((e) => $t(e.key) === "left").map((e) => e.key), Gs = Jt.filter((e) => $t(e.key) === "right").map((e) => e.key), br = fe(/* @__PURE__ */ new Map()), [Vn, ui] = _({});
4475
+ })(), [ii, di] = _(null), ci = Dc(Ys, ii), fr = Jt.filter((e) => $t(e.key) === "left").map((e) => e.key), Js = Jt.filter((e) => $t(e.key) === "right").map((e) => e.key), br = fe(/* @__PURE__ */ new Map()), [Vn, ui] = _({});
4476
4476
  Li(() => {
4477
4477
  const e = {};
4478
4478
  for (const [r, s] of br.current)
@@ -4484,7 +4484,7 @@ function D0({
4484
4484
  return;
4485
4485
  }
4486
4486
  });
4487
- const pi = 52, Xs = (e) => {
4487
+ const pi = 52, Gs = (e) => {
4488
4488
  if ($t(e) === "left") {
4489
4489
  let s = Dt ? Vn.__checkbox__ ?? pi : 0;
4490
4490
  for (const l of fr) {
@@ -4494,7 +4494,7 @@ function D0({
4494
4494
  return Math.floor(s);
4495
4495
  }
4496
4496
  let r = 0;
4497
- for (const s of [...Gs].reverse()) {
4497
+ for (const s of [...Js].reverse()) {
4498
4498
  if (s === e) break;
4499
4499
  r += Vn[s] ?? 0;
4500
4500
  }
@@ -4502,15 +4502,15 @@ function D0({
4502
4502
  }, ct = (e, t, r) => {
4503
4503
  const s = $t(e);
4504
4504
  if (!s) return "";
4505
- const l = s === "left" && fr[fr.length - 1] === e ? "border-r border-slate-200 dark:border-slate-700" : s === "right" && Gs[0] === e ? "border-l border-slate-200 dark:border-slate-700" : "";
4505
+ const l = s === "left" && fr[fr.length - 1] === e ? "border-r border-slate-200 dark:border-slate-700" : s === "right" && Js[0] === e ? "border-l border-slate-200 dark:border-slate-700" : "";
4506
4506
  return `sticky ${t} ${r} ${l}`;
4507
4507
  }, Oe = (e) => {
4508
4508
  const t = $t(e);
4509
4509
  if (t)
4510
- return t === "left" ? { left: Xs(e) } : { right: Xs(e) };
4510
+ return t === "left" ? { left: Gs(e) } : { right: Gs(e) };
4511
4511
  }, hr = (e) => (t) => {
4512
4512
  t ? br.current.set(e, t) : br.current.delete(e);
4513
- }, Zs = {
4513
+ }, Xs = {
4514
4514
  left: "Pinned left — click to pin right",
4515
4515
  right: "Pinned right — click to unpin",
4516
4516
  none: "Pin column left"
@@ -4520,7 +4520,7 @@ function D0({
4520
4520
  const s = gr.current;
4521
4521
  if (!s) return;
4522
4522
  const l = Math.max(60, Math.min(640, s.startW + (r.clientX - s.startX)));
4523
- f((o) => ({ ...o, [s.key]: l }));
4523
+ f((i) => ({ ...i, [s.key]: l }));
4524
4524
  }, t = () => {
4525
4525
  gr.current = null, document.body.style.cursor = "";
4526
4526
  };
@@ -4548,7 +4548,7 @@ function D0({
4548
4548
  title: "Drag to resize · double-click to fit content",
4549
4549
  className: "absolute right-0 top-0 h-full w-1.5 cursor-col-resize opacity-0 transition-opacity hover:bg-nvr-cyan/40 hover:opacity-100 group-hover/hcell:opacity-60"
4550
4550
  }
4551
- ), el = (e) => Lt[e] ? { width: Lt[e], minWidth: Lt[e], maxWidth: Lt[e] } : void 0, tl = (e) => {
4551
+ ), Zs = (e) => Lt[e] ? { width: Lt[e], minWidth: Lt[e], maxWidth: Lt[e] } : void 0, el = (e) => {
4552
4552
  const t = $t(e);
4553
4553
  return /* @__PURE__ */ a(
4554
4554
  "button",
@@ -4557,8 +4557,8 @@ function D0({
4557
4557
  onClick: (r) => {
4558
4558
  r.stopPropagation(), ho(e);
4559
4559
  },
4560
- title: Zs[t ?? "none"],
4561
- "aria-label": Zs[t ?? "none"],
4560
+ title: Xs[t ?? "none"],
4561
+ "aria-label": Xs[t ?? "none"],
4562
4562
  className: `ml-1 inline-flex align-middle transition-opacity ${t ? "text-[#00a5cc] opacity-100" : "text-slate-300 opacity-0 group-hover/hcell:opacity-100 dark:text-slate-600"}`,
4563
4563
  children: /* @__PURE__ */ a(
4564
4564
  qi,
@@ -4577,10 +4577,10 @@ function D0({
4577
4577
  enabled: !!n && Je && !re && bi,
4578
4578
  staleTime: 5 * 6e4,
4579
4579
  retry: !1
4580
- }), nl = fe(!1), [, gi] = _(0);
4580
+ }), tl = fe(!1), [, gi] = _(0);
4581
4581
  pe(
4582
4582
  () => y.getQueryCache().subscribe((e) => {
4583
- if (!nl.current || e.type !== "updated" || e.action.type !== "success") return;
4583
+ if (!tl.current || e.type !== "updated" || e.action.type !== "success") return;
4584
4584
  const t = String(e.query.queryKey[0] ?? "");
4585
4585
  (t === "cbv-quick-options" || t === "cbv-filter-options" || t === "cbv-filter-selected-labels") && gi((r) => r + 1);
4586
4586
  }),
@@ -4595,7 +4595,7 @@ function D0({
4595
4595
  if (s != null && s.label) return s.label;
4596
4596
  }
4597
4597
  }, vr = (() => {
4598
- var s, l, o, b;
4598
+ var s, l, i, b;
4599
4599
  if (re) return null;
4600
4600
  let e = !1;
4601
4601
  const t = (x, v, U, j = !1) => {
@@ -4628,7 +4628,7 @@ function D0({
4628
4628
  if (!v) continue;
4629
4629
  const U = x === "__state__" ? "State" : x === "__fulfilment__" ? (Fe == null ? void 0 : Fe.label) ?? "Shipped" : x === "__integrations__" ? "Integrations" : x === "__aging__" ? "Time in state" : Ze(x), j = xe[x], Le = (j == null ? void 0 : j.type) === "number" && j.prefix === "$";
4630
4630
  if (v.kind === "in" && v.value.length) {
4631
- const D = Dr(Ge, n, x), z = (D == null ? void 0 : D.one_collection) ?? null, Y = cs[x], p = z ?? ((Y == null ? void 0 : Y.kind) === "m2m" ? Y.target : null);
4631
+ const D = Er(Ge, n, x), z = (D == null ? void 0 : D.one_collection) ?? null, Y = ds[x], p = z ?? ((Y == null ? void 0 : Y.kind) === "m2m" ? Y.target : null);
4632
4632
  r.push(
4633
4633
  p ? t(
4634
4634
  U,
@@ -4648,10 +4648,10 @@ function D0({
4648
4648
  )
4649
4649
  });
4650
4650
  else if (v.kind === "fulfilment" && Fe) {
4651
- const D = (l = El.find((z) => z.value === v.value)) == null ? void 0 : l.label;
4651
+ const D = (l = Rl.find((z) => z.value === v.value)) == null ? void 0 : l.label;
4652
4652
  D && r.push({ kind: "phrase", text: D.toLowerCase() });
4653
4653
  } else if (v.kind === "integrations") {
4654
- const D = (o = Dl.find((z) => z.value === v.value)) == null ? void 0 : o.label;
4654
+ const D = (i = El.find((z) => z.value === v.value)) == null ? void 0 : i.label;
4655
4655
  D && r.push({ kind: "is", field: U, values: [D.toLowerCase()] });
4656
4656
  } else if (v.kind === "tasks")
4657
4657
  r.push({
@@ -4697,7 +4697,7 @@ function D0({
4697
4697
  }).filter((v) => !!v);
4698
4698
  x.length > 0 && r.push({ kind: "phrase", text: `flagged ${x.join(" or ")}` });
4699
4699
  }
4700
- return nl.current = e, td({
4700
+ return tl.current = e, td({
4701
4701
  noun: (A == null ? void 0 : A.display_name) || je(n),
4702
4702
  viewName: ((b = dt.find((x) => x.id === Ht)) == null ? void 0 : b.name) ?? null,
4703
4703
  search: G,
@@ -4774,7 +4774,7 @@ function D0({
4774
4774
  ` }),
4775
4775
  /* @__PURE__ */ a(vu, {}),
4776
4776
  /* @__PURE__ */ a(kc, {}),
4777
- ie && Vl(
4777
+ ie && Wl(
4778
4778
  /* @__PURE__ */ c(
4779
4779
  "div",
4780
4780
  {
@@ -4815,7 +4815,7 @@ function D0({
4815
4815
  ]
4816
4816
  }
4817
4817
  ),
4818
- (ie.key === "__state__" || Ys.some((e) => e.key === ie.key)) && ce !== ie.key && /* @__PURE__ */ c(
4818
+ (ie.key === "__state__" || Hs.some((e) => e.key === ie.key)) && ce !== ie.key && /* @__PURE__ */ c(
4819
4819
  "button",
4820
4820
  {
4821
4821
  type: "button",
@@ -4894,7 +4894,7 @@ function D0({
4894
4894
  {
4895
4895
  confirmLabel: "Delete this record? It moves to Trash for 30 days.",
4896
4896
  onConfirm: () => {
4897
- zs.mutate(ie.row.id), Vt(null);
4897
+ Us.mutate(ie.row.id), Vt(null);
4898
4898
  },
4899
4899
  className: "block w-full truncate px-3 py-1.5 text-left text-[12px] text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-900/20",
4900
4900
  armedClassName: "whitespace-normal bg-red-50 font-semibold dark:bg-red-900/20",
@@ -5013,7 +5013,7 @@ function D0({
5013
5013
  Ec,
5014
5014
  {
5015
5015
  parent: An.parent,
5016
- value: us,
5016
+ value: cs,
5017
5017
  onChange: (e) => {
5018
5018
  ko(e), T(1);
5019
5019
  }
@@ -5027,7 +5027,7 @@ function D0({
5027
5027
  {
5028
5028
  type: "button",
5029
5029
  onClick: () => {
5030
- ms(!1), ps((t) => t === e.key ? null : e.key);
5030
+ ps(!1), us((t) => t === e.key ? null : e.key);
5031
5031
  },
5032
5032
  "aria-pressed": qt === e.key,
5033
5033
  "data-cbv-view-toggle": e.key,
@@ -5045,7 +5045,7 @@ function D0({
5045
5045
  {
5046
5046
  type: "button",
5047
5047
  onClick: () => {
5048
- ps(null), ms((e) => !e);
5048
+ us(null), ps((e) => !e);
5049
5049
  },
5050
5050
  title: la ? "Back to the table" : "Show these records on a map",
5051
5051
  className: `flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-[12px] font-medium ${la ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
@@ -5109,7 +5109,7 @@ function D0({
5109
5109
  "button",
5110
5110
  {
5111
5111
  type: "button",
5112
- onClick: () => Ar((t) => t.filter((r) => r.id !== e.id)),
5112
+ onClick: () => Or((t) => t.filter((r) => r.id !== e.id)),
5113
5113
  "aria-label": "Remove exclusion",
5114
5114
  className: "rounded-full p-0.5 hover:bg-red-100 dark:hover:bg-red-500/20",
5115
5115
  children: /* @__PURE__ */ a(_r, { className: "h-3 w-3" })
@@ -5148,7 +5148,7 @@ function D0({
5148
5148
  onClick: () => mn((e) => !e),
5149
5149
  className: `flex h-8 items-center gap-1 rounded-md border px-2.5 text-[12px] font-medium ${ce ? "border-nvr-cyan/40 bg-nvr-cyan/[0.08] text-[#007a99] dark:text-nvr-cyan" : "border-slate-200 text-slate-500 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400"}`,
5150
5150
  children: [
5151
- /* @__PURE__ */ a(vl, { className: "h-3.5 w-3.5" }),
5151
+ /* @__PURE__ */ a(xl, { className: "h-3.5 w-3.5" }),
5152
5152
  ce ? `Group: ${ce === "__state__" ? "State" : Ze(ce)}` : "Group"
5153
5153
  ]
5154
5154
  }
@@ -5163,7 +5163,7 @@ function D0({
5163
5163
  children: "No grouping"
5164
5164
  }
5165
5165
  ),
5166
- Ys.map((e) => /* @__PURE__ */ a(
5166
+ Hs.map((e) => /* @__PURE__ */ a(
5167
5167
  "button",
5168
5168
  {
5169
5169
  type: "button",
@@ -5198,10 +5198,10 @@ function D0({
5198
5198
  "aria-label": "Row density",
5199
5199
  title: tn === "compact" ? "Switch to comfortable rows" : "Switch to compact rows",
5200
5200
  className: "flex h-8 w-8 items-center justify-center rounded-md border border-slate-200 text-slate-500 hover:bg-slate-100 hover:text-slate-700 dark:border-slate-700 dark:text-slate-400 dark:hover:bg-slate-800",
5201
- children: tn === "compact" ? /* @__PURE__ */ a(vl, { className: "h-4 w-4" }) : /* @__PURE__ */ a(wi, { className: "h-4 w-4" })
5201
+ children: tn === "compact" ? /* @__PURE__ */ a(xl, { className: "h-4 w-4" }) : /* @__PURE__ */ a(wi, { className: "h-4 w-4" })
5202
5202
  }
5203
5203
  ),
5204
- /* @__PURE__ */ c("div", { className: "relative", ref: Br, children: [
5204
+ /* @__PURE__ */ c("div", { className: "relative", ref: jr, children: [
5205
5205
  /* @__PURE__ */ a(
5206
5206
  "button",
5207
5207
  {
@@ -5229,8 +5229,8 @@ function D0({
5229
5229
  s.preventDefault();
5230
5230
  const l = It.current;
5231
5231
  if (It.current = null, l == null || l === t) return;
5232
- const o = [...ve], [b] = o.splice(l, 1);
5233
- o.splice(t, 0, b), at(o);
5232
+ const i = [...ve], [b] = i.splice(l, 1);
5233
+ i.splice(t, 0, b), at(i);
5234
5234
  },
5235
5235
  className: "group flex items-center gap-1.5 rounded px-1.5 py-1 hover:bg-slate-50 dark:hover:bg-slate-800",
5236
5236
  children: [
@@ -5249,8 +5249,8 @@ function D0({
5249
5249
  value: Ie[e] ?? "",
5250
5250
  placeholder: e.includes(".") ? e.split(".").map(je).join(" › ") : je(e),
5251
5251
  onChange: (s) => Pe((l) => {
5252
- const o = { ...l };
5253
- return s.target.value ? o[e] = s.target.value : delete o[e], o;
5252
+ const i = { ...l };
5253
+ return s.target.value ? i[e] = s.target.value : delete i[e], i;
5254
5254
  }),
5255
5255
  onKeyDown: (s) => {
5256
5256
  (s.key === "Enter" || s.key === "Escape") && ee(null);
@@ -5317,8 +5317,8 @@ function D0({
5317
5317
  {
5318
5318
  type: "button",
5319
5319
  onClick: () => {
5320
- rt((o) => {
5321
- const b = { ...o };
5320
+ rt((i) => {
5321
+ const b = { ...i };
5322
5322
  return s.cfg ? b[e] = s.cfg : delete b[e], b;
5323
5323
  }), ae(null);
5324
5324
  },
@@ -5336,8 +5336,8 @@ function D0({
5336
5336
  onKeyDown: (s) => {
5337
5337
  if (s.key === "Enter") {
5338
5338
  const l = s.target.value.trim();
5339
- l && rt((o) => ({
5340
- ...o,
5339
+ l && rt((i) => ({
5340
+ ...i,
5341
5341
  [e]: { type: "datetime", template: l }
5342
5342
  })), ae(null);
5343
5343
  }
@@ -5358,10 +5358,10 @@ function D0({
5358
5358
  {
5359
5359
  ariaLabel: "Rule operator",
5360
5360
  value: s.op,
5361
- onChange: (o) => te((b) => ({
5361
+ onChange: (i) => te((b) => ({
5362
5362
  ...b,
5363
5363
  [e]: (b[e] ?? []).map(
5364
- (x, v) => v === l ? { ...x, op: o } : x
5364
+ (x, v) => v === l ? { ...x, op: i } : x
5365
5365
  )
5366
5366
  })),
5367
5367
  options: [
@@ -5379,46 +5379,46 @@ function D0({
5379
5379
  "input",
5380
5380
  {
5381
5381
  value: s.value ?? "",
5382
- onChange: (o) => te((b) => ({
5382
+ onChange: (i) => te((b) => ({
5383
5383
  ...b,
5384
5384
  [e]: (b[e] ?? []).map(
5385
- (x, v) => v === l ? { ...x, value: o.target.value } : x
5385
+ (x, v) => v === l ? { ...x, value: i.target.value } : x
5386
5386
  )
5387
5387
  })),
5388
5388
  placeholder: "value",
5389
5389
  className: "h-5 w-16 rounded border border-slate-200 bg-white px-1 text-[10.5px] dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100"
5390
5390
  }
5391
5391
  ),
5392
- ["red", "amber", "green", "blue"].map((o) => /* @__PURE__ */ a(
5392
+ ["red", "amber", "green", "blue"].map((i) => /* @__PURE__ */ a(
5393
5393
  "button",
5394
5394
  {
5395
5395
  type: "button",
5396
- "aria-label": o,
5396
+ "aria-label": i,
5397
5397
  onClick: () => te((b) => ({
5398
5398
  ...b,
5399
5399
  [e]: (b[e] ?? []).map(
5400
- (x, v) => v === l ? { ...x, color: o } : x
5400
+ (x, v) => v === l ? { ...x, color: i } : x
5401
5401
  )
5402
5402
  })),
5403
5403
  className: Xt(
5404
5404
  "h-3.5 w-3.5 rounded-full border",
5405
- o === "red" && "bg-red-500",
5406
- o === "amber" && "bg-amber-400",
5407
- o === "green" && "bg-emerald-500",
5408
- o === "blue" && "bg-sky-500",
5409
- s.color === o ? "border-slate-700 ring-1 ring-slate-400 dark:border-white" : "border-transparent opacity-50"
5405
+ i === "red" && "bg-red-500",
5406
+ i === "amber" && "bg-amber-400",
5407
+ i === "green" && "bg-emerald-500",
5408
+ i === "blue" && "bg-sky-500",
5409
+ s.color === i ? "border-slate-700 ring-1 ring-slate-400 dark:border-white" : "border-transparent opacity-50"
5410
5410
  )
5411
5411
  },
5412
- o
5412
+ i
5413
5413
  )),
5414
5414
  /* @__PURE__ */ a(
5415
5415
  "button",
5416
5416
  {
5417
5417
  type: "button",
5418
5418
  "aria-label": "Remove rule",
5419
- onClick: () => te((o) => ({
5420
- ...o,
5421
- [e]: (o[e] ?? []).filter((b, x) => x !== l)
5419
+ onClick: () => te((i) => ({
5420
+ ...i,
5421
+ [e]: (i[e] ?? []).filter((b, x) => x !== l)
5422
5422
  })),
5423
5423
  className: "ml-auto text-slate-300 hover:text-slate-500",
5424
5424
  children: "✕"
@@ -5533,8 +5533,8 @@ function D0({
5533
5533
  "button",
5534
5534
  {
5535
5535
  type: "button",
5536
- onClick: () => Us.mutate(),
5537
- disabled: Us.isPending,
5536
+ onClick: () => Bs.mutate(),
5537
+ disabled: Bs.isPending,
5538
5538
  title: "Save the current columns/filters/sort as the collection default view",
5539
5539
  className: "inline-flex items-center gap-1 text-[11.5px] text-slate-500 hover:text-[#00a5cc] disabled:opacity-40 dark:text-slate-400",
5540
5540
  children: [
@@ -5547,7 +5547,7 @@ function D0({
5547
5547
  ] })
5548
5548
  ] })
5549
5549
  ] }),
5550
- /* @__PURE__ */ c("div", { className: "relative", ref: jr, children: [
5550
+ /* @__PURE__ */ c("div", { className: "relative", ref: Kr, children: [
5551
5551
  /* @__PURE__ */ a(
5552
5552
  "button",
5553
5553
  {
@@ -5578,23 +5578,23 @@ function D0({
5578
5578
  var s;
5579
5579
  fn(!1);
5580
5580
  const e = ve, t = e.map((l) => Ze(l)).join(" "), r = Ce.map(
5581
- (l) => e.map((o) => {
5582
- const b = Ut(o) ? xn(_t(l.id, o) ?? "", o, l.id) : xn(String(l[o] ?? ""), o, l.id);
5581
+ (l) => e.map((i) => {
5582
+ const b = Ut(i) ? xn(_t(l.id, i) ?? "", i, l.id) : xn(String(l[i] ?? ""), i, l.id);
5583
5583
  return String(b ?? "").replace(/[\t\n]/g, " ");
5584
5584
  }).join(" ")
5585
5585
  ).join(`
5586
5586
  `);
5587
5587
  (s = navigator.clipboard) == null || s.writeText(`${t}
5588
5588
  ${r}`).then(() => {
5589
- Kr(!0), setTimeout(() => Kr(!1), 2e3);
5589
+ Ir(!0), setTimeout(() => Ir(!1), 2e3);
5590
5590
  });
5591
5591
  },
5592
5592
  className: "block w-full rounded-md px-2.5 py-1.5 text-left text-[12.5px] text-slate-700 hover:bg-muted dark:text-slate-200",
5593
5593
  children: ao ? "Copied ✓" : "Copy table to clipboard"
5594
5594
  }
5595
5595
  ),
5596
- As.length > 0 && /* @__PURE__ */ a("p", { className: "border-t border-slate-100 px-2.5 pb-0.5 pt-1.5 text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:border-border/60", children: "Presets (server, current filters apply)" }),
5597
- As.map((e) => {
5596
+ Os.length > 0 && /* @__PURE__ */ a("p", { className: "border-t border-slate-100 px-2.5 pb-0.5 pt-1.5 text-[10px] font-semibold uppercase tracking-wide text-slate-400 dark:border-border/60", children: "Presets (server, current filters apply)" }),
5597
+ Os.map((e) => {
5598
5598
  var t;
5599
5599
  return /* @__PURE__ */ c("div", { className: "flex items-center", children: [
5600
5600
  /* @__PURE__ */ c(
@@ -5631,9 +5631,9 @@ ${r}`).then(() => {
5631
5631
  "input",
5632
5632
  {
5633
5633
  value: fa,
5634
- onChange: (e) => Is(e.target.value),
5634
+ onChange: (e) => As(e.target.value),
5635
5635
  onKeyDown: (e) => {
5636
- e.key === "Enter" && Ks();
5636
+ e.key === "Enter" && Is();
5637
5637
  },
5638
5638
  placeholder: "Save columns as preset…",
5639
5639
  className: "h-6 min-w-0 flex-1 rounded border border-slate-200 bg-background px-1.5 text-[11.5px] dark:border-border"
@@ -5644,7 +5644,7 @@ ${r}`).then(() => {
5644
5644
  {
5645
5645
  type: "button",
5646
5646
  disabled: !fa.trim(),
5647
- onClick: () => void Ks(),
5647
+ onClick: () => void Is(),
5648
5648
  className: "h-6 shrink-0 rounded bg-nvr-cyan px-2 text-[11px] font-semibold text-white disabled:opacity-40",
5649
5649
  children: "Save"
5650
5650
  }
@@ -5661,7 +5661,7 @@ ${r}`).then(() => {
5661
5661
  className: "flex h-8 items-center gap-1 rounded-md bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white hover:brightness-105",
5662
5662
  children: [
5663
5663
  "+ ",
5664
- Hr,
5664
+ Vr,
5665
5665
  /* @__PURE__ */ a(Jn, { className: "h-3.5 w-3.5" })
5666
5666
  ]
5667
5667
  }
@@ -5671,7 +5671,7 @@ ${r}`).then(() => {
5671
5671
  {
5672
5672
  key: "default",
5673
5673
  slug: null,
5674
- label: ((ll = na.active) == null ? void 0 : ll.create_label) ?? ((ol = na.active) == null ? void 0 : ol.name) ?? "Default layout",
5674
+ label: ((sl = na.active) == null ? void 0 : sl.create_label) ?? ((ll = na.active) == null ? void 0 : ll.name) ?? "Default layout",
5675
5675
  isDefault: !0,
5676
5676
  steps: Ka
5677
5677
  },
@@ -5692,7 +5692,7 @@ ${r}`).then(() => {
5692
5692
  {
5693
5693
  type: "button",
5694
5694
  onClick: () => {
5695
- Pn(!1), Yr(e.slug);
5695
+ Pn(!1), Hr(e.slug);
5696
5696
  },
5697
5697
  className: "flex min-w-0 flex-1 items-center px-2 py-1.5 text-left text-[12px] text-slate-700 dark:text-slate-200",
5698
5698
  children: [
@@ -5712,7 +5712,7 @@ ${r}`).then(() => {
5712
5712
  },
5713
5713
  className: "mr-1 flex h-6 shrink-0 items-center gap-1 rounded px-1.5 text-[11px] font-medium text-slate-400 hover:bg-nvr-cyan/10 hover:text-nvr-navy dark:hover:text-nvr-cyan",
5714
5714
  children: [
5715
- /* @__PURE__ */ a(kl, { className: "h-3 w-3" }),
5715
+ /* @__PURE__ */ a(vl, { className: "h-3 w-3" }),
5716
5716
  "Quick pick"
5717
5717
  ]
5718
5718
  }
@@ -5721,21 +5721,21 @@ ${r}`).then(() => {
5721
5721
  },
5722
5722
  e.key
5723
5723
  )),
5724
- ((il = Mn.data) == null ? void 0 : il.enabled) && /* @__PURE__ */ c(Qe, { children: [
5724
+ ((ol = Mn.data) == null ? void 0 : ol.enabled) && /* @__PURE__ */ c(Qe, { children: [
5725
5725
  /* @__PURE__ */ a("div", { className: "my-1 border-t border-slate-100 dark:border-border" }),
5726
5726
  /* @__PURE__ */ c(
5727
5727
  "button",
5728
5728
  {
5729
5729
  type: "button",
5730
5730
  "data-cbv-new-from-document": !0,
5731
- disabled: Gr,
5731
+ disabled: Jr,
5732
5732
  onClick: () => {
5733
- Pn(!1), Zr(null);
5733
+ Pn(!1), Xr(null);
5734
5734
  },
5735
5735
  className: "flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-[12px] text-slate-700 hover:bg-slate-100 disabled:opacity-60 dark:text-slate-200 dark:hover:bg-muted",
5736
5736
  title: "Upload a SOW, quote or spreadsheet — the new record opens with what it says proposed",
5737
5737
  children: [
5738
- /* @__PURE__ */ a(yl, { className: "h-3.5 w-3.5 text-slate-400" }),
5738
+ /* @__PURE__ */ a(kl, { className: "h-3.5 w-3.5 text-slate-400" }),
5739
5739
  "New from document…"
5740
5740
  ]
5741
5741
  }
@@ -5747,15 +5747,15 @@ ${r}`).then(() => {
5747
5747
  "button",
5748
5748
  {
5749
5749
  type: "button",
5750
- ref: es,
5751
- onClick: () => Yr(null),
5750
+ ref: Zr,
5751
+ onClick: () => Hr(null),
5752
5752
  className: Xt(
5753
5753
  "h-8 bg-nvr-cyan px-3 text-[12.5px] font-semibold text-white hover:brightness-105",
5754
- Ka.length > 0 || (dl = Mn.data) != null && dl.enabled ? "rounded-l-md" : "rounded-md"
5754
+ Ka.length > 0 || (il = Mn.data) != null && il.enabled ? "rounded-l-md" : "rounded-md"
5755
5755
  ),
5756
5756
  children: [
5757
5757
  "+ ",
5758
- Hr
5758
+ Vr
5759
5759
  ]
5760
5760
  }
5761
5761
  ),
@@ -5769,31 +5769,31 @@ ${r}`).then(() => {
5769
5769
  onClick: () => aa({ slug: null }),
5770
5770
  className: Xt(
5771
5771
  "flex h-8 items-center border-l border-white/30 bg-nvr-cyan px-2 text-white hover:brightness-105",
5772
- !((cl = Mn.data) != null && cl.enabled) && "rounded-r-md"
5772
+ !((dl = Mn.data) != null && dl.enabled) && "rounded-r-md"
5773
5773
  ),
5774
- children: /* @__PURE__ */ a(kl, { className: "h-3.5 w-3.5" })
5774
+ children: /* @__PURE__ */ a(vl, { className: "h-3.5 w-3.5" })
5775
5775
  }
5776
5776
  ),
5777
- ((ul = Mn.data) == null ? void 0 : ul.enabled) && /* @__PURE__ */ a(
5777
+ ((cl = Mn.data) == null ? void 0 : cl.enabled) && /* @__PURE__ */ a(
5778
5778
  "button",
5779
5779
  {
5780
5780
  type: "button",
5781
5781
  "data-cbv-new-from-document": !0,
5782
- disabled: Gr,
5782
+ disabled: Jr,
5783
5783
  title: "New from document — upload a SOW, quote or spreadsheet and review what it proposes",
5784
5784
  "aria-label": "New from document",
5785
- onClick: () => Zr(null),
5785
+ onClick: () => Xr(null),
5786
5786
  className: "flex h-8 items-center rounded-r-md border-l border-white/30 bg-nvr-cyan px-2 text-white hover:brightness-105 disabled:opacity-60",
5787
- children: /* @__PURE__ */ a(yl, { className: "h-3.5 w-3.5" })
5787
+ children: /* @__PURE__ */ a(kl, { className: "h-3.5 w-3.5" })
5788
5788
  }
5789
5789
  )
5790
5790
  ] })),
5791
5791
  /* @__PURE__ */ a(
5792
5792
  "input",
5793
5793
  {
5794
- ref: Jr,
5794
+ ref: Yr,
5795
5795
  type: "file",
5796
- accept: (((pl = Mn.data) == null ? void 0 : pl.accept) ?? []).join(","),
5796
+ accept: (((ul = Mn.data) == null ? void 0 : ul.accept) ?? []).join(","),
5797
5797
  multiple: !0,
5798
5798
  className: "hidden",
5799
5799
  onChange: co,
@@ -5811,7 +5811,7 @@ ${r}`).then(() => {
5811
5811
  e || aa(null);
5812
5812
  },
5813
5813
  noun: (A == null ? void 0 : A.singular) ?? "record",
5814
- anchorEl: ja.current ?? es.current,
5814
+ anchorEl: ja.current ?? Zr.current,
5815
5815
  onDone: (e) => {
5816
5816
  aa(null), Q({ collection: n, itemId: "new", layoutSlug: Ia.slug, prefill: e });
5817
5817
  }
@@ -5842,7 +5842,7 @@ ${r}`).then(() => {
5842
5842
  Eu,
5843
5843
  {
5844
5844
  def: e,
5845
- allowedIds: ts(e),
5845
+ allowedIds: es(e),
5846
5846
  scopeDefault: qn.has(e.key),
5847
5847
  narrowBy: Pt.filter((t) => t.key !== e.key && t.collection).map((t) => ({
5848
5848
  collection: t.collection,
@@ -5891,7 +5891,7 @@ ${r}`).then(() => {
5891
5891
  "button",
5892
5892
  {
5893
5893
  type: "button",
5894
- onClick: Os,
5894
+ onClick: Ms,
5895
5895
  className: `inline-flex h-6 items-center rounded-full border px-2.5 text-[12px] transition-colors ${Ht == null ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-slate-900 dark:text-white" : "border-slate-200 bg-white text-slate-600 hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300"}`,
5896
5896
  children: "Default"
5897
5897
  }
@@ -5954,7 +5954,7 @@ ${r}`).then(() => {
5954
5954
  children: ha(e.id) ? /* @__PURE__ */ a(_i, { className: "h-3 w-3", fill: "currentColor" }) : /* @__PURE__ */ a(Ni, { className: "h-3 w-3" })
5955
5955
  }
5956
5956
  ),
5957
- Ns(e) && /* @__PURE__ */ a(
5957
+ _s(e) && /* @__PURE__ */ a(
5958
5958
  "button",
5959
5959
  {
5960
5960
  type: "button",
@@ -5965,7 +5965,7 @@ ${r}`).then(() => {
5965
5965
  "data-view-update": e.id,
5966
5966
  "data-view-update-state": zt.isPending && zt.variables === e.id ? "saving" : ur === e.id ? "saved" : "idle",
5967
5967
  className: "inline-flex h-3.5 w-3.5 items-center justify-center",
5968
- children: zt.isPending && zt.variables === e.id ? /* @__PURE__ */ a(wl, { className: "h-3 w-3 animate-spin" }) : ur === e.id ? /* @__PURE__ */ a(
5968
+ children: zt.isPending && zt.variables === e.id ? /* @__PURE__ */ a(yl, { className: "h-3 w-3 animate-spin" }) : ur === e.id ? /* @__PURE__ */ a(
5969
5969
  Si,
5970
5970
  {
5971
5971
  className: "h-3 w-3 text-emerald-600 dark:text-emerald-400",
@@ -5984,7 +5984,7 @@ ${r}`).then(() => {
5984
5984
  onRoleDefault: (t) => Ho.mutate({ id: e.id, role: t })
5985
5985
  }
5986
5986
  ),
5987
- Ns(e) && (Ct || !(e.is_default || e.default_for_role)) && /* @__PURE__ */ a(
5987
+ _s(e) && (Ct || !(e.is_default || e.default_for_role)) && /* @__PURE__ */ a(
5988
5988
  Fr,
5989
5989
  {
5990
5990
  title: `Delete view ${e.name}`,
@@ -6056,15 +6056,15 @@ ${r}`).then(() => {
6056
6056
  "button",
6057
6057
  {
6058
6058
  type: "button",
6059
- disabled: fs,
6059
+ disabled: ms,
6060
6060
  onClick: () => void u.request(he("/access-requests", { collection: n })).then(() => yo(!0)).catch(() => {
6061
6061
  }),
6062
6062
  className: "h-7 shrink-0 rounded-md border border-red-300 px-2.5 text-[12px] font-medium hover:bg-red-100 disabled:opacity-60 dark:border-red-500/40 dark:hover:bg-red-900/20",
6063
6063
  "data-request-access": !0,
6064
- children: fs ? "Requested — an admin was notified" : "Request access"
6064
+ children: ms ? "Requested — an admin was notified" : "Request access"
6065
6065
  }
6066
6066
  ),
6067
- Rl(et).map((e) => /* @__PURE__ */ c(
6067
+ Fl(et).map((e) => /* @__PURE__ */ c(
6068
6068
  "button",
6069
6069
  {
6070
6070
  type: "button",
@@ -6082,7 +6082,7 @@ ${r}`).then(() => {
6082
6082
  },
6083
6083
  e
6084
6084
  )),
6085
- (et == null ? void 0 : et.status) !== 403 && Rl(et).length === 0 && /* @__PURE__ */ a(
6085
+ (et == null ? void 0 : et.status) !== 403 && Fl(et).length === 0 && /* @__PURE__ */ a(
6086
6086
  "button",
6087
6087
  {
6088
6088
  type: "button",
@@ -6105,7 +6105,7 @@ ${r}`).then(() => {
6105
6105
  prefill: { [In.parent_field]: e }
6106
6106
  }) : void 0
6107
6107
  }
6108
- ) }) }) : qt && (K != null && K.some((e) => e.key === qt)) ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", "data-cbv-extra-view": qt, children: (ml = K.find((e) => e.key === qt)) == null ? void 0 : ml.render() }) : null,
6108
+ ) }) }) : qt && (K != null && K.some((e) => e.key === qt)) ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", "data-cbv-extra-view": qt, children: (pl = K.find((e) => e.key === qt)) == null ? void 0 : pl.render() }) : null,
6109
6109
  la && hn ? /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a(
6110
6110
  du,
6111
6111
  {
@@ -6142,13 +6142,13 @@ ${r}`).then(() => {
6142
6142
  yt && !oa && /* @__PURE__ */ a("div", { className: "cbv-progress pointer-events-none absolute inset-x-0 top-0 z-[6] h-[3px] overflow-hidden" }),
6143
6143
  yt && !oa && Wa && /* @__PURE__ */ a(Qe, { children: /* @__PURE__ */ a("div", { className: "cbv-overlay nvr-fade-in pointer-events-none absolute inset-0 z-[5] flex items-start justify-center bg-white/40 pt-24 dark:bg-slate-950/35", children: /* @__PURE__ */ c("span", { className: "nvr-pop-in flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-[12px] font-medium text-slate-600 shadow-lg dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", children: [
6144
6144
  /* @__PURE__ */ a(yr, { "aria-hidden": !0, className: "h-3.5 w-3.5 animate-spin text-[#00a5cc]" }),
6145
- _s != null ? `${Ga.text ?? "Still working"} — ${_s}s` : "Loading…"
6145
+ ws != null ? `${Ga.text ?? "Still working"} — ${ws}s` : "Loading…"
6146
6146
  ] }) }) }),
6147
6147
  oa && Ga.slow && /* @__PURE__ */ a("div", { className: "pointer-events-none absolute inset-x-0 top-12 z-[6] flex justify-center px-4", children: /* @__PURE__ */ a(xu, { reason: Ga, variant: "pill" }) }),
6148
6148
  /* @__PURE__ */ a(
6149
6149
  "div",
6150
6150
  {
6151
- ref: Ur,
6151
+ ref: Br,
6152
6152
  "data-cbv-scroll": !0,
6153
6153
  className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden",
6154
6154
  children: ve.length === 0 ? /* @__PURE__ */ c("div", { className: "p-0", children: [
@@ -6183,7 +6183,7 @@ ${r}`).then(() => {
6183
6183
  ref: hr("__checkbox__"),
6184
6184
  className: "sticky left-0 top-0 z-[4] h-8 w-11 bg-slate-50 py-0 pl-1.5 pr-3 dark:bg-slate-800",
6185
6185
  children: /* @__PURE__ */ c("span", { className: "flex items-center gap-1", children: [
6186
- /* @__PURE__ */ a(Al, { change: null }),
6186
+ /* @__PURE__ */ a(Ol, { change: null }),
6187
6187
  vt && /* @__PURE__ */ a(
6188
6188
  "input",
6189
6189
  {
@@ -6208,25 +6208,25 @@ ${r}`).then(() => {
6208
6208
  className: `${s} text-left ${e.kind === "actions" ? "w-20 px-2" : ""} ${l}`,
6209
6209
  children: [
6210
6210
  D,
6211
- tl(t)
6211
+ el(t)
6212
6212
  ]
6213
6213
  },
6214
6214
  t
6215
6215
  );
6216
6216
  }
6217
- const o = kt.get(t), b = !!(o != null && o.computed_formula && !o.computed_store && !o.sql_filterable), x = Ut(t) || b, v = !x && (X === t || X === `-${t}` || X.replace(/^-/, "").startsWith(`${t}.`)), U = X.startsWith("-") && v, j = kt.get(t), Le = Ze(t);
6217
+ const i = kt.get(t), b = !!(i != null && i.computed_formula && !i.computed_store && !i.sql_filterable), x = Ut(t) || b, v = !x && (X === t || X === `-${t}` || X.replace(/^-/, "").startsWith(`${t}.`)), U = X.startsWith("-") && v, j = kt.get(t), Le = Ze(t);
6218
6218
  return /* @__PURE__ */ c(
6219
6219
  "th",
6220
6220
  {
6221
6221
  ref: r ? hr(t) : void 0,
6222
- style: { ...el(t), ...Oe(t) },
6222
+ style: { ...Zs(t), ...Oe(t) },
6223
6223
  onClick: () => {
6224
- x || Qs(t);
6224
+ x || zs(t);
6225
6225
  },
6226
6226
  "aria-sort": x ? void 0 : v ? U ? "descending" : "ascending" : "none",
6227
6227
  tabIndex: x ? void 0 : 0,
6228
6228
  onKeyDown: (D) => {
6229
- x || D.target !== D.currentTarget || (D.key === "Enter" || D.key === " ") && (D.preventDefault(), Qs(t));
6229
+ x || D.target !== D.currentTarget || (D.key === "Enter" || D.key === " ") && (D.preventDefault(), zs(t));
6230
6230
  },
6231
6231
  className: `${s} relative ${dr(t) ? "text-right" : "text-left"} ${x ? "" : "cursor-pointer hover:text-slate-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan"} ${l}`,
6232
6232
  children: [
@@ -6248,7 +6248,7 @@ ${r}`).then(() => {
6248
6248
  children: v ? U ? "▼" : "▲" : "⇅"
6249
6249
  }
6250
6250
  ),
6251
- tl(t),
6251
+ el(t),
6252
6252
  fi(t)
6253
6253
  ]
6254
6254
  },
@@ -6267,27 +6267,27 @@ ${r}`).then(() => {
6267
6267
  {
6268
6268
  block: !0,
6269
6269
  label: "All",
6270
- options: ((wt == null ? void 0 : wt.states) ?? []).map((o) => ({
6271
- value: o.key,
6272
- label: o.label ?? o.key
6270
+ options: ((wt == null ? void 0 : wt.states) ?? []).map((i) => ({
6271
+ value: i.key,
6272
+ label: i.label ?? i.key
6273
6273
  })),
6274
6274
  selected: ((l = Ve.__state__) == null ? void 0 : l.kind) === "state" ? Ve.__state__.value : [],
6275
- onChange: (o) => ze(
6275
+ onChange: (i) => ze(
6276
6276
  "__state__",
6277
- o.length ? { kind: "state", value: o.map(String) } : null
6277
+ i.length ? { kind: "state", value: i.map(String) } : null
6278
6278
  )
6279
6279
  }
6280
6280
  ) }, t);
6281
6281
  if (e.kind === "fulfilment") {
6282
- const o = Ve.__fulfilment__;
6282
+ const i = Ve.__fulfilment__;
6283
6283
  return /* @__PURE__ */ a("th", { style: Oe(t), className: s, children: /* @__PURE__ */ a(
6284
6284
  Nn,
6285
6285
  {
6286
6286
  ariaLabel: "Shipped filter",
6287
- value: (o == null ? void 0 : o.kind) === "fulfilment" ? o.value : "",
6287
+ value: (i == null ? void 0 : i.kind) === "fulfilment" ? i.value : "",
6288
6288
  options: [
6289
6289
  { value: "", label: "All" },
6290
- ...El.filter(
6290
+ ...Rl.filter(
6291
6291
  (b) => b.value !== "complete" || !!(Fe != null && Fe.remaining_field)
6292
6292
  )
6293
6293
  ],
@@ -6302,7 +6302,7 @@ ${r}`).then(() => {
6302
6302
  ) }, t);
6303
6303
  }
6304
6304
  if (e.kind === "aging") {
6305
- const o = Ve.__aging__;
6305
+ const i = Ve.__aging__;
6306
6306
  return /* @__PURE__ */ a(
6307
6307
  "th",
6308
6308
  {
@@ -6319,7 +6319,7 @@ ${r}`).then(() => {
6319
6319
  type: "range",
6320
6320
  range_unit: "h"
6321
6321
  },
6322
- value: (o == null ? void 0 : o.kind) === "aging" ? o.value : "",
6322
+ value: (i == null ? void 0 : i.kind) === "aging" ? i.value : "",
6323
6323
  onChange: (b) => {
6324
6324
  const x = typeof b == "string" ? b : "";
6325
6325
  ze(
@@ -6334,7 +6334,7 @@ ${r}`).then(() => {
6334
6334
  );
6335
6335
  }
6336
6336
  if (e.kind === "integrations") {
6337
- const o = Ve.__integrations__, b = (o == null ? void 0 : o.kind) === "integrations" ? o.value : "";
6337
+ const i = Ve.__integrations__, b = (i == null ? void 0 : i.kind) === "integrations" ? i.value : "";
6338
6338
  return /* @__PURE__ */ a(
6339
6339
  "th",
6340
6340
  {
@@ -6348,7 +6348,7 @@ ${r}`).then(() => {
6348
6348
  value: b,
6349
6349
  options: [
6350
6350
  { value: "", label: "All" },
6351
- ...Dl
6351
+ ...El
6352
6352
  ],
6353
6353
  onChange: (x) => ze(
6354
6354
  "__integrations__",
@@ -6364,7 +6364,7 @@ ${r}`).then(() => {
6364
6364
  );
6365
6365
  }
6366
6366
  if (e.kind === "tasks") {
6367
- const o = Ve.__tasks__, b = (o == null ? void 0 : o.kind) === "tasks" ? o.value : "";
6367
+ const i = Ve.__tasks__, b = (i == null ? void 0 : i.kind) === "tasks" ? i.value : "";
6368
6368
  return /* @__PURE__ */ a(
6369
6369
  "th",
6370
6370
  {
@@ -6414,14 +6414,14 @@ ${r}`).then(() => {
6414
6414
  rowClassName: "h-8",
6415
6415
  cellClassName: "px-3 py-1.5",
6416
6416
  leadingCells: Dt ? 1 : 0,
6417
- cellStyle: (e) => ({ ...el(e), ...Oe(e) }),
6417
+ cellStyle: (e) => ({ ...Zs(e), ...Oe(e) }),
6418
6418
  barClassName: "cbv-shimmer"
6419
6419
  }
6420
6420
  )
6421
6421
  ) : Ce.length === 0 ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a(
6422
6422
  "td",
6423
6423
  {
6424
- colSpan: ve.length + Hs,
6424
+ colSpan: ve.length + Vs,
6425
6425
  className: "nvr-fade-in py-16",
6426
6426
  children: (() => {
6427
6427
  const e = Be.length === 0 && Object.keys(Ve).length === 0 && !Object.values(gt).some((r) => r.length > 0) && !G, t = A == null ? void 0 : A.empty_state;
@@ -6444,7 +6444,7 @@ ${r}`).then(() => {
6444
6444
  }
6445
6445
  return et != null ? null : /* @__PURE__ */ c("div", { className: "flex flex-col items-center gap-2 text-center", children: [
6446
6446
  /* @__PURE__ */ a("span", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800", children: /* @__PURE__ */ a(
6447
- Wl,
6447
+ Ql,
6448
6448
  {
6449
6449
  "aria-hidden": !0,
6450
6450
  className: "h-4.5 w-4.5 h-5 w-5 text-slate-400"
@@ -6492,7 +6492,7 @@ ${r}`).then(() => {
6492
6492
  ] });
6493
6493
  })()
6494
6494
  }
6495
- ) }) : Js.map((e, t) => {
6495
+ ) }) : Ys.map((e, t) => {
6496
6496
  var z;
6497
6497
  const r = { animationDelay: `${Math.min(t, 14) * 16}ms` };
6498
6498
  if (e.kind === "header")
@@ -6509,7 +6509,7 @@ ${r}`).then(() => {
6509
6509
  "td",
6510
6510
  {
6511
6511
  className: "px-3 py-1.5",
6512
- colSpan: ve.length + Hs,
6512
+ colSpan: ve.length + Vs,
6513
6513
  children: /* @__PURE__ */ c("span", { className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 dark:text-slate-200", children: [
6514
6514
  /* @__PURE__ */ a(
6515
6515
  Jn,
@@ -6525,7 +6525,7 @@ ${r}`).then(() => {
6525
6525
  },
6526
6526
  `__group__${e.gkey}`
6527
6527
  );
6528
- const s = e.row, l = s.id, o = an.includes(l), b = (z = Re == null ? void 0 : Re.instances) == null ? void 0 : z[String(l)], x = Lo[String(l)], v = lr == null ? void 0 : lr[String(l)], U = qo.get(String(l)) ?? null, j = Ro(n, l), Le = !o && x ? Wd(x.color) : void 0, D = o ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Le ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
6528
+ const s = e.row, l = s.id, i = an.includes(l), b = (z = Re == null ? void 0 : Re.instances) == null ? void 0 : z[String(l)], x = Lo[String(l)], v = lr == null ? void 0 : lr[String(l)], U = qo.get(String(l)) ?? null, j = Ro(n, l), Le = !i && x ? Wd(x.color) : void 0, D = i ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : Le ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
6529
6529
  return /* @__PURE__ */ c(
6530
6530
  "tr",
6531
6531
  {
@@ -6535,7 +6535,7 @@ ${r}`).then(() => {
6535
6535
  title: Ot.titleFor(String(l)) ?? (U && !U.is_mine ? Nd(U) : void 0) ?? (x ? `At risk — ${x.rule}` : void 0) ?? (j ? pu : void 0),
6536
6536
  "data-picker-excluded": j ? "" : void 0,
6537
6537
  style: r,
6538
- className: `nvr-row-enter group h-8 cursor-pointer border-b border-slate-100 transition-colors duration-150 hover:bg-nvr-cyan/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan dark:border-slate-800 dark:hover:bg-nvr-cyan/[0.08] ${o ? "bg-nvr-cyan/[0.08]" : Le ?? ""} ${j ? uu : ""}`,
6538
+ className: `nvr-row-enter group h-8 cursor-pointer border-b border-slate-100 transition-colors duration-150 hover:bg-nvr-cyan/[0.04] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan dark:border-slate-800 dark:hover:bg-nvr-cyan/[0.08] ${i ? "bg-nvr-cyan/[0.08]" : Le ?? ""} ${j ? uu : ""}`,
6539
6539
  children: [
6540
6540
  Dt && /* @__PURE__ */ a(
6541
6541
  "td",
@@ -6550,19 +6550,19 @@ ${r}`).then(() => {
6550
6550
  isNew: Ot.isNew(String(l)),
6551
6551
  dataAttr: "data-cbv-live-mark"
6552
6552
  }
6553
- ) : Ss[Tl(n, String(l))] ? /* @__PURE__ */ a(
6553
+ ) : Ns[ql(n, String(l))] ? /* @__PURE__ */ a(
6554
6554
  hu,
6555
6555
  {
6556
- viewers: Ss[Tl(n, String(l))],
6556
+ viewers: Ns[ql(n, String(l))],
6557
6557
  dataAttr: "data-cbv-presence"
6558
6558
  }
6559
- ) : /* @__PURE__ */ a(Al, { change: v, dataAttr: "data-cbv-unseen" }),
6559
+ ) : /* @__PURE__ */ a(Ol, { change: v, dataAttr: "data-cbv-unseen" }),
6560
6560
  /* @__PURE__ */ a(hc, { rowId: l }),
6561
6561
  vt && /* @__PURE__ */ a(
6562
6562
  "input",
6563
6563
  {
6564
6564
  type: "checkbox",
6565
- checked: o,
6565
+ checked: i,
6566
6566
  onChange: () => ni(l),
6567
6567
  "aria-label": `Select ${jd(A, s, l, n) || "this record"}`
6568
6568
  }
@@ -6655,7 +6655,7 @@ ${r}`).then(() => {
6655
6655
  className: `whitespace-nowrap px-3 py-1 ${ct(p, "z-[1]", D)}`,
6656
6656
  onClick: (O) => O.stopPropagation(),
6657
6657
  children: /* @__PURE__ */ a(
6658
- Ml,
6658
+ Pl,
6659
6659
  {
6660
6660
  users: (ir == null ? void 0 : ir[String(l)]) ?? [],
6661
6661
  showSingleName: !1
@@ -6762,7 +6762,7 @@ ${r}`).then(() => {
6762
6762
  onPeek: () => xt.push([{ collection: n, itemId: String(l) }]),
6763
6763
  onAudit: () => cn(String(l)),
6764
6764
  urlFor: F,
6765
- onDeleted: () => zs.mutate(l),
6765
+ onDeleted: () => Us.mutate(l),
6766
6766
  row: s,
6767
6767
  bulkEnabledKeys: De.bulk_actions ?? null,
6768
6768
  disabled: vt
@@ -6790,16 +6790,16 @@ ${r}`).then(() => {
6790
6790
  s,
6791
6791
  p,
6792
6792
  !!U && !U.is_mine,
6793
- Ut(p) ? Ds(p) === "nivaro_users" ? (() => {
6793
+ Ut(p) ? Es(p) === "nivaro_users" ? (() => {
6794
6794
  var se, C, B;
6795
6795
  const O = p.includes(".") ? p : Ye[p], nt = ((B = (C = (se = Te == null ? void 0 : Te.rows) == null ? void 0 : se[String(l)]) == null ? void 0 : C[O]) == null ? void 0 : B.ids) ?? [], W = _t(l, p) ?? "";
6796
6796
  if (nt.length === 0 || !W || W === "—")
6797
6797
  return /* @__PURE__ */ a("span", { className: "text-[12px] text-slate-300", children: "—" });
6798
6798
  if (nt.length === 1)
6799
- return /* @__PURE__ */ a("span", { onClick: (Ne) => Ne.stopPropagation(), children: /* @__PURE__ */ a(Ol, { userId: String(nt[0]), size: "compact" }) });
6799
+ return /* @__PURE__ */ a("span", { onClick: (Ne) => Ne.stopPropagation(), children: /* @__PURE__ */ a(Ml, { userId: String(nt[0]), size: "compact" }) });
6800
6800
  const ye = W.split(", ");
6801
6801
  return /* @__PURE__ */ a(
6802
- Ml,
6802
+ Pl,
6803
6803
  {
6804
6804
  users: nt.map((Ne, Ee) => ({
6805
6805
  id: String(Ne),
@@ -6820,7 +6820,7 @@ ${r}`).then(() => {
6820
6820
  "data-tip": _t(l, p) ?? void 0,
6821
6821
  className: "block max-w-[260px] truncate text-left text-[12px] font-medium text-slate-700 underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#0284c7] hover:decoration-[#0284c7] dark:text-slate-200 dark:decoration-slate-600 dark:hover:text-[#38bdf8]",
6822
6822
  children: [
6823
- ((Gt = xe[p]) == null ? void 0 : Gt.type) === "count" && Ps(p) ? "📎 " : "",
6823
+ ((Gt = xe[p]) == null ? void 0 : Gt.type) === "count" && Ds(p) ? "📎 " : "",
6824
6824
  xn(_t(l, p) ?? "", p, l)
6825
6825
  ]
6826
6826
  }
@@ -6829,9 +6829,9 @@ ${r}`).then(() => {
6829
6829
  {
6830
6830
  className: "block max-w-[260px] truncate text-[12px] text-slate-700 dark:text-slate-200",
6831
6831
  "data-tip": _t(l, p) ?? void 0,
6832
- children: _t(l, p) != null ? `${((kn = xe[p]) == null ? void 0 : kn.type) === "count" && Ps(p) ? "📎 " : ""}${xn(_t(l, p) ?? "", p, l)}` : /* @__PURE__ */ a("span", { className: "inline-block h-3.5 w-16 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
6832
+ children: _t(l, p) != null ? `${((kn = xe[p]) == null ? void 0 : kn.type) === "count" && Ds(p) ? "📎 " : ""}${xn(_t(l, p) ?? "", p, l)}` : /* @__PURE__ */ a("span", { className: "inline-block h-3.5 w-16 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
6833
6833
  }
6834
- ) : (tt == null ? void 0 : tt.one_collection) === "nivaro_users" && s[p] != null ? /* @__PURE__ */ a("span", { onClick: (O) => O.stopPropagation(), children: /* @__PURE__ */ a(Ol, { userId: String(s[p]), size: "compact" }) }) : tt != null && tt.one_collection && s[p] != null && !Tt(tt.one_collection) ? /* @__PURE__ */ a(
6834
+ ) : (tt == null ? void 0 : tt.one_collection) === "nivaro_users" && s[p] != null ? /* @__PURE__ */ a("span", { onClick: (O) => O.stopPropagation(), children: /* @__PURE__ */ a(Ml, { userId: String(s[p]), size: "compact" }) }) : tt != null && tt.one_collection && s[p] != null && !Tt(tt.one_collection) ? /* @__PURE__ */ a(
6835
6835
  "button",
6836
6836
  {
6837
6837
  type: "button",
@@ -6845,7 +6845,7 @@ ${r}`).then(() => {
6845
6845
  },
6846
6846
  className: "text-left text-[12px] font-medium text-slate-700 underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#0284c7] hover:decoration-[#0284c7] dark:text-slate-200 dark:decoration-slate-600 dark:hover:text-[#38bdf8]",
6847
6847
  children: /* @__PURE__ */ a(
6848
- Pr,
6848
+ Dr,
6849
6849
  {
6850
6850
  relatedCollection: tt.one_collection,
6851
6851
  id: s[p]
@@ -6868,7 +6868,7 @@ ${r}`).then(() => {
6868
6868
  {
6869
6869
  className: Xt(
6870
6870
  "text-[12px] tabular-nums text-slate-700 dark:text-slate-200",
6871
- wa(s[p], H[p]) && jl[wa(s[p], H[p])]
6871
+ wa(s[p], H[p]) && Kl[wa(s[p], H[p])]
6872
6872
  ),
6873
6873
  children: Hn(String(s[p]), xe[p])
6874
6874
  }
@@ -6877,10 +6877,10 @@ ${r}`).then(() => {
6877
6877
  {
6878
6878
  className: Xt(
6879
6879
  "text-[12px]",
6880
- jl[wa(s[p], H[p])]
6880
+ Kl[wa(s[p], H[p])]
6881
6881
  ),
6882
6882
  children: /* @__PURE__ */ a(
6883
- Bl,
6883
+ jl,
6884
6884
  {
6885
6885
  collection: n,
6886
6886
  field: p,
@@ -6891,7 +6891,7 @@ ${r}`).then(() => {
6891
6891
  )
6892
6892
  }
6893
6893
  ) : /* @__PURE__ */ a(
6894
- Bl,
6894
+ jl,
6895
6895
  {
6896
6896
  collection: n,
6897
6897
  field: p,
@@ -6931,7 +6931,7 @@ ${r}`).then(() => {
6931
6931
  )
6932
6932
  }
6933
6933
  ),
6934
- /* @__PURE__ */ a(Gc, { scrollerRef: Ur }),
6934
+ /* @__PURE__ */ a(Gc, { scrollerRef: Br }),
6935
6935
  /* @__PURE__ */ a(
6936
6936
  bu,
6937
6937
  {
@@ -7028,14 +7028,14 @@ ${r}`).then(() => {
7028
7028
  {
7029
7029
  type: "button",
7030
7030
  disabled: M >= ia || Ya,
7031
- onClick: () => void ks(),
7031
+ onClick: () => void vs(),
7032
7032
  "aria-label": "Last page",
7033
7033
  "aria-busy": Ya || void 0,
7034
7034
  "data-tip": jn || Bt ? "Last page (counts first)" : "Last page",
7035
7035
  className: "inline-flex h-7 items-center gap-1 rounded px-2 text-[12px] text-slate-600 hover:bg-slate-100 disabled:opacity-30 dark:text-slate-300 dark:hover:bg-slate-800",
7036
7036
  children: [
7037
7037
  /* @__PURE__ */ a("span", { className: "hidden sm:inline", children: "Last" }),
7038
- Ya ? /* @__PURE__ */ a(wl, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": !0 }) : /* @__PURE__ */ a($i, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
7038
+ Ya ? /* @__PURE__ */ a(yl, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": !0 }) : /* @__PURE__ */ a($i, { className: "h-3.5 w-3.5", "aria-hidden": !0 })
7039
7039
  ]
7040
7040
  }
7041
7041
  )
@@ -7083,10 +7083,10 @@ ${r}`).then(() => {
7083
7083
  "button",
7084
7084
  {
7085
7085
  type: "button",
7086
- disabled: Ws,
7086
+ disabled: Qs,
7087
7087
  onClick: () => void ai(),
7088
7088
  className: "font-semibold text-nvr-navy underline decoration-dotted hover:text-nvr-cyan dark:text-nvr-cyan",
7089
- children: Ws ? "Selecting…" : Me > ga ? `Select the first ${ga.toLocaleString()} of ${Me.toLocaleString()} matching` : `Select all ${Me.toLocaleString()} matching rows`
7089
+ children: Qs ? "Selecting…" : Me > ga ? `Select the first ${ga.toLocaleString()} of ${Me.toLocaleString()} matching` : `Select all ${Me.toLocaleString()} matching rows`
7090
7090
  }
7091
7091
  )
7092
7092
  ] }),
@@ -7108,15 +7108,15 @@ ${r}`).then(() => {
7108
7108
  }
7109
7109
  );
7110
7110
  }
7111
- function Qu(n, i, h, d, w) {
7112
- const N = Dr(i, n, h);
7113
- return N != null && N.one_collection ? /* @__PURE__ */ a(Pr, { relatedCollection: N.one_collection, id: d }) : Wi(d, w);
7111
+ function Qu(n, o, h, d, w) {
7112
+ const N = Er(o, n, h);
7113
+ return N != null && N.one_collection ? /* @__PURE__ */ a(Dr, { relatedCollection: N.one_collection, id: d }) : Wi(d, w);
7114
7114
  }
7115
7115
  export {
7116
7116
  D0 as CollectionBrowserView,
7117
7117
  Ra as MultiPick,
7118
7118
  Tu as RowActionsMenu,
7119
- jl as TINT_TEXT,
7119
+ Kl as TINT_TEXT,
7120
7120
  Qu as compareCell,
7121
7121
  Ca as invalidateCbvRowQueries,
7122
7122
  qu as roleMayDelete,