@nivaro/react 0.1.59 → 0.1.60

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 (2) hide show
  1. package/dist/index.js +633 -621
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as a, Fragment as dt } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a, Fragment as it } from "react/jsx-runtime";
2
2
  import * as Oh from "lucide-react";
3
3
  import { Check as on, X as Gt, Search as ja, ChevronDown as nn, ChevronsLeft as Lh, ChevronsRight as Rh, Copy as bl, Pin as Xi, ChevronRight as Ar, ChevronsUpDown as xi, ChevronUp as d0, RotateCcw as co, MessageSquareWarning as Mh, AlertCircle as as, MoreVertical as Dh, MoreHorizontal as vu, Clipboard as Eh, Clock as ls, Calendar as Ph, Paperclip as Ii, Folder as Kh, File as Ic, FileText as Ko, Bell as gl, Phone as Qo, MessageSquare as ku, Mail as mi, UserCheck as c0, UserPlus as u0, Users as Ps, User as Jo, Activity as m0, Zap as Ih, Power as Uh, Filter as wu, Sliders as Bh, Settings as p0, RefreshCw as ss, Pause as zh, Play as Nu, HelpCircle as f0, Info as bd, AlertTriangle as ga, Flag as Wh, Bookmark as Vh, Heart as Qh, Star as Ho, Unlock as Jh, Lock as gi, EyeOff as Hh, Eye as Gh, Send as xd, Upload as is, Download as Ks, Save as Go, Trash2 as Ta, Edit2 as Yh, Edit as Xh, Minus as _u, Plus as dr, XCircle as Zh, CheckCircle as eb, Share2 as tb, Link as h0, ExternalLink as yi, ArrowUpRight as nb, ArrowDown as rb, ArrowUp as ab, ArrowLeft as pi, ArrowRight as ya, Loader2 as Tt, Sparkles as li, SlidersHorizontal as b0, History as Os, Building2 as x0, MessageCircle as Su, Pencil as si, GripVertical as Uc, FileVideo as lb, FileAudio as sb, FileSpreadsheet as Cu, FileCode as ib, Bold as ob, Italic as db, UnderlineIcon as cb, Strikethrough as ub, Heading1 as mb, Heading2 as pb, Heading3 as fb, List as hb, ListOrdered as bb, Quote as xb, Code as gb, Link2Off as yb, Wrench as g0, ShieldAlert as vb, BellRing as Ui, FileDiff as kb, ClipboardPlus as y0, Satellite as wm, CopyPlus as wb, GitBranch as Wd, Link2 as v0, ClipboardList as Nb, GitFork as Nm, FileDown as _b, ChevronLeft as Ls, FileUp as Sb, Ban as $u, ScrollText as Cb, RotateCw as Vd, Rows3 as Yo, Rows2 as k0, BellOff as Xo, Flame as $b, Rows4 as qb, PanelLeftClose as Tb, Settings2 as w0, Sigma as Fb, StickyNote as jb, Camera as Zo, TrendingUp as Ab, TrendingDown as Ob, Undo2 as N0, UserRound as Bc, KeyRound as Lb, LogOut as _0, ShieldCheck as Rb, LayoutGrid as _m, ChartColumn as Mb, FlaskConical as Sm, Gauge as Db, Siren as Cm, PlayCircle as Eb, Hash as zc, Video as Pb, CheckCheck as Kb } from "lucide-react";
4
4
  import * as fn from "react";
@@ -782,7 +782,7 @@ function Gc({
782
782
  className: "[&_button]:!border-amber-400 [&_input]:!border-amber-400 dark:[&_button]:!border-amber-500/60 dark:[&_input]:!border-amber-500/60",
783
783
  children: c
784
784
  }
785
- ) : /* @__PURE__ */ e(dt, { children: c });
785
+ ) : /* @__PURE__ */ e(it, { children: c });
786
786
  }
787
787
  function Yc(t) {
788
788
  return t.placeholder.replace(/^Search\s+/i, "").replace(/[…]|\.{3}$/g, "");
@@ -945,7 +945,7 @@ function Tu({
945
945
  $e
946
946
  );
947
947
  };
948
- return /* @__PURE__ */ a(dt, { children: [
948
+ return /* @__PURE__ */ a(it, { children: [
949
949
  /* @__PURE__ */ e(W0, {}),
950
950
  o && u && /* @__PURE__ */ e("div", { className: "mb-4 rounded-md border border-red-200 bg-red-50 px-4 py-2.5 text-[13px] text-red-700", children: u }),
951
951
  /* @__PURE__ */ a(
@@ -987,7 +987,7 @@ function Tu({
987
987
  className: Q("h-4 rounded", ue.className ? void 0 : "flex-1")
988
988
  },
989
989
  ue.key
990
- )) }, fe)) }) : /* @__PURE__ */ a(dt, { children: [
990
+ )) }, fe)) }) : /* @__PURE__ */ a(it, { children: [
991
991
  /* @__PURE__ */ e(
992
992
  "div",
993
993
  {
@@ -1756,7 +1756,7 @@ function wi({
1756
1756
  className: `shrink-0 rounded-full object-cover ${r ?? ""}`,
1757
1757
  draggable: !1
1758
1758
  }
1759
- ) : /* @__PURE__ */ e(dt, { children: n });
1759
+ ) : /* @__PURE__ */ e(it, { children: n });
1760
1760
  }
1761
1761
  const mg = ["👍", "✅", "👀", "🎉", "❤️", "😂"], sf = Br(null);
1762
1762
  function Yr() {
@@ -2970,8 +2970,8 @@ function mf({
2970
2970
  }
2971
2971
  ),
2972
2972
  children: !wt && st.map((nt, Xe) => {
2973
- var Ft;
2974
- const $t = String(nt[$e.field] ?? ""), xt = $t.slice($t.lastIndexOf(Ie) + Ie.length), Zt = ((Ft = v[0]) == null ? void 0 : Ft.field) === $e.field ? xt : void 0;
2973
+ var jt;
2974
+ const $t = String(nt[$e.field] ?? ""), xt = $t.slice($t.lastIndexOf(Ie) + Ie.length), Zt = ((jt = v[0]) == null ? void 0 : jt.field) === $e.field ? xt : void 0;
2975
2975
  return H(nt, `${at}-${Xe}`, 2, Zt);
2976
2976
  })
2977
2977
  },
@@ -3018,7 +3018,7 @@ function mf({
3018
3018
  )) })
3019
3019
  ] }),
3020
3020
  /* @__PURE__ */ e("div", { className: U ? "min-h-0 flex-1 overflow-auto" : "overflow-x-auto", children: /* @__PURE__ */ a("table", { className: "w-full text-[12px]", children: [
3021
- /* @__PURE__ */ e("thead", { children: R ? /* @__PURE__ */ a(dt, { children: [
3021
+ /* @__PURE__ */ e("thead", { children: R ? /* @__PURE__ */ a(it, { children: [
3022
3022
  /* @__PURE__ */ a("tr", { children: [
3023
3023
  (() => {
3024
3024
  const V = [];
@@ -3142,7 +3142,7 @@ function mf({
3142
3142
  ] });
3143
3143
  }
3144
3144
  function Pm({ header: t, children: n }) {
3145
- return /* @__PURE__ */ a(dt, { children: [
3145
+ return /* @__PURE__ */ a(it, { children: [
3146
3146
  t,
3147
3147
  n
3148
3148
  ] });
@@ -3792,7 +3792,7 @@ function Zd({
3792
3792
  {
3793
3793
  className: `animate-pulse inline-block h-3 w-14 rounded ${l ? "bg-slate-600" : "bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]"}`
3794
3794
  }
3795
- ) : /* @__PURE__ */ a(dt, { children: [
3795
+ ) : /* @__PURE__ */ a(it, { children: [
3796
3796
  i && /* @__PURE__ */ e("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: i }),
3797
3797
  o,
3798
3798
  d && /* @__PURE__ */ e("span", { className: `text-[10px] ${l ? "text-slate-400" : "text-slate-500"}`, children: d })
@@ -4366,7 +4366,7 @@ function ri({
4366
4366
  ) : Z;
4367
4367
  }
4368
4368
  }
4369
- return b ? /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5", children: $ ? /* @__PURE__ */ e("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ e("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : k && h && /* @__PURE__ */ a(dt, { children: [
4369
+ return b ? /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) : /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5", children: $ ? /* @__PURE__ */ e("div", { className: "flex items-baseline gap-1", children: /* @__PURE__ */ e("div", { className: "animate-pulse h-5 w-20 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }) }) : k && h && /* @__PURE__ */ a(it, { children: [
4370
4370
  (h.widget_type === "stat" || h.widget_type === "custom-query" && "value" in k) && /* @__PURE__ */ e(Wm, { data: k }),
4371
4371
  h.widget_type === "custom-query" && "values" in k && /* @__PURE__ */ e(Vm, { data: k }),
4372
4372
  h.widget_type === "action-buttons" && /* @__PURE__ */ e(
@@ -4423,7 +4423,7 @@ function ri({
4423
4423
  ] });
4424
4424
  function Y() {
4425
4425
  var V;
4426
- return !k || !h ? null : /* @__PURE__ */ a(dt, { children: [
4426
+ return !k || !h ? null : /* @__PURE__ */ a(it, { children: [
4427
4427
  (h.widget_type === "stat" || h.widget_type === "custom-query" && "value" in k) && /* @__PURE__ */ e(Wm, { data: k }),
4428
4428
  h.widget_type === "custom-query" && "values" in k && /* @__PURE__ */ e(Vm, { data: k }),
4429
4429
  h.widget_type === "list" && /* @__PURE__ */ e(fy, { data: k }),
@@ -6044,8 +6044,8 @@ function Ry({
6044
6044
  defaultExpanded: fe.slot.default_expanded ?? !0,
6045
6045
  frameless: !0,
6046
6046
  apiBase: R,
6047
- onContentChange: (Ft) => oe(
6048
- (It) => It[fe.slot.field] === Ft ? It : { ...It, [fe.slot.field]: Ft }
6047
+ onContentChange: (jt) => oe(
6048
+ (It) => It[fe.slot.field] === jt ? It : { ...It, [fe.slot.field]: jt }
6049
6049
  )
6050
6050
  }
6051
6051
  ) }, fe.slot.field);
@@ -6331,10 +6331,10 @@ function ao({
6331
6331
  }
6332
6332
  }
6333
6333
  }
6334
- const k = (M) => r ? r(M) : M.button_label, g = x[0] ? ($ = k(x[0])) == null ? void 0 : $.trim() : void 0, b = g && x.every((M) => k(M) === k(x[0])) ? g : null, S = f ? /* @__PURE__ */ a(dt, { children: [
6334
+ const k = (M) => r ? r(M) : M.button_label, g = x[0] ? ($ = k(x[0])) == null ? void 0 : $.trim() : void 0, b = g && x.every((M) => k(M) === k(x[0])) ? g : null, S = f ? /* @__PURE__ */ a(it, { children: [
6335
6335
  /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }),
6336
6336
  " Importing…"
6337
- ] }) : /* @__PURE__ */ a(dt, { children: [
6337
+ ] }) : /* @__PURE__ */ a(it, { children: [
6338
6338
  /* @__PURE__ */ e(is, { className: "h-3.5 w-3.5" }),
6339
6339
  " ",
6340
6340
  b ?? "Import from file"
@@ -7483,7 +7483,7 @@ function Vy({
7483
7483
  const U = T.get(String(I.id)), z = Number((U == null ? void 0 : U[t.value_field]) ?? 0) || 0;
7484
7484
  return C(t.value_max, I, { __input__: z, __saved__: z });
7485
7485
  }
7486
- return /* @__PURE__ */ a(dt, { children: [
7486
+ return /* @__PURE__ */ a(it, { children: [
7487
7487
  /* @__PURE__ */ e(
7488
7488
  "button",
7489
7489
  {
@@ -7875,10 +7875,10 @@ function Hy({
7875
7875
  if (!["ERROR", "FAILED"].includes(_e)) continue;
7876
7876
  const Be = String((Pe == null ? void 0 : Pe.lineNumber) ?? "");
7877
7877
  if (!Be || L.has(Be)) continue;
7878
- const yt = By(Pe == null ? void 0 : Pe.lineDetailedMessage), it = yt.find(
7879
- (jt) => new RegExp(`^Line(?:Number)?\\s*${Be}\\s*:`, "i").test(jt.trim())
7878
+ const yt = By(Pe == null ? void 0 : Pe.lineDetailedMessage), ot = yt.find(
7879
+ (Ft) => new RegExp(`^Line(?:Number)?\\s*${Be}\\s*:`, "i").test(Ft.trim())
7880
7880
  ) ?? yt[0];
7881
- it && L.set(Be, it.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
7881
+ ot && L.set(Be, ot.replace(/^Line(?:Number)?\s*\d+\s*:\s*/i, ""));
7882
7882
  }
7883
7883
  if (L.size > 0 || !W.last_error) return L;
7884
7884
  for (const je of W.last_error.split(" · ")) {
@@ -7954,12 +7954,12 @@ function Hy({
7954
7954
  Ve(() => {
7955
7955
  at.current = be;
7956
7956
  }, [be]);
7957
- const [wt, Ot] = q(!1), [gt, nt] = q(null), [Xe, $t] = q(null), xt = yf(), [Zt, Ft] = q(() => {
7957
+ const [wt, Ot] = q(!1), [gt, nt] = q(null), [Xe, $t] = q(null), xt = yf(), [Zt, jt] = q(() => {
7958
7958
  var L;
7959
7959
  return y === Ai ? Ai : y && (f != null && f.some((W) => W.name === y)) ? y : (L = f == null ? void 0 : f[0]) == null ? void 0 : L.name;
7960
7960
  });
7961
7961
  function It(L) {
7962
- Ft(L);
7962
+ jt(L);
7963
7963
  }
7964
7964
  const St = Ge(null), { data: tn } = ge({
7965
7965
  queryKey: ["auto-table-layout", t],
@@ -7986,7 +7986,7 @@ function Hy({
7986
7986
  queryFn: () => C.request(he(`/collection-layouts/${ae}`)).then((L) => L.data ?? {}),
7987
7987
  enabled: !!ae,
7988
7988
  staleTime: 5 * 6e4
7989
- }), ot = (lt == null ? void 0 : lt.row_order_field) ?? null, Dt = Se(() => {
7989
+ }), dt = (lt == null ? void 0 : lt.row_order_field) ?? null, Dt = Se(() => {
7990
7990
  if (!k || Object.keys(k).length === 0) return null;
7991
7991
  const L = {};
7992
7992
  for (const [W, te] of Object.entries(k))
@@ -8011,8 +8011,8 @@ function Hy({
8011
8011
  ).then((L) => L.data ?? []),
8012
8012
  enabled: !z,
8013
8013
  staleTime: 3e4
8014
- }), Mn = m ?? [], En = pr({
8015
- queries: Mn.map((L) => ({
8014
+ }), Dn = m ?? [], Pn = pr({
8015
+ queries: Dn.map((L) => ({
8016
8016
  queryKey: ["resolve-cascade", re == null ? void 0 : re.collection, L.parent_field, t, L.child_field],
8017
8017
  queryFn: () => C.request(
8018
8018
  he("/data-model/resolve-cascade", {
@@ -8027,16 +8027,16 @@ function Hy({
8027
8027
  }))
8028
8028
  }), Fn = Se(() => {
8029
8029
  const L = {};
8030
- return !re || !Mn.length || Mn.forEach((W, te) => {
8030
+ return !re || !Dn.length || Dn.forEach((W, te) => {
8031
8031
  var Pe;
8032
- const se = (Pe = En[te]) == null ? void 0 : Pe.data;
8032
+ const se = (Pe = Pn[te]) == null ? void 0 : Pe.data;
8033
8033
  if (!se || se.type === "none") return;
8034
8034
  const je = re.draft[W.parent_field];
8035
8035
  je == null || je === "" || (se.type === "direct_fk" ? L[W.child_field] = { [se.filter_column]: { _eq: je } } : se.type === "m2m_junction" && (L[W.child_field] = {
8036
8036
  _exists_junction: { table: se.table, self_fk: se.self_fk, filter_fk: se.filter_fk, value: je }
8037
8037
  }));
8038
8038
  }), L;
8039
- }, [Mn, En, re]), ie = o === "pending", De = O ? O.getPendingRows(t, n) : [], Ke = ie && O ? O.getPendingEdits(t, n) : /* @__PURE__ */ new Map(), Je = ie && O ? O.getPendingDeletes(t, n) : /* @__PURE__ */ new Set(), me = Se(
8039
+ }, [Dn, Pn, re]), ie = o === "pending", De = O ? O.getPendingRows(t, n) : [], Ke = ie && O ? O.getPendingEdits(t, n) : /* @__PURE__ */ new Map(), Je = ie && O ? O.getPendingDeletes(t, n) : /* @__PURE__ */ new Set(), me = Se(
8040
8040
  () => new Map(
8041
8041
  Qe.filter((L) => L.computed_type === "write" && !!L.computed_formula).map((L) => [L.field, String(L.computed_formula)])
8042
8042
  ),
@@ -8073,10 +8073,10 @@ function Hy({
8073
8073
  }
8074
8074
  const ht = typeof yt == "object" && !Array.isArray(yt) ? yt : { _eq: yt };
8075
8075
  if (_e.includes(".")) {
8076
- const it = _e.split(".");
8077
- let jt = ht;
8078
- for (let Et = it.length - 1; Et >= 1; Et--) jt = { [it[Et]]: jt };
8079
- se[it[0]] = jt;
8076
+ const ot = _e.split(".");
8077
+ let Ft = ht;
8078
+ for (let Et = ot.length - 1; Et >= 1; Et--) Ft = { [ot[Et]]: Ft };
8079
+ se[ot[0]] = Ft;
8080
8080
  } else
8081
8081
  se[_e] = ht;
8082
8082
  }
@@ -8166,9 +8166,9 @@ function Hy({
8166
8166
  return L;
8167
8167
  }, [Vt]), _t = Se(() => {
8168
8168
  let L = _n ? dn.map((W) => ({ ...W, ..._n[String(W.id)] ?? {} })) : dn;
8169
- if (ot) {
8169
+ if (dt) {
8170
8170
  const W = (te) => {
8171
- const se = ie ? Ke.get(String(te.id)) : void 0, je = (se == null ? void 0 : se[ot]) ?? te[ot];
8171
+ const se = ie ? Ke.get(String(te.id)) : void 0, je = (se == null ? void 0 : se[dt]) ?? te[dt];
8172
8172
  return Number(je ?? -1);
8173
8173
  };
8174
8174
  L = [...L].sort((te, se) => W(te) - W(se));
@@ -8185,7 +8185,7 @@ function Hy({
8185
8185
  });
8186
8186
  }
8187
8187
  return L;
8188
- }, [dn, _n, ot, ie, Ke, x, h, F]), ca = !!F && !!_n, [xn, Wr] = q(/* @__PURE__ */ new Set()), yn = (L) => String(L[F ?? ""] ?? "").trim() || "Uncategorized", ol = (L) => Wr((W) => {
8188
+ }, [dn, _n, dt, ie, Ke, x, h, F]), ca = !!F && !!_n, [xn, Wr] = q(/* @__PURE__ */ new Set()), yn = (L) => String(L[F ?? ""] ?? "").trim() || "Uncategorized", ol = (L) => Wr((W) => {
8189
8189
  const te = new Set(W);
8190
8190
  return te.has(L) ? te.delete(L) : te.add(L), te;
8191
8191
  }), xr = Se(
@@ -8309,7 +8309,7 @@ function Hy({
8309
8309
  L.set(W, je);
8310
8310
  }
8311
8311
  return L;
8312
- }, [ma, nr, La, ua]), wa = Se(() => _t.map((L) => String(L.id)), [_t]), Mr = wa.join(","), Dn = pr({
8312
+ }, [ma, nr, La, ua]), wa = Se(() => _t.map((L) => String(L.id)), [_t]), Mr = wa.join(","), En = pr({
8313
8313
  queries: ma.map((L) => {
8314
8314
  const W = nr.get(L);
8315
8315
  return {
@@ -8330,13 +8330,13 @@ function Hy({
8330
8330
  var Pe;
8331
8331
  const se = nr.get(W), je = /* @__PURE__ */ new Map();
8332
8332
  if (se)
8333
- for (const _e of ((Pe = Dn[te]) == null ? void 0 : Pe.data) ?? []) {
8333
+ for (const _e of ((Pe = En[te]) == null ? void 0 : Pe.data) ?? []) {
8334
8334
  const Be = String(_e[se.fkField]);
8335
8335
  je.has(Be) || je.set(Be, []), je.get(Be).push(_e);
8336
8336
  }
8337
8337
  L.set(W, je);
8338
8338
  }), L;
8339
- }, [ma, nr, Dn]), rr = Se(() => {
8339
+ }, [ma, nr, En]), rr = Se(() => {
8340
8340
  const L = /* @__PURE__ */ new Map(), W = (te, se) => {
8341
8341
  se == null || se === "" || (L.has(te) || L.set(te, []), L.get(te).push(String(se)));
8342
8342
  };
@@ -8379,7 +8379,7 @@ function Hy({
8379
8379
  },
8380
8380
  enabled: rr.size > 0,
8381
8381
  staleTime: 6e4
8382
- }), Pn = Se(() => ua.map(({ relationField: L, memberField: W }) => {
8382
+ }), Kn = Se(() => ua.map(({ relationField: L, memberField: W }) => {
8383
8383
  const te = nr.get(L), je = (te ? ea.get(te.grandCollection) ?? [] : []).find((Pe) => Pe.field === W);
8384
8384
  return {
8385
8385
  field: `${L}.${W}`,
@@ -8404,12 +8404,12 @@ function Hy({
8404
8404
  return L.type === "presentation" && L.field.includes(".");
8405
8405
  }
8406
8406
  function ta(L, W, te) {
8407
- var it, jt;
8407
+ var ot, Ft;
8408
8408
  const se = L.field.indexOf(".");
8409
8409
  if (se < 0) return "—";
8410
- const je = L.field.slice(0, se), Pe = L.field.slice(se + 1), _e = W[`__o2m_${je}`], Be = te ? Array.isArray(_e) ? _e : [] : ((it = _r.get(je)) == null ? void 0 : it.get(String(W.id))) ?? [];
8410
+ const je = L.field.slice(0, se), Pe = L.field.slice(se + 1), _e = W[`__o2m_${je}`], Be = te ? Array.isArray(_e) ? _e : [] : ((ot = _r.get(je)) == null ? void 0 : ot.get(String(W.id))) ?? [];
8411
8411
  if (Be.length === 0) return "—";
8412
- const yt = (jt = Ra.get(je)) == null ? void 0 : jt.get(Pe), ht = Be.map((Et) => {
8412
+ const yt = (Ft = Ra.get(je)) == null ? void 0 : Ft.get(Pe), ht = Be.map((Et) => {
8413
8413
  var Pt;
8414
8414
  const sn = Et[Pe];
8415
8415
  return sn == null || sn === "" ? null : yt != null && yt.one_collection ? ((Pt = Ma[yt.one_collection]) == null ? void 0 : Pt[String(sn)]) ?? String(sn) : String(sn);
@@ -8417,32 +8417,32 @@ function Hy({
8417
8417
  return ht.length > 0 ? ht.join(", ") : "—";
8418
8418
  }
8419
8419
  function Nl(L, W) {
8420
- var ht, it;
8420
+ var ht, ot;
8421
8421
  const te = L.field.indexOf(".");
8422
8422
  if (te < 0) return "—";
8423
8423
  const se = L.field.slice(0, te), je = L.field.slice(te + 1), Pe = ((ht = _r.get(se)) == null ? void 0 : ht.get(String(W.id))) ?? [];
8424
8424
  if (Pe.length === 0) return "—";
8425
- const _e = (it = Ra.get(se)) == null ? void 0 : it.get(je);
8425
+ const _e = (ot = Ra.get(se)) == null ? void 0 : ot.get(je);
8426
8426
  if (!(_e != null && _e.one_collection) || !_) return ta(L, W, !1);
8427
- const Be = _e.one_collection, yt = Pe.map((jt) => {
8427
+ const Be = _e.one_collection, yt = Pe.map((Ft) => {
8428
8428
  var sn;
8429
- const Et = jt[je];
8429
+ const Et = Ft[je];
8430
8430
  return Et == null || Et === "" ? null : { id: String(Et), label: ((sn = Ma[Be]) == null ? void 0 : sn[String(Et)]) ?? String(Et) };
8431
- }).filter((jt) => !!jt);
8432
- return yt.length === 0 ? "—" : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: yt.map((jt, Et) => /* @__PURE__ */ e(
8431
+ }).filter((Ft) => !!Ft);
8432
+ return yt.length === 0 ? "—" : /* @__PURE__ */ e("span", { className: "inline-flex flex-wrap gap-x-1.5", children: yt.map((Ft, Et) => /* @__PURE__ */ e(
8433
8433
  "button",
8434
8434
  {
8435
8435
  type: "button",
8436
8436
  onClick: (sn) => {
8437
- sn.stopPropagation(), _.open({ collection: Be, itemId: jt.id, title: jt.label, width: "80%" });
8437
+ sn.stopPropagation(), _.open({ collection: Be, itemId: Ft.id, title: Ft.label, width: "80%" });
8438
8438
  },
8439
8439
  className: "truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-[#00ceff] dark:hover:text-[#00ceff]",
8440
- children: jt.label
8440
+ children: Ft.label
8441
8441
  },
8442
- `${jt.id}:${Et}`
8442
+ `${Ft.id}:${Et}`
8443
8443
  )) });
8444
8444
  }
8445
- const rn = un && (yr.length > 0 || Pn.length > 0) ? [...yr, ...Pn] : gr, Cr = Se(
8445
+ const rn = un && (yr.length > 0 || Kn.length > 0) ? [...yr, ...Kn] : gr, Cr = Se(
8446
8446
  () => Qe.filter((L) => L.group_key === "__apply_values__" && !nc.has(L.type ?? "") && !ui.has(L.field)),
8447
8447
  [Qe]
8448
8448
  ), Pl = Se(
@@ -8497,11 +8497,11 @@ function Hy({
8497
8497
  const je = W.ids.filter((_e) => !se.has(_e));
8498
8498
  je.length && L.set(W.field, new Set(je));
8499
8499
  }), L;
8500
- }, [Dr, $r]), Kn = Se(() => {
8500
+ }, [Dr, $r]), In = Se(() => {
8501
8501
  const L = /* @__PURE__ */ new Map(), W = [..._t, ...De], te = [...Ke.values()], se = U.flatMap((je) => je.rows);
8502
8502
  for (const [je, Pe] of Jn) {
8503
8503
  if (!Pe.one_collection) continue;
8504
- const _e = W.map((it) => it[je]).filter((it) => it != null).map(String), Be = te.map((it) => it[je]).filter((it) => it != null).map(String), yt = se.map((it) => it[je]).filter((it) => it != null).map(String), ht = [.../* @__PURE__ */ new Set([..._e, ...Be, ...yt])].sort();
8504
+ const _e = W.map((ot) => ot[je]).filter((ot) => ot != null).map(String), Be = te.map((ot) => ot[je]).filter((ot) => ot != null).map(String), yt = se.map((ot) => ot[je]).filter((ot) => ot != null).map(String), ht = [.../* @__PURE__ */ new Set([..._e, ...Be, ...yt])].sort();
8505
8505
  ht.length && L.set(Pe.one_collection, ht);
8506
8506
  }
8507
8507
  return L;
@@ -8516,25 +8516,25 @@ function Hy({
8516
8516
  }
8517
8517
  return L;
8518
8518
  }, [gr, Jn]), Hn = Se(
8519
- () => ["m2o-display", t, ...Array.from(Kn.entries()).flat(2)],
8520
- [t, Kn]
8519
+ () => ["m2o-display", t, ...Array.from(In.entries()).flat(2)],
8520
+ [t, In]
8521
8521
  ), { data: bs = {}, isFetching: _l } = ge({
8522
8522
  queryKey: Hn,
8523
8523
  queryFn: async () => {
8524
8524
  const L = {}, W = await Promise.all(
8525
- [...Kn.keys()].map(
8525
+ [...In.keys()].map(
8526
8526
  (te) => C.request(he(`/collections/${te}`)).then((se) => ({ collection: te, meta: se.data }))
8527
8527
  )
8528
8528
  );
8529
8529
  return await Promise.all(
8530
8530
  W.map(async ({ collection: te, meta: se }) => {
8531
- const je = Kn.get(te), Pe = na.get(te);
8531
+ const je = In.get(te), Pe = na.get(te);
8532
8532
  let _e;
8533
8533
  if (Pe)
8534
8534
  _e = `id,${Pe.groupField}.*,${Pe.optionField}.*`;
8535
8535
  else {
8536
- const yt = (se == null ? void 0 : se.display_template) ?? void 0, ht = yt ? [...yt.matchAll(/\{\{([\w.]+)\}\}/g)].map((it) => it[1]) : [];
8537
- _e = ht.some((it) => it.includes(".")) ? ["id", ...ht].join(",") : void 0;
8536
+ const yt = (se == null ? void 0 : se.display_template) ?? void 0, ht = yt ? [...yt.matchAll(/\{\{([\w.]+)\}\}/g)].map((ot) => ot[1]) : [];
8537
+ _e = ht.some((ot) => ot.includes(".")) ? ["id", ...ht].join(",") : void 0;
8538
8538
  }
8539
8539
  const Be = await C.request(
8540
8540
  he(`/items/${te}`, {
@@ -8546,8 +8546,8 @@ function Hy({
8546
8546
  L[te] = {};
8547
8547
  for (const yt of Be)
8548
8548
  if (Pe) {
8549
- const ht = yt[Pe.groupField], it = yt[Pe.optionField], jt = ht ? Wn(null, ht) : null, Et = it ? Wn(null, it) : null;
8550
- L[te][String(yt.id)] = [jt, Et].filter(Boolean).join(" — ") || String(yt.id);
8549
+ const ht = yt[Pe.groupField], ot = yt[Pe.optionField], Ft = ht ? Wn(null, ht) : null, Et = ot ? Wn(null, ot) : null;
8550
+ L[te][String(yt.id)] = [Ft, Et].filter(Boolean).join(" — ") || String(yt.id);
8551
8551
  } else {
8552
8552
  const ht = (se == null ? void 0 : se.display_template) ?? void 0;
8553
8553
  L[te][String(yt.id)] = Wn(ht, yt);
@@ -8555,7 +8555,7 @@ function Hy({
8555
8555
  })
8556
8556
  ), L;
8557
8557
  },
8558
- enabled: Kn.size > 0,
8558
+ enabled: In.size > 0,
8559
8559
  staleTime: 6e4
8560
8560
  });
8561
8561
  function Sl(L) {
@@ -8638,11 +8638,11 @@ function Hy({
8638
8638
  return ht ? C.request(ut(`/items/${ht.junctionCollection}`, { [ht.junctionManyField]: Pe, [ht.junctionOtherField]: Be })) : Promise.resolve();
8639
8639
  })), Pe != null && te.length)
8640
8640
  for (const [_e, Be] of te) {
8641
- const yt = _e.slice(6), ht = Le.find((jt) => jt.one_collection === t && jt.one_field === yt);
8641
+ const yt = _e.slice(6), ht = Le.find((Ft) => Ft.one_collection === t && Ft.one_field === yt);
8642
8642
  if (!(ht != null && ht.many_collection) || !ht.many_field) continue;
8643
- const it = Array.isArray(Be) ? Be : [];
8644
- for (const jt of it)
8645
- await C.request(ut(`/items/${ht.many_collection}`, { ...jt, [ht.many_field]: Pe }));
8643
+ const ot = Array.isArray(Be) ? Be : [];
8644
+ for (const Ft of ot)
8645
+ await C.request(ut(`/items/${ht.many_collection}`, { ...Ft, [ht.many_field]: Pe }));
8646
8646
  }
8647
8647
  R.invalidateQueries({ queryKey: ["o2m-rows", t, n, r] });
8648
8648
  } else {
@@ -8677,9 +8677,9 @@ function Hy({
8677
8677
  }
8678
8678
  }
8679
8679
  }
8680
- const [Na, Xa] = q(/* @__PURE__ */ new Set()), [Vr, Da] = q(null), [Qr, cl] = q(null), [Kl, Cl] = q(!1), [pa, K] = q(1), [Fe, Ye] = q(!1), [kt, zt] = q(!1), [Ht, Rn] = q({}), [Cn, wn] = q(!1), [Sn, In] = q({}), [Yn, la] = q(!1);
8680
+ const [Na, Xa] = q(/* @__PURE__ */ new Set()), [Vr, Da] = q(null), [Qr, cl] = q(null), [Kl, Cl] = q(!1), [pa, K] = q(1), [Fe, Ye] = q(!1), [kt, zt] = q(!1), [Ht, Mn] = q({}), [Cn, wn] = q(!1), [Sn, Un] = q({}), [Yn, la] = q(!1);
8681
8681
  function $l(L, W) {
8682
- Rn((te) => ({ ...te, [L]: W }));
8682
+ Mn((te) => ({ ...te, [L]: W }));
8683
8683
  }
8684
8684
  async function Ni() {
8685
8685
  if (Object.keys(Sn).some((W) => Sn[W] !== null && Sn[W] !== void 0)) {
@@ -8691,7 +8691,7 @@ function Hy({
8691
8691
  )
8692
8692
  ), R.invalidateQueries({ queryKey: ["o2m-rows", t, n, r] }))), De.length && O && De.forEach(
8693
8693
  (W, te) => O.updateRow(t, n, te, { ...W, ...Sn })
8694
- ), wn(!1), In({});
8694
+ ), wn(!1), Un({});
8695
8695
  } catch {
8696
8696
  } finally {
8697
8697
  la(!1);
@@ -8723,34 +8723,34 @@ function Hy({
8723
8723
  function Fr(L, W) {
8724
8724
  L.preventDefault(), cl(W);
8725
8725
  }
8726
- function Un() {
8726
+ function Bn() {
8727
8727
  Da(null), cl(null);
8728
8728
  }
8729
8729
  async function Ea(L) {
8730
8730
  if (L.preventDefault(), Vr === null || Qr === null || Vr === Qr) {
8731
- Un();
8731
+ Bn();
8732
8732
  return;
8733
8733
  }
8734
8734
  const W = [..._t], [te] = W.splice(Vr, 1);
8735
8735
  W.splice(Qr, 0, te);
8736
8736
  const se = W.map((je, Pe) => ({ row: je, newOrder: Pe })).filter(({ row: je, newOrder: Pe }) => {
8737
- const _e = ie ? Ke.get(String(je.id)) : void 0, Be = (_e == null ? void 0 : _e[ot]) ?? je[ot];
8737
+ const _e = ie ? Ke.get(String(je.id)) : void 0, Be = (_e == null ? void 0 : _e[dt]) ?? je[dt];
8738
8738
  return Number(Be ?? -1) !== Pe;
8739
8739
  });
8740
8740
  if (ie && O) {
8741
8741
  se.forEach(
8742
- ({ row: je, newOrder: Pe }) => O.queueEdit(t, n, String(je.id), { [ot]: Pe })
8743
- ), Un();
8742
+ ({ row: je, newOrder: Pe }) => O.queueEdit(t, n, String(je.id), { [dt]: Pe })
8743
+ ), Bn();
8744
8744
  return;
8745
8745
  }
8746
8746
  Cl(!0);
8747
8747
  try {
8748
8748
  await Promise.all(se.map(
8749
- ({ row: je, newOrder: Pe }) => C.request(Nn(`/items/${t}/${je.id}${Oe}`, { [ot]: Pe }))
8749
+ ({ row: je, newOrder: Pe }) => C.request(Nn(`/items/${t}/${je.id}${Oe}`, { [dt]: Pe }))
8750
8750
  )), R.invalidateQueries({ queryKey: ["o2m-rows", t, n, r] });
8751
8751
  } catch {
8752
8752
  } finally {
8753
- Cl(!1), Un();
8753
+ Cl(!1), Bn();
8754
8754
  }
8755
8755
  }
8756
8756
  async function Er(L, W) {
@@ -8777,15 +8777,15 @@ function Hy({
8777
8777
  if (L.interface === "formula-column") {
8778
8778
  const ht = typeof se.column_formula == "string" ? se.column_formula : "";
8779
8779
  if (!ht || !te) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8780
- const it = _t.find((sn) => String(sn.id) === te) ?? {}, jt = hi(
8780
+ const ot = _t.find((sn) => String(sn.id) === te) ?? {}, Ft = hi(
8781
8781
  ht,
8782
8782
  (sn) => {
8783
- var Pt, Ln;
8784
- return sn.includes(".") ? (Ln = (Pt = Vt == null ? void 0 : Vt.rows[te]) == null ? void 0 : Pt[sn]) == null ? void 0 : Ln.value : it[sn];
8783
+ var Pt, Rn;
8784
+ return sn.includes(".") ? (Rn = (Pt = Vt == null ? void 0 : Vt.rows[te]) == null ? void 0 : Pt[sn]) == null ? void 0 : Rn.value : ot[sn];
8785
8785
  }
8786
8786
  );
8787
- if (jt === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8788
- const Et = jt.toLocaleString(
8787
+ if (Ft === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8788
+ const Et = Ft.toLocaleString(
8789
8789
  "en-US",
8790
8790
  ti(se, se.format)
8791
8791
  );
@@ -8794,23 +8794,23 @@ function Hy({
8794
8794
  if (L.interface === "match-agg-column") {
8795
8795
  const ht = qt.get(L.field);
8796
8796
  if (!ht || !te) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8797
- const it = _t.find((Ln) => String(Ln.id) === te) ?? {}, jt = (Ln, fa) => fa.split(".").reduce(
8797
+ const ot = _t.find((Rn) => String(Rn.id) === te) ?? {}, Ft = (Rn, fa) => fa.split(".").reduce(
8798
8798
  (lr, sa) => lr && typeof lr == "object" ? lr[sa] : void 0,
8799
- Ln
8799
+ Rn
8800
8800
  ), Et = ht.rows.filter(
8801
- (Ln) => ht.cfg.rowKeys.every(([fa, lr]) => {
8802
- const sa = jt(Ln, fa), zn = it[lr];
8801
+ (Rn) => ht.cfg.rowKeys.every(([fa, lr]) => {
8802
+ const sa = Ft(Rn, fa), zn = ot[lr];
8803
8803
  return sa == null || zn === null || zn === void 0 ? !1 : String(sa) === String(zn);
8804
8804
  })
8805
8805
  );
8806
- let sn = ht.cfg.aggregate === "count" ? Et.length : Et.reduce((Ln, fa) => Ln + (Number(fa[ht.cfg.valueField]) || 0), 0);
8806
+ let sn = ht.cfg.aggregate === "count" ? Et.length : Et.reduce((Rn, fa) => Rn + (Number(fa[ht.cfg.valueField]) || 0), 0);
8807
8807
  if (ht.cfg.formula) {
8808
- const Ln = hi(ht.cfg.formula, {
8809
- ...it,
8808
+ const Rn = hi(ht.cfg.formula, {
8809
+ ...ot,
8810
8810
  __agg__: sn
8811
8811
  });
8812
- if (Ln === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8813
- sn = Ln;
8812
+ if (Rn === null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8813
+ sn = Rn;
8814
8814
  }
8815
8815
  const Pt = sn.toLocaleString("en-US", ti(se, ht.cfg.format));
8816
8816
  return /* @__PURE__ */ e("span", { className: "tabular-nums", children: Pt });
@@ -8833,16 +8833,16 @@ function Hy({
8833
8833
  }
8834
8834
  if (W == null) return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
8835
8835
  if (L.interface === "relation-path" && _ && te) {
8836
- const ht = ci(L), it = (_e = Vt == null ? void 0 : Vt.rows[te]) == null ? void 0 : _e[L.field], jt = Vt == null ? void 0 : Vt.targets[L.field];
8837
- if (ht && it && jt && it.ids.length > 0)
8836
+ const ht = ci(L), ot = (_e = Vt == null ? void 0 : Vt.rows[te]) == null ? void 0 : _e[L.field], Ft = Vt == null ? void 0 : Vt.targets[L.field];
8837
+ if (ht && ot && Ft && ot.ids.length > 0)
8838
8838
  return /* @__PURE__ */ e(
8839
8839
  "button",
8840
8840
  {
8841
8841
  type: "button",
8842
8842
  onClick: (Et) => {
8843
8843
  Et.stopPropagation(), _.open({
8844
- collection: jt,
8845
- itemId: it.ids[0],
8844
+ collection: Ft,
8845
+ itemId: ot.ids[0],
8846
8846
  layoutId: ht.layout_id,
8847
8847
  width: ht.width,
8848
8848
  title: String(W)
@@ -8857,9 +8857,9 @@ function Hy({
8857
8857
  if (je != null && je.one_collection) {
8858
8858
  const ht = (Be = bs[je.one_collection]) == null ? void 0 : Be[String(W)];
8859
8859
  if (!ht && _l) return /* @__PURE__ */ e(Tt, { className: "h-3 w-3 animate-spin text-slate-300" });
8860
- const it = _ ? ci(L) : null, jt = W != null && ((yt = jn.get(L.field)) == null ? void 0 : yt.has(String(W))) === !0;
8860
+ const ot = _ ? ci(L) : null, Ft = W != null && ((yt = jn.get(L.field)) == null ? void 0 : yt.has(String(W))) === !0;
8861
8861
  let Et;
8862
- return it && _ ? Et = /* @__PURE__ */ e(
8862
+ return ot && _ ? Et = /* @__PURE__ */ e(
8863
8863
  "button",
8864
8864
  {
8865
8865
  type: "button",
@@ -8867,15 +8867,15 @@ function Hy({
8867
8867
  sn.stopPropagation(), _.open({
8868
8868
  collection: je.one_collection,
8869
8869
  itemId: String(W),
8870
- layoutId: it.layout_id,
8871
- width: it.width,
8870
+ layoutId: ot.layout_id,
8871
+ width: ot.width,
8872
8872
  title: ht ?? String(W)
8873
8873
  });
8874
8874
  },
8875
8875
  className: "block max-w-full truncate text-left underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-[#172940] hover:decoration-[#00ceff] dark:hover:text-[#00ceff]",
8876
8876
  children: ht ?? String(W)
8877
8877
  }
8878
- ) : Et = /* @__PURE__ */ e("span", { className: "block truncate", children: ht ?? String(W) }), jt ? /* @__PURE__ */ e(Uy, { children: Et }) : Et;
8878
+ ) : Et = /* @__PURE__ */ e("span", { className: "block truncate", children: ht ?? String(W) }), Ft ? /* @__PURE__ */ e(Uy, { children: Et }) : Et;
8879
8879
  }
8880
8880
  if (L.type === "boolean")
8881
8881
  return /* @__PURE__ */ e("span", { className: W ? "text-emerald-600" : "text-slate-400", children: W ? "Yes" : "No" });
@@ -8888,15 +8888,15 @@ function Hy({
8888
8888
  const ht = Number(W);
8889
8889
  if (!Number.isNaN(ht))
8890
8890
  try {
8891
- const it = L.options ? typeof L.options == "string" ? JSON.parse(L.options) : L.options : {}, jt = it.format;
8892
- if (jt === "int")
8891
+ const ot = L.options ? typeof L.options == "string" ? JSON.parse(L.options) : L.options : {}, Ft = ot.format;
8892
+ if (Ft === "int")
8893
8893
  return /* @__PURE__ */ e("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, { maximumFractionDigits: 0 }).format(ht) });
8894
- if (jt === "decimal") {
8895
- const Et = typeof it.precision == "number" ? it.precision : 2;
8894
+ if (Ft === "decimal") {
8895
+ const Et = typeof ot.precision == "number" ? ot.precision : 2;
8896
8896
  return /* @__PURE__ */ e("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, { minimumFractionDigits: Et, maximumFractionDigits: Et }).format(ht) });
8897
8897
  }
8898
- if (jt === "currency") {
8899
- const Et = it.currency || "USD";
8898
+ if (Ft === "currency") {
8899
+ const Et = ot.currency || "USD";
8900
8900
  return /* @__PURE__ */ e("span", { className: "block truncate tabular-nums", children: new Intl.NumberFormat(void 0, {
8901
8901
  ...ti(se, "currency"),
8902
8902
  currency: Et
@@ -8909,7 +8909,7 @@ function Hy({
8909
8909
  }
8910
8910
  if (Bt || !z && An)
8911
8911
  return /* @__PURE__ */ e("div", { className: "py-3 text-center text-[12px] text-slate-400", children: /* @__PURE__ */ e(Tt, { className: "h-4 w-4 animate-spin inline" }) });
8912
- const ar = (be == null ? void 0 : be.rowId) === "new", _a = rn.length + (z || ie ? 2 : 1) + (ot || z || ie ? 1 : 0), Bn = rn.filter((L) => !Sr(L)).length >= 6 ? "panel" : "inline", kn = (L) => {
8912
+ const ar = (be == null ? void 0 : be.rowId) === "new", _a = rn.length + (z || ie ? 2 : 1) + (dt || z || ie ? 1 : 0), Ln = rn.filter((L) => !Sr(L)).length >= 6 ? "panel" : "inline", kn = (L) => {
8913
8913
  for (const W of rn) {
8914
8914
  if (Sr(W)) continue;
8915
8915
  const te = L[W.field];
@@ -8948,87 +8948,93 @@ function Hy({
8948
8948
  },
8949
8949
  se
8950
8950
  );
8951
- }) }), Pr = (L) => L.computed_type === "write" && !!L.computed_formula || L.interface === "formula-column" || L.interface === "match-agg-column" || L.interface === "relation-path" || !!L.readonly || Sr(L), Ul = (L) => /* @__PURE__ */ e("td", { colSpan: _a, className: "p-0", children: /* @__PURE__ */ a(
8952
- "div",
8953
- {
8954
- className: "my-1.5 rounded-lg border border-nvr-cyan/40 bg-white px-4 py-3 shadow-[0_6px_24px_-8px_rgba(15,23,42,0.35)] ring-1 ring-nvr-cyan/15 dark:border-nvr-cyan/30 dark:bg-card",
8955
- onClick: (W) => W.stopPropagation(),
8956
- children: [
8957
- /* @__PURE__ */ a("div", { className: "mb-3 flex items-center justify-between gap-3 border-b border-slate-100 pb-2 dark:border-border", children: [
8958
- /* @__PURE__ */ e("div", { className: "min-w-0 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: L.identity }),
8959
- /* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-1.5", children: [
8960
- L.onDelete && /* @__PURE__ */ e(
8961
- "button",
8962
- {
8963
- type: "button",
8964
- onClick: L.onDelete,
8965
- className: "rounded px-2 py-1 text-[11px] text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",
8966
- children: "Delete"
8967
- }
8968
- ),
8969
- /* @__PURE__ */ e(
8970
- "button",
8971
- {
8972
- type: "button",
8973
- onClick: Tr,
8974
- className: "rounded px-2 py-1 text-[11px] text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
8975
- children: "Cancel"
8976
- }
8977
- ),
8978
- /* @__PURE__ */ e(
8979
- "button",
8980
- {
8981
- type: "button",
8982
- disabled: wt,
8983
- onClick: aa,
8984
- className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
8985
- children: wt ? "Saving…" : L.saveLabel
8986
- }
8987
- )
8988
- ] })
8989
- ] }),
8990
- rn.some((W) => Pr(W)) && /* @__PURE__ */ e("div", { className: "mb-3 flex flex-wrap items-stretch gap-x-6 gap-y-2 rounded-md bg-slate-50/80 px-3 py-2 dark:bg-muted/40", children: rn.filter(Pr).map((W) => {
8991
- const te = W.label || Lt(W.field), se = W.computed_type === "write" && !!W.computed_formula;
8992
- return /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col justify-start", children: [
8993
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: te }),
8994
- /* @__PURE__ */ e("span", { className: "mt-0.5 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: se ? Jr(
8995
- W,
8996
- qa(W.computed_formula, L.draft) ?? L.draft[W.field]
8997
- ) : Sr(W) ? ta(W, L.draft, !0) : Jr(W, L.draft[W.field], L.rowId) })
8998
- ] }, W.field);
8999
- }) }),
9000
- /* @__PURE__ */ e(
9001
- "div",
9002
- {
9003
- className: "grid items-start gap-x-4 gap-y-3",
9004
- style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
9005
- children: rn.filter((W) => !Pr(W)).map((W) => {
9006
- const te = W.computed_type === "write" && !!W.computed_formula, se = W.label || Lt(W.field), je = W.interface === "formula-column" || W.interface === "match-agg-column" || W.interface === "relation-path";
9007
- return Sr(W) ? /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
9008
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: se }),
9009
- /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: ta(W, L.draft, !0) })
9010
- ] }, W.field) : /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
9011
- /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: se }),
9012
- te ? /* @__PURE__ */ e("div", { className: "text-[12px] italic text-slate-500", children: Jr(W, qa(W.computed_formula, L.draft) ?? L.draft[W.field]) }) : je || W.readonly ? /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: Jr(W, L.draft[W.field], L.rowId) }) : /* @__PURE__ */ e(
9013
- el,
9014
- {
9015
- field: { ...W, sort: W.sort ?? 0 },
9016
- value: L.draft[W.field] ?? null,
9017
- onChange: (Pe) => Gn(W.field, Pe),
9018
- relations: Le,
9019
- collection: t,
9020
- itemId: L.rowId ?? "new",
9021
- cascadeFilter: Fn[W.field]
9022
- }
9023
- )
9024
- ] }, W.field);
9025
- })
9026
- }
9027
- ),
9028
- L.drawer
9029
- ]
9030
- }
9031
- ) }), P = Zt === Ai, xe = P ? null : (un == null ? void 0 : un.name) ?? ((Te = f == null ? void 0 : f[0]) == null ? void 0 : Te.name), we = f && f.length >= 2 && /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-[11px]", children: [
8951
+ }) }), Pr = (L) => L.computed_type === "write" && !!L.computed_formula || L.interface === "formula-column" || L.interface === "match-agg-column" || L.interface === "relation-path" || !!L.readonly || Sr(L), Ul = (L) => (
8952
+ // Spans EVERY column — the leading grip/number/status cells are hidden
8953
+ // while the panel renders (the panel header already says "Line N · …"),
8954
+ // so nothing pushes the form to the right. Overshoot is clamped by the
8955
+ // browser to the table's real column count.
8956
+ /* @__PURE__ */ e("td", { colSpan: _a + (u ? 2 : 1), className: "p-0", children: /* @__PURE__ */ a(
8957
+ "div",
8958
+ {
8959
+ className: "my-1.5 rounded-lg border border-nvr-cyan/40 bg-white px-4 py-3 shadow-[0_6px_24px_-8px_rgba(15,23,42,0.35)] ring-1 ring-nvr-cyan/15 dark:border-nvr-cyan/30 dark:bg-card",
8960
+ onClick: (W) => W.stopPropagation(),
8961
+ children: [
8962
+ /* @__PURE__ */ a("div", { className: "mb-3 flex items-center justify-between gap-3 border-b border-slate-100 pb-2 dark:border-border", children: [
8963
+ /* @__PURE__ */ e("div", { className: "min-w-0 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: L.identity }),
8964
+ /* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-1.5", children: [
8965
+ L.onDelete && /* @__PURE__ */ e(
8966
+ "button",
8967
+ {
8968
+ type: "button",
8969
+ onClick: L.onDelete,
8970
+ className: "rounded px-2 py-1 text-[11px] text-slate-400 transition-colors hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",
8971
+ children: "Delete"
8972
+ }
8973
+ ),
8974
+ /* @__PURE__ */ e(
8975
+ "button",
8976
+ {
8977
+ type: "button",
8978
+ onClick: Tr,
8979
+ className: "rounded px-2 py-1 text-[11px] text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
8980
+ children: "Cancel"
8981
+ }
8982
+ ),
8983
+ /* @__PURE__ */ e(
8984
+ "button",
8985
+ {
8986
+ type: "button",
8987
+ disabled: wt,
8988
+ onClick: aa,
8989
+ className: "rounded bg-nvr-cyan px-3 py-1 text-[11px] font-medium text-white transition-[filter] hover:brightness-110 disabled:opacity-50",
8990
+ children: wt ? "Saving…" : L.saveLabel
8991
+ }
8992
+ )
8993
+ ] })
8994
+ ] }),
8995
+ rn.some((W) => Pr(W)) && /* @__PURE__ */ e("div", { className: "mb-3 flex flex-wrap items-stretch gap-x-6 gap-y-2 rounded-md bg-slate-50/80 px-3 py-2 dark:bg-muted/40", children: rn.filter(Pr).map((W) => {
8996
+ const te = W.label || Lt(W.field), se = W.computed_type === "write" && !!W.computed_formula;
8997
+ return /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col justify-start", children: [
8998
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: te }),
8999
+ /* @__PURE__ */ e("span", { className: "mt-0.5 truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: se ? Jr(
9000
+ W,
9001
+ qa(W.computed_formula, L.draft) ?? L.draft[W.field]
9002
+ ) : Sr(W) ? ta(W, L.draft, !0) : Jr(W, L.draft[W.field], L.rowId) })
9003
+ ] }, W.field);
9004
+ }) }),
9005
+ /* @__PURE__ */ e(
9006
+ "div",
9007
+ {
9008
+ className: "grid items-start gap-x-4 gap-y-3",
9009
+ style: { gridTemplateColumns: "repeat(auto-fit, minmax(240px, 1fr))" },
9010
+ children: rn.filter((W) => !Pr(W)).map((W) => {
9011
+ const te = W.computed_type === "write" && !!W.computed_formula, se = W.label || Lt(W.field), je = W.interface === "formula-column" || W.interface === "match-agg-column" || W.interface === "relation-path";
9012
+ return Sr(W) ? /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
9013
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: se }),
9014
+ /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: ta(W, L.draft, !0) })
9015
+ ] }, W.field) : /* @__PURE__ */ a("div", { className: "flex min-w-0 flex-col gap-1", children: [
9016
+ /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-slate-400", children: se }),
9017
+ te ? /* @__PURE__ */ e("div", { className: "text-[12px] italic text-slate-500", children: Jr(W, qa(W.computed_formula, L.draft) ?? L.draft[W.field]) }) : je || W.readonly ? /* @__PURE__ */ e("div", { className: "text-[12px] text-slate-500", children: Jr(W, L.draft[W.field], L.rowId) }) : /* @__PURE__ */ e(
9018
+ el,
9019
+ {
9020
+ field: { ...W, sort: W.sort ?? 0 },
9021
+ value: L.draft[W.field] ?? null,
9022
+ onChange: (Pe) => Gn(W.field, Pe),
9023
+ relations: Le,
9024
+ collection: t,
9025
+ itemId: L.rowId ?? "new",
9026
+ cascadeFilter: Fn[W.field]
9027
+ }
9028
+ )
9029
+ ] }, W.field);
9030
+ })
9031
+ }
9032
+ ),
9033
+ L.drawer
9034
+ ]
9035
+ }
9036
+ ) })
9037
+ ), P = Zt === Ai, xe = P ? null : (un == null ? void 0 : un.name) ?? ((Te = f == null ? void 0 : f[0]) == null ? void 0 : Te.name), we = f && f.length >= 2 && /* @__PURE__ */ a("div", { className: "flex items-center gap-1 text-[11px]", children: [
9032
9038
  /* @__PURE__ */ e(
9033
9039
  "button",
9034
9040
  {
@@ -9227,7 +9233,7 @@ function Hy({
9227
9233
  {
9228
9234
  field: L,
9229
9235
  value: Sn[L.field] ?? null,
9230
- onChange: (W) => In((te) => ({ ...te, [L.field]: W })),
9236
+ onChange: (W) => Un((te) => ({ ...te, [L.field]: W })),
9231
9237
  relations: Le,
9232
9238
  collection: t,
9233
9239
  itemId: "new"
@@ -9259,7 +9265,7 @@ function Hy({
9259
9265
  ] }) }),
9260
9266
  /* @__PURE__ */ a("table", { className: "w-full table-fixed", children: [
9261
9267
  /* @__PURE__ */ e("thead", { className: "bg-slate-50 border-b border-slate-200 [&>tr>th:first-child]:rounded-tl-lg [&>tr>th:last-child]:rounded-tr-lg", children: /* @__PURE__ */ a("tr", { children: [
9262
- c && (ot || z || ie) && /* @__PURE__ */ e("th", { className: "w-6" }),
9268
+ c && (dt || z || ie) && /* @__PURE__ */ e("th", { className: "w-6" }),
9263
9269
  u && /* @__PURE__ */ e("th", { className: "w-8 px-2 py-2 text-left font-medium text-slate-400 text-[11px]", children: "#" }),
9264
9270
  (z || ie) && /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-400 text-[11px] w-20", children: "Status" }),
9265
9271
  rn.map((L) => /* @__PURE__ */ e("th", { className: "px-3 py-2 text-left font-medium text-slate-500 text-[11px]", children: L.label ?? Lt(L.field) }, L.field)),
@@ -9267,7 +9273,7 @@ function Hy({
9267
9273
  ] }) }),
9268
9274
  /* @__PURE__ */ a("tbody", { children: [
9269
9275
  kt && /* @__PURE__ */ a("tr", { className: "border-b border-[#00ceff]/20 bg-[#00ceff]/5", children: [
9270
- c && (ot || z || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9276
+ c && (dt || z || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9271
9277
  u && /* @__PURE__ */ e("td", { className: "w-8" }),
9272
9278
  (z || ie) && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-[#009abe]", children: "Defaults" }) }),
9273
9279
  Pl.map((L) => /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e(
@@ -9293,7 +9299,7 @@ function Hy({
9293
9299
  ) })
9294
9300
  ] }),
9295
9301
  !z && xt === "original" && _t.map((L, W) => {
9296
- const te = String(L.id), se = ca ? yn(L) : null, je = se !== null && (W === 0 || yn(_t[W - 1]) !== se), Pe = se !== null && xn.has(se), _e = je && se !== null ? /* @__PURE__ */ e("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ e("td", { colSpan: rn.length + 1 + (z || ie ? 1 : 0) + (u ? 1 : 0) + (c && (ot || z || ie) ? 1 : 0), className: "px-2 py-1", children: /* @__PURE__ */ a(
9302
+ const te = String(L.id), se = ca ? yn(L) : null, je = se !== null && (W === 0 || yn(_t[W - 1]) !== se), Pe = se !== null && xn.has(se), _e = je && se !== null ? /* @__PURE__ */ e("tr", { className: "border-b border-slate-200 bg-slate-100/80 dark:border-border dark:bg-muted", children: /* @__PURE__ */ e("td", { colSpan: rn.length + 1 + (z || ie ? 1 : 0) + (u ? 1 : 0) + (c && (dt || z || ie) ? 1 : 0), className: "px-2 py-1", children: /* @__PURE__ */ a(
9297
9303
  "button",
9298
9304
  {
9299
9305
  type: "button",
@@ -9304,25 +9310,25 @@ function Hy({
9304
9310
  children: [
9305
9311
  /* @__PURE__ */ e(Ar, { className: Q("h-3 w-3 shrink-0 text-slate-400 transition-transform", !Pe && "rotate-90") }),
9306
9312
  /* @__PURE__ */ e("span", { className: "text-[11px] font-semibold text-slate-600 dark:text-slate-300", children: se }),
9307
- /* @__PURE__ */ e("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: _t.reduce((Pt, Ln) => Pt + (yn(Ln) === se ? 1 : 0), 0) })
9313
+ /* @__PURE__ */ e("span", { className: "rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[10px] font-medium text-slate-500 dark:border-border dark:bg-background dark:text-slate-400", children: _t.reduce((Pt, Rn) => Pt + (yn(Rn) === se ? 1 : 0), 0) })
9308
9314
  ]
9309
9315
  }
9310
9316
  ) }) }) : null;
9311
9317
  if (Pe) return /* @__PURE__ */ e(tl, { children: _e }, te);
9312
- const Be = (be == null ? void 0 : be.rowId) === te, yt = Vr === W, ht = Qr === W && Vr !== W, it = Ke.has(te), jt = Je.has(te), Et = it ? { ...L, ...Ke.get(te) } : L, sn = ye && !jt ? G.get(String(Et[ye] ?? "")) ?? null : null;
9318
+ const Be = (be == null ? void 0 : be.rowId) === te, yt = Vr === W, ht = Qr === W && Vr !== W, ot = Ke.has(te), Ft = Je.has(te), Et = ot ? { ...L, ...Ke.get(te) } : L, sn = ye && !Ft ? G.get(String(Et[ye] ?? "")) ?? null : null;
9313
9319
  return /* @__PURE__ */ a(tl, { children: [
9314
9320
  _e,
9315
9321
  /* @__PURE__ */ a(
9316
9322
  "tr",
9317
9323
  {
9318
- draggable: c && !!ot && !Be && !jt,
9324
+ draggable: c && !!dt && !Be && !Ft,
9319
9325
  onDragStart: () => Il(W),
9320
9326
  onDragOver: (Pt) => Fr(Pt, W),
9321
9327
  onDrop: Ea,
9322
- onDragEnd: Un,
9323
- onClick: () => !Be && !jt && Sl(Et),
9328
+ onDragEnd: Bn,
9329
+ onClick: () => !Be && !Ft && Sl(Et),
9324
9330
  onBlur: (Pt) => {
9325
- !Be || wt || jt || Pt.currentTarget.contains(Pt.relatedTarget) || (St.current = setTimeout(() => void aa(), 150));
9331
+ !Be || wt || Ft || Pt.currentTarget.contains(Pt.relatedTarget) || (St.current = setTimeout(() => void aa(), 150));
9326
9332
  },
9327
9333
  onFocus: () => {
9328
9334
  St.current && (clearTimeout(St.current), St.current = null);
@@ -9331,15 +9337,17 @@ function Hy({
9331
9337
  "border-b border-slate-100 transition-colors",
9332
9338
  yt ? "opacity-40" : "",
9333
9339
  ht ? "border-t-2 border-t-[#00ceff]" : "",
9334
- jt ? "opacity-50 bg-red-50/40 cursor-default line-through" : "",
9335
- !jt && Be ? "bg-[#f0fbff] dark:bg-nvr-cyan/5 cursor-default" : "",
9336
- !jt && !Be ? sn ? "bg-red-50/70 hover:bg-red-50 cursor-pointer dark:bg-red-900/15" : W % 2 === 0 ? "bg-white hover:bg-slate-50/80 dark:bg-card dark:hover:bg-muted cursor-pointer" : "bg-slate-50/50 hover:bg-slate-100/60 cursor-pointer" : ""
9340
+ Ft ? "opacity-50 bg-red-50/40 cursor-default line-through" : "",
9341
+ !Ft && Be ? "bg-[#f0fbff] dark:bg-nvr-cyan/5 cursor-default" : "",
9342
+ !Ft && !Be ? sn ? "bg-red-50/70 hover:bg-red-50 cursor-pointer dark:bg-red-900/15" : W % 2 === 0 ? "bg-white hover:bg-slate-50/80 dark:bg-card dark:hover:bg-muted cursor-pointer" : "bg-slate-50/50 hover:bg-slate-100/60 cursor-pointer" : ""
9337
9343
  ),
9338
9344
  children: [
9339
- c && (ot || ie) && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (Pt) => Pt.stopPropagation(), children: ot && /* @__PURE__ */ e(Uc, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
9340
- u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: W + 1 }),
9341
- ie && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: jt ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5", children: "Delete" }) : it ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null }),
9342
- Be && !jt && Bn === "panel" ? Ul({
9345
+ !(Be && !Ft && Ln === "panel") && /* @__PURE__ */ a(it, { children: [
9346
+ c && (dt || ie) && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (Pt) => Pt.stopPropagation(), children: dt && /* @__PURE__ */ e(Uc, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
9347
+ u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: W + 1 }),
9348
+ ie && /* @__PURE__ */ e("td", { className: "px-3 py-1 align-middle w-20", children: Ft ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-red-600 bg-red-50 border border-red-200 rounded px-1.5 py-0.5", children: "Delete" }) : ot ? /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Edited" }) : null })
9349
+ ] }),
9350
+ Be && !Ft && Ln === "panel" ? Ul({
9343
9351
  identity: `${u ? `Line ${W + 1} · ` : ""}${kn(Et)}`,
9344
9352
  draft: (be == null ? void 0 : be.draft) ?? Et,
9345
9353
  rowId: te,
@@ -9349,8 +9357,8 @@ function Hy({
9349
9357
  }) : rn.map((Pt) => {
9350
9358
  if (Sr(Pt))
9351
9359
  return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: Nl(Pt, Et) }) }, Pt.field);
9352
- const Ln = Pt.computed_type === "write" && !!Pt.computed_formula, fa = Ln ? qa(Pt.computed_formula, Be ? (be == null ? void 0 : be.draft) ?? Et : Et) ?? Et[Pt.field] : null;
9353
- return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: Ln ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Jr(Pt, fa) }) : Be && !jt || Aa(Pt.interface) ? /* @__PURE__ */ e("div", { onClick: (lr) => lr.stopPropagation(), children: /* @__PURE__ */ e(
9360
+ const Rn = Pt.computed_type === "write" && !!Pt.computed_formula, fa = Rn ? qa(Pt.computed_formula, Be ? (be == null ? void 0 : be.draft) ?? Et : Et) ?? Et[Pt.field] : null;
9361
+ return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: Rn ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Jr(Pt, fa) }) : Be && !Ft || Aa(Pt.interface) ? /* @__PURE__ */ e("div", { onClick: (lr) => lr.stopPropagation(), children: /* @__PURE__ */ e(
9354
9362
  el,
9355
9363
  {
9356
9364
  field: { ...Pt, sort: Pt.sort ?? 0 },
@@ -9360,11 +9368,11 @@ function Hy({
9360
9368
  collection: t,
9361
9369
  itemId: te,
9362
9370
  cascadeFilter: Fn[Pt.field],
9363
- displayOnly: !Be || jt
9371
+ displayOnly: !Be || Ft
9364
9372
  }
9365
9373
  ) }) : /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden", children: Jr(Pt, Et[Pt.field], L.id != null ? String(L.id) : void 0) }) }, Pt.field);
9366
9374
  }),
9367
- !(Be && !jt && Bn === "panel") && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: Be && !jt ? /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", onClick: (Pt) => Pt.stopPropagation(), children: [
9375
+ !(Be && !Ft && Ln === "panel") && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: Be && !Ft ? /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", onClick: (Pt) => Pt.stopPropagation(), children: [
9368
9376
  /* @__PURE__ */ e(
9369
9377
  "button",
9370
9378
  {
@@ -9384,7 +9392,7 @@ function Hy({
9384
9392
  children: "✕"
9385
9393
  }
9386
9394
  )
9387
- ] }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-end gap-0.5", children: jt ? /* @__PURE__ */ e(
9395
+ ] }) : /* @__PURE__ */ e("div", { className: "flex items-center justify-end gap-0.5", children: Ft ? /* @__PURE__ */ e(
9388
9396
  "button",
9389
9397
  {
9390
9398
  type: "button",
@@ -9395,8 +9403,8 @@ function Hy({
9395
9403
  className: "rounded px-1.5 py-0.5 text-[10px] text-red-500 hover:text-red-700 border border-red-200 hover:border-red-400",
9396
9404
  children: "Undo"
9397
9405
  }
9398
- ) : /* @__PURE__ */ a(dt, { children: [
9399
- it && /* @__PURE__ */ e(
9406
+ ) : /* @__PURE__ */ a(it, { children: [
9407
+ ot && /* @__PURE__ */ e(
9400
9408
  "button",
9401
9409
  {
9402
9410
  type: "button",
@@ -9444,13 +9452,13 @@ function Hy({
9444
9452
  ]
9445
9453
  }
9446
9454
  ) }),
9447
- Be && !jt && Bn !== "panel" && w && w.length > 0 && /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: _a, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: w.map((Pt) => {
9448
- const Ln = typeof Pt == "string" ? Pt : Pt.field, fa = typeof Pt == "string" ? void 0 : Pt.hint, lr = typeof Pt == "string" ? void 0 : Pt.match, sa = (be == null ? void 0 : be.draft) ?? Et, zn = lr ? ld(lr, sa, r, re == null ? void 0 : re.draft) : null;
9455
+ Be && !Ft && Ln !== "panel" && w && w.length > 0 && /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: _a, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: w.map((Pt) => {
9456
+ const Rn = typeof Pt == "string" ? Pt : Pt.field, fa = typeof Pt == "string" ? void 0 : Pt.hint, lr = typeof Pt == "string" ? void 0 : Pt.match, sa = (be == null ? void 0 : be.draft) ?? Et, zn = lr ? ld(lr, sa, r, re == null ? void 0 : re.draft) : null;
9449
9457
  return /* @__PURE__ */ e(
9450
9458
  tc,
9451
9459
  {
9452
9460
  parentCollection: t,
9453
- relationField: Ln,
9461
+ relationField: Rn,
9454
9462
  parentRowId: te,
9455
9463
  parentDraft: (be == null ? void 0 : be.draft) ?? Et,
9456
9464
  hint: fa,
@@ -9461,20 +9469,22 @@ function Hy({
9461
9469
  matchSeed: (zn == null ? void 0 : zn.seed) ?? {}
9462
9470
  } : ie ? {
9463
9471
  deferred: !0,
9464
- stagedOps: (be == null ? void 0 : be.draft[`__nested_ops_${Ln}`]) ?? zi,
9465
- onStagedOpsChange: (Od) => Gn(`__nested_ops_${Ln}`, Od)
9472
+ stagedOps: (be == null ? void 0 : be.draft[`__nested_ops_${Rn}`]) ?? zi,
9473
+ onStagedOpsChange: (Od) => Gn(`__nested_ops_${Rn}`, Od)
9466
9474
  } : {}
9467
9475
  },
9468
- Ln
9476
+ Rn
9469
9477
  );
9470
9478
  }) }) }) })
9471
9479
  ] }, te);
9472
9480
  }),
9473
9481
  ar && /* @__PURE__ */ a("tr", { className: "border-b border-slate-100 bg-[#f0fbff] dark:bg-nvr-cyan/5", children: [
9474
- (ot || z || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9475
- u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: _t.length + De.length + 1 }),
9476
- (z || ie) && /* @__PURE__ */ e("td", { className: "px-3 py-1.5" }),
9477
- Bn === "panel" ? Ul({
9482
+ Ln !== "panel" && /* @__PURE__ */ a(it, { children: [
9483
+ (dt || z || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9484
+ u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: _t.length + De.length + 1 }),
9485
+ (z || ie) && /* @__PURE__ */ e("td", { className: "px-3 py-1.5" })
9486
+ ] }),
9487
+ Ln === "panel" ? Ul({
9478
9488
  identity: `${u ? `Line ${_t.length + De.length + 1} · ` : ""}New line`,
9479
9489
  draft: be.draft,
9480
9490
  rowId: void 0,
@@ -9505,7 +9515,7 @@ function Hy({
9505
9515
  }
9506
9516
  ) }) }, L.field);
9507
9517
  }),
9508
- Bn !== "panel" && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", children: [
9518
+ Ln !== "panel" && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", children: [
9509
9519
  /* @__PURE__ */ e(
9510
9520
  "button",
9511
9521
  {
@@ -9527,22 +9537,22 @@ function Hy({
9527
9537
  )
9528
9538
  ] }) })
9529
9539
  ] }),
9530
- _t.length === 0 && De.length === 0 && !ar && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: rn.length + (z || ie ? 2 : 1) + (ot || z || ie ? 1 : 0), className: "px-3 py-14 text-center text-slate-400", children: z ? "No pending rows" : "No rows yet" }) }),
9540
+ _t.length === 0 && De.length === 0 && !ar && /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: rn.length + (z || ie ? 2 : 1) + (dt || z || ie ? 1 : 0), className: "px-3 py-14 text-center text-slate-400", children: z ? "No pending rows" : "No rows yet" }) }),
9531
9541
  !z && xt !== "original" && (() => {
9532
- const L = U.find((te) => te.addendumId === xt), W = (c && (ot || ie) ? 1 : 0) + (u ? 1 : 0) + (ie ? 1 : 0) + rn.length + 1;
9542
+ const L = U.find((te) => te.addendumId === xt), W = (c && (dt || ie) ? 1 : 0) + (u ? 1 : 0) + (ie ? 1 : 0) + rn.length + 1;
9533
9543
  return L ? L.rows.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: W, className: "px-3 py-8 text-center text-[11px] text-amber-500", children: "No proposed rows in this addendum" }) }) : L.rows.map((te, se) => {
9534
- const je = On({ ...te }), Pe = _t.find((it) => String(it.id) === String(je.id)), _e = Pe ? On({ ...Pe }) : void 0, Be = !_e, yt = new Set(
9535
- Be ? gr.map((it) => it.field) : gr.filter((it) => String(je[it.field] ?? "") !== String(_e[it.field] ?? "")).map((it) => it.field)
9544
+ const je = On({ ...te }), Pe = _t.find((ot) => String(ot.id) === String(je.id)), _e = Pe ? On({ ...Pe }) : void 0, Be = !_e, yt = new Set(
9545
+ Be ? gr.map((ot) => ot.field) : gr.filter((ot) => String(je[ot.field] ?? "") !== String(_e[ot.field] ?? "")).map((ot) => ot.field)
9536
9546
  ), ht = Be || yt.size > 0;
9537
9547
  return /* @__PURE__ */ a("tr", { className: ht ? "border-b border-amber-100 bg-amber-50/40 dark:border-amber-500/25 dark:bg-amber-400/10" : "border-b border-slate-100", children: [
9538
- c && (ot || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9548
+ c && (dt || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9539
9549
  u && /* @__PURE__ */ e("td", { className: `w-8 px-2 align-middle text-[11px] select-none ${ht ? "text-amber-400" : "text-slate-400"}`, children: se + 1 }),
9540
9550
  ie && /* @__PURE__ */ e("td", { className: "w-20" }),
9541
- rn.map((it) => /* @__PURE__ */ e("td", { className: `px-2 py-1.5 text-[11px] ${yt.has(it.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`, children: Sr(it) ? Nl(it, je) : Jr(it, je[it.field], je.id != null ? String(je.id) : void 0) }, it.field)),
9551
+ rn.map((ot) => /* @__PURE__ */ e("td", { className: `px-2 py-1.5 text-[11px] ${yt.has(ot.field) ? "bg-amber-50 text-amber-900 dark:bg-amber-400/15 dark:text-amber-300" : "text-slate-700 dark:text-slate-300"}`, children: Sr(ot) ? Nl(ot, je) : Jr(ot, je[ot.field], je.id != null ? String(je.id) : void 0) }, ot.field)),
9542
9552
  /* @__PURE__ */ e("td", { className: "w-20 px-2 py-1.5 text-right", children: ht && /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase tracking-wide text-amber-400", children: Be ? "New" : "Modified" }) })
9543
9553
  ] }, se);
9544
9554
  }) : _t.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: W, className: "px-3 py-8 text-center text-[11px] text-slate-400", children: "No rows" }) }) : _t.map((te, se) => /* @__PURE__ */ a("tr", { className: "border-b border-slate-100", children: [
9545
- c && (ot || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9555
+ c && (dt || ie) && /* @__PURE__ */ e("td", { className: "w-6" }),
9546
9556
  u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-[11px] text-slate-400 select-none", children: se + 1 }),
9547
9557
  ie && /* @__PURE__ */ e("td", { className: "w-20" }),
9548
9558
  rn.map((je) => /* @__PURE__ */ e("td", { className: "px-2 py-1.5 text-[11px] text-slate-700", children: Sr(je) ? Nl(je, te) : Jr(je, te[je.field], te.id != null ? String(te.id) : void 0) }, je.field)),
@@ -9559,9 +9569,9 @@ function Hy({
9559
9569
  onDragStart: () => Il(W),
9560
9570
  onDragOver: (Be) => Fr(Be, W),
9561
9571
  onDrop: (Be) => {
9562
- Be.preventDefault(), Vr !== null && Qr !== null && Vr !== Qr && (O == null || O.reorderRows(t, n, Vr, Qr)), Un();
9572
+ Be.preventDefault(), Vr !== null && Qr !== null && Vr !== Qr && (O == null || O.reorderRows(t, n, Vr, Qr)), Bn();
9563
9573
  },
9564
- onDragEnd: Un,
9574
+ onDragEnd: Bn,
9565
9575
  onClick: () => !se && ra(L, W),
9566
9576
  onBlur: (Be) => {
9567
9577
  !se || wt || Be.currentTarget.contains(Be.relatedTarget) || (St.current = setTimeout(() => void aa(), 150));
@@ -9576,13 +9586,15 @@ function Hy({
9576
9586
  se ? "bg-[#f0fbff] dark:bg-nvr-cyan/5 cursor-default" : _e ? "hover:bg-slate-50 dark:hover:bg-muted cursor-pointer" : "bg-amber-50/40 hover:bg-amber-50/70 dark:bg-amber-400/10 dark:hover:bg-amber-400/15 cursor-pointer"
9577
9587
  ),
9578
9588
  children: [
9579
- c && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (Be) => Be.stopPropagation(), children: /* @__PURE__ */ e(Uc, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
9580
- u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: _t.length + W + 1 }),
9581
- /* @__PURE__ */ a("td", { className: "px-3 py-1 align-middle w-16", children: [
9582
- !se && !_e && /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
9583
- !se && _e && L.id != null && Na.has(L.id) && /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
9589
+ !(se && Ln === "panel") && /* @__PURE__ */ a(it, { children: [
9590
+ c && /* @__PURE__ */ e("td", { className: "w-6 px-1 align-middle", onClick: (Be) => Be.stopPropagation(), children: /* @__PURE__ */ e(Uc, { className: "h-3 w-3 text-slate-300 cursor-grab" }) }),
9591
+ u && /* @__PURE__ */ e("td", { className: "w-8 px-2 align-middle text-slate-400 text-[11px] select-none", children: _t.length + W + 1 }),
9592
+ /* @__PURE__ */ a("td", { className: "px-3 py-1 align-middle w-16", children: [
9593
+ !se && !_e && /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-amber-600 bg-amber-50 border border-amber-200 dark:text-amber-400 dark:bg-amber-500/10 dark:border-amber-500/40 rounded px-1.5 py-0.5", children: "Pending" }),
9594
+ !se && _e && L.id != null && Na.has(L.id) && /* @__PURE__ */ e("span", { className: "inline-flex text-[10px] font-medium text-blue-600 bg-blue-50 border border-blue-200 rounded px-1.5 py-0.5", children: "Edited" })
9595
+ ] })
9584
9596
  ] }),
9585
- se && Bn === "panel" ? Ul({
9597
+ se && Ln === "panel" ? Ul({
9586
9598
  identity: `${u ? `Line ${_t.length + W + 1} · ` : ""}${kn(se ? be.draft : L)}`,
9587
9599
  draft: (be == null ? void 0 : be.draft) ?? L,
9588
9600
  rowId: te,
@@ -9596,13 +9608,13 @@ function Hy({
9596
9608
  }) : rn.map((Be) => {
9597
9609
  if (Sr(Be))
9598
9610
  return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500", children: ta(Be, se ? be.draft : L, !0) }) }, Be.field);
9599
- const yt = Be.computed_type === "write" && !!Be.computed_formula, ht = Aa(Be.interface), it = `__m2m_${Be.field}`, jt = ht && se ? Lr(Be) : null, Et = yt ? qa(Be.computed_formula, se ? be.draft : L) ?? L[Be.field] : se ? be.draft[Be.field] : L[Be.field];
9600
- return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: yt ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Jr(Be, Et) }) : ht && se && jt ? /* @__PURE__ */ e("div", { onClick: (sn) => sn.stopPropagation(), children: /* @__PURE__ */ e(
9611
+ const yt = Be.computed_type === "write" && !!Be.computed_formula, ht = Aa(Be.interface), ot = `__m2m_${Be.field}`, Ft = ht && se ? Lr(Be) : null, Et = yt ? qa(Be.computed_formula, se ? be.draft : L) ?? L[Be.field] : se ? be.draft[Be.field] : L[Be.field];
9612
+ return /* @__PURE__ */ e("td", { className: "px-2 py-1 align-top", children: yt ? /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden text-slate-500 italic", children: Jr(Be, Et) }) : ht && se && Ft ? /* @__PURE__ */ e("div", { onClick: (sn) => sn.stopPropagation(), children: /* @__PURE__ */ e(
9601
9613
  Ha,
9602
9614
  {
9603
- collection: jt.targetCollection,
9604
- value: be.draft[it] ?? null,
9605
- onChange: (sn) => Gn(it, sn),
9615
+ collection: Ft.targetCollection,
9616
+ value: be.draft[ot] ?? null,
9617
+ onChange: (sn) => Gn(ot, sn),
9606
9618
  extraFilter: Fn[Be.field]
9607
9619
  }
9608
9620
  ) }) : ht ? /* @__PURE__ */ e("span", { className: "text-slate-300 text-[11px]", children: "—" }) : se ? /* @__PURE__ */ e("div", { onClick: (sn) => sn.stopPropagation(), children: /* @__PURE__ */ e(
@@ -9618,7 +9630,7 @@ function Hy({
9618
9630
  }
9619
9631
  ) }) : /* @__PURE__ */ e("div", { className: "py-0.5 overflow-hidden", children: Jr(Be, L[Be.field], String(L.id)) }) }, Be.field);
9620
9632
  }),
9621
- !(se && Bn === "panel") && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: se ? /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", onClick: (Be) => Be.stopPropagation(), children: [
9633
+ !(se && Ln === "panel") && /* @__PURE__ */ e("td", { className: "px-1 py-1 align-middle", children: se ? /* @__PURE__ */ a("div", { className: "flex items-stretch gap-1", onClick: (Be) => Be.stopPropagation(), children: [
9622
9634
  /* @__PURE__ */ e(
9623
9635
  "button",
9624
9636
  {
@@ -9666,7 +9678,7 @@ function Hy({
9666
9678
  ]
9667
9679
  }
9668
9680
  ),
9669
- se && Bn !== "panel" && w && w.length > 0 && /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: _a, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: w.map((Be) => {
9681
+ se && Ln !== "panel" && w && w.length > 0 && /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 bg-[#f0fbff]/60 dark:bg-nvr-cyan/5", children: /* @__PURE__ */ e("td", { colSpan: _a, className: "px-3 py-2", children: /* @__PURE__ */ e("div", { className: "space-y-2", children: w.map((Be) => {
9670
9682
  const yt = typeof Be == "string" ? Be : Be.field, ht = typeof Be == "string" ? void 0 : Be.hint;
9671
9683
  return /* @__PURE__ */ e(
9672
9684
  tc,
@@ -9675,7 +9687,7 @@ function Hy({
9675
9687
  relationField: yt,
9676
9688
  parentRowId: null,
9677
9689
  stagedMembers: be.draft[`__o2m_${yt}`] ?? [],
9678
- onStagedChange: (it) => Gn(`__o2m_${yt}`, it),
9690
+ onStagedChange: (ot) => Gn(`__o2m_${yt}`, ot),
9679
9691
  parentDraft: be.draft,
9680
9692
  hint: ht
9681
9693
  },
@@ -9701,7 +9713,7 @@ function Hy({
9701
9713
  ...De.map((te) => On(te))
9702
9714
  ];
9703
9715
  return /* @__PURE__ */ e("tfoot", { children: /* @__PURE__ */ a("tr", { className: "border-t border-slate-200 bg-slate-50 text-[11px] font-medium text-slate-600", children: [
9704
- c && (ot || z || ie) && /* @__PURE__ */ e("td", {}),
9716
+ c && (dt || z || ie) && /* @__PURE__ */ e("td", {}),
9705
9717
  u && /* @__PURE__ */ e("td", {}),
9706
9718
  (z || ie) && /* @__PURE__ */ e("td", {}),
9707
9719
  rn.map((te) => {
@@ -9715,7 +9727,7 @@ function Hy({
9715
9727
  if (!je) return /* @__PURE__ */ e("td", { className: "px-3 py-1.5" }, te.field);
9716
9728
  const Pe = W.map((ht) => Number(ht[te.field])).filter((ht) => !Number.isNaN(ht));
9717
9729
  let _e = null;
9718
- je === "count" ? _e = W.length : Pe.length > 0 && (je === "sum" ? _e = Pe.reduce((ht, it) => ht + it, 0) : je === "avg" ? _e = Pe.reduce((ht, it) => ht + it, 0) / Pe.length : je === "min" ? _e = Math.min(...Pe) : je === "max" && (_e = Math.max(...Pe)));
9730
+ je === "count" ? _e = W.length : Pe.length > 0 && (je === "sum" ? _e = Pe.reduce((ht, ot) => ht + ot, 0) : je === "avg" ? _e = Pe.reduce((ht, ot) => ht + ot, 0) / Pe.length : je === "min" ? _e = Math.min(...Pe) : je === "max" && (_e = Math.max(...Pe)));
9719
9731
  const Be = se.format;
9720
9732
  let yt = _e === null ? "—" : (() => {
9721
9733
  try {
@@ -10181,7 +10193,7 @@ function Xy({
10181
10193
  if (ie == null || ie === "") return "—";
10182
10194
  const Ke = Number(ie);
10183
10195
  return De === "currency" ? Number.isNaN(Ke) ? String(ie) : Ke.toLocaleString(void 0, { style: "currency", currency: "USD" }) : De === "number" ? Number.isNaN(Ke) ? String(ie) : Ke.toLocaleString(void 0, { maximumFractionDigits: 2 }) : String(ie);
10184
- }, Ft = (ie, De) => /* @__PURE__ */ a(dt, { children: [
10196
+ }, jt = (ie, De) => /* @__PURE__ */ a(it, { children: [
10185
10197
  Ot.map((Ke) => /* @__PURE__ */ e(
10186
10198
  "span",
10187
10199
  {
@@ -10279,7 +10291,7 @@ function Xy({
10279
10291
  }
10280
10292
  return me;
10281
10293
  }
10282
- async function ot(ie, De, Ke) {
10294
+ async function dt(ie, De, Ke) {
10283
10295
  const Je = De.trim() === "" ? 0 : Number(De);
10284
10296
  if (Number.isNaN(Je) || Je < 0 || (ae(ie) ?? 0) === Je) return;
10285
10297
  const Ue = Je > 0 ? await Le(ie) : {};
@@ -10373,9 +10385,9 @@ function Xy({
10373
10385
  return ((Ae = Ue.data) == null ? void 0 : Ae[0]) ?? { id: ie };
10374
10386
  }).catch(() => ({ id: ie })));
10375
10387
  const me = (ae(De) ?? 0) + 1;
10376
- await ot(De, String(me), Je);
10388
+ await dt(De, String(me), Je);
10377
10389
  }
10378
- const dn = H.length, An = Object.keys(s.copy_fields ?? {}), Mn = Object.keys(s.compute_fields ?? {}), En = (ie, De) => {
10390
+ const dn = H.length, An = Object.keys(s.copy_fields ?? {}), Dn = Object.keys(s.compute_fields ?? {}), Pn = (ie, De) => {
10379
10391
  const Ke = ae(ie), Je = F[ie], me = Je !== void 0 ? Je : Ke && Ke > 0 ? String(Ke) : "";
10380
10392
  return /* @__PURE__ */ e(
10381
10393
  "input",
@@ -10391,7 +10403,7 @@ function Xy({
10391
10403
  k((ft) => {
10392
10404
  const Ct = { ...ft };
10393
10405
  return delete Ct[ie], Ct;
10394
- }), ot(ie, Ae, De);
10406
+ }), dt(ie, Ae, De);
10395
10407
  },
10396
10408
  onKeyDown: (Ue) => {
10397
10409
  Ue.key === "Enter" && Ue.currentTarget.blur();
@@ -10487,7 +10499,7 @@ function Xy({
10487
10499
  children: [
10488
10500
  ke(Ke),
10489
10501
  /* @__PURE__ */ e("span", { className: It, children: Wn(D, ie) }),
10490
- Ft(Ke, ie),
10502
+ jt(Ke, ie),
10491
10503
  me && /* @__PURE__ */ e(
10492
10504
  ga,
10493
10505
  {
@@ -10496,7 +10508,7 @@ function Xy({
10496
10508
  }
10497
10509
  ),
10498
10510
  g.has(Ke) && /* @__PURE__ */ e(Tt, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }),
10499
- En(Ke, ie)
10511
+ Pn(Ke, ie)
10500
10512
  ]
10501
10513
  },
10502
10514
  Ke
@@ -10551,7 +10563,7 @@ function Xy({
10551
10563
  children: [
10552
10564
  ke(Je.id),
10553
10565
  /* @__PURE__ */ e("span", { className: It, children: Je.label }),
10554
- Ft(Je.id, Je.row),
10566
+ jt(Je.id, Je.row),
10555
10567
  Ae && /* @__PURE__ */ e(
10556
10568
  ga,
10557
10569
  {
@@ -10560,7 +10572,7 @@ function Xy({
10560
10572
  }
10561
10573
  ),
10562
10574
  g.has(Je.id) && /* @__PURE__ */ e(Tt, { className: "h-3 w-3 shrink-0 animate-spin text-slate-400" }),
10563
- En(Je.id, Je.row)
10575
+ Pn(Je.id, Je.row)
10564
10576
  ]
10565
10577
  },
10566
10578
  Je.id
@@ -10577,7 +10589,7 @@ function Xy({
10577
10589
  catalogCol: $,
10578
10590
  catalogFields: C,
10579
10591
  tmpl: D,
10580
- qtyInput: En,
10592
+ qtyInput: Pn,
10581
10593
  currentQty: ae
10582
10594
  },
10583
10595
  ie.label
@@ -10620,7 +10632,7 @@ function Xy({
10620
10632
  /* @__PURE__ */ e("span", { className: "flex-1 text-[11px] font-medium text-slate-500", children: "Item" }),
10621
10633
  An.map((Ae) => /* @__PURE__ */ e(tl, { children: Ue(Lt(Ae)) }, Ae)),
10622
10634
  Ue(Lt(y)),
10623
- Mn.map((Ae) => /* @__PURE__ */ e(tl, { children: Ue(Lt(Ae)) }, Ae)),
10635
+ Dn.map((Ae) => /* @__PURE__ */ e(tl, { children: Ue(Lt(Ae)) }, Ae)),
10624
10636
  !i && /* @__PURE__ */ e("span", { className: "w-6 shrink-0" })
10625
10637
  ] }),
10626
10638
  H.map((Ae, ft) => {
@@ -10694,9 +10706,9 @@ function Xy({
10694
10706
  ),
10695
10707
  /* @__PURE__ */ a("span", { className: "inline-flex w-20 shrink-0 items-center justify-end gap-1", children: [
10696
10708
  g.has(Ae.key) && /* @__PURE__ */ e(Tt, { className: "h-3 w-3 animate-spin text-slate-400" }),
10697
- En(Ae.key, tn(Ae.key))
10709
+ Pn(Ae.key, tn(Ae.key))
10698
10710
  ] }),
10699
- Mn.map((Ut) => {
10711
+ Dn.map((Ut) => {
10700
10712
  var _t, ca;
10701
10713
  const Vt = Ae.row[Ut], _n = Vt != null && Vt !== "" ? Vt : qa(((_t = s.compute_fields) == null ? void 0 : _t[Ut]) ?? "", Ae.row);
10702
10714
  return /* @__PURE__ */ e(
@@ -10727,7 +10739,7 @@ function Xy({
10727
10739
  u.queueDelete(t, n, Ct);
10728
10740
  return;
10729
10741
  }
10730
- ot(Ae.key, "0", {});
10742
+ dt(Ae.key, "0", {});
10731
10743
  },
10732
10744
  className: "w-6 shrink-0 rounded p-0.5 text-slate-300 transition-colors hover:text-red-500",
10733
10745
  children: /* @__PURE__ */ e(Gt, { className: "mx-auto h-3.5 w-3.5" })
@@ -10901,7 +10913,7 @@ function Zy({
10901
10913
  b.field
10902
10914
  );
10903
10915
  }),
10904
- /* @__PURE__ */ e("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: k && g ? /* @__PURE__ */ a(dt, { children: [
10916
+ /* @__PURE__ */ e("div", { className: "flex min-h-[28px] flex-1 items-center gap-2", children: k && g ? /* @__PURE__ */ a(it, { children: [
10905
10917
  /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-slate-700 dark:text-slate-200", children: Wn(s, g) }),
10906
10918
  (d(k) ?? 0) > 0 && /* @__PURE__ */ e("span", { className: "rounded bg-[#00ceff1a] px-1.5 py-0.5 text-[10px] font-semibold text-[#009abe]", children: "picked" }),
10907
10919
  i(k, g)
@@ -11298,11 +11310,11 @@ function av({
11298
11310
  T && /* @__PURE__ */ e(ls, { className: "h-3 w-3 text-amber-400 shrink-0" }),
11299
11311
  /* @__PURE__ */ e("p", { className: "text-[12px] font-medium text-slate-700 truncate", children: T ? v.name : (b == null ? void 0 : b.title) || (b == null ? void 0 : b.filename_download) || k })
11300
11312
  ] }),
11301
- /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: T ? /* @__PURE__ */ a(dt, { children: [
11313
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap items-center gap-x-2 mt-0.5", children: T ? /* @__PURE__ */ a(it, { children: [
11302
11314
  v.type && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: v.type }),
11303
11315
  /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: sd(v.size) }),
11304
11316
  /* @__PURE__ */ e("span", { className: "text-[10px] text-amber-500", children: "Pending upload" })
11305
- ] }) : /* @__PURE__ */ a(dt, { children: [
11317
+ ] }) : /* @__PURE__ */ a(it, { children: [
11306
11318
  (b == null ? void 0 : b.type) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: b.type }),
11307
11319
  (b == null ? void 0 : b.filesize) != null && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: sd(b.filesize) }),
11308
11320
  (b == null ? void 0 : b.uploaded_on) && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-400", children: _f(b.uploaded_on) }),
@@ -11331,7 +11343,7 @@ function av({
11331
11343
  children: "Replace"
11332
11344
  }
11333
11345
  ),
11334
- l && /* @__PURE__ */ a(dt, { children: [
11346
+ l && /* @__PURE__ */ a(it, { children: [
11335
11347
  /* @__PURE__ */ a(
11336
11348
  "button",
11337
11349
  {
@@ -11371,7 +11383,7 @@ function av({
11371
11383
  children: "Select file…"
11372
11384
  }
11373
11385
  ),
11374
- l && !r && /* @__PURE__ */ a(dt, { children: [
11386
+ l && !r && /* @__PURE__ */ a(it, { children: [
11375
11387
  /* @__PURE__ */ a(
11376
11388
  "button",
11377
11389
  {
@@ -11674,7 +11686,7 @@ function lv({
11674
11686
  }
11675
11687
  )
11676
11688
  ] }),
11677
- s && /* @__PURE__ */ a(dt, { children: [
11689
+ s && /* @__PURE__ */ a(it, { children: [
11678
11690
  /* @__PURE__ */ a(
11679
11691
  "button",
11680
11692
  {
@@ -11933,7 +11945,7 @@ function iv({
11933
11945
  f,
11934
11946
  (Oe, Y) => y((ke) => ({ ...ke, [Oe]: Y }))
11935
11947
  ) : O(ee, H[ee.field]) }, ee.field)),
11936
- /* @__PURE__ */ e("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 justify-end", children: ce ? /* @__PURE__ */ a(dt, { children: [
11948
+ /* @__PURE__ */ e("td", { className: "px-2 py-1.5", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-1 justify-end", children: ce ? /* @__PURE__ */ a(it, { children: [
11937
11949
  /* @__PURE__ */ e(
11938
11950
  "button",
11939
11951
  {
@@ -11953,7 +11965,7 @@ function iv({
11953
11965
  children: "Cancel"
11954
11966
  }
11955
11967
  )
11956
- ] }) : /* @__PURE__ */ a(dt, { children: [
11968
+ ] }) : /* @__PURE__ */ a(it, { children: [
11957
11969
  /* @__PURE__ */ e(
11958
11970
  "button",
11959
11971
  {
@@ -12884,7 +12896,7 @@ function pv({
12884
12896
  l && "opacity-60"
12885
12897
  ),
12886
12898
  children: [
12887
- !l && /* @__PURE__ */ a(dt, { children: [
12899
+ !l && /* @__PURE__ */ a(it, { children: [
12888
12900
  /* @__PURE__ */ a("div", { className: "flex flex-wrap items-center gap-0.5 border-b border-slate-200 bg-slate-50 px-2 py-1.5", children: [
12889
12901
  /* @__PURE__ */ e(
12890
12902
  ha,
@@ -13755,7 +13767,7 @@ function bv({
13755
13767
  mt.error((x == null ? void 0 : x.error) ?? "Could not update subscription");
13756
13768
  }
13757
13769
  });
13758
- return /* @__PURE__ */ a(dt, { children: [
13770
+ return /* @__PURE__ */ a(it, { children: [
13759
13771
  /* @__PURE__ */ e(
13760
13772
  bt,
13761
13773
  {
@@ -15218,7 +15230,7 @@ function Jv({
15218
15230
  return /* @__PURE__ */ a("div", { className: "flex items-baseline gap-2 text-[12px]", children: [
15219
15231
  /* @__PURE__ */ e("span", { className: "min-w-[80px] shrink-0 text-slate-500 dark:text-slate-400", children: "Amount" }),
15220
15232
  /* @__PURE__ */ e("span", { className: "font-mono text-[11px] text-slate-700 dark:text-slate-300 bg-slate-50 dark:bg-muted/50 rounded px-1.5 py-0.5", children: /* @__PURE__ */ a("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
15221
- T != null && T !== A && /* @__PURE__ */ a(dt, { children: [
15233
+ T != null && T !== A && /* @__PURE__ */ a(it, { children: [
15222
15234
  /* @__PURE__ */ e("span", { className: "tabular-nums text-slate-400 line-through dark:text-slate-500", children: Ei.format(T) }),
15223
15235
  /* @__PURE__ */ e("span", { className: "text-slate-400", children: "→" })
15224
15236
  ] }),
@@ -15260,7 +15272,7 @@ function Jv({
15260
15272
  else if (S(T.field, A)) {
15261
15273
  const _ = Number(A), R = b == null ? void 0 : b[T.field], O = R != null && R !== "" && !Number.isNaN(Number(R)) ? Number(R) : null, I = O != null ? _ - O : null;
15262
15274
  E = /* @__PURE__ */ a("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
15263
- O != null && O !== _ && /* @__PURE__ */ a(dt, { children: [
15275
+ O != null && O !== _ && /* @__PURE__ */ a(it, { children: [
15264
15276
  /* @__PURE__ */ e("span", { className: "tabular-nums text-slate-400 line-through dark:text-slate-500", children: M(T.field, O) }),
15265
15277
  /* @__PURE__ */ e("span", { className: "text-slate-400", children: "→" })
15266
15278
  ] }),
@@ -15304,7 +15316,7 @@ function Jv({
15304
15316
  children: F.isPending ? "Submitting…" : "Submit for Review"
15305
15317
  }
15306
15318
  ),
15307
- t.status === "review" && !t.workflow_template_id && /* @__PURE__ */ a(dt, { children: [
15319
+ t.status === "review" && !t.workflow_template_id && /* @__PURE__ */ a(it, { children: [
15308
15320
  /* @__PURE__ */ e(
15309
15321
  bt,
15310
15322
  {
@@ -15382,7 +15394,7 @@ function To({
15382
15394
  return T.current = s, Ve(() => {
15383
15395
  var A;
15384
15396
  (A = T.current) == null || A.call(T, D);
15385
- }, [D]), !l && (w || y.length === 0) ? null : /* @__PURE__ */ a(dt, { children: [
15397
+ }, [D]), !l && (w || y.length === 0) ? null : /* @__PURE__ */ a(it, { children: [
15386
15398
  /* @__PURE__ */ a("div", { className: Wa(
15387
15399
  "overflow-hidden rounded-xl border bg-white dark:bg-card",
15388
15400
  D > 0 ? "border-amber-300 dark:border-amber-500/40" : "border-slate-200 dark:border-border"
@@ -15805,7 +15817,7 @@ function Fo({
15805
15817
  O
15806
15818
  ))
15807
15819
  ] })
15808
- ] }) : /* @__PURE__ */ a(dt, { children: [
15820
+ ] }) : /* @__PURE__ */ a(it, { children: [
15809
15821
  /* @__PURE__ */ a("form", { onSubmit: _, className: "space-y-2", children: [
15810
15822
  /* @__PURE__ */ e(
15811
15823
  sc,
@@ -15858,7 +15870,7 @@ function Fo({
15858
15870
  children: /* @__PURE__ */ e(y0, { className: "h-3 w-3" })
15859
15871
  }
15860
15872
  ),
15861
- I && /* @__PURE__ */ a(dt, { children: [
15873
+ I && /* @__PURE__ */ a(it, { children: [
15862
15874
  /* @__PURE__ */ e(
15863
15875
  "button",
15864
15876
  {
@@ -16025,7 +16037,7 @@ function t1({
16025
16037
  ] })
16026
16038
  ] })
16027
16039
  ] }),
16028
- /* @__PURE__ */ e("div", { className: "mt-5 space-y-2.5", children: u ? /* @__PURE__ */ a(dt, { children: [
16040
+ /* @__PURE__ */ e("div", { className: "mt-5 space-y-2.5", children: u ? /* @__PURE__ */ a(it, { children: [
16029
16041
  /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-3/4 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" }),
16030
16042
  /* @__PURE__ */ e("div", { className: "animate-pulse h-4 w-1/2 rounded bg-slate-200 dark:bg-[hsl(var(--nvr-skeleton))]" })
16031
16043
  ] }) : c.length > 0 ? c.map((p, f) => /* @__PURE__ */ e(
@@ -16045,10 +16057,10 @@ function t1({
16045
16057
  onClick: () => d.mutate(),
16046
16058
  className: "mt-3 inline-flex items-center gap-1.5 rounded-md bg-nvr-cyan px-3 py-1.5 text-[12px] font-medium text-white hover:brightness-110 disabled:opacity-50",
16047
16059
  "data-request-access": !0,
16048
- children: s ? /* @__PURE__ */ a(dt, { children: [
16060
+ children: s ? /* @__PURE__ */ a(it, { children: [
16049
16061
  /* @__PURE__ */ e(on, { className: "h-3.5 w-3.5" }),
16050
16062
  " Request sent"
16051
- ] }) : /* @__PURE__ */ a(dt, { children: [
16063
+ ] }) : /* @__PURE__ */ a(it, { children: [
16052
16064
  /* @__PURE__ */ e(xd, { className: "h-3.5 w-3.5" }),
16053
16065
  d.isPending ? "Sending…" : "Request access"
16054
16066
  ] })
@@ -16190,7 +16202,7 @@ function l1({
16190
16202
  }), u = d ?? [];
16191
16203
  if (u.length === 0) return null;
16192
16204
  const c = u.filter((f) => f.status === "accepted").length, m = u.filter((f) => f.status === "failed").length, p = u.length - c - m;
16193
- return /* @__PURE__ */ a(dt, { children: [
16205
+ return /* @__PURE__ */ a(it, { children: [
16194
16206
  /* @__PURE__ */ a(
16195
16207
  "button",
16196
16208
  {
@@ -16244,7 +16256,7 @@ function s1({
16244
16256
  },
16245
16257
  onSettled: () => i(null)
16246
16258
  });
16247
- return !d || d.length === 0 ? null : /* @__PURE__ */ e(dt, { children: d.map((u) => /* @__PURE__ */ a(
16259
+ return !d || d.length === 0 ? null : /* @__PURE__ */ e(it, { children: d.map((u) => /* @__PURE__ */ a(
16248
16260
  bt,
16249
16261
  {
16250
16262
  type: "button",
@@ -17784,7 +17796,7 @@ function Rf({ collection: t, item: n }) {
17784
17796
  l.days_in_state,
17785
17797
  "d ago):",
17786
17798
  " ",
17787
- l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ a(dt, { children: [
17799
+ l.changed_total === 0 && l.comments === 0 && l.addendums.count === 0 ? /* @__PURE__ */ e("span", { children: "no changes to this record." }) : /* @__PURE__ */ a(it, { children: [
17788
17800
  l.changed_total > 0 && /* @__PURE__ */ a("span", { children: [
17789
17801
  l.changed_total,
17790
17802
  " field",
@@ -17812,7 +17824,7 @@ function Rf({ collection: t, item: n }) {
17812
17824
  i.field,
17813
17825
  ":",
17814
17826
  " ",
17815
- i.old !== void 0 && /* @__PURE__ */ a(dt, { children: [
17827
+ i.old !== void 0 && /* @__PURE__ */ a(it, { children: [
17816
17828
  /* @__PURE__ */ e("span", { className: "text-red-600 line-through dark:text-red-400", children: s(i.old) }),
17817
17829
  " "
17818
17830
  ] }),
@@ -18035,7 +18047,7 @@ function k1({
18035
18047
  transition_id: f,
18036
18048
  comment: m.trim() || void 0
18037
18049
  }),
18038
- children: E.isPending ? /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(dt, { children: [
18050
+ children: E.isPending ? /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(it, { children: [
18039
18051
  /* @__PURE__ */ e("span", { children: "Confirm" }),
18040
18052
  /* @__PURE__ */ e(on, { className: "h-3 w-3" })
18041
18053
  ] })
@@ -18043,7 +18055,7 @@ function k1({
18043
18055
  )
18044
18056
  ] })
18045
18057
  ] });
18046
- return /* @__PURE__ */ a(dt, { children: [
18058
+ return /* @__PURE__ */ a(it, { children: [
18047
18059
  /* @__PURE__ */ a("div", { className: `overflow-hidden rounded-xl border bg-white dark:bg-card ${o ? "border-amber-300 dark:border-amber-600/50" : "border-slate-200 dark:border-border"}`, children: [
18048
18060
  /* @__PURE__ */ a(
18049
18061
  "div",
@@ -18385,7 +18397,7 @@ function w1({
18385
18397
  transition_id: o,
18386
18398
  comment: i.trim() || void 0
18387
18399
  }),
18388
- children: w.isPending ? /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(dt, { children: [
18400
+ children: w.isPending ? /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ a(it, { children: [
18389
18401
  /* @__PURE__ */ e("span", { children: "Confirm" }),
18390
18402
  /* @__PURE__ */ e(on, { className: "h-3 w-3" })
18391
18403
  ] })
@@ -18584,7 +18596,7 @@ function T1({
18584
18596
  )) })
18585
18597
  ] }),
18586
18598
  c === "side" ? /* @__PURE__ */ e(C1, { before: N, after: x }) : y && t.delta ? /* @__PURE__ */ e($1, { delta: t.delta }) : /* @__PURE__ */ e(q1, { data: t.data }),
18587
- F && /* @__PURE__ */ e("div", { className: "flex items-center justify-end gap-2 pt-1", children: o ? /* @__PURE__ */ a(dt, { children: [
18599
+ F && /* @__PURE__ */ e("div", { className: "flex items-center justify-end gap-2 pt-1", children: o ? /* @__PURE__ */ a(it, { children: [
18588
18600
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-500", children: "Restore this revision?" }),
18589
18601
  /* @__PURE__ */ e(
18590
18602
  bt,
@@ -19414,7 +19426,7 @@ function O1({ collection: t, item: n }) {
19414
19426
  " branches"
19415
19427
  ] })
19416
19428
  ] }),
19417
- o.active ? /* @__PURE__ */ a(dt, { children: [
19429
+ o.active ? /* @__PURE__ */ a(it, { children: [
19418
19430
  /* @__PURE__ */ e("div", { className: "space-y-2", children: o.branches.map((N, x) => /* @__PURE__ */ e(
19419
19431
  A1,
19420
19432
  {
@@ -19851,7 +19863,7 @@ function Q1({
19851
19863
  }
19852
19864
  }),
19853
19865
  []
19854
- ), [nt, Xe] = q({}), [$t, xt] = q(null), [Zt, Ft] = q(!1), It = Ge(null), [St, tn] = q(!1), [ae, Qe] = q(!1), [Bt, Le] = q([]);
19866
+ ), [nt, Xe] = q({}), [$t, xt] = q(null), [Zt, jt] = q(!1), It = Ge(null), [St, tn] = q(!1), [ae, Qe] = q(!1), [Bt, Le] = q([]);
19855
19867
  function lt(j, B) {
19856
19868
  Le((J) => J.map((ne) => {
19857
19869
  if (ne.id !== j) return ne;
@@ -19859,8 +19871,8 @@ function Q1({
19859
19871
  return { ...ne, ...pe };
19860
19872
  }));
19861
19873
  }
19862
- const ot = Ge({}), Dt = Ge(/* @__PURE__ */ new Set()), [ln, dn] = q(null), [An, Mn] = q([]), En = Qt((j) => {
19863
- Mn((B) => [...B, j]);
19874
+ const dt = Ge({}), Dt = Ge(/* @__PURE__ */ new Set()), [ln, dn] = q(null), [An, Dn] = q([]), Pn = Qt((j) => {
19875
+ Dn((B) => [...B, j]);
19864
19876
  }, []), [Fn, ie] = q([]), De = Qt((j) => {
19865
19877
  ie((B) => [...B, j]);
19866
19878
  }, []), [Ke, Je] = q(/* @__PURE__ */ new Map()), [me, Ue] = q(/* @__PURE__ */ new Map()), [Ae, ft] = q(/* @__PURE__ */ new Map()), Ct = Se(() => ({
@@ -20283,7 +20295,7 @@ function Q1({
20283
20295
  }, [R, S, $, M]), Ve(() => {
20284
20296
  !R || !b || en.current || (b.lines.length > 0 || Object.keys(b.m2m ?? {}).length > 0) && !ye || b.lines.length > 0 && !re || (en.current = !0, Wr(b));
20285
20297
  }, [R, b, ye, re, Wr]), Ve(() => {
20286
- $e && (ot.current = $e, at.current = $e, st($e), tn(!1));
20298
+ $e && (dt.current = $e, at.current = $e, st($e), tn(!1));
20287
20299
  }, [$e]), Ve(() => {
20288
20300
  var J;
20289
20301
  if (!R || O === void 0 || Ut.current) return;
@@ -20316,7 +20328,7 @@ function Q1({
20316
20328
  if (!Zr) return;
20317
20329
  const j = {};
20318
20330
  for (const [B, J] of Object.entries(Zr)) j[B] = J.value;
20319
- Object.keys(j).length !== 0 && (ot.current = { ...ot.current, ...j }, at.current = { ...at.current, ...j }, st((B) => ({ ...B, ...j })));
20331
+ Object.keys(j).length !== 0 && (dt.current = { ...dt.current, ...j }, at.current = { ...at.current, ...j }, st((B) => ({ ...B, ...j })));
20320
20332
  }, [Zr]);
20321
20333
  const vn = Se(() => {
20322
20334
  const j = H.filter((ne) => ne.is_active === !0 || ne.is_active === 1), B = /* @__PURE__ */ new Set();
@@ -20510,7 +20522,7 @@ function Q1({
20510
20522
  }), ur(j), ne || nr(j, B);
20511
20523
  },
20512
20524
  [U, ur, nr]
20513
- ), [Mr, Dn] = q({}), _r = Se(
20525
+ ), [Mr, En] = q({}), _r = Se(
20514
20526
  () => X.filter((j) => !j.junction_field && j.one_collection === t && j.one_field && j.many_field && j.many_collection),
20515
20527
  [X, t]
20516
20528
  ), rr = pr({
@@ -20535,9 +20547,9 @@ function Q1({
20535
20547
  const ne = (pe = rr[J]) == null ? void 0 : pe.data;
20536
20548
  B.one_field && ne !== void 0 && (j[B.one_field] = ne);
20537
20549
  }), j;
20538
- }, [_r, rr]), Pn = Qt(
20550
+ }, [_r, rr]), Kn = Qt(
20539
20551
  (j, B) => {
20540
- Dn((J) => J[j] === B ? J : { ...J, [j]: B }), B > 0 && Dt.current.add(j), Xe((J) => {
20552
+ En((J) => J[j] === B ? J : { ...J, [j]: B }), B > 0 && Dt.current.add(j), Xe((J) => {
20541
20553
  const ne = (U ?? []).find((Ce) => Ce.field === j);
20542
20554
  if (!(ne != null && ne.required)) return J;
20543
20555
  const pe = { ...J };
@@ -20556,7 +20568,7 @@ function Q1({
20556
20568
  queryFn: () => D.request(he("/users/me")).then((j) => j.data ?? null),
20557
20569
  staleTime: 5 * 6e4,
20558
20570
  enabled: Dr || $r
20559
- }), { data: Kn } = ge({
20571
+ }), { data: In } = ge({
20560
20572
  queryKey: ["pipeline-instance-lock", t, _],
20561
20573
  queryFn: () => D.request(he(`/pipelines/instance/${t}/${_}`)).then((j) => j.data).catch(() => null),
20562
20574
  staleTime: 3e4,
@@ -20577,13 +20589,13 @@ function Q1({
20577
20589
  try {
20578
20590
  const ne = JSON.parse(G.addendum_allowed_states);
20579
20591
  if (Array.isArray(ne) && ne.length > 0) {
20580
- const pe = ((j = Kn == null ? void 0 : Kn.instance) == null ? void 0 : j.current_state) ?? null, Ce = ((J = (B = Kn == null ? void 0 : Kn.states) == null ? void 0 : B.find((Ze) => Ze.id === pe)) == null ? void 0 : J.key) ?? null;
20592
+ const pe = ((j = In == null ? void 0 : In.instance) == null ? void 0 : j.current_state) ?? null, Ce = ((J = (B = In == null ? void 0 : In.states) == null ? void 0 : B.find((Ze) => Ze.id === pe)) == null ? void 0 : J.key) ?? null;
20581
20593
  if (!ne.some((Ze) => Ze.state_keys.length === 0 || Ce !== null && Ze.state_keys.includes(Ce))) return !1;
20582
20594
  }
20583
20595
  } catch {
20584
20596
  }
20585
20597
  return !0;
20586
- }, [$r, G == null ? void 0 : G.addendum_allowed_roles, G == null ? void 0 : G.addendum_allowed_states, jn == null ? void 0 : jn.role, Kn]), { data: Hn = [] } = ge({
20598
+ }, [$r, G == null ? void 0 : G.addendum_allowed_roles, G == null ? void 0 : G.addendum_allowed_states, jn == null ? void 0 : jn.role, In]), { data: Hn = [] } = ge({
20587
20599
  queryKey: ["addendums", t, _],
20588
20600
  queryFn: () => D.request(
20589
20601
  he(`/addendums/${t}/${_}`)
@@ -20704,12 +20716,12 @@ function Q1({
20704
20716
  for (const [J, ne] of Object.entries(B.data ?? {}))
20705
20717
  !Array.isArray(ne) || ne.length === 0 || (j[J] || (j[J] = []), j[J].push({ addendumId: B.id, addendumTitle: B.title, addendumStatus: B.status, rows: ne }));
20706
20718
  return j;
20707
- }, [Hn]), Rn = Se(() => !r || !O ? null : new Set(Jn.map((j) => j.field)), [r, O, Jn]), Cn = Se(() => {
20719
+ }, [Hn]), Mn = Se(() => !r || !O ? null : new Set(Jn.map((j) => j.field)), [r, O, Jn]), Cn = Se(() => {
20708
20720
  if (!U) return [];
20709
20721
  if (r && O === void 0) return [];
20710
20722
  const j = [...U].sort((ne, pe) => (ne.sort ?? 0) - (pe.sort ?? 0)), B = /* @__PURE__ */ new Set(), J = j.filter((ne) => B.has(ne.field) ? !1 : (B.add(ne.field), !0));
20711
- return Rn ? J.filter((ne) => Rn.has(ne.field) || hl.has(ne.field) || No(ne.field)) : J;
20712
- }, [U, Rn, r, O]), wn = Se(() => ((O == null ? void 0 : O.groups) ?? []).sort((j, B) => j.sort - B.sort), [O]), Sn = Se(() => {
20723
+ return Mn ? J.filter((ne) => Mn.has(ne.field) || hl.has(ne.field) || No(ne.field)) : J;
20724
+ }, [U, Mn, r, O]), wn = Se(() => ((O == null ? void 0 : O.groups) ?? []).sort((j, B) => j.sort - B.sort), [O]), Sn = Se(() => {
20713
20725
  const j = {};
20714
20726
  for (const B of wn) {
20715
20727
  const J = wp(B.summary_fields);
@@ -20718,11 +20730,11 @@ function Q1({
20718
20730
  typeof ne != "string" && ne.field && "agg" in ne && ne.agg && ne.agg_field && (j[ne.field] = ne);
20719
20731
  }
20720
20732
  return j;
20721
- }, [wn]), In = Se(
20733
+ }, [wn]), Un = Se(
20722
20734
  () => _r.filter((j) => j.one_field && j.one_field in Sn),
20723
20735
  [_r, Sn]
20724
20736
  ), Yn = pr({
20725
- queries: In.map((j) => ({
20737
+ queries: Un.map((j) => ({
20726
20738
  queryKey: ["field-config", j.many_collection],
20727
20739
  queryFn: () => D.request(he(`/field-config/${j.many_collection}`)).then((B) => B.data ?? []),
20728
20740
  enabled: !!j.many_collection,
@@ -20730,7 +20742,7 @@ function Q1({
20730
20742
  }))
20731
20743
  }), la = Se(() => {
20732
20744
  const j = { ...Sn };
20733
- return In.forEach((B, J) => {
20745
+ return Un.forEach((B, J) => {
20734
20746
  var Ze;
20735
20747
  if (!B.one_field) return;
20736
20748
  const ne = Sn[B.one_field];
@@ -20740,8 +20752,8 @@ function Q1({
20740
20752
  const ze = Ce.options ? typeof Ce.options == "string" ? Ce.options : JSON.stringify(Ce.options) : null;
20741
20753
  ze && (j[B.one_field] = { ...ne, field_options: ze });
20742
20754
  }), j;
20743
- }, [Sn, In, Yn]), $l = pr({
20744
- queries: In.map((j) => (Sn[j.one_field], {
20755
+ }, [Sn, Un, Yn]), $l = pr({
20756
+ queries: Un.map((j) => (Sn[j.one_field], {
20745
20757
  queryKey: ["o2m-rows", j.many_collection, j.many_field, _],
20746
20758
  queryFn: () => D.request(
20747
20759
  he(`/items/${j.many_collection}`, {
@@ -20754,7 +20766,7 @@ function Q1({
20754
20766
  }))
20755
20767
  }), Ni = Se(() => {
20756
20768
  const j = {};
20757
- return In.forEach((B, J) => {
20769
+ return Un.forEach((B, J) => {
20758
20770
  var At;
20759
20771
  if (!B.one_field || !B.many_collection || !B.many_field) return;
20760
20772
  const ne = ((At = $l[J]) == null ? void 0 : At.data) ?? [], pe = la[B.one_field];
@@ -20774,16 +20786,16 @@ function Q1({
20774
20786
  }
20775
20787
  pe.agg === "sum" ? j[B.one_field] = Nt.reduce((ct, et) => ct + et, 0) : pe.agg === "avg" ? j[B.one_field] = Nt.reduce((ct, et) => ct + et, 0) / Nt.length : pe.agg === "min" ? j[B.one_field] = Math.min(...Nt) : pe.agg === "max" && (j[B.one_field] = Math.max(...Nt));
20776
20788
  }), j;
20777
- }, [In, $l, Sn, Ke, me, Ae]), Vs = Se(() => {
20789
+ }, [Un, $l, Sn, Ke, me, Ae]), Vs = Se(() => {
20778
20790
  const j = /* @__PURE__ */ new Set();
20779
20791
  return _r.forEach((B, J) => {
20780
20792
  var ne;
20781
20793
  (ne = rr[J]) != null && ne.isLoading && B.one_field && j.add(B.one_field);
20782
- }), In.forEach((B, J) => {
20794
+ }), Un.forEach((B, J) => {
20783
20795
  var ne;
20784
20796
  (ne = $l[J]) != null && ne.isLoading && B.one_field && j.add(B.one_field);
20785
20797
  }), j;
20786
- }, [_r, rr, In, $l]), Il = Se(() => {
20798
+ }, [_r, rr, Un, $l]), Il = Se(() => {
20787
20799
  const j = /* @__PURE__ */ new Map();
20788
20800
  for (const B of U ?? []) {
20789
20801
  if (B.interface !== "inline-table") continue;
@@ -20804,7 +20816,7 @@ function Q1({
20804
20816
  for (const J of j)
20805
20817
  !J.group_key || No(J.field) || (B[J.group_key] || (B[J.group_key] = []), B[J.group_key].find((ne) => ne.field === J.field) || B[J.group_key].push(J));
20806
20818
  return B;
20807
- }, [U]), Un = Se(
20819
+ }, [U]), Bn = Se(
20808
20820
  () => Cn.filter(
20809
20821
  (j) => !j.group_key && !j.hidden && !hl.has(j.field) && !No(j.field) && (I === null || j.layout_assigned !== !1)
20810
20822
  ),
@@ -20814,26 +20826,26 @@ function Q1({
20814
20826
  () => Cn.filter((j) => hl.has(j.field) || j.readonly),
20815
20827
  [Cn]
20816
20828
  );
20817
- const Ea = Se(() => wn.filter((j) => j.type === "container"), [wn]), Er = Se(() => wn.filter((j) => j.type === "tab" && !j.container_id), [wn]), Jr = Se(() => wn.filter((j) => j.type === "tab").sort((j, B) => j.sort - B.sort), [wn]), ar = Se(() => wn.filter((j) => j.type === "section" || j.type === "metadata"), [wn]), _a = Ea.length > 0, Bn = Er.length > 0, kn = O == null ? void 0 : O.layout, Pa = kn ? !!kn.ai_enabled : !0, Pr = Bn && (kn == null ? void 0 : kn.tab_mode) === "steps", Ul = !!(kn != null && kn.validate_before_next), P = !!(kn != null && kn.summary_enabled), xe = !!(kn != null && kn.summary_hide_empty), we = kn ? !kn.disable_revisions && c : c, Te = kn ? !kn.disable_comments && y : y, L = kn ? !kn.disable_tasks && w : w, W = kn ? !kn.disable_clone && m : m, te = kn ? !kn.disable_delete : !0, se = !!(kn != null && kn.accordion_mode), [je, Pe] = q(!1), [_e, Be] = q(null), [yt, ht] = q(/* @__PURE__ */ new Set()), it = Ge(!1);
20829
+ const Ea = Se(() => wn.filter((j) => j.type === "container"), [wn]), Er = Se(() => wn.filter((j) => j.type === "tab" && !j.container_id), [wn]), Jr = Se(() => wn.filter((j) => j.type === "tab").sort((j, B) => j.sort - B.sort), [wn]), ar = Se(() => wn.filter((j) => j.type === "section" || j.type === "metadata"), [wn]), _a = Ea.length > 0, Ln = Er.length > 0, kn = O == null ? void 0 : O.layout, Pa = kn ? !!kn.ai_enabled : !0, Pr = Ln && (kn == null ? void 0 : kn.tab_mode) === "steps", Ul = !!(kn != null && kn.validate_before_next), P = !!(kn != null && kn.summary_enabled), xe = !!(kn != null && kn.summary_hide_empty), we = kn ? !kn.disable_revisions && c : c, Te = kn ? !kn.disable_comments && y : y, L = kn ? !kn.disable_tasks && w : w, W = kn ? !kn.disable_clone && m : m, te = kn ? !kn.disable_delete : !0, se = !!(kn != null && kn.accordion_mode), [je, Pe] = q(!1), [_e, Be] = q(null), [yt, ht] = q(/* @__PURE__ */ new Set()), ot = Ge(!1);
20818
20830
  Ve(() => {
20819
20831
  if (!se) {
20820
- it.current = !1;
20832
+ ot.current = !1;
20821
20833
  return;
20822
20834
  }
20823
- if (se && !it.current) {
20824
- it.current = !0;
20835
+ if (se && !ot.current) {
20836
+ ot.current = !0;
20825
20837
  const j = ar.find((B) => !B.is_collapsed) ?? ar[0];
20826
20838
  j && Be(j.id);
20827
20839
  }
20828
20840
  }, [se, ar]);
20829
- const jt = Ge(null), [Et, sn] = q(() => /* @__PURE__ */ new Map()), [Pt, Ln] = q(() => /* @__PURE__ */ new Map()), fa = (j, B) => {
20841
+ const Ft = Ge(null), [Et, sn] = q(() => /* @__PURE__ */ new Map()), [Pt, Rn] = q(() => /* @__PURE__ */ new Map()), fa = (j, B) => {
20830
20842
  var J;
20831
20843
  return Et.get(j.id) ?? ((J = B[0]) == null ? void 0 : J.key) ?? "";
20832
20844
  }, lr = (j, B) => {
20833
20845
  var J;
20834
20846
  return ((J = Pt.get(j.id)) == null ? void 0 : J.has(B)) ?? !1;
20835
20847
  }, sa = (j, B) => {
20836
- sn((J) => new Map(J).set(j.id, B)), Ln((J) => {
20848
+ sn((J) => new Map(J).set(j.id, B)), Rn((J) => {
20837
20849
  const ne = J.get(j.id) ?? /* @__PURE__ */ new Set();
20838
20850
  return ne.has(B) ? J : new Map(J).set(j.id, /* @__PURE__ */ new Set([...ne, B]));
20839
20851
  });
@@ -20865,17 +20877,17 @@ function Q1({
20865
20877
  localStorage.setItem(`nvr_tab_${t}`, j);
20866
20878
  } catch {
20867
20879
  }
20868
- (B = jt.current) == null || B.scrollTo({ top: 0 });
20880
+ (B = Ft.current) == null || B.scrollTo({ top: 0 });
20869
20881
  }, mr = Se(() => {
20870
- if (!Bn) return [];
20882
+ if (!Ln) return [];
20871
20883
  const j = [];
20872
- (Pr ? Un.length > 0 : ar.length > 0) && j.push({ key: "__general__", label: "General" });
20884
+ (Pr ? Bn.length > 0 : ar.length > 0) && j.push({ key: "__general__", label: "General" });
20873
20885
  for (const B of Er) j.push({ key: B.key, label: B.label });
20874
20886
  return j;
20875
- }, [Bn, ar, Er, Pr, Un]);
20887
+ }, [Ln, ar, Er, Pr, Bn]);
20876
20888
  Ve(() => {
20877
- !Bn || mr.length === 0 || mr.some((j) => j.key === zn) || Bl(mr[0].key);
20878
- }, [Bn, mr, zn]);
20889
+ !Ln || mr.length === 0 || mr.some((j) => j.key === zn) || Bl(mr[0].key);
20890
+ }, [Ln, mr, zn]);
20879
20891
  const lm = Ge(!1);
20880
20892
  Ve(() => {
20881
20893
  var J;
@@ -20914,16 +20926,16 @@ function Q1({
20914
20926
  const j = /* @__PURE__ */ new Set();
20915
20927
  for (const B of mr) {
20916
20928
  if (R && !am.has(B.key)) continue;
20917
- (B.key === "__general__" ? Pr ? Un : [...Un, ...ar.flatMap((pe) => Fr[pe.key] ?? [])] : Fr[B.key] ?? []).filter((pe) => pe.required && !pe.hidden).every((pe) => {
20929
+ (B.key === "__general__" ? Pr ? Bn : [...Bn, ...ar.flatMap((pe) => Fr[pe.key] ?? [])] : Fr[B.key] ?? []).filter((pe) => pe.required && !pe.hidden).every((pe) => {
20918
20930
  const Ce = be[pe.field];
20919
20931
  return Ce != null && Ce !== "";
20920
20932
  }) && j.add(B.key);
20921
20933
  }
20922
20934
  return j;
20923
- }, [mr, Un, ar, Fr, be, R, am, Pr]);
20935
+ }, [mr, Bn, ar, Fr, be, R, am, Pr]);
20924
20936
  function vh() {
20925
20937
  if (Ul) {
20926
- const B = zn === "__general__" ? Pr ? Un : [...Un, ...ar.flatMap((ne) => Fr[ne.key] ?? [])] : Fr[zn] ?? [], J = {};
20938
+ const B = zn === "__general__" ? Pr ? Bn : [...Bn, ...ar.flatMap((ne) => Fr[ne.key] ?? [])] : Fr[zn] ?? [], J = {};
20927
20939
  for (const ne of B)
20928
20940
  if (ne.required && !ne.hidden) {
20929
20941
  const pe = be[ne.field];
@@ -21103,7 +21115,7 @@ function Q1({
21103
21115
  item: "__ungrouped__",
21104
21116
  sort: (() => {
21105
21117
  const J = (O == null ? void 0 : O.ungrouped_sort) ?? ar.length;
21106
- if (Ld.size > 0 && Un.some((ne) => Ld.has(ne.field))) {
21118
+ if (Ld.size > 0 && Bn.some((ne) => Ld.has(ne.field))) {
21107
21119
  const ne = [
21108
21120
  p && Xn ? Xn.sort : null,
21109
21121
  L && kr ? kr.sort : null,
@@ -21137,7 +21149,7 @@ function Q1({
21137
21149
  R,
21138
21150
  Ld,
21139
21151
  G == null ? void 0 : G.addendums_enabled,
21140
- Un,
21152
+ Bn,
21141
21153
  Js
21142
21154
  ]);
21143
21155
  function gs() {
@@ -21188,7 +21200,7 @@ function Q1({
21188
21200
  if (It.current) return null;
21189
21201
  const j = [];
21190
21202
  if (!R) {
21191
- const J = Cn.filter((ne) => !hl.has(ne.field) && !ne.readonly && ne.field in be && !uc(be[ne.field], ot.current[ne.field])).map((ne) => ne.field);
21203
+ const J = Cn.filter((ne) => !hl.has(ne.field) && !ne.readonly && ne.field in be && !uc(be[ne.field], dt.current[ne.field])).map((ne) => ne.field);
21192
21204
  J.length && j.push({ collection: t, changedFields: J });
21193
21205
  }
21194
21206
  for (const [J, ne] of me.entries()) {
@@ -21232,7 +21244,7 @@ function Q1({
21232
21244
  return ((Wt = Rt == null ? void 0 : Rt.data) == null ? void 0 : Wt.error) ?? (tt instanceof Error ? tt.message : "Failed");
21233
21245
  }
21234
21246
  let B = null;
21235
- const J = [...Vt.entries()].some(([, tt]) => tt.length > 0) || [..._t.entries()].some(([, tt]) => tt.size > 0), ne = [...Ke.entries()].filter(([, tt]) => tt.length > 0).map(([tt]) => tt), pe = [...me.entries()].filter(([, tt]) => tt.size > 0).map(([tt]) => tt), Ce = [...Ae.entries()].filter(([, tt]) => tt.size > 0).map(([tt]) => tt), ze = R ? Cn.filter((tt) => !hl.has(tt.field) && !tt.readonly && tt.field in be).length : Cn.filter((tt) => hl.has(tt.field) || tt.readonly || !(tt.field in be) ? !1 : !uc(be[tt.field], ot.current[tt.field])).length, Ze = R ? `${ze} field${ze !== 1 ? "s" : ""} set` : ze === 0 ? "No field changes" : `${ze} field${ze !== 1 ? "s" : ""} changed`;
21247
+ const J = [...Vt.entries()].some(([, tt]) => tt.length > 0) || [..._t.entries()].some(([, tt]) => tt.size > 0), ne = [...Ke.entries()].filter(([, tt]) => tt.length > 0).map(([tt]) => tt), pe = [...me.entries()].filter(([, tt]) => tt.size > 0).map(([tt]) => tt), Ce = [...Ae.entries()].filter(([, tt]) => tt.size > 0).map(([tt]) => tt), ze = R ? Cn.filter((tt) => !hl.has(tt.field) && !tt.readonly && tt.field in be).length : Cn.filter((tt) => hl.has(tt.field) || tt.readonly || !(tt.field in be) ? !1 : !uc(be[tt.field], dt.current[tt.field])).length, Ze = R ? `${ze} field${ze !== 1 ? "s" : ""} set` : ze === 0 ? "No field changes" : `${ze} field${ze !== 1 ? "s" : ""} changed`;
21236
21248
  let We = 0, rt = 0;
21237
21249
  for (const [, tt] of Vt.entries()) We += tt.length;
21238
21250
  for (const [, tt] of _t.entries()) rt += tt.size;
@@ -21269,7 +21281,7 @@ function Q1({
21269
21281
  }
21270
21282
  }
21271
21283
  lt("main", { status: "running" });
21272
- const et = {}, vt = ot.current, Mt = at.current;
21284
+ const et = {}, vt = dt.current, Mt = at.current;
21273
21285
  for (const tt of Cn) {
21274
21286
  if (hl.has(tt.field) || tt.readonly || !(tt.field in Mt)) continue;
21275
21287
  const Rt = Mt[tt.field], Wt = vt[tt.field];
@@ -21443,7 +21455,7 @@ function Q1({
21443
21455
  )), Yt;
21444
21456
  },
21445
21457
  onSuccess: (j) => {
21446
- It.current = null, tn(!1), _n(/* @__PURE__ */ new Map()), ca(/* @__PURE__ */ new Map()), Mn([]), ie([]);
21458
+ It.current = null, tn(!1), _n(/* @__PURE__ */ new Map()), ca(/* @__PURE__ */ new Map()), Dn([]), ie([]);
21447
21459
  const B = /* @__PURE__ */ new Set([
21448
21460
  ...Ke.keys(),
21449
21461
  ...me.keys(),
@@ -21471,7 +21483,7 @@ function Q1({
21471
21483
  if (rn)
21472
21484
  for (const j of U ?? []) qi.add(j.field);
21473
21485
  if (Dr) {
21474
- const j = (jn == null ? void 0 : jn.role) ?? null, B = ((ym = Kn == null ? void 0 : Kn.instance) == null ? void 0 : ym.current_state) ?? null, J = B ? ((vm = ((Kn == null ? void 0 : Kn.states) ?? []).find((ne) => ne.id === B)) == null ? void 0 : vm.key) ?? null : null;
21486
+ const j = (jn == null ? void 0 : jn.role) ?? null, B = ((ym = In == null ? void 0 : In.instance) == null ? void 0 : ym.current_state) ?? null, J = B ? ((vm = ((In == null ? void 0 : In.states) ?? []).find((ne) => ne.id === B)) == null ? void 0 : vm.key) ?? null : null;
21475
21487
  for (const ne of Jn) {
21476
21488
  if (!ne.lock_conditions) continue;
21477
21489
  let pe = [];
@@ -21512,7 +21524,7 @@ function Q1({
21512
21524
  title: (vr == null ? void 0 : vr.label_override) ?? void 0,
21513
21525
  defaultExpanded: (vr == null ? void 0 : vr.default_expanded) ?? !1,
21514
21526
  queuedComments: R ? An : void 0,
21515
- onQueueComment: R ? En : void 0
21527
+ onQueueComment: R ? Pn : void 0
21516
21528
  },
21517
21529
  "__comments__"
21518
21530
  );
@@ -21592,7 +21604,7 @@ function Q1({
21592
21604
  return null;
21593
21605
  }
21594
21606
  function fm() {
21595
- const j = Un.filter((B) => !B.hidden);
21607
+ const j = Bn.filter((B) => !B.hidden);
21596
21608
  return j.length === 0 ? null : /* @__PURE__ */ e("div", { className: "rounded-xl border border-slate-200 bg-white px-5 py-5", children: /* @__PURE__ */ e(cc, { children: (B) => j.map((J) => {
21597
21609
  var rt;
21598
21610
  const ne = ul == null ? void 0 : ul[J.field], pe = ne == null ? void 0 : ne.entries, Ce = (ne == null ? void 0 : ne.separator) ?? null, ze = be[J.field], Ze = ze != null && ze !== "", We = pe != null && pe.length && Ze ? ((rt = X.find((Nt) => Nt.many_collection === t && Nt.many_field === J.field && !Nt.junction_field)) == null ? void 0 : rt.one_collection) ?? null : null;
@@ -21611,7 +21623,7 @@ function Q1({
21611
21623
  locked: rn || qe !== "original",
21612
21624
  layoutAiEnabled: Pa,
21613
21625
  renderField: h,
21614
- onCountChange: Pn
21626
+ onCountChange: Kn
21615
21627
  }
21616
21628
  ),
21617
21629
  (pe == null ? void 0 : pe.length) && Ze && We && /* @__PURE__ */ e(
@@ -21718,7 +21730,7 @@ function Q1({
21718
21730
  locked: qi.has(bn.field) || qe !== "original",
21719
21731
  layoutAiEnabled: Pa,
21720
21732
  renderField: h,
21721
- onCountChange: Pn
21733
+ onCountChange: Kn
21722
21734
  }
21723
21735
  ) }, bn.field) : null;
21724
21736
  }) }) }) : void 0;
@@ -21737,7 +21749,7 @@ function Q1({
21737
21749
  locked: qi.has(vt.field) || qe !== "original",
21738
21750
  layoutAiEnabled: Pa,
21739
21751
  renderField: h,
21740
- onCountChange: Pn,
21752
+ onCountChange: Kn,
21741
21753
  swapButton: mn,
21742
21754
  swapContent: Tn
21743
21755
  }
@@ -21868,7 +21880,7 @@ function Q1({
21868
21880
  layoutAiEnabled: Pa,
21869
21881
  displayOnly: B.type === "metadata",
21870
21882
  renderField: h,
21871
- onCountChange: Pn,
21883
+ onCountChange: Kn,
21872
21884
  isNew: R,
21873
21885
  fieldValues: ze.map((ct) => be[ct.field]),
21874
21886
  isOpen: Nt ? _e === B.id : void 0,
@@ -21903,7 +21915,7 @@ function Q1({
21903
21915
  !Xn && p && /* @__PURE__ */ e(jo, { collection: kt, item: zt, onBeforeTransition: gs, addendumPending: !Ye && Z > 0 && !!(G != null && G.addendums_enabled), addendumView: Ye }),
21904
21916
  !kr && L && /* @__PURE__ */ e(Ao, { collection: t, item: _, queuedTasks: R ? Fn : void 0, onQueueTask: R ? De : void 0 }),
21905
21917
  !R && _ && /* @__PURE__ */ e(vp, { collection: t, itemId: String(_) }),
21906
- !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, queuedComments: R ? An : void 0, onQueueComment: R ? En : void 0 }),
21918
+ !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, queuedComments: R ? An : void 0, onQueueComment: R ? Pn : void 0 }),
21907
21919
  f && /* @__PURE__ */ e(oc, { collection: t, item: _ }),
21908
21920
  !Sa && O !== void 0 && (G == null ? void 0 : G.addendums_enabled) && !R && /* @__PURE__ */ e(
21909
21921
  To,
@@ -21923,7 +21935,7 @@ function Q1({
21923
21935
  ] });
21924
21936
  }
21925
21937
  function hm(j, B = !1) {
21926
- const J = (j === "__general__" ? B ? Un : [...Un, ...ar.flatMap((Ze) => Fr[Ze.key] ?? [])] : Fr[j] ?? []).filter((Ze) => !Ze.hidden), ne = Si && Js === j && p, pe = _i && Qs === j && !R, Ce = bo.filter((Ze) => (Ze.group_key ?? null) === j), ze = J.map((Ze) => ({ _k: Ze.field, sort: Ze.sort ?? 0, _t: "field", f: Ze }));
21938
+ const J = (j === "__general__" ? B ? Bn : [...Bn, ...ar.flatMap((Ze) => Fr[Ze.key] ?? [])] : Fr[j] ?? []).filter((Ze) => !Ze.hidden), ne = Si && Js === j && p, pe = _i && Qs === j && !R, Ce = bo.filter((Ze) => (Ze.group_key ?? null) === j), ze = J.map((Ze) => ({ _k: Ze.field, sort: Ze.sort ?? 0, _t: "field", f: Ze }));
21927
21939
  ne && wr && ze.push({ _k: "__owners__", sort: wr.sort, _t: "owners", slot: wr }), pe && Vn && ze.push({ _k: "__pdf__", sort: Vn.sort, _t: "pdf", slot: Vn });
21928
21940
  for (const Ze of Ce)
21929
21941
  ze.push({ _k: Ze.field, sort: Ze.sort, _t: "widget", slot: Ze });
@@ -21984,7 +21996,7 @@ function Q1({
21984
21996
  locked: rn || qe !== "original",
21985
21997
  layoutAiEnabled: Pa,
21986
21998
  renderField: h,
21987
- onCountChange: Pn
21999
+ onCountChange: Kn
21988
22000
  }
21989
22001
  ),
21990
22002
  (At == null ? void 0 : At.length) && vt && Mt && /* @__PURE__ */ e(
@@ -22006,7 +22018,7 @@ function Q1({
22006
22018
  ...Er.map((J) => ({ key: J.key, label: J.label }))
22007
22019
  ];
22008
22020
  return /* @__PURE__ */ a("div", { className: "space-y-4", children: [
22009
- Un.length > 0 && fm(),
22021
+ Bn.length > 0 && fm(),
22010
22022
  /* @__PURE__ */ e("div", { className: "flex border-b border-slate-200 overflow-x-auto gap-1 px-1", children: j.map((J) => {
22011
22023
  const ne = Object.keys(nt).some((pe) => {
22012
22024
  const Ce = Cn.find((ze) => ze.field === pe);
@@ -22034,7 +22046,7 @@ function Q1({
22034
22046
  !Xn && p && /* @__PURE__ */ e(jo, { collection: kt, item: zt, onBeforeTransition: gs, addendumPending: !Ye && Z > 0 && !!(G != null && G.addendums_enabled), addendumView: Ye }),
22035
22047
  !kr && L && /* @__PURE__ */ e(Ao, { collection: t, item: _, queuedTasks: R ? Fn : void 0, onQueueTask: R ? De : void 0 }),
22036
22048
  !R && _ && /* @__PURE__ */ e(vp, { collection: t, itemId: String(_) }),
22037
- !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, queuedComments: R ? An : void 0, onQueueComment: R ? En : void 0 }),
22049
+ !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, queuedComments: R ? An : void 0, onQueueComment: R ? Pn : void 0 }),
22038
22050
  f && /* @__PURE__ */ e(oc, { collection: t, item: _ }),
22039
22051
  !Sa && O !== void 0 && (G == null ? void 0 : G.addendums_enabled) && !R && /* @__PURE__ */ e(
22040
22052
  To,
@@ -22146,7 +22158,7 @@ function Q1({
22146
22158
  }),
22147
22159
  !Xn && p && /* @__PURE__ */ e(jo, { collection: kt, item: zt, defaultExpanded: !1, onBeforeTransition: gs, addendumPending: !Ye && Z > 0 && !!(G != null && G.addendums_enabled), addendumView: Ye }),
22148
22160
  !kr && L && /* @__PURE__ */ e(Ao, { collection: t, item: _, defaultExpanded: !1, queuedTasks: R ? Fn : void 0, onQueueTask: R ? De : void 0 }),
22149
- !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, defaultExpanded: !1, queuedComments: R ? An : void 0, onQueueComment: R ? En : void 0 }),
22161
+ !vr && Te && /* @__PURE__ */ e(Fo, { collection: t, item: _, defaultExpanded: !1, queuedComments: R ? An : void 0, onQueueComment: R ? Pn : void 0 }),
22150
22162
  f && /* @__PURE__ */ e(oc, { collection: t, item: _ }),
22151
22163
  !Sa && O !== void 0 && (G == null ? void 0 : G.addendums_enabled) && !R && /* @__PURE__ */ e(
22152
22164
  To,
@@ -22447,7 +22459,7 @@ function Q1({
22447
22459
  },
22448
22460
  j.id
22449
22461
  )),
22450
- we && !R || W && !R && A || xm ? /* @__PURE__ */ a(dt, { children: [
22462
+ we && !R || W && !R && A || xm ? /* @__PURE__ */ a(it, { children: [
22451
22463
  we && !R && /* @__PURE__ */ e(
22452
22464
  Mf,
22453
22465
  {
@@ -22470,14 +22482,14 @@ function Q1({
22470
22482
  }
22471
22483
  }
22472
22484
  ),
22473
- A && !R && _ && /* @__PURE__ */ a(dt, { children: [
22485
+ A && !R && _ && /* @__PURE__ */ a(it, { children: [
22474
22486
  /* @__PURE__ */ a(
22475
22487
  bt,
22476
22488
  {
22477
22489
  type: "button",
22478
22490
  variant: "outline",
22479
22491
  size: "sm",
22480
- onClick: () => Ft(!0),
22492
+ onClick: () => jt(!0),
22481
22493
  title: "Edit every field with conditional logic bypassed (admin)",
22482
22494
  className: "gap-1.5",
22483
22495
  children: [
@@ -22492,7 +22504,7 @@ function Q1({
22492
22504
  collection: t,
22493
22505
  itemId: String(_),
22494
22506
  open: Zt,
22495
- onClose: () => Ft(!1),
22507
+ onClose: () => jt(!1),
22496
22508
  onSaved: () => {
22497
22509
  C.invalidateQueries({ queryKey: ["item", t, String(_)] });
22498
22510
  }
@@ -22510,7 +22522,7 @@ function Q1({
22510
22522
  onSuccess: (j) => s == null ? void 0 : s(String(j))
22511
22523
  }
22512
22524
  ),
22513
- xm && (Ch ? /* @__PURE__ */ a(dt, { children: [
22525
+ xm && (Ch ? /* @__PURE__ */ a(it, { children: [
22514
22526
  /* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground", children: "Delete?" }),
22515
22527
  /* @__PURE__ */ e(
22516
22528
  bt,
@@ -22753,7 +22765,7 @@ function Q1({
22753
22765
  /* @__PURE__ */ a(
22754
22766
  "div",
22755
22767
  {
22756
- ref: jt,
22768
+ ref: Ft,
22757
22769
  className: Q(
22758
22770
  "p-6 space-y-4",
22759
22771
  P ? "flex-1 overflow-y-auto" : ""
@@ -22794,7 +22806,7 @@ function Q1({
22794
22806
  ]
22795
22807
  }
22796
22808
  ),
22797
- Bn ? Pr ? Fh() : Th() : qh(),
22809
+ Ln ? Pr ? Fh() : Th() : qh(),
22798
22810
  k
22799
22811
  ]
22800
22812
  }
@@ -22820,7 +22832,7 @@ function Q1({
22820
22832
  {
22821
22833
  allSteps: Jr.length > 0 ? Jr.map((j) => ({ key: j.key, label: j.label })) : mr,
22822
22834
  groupedMap: Fr,
22823
- ungroupedFields: Un,
22835
+ ungroupedFields: Bn,
22824
22836
  sectionGroups: ar.filter((j) => j.type !== "metadata"),
22825
22837
  draft: be,
22826
22838
  relations: X,
@@ -22844,7 +22856,7 @@ function Q1({
22844
22856
  (Ze) => Ze.type === "tab" && Ze.container_id === ze.id && Ze.key === j
22845
22857
  )
22846
22858
  );
22847
- Ce ? (sa(Ce, j), (pe = jt.current) == null || pe.scrollTo({ top: 0 })) : Bl(j);
22859
+ Ce ? (sa(Ce, j), (pe = Ft.current) == null || pe.scrollTo({ top: 0 })) : Bl(j);
22848
22860
  } else
22849
22861
  Bl(j);
22850
22862
  let J = 0;
@@ -23796,7 +23808,7 @@ val1,val2,val3`,
23796
23808
  s < pc.length - 1 ? /* @__PURE__ */ a(bt, { size: "sm", disabled: !G, onClick: () => i((Y) => Y + 1), children: [
23797
23809
  "Next ",
23798
23810
  /* @__PURE__ */ e(ya, { className: "h-3.5 w-3.5" })
23799
- ] }) : /* @__PURE__ */ e(bt, { size: "sm", disabled: re.isPending, onClick: () => re.mutate(), children: re.isPending ? /* @__PURE__ */ a(dt, { children: [
23811
+ ] }) : /* @__PURE__ */ e(bt, { size: "sm", disabled: re.isPending, onClick: () => re.mutate(), children: re.isPending ? /* @__PURE__ */ a(it, { children: [
23800
23812
  /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }),
23801
23813
  " Starting…"
23802
23814
  ] }) : "Start import" })
@@ -24103,7 +24115,7 @@ function nk({
24103
24115
  /* @__PURE__ */ e("h3", { className: "truncate text-[15px] font-semibold text-slate-900 dark:text-foreground", children: i === pl ? "New import definition" : dd(y) }),
24104
24116
  y && /* @__PURE__ */ a("p", { className: "mt-0.5 font-mono text-[11px] text-slate-400", children: [
24105
24117
  y.staging_table || `staging_${y.key}`,
24106
- y.procedure && /* @__PURE__ */ a(dt, { children: [
24118
+ y.procedure && /* @__PURE__ */ a(it, { children: [
24107
24119
  " ",
24108
24120
  /* @__PURE__ */ e(ya, { className: "inline h-3 w-3 -translate-y-px" }),
24109
24121
  " ",
@@ -24216,7 +24228,7 @@ function nk({
24216
24228
  ) }) })
24217
24229
  ] }),
24218
24230
  /* @__PURE__ */ a("div", { className: "flex items-center gap-3", children: [
24219
- /* @__PURE__ */ e(bt, { size: "sm", disabled: !F || v.isPending, onClick: () => v.mutate(), children: v.isPending ? /* @__PURE__ */ a(dt, { children: [
24231
+ /* @__PURE__ */ e(bt, { size: "sm", disabled: !F || v.isPending, onClick: () => v.mutate(), children: v.isPending ? /* @__PURE__ */ a(it, { children: [
24220
24232
  /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }),
24221
24233
  " Saving…"
24222
24234
  ] }) : i === pl ? "Create definition" : "Save changes" }),
@@ -24269,7 +24281,7 @@ function ak({ def: t }) {
24269
24281
  const n = t.staging_table || `staging_${t.key}`;
24270
24282
  return /* @__PURE__ */ a("span", { className: "flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-slate-500 dark:text-muted-foreground", children: [
24271
24283
  /* @__PURE__ */ e("span", { className: "truncate", children: n }),
24272
- t.procedure ? /* @__PURE__ */ a(dt, { children: [
24284
+ t.procedure ? /* @__PURE__ */ a(it, { children: [
24273
24285
  /* @__PURE__ */ e(ya, { className: "h-3 w-3 shrink-0 text-slate-300 dark:text-slate-600" }),
24274
24286
  /* @__PURE__ */ e("span", { className: "truncate", children: t.procedure })
24275
24287
  ] }) : /* @__PURE__ */ e("span", { className: "shrink-0 font-sans text-slate-400", children: "· load only" })
@@ -24510,7 +24522,7 @@ function lk({
24510
24522
  ),
24511
24523
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "lower runs first" })
24512
24524
  ] }),
24513
- h && /* @__PURE__ */ e("p", { className: "min-w-0 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: h.procedure ? /* @__PURE__ */ a(dt, { children: [
24525
+ h && /* @__PURE__ */ e("p", { className: "min-w-0 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: h.procedure ? /* @__PURE__ */ a(it, { children: [
24514
24526
  "Will load into",
24515
24527
  " ",
24516
24528
  /* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: h.staging_table || `staging_${h.key}` }),
@@ -24518,7 +24530,7 @@ function lk({
24518
24530
  " ",
24519
24531
  /* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: h.procedure }),
24520
24532
  "."
24521
- ] }) : /* @__PURE__ */ a(dt, { children: [
24533
+ ] }) : /* @__PURE__ */ a(it, { children: [
24522
24534
  "Will load into",
24523
24535
  " ",
24524
24536
  /* @__PURE__ */ e("span", { className: "font-mono text-slate-700 dark:text-foreground", children: h.staging_table || `staging_${h.key}` }),
@@ -24533,7 +24545,7 @@ function lk({
24533
24545
  size: "sm",
24534
24546
  disabled: !h || !m || g.isPending || k.isPending,
24535
24547
  onClick: () => g.mutate(),
24536
- children: g.isPending ? /* @__PURE__ */ a(dt, { children: [
24548
+ children: g.isPending ? /* @__PURE__ */ a(it, { children: [
24537
24549
  /* @__PURE__ */ e(Tt, { className: "h-3.5 w-3.5 animate-spin" }),
24538
24550
  " Queueing…"
24539
24551
  ] }) : "Queue import"
@@ -24905,7 +24917,7 @@ function H_({
24905
24917
  runCounts: Oe,
24906
24918
  isLoading: _.isLoading
24907
24919
  }
24908
- ) : /* @__PURE__ */ a(dt, { children: [
24920
+ ) : /* @__PURE__ */ a(it, { children: [
24909
24921
  ce && /* @__PURE__ */ e(
24910
24922
  dk,
24911
24923
  {
@@ -25127,7 +25139,7 @@ function ck({
25127
25139
  /* @__PURE__ */ a("div", { className: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2.5 dark:border-border dark:bg-muted/30", children: [
25128
25140
  /* @__PURE__ */ a("p", { className: "flex flex-wrap items-center gap-1.5 font-mono text-[12px] text-slate-800 dark:text-foreground", children: [
25129
25141
  /* @__PURE__ */ e("span", { children: c.staging_table || `staging_${c.import_key}` }),
25130
- c.procedure ? /* @__PURE__ */ a(dt, { children: [
25142
+ c.procedure ? /* @__PURE__ */ a(it, { children: [
25131
25143
  /* @__PURE__ */ e(ya, { className: "h-3.5 w-3.5 text-slate-400" }),
25132
25144
  /* @__PURE__ */ e("span", { children: c.procedure })
25133
25145
  ] }) : /* @__PURE__ */ e("span", { className: "font-sans text-[11.5px] text-slate-500", children: "· load only, no procedure" })
@@ -25231,7 +25243,7 @@ function uk({
25231
25243
  t,
25232
25244
  " selected"
25233
25245
  ] }),
25234
- l && /* @__PURE__ */ a(dt, { children: [
25246
+ l && /* @__PURE__ */ a(it, { children: [
25235
25247
  /* @__PURE__ */ e(
25236
25248
  "button",
25237
25249
  {
@@ -25367,7 +25379,7 @@ function fk({
25367
25379
  side: "right",
25368
25380
  className: "flex max-w-full flex-col gap-0 p-0",
25369
25381
  style: { width: p ?? 480, maxWidth: "96vw" },
25370
- children: t && /* @__PURE__ */ a(dt, { children: [
25382
+ children: t && /* @__PURE__ */ a(it, { children: [
25371
25383
  /* @__PURE__ */ e(Rl, { className: "shrink-0 border-b border-slate-200 px-5 py-4 dark:border-border", children: /* @__PURE__ */ a("div", { className: "flex items-start justify-between gap-3 pr-6", children: [
25372
25384
  /* @__PURE__ */ a("div", { className: "min-w-0", children: [
25373
25385
  /* @__PURE__ */ e(Ml, { className: "truncate text-[15px] font-semibold", children: t.label }),
@@ -25913,7 +25925,7 @@ function Jf({ collection: t, id: n }) {
25913
25925
  className: "text-left underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#0284c7] hover:decoration-[#0284c7] dark:decoration-slate-600",
25914
25926
  children: d
25915
25927
  }
25916
- ) : /* @__PURE__ */ e(dt, { children: d });
25928
+ ) : /* @__PURE__ */ e(it, { children: d });
25917
25929
  }
25918
25930
  function Nk({
25919
25931
  collection: t,
@@ -26502,7 +26514,7 @@ function Gf({
26502
26514
  children: _
26503
26515
  }
26504
26516
  ), C = /* @__PURE__ */ e("div", { className: "my-1 border-t border-slate-100 dark:border-slate-800" });
26505
- return /* @__PURE__ */ a(dt, { children: [
26517
+ return /* @__PURE__ */ a(it, { children: [
26506
26518
  /* @__PURE__ */ a(
26507
26519
  "button",
26508
26520
  {
@@ -26594,7 +26606,7 @@ function Gf({
26594
26606
  }
26595
26607
  )
26596
26608
  ] })
26597
- ] }) : /* @__PURE__ */ a(dt, { children: [
26609
+ ] }) : /* @__PURE__ */ a(it, { children: [
26598
26610
  E("Open", () => {
26599
26611
  f(!1), l();
26600
26612
  }),
@@ -26607,7 +26619,7 @@ function Gf({
26607
26619
  i && E("Audit log", () => {
26608
26620
  f(!1), i();
26609
26621
  }),
26610
- r && g.length > 0 && /* @__PURE__ */ a(dt, { children: [
26622
+ r && g.length > 0 && /* @__PURE__ */ a(it, { children: [
26611
26623
  C,
26612
26624
  /* @__PURE__ */ e("p", { className: "px-3 pb-0.5 pt-1 text-[9.5px] font-bold uppercase tracking-wider text-slate-400", children: "Transitions" }),
26613
26625
  g.map((_) => {
@@ -27158,7 +27170,7 @@ function Gu({
27158
27170
  if (!u)
27159
27171
  return /* @__PURE__ */ e("div", { className: "px-3 py-1.5", style: { paddingLeft: `${0.5 + n}rem` }, children: /* @__PURE__ */ e("span", { className: "inline-block h-3 w-20 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }) });
27160
27172
  const p = n < 2;
27161
- return /* @__PURE__ */ e(dt, { children: u.fields.filter((f) => !f.hidden && (!s || f.field.includes(s))).map((f) => {
27173
+ return /* @__PURE__ */ e(it, { children: u.fields.filter((f) => !f.hidden && (!s || f.field.includes(s))).map((f) => {
27162
27174
  const y = p ? Ca(u.relations, t, f.field) : void 0, w = p && i ? oo(u.relations, t, f.field) : void 0, v = (y == null ? void 0 : y.one_collection) ?? null, N = c.has(f.field);
27163
27175
  return /* @__PURE__ */ a("div", { children: [
27164
27176
  /* @__PURE__ */ a(
@@ -27349,7 +27361,7 @@ function Ek({
27349
27361
  }
27350
27362
  }
27351
27363
  const N = [...w, ...v.slice(0, 12)];
27352
- return N.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matching fields" }) : /* @__PURE__ */ e(dt, { children: N.map((x) => /* @__PURE__ */ a(
27364
+ return N.length === 0 ? /* @__PURE__ */ e("p", { className: "px-3 py-2 text-[12px] text-slate-400", children: "No matching fields" }) : /* @__PURE__ */ e(it, { children: N.map((x) => /* @__PURE__ */ a(
27353
27365
  "div",
27354
27366
  {
27355
27367
  className: "group/frow flex w-full items-center gap-1 px-1.5 hover:bg-slate-50 dark:hover:bg-slate-800",
@@ -27594,7 +27606,7 @@ function Ik({
27594
27606
  children: "+ Add Filter"
27595
27607
  }
27596
27608
  ),
27597
- d && /* @__PURE__ */ e("div", { className: "absolute left-0 top-full z-50 mt-1 w-80 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-slate-700 dark:bg-slate-900", children: f == null ? /* @__PURE__ */ a(dt, { children: [
27609
+ d && /* @__PURE__ */ e("div", { className: "absolute left-0 top-full z-50 mt-1 w-80 overflow-hidden rounded-xl border border-slate-200 bg-white shadow-xl dark:border-slate-700 dark:bg-slate-900", children: f == null ? /* @__PURE__ */ a(it, { children: [
27598
27610
  m.path.length > 0 && /* @__PURE__ */ a(
27599
27611
  "button",
27600
27612
  {
@@ -27635,7 +27647,7 @@ function Ik({
27635
27647
  }
27636
27648
  }
27637
27649
  ) })
27638
- ] }) : /* @__PURE__ */ a(dt, { children: [
27650
+ ] }) : /* @__PURE__ */ a(it, { children: [
27639
27651
  /* @__PURE__ */ a(
27640
27652
  "button",
27641
27653
  {
@@ -27791,7 +27803,7 @@ function Ik({
27791
27803
  className: "h-8 min-w-0 flex-1 rounded-md border border-slate-200 bg-white px-2.5 text-[13px] outline-none focus:border-[#00ceff80] dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
27792
27804
  }
27793
27805
  ),
27794
- O === "number" && w === "_between" && /* @__PURE__ */ a(dt, { children: [
27806
+ O === "number" && w === "_between" && /* @__PURE__ */ a(it, { children: [
27795
27807
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: "to" }),
27796
27808
  /* @__PURE__ */ e(
27797
27809
  "input",
@@ -28072,7 +28084,7 @@ function G_({
28072
28084
  P ? localStorage.setItem(`nvr_cbv_group_${t}`, P) : localStorage.removeItem(`nvr_cbv_group_${t}`);
28073
28085
  } catch {
28074
28086
  }
28075
- }, [gt, nt] = q(!1), [Xe, $t] = q(""), [xt, Zt] = q(null), Ft = pt({
28087
+ }, [gt, nt] = q(!1), [Xe, $t] = q(""), [xt, Zt] = q(null), jt = pt({
28076
28088
  mutationFn: (P) => m.request(ut("/ai/query", { collection: t, prompt: P, limit: 200 })),
28077
28089
  onSuccess: (P) => {
28078
28090
  var xe;
@@ -28097,9 +28109,9 @@ function G_({
28097
28109
  window.removeEventListener("mousedown", P), window.removeEventListener("scroll", P, !0), window.removeEventListener("keydown", P);
28098
28110
  };
28099
28111
  }, [St]);
28100
- const [Bt, Le] = q([]), [lt, ot] = q(null), [Dt, ln] = q(!1), [dn, An] = q(""), [Mn, En] = q(!1), Fn = Ge(null), ie = Ge(null), De = Ge(!1), { isAdmin: Ke } = yl(), Je = Ge(t);
28112
+ const [Bt, Le] = q([]), [lt, dt] = q(null), [Dt, ln] = q(!1), [dn, An] = q(""), [Dn, Pn] = q(!1), Fn = Ge(null), ie = Ge(null), De = Ge(!1), { isAdmin: Ke } = yl(), Je = Ge(t);
28101
28113
  Ve(() => {
28102
- Je.current !== t && (Je.current = t, v(1), x(i), k([]), b(l ?? ""), $(r ?? null), D({}), C({}), Le([]), ot(null), re({}), ye({}), V({}), G([]), Z != null && Z.length && de.back(Z.length), qe(null), De.current = !1);
28114
+ Je.current !== t && (Je.current = t, v(1), x(i), k([]), b(l ?? ""), $(r ?? null), D({}), C({}), Le([]), dt(null), re({}), ye({}), V({}), G([]), Z != null && Z.length && de.back(Z.length), qe(null), De.current = !1);
28103
28115
  }, [t]), Ve(() => {
28104
28116
  if (!Re) return;
28105
28117
  const P = (xe) => {
@@ -28319,7 +28331,7 @@ function G_({
28319
28331
  enabled: !!t && La.length > 0 && Qn.length > 0,
28320
28332
  staleTime: 3e4,
28321
28333
  retry: !1
28322
- }), Mr = Qn.map((P) => String(P.id)).join(","), { data: Dn } = ge({
28334
+ }), Mr = Qn.map((P) => String(P.id)).join(","), { data: En } = ge({
28323
28335
  queryKey: ["cbv-pipeline-instances", t, Mr],
28324
28336
  queryFn: () => m.request(
28325
28337
  he(`/pipelines/instances/${t}`, Mr ? { ids: Mr } : void 0)
@@ -28328,12 +28340,12 @@ function G_({
28328
28340
  placeholderData: (P) => P,
28329
28341
  staleTime: 3e4,
28330
28342
  retry: !1
28331
- }), _r = (Ul = Dn == null ? void 0 : Dn.binding) == null ? void 0 : Ul.template, { data: rr } = ge({
28343
+ }), _r = (Ul = En == null ? void 0 : En.binding) == null ? void 0 : Ul.template, { data: rr } = ge({
28332
28344
  queryKey: ["cbv-pipeline-template", _r],
28333
28345
  queryFn: () => m.request(he(`/pipelines/${_r}`)).then((P) => P.data),
28334
28346
  enabled: !!_r,
28335
28347
  retry: !1
28336
- }), Ma = !!(Dn != null && Dn.binding), { data: Pn } = ge({
28348
+ }), Ma = !!(En != null && En.binding), { data: Kn } = ge({
28337
28349
  queryKey: ["cbv-owners", t, Mr],
28338
28350
  queryFn: () => m.request(
28339
28351
  ut(`/pipelines/instance/${t}/owners/batch`, {
@@ -28384,11 +28396,11 @@ function G_({
28384
28396
  }, jn = (P, xe) => V((we) => {
28385
28397
  const Te = { ...we };
28386
28398
  return xe ? Te[P] = xe : delete Te[P], Te;
28387
- }), Kn = (P) => {
28399
+ }), In = (P) => {
28388
28400
  var te, se, je, Pe;
28389
28401
  const { key: xe, row: we, cellText: Te } = P, L = we.id;
28390
28402
  if (xe === "__state__") {
28391
- const _e = (te = Dn == null ? void 0 : Dn.instances) == null ? void 0 : te[String(L)];
28403
+ const _e = (te = En == null ? void 0 : En.instances) == null ? void 0 : te[String(L)];
28392
28404
  if (!(_e != null && _e.state_key)) return;
28393
28405
  const Be = le.__state__, yt = (Be == null ? void 0 : Be.kind) === "state" ? Be.value : [];
28394
28406
  jn("__state__", { kind: "state", value: [.../* @__PURE__ */ new Set([...yt, _e.state_key])] });
@@ -28540,7 +28552,7 @@ function G_({
28540
28552
  staleTime: 3e4
28541
28553
  }), Tr = () => p.invalidateQueries({ queryKey: ["cbv-views", t] }), Gn = (P) => {
28542
28554
  var xe;
28543
- if (ot(P.id), k(P.filters ?? []), b(P.sort ?? ""), (xe = P.columns) != null && xe.length) {
28555
+ if (dt(P.id), k(P.filters ?? []), b(P.sort ?? ""), (xe = P.columns) != null && xe.length) {
28544
28556
  const Te = P.columns.map(Sk).filter((se) => se.includes(".") || Vt.has(se));
28545
28557
  Te.length > 0 && $(Te);
28546
28558
  const L = {}, W = {}, te = {};
@@ -28556,7 +28568,7 @@ function G_({
28556
28568
  Gn(P);
28557
28569
  return;
28558
28570
  }
28559
- ot(null), k([]), b(l ?? ""), $(r ?? null), D({}), C({}), xn(null), v(1);
28571
+ dt(null), k([]), b(l ?? ""), $(r ?? null), D({}), C({}), xn(null), v(1);
28560
28572
  }, Na = () => ({
28561
28573
  filters: F,
28562
28574
  sort: g,
@@ -28586,7 +28598,7 @@ function G_({
28586
28598
  ut("/saved-views", { collection: t, name: dn.trim(), ...Na() })
28587
28599
  ),
28588
28600
  onSuccess: (P) => {
28589
- ln(!1), An(""), ot(P.data.id), Tr();
28601
+ ln(!1), An(""), dt(P.data.id), Tr();
28590
28602
  }
28591
28603
  }), Vr = pt({
28592
28604
  mutationFn: (P) => m.request(Nn(`/saved-views/${P}`, Na())),
@@ -28623,8 +28635,8 @@ function G_({
28623
28635
  },
28624
28636
  onSuccess: () => p.invalidateQueries({ queryKey: ["cbv-view-subs"] })
28625
28637
  }), Fe = async () => {
28626
- if (!Mn) {
28627
- En(!0);
28638
+ if (!Dn) {
28639
+ Pn(!0);
28628
28640
  try {
28629
28641
  const P = await m.request(
28630
28642
  he(`/items/${t}`, {
@@ -28653,10 +28665,10 @@ function G_({
28653
28665
  const _e = Pe == null ? "" : String(typeof Pe == "object" ? JSON.stringify(Pe) : Pe);
28654
28666
  return /[",\n]/.test(_e) ? `"${_e.replace(/"/g, '""')}"` : _e;
28655
28667
  }, L = (Pe, _e) => {
28656
- var ht, it;
28668
+ var ht, ot;
28657
28669
  const Be = E[_e];
28658
28670
  if (_e.includes(".") || _e in vn) {
28659
- const jt = _e.includes(".") ? _e : vn[_e], Et = ((it = (ht = we[String(Pe.id)]) == null ? void 0 : ht[jt]) == null ? void 0 : it.value) ?? "";
28671
+ const Ft = _e.includes(".") ? _e : vn[_e], Et = ((ot = (ht = we[String(Pe.id)]) == null ? void 0 : ht[Ft]) == null ? void 0 : ot.value) ?? "";
28660
28672
  return Be && Et ? qs(Et, Be) : Et;
28661
28673
  }
28662
28674
  const yt = Pe[_e];
@@ -28668,7 +28680,7 @@ function G_({
28668
28680
  `)], { type: "text/csv;charset=utf-8" }), se = URL.createObjectURL(te), je = document.createElement("a");
28669
28681
  je.href = se, je.download = `${t}.csv`, je.click(), URL.revokeObjectURL(se);
28670
28682
  } finally {
28671
- En(!1);
28683
+ Pn(!1);
28672
28684
  }
28673
28685
  }
28674
28686
  }, Ye = (P) => {
@@ -28677,7 +28689,7 @@ function G_({
28677
28689
  g === P ? b(`-${P}`) : g === `-${P}` ? b("") : b(P), v(1);
28678
28690
  }, zt = Qn.length > 0 && Qn.every((P) => Bt.includes(P.id)), Ht = () => Le(
28679
28691
  zt ? Bt.filter((P) => !Qn.some((xe) => xe.id === P)) : [.../* @__PURE__ */ new Set([...Bt, ...Qn.map((P) => P.id)])]
28680
- ), Rn = (P) => Le((xe) => xe.includes(P) ? xe.filter((we) => we !== P) : [...xe, P]), Cn = ur === 0 ? 0 : (w - 1) * Jt + 1, wn = Math.min(w * Jt, ur), Sn = !!(Dn != null && Dn.instances), In = (ft ? 1 : 0) + (Sn ? 2 : 0) + (Ct ? 1 : 0), Yn = [
28692
+ ), Mn = (P) => Le((xe) => xe.includes(P) ? xe.filter((we) => we !== P) : [...xe, P]), Cn = ur === 0 ? 0 : (w - 1) * Jt + 1, wn = Math.min(w * Jt, ur), Sn = !!(En != null && En.instances), Un = (ft ? 1 : 0) + (Sn ? 2 : 0) + (Ct ? 1 : 0), Yn = [
28681
28693
  ..._t.map((P) => ({ key: P, kind: "data" })),
28682
28694
  ...Sn ? [
28683
28695
  { key: "__state__", kind: "state" },
@@ -28696,7 +28708,7 @@ function G_({
28696
28708
  if (!Ie) return "";
28697
28709
  const xe = P.id;
28698
28710
  if (Ie === "__state__") {
28699
- const L = (Te = Dn == null ? void 0 : Dn.instances) == null ? void 0 : Te[String(xe)];
28711
+ const L = (Te = En == null ? void 0 : En.instances) == null ? void 0 : Te[String(xe)];
28700
28712
  return (L == null ? void 0 : L.state_label) ?? (L == null ? void 0 : L.state_key) ?? "(no state)";
28701
28713
  }
28702
28714
  if (Dr(Ie)) return Cr(xe, Ie) || "(empty)";
@@ -28715,10 +28727,10 @@ function G_({
28715
28727
  if (we.push({ kind: "header", gkey: Te, label: Te, count: L.length }), !at.has(Te)) for (const W of L) we.push({ kind: "row", row: W });
28716
28728
  }
28717
28729
  return we;
28718
- })(), Il = la.filter((P) => yn(P.key) === "left").map((P) => P.key), Fr = la.filter((P) => yn(P.key) === "right").map((P) => P.key), Un = Ge(/* @__PURE__ */ new Map()), [Ea, Er] = q({});
28730
+ })(), Il = la.filter((P) => yn(P.key) === "left").map((P) => P.key), Fr = la.filter((P) => yn(P.key) === "right").map((P) => P.key), Bn = Ge(/* @__PURE__ */ new Map()), [Ea, Er] = q({});
28719
28731
  uo(() => {
28720
28732
  const P = {};
28721
- for (const [we, Te] of Un.current)
28733
+ for (const [we, Te] of Bn.current)
28722
28734
  Te != null && Te.isConnected && (P[we] = Te.getBoundingClientRect().width);
28723
28735
  const xe = /* @__PURE__ */ new Set([...Object.keys(P), ...Object.keys(Ea)]);
28724
28736
  for (const we of xe)
@@ -28747,12 +28759,12 @@ function G_({
28747
28759
  if (!Te) return "";
28748
28760
  const L = Te === "left" && Il[Il.length - 1] === P ? "border-r border-slate-200 dark:border-slate-700" : Te === "right" && Fr[0] === P ? "border-l border-slate-200 dark:border-slate-700" : "";
28749
28761
  return `sticky ${xe} ${we} ${L}`;
28750
- }, Bn = (P) => {
28762
+ }, Ln = (P) => {
28751
28763
  const xe = yn(P);
28752
28764
  if (xe)
28753
28765
  return xe === "left" ? { left: ar(P) } : { right: ar(P) };
28754
28766
  }, kn = (P) => (xe) => {
28755
- xe ? Un.current.set(P, xe) : Un.current.delete(P);
28767
+ xe ? Bn.current.set(P, xe) : Bn.current.delete(P);
28756
28768
  }, Pa = {
28757
28769
  left: "Pinned left — click to pin right",
28758
28770
  right: "Pinned right — click to unpin",
@@ -28859,7 +28871,7 @@ function G_({
28859
28871
  {
28860
28872
  type: "button",
28861
28873
  onClick: () => {
28862
- Kn(St), tn(null);
28874
+ In(St), tn(null);
28863
28875
  },
28864
28876
  className: "block w-full truncate px-3 py-1.5 text-left text-[12px] text-slate-700 hover:bg-slate-50 dark:text-slate-200 dark:hover:bg-slate-800",
28865
28877
  children: [
@@ -28950,7 +28962,7 @@ function G_({
28950
28962
  value: Xe,
28951
28963
  onChange: (P) => $t(P.target.value),
28952
28964
  onKeyDown: (P) => {
28953
- P.key === "Enter" && Xe.trim() && !Ft.isPending && Ft.mutate(Xe.trim()), P.key === "Escape" && nt(!1);
28965
+ P.key === "Enter" && Xe.trim() && !jt.isPending && jt.mutate(Xe.trim()), P.key === "Escape" && nt(!1);
28954
28966
  },
28955
28967
  placeholder: 'Ask in plain language — "over 50k in Zone 1 still waiting on approval"',
28956
28968
  className: "h-8 flex-1 rounded-md border border-slate-200 bg-white px-3 text-[12.5px] outline-none focus:border-[#00ceff80] focus:ring-2 focus:ring-[#00ceff4d] dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100"
@@ -28960,10 +28972,10 @@ function G_({
28960
28972
  "button",
28961
28973
  {
28962
28974
  type: "button",
28963
- disabled: !Xe.trim() || Ft.isPending,
28964
- onClick: () => Ft.mutate(Xe.trim()),
28975
+ disabled: !Xe.trim() || jt.isPending,
28976
+ onClick: () => jt.mutate(Xe.trim()),
28965
28977
  className: "flex h-8 items-center gap-1.5 rounded-md bg-nvr-cyan px-3 text-[12px] font-semibold text-white hover:brightness-110 disabled:opacity-40",
28966
- children: Ft.isPending ? /* @__PURE__ */ e(Vd, { className: "h-3.5 w-3.5 animate-spin" }) : "Ask"
28978
+ children: jt.isPending ? /* @__PURE__ */ e(Vd, { className: "h-3.5 w-3.5 animate-spin" }) : "Ask"
28967
28979
  }
28968
28980
  )
28969
28981
  ] }),
@@ -29275,9 +29287,9 @@ function G_({
29275
29287
  {
29276
29288
  type: "button",
29277
29289
  onClick: () => void Fe(),
29278
- disabled: Mn,
29290
+ disabled: Dn,
29279
29291
  className: "h-8 rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-500 hover:text-slate-700 disabled:opacity-50 dark:border-slate-700 dark:text-slate-400",
29280
- children: Mn ? "Exporting…" : "Export"
29292
+ children: Dn ? "Exporting…" : "Export"
29281
29293
  }
29282
29294
  ),
29283
29295
  qt && !(me != null && me.singleton) && /* @__PURE__ */ e(
@@ -29368,7 +29380,7 @@ function G_({
29368
29380
  P.is_default && /* @__PURE__ */ e("span", { title: "Collection default view", className: "text-[#00a5cc]", children: "★" }),
29369
29381
  P.is_shared && !P.is_default && /* @__PURE__ */ e("span", { title: "Shared", children: "⚭" }),
29370
29382
  /* @__PURE__ */ e("button", { type: "button", onClick: () => Gn(P), children: P.name }),
29371
- lt === P.id && /* @__PURE__ */ a(dt, { children: [
29383
+ lt === P.id && /* @__PURE__ */ a(it, { children: [
29372
29384
  /* @__PURE__ */ e(
29373
29385
  "button",
29374
29386
  {
@@ -29424,7 +29436,7 @@ function G_({
29424
29436
  ] }),
29425
29437
  Rr != null && /* @__PURE__ */ e("div", { className: "mx-4 mt-3 rounded-md border border-red-200 bg-red-50 px-4 py-2.5 text-[13px] text-red-700", children: Rr instanceof Error ? Rr.message : "Failed to load records" }),
29426
29438
  /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col p-4 pt-3", children: /* @__PURE__ */ a("div", { className: "relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-900", children: [
29427
- ma && !ua && /* @__PURE__ */ a(dt, { children: [
29439
+ ma && !ua && /* @__PURE__ */ a(it, { children: [
29428
29440
  /* @__PURE__ */ e("div", { className: "cbv-progress pointer-events-none absolute inset-x-0 top-0 z-[6] h-[3px] overflow-hidden" }),
29429
29441
  /* @__PURE__ */ e("div", { className: "cbv-overlay pointer-events-none absolute inset-0 z-[5] flex items-start justify-center bg-white/40 pt-24 dark:bg-slate-950/35", children: /* @__PURE__ */ a("span", { className: "flex items-center gap-2 rounded-full border border-slate-200 bg-white px-3 py-1.5 text-[12px] font-medium text-slate-600 shadow-lg dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", children: [
29430
29442
  /* @__PURE__ */ e(Vd, { "aria-hidden": !0, className: "h-3.5 w-3.5 animate-spin text-[#00a5cc]" }),
@@ -29479,7 +29491,7 @@ function G_({
29479
29491
  "th",
29480
29492
  {
29481
29493
  ref: we ? kn(xe) : void 0,
29482
- style: Bn(xe),
29494
+ style: Ln(xe),
29483
29495
  className: `${Te} text-left ${P.kind === "actions" ? "w-20 px-2" : ""} ${L}`,
29484
29496
  children: [
29485
29497
  Be,
@@ -29494,7 +29506,7 @@ function G_({
29494
29506
  "th",
29495
29507
  {
29496
29508
  ref: we ? kn(xe) : void 0,
29497
- style: Bn(xe),
29509
+ style: Ln(xe),
29498
29510
  onClick: () => {
29499
29511
  te || kt(xe);
29500
29512
  },
@@ -29515,7 +29527,7 @@ function G_({
29515
29527
  la.map((P) => {
29516
29528
  var L;
29517
29529
  const xe = P.key, Te = `sticky top-8 bg-slate-50 px-2 py-1 text-left font-normal dark:bg-slate-800 ${!!yn(xe) ? "z-[4]" : "z-[2]"} ${_a(xe, "", "")}`;
29518
- return P.kind === "state" ? /* @__PURE__ */ e("th", { style: Bn(xe), className: Te, children: /* @__PURE__ */ e(
29530
+ return P.kind === "state" ? /* @__PURE__ */ e("th", { style: Ln(xe), className: Te, children: /* @__PURE__ */ e(
29519
29531
  Td,
29520
29532
  {
29521
29533
  block: !0,
@@ -29533,21 +29545,21 @@ function G_({
29533
29545
  ) }, xe) : P.kind !== "data" ? /* @__PURE__ */ e(
29534
29546
  "th",
29535
29547
  {
29536
- style: Bn(xe),
29548
+ style: Ln(xe),
29537
29549
  className: `${Te} ${P.kind === "actions" ? "w-20" : ""}`
29538
29550
  },
29539
29551
  xe
29540
- ) : /* @__PURE__ */ e("th", { style: Bn(xe), className: Te, children: bs(xe) }, xe);
29552
+ ) : /* @__PURE__ */ e("th", { style: Ln(xe), className: Te, children: bs(xe) }, xe);
29541
29553
  })
29542
29554
  ] })
29543
29555
  ] }),
29544
- /* @__PURE__ */ e("tbody", { className: "text-[12px] tabular-nums", children: ua ? Array.from({ length: 12 }, (P, xe) => /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 dark:border-slate-800", children: /* @__PURE__ */ e("td", { className: "px-3 py-2", colSpan: _t.length + In, children: /* @__PURE__ */ e(
29556
+ /* @__PURE__ */ e("tbody", { className: "text-[12px] tabular-nums", children: ua ? Array.from({ length: 12 }, (P, xe) => /* @__PURE__ */ e("tr", { className: "border-b border-slate-100 dark:border-slate-800", children: /* @__PURE__ */ e("td", { className: "px-3 py-2", colSpan: _t.length + Un, children: /* @__PURE__ */ e(
29545
29557
  "span",
29546
29558
  {
29547
29559
  className: "cbv-shimmer block h-3.5 rounded",
29548
29560
  style: { width: `${55 + xe * 17 % 40}%` }
29549
29561
  }
29550
- ) }) }, xe)) : Qn.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: _t.length + In, className: "py-16", children: /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2 text-center", children: [
29562
+ ) }) }, xe)) : Qn.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: _t.length + Un, className: "py-16", children: /* @__PURE__ */ a("div", { className: "flex flex-col items-center gap-2 text-center", children: [
29551
29563
  /* @__PURE__ */ e("span", { className: "flex h-10 w-10 items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800", children: /* @__PURE__ */ e(ja, { "aria-hidden": !0, className: "h-4.5 w-4.5 h-5 w-5 text-slate-400" }) }),
29552
29564
  /* @__PURE__ */ e("p", { className: "text-[13.5px] font-medium text-slate-600 dark:text-slate-300", children: "No records match" }),
29553
29565
  /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-400", children: "Try adjusting your search or filters." }),
@@ -29573,7 +29585,7 @@ function G_({
29573
29585
  return _e.has(P.gkey) ? _e.delete(P.gkey) : _e.add(P.gkey), _e;
29574
29586
  }),
29575
29587
  className: "cursor-pointer border-b border-slate-200 bg-slate-50/80 hover:bg-slate-100/80 dark:border-slate-700 dark:bg-muted/40",
29576
- children: /* @__PURE__ */ e("td", { className: "px-3 py-1.5", colSpan: _t.length + In, children: /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 dark:text-slate-200", children: [
29588
+ children: /* @__PURE__ */ e("td", { className: "px-3 py-1.5", colSpan: _t.length + Un, children: /* @__PURE__ */ a("span", { className: "flex items-center gap-1.5 text-[12px] font-medium text-slate-600 dark:text-slate-200", children: [
29577
29589
  at.has(P.gkey) ? /* @__PURE__ */ e(nn, { className: "h-3.5 w-3.5 -rotate-90 text-slate-400" }) : /* @__PURE__ */ e(nn, { className: "h-3.5 w-3.5 text-slate-400" }),
29578
29590
  P.label,
29579
29591
  /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-200/70 px-1.5 text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: P.count })
@@ -29581,7 +29593,7 @@ function G_({
29581
29593
  },
29582
29594
  `__group__${P.gkey}`
29583
29595
  );
29584
- const xe = P.row, we = xe.id, Te = Bt.includes(we), L = (je = Dn == null ? void 0 : Dn.instances) == null ? void 0 : je[String(we)], W = wa[String(we)], te = !Te && W ? Uf(W.color) : void 0, se = Te ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : te ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
29596
+ const xe = P.row, we = xe.id, Te = Bt.includes(we), L = (je = En == null ? void 0 : En.instances) == null ? void 0 : je[String(we)], W = wa[String(we)], te = !Te && W ? Uf(W.color) : void 0, se = Te ? "bg-[#e6fafe] dark:bg-[#0c2a33]" : te ?? "bg-white group-hover:bg-[#f2fcff] dark:bg-slate-900 dark:group-hover:bg-[#0e2d3a]";
29585
29597
  return /* @__PURE__ */ a(
29586
29598
  "tr",
29587
29599
  {
@@ -29599,7 +29611,7 @@ function G_({
29599
29611
  {
29600
29612
  type: "checkbox",
29601
29613
  checked: Te,
29602
- onChange: () => Rn(we),
29614
+ onChange: () => Mn(we),
29603
29615
  "aria-label": `Select ${we}`
29604
29616
  }
29605
29617
  )
@@ -29612,14 +29624,14 @@ function G_({
29612
29624
  return /* @__PURE__ */ e(
29613
29625
  "td",
29614
29626
  {
29615
- style: Bn(_e),
29616
- onContextMenu: (it) => {
29617
- it.preventDefault(), tn({
29618
- x: it.clientX,
29619
- y: it.clientY,
29627
+ style: Ln(_e),
29628
+ onContextMenu: (ot) => {
29629
+ ot.preventDefault(), tn({
29630
+ x: ot.clientX,
29631
+ y: ot.clientY,
29620
29632
  key: _e,
29621
29633
  row: xe,
29622
- cellText: it.currentTarget.innerText.trim()
29634
+ cellText: ot.currentTarget.innerText.trim()
29623
29635
  });
29624
29636
  },
29625
29637
  className: `whitespace-nowrap px-3 py-1.5 ${_a(_e, "z-[1]", se)}`,
@@ -29648,13 +29660,13 @@ function G_({
29648
29660
  return /* @__PURE__ */ e(
29649
29661
  "td",
29650
29662
  {
29651
- style: Bn(_e),
29663
+ style: Ln(_e),
29652
29664
  className: `whitespace-nowrap px-3 py-1 ${_a(_e, "z-[1]", se)}`,
29653
- onClick: (it) => it.stopPropagation(),
29665
+ onClick: (ot) => ot.stopPropagation(),
29654
29666
  children: /* @__PURE__ */ e(
29655
29667
  eu,
29656
29668
  {
29657
- users: (Pn == null ? void 0 : Pn[String(we)]) ?? [],
29669
+ users: (Kn == null ? void 0 : Kn[String(we)]) ?? [],
29658
29670
  showSingleName: !1
29659
29671
  }
29660
29672
  )
@@ -29665,9 +29677,9 @@ function G_({
29665
29677
  return /* @__PURE__ */ e(
29666
29678
  "td",
29667
29679
  {
29668
- style: Bn(_e),
29680
+ style: Ln(_e),
29669
29681
  className: `w-20 whitespace-nowrap px-2 py-1 text-right ${_a(_e, "z-[1]", se)}`,
29670
- onClick: (it) => it.stopPropagation(),
29682
+ onClick: (ot) => ot.stopPropagation(),
29671
29683
  children: /* @__PURE__ */ e(
29672
29684
  Gf,
29673
29685
  {
@@ -29688,29 +29700,29 @@ function G_({
29688
29700
  return /* @__PURE__ */ e(
29689
29701
  "td",
29690
29702
  {
29691
- style: Bn(_e),
29692
- onContextMenu: (it) => {
29693
- it.preventDefault(), tn({
29694
- x: it.clientX,
29695
- y: it.clientY,
29703
+ style: Ln(_e),
29704
+ onContextMenu: (ot) => {
29705
+ ot.preventDefault(), tn({
29706
+ x: ot.clientX,
29707
+ y: ot.clientY,
29696
29708
  key: _e,
29697
29709
  row: xe,
29698
- cellText: it.currentTarget.innerText.trim()
29710
+ cellText: ot.currentTarget.innerText.trim()
29699
29711
  });
29700
29712
  },
29701
29713
  className: `whitespace-nowrap px-3 py-1.5 ${Sl(_e) ? "text-right" : ""} ${_a(_e, "z-[1]", se)}`,
29702
29714
  children: Dr(_e) ? Pl(_e) === "nivaro_users" ? (() => {
29703
- var Pt, Ln, fa;
29704
- const it = _e.includes(".") ? _e : vn[_e], jt = ((fa = (Ln = (Pt = rn == null ? void 0 : rn.rows) == null ? void 0 : Pt[String(we)]) == null ? void 0 : Ln[it]) == null ? void 0 : fa.ids) ?? [], Et = Cr(we, _e) ?? "";
29705
- if (jt.length === 0 || !Et || Et === "—")
29715
+ var Pt, Rn, fa;
29716
+ const ot = _e.includes(".") ? _e : vn[_e], Ft = ((fa = (Rn = (Pt = rn == null ? void 0 : rn.rows) == null ? void 0 : Pt[String(we)]) == null ? void 0 : Rn[ot]) == null ? void 0 : fa.ids) ?? [], Et = Cr(we, _e) ?? "";
29717
+ if (Ft.length === 0 || !Et || Et === "—")
29706
29718
  return /* @__PURE__ */ e("span", { className: "text-[12px] text-slate-300", children: "—" });
29707
- if (jt.length === 1)
29708
- return /* @__PURE__ */ e("span", { onClick: (lr) => lr.stopPropagation(), children: /* @__PURE__ */ e(Us, { userId: String(jt[0]), size: "compact" }) });
29719
+ if (Ft.length === 1)
29720
+ return /* @__PURE__ */ e("span", { onClick: (lr) => lr.stopPropagation(), children: /* @__PURE__ */ e(Us, { userId: String(Ft[0]), size: "compact" }) });
29709
29721
  const sn = Et.split(", ");
29710
29722
  return /* @__PURE__ */ e(
29711
29723
  eu,
29712
29724
  {
29713
- users: jt.map((lr, sa) => ({
29725
+ users: Ft.map((lr, sa) => ({
29714
29726
  id: String(lr),
29715
29727
  name: sn[sa] ?? String(lr)
29716
29728
  })),
@@ -29721,8 +29733,8 @@ function G_({
29721
29733
  "button",
29722
29734
  {
29723
29735
  type: "button",
29724
- onClick: (it) => {
29725
- it.stopPropagation(), de.push([{ collection: Be.target, itemId: Be.id }]);
29736
+ onClick: (ot) => {
29737
+ ot.stopPropagation(), de.push([{ collection: Be.target, itemId: Be.id }]);
29726
29738
  },
29727
29739
  "data-tip": Cr(we, _e) ?? void 0,
29728
29740
  className: "block max-w-[260px] truncate text-left text-[12px] font-medium text-slate-700 underline decoration-slate-300 underline-offset-2 transition-colors hover:text-[#0284c7] hover:decoration-[#0284c7] dark:text-slate-200 dark:decoration-slate-600 dark:hover:text-[#38bdf8]",
@@ -29735,12 +29747,12 @@ function G_({
29735
29747
  "data-tip": Cr(we, _e) ?? void 0,
29736
29748
  children: Cr(we, _e) != null ? ra(Cr(we, _e) ?? "", _e) : /* @__PURE__ */ e("span", { className: "inline-block h-3.5 w-16 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
29737
29749
  }
29738
- ) : (yt == null ? void 0 : yt.one_collection) === "nivaro_users" && xe[_e] != null ? /* @__PURE__ */ e("span", { onClick: (it) => it.stopPropagation(), children: /* @__PURE__ */ e(Us, { userId: String(xe[_e]), size: "compact" }) }) : yt != null && yt.one_collection && xe[_e] != null && !Ll(yt.one_collection) ? /* @__PURE__ */ e(
29750
+ ) : (yt == null ? void 0 : yt.one_collection) === "nivaro_users" && xe[_e] != null ? /* @__PURE__ */ e("span", { onClick: (ot) => ot.stopPropagation(), children: /* @__PURE__ */ e(Us, { userId: String(xe[_e]), size: "compact" }) }) : yt != null && yt.one_collection && xe[_e] != null && !Ll(yt.one_collection) ? /* @__PURE__ */ e(
29739
29751
  "button",
29740
29752
  {
29741
29753
  type: "button",
29742
- onClick: (it) => {
29743
- it.stopPropagation(), de.push([
29754
+ onClick: (ot) => {
29755
+ ot.stopPropagation(), de.push([
29744
29756
  {
29745
29757
  collection: yt.one_collection,
29746
29758
  itemId: String(xe[_e])
@@ -29970,8 +29982,8 @@ function Oi({
29970
29982
  l && "bg-nvr-cyan/5 ring-1 ring-inset ring-nvr-cyan dark:bg-nvr-cyan/10",
29971
29983
  !l && !s && n === 0 && "opacity-50"
29972
29984
  ),
29973
- children: s ? /* @__PURE__ */ e(ir, { className: "h-5 w-16 rounded" }) : /* @__PURE__ */ a(dt, { children: [
29974
- /* @__PURE__ */ e("span", { className: "flex items-baseline gap-1 text-[15px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: r != null ? /* @__PURE__ */ a(dt, { children: [
29985
+ children: s ? /* @__PURE__ */ e(ir, { className: "h-5 w-16 rounded" }) : /* @__PURE__ */ a(it, { children: [
29986
+ /* @__PURE__ */ e("span", { className: "flex items-baseline gap-1 text-[15px] font-semibold leading-none tabular-nums text-slate-900 dark:text-foreground", children: r != null ? /* @__PURE__ */ a(it, { children: [
29975
29987
  /* @__PURE__ */ e("span", { className: "text-nvr-navy dark:text-nvr-cyan", children: an(r) }),
29976
29988
  /* @__PURE__ */ a("span", { className: "text-[11px] font-medium text-slate-400", children: [
29977
29989
  "/ ",
@@ -30032,7 +30044,7 @@ function Hk({
30032
30044
  }
30033
30045
  ),
30034
30046
  t,
30035
- /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-900 dark:text-foreground", children: r != null ? /* @__PURE__ */ a(dt, { children: [
30047
+ /* @__PURE__ */ e("span", { className: "font-semibold tabular-nums text-slate-900 dark:text-foreground", children: r != null ? /* @__PURE__ */ a(it, { children: [
30036
30048
  /* @__PURE__ */ e("span", { className: "text-nvr-navy dark:text-nvr-cyan", children: an(r) }),
30037
30049
  /* @__PURE__ */ a("span", { className: "font-normal text-slate-400", children: [
30038
30050
  " / ",
@@ -30098,7 +30110,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30098
30110
  }
30099
30111
  (async () => {
30100
30112
  const Fe = {}, Ye = {}, kt = async (zt, Ht) => {
30101
- const Rn = await s.request(
30113
+ const Mn = await s.request(
30102
30114
  he(`/items/${zt.target_collection}`, {
30103
30115
  filter: JSON.stringify({ id: { _in: Ht } }),
30104
30116
  fields: `id,${zt.display_field}`,
@@ -30106,25 +30118,25 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30106
30118
  })
30107
30119
  );
30108
30120
  return [...new Set(
30109
- (Rn.data ?? []).map((Cn) => String(Cn[zt.display_field] ?? "")).filter(Boolean)
30121
+ (Mn.data ?? []).map((Cn) => String(Cn[zt.display_field] ?? "")).filter(Boolean)
30110
30122
  )];
30111
30123
  };
30112
30124
  for (const zt of K) {
30113
30125
  const Ht = Bs(O, { collection: zt.target_collection });
30114
30126
  if (!Ht) continue;
30115
- const Rn = `extra.${zt.path}`;
30127
+ const Mn = `extra.${zt.path}`;
30116
30128
  try {
30117
30129
  const Cn = O.restricted[Ht.name] ?? [];
30118
30130
  if (Cn.length > 0) {
30119
30131
  const Yn = await kt(zt, Cn);
30120
- Yn.length > 0 && (Ye[Rn.slice(6)] = Yn);
30132
+ Yn.length > 0 && (Ye[Mn.slice(6)] = Yn);
30121
30133
  }
30122
30134
  const wn = ho(O, Ht.name);
30123
30135
  if (wn.length === 0) continue;
30124
- const Sn = h[Rn];
30136
+ const Sn = h[Mn];
30125
30137
  if (Sn && (Array.isArray(Sn) ? Sn.length > 0 : Sn !== "")) continue;
30126
- const In = wn.length ? await kt(zt, wn) : [];
30127
- In.length > 0 && (Fe[Rn] = In);
30138
+ const Un = wn.length ? await kt(zt, wn) : [];
30139
+ Un.length > 0 && (Fe[Mn] = Un);
30128
30140
  } catch {
30129
30141
  }
30130
30142
  }
@@ -30230,10 +30242,10 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30230
30242
  const kt = (await s.request(he(`/pipelines/instance/${K.collection}/${K.item_id}`))).data;
30231
30243
  if (!kt || kt.states.length === 0)
30232
30244
  throw new Error("This item has no workflow instance");
30233
- const zt = kt.states.find((Rn) => Rn.key === Fe);
30245
+ const zt = kt.states.find((Mn) => Mn.key === Fe);
30234
30246
  if (!zt) throw new Error("Target state not found");
30235
30247
  const Ht = kt.available_transitions.find(
30236
- (Rn) => Rn.to_state === zt.id
30248
+ (Mn) => Mn.to_state === zt.id
30237
30249
  );
30238
30250
  if (!Ht) throw new Error("No transition available to move this item here");
30239
30251
  await s.request(
@@ -30274,7 +30286,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30274
30286
  queryKey: ["queue-column-prefs", t],
30275
30287
  queryFn: () => s.request(he(`/queues/${t}/column-prefs`)),
30276
30288
  enabled: !!t
30277
- }), [Ft, It] = q(null), [St, tn] = q(null);
30289
+ }), [jt, It] = q(null), [St, tn] = q(null);
30278
30290
  Ve(() => {
30279
30291
  Zt && tn(Zt.data.default_view_id);
30280
30292
  }, [Zt]);
@@ -30290,14 +30302,14 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30290
30302
  queryFn: () => s.request(he(`/queues/${t}/trends`, { days: 14 })),
30291
30303
  enabled: !!t,
30292
30304
  staleTime: 300 * 1e3
30293
- }), { data: ot } = ge({
30305
+ }), { data: dt } = ge({
30294
30306
  queryKey: ["queue-trends", t, "mine"],
30295
30307
  queryFn: () => s.request(he(`/queues/${t}/trends`, { days: 14, scope: "mine" })),
30296
30308
  enabled: !!t && u === "mine",
30297
30309
  staleTime: 300 * 1e3
30298
30310
  });
30299
30311
  function Dt(K) {
30300
- const Ye = (u === "all" ? lt == null ? void 0 : lt.data : u === "mine" ? ot == null ? void 0 : ot.data : void 0) ?? [];
30312
+ const Ye = (u === "all" ? lt == null ? void 0 : lt.data : u === "mine" ? dt == null ? void 0 : dt.data : void 0) ?? [];
30301
30313
  if (Ye.length === 0) return {};
30302
30314
  const kt = Ye.map((Ht) => Ht[K]), zt = Ye[Ye.length - 1];
30303
30315
  return { trend: kt, delta: ((Qe == null ? void 0 : Qe[K]) ?? 0) - zt[K] };
@@ -30321,7 +30333,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30321
30333
  ).then((Fe) => Fe.data),
30322
30334
  staleTime: 300 * 1e3
30323
30335
  }))
30324
- }), Mn = (K) => K.replace(/_/g, " ").replace(/\b\w/g, (Fe) => Fe.toUpperCase()), En = Se(() => {
30336
+ }), Dn = (K) => K.replace(/_/g, " ").replace(/\b\w/g, (Fe) => Fe.toUpperCase()), Pn = Se(() => {
30325
30337
  const K = {};
30326
30338
  for (const Fe of An)
30327
30339
  (Fe.data ?? []).forEach((Ye, kt) => {
@@ -30331,15 +30343,15 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30331
30343
  }, [An.map((K) => K.data)]), Fn = Qe ? Object.entries(Qe.by_state).sort(
30332
30344
  (K, Fe) => {
30333
30345
  var Ye, kt;
30334
- return (((Ye = En[K[0]]) == null ? void 0 : Ye.sort) ?? Number.MAX_SAFE_INTEGER) - (((kt = En[Fe[0]]) == null ? void 0 : kt.sort) ?? Number.MAX_SAFE_INTEGER);
30346
+ return (((Ye = Pn[K[0]]) == null ? void 0 : Ye.sort) ?? Number.MAX_SAFE_INTEGER) - (((kt = Pn[Fe[0]]) == null ? void 0 : kt.sort) ?? Number.MAX_SAFE_INTEGER);
30335
30347
  }
30336
30348
  ) : [], ie = Se(() => {
30337
30349
  const K = {};
30338
- for (const [Fe, Ye] of Object.entries(En)) K[Fe] = Ye.label;
30350
+ for (const [Fe, Ye] of Object.entries(Pn)) K[Fe] = Ye.label;
30339
30351
  return K;
30340
- }, [En]), De = (K) => K ? K === "none" ? "No State" : ie[K] ?? Mn(K) : "—", Ke = (K) => {
30352
+ }, [Pn]), De = (K) => K ? K === "none" ? "No State" : ie[K] ?? Dn(K) : "—", Ke = (K) => {
30341
30353
  const Fe = (dn ?? []).find((Ye) => Ye.collection === K);
30342
- return (Fe == null ? void 0 : Fe.display_name) || (Fe == null ? void 0 : Fe.plural) || Mn(K);
30354
+ return (Fe == null ? void 0 : Fe.display_name) || (Fe == null ? void 0 : Fe.plural) || Dn(K);
30343
30355
  }, Je = Se(() => k ? If(ae, k) : null, [ae, k]);
30344
30356
  Ve(() => {
30345
30357
  !k || !Je || S(ae.length > 200 ? new Set(Je.map((K) => K.key)) : /* @__PURE__ */ new Set());
@@ -30458,7 +30470,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30458
30470
  sort: N,
30459
30471
  group_by: k,
30460
30472
  view: w,
30461
- columns: Ft,
30473
+ columns: jt,
30462
30474
  pins: D
30463
30475
  }
30464
30476
  })
@@ -30476,7 +30488,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30476
30488
  sort: N,
30477
30489
  group_by: k,
30478
30490
  view: w,
30479
- columns: Ft,
30491
+ columns: jt,
30480
30492
  pins: D
30481
30493
  }
30482
30494
  })
@@ -30504,9 +30516,9 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30504
30516
  }
30505
30517
  }), [nr, Rr] = q([]), [Qn, ur] = q(!1);
30506
30518
  async function ea(K, Fe) {
30507
- const Ye = ae.filter((Rn) => nr.includes(Ae(Rn)));
30519
+ const Ye = ae.filter((Mn) => nr.includes(Ae(Mn)));
30508
30520
  ur(!0);
30509
- const kt = await Promise.allSettled(Ye.map(Fe)), zt = kt.filter((Rn) => Rn.status === "fulfilled").length, Ht = kt.length - zt;
30521
+ const kt = await Promise.allSettled(Ye.map(Fe)), zt = kt.filter((Mn) => Mn.status === "fulfilled").length, Ht = kt.length - zt;
30510
30522
  ur(!1), Rr([]), l.invalidateQueries({ queryKey: ["queue-items", t] }), Ht ? mt.warning(`${K}: ${zt} succeeded, ${Ht} failed`) : mt.success(`${K}: ${zt} succeeded`);
30511
30523
  }
30512
30524
  const La = (K) => {
@@ -30527,7 +30539,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30527
30539
  }, wa = Je == null ? void 0 : Je.map((K) => ({
30528
30540
  key: K.key,
30529
30541
  rows: K.rows,
30530
- header: /* @__PURE__ */ a(dt, { children: [
30542
+ header: /* @__PURE__ */ a(it, { children: [
30531
30543
  /* @__PURE__ */ e("span", { children: Ra(K.key) }),
30532
30544
  /* @__PURE__ */ a("span", { className: "font-normal text-slate-400", children: [
30533
30545
  "(",
@@ -30543,7 +30555,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30543
30555
  " at risk"
30544
30556
  ] })
30545
30557
  ] })
30546
- })), Mr = (((Cl = be == null ? void 0 : be.available_values.collection) == null ? void 0 : Cl.length) ?? 0) > 1, Dn = [
30558
+ })), Mr = (((Cl = be == null ? void 0 : be.available_values.collection) == null ? void 0 : Cl.length) ?? 0) > 1, En = [
30547
30559
  ...Mr ? [
30548
30560
  {
30549
30561
  key: "collection",
@@ -30635,7 +30647,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30635
30647
  children: "Claim"
30636
30648
  }
30637
30649
  )
30638
- }, rr = (_ == null ? void 0 : _.available_extra_fields) ?? [], Ma = vd("drill.queue"), Pn = Ma.value, Sr = (K) => Ma.push([K]), ta = (K) => {
30650
+ }, rr = (_ == null ? void 0 : _.available_extra_fields) ?? [], Ma = vd("drill.queue"), Kn = Ma.value, Sr = (K) => Ma.push([K]), ta = (K) => {
30639
30651
  var Fe;
30640
30652
  for (const Ye of (_ == null ? void 0 : _.sources) ?? []) {
30641
30653
  const kt = (Fe = Ye.drilldown) == null ? void 0 : Fe[K];
@@ -30671,10 +30683,10 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30671
30683
  header: le(`extra.${K}`, Do(K)),
30672
30684
  sortable: !0,
30673
30685
  render: (Fe) => {
30674
- var In, Yn;
30675
- const Ye = (In = Fe.extra) == null ? void 0 : In[K];
30686
+ var Un, Yn;
30687
+ const Ye = (Un = Fe.extra) == null ? void 0 : Un[K];
30676
30688
  if (Ye == null || Ye === "") return /* @__PURE__ */ e("span", { className: "text-slate-300", children: "—" });
30677
- const kt = La(K), zt = kt ? qs(String(Ye), kt) : String(Ye), { text: Ht, title: Rn } = Pl(zt), Cn = ((_ == null ? void 0 : _.extra_field_meta) ?? []).find((la) => la.path === K), wn = ((Yn = Fe.extra_ids) == null ? void 0 : Yn[K]) ?? [], Sn = ta(K);
30689
+ const kt = La(K), zt = kt ? qs(String(Ye), kt) : String(Ye), { text: Ht, title: Mn } = Pl(zt), Cn = ((_ == null ? void 0 : _.extra_field_meta) ?? []).find((la) => la.path === K), wn = ((Yn = Fe.extra_ids) == null ? void 0 : Yn[K]) ?? [], Sn = ta(K);
30678
30690
  return (Cn == null ? void 0 : Cn.kind) === "relation" && Cn.target_collection && wn.length > 0 && Sn.enabled && !Cn.aggregate ? /* @__PURE__ */ e(
30679
30691
  "button",
30680
30692
  {
@@ -30688,11 +30700,11 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30688
30700
  title: zt
30689
30701
  });
30690
30702
  },
30691
- title: Rn,
30703
+ title: Mn,
30692
30704
  className: "block max-w-[200px] truncate text-left text-[12px] text-slate-700 underline decoration-slate-300 decoration-dotted underline-offset-2 hover:text-nvr-navy hover:decoration-nvr-cyan dark:text-slate-200 dark:hover:text-nvr-cyan",
30693
30705
  children: Ht
30694
30706
  }
30695
- ) : /* @__PURE__ */ e("span", { className: "block max-w-[200px] truncate text-[12px]", title: Rn, children: Ht });
30707
+ ) : /* @__PURE__ */ e("span", { className: "block max-w-[200px] truncate text-[12px]", title: Mn, children: Ht });
30696
30708
  }
30697
30709
  })), Dr = [
30698
30710
  ...Mr ? ["collection"] : [],
@@ -30710,9 +30722,9 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30710
30722
  "sla_status",
30711
30723
  "at_risk",
30712
30724
  ...rr.slice(0, 2).map((K) => `extra.${K}`)
30713
- ], jn = (ee == null ? void 0 : ee.default_columns) ?? null, Kn = Ft ?? jn, na = new Set(Kn ?? $r), Hn = [
30714
- ...(Kn ?? []).filter((K) => Dr.includes(K)),
30715
- ...Dr.filter((K) => !(Kn ?? []).includes(K))
30725
+ ], jn = (ee == null ? void 0 : ee.default_columns) ?? null, In = jt ?? jn, na = new Set(In ?? $r), Hn = [
30726
+ ...(In ?? []).filter((K) => Dr.includes(K)),
30727
+ ...Dr.filter((K) => !(In ?? []).includes(K))
30716
30728
  ], bs = j0(Qc(A0, { activationConstraint: { distance: 4 } }));
30717
30729
  function _l(K) {
30718
30730
  const { active: Fe, over: Ye } = K;
@@ -30722,7 +30734,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30722
30734
  Fx(Hn, kt, zt).filter((Ht) => na.has(Ht))
30723
30735
  );
30724
30736
  }
30725
- const Sl = Dn.find((K) => K.key === "label"), ra = [...Dn, ...Jn], qr = {
30737
+ const Sl = En.find((K) => K.key === "label"), ra = [...En, ...Jn], qr = {
30726
30738
  key: "__actions__",
30727
30739
  header: "",
30728
30740
  render: (K) => K.collection === "tasks" ? null : /* @__PURE__ */ e("span", { onClick: (Fe) => Fe.stopPropagation(), children: /* @__PURE__ */ e(
@@ -30770,12 +30782,12 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30770
30782
  Fe.trim() && (Ye.filter = JSON.stringify({ [K.display_field]: { _contains: Fe.trim() } }));
30771
30783
  const zt = (await s.request(
30772
30784
  he(`/items/${K.target_collection}`, Ye)
30773
- )).data ?? [], Ht = La(K.path), Rn = X[K.path] ? new Set(X[K.path]) : null, Cn = /* @__PURE__ */ new Set(), wn = [];
30785
+ )).data ?? [], Ht = La(K.path), Mn = X[K.path] ? new Set(X[K.path]) : null, Cn = /* @__PURE__ */ new Set(), wn = [];
30774
30786
  for (const Sn of zt) {
30775
- const In = Sn[K.display_field];
30776
- if (In == null || In === "") continue;
30777
- const Yn = String(In);
30778
- Cn.has(Yn) || Rn && !Rn.has(Yn) || (Cn.add(Yn), wn.push({ label: Ht ? qs(Yn, Ht) : Yn, value: Yn }));
30787
+ const Un = Sn[K.display_field];
30788
+ if (Un == null || Un === "") continue;
30789
+ const Yn = String(Un);
30790
+ Cn.has(Yn) || Mn && !Mn.has(Yn) || (Cn.add(Yn), wn.push({ label: Ht ? qs(Yn, Ht) : Yn, value: Yn }));
30779
30791
  }
30780
30792
  return wn;
30781
30793
  }, Xa = new Map(((_ == null ? void 0 : _.extra_field_meta) ?? []).map((K) => [K.path, K])), Vr = (K, Fe) => {
@@ -30965,7 +30977,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
30965
30977
  label: De(K),
30966
30978
  count: Fe,
30967
30979
  filteredCount: Bt ? Bt.by_state[K] ?? 0 : null,
30968
- color: ((Ye = En[K]) == null ? void 0 : Ye.color) ?? null,
30980
+ color: ((Ye = Pn[K]) == null ? void 0 : Ye.color) ?? null,
30969
30981
  active: fe.includes(K),
30970
30982
  onClick: () => ve(K)
30971
30983
  },
@@ -31412,7 +31424,7 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
31412
31424
  ] })
31413
31425
  ] })
31414
31426
  ] }),
31415
- /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto px-6 pb-6", children: w === "table" ? /* @__PURE__ */ a(dt, { children: [
31427
+ /* @__PURE__ */ e("div", { className: "flex min-h-0 flex-1 flex-col overflow-y-auto px-6 pb-6", children: w === "table" ? /* @__PURE__ */ a(it, { children: [
31416
31428
  !Ie && Me > 0 && /* @__PURE__ */ a("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", children: [
31417
31429
  Da.filter((K) => !ue(h[K.key])).map((K) => /* @__PURE__ */ a(
31418
31430
  "span",
@@ -31615,19 +31627,19 @@ function Y_({ queueId: t, realtime: n, renderError: r }) {
31615
31627
  onClear: () => Rr([])
31616
31628
  }
31617
31629
  ),
31618
- Pn != null && Pn.length ? /* @__PURE__ */ e(
31630
+ Kn != null && Kn.length ? /* @__PURE__ */ e(
31619
31631
  qd,
31620
31632
  {
31621
- collection: Pn[0].collection,
31622
- itemId: Pn[0].itemId,
31623
- layoutId: Pn[0].layoutId,
31624
- rootLayoutSlug: Pn[0].rootLayoutSlug,
31625
- width: Pn[0].width,
31626
- title: Pn[0].title,
31627
- stack: Pn,
31628
- onPush: (K) => Ma.push([...Pn, K]),
31633
+ collection: Kn[0].collection,
31634
+ itemId: Kn[0].itemId,
31635
+ layoutId: Kn[0].layoutId,
31636
+ rootLayoutSlug: Kn[0].rootLayoutSlug,
31637
+ width: Kn[0].width,
31638
+ title: Kn[0].title,
31639
+ stack: Kn,
31640
+ onPush: (K) => Ma.push([...Kn, K]),
31629
31641
  onPop: () => Ma.back(),
31630
- onClose: () => Ma.back(Pn.length)
31642
+ onClose: () => Ma.back(Kn.length)
31631
31643
  }
31632
31644
  ) : null,
31633
31645
  /* @__PURE__ */ e(
@@ -32008,7 +32020,7 @@ function nw({
32008
32020
  )
32009
32021
  ] })
32010
32022
  ] }),
32011
- t.type === "table" && /* @__PURE__ */ a(dt, { children: [
32023
+ t.type === "table" && /* @__PURE__ */ a(it, { children: [
32012
32024
  /* @__PURE__ */ a("label", { className: "block space-y-1", children: [
32013
32025
  /* @__PURE__ */ e("span", { className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300", children: "Columns (comma-separated fields)" }),
32014
32026
  /* @__PURE__ */ e(
@@ -32056,7 +32068,7 @@ function nw({
32056
32068
  )
32057
32069
  ] })
32058
32070
  ] }),
32059
- t.type === "calc" && /* @__PURE__ */ a(dt, { children: [
32071
+ t.type === "calc" && /* @__PURE__ */ a(it, { children: [
32060
32072
  /* @__PURE__ */ a("label", { className: "block space-y-1", children: [
32061
32073
  /* @__PURE__ */ e("span", { className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300", children: "Formula" }),
32062
32074
  /* @__PURE__ */ e(
@@ -32119,7 +32131,7 @@ function nw({
32119
32131
  /* @__PURE__ */ e("p", { className: "text-[10.5px] text-amber-600 dark:text-amber-400", children: "Save before previewing — calc widgets resolve against saved siblings." })
32120
32132
  ] })
32121
32133
  ] }),
32122
- t.type === "query" && /* @__PURE__ */ a(dt, { children: [
32134
+ t.type === "query" && /* @__PURE__ */ a(it, { children: [
32123
32135
  /* @__PURE__ */ a("label", { className: "block space-y-1", children: [
32124
32136
  /* @__PURE__ */ e("span", { className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300", children: "Query slug" }),
32125
32137
  /* @__PURE__ */ e(
@@ -32180,7 +32192,7 @@ function nw({
32180
32192
  ),
32181
32193
  "Shade the typical range from the prior 4 periods"
32182
32194
  ] }),
32183
- t.type === "narrative" && /* @__PURE__ */ a(dt, { children: [
32195
+ t.type === "narrative" && /* @__PURE__ */ a(it, { children: [
32184
32196
  /* @__PURE__ */ a("label", { className: "block space-y-1", children: [
32185
32197
  /* @__PURE__ */ a("span", { className: "text-[11.5px] font-medium text-slate-600 dark:text-slate-300", children: [
32186
32198
  "Text (",
@@ -32994,7 +33006,7 @@ function fw({
32994
33006
  layout: T ? "vertical" : "horizontal",
32995
33007
  margin: { top: 6, right: 8, left: T ? 30 : -6, bottom: 0 },
32996
33008
  children: [
32997
- T ? /* @__PURE__ */ a(dt, { children: [
33009
+ T ? /* @__PURE__ */ a(it, { children: [
32998
33010
  /* @__PURE__ */ e(
32999
33011
  di,
33000
33012
  {
@@ -33014,7 +33026,7 @@ function fw({
33014
33026
  width: 120
33015
33027
  }
33016
33028
  )
33017
- ] }) : /* @__PURE__ */ a(dt, { children: [
33029
+ ] }) : /* @__PURE__ */ a(it, { children: [
33018
33030
  /* @__PURE__ */ e(
33019
33031
  di,
33020
33032
  {
@@ -33711,27 +33723,27 @@ const Up = S0(function({
33711
33723
  )
33712
33724
  ] }, Me.dim)) });
33713
33725
  } else if (r.type === "table") {
33714
- const Ee = z.rows ?? [], Me = (V = r.config) != null && V.columns && r.config.columns.length > 0 ? r.config.columns.map((Ft) => typeof Ft == "string" ? { field: Ft } : Ft) : Ee[0] ? Object.keys(Ee[0]).filter((Ft) => Ft !== "id").map((Ft) => ({ field: Ft })) : [], be = Me.map((Ft) => Ft.field), st = (Ft) => Me.find((It) => It.field === Ft), at = ((de = r.config) == null ? void 0 : de.format_rules) ?? [], wt = (Ft) => {
33726
+ const Ee = z.rows ?? [], Me = (V = r.config) != null && V.columns && r.config.columns.length > 0 ? r.config.columns.map((jt) => typeof jt == "string" ? { field: jt } : jt) : Ee[0] ? Object.keys(Ee[0]).filter((jt) => jt !== "id").map((jt) => ({ field: jt })) : [], be = Me.map((jt) => jt.field), st = (jt) => Me.find((It) => It.field === jt), at = ((de = r.config) == null ? void 0 : de.format_rules) ?? [], wt = (jt) => {
33715
33727
  var It;
33716
33728
  for (const St of at)
33717
- if ((St.scope ?? "cell") === "row" && Ip(St, Ft[St.field]))
33729
+ if ((St.scope ?? "cell") === "row" && Ip(St, jt[St.field]))
33718
33730
  return ((It = Kp[St.color]) == null ? void 0 : It.row) ?? null;
33719
33731
  return null;
33720
- }, Ot = (Ft, It) => {
33732
+ }, Ot = (jt, It) => {
33721
33733
  var St;
33722
33734
  for (const tn of at)
33723
- if ((tn.scope ?? "cell") === "cell" && tn.field === It && Ip(tn, Ft[It]))
33735
+ if ((tn.scope ?? "cell") === "cell" && tn.field === It && Ip(tn, jt[It]))
33724
33736
  return ((St = Kp[tn.color]) == null ? void 0 : St.cell) ?? null;
33725
33737
  return null;
33726
- }, gt = N.trim().toLowerCase(), nt = gt ? Ee.filter((Ft) => Object.values(Ft).some((It) => String(It ?? "").toLowerCase().includes(gt))) : Ee, Xe = 12, $t = Math.max(1, Math.ceil(nt.length / Xe)), xt = Math.min(h, $t - 1), Zt = nt.length > Xe ? nt.slice(xt * Xe, xt * Xe + Xe) : nt;
33738
+ }, gt = N.trim().toLowerCase(), nt = gt ? Ee.filter((jt) => Object.values(jt).some((It) => String(It ?? "").toLowerCase().includes(gt))) : Ee, Xe = 12, $t = Math.max(1, Math.ceil(nt.length / Xe)), xt = Math.min(h, $t - 1), Zt = nt.length > Xe ? nt.slice(xt * Xe, xt * Xe + Xe) : nt;
33727
33739
  ee = Ee.length === 0 ? /* @__PURE__ */ e("p", { className: "px-1 text-[12px] text-slate-400", children: "No rows." }) : /* @__PURE__ */ a("div", { className: "flex min-h-0 flex-1 flex-col", children: [
33728
33740
  Ee.length > Xe && /* @__PURE__ */ a("div", { className: "mb-1 flex items-center gap-2", children: [
33729
33741
  /* @__PURE__ */ e(
33730
33742
  "input",
33731
33743
  {
33732
33744
  value: N,
33733
- onChange: (Ft) => {
33734
- x(Ft.target.value), F(0);
33745
+ onChange: (jt) => {
33746
+ x(jt.target.value), F(0);
33735
33747
  },
33736
33748
  placeholder: "Search rows…",
33737
33749
  className: "h-6 w-40 rounded border border-slate-200 bg-white px-1.5 text-[11px] dark:border-border dark:bg-card dark:text-slate-200"
@@ -33746,26 +33758,26 @@ const Up = S0(function({
33746
33758
  ] })
33747
33759
  ] }),
33748
33760
  /* @__PURE__ */ e("div", { className: "min-h-0 flex-1 overflow-auto", children: /* @__PURE__ */ a("table", { className: "w-full text-[11.5px]", children: [
33749
- /* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: be.map((Ft) => {
33761
+ /* @__PURE__ */ e("thead", { className: "sticky top-0 bg-white dark:bg-card", children: /* @__PURE__ */ e("tr", { children: be.map((jt) => {
33750
33762
  var It;
33751
33763
  return /* @__PURE__ */ e(
33752
33764
  "th",
33753
33765
  {
33754
33766
  className: "border-b border-slate-100 px-1.5 py-1 text-left font-medium text-slate-400 dark:border-border",
33755
- children: ((It = st(Ft)) == null ? void 0 : It.label) ?? Ft
33767
+ children: ((It = st(jt)) == null ? void 0 : It.label) ?? jt
33756
33768
  },
33757
- Ft
33769
+ jt
33758
33770
  );
33759
33771
  }) }) }),
33760
- /* @__PURE__ */ e("tbody", { children: Zt.map((Ft) => /* @__PURE__ */ e(
33772
+ /* @__PURE__ */ e("tbody", { children: Zt.map((jt) => /* @__PURE__ */ e(
33761
33773
  "tr",
33762
33774
  {
33763
33775
  className: Q(
33764
- wt(Ft),
33765
- r.collection && Ft.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
33776
+ wt(jt),
33777
+ r.collection && jt.id != null && "cursor-pointer hover:bg-slate-50 dark:hover:bg-muted/60"
33766
33778
  ),
33767
33779
  onClick: () => {
33768
- r.collection && Ft.id != null && (o == null || o({ collection: r.collection, itemId: String(Ft.id) }));
33780
+ r.collection && jt.id != null && (o == null || o({ collection: r.collection, itemId: String(jt.id) }));
33769
33781
  },
33770
33782
  children: be.map((It) => {
33771
33783
  var St, tn, ae, Qe;
@@ -33774,16 +33786,16 @@ const Up = S0(function({
33774
33786
  {
33775
33787
  className: Q(
33776
33788
  "max-w-[180px] truncate border-b border-slate-50 px-1.5 py-1 text-slate-700 dark:border-border/40 dark:text-slate-300",
33777
- (typeof Ft[It] == "number" || Cs.has(((St = st(It)) == null ? void 0 : St.format) ?? "")) && "text-right tabular-nums",
33778
- Ot(Ft, It)
33789
+ (typeof jt[It] == "number" || Cs.has(((St = st(It)) == null ? void 0 : St.format) ?? "")) && "text-right tabular-nums",
33790
+ Ot(jt, It)
33779
33791
  ),
33780
- children: (tn = st(It)) != null && tn.format ? ni(Ft[It], (ae = st(It)) == null ? void 0 : ae.format, (Qe = st(It)) == null ? void 0 : Qe.decimals) : String(Ft[It] ?? "")
33792
+ children: (tn = st(It)) != null && tn.format ? ni(jt[It], (ae = st(It)) == null ? void 0 : ae.format, (Qe = st(It)) == null ? void 0 : Qe.decimals) : String(jt[It] ?? "")
33781
33793
  },
33782
33794
  It
33783
33795
  );
33784
33796
  })
33785
33797
  },
33786
- String(Ft.id)
33798
+ String(jt.id)
33787
33799
  )) })
33788
33800
  ] }) })
33789
33801
  ] });
@@ -33969,7 +33981,7 @@ const Up = S0(function({
33969
33981
  layout: gt ? "vertical" : "horizontal",
33970
33982
  margin: { top: 6, right: 8, left: gt ? 30 : -10, bottom: 0 },
33971
33983
  children: [
33972
- gt ? /* @__PURE__ */ a(dt, { children: [
33984
+ gt ? /* @__PURE__ */ a(it, { children: [
33973
33985
  /* @__PURE__ */ e(di, { type: "number", tick: { fontSize: 10 }, stroke: "#94a3b8" }),
33974
33986
  /* @__PURE__ */ e(
33975
33987
  Jl,
@@ -33981,7 +33993,7 @@ const Up = S0(function({
33981
33993
  width: 90
33982
33994
  }
33983
33995
  )
33984
- ] }) : /* @__PURE__ */ a(dt, { children: [
33996
+ ] }) : /* @__PURE__ */ a(it, { children: [
33985
33997
  /* @__PURE__ */ e(
33986
33998
  di,
33987
33999
  {
@@ -34419,12 +34431,12 @@ function X_({
34419
34431
  if (Ct < 0 || qt < 0 || qt >= ft.length) return ft;
34420
34432
  const Jt = ft[Ct], en = ft[qt];
34421
34433
  return ft[Ct] = { ...en, x: Jt.x, y: Jt.y }, ft[qt] = { ...Jt, x: en.x, y: en.y }, ft;
34422
- }), [xt, Zt] = q(""), [Ft, It] = q(!1), [St, tn] = q(null), { data: ae, isLoading: Qe } = ge({
34434
+ }), [xt, Zt] = q(""), [jt, It] = q(!1), [St, tn] = q(null), { data: ae, isLoading: Qe } = ge({
34423
34435
  queryKey: ["nivaro-report", t],
34424
34436
  queryFn: () => u.request(lx(t)).then((me) => me.data),
34425
34437
  staleTime: 3e4
34426
- }), Bt = Ge(null), Le = Ge([]), lt = ((Ke = ae == null ? void 0 : ae.global_filters) == null ? void 0 : Ke.date_range) ?? null, ot = Se(() => y !== void 0 ? y : r !== void 0 ? r : lt, [y, r, lt]);
34427
- Bt.current = ot ?? null, Le.current = v;
34438
+ }), Bt = Ge(null), Le = Ge([]), lt = ((Ke = ae == null ? void 0 : ae.global_filters) == null ? void 0 : Ke.date_range) ?? null, dt = Se(() => y !== void 0 ? y : r !== void 0 ? r : lt, [y, r, lt]);
34439
+ Bt.current = dt ?? null, Le.current = v;
34428
34440
  const Dt = Se(
34429
34441
  () => {
34430
34442
  var me;
@@ -34474,7 +34486,7 @@ function X_({
34474
34486
  })();
34475
34487
  }
34476
34488
  }, [S, b, ae, g, Dt]);
34477
- const ln = (ae == null ? void 0 : ae.widgets) ?? [], dn = x !== void 0 ? x : ot, An = v.filter((me) => me.values.length > 0).length + (ot ? 1 : 0), Mn = JSON.stringify(F) !== JSON.stringify(v) || x !== void 0, En = () => {
34489
+ const ln = (ae == null ? void 0 : ae.widgets) ?? [], dn = x !== void 0 ? x : dt, An = v.filter((me) => me.values.length > 0).length + (dt ? 1 : 0), Dn = JSON.stringify(F) !== JSON.stringify(v) || x !== void 0, Pn = () => {
34478
34490
  N(F), x !== void 0 && (w(x), h(void 0));
34479
34491
  }, Fn = () => {
34480
34492
  k([]), N([]), w(null), h(void 0);
@@ -34483,7 +34495,7 @@ function X_({
34483
34495
  }, De = async () => {
34484
34496
  var Ue, Ae;
34485
34497
  const me = xt.trim();
34486
- if (!(!me || Ft)) {
34498
+ if (!(!me || jt)) {
34487
34499
  It(!0), tn(null);
34488
34500
  try {
34489
34501
  const ft = await u.request(
@@ -34545,11 +34557,11 @@ function X_({
34545
34557
  "button",
34546
34558
  {
34547
34559
  type: "button",
34548
- disabled: !Mn,
34549
- onClick: En,
34560
+ disabled: !Dn,
34561
+ onClick: Pn,
34550
34562
  className: Q(
34551
34563
  "inline-flex h-7 items-center gap-1 rounded-md px-2.5 text-[11.5px] font-semibold",
34552
- Mn ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
34564
+ Dn ? "bg-nvr-cyan text-white" : "bg-slate-100 text-slate-400 dark:bg-muted dark:text-slate-500"
34553
34565
  ),
34554
34566
  children: [
34555
34567
  /* @__PURE__ */ e(on, { className: "h-3 w-3" }),
@@ -34557,7 +34569,7 @@ function X_({
34557
34569
  ]
34558
34570
  }
34559
34571
  ),
34560
- (An > 0 || Mn) && /* @__PURE__ */ a(
34572
+ (An > 0 || Dn) && /* @__PURE__ */ a(
34561
34573
  "button",
34562
34574
  {
34563
34575
  type: "button",
@@ -34669,10 +34681,10 @@ function X_({
34669
34681
  "button",
34670
34682
  {
34671
34683
  type: "button",
34672
- disabled: Ft || !xt.trim(),
34684
+ disabled: jt || !xt.trim(),
34673
34685
  onClick: () => void De(),
34674
34686
  className: "text-[11px] font-semibold text-nvr-navy disabled:opacity-40 dark:text-nvr-cyan",
34675
- children: Ft ? "…" : "Set"
34687
+ children: jt ? "…" : "Set"
34676
34688
  }
34677
34689
  )
34678
34690
  ] }),
@@ -34793,7 +34805,7 @@ function X_({
34793
34805
  },
34794
34806
  me.field
34795
34807
  )) }),
34796
- (ae == null ? void 0 : ae.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children: Y ? /* @__PURE__ */ a(dt, { children: [
34808
+ (ae == null ? void 0 : ae.editable) && /* @__PURE__ */ e("div", { className: "mb-2 flex items-center gap-1.5", children: Y ? /* @__PURE__ */ a(it, { children: [
34797
34809
  /* @__PURE__ */ e(
34798
34810
  "button",
34799
34811
  {
@@ -34858,7 +34870,7 @@ function X_({
34858
34870
  {
34859
34871
  reportId: t,
34860
34872
  widget: me,
34861
- dateRange: ot,
34873
+ dateRange: dt,
34862
34874
  entityFilters: [
34863
34875
  ...v.filter((Ct) => Ct.field !== $e.field),
34864
34876
  { field: $e.field, values: [Ae], labels: [Ae] }
@@ -34868,7 +34880,7 @@ function X_({
34868
34880
  onDrill: f
34869
34881
  }
34870
34882
  )
34871
- ] }, ft)) }) : /* @__PURE__ */ a(dt, { children: [
34883
+ ] }, ft)) }) : /* @__PURE__ */ a(it, { children: [
34872
34884
  Y && /* @__PURE__ */ e(
34873
34885
  ew,
34874
34886
  {
@@ -34888,7 +34900,7 @@ function X_({
34888
34900
  {
34889
34901
  reportId: t,
34890
34902
  widget: me,
34891
- dateRange: ot,
34903
+ dateRange: dt,
34892
34904
  entityFilters: v,
34893
34905
  refetchInterval: s,
34894
34906
  filterBar: Dt,
@@ -35734,7 +35746,7 @@ function Z_({ userId: t, className: n }) {
35734
35746
  title: k ? "Active" : h.status
35735
35747
  }
35736
35748
  ),
35737
- i && /* @__PURE__ */ a(dt, { children: [
35749
+ i && /* @__PURE__ */ a(it, { children: [
35738
35750
  /* @__PURE__ */ e(
35739
35751
  "button",
35740
35752
  {
@@ -36225,7 +36237,7 @@ function Lw({
36225
36237
  open: t,
36226
36238
  title: r ? "Edit Alert Rule" : "Create Alert Rule",
36227
36239
  onClose: i,
36228
- footer: /* @__PURE__ */ a(dt, { children: [
36240
+ footer: /* @__PURE__ */ a(it, { children: [
36229
36241
  /* @__PURE__ */ e("button", { type: "button", className: Zu, onClick: i, children: "Cancel" }),
36230
36242
  /* @__PURE__ */ e(
36231
36243
  "button",
@@ -36372,7 +36384,7 @@ function Rw({
36372
36384
  open: t,
36373
36385
  title: "Edit Notification Subscription",
36374
36386
  onClose: r,
36375
- footer: /* @__PURE__ */ a(dt, { children: [
36387
+ footer: /* @__PURE__ */ a(it, { children: [
36376
36388
  /* @__PURE__ */ e("button", { type: "button", className: Zu, onClick: r, children: "Cancel" }),
36377
36389
  /* @__PURE__ */ e("button", { type: "button", className: Xu, disabled: s, onClick: () => {
36378
36390
  let g = null;
@@ -36418,7 +36430,7 @@ function Rw({
36418
36430
  }
36419
36431
  )
36420
36432
  ] }),
36421
- !F && /* @__PURE__ */ a(dt, { children: [
36433
+ !F && /* @__PURE__ */ a(it, { children: [
36422
36434
  /* @__PURE__ */ a("div", { className: "flex gap-3", children: [
36423
36435
  /* @__PURE__ */ a("div", { className: "flex-1", children: [
36424
36436
  /* @__PURE__ */ e(jr, { children: n.event_type === "workflow_transition" ? "State filter field" : "Filter field" }),
@@ -36511,7 +36523,7 @@ function Mw({
36511
36523
  open: t,
36512
36524
  title: r ? "Edit Anomaly Rule" : "New Anomaly Rule",
36513
36525
  onClose: l,
36514
- footer: /* @__PURE__ */ a(dt, { children: [
36526
+ footer: /* @__PURE__ */ a(it, { children: [
36515
36527
  /* @__PURE__ */ e("button", { type: "button", className: Zu, onClick: l, children: "Cancel" }),
36516
36528
  /* @__PURE__ */ e(
36517
36529
  "button",
@@ -36930,19 +36942,19 @@ function e5({
36930
36942
  if (G)
36931
36943
  await f("PATCH", `/metric-alerts/rules/${G.id}`, ae), p("Alert rule updated");
36932
36944
  else {
36933
- const Le = x.find((ot) => ot.id === ae.definition_id), lt = { ...ae.filters ?? {} };
36934
- for (const ot of (Le == null ? void 0 : Le.supported_filters) ?? []) {
36935
- if ((Qe = lt[ot.key]) != null && Qe.length) continue;
36936
- const Dt = Bs(d, { key: ot.key, collection: ot.collection });
36945
+ const Le = x.find((dt) => dt.id === ae.definition_id), lt = { ...ae.filters ?? {} };
36946
+ for (const dt of (Le == null ? void 0 : Le.supported_filters) ?? []) {
36947
+ if ((Qe = lt[dt.key]) != null && Qe.length) continue;
36948
+ const Dt = Bs(d, { key: dt.key, collection: dt.collection });
36937
36949
  if (!Dt) continue;
36938
36950
  const ln = (Bt = d == null ? void 0 : d.restricted) == null ? void 0 : Bt[Dt.name];
36939
36951
  if (!(ln != null && ln.length)) continue;
36940
36952
  const dn = ho(d, Dt.name), An = dn.length ? dn : ln;
36941
- lt[ot.key] = await io(
36953
+ lt[dt.key] = await io(
36942
36954
  s,
36943
36955
  Dt,
36944
36956
  An,
36945
- ot.value_field
36957
+ dt.value_field
36946
36958
  );
36947
36959
  }
36948
36960
  await f("POST", "/metric-alerts/rules", { ...ae, filters: lt }), p("Alert rule created");
@@ -37009,7 +37021,7 @@ function e5({
37009
37021
  for (const Qe of x)
37010
37022
  ae.has(Qe.category) || ae.set(Qe.category, []), ae.get(Qe.category).push(Qe);
37011
37023
  return ae;
37012
- }, [x]), nt = S.filter((ae) => ae.status === "firing").length, Xe = R.filter((ae) => ae.status === "firing").length, $t = U.filter((ae) => ae.status === "active").length, xt = re.filter((ae) => ae.status === "new").length, Ft = [
37024
+ }, [x]), nt = S.filter((ae) => ae.status === "firing").length, Xe = R.filter((ae) => ae.status === "firing").length, $t = U.filter((ae) => ae.status === "active").length, xt = re.filter((ae) => ae.status === "new").length, jt = [
37013
37025
  { key: "catalog", label: "Alert Catalog", icon: /* @__PURE__ */ e(_m, { className: "h-3.5 w-3.5" }) },
37014
37026
  { key: "rules", label: "Alert Rules", icon: /* @__PURE__ */ e(gl, { className: "h-3.5 w-3.5" }) },
37015
37027
  {
@@ -37053,7 +37065,7 @@ function e5({
37053
37065
  }, St = (ae) => v || ae != null && String(ae).toLowerCase() === w, tn = "inline-flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan px-2.5 text-[12px] font-semibold text-white hover:opacity-90";
37054
37066
  return /* @__PURE__ */ a("div", { className: Q("flex flex-col gap-3", l), "data-alert-manager": "", children: [
37055
37067
  c && /* @__PURE__ */ e("div", { className: "fixed right-4 top-4 z-[60] rounded-md bg-[#0f172a] px-3 py-2 text-[12.5px] text-white shadow-lg dark:bg-slate-100 dark:text-slate-900", children: c }),
37056
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 border-b border-slate-200 pb-px dark:border-border", "data-alert-tabs": "", children: Ft.map((ae) => /* @__PURE__ */ a(
37068
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1 border-b border-slate-200 pb-px dark:border-border", "data-alert-tabs": "", children: jt.map((ae) => /* @__PURE__ */ a(
37057
37069
  "button",
37058
37070
  {
37059
37071
  type: "button",
@@ -37106,7 +37118,7 @@ function e5({
37106
37118
  }
37107
37119
  ),
37108
37120
  /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/50", children: Qe.map((Le) => {
37109
- const lt = F.filter((ot) => ot.definition_id === Le.id).length;
37121
+ const lt = F.filter((dt) => dt.definition_id === Le.id).length;
37110
37122
  return /* @__PURE__ */ a(
37111
37123
  "li",
37112
37124
  {
@@ -37185,7 +37197,7 @@ function e5({
37185
37197
  ] }),
37186
37198
  loading: k,
37187
37199
  children: F.map((ae) => {
37188
- var ot, Dt;
37200
+ var dt, Dt;
37189
37201
  const Qe = !!qe[ae.id], Bt = St(ae.created_by), Le = Re[ae.id], lt = ae.status !== "active";
37190
37202
  return /* @__PURE__ */ a(
37191
37203
  "tr",
@@ -37204,7 +37216,7 @@ function e5({
37204
37216
  {
37205
37217
  operator: ae.operator,
37206
37218
  threshold: ae.threshold_value,
37207
- unit: (ot = ae.definition) == null ? void 0 : ot.unit
37219
+ unit: (dt = ae.definition) == null ? void 0 : dt.unit
37208
37220
  }
37209
37221
  ) }),
37210
37222
  /* @__PURE__ */ e("td", { className: Xt, children: lt ? /* @__PURE__ */ e(Li, { status: ae.status }) : Le ? /* @__PURE__ */ a("span", { className: "flex flex-col gap-0.5", children: [
@@ -37255,7 +37267,7 @@ function e5({
37255
37267
  children: Qe ? /* @__PURE__ */ e(Ui, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ e(gl, { className: "h-3.5 w-3.5" })
37256
37268
  }
37257
37269
  ),
37258
- Bt && /* @__PURE__ */ a(dt, { children: [
37270
+ Bt && /* @__PURE__ */ a(it, { children: [
37259
37271
  /* @__PURE__ */ e(
37260
37272
  "button",
37261
37273
  {
@@ -37765,7 +37777,7 @@ function e5({
37765
37777
  children: re.map((ae) => {
37766
37778
  const Qe = ae.stats_snapshot ?? {}, Bt = Object.values(
37767
37779
  Qe.group ?? {}
37768
- ).filter(Boolean), Le = typeof Qe.multiplier == "number" ? Qe.multiplier : null, lt = typeof Qe.value == "number" ? Qe.value : null, ot = typeof Qe.mean == "number" ? Qe.mean : null, Dt = ae.status !== "resolved";
37780
+ ).filter(Boolean), Le = typeof Qe.multiplier == "number" ? Qe.multiplier : null, lt = typeof Qe.value == "number" ? Qe.value : null, dt = typeof Qe.mean == "number" ? Qe.mean : null, Dt = ae.status !== "resolved";
37769
37781
  return /* @__PURE__ */ a(
37770
37782
  "tr",
37771
37783
  {
@@ -37798,10 +37810,10 @@ function e5({
37798
37810
  ]
37799
37811
  }
37800
37812
  ),
37801
- lt != null && ot != null && /* @__PURE__ */ a("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: [
37813
+ lt != null && dt != null && /* @__PURE__ */ a("span", { className: "font-mono text-[10.5px] tabular-nums text-slate-400 dark:text-slate-500", children: [
37802
37814
  Fs(lt, "dollar"),
37803
37815
  " vs ",
37804
- Fs(ot, "dollar")
37816
+ Fs(dt, "dollar")
37805
37817
  ] })
37806
37818
  ] }) : /* @__PURE__ */ e("span", { className: "text-slate-300 dark:text-slate-600", children: "—" }) }),
37807
37819
  /* @__PURE__ */ e("td", { className: Q(Xt, "max-w-0"), children: /* @__PURE__ */ e(Bw, { text: ae.ai_explanation }) }),
@@ -38039,7 +38051,7 @@ function zw({ token: t, url: n, mine: r }) {
38039
38051
  }
38040
38052
  function Ww({ text: t, mine: n }) {
38041
38053
  const r = Yr(), l = wl(), s = Se(() => _g(t, r.entityPattern), [t, r.entityPattern]);
38042
- return /* @__PURE__ */ e(dt, { children: s.map((i, d) => {
38054
+ return /* @__PURE__ */ e(it, { children: s.map((i, d) => {
38043
38055
  if (i.entity) {
38044
38056
  const o = r.entityUrl(i.entity);
38045
38057
  return /* @__PURE__ */ e(zw, { token: i.text, url: o, mine: n }, d);
@@ -38221,7 +38233,7 @@ function Hw({
38221
38233
  }, [m.length]), Ve(() => {
38222
38234
  if (!fe || !_) return;
38223
38235
  if (m.some(
38224
- (ot) => (ot.sender_name ?? "").toLowerCase() === _.toLowerCase() && new Date(ot.date_created).getTime() >= fe - 5e3
38236
+ (dt) => (dt.sender_name ?? "").toLowerCase() === _.toLowerCase() && new Date(dt.date_created).getTime() >= fe - 5e3
38225
38237
  )) {
38226
38238
  ue(null);
38227
38239
  return;
@@ -38231,7 +38243,7 @@ function Hw({
38231
38243
  }, [fe, _, m]);
38232
38244
  const wt = Se(() => {
38233
38245
  const Le = /* @__PURE__ */ new Set();
38234
- for (const lt of m) for (const ot of lt.attachments ?? []) Le.add(ot);
38246
+ for (const lt of m) for (const dt of lt.attachments ?? []) Le.add(dt);
38235
38247
  return [...Le];
38236
38248
  }, [m]), { data: Ot } = ge({
38237
38249
  queryKey: ["nvr-chat-attachments", wt.slice().sort().join("|")],
@@ -38255,14 +38267,14 @@ function Hw({
38255
38267
  Z((lt) => lt + Le.length);
38256
38268
  for (const lt of Le)
38257
38269
  try {
38258
- const ot = await u.upload(lt);
38270
+ const dt = await u.upload(lt);
38259
38271
  V((Dt) => [
38260
38272
  ...Dt,
38261
- { id: ot.id, name: lt.name, type: lt.type || null }
38273
+ { id: dt.id, name: lt.name, type: lt.type || null }
38262
38274
  ]);
38263
38275
  } catch {
38264
38276
  } finally {
38265
- Z((ot) => ot - 1);
38277
+ Z((dt) => dt - 1);
38266
38278
  }
38267
38279
  }
38268
38280
  };
@@ -38271,26 +38283,26 @@ function Hw({
38271
38283
  }, [t, m.length]);
38272
38284
  const nt = Se(() => {
38273
38285
  if (X === null) return [];
38274
- const Le = X.toLowerCase(), lt = d.onlineUsers.filter((ot) => (ot.display_name ?? "").toLowerCase().startsWith(Le)).slice(0, 6);
38286
+ const Le = X.toLowerCase(), lt = d.onlineUsers.filter((dt) => (dt.display_name ?? "").toLowerCase().startsWith(Le)).slice(0, 6);
38275
38287
  return _ && _.toLowerCase().startsWith(Le) ? [{ user_id: "__bot__", display_name: _ }, ...lt].slice(0, 6) : lt;
38276
38288
  }, [X, d.onlineUsers, _]), Xe = (Le) => {
38277
38289
  var ln;
38278
- const lt = Le.display_name ?? "Unknown", ot = `@[${lt}] `, Dt = R.lastIndexOf(`@${X ?? ""}`);
38279
- O(Dt !== -1 ? R.slice(0, Dt) + ot : R + ot), $e.current.set(lt, Le), ye(null), (ln = Ie.current) == null || ln.focus();
38290
+ const lt = Le.display_name ?? "Unknown", dt = `@[${lt}] `, Dt = R.lastIndexOf(`@${X ?? ""}`);
38291
+ O(Dt !== -1 ? R.slice(0, Dt) + dt : R + dt), $e.current.set(lt, Le), ye(null), (ln = Ie.current) == null || ln.focus();
38280
38292
  }, $t = () => {
38281
38293
  const Le = R.trim();
38282
38294
  if (!Le && le.length === 0) return;
38283
38295
  const lt = le.map((Dt) => Dt.id);
38284
38296
  O(""), V([]), ye(null), w.clearTyping();
38285
- const ot = c ? [...$e.current.entries()].filter(([Dt]) => Le.includes(`@[${Dt}]`)).map(([, Dt]) => Dt.user_id).filter((Dt) => Dt !== "__bot__") : [];
38286
- if (f.mutate({ text: Le, mentions: ot, attachments: lt }), $e.current.clear(), _) {
38297
+ const dt = c ? [...$e.current.entries()].filter(([Dt]) => Le.includes(`@[${Dt}]`)).map(([, Dt]) => Dt.user_id).filter((Dt) => Dt !== "__bot__") : [];
38298
+ if (f.mutate({ text: Le, mentions: dt, attachments: lt }), $e.current.clear(), _) {
38287
38299
  const Dt = _.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
38288
38300
  new RegExp(`@\\[?${Dt}\\]?\\b`, "i").test(Le) && ue(Date.now());
38289
38301
  }
38290
38302
  }, xt = (Le, lt) => {
38291
38303
  O(Le), w.onType();
38292
- const ot = Sg(Le, lt);
38293
- ye(ot), ot !== null && G(0);
38304
+ const dt = Sg(Le, lt);
38305
+ ye(dt), dt !== null && G(0);
38294
38306
  }, Zt = (Le) => {
38295
38307
  if (X !== null && nt.length > 0) {
38296
38308
  if (Le.key === "ArrowDown") {
@@ -38307,16 +38319,16 @@ function Hw({
38307
38319
  }
38308
38320
  Le.key === "Escape" && (Le.preventDefault(), ye(null));
38309
38321
  }
38310
- }, Ft = (Qe = c == null ? void 0 : c.id) == null ? void 0 : Qe.toLowerCase(), It = I && z.trim().length > 0, St = Se(
38322
+ }, jt = (Qe = c == null ? void 0 : c.id) == null ? void 0 : Qe.toLowerCase(), It = I && z.trim().length > 0, St = Se(
38311
38323
  () => It ? m.filter((Le) => Le.message.toLowerCase().includes(z.trim().toLowerCase())) : m,
38312
38324
  [m, It, z]
38313
38325
  ), tn = Se(() => {
38314
38326
  var Le;
38315
38327
  if (It) return -1;
38316
38328
  for (let lt = St.length - 1; lt >= 0; lt--)
38317
- if (((Le = St[lt].sender) == null ? void 0 : Le.toLowerCase()) === Ft) return lt;
38329
+ if (((Le = St[lt].sender) == null ? void 0 : Le.toLowerCase()) === jt) return lt;
38318
38330
  return -1;
38319
- }, [St, Ft, It]), ae = v ? new Date(v).getTime() : 0;
38331
+ }, [St, jt, It]), ae = v ? new Date(v).getTime() : 0;
38320
38332
  return /* @__PURE__ */ a("div", { className: "flex h-full min-h-0 flex-col", "data-chat-room": t, children: [
38321
38333
  /* @__PURE__ */ a("div", { className: Q("flex shrink-0 items-center gap-2 border-b px-3 py-2", o.divider), children: [
38322
38334
  /* @__PURE__ */ e(
@@ -38375,26 +38387,26 @@ function Hw({
38375
38387
  onClick: async () => {
38376
38388
  var Le, lt;
38377
38389
  try {
38378
- let ot = [];
38390
+ let dt = [];
38379
38391
  if (t.startsWith("dm:") && c) {
38380
38392
  const Dt = Ou(t, c.id);
38381
38393
  if (Dt) {
38382
38394
  const ln = await u.request(
38383
38395
  he(`/users/${Dt}`)
38384
38396
  );
38385
- (Le = ln.data) != null && Le.email && (ot = [ln.data.email]);
38397
+ (Le = ln.data) != null && Le.email && (dt = [ln.data.email]);
38386
38398
  }
38387
- } else (lt = C == null ? void 0 : C.channel) != null && lt.id && (ot = (await u.request(
38399
+ } else (lt = C == null ? void 0 : C.channel) != null && lt.id && (dt = (await u.request(
38388
38400
  he(
38389
38401
  `/chat/channels/${C.channel.id}/members`
38390
38402
  )
38391
38403
  )).data.filter((ln) => ln.email && ln.user.toUpperCase() !== (c == null ? void 0 : c.id.toUpperCase())).map((ln) => ln.email));
38392
- if (ot.length === 0) {
38404
+ if (dt.length === 0) {
38393
38405
  mt.error("No callable participants found");
38394
38406
  return;
38395
38407
  }
38396
38408
  window.open(
38397
- `https://teams.microsoft.com/l/call/0/0?users=${encodeURIComponent(ot.join(","))}`,
38409
+ `https://teams.microsoft.com/l/call/0/0?users=${encodeURIComponent(dt.join(","))}`,
38398
38410
  "_blank",
38399
38411
  "noopener"
38400
38412
  );
@@ -38436,7 +38448,7 @@ function Hw({
38436
38448
  ["all", "All messages", !C.muted && C.notify_mode !== "mentions"],
38437
38449
  ["mentions", "Mentions only", !C.muted && C.notify_mode === "mentions"],
38438
38450
  ["muted", "Muted", C.muted]
38439
- ].map(([Le, lt, ot]) => /* @__PURE__ */ a(
38451
+ ].map(([Le, lt, dt]) => /* @__PURE__ */ a(
38440
38452
  "button",
38441
38453
  {
38442
38454
  type: "button",
@@ -38445,11 +38457,11 @@ function Hw({
38445
38457
  },
38446
38458
  className: Q(
38447
38459
  "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12px]",
38448
- ot ? o.accentSoft : "text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-muted"
38460
+ dt ? o.accentSoft : "text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-muted"
38449
38461
  ),
38450
38462
  children: [
38451
38463
  lt,
38452
- ot && /* @__PURE__ */ e(on, { className: "ml-auto h-3 w-3" })
38464
+ dt && /* @__PURE__ */ e(on, { className: "ml-auto h-3 w-3" })
38453
38465
  ]
38454
38466
  },
38455
38467
  Le
@@ -38516,7 +38528,7 @@ function Hw({
38516
38528
  ] }, Le.pin_id)) })
38517
38529
  ] }),
38518
38530
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-2.5 overflow-y-auto px-3 py-3", "data-chat-messages": !0, children: [
38519
- p ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "Loading…" }) : St.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-400", children: It ? "No messages match." : /* @__PURE__ */ a(dt, { children: [
38531
+ p ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "Loading…" }) : St.length === 0 ? /* @__PURE__ */ e("div", { className: "py-6 text-center text-[12px] text-slate-400", children: It ? "No messages match." : /* @__PURE__ */ a(it, { children: [
38520
38532
  /* @__PURE__ */ e("p", { children: "No messages yet — say hello." }),
38521
38533
  /* @__PURE__ */ a("p", { className: "mt-1 text-[11px]", children: [
38522
38534
  "Tip: @ mentions someone",
@@ -38525,10 +38537,10 @@ function Hw({
38525
38537
  ] })
38526
38538
  ] }) }) : St.map((Le, lt) => {
38527
38539
  var Ke, Je;
38528
- const ot = ((Ke = Le.sender) == null ? void 0 : Ke.toLowerCase()) === Ft, Dt = St[lt - 1], ln = lt === 0 || Dt && new Date(Dt.date_created).toDateString() !== new Date(Le.date_created).toDateString(), dn = ot && lt === tn, An = dn && ae > 0 && new Date(Le.date_created).getTime() <= ae, Mn = !!Le.deleted_at, En = ot && !Mn && Date.now() - new Date(Le.date_created).getTime() < 15 * 6e4, Fn = oe === Le.id, ie = !It && st.current > 0 && lt === Math.max(0, St.length - st.current), De = /* @__PURE__ */ new Map();
38540
+ const dt = ((Ke = Le.sender) == null ? void 0 : Ke.toLowerCase()) === jt, Dt = St[lt - 1], ln = lt === 0 || Dt && new Date(Dt.date_created).toDateString() !== new Date(Le.date_created).toDateString(), dn = dt && lt === tn, An = dn && ae > 0 && new Date(Le.date_created).getTime() <= ae, Dn = !!Le.deleted_at, Pn = dt && !Dn && Date.now() - new Date(Le.date_created).getTime() < 15 * 6e4, Fn = oe === Le.id, ie = !It && st.current > 0 && lt === Math.max(0, St.length - st.current), De = /* @__PURE__ */ new Map();
38529
38541
  for (const me of Le.reactions ?? []) {
38530
38542
  const Ue = De.get(me.emoji) ?? { count: 0, mine: !1, names: [] };
38531
- Ue.count++, ((Je = me.user) == null ? void 0 : Je.toLowerCase()) === Ft && (Ue.mine = !0), me.user_name && Ue.names.push(me.user_name), De.set(me.emoji, Ue);
38543
+ Ue.count++, ((Je = me.user) == null ? void 0 : Je.toLowerCase()) === jt && (Ue.mine = !0), me.user_name && Ue.names.push(me.user_name), De.set(me.emoji, Ue);
38532
38544
  }
38533
38545
  return /* @__PURE__ */ a("div", { children: [
38534
38546
  ln && /* @__PURE__ */ a("div", { className: "my-2 flex items-center gap-2", children: [
@@ -38541,18 +38553,18 @@ function Hw({
38541
38553
  /* @__PURE__ */ e("span", { className: "text-[10px] font-semibold uppercase tracking-wide text-red-400", children: "New messages" }),
38542
38554
  /* @__PURE__ */ e("span", { className: "h-px flex-1 bg-red-300 dark:bg-red-500/50" })
38543
38555
  ] }),
38544
- /* @__PURE__ */ a("div", { className: Q("group/msg flex gap-2", ot && "flex-row-reverse"), children: [
38545
- !ot && /* @__PURE__ */ e(bi, { id: Le.sender, name: Le.sender_name, size: 26 }),
38546
- /* @__PURE__ */ a("div", { className: Q("relative max-w-[78%]", ot && "text-right"), children: [
38547
- !ot && /* @__PURE__ */ e("p", { className: "mb-0.5 text-[10.5px] font-medium text-slate-400", children: Le.sender_name ?? "Unknown" }),
38548
- !Mn && !Fn && /* @__PURE__ */ a(
38556
+ /* @__PURE__ */ a("div", { className: Q("group/msg flex gap-2", dt && "flex-row-reverse"), children: [
38557
+ !dt && /* @__PURE__ */ e(bi, { id: Le.sender, name: Le.sender_name, size: 26 }),
38558
+ /* @__PURE__ */ a("div", { className: Q("relative max-w-[78%]", dt && "text-right"), children: [
38559
+ !dt && /* @__PURE__ */ e("p", { className: "mb-0.5 text-[10.5px] font-medium text-slate-400", children: Le.sender_name ?? "Unknown" }),
38560
+ !Dn && !Fn && /* @__PURE__ */ a(
38549
38561
  "div",
38550
38562
  {
38551
38563
  className: Q(
38552
38564
  "absolute -top-3 z-10 hidden items-center gap-0.5 rounded-full border px-1 py-0.5 shadow-sm group-hover/msg:flex",
38553
38565
  o.surface,
38554
38566
  "border-slate-200 dark:border-border",
38555
- ot ? "left-0" : "right-0"
38567
+ dt ? "left-0" : "right-0"
38556
38568
  ),
38557
38569
  "data-chat-msg-actions": !0,
38558
38570
  children: [
@@ -38590,7 +38602,7 @@ function Hw({
38590
38602
  children: /* @__PURE__ */ e(Xi, { className: "h-3 w-3" })
38591
38603
  }
38592
38604
  ),
38593
- En && /* @__PURE__ */ a(dt, { children: [
38605
+ Pn && /* @__PURE__ */ a(it, { children: [
38594
38606
  /* @__PURE__ */ e(
38595
38607
  "button",
38596
38608
  {
@@ -38628,7 +38640,7 @@ function Hw({
38628
38640
  ]
38629
38641
  }
38630
38642
  ),
38631
- Mn ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-400 dark:border-border", children: "Message removed" }) : Fn ? /* @__PURE__ */ a(
38643
+ Dn ? /* @__PURE__ */ e("div", { className: "inline-block rounded-2xl border border-dashed border-slate-200 px-3 py-1.5 text-left text-[11.5px] italic text-slate-400 dark:border-border", children: "Message removed" }) : Fn ? /* @__PURE__ */ a(
38632
38644
  "form",
38633
38645
  {
38634
38646
  className: "flex items-center gap-1",
@@ -38659,10 +38671,10 @@ function Hw({
38659
38671
  {
38660
38672
  className: Q(
38661
38673
  "inline-block rounded-2xl px-3 py-1.5 text-left text-[12.5px] leading-snug",
38662
- ot ? Q("rounded-br-md", o.bubbleMine) : Q("rounded-bl-md", o.bubbleOther)
38674
+ dt ? Q("rounded-br-md", o.bubbleMine) : Q("rounded-bl-md", o.bubbleOther)
38663
38675
  ),
38664
38676
  children: [
38665
- Le.message && (s ? s(Le, { mine: ot }) : /* @__PURE__ */ e(Ww, { text: Le.message, mine: ot })),
38677
+ Le.message && (s ? s(Le, { mine: dt }) : /* @__PURE__ */ e(Ww, { text: Le.message, mine: dt })),
38666
38678
  (Le.attachments ?? []).length > 0 && /* @__PURE__ */ e("div", { className: Q("flex flex-wrap gap-1.5", Le.message && "mt-1.5"), children: (Le.attachments ?? []).map((me) => {
38667
38679
  const Ue = Ot == null ? void 0 : Ot.get(me), Ae = (Ue == null ? void 0 : Ue.title) || (Ue == null ? void 0 : Ue.filename_download) || "Attachment", ft = u.fileUrl(me), Ct = ((Ue == null ? void 0 : Ue.type) ?? "").startsWith("image/"), qt = () => qe({
38668
38680
  id: me,
@@ -38686,7 +38698,7 @@ function Hw({
38686
38698
  onClick: qt,
38687
38699
  className: Q(
38688
38700
  "inline-flex max-w-[220px] items-center gap-1.5 rounded-lg border px-2 py-1 text-[11.5px]",
38689
- ot ? "border-white/30 bg-white/10" : "border-slate-200 bg-white dark:border-border dark:bg-card"
38701
+ dt ? "border-white/30 bg-white/10" : "border-slate-200 bg-white dark:border-border dark:bg-card"
38690
38702
  ),
38691
38703
  children: [
38692
38704
  /* @__PURE__ */ e(Ii, { className: "h-3 w-3 shrink-0 opacity-60" }),
@@ -38699,7 +38711,7 @@ function Hw({
38699
38711
  ]
38700
38712
  }
38701
38713
  ),
38702
- De.size > 0 && /* @__PURE__ */ e("div", { className: Q("mt-0.5 flex flex-wrap gap-1", ot && "justify-end"), "data-chat-reactions": !0, children: [...De.entries()].map(([me, Ue]) => /* @__PURE__ */ a(
38714
+ De.size > 0 && /* @__PURE__ */ e("div", { className: Q("mt-0.5 flex flex-wrap gap-1", dt && "justify-end"), "data-chat-reactions": !0, children: [...De.entries()].map(([me, Ue]) => /* @__PURE__ */ a(
38703
38715
  "button",
38704
38716
  {
38705
38717
  type: "button",
@@ -38717,8 +38729,8 @@ function Hw({
38717
38729
  me
38718
38730
  )) }),
38719
38731
  /* @__PURE__ */ a("p", { className: "mt-0.5 flex items-center justify-end gap-1 text-[10px] text-slate-400", children: [
38720
- !ot && /* @__PURE__ */ e("span", { className: "mr-auto" }),
38721
- Le.edited_at && !Mn && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
38732
+ !dt && /* @__PURE__ */ e("span", { className: "mr-auto" }),
38733
+ Le.edited_at && !Dn && /* @__PURE__ */ e("span", { className: "italic", children: "(edited)" }),
38722
38734
  new Date(Le.date_created).toLocaleTimeString("en-US", {
38723
38735
  hour: "numeric",
38724
38736
  minute: "2-digit"
@@ -38765,7 +38777,7 @@ function Hw({
38765
38777
  "button",
38766
38778
  {
38767
38779
  type: "button",
38768
- onClick: () => V((lt) => lt.filter((ot) => ot.id !== Le.id)),
38780
+ onClick: () => V((lt) => lt.filter((dt) => dt.id !== Le.id)),
38769
38781
  className: "text-slate-400 hover:text-red-500",
38770
38782
  "aria-label": `Remove ${Le.name}`,
38771
38783
  children: /* @__PURE__ */ e(Gt, { className: "h-3 w-3" })
@@ -38798,8 +38810,8 @@ function Hw({
38798
38810
  "button",
38799
38811
  {
38800
38812
  type: "button",
38801
- onMouseDown: (ot) => {
38802
- ot.preventDefault(), Xe(Le);
38813
+ onMouseDown: (dt) => {
38814
+ dt.preventDefault(), Xe(Le);
38803
38815
  },
38804
38816
  className: Q(
38805
38817
  "flex w-full items-center gap-2 px-3 py-1.5 text-left text-[12.5px]",
@@ -38912,7 +38924,7 @@ function Yw({
38912
38924
  ] })
38913
38925
  ] }),
38914
38926
  /* @__PURE__ */ a("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-3", children: [
38915
- $ ? /* @__PURE__ */ a(dt, { children: [
38927
+ $ ? /* @__PURE__ */ a(it, { children: [
38916
38928
  /* @__PURE__ */ a("label", { className: "block", children: [
38917
38929
  /* @__PURE__ */ e("span", { className: "mb-1 block text-[11px] font-medium text-slate-400", children: "Name" }),
38918
38930
  /* @__PURE__ */ e(
@@ -40353,7 +40365,7 @@ function dh({
40353
40365
  ]
40354
40366
  }
40355
40367
  ) : null,
40356
- children: !Ne && /* @__PURE__ */ a(dt, { children: [
40368
+ children: !Ne && /* @__PURE__ */ a(it, { children: [
40357
40369
  t.option_section ? O.map((Me) => {
40358
40370
  const be = `s:${Z.id}|${Me.name}`, st = y.has(be), at = Me.rows.reduce(
40359
40371
  (gt, nt) => {
@@ -40424,7 +40436,7 @@ function Vp({
40424
40436
  header: t,
40425
40437
  children: n
40426
40438
  }) {
40427
- return /* @__PURE__ */ a(dt, { children: [
40439
+ return /* @__PURE__ */ a(it, { children: [
40428
40440
  t,
40429
40441
  n
40430
40442
  ] });
@@ -40785,7 +40797,7 @@ function oN({
40785
40797
  ] });
40786
40798
  }
40787
40799
  function dN({ header: t, children: n }) {
40788
- return /* @__PURE__ */ a(dt, { children: [
40800
+ return /* @__PURE__ */ a(it, { children: [
40789
40801
  t,
40790
40802
  n
40791
40803
  ] });
@@ -41835,7 +41847,7 @@ function CN({
41835
41847
  }) {
41836
41848
  const l = Object.entries(t.params);
41837
41849
  return da(
41838
- /* @__PURE__ */ a(dt, { children: [
41850
+ /* @__PURE__ */ a(it, { children: [
41839
41851
  /* @__PURE__ */ e(
41840
41852
  "div",
41841
41853
  {
@@ -41857,7 +41869,7 @@ function CN({
41857
41869
  /* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-slate-400", children: Lt(s) }),
41858
41870
  /* @__PURE__ */ e("dd", { className: "ml-auto font-medium tabular-nums text-slate-800 dark:text-slate-100", children: String(i) })
41859
41871
  ] }, s)) }),
41860
- t.phase === "confirm" && /* @__PURE__ */ a(dt, { children: [
41872
+ t.phase === "confirm" && /* @__PURE__ */ a(it, { children: [
41861
41873
  /* @__PURE__ */ e("p", { className: "mt-2 text-[12.5px] text-slate-600 dark:text-slate-300", children: t.confirmText }),
41862
41874
  /* @__PURE__ */ a("div", { className: "mt-3 flex gap-2", children: [
41863
41875
  /* @__PURE__ */ e(
@@ -41885,7 +41897,7 @@ function CN({
41885
41897
  "Running… ",
41886
41898
  /* @__PURE__ */ e("span", { className: "tabular-nums", children: Wo(t.elapsedMs) })
41887
41899
  ] }),
41888
- t.phase === "done" && /* @__PURE__ */ a(dt, { children: [
41900
+ t.phase === "done" && /* @__PURE__ */ a(it, { children: [
41889
41901
  /* @__PURE__ */ a("p", { className: "mt-2 text-[12.5px] font-medium text-emerald-600 dark:text-emerald-400", children: [
41890
41902
  t.action.success_message ?? "Completed",
41891
41903
  " · ",
@@ -41912,7 +41924,7 @@ function CN({
41912
41924
  }
41913
41925
  )
41914
41926
  ] }),
41915
- t.phase === "error" && /* @__PURE__ */ a(dt, { children: [
41927
+ t.phase === "error" && /* @__PURE__ */ a(it, { children: [
41916
41928
  /* @__PURE__ */ a("p", { className: "mt-2 text-[12.5px] font-medium text-red-600 dark:text-red-400", children: [
41917
41929
  "Failed after ",
41918
41930
  Wo(t.elapsedMs),
@@ -41996,7 +42008,7 @@ function a5({ slug: t, hideHeader: n, className: r }) {
41996
42008
  return (b = g.config) == null ? void 0 : b.full_height;
41997
42009
  }), h = /* @__PURE__ */ a("div", { className: `flex h-full min-h-0 flex-col ${r ?? ""}`, children: [
41998
42010
  !n && /* @__PURE__ */ e("div", { className: "shrink-0 pb-4", children: /* @__PURE__ */ e("h1", { className: "text-lg font-semibold text-slate-900 dark:text-slate-100", children: o.name }) }),
41999
- /* @__PURE__ */ e("div", { className: `min-h-0 flex-1 overflow-y-auto ${x ? "flex flex-col" : ""}`, children: p.length === 0 ? /* @__PURE__ */ e("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ a(dt, { children: [
42011
+ /* @__PURE__ */ e("div", { className: `min-h-0 flex-1 overflow-y-auto ${x ? "flex flex-col" : ""}`, children: p.length === 0 ? /* @__PURE__ */ e("p", { className: "p-6 text-center text-[13px] text-slate-400", children: "This page has no widgets yet." }) : /* @__PURE__ */ a(it, { children: [
42000
42012
  w.map((g) => /* @__PURE__ */ e("div", { className: "mb-3 flex shrink-0 flex-wrap items-center gap-2", children: g.items.map((b) => /* @__PURE__ */ e(Jp, { slug: o.slug, widget: b }, b.id)) }, g.y)),
42001
42013
  /* @__PURE__ */ e(
42002
42014
  "div",
@@ -43336,7 +43348,7 @@ function ZN({
43336
43348
  /* @__PURE__ */ e("span", { "data-nf-comment-author": !0, children: YN(M.user) }),
43337
43349
  /* @__PURE__ */ e("span", { "data-nf-comment-time": !0, children: XN(M.created_at) }),
43338
43350
  T && /* @__PURE__ */ e("span", { "data-nf-comment-edited": !0, children: "(edited)" }),
43339
- /* @__PURE__ */ e("div", { "data-nf-comment-actions": !0, children: !D && /* @__PURE__ */ a(dt, { children: [
43351
+ /* @__PURE__ */ e("div", { "data-nf-comment-actions": !0, children: !D && /* @__PURE__ */ a(it, { children: [
43340
43352
  /* @__PURE__ */ e(
43341
43353
  "button",
43342
43354
  {
@@ -43783,7 +43795,7 @@ function n_({
43783
43795
  (f) => f.from_state === m && f.to_state === p || f.from_state === p && f.to_state === m
43784
43796
  ).sort((f, y) => new Date(f.timestamp).getTime() - new Date(y.timestamp).getTime());
43785
43797
  }
43786
- return /* @__PURE__ */ a(dt, { children: [
43798
+ return /* @__PURE__ */ a(it, { children: [
43787
43799
  i && da(
43788
43800
  /* @__PURE__ */ a(
43789
43801
  "div",
@@ -44762,13 +44774,13 @@ function d5({
44762
44774
  return le.sort((de, Z) => de.sort - Z.sort);
44763
44775
  }
44764
44776
  function ee() {
44765
- return /* @__PURE__ */ e(dt, { children: ce().map((le) => /* @__PURE__ */ e(rl.Fragment, { children: le.render() }, le.key)) });
44777
+ return /* @__PURE__ */ e(it, { children: ce().map((le) => /* @__PURE__ */ e(rl.Fragment, { children: le.render() }, le.key)) });
44766
44778
  }
44767
44779
  function Oe() {
44768
44780
  const le = x.ungroupedSort != null && x.ungroupedSort >= x.groups.length, V = x.slotAssignments.filter(
44769
44781
  (de) => de.isVisible && de.groupKey == null && !!((c == null ? void 0 : c[de.slot]) ?? Pc[de.slot])
44770
44782
  );
44771
- return /* @__PURE__ */ a(dt, { children: [
44783
+ return /* @__PURE__ */ a(it, { children: [
44772
44784
  !le && G(),
44773
44785
  /* @__PURE__ */ a("div", { className: i, "data-nivaro-tab-strip": !0, role: "tablist", children: [
44774
44786
  R.map((de) => /* @__PURE__ */ e(
@@ -44819,7 +44831,7 @@ function d5({
44819
44831
  ), qe = x.ungroupedSort, Re = re.length > 0 && (qe == null || qe >= R.length) ? V === le - 1 : !1;
44820
44832
  return (t.fieldsByGroup.get((de == null ? void 0 : de.key) ?? "") ?? []).filter(
44821
44833
  (ve) => g(ve.field)
44822
- ), /* @__PURE__ */ a(dt, { children: [
44834
+ ), /* @__PURE__ */ a(it, { children: [
44823
44835
  Ne && oe(Ne),
44824
44836
  /* @__PURE__ */ e("div", { className: p, "data-nf-stepper": !0, "data-nf-steps": le, children: R.map((ve, fe) => /* @__PURE__ */ a(rl.Fragment, { children: [
44825
44837
  fe > 0 && /* @__PURE__ */ e(
@@ -44890,7 +44902,7 @@ function d5({
44890
44902
  onClick: () => T((ve) => Math.min(le - 1, ve + 1)),
44891
44903
  children: "Next"
44892
44904
  }
44893
- ) : /* @__PURE__ */ a(dt, { children: [
44905
+ ) : /* @__PURE__ */ a(it, { children: [
44894
44906
  v,
44895
44907
  /* @__PURE__ */ e(
44896
44908
  "button",
@@ -44934,7 +44946,7 @@ function c5({
44934
44946
  );
44935
44947
  return l ? /* @__PURE__ */ e(rl.Fragment, { children: l(x, h) }, x.field) : h();
44936
44948
  }, v = (x, h) => {
44937
- const F = /* @__PURE__ */ e(dt, { children: h.map((k) => w(k)) });
44949
+ const F = /* @__PURE__ */ e(it, { children: h.map((k) => w(k)) });
44938
44950
  if (s) {
44939
44951
  const k = (x == null ? void 0 : x.key) ?? "__ungrouped__";
44940
44952
  return /* @__PURE__ */ e(rl.Fragment, { children: s(x, F) }, k);
@@ -44946,7 +44958,7 @@ function c5({
44946
44958
  }, N = () => {
44947
44959
  if (!o) return null;
44948
44960
  const x = t.fieldsByGroup.get(null) ?? [];
44949
- return /* @__PURE__ */ a(dt, { children: [
44961
+ return /* @__PURE__ */ a(it, { children: [
44950
44962
  x.length > 0 ? v(null, x) : null,
44951
44963
  t.visibleGroups.map((h) => v(h, t.fieldsByGroup.get(h.key) ?? []))
44952
44964
  ] });