@nivaro/react 0.3.112 → 0.3.114

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,49 +1,49 @@
1
1
  import { jsx as l, jsxs as k, Fragment as yn } from "react/jsx-runtime";
2
- import { useQueryClient as Bl, useQuery as Ce, useQueries as bn } from "@tanstack/react-query";
3
- import { Loader2 as wn, ListChecks as gd, SquarePen as bd, Rows3 as yd, PanelBottomOpen as wd, Zap as vd, Clock as _o, History as pi, AlertTriangle as Ir, ChevronRight as Jl, GripVertical as Nl, FileUp as Sl, GripHorizontal as xd, X as _d, Lock as kd } from "lucide-react";
4
- import { useState as B, useMemo as T, useEffect as de, useRef as ee, useId as $l, useDeferredValue as Nd, useCallback as Pt, Fragment as ko } from "react";
5
- import { createPortal as Sd } from "react-dom";
6
- import { changeReasonChallenge as No, ChangeReasonDialog as $d } from "./ChangeReasonDialog.js";
2
+ import { useQueryClient as Jl, useQuery as Ce, useQueries as bn } from "@tanstack/react-query";
3
+ import { Loader2 as wn, ListChecks as bd, SquarePen as yd, Rows3 as wd, PanelBottomOpen as vd, Zap as xd, Clock as _o, History as mi, AlertTriangle as Ir, ChevronRight as Ql, GripVertical as Sl, FileUp as $l, GripHorizontal as _d, X as kd, Lock as Nd } from "lucide-react";
4
+ import { useState as B, useMemo as L, useEffect as de, useRef as ee, useId as El, useDeferredValue as Sd, useCallback as Pt, Fragment as ko } from "react";
5
+ import { createPortal as $d } from "react-dom";
6
+ import { changeReasonChallenge as No, ChangeReasonDialog as Ed } from "./ChangeReasonDialog.js";
7
7
  import { toast as be } from "sonner";
8
- import { useNivaroClient as xi, useDrilldown as Ed, useParentDraft as qd, useReimportHandler as Id, useItemEditAuth as Od, fieldDrilldownConfig as El } from "../../context.js";
9
- import { get as ue, post as Te, patch as wi, del as Ql } from "../../lib/commands.js";
10
- import { useAfterIdle as Ad } from "../../lib/defer.js";
8
+ import { useNivaroClient as vi, useDrilldown as qd, useParentDraft as Id, useReimportHandler as Od, useItemEditAuth as Ad, fieldDrilldownConfig as ql } from "../../context.js";
9
+ import { get as ue, post as Le, patch as yi, del as zl } from "../../lib/commands.js";
10
+ import { useAfterIdle as Rd } from "../../lib/defer.js";
11
11
  import { evaluateNumeric as ct, evaluateBoolean as jd } from "../../lib/expression.js";
12
12
  import { numericIntlOptions as Nt } from "../../lib/format-value.js";
13
- import { isOwnWrite as Rd } from "../../lib/own-writes.js";
14
- import { queryKeys as $r, fetchCollectionRelations as ql } from "../../lib/query-keys.js";
13
+ import { isOwnWrite as Td } from "../../lib/own-writes.js";
14
+ import { queryKeys as $r, fetchCollectionRelations as Il } from "../../lib/query-keys.js";
15
15
  import { useOptionalRealtime as Ld } from "../../lib/realtime.js";
16
- import { useRecordReader as Td } from "../../lib/record-loader.js";
17
- import { midairCollisionOf as Md } from "../../lib/record-outbox.js";
18
- import { restoreSkippedNote as Kd } from "../../lib/restore-skipped.js";
16
+ import { useRecordReader as Md } from "../../lib/record-loader.js";
17
+ import { midairCollisionOf as Kd } from "../../lib/record-outbox.js";
18
+ import { restoreSkippedNote as Pd } from "../../lib/restore-skipped.js";
19
19
  import { userErrorMessage as Un } from "../../lib/safe-error.js";
20
- import { isFileCollection as Il } from "../../lib/system-collections.js";
21
- import { titleCase as _e, cn as we, formatRelative as Ol, toLocalDateString as Pd } from "../../lib/utils.js";
22
- import { formulaInputsChanged as Dd } from "../../lib/write-formula.js";
23
- import { ImportFromFileButton as Wd } from "../import/ImportFromFileButton.js";
24
- import { OWN_RECORD_WRITES_EVENT as Al } from "../panels/RecordIntegrityBanner.js";
25
- import { Sheet as Ud, SheetContent as Bd, SheetHeader as Jd, SheetTitle as Qd } from "../ui/sheet.js";
26
- import { useAddendumO2M as zd, useAddendumView as Vd } from "./AddendumFieldContext.js";
27
- import { resolveCompareEndpoint as Fd, useCompareSeries as Hd, compareColumnClosed as Ct, fmtMoney as So, CompareProposalBanner as Cd, CompareStripChips as Gd, GridStatChip as Yd, CompareCell as $o, compareRowFor as Eo, compareColumnSum as Xd, ReconcileAction as Zd } from "./CompareSeries.js";
20
+ import { isFileCollection as Ol } from "../../lib/system-collections.js";
21
+ import { titleCase as _e, cn as ve, formatRelative as Al, toLocalDateString as Dd } from "../../lib/utils.js";
22
+ import { formulaInputsChanged as Wd } from "../../lib/write-formula.js";
23
+ import { ImportFromFileButton as Ud } from "../import/ImportFromFileButton.js";
24
+ import { OWN_RECORD_WRITES_EVENT as Rl } from "../panels/RecordIntegrityBanner.js";
25
+ import { Sheet as Bd, SheetContent as Jd, SheetHeader as Qd, SheetTitle as zd } from "../ui/sheet.js";
26
+ import { useAddendumO2M as Vd, useAddendumView as Fd } from "./AddendumFieldContext.js";
27
+ import { resolveCompareEndpoint as Hd, useCompareSeries as Cd, compareColumnClosed as Ct, fmtMoney as So, CompareProposalBanner as Gd, CompareStripChips as Yd, GridStatChip as Xd, CompareCell as $o, compareRowFor as Eo, compareColumnSum as Zd, ReconcileAction as ec } from "./CompareSeries.js";
28
28
  import { FieldRenderer as Wn } from "./FieldRenderer.js";
29
- import { primaryControl as ec, nameFieldControl as tc } from "./field-a11y.js";
30
- import { GridBulkEditDialog as nc } from "./GridBulkEditDialog.js";
31
- import { useDebouncedValue as rc, searchWords as ic, GRID_READ_LIMIT as qo, useGridServerSearch as oc, useGridChildTotal as sc, extraSearchRows as lc, useGridSearchHighlight as ac, pendingRowVisibility as dc, GRID_SEARCH_MIN_ROWS as cc, GridSearchBox as uc, GRID_SEARCH_HIGHLIGHT_CSS as fc, cellSearchTexts as mc, textMatchesWords as pc } from "./grid-search.js";
32
- import { parseJson as hi, SENTINEL_FIELDS as Ro, applyDisplayTemplate as Er, EMPTY_NESTED_OPS as gi, SYSTEM_FIELDS as jl } from "./helpers.js";
33
- import { lineLabelOf as bi, rowBaseBookFor as hc, writeLineGuarded as gc, lineConflictKey as bc, resolveLineCollision as yc, snapshotRowBases as wc, incrementGuarded as vc } from "./line-midair.js";
34
- import { NUMBER_FIELD_TYPES as xc, checkNumberEntry as _c, changedRowFields as Rl, lineRuleErrors as kc, computedColumnErrors as Nc, zeroQtyColumn as Ll, dropRevertedFields as Sc, isRealLineEdit as $c } from "./line-qty.js";
35
- import { LineCollisionDialog as Ec } from "./MidairCollisionDialog.js";
29
+ import { primaryControl as tc, nameFieldControl as nc } from "./field-a11y.js";
30
+ import { GridBulkEditDialog as rc } from "./GridBulkEditDialog.js";
31
+ import { useDebouncedValue as ic, searchWords as oc, GRID_READ_LIMIT as qo, useGridServerSearch as sc, useGridChildTotal as lc, extraSearchRows as ac, useGridSearchHighlight as dc, useGridSearchShortcut as cc, pendingRowVisibility as uc, GRID_SEARCH_MIN_ROWS as fc, GridSearchBox as mc, GRID_SEARCH_HIGHLIGHT_CSS as pc, GRID_SEARCH_ROOT_ATTR as hc, cellSearchTexts as gc, textMatchesWords as bc } from "./grid-search.js";
32
+ import { parseJson as pi, SENTINEL_FIELDS as jo, applyDisplayTemplate as Er, EMPTY_NESTED_OPS as hi, SYSTEM_FIELDS as jl } from "./helpers.js";
33
+ import { lineLabelOf as gi, rowBaseBookFor as yc, writeLineGuarded as wc, lineConflictKey as vc, resolveLineCollision as xc, snapshotRowBases as _c, incrementGuarded as kc } from "./line-midair.js";
34
+ import { NUMBER_FIELD_TYPES as Nc, checkNumberEntry as Sc, changedRowFields as Tl, lineRuleErrors as $c, computedColumnErrors as Ec, zeroQtyColumn as Ll, dropRevertedFields as qc, isRealLineEdit as Ic } from "./line-qty.js";
35
+ import { LineCollisionDialog as Oc } from "./MidairCollisionDialog.js";
36
36
  import { NestedRelationEditor as Io } from "./NestedRelationEditor.js";
37
- import { useO2MStaging as qc, useLiveRows as Ic, useStagedRelations as Oc } from "./O2MStagingContext.js";
37
+ import { useO2MStaging as Ac, useLiveRows as Rc, useStagedRelations as jc } from "./O2MStagingContext.js";
38
38
  import { RelationCombobox as Oo } from "./RelationCombobox.js";
39
- import { useRowCommentCounts as Ac, RowCommentButton as jc } from "./RowComments.js";
40
- import { RowHistorySheet as Tl, parseImportStamp as Rc } from "./RowHistorySheet.js";
41
- import { useRowMatches as Lc, RowMatchDot as Ml, rowFromCandidate as Tc, RowMatchPanel as Mc } from "./RowMatchPanel.js";
42
- import { RowWatchButton as Kc } from "./RowWatchButton.js";
43
- import { RuleProvenanceChip as Pc } from "./RuleProvenancePopover.js";
44
- import { normalizeSetAllRows as Dc, SetAllRowsButton as Wc } from "./SetAllRowsButton.js";
45
- import { resolveOptionFilterTokens as zl } from "../../lib/option-filter-tokens.js";
46
- function Kl(s, u) {
39
+ import { useRowCommentCounts as Tc, RowCommentButton as Lc } from "./RowComments.js";
40
+ import { RowHistorySheet as Ml, parseImportStamp as Mc } from "./RowHistorySheet.js";
41
+ import { useRowMatches as Kc, RowMatchDot as Kl, rowFromCandidate as Pc, RowMatchPanel as Dc } from "./RowMatchPanel.js";
42
+ import { RowWatchButton as Wc } from "./RowWatchButton.js";
43
+ import { RuleProvenanceChip as Uc } from "./RuleProvenancePopover.js";
44
+ import { normalizeSetAllRows as Bc, SetAllRowsButton as Jc } from "./SetAllRowsButton.js";
45
+ import { resolveOptionFilterTokens as Vl } from "../../lib/option-filter-tokens.js";
46
+ function Pl(s, u) {
47
47
  const y = s[u.field], A = y == null || y === "", U = u.op ?? "eq";
48
48
  if (U === "null") return A;
49
49
  if (U === "nnull") return !A;
@@ -59,17 +59,17 @@ function Ao(s, u) {
59
59
  if (!(u != null && u.length)) return [];
60
60
  const y = [];
61
61
  for (const J of u)
62
- !((A = J == null ? void 0 : J.when) != null && A.field) || !((U = J == null ? void 0 : J.expect) != null && U.field) || Kl(s, J.when) && (Kl(s, J.expect) || y.push(J.label || `${J.when.field} vs ${J.expect.field}`));
62
+ !((A = J == null ? void 0 : J.when) != null && A.field) || !((U = J == null ? void 0 : J.expect) != null && U.field) || Pl(s, J.when) && (Pl(s, J.expect) || y.push(J.label || `${J.when.field} vs ${J.expect.field}`));
63
63
  return y;
64
64
  }
65
- const Uc = {
65
+ const Qc = {
66
66
  lt: "<",
67
67
  gt: ">",
68
68
  quot: '"',
69
69
  amp: "&",
70
70
  "#39": "'"
71
71
  };
72
- function Bc(s, u) {
72
+ function zc(s, u) {
73
73
  const y = [];
74
74
  return { rows: s.map((U) => {
75
75
  const J = [], te = { ...U };
@@ -80,7 +80,7 @@ function Bc(s, u) {
80
80
  return y.push(J), te;
81
81
  }), dropped: y };
82
82
  }
83
- function Pl({
83
+ function Dl({
84
84
  saved: s,
85
85
  onDelete: u
86
86
  }) {
@@ -104,11 +104,11 @@ function Pl({
104
104
  A(!1), u(U);
105
105
  },
106
106
  className: y ? "rounded bg-red-50 p-0.5 text-red-600 dark:bg-red-900/20 dark:text-red-400" : "rounded p-0.5 text-slate-300 hover:text-red-500",
107
- children: /* @__PURE__ */ l(_d, { className: "h-3 w-3" })
107
+ children: /* @__PURE__ */ l(kd, { className: "h-3 w-3" })
108
108
  }
109
109
  );
110
110
  }
111
- function Jc({ children: s }) {
111
+ function Vc({ children: s }) {
112
112
  const [u, y] = B(null);
113
113
  return /* @__PURE__ */ k(
114
114
  "span",
@@ -123,7 +123,7 @@ function Jc({ children: s }) {
123
123
  children: [
124
124
  /* @__PURE__ */ l(Ir, { className: "h-3 w-3 shrink-0 text-amber-500" }),
125
125
  /* @__PURE__ */ l("span", { className: "min-w-0 truncate", children: s }),
126
- u && Sd(
126
+ u && $d(
127
127
  /* @__PURE__ */ l(
128
128
  "div",
129
129
  {
@@ -138,11 +138,11 @@ function Jc({ children: s }) {
138
138
  }
139
139
  );
140
140
  }
141
- function Qc(s) {
141
+ function Fc(s) {
142
142
  if (typeof s != "string" || !s.trim()) return [];
143
143
  const u = s.replace(
144
144
  /&(lt|gt|quot|amp|#39);/g,
145
- (J, te) => Uc[te] ?? ""
145
+ (J, te) => Qc[te] ?? ""
146
146
  ), y = [], A = /"detail"\s*:\s*"((?:[^"\\]|\\.)*)"/g;
147
147
  let U = A.exec(u);
148
148
  for (; U; ) {
@@ -159,7 +159,7 @@ function Qc(s) {
159
159
  }
160
160
  return y;
161
161
  }
162
- const Lo = /* @__PURE__ */ new Set([
162
+ const To = /* @__PURE__ */ new Set([
163
163
  "alias",
164
164
  "o2m",
165
165
  "m2m",
@@ -168,7 +168,7 @@ const Lo = /* @__PURE__ */ new Set([
168
168
  "group",
169
169
  "divider"
170
170
  ]), qr = "__all__";
171
- function Vl(s, u, y, A) {
171
+ function Fl(s, u, y, A) {
172
172
  if (u <= 0) return [];
173
173
  let U;
174
174
  for (y === "front" ? U = Array.from({ length: u }, (Q, M) => u - M) : y === "back" ? U = Array.from({ length: u }, (Q, M) => M + 1) : y === "shape" && A && A.some((Q) => Q > 0) ? U = A.slice(0, u).map((Q) => Math.max(0, Q)) : U = Array.from({ length: u }, () => 1); U.length < u; ) U.push(0);
@@ -183,13 +183,13 @@ function Vl(s, u, y, A) {
183
183
  }
184
184
  return te;
185
185
  }
186
- const Dl = 1e3;
187
- function zc(s) {
186
+ const Wl = 1e3;
187
+ function Hc(s) {
188
188
  let u = 0;
189
189
  for (let y = 0; y < s.length; y++) u = u * 31 + s.charCodeAt(y) | 0;
190
190
  return u;
191
191
  }
192
- function Vc(s) {
192
+ function Cc(s) {
193
193
  if (s.line_number != null && s.line_number !== "") return `line ${s.line_number}`;
194
194
  for (const u of ["year", "name", "title", "label", "number"]) {
195
195
  const y = s[u];
@@ -200,19 +200,19 @@ function Vc(s) {
200
200
  function Dt(s, u) {
201
201
  return ct(s, u);
202
202
  }
203
- function jo(s, u) {
203
+ function Ro(s, u) {
204
204
  return u.map((y) => {
205
205
  const A = s[`__m2m_${y}`];
206
206
  return String(A !== void 0 ? A ?? "" : s[y] ?? "");
207
207
  }).join("\0");
208
208
  }
209
- function To(s, u, y, A) {
209
+ function Lo(s, u, y, A) {
210
210
  return typeof s != "string" ? s : s === "$parent.id" ? y : s.startsWith("$parent.") ? A == null ? void 0 : A[s.slice(8)] : s.startsWith("$row.") ? u[s.slice(5)] : s;
211
211
  }
212
- function vi(s, u, y, A) {
212
+ function wi(s, u, y, A) {
213
213
  const U = {};
214
214
  for (const [te, se] of Object.entries(s.filters ?? {})) {
215
- const Q = To(se, u, y, A);
215
+ const Q = Lo(se, u, y, A);
216
216
  if (Q == null || Q === "") return null;
217
217
  if (te.startsWith("_")) {
218
218
  U[te] = Q;
@@ -221,29 +221,29 @@ function vi(s, u, y, A) {
221
221
  const M = typeof Q == "object" && !Array.isArray(Q) ? Q : { _eq: Q };
222
222
  if (te.includes(".")) {
223
223
  const ie = te.split(".");
224
- let Re = M;
225
- for (let W = ie.length - 1; W >= 1; W--) Re = { [ie[W]]: Re };
226
- U[ie[0]] = Re;
224
+ let je = M;
225
+ for (let W = ie.length - 1; W >= 1; W--) je = { [ie[W]]: je };
226
+ U[ie[0]] = je;
227
227
  } else
228
228
  U[te] = M;
229
229
  }
230
230
  const J = {};
231
231
  for (const [te, se] of Object.entries(s.defaults ?? {})) {
232
- const Q = To(se, u, y, A);
232
+ const Q = Lo(se, u, y, A);
233
233
  Q != null && Q !== "" && (J[te] = Q);
234
234
  }
235
235
  return { query: U, seed: J };
236
236
  }
237
- function yi(s, u) {
237
+ function bi(s, u) {
238
238
  return u.split(".").reduce(
239
239
  (y, A) => y && typeof y == "object" ? y[A] : void 0,
240
240
  s
241
241
  );
242
242
  }
243
- function Fc(s, u, y) {
243
+ function Gc(s, u, y) {
244
244
  return u === "presence" ? s != null && String(s).trim() !== "" ? "Yes" : "No" : s == null || s === "" ? "—" : u === "currency" && Number.isFinite(Number(s)) ? Number(s).toLocaleString("en-US", Nt(y, "currency")) : String(s);
245
245
  }
246
- function Hc({
246
+ function Yc({
247
247
  config: s,
248
248
  relatedCollection: u,
249
249
  manyField: y,
@@ -255,13 +255,13 @@ function Hc({
255
255
  onLocalWrite: Q,
256
256
  staging: M,
257
257
  stagingActive: ie,
258
- pendingRows: Re,
258
+ pendingRows: je,
259
259
  pendingEdits: W,
260
260
  pendingDeletes: oe,
261
261
  writeRow: Se,
262
262
  stagedBase: ne
263
263
  }) {
264
- const Ee = xi(), [Ue, fe] = B(!1), [Ve, ve] = B(null), [Z, ye] = B({}), [Ge, Me] = B(null), Oe = T(
264
+ const Ee = vi(), [Ue, fe] = B(!1), [Ve, xe] = B(null), [Z, ye] = B({}), [Ge, Me] = B(null), Oe = L(
265
265
  () => (s.columns ?? []).map(
266
266
  (F) => typeof F == "string" ? {
267
267
  path: F,
@@ -272,18 +272,18 @@ function Hc({
272
272
  } : F
273
273
  ),
274
274
  [s.columns]
275
- ), et = T(
276
- () => zl(s.filter, te, A),
275
+ ), et = L(
276
+ () => Vl(s.filter, te, A),
277
277
  [s.filter, te, A]
278
- ), It = T(() => {
278
+ ), It = L(() => {
279
279
  const F = /* @__PURE__ */ new Set(["id"]);
280
280
  s.group_by && F.add(s.group_by);
281
- const P = (j) => {
282
- /^__\w+__$/.test(j) || F.add(j);
281
+ const P = (R) => {
282
+ /^__\w+__$/.test(R) || F.add(R);
283
283
  };
284
- for (const j of Oe) {
285
- j.path && P(j.path);
286
- for (const Y of (j.formula ?? "").matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) P(Y[1]);
284
+ for (const R of Oe) {
285
+ R.path && P(R.path);
286
+ for (const Y of (R.formula ?? "").matchAll(/\{\{\s*([\w.]+)\s*\}\}/g)) P(Y[1]);
287
287
  }
288
288
  return [...F].join(",");
289
289
  }, [Oe, s.group_by]), { data: le = [], isFetching: ut } = Ce({
@@ -302,39 +302,39 @@ function Hc({
302
302
  ).then((F) => F.data ?? []),
303
303
  enabled: Ue,
304
304
  staleTime: 0
305
- }), St = T(() => {
305
+ }), St = L(() => {
306
306
  const F = /* @__PURE__ */ new Map();
307
307
  for (const P of U) {
308
- const j = P[s.target_field];
309
- j != null && F.set(String(j), P);
308
+ const R = P[s.target_field];
309
+ R != null && F.set(String(R), P);
310
310
  }
311
311
  return F;
312
312
  }, [U, s.target_field]);
313
313
  function Ke(F) {
314
- const P = St.get(F), j = (P == null ? void 0 : P.id) != null ? String(P.id) : null, Y = !!(j && (oe != null && oe.has(j))), he = (Re ?? []).findIndex(
314
+ const P = St.get(F), R = (P == null ? void 0 : P.id) != null ? String(P.id) : null, Y = !!(R && (oe != null && oe.has(R))), he = (je ?? []).findIndex(
315
315
  (Ae) => String(Ae[s.target_field]) === F
316
316
  );
317
317
  let $ = 0;
318
- if (he >= 0) $ = Number((Re ?? [])[he][s.value_field]) || 0;
318
+ if (he >= 0) $ = Number((je ?? [])[he][s.value_field]) || 0;
319
319
  else if (P && !Y) {
320
- const Ae = j ? W == null ? void 0 : W.get(j) : void 0;
320
+ const Ae = R ? W == null ? void 0 : W.get(R) : void 0;
321
321
  $ = Number(
322
322
  Ae && s.value_field in Ae ? Ae[s.value_field] : P[s.value_field]
323
323
  ) || 0;
324
324
  }
325
325
  return { savedRow: P, pendingIdx: he, amount: $, deleted: Y };
326
326
  }
327
- async function De(F, P, j) {
327
+ async function De(F, P, R) {
328
328
  let Y = P.trim() === "" ? null : Number(P);
329
329
  if (Y !== null && !Number.isFinite(Y)) return;
330
- if (Y !== null && j) {
331
- const $ = $t(j);
330
+ if (Y !== null && R) {
331
+ const $ = $t(R);
332
332
  $ !== null && Y > $ && (Y = Math.max(0, Math.round($ * 100) / 100), ye((Ae) => ({ ...Ae, [F]: String(Y) })));
333
333
  }
334
334
  if (ie && M) {
335
335
  const { savedRow: $, pendingIdx: Ae, deleted: me } = Ke(F), V = ($ == null ? void 0 : $.id) != null ? String($.id) : null;
336
336
  Y === null || Y === 0 ? Ae >= 0 ? M.removeRow(u, y, Ae) : V && !me && (M.cancelPendingEdit(u, y, V), M.queueDelete(u, y, V)) : Ae >= 0 ? M.updateRow(u, y, Ae, {
337
- ...(Re ?? [])[Ae],
337
+ ...(je ?? [])[Ae],
338
338
  [s.value_field]: Y
339
339
  }) : V ? (me && M.cancelPendingDelete(u, y, V), M.queueEdit(u, y, V, {
340
340
  [s.value_field]: Y,
@@ -347,18 +347,18 @@ function Hc({
347
347
  return;
348
348
  }
349
349
  const he = St.get(F);
350
- ve(F);
350
+ xe(F);
351
351
  try {
352
352
  if (Y === null || Y === 0)
353
- (he == null ? void 0 : he.id) != null && await Ee.request(Ql(`/items/${u}/${he.id}`));
353
+ (he == null ? void 0 : he.id) != null && await Ee.request(zl(`/items/${u}/${he.id}`));
354
354
  else if ((he == null ? void 0 : he.id) != null) {
355
355
  if (Number(he[s.value_field]) !== Y) {
356
356
  const $ = { [s.value_field]: Y };
357
- Se ? await Se(String(he.id), $) : await Ee.request(wi(`/items/${u}/${he.id}`, $));
357
+ Se ? await Se(String(he.id), $) : await Ee.request(yi(`/items/${u}/${he.id}`, $));
358
358
  }
359
359
  } else
360
360
  await Ee.request(
361
- Te(`/items/${u}`, {
361
+ Le(`/items/${u}`, {
362
362
  ...J,
363
363
  [s.target_field]: F,
364
364
  [s.value_field]: Y,
@@ -368,24 +368,24 @@ function Hc({
368
368
  Q == null || Q((he == null ? void 0 : he.id) != null ? String(he.id) : null), se();
369
369
  } catch {
370
370
  } finally {
371
- ve(null);
371
+ xe(null);
372
372
  }
373
373
  }
374
- function Be(F, P, j) {
375
- return ct(F, (Y) => Y in j ? j[Y] : yi(P, Y));
374
+ function Be(F, P, R) {
375
+ return ct(F, (Y) => Y in R ? R[Y] : bi(P, Y));
376
376
  }
377
377
  function ke(F) {
378
- const P = St.get(F), j = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0, Y = Z[F], he = ie ? Ke(F).amount : j;
379
- return { __input__: Y !== void 0 && Y !== "" ? Number(Y) || 0 : he, __saved__: j };
378
+ const P = St.get(F), R = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0, Y = Z[F], he = ie ? Ke(F).amount : R;
379
+ return { __input__: Y !== void 0 && Y !== "" ? Number(Y) || 0 : he, __saved__: R };
380
380
  }
381
381
  function Bn(F, P) {
382
- const j = Be(F, P, ke(String(P.id)));
383
- return j === null ? "—" : j.toLocaleString("en-US", { style: "currency", currency: "USD" });
382
+ const R = Be(F, P, ke(String(P.id)));
383
+ return R === null ? "—" : R.toLocaleString("en-US", { style: "currency", currency: "USD" });
384
384
  }
385
385
  function $t(F) {
386
386
  if (!s.value_max) return null;
387
- const P = St.get(String(F.id)), j = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0;
388
- return Be(s.value_max, F, { __input__: j, __saved__: j });
387
+ const P = St.get(String(F.id)), R = Number((P == null ? void 0 : P[s.value_field]) ?? 0) || 0;
388
+ return Be(s.value_max, F, { __input__: R, __saved__: R });
389
389
  }
390
390
  return /* @__PURE__ */ k(yn, { children: [
391
391
  /* @__PURE__ */ l(
@@ -397,8 +397,8 @@ function Hc({
397
397
  children: "Allocate…"
398
398
  }
399
399
  ),
400
- /* @__PURE__ */ l(Ud, { open: Ue, onOpenChange: fe, children: /* @__PURE__ */ k(Bd, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
401
- /* @__PURE__ */ l(Jd, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ l(Qd, { className: "text-[14px]", children: s.title ?? "Allocate" }) }),
400
+ /* @__PURE__ */ l(Bd, { open: Ue, onOpenChange: fe, children: /* @__PURE__ */ k(Jd, { side: "right", className: "w-[92vw] sm:max-w-[1200px] overflow-y-auto p-0", children: [
401
+ /* @__PURE__ */ l(Qd, { className: "border-b border-slate-200 px-5 py-3", children: /* @__PURE__ */ l(zd, { className: "text-[14px]", children: s.title ?? "Allocate" }) }),
402
402
  /* @__PURE__ */ k("div", { className: "p-4", children: [
403
403
  /* @__PURE__ */ l("p", { className: "mb-2 text-[11px] text-slate-400", children: "Enter an amount to allocate a line — clearing it removes the allocation." }),
404
404
  ut ? /* @__PURE__ */ l("div", { className: "py-10 text-center", children: /* @__PURE__ */ l(wn, { className: "inline h-4 w-4 animate-spin text-slate-400" }) }) : le.length === 0 ? /* @__PURE__ */ l("p", { className: "py-10 text-center text-[12px] text-slate-400", children: "No eligible rows for the current record's filters." }) : /* @__PURE__ */ l("div", { className: "overflow-x-auto rounded-lg border border-slate-200", children: /* @__PURE__ */ k("table", { className: "w-full text-left text-[12px]", children: [
@@ -414,9 +414,9 @@ function Hc({
414
414
  /* @__PURE__ */ l("th", { className: "whitespace-nowrap px-2.5 py-1.5 text-[11px] font-medium text-slate-500", children: s.value_label ?? "Allocate" })
415
415
  ] }) }),
416
416
  /* @__PURE__ */ l("tbody", { className: "divide-y divide-slate-100", children: (() => {
417
- const F = (me) => s.group_by ? String(yi(me, s.group_by) ?? "—") : "";
418
- let P = le, j = [];
419
- s.group_by && (j = [...new Set(le.map(F))], P = j.flatMap(
417
+ const F = (me) => s.group_by ? String(bi(me, s.group_by) ?? "—") : "";
418
+ let P = le, R = [];
419
+ s.group_by && (R = [...new Set(le.map(F))], P = R.flatMap(
420
420
  (me) => le.filter((V) => F(V) === me)
421
421
  ));
422
422
  const Y = Ge ?? new Set(
@@ -434,11 +434,11 @@ function Hc({
434
434
  (Fe) => Ke(String(Fe.id)).amount > 0
435
435
  ).length, it = Oe.map(
436
436
  (Fe) => !!Fe.formula || Fe.format === "currency"
437
- ), Ut = it.indexOf(!0), Gt = Ut === -1 ? Oe.length : Math.max(1, Ut), _i = (Fe) => {
437
+ ), Ut = it.indexOf(!0), Gt = Ut === -1 ? Oe.length : Math.max(1, Ut), xi = (Fe) => {
438
438
  const mt = Oe[Fe];
439
439
  let qe = 0;
440
440
  for (const Qn of S) {
441
- const Yt = mt.formula ? Be(mt.formula, Qn, ke(String(Qn.id))) : Number(yi(Qn, mt.path ?? ""));
441
+ const Yt = mt.formula ? Be(mt.formula, Qn, ke(String(Qn.id))) : Number(bi(Qn, mt.path ?? ""));
442
442
  Yt !== null && Number.isFinite(Yt) && (qe += Yt);
443
443
  }
444
444
  return qe.toLocaleString("en-US", {
@@ -463,9 +463,9 @@ function Hc({
463
463
  className: "flex w-full items-center gap-1.5 text-left",
464
464
  children: [
465
465
  /* @__PURE__ */ l(
466
- Jl,
466
+ Ql,
467
467
  {
468
- className: we(
468
+ className: ve(
469
469
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
470
470
  Y.has(w) && "rotate-90"
471
471
  )
@@ -488,7 +488,7 @@ function Hc({
488
488
  "td",
489
489
  {
490
490
  className: "whitespace-nowrap px-2.5 py-1 text-[11px] font-semibold tabular-nums text-slate-600",
491
- children: it[Gt + mt] ? _i(Gt + mt) : ""
491
+ children: it[Gt + mt] ? xi(Gt + mt) : ""
492
492
  },
493
493
  mt
494
494
  )),
@@ -505,15 +505,15 @@ function Hc({
505
505
  if (s.group_by && !Y.has(w)) continue;
506
506
  const Wt = Ke(V), Jn = Wt.amount > 0 ? Wt.savedRow ?? {} : void 0, ft = Z[V] ?? (Wt.amount > 0 ? String(Wt.amount) : "");
507
507
  $.push(
508
- /* @__PURE__ */ k("tr", { className: we(Jn && "bg-nvr-cyan/5"), children: [
508
+ /* @__PURE__ */ k("tr", { className: ve(Jn && "bg-nvr-cyan/5"), children: [
509
509
  Oe.map((S, E) => {
510
- const it = S.formula ? Bn(S.formula, me) : Fc(yi(me, S.path ?? ""), S.format);
510
+ const it = S.formula ? Bn(S.formula, me) : Gc(bi(me, S.path ?? ""), S.format);
511
511
  return /* @__PURE__ */ l(
512
512
  "td",
513
513
  {
514
514
  title: S.width ? it : void 0,
515
515
  style: S.width ? { maxWidth: S.width } : void 0,
516
- className: we(
516
+ className: ve(
517
517
  "px-2.5 py-1.5 text-slate-700",
518
518
  S.width ? "truncate" : "whitespace-nowrap"
519
519
  ),
@@ -540,7 +540,7 @@ function Hc({
540
540
  it.key === "Enter" && Z[V] !== void 0 && De(V, Z[V], me);
541
541
  },
542
542
  placeholder: "0",
543
- className: we(
543
+ className: ve(
544
544
  "h-7 w-28 rounded border px-2 text-[12px] tabular-nums focus:outline-none focus:ring-1",
545
545
  E ? "border-red-400 bg-red-50 text-red-700 focus:ring-red-400 dark:border-red-700 dark:bg-red-950/30 dark:text-red-300" : "border-slate-200 focus:ring-nvr-cyan"
546
546
  )
@@ -559,18 +559,18 @@ function Hc({
559
559
  ] }) })
560
560
  ] });
561
561
  }
562
- function Cc({
562
+ function Xc({
563
563
  config: s,
564
564
  rows: u,
565
565
  relatedCollection: y,
566
566
  computedWriteFields: A,
567
567
  applyRow: U
568
568
  }) {
569
- const J = xi(), [te, se] = B(!1), [Q, M] = B(!1), ie = async () => {
569
+ const J = vi(), [te, se] = B(!1), [Q, M] = B(!1), ie = async () => {
570
570
  M(!1);
571
- const Re = Object.keys(s.set).filter((W) => A.has(W));
572
- if (Re.length > 0) {
573
- const W = Re[0];
571
+ const je = Object.keys(s.set).filter((W) => A.has(W));
572
+ if (je.length > 0) {
573
+ const W = je[0];
574
574
  be.error(
575
575
  `${s.label}: "${W}" is calculated from ${A.get(W)} and cannot be set directly — target those fields instead`,
576
576
  { duration: 12e3 }
@@ -608,11 +608,11 @@ function Cc({
608
608
  const ye = Ue.get(String(Z)) ?? [];
609
609
  return Ee === "count" ? ye.length : ye.length === 0 ? 0 : Ee === "min" ? Math.min(...ye) : Ee === "max" ? Math.max(...ye) : ye.reduce((Ge, Me) => Ge + Me, 0);
610
610
  };
611
- let Ve = 0, ve = 0;
611
+ let Ve = 0, xe = 0;
612
612
  for (const Z of u) {
613
613
  const ye = { ...Z, __agg__: fe(Z.id) };
614
614
  if (s.guard && !jd(s.guard, ye)) {
615
- ve++;
615
+ xe++;
616
616
  continue;
617
617
  }
618
618
  const Ge = {};
@@ -621,13 +621,13 @@ function Cc({
621
621
  et != null && Number.isFinite(et) && (Ge[Me] = Math.round(et * 100) / 100);
622
622
  }
623
623
  if (Object.keys(Ge).length === 0) {
624
- ve++;
624
+ xe++;
625
625
  continue;
626
626
  }
627
627
  await U(Z, Ge), Ve++;
628
628
  }
629
629
  be.success(
630
- `${s.label}: ${Ve} row${Ve === 1 ? "" : "s"} updated` + (ve > 0 ? `, ${ve} unchanged` : "")
630
+ `${s.label}: ${Ve} row${Ve === 1 ? "" : "s"} updated` + (xe > 0 ? `, ${xe} unchanged` : "")
631
631
  );
632
632
  } catch {
633
633
  be.error(`${s.label} failed`);
@@ -661,7 +661,7 @@ function Cc({
661
661
  type: "button",
662
662
  disabled: te,
663
663
  onClick: () => s.confirm ? M(!0) : void ie(),
664
- className: we(
664
+ className: ve(
665
665
  "rounded px-2 py-0.5 text-[11px] font-medium disabled:opacity-50",
666
666
  s.variant === "danger" ? "border border-red-200 text-red-600 hover:bg-red-50 dark:border-red-800 dark:hover:bg-red-900/20" : "border border-slate-200 text-slate-600 hover:bg-slate-50 dark:border-border dark:hover:bg-muted"
667
667
  ),
@@ -669,7 +669,7 @@ function Cc({
669
669
  }
670
670
  );
671
671
  }
672
- function Gc({
672
+ function Zc({
673
673
  config: s,
674
674
  matchCfg: u,
675
675
  rows: y,
@@ -678,19 +678,19 @@ function Gc({
678
678
  relatedCollection: J,
679
679
  manyField: te
680
680
  }) {
681
- const se = xi(), Q = Bl(), [M, ie] = B(!1), [Re, W] = B(null), oe = async () => {
681
+ const se = vi(), Q = Jl(), [M, ie] = B(!1), [je, W] = B(null), oe = async () => {
682
682
  if (M) return;
683
683
  ie(!0), W(null);
684
684
  const Se = s.fk_field, ne = s.alloc_qty_field, Ee = s.candidates.min_capacity ?? 1, Ue = [
685
685
  ...s.candidates.capacity_formula.matchAll(/\{\{\s*(\w+)\s*\}\}/g)
686
686
  ].map((Me) => Me[1]), fe = {};
687
- let Ve = 0, ve = 0, Z = 0;
688
- const ye = [], Ge = (Me, Oe) => vc(se, u.collection, Me, ne, Oe);
687
+ let Ve = 0, xe = 0, Z = 0;
688
+ const ye = [], Ge = (Me, Oe) => kc(se, u.collection, Me, ne, Oe);
689
689
  try {
690
690
  for (let Oe = 0; Oe < y.length; Oe++) {
691
691
  const et = y[Oe], It = Number(et[s.row_qty_field]);
692
692
  if (!Number.isFinite(It) || It <= 0) continue;
693
- const le = vi(u, et, A, U);
693
+ const le = wi(u, et, A, U);
694
694
  if (!le) continue;
695
695
  const ut = await se.request(
696
696
  ue(`/items/${u.collection}`, {
@@ -698,10 +698,10 @@ function Gc({
698
698
  fields: `id,${Se},${ne}`,
699
699
  limit: 500
700
700
  })
701
- ).then((P) => P.data ?? []), St = ut.reduce((P, j) => P + (Number(j[ne]) || 0), 0);
701
+ ).then((P) => P.data ?? []), St = ut.reduce((P, R) => P + (Number(R[ne]) || 0), 0);
702
702
  let Ke = It - St;
703
703
  if (Ke <= 0) continue;
704
- const De = vi(
704
+ const De = wi(
705
705
  {
706
706
  collection: s.candidates.collection,
707
707
  filters: s.candidates.filters,
@@ -732,15 +732,15 @@ function Gc({
732
732
  })
733
733
  ).then((P) => P.data ?? []), $t = {};
734
734
  for (const P of Bn) {
735
- const j = String(P[Se]);
736
- $t[j] = ($t[j] ?? 0) + (Number(P[ne]) || 0);
735
+ const R = String(P[Se]);
736
+ $t[R] = ($t[R] ?? 0) + (Number(P[ne]) || 0);
737
737
  }
738
738
  const F = Ke;
739
739
  for (const P of Be) {
740
740
  if (Ke <= 0) break;
741
- const j = String(P.id), he = (Dt(s.candidates.capacity_formula, P) ?? 0) - ($t[j] ?? 0) - (fe[j] ?? 0);
741
+ const R = String(P.id), he = (Dt(s.candidates.capacity_formula, P) ?? 0) - ($t[R] ?? 0) - (fe[R] ?? 0);
742
742
  if (he < Ee) continue;
743
- const $ = Math.min(Ke, he), Ae = ut.find((me) => String(me[Se]) === j);
743
+ const $ = Math.min(Ke, he), Ae = ut.find((me) => String(me[Se]) === R);
744
744
  if (Ae) {
745
745
  if (!await Ge(String(Ae.id), $)) {
746
746
  Z++;
@@ -748,15 +748,15 @@ function Gc({
748
748
  }
749
749
  } else
750
750
  await se.request(
751
- Te(`/items/${u.collection}`, { ...le.seed, [Se]: P.id, [ne]: $ })
751
+ Le(`/items/${u.collection}`, { ...le.seed, [Se]: P.id, [ne]: $ })
752
752
  );
753
- fe[j] = (fe[j] ?? 0) + $, Ke -= $, Ve += $;
753
+ fe[R] = (fe[R] ?? 0) + $, Ke -= $, Ve += $;
754
754
  }
755
- Ke < F && ve++, Ke > 0 && ye.push(Oe + 1);
755
+ Ke < F && xe++, Ke > 0 && ye.push(Oe + 1);
756
756
  }
757
757
  const Me = [];
758
758
  Me.push(
759
- Ve > 0 ? `Allocated ${Ve.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${ve} row${ve === 1 ? "" : "s"}` : "Nothing to allocate"
759
+ Ve > 0 ? `Allocated ${Ve.toLocaleString("en-US", { maximumFractionDigits: 2 })} across ${xe} row${xe === 1 ? "" : "s"}` : "Nothing to allocate"
760
760
  ), ye.length > 0 && Me.push(`short on row${ye.length === 1 ? "" : "s"} ${ye.join(", ")}`), Z > 0 && Me.push(
761
761
  `${Z} allocation${Z === 1 ? "" : "s"} kept changing while this ran — left as saved; run again`
762
762
  ), W(Me.join(" — ")), Q.invalidateQueries({ queryKey: ["o2m-rows", J, te, A] }), Q.invalidateQueries({ queryKey: ["match-agg"] });
@@ -777,15 +777,15 @@ function Gc({
777
777
  children: M ? "Allocating…" : s.label ?? "Auto allocate"
778
778
  }
779
779
  ),
780
- Re && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500", children: Re })
780
+ je && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-500", children: je })
781
781
  ] });
782
782
  }
783
- function Yc(s) {
783
+ function eu(s) {
784
784
  return s.filter(
785
- (u) => u.group_key === "__apply_values__" && !Lo.has(u.type ?? "") && !Ro.has(u.field) && !u.readonly && !(u.computed_type === "write" && u.computed_formula) && u.interface !== "formula-column" && u.interface !== "match-agg-column" && u.interface !== "relation-path"
785
+ (u) => u.group_key === "__apply_values__" && !To.has(u.type ?? "") && !jo.has(u.field) && !u.readonly && !(u.computed_type === "write" && u.computed_formula) && u.interface !== "formula-column" && u.interface !== "match-agg-column" && u.interface !== "relation-path"
786
786
  );
787
787
  }
788
- function zu({
788
+ function Hu({
789
789
  relatedCollection: s,
790
790
  manyField: u,
791
791
  parentId: y,
@@ -797,7 +797,7 @@ function zu({
797
797
  saveMode: Q = "immediate",
798
798
  showLineNumbers: M = !1,
799
799
  enableReorder: ie = !0,
800
- parentCascades: Re,
800
+ parentCascades: je,
801
801
  rowRules: W,
802
802
  columnPresets: oe,
803
803
  defaultPreset: Se,
@@ -806,7 +806,7 @@ function zu({
806
806
  uniqueBy: Ue,
807
807
  sortField: fe,
808
808
  sortDir: Ve = "asc",
809
- sectionGroupBy: ve,
809
+ sectionGroupBy: xe,
810
810
  freezeFirstColumn: Z = !1,
811
811
  rowFilter: ye,
812
812
  rowDefaults: Ge,
@@ -825,12 +825,12 @@ function zu({
825
825
  submissionErrors: $t,
826
826
  prefillParentId: F,
827
827
  parentFieldKey: P,
828
- readOnly: j = !1,
828
+ readOnly: R = !1,
829
829
  emptyLabel: Y,
830
830
  editorMode: he
831
831
  }) {
832
- var _l, kl;
833
- const $ = xi(), Ae = Td(), me = Ed(), V = Bl(), w = qc(), Wt = Ic(), Jn = Oc(), ft = zd()[P ?? ""] ?? [], S = y === "new", E = qd(), it = Id(), Ut = Ld(), Gt = `nvr_grid_editor_${s}_${P ?? u}`, [_i, Or] = B(() => {
832
+ var kl, Nl;
833
+ const $ = vi(), Ae = Md(), me = qd(), V = Jl(), w = Ac(), Wt = Rc(), Jn = jc(), ft = Vd()[P ?? ""] ?? [], S = y === "new", E = Id(), it = Od(), Ut = Ld(), Gt = `nvr_grid_editor_${s}_${P ?? u}`, [xi, Or] = B(() => {
834
834
  if (typeof localStorage > "u") return null;
835
835
  try {
836
836
  const e = localStorage.getItem(Gt);
@@ -843,7 +843,7 @@ function zu({
843
843
  queryFn: () => $.request(ue(`/field-config/${A}`)).then((e) => e.data ?? []),
844
844
  enabled: he === void 0 && !!A && !!P,
845
845
  staleTime: 5 * 6e4
846
- }), mt = T(() => {
846
+ }), mt = L(() => {
847
847
  if (he) return he;
848
848
  const e = Fe == null ? void 0 : Fe.find((t) => t.field === P), n = e != null && e.options ? typeof e.options == "string" ? (() => {
849
849
  try {
@@ -853,7 +853,7 @@ function zu({
853
853
  }
854
854
  })() : e.options : {};
855
855
  return (n == null ? void 0 : n.editor_mode) === "split" ? "split" : "drawer";
856
- }, [he, Fe, P]), qe = !j && (_i ?? mt) === "split", Qn = (e) => {
856
+ }, [he, Fe, P]), qe = !R && (xi ?? mt) === "split", Qn = (e) => {
857
857
  Or(e);
858
858
  try {
859
859
  localStorage.setItem(Gt, e);
@@ -874,27 +874,27 @@ function zu({
874
874
  } catch {
875
875
  }
876
876
  }, [Ar, Yt]);
877
- const jr = ee(null), zn = ee(null), Ko = ee(async () => {
878
- }), ki = ee(
877
+ const Rr = ee(null), zn = ee(null), Ko = ee(async () => {
878
+ }), _i = ee(
879
879
  async () => {
880
880
  }
881
- ), Rr = ee(null), Po = ee(!1);
881
+ ), jr = ee(null), Po = ee(!1);
882
882
  de(() => {
883
- if (j || typeof window > "u") return;
883
+ if (R || typeof window > "u") return;
884
884
  const e = (n) => {
885
885
  const t = n.detail;
886
886
  if (!t || typeof t.target != "string" || !t.target || A && t.collection !== A) return;
887
887
  const r = P ?? u;
888
888
  if (!(t.grid !== r && t.grid !== s)) {
889
889
  if (t.handled = !0, !Po.current) {
890
- Rr.current = { target: t.target, value: t.value ?? null };
890
+ jr.current = { target: t.target, value: t.value ?? null };
891
891
  return;
892
892
  }
893
- ki.current(t.target, t.value ?? null);
893
+ _i.current(t.target, t.value ?? null);
894
894
  }
895
895
  };
896
896
  return window.addEventListener("nvr:grid-apply-field", e), () => window.removeEventListener("nvr:grid-apply-field", e);
897
- }, [j, A, P, u, s]), de(() => {
897
+ }, [R, A, P, u, s]), de(() => {
898
898
  const e = zn.current;
899
899
  if (!e || !qe) return;
900
900
  const n = (t) => {
@@ -906,16 +906,16 @@ function zu({
906
906
  };
907
907
  return e.addEventListener("keydown", n), () => e.removeEventListener("keydown", n);
908
908
  }, [qe]);
909
- const [Xt, Hl] = B(!1), [Bt, Lr] = B(/* @__PURE__ */ new Set()), [Vn, Do] = B(!1), Wo = (e) => Lr((n) => {
909
+ const [Xt, Cl] = B(!1), [Bt, Tr] = B(/* @__PURE__ */ new Set()), [Vn, Do] = B(!1), Wo = (e) => Tr((n) => {
910
910
  const t = new Set(n);
911
911
  return t.has(e) ? t.delete(e) : t.add(e), t;
912
- }), Uo = $t ? $t.line_field ?? "line_number" : null, { data: Tr } = Ce({
912
+ }), Uo = $t ? $t.line_field ?? "line_number" : null, { data: Lr } = Ce({
913
913
  queryKey: ["erp-submissions", A ?? "", String(y)],
914
914
  queryFn: () => $.request(ue(`/erp-submissions/${A}/${encodeURIComponent(String(y))}`)).then((e) => e.data ?? []),
915
915
  enabled: !!$t && !!A && !S && !!y,
916
916
  staleTime: 15e3
917
- }), Cl = T(() => {
918
- const e = /* @__PURE__ */ new Map(), n = Tr == null ? void 0 : Tr[0];
917
+ }), Gl = L(() => {
918
+ const e = /* @__PURE__ */ new Map(), n = Lr == null ? void 0 : Lr[0];
919
919
  if (!n || n.status !== "failed") return e;
920
920
  const t = n.response, r = t && typeof t == "object" && Array.isArray(t.orderDetailResponse) ? t.orderDetailResponse : [];
921
921
  for (const i of r)
@@ -925,7 +925,7 @@ function zu({
925
925
  if (!["ERROR", "FAILED"].includes(a)) continue;
926
926
  const c = String((o == null ? void 0 : o.lineNumber) ?? "");
927
927
  if (!c || e.has(c)) continue;
928
- const d = Qc(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
928
+ const d = Fc(o == null ? void 0 : o.lineDetailedMessage), m = d.find(
929
929
  (h) => new RegExp(`^Line(?:Number)?\\s*${c}\\s*:`, "i").test(h.trim())
930
930
  ) ?? d[0];
931
931
  m && e.set(c, m.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
@@ -936,26 +936,26 @@ function zu({
936
936
  o && !e.has(o[1]) && e.set(o[1], o[2] || i.trim());
937
937
  }
938
938
  return e;
939
- }, [Tr]), Bo = ee(!1), [Jo, Ni] = B(S && !!F);
939
+ }, [Lr]), Bo = ee(!1), [Jo, ki] = B(S && !!F);
940
940
  de(() => {
941
941
  if (!Bo.current) {
942
942
  if (!S || !F || !w) {
943
- Ni(!1);
943
+ ki(!1);
944
944
  return;
945
945
  }
946
946
  Bo.current = !0, $.request(
947
947
  ue(`/items/${s}`, {
948
948
  filter: JSON.stringify({ [u]: { _eq: F } }),
949
- limit: Dl
949
+ limit: Wl
950
950
  })
951
951
  ).then((e) => {
952
952
  for (const n of e.data ?? [])
953
953
  w.queueRow(s, u, { __prefilled: !0, ...n });
954
- Ni(!1);
955
- }).catch(() => Ni(!1));
954
+ ki(!1);
955
+ }).catch(() => ki(!1));
956
956
  }
957
957
  }, []);
958
- const [Gl, Qo] = B(!1), Yl = T(
958
+ const [Yl, Qo] = B(!1), Xl = L(
959
959
  () => /* @__PURE__ */ new Set([
960
960
  "id",
961
961
  u,
@@ -968,7 +968,7 @@ function zu({
968
968
  "creator"
969
969
  ]),
970
970
  [u]
971
- ), zo = ee(/* @__PURE__ */ new WeakMap()), Xl = async (e) => {
971
+ ), zo = ee(/* @__PURE__ */ new WeakMap()), Zl = async (e) => {
972
972
  const n = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Set([
973
973
  ...Object.keys(He),
974
974
  ...Object.keys(hr)
@@ -1003,20 +1003,20 @@ function zu({
1003
1003
  }
1004
1004
  })
1005
1005
  ), n;
1006
- }, Zl = async (e) => {
1006
+ }, ea = async (e) => {
1007
1007
  if (w)
1008
1008
  try {
1009
1009
  const t = (await $.request(
1010
1010
  ue(`/items/${s}`, {
1011
1011
  filter: JSON.stringify({ [u]: { _eq: e } }),
1012
- limit: Dl
1012
+ limit: Wl
1013
1013
  })
1014
1014
  )).data ?? [], r = t.map((m) => {
1015
1015
  const h = {};
1016
1016
  for (const [b, v] of Object.entries(m))
1017
- !Yl.has(b) && v != null && typeof v != "object" && (h[b] = v);
1017
+ !Xl.has(b) && v != null && typeof v != "object" && (h[b] = v);
1018
1018
  return h;
1019
- }), i = await Xl(r), { rows: o, dropped: a } = Bc(r, i);
1019
+ }), i = await Zl(r), { rows: o, dropped: a } = zc(r, i);
1020
1020
  an(o).forEach((m, h) => {
1021
1021
  var b;
1022
1022
  (b = a[h]) != null && b.length && zo.current.set(m, new Set(a[h])), w.queueRow(s, u, m);
@@ -1033,14 +1033,14 @@ function zu({
1033
1033
  } catch {
1034
1034
  be.error("Could not copy lines");
1035
1035
  }
1036
- }, pt = A && !S ? `?parent_collection=${encodeURIComponent(A)}&parent_id=${encodeURIComponent(y)}` : "", [je, Fn] = B(null), [ea, Si] = B(null), [Vo, Mr] = B(!1), [ta, Fo] = B(!1), { data: na = [], isLoading: ra } = Ce({
1037
- queryKey: ["o2m-row-revisions", s, je == null ? void 0 : je.id],
1036
+ }, pt = A && !S ? `?parent_collection=${encodeURIComponent(A)}&parent_id=${encodeURIComponent(y)}` : "", [Re, Fn] = B(null), [ta, Ni] = B(null), [Vo, Mr] = B(!1), [na, Fo] = B(!1), { data: ra = [], isLoading: ia } = Ce({
1037
+ queryKey: ["o2m-row-revisions", s, Re == null ? void 0 : Re.id],
1038
1038
  queryFn: () => $.request(
1039
- ue("/revisions", { collection: s, item: String(je == null ? void 0 : je.id) })
1039
+ ue("/revisions", { collection: s, item: String(Re == null ? void 0 : Re.id) })
1040
1040
  ).then((e) => e.data ?? []),
1041
- enabled: !!(je != null && je.id),
1041
+ enabled: !!(Re != null && Re.id),
1042
1042
  staleTime: 15e3
1043
- }), { data: Zt, isLoading: ia } = Ce({
1043
+ }), { data: Zt, isLoading: oa } = Ce({
1044
1044
  queryKey: ["o2m-field-snapshots", s, u, y],
1045
1045
  queryFn: () => $.request(
1046
1046
  ue("/revisions/o2m-snapshots", {
@@ -1051,7 +1051,7 @@ function zu({
1051
1051
  ),
1052
1052
  enabled: Vo && !S,
1053
1053
  staleTime: 15e3
1054
- }), oa = T(
1054
+ }), sa = L(
1055
1055
  () => ((Zt == null ? void 0 : Zt.data) ?? []).map((e) => ({
1056
1056
  id: e.revision_id,
1057
1057
  delta: e.delta ?? null,
@@ -1066,17 +1066,17 @@ function zu({
1066
1066
  })),
1067
1067
  [Zt]
1068
1068
  );
1069
- async function sa(e) {
1069
+ async function la(e) {
1070
1070
  Fo(!0);
1071
1071
  try {
1072
1072
  const n = await $.request(
1073
- Te("/revisions/o2m-restore", {
1073
+ Le("/revisions/o2m-restore", {
1074
1074
  collection: s,
1075
1075
  many_field: u,
1076
1076
  parent_id: y,
1077
1077
  target_timestamp: e
1078
1078
  })
1079
- ), t = Kd(n);
1079
+ ), t = Pd(n);
1080
1080
  t && be.warning(t, { duration: 1e4 }), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), V.invalidateQueries({
1081
1081
  queryKey: ["o2m-field-snapshots", s, u, y]
1082
1082
  }), Mr(!1);
@@ -1085,19 +1085,19 @@ function zu({
1085
1085
  Fo(!1);
1086
1086
  }
1087
1087
  }
1088
- j && (ie = !1);
1089
- const Hn = T(
1088
+ R && (ie = !1);
1089
+ const Hn = L(
1090
1090
  () => new Set(
1091
1091
  (W ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
1092
1092
  ),
1093
1093
  [W]
1094
- ), [f, Je] = B(null), ht = $l(), Cn = (e, n) => `${ht}-${e}-${n}`, Ye = ee(null), Ho = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Ot = ee(null), Kr = (e, n) => {
1094
+ ), [f, Je] = B(null), ht = El(), Cn = (e, n) => `${ht}-${e}-${n}`, Ye = ee(null), Ho = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Ot = ee(null), Kr = (e, n) => {
1095
1095
  !e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
1096
- }, la = (e) => {
1096
+ }, aa = (e) => {
1097
1097
  var t, r, i;
1098
1098
  const n = ((i = (r = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : r.call(t, "[data-grid-cell]")) == null ? void 0 : i.getAttribute("data-grid-cell")) ?? null;
1099
1099
  n !== Ot.current && (Ot.current && Kr(Ot.current, "end"), Ot.current = n, n && Kr(n, "start"));
1100
- }, aa = (e) => {
1100
+ }, da = (e) => {
1101
1101
  var t, r;
1102
1102
  (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (Ot.current && Kr(Ot.current, "end"), Ot.current = null);
1103
1103
  };
@@ -1127,7 +1127,7 @@ function zu({
1127
1127
  },
1128
1128
  []
1129
1129
  );
1130
- const $i = ee(0), gt = ee({
1130
+ const Si = ee(0), gt = ee({
1131
1131
  rowId: null,
1132
1132
  seqs: /* @__PURE__ */ new Map()
1133
1133
  });
@@ -1146,7 +1146,7 @@ function zu({
1146
1146
  }
1147
1147
  if (Gn.current !== e.rowId && !en.current)
1148
1148
  return { ok: !0, committed: !1 };
1149
- const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + I.length + 1}` : bi(I, e.rowId, X), t = await Kt();
1149
+ const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + I.length + 1}` : gi(I, e.rowId, X), t = await Kt();
1150
1150
  return { ok: t, committed: t, label: n };
1151
1151
  };
1152
1152
  const tt = w == null ? void 0 : w.noteLineDraft, Go = !!f && Gn.current === (f.rowId ?? null);
@@ -1169,7 +1169,7 @@ function zu({
1169
1169
  if (Pr)
1170
1170
  return Pr(ht, () => Co.current()), () => Pr(ht, null);
1171
1171
  }, [Pr, ht]), de(() => {
1172
- if (!f || j) return;
1172
+ if (!f || R) return;
1173
1173
  const e = (n) => {
1174
1174
  const t = n.target;
1175
1175
  if (t) {
@@ -1185,9 +1185,9 @@ function zu({
1185
1185
  }
1186
1186
  };
1187
1187
  return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1188
- }, [f, j]);
1188
+ }, [f, R]);
1189
1189
  const [Et, xn] = B(!1), [Zo, At] = B(null), [Yn, Dr] = B(null), [es, ts] = B(!1);
1190
- async function da() {
1190
+ async function ca() {
1191
1191
  if (!Yn) return;
1192
1192
  ts(!0);
1193
1193
  const e = [];
@@ -1196,9 +1196,9 @@ function zu({
1196
1196
  const i = [];
1197
1197
  for (const o of r.members)
1198
1198
  try {
1199
- await $.request(Te(`/items/${r.collection}`, { ...o, [r.fkField]: r.rowId }));
1199
+ await $.request(Le(`/items/${r.collection}`, { ...o, [r.fkField]: r.rowId }));
1200
1200
  } catch (a) {
1201
- i.push(o), n || (n = Ul(a));
1201
+ i.push(o), n || (n = Bl(a));
1202
1202
  }
1203
1203
  i.length && e.push({ ...r, members: i });
1204
1204
  }
@@ -1211,24 +1211,24 @@ function zu({
1211
1211
  } : null
1212
1212
  );
1213
1213
  }
1214
- const [Wr, Xn] = B(null), xe = Vd(), [Ei, ca] = B(() => {
1214
+ const [Wr, Xn] = B(null), we = Fd(), [$i, ua] = B(() => {
1215
1215
  var e;
1216
1216
  return Se === qr ? qr : Se && (oe != null && oe.some((n) => n.name === Se)) ? Se : (e = oe == null ? void 0 : oe[0]) == null ? void 0 : e.name;
1217
1217
  });
1218
1218
  function ns(e) {
1219
- ca(e);
1219
+ ua(e);
1220
1220
  }
1221
1221
  const bt = ee(null), Zn = ee(!1), Ur = (e) => {
1222
1222
  const n = e;
1223
1223
  return !n || !(n instanceof HTMLElement) ? !1 : n.isConnected ? !!(n.closest("[data-o2m-editing]") || n.closest("[data-radix-popper-content-wrapper]") || n.closest("[data-nvr-combobox-panel]") || n.closest('[role="dialog"]') || n.closest("[data-omx-overlay]")) : !0;
1224
- }, { data: qi } = Ce({
1224
+ }, { data: Ei } = Ce({
1225
1225
  queryKey: ["auto-table-layout", s],
1226
1226
  queryFn: () => $.request(
1227
1227
  ue("/collection-layouts", { collection: s })
1228
1228
  ).then((e) => (e.data ?? []).find((n) => n.layout_type === "table") ?? null),
1229
1229
  enabled: !U,
1230
1230
  staleTime: 5 * 6e4
1231
- }), tn = U ?? (qi == null ? void 0 : qi.id) ?? null, { data: ae = [], isLoading: rs } = Ce({
1231
+ }), tn = U ?? (Ei == null ? void 0 : Ei.id) ?? null, { data: ae = [], isLoading: rs } = Ce({
1232
1232
  queryKey: $r.fieldConfig(s, tn),
1233
1233
  queryFn: () => $.request(
1234
1234
  ue(
@@ -1242,22 +1242,22 @@ function zu({
1242
1242
  // whichever filled the cache first decided the shape here (prod 2026-11-13: relations.find
1243
1243
  // is not a function).
1244
1244
  queryKey: $r.collectionRelations(s),
1245
- queryFn: () => ql($, s),
1245
+ queryFn: () => Il($, s),
1246
1246
  staleTime: 10 * 6e4
1247
- }), Pe = Array.isArray(is) ? is : [], { data: Ii } = Ce({
1247
+ }), Pe = Array.isArray(is) ? is : [], { data: qi } = Ce({
1248
1248
  queryKey: ["layout-meta", tn],
1249
1249
  queryFn: () => $.request(
1250
1250
  ue(`/collection-layouts/${tn}`)
1251
1251
  ).then((e) => e.data ?? {}),
1252
1252
  enabled: !!tn,
1253
1253
  staleTime: 5 * 6e4
1254
- }), X = (Ii == null ? void 0 : Ii.row_order_field) ?? null, nn = T(() => {
1254
+ }), X = (qi == null ? void 0 : qi.row_order_field) ?? null, nn = L(() => {
1255
1255
  if (!ye || Object.keys(ye).length === 0) return null;
1256
1256
  const e = {};
1257
1257
  for (const [n, t] of Object.entries(ye))
1258
1258
  e[n] = t !== null && typeof t == "object" ? t : { _eq: t };
1259
1259
  return e;
1260
- }, [ye]), rn = T(
1260
+ }, [ye]), rn = L(
1261
1261
  () => Object.fromEntries(
1262
1262
  Object.entries(Ge ?? {}).filter(
1263
1263
  ([, e]) => e === null || ["string", "number", "boolean"].includes(typeof e)
@@ -1286,25 +1286,25 @@ function zu({
1286
1286
  ).then((e) => e.data ?? []),
1287
1287
  enabled: !S,
1288
1288
  staleTime: 3e4
1289
- }), ot = T(
1290
- () => hc($, s),
1289
+ }), ot = L(
1290
+ () => yc($, s),
1291
1291
  [$, s]
1292
1292
  );
1293
1293
  de(() => {
1294
- !S && !j && ot.noteRows(Ie);
1295
- }, [Ie, ot, S, j]);
1294
+ !S && !R && ot.noteRows(Ie);
1295
+ }, [Ie, ot, S, R]);
1296
1296
  const kn = (e) => {
1297
1297
  if (S) return {};
1298
1298
  const n = ot.settled(e);
1299
1299
  return typeof n == "number" && n > 0 ? { __base_revision: n } : {};
1300
- }, [Br, Oi] = B(null), Nn = ee(async () => !1), Ai = ee([]), er = () => {
1301
- const e = Ai.current;
1302
- Ai.current = [], e.length !== 0 && Oi((n) => {
1300
+ }, [Br, Ii] = B(null), Nn = ee(async () => !1), Oi = ee([]), er = () => {
1301
+ const e = Oi.current;
1302
+ Oi.current = [], e.length !== 0 && Ii((n) => {
1303
1303
  const t = new Map((n ?? []).map((r) => [r.rowId, r]));
1304
1304
  for (const r of e) t.set(r.rowId, r);
1305
1305
  return [...t.values()];
1306
1306
  });
1307
- }, ua = Ad(2e3), { data: Sn } = Ce({
1307
+ }, fa = Rd(2e3), { data: Sn } = Ce({
1308
1308
  queryKey: ["o2m-cell-provenance", s, u, y, on],
1309
1309
  queryFn: () => $.request(
1310
1310
  ue("/revisions/o2m-cell-provenance", {
@@ -1313,10 +1313,10 @@ function zu({
1313
1313
  parent_id: y
1314
1314
  })
1315
1315
  ).then((e) => ({ data: e.data ?? {}, created: e.created ?? {} })),
1316
- enabled: ua && !!J && !S && Ie.length > 0,
1316
+ enabled: fa && !!J && !S && Ie.length > 0,
1317
1317
  staleTime: 6e4,
1318
1318
  placeholderData: (e) => e
1319
- }), fa = !!(ut != null && ut.enabled) && typeof (ut == null ? void 0 : ut.field) == "string", { data: st } = Ce({
1319
+ }), ma = !!(ut != null && ut.enabled) && typeof (ut == null ? void 0 : ut.field) == "string", { data: st } = Ce({
1320
1320
  queryKey: [
1321
1321
  "line-aging",
1322
1322
  A ?? "",
@@ -1331,18 +1331,18 @@ function zu({
1331
1331
  parent_id: y
1332
1332
  })
1333
1333
  ).then((e) => e.data ?? null),
1334
- enabled: fa && !S && !!A,
1334
+ enabled: ma && !S && !!A,
1335
1335
  staleTime: 6e4,
1336
1336
  placeholderData: (e) => e
1337
- }), os = T(
1337
+ }), os = L(
1338
1338
  () => new Set(st != null && st.overdue ? st.overdue_ids : []),
1339
1339
  [st]
1340
- ), ss = st != null && st.overdue ? `${st.label} still missing · ${st.days} ${st.days === 1 ? "day" : "days"} on the clock (limit ${st.threshold_days})` : void 0, ji = (Sn == null ? void 0 : Sn.data) ?? {}, ma = (Sn == null ? void 0 : Sn.created) ?? {}, Jr = (e) => {
1341
- const n = ma[e];
1340
+ ), ss = st != null && st.overdue ? `${st.label} still missing · ${st.days} ${st.days === 1 ? "day" : "days"} on the clock (limit ${st.threshold_days})` : void 0, Ai = (Sn == null ? void 0 : Sn.data) ?? {}, pa = (Sn == null ? void 0 : Sn.created) ?? {}, Jr = (e) => {
1341
+ const n = pa[e];
1342
1342
  if (!n) return null;
1343
- const t = Rc(n.comment);
1344
- return t ? `From ${t.template} · ${Ol(n.at)} by ${n.who}` : null;
1345
- }, sn = Re ?? [], ls = bn({
1343
+ const t = Mc(n.comment);
1344
+ return t ? `From ${t.template} · ${Al(n.at)} by ${n.who}` : null;
1345
+ }, sn = je ?? [], ls = bn({
1346
1346
  queries: sn.map((e) => ({
1347
1347
  queryKey: [
1348
1348
  "resolve-cascade",
@@ -1362,7 +1362,7 @@ function zu({
1362
1362
  enabled: !!(E != null && E.collection) && !!e.parent_field && !!e.child_field,
1363
1363
  staleTime: 3e5
1364
1364
  }))
1365
- }), He = T(() => {
1365
+ }), He = L(() => {
1366
1366
  const e = {};
1367
1367
  return !E || !sn.length || sn.forEach((n, t) => {
1368
1368
  var o;
@@ -1378,7 +1378,7 @@ function zu({
1378
1378
  }
1379
1379
  }));
1380
1380
  }), e;
1381
- }, [sn, ls, E]), Qr = T(() => {
1381
+ }, [sn, ls, E]), Qr = L(() => {
1382
1382
  var n, t;
1383
1383
  const e = {};
1384
1384
  for (const r of sn) {
@@ -1391,54 +1391,54 @@ function zu({
1391
1391
  de(() => {
1392
1392
  Ye.current || Vr({});
1393
1393
  }, [on]);
1394
- const Qe = D && w ? w.getPendingDeletes(s, u) : /* @__PURE__ */ new Set(), [tr, as] = B(""), Fr = ee(null), nr = Nd(tr), pa = rc(tr.trim(), 300), Ri = T(() => ic(nr), [nr]), ln = !S && Ie.length >= qo, ds = T(
1394
+ const Qe = D && w ? w.getPendingDeletes(s, u) : /* @__PURE__ */ new Set(), [tr, as] = B(""), Ri = ee(null), nr = Sd(tr), ha = ic(tr.trim(), 300), ji = L(() => oc(nr), [nr]), ln = !S && Ie.length >= qo, ds = L(
1395
1395
  () => nn ? { _and: [{ [u]: { _eq: y } }, nn] } : { [u]: { _eq: y } },
1396
1396
  [nn, u, y]
1397
- ), lt = oc({
1397
+ ), lt = sc({
1398
1398
  client: $,
1399
1399
  collection: s,
1400
1400
  filter: ds,
1401
- query: pa,
1401
+ query: ha,
1402
1402
  enabled: ln,
1403
1403
  version: on
1404
- }), ha = sc({
1404
+ }), ga = lc({
1405
1405
  client: $,
1406
1406
  collection: s,
1407
1407
  filter: ds,
1408
1408
  enabled: ln,
1409
1409
  version: on
1410
- }), ga = ee(/* @__PURE__ */ new Map()), ba = [...C.keys()].sort().join(","), Li = (f == null ? void 0 : f.rowId) ?? null, ya = (lt.rows ?? []).map((e) => String(e.id)).join(","), Jt = T(() => {
1411
- const e = ga.current;
1410
+ }), ba = ee(/* @__PURE__ */ new Map()), ya = [...C.keys()].sort().join(","), Ti = (f == null ? void 0 : f.rowId) ?? null, wa = (lt.rows ?? []).map((e) => String(e.id)).join(","), Jt = L(() => {
1411
+ const e = ba.current;
1412
1412
  for (const n of [...e.keys()])
1413
- n !== Li && !C.has(n) && e.delete(n);
1413
+ n !== Ti && !C.has(n) && e.delete(n);
1414
1414
  for (const n of lt.rows ?? []) {
1415
1415
  const t = String(n.id);
1416
- (t === Li || C.has(t)) && e.set(t, n);
1416
+ (t === Ti || C.has(t)) && e.set(t, n);
1417
1417
  }
1418
- return lc(Ie, lt.rows, [...e.values()]);
1419
- }, [Ie, ya, Li, ba]), rr = T(
1418
+ return ac(Ie, lt.rows, [...e.values()]);
1419
+ }, [Ie, wa, Ti, ya]), rr = L(
1420
1420
  () => new Set(Jt.map((e) => String(e.id))),
1421
1421
  [Jt]
1422
- ), ir = T(
1422
+ ), ir = L(
1423
1423
  () => Jt.length ? [...Ie, ...Jt] : Ie,
1424
1424
  [Ie, Jt]
1425
1425
  );
1426
1426
  de(() => {
1427
- !S && !j && Jt.length && ot.noteRows(Jt);
1428
- }, [Jt, ot, S, j]);
1429
- const Ti = ee(/* @__PURE__ */ new Set()), cs = ee(null);
1427
+ !S && !R && Jt.length && ot.noteRows(Jt);
1428
+ }, [Jt, ot, S, R]);
1429
+ const Li = ee(/* @__PURE__ */ new Set()), cs = ee(null);
1430
1430
  de(() => {
1431
- Ti.current = /* @__PURE__ */ new Set();
1431
+ Li.current = /* @__PURE__ */ new Set();
1432
1432
  }, [nr]);
1433
- const Mi = T(
1433
+ const Mi = L(
1434
1434
  () => new Map(
1435
1435
  ae.filter((e) => e.computed_type === "write" && !!e.computed_formula).map((e) => [e.field, String(e.computed_formula)])
1436
1436
  ),
1437
1437
  [ae]
1438
- ), us = T(
1438
+ ), us = L(
1439
1439
  () => ae.filter((e) => e.interface === "relation-path" && e.field.includes(".")).map((e) => e.field),
1440
1440
  [ae]
1441
- ), fs = T(() => ae.filter((e) => e.interface === "match-agg-column"), [ae]), Ki = T(
1441
+ ), fs = L(() => ae.filter((e) => e.interface === "match-agg-column"), [ae]), Ki = L(
1442
1442
  () => fs.map((e) => {
1443
1443
  const n = e.options ? typeof e.options == "string" ? (() => {
1444
1444
  try {
@@ -1453,7 +1453,7 @@ function zu({
1453
1453
  i.push([a, c.slice(5)]);
1454
1454
  continue;
1455
1455
  }
1456
- const d = To(c, {}, y, E == null ? void 0 : E.draft);
1456
+ const d = Lo(c, {}, y, E == null ? void 0 : E.draft);
1457
1457
  if (d == null || d === "") {
1458
1458
  o = !0;
1459
1459
  continue;
@@ -1507,7 +1507,7 @@ function zu({
1507
1507
  enabled: !e.unresolved && !!e.collection && !S,
1508
1508
  staleTime: 3e4
1509
1509
  }))
1510
- }), wa = T(() => {
1510
+ }), va = L(() => {
1511
1511
  const e = /* @__PURE__ */ new Map();
1512
1512
  return Ki.forEach((n, t) => {
1513
1513
  var r;
@@ -1516,7 +1516,7 @@ function zu({
1516
1516
  rows: ((r = ms[t]) == null ? void 0 : r.data) ?? []
1517
1517
  });
1518
1518
  }), e;
1519
- }, [Ki, ms]), ps = T(() => ae.filter((e) => e.interface === "formula-column"), [ae]), hs = T(() => {
1519
+ }, [Ki, ms]), ps = L(() => ae.filter((e) => e.interface === "formula-column"), [ae]), hs = L(() => {
1520
1520
  const e = /* @__PURE__ */ new Set();
1521
1521
  for (const n of ps) {
1522
1522
  const t = n.options ? typeof n.options == "string" ? (() => {
@@ -1530,23 +1530,23 @@ function zu({
1530
1530
  i[1].includes(".") && e.add(i[1]);
1531
1531
  }
1532
1532
  return [...e];
1533
- }, [ps]), Pi = T(() => {
1533
+ }, [ps]), Pi = L(() => {
1534
1534
  const e = new Set(us);
1535
1535
  for (const n of hs) e.add(n);
1536
- return ve != null && ve.includes(".") && e.add(ve), [...e];
1537
- }, [us, hs, ve]), va = K.map((e) => String(e.id ?? "")).join(","), Di = T(() => {
1536
+ return xe != null && xe.includes(".") && e.add(xe), [...e];
1537
+ }, [us, hs, xe]), xa = K.map((e) => String(e.id ?? "")).join(","), Di = L(() => {
1538
1538
  const e = /* @__PURE__ */ new Set(), n = (t) => {
1539
1539
  const r = t == null ? "" : String(t);
1540
1540
  r && !r.startsWith("pending:") && r !== "new" && e.add(r);
1541
1541
  };
1542
1542
  for (const t of ir) n(t.id);
1543
1543
  for (const t of K) n(t.id);
1544
- if (xe !== "original") {
1545
- const t = ft.find((r) => r.addendumId === xe);
1544
+ if (we !== "original") {
1545
+ const t = ft.find((r) => r.addendumId === we);
1546
1546
  for (const r of (t == null ? void 0 : t.rows) ?? []) n(r.id);
1547
1547
  }
1548
1548
  return [...e];
1549
- }, [ir, va, xe, ft]), { data: $e } = Ce({
1549
+ }, [ir, xa, we, ft]), { data: $e } = Ce({
1550
1550
  queryKey: [
1551
1551
  "o2m-resolve-paths",
1552
1552
  s,
@@ -1563,7 +1563,7 @@ function zu({
1563
1563
  ).then((e) => e.data ?? { rows: {}, targets: {} }),
1564
1564
  enabled: Pi.length > 0 && Di.length > 0,
1565
1565
  staleTime: 3e4
1566
- }), yt = T(() => {
1566
+ }), yt = L(() => {
1567
1567
  if (!$e) return;
1568
1568
  const e = {};
1569
1569
  for (const [n, t] of Object.entries($e.rows)) {
@@ -1571,7 +1571,7 @@ function zu({
1571
1571
  for (const [r, i] of Object.entries(t)) e[n][r] = i.value;
1572
1572
  }
1573
1573
  return e;
1574
- }, [$e]), I = T(() => {
1574
+ }, [$e]), I = L(() => {
1575
1575
  let e = yt ? ir.map((n) => ({ ...n, ...yt[String(n.id)] ?? {} })) : ir;
1576
1576
  if (X) {
1577
1577
  const n = (t) => {
@@ -1584,8 +1584,8 @@ function zu({
1584
1584
  const r = D ? C.get(String(n.id)) : void 0, i = D ? C.get(String(t.id)) : void 0, o = (r == null ? void 0 : r[fe]) ?? n[fe], a = (i == null ? void 0 : i[fe]) ?? t[fe];
1585
1585
  let c = 0;
1586
1586
  return o == null && a == null ? c = 0 : o == null ? c = 1 : a == null ? c = -1 : typeof o == "number" && typeof a == "number" ? c = o - a : c = String(o).localeCompare(String(a), void 0, { sensitivity: "base" }), Ve === "desc" ? -c : c;
1587
- })), ve && yt) {
1588
- const n = (t) => String(t[ve] ?? "").trim();
1587
+ })), xe && yt) {
1588
+ const n = (t) => String(t[xe] ?? "").trim();
1589
1589
  e = [...e].sort((t, r) => {
1590
1590
  const i = n(t), o = n(r);
1591
1591
  return i === o ? 0 : i ? o ? i.localeCompare(o, void 0, { sensitivity: "base" }) : -1 : 1;
@@ -1600,27 +1600,27 @@ function zu({
1600
1600
  C,
1601
1601
  fe,
1602
1602
  Ve,
1603
- ve
1604
- ]), gs = !!ve && !!yt, Hr = ve ? `nvr_grid_sections:${s}:${P ?? u}` : null, [bs, xa] = B(() => {
1605
- if (!Hr || typeof localStorage > "u") return /* @__PURE__ */ new Set();
1603
+ xe
1604
+ ]), gs = !!xe && !!yt, Fr = xe ? `nvr_grid_sections:${s}:${P ?? u}` : null, [bs, _a] = B(() => {
1605
+ if (!Fr || typeof localStorage > "u") return /* @__PURE__ */ new Set();
1606
1606
  try {
1607
- const e = localStorage.getItem(Hr), n = e ? JSON.parse(e) : null;
1607
+ const e = localStorage.getItem(Fr), n = e ? JSON.parse(e) : null;
1608
1608
  return new Set(Array.isArray(n) ? n.map(String) : []);
1609
1609
  } catch {
1610
1610
  return /* @__PURE__ */ new Set();
1611
1611
  }
1612
- }), or = (e) => String(e[ve ?? ""] ?? "").trim() || "Uncategorized", _a = (e) => xa((n) => {
1612
+ }), or = (e) => String(e[xe ?? ""] ?? "").trim() || "Uncategorized", ka = (e) => _a((n) => {
1613
1613
  const t = new Set(n);
1614
- if (t.has(e) ? t.delete(e) : t.add(e), Hr)
1614
+ if (t.has(e) ? t.delete(e) : t.add(e), Fr)
1615
1615
  try {
1616
- localStorage.setItem(Hr, JSON.stringify([...t]));
1616
+ localStorage.setItem(Fr, JSON.stringify([...t]));
1617
1617
  } catch {
1618
1618
  }
1619
1619
  return t;
1620
- }), ka = (e) => {
1620
+ }), Na = (e) => {
1621
1621
  const n = [];
1622
- for (const t of Le) {
1623
- const r = hi(t.options) ?? {}, i = r.aggregate;
1622
+ for (const t of Te) {
1623
+ const r = pi(t.options) ?? {}, i = r.aggregate;
1624
1624
  if (!i || t.interface === "formula-column" || t.interface === "match-agg-column") continue;
1625
1625
  const o = e.map((d) => {
1626
1626
  const p = String(d.id), m = C.has(p) ? { ...d, ...C.get(p) } : d;
@@ -1638,7 +1638,7 @@ function zu({
1638
1638
  n.push({ label: t.label || _e(t.field), text: c });
1639
1639
  }
1640
1640
  return n;
1641
- }, Wi = T(
1641
+ }, Wi = L(
1642
1642
  () => ae.filter(
1643
1643
  (e) => e.computed_type === "write" && typeof e.computed_formula == "string" && e.computed_formula.trim()
1644
1644
  ),
@@ -1649,7 +1649,7 @@ function zu({
1649
1649
  const t = n === void 0 ? ys(e.id) : n, r = { ...e };
1650
1650
  for (const i of Wi) {
1651
1651
  const o = i.computed_formula;
1652
- if (t && !Dd(o, r, t)) continue;
1652
+ if (t && !Wd(o, r, t)) continue;
1653
1653
  const a = Dt(o, r);
1654
1654
  a !== null && (r[i.field] = a);
1655
1655
  }
@@ -1661,7 +1661,7 @@ function zu({
1661
1661
  if (!(n.startsWith("pending:") || n === "new"))
1662
1662
  return I.find((t) => String(t.id) === n);
1663
1663
  }
1664
- const Na = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), sr = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
1664
+ const Sa = /* @__PURE__ */ new Set(["__apply_values__", "__create_with_defaults__"]), sr = (e) => e === "select-multiple-m2m" || (e ?? "").endsWith("-m2m");
1665
1665
  function Ui(e) {
1666
1666
  const n = Pe.find(
1667
1667
  (r) => r.one_collection === s && (r.one_field === e.field || r.junction_field != null && r.many_collection === e.field)
@@ -1702,7 +1702,7 @@ function zu({
1702
1702
  const r = lr(t, n);
1703
1703
  return X && n.push(Number(r[X])), r;
1704
1704
  });
1705
- }, Ji = T(() => {
1705
+ }, Ji = L(() => {
1706
1706
  const e = [
1707
1707
  ...(I ?? []).filter((n) => !Qe.has(String(n.id)) && !rr.has(String(n.id))).map((n) => {
1708
1708
  const t = String(n.id), r = C.has(t) ? { ...n, ...C.get(t) } : n;
@@ -1715,45 +1715,45 @@ function zu({
1715
1715
  r >= 0 && r < e.length && (e[r] = n);
1716
1716
  }
1717
1717
  return e;
1718
- }, [I, Bi, f, rr]), ar = T(() => {
1719
- if (xe === "original") return Ji;
1720
- const e = ft.find((n) => n.addendumId === xe);
1718
+ }, [I, Bi, f, rr]), ar = L(() => {
1719
+ if (we === "original") return Ji;
1720
+ const e = ft.find((n) => n.addendumId === we);
1721
1721
  return e ? e.rows.map(
1722
1722
  (n) => ge(
1723
1723
  { ...n },
1724
1724
  e.baseRows ? n : void 0
1725
1725
  )
1726
1726
  ) : Ji;
1727
- }, [xe, ft, Ji]), ws = Ie.length >= qo, jt = E == null ? void 0 : E.draft, dn = Pt(
1727
+ }, [we, ft, Ji]), ws = Ie.length >= qo, Rt = E == null ? void 0 : E.draft, dn = Pt(
1728
1728
  (e) => {
1729
1729
  if (e.startsWith("$parent."))
1730
- return (jt == null ? void 0 : jt[e.slice(8)]) ?? 0;
1730
+ return (Rt == null ? void 0 : Rt[e.slice(8)]) ?? 0;
1731
1731
  if (e.startsWith("$sum.")) {
1732
1732
  const n = e.slice(5);
1733
1733
  return ar.reduce((t, r) => t + (Number(r[n]) || 0), 0);
1734
1734
  }
1735
- return e === "$count" ? ar.length : jt == null ? void 0 : jt[e];
1735
+ return e === "$count" ? ar.length : Rt == null ? void 0 : Rt[e];
1736
1736
  },
1737
- [jt, ar]
1738
- ), Qi = T(() => Ke != null && Ke.length ? Ke.map((e) => ({ ...e, result: ct(e.value, dn) })) : null, [Ke, dn]), Cr = T(
1739
- () => De != null && De.endpoint ? Fd(De.endpoint, jt) : null,
1740
- [De == null ? void 0 : De.endpoint, jt]
1741
- ), zi = Hd({
1737
+ [Rt, ar]
1738
+ ), Qi = L(() => Ke != null && Ke.length ? Ke.map((e) => ({ ...e, result: ct(e.value, dn) })) : null, [Ke, dn]), Hr = L(
1739
+ () => De != null && De.endpoint ? Hd(De.endpoint, Rt) : null,
1740
+ [De == null ? void 0 : De.endpoint, Rt]
1741
+ ), zi = Cd({
1742
1742
  client: $,
1743
- endpoint: Cr,
1743
+ endpoint: Hr,
1744
1744
  enabled: !!De && !S
1745
- }), R = De && !S ? zi.data ?? null : null, vs = !!De && !S && !!Cr && zi.isLoading, xs = !!De && !S && zi.isError, dr = Pt(
1745
+ }), j = De && !S ? zi.data ?? null : null, vs = !!De && !S && !!Hr && zi.isLoading, xs = !!De && !S && zi.isError, dr = Pt(
1746
1746
  (e) => e.label || _e(e.field),
1747
1747
  []
1748
- ), { isAdmin: $n } = Od(), Gr = Pt(
1748
+ ), { isAdmin: $n } = Ad(), Cr = Pt(
1749
1749
  (e) => {
1750
1750
  var n;
1751
- return !$n && ((n = hi(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
1751
+ return !$n && ((n = pi(e.options)) == null ? void 0 : n.admin_only_edit) === !0;
1752
1752
  },
1753
1753
  [$n]
1754
1754
  ), Vi = Pt(
1755
- (e, n) => !!(R != null && R.closed_locked) && !$n && R.columns.includes(e) && Ct(R, n[R.key_field], e),
1756
- [R, $n]
1755
+ (e, n) => !!(j != null && j.closed_locked) && !$n && j.columns.includes(e) && Ct(j, n[j.key_field], e),
1756
+ [j, $n]
1757
1757
  ), En = Pt(
1758
1758
  async (e, n, t) => {
1759
1759
  if (e.startsWith("pending:")) {
@@ -1785,21 +1785,21 @@ function zu({
1785
1785
  },
1786
1786
  // eslint-disable-next-line react-hooks/exhaustive-deps
1787
1787
  [K, w, D, s, u, $, V, y]
1788
- ), cr = Cr ? `nvr_compare_dismiss:${Cr}` : null, [_s, Sa] = B(() => {
1788
+ ), cr = Hr ? `nvr_compare_dismiss:${Hr}` : null, [_s, $a] = B(() => {
1789
1789
  try {
1790
1790
  return !cr || typeof window > "u" ? /* @__PURE__ */ new Set() : new Set(JSON.parse(window.localStorage.getItem(cr) ?? "[]"));
1791
1791
  } catch {
1792
1792
  return /* @__PURE__ */ new Set();
1793
1793
  }
1794
- }), ks = T(
1794
+ }), ks = L(
1795
1795
  // `add` proposals need the plan grid's per-period arithmetic; the flat grid only fills.
1796
- () => ((R == null ? void 0 : R.proposals) ?? []).filter(
1796
+ () => ((j == null ? void 0 : j.proposals) ?? []).filter(
1797
1797
  (e) => e.mode !== "add" && !_s.has(e.id)
1798
1798
  ),
1799
- [R == null ? void 0 : R.proposals, _s]
1799
+ [j == null ? void 0 : j.proposals, _s]
1800
1800
  ), Fi = Pt(
1801
1801
  (e, n = !0) => {
1802
- Sa((t) => {
1802
+ $a((t) => {
1803
1803
  const r = new Set(t);
1804
1804
  r.add(e.id);
1805
1805
  try {
@@ -1810,17 +1810,17 @@ function zu({
1810
1810
  });
1811
1811
  },
1812
1812
  [cr]
1813
- ), $a = Pt(
1813
+ ), Ea = Pt(
1814
1814
  (e) => {
1815
- if (!R) return;
1816
- const n = R.key_field, t = e.change_reason ?? e.label, r = (a) => a == null || a === "" || Number(a) === 0;
1815
+ if (!j) return;
1816
+ const n = j.key_field, t = e.change_reason ?? e.label, r = (a) => a == null || a === "" || Number(a) === 0;
1817
1817
  let i = 0;
1818
1818
  const o = (w == null ? void 0 : w.getPendingEdits(s, u)) ?? /* @__PURE__ */ new Map();
1819
1819
  for (const a of e.rows) {
1820
1820
  if (a.category != null) continue;
1821
1821
  const c = I.find((h) => String(h[n]) === String(a.key)), d = K.findIndex((h) => String(h[n]) === String(a.key)), p = c ? { ...c, ...o.get(String(c.id)) ?? {} } : d >= 0 ? K[d] : null, m = {};
1822
1822
  for (const [h, b] of Object.entries(a.values))
1823
- Ct(R, a.key, h) || p && !r(p[h]) || (m[h] = b);
1823
+ Ct(j, a.key, h) || p && !r(p[h]) || (m[h] = b);
1824
1824
  Object.keys(m).length !== 0 && (i++, c ? En(String(c.id), m, t) : d >= 0 ? En(`pending:${d}`, m, t) : w && w.queueRow(
1825
1825
  s,
1826
1826
  u,
@@ -1833,7 +1833,7 @@ function zu({
1833
1833
  },
1834
1834
  // eslint-disable-next-line react-hooks/exhaustive-deps
1835
1835
  [
1836
- R,
1836
+ j,
1837
1837
  I,
1838
1838
  K,
1839
1839
  w,
@@ -1842,13 +1842,13 @@ function zu({
1842
1842
  En,
1843
1843
  Fi
1844
1844
  ]
1845
- ), Ea = Pt(
1845
+ ), qa = Pt(
1846
1846
  (e) => {
1847
1847
  var v;
1848
1848
  if (!((v = ke == null ? void 0 : ke.fields) != null && v.length)) return;
1849
1849
  const n = ct(ke.remaining, dn), t = n == null || !Number.isFinite(n) ? 0 : Math.round(n * 100) / 100;
1850
1850
  if (t <= 0) return;
1851
- const r = ke.only_empty !== !1, i = (x) => x == null || x === "" || Number(x) === 0, o = (w == null ? void 0 : w.getPendingEdits(s, u)) ?? /* @__PURE__ */ new Map(), a = (w == null ? void 0 : w.getPendingDeletes(s, u)) ?? /* @__PURE__ */ new Set(), c = R == null ? void 0 : R.key_field, d = [];
1851
+ const r = ke.only_empty !== !1, i = (x) => x == null || x === "" || Number(x) === 0, o = (w == null ? void 0 : w.getPendingEdits(s, u)) ?? /* @__PURE__ */ new Map(), a = (w == null ? void 0 : w.getPendingDeletes(s, u)) ?? /* @__PURE__ */ new Set(), c = j == null ? void 0 : j.key_field, d = [];
1852
1852
  for (const x of I) {
1853
1853
  const N = String(x.id);
1854
1854
  a.has(N) || d.push({ id: N, row: { ...x, ...o.get(N) ?? {} } });
@@ -1857,12 +1857,12 @@ function zu({
1857
1857
  const p = [], m = [];
1858
1858
  for (const x of d)
1859
1859
  for (const N of ke.fields)
1860
- r && !i(x.row[N]) || R && Ct(R, x.row[R.key_field], N) || (p.push({ id: x.id, field: N }), m.push(0));
1860
+ r && !i(x.row[N]) || j && Ct(j, x.row[j.key_field], N) || (p.push({ id: x.id, field: N }), m.push(0));
1861
1861
  if (p.length === 0) {
1862
1862
  be.message("Nothing to spread into — every target is filled or closed");
1863
1863
  return;
1864
1864
  }
1865
- const h = Vl(
1865
+ const h = Fl(
1866
1866
  t,
1867
1867
  p.length,
1868
1868
  e === "shape" ? "even" : e,
@@ -1889,7 +1889,7 @@ function zu({
1889
1889
  w,
1890
1890
  s,
1891
1891
  u,
1892
- R,
1892
+ j,
1893
1893
  I,
1894
1894
  K,
1895
1895
  En
@@ -1907,7 +1907,7 @@ function zu({
1907
1907
  const Ns = ee(() => {
1908
1908
  });
1909
1909
  Ns.current = () => cn == null ? void 0 : cn(s, u, null), de(() => () => Ns.current(), []);
1910
- const ur = T(() => {
1910
+ const ur = L(() => {
1911
1911
  const e = /* @__PURE__ */ new Map();
1912
1912
  for (const n of ae) {
1913
1913
  let t = null;
@@ -1924,10 +1924,10 @@ function zu({
1924
1924
  i.length && e.set(n.field, i);
1925
1925
  }
1926
1926
  return e;
1927
- }, [ae]), Ss = T(() => {
1927
+ }, [ae]), Ss = L(() => {
1928
1928
  var n;
1929
1929
  const e = [];
1930
- for (const t of Re ?? []) {
1930
+ for (const t of je ?? []) {
1931
1931
  const r = (n = t.on_unavailable) == null ? void 0 : n.replace;
1932
1932
  if (!(!r || typeof r != "object"))
1933
1933
  for (const i of Object.values(r))
@@ -1938,7 +1938,7 @@ function zu({
1938
1938
  );
1939
1939
  }
1940
1940
  return e;
1941
- }, [Re]), qa = T(() => {
1941
+ }, [je]), Ia = L(() => {
1942
1942
  var n, t;
1943
1943
  const e = /* @__PURE__ */ new Map();
1944
1944
  for (const r of [...ur.values(), Ss])
@@ -1954,12 +1954,12 @@ function zu({
1954
1954
  }
1955
1955
  return [...e.entries()];
1956
1956
  }, [ur, Ss, E == null ? void 0 : E.draft]), $s = bn({
1957
- queries: qa.map(([e, n]) => ({
1957
+ queries: Ia.map(([e, n]) => ({
1958
1958
  queryKey: ["pinned-parent", n.collection, n.id, [...n.fields].sort().join(",")],
1959
1959
  queryFn: () => Ae(n.collection, n.id, [...n.fields]).then((t) => [e, t]).catch(() => [e, null]),
1960
1960
  staleTime: 6e4
1961
1961
  }))
1962
- }), Yr = T(() => {
1962
+ }), Gr = L(() => {
1963
1963
  const e = /* @__PURE__ */ new Map();
1964
1964
  for (const n of $s) n.data && e.set(n.data[0], n.data[1]);
1965
1965
  return e;
@@ -1972,7 +1972,7 @@ function zu({
1972
1972
  }
1973
1973
  const a = (i = E == null ? void 0 : E.draft) == null ? void 0 : i[o.parent_field];
1974
1974
  if (a == null || a === "") continue;
1975
- const c = Yr.get(`${o.parent_collection}|${String(a)}`), d = c == null ? void 0 : c[o.source_field];
1975
+ const c = Gr.get(`${o.parent_collection}|${String(a)}`), d = c == null ? void 0 : c[o.source_field];
1976
1976
  if (!(d == null || d === ""))
1977
1977
  return { id: d, tag: o.tag ?? "Default" };
1978
1978
  }
@@ -1981,18 +1981,18 @@ function zu({
1981
1981
  const t = ur.get(e);
1982
1982
  return t ? Es(t, n) : null;
1983
1983
  }, Ne = ae.filter(
1984
- (e) => !e.hidden && (!Lo.has(e.type) || sr(e.interface)) && e.field !== u && e.field !== "id" && (!tn || e.layout_assigned === !0) && !Ro.has(e.field) && !Na.has(e.group_key ?? "")
1985
- ), Rt = oe && oe.length >= 2 && Ei !== qr ? oe.find((e) => e.name === Ei) : void 0, Ia = new Set(
1984
+ (e) => !e.hidden && (!To.has(e.type) || sr(e.interface)) && e.field !== u && e.field !== "id" && (!tn || e.layout_assigned === !0) && !jo.has(e.field) && !Sa.has(e.group_key ?? "")
1985
+ ), jt = oe && oe.length >= 2 && $i !== qr ? oe.find((e) => e.name === $i) : void 0, Oa = new Set(
1986
1986
  (ne ?? []).map((e) => typeof e == "string" ? e : e.field)
1987
- ), qs = Rt ? new Set(
1988
- Rt.columns.filter((e) => {
1987
+ ), qs = jt ? new Set(
1988
+ jt.columns.filter((e) => {
1989
1989
  const n = e.indexOf(".");
1990
- return n < 0 ? !0 : !Ia.has(e.slice(0, n));
1990
+ return n < 0 ? !0 : !Oa.has(e.slice(0, n));
1991
1991
  })
1992
- ) : null, Is = qs ? Ne.filter((e) => qs.has(e.field)) : [], In = T(() => {
1993
- if (!Rt) return [];
1992
+ ) : null, Is = qs ? Ne.filter((e) => qs.has(e.field)) : [], In = L(() => {
1993
+ if (!jt) return [];
1994
1994
  const e = [];
1995
- for (const n of Rt.columns) {
1995
+ for (const n of jt.columns) {
1996
1996
  const t = n.indexOf(".");
1997
1997
  if (t < 0) continue;
1998
1998
  const r = n.slice(0, t), i = n.slice(t + 1);
@@ -2001,10 +2001,10 @@ function zu({
2001
2001
  )) && e.push({ relationField: r, memberField: i });
2002
2002
  }
2003
2003
  return e;
2004
- }, [Rt, ne]), un = T(
2004
+ }, [jt, ne]), un = L(
2005
2005
  () => [...new Set(In.map((e) => e.relationField))],
2006
2006
  [In]
2007
- ), Lt = T(() => {
2007
+ ), Tt = L(() => {
2008
2008
  const e = /* @__PURE__ */ new Map();
2009
2009
  for (const n of un) {
2010
2010
  const t = Pe.find(
@@ -2016,13 +2016,13 @@ function zu({
2016
2016
  );
2017
2017
  }
2018
2018
  return e;
2019
- }, [un, Pe, s]), On = T(
2019
+ }, [un, Pe, s]), On = L(
2020
2020
  () => [
2021
2021
  ...new Set(
2022
- [...Lt.values()].filter((e) => !!e).map((e) => e.grandCollection)
2022
+ [...Tt.values()].filter((e) => !!e).map((e) => e.grandCollection)
2023
2023
  )
2024
2024
  ],
2025
- [Lt]
2025
+ [Tt]
2026
2026
  ), Os = bn({
2027
2027
  queries: On.map((e) => ({
2028
2028
  queryKey: $r.fieldConfig(e, null),
@@ -2032,27 +2032,27 @@ function zu({
2032
2032
  }), As = bn({
2033
2033
  queries: On.map((e) => ({
2034
2034
  queryKey: $r.collectionRelations(e),
2035
- queryFn: () => ql($, e),
2035
+ queryFn: () => Il($, e),
2036
2036
  staleTime: 10 * 6e4
2037
2037
  }))
2038
- }), js = T(() => {
2038
+ }), Rs = L(() => {
2039
2039
  const e = /* @__PURE__ */ new Map();
2040
2040
  return On.forEach((n, t) => {
2041
2041
  var r;
2042
2042
  e.set(n, ((r = Os[t]) == null ? void 0 : r.data) ?? []);
2043
2043
  }), e;
2044
- }, [On, Os]), Rs = T(() => {
2044
+ }, [On, Os]), js = L(() => {
2045
2045
  const e = /* @__PURE__ */ new Map();
2046
2046
  return On.forEach((n, t) => {
2047
2047
  var r;
2048
2048
  e.set(n, ((r = As[t]) == null ? void 0 : r.data) ?? []);
2049
2049
  }), e;
2050
- }, [On, As]), Xr = T(() => {
2050
+ }, [On, As]), Yr = L(() => {
2051
2051
  const e = /* @__PURE__ */ new Map();
2052
2052
  for (const n of un) {
2053
- const t = Lt.get(n);
2053
+ const t = Tt.get(n);
2054
2054
  if (!t) continue;
2055
- const r = Rs.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
2055
+ const r = js.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
2056
2056
  for (const o of In) {
2057
2057
  if (o.relationField !== n) continue;
2058
2058
  const a = r.find(
@@ -2063,10 +2063,10 @@ function zu({
2063
2063
  e.set(n, i);
2064
2064
  }
2065
2065
  return e;
2066
- }, [un, Lt, Rs, In]), Zr = T(() => I.map((e) => String(e.id)), [I]), fr = T(
2067
- () => `nvr-gf-${Math.abs(zc(`${s}:${P ?? u}`)) % 1e5}`,
2066
+ }, [un, Tt, js, In]), Xr = L(() => I.map((e) => String(e.id)), [I]), fr = L(
2067
+ () => `nvr-gf-${Math.abs(Hc(`${s}:${P ?? u}`)) % 1e5}`,
2068
2068
  [s, P, u]
2069
- ), Ls = T(() => {
2069
+ ), Ts = L(() => {
2070
2070
  if (!Z) return null;
2071
2071
  const e = [];
2072
2072
  ie && (X || S || D) && e.push(24), M && e.push(32), (S || D) && e.push(80), e.push(220);
@@ -2088,25 +2088,25 @@ function zu({
2088
2088
  S,
2089
2089
  D,
2090
2090
  M
2091
- ]), [ei, Oa] = B(150), Ts = ee(null);
2091
+ ]), [Zr, Aa] = B(150), Ls = ee(null);
2092
2092
  de(() => {
2093
- const e = Ts.current;
2093
+ const e = Ls.current;
2094
2094
  if (!e) return;
2095
2095
  const n = new IntersectionObserver(
2096
2096
  (t) => {
2097
- t.some((r) => r.isIntersecting) && Oa((r) => r + 150);
2097
+ t.some((r) => r.isIntersecting) && Aa((r) => r + 150);
2098
2098
  },
2099
2099
  { rootMargin: "400px" }
2100
2100
  );
2101
2101
  return n.observe(e), () => n.disconnect();
2102
- }, [I.length, ei, nr]);
2103
- const Aa = Zr.join(","), ja = Ac(
2102
+ }, [I.length, Zr, nr]);
2103
+ const Ra = Xr.join(","), ja = Tc(
2104
2104
  s,
2105
- Zr,
2105
+ Xr,
2106
2106
  !!te && !S
2107
2107
  ), Ms = bn({
2108
2108
  queries: un.map((e) => {
2109
- const n = Lt.get(e);
2109
+ const n = Tt.get(e);
2110
2110
  return {
2111
2111
  queryKey: [
2112
2112
  "o2m-rows",
@@ -2115,23 +2115,23 @@ function zu({
2115
2115
  y,
2116
2116
  "summary-members",
2117
2117
  e,
2118
- Aa
2118
+ Ra
2119
2119
  ],
2120
2120
  queryFn: () => n ? $.request(
2121
2121
  ue(`/items/${n.grandCollection}`, {
2122
- filter: JSON.stringify({ [n.fkField]: { _in: Zr } }),
2122
+ filter: JSON.stringify({ [n.fkField]: { _in: Xr } }),
2123
2123
  limit: 1e3
2124
2124
  })
2125
2125
  ).then((t) => t.data ?? []) : Promise.resolve([]),
2126
- enabled: !!n && Zr.length > 0,
2126
+ enabled: !!n && Xr.length > 0,
2127
2127
  staleTime: 3e4
2128
2128
  };
2129
2129
  })
2130
- }), ti = T(() => {
2130
+ }), ei = L(() => {
2131
2131
  const e = /* @__PURE__ */ new Map();
2132
2132
  return un.forEach((n, t) => {
2133
2133
  var o;
2134
- const r = Lt.get(n), i = /* @__PURE__ */ new Map();
2134
+ const r = Tt.get(n), i = /* @__PURE__ */ new Map();
2135
2135
  if (r)
2136
2136
  for (const a of ((o = Ms[t]) == null ? void 0 : o.data) ?? []) {
2137
2137
  const c = String(a[r.fkField]);
@@ -2139,7 +2139,7 @@ function zu({
2139
2139
  }
2140
2140
  e.set(n, i);
2141
2141
  }), e;
2142
- }, [un, Lt, Ms]), Ks = Jn == null ? void 0 : Jn.report;
2142
+ }, [un, Tt, Ms]), Ks = Jn == null ? void 0 : Jn.report;
2143
2143
  de(() => {
2144
2144
  if (!Ks || !ne || ne.length === 0) return;
2145
2145
  const e = `${s}.${u}`, n = (r, i) => {
@@ -2172,7 +2172,7 @@ function zu({
2172
2172
  for (const v of m.deleted ?? []) c.deleted.push(v);
2173
2173
  }
2174
2174
  if (Qe.size > 0) {
2175
- const d = ti.get(i);
2175
+ const d = ei.get(i);
2176
2176
  for (const p of Qe)
2177
2177
  for (const m of (d == null ? void 0 : d.get(String(p))) ?? [])
2178
2178
  m.id != null && c.deleted.push(m.id);
@@ -2181,12 +2181,12 @@ function zu({
2181
2181
  }
2182
2182
  Ks(e, Object.keys(t).length > 0 ? t : null);
2183
2183
  });
2184
- const Hi = T(() => {
2184
+ const Hi = L(() => {
2185
2185
  const e = /* @__PURE__ */ new Map(), n = (t, r) => {
2186
- r == null || r === "" || Il(t) || (e.has(t) || e.set(t, []), e.get(t).push(String(r)));
2186
+ r == null || r === "" || Ol(t) || (e.has(t) || e.set(t, []), e.get(t).push(String(r)));
2187
2187
  };
2188
- for (const [t, r] of ti) {
2189
- const i = Xr.get(t);
2188
+ for (const [t, r] of ei) {
2189
+ const i = Yr.get(t);
2190
2190
  if (!(!i || i.size === 0)) {
2191
2191
  for (const o of r.values())
2192
2192
  for (const a of o)
@@ -2215,7 +2215,7 @@ function zu({
2215
2215
  }
2216
2216
  for (const [t, r] of e) e.set(t, [...new Set(r)].sort());
2217
2217
  return e;
2218
- }, [ti, Xr, K, C, zr]), { data: Ps = {} } = Ce({
2218
+ }, [ei, Yr, K, C, zr]), { data: Ps = {} } = Ce({
2219
2219
  queryKey: [
2220
2220
  "summary-m2o-display",
2221
2221
  s,
@@ -2255,9 +2255,9 @@ function zu({
2255
2255
  ).then((e) => e.data),
2256
2256
  enabled: !!s,
2257
2257
  staleTime: 10 * 6e4
2258
- }), Ds = T(
2258
+ }), Ds = L(
2259
2259
  () => In.map(({ relationField: e, memberField: n }) => {
2260
- const t = Lt.get(e), i = (t ? js.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2260
+ const t = Tt.get(e), i = (t ? Rs.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2261
2261
  return {
2262
2262
  field: `${e}.${n}`,
2263
2263
  type: "presentation",
@@ -2277,7 +2277,7 @@ function zu({
2277
2277
  dependency_config: null
2278
2278
  };
2279
2279
  }),
2280
- [In, Lt, js]
2280
+ [In, Tt, Rs]
2281
2281
  );
2282
2282
  function nt(e) {
2283
2283
  return e.type === "presentation" && e.field.includes(".");
@@ -2290,7 +2290,7 @@ function zu({
2290
2290
  }
2291
2291
  const r = String(n.id), i = zr[`${r}|${e}`];
2292
2292
  if (i) return i;
2293
- const o = ((p = ti.get(e)) == null ? void 0 : p.get(r)) ?? [], a = (m = C.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
2293
+ const o = ((p = ei.get(e)) == null ? void 0 : p.get(r)) ?? [], a = (m = C.get(r)) == null ? void 0 : m[`__nested_ops_${e}`];
2294
2294
  if (!a) return o;
2295
2295
  const c = new Set((a.deleted ?? []).map(String)), d = new Map((a.updated ?? []).map((h) => [String(h.id), h.changes]));
2296
2296
  return [
@@ -2306,20 +2306,20 @@ function zu({
2306
2306
  if (r < 0) return "—";
2307
2307
  const i = e.field.slice(0, r), o = e.field.slice(r + 1), a = Ws(i, n, t);
2308
2308
  if (a.length === 0) return "—";
2309
- const c = (p = Xr.get(i)) == null ? void 0 : p.get(o), d = a.map((m) => {
2309
+ const c = (p = Yr.get(i)) == null ? void 0 : p.get(o), d = a.map((m) => {
2310
2310
  var b;
2311
2311
  const h = m[o];
2312
2312
  return h == null || h === "" ? null : c != null && c.one_collection ? ((b = Ps[c.one_collection]) == null ? void 0 : b[String(h)]) ?? String(h) : String(h);
2313
2313
  }).filter((m) => !!m);
2314
2314
  return d.length > 0 ? d.join(", ") : "—";
2315
2315
  }
2316
- function ni(e, n) {
2316
+ function ti(e, n) {
2317
2317
  var p;
2318
2318
  const t = e.field.indexOf(".");
2319
2319
  if (t < 0) return "—";
2320
2320
  const r = e.field.slice(0, t), i = e.field.slice(t + 1), o = Ws(r, n, !1);
2321
2321
  if (o.length === 0) return "—";
2322
- const a = (p = Xr.get(r)) == null ? void 0 : p.get(i);
2322
+ const a = (p = Yr.get(r)) == null ? void 0 : p.get(i);
2323
2323
  if (!(a != null && a.one_collection) || !me) return mr(e, n, !1);
2324
2324
  const c = a.one_collection, d = o.map((m) => {
2325
2325
  var b;
@@ -2339,37 +2339,37 @@ function zu({
2339
2339
  `${m.id}:${h}`
2340
2340
  )) });
2341
2341
  }
2342
- const Le = Rt && (Is.length > 0 || Ds.length > 0) ? [...Is, ...Ds] : Ne, An = ee(null), [Ra, Gi] = B(0), Us = ee(/* @__PURE__ */ new Map()), Tt = ee(0), Yi = 1e4, wt = (e) => Us.current.set(String(e), Date.now());
2342
+ const Te = jt && (Is.length > 0 || Ds.length > 0) ? [...Is, ...Ds] : Ne, An = ee(null), [Ta, Gi] = B(0), Us = ee(/* @__PURE__ */ new Map()), Lt = ee(0), Yi = 1e4, wt = (e) => Us.current.set(String(e), Date.now());
2343
2343
  de(() => {
2344
2344
  const e = new Set(Ie.map((t) => String(t.id))), n = cs.current;
2345
- if (cs.current = e, !(!n || !tr.trim()) && !(Date.now() - Tt.current > Yi))
2346
- for (const t of e) n.has(t) || Ti.current.add(t);
2345
+ if (cs.current = e, !(!n || !tr.trim()) && !(Date.now() - Lt.current > Yi))
2346
+ for (const t of e) n.has(t) || Li.current.add(t);
2347
2347
  }, [on]), de(() => {
2348
2348
  const e = (n) => {
2349
2349
  var r;
2350
2350
  const t = ((r = n.detail) == null ? void 0 : r.writes) ?? [];
2351
2351
  for (const i of t) i.collection === s && wt(i.id);
2352
2352
  };
2353
- return window.addEventListener(Al, e), () => window.removeEventListener(Al, e);
2353
+ return window.addEventListener(Rl, e), () => window.removeEventListener(Rl, e);
2354
2354
  }, [s]), Nn.current = async (e, n, t, r) => {
2355
- const i = await gc($, ot, e, n, t, {
2355
+ const i = await wc($, ot, e, n, t, {
2356
2356
  key: `${s}.${u}`,
2357
- label: bi(I, n, X),
2357
+ label: gi(I, n, X),
2358
2358
  ...r !== void 0 ? { base: r } : {}
2359
2359
  });
2360
- return i.ok ? (wt(n), !0) : (Ai.current.push(i.conflict), !1);
2360
+ return i.ok ? (wt(n), !0) : (Oi.current.push(i.conflict), !1);
2361
2361
  };
2362
2362
  const Xi = async (e, n, t) => {
2363
2363
  const r = await Nn.current(e, n, t);
2364
2364
  return r || er(), r;
2365
2365
  }, La = async (e) => {
2366
2366
  const n = Br ?? [];
2367
- Oi(null);
2367
+ Ii(null);
2368
2368
  let t = 0;
2369
2369
  for (const r of n) {
2370
2370
  const i = new Set(
2371
- r.conflicts.filter((a) => e.has(bc(r, a.field))).map((a) => a.field)
2372
- ), o = yc(r.mine, i);
2371
+ r.conflicts.filter((a) => e.has(vc(r, a.field))).map((a) => a.field)
2372
+ ), o = xc(r.mine, i);
2373
2373
  if (o) {
2374
2374
  r.latest > 0 && ot.set(r.rowId, r.latest);
2375
2375
  try {
@@ -2390,12 +2390,12 @@ function zu({
2390
2390
  return n;
2391
2391
  },
2392
2392
  [pr]
2393
- ), Ta = (e, n) => {
2393
+ ), Ma = (e, n) => {
2394
2394
  for (const t of Object.keys(n)) if (String(e[t] ?? "") !== String(n[t] ?? "")) return !1;
2395
2395
  return !0;
2396
- }, ri = (e, n) => {
2396
+ }, ni = (e, n) => {
2397
2397
  const t = Us.current.get(e);
2398
- return t && n - t < Yi ? !0 : Rd(s, e);
2398
+ return t && n - t < Yi ? !0 : Td(s, e);
2399
2399
  };
2400
2400
  de(() => {
2401
2401
  if (S || _n || !pr) return;
@@ -2407,13 +2407,13 @@ function zu({
2407
2407
  let r = !1;
2408
2408
  for (const i of Ie) {
2409
2409
  const o = String(i.id);
2410
- t.add(o), (ri(o, n) || !e.has(o) && n - Tt.current < Yi) && (e.set(o, Mt(i)), r = !0);
2410
+ t.add(o), (ni(o, n) || !e.has(o) && n - Lt.current < Yi) && (e.set(o, Mt(i)), r = !0);
2411
2411
  }
2412
2412
  for (const i of [...e.keys()])
2413
- !t.has(i) && ri(i, n) && (e.delete(i), r = !0);
2413
+ !t.has(i) && ni(i, n) && (e.delete(i), r = !0);
2414
2414
  r && Gi((i) => i + 1);
2415
2415
  }, [on, S, _n, pr]);
2416
- const vt = T(() => {
2416
+ const vt = L(() => {
2417
2417
  const e = An.current;
2418
2418
  if (!e || S) return null;
2419
2419
  const n = Date.now(), t = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = [], o = /* @__PURE__ */ new Set();
@@ -2425,35 +2425,35 @@ function zu({
2425
2425
  t.add(c);
2426
2426
  continue;
2427
2427
  }
2428
- ri(c, n) || Ta(Mt(a), d) || r.add(c);
2428
+ ni(c, n) || Ma(Mt(a), d) || r.add(c);
2429
2429
  }
2430
2430
  for (const a of e.keys()) o.has(a) || i.push(a);
2431
2431
  return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
2432
- }, [Ie, Ra, Bi, S, Mt]), Ma = () => {
2432
+ }, [Ie, Ta, Bi, S, Mt]), Ka = () => {
2433
2433
  An.current = new Map(Ie.map((e) => [String(e.id), Mt(e)])), Gi((e) => e + 1);
2434
- }, jn = ee(null), [ii, Bs] = B({}), Rn = T(() => {
2435
- const e = jn.current, n = f == null ? void 0 : f.rowId;
2434
+ }, Rn = ee(null), [ri, Bs] = B({}), jn = L(() => {
2435
+ const e = Rn.current, n = f == null ? void 0 : f.rowId;
2436
2436
  if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
2437
2437
  const t = Ie.find((o) => String(o.id) === n);
2438
- if (!t || ri(n, Date.now())) return [];
2438
+ if (!t || ni(n, Date.now())) return [];
2439
2439
  const r = Mt(t), i = [];
2440
2440
  for (const o of Object.keys(r)) {
2441
- if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(ii[o] ?? "\0") === String(r[o] ?? "") || String((f == null ? void 0 : f.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2441
+ if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(ri[o] ?? "\0") === String(r[o] ?? "") || String((f == null ? void 0 : f.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2442
2442
  const a = ae.find((c) => c.field === o);
2443
2443
  (a == null ? void 0 : a.computed_type) === "write" && a.computed_formula || i.push({ field: o, label: (a == null ? void 0 : a.label) || _e(o), theirs: r[o], was: e.snap[o] });
2444
2444
  }
2445
2445
  return i;
2446
- }, [Ie, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, ii, Mt, ae]), Js = (e) => {
2447
- if (!e || Rn.length === 0 || (f == null ? void 0 : f.rowId) !== e) return null;
2446
+ }, [Ie, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, ri, Mt, ae]), Js = (e) => {
2447
+ if (!e || jn.length === 0 || (f == null ? void 0 : f.rowId) !== e) return null;
2448
2448
  const n = (i) => i == null || i === "" ? "∅" : String(i).slice(0, 40), t = (i) => {
2449
- const o = { ...ii }, a = {};
2450
- for (const c of Rn)
2451
- i && c.field !== i || (a[c.field] = c.theirs, o[c.field] = c.theirs, jn.current && (jn.current.snap[c.field] = c.theirs));
2452
- uo(a), Bs(o), (!i || Rn.length === 1) && so(e);
2449
+ const o = { ...ri }, a = {};
2450
+ for (const c of jn)
2451
+ i && c.field !== i || (a[c.field] = c.theirs, o[c.field] = c.theirs, Rn.current && (Rn.current.snap[c.field] = c.theirs));
2452
+ uo(a), Bs(o), (!i || jn.length === 1) && so(e);
2453
2453
  }, r = () => {
2454
- const i = { ...ii };
2455
- for (const o of Rn)
2456
- i[o.field] = o.theirs, jn.current && (jn.current.snap[o.field] = o.theirs);
2454
+ const i = { ...ri };
2455
+ for (const o of jn)
2456
+ i[o.field] = o.theirs, Rn.current && (Rn.current.snap[o.field] = o.theirs);
2457
2457
  Bs(i), so(e);
2458
2458
  };
2459
2459
  return /* @__PURE__ */ k(
@@ -2466,7 +2466,7 @@ function zu({
2466
2466
  /* @__PURE__ */ k("span", { className: "min-w-0 flex-1", children: [
2467
2467
  "Changed by others while you edit:",
2468
2468
  " ",
2469
- Rn.map((i, o) => /* @__PURE__ */ k("span", { "data-row-remote-field": i.field, children: [
2469
+ jn.map((i, o) => /* @__PURE__ */ k("span", { "data-row-remote-field": i.field, children: [
2470
2470
  o > 0 && " · ",
2471
2471
  /* @__PURE__ */ l("span", { className: "font-medium", children: i.label }),
2472
2472
  " ",
@@ -2507,18 +2507,18 @@ function zu({
2507
2507
  ]
2508
2508
  }
2509
2509
  );
2510
- }, Qs = T(() => {
2510
+ }, Qs = L(() => {
2511
2511
  if (!vt) return [];
2512
2512
  const e = /* @__PURE__ */ new Set();
2513
2513
  for (const n of vt.changed) {
2514
- const t = Object.values(ji[n] ?? {});
2514
+ const t = Object.values(Ai[n] ?? {});
2515
2515
  if (t.length === 0) continue;
2516
2516
  const r = t.reduce((i, o) => String(o.at) > String(i.at) ? o : i);
2517
2517
  r.who && e.add(r.who);
2518
2518
  }
2519
2519
  return [...e];
2520
- }, [vt, ji]), [Ze, fn] = B(null), Zi = ee(/* @__PURE__ */ new Set()), zs = (e, n) => JSON.stringify([e, n]), [Ln, Ka] = B(() => /* @__PURE__ */ new Map()), Vs = ee(""), eo = ee(() => {
2521
- }), Pa = (e) => {
2520
+ }, [vt, Ai]), [Ze, fn] = B(null), Zi = ee(/* @__PURE__ */ new Set()), zs = (e, n) => JSON.stringify([e, n]), [Tn, Pa] = B(() => /* @__PURE__ */ new Map()), Vs = ee(""), eo = ee(() => {
2521
+ }), Da = (e) => {
2522
2522
  const n = zn.current;
2523
2523
  if (!n) return null;
2524
2524
  const t = `${s}:${e}`;
@@ -2542,7 +2542,7 @@ function zu({
2542
2542
  }
2543
2543
  const o = [...i.entries()].map(([a, c]) => `${a}\0${c}`).sort().join(`
2544
2544
  `);
2545
- o !== Vs.current && (Vs.current = o, Ka(i));
2545
+ o !== Vs.current && (Vs.current = o, Pa(i));
2546
2546
  };
2547
2547
  eo.current = t, t();
2548
2548
  const r = new MutationObserver(t);
@@ -2559,26 +2559,26 @@ function zu({
2559
2559
  const e = Zi.current;
2560
2560
  for (const n of [...e]) {
2561
2561
  const [t, r] = JSON.parse(n);
2562
- Ln.get(t) !== r && e.delete(n);
2562
+ Tn.get(t) !== r && e.delete(n);
2563
2563
  }
2564
- Ze && Ln.get(Ze.rowKey) !== Ze.editor && fn(null);
2565
- }, [Ln, Ze]), de(() => {
2564
+ Ze && Tn.get(Ze.rowKey) !== Ze.editor && fn(null);
2565
+ }, [Tn, Ze]), de(() => {
2566
2566
  if (!Ze || typeof window > "u") return;
2567
2567
  const e = (n) => {
2568
2568
  n.key === "Escape" && fn(null);
2569
2569
  };
2570
2570
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
2571
2571
  }, [Ze]);
2572
- const to = T(() => {
2573
- if (Ln.size === 0) return [];
2572
+ const to = L(() => {
2573
+ if (Tn.size === 0) return [];
2574
2574
  const e = [];
2575
2575
  return I.forEach((n, t) => {
2576
- const r = Ln.get(String(n.id));
2576
+ const r = Tn.get(String(n.id));
2577
2577
  if (!r) return;
2578
2578
  const i = n.line_number, o = typeof i == "number" || typeof i == "string" && i.trim() !== "";
2579
2579
  e.push(`${r} is editing line ${String(o ? i : t + 1)}`);
2580
2580
  }), e;
2581
- }, [Ln, I]);
2581
+ }, [Tn, I]);
2582
2582
  de(() => {
2583
2583
  if (!Ut || S) return;
2584
2584
  let e = null;
@@ -2601,15 +2601,15 @@ function zu({
2601
2601
  if (Hs.current = e, !!n) {
2602
2602
  for (const t of n.edits) e.edits.has(t) || wt(t);
2603
2603
  for (const t of n.deletes) e.deletes.has(t) || wt(t);
2604
- e.pending < n.pending && (Tt.current = Date.now());
2604
+ e.pending < n.pending && (Lt.current = Date.now());
2605
2605
  }
2606
2606
  }, [Bi]);
2607
- const no = T(() => Yc(ae), [ae]), Cs = T(
2607
+ const no = L(() => eu(ae), [ae]), Cs = L(
2608
2608
  () => ae.filter(
2609
- (e) => e.group_key === "__create_with_defaults__" && !Lo.has(e.type ?? "") && !Ro.has(e.field)
2609
+ (e) => e.group_key === "__create_with_defaults__" && !To.has(e.type ?? "") && !jo.has(e.field)
2610
2610
  ),
2611
2611
  [ae]
2612
- ), ze = T(() => {
2612
+ ), ze = L(() => {
2613
2613
  const e = /* @__PURE__ */ new Map();
2614
2614
  for (const n of Ne) {
2615
2615
  const t = Pe.find(
@@ -2618,7 +2618,7 @@ function zu({
2618
2618
  t != null && t.one_collection && e.set(n.field, t);
2619
2619
  }
2620
2620
  return e;
2621
- }, [Ne, Pe, s]), hr = T(() => {
2621
+ }, [Ne, Pe, s]), hr = L(() => {
2622
2622
  var n;
2623
2623
  const e = {};
2624
2624
  for (const t of Ne) {
@@ -2630,7 +2630,7 @@ function zu({
2630
2630
  }
2631
2631
  })() : null, i = r == null ? void 0 : r.option_filter;
2632
2632
  if (!i || typeof i != "object") continue;
2633
- const o = zl(
2633
+ const o = Vl(
2634
2634
  i,
2635
2635
  E == null ? void 0 : E.draft,
2636
2636
  ((n = E == null ? void 0 : E.draft) == null ? void 0 : n.id) != null ? String(E.draft.id) : ""
@@ -2638,7 +2638,7 @@ function zu({
2638
2638
  o && (e[t.field] = o);
2639
2639
  }
2640
2640
  return e;
2641
- }, [Ne, E == null ? void 0 : E.draft]), ro = T(() => {
2641
+ }, [Ne, E == null ? void 0 : E.draft]), ro = L(() => {
2642
2642
  const e = [], n = /* @__PURE__ */ new Set([
2643
2643
  ...Object.keys(He),
2644
2644
  ...Object.keys(hr)
@@ -2674,7 +2674,7 @@ function zu({
2674
2674
  ).then((n) => new Set((n.data ?? []).map((t) => String(t.id)))),
2675
2675
  staleTime: 3e4
2676
2676
  }))
2677
- }), io = T(() => {
2677
+ }), io = L(() => {
2678
2678
  const e = /* @__PURE__ */ new Map();
2679
2679
  return ro.forEach((n, t) => {
2680
2680
  var a;
@@ -2693,14 +2693,14 @@ function zu({
2693
2693
  ro,
2694
2694
  Gs,
2695
2695
  ur,
2696
- Yr,
2696
+ Gr,
2697
2697
  E == null ? void 0 : E.draft,
2698
2698
  I,
2699
2699
  K
2700
- ]), oi = ee(/* @__PURE__ */ new Set()), oo = ee(!1);
2700
+ ]), ii = ee(/* @__PURE__ */ new Set()), oo = ee(!1);
2701
2701
  de(() => {
2702
2702
  var t;
2703
- if (j || !$ || oo.current) return;
2703
+ if (R || !$ || oo.current) return;
2704
2704
  const e = E == null ? void 0 : E.dirtyFields;
2705
2705
  if (!e || e.size === 0) return;
2706
2706
  const n = [];
@@ -2710,7 +2710,7 @@ function zu({
2710
2710
  const o = io.get(r.child_field), a = He[r.child_field], c = ze.get(r.child_field);
2711
2711
  if (!(o != null && o.size) || !a || !(c != null && c.one_collection)) continue;
2712
2712
  const d = JSON.stringify(a), p = [...o].filter(
2713
- (b) => !oi.current.has(`${r.child_field}|${b}|${d}`)
2713
+ (b) => !ii.current.has(`${r.child_field}|${b}|${d}`)
2714
2714
  );
2715
2715
  if (!p.length) continue;
2716
2716
  const m = {};
@@ -2727,10 +2727,10 @@ function zu({
2727
2727
  const b = Object.values(i.replace).flat().every((x) => {
2728
2728
  var _;
2729
2729
  const N = (_ = E == null ? void 0 : E.draft) == null ? void 0 : _[x.parent_field];
2730
- return N == null || N === "" || Yr.has(`${x.parent_collection}|${String(N)}`);
2730
+ return N == null || N === "" || Gr.has(`${x.parent_collection}|${String(N)}`);
2731
2731
  }), v = `hint|${r.child_field}|${d}`;
2732
- if (b && !oi.current.has(v)) {
2733
- oi.current.add(v);
2732
+ if (b && !ii.current.has(v)) {
2733
+ ii.current.add(v);
2734
2734
  const x = ((t = E == null ? void 0 : E.fieldLabels) == null ? void 0 : t[r.parent_field]) ?? _e(r.parent_field);
2735
2735
  be.message(
2736
2736
  `${i.label ?? "Value"} on ${p.length} ${p.length === 1 ? "line is" : "lines are"} not available for this ${x} — no default ${(i.label ?? "value").toLowerCase()} is set on it (or its type), so nothing was switched`
@@ -2745,7 +2745,7 @@ function zu({
2745
2745
  let r = 0, i = 0, o = 0, a = 0;
2746
2746
  for (const x of n) {
2747
2747
  for (const H of x.ids)
2748
- oi.current.add(`${x.rule.child_field}|${H}|${x.filterKey}`);
2748
+ ii.current.add(`${x.rule.child_field}|${H}|${x.filterKey}`);
2749
2749
  const N = x.rule.child_field, _ = (x.cfg.keep ?? []).filter((H) => typeof H == "string" && H), g = await $.request(
2750
2750
  ue(`/items/${x.target}`, {
2751
2751
  filter: JSON.stringify({ id: { _in: x.ids } }),
@@ -2774,7 +2774,7 @@ function zu({
2774
2774
  pe == null ? i++ : O.set(String(H.id), pe);
2775
2775
  }
2776
2776
  if (O.size === 0) continue;
2777
- const L = zt(), q = async (H) => {
2777
+ const T = zt(), q = async (H) => {
2778
2778
  const ce = {
2779
2779
  ...H,
2780
2780
  [N]: O.get(String(H[N]))
@@ -2782,22 +2782,22 @@ function zu({
2782
2782
  let pe = { [N]: ce[N] };
2783
2783
  if (W && W.length > 0) {
2784
2784
  const G = await $.request(
2785
- Te("/field-rules/evaluate", {
2785
+ Le("/field-rules/evaluate", {
2786
2786
  collection: s,
2787
2787
  data: H,
2788
2788
  locks_only: !0,
2789
2789
  probe: !0,
2790
- parent_context: L,
2790
+ parent_context: T,
2791
2791
  row_rules: W
2792
2792
  })
2793
2793
  ).catch(() => null), Xe = ao(N, H, G == null ? void 0 : G.expected);
2794
2794
  for (const Dn of Xe) ce[Dn] = null;
2795
2795
  const rt = await $.request(
2796
- Te("/field-rules/evaluate", {
2796
+ Le("/field-rules/evaluate", {
2797
2797
  collection: s,
2798
2798
  data: ce,
2799
2799
  changed_field: N,
2800
- parent_context: L,
2800
+ parent_context: T,
2801
2801
  row_rules: W
2802
2802
  })
2803
2803
  ).catch(() => null);
@@ -2849,22 +2849,22 @@ function zu({
2849
2849
  })().finally(() => {
2850
2850
  oo.current = !1;
2851
2851
  }));
2852
- }, [io, He, E == null ? void 0 : E.dirtyFields, Yr]);
2853
- const gr = T(() => {
2852
+ }, [io, He, E == null ? void 0 : E.dirtyFields, Gr]);
2853
+ const gr = L(() => {
2854
2854
  const e = /* @__PURE__ */ new Map(), n = [...I, ...K], t = [...C.values()], r = ft.flatMap((i) => i.rows);
2855
2855
  f != null && f.draft && r.push(f.draft);
2856
2856
  for (const [i, o] of ze) {
2857
- if (!o.one_collection || Il(o.one_collection)) continue;
2857
+ if (!o.one_collection || Ol(o.one_collection)) continue;
2858
2858
  const a = n.map((m) => m[i]).filter((m) => m != null).map(String), c = t.map((m) => m[i]).filter((m) => m != null).map(String), d = r.map((m) => m[i]).filter((m) => m != null).map(String), p = [.../* @__PURE__ */ new Set([...a, ...c, ...d])].sort();
2859
2859
  p.length && e.set(o.one_collection, p);
2860
2860
  }
2861
2861
  return e;
2862
- }, [I, K, C, ze, ft, f == null ? void 0 : f.draft]), Da = T(() => {
2862
+ }, [I, K, C, ze, ft, f == null ? void 0 : f.draft]), Wa = L(() => {
2863
2863
  const e = /* @__PURE__ */ new Map();
2864
2864
  for (const n of Ne) {
2865
2865
  const t = ze.get(n.field);
2866
2866
  if (t != null && t.one_collection && n.interface === "relation-grouped") {
2867
- const r = hi(n.options);
2867
+ const r = pi(n.options);
2868
2868
  r != null && r.group_field && (r != null && r.option_field) && e.set(t.one_collection, {
2869
2869
  groupField: r.group_field,
2870
2870
  optionField: r.option_field
@@ -2872,11 +2872,11 @@ function zu({
2872
2872
  }
2873
2873
  }
2874
2874
  return e;
2875
- }, [Ne, ze]), Wa = T(
2875
+ }, [Ne, ze]), Ua = L(
2876
2876
  () => ["m2o-display", s, ...Array.from(gr.entries()).flat(2)],
2877
2877
  [s, gr]
2878
- ), { data: mn = {}, isFetching: Ua } = Ce({
2879
- queryKey: Wa,
2878
+ ), { data: mn = {}, isFetching: Ba } = Ce({
2879
+ queryKey: Ua,
2880
2880
  queryFn: async () => {
2881
2881
  const e = {}, n = await Promise.all(
2882
2882
  [...gr.keys()].map(
@@ -2891,7 +2891,7 @@ function zu({
2891
2891
  );
2892
2892
  return await Promise.all(
2893
2893
  n.map(async ({ collection: t, meta: r }) => {
2894
- const i = gr.get(t), o = Da.get(t);
2894
+ const i = gr.get(t), o = Wa.get(t);
2895
2895
  let a;
2896
2896
  if (o)
2897
2897
  a = `id,${o.groupField}.*,${o.optionField}.*`;
@@ -2925,14 +2925,14 @@ function zu({
2925
2925
  // already known on screen while the new one loads.
2926
2926
  placeholderData: (e) => e,
2927
2927
  staleTime: 6e4
2928
- }), Ba = T(
2928
+ }), Ja = L(
2929
2929
  () => le != null && le.unmatched_banner ? K.map((e) => ge({ ...e })) : void 0,
2930
2930
  // eslint-disable-next-line react-hooks/exhaustive-deps
2931
2931
  [le == null ? void 0 : le.unmatched_banner, K]
2932
- ), Qt = Lc({
2932
+ ), Qt = Kc({
2933
2933
  config: le,
2934
2934
  rows: I,
2935
- stagedRows: Ba,
2935
+ stagedRows: Ja,
2936
2936
  relatedCollection: s,
2937
2937
  childRelations: Pe,
2938
2938
  parentDraft: E == null ? void 0 : E.draft,
@@ -2949,7 +2949,7 @@ function zu({
2949
2949
  r[String(i)] = o;
2950
2950
  try {
2951
2951
  const o = (await $.request(
2952
- Te("/field-rules/apply", {
2952
+ Le("/field-rules/apply", {
2953
2953
  collection: s,
2954
2954
  fk_field: u,
2955
2955
  ...S ? {} : { parent_id: y },
@@ -2982,18 +2982,18 @@ function zu({
2982
2982
  for (const p of c)
2983
2983
  Qe.has(String(p.id)) || w.queueEdit(s, u, String(p.id), p.patch);
2984
2984
  const d = a.length + c.length;
2985
- be.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), Mn(null), ai(!1);
2985
+ be.success(`Rules staged on ${d} ${d === 1 ? "line" : "lines"} — saved with the record`), Mn(null), li(!1);
2986
2986
  return;
2987
2987
  }
2988
2988
  if (a.length > 0 && c.length === 0) {
2989
2989
  be.success(
2990
2990
  `Rules applied to ${a.length} pending ${a.length === 1 ? "line" : "lines"}`
2991
- ), Mn(null), ai(!1);
2991
+ ), Mn(null), li(!1);
2992
2992
  return;
2993
2993
  }
2994
2994
  if (a.length > 0) {
2995
2995
  const d = await $.request(
2996
- Te("/field-rules/apply", {
2996
+ Le("/field-rules/apply", {
2997
2997
  collection: s,
2998
2998
  fk_field: u,
2999
2999
  parent_id: y,
@@ -3011,8 +3011,8 @@ function zu({
3011
3011
  V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), V.invalidateQueries({
3012
3012
  queryKey: ["o2m-field-snapshots", s, u, y]
3013
3013
  }), o.failed.length ? be.error(
3014
- `Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"} — ${o.failed.length} failed: ${o.failed.slice(0, 3).map((d) => `${bi(I, String(d.id), X)}: ${d.error}`).join("; ")}`
3015
- ) : be.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), Mn(null), ai(!1);
3014
+ `Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"} — ${o.failed.length} failed: ${o.failed.slice(0, 3).map((d) => `${gi(I, String(d.id), X)}: ${d.error}`).join("; ")}`
3015
+ ) : be.success(`Rules applied to ${o.applied} ${o.applied === 1 ? "line" : "lines"}`), Mn(null), li(!1);
3016
3016
  } catch (i) {
3017
3017
  be.error(`Re-run rules failed: ${Un(i, "unknown error")}`);
3018
3018
  } finally {
@@ -3034,9 +3034,9 @@ function zu({
3034
3034
  }
3035
3035
  return e;
3036
3036
  }
3037
- function si(e, n) {
3037
+ function oi(e, n) {
3038
3038
  !$ || !W || W.length === 0 || $.request(
3039
- Te("/field-rules/evaluate", {
3039
+ Le("/field-rules/evaluate", {
3040
3040
  collection: s,
3041
3041
  data: n,
3042
3042
  locks_only: !0,
@@ -3071,26 +3071,26 @@ function zu({
3071
3071
  }
3072
3072
  }
3073
3073
  const lo = async (e) => await Vt.current.get(e) ?? null;
3074
- function li(e) {
3075
- if (j) return;
3074
+ function si(e) {
3075
+ if (R) return;
3076
3076
  const n = String(e.id);
3077
3077
  if ((f == null ? void 0 : f.rowId) === n) return;
3078
3078
  eo.current();
3079
- const t = Pa(n);
3079
+ const t = Da(n);
3080
3080
  if (t && !Zi.current.has(zs(n, t))) {
3081
3081
  fn({ rowKey: n, editor: t });
3082
3082
  return;
3083
3083
  }
3084
3084
  Ze && fn(null);
3085
3085
  const r = ge({ ...e }), i = Ie.find((o) => String(o.id) === n) ?? e;
3086
- jn.current = { rowId: n, snap: Mt(i) }, so(n), Je({ rowId: n, draft: r, locksPending: Hn.size > 0 }), si(n, r);
3086
+ Rn.current = { rowId: n, snap: Mt(i) }, so(n), Je({ rowId: n, draft: r, locksPending: Hn.size > 0 }), oi(n, r);
3087
3087
  }
3088
3088
  de(() => {
3089
3089
  const e = (n) => {
3090
3090
  const t = n.detail;
3091
3091
  if (!t || t.collection !== s || t.field !== u || !t.rowId) return;
3092
3092
  const r = I.find((i) => String(i.id) === String(t.rowId));
3093
- r && (li(r), window.setTimeout(() => {
3093
+ r && (si(r), window.setTimeout(() => {
3094
3094
  const i = document.querySelector(
3095
3095
  `[data-o2m-row="${s}:${String(t.rowId)}"]`
3096
3096
  );
@@ -3100,12 +3100,12 @@ function zu({
3100
3100
  return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
3101
3101
  }, [s, u, I]);
3102
3102
  function Xs(e, n) {
3103
- if (j) return;
3103
+ if (R) return;
3104
3104
  const t = `pending:${n}`;
3105
3105
  if ((f == null ? void 0 : f.rowId) === t) return;
3106
3106
  Ze && fn(null);
3107
3107
  const r = ge({ ...e });
3108
- Je({ rowId: t, draft: r, locksPending: Hn.size > 0 }), si(t, r);
3108
+ Je({ rowId: t, draft: r, locksPending: Hn.size > 0 }), oi(t, r);
3109
3109
  }
3110
3110
  function Zs(e) {
3111
3111
  var d, p, m, h;
@@ -3117,7 +3117,7 @@ function zu({
3117
3117
  const c = n.op === "neq" ? "is not" : n.op === "null" ? "is empty" : n.op === "nnull" ? "is set" : n.op === "in" ? "is one of" : n.op === "contains" ? "contains" : "is";
3118
3118
  return `Locked — ${r} ${c}${n.op === "null" || n.op === "nnull" ? "" : ` ${n.value ?? ""}`}`;
3119
3119
  }
3120
- function Ja(e) {
3120
+ function Qa(e) {
3121
3121
  const n = f == null ? void 0 : f.expected;
3122
3122
  if (!n || !(e in n)) return null;
3123
3123
  const t = f == null ? void 0 : f.draft[e];
@@ -3125,14 +3125,14 @@ function zu({
3125
3125
  const i = n[e];
3126
3126
  return i == null || i === "" ? null : String(t) === String(i) ? "auto" : "overridden";
3127
3127
  }
3128
- function Qa(e) {
3128
+ function za(e) {
3129
3129
  const n = Ye.current;
3130
3130
  if (!n || !$ || !W || W.length === 0) return;
3131
3131
  const t = n.rowId;
3132
3132
  gt.current.rowId !== t && (gt.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
3133
- const r = ++$i.current;
3133
+ const r = ++Si.current;
3134
3134
  gt.current.seqs.set(e, r), $.request(
3135
- Te("/field-rules/evaluate", {
3135
+ Le("/field-rules/evaluate", {
3136
3136
  collection: s,
3137
3137
  data: n.draft,
3138
3138
  target_fields: [e],
@@ -3181,7 +3181,7 @@ function zu({
3181
3181
  });
3182
3182
  }
3183
3183
  function tl(e, n) {
3184
- if (j) return;
3184
+ if (R) return;
3185
3185
  const t = { ...e };
3186
3186
  if (n.rowDeleted || !n.itemId) {
3187
3187
  delete t.id;
@@ -3190,10 +3190,10 @@ function zu({
3190
3190
  rowId: "new",
3191
3191
  draft: lr(t),
3192
3192
  locksPending: Hn.size > 0
3193
- }), si("new", t);
3193
+ }), oi("new", t);
3194
3194
  } else
3195
3195
  Je({ rowId: String(n.itemId), draft: t });
3196
- Fn(null), Si(null), Mr(!1);
3196
+ Fn(null), Ni(null), Mr(!1);
3197
3197
  }
3198
3198
  function co(e) {
3199
3199
  if (At(null), Je(
@@ -3212,11 +3212,11 @@ function zu({
3212
3212
  const n = e.filter((i) => !document.getElementById(Cn(i.field, "cell")));
3213
3213
  n.length && At(n.map((i) => i.message).join(" · "));
3214
3214
  const t = e.find((i) => !n.includes(i));
3215
- t && ((r = ec(document.getElementById(Cn(t.field, "cell")))) == null || r.focus());
3215
+ t && ((r = tc(document.getElementById(Cn(t.field, "cell")))) == null || r.focus());
3216
3216
  });
3217
3217
  }
3218
- function za() {
3219
- j || (Je({ rowId: "new", draft: { ...rn }, locksPending: Hn.size > 0 }), si("new", { ...rn }));
3218
+ function Va() {
3219
+ R || (Je({ rowId: "new", draft: { ...rn }, locksPending: Hn.size > 0 }), oi("new", { ...rn }));
3220
3220
  }
3221
3221
  function br() {
3222
3222
  var n;
@@ -3233,7 +3233,7 @@ function zu({
3233
3233
  (i = w == null ? void 0 : w.noteEditIntent) == null || i.call(w);
3234
3234
  const n = Ye.current, t = (n == null ? void 0 : n.rowId) ?? null;
3235
3235
  Gn.current = t, gt.current.rowId !== t && (gt.current = { rowId: t, seqs: /* @__PURE__ */ new Map() });
3236
- for (const o of Object.keys(e)) gt.current.seqs.set(o, ++$i.current);
3236
+ for (const o of Object.keys(e)) gt.current.seqs.set(o, ++Si.current);
3237
3237
  const r = ge({ ...(n == null ? void 0 : n.draft) ?? {}, ...e });
3238
3238
  Je((o) => o && { ...o, draft: r });
3239
3239
  }
@@ -3242,30 +3242,30 @@ function zu({
3242
3242
  (v = w == null ? void 0 : w.noteEditIntent) == null || v.call(w);
3243
3243
  const t = Ye.current, r = (t == null ? void 0 : t.rowId) ?? null;
3244
3244
  Gn.current = r, gt.current.rowId !== r && (gt.current = { rowId: r, seqs: /* @__PURE__ */ new Map() });
3245
- const i = ++$i.current;
3245
+ const i = ++Si.current;
3246
3246
  gt.current.seqs.set(e, i);
3247
3247
  const o = ge(t ? { ...t.draft, [e]: n } : { [e]: n }), a = n != null && n !== "", c = !!((x = Ne.find((g) => g.field === e)) != null && x.required), d = (a || !c) && !!((N = t == null ? void 0 : t.missing) != null && N.includes(e)), p = d ? ((t == null ? void 0 : t.missing) ?? []).filter((g) => g !== e) : t == null ? void 0 : t.missing, m = ((t == null ? void 0 : t.invalid) ?? []).filter(
3248
3248
  (g) => ae.some((O) => O.field === g && O.computed_type === "write")
3249
3249
  ), h = !!((_ = t == null ? void 0 : t.invalid) != null && _.includes(e)) || m.length > 0, b = h ? ((t == null ? void 0 : t.invalid) ?? []).filter((g) => g !== e && !m.includes(g)) : t == null ? void 0 : t.invalid;
3250
3250
  if ((d || h) && ((p == null ? void 0 : p.length) ?? 0) === 0 && ((b == null ? void 0 : b.length) ?? 0) === 0 && At(null), Je(
3251
3251
  (g) => {
3252
- var O, L;
3252
+ var O, T;
3253
3253
  return g && {
3254
3254
  ...g,
3255
3255
  draft: o,
3256
3256
  missing: (a || !c) && ((O = g.missing) != null && O.includes(e)) ? g.missing.filter((q) => q !== e) : g.missing,
3257
- invalid: (L = g.invalid) != null && L.length ? g.invalid.filter(
3257
+ invalid: (T = g.invalid) != null && T.length ? g.invalid.filter(
3258
3258
  (q) => q !== e && !ae.some((z) => z.field === q && z.computed_type === "write")
3259
3259
  ) : g.invalid
3260
3260
  };
3261
3261
  }
3262
3262
  ), W && W.length > 0 && $) {
3263
- const g = zt(), O = ao(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), L = { ...o };
3264
- for (const q of O) L[q] = null;
3263
+ const g = zt(), O = ao(e, (t == null ? void 0 : t.draft) ?? {}, t == null ? void 0 : t.expected), T = { ...o };
3264
+ for (const q of O) T[q] = null;
3265
3265
  $.request(
3266
- Te("/field-rules/evaluate", {
3266
+ Le("/field-rules/evaluate", {
3267
3267
  collection: s,
3268
- data: L,
3268
+ data: T,
3269
3269
  changed_field: e,
3270
3270
  probe: !0,
3271
3271
  parent_context: g,
@@ -3277,12 +3277,12 @@ function zu({
3277
3277
  }
3278
3278
  function Kt() {
3279
3279
  if (en.current) return en.current;
3280
- const e = Va().finally(() => {
3280
+ const e = Fa().finally(() => {
3281
3281
  en.current === e && (en.current = null);
3282
3282
  });
3283
3283
  return en.current = e, e;
3284
3284
  }
3285
- async function Va() {
3285
+ async function Fa() {
3286
3286
  var m;
3287
3287
  if (!f) return !1;
3288
3288
  const e = f.rowId, n = () => {
@@ -3290,12 +3290,12 @@ function zu({
3290
3290
  ((h = Ye.current) == null ? void 0 : h.rowId) === e && Je(null);
3291
3291
  };
3292
3292
  if (Ue != null && Ue.length) {
3293
- const h = f.rowId.startsWith("pending:"), b = h ? parseInt(f.rowId.split(":")[1], 10) : null, v = f.rowId === "new" || h ? null : f.rowId, x = jo(f.draft, Ue);
3293
+ const h = f.rowId.startsWith("pending:"), b = h ? parseInt(f.rowId.split(":")[1], 10) : null, v = f.rowId === "new" || h ? null : f.rowId, x = Ro(f.draft, Ue);
3294
3294
  if (I.some((_) => {
3295
3295
  if (String(_.id) === v || Qe.has(String(_.id))) return !1;
3296
3296
  const g = C.has(String(_.id)) ? { ..._, ...C.get(String(_.id)) } : _;
3297
- return jo(g, Ue) === x;
3298
- }) || K.some((_, g) => g !== b && jo(_, Ue) === x))
3297
+ return Ro(g, Ue) === x;
3298
+ }) || K.some((_, g) => g !== b && Ro(_, Ue) === x))
3299
3299
  return At(`A row with the same ${Ue.join(" + ")} already exists.`), !1;
3300
3300
  }
3301
3301
  const t = (h) => h == null || h === "", r = Ne.filter(
@@ -3313,10 +3313,10 @@ function zu({
3313
3313
  const i = ys(f.rowId), o = Ne.flatMap((h) => {
3314
3314
  var v;
3315
3315
  if (Sr(h) || (v = f.locks) != null && v.includes(h.field)) return [];
3316
- if (!xc.has(h.type ?? "")) return [];
3316
+ if (!Nc.has(h.type ?? "")) return [];
3317
3317
  if (i && String(i[h.field] ?? "") === String(f.draft[h.field] ?? ""))
3318
3318
  return [];
3319
- const b = _c(f.draft[h.field], {
3319
+ const b = Sc(f.draft[h.field], {
3320
3320
  type: h.type,
3321
3321
  label: h.label || _e(h.field)
3322
3322
  });
@@ -3324,7 +3324,7 @@ function zu({
3324
3324
  });
3325
3325
  if (o.length > 0)
3326
3326
  return co(o), !1;
3327
- const a = i ? Rl(f.draft, i, new Set(Object.keys(f.draft))) : f.draft, c = kc(
3327
+ const a = i ? Tl(f.draft, i, new Set(Object.keys(f.draft))) : f.draft, c = $c(
3328
3328
  ae.map((h) => ({
3329
3329
  field: h.field,
3330
3330
  label: h.label || _e(h.field),
@@ -3336,11 +3336,11 @@ function zu({
3336
3336
  );
3337
3337
  if (c.length > 0)
3338
3338
  return co(c), !1;
3339
- const d = Nc(
3339
+ const d = Ec(
3340
3340
  ae,
3341
3341
  ge({ ...f.draft }),
3342
3342
  i,
3343
- f.rowId === "new" ? "New line" : f.rowId.startsWith("pending:") ? `Line ${Number(f.rowId.slice(8)) + I.length + 1}` : bi(I, f.rowId, X)
3343
+ f.rowId === "new" ? "New line" : f.rowId.startsWith("pending:") ? `Line ${Number(f.rowId.slice(8)) + I.length + 1}` : gi(I, f.rowId, X)
3344
3344
  );
3345
3345
  if (d.length > 0)
3346
3346
  return co(d), !1;
@@ -3358,11 +3358,11 @@ function zu({
3358
3358
  return Number(ge(z)[b]) || 0;
3359
3359
  })() : x >= 0 && Number(
3360
3360
  ge(K[x])[b]
3361
- ) || 0, O = _ + g, L = _ + (Number(v[b]) || 0);
3362
- if (L > h + 5e-3 && L > O + 5e-3) {
3361
+ ) || 0, O = _ + g, T = _ + (Number(v[b]) || 0);
3362
+ if (T > h + 5e-3 && T > O + 5e-3) {
3363
3363
  const q = (z) => Be.format === "currency" ? z.toLocaleString("en-US", { style: "currency", currency: "USD" }) : z.toLocaleString("en-US", { maximumFractionDigits: 2 });
3364
3364
  return At(
3365
- `${Be.message ?? `${Be.label ?? "Total"} cannot exceed ${q(h)}`} — this would make it ${q(L)} (${q(L - h)} over).`
3365
+ `${Be.message ?? `${Be.label ?? "Total"} cannot exceed ${q(h)}`} — this would make it ${q(T)} (${q(T - h)} over).`
3366
3366
  ), !1;
3367
3367
  }
3368
3368
  }
@@ -3373,7 +3373,7 @@ function zu({
3373
3373
  try {
3374
3374
  if (f.rowId.startsWith("pending:")) {
3375
3375
  const h = parseInt(f.rowId.split(":")[1], 10), b = K[h];
3376
- return w == null || w.updateRow(s, u, h, f.draft), b != null && b.__prefilled && (b == null ? void 0 : b.id) != null && Ha((v) => /* @__PURE__ */ new Set([...v, b.id])), n(), xn(!1), !0;
3376
+ return w == null || w.updateRow(s, u, h, f.draft), b != null && b.__prefilled && (b == null ? void 0 : b.id) != null && Ca((v) => /* @__PURE__ */ new Set([...v, b.id])), n(), xn(!1), !0;
3377
3377
  }
3378
3378
  if (f.rowId === "new") {
3379
3379
  if ((S || D) && w)
@@ -3386,22 +3386,22 @@ function zu({
3386
3386
  let N = null;
3387
3387
  try {
3388
3388
  N = await $.request(
3389
- Te(`/items/${s}${pt}`, x)
3389
+ Le(`/items/${s}${pt}`, x)
3390
3390
  );
3391
3391
  } catch (g) {
3392
3392
  const O = No(g);
3393
3393
  if (O)
3394
3394
  return Xn({
3395
3395
  challenge: O,
3396
- retry: async (L) => {
3396
+ retry: async (T) => {
3397
3397
  var z;
3398
3398
  const q = await $.request(
3399
- Te(`/items/${s}${pt}`, {
3399
+ Le(`/items/${s}${pt}`, {
3400
3400
  ...x,
3401
- _change_reason: L
3401
+ _change_reason: T
3402
3402
  })
3403
3403
  );
3404
- Tt.current = Date.now(), ((z = q == null ? void 0 : q.data) == null ? void 0 : z.id) != null && wt(String(q.data.id)), V.invalidateQueries({
3404
+ Lt.current = Date.now(), ((z = q == null ? void 0 : q.data) == null ? void 0 : z.id) != null && wt(String(q.data.id)), V.invalidateQueries({
3405
3405
  queryKey: ["o2m-rows", s, u, y]
3406
3406
  }), n();
3407
3407
  }
@@ -3409,15 +3409,15 @@ function zu({
3409
3409
  throw g;
3410
3410
  }
3411
3411
  const _ = (m = N == null ? void 0 : N.data) == null ? void 0 : m.id;
3412
- if (Tt.current = Date.now(), _ != null && wt(String(_)), _ != null && h.length && await Promise.all(
3412
+ if (Lt.current = Date.now(), _ != null && wt(String(_)), _ != null && h.length && await Promise.all(
3413
3413
  h.map(([g, O]) => {
3414
3414
  if (O == null) return Promise.resolve();
3415
- const L = g.slice(6), q = Ui({
3416
- field: L,
3415
+ const T = g.slice(6), q = Ui({
3416
+ field: T,
3417
3417
  interface: "select-multiple-m2m"
3418
3418
  });
3419
3419
  return q ? $.request(
3420
- Te(`/items/${q.junctionCollection}`, {
3420
+ Le(`/items/${q.junctionCollection}`, {
3421
3421
  [q.junctionManyField]: _,
3422
3422
  [q.junctionOtherField]: O
3423
3423
  })
@@ -3425,11 +3425,11 @@ function zu({
3425
3425
  })
3426
3426
  ), b.length) {
3427
3427
  const g = [];
3428
- let O = "", L = 0, q = 0;
3428
+ let O = "", T = 0, q = 0;
3429
3429
  for (const [re, H] of b) {
3430
3430
  const ce = re.slice(6), pe = Array.isArray(H) ? H : [];
3431
3431
  if (pe.length === 0) continue;
3432
- L += pe.length;
3432
+ T += pe.length;
3433
3433
  const G = Pe.find(
3434
3434
  (rt) => rt.one_collection === s && rt.one_field === ce
3435
3435
  );
@@ -3441,13 +3441,13 @@ function zu({
3441
3441
  for (const rt of pe)
3442
3442
  try {
3443
3443
  await $.request(
3444
- Te(`/items/${G.many_collection}`, {
3444
+ Le(`/items/${G.many_collection}`, {
3445
3445
  ...rt,
3446
3446
  [G.many_field]: _
3447
3447
  })
3448
3448
  );
3449
3449
  } catch (Dn) {
3450
- Xe.push(rt), O || (O = Ul(Dn));
3450
+ Xe.push(rt), O || (O = Bl(Dn));
3451
3451
  }
3452
3452
  Xe.length && g.push({
3453
3453
  label: _e(ce),
@@ -3459,10 +3459,10 @@ function zu({
3459
3459
  }
3460
3460
  const z = g.reduce((re, H) => re + H.members.length, 0);
3461
3461
  q > 0 ? Dr({
3462
- text: `The line saved, but ${q} of ${L} nested row${L === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
3462
+ text: `The line saved, but ${q} of ${T} nested row${T === 1 ? "" : "s"} could not be attached — the server did not return the new line's id. Open the line and add them again.`,
3463
3463
  groups: []
3464
3464
  }) : z > 0 && Dr({
3465
- text: `${z} of ${L} ${g.map((re) => re.label).join(", ")} row${L === 1 ? "" : "s"} did not save — ${O}`,
3465
+ text: `${z} of ${T} ${g.map((re) => re.label).join(", ")} row${T === 1 ? "" : "s"} did not save — ${O}`,
3466
3466
  groups: g
3467
3467
  });
3468
3468
  }
@@ -3474,11 +3474,11 @@ function zu({
3474
3474
  // A reason an editor action prefilled (carry-forward) rides the row:
3475
3475
  // the server stores it on the activity row, never in a column.
3476
3476
  "_change_reason"
3477
- ]), v = I.find((g) => String(g.id) === f.rowId), x = Rl(f.draft, v, b);
3477
+ ]), v = I.find((g) => String(g.id) === f.rowId), x = Tl(f.draft, v, b);
3478
3478
  if (D && w) {
3479
3479
  const g = Object.entries(f.draft).filter(
3480
3480
  ([re]) => re.startsWith("__nested_ops_")
3481
- ), O = x, { rest: L, reverted: q } = Sc(
3481
+ ), O = x, { rest: T, reverted: q } = qc(
3482
3482
  C.get(f.rowId),
3483
3483
  f.draft,
3484
3484
  v
@@ -3486,11 +3486,11 @@ function zu({
3486
3486
  if (q.length > 0) {
3487
3487
  w.cancelPendingEdit(s, u, f.rowId);
3488
3488
  const re = {
3489
- ...L,
3489
+ ...T,
3490
3490
  ...O,
3491
3491
  ...Object.fromEntries(g)
3492
3492
  };
3493
- if ($c(re)) {
3493
+ if (Ic(re)) {
3494
3494
  const H = await lo(f.rowId);
3495
3495
  w.queueEdit(s, u, f.rowId, {
3496
3496
  ...re,
@@ -3513,7 +3513,7 @@ function zu({
3513
3513
  const N = await lo(f.rowId), _ = (g) => N != null ? { ...g, _base_revision: N } : g;
3514
3514
  try {
3515
3515
  await $.request(
3516
- wi(`/items/${s}/${f.rowId}${pt}`, _(x))
3516
+ yi(`/items/${s}/${f.rowId}${pt}`, _(x))
3517
3517
  );
3518
3518
  } catch (g) {
3519
3519
  const O = No(g);
@@ -3523,16 +3523,16 @@ function zu({
3523
3523
  challenge: O,
3524
3524
  retry: async (z) => {
3525
3525
  await $.request(
3526
- wi(q, _({ ...x, _change_reason: z }))
3526
+ yi(q, _({ ...x, _change_reason: z }))
3527
3527
  ), Vt.current.delete(e), ot.forget(e), wt(e), V.invalidateQueries({
3528
3528
  queryKey: ["o2m-rows", s, u, y]
3529
3529
  }), n();
3530
3530
  }
3531
3531
  }), xn(!1), !1;
3532
3532
  }
3533
- const L = Md(g);
3534
- if (L)
3535
- return Vt.current.set(e, Promise.resolve(L.latest || null)), L.latest > 0 && ot.set(e, L.latest), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), be.warning(
3533
+ const T = Kd(g);
3534
+ if (T)
3535
+ return Vt.current.set(e, Promise.resolve(T.latest || null)), T.latest > 0 && ot.set(e, T.latest), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), be.warning(
3536
3536
  "Someone else changed this line while you edited it — take their values or keep yours, then save again"
3537
3537
  ), xn(!1), !1;
3538
3538
  throw g;
@@ -3546,11 +3546,11 @@ function zu({
3546
3546
  xn(!1);
3547
3547
  }
3548
3548
  }
3549
- const [Fa, Ha] = B(/* @__PURE__ */ new Set()), [qt, nl] = B(null), [Ft, rl] = B(null), [Ca, il] = B(!1), [pn, Ga] = B(1), [hn, Tn] = B(!1), [ol, Ya] = B(!1), [fo, Xa] = B({}), [sl, ll] = B(!1), [al, ai] = B(!1), [mo, Za] = B("empty-only"), [di, dl] = B(null), [Ht, Mn] = B(null), [gn, cl] = B({}), [ul, fl] = B(!1);
3550
- function ed(e, n) {
3551
- Xa((t) => ({ ...t, [e]: n }));
3549
+ const [Ha, Ca] = B(/* @__PURE__ */ new Set()), [qt, nl] = B(null), [Ft, rl] = B(null), [Ga, il] = B(!1), [pn, Ya] = B(1), [hn, Ln] = B(!1), [ol, Xa] = B(!1), [fo, Za] = B({}), [sl, ll] = B(!1), [al, li] = B(!1), [mo, ed] = B("empty-only"), [ai, dl] = B(null), [Ht, Mn] = B(null), [gn, cl] = B({}), [ul, fl] = B(!1);
3550
+ function td(e, n) {
3551
+ Za((t) => ({ ...t, [e]: n }));
3552
3552
  }
3553
- async function td() {
3553
+ async function nd() {
3554
3554
  if (Object.keys(gn).some(
3555
3555
  (n) => gn[n] !== null && gn[n] !== void 0
3556
3556
  )) {
@@ -3589,7 +3589,7 @@ function zu({
3589
3589
  }
3590
3590
  }
3591
3591
  }
3592
- async function nd(e) {
3592
+ async function rd(e) {
3593
3593
  const n = Math.max(1, Math.min(24, pn)), t = /* @__PURE__ */ new Date(), r = Array.from({ length: n }, (i, o) => {
3594
3594
  const a = new Date(t.getFullYear(), t.getMonth() + 1 + o, 1), c = `${a.getFullYear()}-${String(a.getMonth() + 1).padStart(2, "0")}-01`;
3595
3595
  return { ...rn, ...fo, [e]: c };
@@ -3598,40 +3598,40 @@ function zu({
3598
3598
  for (const i of an(r)) w.queueRow(s, u, i);
3599
3599
  return;
3600
3600
  }
3601
- Tn(!0);
3601
+ Ln(!0);
3602
3602
  try {
3603
3603
  for (const i of an(r))
3604
3604
  await $.request(
3605
- Te(`/items/${s}${pt}`, { ...i, [u]: y })
3605
+ Le(`/items/${s}${pt}`, { ...i, [u]: y })
3606
3606
  );
3607
- Tt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3607
+ Lt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3608
3608
  } catch {
3609
3609
  } finally {
3610
- Tn(!1);
3610
+ Ln(!1);
3611
3611
  }
3612
3612
  }
3613
- async function rd() {
3613
+ async function id() {
3614
3614
  const e = le == null ? void 0 : le.unmatched_banner;
3615
3615
  if (!e || Qt.unmatchedCandidates.length === 0) return;
3616
3616
  const n = Qt.unmatchedCandidates.map((t) => ({
3617
3617
  ...rn,
3618
- ...Tc(e, t)
3618
+ ...Pc(e, t)
3619
3619
  }));
3620
3620
  if ((S || D) && w) {
3621
3621
  for (const t of an(n)) w.queueRow(s, u, t);
3622
3622
  return;
3623
3623
  }
3624
- Tn(!0);
3624
+ Ln(!0);
3625
3625
  try {
3626
3626
  for (const t of an(n))
3627
3627
  await $.request(
3628
- Te(`/items/${s}${pt}`, { ...t, [u]: y })
3628
+ Le(`/items/${s}${pt}`, { ...t, [u]: y })
3629
3629
  );
3630
- Tt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3630
+ Lt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3631
3631
  } catch (t) {
3632
3632
  be.error(`Could not add rows: ${Un(t, "unknown error")}`);
3633
3633
  } finally {
3634
- Tn(!1);
3634
+ Ln(!1);
3635
3635
  }
3636
3636
  }
3637
3637
  async function ml(e) {
@@ -3641,16 +3641,16 @@ function zu({
3641
3641
  for (const i of r) w.queueRow(s, u, i);
3642
3642
  return;
3643
3643
  }
3644
- Tn(!0);
3644
+ Ln(!0);
3645
3645
  try {
3646
3646
  for (const r of an(Array.from({ length: n }, () => ({ ...t }))))
3647
3647
  await $.request(
3648
- Te(`/items/${s}${pt}`, { ...r, [u]: y })
3648
+ Le(`/items/${s}${pt}`, { ...r, [u]: y })
3649
3649
  );
3650
- Tt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3650
+ Lt.current = Date.now(), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
3651
3651
  } catch {
3652
3652
  } finally {
3653
- Tn(!1);
3653
+ Ln(!1);
3654
3654
  }
3655
3655
  }
3656
3656
  function pl(e) {
@@ -3662,7 +3662,7 @@ function zu({
3662
3662
  function Kn() {
3663
3663
  nl(null), rl(null);
3664
3664
  }
3665
- async function id(e) {
3665
+ async function od(e) {
3666
3666
  if (e.preventDefault(), qt === null || Ft === null || qt === Ft) {
3667
3667
  Kn();
3668
3668
  return;
@@ -3686,7 +3686,7 @@ function zu({
3686
3686
  await Promise.all(
3687
3687
  r.map(
3688
3688
  ({ row: i, newOrder: o }) => $.request(
3689
- wi(`/items/${s}/${i.id}${pt}`, { [X]: o })
3689
+ yi(`/items/${s}/${i.id}${pt}`, { [X]: o })
3690
3690
  )
3691
3691
  )
3692
3692
  ), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
@@ -3703,7 +3703,7 @@ function zu({
3703
3703
  return;
3704
3704
  }
3705
3705
  try {
3706
- await $.request(Ql(`/items/${s}/${t}${pt}`)), wt(String(t)), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), (f == null ? void 0 : f.rowId) === String(t) && Je(null), J && V.invalidateQueries({
3706
+ await $.request(zl(`/items/${s}/${t}${pt}`)), wt(String(t)), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] }), (f == null ? void 0 : f.rowId) === String(t) && Je(null), J && V.invalidateQueries({
3707
3707
  queryKey: ["o2m-field-snapshots", s, u, y]
3708
3708
  });
3709
3709
  } catch {
@@ -3735,22 +3735,22 @@ function zu({
3735
3735
  "en-US",
3736
3736
  Nt(i, i.format)
3737
3737
  ), N = m.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (_, g) => {
3738
- var L, q;
3739
- const O = g.includes(".") ? t ? (q = (L = $e == null ? void 0 : $e.rows[t]) == null ? void 0 : L[g]) == null ? void 0 : q.value : void 0 : h[g];
3738
+ var T, q;
3739
+ const O = g.includes(".") ? t ? (q = (T = $e == null ? void 0 : $e.rows[t]) == null ? void 0 : T[g]) == null ? void 0 : q.value : void 0 : h[g];
3740
3740
  return O == null || O === "" ? "0" : String(O);
3741
3741
  });
3742
3742
  return /* @__PURE__ */ l("span", { className: "tabular-nums", "data-tip": `${m} = ${N} = ${x}`, children: x });
3743
3743
  }
3744
3744
  if (e.interface === "match-agg-column") {
3745
- const m = wa.get(e.field);
3745
+ const m = va.get(e.field);
3746
3746
  if (!m || !t) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
3747
3747
  const h = I.find((_) => String(_.id) === t) ?? {}, b = (_, g) => g.split(".").reduce(
3748
- (O, L) => O && typeof O == "object" ? O[L] : void 0,
3748
+ (O, T) => O && typeof O == "object" ? O[T] : void 0,
3749
3749
  _
3750
3750
  ), v = m.rows.filter(
3751
3751
  (_) => m.cfg.rowKeys.every(([g, O]) => {
3752
- const L = b(_, g), q = h[O];
3753
- return L == null || q === null || q === void 0 ? !1 : String(L) === String(q);
3752
+ const T = b(_, g), q = h[O];
3753
+ return T == null || q === null || q === void 0 ? !1 : String(T) === String(q);
3754
3754
  })
3755
3755
  );
3756
3756
  let x = m.cfg.aggregate === "count" ? v.length : v.reduce((_, g) => _ + (Number(g[m.cfg.valueField]) || 0), 0);
@@ -3776,7 +3776,7 @@ function zu({
3776
3776
  return /* @__PURE__ */ l(
3777
3777
  "span",
3778
3778
  {
3779
- className: we(
3779
+ className: ve(
3780
3780
  "inline-flex items-center rounded-full px-2 py-0.5 text-[10.5px] font-medium",
3781
3781
  m ? "bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400" : "bg-slate-100 text-slate-400 dark:bg-slate-800 dark:text-slate-500"
3782
3782
  ),
@@ -3786,7 +3786,7 @@ function zu({
3786
3786
  }
3787
3787
  if (n == null) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
3788
3788
  if (e.interface === "relation-path" && me && t) {
3789
- const m = El(e), h = (c = $e == null ? void 0 : $e.rows[t]) == null ? void 0 : c[e.field], b = $e == null ? void 0 : $e.targets[e.field];
3789
+ const m = ql(e), h = (c = $e == null ? void 0 : $e.rows[t]) == null ? void 0 : c[e.field], b = $e == null ? void 0 : $e.targets[e.field];
3790
3790
  if (m && h && b && h.ids.length > 0)
3791
3791
  return /* @__PURE__ */ l(
3792
3792
  "button",
@@ -3809,9 +3809,9 @@ function zu({
3809
3809
  const o = ze.get(e.field);
3810
3810
  if (o != null && o.one_collection) {
3811
3811
  const m = (d = mn[o.one_collection]) == null ? void 0 : d[String(n)];
3812
- if (!m && Ua)
3812
+ if (!m && Ba)
3813
3813
  return /* @__PURE__ */ l(wn, { className: "h-3 w-3 animate-spin text-slate-300" });
3814
- const h = me ? El(e) : null, b = n != null && ((p = io.get(e.field)) == null ? void 0 : p.has(String(n))) === !0;
3814
+ const h = me ? ql(e) : null, b = n != null && ((p = io.get(e.field)) == null ? void 0 : p.has(String(n))) === !0;
3815
3815
  let v;
3816
3816
  return h && me ? v = /* @__PURE__ */ l(
3817
3817
  "button",
@@ -3829,13 +3829,13 @@ function zu({
3829
3829
  className: "block max-w-full truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-nvr-cyan dark:hover:text-nvr-cyan",
3830
3830
  children: m ?? String(n)
3831
3831
  }
3832
- ) : v = /* @__PURE__ */ l("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ l(Jc, { children: v }) : v;
3832
+ ) : v = /* @__PURE__ */ l("span", { className: "block truncate", children: m ?? String(n) }), b ? /* @__PURE__ */ l(Vc, { children: v }) : v;
3833
3833
  }
3834
3834
  if (e.type === "boolean")
3835
3835
  return /* @__PURE__ */ l("span", { className: n ? "text-emerald-600" : "text-slate-400", children: n ? "Yes" : "No" });
3836
3836
  if (e.type === "datetime" || e.type === "date")
3837
3837
  try {
3838
- return /* @__PURE__ */ l("span", { className: "block truncate", children: Pd(n) });
3838
+ return /* @__PURE__ */ l("span", { className: "block truncate", children: Dd(n) });
3839
3839
  } catch {
3840
3840
  }
3841
3841
  if ([
@@ -3879,26 +3879,28 @@ function zu({
3879
3879
  }
3880
3880
  return /* @__PURE__ */ l("span", { className: "block truncate", children: String(n) });
3881
3881
  }
3882
- const ho = ee(/* @__PURE__ */ new Map()), od = $l(), sd = (Xt && xe === "original" && !j ? 1 : 0) + (ie && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0);
3883
- if (ac(
3884
- od,
3882
+ const ho = ee(/* @__PURE__ */ new Map()), sd = El(), ld = (Xt && we === "original" && !R ? 1 : 0) + (ie && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0);
3883
+ dc(
3884
+ sd,
3885
3885
  zn,
3886
- xe === "original" ? Ri : [],
3887
- `tr[data-o2m-row]:not([data-o2m-editing]) > td:nth-child(n+${sd + 1}):not(:last-child)`
3888
- ), rs || !S && _n)
3886
+ we === "original" ? ji : [],
3887
+ `tr[data-o2m-row]:not([data-o2m-editing]) > td:nth-child(n+${ld + 1}):not(:last-child)`
3888
+ );
3889
+ const gl = ee(null);
3890
+ if (cc(gl, Ri, we === "original"), rs || !S && _n)
3889
3891
  return /* @__PURE__ */ l("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ l(wn, { className: "h-4 w-4 animate-spin inline" }) });
3890
- const yr = (f == null ? void 0 : f.rowId) === "new", at = Xt && xe === "original" && !j, _t = (at ? 1 : 0) + (ie && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0) + Le.length + 1, wr = at ? "select" : ie && (X || D) ? "reorder" : M ? "num" : D ? "status" : "data", vr = (e) => {
3892
+ const yr = (f == null ? void 0 : f.rowId) === "new", at = Xt && we === "original" && !R, _t = (at ? 1 : 0) + (ie && (X || S || D) ? 1 : 0) + (M ? 1 : 0) + (S || D ? 1 : 0) + Te.length + 1, wr = at ? "select" : ie && (X || D) ? "reorder" : M ? "num" : D ? "status" : "data", vr = (e) => {
3891
3893
  if (!vt) return null;
3892
3894
  const n = vt.added.has(e) ? "bg-emerald-500" : vt.changed.has(e) ? "bg-amber-500" : null;
3893
3895
  return n ? /* @__PURE__ */ l(
3894
3896
  "span",
3895
3897
  {
3896
3898
  "aria-hidden": "true",
3897
- className: we("pointer-events-none absolute inset-y-0 left-0 w-0.5", n)
3899
+ className: ve("pointer-events-none absolute inset-y-0 left-0 w-0.5", n)
3898
3900
  }
3899
3901
  ) : null;
3900
- }, kt = Ri.length > 0 && xe === "original", ld = (e, n) => {
3901
- const t = hi(e.options) ?? {}, r = typeof t.column_formula == "string" ? t.column_formula : "";
3902
+ }, kt = ji.length > 0 && we === "original", ad = (e, n) => {
3903
+ const t = pi(e.options) ?? {}, r = typeof t.column_formula == "string" ? t.column_formula : "";
3902
3904
  if (!r) return "";
3903
3905
  const i = n.id != null ? String(n.id) : "", o = (c) => typeof c == "string" && /^-?\d+(\.\d+)?$/.test(c.trim()) ? Number(c) : c, a = ct(
3904
3906
  r,
@@ -3912,54 +3914,54 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
3912
3914
  }, go = (e) => {
3913
3915
  var t;
3914
3916
  const n = [];
3915
- for (const r of Le) {
3917
+ for (const r of Te) {
3916
3918
  if (nt(r)) continue;
3917
3919
  if (r.interface === "formula-column") {
3918
- n.push(ld(r, e));
3920
+ n.push(ad(r, e));
3919
3921
  continue;
3920
3922
  }
3921
3923
  let i = e[r.field];
3922
3924
  r.computed_type === "write" && r.computed_formula && (i = Dt(r.computed_formula, e) ?? i);
3923
3925
  const o = ze.get(r.field), a = o != null && o.one_collection && i != null ? (t = mn[o.one_collection]) == null ? void 0 : t[String(i)] : void 0;
3924
- n.push(...mc(r, i, { m2oLabel: a }));
3926
+ n.push(...gc(r, i, { m2oLabel: a }));
3925
3927
  }
3926
- return pc(n.join(`
3927
- `), Ri);
3928
+ return bc(n.join(`
3929
+ `), ji);
3928
3930
  }, Pn = [];
3929
- let gl = 0;
3930
- !S && xe === "original" && I.forEach((e, n) => {
3931
+ let bl = 0;
3932
+ !S && we === "original" && I.forEach((e, n) => {
3931
3933
  if (!kt) {
3932
3934
  Pn.push({ row: e, ri: n });
3933
3935
  return;
3934
3936
  }
3935
3937
  const t = String(e.id), r = C.has(t) ? { ...e, ...C.get(t) } : e, i = rr.has(t) || go(r);
3936
- i && gl++, (i || (f == null ? void 0 : f.rowId) === t || Ti.current.has(t)) && Pn.push({ row: e, ri: n });
3938
+ i && bl++, (i || (f == null ? void 0 : f.rowId) === t || Li.current.has(t)) && Pn.push({ row: e, ri: n });
3937
3939
  });
3938
- const ci = K.map(
3939
- (e, n) => kt ? dc(e, {
3940
+ const di = K.map(
3941
+ (e, n) => kt ? uc(e, {
3940
3942
  matches: go(e),
3941
3943
  editing: (f == null ? void 0 : f.rowId) === `pending:${n}`
3942
3944
  }) : "show"
3943
- ), ad = kt ? K.filter((e) => go(e)).length : 0, dd = ci.filter((e) => e === "dim").length, bo = Pn.slice(0, ei), ui = ln ? ha ?? Ie.length : Ie.length, bl = xe === "original" && (ln || Ie.length + K.length > cc || tr.trim() !== ""), xr = bl ? /* @__PURE__ */ l(
3944
- uc,
3945
+ ), dd = kt ? K.filter((e) => go(e)).length : 0, cd = di.filter((e) => e === "dim").length, bo = Pn.slice(0, Zr), ci = ln ? ga ?? Ie.length : Ie.length, yl = we === "original" && (ln || Ie.length + K.length > fc || tr.trim() !== ""), xr = yl ? /* @__PURE__ */ l(
3946
+ mc,
3945
3947
  {
3946
3948
  value: tr,
3947
3949
  onChange: as,
3948
- inputRef: Fr,
3950
+ inputRef: Ri,
3949
3951
  searching: kt,
3950
- shown: gl + ad,
3951
- total: ui + K.length,
3952
+ shown: bl + dd,
3953
+ total: ci + K.length,
3952
3954
  loaded: ln ? Ie.length : null,
3953
- loadedOf: ln ? ui : null,
3955
+ loadedOf: ln ? ci : null,
3954
3956
  loading: lt.loading,
3955
3957
  error: lt.error,
3956
3958
  onRetry: lt.retry,
3957
3959
  moreMatches: lt.total != null && lt.rows ? lt.total - lt.rows.length : null,
3958
- keptUnsaved: dd
3960
+ keptUnsaved: cd
3959
3961
  }
3960
3962
  ) : null, _r = () => {
3961
3963
  const e = [];
3962
- if (xe !== "original") return e;
3964
+ if (we !== "original") return e;
3963
3965
  if (!S)
3964
3966
  for (const { row: n, ri: t } of bo) {
3965
3967
  const r = String(n.id);
@@ -3977,9 +3979,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
3977
3979
  }
3978
3980
  }
3979
3981
  return K.forEach((n, t) => {
3980
- ci[t] !== "hide" && e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
3982
+ di[t] !== "hide" && e.push({ key: `pending:${t}`, kind: "pending", row: n, idx: t });
3981
3983
  }), e;
3982
- }, yo = at ? _r().map((e) => e.key) : [], cd = yo.length > 0 && yo.every((e) => Bt.has(e)), kr = at ? _r().filter((e) => Bt.has(e.key)) : [], ud = () => {
3984
+ }, yo = at ? _r().map((e) => e.key) : [], ud = yo.length > 0 && yo.every((e) => Bt.has(e)), kr = at ? _r().filter((e) => Bt.has(e.key)) : [], fd = () => {
3983
3985
  var t;
3984
3986
  const e = Ye.current;
3985
3987
  if (!e) return !1;
@@ -3987,7 +3989,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
3987
3989
  const n = ((t = _r().find((r) => r.key === e.rowId)) == null ? void 0 : t.row) ?? {};
3988
3990
  for (const [r, i] of Object.entries(e.draft)) {
3989
3991
  if (r.startsWith("__")) {
3990
- if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(gi))
3992
+ if ((Array.isArray(i) ? i.length > 0 : i != null && typeof i == "object") && JSON.stringify(i) !== JSON.stringify(hi))
3991
3993
  return !0;
3992
3994
  continue;
3993
3995
  }
@@ -3995,27 +3997,27 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
3995
3997
  return !0;
3996
3998
  }
3997
3999
  return !1;
3998
- }, fd = async (e) => {
4000
+ }, md = async (e) => {
3999
4001
  const n = Ye.current;
4000
4002
  if (!n || n.rowId === "new") return;
4001
4003
  const t = _r(), r = t.findIndex((a) => a.key === n.rowId);
4002
4004
  if (r < 0) return;
4003
4005
  const i = r + e;
4004
4006
  if (i < 0 || i >= t.length) return;
4005
- if (ud()) {
4007
+ if (fd()) {
4006
4008
  if (!await Kt()) return;
4007
4009
  } else
4008
4010
  br();
4009
4011
  const o = t[i];
4010
- o.kind === "pending" ? Xs(o.row, o.idx) : li(o.row), window.setTimeout(() => {
4012
+ o.kind === "pending" ? Xs(o.row, o.idx) : si(o.row), window.setTimeout(() => {
4011
4013
  const a = document.querySelector(
4012
4014
  `[data-o2m-row="${s}:${o.key}"]`
4013
4015
  );
4014
4016
  a && (a.focus({ preventScroll: !0 }), a.scrollIntoView({ block: "nearest" }));
4015
4017
  }, 0);
4016
4018
  };
4017
- Ko.current = fd;
4018
- async function md(e) {
4019
+ Ko.current = md;
4020
+ async function pd(e) {
4019
4021
  const n = ho.current;
4020
4022
  await wo(
4021
4023
  e,
@@ -4023,15 +4025,15 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4023
4025
  { clearSelection: !0, noun: "row", baseOf: (t) => n.get(t) }
4024
4026
  ), ho.current = /* @__PURE__ */ new Map();
4025
4027
  }
4026
- function pd() {
4027
- ho.current = S || j ? /* @__PURE__ */ new Map() : wc(
4028
+ function hd() {
4029
+ ho.current = S || R ? /* @__PURE__ */ new Map() : _c(
4028
4030
  ot,
4029
4031
  [...Bt].filter((e) => !e.startsWith("pending:"))
4030
4032
  ), Do(!0);
4031
4033
  }
4032
- const yl = () => {
4034
+ const wl = () => {
4033
4035
  const e = [];
4034
- return xe !== "original" || (S || I.forEach((n, t) => {
4036
+ return we !== "original" || (S || I.forEach((n, t) => {
4035
4037
  const r = String(n.id);
4036
4038
  Qe.has(r) || rr.has(r) || e.push({
4037
4039
  key: r,
@@ -4056,7 +4058,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4056
4058
  if (W != null && W.length) {
4057
4059
  try {
4058
4060
  const g = await $.request(
4059
- Te("/field-rules/evaluate", {
4061
+ Le("/field-rules/evaluate", {
4060
4062
  collection: s,
4061
4063
  data: b.row,
4062
4064
  locks_only: !0,
@@ -4071,13 +4073,13 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4071
4073
  }
4072
4074
  for (const g of r) {
4073
4075
  if (x.includes(g)) continue;
4074
- const O = ao(g, { ...b.row }, N), L = { ...v };
4075
- for (const q of O) L[q] = null;
4076
+ const O = ao(g, { ...b.row }, N), T = { ...v };
4077
+ for (const q of O) T[q] = null;
4076
4078
  try {
4077
4079
  const q = await $.request(
4078
- Te("/field-rules/evaluate", {
4080
+ Le("/field-rules/evaluate", {
4079
4081
  collection: s,
4080
- data: L,
4082
+ data: T,
4081
4083
  changed_field: g,
4082
4084
  probe: !0,
4083
4085
  parent_context: zt(),
@@ -4100,7 +4102,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4100
4102
  a.push({ t: b, changes: _ });
4101
4103
  }
4102
4104
  const c = (b, v) => {
4103
- t.clearSelection && Lr(/* @__PURE__ */ new Set());
4105
+ t.clearSelection && Tr(/* @__PURE__ */ new Set());
4104
4106
  const x = b === 1 ? t.noun : `${t.noun}s`;
4105
4107
  v.length ? be.error(
4106
4108
  `Applied to ${b} ${x} — ${v.length} failed: ${v.slice(0, 3).join("; ")}`
@@ -4148,9 +4150,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4148
4150
  (x = t.baseOf) == null ? void 0 : x.call(t, _.key)
4149
4151
  ) && d++;
4150
4152
  } catch (O) {
4151
- const L = v ? null : No(O);
4152
- if (L) {
4153
- Xn({ challenge: L, retry: (q) => m(N, q) }), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
4153
+ const T = v ? null : No(O);
4154
+ if (T) {
4155
+ Xn({ challenge: T, retry: (q) => m(N, q) }), V.invalidateQueries({ queryKey: ["o2m-rows", s, u, y] });
4154
4156
  return;
4155
4157
  }
4156
4158
  p.push(`#${_.key} ${Un(O, "failed")}`);
@@ -4161,21 +4163,21 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4161
4163
  };
4162
4164
  await m(0);
4163
4165
  }
4164
- if (ki.current = (e, n) => wo({ [e]: n }, yl(), {
4166
+ if (_i.current = (e, n) => wo({ [e]: n }, wl(), {
4165
4167
  clearSelection: !1,
4166
4168
  noun: "line"
4167
- }), Po.current = !0, Rr.current) {
4168
- const e = Rr.current;
4169
- Rr.current = null, window.setTimeout(() => void ki.current(e.target, e.value), 0);
4169
+ }), Po.current = !0, jr.current) {
4170
+ const e = jr.current;
4171
+ jr.current = null, window.setTimeout(() => void _i.current(e.target, e.value), 0);
4170
4172
  }
4171
- const dt = qe ? "split" : Le.filter((e) => !nt(e)).length >= 6 ? "panel" : "inline", fi = (e) => {
4173
+ const dt = qe ? "split" : Te.filter((e) => !nt(e)).length >= 6 ? "panel" : "inline", ui = (e) => {
4172
4174
  const n = Ci == null ? void 0 : Ci.display_template;
4173
4175
  if (n) {
4174
4176
  const t = Er(n, e).trim();
4175
4177
  if (t && t !== "-" && t !== String(e.id ?? ""))
4176
4178
  return t.length > 60 ? `${t.slice(0, 60)}…` : t;
4177
4179
  }
4178
- for (const t of Le) {
4180
+ for (const t of Te) {
4179
4181
  if (nt(t)) continue;
4180
4182
  const r = e[t.field];
4181
4183
  if (typeof r == "string" && r.trim() !== "" && !/^-?\d+(\.\d+)?$/.test(r.trim()))
@@ -4184,7 +4186,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4184
4186
  return e.id != null ? `#${e.id}` : "New line";
4185
4187
  }, Nr = (e, n) => {
4186
4188
  const t = (n == null ? void 0 : n.rowKey) ?? "__new__", r = { ...e };
4187
- for (const i of Le) {
4189
+ for (const i of Te) {
4188
4190
  if (i.computed_type !== "rollup" || !i.computed_formula) continue;
4189
4191
  let o = null;
4190
4192
  try {
@@ -4206,14 +4208,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4206
4208
  }
4207
4209
  a != null && (r[i.field] = a);
4208
4210
  }
4209
- for (const i of Le)
4211
+ for (const i of Te)
4210
4212
  if (i.computed_type === "write" && i.computed_formula) {
4211
4213
  const o = Dt(i.computed_formula, r);
4212
4214
  o != null && (r[i.field] = o);
4213
4215
  }
4214
4216
  return r;
4215
- }, mi = (e, n) => !ne || ne.length === 0 ? null : /* @__PURE__ */ l("div", { className: "mt-3 space-y-2 border-t border-slate-100 pt-3 dark:border-border", children: ne.map((t) => {
4216
- const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, a = o ? vi(o, n, y, E == null ? void 0 : E.draft) : null;
4217
+ }, fi = (e, n) => !ne || ne.length === 0 ? null : /* @__PURE__ */ l("div", { className: "mt-3 space-y-2 border-t border-slate-100 pt-3 dark:border-border", children: ne.map((t) => {
4218
+ const r = typeof t == "string" ? t : t.field, i = typeof t == "string" ? void 0 : t.hint, o = typeof t == "string" ? void 0 : t.match, a = o ? wi(o, n, y, E == null ? void 0 : E.draft) : null;
4217
4219
  return /* @__PURE__ */ l(
4218
4220
  Io,
4219
4221
  {
@@ -4235,12 +4237,12 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4235
4237
  // rows with the line's queued edit, like the FK mode.
4236
4238
  ...e && D ? {
4237
4239
  deferred: !0,
4238
- stagedOps: n[`__nested_ops_${r}`] ?? gi,
4240
+ stagedOps: n[`__nested_ops_${r}`] ?? hi,
4239
4241
  onStagedOpsChange: (c) => xt(`__nested_ops_${r}`, c)
4240
4242
  } : {}
4241
4243
  } : e ? D ? {
4242
4244
  deferred: !0,
4243
- stagedOps: n[`__nested_ops_${r}`] ?? gi,
4245
+ stagedOps: n[`__nested_ops_${r}`] ?? hi,
4244
4246
  onStagedOpsChange: (c) => xt(`__nested_ops_${r}`, c)
4245
4247
  } : {} : {
4246
4248
  // UNSAVED row: members stage under __o2m_<field> in the
@@ -4255,7 +4257,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4255
4257
  },
4256
4258
  r
4257
4259
  );
4258
- }) }), Sr = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || Gr(e) || nt(e), wl = (e) => {
4260
+ }) }), Sr = (e) => e.computed_type === "write" && !!e.computed_formula || e.interface === "formula-column" || e.interface === "match-agg-column" || e.interface === "relation-path" || !!e.readonly || Cr(e) || nt(e), vl = (e) => {
4259
4261
  var n;
4260
4262
  return /* @__PURE__ */ k(
4261
4263
  "div",
@@ -4299,7 +4301,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4299
4301
  (() => {
4300
4302
  const t = [
4301
4303
  ...Ne.filter(Sr),
4302
- ...Le.filter((r) => nt(r))
4304
+ ...Te.filter((r) => nt(r))
4303
4305
  ];
4304
4306
  return t.length > 0 && (() => {
4305
4307
  const r = Nr(e.draft, { rowKey: e.rowId ?? "__new__" });
@@ -4333,7 +4335,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4333
4335
  {
4334
4336
  className: "grid items-start gap-x-4 gap-y-3",
4335
4337
  style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
4336
- children: Le.filter((t) => !Sr(t)).map((t) => {
4338
+ children: Te.filter((t) => !Sr(t)).map((t) => {
4337
4339
  var b, v, x, N, _, g;
4338
4340
  const r = t.computed_type === "write" && !!t.computed_formula, i = t.label || _e(t.field), o = t.interface === "formula-column" || t.interface === "match-agg-column" || t.interface === "relation-path";
4339
4341
  if (nt(t))
@@ -4351,9 +4353,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4351
4353
  "div",
4352
4354
  {
4353
4355
  id: Cn(t.field, "cell"),
4354
- ref: (O) => tc(O, p, h),
4356
+ ref: (O) => nc(O, p, h),
4355
4357
  "data-grid-cell": Ho(e.rowId, t.field),
4356
- className: we(
4358
+ className: ve(
4357
4359
  "flex min-w-0 flex-col gap-1",
4358
4360
  c && "rounded-md [&_input]:border-red-400 [&_input]:ring-1 [&_input]:ring-red-300 [&_button]:border-red-400 [&_button]:ring-1 [&_button]:ring-red-300 dark:[&_input]:border-red-600 dark:[&_input]:ring-red-800 dark:[&_button]:border-red-600 dark:[&_button]:ring-red-800"
4359
4361
  ),
@@ -4361,7 +4363,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4361
4363
  /* @__PURE__ */ k(
4362
4364
  "span",
4363
4365
  {
4364
- className: we(
4366
+ className: ve(
4365
4367
  "flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide",
4366
4368
  c ? "text-red-600 dark:text-red-400" : "text-slate-400"
4367
4369
  ),
@@ -4370,24 +4372,24 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4370
4372
  a && /* @__PURE__ */ l("span", { className: "ml-1 normal-case tracking-normal", children: "· required" }),
4371
4373
  (() => {
4372
4374
  var re, H;
4373
- const O = Ja(t.field);
4375
+ const O = Qa(t.field);
4374
4376
  if (!O) return null;
4375
- const L = ze.get(t.field), q = (ce) => {
4377
+ const T = ze.get(t.field), q = (ce) => {
4376
4378
  var pe;
4377
- return (L != null && L.one_collection ? (pe = mn[L.one_collection]) == null ? void 0 : pe[String(ce)] : void 0) ?? String(ce);
4379
+ return (T != null && T.one_collection ? (pe = mn[T.one_collection]) == null ? void 0 : pe[String(ce)] : void 0) ?? String(ce);
4378
4380
  }, z = (ce) => {
4379
4381
  var pe;
4380
4382
  return ((pe = Ne.find((G) => G.field === ce)) == null ? void 0 : pe.label) ?? ce.replace(/_/g, " ");
4381
4383
  };
4382
4384
  return /* @__PURE__ */ l(
4383
- Pc,
4385
+ Uc,
4384
4386
  {
4385
4387
  kind: O,
4386
4388
  provenance: (re = f == null ? void 0 : f.provenance) == null ? void 0 : re[t.field],
4387
4389
  labelOf: q,
4388
4390
  fieldLabel: z,
4389
- relatedCollection: (L == null ? void 0 : L.one_collection) ?? null,
4390
- onReset: O === "overridden" && !j && !((H = f == null ? void 0 : f.locks) != null && H.includes(t.field)) ? () => Qa(t.field) : void 0
4391
+ relatedCollection: (T == null ? void 0 : T.one_collection) ?? null,
4392
+ onReset: O === "overridden" && !R && !((H = f == null ? void 0 : f.locks) != null && H.includes(t.field)) ? () => za(t.field) : void 0
4391
4393
  }
4392
4394
  );
4393
4395
  })()
@@ -4397,12 +4399,12 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4397
4399
  r ? /* @__PURE__ */ l("div", { className: "text-[12px] italic text-slate-500", children: We(
4398
4400
  t,
4399
4401
  Dt(t.computed_formula, e.draft) ?? e.draft[t.field]
4400
- ) }) : o || t.readonly || Gr(t) || (_ = f == null ? void 0 : f.locks) != null && _.includes(t.field) || Vi(t.field, e.draft) ? /* @__PURE__ */ l(
4402
+ ) }) : o || t.readonly || Cr(t) || (_ = f == null ? void 0 : f.locks) != null && _.includes(t.field) || Vi(t.field, e.draft) ? /* @__PURE__ */ l(
4401
4403
  "div",
4402
4404
  {
4403
4405
  className: "text-[12px] text-slate-500",
4404
4406
  "data-compare-locked": Vi(t.field, e.draft) ? t.field : void 0,
4405
- "data-tip": (g = f == null ? void 0 : f.locks) != null && g.includes(t.field) ? Zs(t.field) : Vi(t.field, e.draft) ? (R == null ? void 0 : R.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
4407
+ "data-tip": (g = f == null ? void 0 : f.locks) != null && g.includes(t.field) ? Zs(t.field) : Vi(t.field, e.draft) ? (j == null ? void 0 : j.closed_locked_message) || "This month is closed — only reconciling it to the actual is allowed" : void 0,
4406
4408
  children: We(t, e.draft[t.field], e.rowId)
4407
4409
  }
4408
4410
  ) : f != null && f.locksPending && Hn.has(t.field) ? (
@@ -4431,10 +4433,10 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4431
4433
  pinnedOption: qn(t.field, e.draft)
4432
4434
  }
4433
4435
  ),
4434
- R && R.columns.includes(t.field) && (() => {
4435
- const O = Eo(R, e.draft), L = O == null ? void 0 : O.values[t.field], q = Ct(
4436
- R,
4437
- e.draft[R.key_field],
4436
+ j && j.columns.includes(t.field) && (() => {
4437
+ const O = Eo(j, e.draft), T = O == null ? void 0 : O.values[t.field], q = Ct(
4438
+ j,
4439
+ e.draft[j.key_field],
4438
4440
  t.field
4439
4441
  );
4440
4442
  return /* @__PURE__ */ k(
@@ -4443,28 +4445,28 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4443
4445
  "data-compare-editor-hint": t.field,
4444
4446
  className: "mt-1 flex items-center gap-1 text-[11px] text-slate-500 dark:text-muted-foreground",
4445
4447
  children: [
4446
- /* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children: R.label }),
4447
- /* @__PURE__ */ l("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: L == null ? "—" : So(L) }),
4448
+ /* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-400", children: j.label }),
4449
+ /* @__PURE__ */ l("span", { className: "tabular-nums font-medium text-slate-700 dark:text-slate-200", children: T == null ? "—" : So(T) }),
4448
4450
  q && /* @__PURE__ */ k(
4449
4451
  "span",
4450
4452
  {
4451
4453
  className: "inline-flex items-center gap-0.5 text-[10px] uppercase tracking-wide text-slate-400",
4452
- "data-tip": R.closed_locked && $n ? `${R.closed_rule ?? ""} A change here needs a reason.`.trim() : R.closed_rule,
4454
+ "data-tip": j.closed_locked && $n ? `${j.closed_rule ?? ""} A change here needs a reason.`.trim() : j.closed_rule,
4453
4455
  children: [
4454
- /* @__PURE__ */ l(kd, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
4456
+ /* @__PURE__ */ l(Nd, { className: "h-2.5 w-2.5", "aria-hidden": "true" }),
4455
4457
  " closed"
4456
4458
  ]
4457
4459
  }
4458
4460
  ),
4459
- q && !j && /* @__PURE__ */ l(
4460
- Zd,
4461
+ q && !R && /* @__PURE__ */ l(
4462
+ ec,
4461
4463
  {
4462
- data: R,
4463
- rowKey: e.draft[R.key_field],
4464
+ data: j,
4465
+ rowKey: e.draft[j.key_field],
4464
4466
  column: t.field,
4465
4467
  columnLabel: dr(t),
4466
4468
  plannedRow: e.draft,
4467
- actual: L ?? 0,
4469
+ actual: T ?? 0,
4468
4470
  variant: "button",
4469
4471
  onApply: (z, re) => uo({ ...z, _change_reason: re })
4470
4472
  }
@@ -4490,23 +4492,23 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4490
4492
  })
4491
4493
  }
4492
4494
  ),
4493
- ke && ((n = ke.fields) == null ? void 0 : n.length) > 0 && !j && /* @__PURE__ */ l(
4494
- Xc,
4495
+ ke && ((n = ke.fields) == null ? void 0 : n.length) > 0 && !R && /* @__PURE__ */ l(
4496
+ tu,
4495
4497
  {
4496
4498
  config: ke,
4497
4499
  draft: e.draft,
4498
4500
  remaining: ct(ke.remaining, dn),
4499
4501
  onApply: uo,
4500
- closedFields: R ? new Set(
4502
+ closedFields: j ? new Set(
4501
4503
  ke.fields.filter(
4502
- (t) => Ct(R, e.draft[R.key_field], t)
4504
+ (t) => Ct(j, e.draft[j.key_field], t)
4503
4505
  )
4504
4506
  ) : void 0,
4505
4507
  shapeSource: (() => {
4506
- if (!R) return null;
4507
- const t = Number(e.draft[R.key_field]);
4508
+ if (!j) return null;
4509
+ const t = Number(e.draft[j.key_field]);
4508
4510
  if (!Number.isFinite(t)) return null;
4509
- const r = I.find((a) => Number(a[R.key_field]) === t - 1);
4511
+ const r = I.find((a) => Number(a[j.key_field]) === t - 1);
4510
4512
  if (!r) return null;
4511
4513
  const i = {};
4512
4514
  let o = !1;
@@ -4518,23 +4520,23 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4518
4520
  })()
4519
4521
  }
4520
4522
  ),
4521
- le && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(Mc, { config: le, result: Qt.byRow.get(e.rowId) }),
4523
+ le && e.rowId && !e.rowId.startsWith("pending:") && e.rowId !== "new" && /* @__PURE__ */ l(Dc, { config: le, result: Qt.byRow.get(e.rowId) }),
4522
4524
  e.drawer
4523
4525
  ]
4524
4526
  }
4525
4527
  );
4526
- }, vo = (e) => /* @__PURE__ */ l("td", { colSpan: _t, className: "p-0", children: wl(e) }), vl = (e, n) => {
4528
+ }, vo = (e) => /* @__PURE__ */ l("td", { colSpan: _t, className: "p-0", children: vl(e) }), xl = (e, n) => {
4527
4529
  const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
4528
4530
  Zi.current.add(zs(e.rowKey, e.editor)), fn(null);
4529
4531
  const i = I.find((o) => String(o.id) === e.rowKey);
4530
- i && li(C.has(e.rowKey) ? { ...i, ...C.get(e.rowKey) } : i);
4532
+ i && si(C.has(e.rowKey) ? { ...i, ...C.get(e.rowKey) } : i);
4531
4533
  };
4532
4534
  return /* @__PURE__ */ k(
4533
4535
  "div",
4534
4536
  {
4535
4537
  "data-row-soft-lock": "",
4536
4538
  role: "status",
4537
- className: we(
4539
+ className: ve(
4538
4540
  "flex flex-wrap items-center gap-2 border-amber-300 bg-amber-50 px-3 py-1.5 text-[11.5px] text-amber-900 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-100",
4539
4541
  n === "docked" ? "rounded-lg border" : "border-b"
4540
4542
  ),
@@ -4565,15 +4567,15 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4565
4567
  ]
4566
4568
  }
4567
4569
  );
4568
- }, xl = Ei === qr, hd = xl ? null : (Rt == null ? void 0 : Rt.name) ?? ((_l = oe == null ? void 0 : oe[0]) == null ? void 0 : _l.name), xo = oe && oe.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
4570
+ }, _l = $i === qr, gd = _l ? null : (jt == null ? void 0 : jt.name) ?? ((kl = oe == null ? void 0 : oe[0]) == null ? void 0 : kl.name), xo = oe && oe.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
4569
4571
  /* @__PURE__ */ l(
4570
4572
  "button",
4571
4573
  {
4572
4574
  type: "button",
4573
4575
  onClick: () => ns(qr),
4574
- className: we(
4576
+ className: ve(
4575
4577
  "h-6 px-2.5 rounded border transition-colors",
4576
- xl ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4578
+ _l ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4577
4579
  ),
4578
4580
  children: "All"
4579
4581
  }
@@ -4583,9 +4585,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4583
4585
  {
4584
4586
  type: "button",
4585
4587
  onClick: () => ns(e.name),
4586
- className: we(
4588
+ className: ve(
4587
4589
  "h-6 px-2.5 rounded border transition-colors",
4588
- hd === e.name ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4590
+ gd === e.name ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4589
4591
  ),
4590
4592
  children: e.name
4591
4593
  },
@@ -4596,25 +4598,18 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4596
4598
  // Advertises which child collection this grid holds, so the summary can
4597
4599
  // jump to it by collection rather than by field name (the two differ for
4598
4600
  // relations that never got an alias field on the layout).
4599
- // biome-ignore lint/a11y/noStaticElementInteractions: the "/" shortcut listens for keys bubbling up from the grid's own controls
4600
4601
  /* @__PURE__ */ k(
4601
4602
  "div",
4602
4603
  {
4604
+ ref: gl,
4603
4605
  className: "space-y-1.5",
4604
4606
  "data-o2m-collection": s,
4605
- onFocusCapture: la,
4606
- onBlurCapture: aa,
4607
- onKeyDown: (e) => {
4608
- var t, r;
4609
- if (e.key !== "/" || e.defaultPrevented || e.metaKey || e.ctrlKey || e.altKey || !bl) return;
4610
- const n = e.target;
4611
- n != null && n.closest(
4612
- 'input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="combobox"], [role="textbox"]'
4613
- ) || (e.preventDefault(), (t = Fr.current) == null || t.focus(), (r = Fr.current) == null || r.select());
4614
- },
4607
+ ...yl ? { [hc]: "" } : {},
4608
+ onFocusCapture: aa,
4609
+ onBlurCapture: da,
4615
4610
  children: [
4616
4611
  /* @__PURE__ */ l(
4617
- $d,
4612
+ Ed,
4618
4613
  {
4619
4614
  challenge: (Wr == null ? void 0 : Wr.challenge) ?? null,
4620
4615
  onCancel: () => Xn(null),
@@ -4625,7 +4620,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4625
4620
  }
4626
4621
  ),
4627
4622
  Br && Br.length > 0 && /* @__PURE__ */ l(
4628
- Ec,
4623
+ Oc,
4629
4624
  {
4630
4625
  lines: Br.map((e) => ({
4631
4626
  ...e,
@@ -4648,14 +4643,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4648
4643
  return ((n = ae.find((t) => t.field === e)) == null ? void 0 : n.label) || _e(e);
4649
4644
  },
4650
4645
  onCancel: () => {
4651
- Oi(null), V.invalidateQueries({
4646
+ Ii(null), V.invalidateQueries({
4652
4647
  queryKey: ["o2m-rows", s, u, y]
4653
4648
  });
4654
4649
  },
4655
4650
  onResolve: (e) => void La(e)
4656
4651
  }
4657
4652
  ),
4658
- !j && /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
4653
+ !R && /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
4659
4654
  /* @__PURE__ */ l("span", { className: "text-slate-400", children: "Add" }),
4660
4655
  /* @__PURE__ */ l(
4661
4656
  "input",
@@ -4664,7 +4659,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4664
4659
  min: 1,
4665
4660
  max: 100,
4666
4661
  value: pn,
4667
- onChange: (e) => Ga(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
4662
+ onChange: (e) => Ya(Math.max(1, Math.min(100, parseInt(e.target.value, 10) || 1))),
4668
4663
  className: "w-14 h-6 rounded border border-slate-200 px-2 text-[11px] text-slate-700 text-center focus:outline-none focus:ring-1 focus:ring-nvr-cyan"
4669
4664
  }
4670
4665
  ),
@@ -4690,7 +4685,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4690
4685
  {
4691
4686
  type: "button",
4692
4687
  disabled: hn,
4693
- onClick: () => nd(e[0].field),
4688
+ onClick: () => rd(e[0].field),
4694
4689
  "data-tip": `Generate ${pn} rows with ${e[0].field} advancing one month per row (starting next month)`,
4695
4690
  className: "h-6 px-2.5 rounded border border-dashed border-slate-300 text-slate-500 hover:border-nvr-cyan/60 hover:text-slate-700 disabled:opacity-40 transition-colors",
4696
4691
  children: [
@@ -4701,7 +4696,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4701
4696
  );
4702
4697
  })(),
4703
4698
  Me && (!S || w) && /* @__PURE__ */ l(
4704
- Hc,
4699
+ Yc,
4705
4700
  {
4706
4701
  config: Me,
4707
4702
  relatedCollection: s,
@@ -4714,7 +4709,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4714
4709
  queryKey: ["o2m-rows", s, u, y]
4715
4710
  }),
4716
4711
  onLocalWrite: (e) => {
4717
- e ? wt(e) : Tt.current = Date.now();
4712
+ e ? wt(e) : Lt.current = Date.now();
4718
4713
  },
4719
4714
  staging: w,
4720
4715
  stagingActive: (S || D) && !!w,
@@ -4725,12 +4720,12 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4725
4720
  stagedBase: kn
4726
4721
  }
4727
4722
  ),
4728
- Oe && !S && !j && (() => {
4723
+ Oe && !S && !R && (() => {
4729
4724
  const e = (ne ?? []).find(
4730
4725
  (n) => typeof n == "object" && n.field === Oe.relation && !!n.match
4731
4726
  );
4732
4727
  return e != null && e.match ? /* @__PURE__ */ l(
4733
- Gc,
4728
+ Zc,
4734
4729
  {
4735
4730
  config: Oe,
4736
4731
  matchCfg: e.match,
@@ -4743,7 +4738,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4743
4738
  ) : null;
4744
4739
  })(),
4745
4740
  (et ?? []).map((e) => /* @__PURE__ */ l(
4746
- Cc,
4741
+ Xc,
4747
4742
  {
4748
4743
  config: e,
4749
4744
  rows: [...I, ...K.map((n, t) => ({ ...n, __pendingIndex: t }))],
@@ -4770,8 +4765,8 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4770
4765
  },
4771
4766
  e.label
4772
4767
  )),
4773
- It && !S && !j && it && A && /* @__PURE__ */ l(
4774
- Wd,
4768
+ It && !S && !R && it && A && /* @__PURE__ */ l(
4769
+ Ud,
4775
4770
  {
4776
4771
  collection: A,
4777
4772
  templateFilter: (e) => {
@@ -4786,7 +4781,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4786
4781
  compact: !0
4787
4782
  }
4788
4783
  ),
4789
- A && w && !j && /* @__PURE__ */ k("span", { className: "relative inline-flex", children: [
4784
+ A && w && !R && /* @__PURE__ */ k("span", { className: "relative inline-flex", children: [
4790
4785
  /* @__PURE__ */ l(
4791
4786
  "button",
4792
4787
  {
@@ -4797,13 +4792,13 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4797
4792
  children: "Copy from…"
4798
4793
  }
4799
4794
  ),
4800
- Gl && /* @__PURE__ */ l("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ l(
4795
+ Yl && /* @__PURE__ */ l("span", { className: "absolute left-0 top-full z-[70] mt-1 w-[300px] rounded-lg border border-slate-200 bg-white p-2 shadow-xl dark:border-border dark:bg-card", children: /* @__PURE__ */ l(
4801
4796
  Oo,
4802
4797
  {
4803
4798
  collection: A,
4804
4799
  value: null,
4805
4800
  onChange: (e) => {
4806
- e != null && Zl(String(e));
4801
+ e != null && ea(String(e));
4807
4802
  },
4808
4803
  placeholder: "Pick the record to copy from…"
4809
4804
  }
@@ -4813,8 +4808,8 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4813
4808
  "button",
4814
4809
  {
4815
4810
  type: "button",
4816
- onClick: () => Ya((e) => !e),
4817
- className: we(
4811
+ onClick: () => Xa((e) => !e),
4812
+ className: ve(
4818
4813
  "h-6 px-2.5 rounded border transition-colors",
4819
4814
  ol ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4820
4815
  ),
@@ -4826,20 +4821,20 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4826
4821
  {
4827
4822
  type: "button",
4828
4823
  onClick: () => ll((e) => !e),
4829
- className: we(
4824
+ className: ve(
4830
4825
  "h-6 px-2.5 rounded border transition-colors",
4831
4826
  sl ? "border-amber-400 bg-amber-50 text-amber-700 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4832
4827
  ),
4833
4828
  children: "apply values…"
4834
4829
  }
4835
4830
  ),
4836
- ke && ((kl = ke.fields) == null ? void 0 : kl.length) > 0 && ke.across_rows !== !1 && I.length + K.length > 1 && /* @__PURE__ */ l(
4837
- Zc,
4831
+ ke && ((Nl = ke.fields) == null ? void 0 : Nl.length) > 0 && ke.across_rows !== !1 && I.length + K.length > 1 && /* @__PURE__ */ l(
4832
+ nu,
4838
4833
  {
4839
4834
  config: ke,
4840
4835
  remaining: ct(ke.remaining, dn),
4841
- rowNoun: R ? _e(R.key_field).toLowerCase() : "row",
4842
- onApply: Ea
4836
+ rowNoun: j ? _e(j.key_field).toLowerCase() : "row",
4837
+ onApply: qa
4843
4838
  }
4844
4839
  ),
4845
4840
  !!(W != null && W.length) && I.length + K.length > 0 && /* @__PURE__ */ l(
@@ -4847,9 +4842,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4847
4842
  {
4848
4843
  type: "button",
4849
4844
  onClick: () => {
4850
- ai((e) => !e), Mn(null);
4845
+ li((e) => !e), Mn(null);
4851
4846
  },
4852
- className: we(
4847
+ className: ve(
4853
4848
  "h-6 px-2.5 rounded border transition-colors",
4854
4849
  al ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
4855
4850
  ),
@@ -4857,10 +4852,10 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4857
4852
  children: "re-run rules…"
4858
4853
  }
4859
4854
  ),
4860
- !j && xe === "original" && I.length + K.length > 0 && Dc(Bn).filter((e) => !e.admin_only || $n).map((e) => {
4861
- const n = kr.length > 0 ? kr : yl(), t = ae.find((a) => a.field === e.field), r = e.label ?? (t ? dr(t) : _e(e.field)), i = new Set(n.map((a) => String(a.row[e.field] ?? ""))), o = i.size === 1 && [...i][0] || null;
4855
+ !R && we === "original" && I.length + K.length > 0 && Bc(Bn).filter((e) => !e.admin_only || $n).map((e) => {
4856
+ const n = kr.length > 0 ? kr : wl(), t = ae.find((a) => a.field === e.field), r = e.label ?? (t ? dr(t) : _e(e.field)), i = new Set(n.map((a) => String(a.row[e.field] ?? ""))), o = i.size === 1 && [...i][0] || null;
4862
4857
  return /* @__PURE__ */ l(
4863
- Wc,
4858
+ Jc,
4864
4859
  {
4865
4860
  label: r,
4866
4861
  count: n.length,
@@ -4874,7 +4869,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4874
4869
  `set-all:${e.field}`
4875
4870
  );
4876
4871
  }),
4877
- xe === "original" && I.length + K.length > 0 && /* @__PURE__ */ k(
4872
+ we === "original" && I.length + K.length > 0 && /* @__PURE__ */ k(
4878
4873
  "button",
4879
4874
  {
4880
4875
  type: "button",
@@ -4882,14 +4877,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4882
4877
  "aria-pressed": Xt,
4883
4878
  "data-tip": Xt ? "Hide the selection checkboxes" : "Tick rows to edit several lines at once",
4884
4879
  onClick: () => {
4885
- Hl((e) => !e), Lr(/* @__PURE__ */ new Set());
4880
+ Cl((e) => !e), Tr(/* @__PURE__ */ new Set());
4886
4881
  },
4887
- className: we(
4882
+ className: ve(
4888
4883
  "inline-flex h-6 items-center gap-1 rounded border px-2 transition-colors",
4889
4884
  Xt ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
4890
4885
  ),
4891
4886
  children: [
4892
- /* @__PURE__ */ l(gd, { className: "h-3 w-3", "aria-hidden": "true" }),
4887
+ /* @__PURE__ */ l(bd, { className: "h-3 w-3", "aria-hidden": "true" }),
4893
4888
  Xt ? "Selecting" : "Select rows"
4894
4889
  ]
4895
4890
  }
@@ -4898,11 +4893,11 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4898
4893
  "button",
4899
4894
  {
4900
4895
  type: "button",
4901
- onClick: pd,
4896
+ onClick: hd,
4902
4897
  "data-tip": "Set the same values on every selected line",
4903
4898
  className: "inline-flex h-6 items-center gap-1 rounded border border-amber-400 bg-amber-50 px-2 font-medium text-amber-700 transition-colors hover:border-amber-500 dark:border-amber-600 dark:bg-amber-950/30 dark:text-amber-300",
4904
4899
  children: [
4905
- /* @__PURE__ */ l(bd, { className: "h-3 w-3", "aria-hidden": "true" }),
4900
+ /* @__PURE__ */ l(yd, { className: "h-3 w-3", "aria-hidden": "true" }),
4906
4901
  "Edit ",
4907
4902
  Bt.size,
4908
4903
  " selected…"
@@ -4917,11 +4912,11 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4917
4912
  "aria-pressed": qe,
4918
4913
  "data-tip": qe ? "Edit each line where it sits in the table" : "Edit lines in a panel docked under the table — ↑/↓ walk the rows",
4919
4914
  onClick: () => Qn(qe ? "drawer" : "split"),
4920
- className: we(
4915
+ className: ve(
4921
4916
  "inline-flex h-6 w-6 items-center justify-center rounded border transition-colors",
4922
4917
  qe ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-500 hover:border-slate-400 hover:text-slate-800 dark:border-border dark:text-slate-300"
4923
4918
  ),
4924
- children: qe ? /* @__PURE__ */ l(yd, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ l(wd, { className: "h-3 w-3", "aria-hidden": "true" })
4919
+ children: qe ? /* @__PURE__ */ l(wd, { className: "h-3 w-3", "aria-hidden": "true" }) : /* @__PURE__ */ l(vd, { className: "h-3 w-3", "aria-hidden": "true" })
4925
4920
  }
4926
4921
  ),
4927
4922
  hn && /* @__PURE__ */ l(wn, { className: "h-3 w-3 animate-spin text-slate-400" }),
@@ -4934,7 +4929,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4934
4929
  "data-grid-save-mode": "live",
4935
4930
  "data-tip": "Every change to a line here is saved the moment you make it — no Save needed",
4936
4931
  children: [
4937
- /* @__PURE__ */ l(vd, { className: "h-3 w-3", "aria-hidden": "true" }),
4932
+ /* @__PURE__ */ l(xd, { className: "h-3 w-3", "aria-hidden": "true" }),
4938
4933
  "Saves as you go"
4939
4934
  ]
4940
4935
  }
@@ -4943,7 +4938,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4943
4938
  return /* @__PURE__ */ k(
4944
4939
  "span",
4945
4940
  {
4946
- className: we(
4941
+ className: ve(
4947
4942
  "inline-flex h-6 shrink-0 items-center gap-1 whitespace-nowrap rounded px-1.5 text-[10.5px]",
4948
4943
  n > 0 ? "bg-[#fffbeb] font-medium text-[#92400e] dark:bg-[#3a2e14] dark:text-[#f5d58a]" : "text-slate-400 dark:text-slate-500"
4949
4944
  ),
@@ -4965,11 +4960,11 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4965
4960
  type: "button",
4966
4961
  "data-tip": "Lines timeline — every line added, changed or removed on this record",
4967
4962
  onClick: () => Mr(!0),
4968
- className: we(
4963
+ className: ve(
4969
4964
  "rounded p-1 text-slate-300 hover:text-nvr-cyan",
4970
4965
  !xr && "ml-auto"
4971
4966
  ),
4972
- children: /* @__PURE__ */ l(pi, { className: "h-3.5 w-3.5" })
4967
+ children: /* @__PURE__ */ l(mi, { className: "h-3.5 w-3.5" })
4973
4968
  }
4974
4969
  )
4975
4970
  ] }),
@@ -4999,7 +4994,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
4999
4994
  {
5000
4995
  type: "button",
5001
4996
  disabled: ul || !(I.length + K.length),
5002
- onClick: td,
4997
+ onClick: nd,
5003
4998
  className: "h-9 rounded px-3 bg-amber-500 text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50 whitespace-nowrap",
5004
4999
  children: ul ? "Applying…" : `Apply to all ${I.length + K.length} rows`
5005
5000
  }
@@ -5051,7 +5046,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5051
5046
  name: `rerun-mode-${u}`,
5052
5047
  checked: mo === e,
5053
5048
  onChange: () => {
5054
- Za(e), Mn(null);
5049
+ ed(e), Mn(null);
5055
5050
  },
5056
5051
  className: "accent-nvr-cyan"
5057
5052
  }
@@ -5065,20 +5060,20 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5065
5060
  "button",
5066
5061
  {
5067
5062
  type: "button",
5068
- disabled: di !== null,
5063
+ disabled: ai !== null,
5069
5064
  onClick: () => void Ys(!0),
5070
5065
  className: "h-7 rounded border border-slate-300 bg-white px-2.5 text-[11px] font-medium text-slate-700 hover:border-slate-400 disabled:opacity-50 dark:bg-card dark:text-slate-200",
5071
- children: di === "preview" ? "Previewing…" : "Preview"
5066
+ children: ai === "preview" ? "Previewing…" : "Preview"
5072
5067
  }
5073
5068
  ),
5074
5069
  Ht && Ht.changes.length > 0 && /* @__PURE__ */ l(
5075
5070
  "button",
5076
5071
  {
5077
5072
  type: "button",
5078
- disabled: di !== null,
5073
+ disabled: ai !== null,
5079
5074
  onClick: () => void Ys(!1),
5080
5075
  className: "h-7 rounded bg-nvr-cyan px-3 text-[11px] font-medium text-white hover:brightness-110 disabled:opacity-50",
5081
- children: di === "apply" ? D && w ? "Staging…" : "Applying…" : `${D && w ? "Stage for" : "Apply to"} ${Ht.changes.length} ${Ht.changes.length === 1 ? "line" : "lines"}`
5076
+ children: ai === "apply" ? D && w ? "Staging…" : "Applying…" : `${D && w ? "Stage for" : "Apply to"} ${Ht.changes.length} ${Ht.changes.length === 1 ? "line" : "lines"}`
5082
5077
  }
5083
5078
  )
5084
5079
  ] }),
@@ -5097,7 +5092,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5097
5092
  Ht.truncated && /* @__PURE__ */ l("li", { className: "text-amber-700", children: "Preview shows the first 200 lines." })
5098
5093
  ] }) })
5099
5094
  ] }),
5100
- (le == null ? void 0 : le.unmatched_banner) && !j && Qt.unmatchedCandidates.length > 0 && (() => {
5095
+ (le == null ? void 0 : le.unmatched_banner) && !R && Qt.unmatchedCandidates.length > 0 && (() => {
5101
5096
  var a, c, d, p, m, h, b, v;
5102
5097
  const e = Qt.unmatchedCandidates.length, n = ((a = le.unmatched_banner) == null ? void 0 : a.label) ?? "related line", t = e === 1 ? n : `${n}s`, r = ((c = le.candidates) == null ? void 0 : c.primary) ?? ((m = (p = (d = le.candidates) == null ? void 0 : d.keys) == null ? void 0 : p[0]) == null ? void 0 : m.row), i = (v = (b = (h = le.candidates) == null ? void 0 : h.keys) == null ? void 0 : b.find(
5103
5098
  (x) => x.row === r
@@ -5127,7 +5122,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5127
5122
  {
5128
5123
  type: "button",
5129
5124
  disabled: hn,
5130
- onClick: () => void rd(),
5125
+ onClick: () => void id(),
5131
5126
  className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 disabled:opacity-50 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
5132
5127
  "data-tip": S || D ? "Stages one row per missing line — saved with the record" : "Adds one row per missing line now",
5133
5128
  children: hn ? "Adding…" : `Add ${e === 1 ? "it" : `all ${e}`} as ${e === 1 ? "a row" : "rows"}`
@@ -5135,12 +5130,12 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5135
5130
  )
5136
5131
  ] });
5137
5132
  })(),
5138
- (vt || to.length > 0) && !S && xe === "original" && (() => {
5133
+ (vt || to.length > 0) && !S && we === "original" && (() => {
5139
5134
  const e = vt, n = (e == null ? void 0 : e.total) ?? 0, t = [];
5140
5135
  e != null && e.added.size && t.push(`${e.added.size} added`), e != null && e.changed.size && t.push(`${e.changed.size} changed`), e != null && e.removed.length && t.push(`${e.removed.length} removed`);
5141
5136
  const r = ((e == null ? void 0 : e.removed) ?? []).slice(0, 5).map((i) => {
5142
5137
  var o;
5143
- return fi(((o = An.current) == null ? void 0 : o.get(i)) ?? { id: i });
5138
+ return ui(((o = An.current) == null ? void 0 : o.get(i)) ?? { id: i });
5144
5139
  });
5145
5140
  return /* @__PURE__ */ k(
5146
5141
  "div",
@@ -5168,7 +5163,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5168
5163
  "button",
5169
5164
  {
5170
5165
  type: "button",
5171
- onClick: Ma,
5166
+ onClick: Ka,
5172
5167
  className: "ml-auto h-6 rounded border border-amber-300 bg-white px-2.5 text-[11px] font-medium text-amber-800 hover:border-amber-400 dark:border-amber-500/50 dark:bg-transparent dark:text-amber-200",
5173
5168
  "data-tip": "Take the current rows as the new baseline",
5174
5169
  children: "Dismiss"
@@ -5192,18 +5187,18 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5192
5187
  /* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" }),
5193
5188
  /* @__PURE__ */ l("div", { className: "h-8 rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))] animate-pulse" })
5194
5189
  ] }),
5195
- !j && ks.length > 0 && /* @__PURE__ */ l(
5196
- Cd,
5190
+ !R && ks.length > 0 && /* @__PURE__ */ l(
5191
+ Gd,
5197
5192
  {
5198
5193
  proposals: ks,
5199
- onApply: $a,
5194
+ onApply: Ea,
5200
5195
  onDismiss: (e) => Fi(e, !0)
5201
5196
  }
5202
5197
  ),
5203
- (Qi && Qi.length > 0 || De && !S && (R || vs || xs)) && /* @__PURE__ */ k("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
5204
- /* @__PURE__ */ l(Gd, { data: R, loading: vs, error: xs }),
5198
+ (Qi && Qi.length > 0 || De && !S && (j || vs || xs)) && /* @__PURE__ */ k("div", { "data-o2m-stats": !0, className: "mb-2 flex flex-wrap items-stretch gap-1.5", children: [
5199
+ /* @__PURE__ */ l(Yd, { data: j, loading: vs, error: xs }),
5205
5200
  (Qi ?? []).map((e) => /* @__PURE__ */ l(
5206
- Yd,
5201
+ Xd,
5207
5202
  {
5208
5203
  label: e.label,
5209
5204
  value: e.result,
@@ -5213,22 +5208,22 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5213
5208
  e.label
5214
5209
  ))
5215
5210
  ] }),
5216
- j && (xr ? /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2", children: [
5211
+ R && (xr ? /* @__PURE__ */ k("div", { className: "flex flex-wrap items-center gap-2", children: [
5217
5212
  xo,
5218
5213
  /* @__PURE__ */ l("div", { className: "ml-auto", children: xr })
5219
5214
  ] }) : xo),
5220
- kt && /* @__PURE__ */ l("style", { children: fc }),
5215
+ kt && /* @__PURE__ */ l("style", { children: pc }),
5221
5216
  /* @__PURE__ */ k(
5222
5217
  "div",
5223
5218
  {
5224
5219
  ref: zn,
5225
5220
  className: Jo ? "hidden" : `relative rounded-lg border border-slate-200 text-[12px]${Z ? " overflow-x-auto" : ""}`,
5226
5221
  children: [
5227
- Ca && /* @__PURE__ */ l("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ k("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
5222
+ Ga && /* @__PURE__ */ l("div", { className: "absolute inset-0 z-10 flex items-center justify-center rounded-lg bg-white/60 backdrop-blur-[1px] dark:bg-black/40", children: /* @__PURE__ */ k("div", { className: "flex items-center gap-2 rounded-md border border-slate-200 bg-white px-3 py-1.5 shadow-sm text-[12px] text-slate-500", children: [
5228
5223
  /* @__PURE__ */ l(wn, { className: "h-3.5 w-3.5 animate-spin" }),
5229
5224
  "Saving order…"
5230
5225
  ] }) }),
5231
- Ls && /* @__PURE__ */ l("style", { children: Ls }),
5226
+ Ts && /* @__PURE__ */ l("style", { children: Ts }),
5232
5227
  /* @__PURE__ */ k(
5233
5228
  "table",
5234
5229
  {
@@ -5241,14 +5236,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5241
5236
  type: "checkbox",
5242
5237
  "aria-label": "Select all rows",
5243
5238
  className: "accent-nvr-cyan",
5244
- checked: cd,
5245
- onChange: (e) => Lr(e.target.checked ? new Set(yo) : /* @__PURE__ */ new Set())
5239
+ checked: ud,
5240
+ onChange: (e) => Tr(e.target.checked ? new Set(yo) : /* @__PURE__ */ new Set())
5246
5241
  }
5247
5242
  ) }),
5248
5243
  ie && (X || S || D) && /* @__PURE__ */ l("th", { className: "w-6" }),
5249
5244
  M && /* @__PURE__ */ l("th", { className: "w-8 px-2 py-2 text-left font-medium text-slate-400 text-[11px]", children: "#" }),
5250
5245
  (S || D) && /* @__PURE__ */ l("th", { className: "px-3 py-2 text-left font-medium text-slate-400 text-[11px] w-20", children: "Status" }),
5251
- Le.map((e) => /* @__PURE__ */ l(
5246
+ Te.map((e) => /* @__PURE__ */ l(
5252
5247
  "th",
5253
5248
  {
5254
5249
  className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]",
@@ -5273,7 +5268,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5273
5268
  {
5274
5269
  field: e,
5275
5270
  value: fo[e.field] ?? null,
5276
- onChange: (n) => ed(e.field, n),
5271
+ onChange: (n) => td(e.field, n),
5277
5272
  relations: Pe,
5278
5273
  collection: s,
5279
5274
  itemId: "new"
@@ -5293,20 +5288,20 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5293
5288
  }
5294
5289
  ) })
5295
5290
  ] }),
5296
- !S && xe === "original" && bo.map(({ row: e, ri: n }, t) => {
5291
+ !S && we === "original" && bo.map(({ row: e, ri: n }, t) => {
5297
5292
  const r = String(e.id), i = gs ? or(e) : null, o = i !== null && (t === 0 || or(bo[t - 1].row) !== i), a = i !== null && !kt && bs.has(i), c = o && i !== null ? /* @__PURE__ */ l("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ l("td", { colSpan: _t, className: "px-2 py-1", children: /* @__PURE__ */ k(
5298
5293
  "button",
5299
5294
  {
5300
5295
  type: "button",
5301
5296
  onClick: (_) => {
5302
- _.stopPropagation(), _a(i);
5297
+ _.stopPropagation(), ka(i);
5303
5298
  },
5304
5299
  className: "flex w-full items-center gap-1.5 text-left",
5305
5300
  children: [
5306
5301
  /* @__PURE__ */ l(
5307
- Jl,
5302
+ Ql,
5308
5303
  {
5309
- className: we(
5304
+ className: ve(
5310
5305
  "h-3 w-3 shrink-0 text-slate-400 transition-transform",
5311
5306
  !a && "rotate-90"
5312
5307
  )
@@ -5315,7 +5310,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5315
5310
  /* @__PURE__ */ l("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: i }),
5316
5311
  /* @__PURE__ */ l("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: I.reduce((_, g) => _ + (or(g) === i ? 1 : 0), 0) }),
5317
5312
  (() => {
5318
- const _ = ka(
5313
+ const _ = Na(
5319
5314
  I.filter(
5320
5315
  (g) => or(g) === i && !Qe.has(String(g.id))
5321
5316
  )
@@ -5337,7 +5332,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5337
5332
  }
5338
5333
  ) }) }) : null;
5339
5334
  if (a) return /* @__PURE__ */ l(ko, { children: c }, r);
5340
- const d = (f == null ? void 0 : f.rowId) === r, p = d && !qe, m = qt === n, h = Ft === n && qt !== n, b = C.has(r), v = Qe.has(r), x = b ? { ...e, ...C.get(r) } : e, N = Uo && !v ? Cl.get(String(x[Uo] ?? "")) ?? null : null;
5335
+ const d = (f == null ? void 0 : f.rowId) === r, p = d && !qe, m = qt === n, h = Ft === n && qt !== n, b = C.has(r), v = Qe.has(r), x = b ? { ...e, ...C.get(r) } : e, N = Uo && !v ? Gl.get(String(x[Uo] ?? "")) ?? null : null;
5341
5336
  return /* @__PURE__ */ k(ko, { children: [
5342
5337
  c,
5343
5338
  /* @__PURE__ */ k(
@@ -5349,9 +5344,9 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5349
5344
  draggable: ie && !!X && !d && !v && !kt,
5350
5345
  onDragStart: () => pl(n),
5351
5346
  onDragOver: (_) => hl(_, n),
5352
- onDrop: id,
5347
+ onDrop: od,
5353
5348
  onDragEnd: Kn,
5354
- onClick: () => !d && !v && li(x),
5349
+ onClick: () => !d && !v && si(x),
5355
5350
  onBlur: (_) => {
5356
5351
  !d || Et || v || _.currentTarget.contains(_.relatedTarget) || Ur(_.relatedTarget) || (bt.current = setTimeout(() => {
5357
5352
  Zn.current || Ur(document.activeElement) || Kt();
@@ -5360,7 +5355,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5360
5355
  onFocus: () => {
5361
5356
  bt.current && (clearTimeout(bt.current), bt.current = null);
5362
5357
  },
5363
- className: we(
5358
+ className: ve(
5364
5359
  "group/row border-b border-slate-100 transition-[color,background-color,opacity] duration-300",
5365
5360
  m ? "opacity-40" : "",
5366
5361
  h ? "border-t-2 border-t-nvr-cyan" : "",
@@ -5399,7 +5394,7 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5399
5394
  onClick: (_) => _.stopPropagation(),
5400
5395
  children: [
5401
5396
  wr === "reorder" && vr(r),
5402
- X && /* @__PURE__ */ l(Nl, { className: "h-3 w-3 text-slate-300 cursor-grab" })
5397
+ X && /* @__PURE__ */ l(Sl, { className: "h-3 w-3 text-slate-300 cursor-grab" })
5403
5398
  ]
5404
5399
  }
5405
5400
  ),
@@ -5419,14 +5414,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5419
5414
  )
5420
5415
  ) : n + 1,
5421
5416
  le && /* @__PURE__ */ l(
5422
- Ml,
5417
+ Kl,
5423
5418
  {
5424
5419
  result: Qt.byRow.get(r),
5425
5420
  title: le.title
5426
5421
  }
5427
5422
  ),
5428
5423
  Jr(r) && /* @__PURE__ */ l(
5429
- Sl,
5424
+ $l,
5430
5425
  {
5431
5426
  className: "h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
5432
5427
  "aria-label": "Imported line",
@@ -5457,14 +5452,14 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5457
5452
  D && /* @__PURE__ */ k("td", { className: "relative px-3 py-1 align-middle w-20", children: [
5458
5453
  wr === "status" && vr(r),
5459
5454
  !M && le && /* @__PURE__ */ l(
5460
- Ml,
5455
+ Kl,
5461
5456
  {
5462
5457
  result: Qt.byRow.get(r),
5463
5458
  title: le.title
5464
5459
  }
5465
5460
  ),
5466
5461
  !M && Jr(r) && /* @__PURE__ */ l(
5467
- Sl,
5462
+ $l,
5468
5463
  {
5469
5464
  className: "mr-1 inline h-2.5 w-2.5 text-slate-300 dark:text-slate-500",
5470
5465
  "aria-label": "Imported line",
@@ -5502,38 +5497,38 @@ ${a.toLocaleString("en-US", Nt(t, t.format))}`;
5502
5497
  ] })
5503
5498
  ] }),
5504
5499
  d && !v && dt === "panel" ? vo({
5505
- identity: `${M ? `Line ${n + 1} · ` : ""}${fi(x)}`,
5500
+ identity: `${M ? `Line ${n + 1} · ` : ""}${ui(x)}`,
5506
5501
  draft: (f == null ? void 0 : f.draft) ?? x,
5507
5502
  rowId: r,
5508
5503
  saveLabel: "Save",
5509
5504
  onDelete: (_) => po(e, _),
5510
- drawer: mi(r, (f == null ? void 0 : f.draft) ?? x)
5505
+ drawer: fi(r, (f == null ? void 0 : f.draft) ?? x)
5511
5506
  }) : (() => {
5512
5507
  const _ = Nr(x, { rowKey: r });
5513
- return Le.map((g, O) => {
5508
+ return Te.map((g, O) => {
5514
5509
  var H, ce, pe;
5515
5510
  if (nt(g))
5516
- return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500", children: ni(g, x) }) }, g.field);
5517
- const L = g.computed_type === "write" && !!g.computed_formula, q = L ? Dt(
5511
+ return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500", children: ti(g, x) }) }, g.field);
5512
+ const T = g.computed_type === "write" && !!g.computed_formula, q = T ? Dt(
5518
5513
  g.computed_formula,
5519
5514
  d ? (f == null ? void 0 : f.draft) ?? x : x
5520
- ) ?? x[g.field] : null, z = J && !d && !v ? (H = ji[r]) == null ? void 0 : H[g.field] : void 0, re = z ? `${g.label || _e(g.field)} · changed ${Ol(z.at)} by ${z.who}${z.reason ? `
5515
+ ) ?? x[g.field] : null, z = J && !d && !v ? (H = Ai[r]) == null ? void 0 : H[g.field] : void 0, re = z ? `${g.label || _e(g.field)} · changed ${Al(z.at)} by ${z.who}${z.reason ? `
5521
5516
  Reason: “${z.reason}”` : ""}` : void 0;
5522
5517
  return /* @__PURE__ */ k(
5523
5518
  "td",
5524
5519
  {
5525
- className: we(
5520
+ className: ve(
5526
5521
  "px-2 py-1 align-top",
5527
5522
  (z || O === 0 && wr === "data") && "relative",
5528
- R && Ct(
5529
- R,
5530
- x[R.key_field],
5523
+ j && Ct(
5524
+ j,
5525
+ x[j.key_field],
5531
5526
  g.field
5532
5527
  ) && "bg-slate-50/80 dark:bg-white/[0.035]"
5533
5528
  ),
5534
- "data-compare-closed": R && Ct(
5535
- R,
5536
- x[R.key_field],
5529
+ "data-compare-closed": j && Ct(
5530
+ j,
5531
+ x[j.key_field],
5537
5532
  g.field
5538
5533
  ) ? "" : void 0,
5539
5534
  "data-tip": re,
@@ -5556,20 +5551,20 @@ Reason: “${z.reason}”` : ""}` : void 0;
5556
5551
  type: "button",
5557
5552
  "aria-label": `History of ${g.label || _e(g.field)}`,
5558
5553
  onClick: (G) => {
5559
- G.stopPropagation(), Si(z.revision_id), Fn(e);
5554
+ G.stopPropagation(), Ni(z.revision_id), Fn(e);
5560
5555
  },
5561
5556
  className: "absolute right-0.5 top-0.5 rounded p-px text-slate-300 opacity-0 transition-opacity duration-150 hover:text-nvr-cyan focus-visible:opacity-100 group-hover/row:opacity-100 dark:text-slate-500",
5562
- children: /* @__PURE__ */ l(pi, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
5557
+ children: /* @__PURE__ */ l(mi, { className: "h-2.5 w-2.5", "aria-hidden": "true" })
5563
5558
  }
5564
5559
  ),
5565
- L ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: We(g, q) }) : p && !v || sr(g.interface) ? (
5560
+ T ? /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: We(g, q) }) : p && !v || sr(g.interface) ? (
5566
5561
  // A field a rule LOCKS on this row is read-only here too
5567
5562
  // (the server drops the write anyway) and says why on hover.
5568
5563
  /* @__PURE__ */ l(
5569
5564
  "div",
5570
5565
  {
5571
5566
  onClick: (G) => G.stopPropagation(),
5572
- "data-tip": p && ((ce = f == null ? void 0 : f.locks) != null && ce.includes(g.field)) ? Zs(g.field) : Gr(g) ? "Only administrators can change this field" : void 0,
5567
+ "data-tip": p && ((ce = f == null ? void 0 : f.locks) != null && ce.includes(g.field)) ? Zs(g.field) : Cr(g) ? "Only administrators can change this field" : void 0,
5573
5568
  "data-grid-cell": p ? Ho(r, g.field) : void 0,
5574
5569
  children: /* @__PURE__ */ l(
5575
5570
  Wn,
@@ -5586,7 +5581,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
5586
5581
  g.field,
5587
5582
  (f == null ? void 0 : f.draft) ?? {}
5588
5583
  ),
5589
- displayOnly: !p || v || Gr(g) || p && !!((pe = f == null ? void 0 : f.locks) != null && pe.includes(g.field))
5584
+ displayOnly: !p || v || Cr(g) || p && !!((pe = f == null ? void 0 : f.locks) != null && pe.includes(g.field))
5590
5585
  }
5591
5586
  )
5592
5587
  }
@@ -5605,17 +5600,17 @@ Reason: “${z.reason}”` : ""}` : void 0;
5605
5600
  x[g.field],
5606
5601
  e.id != null ? String(e.id) : void 0
5607
5602
  ) }),
5608
- R && /* @__PURE__ */ l(
5603
+ j && /* @__PURE__ */ l(
5609
5604
  $o,
5610
5605
  {
5611
- data: R,
5612
- row: Eo(R, x),
5613
- rowKey: x[R.key_field],
5606
+ data: j,
5607
+ row: Eo(j, x),
5608
+ rowKey: x[j.key_field],
5614
5609
  column: g.field,
5615
5610
  planned: p && !v ? f == null ? void 0 : f.draft[g.field] : x[g.field],
5616
5611
  columnLabel: dr(g),
5617
5612
  plannedRow: x,
5618
- onAdjust: !j && !v && e.id != null ? (G, Xe) => void En(String(e.id), G, Xe) : void 0
5613
+ onAdjust: !R && !v && e.id != null ? (G, Xe) => void En(String(e.id), G, Xe) : void 0
5619
5614
  }
5620
5615
  )
5621
5616
  ]
@@ -5671,8 +5666,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
5671
5666
  onClick: (_) => {
5672
5667
  _.stopPropagation(), w == null || w.cancelPendingEdit(s, u, r), Vr((g) => {
5673
5668
  const O = {};
5674
- for (const [L, q] of Object.entries(g))
5675
- L.startsWith(`${r}|`) || (O[L] = q);
5669
+ for (const [T, q] of Object.entries(g))
5670
+ T.startsWith(`${r}|`) || (O[T] = q);
5676
5671
  return O;
5677
5672
  });
5678
5673
  },
@@ -5681,7 +5676,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
5681
5676
  }
5682
5677
  ),
5683
5678
  te && r != null && /* @__PURE__ */ l(
5684
- jc,
5679
+ Lc,
5685
5680
  {
5686
5681
  collection: s,
5687
5682
  rowId: String(r),
@@ -5697,19 +5692,19 @@ Reason: “${z.reason}”` : ""}` : void 0;
5697
5692
  _.stopPropagation(), Fn(e);
5698
5693
  },
5699
5694
  className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
5700
- children: /* @__PURE__ */ l(pi, { className: "h-3 w-3" })
5695
+ children: /* @__PURE__ */ l(mi, { className: "h-3 w-3" })
5701
5696
  }
5702
5697
  ),
5703
5698
  r != null && !String(r).startsWith("pending") && /* @__PURE__ */ l(
5704
- Kc,
5699
+ Wc,
5705
5700
  {
5706
5701
  collection: s,
5707
5702
  rowId: String(r),
5708
- rowLabel: Vc(e)
5703
+ rowLabel: Cc(e)
5709
5704
  }
5710
5705
  ),
5711
- !j && /* @__PURE__ */ l(
5712
- Pl,
5706
+ !R && /* @__PURE__ */ l(
5707
+ Dl,
5713
5708
  {
5714
5709
  saved: r != null && !String(r).startsWith("pending"),
5715
5710
  onDelete: (_) => po(e, _)
@@ -5719,8 +5714,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
5719
5714
  ]
5720
5715
  }
5721
5716
  ),
5722
- !qe && (Ze == null ? void 0 : Ze.rowKey) === r && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: _t, className: "p-0", children: vl(Ze, "row") }) }),
5723
- d && dt === "inline" && Rn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: _t, className: "px-2 pt-2", children: Js(r) }) }),
5717
+ !qe && (Ze == null ? void 0 : Ze.rowKey) === r && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: _t, className: "p-0", children: xl(Ze, "row") }) }),
5718
+ d && dt === "inline" && jn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: _t, className: "px-2 pt-2", children: Js(r) }) }),
5724
5719
  N && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ k(
5725
5720
  "td",
5726
5721
  {
@@ -5738,8 +5733,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
5738
5733
  "data-o2m-editing": !0,
5739
5734
  className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
5740
5735
  children: /* @__PURE__ */ l("td", { colSpan: _t, className: "px-3 py-2", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: ne.map((_) => {
5741
- const g = typeof _ == "string" ? _ : _.field, O = typeof _ == "string" ? void 0 : _.hint, L = typeof _ == "string" ? void 0 : _.match, q = (f == null ? void 0 : f.draft) ?? x, z = L ? vi(
5742
- L,
5736
+ const g = typeof _ == "string" ? _ : _.field, O = typeof _ == "string" ? void 0 : _.hint, T = typeof _ == "string" ? void 0 : _.match, q = (f == null ? void 0 : f.draft) ?? x, z = T ? wi(
5737
+ T,
5743
5738
  q,
5744
5739
  y,
5745
5740
  E == null ? void 0 : E.draft
@@ -5758,13 +5753,13 @@ Reason: “${z.reason}”` : ""}` : void 0;
5758
5753
  u,
5759
5754
  y
5760
5755
  ],
5761
- ...L ? {
5762
- matchCollection: L.collection,
5756
+ ...T ? {
5757
+ matchCollection: T.collection,
5763
5758
  matchQuery: (z == null ? void 0 : z.query) ?? null,
5764
5759
  matchSeed: (z == null ? void 0 : z.seed) ?? {}
5765
5760
  } : D ? {
5766
5761
  deferred: !0,
5767
- stagedOps: (f == null ? void 0 : f.draft[`__nested_ops_${g}`]) ?? gi,
5762
+ stagedOps: (f == null ? void 0 : f.draft[`__nested_ops_${g}`]) ?? hi,
5768
5763
  onStagedOpsChange: (re) => xt(`__nested_ops_${g}`, re)
5769
5764
  } : {}
5770
5765
  },
@@ -5810,8 +5805,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
5810
5805
  draft: f.draft,
5811
5806
  rowId: void 0,
5812
5807
  saveLabel: "Save",
5813
- drawer: mi(void 0, f.draft)
5814
- }) : Le.map((e) => {
5808
+ drawer: fi(void 0, f.draft)
5809
+ }) : Te.map((e) => {
5815
5810
  if (nt(e))
5816
5811
  return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500", children: mr(e, f.draft, !0) }) }, e.field);
5817
5812
  const n = e.computed_type === "write" && !!e.computed_formula, t = sr(e.interface), r = `__m2m_${e.field}`, i = t ? Ui(e) : null;
@@ -5866,8 +5861,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
5866
5861
  }
5867
5862
  ),
5868
5863
  I.length === 0 && K.length === 0 && !yr && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: _t, className: "px-3 py-14 text-center text-slate-400", children: Y ? `No ${Y.toLowerCase()} yet` : S ? "No pending rows" : "No rows yet" }) }),
5869
- !S && xe !== "original" && (() => {
5870
- const e = ft.find((c) => c.addendumId === xe), n = (ie && (X || D) ? 1 : 0) + (M ? 1 : 0) + (D ? 1 : 0) + Le.length + 1;
5864
+ !S && we !== "original" && (() => {
5865
+ const e = ft.find((c) => c.addendumId === we), n = (ie && (X || D) ? 1 : 0) + (M ? 1 : 0) + (D ? 1 : 0) + Te.length + 1;
5871
5866
  if (!e)
5872
5867
  return I.length === 0 ? /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l(
5873
5868
  "td",
@@ -5880,7 +5875,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
5880
5875
  ie && (X || D) && /* @__PURE__ */ l("td", { className: "w-6" }),
5881
5876
  M && /* @__PURE__ */ l("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: d + 1 }),
5882
5877
  D && /* @__PURE__ */ l("td", { className: "w-20" }),
5883
- Le.map((p) => /* @__PURE__ */ l("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: nt(p) ? ni(p, c) : We(
5878
+ Te.map((p) => /* @__PURE__ */ l("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: nt(p) ? ti(p, c) : We(
5884
5879
  p,
5885
5880
  c[p.field],
5886
5881
  c.id != null ? String(c.id) : void 0
@@ -5914,11 +5909,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
5914
5909
  ie && (X || D) && /* @__PURE__ */ l("td", { className: "w-6" }),
5915
5910
  M && /* @__PURE__ */ l("td", { className: "w-8 px-2 align-middle text-[11px] text-red-300 select-none", children: "–" }),
5916
5911
  D && /* @__PURE__ */ l("td", { className: "w-20" }),
5917
- Le.map((m) => /* @__PURE__ */ l(
5912
+ Te.map((m) => /* @__PURE__ */ l(
5918
5913
  "td",
5919
5914
  {
5920
5915
  className: "px-2 py-1.5 text-[11px] text-red-700/70 line-through dark:text-red-300/70",
5921
- children: nt(m) ? ni(m, p) : We(
5916
+ children: nt(m) ? ti(m, p) : We(
5922
5917
  m,
5923
5918
  p[m.field],
5924
5919
  p.id != null ? String(p.id) : void 0
@@ -5962,11 +5957,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
5962
5957
  }
5963
5958
  ),
5964
5959
  D && /* @__PURE__ */ l("td", { className: "w-20" }),
5965
- Le.map((N) => /* @__PURE__ */ l(
5960
+ Te.map((N) => /* @__PURE__ */ l(
5966
5961
  "td",
5967
5962
  {
5968
5963
  className: `px-2 py-1.5 text-[11px] ${v.has(N.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`,
5969
- children: nt(N) ? ni(N, p) : We(
5964
+ children: nt(N) ? ti(N, p) : We(
5970
5965
  N,
5971
5966
  p[N.field],
5972
5967
  p.id != null ? String(p.id) : void 0
@@ -5981,14 +5976,14 @@ Reason: “${z.reason}”` : ""}` : void 0;
5981
5976
  );
5982
5977
  }), ...o];
5983
5978
  })(),
5984
- !S && xe === "original" && Pn.length > ei && /* @__PURE__ */ l("tr", { ref: Ts, children: /* @__PURE__ */ k(
5979
+ !S && we === "original" && Pn.length > Zr && /* @__PURE__ */ l("tr", { ref: Ls, children: /* @__PURE__ */ k(
5985
5980
  "td",
5986
5981
  {
5987
5982
  colSpan: _t,
5988
5983
  className: "px-3 py-2 text-center text-[11px] text-slate-400",
5989
5984
  children: [
5990
5985
  "Showing ",
5991
- ei,
5986
+ Zr,
5992
5987
  " of ",
5993
5988
  Pn.length,
5994
5989
  " ",
@@ -5998,7 +5993,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
5998
5993
  }
5999
5994
  ) }),
6000
5995
  kt && Pn.length === 0 && // Unsaved rows kept in view (dimmed) are not matches either.
6001
- ci.every((e) => e !== "show") && !yr && /* @__PURE__ */ l("tr", { "data-grid-search-empty": "", children: /* @__PURE__ */ l(
5996
+ di.every((e) => e !== "show") && !yr && /* @__PURE__ */ l("tr", { "data-grid-search-empty": "", children: /* @__PURE__ */ l(
6002
5997
  "td",
6003
5998
  {
6004
5999
  colSpan: _t,
@@ -6006,13 +6001,13 @@ Reason: “${z.reason}”` : ""}` : void 0;
6006
6001
  children: lt.loading ? /* @__PURE__ */ k("span", { className: "inline-flex items-center gap-1.5", children: [
6007
6002
  /* @__PURE__ */ l(wn, { className: "h-3.5 w-3.5 animate-spin", "aria-hidden": "true" }),
6008
6003
  "Searching all ",
6009
- ui.toLocaleString("en-US"),
6004
+ ci.toLocaleString("en-US"),
6010
6005
  " rows…"
6011
6006
  ] }) : /* @__PURE__ */ k(yn, { children: [
6012
6007
  "No rows match “",
6013
6008
  nr.trim(),
6014
6009
  "”",
6015
- ln && !lt.error ? ` in all ${ui.toLocaleString("en-US")} rows` : "",
6010
+ ln && !lt.error ? ` in all ${ci.toLocaleString("en-US")} rows` : "",
6016
6011
  ".",
6017
6012
  " ",
6018
6013
  /* @__PURE__ */ l(
@@ -6021,7 +6016,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6021
6016
  type: "button",
6022
6017
  onClick: () => {
6023
6018
  var e;
6024
- as(""), (e = Fr.current) == null || e.focus();
6019
+ as(""), (e = Ri.current) == null || e.focus();
6025
6020
  },
6026
6021
  className: "font-medium text-nvr-cyan underline-offset-2 hover:underline",
6027
6022
  children: "Clear search"
@@ -6030,11 +6025,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
6030
6025
  ] })
6031
6026
  }
6032
6027
  ) }),
6033
- R && xe === "original" && (() => {
6028
+ j && we === "original" && (() => {
6034
6029
  const e = /* @__PURE__ */ new Set();
6035
- for (const t of I ?? []) e.add(String(t[R.key_field] ?? ""));
6036
- for (const t of K) e.add(String(t[R.key_field] ?? ""));
6037
- const n = R.rows.filter((t) => !e.has(String(t.key)));
6030
+ for (const t of I ?? []) e.add(String(t[j.key_field] ?? ""));
6031
+ for (const t of K) e.add(String(t[j.key_field] ?? ""));
6032
+ const n = j.rows.filter((t) => !e.has(String(t.key)));
6038
6033
  return n.length === 0 ? null : n.map((t) => /* @__PURE__ */ k(
6039
6034
  "tr",
6040
6035
  {
@@ -6045,36 +6040,36 @@ Reason: “${z.reason}”` : ""}` : void 0;
6045
6040
  ie && (X || S || D) && /* @__PURE__ */ l("td", {}),
6046
6041
  M && /* @__PURE__ */ l("td", {}),
6047
6042
  (S || D) && /* @__PURE__ */ l("td", { className: "px-3 py-1 align-top", children: /* @__PURE__ */ k("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-500 dark:text-slate-400", children: [
6048
- R.label,
6043
+ j.label,
6049
6044
  " only"
6050
6045
  ] }) }),
6051
- Le.map(
6052
- (r) => r.field === R.key_field ? /* @__PURE__ */ k("td", { className: "px-2 py-1 align-top", children: [
6046
+ Te.map(
6047
+ (r) => r.field === j.key_field ? /* @__PURE__ */ k("td", { className: "px-2 py-1 align-top", children: [
6053
6048
  /* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] font-medium text-slate-700 dark:text-slate-200", children: String(t.key) }),
6054
6049
  /* @__PURE__ */ k(
6055
6050
  "div",
6056
6051
  {
6057
6052
  className: "mt-0.5 text-[10.5px] text-slate-600 dark:text-slate-300",
6058
- "data-tip": `${R.label} recorded for ${String(t.key)} with no ${Y ? Y.toLowerCase() : "row"} to compare against — add a row for ${String(t.key)} to plan against it`,
6053
+ "data-tip": `${j.label} recorded for ${String(t.key)} with no ${Y ? Y.toLowerCase() : "row"} to compare against — add a row for ${String(t.key)} to plan against it`,
6059
6054
  children: [
6060
6055
  "No plan for this ",
6061
- _e(R.key_field).toLowerCase()
6056
+ _e(j.key_field).toLowerCase()
6062
6057
  ]
6063
6058
  }
6064
6059
  )
6065
6060
  ] }, r.field) : /* @__PURE__ */ k(
6066
6061
  "td",
6067
6062
  {
6068
- className: we(
6063
+ className: ve(
6069
6064
  "px-2 py-1 align-top",
6070
- Ct(R, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
6065
+ Ct(j, t.key, r.field) && "bg-slate-100/70 dark:bg-white/[0.035]"
6071
6066
  ),
6072
6067
  children: [
6073
- R.columns.includes(r.field) && /* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
6068
+ j.columns.includes(r.field) && /* @__PURE__ */ l("div", { className: "py-0.5 text-[12px] text-slate-300 dark:text-slate-600", children: "—" }),
6074
6069
  /* @__PURE__ */ l(
6075
6070
  $o,
6076
6071
  {
6077
- data: R,
6072
+ data: j,
6078
6073
  row: t,
6079
6074
  rowKey: t.key,
6080
6075
  column: r.field,
@@ -6094,7 +6089,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6094
6089
  ));
6095
6090
  })(),
6096
6091
  K.length > 0 && K.map((e, n) => {
6097
- const t = `pending:${n}`, r = ci[n] ?? "show";
6092
+ const t = `pending:${n}`, r = di[n] ?? "show";
6098
6093
  if (r === "hide") return null;
6099
6094
  const i = (f == null ? void 0 : f.rowId) === t, o = i && !qe, a = qt === n, c = Ft === n && qt !== n, d = !!e.__prefilled;
6100
6095
  return /* @__PURE__ */ k(ko, { children: [
@@ -6122,7 +6117,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6122
6117
  onFocus: () => {
6123
6118
  bt.current && (clearTimeout(bt.current), bt.current = null);
6124
6119
  },
6125
- className: we(
6120
+ className: ve(
6126
6121
  "nvr-rise-in border-b border-slate-100 transition-colors",
6127
6122
  a ? "opacity-40" : "",
6128
6123
  c ? "border-t-2 border-t-nvr-cyan" : "",
@@ -6154,7 +6149,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6154
6149
  {
6155
6150
  className: "w-6 px-1 align-middle",
6156
6151
  onClick: (p) => p.stopPropagation(),
6157
- children: /* @__PURE__ */ l(Nl, { className: "h-3 w-3 text-slate-300 cursor-grab" })
6152
+ children: /* @__PURE__ */ l(Sl, { className: "h-3 w-3 text-slate-300 cursor-grab" })
6158
6153
  }
6159
6154
  ),
6160
6155
  M && /* @__PURE__ */ l("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: /* @__PURE__ */ k("span", { className: "inline-flex items-center gap-1", children: [
@@ -6176,11 +6171,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
6176
6171
  ] }) }),
6177
6172
  /* @__PURE__ */ k("td", { className: "px-3 py-1 align-middle w-16", children: [
6178
6173
  !i && !d && /* @__PURE__ */ l("span", { className: "nvr-pop inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
6179
- !i && d && e.id != null && Fa.has(e.id) && /* @__PURE__ */ l("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
6174
+ !i && d && e.id != null && Ha.has(e.id) && /* @__PURE__ */ l("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
6180
6175
  ] })
6181
6176
  ] }),
6182
6177
  i && dt === "panel" ? vo({
6183
- identity: `${M ? `Line ${I.length + n + 1} · ` : ""}${fi(i ? f.draft : e)}`,
6178
+ identity: `${M ? `Line ${I.length + n + 1} · ` : ""}${ui(i ? f.draft : e)}`,
6184
6179
  draft: (f == null ? void 0 : f.draft) ?? e,
6185
6180
  rowId: t,
6186
6181
  saveLabel: "Save",
@@ -6189,14 +6184,14 @@ Reason: “${z.reason}”` : ""}` : void 0;
6189
6184
  },
6190
6185
  // Grandchild rows for an unsaved row stage against the
6191
6186
  // draft, so there is no row id to pass yet.
6192
- drawer: mi(void 0, (f == null ? void 0 : f.draft) ?? e)
6187
+ drawer: fi(void 0, (f == null ? void 0 : f.draft) ?? e)
6193
6188
  }) : (() => {
6194
6189
  const p = Nr(
6195
6190
  i ? f.draft : e,
6196
6191
  { rowKey: t }
6197
6192
  );
6198
- return Le.map((m) => {
6199
- var O, L;
6193
+ return Te.map((m) => {
6194
+ var O, T;
6200
6195
  if (nt(m))
6201
6196
  return /* @__PURE__ */ l("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden text-slate-500", children: mr(
6202
6197
  m,
@@ -6210,7 +6205,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6210
6205
  return /* @__PURE__ */ k(
6211
6206
  "td",
6212
6207
  {
6213
- className: we(
6208
+ className: ve(
6214
6209
  "px-2 py-1 align-top",
6215
6210
  g && !i && "[&>div]:underline [&>div]:decoration-dotted [&>div]:decoration-amber-400 [&>div]:underline-offset-2"
6216
6211
  ),
@@ -6241,7 +6236,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6241
6236
  m,
6242
6237
  p[m.field] ?? e[m.field],
6243
6238
  String(e.id)
6244
- ) }) : !i && (_ == null || _ === "") && ((L = zo.current.get(e)) != null && L.has(m.field)) ? /* @__PURE__ */ l(
6239
+ ) }) : !i && (_ == null || _ === "") && ((T = zo.current.get(e)) != null && T.has(m.field)) ? /* @__PURE__ */ l(
6245
6240
  "div",
6246
6241
  {
6247
6242
  className: "py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300",
@@ -6250,15 +6245,15 @@ Reason: “${z.reason}”` : ""}` : void 0;
6250
6245
  children: "Pick again"
6251
6246
  }
6252
6247
  ) : /* @__PURE__ */ l("div", { className: "py-0.5 overflow-hidden", children: We(m, _, String(e.id)) }),
6253
- R && /* @__PURE__ */ l(
6248
+ j && /* @__PURE__ */ l(
6254
6249
  $o,
6255
6250
  {
6256
- data: R,
6251
+ data: j,
6257
6252
  row: Eo(
6258
- R,
6253
+ j,
6259
6254
  i ? f.draft : e
6260
6255
  ),
6261
- rowKey: (i ? f.draft : e)[R.key_field],
6256
+ rowKey: (i ? f.draft : e)[j.key_field],
6262
6257
  column: m.field,
6263
6258
  planned: i ? f.draft[m.field] : e[m.field],
6264
6259
  columnLabel: dr(m)
@@ -6307,11 +6302,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
6307
6302
  p.stopPropagation(), Fn(e);
6308
6303
  },
6309
6304
  className: "rounded p-0.5 text-slate-300 hover:text-nvr-cyan",
6310
- children: /* @__PURE__ */ l(pi, { className: "h-3 w-3" })
6305
+ children: /* @__PURE__ */ l(mi, { className: "h-3 w-3" })
6311
6306
  }
6312
6307
  ),
6313
6308
  /* @__PURE__ */ l(
6314
- Pl,
6309
+ Dl,
6315
6310
  {
6316
6311
  saved: !1,
6317
6312
  onDelete: (p) => {
@@ -6349,8 +6344,8 @@ Reason: “${z.reason}”` : ""}` : void 0;
6349
6344
  ] }, n);
6350
6345
  })
6351
6346
  ] }),
6352
- xe === "original" && (() => {
6353
- if (Le.filter((t) => !!(t.options ? typeof t.options == "string" ? (() => {
6347
+ we === "original" && (() => {
6348
+ if (Te.filter((t) => !!(t.options ? typeof t.options == "string" ? (() => {
6354
6349
  try {
6355
6350
  return JSON.parse(t.options);
6356
6351
  } catch {
@@ -6378,20 +6373,20 @@ Reason: “${z.reason}”` : ""}` : void 0;
6378
6373
  ie && (X || S || D) && /* @__PURE__ */ l("td", {}),
6379
6374
  M && /* @__PURE__ */ l("td", {}),
6380
6375
  (S || D) && /* @__PURE__ */ l("td", {}),
6381
- Le.map((t) => {
6376
+ Te.map((t) => {
6382
6377
  const r = t.options ? typeof t.options == "string" ? (() => {
6383
6378
  try {
6384
6379
  return JSON.parse(t.options);
6385
6380
  } catch {
6386
6381
  return {};
6387
6382
  }
6388
- })() : t.options : {}, i = r.aggregate, o = Xd(R, t.field), a = o != null ? /* @__PURE__ */ k(
6383
+ })() : t.options : {}, i = r.aggregate, o = Zd(j, t.field), a = o != null ? /* @__PURE__ */ k(
6389
6384
  "div",
6390
6385
  {
6391
6386
  "data-compare-footer": t.field,
6392
6387
  className: "mt-0.5 flex min-w-0 flex-wrap items-baseline gap-x-1 text-[11px] font-normal leading-4 text-slate-500 dark:text-slate-400",
6393
6388
  children: [
6394
- /* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children: R == null ? void 0 : R.label }),
6389
+ /* @__PURE__ */ l("span", { className: "font-mono text-[9px] uppercase tracking-wide text-slate-500 dark:text-slate-400", children: j == null ? void 0 : j.label }),
6395
6390
  /* @__PURE__ */ l("span", { className: "tabular-nums", children: So(o) })
6396
6391
  ]
6397
6392
  }
@@ -6462,7 +6457,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6462
6457
  type: "button",
6463
6458
  "data-grid-nested-retry": "",
6464
6459
  disabled: es,
6465
- onClick: () => void da(),
6460
+ onClick: () => void ca(),
6466
6461
  className: "font-semibold underline-offset-2 hover:underline disabled:opacity-50",
6467
6462
  children: es ? "Retrying…" : "Retry"
6468
6463
  }
@@ -6479,11 +6474,11 @@ Reason: “${z.reason}”` : ""}` : void 0;
6479
6474
  ]
6480
6475
  }
6481
6476
  ),
6482
- xe === "original" && !yr && !j && /* @__PURE__ */ l("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ l(
6477
+ we === "original" && !yr && !R && /* @__PURE__ */ l("div", { className: "border-t border-slate-100 px-3 py-1.5", children: /* @__PURE__ */ l(
6483
6478
  "button",
6484
6479
  {
6485
6480
  type: "button",
6486
- onClick: za,
6481
+ onClick: Va,
6487
6482
  className: "text-[11px] font-medium text-nvr-cyan hover:underline",
6488
6483
  children: "+ Add row"
6489
6484
  }
@@ -6491,9 +6486,9 @@ Reason: “${z.reason}”` : ""}` : void 0;
6491
6486
  ]
6492
6487
  }
6493
6488
  ),
6494
- qe && Ze && xe === "original" && /* @__PURE__ */ l("div", { "data-grid-split-editor-lock": "", children: vl(Ze, "docked") }),
6495
- qe && f && xe === "original" && (() => {
6496
- const e = f.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? I.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? I[r] : void 0, o = e === "new" ? I.length + K.length + 1 : n ? I.length + t + 1 : r + 1, a = M ? `Line ${o} · ` : "", c = e === "new" ? `${a}New line` : `${a}${fi(f.draft)}`;
6489
+ qe && Ze && we === "original" && /* @__PURE__ */ l("div", { "data-grid-split-editor-lock": "", children: xl(Ze, "docked") }),
6490
+ qe && f && we === "original" && (() => {
6491
+ const e = f.rowId, n = e.startsWith("pending:"), t = n ? parseInt(e.split(":")[1], 10) : -1, r = !n && e !== "new" ? I.findIndex((d) => String(d.id) === e) : -1, i = r >= 0 ? I[r] : void 0, o = e === "new" ? I.length + K.length + 1 : n ? I.length + t + 1 : r + 1, a = M ? `Line ${o} · ` : "", c = e === "new" ? `${a}New line` : `${a}${ui(f.draft)}`;
6497
6492
  return /* @__PURE__ */ k(
6498
6493
  "div",
6499
6494
  {
@@ -6510,27 +6505,27 @@ Reason: “${z.reason}”` : ""}` : void 0;
6510
6505
  "data-tip": "Drag to resize · ↑/↓ nudge",
6511
6506
  className: "flex h-3 w-full shrink-0 cursor-row-resize touch-none select-none items-center justify-center rounded-t-lg border-b border-nvr-cyan/20 text-slate-300 hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-nvr-cyan dark:text-slate-500",
6512
6507
  onPointerDown: (d) => {
6513
- jr.current = { startY: d.clientY, startH: Ar }, d.currentTarget.setPointerCapture(d.pointerId);
6508
+ Rr.current = { startY: d.clientY, startH: Ar }, d.currentTarget.setPointerCapture(d.pointerId);
6514
6509
  },
6515
6510
  onPointerMove: (d) => {
6516
- const p = jr.current;
6511
+ const p = Rr.current;
6517
6512
  p && Mo(Math.max(160, Math.min(900, p.startH + (d.clientY - p.startY))));
6518
6513
  },
6519
6514
  onPointerUp: () => {
6520
- jr.current = null;
6515
+ Rr.current = null;
6521
6516
  },
6522
6517
  onPointerCancel: () => {
6523
- jr.current = null;
6518
+ Rr.current = null;
6524
6519
  },
6525
6520
  onKeyDown: (d) => {
6526
6521
  (d.key === "ArrowUp" || d.key === "ArrowDown") && (d.preventDefault(), Mo(
6527
6522
  (p) => Math.max(160, Math.min(900, p + (d.key === "ArrowDown" ? 24 : -24)))
6528
6523
  ));
6529
6524
  },
6530
- children: /* @__PURE__ */ l(xd, { className: "h-3 w-3", "aria-hidden": "true" })
6525
+ children: /* @__PURE__ */ l(_d, { className: "h-3 w-3", "aria-hidden": "true" })
6531
6526
  }
6532
6527
  ),
6533
- /* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto", children: wl({
6528
+ /* @__PURE__ */ l("div", { className: "min-h-0 flex-1 overflow-y-auto", children: vl({
6534
6529
  identity: c,
6535
6530
  draft: f.draft,
6536
6531
  rowId: e === "new" ? void 0 : e,
@@ -6540,14 +6535,14 @@ Reason: “${z.reason}”` : ""}` : void 0;
6540
6535
  d.stopPropagation(), w == null || w.removeRow(s, u, t);
6541
6536
  } : void 0,
6542
6537
  // Grandchild rows of an unsaved row stage against the draft.
6543
- drawer: mi(i ? e : void 0, f.draft)
6538
+ drawer: fi(i ? e : void 0, f.draft)
6544
6539
  }) })
6545
6540
  ]
6546
6541
  }
6547
6542
  );
6548
6543
  })(),
6549
6544
  /* @__PURE__ */ l(
6550
- nc,
6545
+ rc,
6551
6546
  {
6552
6547
  open: Vn,
6553
6548
  onOpenChange: Do,
@@ -6558,7 +6553,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6558
6553
  relations: Pe,
6559
6554
  collection: s,
6560
6555
  cascadeFilters: He,
6561
- onApply: md,
6556
+ onApply: pd,
6562
6557
  onEditIntent: () => {
6563
6558
  var e;
6564
6559
  (e = w == null ? void 0 : w.noteEditIntent) == null || e.call(w), Xo(!0);
@@ -6566,14 +6561,14 @@ Reason: “${z.reason}”` : ""}` : void 0;
6566
6561
  }
6567
6562
  ),
6568
6563
  /* @__PURE__ */ l(
6569
- Tl,
6564
+ Ml,
6570
6565
  {
6571
6566
  mode: "timeline",
6572
6567
  open: Vo,
6573
6568
  onOpenChange: Mr,
6574
6569
  rowTitle: `${I.length} ${I.length === 1 ? "line" : "lines"} on this record`,
6575
- revisions: oa,
6576
- loading: ia,
6570
+ revisions: sa,
6571
+ loading: oa,
6577
6572
  truncated: !!(Zt != null && Zt.truncated),
6578
6573
  fields: ae,
6579
6574
  displayCols: Ne,
@@ -6583,7 +6578,7 @@ Reason: “${z.reason}”` : ""}` : void 0;
6583
6578
  collection: s,
6584
6579
  m2oDisplays: mn,
6585
6580
  client: $,
6586
- allowRestore: !!se && !j,
6581
+ allowRestore: !!se && !R,
6587
6582
  rowLabel: (e, n) => {
6588
6583
  const t = X ? n[X] : n.line_number, r = I.findIndex((c) => String(c.id) === String(e)) + 1, i = t != null && t !== "" ? `Line ${String(t)}` : r > 0 ? `Line ${r}` : "A removed line", o = Ne.find(
6589
6584
  (c) => c.field !== "id" && !ze.get(c.field) && /^(string|text)$/i.test(c.type ?? "") && typeof n[c.field] == "string" && n[c.field].trim() !== ""
@@ -6591,30 +6586,30 @@ Reason: “${z.reason}”` : ""}` : void 0;
6591
6586
  return { title: i, subtitle: a && a.length > 48 ? `${a.slice(0, 48)}…` : a };
6592
6587
  },
6593
6588
  onRestore: (e, n) => tl(e, n),
6594
- onRestoreAllTo: sa,
6595
- restoringAll: ta
6589
+ onRestoreAllTo: la,
6590
+ restoringAll: na
6596
6591
  }
6597
6592
  ),
6598
6593
  /* @__PURE__ */ l(
6599
- Tl,
6594
+ Ml,
6600
6595
  {
6601
- open: !!je,
6596
+ open: !!Re,
6602
6597
  onOpenChange: (e) => {
6603
- e || (Fn(null), Si(null));
6598
+ e || (Fn(null), Ni(null));
6604
6599
  },
6605
6600
  rowTitle: (() => {
6606
- const e = X ? je == null ? void 0 : je[X] : je == null ? void 0 : je.line_number;
6601
+ const e = X ? Re == null ? void 0 : Re[X] : Re == null ? void 0 : Re.line_number;
6607
6602
  return e != null && e !== "" ? `Line ${String(e)}` : "This row";
6608
6603
  })(),
6609
6604
  rowSubtitle: (() => {
6610
- if (!je) return null;
6605
+ if (!Re) return null;
6611
6606
  const e = Ne.find(
6612
- (n) => n.field !== "id" && !ze.get(n.field) && /^(string|text)$/i.test(n.type ?? "") && typeof je[n.field] == "string" && je[n.field].trim() !== ""
6607
+ (n) => n.field !== "id" && !ze.get(n.field) && /^(string|text)$/i.test(n.type ?? "") && typeof Re[n.field] == "string" && Re[n.field].trim() !== ""
6613
6608
  );
6614
- return e ? String(je[e.field]) : null;
6609
+ return e ? String(Re[e.field]) : null;
6615
6610
  })(),
6616
- revisions: na,
6617
- loading: ra,
6611
+ revisions: ra,
6612
+ loading: ia,
6618
6613
  fields: ae,
6619
6614
  displayCols: Ne,
6620
6615
  parentField: u,
@@ -6623,9 +6618,9 @@ Reason: “${z.reason}”` : ""}` : void 0;
6623
6618
  collection: s,
6624
6619
  m2oDisplays: mn,
6625
6620
  client: $,
6626
- allowRestore: !!se && !j,
6627
- focusRevisionId: ea,
6628
- onRestore: (e, n) => tl(e, { ...n, itemId: n.itemId ?? String(je.id) })
6621
+ allowRestore: !!se && !R,
6622
+ focusRevisionId: ta,
6623
+ onRestore: (e, n) => tl(e, { ...n, itemId: n.itemId ?? String(Re.id) })
6629
6624
  }
6630
6625
  )
6631
6626
  ]
@@ -6633,13 +6628,13 @@ Reason: “${z.reason}”` : ""}` : void 0;
6633
6628
  )
6634
6629
  );
6635
6630
  }
6636
- const Wl = {
6631
+ const Ul = {
6637
6632
  even: "Evenly",
6638
6633
  front: "Front-loaded",
6639
6634
  back: "Back-loaded",
6640
6635
  shape: "Like previous"
6641
6636
  };
6642
- function Fl(s) {
6637
+ function Hl(s) {
6643
6638
  return s.presets.length < 2 ? null : /* @__PURE__ */ l("span", { className: "inline-flex items-center gap-0.5", "data-o2m-spread-presets": !0, children: s.presets.map((u) => /* @__PURE__ */ l(
6644
6639
  "button",
6645
6640
  {
@@ -6647,16 +6642,16 @@ function Fl(s) {
6647
6642
  "data-o2m-spread-preset": u,
6648
6643
  "aria-pressed": s.value === u,
6649
6644
  onClick: () => s.onChange(u),
6650
- className: we(
6645
+ className: ve(
6651
6646
  "rounded-full border px-2 py-px text-[10.5px]",
6652
6647
  s.value === u ? "border-nvr-cyan bg-nvr-cyan/10 font-semibold text-slate-800 dark:text-slate-100" : "border-slate-200 text-slate-500 hover:bg-muted dark:border-border dark:text-slate-400"
6653
6648
  ),
6654
- children: u === "shape" ? s.shapeLabel ?? Wl.shape : Wl[u]
6649
+ children: u === "shape" ? s.shapeLabel ?? Ul.shape : Ul[u]
6655
6650
  },
6656
6651
  u
6657
6652
  )) });
6658
6653
  }
6659
- function Xc({
6654
+ function tu({
6660
6655
  config: s,
6661
6656
  draft: u,
6662
6657
  remaining: y,
@@ -6668,7 +6663,7 @@ function Xc({
6668
6663
  (fe) => (U == null ? void 0 : U.has(fe)) && (!te || se(u[fe]))
6669
6664
  ).length, M = s.fields.filter(
6670
6665
  (fe) => !(U != null && U.has(fe)) && (!te || se(u[fe]))
6671
- ), ie = T(() => (s.presets ?? ["even", "front", "back", "shape"]).filter((Ve) => Ve !== "shape" || !!J), [s.presets, J]), [Re, W] = B("even"), oe = ie.includes(Re) ? Re : ie[0] ?? "even", Se = y == null || !Number.isFinite(y) ? 0 : Math.round(y * 100) / 100, ne = (fe) => s.format === "number" ? fe.toLocaleString(void 0, { maximumFractionDigits: 2 }) : fe.toLocaleString(void 0, { style: "currency", currency: "USD" }), Ee = Se <= 0 ? Se < 0 ? `${ne(-Se)} over — nothing to spread` : "Nothing left to spread" : M.length === 0 ? Q > 0 ? "Every open target field already holds a value" : "Every target field already holds a value" : null;
6666
+ ), ie = L(() => (s.presets ?? ["even", "front", "back", "shape"]).filter((Ve) => Ve !== "shape" || !!J), [s.presets, J]), [je, W] = B("even"), oe = ie.includes(je) ? je : ie[0] ?? "even", Se = y == null || !Number.isFinite(y) ? 0 : Math.round(y * 100) / 100, ne = (fe) => s.format === "number" ? fe.toLocaleString(void 0, { maximumFractionDigits: 2 }) : fe.toLocaleString(void 0, { style: "currency", currency: "USD" }), Ee = Se <= 0 ? Se < 0 ? `${ne(-Se)} over — nothing to spread` : "Nothing left to spread" : M.length === 0 ? Q > 0 ? "Every open target field already holds a value" : "Every target field already holds a value" : null;
6672
6667
  return /* @__PURE__ */ k("div", { className: "mt-2 flex flex-wrap items-center gap-2", "data-o2m-spread": !0, children: [
6673
6668
  /* @__PURE__ */ k(
6674
6669
  "button",
@@ -6676,10 +6671,10 @@ function Xc({
6676
6671
  type: "button",
6677
6672
  onClick: () => {
6678
6673
  if (Ee) return;
6679
- const fe = J ? M.map((Z) => J.values[Z] ?? 0) : void 0, Ve = Vl(Se, M.length, oe, fe), ve = {};
6674
+ const fe = J ? M.map((Z) => J.values[Z] ?? 0) : void 0, Ve = Fl(Se, M.length, oe, fe), xe = {};
6680
6675
  M.forEach((Z, ye) => {
6681
- ve[Z] = Ve[ye];
6682
- }), A(ve);
6676
+ xe[Z] = Ve[ye];
6677
+ }), A(xe);
6683
6678
  },
6684
6679
  disabled: !!Ee,
6685
6680
  title: Ee ?? `${ne(Se)} across ${M.length} ${M.length === 1 ? "field" : "fields"}`,
@@ -6691,7 +6686,7 @@ function Xc({
6691
6686
  }
6692
6687
  ),
6693
6688
  !Ee && /* @__PURE__ */ l(
6694
- Fl,
6689
+ Hl,
6695
6690
  {
6696
6691
  presets: ie,
6697
6692
  value: oe,
@@ -6716,7 +6711,7 @@ function Xc({
6716
6711
  Ee && /* @__PURE__ */ l("span", { className: "text-[11px] text-slate-400 dark:text-slate-500", children: Ee })
6717
6712
  ] });
6718
6713
  }
6719
- function Zc(s) {
6714
+ function nu(s) {
6720
6715
  const [u, y] = B(!1), [A, U] = B("even"), J = s.remaining == null || !Number.isFinite(s.remaining) ? 0 : Math.round(s.remaining * 100) / 100, te = (Q) => s.config.format === "number" ? Q.toLocaleString(void 0, { maximumFractionDigits: 2 }) : Q.toLocaleString(void 0, { style: "currency", currency: "USD" });
6721
6716
  if (J <= 0) return null;
6722
6717
  const se = (s.config.presets ?? ["even", "front", "back"]).filter(
@@ -6728,7 +6723,7 @@ function Zc(s) {
6728
6723
  {
6729
6724
  type: "button",
6730
6725
  onClick: () => y((Q) => !Q),
6731
- className: we(
6726
+ className: ve(
6732
6727
  "h-6 px-2.5 rounded border transition-colors",
6733
6728
  u ? "border-nvr-cyan bg-nvr-cyan/10 text-nvr-cyan" : "border-slate-200 text-slate-600 hover:border-slate-400 hover:text-slate-800"
6734
6729
  ),
@@ -6755,7 +6750,7 @@ function Zc(s) {
6755
6750
  " first."
6756
6751
  ] }),
6757
6752
  /* @__PURE__ */ l("div", { className: "mt-2", children: /* @__PURE__ */ l(
6758
- Fl,
6753
+ Hl,
6759
6754
  {
6760
6755
  presets: se,
6761
6756
  value: se.includes(A) ? A : se[0],
@@ -6790,17 +6785,17 @@ function Zc(s) {
6790
6785
  )
6791
6786
  ] });
6792
6787
  }
6793
- function Ul(s) {
6788
+ function Bl(s) {
6794
6789
  var y, A;
6795
6790
  const u = s;
6796
6791
  return ((y = u == null ? void 0 : u.response) == null ? void 0 : y.error) ?? ((A = u == null ? void 0 : u.response) == null ? void 0 : A.message) ?? (u == null ? void 0 : u.message) ?? "the server refused it";
6797
6792
  }
6798
6793
  export {
6799
- Pl as DeleteLineButton,
6800
- zu as InlineTableField,
6801
- Yc as applyValueColumns,
6802
- Bc as dropUnavailableValues,
6794
+ Dl as DeleteLineButton,
6795
+ Hu as InlineTableField,
6796
+ eu as applyValueColumns,
6797
+ zc as dropUnavailableValues,
6803
6798
  Dt as evalClientFormula,
6804
6799
  Ao as failingLints,
6805
- Vl as spreadAmounts
6800
+ Fl as spreadAmounts
6806
6801
  };