@nivaro/react 0.3.65 → 0.3.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +21 -5
  4. package/dist/shared/components/ActivityEntry.js +28 -28
  5. package/dist/shared/components/CollectionBrowserView.js +2432 -2592
  6. package/dist/shared/components/ItemEditForm.js +3912 -3773
  7. package/dist/shared/components/MyWorkView.js +124 -113
  8. package/dist/shared/components/ProfileView.js +483 -472
  9. package/dist/shared/components/RecordCompare.js +149 -129
  10. package/dist/shared/components/ReportView.js +1100 -1094
  11. package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
  12. package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
  13. package/dist/shared/components/integrations/IntegrationObligationsView.js +199 -187
  14. package/dist/shared/components/integrations/console/EventsView.js +22 -24
  15. package/dist/shared/components/integrations/console/SubmissionRow.js +6 -13
  16. package/dist/shared/components/integrations/console/drill/SubmissionDrill.js +29 -28
  17. package/dist/shared/components/integrations/console/tone.js +22 -21
  18. package/dist/shared/components/item-edit/CatalogPickerField.js +240 -238
  19. package/dist/shared/components/item-edit/FieldRow.js +193 -193
  20. package/dist/shared/components/item-edit/GroupSection.js +559 -542
  21. package/dist/shared/components/item-edit/M2MCombobox.js +414 -349
  22. package/dist/shared/components/item-edit/MidairCollisionDialog.js +211 -187
  23. package/dist/shared/components/item-edit/RecordInsights.js +46 -45
  24. package/dist/shared/components/item-edit/RelationCombobox.js +327 -311
  25. package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
  26. package/dist/shared/components/item-edit/UserChip.js +264 -229
  27. package/dist/shared/components/item-edit/cascade-clear-notice.js +23 -19
  28. package/dist/shared/components/item-edit/header-path-preview.js +52 -0
  29. package/dist/shared/components/item-edit/line-merge.js +73 -47
  30. package/dist/shared/components/item-edit/picker-search.js +25 -21
  31. package/dist/shared/components/panels/BranchLanes.js +7 -7
  32. package/dist/shared/components/panels/CommentPanel.js +72 -72
  33. package/dist/shared/components/panels/PipelinePanel.js +261 -261
  34. package/dist/shared/components/panels/RecordIntegrityBanner.js +78 -78
  35. package/dist/shared/components/panels/RevisionsPanel.js +220 -220
  36. package/dist/shared/components/panels/TaskPanel.js +75 -75
  37. package/dist/shared/components/queue/QueueWorklist.js +1007 -979
  38. package/dist/shared/lib/compare-value.js +73 -0
  39. package/dist/shared/lib/format-value.js +19 -18
  40. package/dist/shared/lib/obligation-reason-text.js +1 -1
  41. package/dist/shared/lib/quick-filter-cascade.js +29 -19
  42. package/dist/shared/lib/utils.js +59 -57
  43. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { jsxs as u, jsx as a, Fragment as Se } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as a, Fragment as _e } from "react/jsx-runtime";
2
2
  import { useQueryClient as Br, useQuery as C, useQueries as un } from "@tanstack/react-query";
3
3
  import { Search as Et, Loader2 as ce, PackageCheck as Dr, ChevronRight as mn, Star as dt, AlertTriangle as Be, AlertCircle as dn, X as Lt, Plus as Hr, ChevronDown as Yr } from "lucide-react";
4
4
  import { useState as Y, useRef as pe, useMemo as F, useEffect as xe, Fragment as ot } from "react";
@@ -33,21 +33,21 @@ const cr = (i, m) => {
33
33
  };
34
34
  async function At(i, m, b) {
35
35
  const x = [];
36
- for (let S = 1; S <= 50; S++) {
37
- const s = await i.request(R(m, { ...b, limit: 1e3, page: S })).then((w) => w.data ?? []);
36
+ for (let _ = 1; _ <= 50; _++) {
37
+ const s = await i.request(R(m, { ...b, limit: 1e3, page: _ })).then((w) => w.data ?? []);
38
38
  if (x.push(...s), s.length < 1e3) break;
39
39
  }
40
40
  return x;
41
41
  }
42
42
  function vs(i, m, b, x) {
43
- const S = {}, s = { ...x ?? {} };
43
+ const _ = {}, s = { ...x ?? {} };
44
44
  for (const w of m) {
45
45
  const k = i[w], j = k == null || k === "", v = !j && (x == null ? void 0 : x[w]) !== void 0 && x[w] === String(k);
46
46
  if (!j && !v) continue;
47
- const T = b(w);
48
- T == null || T === "" || !j && String(T) === String(k) || (S[w] = T, s[w] = String(T));
47
+ const O = b(w);
48
+ O == null || O === "" || !j && String(O) === String(k) || (_[w] = O, s[w] = String(O));
49
49
  }
50
- return Object.keys(S).length > 0 ? { updates: S, auto: s } : null;
50
+ return Object.keys(_).length > 0 ? { updates: _, auto: s } : null;
51
51
  }
52
52
  function bn(i, m = /* @__PURE__ */ new Set()) {
53
53
  if (typeof i == "string" && i.startsWith("$parent.")) m.add(i.slice(8));
@@ -59,12 +59,12 @@ function bn(i, m = /* @__PURE__ */ new Set()) {
59
59
  function De(i, m) {
60
60
  const b = {};
61
61
  let x = !1;
62
- const S = (s) => {
62
+ const _ = (s) => {
63
63
  if (typeof s == "string" && s.startsWith("$parent.")) {
64
64
  const w = m == null ? void 0 : m[s.slice(8)];
65
65
  return w == null || w === "" ? (x = !0, s) : w;
66
66
  }
67
- return Array.isArray(s) ? s.map(S) : s && typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([w, k]) => [w, S(k)])) : s;
67
+ return Array.isArray(s) ? s.map(_) : s && typeof s == "object" ? Object.fromEntries(Object.entries(s).map(([w, k]) => [w, _(k)])) : s;
68
68
  };
69
69
  for (const [s, w] of Object.entries(i ?? {}))
70
70
  if (typeof w == "string" && w.startsWith("$parent.")) {
@@ -74,13 +74,13 @@ function De(i, m) {
74
74
  continue;
75
75
  }
76
76
  b[s] = { _eq: k };
77
- } else w && typeof w == "object" ? b[s] = S(w) : b[s] = { _eq: w };
77
+ } else w && typeof w == "object" ? b[s] = _(w) : b[s] = { _eq: w };
78
78
  return x ? null : b;
79
79
  }
80
80
  function ir(i, m) {
81
81
  if (!i) return !0;
82
82
  for (const [b, x] of Object.entries(i)) {
83
- const S = m == null ? void 0 : m[b], s = S == null ? null : String(S), w = x && typeof x == "object" ? x : { _eq: x };
83
+ const _ = m == null ? void 0 : m[b], s = _ == null ? null : String(_), w = x && typeof x == "object" ? x : { _eq: x };
84
84
  for (const [k, j] of Object.entries(w))
85
85
  switch (k) {
86
86
  case "_eq":
@@ -107,8 +107,8 @@ function ir(i, m) {
107
107
  }
108
108
  return !0;
109
109
  }
110
- const _s = 2e3;
111
- function Ss(i, m) {
110
+ const Ss = 2e3;
111
+ function _s(i, m) {
112
112
  if (/e/i.test(i.trim())) return "Type the quantity in full digits";
113
113
  const b = Number(i);
114
114
  if (Pt(m) && i.trim() !== "" && !Number.isNaN(b) && !Number.isInteger(b))
@@ -117,9 +117,9 @@ function Ss(i, m) {
117
117
  return x.ok ? null : x.message;
118
118
  }
119
119
  function qs(i, m, b) {
120
- const x = i.reduce((S, s) => {
120
+ const x = i.reduce((_, s) => {
121
121
  const w = s[m], k = w != null && w !== "" ? w : b != null && b[m] ? Pe(b[m], s) : null, j = Number(k);
122
- return S + (k != null && Number.isFinite(j) ? j : 0);
122
+ return _ + (k != null && Number.isFinite(j) ? j : 0);
123
123
  }, 0);
124
124
  return Math.round(x * 1e6) / 1e6;
125
125
  }
@@ -130,13 +130,13 @@ function $s(i, m) {
130
130
  function js(i) {
131
131
  const m = { ...i.probe };
132
132
  for (const [b, x] of Object.entries(i.compute)) {
133
- const S = Pe(x, m);
134
- if (S === null) continue;
135
- m[b] = S;
136
- const s = i.ruleError(b, S, m);
133
+ const _ = Pe(x, m);
134
+ if (_ === null) continue;
135
+ m[b] = _;
136
+ const s = i.ruleError(b, _, m);
137
137
  if (s) return s;
138
- if (Math.abs(S) > ys)
139
- return `${i.labelOf(b)} would be ${S.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
138
+ if (Math.abs(_) > ys)
139
+ return `${i.labelOf(b)} would be ${_.toLocaleString(void 0, { maximumFractionDigits: 2 })} — too large to save`;
140
140
  }
141
141
  return null;
142
142
  }
@@ -145,15 +145,15 @@ function Fs(i) {
145
145
  for (const b of m)
146
146
  for (const x of i.related ?? []) {
147
147
  if (x.copy_to !== b) continue;
148
- const S = i.lookup(x.key);
149
- if (S != null && S !== "") return S;
148
+ const _ = i.lookup(x.key);
149
+ if (_ != null && _ !== "") return _;
150
150
  }
151
151
  return i.catalogValue;
152
152
  }
153
- function Ts(i, m) {
153
+ function Os(i, m) {
154
154
  return i.map((b) => [b.id, ...m.map((x) => b[x])].map((x) => String(x ?? "")).join("")).join("");
155
155
  }
156
- function Os(i) {
156
+ function Ts(i) {
157
157
  const m = Object.keys(i).filter((x) => i[x].kind === "error");
158
158
  if (m.length === 0) return i;
159
159
  const b = { ...i };
@@ -163,9 +163,9 @@ function Os(i) {
163
163
  function Rs(i, m, b) {
164
164
  const x = Number(i[m]);
165
165
  if (!Number.isFinite(x) || x <= 0) return !1;
166
- const S = b.find((w) => w in i);
167
- if (!S) return !1;
168
- const s = i[S];
166
+ const _ = b.find((w) => w in i);
167
+ if (!_) return !1;
168
+ const s = i[_];
169
169
  return s == null || s === "" || Number(s) === 0;
170
170
  }
171
171
  function da({
@@ -173,12 +173,12 @@ function da({
173
173
  manyField: m,
174
174
  parentId: b,
175
175
  parentCollection: x,
176
- field: S,
176
+ field: _,
177
177
  config: s,
178
178
  readOnly: w = !1
179
179
  }) {
180
- var Un, Bn, Dn, Hn, Yn, Zn, Gn, Xn;
181
- const k = Kt(), j = Br(), v = ks(), T = Gr(), ye = Xr(), Z = s.editable_fields ?? [], G = s.catalog_locked_fields ?? [], { isAdmin: Ae } = nr(), P = b === "new", qe = x && !P ? `?parent_collection=${encodeURIComponent(x)}&parent_id=${encodeURIComponent(b)}` : "", J = s.qty_field ?? "quantity", [fe, $e] = Y(/* @__PURE__ */ new Set()), je = pe(!1), [X, ge] = Y(""), [ke, le] = Y({}), [ie, V] = Y(/* @__PURE__ */ new Set()), [oe, de] = Y({}), [he, Ee] = Y({}), { data: $ = [], isPending: W } = C({
180
+ var Mn, Bn, Dn, Hn, Yn, Zn, Gn, Xn;
181
+ const k = Kt(), j = Br(), v = ks(), O = Gr(), ye = Xr(), Z = s.editable_fields ?? [], G = s.catalog_locked_fields ?? [], { isAdmin: Ae } = nr(), P = b === "new", qe = x && !P ? `?parent_collection=${encodeURIComponent(x)}&parent_id=${encodeURIComponent(b)}` : "", J = s.qty_field ?? "quantity", [fe, $e] = Y(/* @__PURE__ */ new Set()), je = pe(!1), [X, ge] = Y(""), [ke, le] = Y({}), [ie, V] = Y(/* @__PURE__ */ new Set()), [oe, de] = Y({}), [he, Ee] = Y({}), { data: $ = [], isPending: W } = C({
182
182
  queryKey: ["collection-relations", i],
183
183
  queryFn: () => k.request(R(`/collections/${i}`)).then((e) => {
184
184
  var t;
@@ -197,7 +197,7 @@ function da({
197
197
  queryKey: ["field-config", i, null],
198
198
  queryFn: () => k.request(R(`/field-config/${i}`)).then((e) => e.data ?? []),
199
199
  staleTime: 6e4
200
- }), M = ((Un = te.find((e) => e.field === J)) == null ? void 0 : Un.type) ?? null, U = (e, t, n) => {
200
+ }), U = ((Mn = te.find((e) => e.field === J)) == null ? void 0 : Mn.type) ?? null, M = (e, t, n) => {
201
201
  var r;
202
202
  return ((r = xs(
203
203
  te.filter((l) => l.field === e).map((l) => ({
@@ -209,17 +209,17 @@ function da({
209
209
  { [e]: t },
210
210
  { ...n, [e]: t }
211
211
  )[0]) == null ? void 0 : r.message) ?? null;
212
- }, { data: O } = C({
212
+ }, { data: T } = C({
213
213
  queryKey: ["col-meta", g],
214
214
  queryFn: () => k.request(R(`/collections/${g}`)).then((e) => e.data),
215
215
  enabled: !!g,
216
216
  staleTime: 3e5
217
- }), z = O == null ? void 0 : O.display_template, L = F(() => {
217
+ }), z = T == null ? void 0 : T.display_template, L = F(() => {
218
218
  const e = s.section_by.split(".")[0];
219
- return ((O == null ? void 0 : O.relations) ?? []).find(
219
+ return ((T == null ? void 0 : T.relations) ?? []).find(
220
220
  (t) => t.one_collection === g && t.one_field === e && !!t.junction_field
221
221
  ) ?? null;
222
- }, [O, g, s.section_by]), Fe = (L == null ? void 0 : L.many_collection) ?? null, { data: He = [] } = C({
222
+ }, [T, g, s.section_by]), Fe = (L == null ? void 0 : L.many_collection) ?? null, { data: He = [] } = C({
223
223
  queryKey: ["collection-relations", Fe],
224
224
  queryFn: () => k.request(R(`/collections/${Fe}`)).then((e) => {
225
225
  var t;
@@ -239,7 +239,7 @@ function da({
239
239
  target: n,
240
240
  labelPath: s.section_by.split(".").slice(1).join(".") || "id"
241
241
  } : null;
242
- }, [L, Fe, He, s.section_by]), N = T == null ? void 0 : T.draft, { resolvedFilter: B, resolvedSectionFilter: ne, resolvedLinkFilter: Q, missingParents: ee } = F(() => {
242
+ }, [L, Fe, He, s.section_by]), N = O == null ? void 0 : O.draft, { resolvedFilter: B, resolvedSectionFilter: ne, resolvedLinkFilter: Q, missingParents: ee } = F(() => {
243
243
  const e = [], t = (o) => {
244
244
  if (typeof o == "string" && o.startsWith("$parent.")) {
245
245
  const h = o.slice(8), c = N == null ? void 0 : N[h];
@@ -262,24 +262,24 @@ function da({
262
262
  return B ? { _and: [B, t] } : t;
263
263
  }, [L, ne, Q, B]), A = F(() => {
264
264
  const e = /* @__PURE__ */ new Set(["id"]);
265
- O && !L && e.add(s.section_by);
265
+ T && !L && e.add(s.section_by);
266
266
  for (const t of [...(z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)]) e.add(t[1]);
267
267
  for (const t of Object.values(s.copy_fields ?? {})) e.add(t);
268
268
  for (const t of s.columns ?? []) e.add(t.field);
269
269
  return [...e].join(",");
270
- }, [z, O, L, s.section_by, s.copy_fields, s.columns]), Ke = JSON.stringify(H ?? null), { data: re = [], isLoading: pn } = C(
270
+ }, [z, T, L, s.section_by, s.copy_fields, s.columns]), Ke = JSON.stringify(H ?? null), { data: re = [], isLoading: pn } = C(
271
271
  {
272
272
  queryKey: ["catalog-picker", g, A, Ke],
273
273
  queryFn: () => k.request(
274
274
  R(`/items/${g}`, {
275
- limit: _s,
275
+ limit: Ss,
276
276
  fields: A,
277
277
  ...H ? { filter: JSON.stringify(H) } : {}
278
278
  })
279
279
  ).then((e) => e.data ?? []),
280
280
  // Wait for the catalog meta: a to-many section path both narrows this
281
281
  // read and must stay out of its `fields=`.
282
- enabled: !!g && !!O && ee.length === 0 && (!L || !!d),
282
+ enabled: !!g && !!T && ee.length === 0 && (!L || !!d),
283
283
  staleTime: 6e4
284
284
  }
285
285
  ), ur = JSON.stringify(ne ?? null), { data: ct = [], isLoading: mr } = C({
@@ -343,7 +343,7 @@ function da({
343
343
  enabled: !P,
344
344
  staleTime: 15e3
345
345
  }), Ct = F(
346
- () => Ts(me, [
346
+ () => Os(me, [
347
347
  s.item_field,
348
348
  J,
349
349
  ...Z,
@@ -357,7 +357,7 @@ function da({
357
357
  const t = Object.keys(Jt.current).filter(
358
358
  (n) => Jt.current[n].kind === "error"
359
359
  );
360
- de((n) => Os(n)), Ee((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && le((n) => {
360
+ de((n) => Ts(n)), Ee((n) => Object.keys(n).length === 0 ? n : {}), t.length > 0 && le((n) => {
361
361
  if (!t.some((l) => l in n)) return n;
362
362
  const r = { ...n };
363
363
  for (const l of t) delete r[l];
@@ -402,21 +402,21 @@ function da({
402
402
  ).then((e) => e.data ?? []),
403
403
  enabled: !!g && xt.length > 0,
404
404
  staleTime: 6e4
405
- }), { data: Te = [] } = C({
405
+ }), { data: Oe = [] } = C({
406
406
  queryKey: ["pinned-items", g],
407
407
  queryFn: () => k.request(R(`/pinned/${g}`)).then((e) => e.data ?? []),
408
408
  enabled: !!g && !!s.favorites,
409
409
  staleTime: 6e4
410
- }), zt = F(() => new Set(Te), [Te]), { data: Xe = [] } = C({
411
- queryKey: ["pinned-item-rows", g, A, Te.join(",")],
410
+ }), zt = F(() => new Set(Oe), [Oe]), { data: Xe = [] } = C({
411
+ queryKey: ["pinned-item-rows", g, A, Oe.join(",")],
412
412
  queryFn: () => k.request(
413
413
  R(`/items/${g}`, {
414
- filter: JSON.stringify({ id: { _in: Te } }),
414
+ filter: JSON.stringify({ id: { _in: Oe } }),
415
415
  fields: A,
416
- limit: Te.length
416
+ limit: Oe.length
417
417
  })
418
418
  ).then((e) => e.data ?? []),
419
- enabled: !!g && !!s.favorites && Te.length > 0,
419
+ enabled: !!g && !!s.favorites && Oe.length > 0,
420
420
  staleTime: 6e4
421
421
  }), [yt, kn] = Y(/* @__PURE__ */ new Set());
422
422
  async function wn(e) {
@@ -458,15 +458,15 @@ function da({
458
458
  const e = setTimeout(() => pr(X), 300);
459
459
  return () => clearTimeout(e);
460
460
  }, [X]);
461
- const _n = F(() => {
461
+ const Sn = F(() => {
462
462
  var t;
463
463
  const e = (t = [...(z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : t[1];
464
464
  return e && !e.includes(".") ? e : "id";
465
- }, [z]), { shownSearchFields: Ce, otherSearchFields: Sn } = F(() => {
465
+ }, [z]), { shownSearchFields: Ce, otherSearchFields: _n } = F(() => {
466
466
  const e = new Set(
467
- ((O == null ? void 0 : O.relations) ?? []).filter((r) => r.one_collection === g && r.one_field).map((r) => r.one_field)
467
+ ((T == null ? void 0 : T.relations) ?? []).filter((r) => r.one_collection === g && r.one_field).map((r) => r.one_field)
468
468
  ), t = new Set(
469
- ((O == null ? void 0 : O.fields) ?? []).filter((r) => (r.type === "string" || r.type === "text") && !e.has(r.field)).map((r) => r.field)
469
+ ((T == null ? void 0 : T.fields) ?? []).filter((r) => (r.type === "string" || r.type === "text") && !e.has(r.field)).map((r) => r.field)
470
470
  ), n = /* @__PURE__ */ new Set();
471
471
  for (const r of (z ?? "").matchAll(/\{\{([\w.]+)\}\}/g)) t.has(r[1]) && n.add(r[1]);
472
472
  for (const r of s.columns ?? []) t.has(r.field) && n.add(r.field);
@@ -474,14 +474,14 @@ function da({
474
474
  shownSearchFields: [...n],
475
475
  otherSearchFields: [...t].filter((r) => !n.has(r))
476
476
  };
477
- }, [O, g, z, s.columns]), et = F(() => {
477
+ }, [T, g, z, s.columns]), et = F(() => {
478
478
  const e = s.related_columns ?? [], t = e.findIndex((n) => n.stock === !0);
479
479
  return t !== -1 ? t : e.findIndex((n) => n.key === "on_hand" && n.stock !== !1);
480
- }, [s.related_columns]), se = et === -1 ? null : (s.related_columns ?? [])[et] ?? null, Oe = se ? De(se.match, N) : null, Je = F(() => {
480
+ }, [s.related_columns]), se = et === -1 ? null : (s.related_columns ?? [])[et] ?? null, Te = se ? De(se.match, N) : null, Je = F(() => {
481
481
  for (const e of Object.values((se == null ? void 0 : se.match) ?? {}))
482
482
  if (typeof e == "string" && e.startsWith("$parent.")) return e.slice(8);
483
483
  return null;
484
- }, [se]), qn = Je ? N == null ? void 0 : N[Je] : null, xr = Je ? ((Bn = T == null ? void 0 : T.fieldLabels) == null ? void 0 : Bn[Je]) ?? D(Je) : null, Qe = g ? `nvr:catalog-in-stock:${g}:${i}.${m}` : null, [$n, jn] = Y(!1);
484
+ }, [se]), qn = Je ? N == null ? void 0 : N[Je] : null, xr = Je ? ((Bn = O == null ? void 0 : O.fieldLabels) == null ? void 0 : Bn[Je]) ?? D(Je) : null, Qe = g ? `nvr:catalog-in-stock:${g}:${i}.${m}` : null, [$n, jn] = Y(!1);
485
485
  xe(() => {
486
486
  if (Qe)
487
487
  try {
@@ -495,17 +495,17 @@ function da({
495
495
  e ? localStorage.setItem(Qe, "1") : localStorage.removeItem(Qe);
496
496
  } catch {
497
497
  }
498
- }, ae = !!se && $n && Oe !== null, Wt = F(() => {
498
+ }, ae = !!se && $n && Te !== null, Wt = F(() => {
499
499
  if (!se) return null;
500
- const e = ((O == null ? void 0 : O.relations) ?? []).find(
500
+ const e = ((T == null ? void 0 : T.relations) ?? []).find(
501
501
  (t) => t.many_collection === se.collection && t.many_field === se.item_field && t.one_collection === g && !!t.one_field && !t.junction_field
502
502
  );
503
503
  return (e == null ? void 0 : e.one_field) ?? null;
504
- }, [se, O, g]), Mt = F(
505
- () => ae && Wt && se && Oe ? { [Wt]: { _some: { ...Oe, [se.value_field]: { _gt: 0 } } } } : null,
506
- [ae, Wt, se, Oe]
507
- ), Ut = JSON.stringify(Mt), gt = ae && !Mt ? 100 : 25, Bt = (e, t) => {
508
- const n = [t, Mt].filter(Boolean);
504
+ }, [se, T, g]), Ut = F(
505
+ () => ae && Wt && se && Te ? { [Wt]: { _some: { ...Te, [se.value_field]: { _gt: 0 } } } } : null,
506
+ [ae, Wt, se, Te]
507
+ ), Mt = JSON.stringify(Ut), gt = ae && !Ut ? 100 : 25, Bt = (e, t) => {
508
+ const n = [t, Ut].filter(Boolean);
509
509
  return n.length === 0 ? e : { ...e, filter: JSON.stringify(n.length === 1 ? n[0] : { _and: n }) };
510
510
  }, Dt = nr().userId, kt = s.recent === !1 ? 0 : typeof s.recent == "object" && Number((Dn = s.recent) == null ? void 0 : Dn.days) || 30, Ht = ["user_created", "created_by", "creator"].find(
511
511
  (e) => te.some((t) => t.field === e)
@@ -548,7 +548,7 @@ function da({
548
548
  A,
549
549
  ue,
550
550
  Ce,
551
- Ut,
551
+ Mt,
552
552
  gt
553
553
  ],
554
554
  queryFn: () => k.request(
@@ -560,21 +560,21 @@ function da({
560
560
  search_rank: "1",
561
561
  fields: A,
562
562
  limit: gt,
563
- sort: _n
563
+ sort: Sn
564
564
  })
565
565
  )
566
566
  ).then((e) => e.data ?? []),
567
567
  enabled: Yt && Ce.length > 0,
568
568
  staleTime: 3e4,
569
569
  placeholderData: (e) => e
570
- }), wt = Sn.join(","), { data: Fn = [], isFetching: kr } = C({
570
+ }), wt = _n.join(","), { data: Fn = [], isFetching: kr } = C({
571
571
  queryKey: [
572
572
  "catalog-full-search",
573
573
  g,
574
574
  A,
575
575
  ue,
576
576
  wt,
577
- Ut,
577
+ Mt,
578
578
  gt
579
579
  ],
580
580
  queryFn: () => k.request(
@@ -584,14 +584,14 @@ function da({
584
584
  search: ue,
585
585
  fields: [A, wt].filter(Boolean).join(","),
586
586
  limit: gt,
587
- sort: _n
587
+ sort: Sn
588
588
  })
589
589
  )
590
590
  ).then((e) => e.data ?? []),
591
591
  enabled: Yt,
592
592
  staleTime: 3e4,
593
593
  placeholderData: (e) => e
594
- }), wr = nt.join(","), { data: Tn = [] } = C({
594
+ }), wr = nt.join(","), { data: On = [] } = C({
595
595
  queryKey: [
596
596
  "catalog-recent-search",
597
597
  g,
@@ -599,7 +599,7 @@ function da({
599
599
  ue,
600
600
  wt,
601
601
  wr,
602
- Ut
602
+ Mt
603
603
  ],
604
604
  queryFn: () => k.request(
605
605
  R(
@@ -622,15 +622,15 @@ function da({
622
622
  () => fs({
623
623
  shown: Zt,
624
624
  other: Fn,
625
- recent: Tn,
625
+ recent: On,
626
626
  shownFields: Ce,
627
627
  q: ue
628
628
  }),
629
- [Zt, Fn, Tn, Ce, ue]
629
+ [Zt, Fn, On, Ce, ue]
630
630
  ), Nr = (e) => {
631
631
  if (Ce.length === 0 || Zt.some((n) => String(n.id) === String(e.id)) || hs(e, Ce, ue)) return null;
632
632
  const t = rs(ue);
633
- for (const n of Sn) {
633
+ for (const n of _n) {
634
634
  const r = e[n];
635
635
  if (r == null || typeof r == "object") continue;
636
636
  const l = String(r);
@@ -642,10 +642,10 @@ function da({
642
642
  const e = /* @__PURE__ */ new Set();
643
643
  for (const t of re) e.add(String(t.id));
644
644
  for (const t of be) e.add(t.key);
645
- for (const t of Te) e.add(t);
645
+ for (const t of Oe) e.add(t);
646
646
  for (const t of Ve) e.add(String(t.id));
647
647
  return [...e];
648
- }, [re, be, Te, Ve]), rt = un({
648
+ }, [re, be, Oe, Ve]), rt = un({
649
649
  queries: (s.related_columns ?? []).map((e) => {
650
650
  const t = De(e.match, N);
651
651
  return {
@@ -658,7 +658,7 @@ function da({
658
658
  ],
659
659
  queryFn: async () => {
660
660
  const n = {};
661
- if (e.count_all && e.aggregate === "sum" && x && S) {
661
+ if (e.count_all && e.aggregate === "sum" && x && _) {
662
662
  const o = {};
663
663
  if (P)
664
664
  for (const h of bn(e.match))
@@ -667,7 +667,7 @@ function da({
667
667
  const c = We.slice(h, h + 200), f = await k.request(
668
668
  R("/catalog-related/count-all", {
669
669
  collection: x,
670
- field: S,
670
+ field: _,
671
671
  key: e.key,
672
672
  record: P ? "new" : b,
673
673
  ...P ? { parent: JSON.stringify(o) } : {},
@@ -692,13 +692,13 @@ function da({
692
692
  })
693
693
  ).then((p) => p.data ?? []);
694
694
  for (const p of f) {
695
- const _ = p[e.item_field];
696
- if (_ != null)
695
+ const S = p[e.item_field];
696
+ if (S != null)
697
697
  if (r) {
698
698
  const q = Number(p[e.value_field]);
699
- n[String(_)] = (Number(n[String(_)]) || 0) + (Number.isNaN(q) ? 0 : q);
699
+ n[String(S)] = (Number(n[String(S)]) || 0) + (Number.isNaN(q) ? 0 : q);
700
700
  } else
701
- n[String(_)] = p[e.value_field];
701
+ n[String(S)] = p[e.value_field];
702
702
  }
703
703
  if (!r || f.length < 1e3) break;
704
704
  c += 1;
@@ -715,15 +715,15 @@ function da({
715
715
  const n = (s.related_columns ?? []).findIndex((o) => o.key === e);
716
716
  if (n !== -1)
717
717
  return (l = (r = rt[n]) == null ? void 0 : r.data) == null ? void 0 : l[t];
718
- }, at = et === -1 || (Hn = rt[et]) == null ? void 0 : Hn.data, vr = ae && !!((Yn = rt[et]) != null && Yn.isFetching), On = (e) => {
718
+ }, at = et === -1 || (Hn = rt[et]) == null ? void 0 : Hn.data, vr = ae && !!((Yn = rt[et]) != null && Yn.isFetching), Tn = (e) => {
719
719
  if (!ae || at === void 0) return !0;
720
720
  const t = Number(at[e]);
721
721
  return Number.isFinite(t) && t > 0;
722
- }, it = ae ? Ve.filter((e) => On(String(e.id))) : Ve, Xt = ae ? Xe.filter((e) => On(String(e.id))) : Xe, en = (e) => {
722
+ }, it = ae ? Ve.filter((e) => Tn(String(e.id))) : Ve, Xt = ae ? Xe.filter((e) => Tn(String(e.id))) : Xe, en = (e) => {
723
723
  var c;
724
724
  const t = s.qty_warning;
725
725
  if (!t) return null;
726
- const n = _e(e) ?? 0;
726
+ const n = Se(e) ?? 0;
727
727
  if (n <= 0) return null;
728
728
  const r = (s.related_columns ?? []).findIndex((f) => f.key === t.column);
729
729
  if (r === -1) return null;
@@ -731,7 +731,7 @@ function da({
731
731
  if (l === void 0) return null;
732
732
  const o = l[e], h = o == null || o === "" ? 0 : Number(o);
733
733
  return Number.isNaN(h) ? null : n > h ? { available: h, qty: n } : null;
734
- }, _r = (e) => {
734
+ }, Sr = (e) => {
735
735
  const t = s.row_flags ?? [];
736
736
  if (t.length === 0) return [];
737
737
  const n = [];
@@ -746,7 +746,7 @@ function da({
746
746
  }, tn = s.qty_warning ? s.qty_warning.label ?? ((Zn = (s.related_columns ?? []).find((e) => {
747
747
  var t;
748
748
  return e.key === ((t = s.qty_warning) == null ? void 0 : t.column);
749
- })) == null ? void 0 : Zn.label) ?? D(s.qty_warning.column) : "", Sr = !!s.submission_errors, Nt = F(
749
+ })) == null ? void 0 : Zn.label) ?? D(s.qty_warning.column) : "", _r = !!s.submission_errors, Nt = F(
750
750
  () => {
751
751
  var e;
752
752
  return typeof s.submission_errors == "object" && Array.isArray((e = s.submission_errors) == null ? void 0 : e.match_fields) ? s.submission_errors.match_fields.filter((t) => /^[A-Za-z_][A-Za-z0-9_]*$/.test(t)) : [];
@@ -755,7 +755,7 @@ function da({
755
755
  ), qr = ns(6e4), { data: Rn } = C({
756
756
  queryKey: ["erp-submissions", x ?? "", String(b)],
757
757
  queryFn: () => k.request(R(`/erp-submissions/${x}/${encodeURIComponent(b)}`)).then((e) => e.data ?? []),
758
- enabled: Sr && !P && !!x,
758
+ enabled: _r && !P && !!x,
759
759
  staleTime: 15e3,
760
760
  refetchInterval: qr
761
761
  }), nn = F(() => {
@@ -787,7 +787,7 @@ function da({
787
787
  })
788
788
  ].filter((r) => !!r).map(ls);
789
789
  return nn.reasonFor(n);
790
- }, vt = s.summary_fields ?? [], Fr = me.map((e) => String(e.id)).join(","), Tr = un({
790
+ }, vt = s.summary_fields ?? [], Fr = me.map((e) => String(e.id)).join(","), Or = un({
791
791
  queries: vt.filter((e) => e.m2m).map((e) => ({
792
792
  queryKey: ["catalog-summary-m2m", e.field, e.m2m.junction, Fr],
793
793
  queryFn: async () => {
@@ -807,22 +807,22 @@ function da({
807
807
  })
808
808
  ).then((p) => p.data ?? []).catch(() => []) : [], c = new Map(h.map((p) => [String(p.id), String(p[o] ?? p.id)])), f = {};
809
809
  for (const p of r) {
810
- const _ = String(p[n.fk_to_child]), q = c.get(String(p[n.related_field]));
811
- q && (f[_] = f[_] ? `${f[_]}, ${q}` : q);
810
+ const S = String(p[n.fk_to_child]), q = c.get(String(p[n.related_field]));
811
+ q && (f[S] = f[S] ? `${f[S]}, ${q}` : q);
812
812
  }
813
813
  return f;
814
814
  },
815
815
  enabled: !P && me.length > 0,
816
816
  staleTime: 15e3
817
817
  }))
818
- }), Or = (e, t) => {
818
+ }), Tr = (e, t) => {
819
819
  var l, o;
820
820
  if (!e.m2m) return t.row[e.field];
821
821
  const n = vt.filter((h) => h.m2m).findIndex((h) => h.field === e.field);
822
822
  if (n === -1) return;
823
823
  const r = t.row.id;
824
824
  if (r != null)
825
- return (o = (l = Tr[n]) == null ? void 0 : l.data) == null ? void 0 : o[String(r)];
825
+ return (o = (l = Or[n]) == null ? void 0 : l.data) == null ? void 0 : o[String(r)];
826
826
  }, Rr = !!((Gn = s.fulfilment) != null && Gn.shipped_field) && (s.fulfilment.show_when ? ir(s.fulfilment.show_when, N) : !0), Pr = (e) => {
827
827
  if (!Rr || !s.fulfilment) return null;
828
828
  const t = Number(e[s.fulfilment.qty_field ?? J] ?? 0) || 0, n = Number(e[s.fulfilment.shipped_field] ?? 0) || 0, r = t > 0 && n >= t ? {
@@ -836,13 +836,15 @@ function da({
836
836
  } : {
837
837
  dot: "bg-slate-300 dark:bg-slate-600",
838
838
  text: "text-slate-500 dark:text-slate-400",
839
- label: "Requested"
839
+ // The header's ORDER STATUS word for the same order (army 11 a2 F8).
840
+ label: s.fulfilment.pending_label ?? "Order Sent",
841
+ key: "requested"
840
842
  };
841
843
  return /* @__PURE__ */ u(
842
844
  "span",
843
845
  {
844
846
  className: "inline-flex items-center gap-1.5 whitespace-nowrap",
845
- "data-catalog-fulfilment": r.label.split(" ")[0].toLowerCase(),
847
+ "data-catalog-fulfilment": "key" in r ? r.key : r.label.split(" ")[0].toLowerCase(),
846
848
  title: `${s.fulfilment.label ?? "Warehouse"} · ${n} of ${t} shipped`,
847
849
  children: [
848
850
  /* @__PURE__ */ a("span", { "aria-hidden": !0, className: `h-1.5 w-1.5 rounded-full ${r.dot}` }),
@@ -850,7 +852,7 @@ function da({
850
852
  ]
851
853
  }
852
854
  );
853
- }, Pn = s.columns ?? [], En = s.related_columns ?? [], _t = Pn.filter((e) => !e.summary_only), sn = En.filter((e) => !e.summary_only), Ln = Pn.filter((e) => !e.sections_only), An = En.filter((e) => !e.sections_only), Kn = _t.length > 0 || sn.length > 0, an = pe(null), Cn = (e) => {
855
+ }, Pn = s.columns ?? [], En = s.related_columns ?? [], St = Pn.filter((e) => !e.summary_only), sn = En.filter((e) => !e.summary_only), Ln = Pn.filter((e) => !e.sections_only), An = En.filter((e) => !e.sections_only), Kn = St.length > 0 || sn.length > 0, an = pe(null), Cn = (e) => {
854
856
  let t = e.parentElement;
855
857
  for (; t; ) {
856
858
  const n = getComputedStyle(t);
@@ -874,7 +876,7 @@ function da({
874
876
  e && cancelAnimationFrame(e), window.removeEventListener("scroll", t, !0);
875
877
  };
876
878
  }, []);
877
- const St = (e, t) => {
879
+ const _t = (e, t) => {
878
880
  let n = e;
879
881
  for (const r of t.split(".")) {
880
882
  if (n == null || typeof n != "object") return;
@@ -903,8 +905,8 @@ function da({
903
905
  }
904
906
  )
905
907
  ] }, t);
906
- }, Ar = (Xn = _t.find((e) => !e.format)) == null ? void 0 : Xn.field, In = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Ar ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], ln = (e, t, n) => /* @__PURE__ */ u(Se, { children: [
907
- _t.map((r) => {
908
+ }, Ar = (Xn = St.find((e) => !e.format)) == null ? void 0 : Xn.field, In = (e) => e.format ? ["w-20 shrink-0", "text-right"] : e.field === Ar ? ["min-w-0 flex-[3]", ""] : ["w-36 shrink-0", ""], ln = (e, t, n) => /* @__PURE__ */ u(_e, { children: [
909
+ St.map((r) => {
908
910
  const [l, o] = In(r);
909
911
  return /* @__PURE__ */ a(
910
912
  lr,
@@ -912,7 +914,7 @@ function da({
912
914
  text: Ne(
913
915
  Fs({
914
916
  field: r.field,
915
- catalogValue: St(t, r.field),
917
+ catalogValue: _t(t, r.field),
916
918
  copyFields: s.copy_fields,
917
919
  related: s.related_columns,
918
920
  lookup: (h) => st(h, e)
@@ -978,7 +980,7 @@ function da({
978
980
  }),
979
981
  [i, s.item_field]
980
982
  );
981
- const Ie = (e) => mt.get(e) ?? It.find((t) => String(t.id) === e) ?? Xe.find((t) => String(t.id) === e) ?? { id: e }, _e = (e) => {
983
+ const Ie = (e) => mt.get(e) ?? It.find((t) => String(t.id) === e) ?? Xe.find((t) => String(t.id) === e) ?? { id: e }, Se = (e) => {
982
984
  var r;
983
985
  const t = P ? void 0 : Ge.get(e);
984
986
  if (t) return bt.has(String(t.id)) ? null : Number(t[J] ?? 0);
@@ -1026,7 +1028,7 @@ function da({
1026
1028
  je.current = !0;
1027
1029
  const e = /* @__PURE__ */ new Set();
1028
1030
  for (const t of Ft)
1029
- t.items.some((r) => (_e(r.id) ?? 0) > 0) || e.add(t.name);
1031
+ t.items.some((r) => (Se(r.id) ?? 0) > 0) || e.add(t.name);
1030
1032
  $e(e);
1031
1033
  }
1032
1034
  async function Jr(e) {
@@ -1062,28 +1064,28 @@ function da({
1062
1064
  }
1063
1065
  const n = (r = s.copy_fields) == null ? void 0 : r[t];
1064
1066
  return n ? Ie(e)[n] : void 0;
1065
- }, Mn = pe(/* @__PURE__ */ new Map()), Tt = F(() => {
1067
+ }, Un = pe(/* @__PURE__ */ new Map()), Ot = F(() => {
1066
1068
  const e = new Set(Object.keys(s.copy_fields ?? {}));
1067
1069
  for (const t of s.related_columns ?? []) t.copy_to && e.add(t.copy_to);
1068
1070
  return [...e];
1069
1071
  }, [s.copy_fields, s.related_columns]), Ir = JSON.stringify([
1070
- we.map((e) => [e[s.item_field], ...Tt.map((t) => e[t] ?? null)]),
1072
+ we.map((e) => [e[s.item_field], ...Ot.map((t) => e[t] ?? null)]),
1071
1073
  rt.map((e) => e.dataUpdatedAt),
1072
1074
  re.length,
1073
1075
  It.length
1074
1076
  ]);
1075
1077
  xe(() => {
1076
- w || !v || Tt.length === 0 || we.forEach((e, t) => {
1078
+ w || !v || Ot.length === 0 || we.forEach((e, t) => {
1077
1079
  const n = e[s.item_field];
1078
1080
  if (n == null) return;
1079
1081
  const r = vs(
1080
1082
  e,
1081
- Tt,
1083
+ Ot,
1082
1084
  (o) => Wn(String(n), o),
1083
- Mn.current.get(String(n))
1085
+ Un.current.get(String(n))
1084
1086
  );
1085
1087
  if (!r) return;
1086
- Mn.current.set(String(n), r.auto);
1088
+ Un.current.set(String(n), r.auto);
1087
1089
  const l = { ...e, ...r.updates };
1088
1090
  for (const [o, h] of Object.entries(s.compute_fields ?? {})) {
1089
1091
  const c = Pe(h, l);
@@ -1091,14 +1093,14 @@ function da({
1091
1093
  }
1092
1094
  v.updateRow(i, m, t, l);
1093
1095
  });
1094
- }, [Ir, w, Tt]);
1096
+ }, [Ir, w, Ot]);
1095
1097
  const zr = (e, t) => {
1096
1098
  if (w || !Z.includes(t)) return !1;
1097
1099
  if (Ae || !G.includes(t)) return !0;
1098
1100
  const n = Wn(e, t);
1099
1101
  return n == null || n === "" || !(Number(n) > 0);
1100
1102
  };
1101
- function Me(e, t, n, r = {}) {
1103
+ function Ue(e, t, n, r = {}) {
1102
1104
  const l = {
1103
1105
  [s.item_field]: n.id ?? e,
1104
1106
  [J]: t
@@ -1115,8 +1117,8 @@ function da({
1115
1117
  function Qr(e, t, n, r) {
1116
1118
  return js({
1117
1119
  compute: s.compute_fields ?? {},
1118
- probe: { ...Me(e, t, n), ...r, [J]: t },
1119
- ruleError: U,
1120
+ probe: { ...Ue(e, t, n), ...r, [J]: t },
1121
+ ruleError: M,
1120
1122
  labelOf: (l) => {
1121
1123
  var o;
1122
1124
  return ((o = te.find((h) => h.field === l)) == null ? void 0 : o.label) || D(l);
@@ -1124,21 +1126,21 @@ function da({
1124
1126
  });
1125
1127
  }
1126
1128
  async function lt(e, t, n, r = {}) {
1127
- const l = hn(t, { type: M, min: 0, label: "Quantity" });
1129
+ const l = hn(t, { type: U, min: 0, label: "Quantity" });
1128
1130
  if (!l.ok) {
1129
1131
  de((f) => ({ ...f, [e]: { kind: "error", message: l.message } }));
1130
1132
  return;
1131
1133
  }
1132
1134
  const o = l.value ?? 0;
1133
- if ((_e(e) ?? 0) === o) return;
1135
+ if ((Se(e) ?? 0) === o) return;
1134
1136
  if (o === 0 && !r.confirmedRemove) {
1135
1137
  de((f) => ({ ...f, [e]: { kind: "remove", row: n } }));
1136
1138
  return;
1137
1139
  }
1138
1140
  if (o > 0) {
1139
- const f = pt.get(e), p = (P ? void 0 : Ge.get(e)) ?? (f !== void 0 ? we[f] : void 0) ?? {}, _ = U(J, o, p) ?? Qr(e, o, n, p);
1140
- if (_) {
1141
- de((q) => ({ ...q, [e]: { kind: "error", message: _ } }));
1141
+ const f = pt.get(e), p = (P ? void 0 : Ge.get(e)) ?? (f !== void 0 ? we[f] : void 0) ?? {}, S = M(J, o, p) ?? Qr(e, o, n, p);
1142
+ if (S) {
1143
+ de((q) => ({ ...q, [e]: { kind: "error", message: S } }));
1142
1144
  return;
1143
1145
  }
1144
1146
  }
@@ -1152,15 +1154,15 @@ function da({
1152
1154
  return;
1153
1155
  }
1154
1156
  bt.has(p) && v.cancelPendingDelete(i, m, p);
1155
- const _ = Me(e, o, n, c);
1157
+ const S = Ue(e, o, n, c);
1156
1158
  for (const y of Z)
1157
- f[y] != null && f[y] !== "" && (_[y] = f[y]);
1159
+ f[y] != null && f[y] !== "" && (S[y] = f[y]);
1158
1160
  for (const [y, K] of Object.entries(s.compute_fields ?? {})) {
1159
- const Re = Pe(K, { ...f, ..._ });
1160
- Re !== null && (_[y] = Re);
1161
+ const Re = Pe(K, { ...f, ...S });
1162
+ Re !== null && (S[y] = Re);
1161
1163
  }
1162
1164
  const q = me.find((y) => String(y.id) === p) ?? {}, E = Object.fromEntries(
1163
- Object.entries(_).filter(([y, K]) => String(K ?? "") !== String(q[y] ?? ""))
1165
+ Object.entries(S).filter(([y, K]) => String(K ?? "") !== String(q[y] ?? ""))
1164
1166
  );
1165
1167
  Object.keys(E).length === 0 ? v.cancelPendingEdit(i, m, p) : (v.cancelPendingEdit(i, m, p), v.queueEdit(i, m, p, E));
1166
1168
  return;
@@ -1174,14 +1176,14 @@ function da({
1174
1176
  f,
1175
1177
  bs(
1176
1178
  we[f],
1177
- Me(e, o, n, c),
1179
+ Ue(e, o, n, c),
1178
1180
  Z,
1179
1181
  s.compute_fields
1180
1182
  )
1181
1183
  ) : v == null || v.queueRow(
1182
1184
  i,
1183
1185
  m,
1184
- Me(e, o, n, c)
1186
+ Ue(e, o, n, c)
1185
1187
  );
1186
1188
  return;
1187
1189
  }
@@ -1191,20 +1193,20 @@ function da({
1191
1193
  if (o === 0)
1192
1194
  (f == null ? void 0 : f.id) != null && await k.request(es(`/items/${i}/${f.id}${qe}`));
1193
1195
  else if ((f == null ? void 0 : f.id) != null) {
1194
- const p = Me(e, o, n, c);
1196
+ const p = Ue(e, o, n, c);
1195
1197
  for (const y of Z)
1196
1198
  f[y] != null && f[y] !== "" && (p[y] = f[y]);
1197
1199
  for (const [y, K] of Object.entries(s.compute_fields ?? {})) {
1198
1200
  const Re = Pe(K, { ...f, ...p });
1199
1201
  Re !== null && (p[y] = Re);
1200
1202
  }
1201
- const _ = { ...f, ...p }, { id: q, ...E } = _;
1203
+ const S = { ...f, ...p }, { id: q, ...E } = S;
1202
1204
  await k.request(rr(`/items/${i}/${f.id}${qe}`, E));
1203
1205
  } else
1204
1206
  await k.request(
1205
1207
  sr(`/items/${i}${qe}`, {
1206
1208
  [m]: b,
1207
- ...Me(e, o, n, c)
1209
+ ...Ue(e, o, n, c)
1208
1210
  })
1209
1211
  );
1210
1212
  j.invalidateQueries({ queryKey: ["o2m-rows", i, m, b] });
@@ -1222,8 +1224,8 @@ function da({
1222
1224
  const l = (h) => {
1223
1225
  const c = { ...h, [t]: r };
1224
1226
  for (const [f, p] of Object.entries(s.compute_fields ?? {})) {
1225
- const _ = Pe(p, c);
1226
- _ !== null && (c[f] = _);
1227
+ const S = Pe(p, c);
1228
+ S !== null && (c[f] = S);
1227
1229
  }
1228
1230
  return c;
1229
1231
  }, o = P ? void 0 : Ge.get(e);
@@ -1236,7 +1238,7 @@ function da({
1236
1238
  if (Ze && v) {
1237
1239
  const h = l(o), c = me.find((p) => String(p.id) === String(o.id)) ?? {}, f = Object.fromEntries(
1238
1240
  Object.entries(h).filter(
1239
- ([p, _]) => p !== "id" && String(_ ?? "") !== String(c[p] ?? "")
1241
+ ([p, S]) => p !== "id" && String(S ?? "") !== String(c[p] ?? "")
1240
1242
  )
1241
1243
  );
1242
1244
  v.cancelPendingEdit(i, m, String(o.id)), Object.keys(f).length > 0 && v.queueEdit(i, m, String(o.id), f);
@@ -1268,13 +1270,13 @@ function da({
1268
1270
  var h;
1269
1271
  return ((h = o.data) == null ? void 0 : h[0]) ?? { id: e };
1270
1272
  }).catch(() => ({ id: e })));
1271
- const l = (_e(t) ?? 0) + 1;
1273
+ const l = (Se(t) ?? 0) + 1;
1272
1274
  await lt(t, String(l), r);
1273
1275
  }
1274
- const Mr = be.length, Ot = Object.keys(s.copy_fields ?? {}), Ue = Object.keys(s.compute_fields ?? {}), Rt = (e, t) => {
1275
- const n = _e(e);
1276
+ const Ur = be.length, Tt = Object.keys(s.copy_fields ?? {}), Me = Object.keys(s.compute_fields ?? {}), Rt = (e, t) => {
1277
+ const n = Se(e);
1276
1278
  if (w)
1277
- return /* @__PURE__ */ a("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: n && n > 0 ? n : "—" });
1279
+ return /* @__PURE__ */ a("span", { className: "inline-block w-20 shrink-0 text-right tabular-nums text-slate-700 dark:text-slate-200", children: n && n > 0 ? n.toLocaleString("en-US") : "—" });
1278
1280
  const r = ke[e], l = r !== void 0 ? r : n && n > 0 ? String(n) : "", o = oe[e], h = () => de((f) => {
1279
1281
  if (!(e in f)) return f;
1280
1282
  const p = { ...f };
@@ -1284,7 +1286,7 @@ function da({
1284
1286
  {
1285
1287
  type: "number",
1286
1288
  min: 0,
1287
- step: Pt(M) ? 1 : "any",
1289
+ step: Pt(U) ? 1 : "any",
1288
1290
  disabled: w,
1289
1291
  value: l,
1290
1292
  placeholder: "0",
@@ -1292,14 +1294,14 @@ function da({
1292
1294
  onFocus: h,
1293
1295
  onChange: (f) => le((p) => ({ ...p, [e]: f.target.value })),
1294
1296
  onBlur: (f) => {
1295
- const p = f.target.value, _ = Ss(p, M);
1296
- if (_) {
1297
+ const p = f.target.value, S = _s(p, U);
1298
+ if (S) {
1297
1299
  le((q) => {
1298
1300
  const E = { ...q };
1299
1301
  return delete E[e], E;
1300
1302
  }), de((q) => ({
1301
1303
  ...q,
1302
- [e]: { kind: "error", message: $s(_, p) }
1304
+ [e]: { kind: "error", message: $s(S, p) }
1303
1305
  }));
1304
1306
  return;
1305
1307
  }
@@ -1365,11 +1367,11 @@ function da({
1365
1367
  }
1366
1368
  )
1367
1369
  ] });
1368
- }, Ur = (e, t, n) => {
1370
+ }, Mr = (e, t, n) => {
1369
1371
  const r = `${e}:${t}`, l = he[r], o = () => Ee((p) => {
1370
1372
  if (!(r in p)) return p;
1371
- const _ = { ...p };
1372
- return delete _[r], _;
1373
+ const S = { ...p };
1374
+ return delete S[r], S;
1373
1375
  }), h = n[t] == null ? "" : String(n[t]), c = te.find((p) => p.field === t), f = !Pt(c == null ? void 0 : c.type);
1374
1376
  return /* @__PURE__ */ u("span", { className: "inline-flex shrink-0 flex-col items-end", children: [
1375
1377
  /* @__PURE__ */ a(
@@ -1382,15 +1384,15 @@ function da({
1382
1384
  "aria-invalid": !!l || void 0,
1383
1385
  onFocus: o,
1384
1386
  onBlur: (p) => {
1385
- const _ = p.target.value;
1386
- if (_ !== h) {
1387
- const q = c, E = (q == null ? void 0 : q.label) || D(t), y = hn(_, { type: q == null ? void 0 : q.type, label: E }), K = y.ok ? (f ? ps(_, E) : null) ?? U(t, y.value, n) : y.message;
1387
+ const S = p.target.value;
1388
+ if (S !== h) {
1389
+ const q = c, E = (q == null ? void 0 : q.label) || D(t), y = hn(S, { type: q == null ? void 0 : q.type, label: E }), K = y.ok ? (f ? ps(S, E) : null) ?? M(t, y.value, n) : y.message;
1388
1390
  if (K) {
1389
1391
  p.target.value = h, Ee((Re) => ({ ...Re, [r]: K }));
1390
1392
  return;
1391
1393
  }
1392
1394
  }
1393
- Vr(e, t, _);
1395
+ Vr(e, t, S);
1394
1396
  },
1395
1397
  onKeyDown: (p) => {
1396
1398
  p.key === "Enter" && p.currentTarget.blur();
@@ -1421,7 +1423,7 @@ function da({
1421
1423
  /* @__PURE__ */ a("div", { className: "h-8 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
1422
1424
  /* @__PURE__ */ a("div", { className: "h-8 w-2/3 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
1423
1425
  ] }) : g ? /* @__PURE__ */ u("div", { ref: Jn, className: "space-y-3", children: [
1424
- !w && /* @__PURE__ */ u(Se, { children: [
1426
+ !w && /* @__PURE__ */ u(_e, { children: [
1425
1427
  /* @__PURE__ */ u("div", { className: "rounded-lg border border-slate-200 text-[12px] dark:border-border", children: [
1426
1428
  /* @__PURE__ */ u("div", { className: "flex items-center gap-2 border-b border-slate-200 px-3 py-2 dark:border-border", children: [
1427
1429
  /* @__PURE__ */ a(Et, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
@@ -1439,12 +1441,12 @@ function da({
1439
1441
  {
1440
1442
  type: "button",
1441
1443
  "aria-pressed": ae,
1442
- "aria-disabled": Oe === null ? "true" : void 0,
1444
+ "aria-disabled": Te === null ? "true" : void 0,
1443
1445
  onClick: () => {
1444
- Oe !== null && Vt(!$n);
1446
+ Te !== null && Vt(!$n);
1445
1447
  },
1446
1448
  "data-catalog-in-stock": ae ? "on" : "off",
1447
- "data-tip": Oe === null ? `Choose ${xr ?? "where stock is counted"} to show only items in stock there` : ae ? "Showing only items with stock on hand — click to show everything" : "Show only items with stock on hand",
1449
+ "data-tip": Te === null ? `Choose ${xr ?? "where stock is counted"} to show only items in stock there` : ae ? "Showing only items with stock on hand — click to show everything" : "Show only items with stock on hand",
1448
1450
  className: I(
1449
1451
  "inline-flex h-6 max-w-[220px] shrink-0 items-center gap-1 rounded border px-1.5 text-[11px] font-medium transition-colors duration-150 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan aria-disabled:cursor-not-allowed aria-disabled:opacity-50",
1450
1452
  ae ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-[#00728d] dark:border-nvr-cyan/40 dark:bg-nvr-cyan/15 dark:text-nvr-cyan" : "border-slate-200 bg-white text-slate-600 hover:bg-muted dark:border-border dark:bg-background dark:text-slate-300"
@@ -1453,7 +1455,7 @@ function da({
1453
1455
  vr ? /* @__PURE__ */ a(ce, { className: "h-3 w-3 shrink-0 animate-spin" }) : /* @__PURE__ */ a(Dr, { className: "h-3 w-3 shrink-0" }),
1454
1456
  /* @__PURE__ */ u("span", { className: "truncate", children: [
1455
1457
  "In stock",
1456
- Oe !== null && Je && qn != null && /* @__PURE__ */ u(Se, { children: [
1458
+ Te !== null && Je && qn != null && /* @__PURE__ */ u(_e, { children: [
1457
1459
  " at ",
1458
1460
  /* @__PURE__ */ a(
1459
1461
  Es,
@@ -1468,9 +1470,9 @@ function da({
1468
1470
  ]
1469
1471
  }
1470
1472
  ),
1471
- se && Oe === null && /* @__PURE__ */ a("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
1473
+ se && Te === null && /* @__PURE__ */ a("span", { className: "shrink-0 text-[11px] text-slate-500 dark:text-slate-400", children: "Pick a place first" }),
1472
1474
  /* @__PURE__ */ u("span", { className: "shrink-0 rounded border border-slate-200 bg-slate-50 px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-muted dark:text-slate-400", children: [
1473
- Mr,
1475
+ Ur,
1474
1476
  " picked"
1475
1477
  ] }),
1476
1478
  /* @__PURE__ */ a(cn, { show: Le.customized, onReset: Le.reset })
@@ -1487,7 +1489,7 @@ function da({
1487
1489
  children: [
1488
1490
  s.favorites && /* @__PURE__ */ a("span", { className: "w-[18px] shrink-0" }),
1489
1491
  $t(Le, "item", "Item", "w-36 shrink-0"),
1490
- _t.map((e) => {
1492
+ St.map((e) => {
1491
1493
  const [t, n] = In(e);
1492
1494
  return $t(
1493
1495
  Le,
@@ -1516,7 +1518,7 @@ function da({
1516
1518
  /* @__PURE__ */ a(ce, { className: "h-3.5 w-3.5 animate-spin" }),
1517
1519
  " Searching the catalog…"
1518
1520
  ] }),
1519
- X.trim().length > 0 && it.length === 0 && !Gt && /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-500 dark:text-slate-400", children: ae && Ve.length > 0 ? /* @__PURE__ */ u(Se, { children: [
1521
+ X.trim().length > 0 && it.length === 0 && !Gt && /* @__PURE__ */ a("p", { className: "px-3 py-4 text-center text-slate-500 dark:text-slate-400", children: ae && Ve.length > 0 ? /* @__PURE__ */ u(_e, { children: [
1520
1522
  'Nothing in stock matches "',
1521
1523
  X.trim(),
1522
1524
  '" —',
@@ -1534,7 +1536,7 @@ function da({
1534
1536
  ]
1535
1537
  }
1536
1538
  )
1537
- ] }) : /* @__PURE__ */ u(Se, { children: [
1539
+ ] }) : /* @__PURE__ */ u(_e, { children: [
1538
1540
  'No items match "',
1539
1541
  X.trim(),
1540
1542
  '"'
@@ -1552,7 +1554,7 @@ function da({
1552
1554
  Gt && /* @__PURE__ */ a(ce, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" })
1553
1555
  ] }),
1554
1556
  it.map((e, t) => {
1555
- const n = String(e.id), r = _e(n);
1557
+ const n = String(e.id), r = Se(n);
1556
1558
  return /* @__PURE__ */ u(
1557
1559
  "div",
1558
1560
  {
@@ -1568,7 +1570,7 @@ function da({
1568
1570
  ze(z, e),
1569
1571
  (() => {
1570
1572
  const l = Nr(e), o = yr.has(n);
1571
- return !l && !o ? null : /* @__PURE__ */ u(Se, { children: [
1573
+ return !l && !o ? null : /* @__PURE__ */ u(_e, { children: [
1572
1574
  o && /* @__PURE__ */ a(
1573
1575
  "span",
1574
1576
  {
@@ -1606,7 +1608,7 @@ function da({
1606
1608
  " ",
1607
1609
  ee.map((e) => {
1608
1610
  var t;
1609
- return ((t = T == null ? void 0 : T.fieldLabels) == null ? void 0 : t[e]) ?? D(e);
1611
+ return ((t = O == null ? void 0 : O.fieldLabels) == null ? void 0 : t[e]) ?? D(e);
1610
1612
  }).join(", "),
1611
1613
  " ",
1612
1614
  "to browse by category"
@@ -1615,7 +1617,7 @@ function da({
1615
1617
  /* @__PURE__ */ a(ce, { className: "h-4 w-4 animate-spin" }),
1616
1618
  " Loading catalog…"
1617
1619
  ] }),
1618
- ee.length === 0 && !pn && !ut && Ft.length === 0 && /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-slate-500 dark:text-slate-400", children: ae && re.length > 0 ? /* @__PURE__ */ u(Se, { children: [
1620
+ ee.length === 0 && !pn && !ut && Ft.length === 0 && /* @__PURE__ */ a("p", { className: "px-3 py-6 text-center text-slate-500 dark:text-slate-400", children: ae && re.length > 0 ? /* @__PURE__ */ u(_e, { children: [
1619
1621
  "Nothing in this catalog is in stock here —",
1620
1622
  " ",
1621
1623
  /* @__PURE__ */ u(
@@ -1671,7 +1673,7 @@ function da({
1671
1673
  ] }),
1672
1674
  !fe.has("__favorites__") && Xt.length === 0 && /* @__PURE__ */ a("p", { className: "border-b border-slate-100 px-3 py-2 text-center text-[11px] text-slate-400 dark:border-border/50", children: Xe.length > 0 ? "None of your favorites are in stock here." : "No favorites yet — Manage lets you search the full catalog and star items." }),
1673
1675
  !fe.has("__favorites__") && Xt.map((e, t) => {
1674
- const n = String(e.id), r = _e(n), l = en(n);
1676
+ const n = String(e.id), r = Se(n), l = en(n);
1675
1677
  return /* @__PURE__ */ u(
1676
1678
  "div",
1677
1679
  {
@@ -1701,7 +1703,7 @@ function da({
1701
1703
  ] }),
1702
1704
  ee.length === 0 && Ft.map((e) => {
1703
1705
  const t = fe.has(e.name), n = e.items.reduce(
1704
- (r, l) => r + ((_e(l.id) ?? 0) > 0 ? 1 : 0),
1706
+ (r, l) => r + ((Se(l.id) ?? 0) > 0 ? 1 : 0),
1705
1707
  0
1706
1708
  );
1707
1709
  return /* @__PURE__ */ u(ot, { children: [
@@ -1734,7 +1736,7 @@ function da({
1734
1736
  }
1735
1737
  ),
1736
1738
  !t && e.items.map((r, l) => {
1737
- const o = _e(r.id), h = en(r.id);
1739
+ const o = Se(r.id), h = en(r.id);
1738
1740
  return /* @__PURE__ */ u(
1739
1741
  "div",
1740
1742
  {
@@ -1772,9 +1774,9 @@ function da({
1772
1774
  catalogCol: g,
1773
1775
  catalogFields: A,
1774
1776
  tmpl: z,
1775
- currentQty: _e,
1777
+ currentQty: Se,
1776
1778
  addQty: (t, n, r) => lt(t, String(n), r),
1777
- qtyStep: Pt(M) ? 1 : "any",
1779
+ qtyStep: Pt(U) ? 1 : "any",
1778
1780
  readOnly: w
1779
1781
  },
1780
1782
  e.label
@@ -1833,13 +1835,13 @@ function da({
1833
1835
  }
1834
1836
  )
1835
1837
  ] }),
1836
- Ot.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), h(c)) }, c)),
1838
+ Tt.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), h(c)) }, c)),
1837
1839
  o(D(J)),
1838
- Ue.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), `s:${c}`) }, c)),
1840
+ Me.map((c) => /* @__PURE__ */ a(ot, { children: o(D(c), `s:${c}`) }, c)),
1839
1841
  !w && /* @__PURE__ */ a("span", { className: "-my-1 flex w-6 shrink-0 justify-end", children: /* @__PURE__ */ a(cn, { show: ve.customized, onReset: ve.reset }) })
1840
1842
  ] }),
1841
1843
  be.map((c, f) => {
1842
- const p = c.row.id != null ? String(c.row.id) : null, _ = p != null && bt.has(p), q = _ ? null : en(c.key), E = _ ? null : jr(c.key);
1844
+ const p = c.row.id != null ? String(c.row.id) : null, S = p != null && bt.has(p), q = S ? null : en(c.key), E = S ? null : jr(c.key);
1843
1845
  return /* @__PURE__ */ u(
1844
1846
  "div",
1845
1847
  {
@@ -1848,7 +1850,7 @@ function da({
1848
1850
  f % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30",
1849
1851
  q && "bg-amber-50 dark:bg-amber-900/15",
1850
1852
  E && "bg-red-50/70 dark:bg-red-900/15",
1851
- _ && "opacity-60"
1853
+ S && "opacity-60"
1852
1854
  ),
1853
1855
  children: [
1854
1856
  /* @__PURE__ */ u(
@@ -1856,7 +1858,7 @@ function da({
1856
1858
  {
1857
1859
  className: I(
1858
1860
  "flex items-center gap-4",
1859
- _ && "line-through decoration-slate-400"
1861
+ S && "line-through decoration-slate-400"
1860
1862
  ),
1861
1863
  children: [
1862
1864
  zn(
@@ -1864,7 +1866,7 @@ function da({
1864
1866
  jt(c.key),
1865
1867
  "shrink-0 font-semibold text-slate-800 dark:text-slate-100"
1866
1868
  ),
1867
- Ze && !_ && (p == null || ft.has(p)) && /* @__PURE__ */ a(
1869
+ Ze && !S && (p == null || ft.has(p)) && /* @__PURE__ */ a(
1868
1870
  "span",
1869
1871
  {
1870
1872
  "data-catalog-staged": p == null ? "new" : "edited",
@@ -1886,13 +1888,13 @@ ${E}`,
1886
1888
  t && /* @__PURE__ */ a(
1887
1889
  lr,
1888
1890
  {
1889
- text: Ne(St(Ie(c.key), t.field), void 0),
1891
+ text: Ne(_t(Ie(c.key), t.field), void 0),
1890
1892
  className: "min-w-0 flex-1 text-slate-600 dark:text-slate-300"
1891
1893
  }
1892
1894
  ),
1893
1895
  !t && /* @__PURE__ */ a("span", { className: "flex-1" }),
1894
1896
  n.map((y) => {
1895
- const K = St(Ie(c.key), y.field);
1897
+ const K = _t(Ie(c.key), y.field);
1896
1898
  return K == null || K === "" ? null : /* @__PURE__ */ a(
1897
1899
  "span",
1898
1900
  {
@@ -1902,10 +1904,10 @@ ${E}`,
1902
1904
  y.field
1903
1905
  );
1904
1906
  }),
1905
- Ot.map(
1907
+ Tt.map(
1906
1908
  (y) => {
1907
1909
  var K;
1908
- return zr(c.key, y) ? Ur(c.key, y, c.row) : /* @__PURE__ */ a(
1910
+ return zr(c.key, y) ? Mr(c.key, y, c.row) : /* @__PURE__ */ a(
1909
1911
  "span",
1910
1912
  {
1911
1913
  "data-catalog-locked": !w && Z.includes(y) ? y : void 0,
@@ -1925,9 +1927,9 @@ ${E}`,
1925
1927
  ie.has(c.key) && /* @__PURE__ */ a(ce, { className: "h-3 w-3 animate-spin text-slate-400" }),
1926
1928
  Rt(c.key, Ie(c.key))
1927
1929
  ] }),
1928
- Ue.map((y) => {
1930
+ Me.map((y) => {
1929
1931
  var er, tr;
1930
- if (_)
1932
+ if (S)
1931
1933
  return /* @__PURE__ */ a(
1932
1934
  "span",
1933
1935
  {
@@ -1955,7 +1957,7 @@ ${E}`,
1955
1957
  y
1956
1958
  );
1957
1959
  }),
1958
- !w && _ && /* @__PURE__ */ a(
1960
+ !w && S && /* @__PURE__ */ a(
1959
1961
  "button",
1960
1962
  {
1961
1963
  type: "button",
@@ -1964,7 +1966,7 @@ ${E}`,
1964
1966
  children: "Undo"
1965
1967
  }
1966
1968
  ),
1967
- !w && !_ && /* @__PURE__ */ a(
1969
+ !w && !S && /* @__PURE__ */ a(
1968
1970
  "button",
1969
1971
  {
1970
1972
  type: "button",
@@ -1987,7 +1989,7 @@ ${E}`,
1987
1989
  r.map((y) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1988
1990
  /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.field.split(".")[0]) }),
1989
1991
  " ",
1990
- /* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(St(Ie(c.key), y.field), y.format) })
1992
+ /* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(_t(Ie(c.key), y.field), y.format) })
1991
1993
  ] }, y.field)),
1992
1994
  An.map((y) => /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
1993
1995
  /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.key) }),
@@ -1995,7 +1997,7 @@ ${E}`,
1995
1997
  /* @__PURE__ */ a("span", { className: "font-medium tabular-nums text-slate-700 dark:text-slate-200", children: l(st(y.key, c.key), y.format) })
1996
1998
  ] }, y.key)),
1997
1999
  Pr(c.row),
1998
- _r(c.row).map((y) => /* @__PURE__ */ u(
2000
+ Sr(c.row).map((y) => /* @__PURE__ */ u(
1999
2001
  "span",
2000
2002
  {
2001
2003
  className: "inline-flex items-center gap-1 whitespace-nowrap rounded bg-amber-50 px-1.5 py-px text-[10.5px] font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-300",
@@ -2008,7 +2010,7 @@ ${E}`,
2008
2010
  y
2009
2011
  )),
2010
2012
  vt.map((y) => {
2011
- const K = Or(y, c);
2013
+ const K = Tr(y, c);
2012
2014
  return /* @__PURE__ */ u("span", { className: "whitespace-nowrap", children: [
2013
2015
  /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-muted-foreground", children: y.label ?? D(y.field) }),
2014
2016
  " ",
@@ -2026,11 +2028,11 @@ ${E}`,
2026
2028
  Ne(q.qty, "number"),
2027
2029
  " requested"
2028
2030
  ] }),
2029
- !_ && Rs(
2031
+ !S && Rs(
2030
2032
  {
2031
2033
  ...c.row,
2032
2034
  ...Object.fromEntries(
2033
- Ue.filter((y) => c.row[y] == null || c.row[y] === "").map((y) => {
2035
+ Me.filter((y) => c.row[y] == null || c.row[y] === "").map((y) => {
2034
2036
  var K;
2035
2037
  return [
2036
2038
  y,
@@ -2040,7 +2042,7 @@ ${E}`,
2040
2042
  )
2041
2043
  },
2042
2044
  J,
2043
- Ue.length > 0 ? Ue : Ot
2045
+ Me.length > 0 ? Me : Tt
2044
2046
  ) && /* @__PURE__ */ u(
2045
2047
  "p",
2046
2048
  {
@@ -2052,7 +2054,7 @@ ${E}`,
2052
2054
  ]
2053
2055
  }
2054
2056
  ),
2055
- _ && /* @__PURE__ */ a("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
2057
+ S && /* @__PURE__ */ a("p", { className: "mt-1 pl-0.5 text-[11px] text-red-500", children: "Removed — applies when you save" })
2056
2058
  ]
2057
2059
  },
2058
2060
  c.key
@@ -2069,7 +2071,7 @@ ${E}`,
2069
2071
  ), p = (q) => {
2070
2072
  var E;
2071
2073
  return ((E = s.field_formats) == null ? void 0 : E[q]) ?? "number";
2072
- }, _ = (q) => /* @__PURE__ */ a(
2074
+ }, S = (q) => /* @__PURE__ */ a(
2073
2075
  "span",
2074
2076
  {
2075
2077
  ...ve.box(
@@ -2083,12 +2085,12 @@ ${E}`,
2083
2085
  );
2084
2086
  return /* @__PURE__ */ u("div", { className: "flex items-center gap-4 border-t border-slate-200 bg-slate-50 px-3 py-1.5 dark:border-border dark:bg-muted/40", children: [
2085
2087
  /* @__PURE__ */ a("span", { className: "flex-1 text-[11px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400", children: "Total" }),
2086
- Ot.map((q) => {
2088
+ Tt.map((q) => {
2087
2089
  const E = h(q);
2088
2090
  return E ? /* @__PURE__ */ a("span", { ...ve.box(E, "w-20 shrink-0") }, q) : /* @__PURE__ */ a("span", { className: "w-20 shrink-0" }, q);
2089
2091
  }),
2090
2092
  /* @__PURE__ */ a("span", { className: "w-20 shrink-0 text-right text-[12px] font-semibold tabular-nums text-slate-800 dark:text-slate-100", children: Ne(f(J), "number") }),
2091
- Ue.map(_),
2093
+ Me.map(S),
2092
2094
  !w && /* @__PURE__ */ a("span", { className: "w-6 shrink-0" })
2093
2095
  ] });
2094
2096
  })()
@@ -2103,7 +2105,7 @@ ${E}`,
2103
2105
  sectionBy: s.section_by,
2104
2106
  sectionM2M: d,
2105
2107
  pinnedSet: zt,
2106
- pinnedIds: Te,
2108
+ pinnedIds: Oe,
2107
2109
  savingIds: yt,
2108
2110
  relatedCols: (s.favorites_manager_columns ?? []).map((e) => (s.related_columns ?? []).find((t) => t.key === e)).filter((e) => !!e),
2109
2111
  parentDraft: N,
@@ -2125,19 +2127,19 @@ function Ps({
2125
2127
  defaultItemField: m,
2126
2128
  catalogCol: b,
2127
2129
  catalogFields: x,
2128
- tmpl: S,
2130
+ tmpl: _,
2129
2131
  currentQty: s,
2130
2132
  addQty: w,
2131
2133
  qtyStep: k,
2132
2134
  readOnly: j
2133
2135
  }) {
2134
- const v = Kt(), T = i.item_field ?? m, [ye, Z] = Y(!1), [G, Ae] = Y({}), [P, qe] = Y("1"), [J, fe] = Y(!1), $e = F(
2136
+ const v = Kt(), O = i.item_field ?? m, [ye, Z] = Y(!1), [G, Ae] = Y({}), [P, qe] = Y("1"), [J, fe] = Y(!1), $e = F(
2135
2137
  () => [
2136
2138
  "id",
2137
- T,
2139
+ O,
2138
2140
  ...i.attributes.flatMap(($) => [`${$.field}.id`, `${$.field}.${$.label_field}`])
2139
2141
  ].join(","),
2140
- [T, i.attributes]
2142
+ [O, i.attributes]
2141
2143
  ), { data: je = [], isLoading: X } = C({
2142
2144
  queryKey: [
2143
2145
  "catalog-builder",
@@ -2159,22 +2161,22 @@ function Ps({
2159
2161
  const g = $[W];
2160
2162
  if (g == null) return null;
2161
2163
  if (typeof g == "object") {
2162
- const M = g, U = ((te = i.attributes.find((O) => O.field === W)) == null ? void 0 : te.label_field) ?? "id";
2163
- return { id: String(M.id ?? ""), label: String(M[U] ?? M.id ?? "") };
2164
+ const U = g, M = ((te = i.attributes.find((T) => T.field === W)) == null ? void 0 : te.label_field) ?? "id";
2165
+ return { id: String(U.id ?? ""), label: String(U[M] ?? U.id ?? "") };
2164
2166
  }
2165
2167
  return { id: String(g), label: String(g) };
2166
2168
  }, ke = ($) => je.filter(
2167
2169
  (W) => i.attributes.slice(0, $).every((g) => {
2168
- var M;
2170
+ var U;
2169
2171
  const te = G[g.field];
2170
- return te ? ((M = ge(W, g.field)) == null ? void 0 : M.id) === te : !0;
2172
+ return te ? ((U = ge(W, g.field)) == null ? void 0 : U.id) === te : !0;
2171
2173
  })
2172
2174
  ), le = i.attributes.every(($) => G[$.field]), ie = le ? je.find(
2173
2175
  ($) => i.attributes.every((W) => {
2174
2176
  var g;
2175
2177
  return ((g = ge($, W.field)) == null ? void 0 : g.id) === G[W.field];
2176
2178
  })
2177
- ) : void 0, V = (ie == null ? void 0 : ie[T]) != null ? String(ie[T]) : null, { data: oe } = C({
2179
+ ) : void 0, V = (ie == null ? void 0 : ie[O]) != null ? String(ie[O]) : null, { data: oe } = C({
2178
2180
  queryKey: ["catalog-builder-item", b, x, V],
2179
2181
  queryFn: () => v.request(
2180
2182
  R(`/items/${b}`, {
@@ -2226,12 +2228,12 @@ function Ps({
2226
2228
  ] }) : /* @__PURE__ */ u("div", { className: "flex flex-wrap items-end gap-3", children: [
2227
2229
  i.attributes.map(($, W) => {
2228
2230
  const g = /* @__PURE__ */ new Map();
2229
- for (const M of ke(W)) {
2230
- const U = ge(M, $.field);
2231
- U != null && U.id && g.set(U.id, U.label);
2231
+ for (const U of ke(W)) {
2232
+ const M = ge(U, $.field);
2233
+ M != null && M.id && g.set(M.id, M.label);
2232
2234
  }
2233
2235
  const te = [...g.entries()].sort(
2234
- ([, M], [, U]) => M.localeCompare(U, void 0, { numeric: !0 })
2236
+ ([, U], [, M]) => U.localeCompare(M, void 0, { numeric: !0 })
2235
2237
  );
2236
2238
  return /* @__PURE__ */ a(
2237
2239
  Ls,
@@ -2241,25 +2243,25 @@ function Ps({
2241
2243
  valueLabel: G[$.field] ? g.get(G[$.field]) ?? G[$.field] : null,
2242
2244
  options: te,
2243
2245
  disabled: W > 0 && !G[i.attributes[W - 1].field],
2244
- onChange: (M) => Ae((U) => {
2245
- const O = {};
2246
+ onChange: (U) => Ae((M) => {
2247
+ const T = {};
2246
2248
  for (let z = 0; z < W; z++) {
2247
2249
  const L = i.attributes[z].field;
2248
- U[L] && (O[L] = U[L]);
2250
+ M[L] && (T[L] = M[L]);
2249
2251
  }
2250
- return M && (O[$.field] = M), O;
2252
+ return U && (T[$.field] = U), T;
2251
2253
  })
2252
2254
  },
2253
2255
  $.field
2254
2256
  );
2255
2257
  }),
2256
- /* @__PURE__ */ a("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: V && oe ? /* @__PURE__ */ u(Se, { children: [
2257
- /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: ze(S, oe) }),
2258
+ /* @__PURE__ */ a("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: V && oe ? /* @__PURE__ */ u(_e, { children: [
2259
+ /* @__PURE__ */ a("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: ze(_, oe) }),
2258
2260
  (s(V) ?? 0) > 0 && /* @__PURE__ */ u("span", { className: "rounded bg-nvr-cyan/10 px-1.5 py-0.5 text-[10px] font-semibold text-[#00728d] dark:bg-nvr-cyan/15 dark:text-nvr-cyan", children: [
2259
2261
  s(V),
2260
2262
  " in summary"
2261
2263
  ] }),
2262
- !j && /* @__PURE__ */ u(Se, { children: [
2264
+ !j && /* @__PURE__ */ u(_e, { children: [
2263
2265
  /* @__PURE__ */ a(
2264
2266
  "input",
2265
2267
  {
@@ -2299,7 +2301,7 @@ function Es({
2299
2301
  id: b
2300
2302
  }) {
2301
2303
  var k;
2302
- const x = Kt(), { data: S = [] } = C({
2304
+ const x = Kt(), { data: _ = [] } = C({
2303
2305
  queryKey: ["collection-relations", i],
2304
2306
  queryFn: () => x.request(R(`/collections/${i}`)).then((j) => {
2305
2307
  var v;
@@ -2307,7 +2309,7 @@ function Es({
2307
2309
  }),
2308
2310
  enabled: !!i,
2309
2311
  staleTime: 10 * 6e4
2310
- }), s = ((k = S.find(
2312
+ }), s = ((k = _.find(
2311
2313
  (j) => j.many_collection === i && j.many_field === m && !j.junction_field
2312
2314
  )) == null ? void 0 : k.one_collection) ?? null, { data: w } = C({
2313
2315
  queryKey: ["col-meta", s],
@@ -2315,7 +2317,7 @@ function Es({
2315
2317
  enabled: !!s,
2316
2318
  staleTime: 3e5
2317
2319
  });
2318
- return s ? /* @__PURE__ */ a(Ns, { collection: s, id: b, displayTemplate: w == null ? void 0 : w.display_template }) : /* @__PURE__ */ u(Se, { children: [
2320
+ return s ? /* @__PURE__ */ a(Ns, { collection: s, id: b, displayTemplate: w == null ? void 0 : w.display_template }) : /* @__PURE__ */ u(_e, { children: [
2319
2321
  "this ",
2320
2322
  D(m)
2321
2323
  ] });
@@ -2326,22 +2328,22 @@ function lr({
2326
2328
  className: b,
2327
2329
  ...x
2328
2330
  }) {
2329
- const S = cs(i);
2330
- return /* @__PURE__ */ a("span", { ref: S, className: I("truncate", b), ...x, children: m ? /* @__PURE__ */ a(fn, { text: i, query: m }) : i });
2331
+ const _ = cs(i);
2332
+ return /* @__PURE__ */ a("span", { ref: _, className: I("truncate", b), ...x, children: m ? /* @__PURE__ */ a(fn, { text: i, query: m }) : i });
2331
2333
  }
2332
2334
  function Ls({
2333
2335
  label: i,
2334
2336
  value: m,
2335
2337
  valueLabel: b,
2336
2338
  options: x,
2337
- disabled: S,
2339
+ disabled: _,
2338
2340
  onChange: s
2339
2341
  }) {
2340
2342
  const [w, k] = Y(!1), j = pe(null);
2341
2343
  return xe(() => {
2342
2344
  if (!w) return;
2343
- const v = (T) => {
2344
- j.current && !j.current.contains(T.target) && k(!1);
2345
+ const v = (O) => {
2346
+ j.current && !j.current.contains(O.target) && k(!1);
2345
2347
  };
2346
2348
  return document.addEventListener("mousedown", v), () => document.removeEventListener("mousedown", v);
2347
2349
  }, [w]), /* @__PURE__ */ u("div", { ref: j, className: "relative", children: [
@@ -2350,7 +2352,7 @@ function Ls({
2350
2352
  "button",
2351
2353
  {
2352
2354
  type: "button",
2353
- disabled: S,
2355
+ disabled: _,
2354
2356
  onClick: () => k((v) => !v),
2355
2357
  className: "flex w-44 items-center justify-between rounded border border-slate-200 bg-white px-2 py-1.5 text-left text-[12px] text-slate-700 hover:border-slate-300 disabled:opacity-50 dark:border-border dark:bg-background dark:text-slate-200",
2356
2358
  children: [
@@ -2374,7 +2376,7 @@ function Ls({
2374
2376
  ]
2375
2377
  }
2376
2378
  ),
2377
- x.map(([v, T]) => /* @__PURE__ */ a(
2379
+ x.map(([v, O]) => /* @__PURE__ */ a(
2378
2380
  "button",
2379
2381
  {
2380
2382
  type: "button",
@@ -2385,7 +2387,7 @@ function Ls({
2385
2387
  "block w-full truncate px-2 py-1 text-left text-[12px] hover:bg-muted",
2386
2388
  v === m ? "font-medium text-nvr-cyan" : "text-slate-700 dark:text-slate-200"
2387
2389
  ),
2388
- children: T
2390
+ children: O
2389
2391
  },
2390
2392
  v
2391
2393
  ))
@@ -2397,13 +2399,13 @@ function As({
2397
2399
  tmpl: m,
2398
2400
  sectionBy: b,
2399
2401
  sectionM2M: x,
2400
- pinnedSet: S,
2402
+ pinnedSet: _,
2401
2403
  pinnedIds: s,
2402
2404
  savingIds: w,
2403
2405
  relatedCols: k,
2404
2406
  parentDraft: j,
2405
2407
  onToggle: v,
2406
- onClose: T,
2408
+ onClose: O,
2407
2409
  anchor: ye
2408
2410
  }) {
2409
2411
  const Z = Kt(), [G, Ae] = Y(""), [P, qe] = Y(""), [J, fe] = Y(1), $e = pe(null);
@@ -2415,10 +2417,10 @@ function As({
2415
2417
  (d = $e.current) == null || d.focus();
2416
2418
  }, []), xe(() => {
2417
2419
  const d = (N) => {
2418
- N.key === "Escape" && (N.stopPropagation(), T());
2420
+ N.key === "Escape" && (N.stopPropagation(), O());
2419
2421
  };
2420
2422
  return window.addEventListener("keydown", d, !0), () => window.removeEventListener("keydown", d, !0);
2421
- }, [T]);
2423
+ }, [O]);
2422
2424
  const je = F(() => {
2423
2425
  var N;
2424
2426
  const d = (N = [...(m ?? "").matchAll(/\{\{([\w.]+)\}\}/g)][0]) == null ? void 0 : N[1];
@@ -2436,7 +2438,7 @@ function As({
2436
2438
  ),
2437
2439
  staleTime: 3e4,
2438
2440
  placeholderData: (d) => d
2439
- }), ie = ((ke == null ? void 0 : ke.data) ?? []).filter((d) => !S.has(String(d.id))), V = (ke == null ? void 0 : ke.total) ?? ie.length, oe = Math.max(1, Math.ceil(V / ge)), { data: de = [] } = C({
2441
+ }), ie = ((ke == null ? void 0 : ke.data) ?? []).filter((d) => !_.has(String(d.id))), V = (ke == null ? void 0 : ke.total) ?? ie.length, oe = Math.max(1, Math.ceil(V / ge)), { data: de = [] } = C({
2440
2442
  queryKey: ["favorites-manager-pinned", i, X, s.join(",")],
2441
2443
  queryFn: () => Z.request(
2442
2444
  R(`/items/${i}`, {
@@ -2489,7 +2491,7 @@ function As({
2489
2491
  if (d == null || d === "") return "—";
2490
2492
  const B = Number(d);
2491
2493
  return N === "currency" && Number.isFinite(B) ? B.toLocaleString("en-US", { style: "currency", currency: "USD" }) : N === "number" && Number.isFinite(B) ? B.toLocaleString() : String(d);
2492
- }, M = un({
2494
+ }, U = un({
2493
2495
  queries: k.map((d) => {
2494
2496
  const N = De(d.match, j);
2495
2497
  return {
@@ -2518,10 +2520,10 @@ function As({
2518
2520
  staleTime: 3e4
2519
2521
  };
2520
2522
  })
2521
- }), U = k.filter(
2523
+ }), M = k.filter(
2522
2524
  (d) => d.match !== void 0 && De(d.match, j) === null
2523
- ), O = (d) => {
2524
- const N = S.has(d);
2525
+ ), T = (d) => {
2526
+ const N = _.has(d);
2525
2527
  return /* @__PURE__ */ a(
2526
2528
  "button",
2527
2529
  {
@@ -2551,7 +2553,7 @@ function As({
2551
2553
  N % 2 === 0 ? "bg-white dark:bg-background" : "bg-slate-50/50 dark:bg-muted/30"
2552
2554
  ),
2553
2555
  children: [
2554
- /* @__PURE__ */ a("td", { className: "px-2 py-1", children: O(B) }),
2556
+ /* @__PURE__ */ a("td", { className: "px-2 py-1", children: T(B) }),
2555
2557
  /* @__PURE__ */ a("td", { className: "px-2 py-1 font-medium tabular-nums text-slate-700 dark:text-slate-200", children: or(i) ? /* @__PURE__ */ a(
2556
2558
  "button",
2557
2559
  {
@@ -2566,7 +2568,7 @@ function As({
2566
2568
  /* @__PURE__ */ a("td", { className: "px-2 py-1", children: /* @__PURE__ */ a("p", { className: "truncate text-slate-500 dark:text-slate-400", children: g(d) || "—" }) }),
2567
2569
  k.map((Q, ee) => {
2568
2570
  var Ke, re;
2569
- const H = Q.match !== void 0 && De(Q.match, j) === null, A = H || (re = (Ke = M[ee]) == null ? void 0 : Ke.data) == null ? void 0 : re.get(B);
2571
+ const H = Q.match !== void 0 && De(Q.match, j) === null, A = H || (re = (Ke = U[ee]) == null ? void 0 : Ke.data) == null ? void 0 : re.get(B);
2570
2572
  return /* @__PURE__ */ a(
2571
2573
  "td",
2572
2574
  {
@@ -2587,7 +2589,7 @@ function As({
2587
2589
  "div",
2588
2590
  {
2589
2591
  className: "absolute inset-0 bg-slate-900/30 motion-safe:animate-in motion-safe:fade-in",
2590
- onClick: T
2592
+ onClick: O
2591
2593
  }
2592
2594
  ),
2593
2595
  /* @__PURE__ */ u(
@@ -2608,7 +2610,7 @@ function As({
2608
2610
  "button",
2609
2611
  {
2610
2612
  type: "button",
2611
- onClick: T,
2613
+ onClick: O,
2612
2614
  className: "shrink-0 rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/[0.06]",
2613
2615
  "aria-label": "Close",
2614
2616
  children: /* @__PURE__ */ a(Lt, { className: "h-4 w-4" })
@@ -2639,9 +2641,9 @@ function As({
2639
2641
  }
2640
2642
  )
2641
2643
  ] }),
2642
- U.length > 0 && /* @__PURE__ */ u("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
2644
+ M.length > 0 && /* @__PURE__ */ u("p", { className: "mt-1.5 flex items-center gap-1 text-[10px] text-amber-600 dark:text-amber-400", children: [
2643
2645
  /* @__PURE__ */ a(Be, { className: "h-3 w-3 shrink-0" }),
2644
- U.map((d) => d.label ?? D(d.key)).join(", "),
2646
+ M.map((d) => d.label ?? D(d.key)).join(", "),
2645
2647
  " fill in once the form's warehouse selection is made."
2646
2648
  ] })
2647
2649
  ] }),
@@ -2749,7 +2751,7 @@ function As({
2749
2751
  function Ks(i, m) {
2750
2752
  var x;
2751
2753
  if (!i) return null;
2752
- const b = (x = (m ?? []).find((S) => !S.format && !S.sections_only)) == null ? void 0 : x.field;
2754
+ const b = (x = (m ?? []).find((_) => !_.format && !_.sections_only)) == null ? void 0 : x.field;
2753
2755
  return !b || i.includes(`{{${b}}}`) ? i : `${i} · {{${b}}}`;
2754
2756
  }
2755
2757
  export {
@@ -2759,12 +2761,12 @@ export {
2759
2761
  qs as footerSum,
2760
2762
  Fs as gridPriceValue,
2761
2763
  Rs as isUnpricedLine,
2762
- Os as issuesAfterLinesChanged,
2764
+ Ts as issuesAfterLinesChanged,
2763
2765
  js as lineComputeError,
2764
2766
  ir as matchesShowWhen,
2765
- Ss as qtyEntryProblem,
2767
+ _s as qtyEntryProblem,
2766
2768
  $s as refusedQtyNote,
2767
2769
  bn as relatedParentTokens,
2768
- Ts as savedLinesSignature,
2770
+ Os as savedLinesSignature,
2769
2771
  vs as stagedCatalogFill
2770
2772
  };