@nivaro/react 0.3.104 → 0.3.105

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import { useNivaroClient as si, useDrilldown as Ja, useParentDraft as Qa, useRei
9
9
  import { get as de, post as Le, patch as ii, del as gl } from "../../lib/commands.js";
10
10
  import { useAfterIdle as Va } from "../../lib/defer.js";
11
11
  import { evaluateNumeric as wt, evaluateBoolean as Ha } from "../../lib/expression.js";
12
- import { numericIntlOptions as St } from "../../lib/format-value.js";
12
+ import { numericIntlOptions as $t } from "../../lib/format-value.js";
13
13
  import { isOwnWrite as Ya } from "../../lib/own-writes.js";
14
14
  import { useOptionalRealtime as Ga } from "../../lib/realtime.js";
15
15
  import { useRecordReader as Ca } from "../../lib/record-loader.js";
@@ -239,7 +239,7 @@ function ri(s, u) {
239
239
  );
240
240
  }
241
241
  function Cd(s, u, b) {
242
- return u === "presence" ? s != null && String(s).trim() !== "" ? "Yes" : "No" : s == null || s === "" ? "—" : u === "currency" && Number.isFinite(Number(s)) ? Number(s).toLocaleString("en-US", St(b, "currency")) : String(s);
242
+ return u === "presence" ? s != null && String(s).trim() !== "" ? "Yes" : "No" : s == null || s === "" ? "—" : u === "currency" && Number.isFinite(Number(s)) ? Number(s).toLocaleString("en-US", $t(b, "currency")) : String(s);
243
243
  }
244
244
  function Xd({
245
245
  config: s,
@@ -273,7 +273,7 @@ function Xd({
273
273
  ), Ze = K(
274
274
  () => bl(s.filter, ee, A),
275
275
  [s.filter, ee, A]
276
- ), $t = K(() => {
276
+ ), qt = K(() => {
277
277
  const F = /* @__PURE__ */ new Set(["id"]);
278
278
  s.group_by && F.add(s.group_by);
279
279
  const M = (L) => {
@@ -289,12 +289,12 @@ function Xd({
289
289
  "allocate-options",
290
290
  s.collection,
291
291
  JSON.stringify(Ze ?? null),
292
- $t
292
+ qt
293
293
  ],
294
294
  queryFn: () => Se.request(
295
295
  de(`/items/${s.collection}`, {
296
296
  ...Ze ? { filter: JSON.stringify(Ze) } : {},
297
- fields: $t,
297
+ fields: qt,
298
298
  limit: 500
299
299
  })
300
300
  ).then((F) => F.data ?? []),
@@ -686,8 +686,8 @@ function ec({
686
686
  const ye = [], Ge = (Te, qe) => Nd(oe, u.collection, Te, te, qe);
687
687
  try {
688
688
  for (let qe = 0; qe < b.length; qe++) {
689
- const Ze = b[qe], $t = Number(Ze[s.row_qty_field]);
690
- if (!Number.isFinite($t) || $t <= 0) continue;
689
+ const Ze = b[qe], qt = Number(Ze[s.row_qty_field]);
690
+ if (!Number.isFinite(qt) || qt <= 0) continue;
691
691
  const le = oi(u, Ze, A, U);
692
692
  if (!le) continue;
693
693
  const at = await oe.request(
@@ -697,7 +697,7 @@ function ec({
697
697
  limit: 500
698
698
  })
699
699
  ).then((M) => M.data ?? []), vt = at.reduce((M, L) => M + (Number(L[te]) || 0), 0);
700
- let Re = $t - vt;
700
+ let Re = qt - vt;
701
701
  if (Re <= 0) continue;
702
702
  const Pe = oi(
703
703
  {
@@ -811,7 +811,7 @@ function Vc({
811
811
  allocateDrawer: Te,
812
812
  autoAllocate: qe,
813
813
  rowBulkActions: Ze,
814
- uploadTemplate: $t,
814
+ uploadTemplate: qt,
815
815
  rowMatchPanel: le,
816
816
  lineSla: at,
817
817
  rowLints: vt,
@@ -1089,19 +1089,19 @@ function Vc({
1089
1089
  (D ?? []).filter((e) => e.target_type === "lock").map((e) => e.target_field)
1090
1090
  ),
1091
1091
  [D]
1092
- ), [f, Be] = J(null), ft = Wa(), Bn = (e, n) => `${ft}-${e}-${n}`, Ce = ae(null), qo = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, qt = ae(null), Nr = (e, n) => {
1092
+ ), [f, Be] = J(null), ft = Wa(), Bn = (e, n) => `${ft}-${e}-${n}`, Ce = ae(null), qo = (e, n) => e && e !== "new" && !e.startsWith("pending:") ? `${s}:${e}:${n}` : void 0, Et = ae(null), Nr = (e, n) => {
1093
1093
  !e || typeof window > "u" || window.dispatchEvent(new CustomEvent("nvr:cell-editing", { detail: { cell: e, state: n } }));
1094
1094
  }, Ll = (e) => {
1095
1095
  var t, r, i;
1096
1096
  const n = ((i = (r = (t = e.target) == null ? void 0 : t.closest) == null ? void 0 : r.call(t, "[data-grid-cell]")) == null ? void 0 : i.getAttribute("data-grid-cell")) ?? null;
1097
- n !== qt.current && (qt.current && Nr(qt.current, "end"), qt.current = n, n && Nr(n, "start"));
1097
+ n !== Et.current && (Et.current && Nr(Et.current, "end"), Et.current = n, n && Nr(n, "start"));
1098
1098
  }, Tl = (e) => {
1099
1099
  var t, r;
1100
- (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (qt.current && Nr(qt.current, "end"), qt.current = null);
1100
+ (r = (t = e.relatedTarget) == null ? void 0 : t.closest) != null && r.call(t, "[data-grid-cell]") || (Et.current && Nr(Et.current, "end"), Et.current = null);
1101
1101
  };
1102
1102
  ge(
1103
1103
  () => () => {
1104
- qt.current && Nr(qt.current, "end");
1104
+ Et.current && Nr(Et.current, "end");
1105
1105
  },
1106
1106
  []
1107
1107
  );
@@ -1144,7 +1144,7 @@ function Vc({
1144
1144
  }
1145
1145
  if (Jn.current !== e.rowId && !Gt.current)
1146
1146
  return { ok: !0, committed: !1 };
1147
- const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + O.length + 1}` : ni(O, e.rowId, G), t = await Lt();
1147
+ const n = e.rowId === "new" ? "The new line" : e.rowId.startsWith("pending:") ? `Line ${Number(e.rowId.slice(8)) + O.length + 1}` : ni(O, e.rowId, G), t = await Tt();
1148
1148
  return { ok: t, committed: t, label: n };
1149
1149
  };
1150
1150
  const et = x == null ? void 0 : x.noteLineDraft, Oo = !!f && Jn.current === (f.rowId ?? null);
@@ -1179,12 +1179,12 @@ function Vc({
1179
1179
  Fn.current = !0;
1180
1180
  return;
1181
1181
  }
1182
- Fn.current = !1, pt.current && (clearTimeout(pt.current), pt.current = null), Lt();
1182
+ Fn.current = !1, pt.current && (clearTimeout(pt.current), pt.current = null), Tt();
1183
1183
  }
1184
1184
  };
1185
1185
  return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
1186
1186
  }, [f, L]);
1187
- const [_t, fn] = J(!1), [jo, Et] = J(null), [Qn, $r] = J(null), [Lo, To] = J(!1);
1187
+ const [_t, fn] = J(!1), [jo, Ot] = J(null), [Qn, $r] = J(null), [Lo, To] = J(!1);
1188
1188
  async function Rl() {
1189
1189
  if (!Qn) return;
1190
1190
  To(!0);
@@ -1588,11 +1588,11 @@ function Vc({
1588
1588
  let a = null;
1589
1589
  if (i === "count" ? a = e.length : o.length > 0 && (i === "sum" ? a = o.reduce((d, m) => d + m, 0) : i === "avg" ? a = o.reduce((d, m) => d + m, 0) / o.length : i === "min" ? a = Math.min(...o) : i === "max" && (a = Math.max(...o))), a === null) continue;
1590
1590
  const c = r.format === "currency" ? a.toLocaleString("en-US", {
1591
- ...St(r, "currency"),
1591
+ ...$t(r, "currency"),
1592
1592
  currency: r.currency || "USD"
1593
1593
  }) : a.toLocaleString(
1594
1594
  "en-US",
1595
- St(r, r.format)
1595
+ $t(r, r.format)
1596
1596
  );
1597
1597
  n.push({ label: t.label || ve(t.field), text: c });
1598
1598
  }
@@ -1683,20 +1683,20 @@ function Vc({
1683
1683
  e.baseRows ? n : void 0
1684
1684
  )
1685
1685
  ) : Si;
1686
- }, [Ie, dt, Si]), Ho = Je.length >= co, Ot = S == null ? void 0 : S.draft, tn = Rt(
1686
+ }, [Ie, dt, Si]), Ho = Je.length >= co, It = S == null ? void 0 : S.draft, tn = Rt(
1687
1687
  (e) => {
1688
1688
  if (e.startsWith("$parent."))
1689
- return (Ot == null ? void 0 : Ot[e.slice(8)]) ?? 0;
1689
+ return (It == null ? void 0 : It[e.slice(8)]) ?? 0;
1690
1690
  if (e.startsWith("$sum.")) {
1691
1691
  const n = e.slice(5);
1692
1692
  return Cn.reduce((t, r) => t + (Number(r[n]) || 0), 0);
1693
1693
  }
1694
- return e === "$count" ? Cn.length : Ot == null ? void 0 : Ot[e];
1694
+ return e === "$count" ? Cn.length : It == null ? void 0 : It[e];
1695
1695
  },
1696
- [Ot, Cn]
1696
+ [It, Cn]
1697
1697
  ), $i = K(() => Re != null && Re.length ? Re.map((e) => ({ ...e, result: wt(e.value, tn) })) : null, [Re, tn]), Kr = K(
1698
- () => Pe != null && Pe.endpoint ? dd(Pe.endpoint, Ot) : null,
1699
- [Pe == null ? void 0 : Pe.endpoint, Ot]
1698
+ () => Pe != null && Pe.endpoint ? dd(Pe.endpoint, It) : null,
1699
+ [Pe == null ? void 0 : Pe.endpoint, It]
1700
1700
  ), qi = cd({
1701
1701
  client: $,
1702
1702
  endpoint: Kr,
@@ -1941,17 +1941,17 @@ function Vc({
1941
1941
  return t ? ns(t, n) : null;
1942
1942
  }, ke = ce.filter(
1943
1943
  (e) => !e.hidden && (!mo.has(e.type) || Yn(e.interface)) && e.field !== u && e.field !== "id" && (!Ct || e.layout_assigned === !0) && !fo.has(e.field) && !zl.has(e.group_key ?? "")
1944
- ), It = re && re.length >= 2 && fi !== pr ? re.find((e) => e.name === fi) : void 0, Gl = new Set(
1944
+ ), At = re && re.length >= 2 && fi !== pr ? re.find((e) => e.name === fi) : void 0, Gl = new Set(
1945
1945
  (te ?? []).map((e) => typeof e == "string" ? e : e.field)
1946
- ), rs = It ? new Set(
1947
- It.columns.filter((e) => {
1946
+ ), rs = At ? new Set(
1947
+ At.columns.filter((e) => {
1948
1948
  const n = e.indexOf(".");
1949
1949
  return n < 0 ? !0 : !Gl.has(e.slice(0, n));
1950
1950
  })
1951
1951
  ) : null, is = rs ? ke.filter((e) => rs.has(e.field)) : [], vn = K(() => {
1952
- if (!It) return [];
1952
+ if (!At) return [];
1953
1953
  const e = [];
1954
- for (const n of It.columns) {
1954
+ for (const n of At.columns) {
1955
1955
  const t = n.indexOf(".");
1956
1956
  if (t < 0) continue;
1957
1957
  const r = n.slice(0, t), i = n.slice(t + 1);
@@ -1960,10 +1960,10 @@ function Vc({
1960
1960
  )) && e.push({ relationField: r, memberField: i });
1961
1961
  }
1962
1962
  return e;
1963
- }, [It, te]), rn = K(
1963
+ }, [At, te]), rn = K(
1964
1964
  () => [...new Set(vn.map((e) => e.relationField))],
1965
1965
  [vn]
1966
- ), At = K(() => {
1966
+ ), jt = K(() => {
1967
1967
  const e = /* @__PURE__ */ new Map();
1968
1968
  for (const n of rn) {
1969
1969
  const t = Me.find(
@@ -1978,10 +1978,10 @@ function Vc({
1978
1978
  }, [rn, Me, s]), xn = K(
1979
1979
  () => [
1980
1980
  ...new Set(
1981
- [...At.values()].filter((e) => !!e).map((e) => e.grandCollection)
1981
+ [...jt.values()].filter((e) => !!e).map((e) => e.grandCollection)
1982
1982
  )
1983
1983
  ],
1984
- [At]
1984
+ [jt]
1985
1985
  ), os = dn({
1986
1986
  queries: xn.map((e) => ({
1987
1987
  queryKey: ["field-config", e, null],
@@ -2012,7 +2012,7 @@ function Vc({
2012
2012
  }, [xn, ss]), Wr = K(() => {
2013
2013
  const e = /* @__PURE__ */ new Map();
2014
2014
  for (const n of rn) {
2015
- const t = At.get(n);
2015
+ const t = jt.get(n);
2016
2016
  if (!t) continue;
2017
2017
  const r = as.get(t.grandCollection) ?? [], i = /* @__PURE__ */ new Map();
2018
2018
  for (const o of vn) {
@@ -2025,7 +2025,7 @@ function Vc({
2025
2025
  e.set(n, i);
2026
2026
  }
2027
2027
  return e;
2028
- }, [rn, At, as, vn]), Ur = K(() => O.map((e) => String(e.id)), [O]), tr = K(
2028
+ }, [rn, jt, as, vn]), Ur = K(() => O.map((e) => String(e.id)), [O]), tr = K(
2029
2029
  () => `nvr-gf-${Math.abs(Yd(`${s}:${M ?? u}`)) % 1e5}`,
2030
2030
  [s, M, u]
2031
2031
  ), ds = K(() => {
@@ -2068,7 +2068,7 @@ function Vc({
2068
2068
  !!ee && !q
2069
2069
  ), us = dn({
2070
2070
  queries: rn.map((e) => {
2071
- const n = At.get(e);
2071
+ const n = jt.get(e);
2072
2072
  return {
2073
2073
  queryKey: [
2074
2074
  "o2m-rows",
@@ -2093,7 +2093,7 @@ function Vc({
2093
2093
  const e = /* @__PURE__ */ new Map();
2094
2094
  return rn.forEach((n, t) => {
2095
2095
  var o;
2096
- const r = At.get(n), i = /* @__PURE__ */ new Map();
2096
+ const r = jt.get(n), i = /* @__PURE__ */ new Map();
2097
2097
  if (r)
2098
2098
  for (const a of ((o = us[t]) == null ? void 0 : o.data) ?? []) {
2099
2099
  const c = String(a[r.fkField]);
@@ -2101,7 +2101,7 @@ function Vc({
2101
2101
  }
2102
2102
  e.set(n, i);
2103
2103
  }), e;
2104
- }, [rn, At, us]), fs = Kn == null ? void 0 : Kn.report;
2104
+ }, [rn, jt, us]), fs = Kn == null ? void 0 : Kn.report;
2105
2105
  ge(() => {
2106
2106
  if (!fs || !te || te.length === 0) return;
2107
2107
  const e = `${s}.${u}`, n = (r, i) => {
@@ -2219,7 +2219,7 @@ function Vc({
2219
2219
  staleTime: 10 * 6e4
2220
2220
  }), ps = K(
2221
2221
  () => vn.map(({ relationField: e, memberField: n }) => {
2222
- const t = At.get(e), i = (t ? ls.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2222
+ const t = jt.get(e), i = (t ? ls.get(t.grandCollection) ?? [] : []).find((o) => o.field === n);
2223
2223
  return {
2224
2224
  field: `${e}.${n}`,
2225
2225
  type: "presentation",
@@ -2239,7 +2239,7 @@ function Vc({
2239
2239
  dependency_config: null
2240
2240
  };
2241
2241
  }),
2242
- [vn, At, ls]
2242
+ [vn, jt, ls]
2243
2243
  );
2244
2244
  function ot(e) {
2245
2245
  return e.type === "presentation" && e.field.includes(".");
@@ -2301,7 +2301,7 @@ function Vc({
2301
2301
  `${g.id}:${p}`
2302
2302
  )) });
2303
2303
  }
2304
- const Ke = It && (is.length > 0 || ps.length > 0) ? [...is, ...ps] : ke, kn = ae(null), [ea, ji] = J(0), gs = ae(/* @__PURE__ */ new Map()), Dt = ae(0), bs = 1e4, gt = (e) => gs.current.set(String(e), Date.now());
2304
+ const Ke = At && (is.length > 0 || ps.length > 0) ? [...is, ...ps] : ke, kn = ae(null), [ea, ji] = J(0), gs = ae(/* @__PURE__ */ new Map()), Dt = ae(0), bs = 1e4, gt = (e) => gs.current.set(String(e), Date.now());
2305
2305
  ge(() => {
2306
2306
  const e = (n) => {
2307
2307
  var r;
@@ -2338,7 +2338,7 @@ function Vc({
2338
2338
  }
2339
2339
  }
2340
2340
  Vn(), z.invalidateQueries({ queryKey: ["o2m-rows", s, u, b] }), t === 0 && n.length > 0 && be.success("Kept the newer values");
2341
- }, rr = ke.map((e) => e.field).filter((e) => !e.includes(".")).join(","), jt = Rt(
2341
+ }, rr = ke.map((e) => e.field).filter((e) => !e.includes(".")).join(","), Lt = Rt(
2342
2342
  (e) => {
2343
2343
  const n = {};
2344
2344
  for (const t of rr ? rr.split(",") : []) {
@@ -2358,14 +2358,14 @@ function Vc({
2358
2358
  ge(() => {
2359
2359
  if (q || mn || !rr) return;
2360
2360
  if (!kn.current) {
2361
- kn.current = new Map(Je.map((i) => [String(i.id), jt(i)])), ji((i) => i + 1);
2361
+ kn.current = new Map(Je.map((i) => [String(i.id), Lt(i)])), ji((i) => i + 1);
2362
2362
  return;
2363
2363
  }
2364
2364
  const e = kn.current, n = Date.now(), t = /* @__PURE__ */ new Set();
2365
2365
  let r = !1;
2366
2366
  for (const i of Je) {
2367
2367
  const o = String(i.id);
2368
- t.add(o), (Qr(o, n) || !e.has(o) && n - Dt.current < bs) && (e.set(o, jt(i)), r = !0);
2368
+ t.add(o), (Qr(o, n) || !e.has(o) && n - Dt.current < bs) && (e.set(o, Lt(i)), r = !0);
2369
2369
  }
2370
2370
  for (const i of [...e.keys()])
2371
2371
  !t.has(i) && Qr(i, n) && (e.delete(i), r = !0);
@@ -2383,25 +2383,25 @@ function Vc({
2383
2383
  t.add(c);
2384
2384
  continue;
2385
2385
  }
2386
- Qr(c, n) || na(jt(a), d) || r.add(c);
2386
+ Qr(c, n) || na(Lt(a), d) || r.add(c);
2387
2387
  }
2388
2388
  for (const a of e.keys()) o.has(a) || i.push(a);
2389
2389
  return t.size === 0 && r.size === 0 && i.length === 0 ? null : { added: t, changed: r, removed: i, total: t.size + r.size + i.length };
2390
- }, [Je, ea, Ni, q, jt]), ra = () => {
2391
- kn.current = new Map(Je.map((e) => [String(e.id), jt(e)])), ji((e) => e + 1);
2390
+ }, [Je, ea, Ni, q, Lt]), ra = () => {
2391
+ kn.current = new Map(Je.map((e) => [String(e.id), Lt(e)])), ji((e) => e + 1);
2392
2392
  }, Nn = ae(null), [zr, ys] = J({}), Sn = K(() => {
2393
2393
  const e = Nn.current, n = f == null ? void 0 : f.rowId;
2394
2394
  if (!e || !n || e.rowId !== n || n === "new" || n.startsWith("pending:")) return [];
2395
2395
  const t = Je.find((o) => String(o.id) === n);
2396
2396
  if (!t || Qr(n, Date.now())) return [];
2397
- const r = jt(t), i = [];
2397
+ const r = Lt(t), i = [];
2398
2398
  for (const o of Object.keys(r)) {
2399
2399
  if (String(r[o] ?? "") === String(e.snap[o] ?? "") || String(zr[o] ?? "\0") === String(r[o] ?? "") || String((f == null ? void 0 : f.draft[o]) ?? "") === String(r[o] ?? "")) continue;
2400
2400
  const a = ce.find((c) => c.field === o);
2401
2401
  (a == null ? void 0 : a.computed_type) === "write" && a.computed_formula || i.push({ field: o, label: (a == null ? void 0 : a.label) || ve(o), theirs: r[o], was: e.snap[o] });
2402
2402
  }
2403
2403
  return i;
2404
- }, [Je, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, zr, jt, ce]), ws = (e) => {
2404
+ }, [Je, f == null ? void 0 : f.rowId, f == null ? void 0 : f.draft, zr, Lt, ce]), ws = (e) => {
2405
2405
  if (!e || Sn.length === 0 || (f == null ? void 0 : f.rowId) !== e) return null;
2406
2406
  const n = (i) => i == null || i === "" ? "∅" : String(i).slice(0, 40), t = (i) => {
2407
2407
  const o = { ...zr }, a = {};
@@ -3041,7 +3041,7 @@ function Vc({
3041
3041
  }
3042
3042
  Xe && on(null);
3043
3043
  const r = he({ ...e }), i = Je.find((o) => String(o.id) === n) ?? e;
3044
- Nn.current = { rowId: n, snap: jt(i) }, Ui(n), Be({ rowId: n, draft: r, locksPending: Un.size > 0 }), Vr(n, r);
3044
+ Nn.current = { rowId: n, snap: Lt(i) }, Ui(n), Be({ rowId: n, draft: r, locksPending: Un.size > 0 }), Vr(n, r);
3045
3045
  }
3046
3046
  ge(() => {
3047
3047
  const e = (n) => {
@@ -3154,7 +3154,7 @@ function Vc({
3154
3154
  Wn(null), ci(null), kr(!1);
3155
3155
  }
3156
3156
  function Qi(e) {
3157
- if (Et(null), Be(
3157
+ if (Ot(null), Be(
3158
3158
  (n) => n && {
3159
3159
  ...n,
3160
3160
  invalid: e.map((t) => t.field),
@@ -3162,13 +3162,13 @@ function Vc({
3162
3162
  missing: void 0
3163
3163
  }
3164
3164
  ), typeof document > "u" || e.length === 0) {
3165
- Et(e.map((n) => n.message).join(" · ") || null);
3165
+ Ot(e.map((n) => n.message).join(" · ") || null);
3166
3166
  return;
3167
3167
  }
3168
3168
  requestAnimationFrame(() => {
3169
3169
  var r;
3170
3170
  const n = e.filter((i) => !document.getElementById(Bn(i.field, "cell")));
3171
- n.length && Et(n.map((i) => i.message).join(" · "));
3171
+ n.length && Ot(n.map((i) => i.message).join(" · "));
3172
3172
  const t = e.find((i) => !n.includes(i));
3173
3173
  t && ((r = gd(document.getElementById(Bn(t.field, "cell")))) == null || r.focus());
3174
3174
  });
@@ -3179,7 +3179,7 @@ function Vc({
3179
3179
  function sr() {
3180
3180
  var n;
3181
3181
  const e = (n = Ce.current) == null ? void 0 : n.rowId;
3182
- Be(null), Et(null), Rr((t) => {
3182
+ Be(null), Ot(null), Rr((t) => {
3183
3183
  const r = {};
3184
3184
  for (const [i, o] of Object.entries(t))
3185
3185
  e && i.startsWith(`${e}|`) || i.startsWith("__new__|") || (r[i] = o);
@@ -3205,7 +3205,7 @@ function Vc({
3205
3205
  const o = he(t ? { ...t.draft, [e]: n } : { [e]: n }), a = n != null && n !== "", c = !!((N = ke.find((_) => _.field === e)) != null && N.required), d = (a || !c) && !!((y = t == null ? void 0 : t.missing) != null && y.includes(e)), m = d ? ((t == null ? void 0 : t.missing) ?? []).filter((_) => _ !== e) : t == null ? void 0 : t.missing, g = ((t == null ? void 0 : t.invalid) ?? []).filter(
3206
3206
  (_) => ce.some((I) => I.field === _ && I.computed_type === "write")
3207
3207
  ), p = !!((w = t == null ? void 0 : t.invalid) != null && w.includes(e)) || g.length > 0, h = p ? ((t == null ? void 0 : t.invalid) ?? []).filter((_) => _ !== e && !g.includes(_)) : t == null ? void 0 : t.invalid;
3208
- if ((d || p) && ((m == null ? void 0 : m.length) ?? 0) === 0 && ((h == null ? void 0 : h.length) ?? 0) === 0 && Et(null), Be(
3208
+ if ((d || p) && ((m == null ? void 0 : m.length) ?? 0) === 0 && ((h == null ? void 0 : h.length) ?? 0) === 0 && Ot(null), Be(
3209
3209
  (_) => {
3210
3210
  var I, T;
3211
3211
  return _ && {
@@ -3233,7 +3233,7 @@ function Vc({
3233
3233
  });
3234
3234
  }
3235
3235
  }
3236
- function Lt() {
3236
+ function Tt() {
3237
3237
  if (Gt.current) return Gt.current;
3238
3238
  const e = ma().finally(() => {
3239
3239
  Gt.current === e && (Gt.current = null);
@@ -3254,7 +3254,7 @@ function Vc({
3254
3254
  const _ = C.has(String(w.id)) ? { ...w, ...C.get(String(w.id)) } : w;
3255
3255
  return uo(_, We) === N;
3256
3256
  }) || P.some((w, _) => _ !== h && uo(w, We) === N))
3257
- return Et(`A row with the same ${We.join(" + ")} already exists.`), !1;
3257
+ return Ot(`A row with the same ${We.join(" + ")} already exists.`), !1;
3258
3258
  }
3259
3259
  const t = (p) => p == null || p === "", r = ke.filter(
3260
3260
  (p) => {
@@ -3263,7 +3263,7 @@ function Vc({
3263
3263
  }
3264
3264
  );
3265
3265
  if (r.length > 0)
3266
- return Et(
3266
+ return Ot(
3267
3267
  `Required: ${r.map((p) => p.label || ve(p.field)).join(", ")}`
3268
3268
  ), Be(
3269
3269
  (p) => p && { ...p, missing: r.map((h) => h.field), invalid: void 0 }
@@ -3319,13 +3319,13 @@ function Vc({
3319
3319
  ) || 0, I = w + _, T = w + (Number(v[h]) || 0);
3320
3320
  if (T > p + 5e-3 && T > I + 5e-3) {
3321
3321
  const E = (X) => Ue.format === "currency" ? X.toLocaleString("en-US", { style: "currency", currency: "USD" }) : X.toLocaleString("en-US", { maximumFractionDigits: 2 });
3322
- return Et(
3322
+ return Ot(
3323
3323
  `${Ue.message ?? `${Ue.label ?? "Total"} cannot exceed ${E(p)}`} — this would make it ${E(T)} (${E(T - p)} over).`
3324
3324
  ), !1;
3325
3325
  }
3326
3326
  }
3327
3327
  }
3328
- Et(null);
3328
+ Ot(null);
3329
3329
  const m = ll(ce, f.draft);
3330
3330
  m && !(i && ll(ce, i)) && be.warning(`${m} is 0 — this is a $0 line. Remove it if it is not needed.`), fn(!0);
3331
3331
  try {
@@ -3691,7 +3691,7 @@ function Vc({
3691
3691
  if (v === null) return /* @__PURE__ */ l("span", { className: "text-slate-300", children: "—" });
3692
3692
  const N = v.toLocaleString(
3693
3693
  "en-US",
3694
- St(i, i.format)
3694
+ $t(i, i.format)
3695
3695
  ), y = g.replace(/\{\{\s*([^}]+?)\s*\}\}/g, (w, _) => {
3696
3696
  var T, E;
3697
3697
  const I = _.includes(".") ? t ? (E = (T = Ae == null ? void 0 : Ae.rows[t]) == null ? void 0 : T[_]) == null ? void 0 : E.value : void 0 : p[_];
@@ -3722,14 +3722,14 @@ function Vc({
3722
3722
  }
3723
3723
  const y = N.toLocaleString(
3724
3724
  "en-US",
3725
- St(i, g.cfg.format)
3725
+ $t(i, g.cfg.format)
3726
3726
  );
3727
3727
  return /* @__PURE__ */ l("span", { className: "tabular-nums", children: y });
3728
3728
  }
3729
3729
  if (i.format === "currency" && n !== null && n !== void 0 && n !== "" && Number.isFinite(Number(n)) && (n = Number(n).toLocaleString("en-US", {
3730
- ...St(i, "currency"),
3730
+ ...$t(i, "currency"),
3731
3731
  currency: i.currency || "USD"
3732
- })), i.format === "number" && e.interface === "relation-path" && n !== null && n !== void 0 && n !== "" && Number.isFinite(Number(n)) && (n = Number(n).toLocaleString("en-US", St(i, "number"))), e.interface === "relation-path" && i.display === "presence") {
3732
+ })), i.format === "number" && e.interface === "relation-path" && n !== null && n !== void 0 && n !== "" && Number.isFinite(Number(n)) && (n = Number(n).toLocaleString("en-US", $t(i, "number"))), e.interface === "relation-path" && i.display === "presence") {
3733
3733
  const g = n != null && String(n).trim() !== "";
3734
3734
  return /* @__PURE__ */ l(
3735
3735
  "span",
@@ -3828,7 +3828,7 @@ function Vc({
3828
3828
  if (h === "currency") {
3829
3829
  const v = p.currency || "USD";
3830
3830
  return /* @__PURE__ */ l("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
3831
- ...St(i, "currency"),
3831
+ ...$t(i, "currency"),
3832
3832
  currency: v
3833
3833
  }).format(g) });
3834
3834
  }
@@ -3840,7 +3840,7 @@ function Vc({
3840
3840
  const Yi = ae(/* @__PURE__ */ new Map());
3841
3841
  if (Mo || !q && mn)
3842
3842
  return /* @__PURE__ */ l("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ l(Rn, { className: "h-4 w-4 animate-spin inline" }) });
3843
- const Cr = (f == null ? void 0 : f.rowId) === "new", st = cn && Ie === "original" && !L, Tt = (st ? 1 : 0) + (se && (G || q || W) ? 1 : 0) + (R ? 1 : 0) + (q || W ? 1 : 0) + Ke.length + 1, lr = st ? "select" : se && (G || W) ? "reorder" : R ? "num" : W ? "status" : "data", ar = (e) => {
3843
+ const Cr = (f == null ? void 0 : f.rowId) === "new", st = cn && Ie === "original" && !L, St = (st ? 1 : 0) + (se && (G || q || W) ? 1 : 0) + (R ? 1 : 0) + (q || W ? 1 : 0) + Ke.length + 1, lr = st ? "select" : se && (G || W) ? "reorder" : R ? "num" : W ? "status" : "data", ar = (e) => {
3844
3844
  if (!bt) return null;
3845
3845
  const n = bt.added.has(e) ? "bg-emerald-500" : bt.changed.has(e) ? "bg-amber-500" : null;
3846
3846
  return n ? /* @__PURE__ */ l(
@@ -3893,7 +3893,7 @@ function Vc({
3893
3893
  const i = r + e;
3894
3894
  if (i < 0 || i >= t.length) return;
3895
3895
  if (qa()) {
3896
- if (!await Lt()) return;
3896
+ if (!await Tt()) return;
3897
3897
  } else
3898
3898
  sr();
3899
3899
  const o = t[i];
@@ -4179,7 +4179,7 @@ function Vc({
4179
4179
  {
4180
4180
  type: "button",
4181
4181
  disabled: _t,
4182
- onClick: Lt,
4182
+ onClick: Tt,
4183
4183
  className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
4184
4184
  children: _t ? "Saving…" : e.saveLabel
4185
4185
  }
@@ -4211,7 +4211,7 @@ function Vc({
4211
4211
  /* @__PURE__ */ l("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: o }),
4212
4212
  /* @__PURE__ */ l("span", { className: "mt-0.5 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: a ? De(i, r[i.field] ?? e.draft[i.field]) : m != null ? /* @__PURE__ */ l("span", { className: "tabular-nums", children: m.toLocaleString(
4213
4213
  "en-US",
4214
- St(c, c.format)
4214
+ $t(c, c.format)
4215
4215
  ) }) : i.computed_type === "rollup" ? De(i, r[i.field] ?? e.draft[i.field], e.rowId) : ot(i) ? nr(i, e.draft, !0) : De(i, e.draft[i.field], e.rowId) })
4216
4216
  ] }, i.field);
4217
4217
  }) });
@@ -4413,7 +4413,7 @@ function Vc({
4413
4413
  ]
4414
4414
  }
4415
4415
  );
4416
- }, Xi = (e) => /* @__PURE__ */ l("td", { colSpan: Tt, className: "p-0", children: Vs(e) }), Hs = (e, n) => {
4416
+ }, Xi = (e) => /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children: Vs(e) }), Hs = (e, n) => {
4417
4417
  const t = e.editor.split(/\s+/).map((i) => i[0]).filter(Boolean).slice(0, 2).join("").toUpperCase(), r = () => {
4418
4418
  Ti.current.add(xs(e.rowKey, e.editor)), on(null);
4419
4419
  const i = O.find((o) => String(o.id) === e.rowKey);
@@ -4455,7 +4455,7 @@ function Vc({
4455
4455
  ]
4456
4456
  }
4457
4457
  );
4458
- }, Ys = fi === pr, Aa = Ys ? null : (It == null ? void 0 : It.name) ?? ((Cs = re == null ? void 0 : re[0]) == null ? void 0 : Cs.name), Gs = re && re.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
4458
+ }, Ys = fi === pr, Aa = Ys ? null : (At == null ? void 0 : At.name) ?? ((Cs = re == null ? void 0 : re[0]) == null ? void 0 : Cs.name), Gs = re && re.length >= 2 && /* @__PURE__ */ k("div", { className: "flex items-center gap-1 text-[11px]", children: [
4459
4459
  /* @__PURE__ */ l(
4460
4460
  "button",
4461
4461
  {
@@ -4651,13 +4651,13 @@ function Vc({
4651
4651
  },
4652
4652
  e.label
4653
4653
  )),
4654
- $t && !q && !L && rt && A && /* @__PURE__ */ l(
4654
+ qt && !q && !L && rt && A && /* @__PURE__ */ l(
4655
4655
  nd,
4656
4656
  {
4657
4657
  collection: A,
4658
4658
  templateFilter: (e) => {
4659
4659
  var n;
4660
- return e.name === $t && ((n = e.reimport) == null ? void 0 : n.enabled) === !0;
4660
+ return e.name === qt && ((n = e.reimport) == null ? void 0 : n.enabled) === !0;
4661
4661
  },
4662
4662
  getLabel: (e) => {
4663
4663
  var n;
@@ -5167,7 +5167,7 @@ function Vc({
5167
5167
  ) })
5168
5168
  ] }),
5169
5169
  !q && Ie === "original" && O.slice(0, _n).map((e, n) => {
5170
- const t = String(e.id), r = zo ? Hn(e) : null, i = r !== null && (n === 0 || Hn(O[n - 1]) !== r), o = r !== null && Fo.has(r), a = i && r !== null ? /* @__PURE__ */ l("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "px-2 py-1", children: /* @__PURE__ */ k(
5170
+ const t = String(e.id), r = zo ? Hn(e) : null, i = r !== null && (n === 0 || Hn(O[n - 1]) !== r), o = r !== null && Fo.has(r), a = i && r !== null ? /* @__PURE__ */ l("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-2 py-1", children: /* @__PURE__ */ k(
5171
5171
  "button",
5172
5172
  {
5173
5173
  type: "button",
@@ -5227,7 +5227,7 @@ function Vc({
5227
5227
  onClick: () => !c && !h && Hr(v),
5228
5228
  onBlur: (y) => {
5229
5229
  !c || _t || h || y.currentTarget.contains(y.relatedTarget) || Er(y.relatedTarget) || (pt.current = setTimeout(() => {
5230
- Fn.current || Er(document.activeElement) || Lt();
5230
+ Fn.current || Er(document.activeElement) || Tt();
5231
5231
  }, 150));
5232
5232
  },
5233
5233
  onFocus: () => {
@@ -5497,7 +5497,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5497
5497
  {
5498
5498
  type: "button",
5499
5499
  disabled: _t,
5500
- onClick: Lt,
5500
+ onClick: Tt,
5501
5501
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5502
5502
  children: _t ? "…" : "Save"
5503
5503
  }
@@ -5581,12 +5581,12 @@ Reason: “${E.reason}”` : ""}` : void 0;
5581
5581
  ]
5582
5582
  }
5583
5583
  ),
5584
- !$e && (Xe == null ? void 0 : Xe.rowKey) === t && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "p-0", children: Hs(Xe, "row") }) }),
5585
- c && lt === "inline" && Sn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "px-2 pt-2", children: ws(t) }) }),
5584
+ !$e && (Xe == null ? void 0 : Xe.rowKey) === t && /* @__PURE__ */ l("tr", { "data-row-soft-lock-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "p-0", children: Hs(Xe, "row") }) }),
5585
+ c && lt === "inline" && Sn.length > 0 && /* @__PURE__ */ l("tr", { "data-row-remote-change-row": "", children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-2 pt-2", children: ws(t) }) }),
5586
5586
  N && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ k(
5587
5587
  "td",
5588
5588
  {
5589
- colSpan: Tt,
5589
+ colSpan: St,
5590
5590
  className: "border-b border-red-100 bg-red-50/60 px-3 py-1 text-[11px] leading-snug text-red-700 dark:border-red-900/30 dark:bg-red-900/10 dark:text-red-400",
5591
5591
  children: [
5592
5592
  "⚠ ",
@@ -5599,7 +5599,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5599
5599
  {
5600
5600
  "data-o2m-editing": !0,
5601
5601
  className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
5602
- children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "px-3 py-2", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: te.map((y) => {
5602
+ children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: te.map((y) => {
5603
5603
  const w = typeof y == "string" ? y : y.field, _ = typeof y == "string" ? void 0 : y.hint, I = typeof y == "string" ? void 0 : y.match, T = (f == null ? void 0 : f.draft) ?? v, E = I ? oi(
5604
5604
  I,
5605
5605
  T,
@@ -5645,7 +5645,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5645
5645
  children: /* @__PURE__ */ k(
5646
5646
  "td",
5647
5647
  {
5648
- colSpan: Tt,
5648
+ colSpan: St,
5649
5649
  className: "px-3 py-1.5 text-[11px] text-slate-500 dark:text-slate-400",
5650
5650
  children: [
5651
5651
  R ? `Line ${O.length + P.length + 1} · ` : "",
@@ -5709,7 +5709,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5709
5709
  {
5710
5710
  type: "button",
5711
5711
  disabled: _t,
5712
- onClick: Lt,
5712
+ onClick: Tt,
5713
5713
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
5714
5714
  children: _t ? "…" : "Add"
5715
5715
  }
@@ -5727,7 +5727,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5727
5727
  ]
5728
5728
  }
5729
5729
  ),
5730
- O.length === 0 && P.length === 0 && !Cr && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "px-3 py-14 text-center text-slate-400", children: H ? `No ${H.toLowerCase()} yet` : q ? "No pending rows" : "No rows yet" }) }),
5730
+ O.length === 0 && P.length === 0 && !Cr && /* @__PURE__ */ l("tr", { children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-3 py-14 text-center text-slate-400", children: H ? `No ${H.toLowerCase()} yet` : q ? "No pending rows" : "No rows yet" }) }),
5731
5731
  !q && Ie !== "original" && (() => {
5732
5732
  const e = dt.find((c) => c.addendumId === Ie), n = (se && (G || W) ? 1 : 0) + (R ? 1 : 0) + (W ? 1 : 0) + Ke.length + 1;
5733
5733
  if (!e)
@@ -5843,7 +5843,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5843
5843
  );
5844
5844
  }), ...o];
5845
5845
  })(),
5846
- !q && Ie === "original" && O.length > _n && /* @__PURE__ */ l("tr", { ref: cs, children: /* @__PURE__ */ k("td", { colSpan: 99, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
5846
+ !q && Ie === "original" && O.length > _n && /* @__PURE__ */ l("tr", { ref: cs, children: /* @__PURE__ */ k("td", { colSpan: St, className: "px-3 py-2 text-center text-[11px] text-slate-400", children: [
5847
5847
  "Showing ",
5848
5848
  _n,
5849
5849
  " of ",
@@ -5932,7 +5932,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
5932
5932
  onClick: () => !r && Es(e, n),
5933
5933
  onBlur: (d) => {
5934
5934
  !r || _t || d.currentTarget.contains(d.relatedTarget) || Er(d.relatedTarget) || (pt.current = setTimeout(() => {
5935
- Fn.current || Er(document.activeElement) || Lt();
5935
+ Fn.current || Er(document.activeElement) || Tt();
5936
5936
  }, 150));
5937
5937
  },
5938
5938
  onFocus: () => {
@@ -6096,7 +6096,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
6096
6096
  {
6097
6097
  type: "button",
6098
6098
  disabled: _t,
6099
- onClick: Lt,
6099
+ onClick: Tt,
6100
6100
  className: "rounded px-2 h-9 bg-nvr-cyan text-white text-[11px] font-medium hover:brightness-110 disabled:opacity-50",
6101
6101
  children: _t ? "…" : "Save"
6102
6102
  }
@@ -6143,7 +6143,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
6143
6143
  {
6144
6144
  "data-o2m-editing": !0,
6145
6145
  className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5",
6146
- children: /* @__PURE__ */ l("td", { colSpan: Tt, className: "px-3 py-2", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: te.map((d) => {
6146
+ children: /* @__PURE__ */ l("td", { colSpan: St, className: "px-3 py-2", children: /* @__PURE__ */ l("div", { className: "space-y-2", children: te.map((d) => {
6147
6147
  const m = typeof d == "string" ? d : d.field, g = typeof d == "string" ? void 0 : d.hint;
6148
6148
  return /* @__PURE__ */ l(
6149
6149
  so,
@@ -6232,7 +6232,7 @@ Reason: “${E.reason}”` : ""}` : void 0;
6232
6232
  try {
6233
6233
  if (g === "currency")
6234
6234
  return new Intl.NumberFormat(void 0, {
6235
- ...St(r, "currency"),
6235
+ ...$t(r, "currency"),
6236
6236
  currency: r.currency || "USD"
6237
6237
  }).format(m);
6238
6238
  if (g === "decimal") {