@nivaro/react 0.3.48 → 0.3.50

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 (52) hide show
  1. package/dist/components/InlineGridField.js +166 -105
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +25 -1
  5. package/dist/shared/components/CellCopyLayer.js +81 -44
  6. package/dist/shared/components/CollectionBrowserView.js +306 -297
  7. package/dist/shared/components/DataTable.js +3 -3
  8. package/dist/shared/components/FulfilmentPill.js +98 -78
  9. package/dist/shared/components/ItemEditForm.js +4682 -4570
  10. package/dist/shared/components/NotificationSourcesCard.js +151 -147
  11. package/dist/shared/components/ProfileView.js +72 -70
  12. package/dist/shared/components/QueryTable.js +462 -333
  13. package/dist/shared/components/imports/ImportConsole.js +4 -4
  14. package/dist/shared/components/integrations/console/IntegrationsConsole.js +58 -50
  15. package/dist/shared/components/item-edit/CatalogPickerField.js +1144 -1127
  16. package/dist/shared/components/item-edit/CloneDialog.js +192 -142
  17. package/dist/shared/components/item-edit/FieldRenderer.js +127 -126
  18. package/dist/shared/components/item-edit/FieldRow.js +236 -226
  19. package/dist/shared/components/item-edit/HeaderTools.js +118 -113
  20. package/dist/shared/components/item-edit/InlineGridField.js +92 -90
  21. package/dist/shared/components/item-edit/InlineTableField.js +3091 -2942
  22. package/dist/shared/components/item-edit/MidairCollisionDialog.js +175 -0
  23. package/dist/shared/components/item-edit/PlanGrid.js +162 -162
  24. package/dist/shared/components/item-edit/PolishFields.js +169 -162
  25. package/dist/shared/components/item-edit/RelationCombobox.js +186 -181
  26. package/dist/shared/components/item-edit/SummaryPanel.js +148 -135
  27. package/dist/shared/components/item-edit/ValidationSummary.js +64 -47
  28. package/dist/shared/components/item-edit/helpers.js +181 -155
  29. package/dist/shared/components/item-edit/line-midair.js +201 -0
  30. package/dist/shared/components/item-edit/soft-rules.js +27 -0
  31. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  32. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +65 -65
  33. package/dist/shared/components/layout-editor/settings/settings-registry.js +4 -4
  34. package/dist/shared/components/notifications/DeliveryChips.js +9 -9
  35. package/dist/shared/components/panels/ItemLockBanner.js +414 -358
  36. package/dist/shared/components/panels/PipelinePanel.js +1171 -975
  37. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  38. package/dist/shared/components/panels/SlaBreachBanner.js +2 -2
  39. package/dist/shared/components/panels/TransitionRequirementsDialog.js +384 -380
  40. package/dist/shared/components/profile/PersonProfile.js +23 -21
  41. package/dist/shared/components/profile/SignedInDevices.js +126 -0
  42. package/dist/shared/components/queue/QueueItemSheet.js +38 -37
  43. package/dist/shared/components/queue/QueueWorklist.js +870 -827
  44. package/dist/shared/components/queue/column-chooser.js +21 -0
  45. package/dist/shared/components/queue/live-state-aspect.js +6 -0
  46. package/dist/shared/components/support/SupportView.js +1 -1
  47. package/dist/shared/components/ui/number-draft-input.js +93 -0
  48. package/dist/shared/components/widgets/ReviewListWidget.js +191 -166
  49. package/dist/shared/lib/edit-lock-fields.js +7 -0
  50. package/dist/shared/lib/error-hints.js +1 -0
  51. package/dist/shared/lib/reimport-visibility.js +10 -0
  52. package/package.json +1 -1
@@ -8,14 +8,15 @@ import { get as ue, post as lt } from "../../lib/commands.js";
8
8
  import { useAfterIdle as ia } from "../../lib/defer.js";
9
9
  import { evaluateNumeric as et } from "../../lib/expression.js";
10
10
  import { userErrorMessage as da } from "../../lib/safe-error.js";
11
- import { cn as I, formatRelative as ca } from "../../lib/utils.js";
11
+ import { cn as B, formatRelative as ca } from "../../lib/utils.js";
12
+ import { NumberDraftInput as ua } from "../ui/number-draft-input.js";
12
13
  import { Popover as rt, PopoverTrigger as ot, PopoverContent as it } from "../ui/popover.js";
13
- import { resolveCompareEndpoint as ua, useCompareSeries as pa, compareColumnClosed as ma, planLabel as Et, closedThroughLabel as ha, CompareProposalBanner as fa, CompareStripChips as xa, GridStatChip as Ct, monthLabel as nt, extraSeriesValue as ve, SeriesFigurePopover as _t, monthLabelLong as Re, unitWord as ga } from "./CompareSeries.js";
14
- import { useO2MStaging as ya, useLiveRows as ba } from "./O2MStagingContext.js";
15
- import { usePlanGridHost as ka } from "./PlanGridHost.js";
16
- import { RowHistorySheet as va } from "./RowHistorySheet.js";
17
- import { RowWatchButton as Na } from "./RowWatchButton.js";
18
- const Ke = "unclassified", B = (_) => Number(_) || 0, E = (_) => Math.round(_ * 100) / 100;
14
+ import { resolveCompareEndpoint as pa, useCompareSeries as ma, compareColumnClosed as ha, planLabel as Et, closedThroughLabel as fa, CompareProposalBanner as xa, CompareStripChips as ga, GridStatChip as Ct, monthLabel as nt, extraSeriesValue as ve, SeriesFigurePopover as _t, monthLabelLong as Re, unitWord as ya } from "./CompareSeries.js";
15
+ import { useO2MStaging as ba, useLiveRows as ka } from "./O2MStagingContext.js";
16
+ import { usePlanGridHost as va } from "./PlanGridHost.js";
17
+ import { RowHistorySheet as Na } from "./RowHistorySheet.js";
18
+ import { RowWatchButton as wa } from "./RowWatchButton.js";
19
+ const Ke = "unclassified", I = (_) => Number(_) || 0, E = (_) => Math.round(_ * 100) / 100;
19
20
  function D(_) {
20
21
  const n = Math.abs(_ - Math.round(_)) < 5e-3;
21
22
  return _.toLocaleString("en-US", {
@@ -31,16 +32,16 @@ function Tt(_) {
31
32
  const p = /^\(.*\)$/.test(n), y = Number(p ? n.slice(1, -1) : n);
32
33
  return Number.isFinite(y) ? E(p ? -y : y) : null;
33
34
  }
34
- function wa(_) {
35
- const { column: n, actual: p, openColumns: y, mode: o } = _, $ = _.targetRow != null, M = E(B(_.row[n]) - p), K = { [n]: E(p) }, F = _.targetRow ?? _.row, L = $ ? {} : K;
35
+ function $a(_) {
36
+ const { column: n, actual: p, openColumns: y, mode: o } = _, $ = _.targetRow != null, M = E(I(_.row[n]) - p), K = { [n]: E(p) }, F = _.targetRow ?? _.row, L = $ ? {} : K;
36
37
  if (o === "none" || Math.abs(M) < 5e-3 || y.length === 0)
37
38
  return { patch: K, moved: 0, unabsorbed: o === "none" ? 0 : M, targets: [] };
38
39
  let f, b;
39
- if (o === "next" ? (f = [y[0]], b = [1]) : o === "weighted" ? (f = y.filter((x) => B(F[x]) > 5e-3), b = f.map((x) => B(F[x])), f.length === 0 && $ && M > 0 && (f = y, b = f.map(() => 1))) : (f = y, b = f.map(() => 1)), f.length === 0) return { patch: K, moved: 0, unabsorbed: M, targets: [] };
40
+ if (o === "next" ? (f = [y[0]], b = [1]) : o === "weighted" ? (f = y.filter((x) => I(F[x]) > 5e-3), b = f.map((x) => I(F[x])), f.length === 0 && $ && M > 0 && (f = y, b = f.map(() => 1))) : (f = y, b = f.map(() => 1)), f.length === 0) return { patch: K, moved: 0, unabsorbed: M, targets: [] };
40
41
  const C = b.reduce((x, j) => x + j, 0) || 1;
41
42
  let k = M;
42
43
  if (f.forEach((x, j) => {
43
- const v = j === f.length - 1 ? k : E(M * b[j] / C), g = Math.max(0, E(B(F[x]) + v)), i = E(g - B(F[x]));
44
+ const v = j === f.length - 1 ? k : E(M * b[j] / C), g = Math.max(0, E(I(F[x]) + v)), i = E(g - I(F[x]));
44
45
  L[x] = g, k = E(k - i);
45
46
  }), Math.abs(k) >= 5e-3 && k < 0)
46
47
  for (const x of f) {
@@ -57,7 +58,7 @@ function wa(_) {
57
58
  } : { patch: L, moved: E(M - k), unabsorbed: k, targets: f };
58
59
  }
59
60
  const St = 176, Ot = 112, Lt = 128, xe = "sticky left-0 z-[2] bg-white dark:bg-[hsl(var(--card))] border-r border-slate-200 dark:border-border", ge = "sticky right-0 z-[2] bg-white dark:bg-[hsl(var(--card))] border-l border-slate-200 dark:border-border", Ne = "bg-slate-50 dark:bg-white/[0.035]";
60
- function Qa(_) {
61
+ function Ja(_) {
61
62
  const {
62
63
  relatedCollection: n,
63
64
  manyField: p,
@@ -70,9 +71,9 @@ function Qa(_) {
70
71
  readOnly: L = !1,
71
72
  showHistory: f = !0,
72
73
  emptyLabel: b
73
- } = _, C = sa(), k = Yt(), x = ya(), j = ba(), T = ra(), v = T == null ? void 0 : T.draft, { isAdmin: g } = oa(), i = !y || y === "new", U = !L && !!x, m = o.value_fields, R = o.total_field ?? null, {
74
+ } = _, C = sa(), k = Yt(), x = ba(), j = ka(), T = ra(), v = T == null ? void 0 : T.draft, { isAdmin: g } = oa(), i = !y || y === "new", U = !L && !!x, m = o.value_fields, R = o.total_field ?? null, {
74
75
  data: q = [],
75
- isLoading: oe,
76
+ isLoading: re,
76
77
  dataUpdatedAt: be
77
78
  } = ce({
78
79
  queryKey: ["o2m-rows", n, p, y, ""],
@@ -93,7 +94,7 @@ function Qa(_) {
93
94
  enabled: P && f && !i && q.length > 0,
94
95
  staleTime: 6e4,
95
96
  placeholderData: (e) => e
96
- }), z = (e, a) => e.id ? `${n}:${e.id}:${a}` : void 0, ne = (e, a) => {
97
+ }), Q = (e, a) => e.id ? `${n}:${e.id}:${a}` : void 0, oe = (e, a) => {
97
98
  var l;
98
99
  return e.id && !e.edited ? (l = le[e.id]) == null ? void 0 : l[a] : void 0;
99
100
  }, N = Me(null), pe = (e, a) => {
@@ -113,17 +114,17 @@ function Qa(_) {
113
114
  []
114
115
  );
115
116
  const Ee = G(
116
- () => $ != null && $.endpoint ? ua($.endpoint, v) : null,
117
+ () => $ != null && $.endpoint ? pa($.endpoint, v) : null,
117
118
  [$ == null ? void 0 : $.endpoint, v]
118
- ), Be = pa({
119
+ ), Ie = ma({
119
120
  client: C,
120
121
  endpoint: Ee,
121
122
  enabled: !!$ && !i
122
- }), c = $ && !i ? Be.data ?? null : null, me = G(() => !o.split_endpoint || i ? null : o.split_endpoint.replace(
123
+ }), c = $ && !i ? Ie.data ?? null : null, me = G(() => !o.split_endpoint || i ? null : o.split_endpoint.replace(
123
124
  /\$parent\.([A-Za-z_][A-Za-z0-9_]*)/g,
124
125
  (e, a) => String(a === "id" ? y : (v == null ? void 0 : v[a]) ?? "")
125
- ), [o.split_endpoint, i, y, v]), Ie = G(() => ["plan-grid-split-info", me], [me]), { data: ie = null } = ce({
126
- queryKey: Ie,
126
+ ), [o.split_endpoint, i, y, v]), Be = G(() => ["plan-grid-split-info", me], [me]), { data: ie = null } = ce({
127
+ queryKey: Be,
127
128
  queryFn: () => C.request(ue(me)).then((e) => e.data ?? null).catch(() => null),
128
129
  enabled: !!me,
129
130
  staleTime: 3e4
@@ -171,9 +172,9 @@ function Qa(_) {
171
172
  });
172
173
  }), e;
173
174
  }, [q, ct, Te, qe, o.key_field, o.category_field]), Y = ee(
174
- (e) => E(m.reduce((a, l) => a + B(e[l]), 0)),
175
+ (e) => E(m.reduce((a, l) => a + I(e[l]), 0)),
175
176
  [m]
176
- ), re = G(() => {
177
+ ), se = G(() => {
177
178
  const e = /* @__PURE__ */ new Map();
178
179
  for (const a of Z) {
179
180
  if (!a.key) continue;
@@ -187,7 +188,7 @@ function Qa(_) {
187
188
  }));
188
189
  for (const a of (c == null ? void 0 : c.rows) ?? []) {
189
190
  const l = String(a.key);
190
- e.has(l) || m.some((s) => Math.abs(B(a.values[s])) >= 5e-3) && e.set(l, { key: l, mode: "ghost", top: null, cats: [] });
191
+ e.has(l) || m.some((s) => Math.abs(I(a.values[s])) >= 5e-3) && e.set(l, { key: l, mode: "ghost", top: null, cats: [] });
191
192
  }
192
193
  return [...e.values()].sort(
193
194
  (a, l) => Number(a.key) - Number(l.key) || a.key.localeCompare(l.key)
@@ -198,13 +199,13 @@ function Qa(_) {
198
199
  ), he = j == null ? void 0 : j.report;
199
200
  ye(() => {
200
201
  if (he) {
201
- if (oe) {
202
+ if (re) {
202
203
  he(n, p, null);
203
204
  return;
204
205
  }
205
206
  he(n, p, $e);
206
207
  }
207
- }, [he, n, p, $e, oe]);
208
+ }, [he, n, p, $e, re]);
208
209
  const ut = Me(() => {
209
210
  });
210
211
  ut.current = () => he == null ? void 0 : he(n, p, null), ye(() => () => ut.current(), []);
@@ -213,7 +214,7 @@ function Qa(_) {
213
214
  if (e.startsWith("$parent.")) return (v == null ? void 0 : v[e.slice(8)]) ?? 0;
214
215
  if (e.startsWith("$sum.")) {
215
216
  const a = e.slice(5);
216
- return $e.reduce((l, s) => l + B(s[a]), 0);
217
+ return $e.reduce((l, s) => l + I(s[a]), 0);
217
218
  }
218
219
  return e === "$count" ? $e.length : v == null ? void 0 : v[e];
219
220
  },
@@ -236,7 +237,7 @@ function Qa(_) {
236
237
  left: E(e.cap - a)
237
238
  };
238
239
  }) : [], [ie, Z, Y]), J = ee(
239
- (e, a) => ma(c, e, a),
240
+ (e, a) => ha(c, e, a),
240
241
  [c]
241
242
  ), Pe = ee(
242
243
  (e, a) => !U || J(e, a) && !!(c != null && c.closed_locked) && !g,
@@ -246,9 +247,9 @@ function Qa(_) {
246
247
  var u, O, H;
247
248
  const s = c == null ? void 0 : c.rows.find((A) => String(A.key) === e);
248
249
  if (!s) return { value: 0, details: [] };
249
- if (a == null) return { value: B(s.values[l]), details: ((u = s.details) == null ? void 0 : u[l]) ?? [] };
250
+ if (a == null) return { value: I(s.values[l]), details: ((u = s.details) == null ? void 0 : u[l]) ?? [] };
250
251
  const r = (O = s.by_category) == null ? void 0 : O[a];
251
- return { value: B(r == null ? void 0 : r.values[l]), details: ((H = r == null ? void 0 : r.details) == null ? void 0 : H[l]) ?? [] };
252
+ return { value: I(r == null ? void 0 : r.values[l]), details: ((H = r == null ? void 0 : r.details) == null ? void 0 : H[l]) ?? [] };
252
253
  },
253
254
  [c]
254
255
  ), [mt, He] = W(null), X = ee(
@@ -306,12 +307,12 @@ function Qa(_) {
306
307
  (e, a) => {
307
308
  const l = Number(e);
308
309
  if (!Number.isInteger(l)) return null;
309
- const s = String(l + 1), r = m.filter((A) => !J(s, A)), u = re.find((A) => A.key === s);
310
+ const s = String(l + 1), r = m.filter((A) => !J(s, A)), u = se.find((A) => A.key === s);
310
311
  let O = null, H = null;
311
312
  return o.key_collection && We && !We.some((A) => String(A) === s) ? H = `${s} is not set up yet` : r.length === 0 ? H = `${s} has no open period either` : (u == null ? void 0 : u.mode) === "split" ? a == null ? H = `${s} is planned by category and this line is not` : O = u.cats.find((A) => A.cat === a) ?? null : (u == null ? void 0 : u.mode) === "top" && (a != null ? H = `${s} is planned as one line and this one is by category` : O = u.top), { key: s, cat: a, openColumns: r, row: O, blocked: H };
312
313
  },
313
- [m, J, re, o.key_collection, We]
314
- ), Qe = ee(
314
+ [m, J, se, o.key_collection, We]
315
+ ), Ve = ee(
315
316
  (e, a, l, s) => {
316
317
  if (!s || Object.keys(s.patch).length === 0) return X(e, a, l);
317
318
  const r = E(Y({ ...e.values, ...a }) - Y(e.values)), u = s.target.row, O = E(
@@ -330,15 +331,15 @@ function Qa(_) {
330
331
  },
331
332
  [x, n, p]
332
333
  ), Ft = ee(() => {
333
- k.invalidateQueries({ queryKey: ["o2m-rows", n, p, y] }), k.invalidateQueries({ queryKey: Ie }), Ee && k.invalidateQueries({ queryKey: ["o2m-compare", Ee] });
334
- }, [k, n, p, y, Ie, Ee]), Ve = Me(null), fe = G(() => {
334
+ k.invalidateQueries({ queryKey: ["o2m-rows", n, p, y] }), k.invalidateQueries({ queryKey: Be }), Ee && k.invalidateQueries({ queryKey: ["o2m-compare", Ee] });
335
+ }, [k, n, p, y, Be, Ee]), Qe = Me(null), fe = G(() => {
335
336
  const e = [];
336
- for (const a of re)
337
+ for (const a of se)
337
338
  if (a.mode === "top" && a.top && e.push(a.top.uid), a.mode === "split") for (const l of a.cats) e.push(l.uid);
338
339
  return e;
339
- }, [re]), ht = ee((e, a) => {
340
+ }, [se]), ht = ee((e, a) => {
340
341
  var s;
341
- const l = (s = Ve.current) == null ? void 0 : s.querySelector(`[data-pg-cell="${e}:${a}"]`);
342
+ const l = (s = Qe.current) == null ? void 0 : s.querySelector(`[data-pg-cell="${e}:${a}"]`);
342
343
  return l ? (l.focus(), l.select(), !0) : !1;
343
344
  }, []), ft = ee(
344
345
  (e, a, l, s) => {
@@ -355,13 +356,13 @@ function Qa(_) {
355
356
  s.forEach((H, A) => {
356
357
  const S = Z.find((te) => te.uid === fe[r + A]);
357
358
  if (!S) return;
358
- const Q = {};
359
+ const z = {};
359
360
  H.split(" ").forEach((te, h) => {
360
361
  const w = m[u + h];
361
362
  if (!w || Pe(S.key, w)) return;
362
363
  const ae = Tt(te);
363
- ae == null || ae < 0 || (Q[w] = ae);
364
- }), Object.keys(Q).length && X(S, Q) && (O += Object.keys(Q).length);
364
+ ae == null || ae < 0 || (z[w] = ae);
365
+ }), Object.keys(z).length && X(S, z) && (O += Object.keys(z).length);
365
366
  }), O && de.success(`Pasted ${O} ${O === 1 ? "figure" : "figures"}`);
366
367
  },
367
368
  [fe, m, Z, Pe, X]
@@ -379,13 +380,13 @@ function Qa(_) {
379
380
  return u.delete(s.key), u;
380
381
  }), window.setTimeout(() => {
381
382
  var u;
382
- const r = (u = Ve.current) == null ? void 0 : u.querySelector(`[data-o2m-row="${n}:${s.id}"]`);
383
+ const r = (u = Qe.current) == null ? void 0 : u.querySelector(`[data-o2m-row="${n}:${s.id}"]`);
383
384
  r && (r.scrollIntoView({ block: "center", behavior: "smooth" }), r.classList.remove("nvr-row-flash"), r.offsetWidth, r.classList.add("nvr-row-flash"));
384
385
  }, 60)));
385
386
  };
386
387
  return window.addEventListener("nvr:grid-open-row", e), () => window.removeEventListener("nvr:grid-open-row", e);
387
388
  }, [n, Z]);
388
- const [Kt, Bt] = W(() => {
389
+ const [Kt, It] = W(() => {
389
390
  try {
390
391
  return new Set(
391
392
  JSON.parse(localStorage.getItem(`nvr_pg_dismissed:${n}:${y}`) ?? "[]")
@@ -394,7 +395,7 @@ function Qa(_) {
394
395
  return /* @__PURE__ */ new Set();
395
396
  }
396
397
  }), yt = ((c == null ? void 0 : c.proposals) ?? []).filter((e) => !Kt.has(e.id)), bt = (e, a) => {
397
- Bt((l) => {
398
+ It((l) => {
398
399
  const s = new Set(l).add(e.id);
399
400
  if (a)
400
401
  try {
@@ -403,36 +404,36 @@ function Qa(_) {
403
404
  }
404
405
  return s;
405
406
  });
406
- }, It = (e) => {
407
+ }, Bt = (e) => {
407
408
  let a = 0;
408
409
  for (const l of e.rows) {
409
- const s = String(l.key), r = re.find((S) => S.key === s);
410
+ const s = String(l.key), r = se.find((S) => S.key === s);
410
411
  if ((r == null ? void 0 : r.mode) === "split" != (l.category != null)) continue;
411
412
  const u = e.mode === "add", O = Object.fromEntries(
412
413
  Object.entries(l.values).filter(
413
- ([S, Q]) => m.includes(S) && !J(s, S) && (u ? B(Q) !== 0 : B(Q) > 0)
414
+ ([S, z]) => m.includes(S) && !J(s, S) && (u ? I(z) !== 0 : I(z) > 0)
414
415
  )
415
416
  ), H = (S) => Object.fromEntries(
416
- Object.entries(O).map(([Q, te]) => [Q, Math.max(0, E(B(S == null ? void 0 : S[Q]) + B(te)))]).filter(([Q, te]) => Math.abs(te - B(S == null ? void 0 : S[Q])) >= 5e-3)
417
+ Object.entries(O).map(([z, te]) => [z, Math.max(0, E(I(S == null ? void 0 : S[z]) + I(te)))]).filter(([z, te]) => Math.abs(te - I(S == null ? void 0 : S[z])) >= 5e-3)
417
418
  ), A = l.category != null ? r == null ? void 0 : r.cats.find((S) => String(S.cat) === String(l.category)) : null;
418
419
  if (l.category != null) {
419
420
  if (!A) continue;
420
- const S = u ? H(A.values) : Object.fromEntries(Object.entries(O).filter(([Q]) => B(A.values[Q]) === 0));
421
+ const S = u ? H(A.values) : Object.fromEntries(Object.entries(O).filter(([z]) => I(A.values[z]) === 0));
421
422
  Object.keys(S).length && X(A, S, e.change_reason) && (a += Object.keys(S).length);
422
423
  } else if (r != null && r.top) {
423
- const S = u ? H(r.top.values) : Object.fromEntries(Object.entries(O).filter(([Q]) => {
424
+ const S = u ? H(r.top.values) : Object.fromEntries(Object.entries(O).filter(([z]) => {
424
425
  var te;
425
- return B((te = r.top) == null ? void 0 : te.values[Q]) === 0;
426
+ return I((te = r.top) == null ? void 0 : te.values[z]) === 0;
426
427
  }));
427
428
  Object.keys(S).length && X(r.top, S, e.change_reason) && (a += Object.keys(S).length);
428
- } else Object.keys(O).length && !(u && Object.values(O).every((S) => B(S) < 0)) && (Oe(l.key, u ? H(void 0) : O, e.change_reason), a += Object.keys(O).length);
429
+ } else Object.keys(O).length && !(u && Object.values(O).every((S) => I(S) < 0)) && (Oe(l.key, u ? H(void 0) : O, e.change_reason), a += Object.keys(O).length);
429
430
  }
430
431
  a ? de.success(
431
432
  `${e.label}: ${a} ${a === 1 ? "figure" : "figures"} staged — Save to keep them`
432
433
  ) : de.message(
433
434
  e.mode === "add" ? "Nothing to move — no open period could take it" : "Nothing to fill — those periods already hold a figure"
434
435
  ), bt(e, !1);
435
- }, [V, Ge] = W(null), je = ka(), Ze = V && (je != null && je.renderRowHistory) ? je.renderRowHistory({
436
+ }, [V, Ge] = W(null), je = va(), Ze = V && (je != null && je.renderRowHistory) ? je.renderRowHistory({
436
437
  collection: n,
437
438
  parentId: y,
438
439
  rowId: V.id,
@@ -452,20 +453,20 @@ function Qa(_) {
452
453
  queryFn: () => C.request(ue(`/field-config/${n}`)).then((e) => e.data ?? []),
453
454
  enabled: !!V,
454
455
  staleTime: 5 * 6e4
455
- }), [Ye, Ht] = W(!1), vt = re.some((e) => e.mode === "split"), Fe = Et(c), ke = (c == null ? void 0 : c.label) ?? ($ == null ? void 0 : $.label) ?? "Actual", Ae = ha(c == null ? void 0 : c.closed_through), Le = c != null && c.closed_through ? Number(c.closed_through.split("-")[0]) : null, Wt = G(() => {
456
+ }), [Ye, Ht] = W(!1), vt = se.some((e) => e.mode === "split"), Fe = Et(c), ke = (c == null ? void 0 : c.label) ?? ($ == null ? void 0 : $.label) ?? "Actual", Ae = fa(c == null ? void 0 : c.closed_through), Le = c != null && c.closed_through ? Number(c.closed_through.split("-")[0]) : null, Wt = G(() => {
456
457
  if (Le == null) return null;
457
458
  const e = m.filter((a) => J(String(Le), a));
458
459
  return e[e.length - 1] ?? null;
459
460
  }, [Le, m, J]), zt = G(
460
- () => new Set(re.filter((e) => e.mode !== "ghost").map((e) => e.key)),
461
- [re]
462
- ), Qt = F ? et(F, Ce) : null, Vt = (e) => {
463
- let a = Qt ?? 0;
461
+ () => new Set(se.filter((e) => e.mode !== "ghost").map((e) => e.key)),
462
+ [se]
463
+ ), Vt = F ? et(F, Ce) : null, Qt = (e) => {
464
+ let a = Vt ?? 0;
464
465
  if (e.cat != null) {
465
466
  const u = _e.find((O) => O.id === e.cat);
466
467
  u && (a = Math.min(a, u.left));
467
468
  }
468
- const l = m.filter((u) => !J(e.key, u) && B(e.values[u]) === 0);
469
+ const l = m.filter((u) => !J(e.key, u) && I(e.values[u]) === 0);
469
470
  if (a < 5e-3 || l.length === 0) {
470
471
  de.message(
471
472
  a < 5e-3 ? "Nothing is left to spread" : "No empty open periods on this line"
@@ -479,32 +480,32 @@ function Qa(_) {
479
480
  }, Xe = G(() => {
480
481
  const e = {}, a = {};
481
482
  for (const l of m)
482
- e[l] = E(Z.reduce((s, r) => s + B(r.values[l]), 0)), a[l] = E(((c == null ? void 0 : c.rows) ?? []).reduce((s, r) => s + B(r.values[l]), 0));
483
+ e[l] = E(Z.reduce((s, r) => s + I(r.values[l]), 0)), a[l] = E(((c == null ? void 0 : c.rows) ?? []).reduce((s, r) => s + I(r.values[l]), 0));
483
484
  return { planBy: e, actualBy: a };
484
485
  }, [m, Z, c]), Jt = St + m.length * Ot + Lt;
485
- return !i && oe ? /* @__PURE__ */ t("div", { className: "space-y-1.5", "data-plan-grid-loading": !0, children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
486
+ return !i && re ? /* @__PURE__ */ t("div", { className: "space-y-1.5", "data-plan-grid-loading": !0, children: [0, 1, 2].map((e) => /* @__PURE__ */ t(
486
487
  "div",
487
488
  {
488
489
  className: "h-8 animate-pulse rounded",
489
490
  style: { background: "hsl(var(--nvr-skeleton))" }
490
491
  },
491
492
  e
492
- )) }) : /* @__PURE__ */ d("div", { ref: Ve, "data-plan-grid": n, className: "min-w-0", children: [
493
+ )) }) : /* @__PURE__ */ d("div", { ref: Qe, "data-plan-grid": n, className: "min-w-0", children: [
493
494
  c && yt.length > 0 && U && /* @__PURE__ */ t(
494
- fa,
495
+ xa,
495
496
  {
496
497
  proposals: yt,
497
- onApply: It,
498
+ onApply: Bt,
498
499
  onDismiss: (e) => bt(e, !0)
499
500
  }
500
501
  ),
501
502
  (pt.length > 0 || $) && /* @__PURE__ */ d("div", { className: "mb-2 flex flex-wrap items-center gap-1.5", "data-o2m-stats": !0, children: [
502
503
  /* @__PURE__ */ t(
503
- xa,
504
+ ga,
504
505
  {
505
506
  data: c,
506
- loading: !!$ && !i && Be.isLoading,
507
- error: !!$ && !i && Be.isError
507
+ loading: !!$ && !i && Ie.isLoading,
508
+ error: !!$ && !i && Ie.isError
508
509
  }
509
510
  ),
510
511
  pt.map((e) => /* @__PURE__ */ t(
@@ -565,7 +566,7 @@ function Qa(_) {
565
566
  /* @__PURE__ */ t(
566
567
  "th",
567
568
  {
568
- className: I(
569
+ className: B(
569
570
  xe,
570
571
  "z-[3] border-b px-3 py-1.5 text-left text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"
571
572
  ),
@@ -577,7 +578,7 @@ function Qa(_) {
577
578
  return /* @__PURE__ */ t(
578
579
  "th",
579
580
  {
580
- className: I(
581
+ className: B(
581
582
  "border-b border-slate-200 px-2.5 py-1.5 text-right text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:border-border dark:text-slate-400",
582
583
  a && Ne
583
584
  ),
@@ -606,7 +607,7 @@ function Qa(_) {
606
607
  /* @__PURE__ */ t(
607
608
  "th",
608
609
  {
609
- className: I(
610
+ className: B(
610
611
  ge,
611
612
  "z-[3] border-b px-3 py-1.5 text-right text-[10.5px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"
612
613
  ),
@@ -614,7 +615,7 @@ function Qa(_) {
614
615
  }
615
616
  )
616
617
  ] }) }),
617
- re.length === 0 && /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ d(
618
+ se.length === 0 && /* @__PURE__ */ t("tbody", { children: /* @__PURE__ */ t("tr", { children: /* @__PURE__ */ d(
618
619
  "td",
619
620
  {
620
621
  colSpan: m.length + 2,
@@ -625,32 +626,32 @@ function Qa(_) {
625
626
  ]
626
627
  }
627
628
  ) }) }),
628
- re.map((e, a) => {
629
- var S, Q, te;
629
+ se.map((e, a) => {
630
+ var S, z, te;
630
631
  const l = !At.has(e.key), s = (h) => {
631
632
  var w;
632
- return e.mode === "split" ? E(e.cats.reduce((ae, Gt) => ae + B(Gt.values[h]), 0)) : B((w = e.top) == null ? void 0 : w.values[h]);
633
+ return e.mode === "split" ? E(e.cats.reduce((ae, Gt) => ae + I(Gt.values[h]), 0)) : I((w = e.top) == null ? void 0 : w.values[h]);
633
634
  }, r = E(m.reduce((h, w) => h + s(w), 0)), u = m.some(
634
635
  (h) => Math.abs(Se(e.key, Ke, h).value) >= 5e-3
635
636
  ), O = ((c == null ? void 0 : c.series) ?? []).filter(
636
637
  (h) => m.some((w) => Math.abs(ve(h, e.key, w) ?? 0) >= 5e-3)
637
- ), H = m.some((h) => Math.abs(Se(e.key, null, h).value) >= 5e-3), A = (((S = e.top) == null ? void 0 : S.edited) || ((Q = e.top) == null ? void 0 : Q.isNew) || e.cats.some((h) => h.edited || h.isNew)) ?? !1;
638
+ ), H = m.some((h) => Math.abs(Se(e.key, null, h).value) >= 5e-3), A = (((S = e.top) == null ? void 0 : S.edited) || ((z = e.top) == null ? void 0 : z.isNew) || e.cats.some((h) => h.edited || h.isNew)) ?? !1;
638
639
  return /* @__PURE__ */ d(
639
640
  "tbody",
640
641
  {
641
642
  "data-plan-block": e.key,
642
643
  "data-plan-mode": e.mode,
643
- className: I(a > 0 && "pg-block"),
644
+ className: B(a > 0 && "pg-block"),
644
645
  children: [
645
646
  /* @__PURE__ */ d(
646
647
  "tr",
647
648
  {
648
649
  "data-o2m-row": (te = e.top) != null && te.id ? `${n}:${e.top.id}` : void 0,
649
- className: I(
650
+ className: B(
650
651
  a > 0 && "[&>td]:border-t [&>td]:border-slate-200 dark:[&>td]:border-border"
651
652
  ),
652
653
  children: [
653
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
654
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
654
655
  e.mode === "split" ? /* @__PURE__ */ t(
655
656
  "button",
656
657
  {
@@ -676,7 +677,7 @@ function Qa(_) {
676
677
  ),
677
678
  /* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: e.mode === "ghost" ? "" : Fe }),
678
679
  U && e.mode !== "ghost" && /* @__PURE__ */ t(
679
- _a,
680
+ Sa,
680
681
  {
681
682
  block: e,
682
683
  config: o,
@@ -691,7 +692,7 @@ function Qa(_) {
691
692
  catLabel: we,
692
693
  showHistory: f,
693
694
  onHistory: Ge,
694
- onSpread: F ? Vt : null,
695
+ onSpread: F ? Qt : null,
695
696
  onRemove: () => jt(e),
696
697
  onDone: Ft,
697
698
  rc: n
@@ -722,11 +723,11 @@ function Qa(_) {
722
723
  return e.mode === "split" ? /* @__PURE__ */ t(
723
724
  "td",
724
725
  {
725
- className: I(
726
+ className: B(
726
727
  "px-2.5 py-1 text-right font-semibold text-slate-900 dark:text-slate-100",
727
728
  w && Ne
728
729
  ),
729
- children: /* @__PURE__ */ t(se, { n: s(h) })
730
+ children: /* @__PURE__ */ t(ne, { n: s(h) })
730
731
  },
731
732
  h
732
733
  ) : /* @__PURE__ */ t(
@@ -735,8 +736,8 @@ function Qa(_) {
735
736
  row: e.top,
736
737
  col: h,
737
738
  closed: w,
738
- prov: ne(e.top, h),
739
- cellKey: z(e.top, h),
739
+ prov: oe(e.top, h),
740
+ cellKey: Q(e.top, h),
740
741
  locked: Pe(e.key, h),
741
742
  lockedTip: w ? (c == null ? void 0 : c.closed_locked_message) ?? "This period is closed" : void 0,
742
743
  onCommit: (ae) => X(e.top, { [h]: ae }),
@@ -749,11 +750,11 @@ function Qa(_) {
749
750
  /* @__PURE__ */ t(
750
751
  "td",
751
752
  {
752
- className: I(
753
+ className: B(
753
754
  ge,
754
755
  "px-3 py-1 text-right font-semibold text-slate-900 dark:text-slate-100"
755
756
  ),
756
- children: e.mode === "ghost" ? "" : /* @__PURE__ */ t(se, { n: r })
757
+ children: e.mode === "ghost" ? "" : /* @__PURE__ */ t(ne, { n: r })
757
758
  }
758
759
  )
759
760
  ]
@@ -772,12 +773,12 @@ function Qa(_) {
772
773
  isClosed: J,
773
774
  row: e.mode === "top" ? e.top : null,
774
775
  canReconcile: U && e.mode === "top",
775
- onReconcile: Qe,
776
+ onReconcile: Ve,
776
777
  carryFor: ze
777
778
  }
778
779
  ),
779
780
  e.mode !== "split" && O.map((h) => /* @__PURE__ */ d("tr", { "data-compare-series": h.key, children: [
780
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 py-0.5"), children: /* @__PURE__ */ t(
781
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 py-0.5"), children: /* @__PURE__ */ t(
781
782
  "span",
782
783
  {
783
784
  "data-tip": h.hint ?? "",
@@ -788,7 +789,7 @@ function Qa(_) {
788
789
  m.map((w) => /* @__PURE__ */ t(
789
790
  "td",
790
791
  {
791
- className: I(
792
+ className: B(
792
793
  "px-2.5 py-0.5 text-right text-[11.5px] text-slate-500 dark:text-slate-400",
793
794
  J(e.key, w) && Ne
794
795
  ),
@@ -798,16 +799,16 @@ function Qa(_) {
798
799
  series: h,
799
800
  value: ve(h, e.key, w) ?? 0,
800
801
  periodLabel: `${Re(w)} ${e.key}`,
801
- children: /* @__PURE__ */ t(se, { n: ve(h, e.key, w) ?? 0, muted: !0 })
802
+ children: /* @__PURE__ */ t(ne, { n: ve(h, e.key, w) ?? 0, muted: !0 })
802
803
  }
803
- ) : /* @__PURE__ */ t(se, { n: 0, muted: !0 })
804
+ ) : /* @__PURE__ */ t(ne, { n: 0, muted: !0 })
804
805
  },
805
806
  w
806
807
  )),
807
808
  /* @__PURE__ */ t(
808
809
  "td",
809
810
  {
810
- className: I(
811
+ className: B(
811
812
  ge,
812
813
  "px-3 py-0.5 text-right text-[11.5px] text-slate-500 dark:text-slate-400"
813
814
  ),
@@ -821,7 +822,7 @@ function Qa(_) {
821
822
  periodLabel: String(e.key),
822
823
  whole: !0,
823
824
  children: /* @__PURE__ */ t(
824
- se,
825
+ ne,
825
826
  {
826
827
  n: E(
827
828
  m.reduce((w, ae) => w + (ve(h, e.key, ae) ?? 0), 0)
@@ -834,14 +835,14 @@ function Qa(_) {
834
835
  }
835
836
  )
836
837
  ] }, h.key)),
837
- e.mode === "split" && l && e.cats.map((h) => /* @__PURE__ */ d($a, { children: [
838
+ e.mode === "split" && l && e.cats.map((h) => /* @__PURE__ */ d(Ca, { children: [
838
839
  /* @__PURE__ */ d(
839
840
  "tr",
840
841
  {
841
842
  "data-o2m-row": h.id ? `${n}:${h.id}` : void 0,
842
843
  "data-plan-category": h.cat ?? "",
843
844
  children: [
844
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1 pl-[22px]", children: [
845
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 py-1"), children: /* @__PURE__ */ d("div", { className: "flex items-center gap-1 pl-[22px]", children: [
845
846
  /* @__PURE__ */ t("span", { className: "truncate text-[12.5px] font-medium text-slate-800 dark:text-slate-100", children: we(h.cat) }),
846
847
  (h.edited || h.isNew) && /* @__PURE__ */ t("span", { className: "h-1.5 w-1.5 rounded-full bg-amber-500" }),
847
848
  /* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: Fe })
@@ -852,8 +853,8 @@ function Qa(_) {
852
853
  row: h,
853
854
  col: w,
854
855
  closed: J(e.key, w),
855
- prov: ne(h, w),
856
- cellKey: z(h, w),
856
+ prov: oe(h, w),
857
+ cellKey: Q(h, w),
857
858
  locked: Pe(e.key, w),
858
859
  lockedTip: J(e.key, w) ? (c == null ? void 0 : c.closed_locked_message) ?? "This period is closed" : void 0,
859
860
  onCommit: (ae) => X(h, { [w]: ae }),
@@ -865,11 +866,11 @@ function Qa(_) {
865
866
  /* @__PURE__ */ t(
866
867
  "td",
867
868
  {
868
- className: I(
869
+ className: B(
869
870
  ge,
870
871
  "px-3 py-1 text-right font-medium text-slate-800 dark:text-slate-100"
871
872
  ),
872
- children: /* @__PURE__ */ t(se, { n: Y(h.values) })
873
+ children: /* @__PURE__ */ t(ne, { n: Y(h.values) })
873
874
  }
874
875
  )
875
876
  ]
@@ -883,12 +884,12 @@ function Qa(_) {
883
884
  cat: h.cat,
884
885
  cols: m,
885
886
  compare: c,
886
- planOf: (w) => B(h.values[w]),
887
+ planOf: (w) => I(h.values[w]),
887
888
  actualFor: Se,
888
889
  isClosed: J,
889
890
  row: h,
890
891
  canReconcile: U,
891
- onReconcile: Qe,
892
+ onReconcile: Ve,
892
893
  carryFor: ze,
893
894
  indent: !0
894
895
  }
@@ -908,7 +909,7 @@ function Qa(_) {
908
909
  isClosed: J,
909
910
  row: null,
910
911
  canReconcile: !1,
911
- onReconcile: Qe,
912
+ onReconcile: Ve,
912
913
  carryFor: ze,
913
914
  indent: !0,
914
915
  plain: !0
@@ -919,9 +920,9 @@ function Qa(_) {
919
920
  e.key
920
921
  );
921
922
  }),
922
- re.length > 1 && /* @__PURE__ */ d("tfoot", { children: [
923
+ se.length > 1 && /* @__PURE__ */ d("tfoot", { children: [
923
924
  /* @__PURE__ */ d("tr", { className: "[&>td]:border-t [&>td]:border-slate-300 dark:[&>td]:border-border", children: [
924
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 py-1.5"), children: /* @__PURE__ */ d("div", { className: "flex items-center pl-[22px]", children: [
925
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 py-1.5"), children: /* @__PURE__ */ d("div", { className: "flex items-center pl-[22px]", children: [
925
926
  /* @__PURE__ */ t("span", { className: "text-[12px] font-semibold text-slate-900 dark:text-slate-100", children: "All" }),
926
927
  /* @__PURE__ */ t("span", { className: "ml-auto text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: Fe })
927
928
  ] }) }),
@@ -929,39 +930,39 @@ function Qa(_) {
929
930
  "td",
930
931
  {
931
932
  className: "px-2.5 py-1.5 text-right font-semibold text-slate-900 dark:text-slate-100",
932
- children: /* @__PURE__ */ t(se, { n: Xe.planBy[e] })
933
+ children: /* @__PURE__ */ t(ne, { n: Xe.planBy[e] })
933
934
  },
934
935
  e
935
936
  )),
936
937
  /* @__PURE__ */ t(
937
938
  "td",
938
939
  {
939
- className: I(
940
+ className: B(
940
941
  ge,
941
942
  "px-3 py-1.5 text-right font-semibold text-slate-900 dark:text-slate-100"
942
943
  ),
943
- children: /* @__PURE__ */ t(se, { n: Ue })
944
+ children: /* @__PURE__ */ t(ne, { n: Ue })
944
945
  }
945
946
  )
946
947
  ] }),
947
948
  c && /* @__PURE__ */ d("tr", { children: [
948
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 pb-1.5 pt-0"), children: /* @__PURE__ */ t("span", { className: "block text-right text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: ke }) }),
949
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 pb-1.5 pt-0"), children: /* @__PURE__ */ t("span", { className: "block text-right text-[10.5px] font-medium text-slate-500 dark:text-slate-400", children: ke }) }),
949
950
  m.map((e) => /* @__PURE__ */ t(
950
951
  "td",
951
952
  {
952
953
  className: "px-2.5 pb-1.5 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300",
953
- children: /* @__PURE__ */ t(se, { n: Xe.actualBy[e], muted: !0 })
954
+ children: /* @__PURE__ */ t(ne, { n: Xe.actualBy[e], muted: !0 })
954
955
  },
955
956
  e
956
957
  )),
957
958
  /* @__PURE__ */ t(
958
959
  "td",
959
960
  {
960
- className: I(
961
+ className: B(
961
962
  ge,
962
963
  "px-3 pb-1.5 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300"
963
964
  ),
964
- children: /* @__PURE__ */ t(se, { n: E(m.reduce((e, a) => e + Xe.actualBy[a], 0)), muted: !0 })
965
+ children: /* @__PURE__ */ t(ne, { n: E(m.reduce((e, a) => e + Xe.actualBy[a], 0)), muted: !0 })
965
966
  }
966
967
  )
967
968
  ] })
@@ -982,7 +983,7 @@ function Qa(_) {
982
983
  ),
983
984
  U && /* @__PURE__ */ d("div", { className: "mt-2 flex items-center gap-2", children: [
984
985
  /* @__PURE__ */ t(
985
- La,
986
+ Ma,
986
987
  {
987
988
  config: o,
988
989
  client: C,
@@ -995,7 +996,7 @@ function Qa(_) {
995
996
  ] }),
996
997
  Ze,
997
998
  V && Ze == null && /* @__PURE__ */ t(
998
- va,
999
+ Na,
999
1000
  {
1000
1001
  open: !0,
1001
1002
  onOpenChange: (e) => {
@@ -1024,14 +1025,14 @@ function Qa(_) {
1024
1025
  function tt(_) {
1025
1026
  return _.replace(/_/g, " ").replace(/^\w/, (n) => n.toUpperCase());
1026
1027
  }
1027
- function $a(_) {
1028
+ function Ca(_) {
1028
1029
  return /* @__PURE__ */ t(Zt, { children: _.children });
1029
1030
  }
1030
- function se(_) {
1031
+ function ne(_) {
1031
1032
  return Math.abs(_.n) < 5e-3 ? /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: "—" }) : /* @__PURE__ */ t("span", { children: D(_.n) });
1032
1033
  }
1033
1034
  function Mt(_) {
1034
- const { row: n, col: p, closed: y, locked: o, lockedTip: $, prov: M, cellKey: K, onCommit: F, onMove: L, onPaste: f } = _, b = B(n.values[p]), C = M ? `${Re(p)} · changed ${ca(M.at)} by ${M.who}${M.reason ? `
1035
+ const { row: n, col: p, closed: y, locked: o, lockedTip: $, prov: M, cellKey: K, onCommit: F, onMove: L, onPaste: f } = _, b = I(n.values[p]), C = M ? `${Re(p)} · changed ${ca(M.at)} by ${M.who}${M.reason ? `
1035
1036
  Reason: “${M.reason}”` : ""}` : void 0, k = M != null && M.reason ? /* @__PURE__ */ t(
1036
1037
  "span",
1037
1038
  {
@@ -1048,13 +1049,13 @@ Reason: “${M.reason}”` : ""}` : void 0, k = M != null && M.reason ? /* @__PU
1048
1049
  "data-tip": [$, C].filter(Boolean).join(`
1049
1050
  `) || void 0,
1050
1051
  "data-grid-cell": K,
1051
- className: I(
1052
+ className: B(
1052
1053
  "relative px-2.5 py-1 text-right text-slate-700 dark:text-slate-200",
1053
1054
  y && Ne
1054
1055
  ),
1055
1056
  children: [
1056
1057
  k,
1057
- /* @__PURE__ */ t(se, { n: b })
1058
+ /* @__PURE__ */ t(ne, { n: b })
1058
1059
  ]
1059
1060
  }
1060
1061
  );
@@ -1074,7 +1075,7 @@ Reason: “${M.reason}”` : ""}` : void 0, k = M != null && M.reason ? /* @__PU
1074
1075
  return /* @__PURE__ */ d(
1075
1076
  "td",
1076
1077
  {
1077
- className: I("relative p-0", y && Ne),
1078
+ className: B("relative p-0", y && Ne),
1078
1079
  "data-grid-cell": K,
1079
1080
  "data-tip": C,
1080
1081
  children: [
@@ -1125,7 +1126,7 @@ function at(_) {
1125
1126
  plain: x
1126
1127
  } = _, j = E($.reduce((T, v) => T + F(y, o, v).value, 0));
1127
1128
  return /* @__PURE__ */ d("tr", { "data-plan-actual": o ?? "all", children: [
1128
- /* @__PURE__ */ t("td", { className: I(xe, "px-2 pb-1 pt-0"), children: /* @__PURE__ */ t(
1129
+ /* @__PURE__ */ t("td", { className: B(xe, "px-2 pb-1 pt-0"), children: /* @__PURE__ */ t(
1129
1130
  "span",
1130
1131
  {
1131
1132
  "data-tip": p,
@@ -1139,9 +1140,9 @@ function at(_) {
1139
1140
  "td",
1140
1141
  {
1141
1142
  "data-compare-cell": T,
1142
- className: I("px-2.5 pb-1 pt-0 text-right text-[11.5px]", v && Ne),
1143
+ className: B("px-2.5 pb-1 pt-0 text-right text-[11.5px]", v && Ne),
1143
1144
  children: Math.abs(g.value) < 5e-3 && !U ? /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: "—" }) : /* @__PURE__ */ t(
1144
- Ca,
1145
+ _a,
1145
1146
  {
1146
1147
  title: `${Re(T)} ${y}`,
1147
1148
  compare: M,
@@ -1157,7 +1158,7 @@ function at(_) {
1157
1158
  column: T,
1158
1159
  openColumns: $.filter((R) => !L(y, R)),
1159
1160
  carry: (k == null ? void 0 : k(y, o)) ?? null,
1160
- onApply: (R, q, oe) => C(f, R, q, oe)
1161
+ onApply: (R, q, re) => C(f, R, q, re)
1161
1162
  } : null
1162
1163
  }
1163
1164
  )
@@ -1168,11 +1169,11 @@ function at(_) {
1168
1169
  /* @__PURE__ */ t(
1169
1170
  "td",
1170
1171
  {
1171
- className: I(
1172
+ className: B(
1172
1173
  ge,
1173
1174
  "px-3 pb-1 pt-0 text-right text-[11.5px] text-slate-600 dark:text-slate-300"
1174
1175
  ),
1175
- children: /* @__PURE__ */ t(se, { n: j, muted: !0 })
1176
+ children: /* @__PURE__ */ t(ne, { n: j, muted: !0 })
1176
1177
  }
1177
1178
  )
1178
1179
  ] });
@@ -1182,12 +1183,12 @@ const Rt = {
1182
1183
  danger: "text-red-700 dark:text-red-300 font-medium",
1183
1184
  neutral: "text-slate-600 dark:text-slate-300"
1184
1185
  };
1185
- function Ca(_) {
1186
- var z, ne;
1187
- const { title: n, compare: p, actualName: y, actual: o, planned: $, closed: M, plain: K, details: F, tone: L, reconcile: f } = _, [b, C] = W(!1), [k, x] = W("next"), [j, T] = W(""), v = Et(p), g = E($ - o), i = f && f.openColumns.length === 0 && f.carry && !f.carry.blocked ? f.carry : null, U = f && f.openColumns.length === 0 ? ((z = f.carry) == null ? void 0 : z.blocked) ?? null : null, m = i ? ((ne = i.row) == null ? void 0 : ne.values) ?? {} : (f == null ? void 0 : f.row.values) ?? {}, R = i ? i.openColumns : (f == null ? void 0 : f.openColumns) ?? [], q = G(
1186
+ function _a(_) {
1187
+ var Q, oe;
1188
+ const { title: n, compare: p, actualName: y, actual: o, planned: $, closed: M, plain: K, details: F, tone: L, reconcile: f } = _, [b, C] = W(!1), [k, x] = W("next"), [j, T] = W(""), v = Et(p), g = E($ - o), i = f && f.openColumns.length === 0 && f.carry && !f.carry.blocked ? f.carry : null, U = f && f.openColumns.length === 0 ? ((Q = f.carry) == null ? void 0 : Q.blocked) ?? null : null, m = i ? ((oe = i.row) == null ? void 0 : oe.values) ?? {} : (f == null ? void 0 : f.row.values) ?? {}, R = i ? i.openColumns : (f == null ? void 0 : f.openColumns) ?? [], q = G(
1188
1189
  () => {
1189
1190
  var N;
1190
- return f ? wa({
1191
+ return f ? $a({
1191
1192
  row: f.row.values,
1192
1193
  column: f.column,
1193
1194
  actual: o,
@@ -1197,7 +1198,7 @@ function Ca(_) {
1197
1198
  }) : null;
1198
1199
  },
1199
1200
  [f, i, o, k]
1200
- ), oe = q ? q.targetPatch ?? q.patch : {}, be = R.some((N) => B(m[N]) > 5e-3), P = G(() => {
1201
+ ), re = q ? q.targetPatch ?? q.patch : {}, be = R.some((N) => I(m[N]) > 5e-3), P = G(() => {
1201
1202
  const N = `Reconciled ${n} to ${y.toLowerCase()} (${D(o)})`;
1202
1203
  if (!q || Math.abs(q.moved) < 5e-3) return N;
1203
1204
  const pe = `${q.targets.length === 1 ? Re(q.targets[0]) : `${q.targets.length} open periods`}${i ? ` ${i.key}` : ""}`;
@@ -1232,7 +1233,7 @@ function Ca(_) {
1232
1233
  "data-compare-details": !0,
1233
1234
  "data-tip": "",
1234
1235
  "data-plan-off": L === "warn" ? "true" : void 0,
1235
- className: I(
1236
+ className: B(
1236
1237
  "rounded px-0.5 underline-offset-2 hover:underline focus-visible:underline",
1237
1238
  Rt[L]
1238
1239
  ),
@@ -1256,7 +1257,7 @@ function Ca(_) {
1256
1257
  /* @__PURE__ */ t(
1257
1258
  "dd",
1258
1259
  {
1259
- className: I(
1260
+ className: B(
1260
1261
  "font-medium",
1261
1262
  Math.abs(g) < 5e-3 ? "text-slate-800 dark:text-slate-100" : Rt[L === "neutral" ? "neutral" : L]
1262
1263
  ),
@@ -1273,7 +1274,7 @@ function Ca(_) {
1273
1274
  ] }),
1274
1275
  /* @__PURE__ */ t("span", { className: "tabular-nums text-slate-800 dark:text-slate-100", children: D(N.amount) })
1275
1276
  ] }, String(N.id))) }),
1276
- F.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-slate-500 dark:text-slate-400", children: `No ${ga(p, 2)} behind this figure.` }),
1277
+ F.length === 0 && /* @__PURE__ */ t("p", { className: "px-3 py-2 text-slate-500 dark:text-slate-400", children: `No ${ya(p, 2)} behind this figure.` }),
1277
1278
  f && q && /* @__PURE__ */ d(
1278
1279
  "div",
1279
1280
  {
@@ -1290,7 +1291,7 @@ function Ca(_) {
1290
1291
  children: le.map((N) => /* @__PURE__ */ d(
1291
1292
  "label",
1292
1293
  {
1293
- className: I(
1294
+ className: B(
1294
1295
  "flex cursor-pointer items-center gap-2",
1295
1296
  N.disabled && "cursor-not-allowed opacity-50"
1296
1297
  ),
@@ -1337,7 +1338,7 @@ function Ca(_) {
1337
1338
  "data-plan-reconcile-preview": !0,
1338
1339
  children: [
1339
1340
  q.targets.slice(0, 6).map(
1340
- (N) => `${nt(N)}${i ? ` ${i.key}` : ""} ${D(B(m[N]))} → ${D(oe[N])}`
1341
+ (N) => `${nt(N)}${i ? ` ${i.key}` : ""} ${D(I(m[N]))} → ${D(re[N])}`
1341
1342
  ).join(" · "),
1342
1343
  q.targets.length > 6 ? ` · +${q.targets.length - 6} more` : ""
1343
1344
  ]
@@ -1375,7 +1376,7 @@ function Ca(_) {
1375
1376
  ] })
1376
1377
  ] });
1377
1378
  }
1378
- function _a(_) {
1379
+ function Sa(_) {
1379
1380
  const {
1380
1381
  block: n,
1381
1382
  config: p,
@@ -1412,7 +1413,7 @@ function _a(_) {
1412
1413
  {
1413
1414
  align: "start",
1414
1415
  sideOffset: 6,
1415
- className: I("p-1.5", v === "split" ? "w-[440px]" : "w-[300px]"),
1416
+ className: B("p-1.5", v === "split" ? "w-[440px]" : "w-[300px]"),
1416
1417
  children: [
1417
1418
  v === "menu" && /* @__PURE__ */ d("div", { children: [
1418
1419
  n.mode === "top" && y && /* @__PURE__ */ d(
@@ -1483,7 +1484,7 @@ function _a(_) {
1483
1484
  }
1484
1485
  ),
1485
1486
  /* @__PURE__ */ t(
1486
- Na,
1487
+ wa,
1487
1488
  {
1488
1489
  collection: x,
1489
1490
  rowId: R.id,
@@ -1497,7 +1498,7 @@ function _a(_) {
1497
1498
  type: "button",
1498
1499
  "data-plan-remove": n.key,
1499
1500
  onClick: () => g("remove"),
1500
- className: I(m, "text-red-700 dark:text-red-300"),
1501
+ className: B(m, "text-red-700 dark:text-red-300"),
1501
1502
  children: [
1502
1503
  /* @__PURE__ */ t(la, { className: "h-3.5 w-3.5" }),
1503
1504
  `Remove ${n.key}`
@@ -1532,7 +1533,7 @@ function _a(_) {
1532
1533
  ] })
1533
1534
  ] }),
1534
1535
  v === "split" && $ && n.top && /* @__PURE__ */ t(
1535
- Sa,
1536
+ Oa,
1536
1537
  {
1537
1538
  block: n,
1538
1539
  config: p,
@@ -1546,7 +1547,7 @@ function _a(_) {
1546
1547
  }
1547
1548
  ),
1548
1549
  v === "merge" && $ && /* @__PURE__ */ t(
1549
- Oa,
1550
+ La,
1550
1551
  {
1551
1552
  block: n,
1552
1553
  config: p,
@@ -1566,8 +1567,8 @@ function _a(_) {
1566
1567
  function st(_) {
1567
1568
  return da(_, "Something went wrong");
1568
1569
  }
1569
- function Sa(_) {
1570
- var oe, be;
1570
+ function Oa(_) {
1571
+ var re, be;
1571
1572
  const { block: n, config: p, splitBase: y, client: o, cols: $, onCancel: M, onDone: K } = _, F = Number.isFinite(Number(n.key)) ? Number(n.key) : n.key, [L, f] = W(null), [b, C] = W(null), [k, x] = W(null), [j, T] = W(!1), [v, g] = W(""), i = JSON.stringify(L);
1572
1573
  ye(() => {
1573
1574
  let P = !0;
@@ -1579,13 +1580,13 @@ function Sa(_) {
1579
1580
  preview: !0,
1580
1581
  ...L ? { shares: L } : {}
1581
1582
  })
1582
- ).then((z) => {
1583
- P && (C(z.data), x(null), L || f(
1583
+ ).then((Q) => {
1584
+ P && (C(Q.data), x(null), L || f(
1584
1585
  Object.fromEntries(
1585
- z.data.categories.map((ne) => [String(ne.id), Math.round(ne.share * 1e3) / 10])
1586
+ Q.data.categories.map((oe) => [String(oe.id), Math.round(oe.share * 1e3) / 10])
1586
1587
  )
1587
1588
  ));
1588
- }).catch((z) => P && x(st(z)));
1589
+ }).catch((Q) => P && x(st(Q)));
1589
1590
  },
1590
1591
  L ? 250 : 0
1591
1592
  );
@@ -1608,7 +1609,7 @@ function Sa(_) {
1608
1609
  } finally {
1609
1610
  T(!1);
1610
1611
  }
1611
- }, q = (P) => E($.reduce((le, z) => le + B(P[z]), 0));
1612
+ }, q = (P) => E($.reduce((le, Q) => le + I(P[Q]), 0));
1612
1613
  return /* @__PURE__ */ d("div", { className: "p-1.5", "data-plan-split-pane": !0, children: [
1613
1614
  /* @__PURE__ */ t("p", { className: "text-[12.5px] font-semibold text-slate-900 dark:text-slate-100", children: `${p.split_label ?? "Plan by category"} · ${n.key}` }),
1614
1615
  /* @__PURE__ */ t("p", { className: "mt-0.5 text-[11.5px] text-slate-600 dark:text-slate-300", children: "Every period is divided by these shares. Closed periods keep their totals; open ones can be changed in the grid afterwards." }),
@@ -1619,21 +1620,21 @@ function Sa(_) {
1619
1620
  style: { background: "hsl(var(--nvr-skeleton))" }
1620
1621
  }
1621
1622
  ),
1622
- b && (((oe = b.share_sets) == null ? void 0 : oe.length) ?? 0) > 1 && /* @__PURE__ */ d("div", { className: "mt-2 flex flex-wrap items-center gap-1", "data-plan-share-sets": !0, children: [
1623
+ b && (((re = b.share_sets) == null ? void 0 : re.length) ?? 0) > 1 && /* @__PURE__ */ d("div", { className: "mt-2 flex flex-wrap items-center gap-1", "data-plan-share-sets": !0, children: [
1623
1624
  /* @__PURE__ */ t("span", { className: "text-[11px] text-slate-500 dark:text-slate-400", children: "Shares from" }),
1624
1625
  (be = b.share_sets) == null ? void 0 : be.map((P) => {
1625
1626
  const le = Object.fromEntries(
1626
- Object.entries(P.shares).map(([ne, N]) => [ne, Math.round(N * 1e3) / 10])
1627
- ), z = JSON.stringify(le) === i;
1627
+ Object.entries(P.shares).map(([oe, N]) => [oe, Math.round(N * 1e3) / 10])
1628
+ ), Q = JSON.stringify(le) === i;
1628
1629
  return /* @__PURE__ */ t(
1629
1630
  "button",
1630
1631
  {
1631
1632
  type: "button",
1632
1633
  "data-plan-share-set": P.key,
1633
- "aria-pressed": z,
1634
+ "aria-pressed": Q,
1634
1635
  "data-tip": P.hint ?? "",
1635
1636
  onClick: () => f(le),
1636
- className: `h-6 rounded-md border px-1.5 text-[11px] font-medium ${z ? "border-transparent bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300"}`,
1637
+ className: `h-6 rounded-md border px-1.5 text-[11px] font-medium ${Q ? "border-transparent bg-nvr-cyan text-white" : "border-slate-200 text-slate-600 hover:bg-muted dark:border-border dark:text-slate-300"}`,
1637
1638
  children: P.label
1638
1639
  },
1639
1640
  P.key
@@ -1652,16 +1653,15 @@ function Sa(_) {
1652
1653
  /* @__PURE__ */ t("td", { className: "py-1 text-slate-800 dark:text-slate-100", children: P.label }),
1653
1654
  /* @__PURE__ */ d("td", { className: "py-1 text-right", children: [
1654
1655
  /* @__PURE__ */ t(
1655
- "input",
1656
+ ua,
1656
1657
  {
1658
+ bare: !0,
1659
+ type: "text",
1660
+ allowNegative: !1,
1657
1661
  "data-plan-share": String(P.id),
1658
1662
  "aria-label": `${P.label} share`,
1659
- inputMode: "decimal",
1660
1663
  value: (L == null ? void 0 : L[String(P.id)]) ?? "",
1661
- onChange: (le) => {
1662
- const z = Number(le.target.value);
1663
- !Number.isFinite(z) || z < 0 || f((ne) => ({ ...ne ?? {}, [String(P.id)]: z }));
1664
- },
1664
+ onValue: (le) => f((Q) => ({ ...Q ?? {}, [String(P.id)]: le ?? 0 })),
1665
1665
  className: "h-6 w-16 rounded border border-slate-200 bg-background px-1.5 text-right text-[12px] outline-none focus:border-slate-400 dark:border-border"
1666
1666
  }
1667
1667
  ),
@@ -1722,7 +1722,7 @@ function Sa(_) {
1722
1722
  ] })
1723
1723
  ] });
1724
1724
  }
1725
- function Oa(_) {
1725
+ function La(_) {
1726
1726
  const { block: n, config: p, splitBase: y, client: o, onCancel: $, onDone: M } = _, K = Number.isFinite(Number(n.key)) ? Number(n.key) : n.key, [F, L] = W(""), [f, b] = W(!1), [C, k] = W(null), x = `Merged the ${n.key} plan back to one line`;
1727
1727
  return /* @__PURE__ */ d("div", { className: "p-1.5", "data-plan-merge-pane": !0, children: [
1728
1728
  /* @__PURE__ */ t("p", { className: "text-[12.5px] font-semibold text-slate-900 dark:text-slate-100", children: `${p.merge_label ?? "Merge back to one line"} · ${n.key}` }),
@@ -1777,7 +1777,7 @@ function Oa(_) {
1777
1777
  ] })
1778
1778
  ] });
1779
1779
  }
1780
- function La(_) {
1780
+ function Ma(_) {
1781
1781
  const { config: n, client: p, used: y, onAdd: o, label: $ } = _, [M, K] = W(!1), [F, L] = W(""), { data: f = [] } = ce({
1782
1782
  queryKey: ["plan-grid-keys", n.key_collection],
1783
1783
  queryFn: () => p.request(
@@ -1835,8 +1835,8 @@ function La(_) {
1835
1835
  ] });
1836
1836
  }
1837
1837
  export {
1838
- Qa as PlanGridField,
1838
+ Ja as PlanGridField,
1839
1839
  D as fmtFigure,
1840
1840
  Tt as parseFigure,
1841
- wa as reconcilePatch
1841
+ $a as reconcilePatch
1842
1842
  };