@declarion/react 0.2.16 → 0.3.1

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.
package/dist-lib/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as _, I as v, It as y, J as b, Jt as x, K as S, Kt as C, L as w, Lt as T, M as E, Mt as D, N as O, Nt as k, O as A, Ot as j, P as M, Pt as N, Q as P, Qt as F, R as I, Rt as L, S as ee, St as te, T as ne, Tt as re, U as ie, Ut as ae, V as R, Vt as oe, W as se, Wt as ce, X as le, Xt as z, Y as ue, Yt as de, Z as fe, Zt as B, _ as pe, _t as me, a as V, at as he, b as ge, bt as _e, c as ve, ct as ye, d as be, dt as xe, en as Se, et as Ce, f as H, ft as we, g as Te, gt as U, h as Ee, ht as De, i as Oe, it as ke, j as Ae, jt as je, k as Me, kt as Ne, l as Pe, lt as Fe, m as Ie, mt as Le, n as Re, nt as ze, o as Be, ot as Ve, p as He, pt as Ue, q as We, qt as Ge, r as Ke, rt as qe, s as Je, st as Ye, t as Xe, tt as Ze, u as Qe, ut as $e, v as et, vt as tt, w as nt, wt as rt, x as it, xt as at, y as ot, yt as st, z as ct, zt as W } from "./dataTableStyles-DQdH4Ilw.js";
1
+ import { $ as e, $t as t, A as n, At as r, B as i, Bt as a, C as o, Ct as s, D as c, Dt as l, E as u, Et as d, F as f, Ft as p, G as m, Gt as h, H as g, Ht as _, I as v, It as y, J as b, Jt as x, K as S, Kt as C, L as w, Lt as T, M as E, Mt as D, N as O, Nt as k, O as A, Ot as j, P as M, Pt as N, Q as ee, Qt as P, R as F, Rt as I, S as L, St as te, T as ne, Tt as re, U as ie, Ut as ae, V as R, Vt as oe, W as se, Wt as ce, X as le, Xt as z, Y as ue, Yt as de, Z as fe, Zt as B, _ as pe, _t as me, a as V, at as he, b as ge, bt as _e, c as ve, ct as ye, d as be, dt as xe, en as Se, et as Ce, f as H, ft as we, g as Te, gt as U, h as Ee, ht as De, i as Oe, it as ke, j as Ae, jt as je, k as Me, kt as Ne, l as Pe, lt as Fe, m as Ie, mt as Le, n as Re, nt as ze, o as Be, ot as Ve, p as He, pt as Ue, q as We, qt as Ge, r as Ke, rt as qe, s as Je, st as Ye, t as Xe, tt as Ze, u as Qe, ut as $e, v as et, vt as tt, w as nt, wt as rt, x as it, xt as at, y as ot, yt as st, z as ct, zt as W } from "./dataTableStyles-ChRNMLAZ.js";
2
2
  import { A as lt, B as ut, C as dt, D as ft, F as pt, H as mt, I as ht, L as gt, M as _t, N as vt, O as yt, P as bt, R as xt, S as St, T as Ct, U as wt, V as Tt, W as Et, _ as Dt, a as Ot, b as kt, j as At, o as jt, s as Mt, v as Nt, x as Pt, y as Ft } from "./value-DaEUgsnK.js";
3
3
  import { Component as It, Fragment as Lt, Suspense as Rt, createContext as zt, createElement as Bt, lazy as Vt, useCallback as G, useContext as Ht, useEffect as K, useLayoutEffect as Ut, useMemo as q, useRef as J, useState as Y } from "react";
4
4
  import { BrowserRouter as Wt, Link as Gt, Navigate as Kt, Outlet as qt, Route as Jt, Routes as Yt, useLocation as Xt, useLocation as Zt, useNavigate as Qt, useNavigate as $t, useParams as en, useParams as tn, useSearchParams as nn, useSearchParams as rn } from "react-router-dom";
@@ -703,11 +703,11 @@ function gr({ open: e, onOpenChange: n, title: r, description: i, confirmLabel:
703
703
  },
704
704
  children: [
705
705
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
706
- /* @__PURE__ */ Z(F, {
706
+ /* @__PURE__ */ Z(P, {
707
707
  onClick: () => n(!1),
708
708
  children: "Cancel"
709
709
  }),
710
- /* @__PURE__ */ Z(F, {
710
+ /* @__PURE__ */ Z(P, {
711
711
  kind: "primary",
712
712
  danger: s,
713
713
  onClick: () => {
@@ -1532,7 +1532,7 @@ function Ir() {
1532
1532
  //#region src/hooks/useImpersonation.ts
1533
1533
  function Lr() {
1534
1534
  let t = We((e) => e.user), n = We((e) => e.initialize), r = un(), i = t?.impersonation ?? null, a = !!i, o = cn({
1535
- mutationFn: ({ targetUserId: e, reason: t, durationMinutes: n }) => P(e, t, n),
1535
+ mutationFn: ({ targetUserId: e, reason: t, durationMinutes: n }) => ee(e, t, n),
1536
1536
  onSuccess: async () => {
1537
1537
  await n(), r.invalidateQueries(), $.success("Impersonation session started.");
1538
1538
  },
@@ -2696,16 +2696,16 @@ function Zr({ pending: e, onCancel: n, onCloseClean: r, onDiscardAll: i }) {
2696
2696
  },
2697
2697
  children: [
2698
2698
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
2699
- /* @__PURE__ */ Z(F, {
2699
+ /* @__PURE__ */ Z(P, {
2700
2700
  onClick: n,
2701
2701
  children: "Cancel"
2702
2702
  }),
2703
- s > 0 && /* @__PURE__ */ Z(F, {
2703
+ s > 0 && /* @__PURE__ */ Z(P, {
2704
2704
  autoFocus: !0,
2705
2705
  onClick: r,
2706
2706
  children: "Close clean only"
2707
2707
  }),
2708
- /* @__PURE__ */ Z(F, {
2708
+ /* @__PURE__ */ Z(P, {
2709
2709
  kind: "primary",
2710
2710
  danger: !0,
2711
2711
  onClick: i,
@@ -2806,15 +2806,13 @@ async function ei(e) {
2806
2806
  return (await dt(`/api/params/${encodeURIComponent(e)}`)).data;
2807
2807
  }
2808
2808
  async function ti(e, t, n) {
2809
- await dt("/api/data/user", {
2810
- method: "PATCH",
2811
- body: JSON.stringify([{
2812
- id: e,
2813
- $params: [{
2814
- param_code: t,
2815
- value: n
2816
- }]
2817
- }])
2809
+ await M("user.__update", {
2810
+ object_ids: [e],
2811
+ entity: "user",
2812
+ fields: { $params: [{
2813
+ param_code: t,
2814
+ value: n
2815
+ }] }
2818
2816
  });
2819
2817
  }
2820
2818
  //#endregion
@@ -3233,14 +3231,14 @@ function ui({ open: e, onClose: n, onAction: r, mode: i = "default", navigation:
3233
3231
  //#endregion
3234
3232
  //#region src/api/agents.ts
3235
3233
  async function di(e) {
3236
- return (await n("agent_conversation", {
3234
+ return (await Ae("agent_conversation", {
3237
3235
  status: "active",
3238
3236
  ...e.agent_code ? { agent_code: e.agent_code } : {},
3239
3237
  ...e.context ? { context: e.context } : {}
3240
3238
  })).data;
3241
3239
  }
3242
- async function fi(e, t, r) {
3243
- return (await n("agent_message", {
3240
+ async function fi(e, t, n) {
3241
+ return (await Ae("agent_message", {
3244
3242
  role: "user",
3245
3243
  content: [{
3246
3244
  type: "text",
@@ -3250,13 +3248,13 @@ async function fi(e, t, r) {
3250
3248
  seq: 0
3251
3249
  })).data;
3252
3250
  }
3253
- async function pi(e, t, r, i) {
3254
- return (await n("agent_message", {
3251
+ async function pi(e, t, n, r) {
3252
+ return (await Ae("agent_message", {
3255
3253
  role: "user",
3256
3254
  content: [{
3257
3255
  type: "elicit_response",
3258
- id: r,
3259
- data: i
3256
+ id: n,
3257
+ data: r
3260
3258
  }],
3261
3259
  conversation_id: e,
3262
3260
  seq: 0
@@ -3264,29 +3262,29 @@ async function pi(e, t, r, i) {
3264
3262
  }
3265
3263
  async function mi(e, t) {
3266
3264
  let n = { status: "approved" };
3267
- t && (n.params = t), await ct("agent_tool_invocation", e, n);
3265
+ t && (n.params = t), await i("agent_tool_invocation", e, n);
3268
3266
  }
3269
3267
  async function hi(e, t) {
3270
- await ct("agent_tool_invocation", e, {
3268
+ await i("agent_tool_invocation", e, {
3271
3269
  status: "rejected",
3272
3270
  ...t ? { approval: { reason: t } } : {}
3273
3271
  });
3274
3272
  }
3275
3273
  async function gi(e) {
3276
- await ct("agent_conversation", e, { status: "canceling" });
3274
+ await i("agent_conversation", e, { status: "canceling" });
3277
3275
  }
3278
3276
  async function _i() {
3279
- return (await v("agent_conversation", {
3277
+ return (await w("agent_conversation", {
3280
3278
  sort: "updated_at:desc",
3281
3279
  page: 1,
3282
3280
  per_page: 50
3283
3281
  })).data ?? [];
3284
3282
  }
3285
3283
  async function vi(e) {
3286
- await O("agents.rerun_message_turn", { args: { conversation_id: e } });
3284
+ await M("agents.rerun_message_turn", { args: { conversation_id: e } });
3287
3285
  }
3288
3286
  async function yi(e) {
3289
- return (await v("agent_tool_invocation", {
3287
+ return (await w("agent_tool_invocation", {
3290
3288
  filters: [{
3291
3289
  field: "conversation_id",
3292
3290
  op: "eq",
@@ -3301,7 +3299,7 @@ async function yi(e) {
3301
3299
  })).data ?? [];
3302
3300
  }
3303
3301
  async function bi(e) {
3304
- return (await v("agent_message", {
3302
+ return (await w("agent_message", {
3305
3303
  filters: [{
3306
3304
  field: "conversation_id",
3307
3305
  op: "eq",
@@ -3868,11 +3866,11 @@ function Gi({ message: e, schema: t, onSubmit: n, onCancel: r }) {
3868
3866
  }),
3869
3867
  /* @__PURE__ */ Q("div", {
3870
3868
  className: "mt-3 flex justify-end gap-2",
3871
- children: [r && /* @__PURE__ */ Z(F, {
3869
+ children: [r && /* @__PURE__ */ Z(P, {
3872
3870
  kind: "ghost",
3873
3871
  onClick: r,
3874
3872
  children: "Cancel"
3875
- }), /* @__PURE__ */ Z(F, {
3873
+ }), /* @__PURE__ */ Z(P, {
3876
3874
  onClick: c,
3877
3875
  children: "Submit"
3878
3876
  })]
@@ -4167,7 +4165,7 @@ function Qi({ open: e, onClose: n, context: r, title: i = "" }) {
4167
4165
  display: "flex",
4168
4166
  gap: 6
4169
4167
  },
4170
- children: /* @__PURE__ */ Z(F, {
4168
+ children: /* @__PURE__ */ Z(P, {
4171
4169
  size: "xs",
4172
4170
  kind: "primary",
4173
4171
  icon: /* @__PURE__ */ Z(t.refresh, { size: 11 }),
@@ -4473,7 +4471,7 @@ function ia({ block: e }) {
4473
4471
  switch (e.type) {
4474
4472
  case "text": return /* @__PURE__ */ Z("div", {
4475
4473
  className: "agent-md",
4476
- children: /* @__PURE__ */ Z(i, {
4474
+ children: /* @__PURE__ */ Z(A, {
4477
4475
  content: e.text,
4478
4476
  plugins: "gfm",
4479
4477
  prose: !1,
@@ -4870,19 +4868,19 @@ function da({ tool: e, onApprove: n, onReject: r }) {
4870
4868
  marginTop: 8,
4871
4869
  justifyContent: "flex-end"
4872
4870
  },
4873
- children: [l ? /* @__PURE__ */ Z(F, {
4871
+ children: [l ? /* @__PURE__ */ Z(P, {
4874
4872
  size: "xs",
4875
4873
  kind: "ghost",
4876
4874
  onClick: v,
4877
4875
  disabled: h,
4878
4876
  children: "Send rejection"
4879
- }) : /* @__PURE__ */ Z(F, {
4877
+ }) : /* @__PURE__ */ Z(P, {
4880
4878
  size: "xs",
4881
4879
  kind: "ghost",
4882
4880
  onClick: () => u(!0),
4883
4881
  disabled: h,
4884
4882
  children: "Reject"
4885
- }), /* @__PURE__ */ Z(F, {
4883
+ }), /* @__PURE__ */ Z(P, {
4886
4884
  size: "xs",
4887
4885
  kind: "primary",
4888
4886
  icon: /* @__PURE__ */ Z(t.check, { size: 11 }),
@@ -5218,7 +5216,7 @@ function La({ targets: e, onPick: n }) {
5218
5216
  r && n(r), i(!1);
5219
5217
  }
5220
5218
  })
5221
- }) : /* @__PURE__ */ Q(F, {
5219
+ }) : /* @__PURE__ */ Q(P, {
5222
5220
  kind: "ghost",
5223
5221
  onClick: () => i(!0),
5224
5222
  style: { alignSelf: "flex-start" },
@@ -5519,12 +5517,12 @@ function qa({ open: e, onOpenChange: n, action: r, actionName: i, onSubmit: a, i
5519
5517
  },
5520
5518
  children: [
5521
5519
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
5522
- /* @__PURE__ */ Z(F, {
5520
+ /* @__PURE__ */ Z(P, {
5523
5521
  onClick: () => n(!1),
5524
5522
  disabled: o,
5525
5523
  children: "Cancel"
5526
5524
  }),
5527
- /* @__PURE__ */ Z(F, {
5525
+ /* @__PURE__ */ Z(P, {
5528
5526
  kind: "primary",
5529
5527
  icon: Z(o ? T : t.bolt, { size: 13 }),
5530
5528
  onClick: x,
@@ -5631,7 +5629,7 @@ function Ja({ open: e, onClose: n, display: r }) {
5631
5629
  gap: 8,
5632
5630
  background: "var(--surface-2)"
5633
5631
  },
5634
- children: [/* @__PURE__ */ Z("div", { style: { flex: 1 } }), /* @__PURE__ */ Z(F, {
5632
+ children: [/* @__PURE__ */ Z("div", { style: { flex: 1 } }), /* @__PURE__ */ Z(P, {
5635
5633
  kind: "primary",
5636
5634
  onClick: n,
5637
5635
  children: "Close"
@@ -5712,7 +5710,7 @@ function Qa(e) {
5712
5710
  !t || typeof t != "object" || "impersonation_session_id" in t && window.location.assign("/");
5713
5711
  }
5714
5712
  function $a(e) {
5715
- if (e instanceof A) {
5713
+ if (e instanceof Me) {
5716
5714
  let t = e.response.errors ?? [];
5717
5715
  if (t.length === 1) return {
5718
5716
  kind: "error",
@@ -5948,11 +5946,11 @@ function ao({ state: e, onClose: n, onExecute: r }) {
5948
5946
  },
5949
5947
  children: [
5950
5948
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
5951
- /* @__PURE__ */ Z(F, {
5949
+ /* @__PURE__ */ Z(P, {
5952
5950
  onClick: n,
5953
5951
  children: "Cancel"
5954
5952
  }),
5955
- /* @__PURE__ */ Z(F, {
5953
+ /* @__PURE__ */ Z(P, {
5956
5954
  kind: "primary",
5957
5955
  danger: l,
5958
5956
  icon: Z(o ? T : t.bolt, { size: 13 }),
@@ -6152,9 +6150,9 @@ function bo() {
6152
6150
  //#region src/components/layout/Layout.tsx
6153
6151
  var xo = "default";
6154
6152
  function So() {
6155
- let { isAuthenticated: e, isLoading: t, user: n, activeTenant: r } = We(), i = $n(), a = $t(), o = Zt(), { data: s } = S(), c = m((e) => e.sidebar), l = m((e) => e.tabsPosition), u = m((e) => e.aiSurface), d = m((e) => e.theme), f = m((e) => e.set), p = m((e) => e.hydrateFromParams), { data: h } = ni(), g = In((e) => e.tabs), _ = In((e) => e.activeTabId), v = In((e) => e.closeTabs), y = In((e) => e.setScope), b = In((e) => e.hydrate), [x, C] = Y(xo), [w, T] = Y(!1), [E, D] = Y("default"), [O, k] = Y(!1), [A, j] = Y(null), M = u !== "off", N = u === "panel" || u === "both", P = u === "command" || u === "both", F = s?.branding?.ai_name?.trim() ?? "", I = G((e = "default") => {
6153
+ let { isAuthenticated: e, isLoading: t, user: n, activeTenant: r } = We(), i = $n(), a = $t(), o = Zt(), { data: s } = S(), c = m((e) => e.sidebar), l = m((e) => e.tabsPosition), u = m((e) => e.aiSurface), d = m((e) => e.theme), f = m((e) => e.set), p = m((e) => e.hydrateFromParams), { data: h } = ni(), g = In((e) => e.tabs), _ = In((e) => e.activeTabId), v = In((e) => e.closeTabs), y = In((e) => e.setScope), b = In((e) => e.hydrate), [x, C] = Y(xo), [w, T] = Y(!1), [E, D] = Y("default"), [O, k] = Y(!1), [A, j] = Y(null), M = u !== "off", N = u === "panel" || u === "both", ee = u === "command" || u === "both", P = s?.branding?.ai_name?.trim() ?? "", F = G((e = "default") => {
6156
6154
  M && (D(e), T(!0));
6157
- }, [M]), L = G((e) => {
6155
+ }, [M]), I = G((e) => {
6158
6156
  if (e.length === 0) return;
6159
6157
  let t = In.getState(), n = !t.activeTabId || e.includes(t.activeTabId), r = v(e);
6160
6158
  if (!n) return;
@@ -6163,22 +6161,22 @@ function So() {
6163
6161
  pathname: i.pathname,
6164
6162
  search: i.search
6165
6163
  }, { replace: i.replace });
6166
- }, [v, a]), ee = G((e, t) => {
6164
+ }, [v, a]), L = G((e, t) => {
6167
6165
  let n = In.getState(), r = oi(n.tabs, n.activeTabId, e, t);
6168
6166
  if (r) {
6169
6167
  if (r.dirtyTabs.length > 0) {
6170
6168
  j(r);
6171
6169
  return;
6172
6170
  }
6173
- L(r.ids);
6171
+ I(r.ids);
6174
6172
  }
6175
- }, [L]), te = G(() => {
6173
+ }, [I]), te = G(() => {
6176
6174
  j(null);
6177
6175
  }, []), ne = G(() => {
6178
- A && (j(null), L(A.cleanIds));
6179
- }, [A, L]), re = G(() => {
6180
- A && (j(null), L(A.ids));
6181
- }, [A, L]);
6176
+ A && (j(null), I(A.cleanIds));
6177
+ }, [A, I]), re = G(() => {
6178
+ A && (j(null), I(A.ids));
6179
+ }, [A, I]);
6182
6180
  bo(), K(() => {
6183
6181
  i.enabled || !t && !e && a(mt(`${o.pathname}${o.search}${o.hash}`), { replace: !0 });
6184
6182
  }, [
@@ -6220,12 +6218,12 @@ function So() {
6220
6218
  ]), K(() => {
6221
6219
  let e = (e) => {
6222
6220
  let t = document.activeElement, n = !!t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable), r = e.metaKey || e.ctrlKey;
6223
- r && e.key.toLowerCase() === "k" ? (e.preventDefault(), I("default")) : r && e.key.toLowerCase() === "t" ? (e.preventDefault(), I("new")) : r && e.key.toLowerCase() === "b" ? (e.preventDefault(), f("sidebar", c === "collapsed" ? "wide" : "collapsed")) : r && e.key.toLowerCase() === "w" ? (e.preventDefault(), ee("current")) : r && e.key === "/" ? (e.preventDefault(), N && k((e) => !e)) : e.key === "/" && !n ? (e.preventDefault(), I("default")) : e.key === "Escape" && T(!1);
6221
+ r && e.key.toLowerCase() === "k" ? (e.preventDefault(), F("default")) : r && e.key.toLowerCase() === "t" ? (e.preventDefault(), F("new")) : r && e.key.toLowerCase() === "b" ? (e.preventDefault(), f("sidebar", c === "collapsed" ? "wide" : "collapsed")) : r && e.key.toLowerCase() === "w" ? (e.preventDefault(), L("current")) : r && e.key === "/" ? (e.preventDefault(), N && k((e) => !e)) : e.key === "/" && !n ? (e.preventDefault(), F("default")) : e.key === "Escape" && T(!1);
6224
6222
  };
6225
6223
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
6226
6224
  }, [
6227
- I,
6228
- ee,
6225
+ F,
6226
+ L,
6229
6227
  f,
6230
6228
  c,
6231
6229
  N
@@ -6272,7 +6270,7 @@ function So() {
6272
6270
  f("theme", d === "dark" ? "light" : "dark");
6273
6271
  break;
6274
6272
  case "tab-close":
6275
- e.tabCloseScope && ee(e.tabCloseScope);
6273
+ e.tabCloseScope && L(e.tabCloseScope);
6276
6274
  break;
6277
6275
  }
6278
6276
  };
@@ -6296,7 +6294,7 @@ function So() {
6296
6294
  /* @__PURE__ */ Z(Jr, {
6297
6295
  breadcrumbs: ie,
6298
6296
  onCrumbClick: (e) => e.onClick && e.onClick(),
6299
- onCmdK: () => I("default"),
6297
+ onCmdK: () => F("default"),
6300
6298
  onToggleAI: () => N && k((e) => !e),
6301
6299
  aiOpen: O,
6302
6300
  onOpenProfile: () => a("/profile"),
@@ -6307,7 +6305,7 @@ function So() {
6307
6305
  onPick: ae,
6308
6306
  onToggleAI: () => N && k((e) => !e),
6309
6307
  aiOpen: O,
6310
- onCmdK: () => I("default"),
6308
+ onCmdK: () => F("default"),
6311
6309
  areas: s?.areas,
6312
6310
  branding: h?.branding
6313
6311
  }),
@@ -6322,8 +6320,8 @@ function So() {
6322
6320
  },
6323
6321
  children: [
6324
6322
  l === "top" && /* @__PURE__ */ Z(Yr, {
6325
- onNew: () => I("new"),
6326
- onCloseRequest: ee
6323
+ onNew: () => F("new"),
6324
+ onCloseRequest: L
6327
6325
  }),
6328
6326
  /* @__PURE__ */ Z("div", {
6329
6327
  style: {
@@ -6336,8 +6334,8 @@ function So() {
6336
6334
  children: /* @__PURE__ */ Z(qt, {})
6337
6335
  }),
6338
6336
  l === "bottom" && /* @__PURE__ */ Z(Yr, {
6339
- onNew: () => I("new"),
6340
- onCloseRequest: ee
6337
+ onNew: () => F("new"),
6338
+ onCloseRequest: L
6341
6339
  })
6342
6340
  ]
6343
6341
  }),
@@ -6348,13 +6346,13 @@ function So() {
6348
6346
  onAction: (e) => R(e),
6349
6347
  navigation: s?.navigation,
6350
6348
  screens: s?.screens,
6351
- includeAI: P,
6352
- aiName: F
6349
+ includeAI: ee,
6350
+ aiName: P
6353
6351
  }),
6354
6352
  N && O && /* @__PURE__ */ Z(Qi, {
6355
6353
  open: O,
6356
6354
  onClose: () => k(!1),
6357
- title: F
6355
+ title: P
6358
6356
  }),
6359
6357
  /* @__PURE__ */ Z(Zr, {
6360
6358
  pending: A,
@@ -6976,7 +6974,7 @@ function qo() {
6976
6974
  label: `Continue with ${e.name}`,
6977
6975
  icon: /* @__PURE__ */ Z(t.shield, { size: 13 })
6978
6976
  };
6979
- return /* @__PURE__ */ Z(F, {
6977
+ return /* @__PURE__ */ Z(P, {
6980
6978
  size: "md",
6981
6979
  style: {
6982
6980
  justifyContent: "center",
@@ -7072,7 +7070,7 @@ function qo() {
7072
7070
  onChange: (e) => m(e.target.checked)
7073
7071
  }), " Keep me signed in on this device"]
7074
7072
  }),
7075
- /* @__PURE__ */ Z(F, {
7073
+ /* @__PURE__ */ Z(P, {
7076
7074
  type: "submit",
7077
7075
  size: "md",
7078
7076
  kind: "primary",
@@ -7249,7 +7247,7 @@ function Xo() {
7249
7247
  privacyUrl: w
7250
7248
  })]
7251
7249
  }),
7252
- /* @__PURE__ */ Z(F, {
7250
+ /* @__PURE__ */ Z(P, {
7253
7251
  type: "submit",
7254
7252
  size: "md",
7255
7253
  kind: "primary",
@@ -7376,7 +7374,7 @@ function Qo() {
7376
7374
  type: "email",
7377
7375
  "aria-label": "Email"
7378
7376
  })] }),
7379
- /* @__PURE__ */ Z(F, {
7377
+ /* @__PURE__ */ Z(P, {
7380
7378
  type: "submit",
7381
7379
  size: "md",
7382
7380
  kind: "primary",
@@ -7538,7 +7536,7 @@ function as() {
7538
7536
  },
7539
7537
  children: f
7540
7538
  }),
7541
- /* @__PURE__ */ Z(F, {
7539
+ /* @__PURE__ */ Z(P, {
7542
7540
  type: "submit",
7543
7541
  size: "md",
7544
7542
  kind: "primary",
@@ -7640,7 +7638,7 @@ function os() {
7640
7638
  }
7641
7639
  }, e))
7642
7640
  }),
7643
- /* @__PURE__ */ Z(F, {
7641
+ /* @__PURE__ */ Z(P, {
7644
7642
  size: "md",
7645
7643
  kind: "primary",
7646
7644
  style: {
@@ -7733,7 +7731,7 @@ function cs() {
7733
7731
  }),
7734
7732
  /* @__PURE__ */ Z("div", {
7735
7733
  style: { marginTop: 24 },
7736
- children: /* @__PURE__ */ Z(F, {
7734
+ children: /* @__PURE__ */ Z(P, {
7737
7735
  onClick: () => e("/"),
7738
7736
  children: "Go home"
7739
7737
  })
@@ -7886,11 +7884,11 @@ function ls({ open: e, onClose: n, onSubmit: r }) {
7886
7884
  children: "auth.change_password@v1"
7887
7885
  }),
7888
7886
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
7889
- /* @__PURE__ */ Z(F, {
7887
+ /* @__PURE__ */ Z(P, {
7890
7888
  onClick: g,
7891
7889
  children: "Cancel"
7892
7890
  }),
7893
- /* @__PURE__ */ Z(F, {
7891
+ /* @__PURE__ */ Z(P, {
7894
7892
  kind: "primary",
7895
7893
  icon: Z(u ? T : t.key, { size: 13 }),
7896
7894
  onClick: async () => {
@@ -8035,12 +8033,12 @@ function ds({ open: e, onOpenChange: n, actionName: r, message: i, onConfirm: a,
8035
8033
  },
8036
8034
  children: [
8037
8035
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
8038
- /* @__PURE__ */ Z(F, {
8036
+ /* @__PURE__ */ Z(P, {
8039
8037
  onClick: () => n(!1),
8040
8038
  disabled: o,
8041
8039
  children: "Cancel"
8042
8040
  }),
8043
- /* @__PURE__ */ Z(F, {
8041
+ /* @__PURE__ */ Z(P, {
8044
8042
  kind: "primary",
8045
8043
  icon: Z(o ? T : t.bolt, { size: 13 }),
8046
8044
  onClick: a,
@@ -8062,7 +8060,7 @@ function ps(e, t, n = {}) {
8062
8060
  function ms(e) {
8063
8061
  let t = un();
8064
8062
  return cn({
8065
- mutationFn: (t) => n(e, t),
8063
+ mutationFn: (t) => Ae(e, t),
8066
8064
  onSuccess: () => {
8067
8065
  ps(t, e), $.success("Record created");
8068
8066
  },
@@ -8072,7 +8070,7 @@ function ms(e) {
8072
8070
  function hs(e) {
8073
8071
  let t = un();
8074
8072
  return cn({
8075
- mutationFn: ({ pkValues: t, data: n }) => ct(e, t, n),
8073
+ mutationFn: ({ pkValues: t, data: n }) => i(e, t, n),
8076
8074
  onSuccess: () => {
8077
8075
  ps(t, e, {
8078
8076
  item: !0,
@@ -8086,7 +8084,7 @@ function hs(e) {
8086
8084
  function gs(e) {
8087
8085
  let t = un();
8088
8086
  return cn({
8089
- mutationFn: (t) => Ae(e, t),
8087
+ mutationFn: (t) => E(e, t),
8090
8088
  onSuccess: () => {
8091
8089
  ps(t, e, { item: !0 }), $.success("Record deleted");
8092
8090
  },
@@ -8096,7 +8094,7 @@ function gs(e) {
8096
8094
  function _s(e) {
8097
8095
  let t = un();
8098
8096
  return cn({
8099
- mutationFn: (t) => I(e, t),
8097
+ mutationFn: (t) => ct(e, t),
8100
8098
  onSuccess: () => {
8101
8099
  ps(t, e, {
8102
8100
  item: !0,
@@ -8110,7 +8108,7 @@ function vs(e) {
8110
8108
  let t = un();
8111
8109
  return cn({
8112
8110
  mutationFn: async ({ actionCode: e, body: t }) => {
8113
- let n = await O(e, t);
8111
+ let n = await M(e, t);
8114
8112
  if (n.status === "error") throw Error("Action failed for all items");
8115
8113
  return n;
8116
8114
  },
@@ -8315,231 +8313,231 @@ function zs(e, t) {
8315
8313
  }
8316
8314
  //#endregion
8317
8315
  //#region src/components/shared/ActionButton.tsx
8318
- function Bs({ actionCode: e, action: n, entityCode: r, objectIds: i = [], row: a, variant: o = "outline", size: s = "default", onSuccess: c, onBatchStart: l, onBatchError: u, onBatchPartial: d }) {
8319
- let [f, p] = Y(!1), [m, h] = Y(!1), [g, _] = Y(!1), [v, y] = Y(null), b = vs(r), { data: x } = S(), C = vr(), T = Es(n), E = Ts(n), D = !!n.confirmation && Object.keys(n.confirmation).length > 0, O = a ? ys(n.conditions, a) : !0, k = G(async () => {
8320
- if (!(!n.association || i.length === 0)) {
8321
- _(!0);
8316
+ function Bs({ actionCode: e, action: r, entityCode: i, objectIds: a = [], row: o, variant: s = "outline", size: c = "default", onSuccess: l, onBatchStart: u, onBatchError: d, onBatchPartial: f }) {
8317
+ let [p, m] = Y(!1), [h, g] = Y(!1), [_, v] = Y(!1), [y, b] = Y(null), x = vs(i), { data: C } = S(), w = vr(), T = Es(r), E = Ts(r), D = !!r.confirmation && Object.keys(r.confirmation).length > 0, O = o ? ys(r.conditions, o) : !0, k = G(async () => {
8318
+ if (!(!r.association || a.length === 0)) {
8319
+ v(!0);
8322
8320
  try {
8323
- let e = await w(r ? `${r}.${n.association}` : n.association, i), t = Ds(x, e.target_entity);
8321
+ let e = await F(i ? `${i}.${r.association}` : r.association, a), t = Ds(C, e.target_entity);
8324
8322
  if (!t) {
8325
8323
  $.error(`No list screen found for ${e.target_entity}`);
8326
8324
  return;
8327
8325
  }
8328
- let a = x?.entities[e.target_entity], o = U(n.display?.name) || e.target_entity;
8326
+ let n = C?.entities[e.target_entity], o = U(r.display?.name) || e.target_entity;
8329
8327
  if (e.ids.length === 0) {
8330
8328
  $.info(`No related ${o} found`);
8331
8329
  return;
8332
8330
  }
8333
- let s = a?.fields.names().find((e) => a.fields.get(e)?.primary) ?? "id", l = new URLSearchParams();
8334
- l.set(`filter_${s}`, e.ids.join(",")), C(t.route, {
8331
+ let s = n?.fields.names().find((e) => n.fields.get(e)?.primary) ?? "id", c = new URLSearchParams();
8332
+ c.set(`filter_${s}`, e.ids.join(",")), w(t.route, {
8335
8333
  title: o,
8336
- icon: n.display?.icon || t.icon,
8337
- search: l.toString()
8338
- }), c?.();
8334
+ icon: r.display?.icon || t.icon,
8335
+ search: c.toString()
8336
+ }), l?.();
8339
8337
  } catch (e) {
8340
8338
  $.error(e instanceof Error ? e.message : "Failed to resolve association");
8341
8339
  } finally {
8342
- _(!1);
8340
+ v(!1);
8343
8341
  }
8344
8342
  }
8345
8343
  }, [
8346
- n,
8347
8344
  r,
8348
8345
  i,
8349
- x,
8346
+ a,
8350
8347
  C,
8351
- c
8352
- ]), A = n.entity ? `${n.entity}.${e}` : e, j = i.length > 0 ? i : void 0, M = n.resolved_hidden_defaults && Object.keys(n.resolved_hidden_defaults).length > 0 ? n.resolved_hidden_defaults : void 0, N = G((e, t) => {
8348
+ w,
8349
+ l
8350
+ ]), A = r.entity ? `${r.entity}.${e}` : e, j = a.length > 0 ? a : void 0, M = r.resolved_hidden_defaults && Object.keys(r.resolved_hidden_defaults).length > 0 ? r.resolved_hidden_defaults : void 0, N = G((e, t) => {
8353
8351
  if (t?.(), e.status === "accepted") {
8354
- c?.();
8352
+ l?.();
8355
8353
  return;
8356
8354
  }
8357
8355
  let n = e.result?.$display;
8358
8356
  if (n) {
8359
- y(n);
8357
+ b(n);
8360
8358
  return;
8361
8359
  }
8362
- e.status === "partial" ? d?.(i.length, e.success) : c?.();
8360
+ e.status === "partial" ? f?.(a.length, e.success) : l?.();
8363
8361
  }, [
8364
- i.length,
8365
- c,
8366
- d
8367
- ]), P = G(() => {
8368
- if (Ea(n)) {
8369
- xa(n.ui_steps, { row: a }).then(() => c?.());
8362
+ a.length,
8363
+ l,
8364
+ f
8365
+ ]), ee = G(() => {
8366
+ if (Ea(r)) {
8367
+ xa(r.ui_steps, { row: o }).then(() => l?.());
8370
8368
  return;
8371
8369
  }
8372
8370
  if (T) {
8373
8371
  k();
8374
8372
  return;
8375
8373
  }
8376
- if (n.href && !n.handler && !n.association) {
8377
- let t = a && typeof a.id == "string" ? a.id : "", i = n.href;
8378
- r && (i = i.replaceAll("${entity}", r)), t && (i = i.replaceAll("${id}", encodeURIComponent(t)));
8379
- let o = i.indexOf("?"), s = {
8380
- title: U(n.display?.name) || e,
8381
- icon: n.display?.icon
8374
+ if (r.href && !r.handler && !r.association) {
8375
+ let t = o && typeof o.id == "string" ? o.id : "", n = r.href;
8376
+ i && (n = n.replaceAll("${entity}", i)), t && (n = n.replaceAll("${id}", encodeURIComponent(t)));
8377
+ let a = n.indexOf("?"), s = {
8378
+ title: U(r.display?.name) || e,
8379
+ icon: r.display?.icon
8382
8380
  };
8383
- o === -1 ? C(i, s) : C(i.slice(0, o), {
8381
+ a === -1 ? w(n, s) : w(n.slice(0, a), {
8384
8382
  ...s,
8385
- search: i.slice(o + 1)
8386
- }), c?.();
8383
+ search: n.slice(a + 1)
8384
+ }), l?.();
8387
8385
  return;
8388
8386
  }
8389
- E ? p(!0) : D ? h(!0) : (l?.(i.length), b.mutate({
8387
+ E ? m(!0) : D ? g(!0) : (u?.(a.length), x.mutate({
8390
8388
  actionCode: A,
8391
- body: Me(M, j)
8389
+ body: n(M, j)
8392
8390
  }, {
8393
8391
  onSuccess: (e) => N(e),
8394
- onError: () => u?.(i.length)
8392
+ onError: () => d?.(a.length)
8395
8393
  }));
8396
8394
  }, [
8397
- n,
8398
- a,
8399
8395
  r,
8396
+ o,
8397
+ i,
8400
8398
  e,
8401
- C,
8399
+ w,
8402
8400
  T,
8403
8401
  E,
8404
8402
  D,
8405
8403
  A,
8406
8404
  j,
8407
- i,
8405
+ a,
8408
8406
  M,
8409
- b,
8407
+ x,
8410
8408
  N,
8411
8409
  k,
8412
- l,
8413
8410
  u,
8414
- c
8411
+ d,
8412
+ l
8415
8413
  ]), I = G(() => {
8416
- l?.(i.length), b.mutate({
8414
+ u?.(a.length), x.mutate({
8417
8415
  actionCode: A,
8418
- body: Me(M, j)
8416
+ body: n(M, j)
8419
8417
  }, {
8420
- onSuccess: (e) => N(e, () => h(!1)),
8421
- onError: () => u?.(i.length)
8418
+ onSuccess: (e) => N(e, () => g(!1)),
8419
+ onError: () => d?.(a.length)
8422
8420
  });
8423
8421
  }, [
8424
8422
  A,
8425
8423
  j,
8426
- i,
8424
+ a,
8427
8425
  M,
8428
- b,
8426
+ x,
8429
8427
  N,
8430
- l,
8431
- u
8428
+ u,
8429
+ d
8432
8430
  ]), L = G((e) => {
8433
- l?.(i.length), b.mutate({
8431
+ u?.(a.length), x.mutate({
8434
8432
  actionCode: A,
8435
- body: Me(e, j)
8433
+ body: n(e, j)
8436
8434
  }, {
8437
- onSuccess: (e) => N(e, () => p(!1)),
8438
- onError: () => u?.(i.length)
8435
+ onSuccess: (e) => N(e, () => m(!1)),
8436
+ onError: () => d?.(a.length)
8439
8437
  });
8440
8438
  }, [
8441
8439
  A,
8442
8440
  j,
8443
- i,
8444
- b,
8441
+ a,
8442
+ x,
8445
8443
  N,
8446
- l,
8447
- u
8448
- ]), ee = U(n.display?.name), te = n.display?.icon, ne = te && t[te], re = ne ? /* @__PURE__ */ Z(ne, { size: 13 }) : te ? /* @__PURE__ */ Z(R, {
8449
- name: te,
8444
+ u,
8445
+ d
8446
+ ]), te = U(r.display?.name), ne = r.display?.icon, re = ne && t[ne], ie = re ? /* @__PURE__ */ Z(re, { size: 13 }) : ne ? /* @__PURE__ */ Z(R, {
8447
+ name: ne,
8450
8448
  size: 13
8451
- }) : null, ie = !O || b.isPending || g;
8449
+ }) : null, ae = !O || x.isPending || _;
8452
8450
  return /* @__PURE__ */ Q(X, { children: [
8453
- s === "icon" ? /* @__PURE__ */ Z(B, {
8454
- icon: re ?? /* @__PURE__ */ Z(t.bolt, { size: 13 }),
8455
- onClick: P,
8456
- title: ee
8457
- }) : /* @__PURE__ */ Z(F, {
8458
- kind: o === "default" ? "primary" : o === "ghost" ? "ghost" : "default",
8451
+ c === "icon" ? /* @__PURE__ */ Z(B, {
8452
+ icon: ie ?? /* @__PURE__ */ Z(t.bolt, { size: 13 }),
8453
+ onClick: ee,
8454
+ title: te
8455
+ }) : /* @__PURE__ */ Z(P, {
8456
+ kind: s === "default" ? "primary" : s === "ghost" ? "ghost" : "default",
8459
8457
  size: "sm",
8460
- icon: re,
8461
- danger: n.destructive,
8462
- onClick: P,
8463
- disabled: ie,
8464
- title: ee,
8465
- "aria-label": ee,
8466
- children: ee
8458
+ icon: ie,
8459
+ danger: r.destructive,
8460
+ onClick: ee,
8461
+ disabled: ae,
8462
+ title: te,
8463
+ "aria-label": te,
8464
+ children: te
8467
8465
  }),
8468
8466
  E && /* @__PURE__ */ Z(qa, {
8469
- open: f,
8470
- onOpenChange: p,
8471
- action: n,
8472
- actionName: ee,
8467
+ open: p,
8468
+ onOpenChange: m,
8469
+ action: r,
8470
+ actionName: te,
8473
8471
  onSubmit: L,
8474
- isPending: b.isPending,
8475
- row: a
8472
+ isPending: x.isPending,
8473
+ row: o
8476
8474
  }),
8477
8475
  D && /* @__PURE__ */ Z(ds, {
8478
- open: m,
8479
- onOpenChange: h,
8480
- actionName: ee,
8481
- message: U(n.confirmation),
8476
+ open: h,
8477
+ onOpenChange: g,
8478
+ actionName: te,
8479
+ message: U(r.confirmation),
8482
8480
  onConfirm: I,
8483
- isPending: b.isPending
8481
+ isPending: x.isPending
8484
8482
  }),
8485
- v && /* @__PURE__ */ Z(Ja, {
8486
- open: !!v,
8483
+ y && /* @__PURE__ */ Z(Ja, {
8484
+ open: !!y,
8487
8485
  onClose: () => {
8488
- y(null), c?.();
8486
+ b(null), l?.();
8489
8487
  },
8490
- display: v
8488
+ display: y
8491
8489
  })
8492
8490
  ] });
8493
8491
  }
8494
8492
  //#endregion
8495
8493
  //#region src/components/shared/RowActionsKebab.tsx
8496
- function Vs({ actions: e, objectIds: n, row: r, onSuccess: i, preMenu: a, divider: o, size: s = 22, align: c = "end" }) {
8497
- let l = J(null), [u, d] = Y(!1), { run: f } = to();
8498
- if (!a && e.length === 0) return null;
8499
- let p = (e) => () => {
8500
- d(!1), e();
8494
+ function Vs({ actions: e, objectIds: r, row: i, onSuccess: a, preMenu: o, divider: s, size: c = 22, align: l = "end" }) {
8495
+ let u = J(null), [d, f] = Y(!1), { run: p } = to();
8496
+ if (!o && e.length === 0) return null;
8497
+ let m = (e) => () => {
8498
+ f(!1), e();
8501
8499
  };
8502
8500
  return /* @__PURE__ */ Q("div", {
8503
8501
  className: "sl-row-actions",
8504
- "data-open": u ? "true" : void 0,
8502
+ "data-open": d ? "true" : void 0,
8505
8503
  style: {
8506
8504
  display: "flex",
8507
8505
  alignItems: "center",
8508
8506
  justifyContent: "flex-end"
8509
8507
  },
8510
8508
  children: [/* @__PURE__ */ Z(B, {
8511
- ref: l,
8512
- size: s,
8513
- icon: /* @__PURE__ */ Z(t.more, { size: Math.round(s * .55) }),
8514
- onClick: () => d(!u),
8509
+ ref: u,
8510
+ size: c,
8511
+ icon: /* @__PURE__ */ Z(t.more, { size: Math.round(c * .55) }),
8512
+ onClick: () => f(!d),
8515
8513
  title: "Actions"
8516
8514
  }), /* @__PURE__ */ Q(C, {
8517
- open: u,
8518
- anchor: l.current,
8519
- onClose: () => d(!1),
8515
+ open: d,
8516
+ anchor: u.current,
8517
+ onClose: () => f(!1),
8520
8518
  width: 200,
8521
- align: c,
8519
+ align: l,
8522
8520
  children: [
8523
- a,
8524
- a && o && e.length > 0 && /* @__PURE__ */ Z(W, { divider: !0 }),
8525
- e.map(({ code: e, action: a }) => {
8526
- let o = r ? ys(a.conditions, r) : !0, s = U(a.display?.name) || e, c = a.display?.icon, l = c && t[c] ? t[c] : void 0;
8521
+ o,
8522
+ o && s && e.length > 0 && /* @__PURE__ */ Z(W, { divider: !0 }),
8523
+ e.map(({ code: e, action: o }) => {
8524
+ let s = i ? ys(o.conditions, i) : !0, c = U(o.display?.name) || e, l = o.display?.icon, u = l && t[l] ? t[l] : void 0;
8527
8525
  return /* @__PURE__ */ Z(W, {
8528
- icon: l ? /* @__PURE__ */ Z(l, { size: 12 }) : null,
8529
- danger: a.destructive,
8530
- onClick: p(() => {
8531
- if (!o) return;
8532
- let t = a.entity ? `${a.entity}.${e}` : e;
8533
- f({
8534
- action: a,
8535
- title: s,
8526
+ icon: u ? /* @__PURE__ */ Z(u, { size: 12 }) : null,
8527
+ danger: o.destructive,
8528
+ onClick: m(() => {
8529
+ if (!s) return;
8530
+ let t = o.entity ? `${o.entity}.${e}` : e;
8531
+ p({
8532
+ action: o,
8533
+ title: c,
8536
8534
  execute: async (e) => {
8537
- let r = await O(t, Me(e, n));
8538
- return i?.(), r;
8535
+ let i = await M(t, n(e, r));
8536
+ return a?.(), i;
8539
8537
  }
8540
8538
  });
8541
8539
  }),
8542
- children: s
8540
+ children: c
8543
8541
  }, e);
8544
8542
  })
8545
8543
  ]
@@ -8596,7 +8594,7 @@ function Hs({ entity: e, searchable: n, filterFields: r, searchValue: i, onSearc
8596
8594
  });
8597
8595
  }
8598
8596
  function Us({ field: e, label: t, value: n, onChange: r }) {
8599
- let i = ee(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = nt(e.ref?.entity, {
8597
+ let i = L(e.ref?.entity), a = e.display?.ref_display_field ?? i?.display?.display_field, o = q(() => i ? [...i.fields].find(([, e]) => e.primary)?.[0] ?? "id" : "id", [i]), { data: s } = nt(e.ref?.entity, {
8600
8598
  per_page: 200,
8601
8599
  sort: a ? `${a}:asc` : void 0
8602
8600
  }), c = s?.data ?? [], l = (e) => {
@@ -8748,7 +8746,7 @@ function tc({ leaf: e, entityActions: t, globalActions: n, onRun: r, loading: i,
8748
8746
  clip: "rect(0,0,0,0)"
8749
8747
  },
8750
8748
  children: e.reason
8751
- }), /* @__PURE__ */ Z(F, {
8749
+ }), /* @__PURE__ */ Z(P, {
8752
8750
  ref: o,
8753
8751
  kind: h ? "primary" : "default",
8754
8752
  danger: m,
@@ -8766,7 +8764,7 @@ function nc({ group: e, entityActions: n, globalActions: r, onRun: i, loading: a
8766
8764
  let l = J(null), [u, d] = Y(!1), f = e.name ? U(e.name) : "Actions", p = G((e) => {
8767
8765
  l.current = e, s?.(e);
8768
8766
  }, [s]), m = G((e, t) => (d(!1), i(e, t)), [i]);
8769
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
8767
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
8770
8768
  ref: p,
8771
8769
  kind: "default",
8772
8770
  icon: a == null ? e.icon ? /* @__PURE__ */ Z(R, {
@@ -9093,7 +9091,7 @@ function uc({ layout: e, entityActions: n, globalActions: r, onRun: i, reservedR
9093
9091
  let i = lc(e);
9094
9092
  if (e.kind === "action") {
9095
9093
  let t = Zs(e.code, n, r), a = Qs(e.code, n, r), o = $s(e.code, n, r);
9096
- return /* @__PURE__ */ Z(F, {
9094
+ return /* @__PURE__ */ Z(P, {
9097
9095
  "data-node-key": i,
9098
9096
  icon: o ? /* @__PURE__ */ Z(R, {
9099
9097
  name: o,
@@ -9105,7 +9103,7 @@ function uc({ layout: e, entityActions: n, globalActions: r, onRun: i, reservedR
9105
9103
  }, i);
9106
9104
  } else {
9107
9105
  let n = e.name ? U(e.name) : "Actions";
9108
- return /* @__PURE__ */ Z(F, {
9106
+ return /* @__PURE__ */ Z(P, {
9109
9107
  "data-node-key": i,
9110
9108
  iconRight: /* @__PURE__ */ Z(t.down, { size: 10 }),
9111
9109
  tabIndex: -1,
@@ -9146,7 +9144,7 @@ function uc({ layout: e, entityActions: n, globalActions: r, onRun: i, reservedR
9146
9144
  onLoadingChange: b
9147
9145
  }, t);
9148
9146
  }),
9149
- M && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
9147
+ M && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
9150
9148
  ref: w,
9151
9149
  kind: "default",
9152
9150
  iconRight: /* @__PURE__ */ Z(t.down, { size: 10 }),
@@ -9368,125 +9366,125 @@ function bc({ node: e, ctx: t }) {
9368
9366
  ]
9369
9367
  });
9370
9368
  }
9371
- function xc({ node: e, ctx: n, assocCode: r, assocEntity: i, fkField: a }) {
9372
- let o = e.columns && e.columns.length > 0 ? e.columns.filter((e) => e === a ? !1 : !!i.fields.get(e)) : i.fields.names().filter((e) => {
9373
- if (e === a) return !1;
9374
- let t = i.fields.get(e);
9369
+ function xc({ node: e, ctx: r, assocCode: i, assocEntity: a, fkField: o }) {
9370
+ let s = e.columns && e.columns.length > 0 ? e.columns.filter((e) => e === o ? !1 : !!a.fields.get(e)) : a.fields.names().filter((e) => {
9371
+ if (e === o) return !1;
9372
+ let t = a.fields.get(e);
9375
9373
  return !(!t || t.primary || t.display?.is_listable === !1);
9376
- }), s = $e(i, "update"), c = e.interaction ?? (s ? "navigate" : "readonly"), l = (c === "inline_edit" || c === "row_edit") && s && e.editable !== !1, u = U(i.display?.name_plural) || U(i.display?.name) || r, d = e.searchable === !0 || e.filters && e.filters.length > 0, f = q(() => hc(i.actions, a, n.recordId), [
9377
- i.actions,
9378
- a,
9379
- n.recordId
9380
- ]), p = q(() => {
9374
+ }), c = $e(a, "update"), l = e.interaction ?? (c ? "navigate" : "readonly"), u = (l === "inline_edit" || l === "row_edit") && c && e.editable !== !1, d = U(a.display?.name_plural) || U(a.display?.name) || i, f = e.searchable === !0 || e.filters && e.filters.length > 0, p = q(() => hc(a.actions, o, r.recordId), [
9375
+ a.actions,
9376
+ o,
9377
+ r.recordId
9378
+ ]), m = q(() => {
9381
9379
  let e = {};
9382
- for (let { code: t, action: n } of f) e[t] = n;
9380
+ for (let { code: t, action: n } of p) e[t] = n;
9383
9381
  return e;
9384
- }, [f]), m = q(() => Os(i.action_layout ?? null ?? zs(p, "list_toolbar"), p, void 0, {}, []), [i.action_layout, p]), { run: h } = to(), g = vr(), _ = Oe(), v = q(() => ({
9385
- entity: i,
9386
- entityCode: r,
9382
+ }, [p]), h = q(() => Os(a.action_layout ?? null ?? zs(m, "list_toolbar"), m, void 0, {}, []), [a.action_layout, m]), { run: g } = to(), _ = vr(), v = Oe(), y = q(() => ({
9383
+ entity: a,
9384
+ entityCode: i,
9387
9385
  screenRoute: typeof window < "u" ? window.location.pathname : "",
9388
9386
  selectedRows: [],
9389
9387
  selectedIds: [],
9390
- locale: _,
9391
- tabNavigate: (e, t) => g(e, {
9388
+ locale: v,
9389
+ tabNavigate: (e, t) => _(e, {
9392
9390
  title: t?.title,
9393
9391
  icon: t?.icon,
9394
9392
  search: t?.search
9395
9393
  }),
9396
- runActionApi: (e, t) => O(e, t)
9394
+ runActionApi: (e, t) => M(e, t)
9397
9395
  }), [
9396
+ a,
9398
9397
  i,
9399
- r,
9400
- _,
9401
- g
9402
- ]), y = un(), b = G(() => {
9403
- y.invalidateQueries({ predicate: (e) => {
9398
+ v,
9399
+ _
9400
+ ]), b = un(), x = G(() => {
9401
+ b.invalidateQueries({ predicate: (e) => {
9404
9402
  let t = e.queryKey;
9405
- return t[0] === "entity-children" && t[3] === r;
9403
+ return t[0] === "entity-children" && t[3] === i;
9406
9404
  } });
9407
- }, [y, r]), x = G((e, t) => {
9408
- let n = pc(e, t, {}, r);
9409
- if (n !== null) return h({
9405
+ }, [b, i]), S = G((e, t) => {
9406
+ let r = pc(e, t, {}, i);
9407
+ if (r !== null) return g({
9410
9408
  action: t,
9411
9409
  title: U(t.display?.name) || e,
9412
9410
  execute: async (e) => {
9413
- let t = await O(n, Me(e, void 0));
9414
- return b(), t;
9411
+ let t = await M(r, n(e, void 0));
9412
+ return x(), t;
9415
9413
  }
9416
9414
  });
9417
9415
  }, [
9418
- h,
9419
- r,
9420
- b
9421
- ]), [S, C] = Y(0), w = /* @__PURE__ */ Q("div", {
9416
+ g,
9417
+ i,
9418
+ x
9419
+ ]), [C, w] = Y(0), T = /* @__PURE__ */ Q("div", {
9422
9420
  style: {
9423
9421
  display: "flex",
9424
9422
  alignItems: "center",
9425
9423
  gap: 6
9426
9424
  },
9427
- children: [i.action_layout ? m.length > 0 && /* @__PURE__ */ Z(fc, {
9425
+ children: [a.action_layout ? h.length > 0 && /* @__PURE__ */ Z(fc, {
9428
9426
  kind: "toolbar",
9429
- layout: m,
9430
- entityActions: p,
9431
- onRun: x,
9432
- widgetContext: v,
9433
- ariaLabel: `${u} toolbar actions`
9434
- }) : f.map(({ code: e, action: t }) => /* @__PURE__ */ Z(Bs, {
9427
+ layout: h,
9428
+ entityActions: m,
9429
+ onRun: S,
9430
+ widgetContext: y,
9431
+ ariaLabel: `${d} toolbar actions`
9432
+ }) : p.map(({ code: e, action: t }) => /* @__PURE__ */ Z(Bs, {
9435
9433
  actionCode: e,
9436
9434
  action: t,
9437
- entityCode: r,
9435
+ entityCode: i,
9438
9436
  variant: "ghost",
9439
9437
  size: "sm",
9440
- onSuccess: b
9441
- }, e)), l && /* @__PURE__ */ Z(F, {
9438
+ onSuccess: x
9439
+ }, e)), u && /* @__PURE__ */ Z(P, {
9442
9440
  kind: "ghost",
9443
9441
  size: "xs",
9444
9442
  icon: /* @__PURE__ */ Z(t.plus, { size: 12 }),
9445
- onClick: () => C((e) => e + 1),
9443
+ onClick: () => w((e) => e + 1),
9446
9444
  children: "Add row"
9447
9445
  })]
9448
- }), T = d ? /* @__PURE__ */ Z(Cc, {
9449
- entityCode: r,
9450
- entity: i,
9451
- parentEntity: n.entityCode,
9452
- parentId: n.recordId,
9453
- foreignKey: a,
9454
- columns: o,
9455
- editable: l,
9456
- interaction: c,
9457
- ctx: n,
9446
+ }), E = f ? /* @__PURE__ */ Z(Cc, {
9447
+ entityCode: i,
9448
+ entity: a,
9449
+ parentEntity: r.entityCode,
9450
+ parentId: r.recordId,
9451
+ foreignKey: o,
9452
+ columns: s,
9453
+ editable: u,
9454
+ interaction: l,
9455
+ ctx: r,
9458
9456
  searchable: e.searchable,
9459
9457
  filterFields: e.filters,
9460
9458
  sort: e.sort,
9461
- startDraftSignal: S
9459
+ startDraftSignal: C
9462
9460
  }) : /* @__PURE__ */ Z(Sc, {
9463
- entityCode: r,
9464
- entity: i,
9465
- parentEntity: n.entityCode,
9466
- parentId: n.recordId,
9467
- foreignKey: a,
9468
- columns: o,
9469
- editable: l,
9470
- interaction: c,
9471
- ctx: n,
9461
+ entityCode: i,
9462
+ entity: a,
9463
+ parentEntity: r.entityCode,
9464
+ parentId: r.recordId,
9465
+ foreignKey: o,
9466
+ columns: s,
9467
+ editable: u,
9468
+ interaction: l,
9469
+ ctx: r,
9472
9470
  sort: e.sort,
9473
- startDraftSignal: S
9471
+ startDraftSignal: C
9474
9472
  });
9475
- return n.withinCard ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z("div", {
9473
+ return r.withinCard ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z("div", {
9476
9474
  style: {
9477
9475
  display: "flex",
9478
9476
  justifyContent: "flex-end",
9479
9477
  marginBottom: 8
9480
9478
  },
9481
- children: w
9482
- }), T] }) : /* @__PURE__ */ Z(ae, {
9483
- title: u,
9484
- icon: i.display?.icon ? /* @__PURE__ */ Z(R, {
9485
- name: i.display.icon,
9479
+ children: T
9480
+ }), E] }) : /* @__PURE__ */ Z(ae, {
9481
+ title: d,
9482
+ icon: a.display?.icon ? /* @__PURE__ */ Z(R, {
9483
+ name: a.display.icon,
9486
9484
  size: 14
9487
9485
  }) : void 0,
9488
- right: w,
9489
- children: T
9486
+ right: T,
9487
+ children: E
9490
9488
  });
9491
9489
  }
9492
9490
  function Sc({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, sort: l, startDraftSignal: u }) {
@@ -9588,7 +9586,7 @@ function Cc({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
9588
9586
  }),
9589
9587
  D && /* @__PURE__ */ Z("div", {
9590
9588
  style: { marginTop: 4 },
9591
- children: /* @__PURE__ */ Z(F, {
9589
+ children: /* @__PURE__ */ Z(P, {
9592
9590
  kind: "ghost",
9593
9591
  size: "xs",
9594
9592
  icon: k ? /* @__PURE__ */ Z(T, { size: 12 }) : void 0,
@@ -9599,38 +9597,38 @@ function Cc({ entityCode: e, entity: t, parentEntity: n, parentId: r, foreignKey
9599
9597
  })
9600
9598
  ] });
9601
9599
  }
9602
- function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a, editable: o, interaction: s, ctx: c, rows: l, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
9603
- let h = vr(), g = a.find((e) => e !== i), _ = q(() => s === "navigate" ? te(void 0, t, c.schema.screens) : null, [
9600
+ function wc({ entityCode: e, entity: t, parentId: n, foreignKey: r, columns: a, editable: o, interaction: s, ctx: c, rows: l, refs: u, isLoading: d, isError: f, invalidateQuery: p, startDraftSignal: m }) {
9601
+ let h = vr(), g = a.find((e) => e !== r), _ = q(() => s === "navigate" ? te(void 0, t, c.schema.screens) : null, [
9604
9602
  s,
9605
9603
  t,
9606
9604
  c.schema.screens
9607
- ]), v = q(() => o ? _c(t, a, i) : /* @__PURE__ */ new Set(), [
9605
+ ]), v = q(() => o ? _c(t, a, r) : /* @__PURE__ */ new Set(), [
9608
9606
  a,
9609
- i,
9607
+ r,
9610
9608
  t,
9611
9609
  o
9612
- ]), y = q(() => vc(t, a, i), [
9610
+ ]), y = q(() => vc(t, a, r), [
9613
9611
  a,
9614
- i,
9612
+ r,
9615
9613
  t
9616
9614
  ]), b = q(() => {
9617
9615
  let e = /* @__PURE__ */ new Map();
9618
9616
  for (let n of l) {
9619
9617
  let r = xe(t, n);
9620
- e.set(E(r), r);
9618
+ e.set(O(r), r);
9621
9619
  }
9622
9620
  return e;
9623
- }, [l, t]), x = q(() => mc(t.actions), [t.actions]), [S, C] = Y(null), [w, T] = Y(null), [D, O] = Y([]), [k, A] = Y({}), j = J(k);
9624
- j.current = k;
9625
- let M = J({});
9621
+ }, [l, t]), x = q(() => mc(t.actions), [t.actions]), [S, C] = Y(null), [w, T] = Y(null), [D, k] = Y([]), [A, j] = Y({}), M = J(A);
9622
+ M.current = A;
9623
+ let N = J({});
9626
9624
  K(() => {
9627
- let e = M.current;
9625
+ let e = N.current;
9628
9626
  return () => {
9629
9627
  for (let t of Object.values(e)) clearTimeout(t);
9630
9628
  };
9631
9629
  }, []);
9632
- let [N, P] = Y(null), [F, I] = Y([]), [L, ee] = Y(!1), [ne, re] = Y(null), [ie, ae] = Y(/* @__PURE__ */ new Set()), R = G(async (t, n, r) => {
9633
- A((e) => ({
9630
+ let [ee, P] = Y(null), [F, I] = Y([]), [L, ne] = Y(!1), [re, ie] = Y(null), [ae, R] = Y(/* @__PURE__ */ new Set()), oe = G(async (t, n, r) => {
9631
+ j((e) => ({
9634
9632
  ...e,
9635
9633
  [t]: {
9636
9634
  ...e[t],
@@ -9639,7 +9637,7 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9639
9637
  }
9640
9638
  }));
9641
9639
  try {
9642
- return await ct(e, b.get(t) ?? t, n), A((e) => {
9640
+ return await i(e, b.get(t) ?? t, n), j((e) => {
9643
9641
  let n = e[t];
9644
9642
  if (!n) return e;
9645
9643
  if (n.ver > r) return {
@@ -9654,7 +9652,7 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9654
9652
  }), p(), !0;
9655
9653
  } catch (e) {
9656
9654
  let n = e instanceof Error ? e.message : "Save failed";
9657
- return A((e) => ({
9655
+ return j((e) => ({
9658
9656
  ...e,
9659
9657
  [t]: {
9660
9658
  ...e[t],
@@ -9667,8 +9665,8 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9667
9665
  e,
9668
9666
  p,
9669
9667
  b
9670
- ]), oe = G((e, t, n) => {
9671
- A((r) => {
9668
+ ]), se = G((e, t, n) => {
9669
+ j((r) => {
9672
9670
  let i = r[e] ?? {
9673
9671
  buffer: {},
9674
9672
  ver: 0,
@@ -9685,88 +9683,88 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9685
9683
  ver: a
9686
9684
  }
9687
9685
  };
9688
- }), s === "inline_edit" && (M.current[e] && clearTimeout(M.current[e]), M.current[e] = setTimeout(() => {
9689
- let t = j.current[e];
9690
- t && Object.keys(t.buffer).length > 0 && R(e, { ...t.buffer }, t.ver);
9686
+ }), s === "inline_edit" && (N.current[e] && clearTimeout(N.current[e]), N.current[e] = setTimeout(() => {
9687
+ let t = M.current[e];
9688
+ t && Object.keys(t.buffer).length > 0 && oe(e, { ...t.buffer }, t.ver);
9691
9689
  }, 500));
9692
- }, [R, s]), se = G(() => {
9690
+ }, [oe, s]), ce = G(() => {
9693
9691
  let e = {};
9694
- e[i] = r;
9692
+ e[r] = n;
9695
9693
  for (let n of a) {
9696
9694
  let r = t.fields.get(n);
9697
9695
  r && (r.default === void 0 ? r.type === "bool" && (e[n] = !1) : e[n] = r.default);
9698
9696
  }
9699
9697
  P(e), I([]);
9700
9698
  }, [
9701
- i,
9702
9699
  r,
9700
+ n,
9703
9701
  a,
9704
9702
  t.fields
9705
- ]), ce = J(m);
9703
+ ]), le = J(m);
9706
9704
  K(() => {
9707
- m !== void 0 && m !== ce.current && (ce.current = m, !N && se());
9705
+ m !== void 0 && m !== le.current && (le.current = m, !ee && ce());
9708
9706
  }, [
9709
9707
  m,
9710
- N,
9711
- se
9708
+ ee,
9709
+ ce
9712
9710
  ]);
9713
- let le = G(async () => {
9714
- if (!N) return;
9715
- let r = yc(N, a, t, i);
9716
- if (r.length > 0) {
9717
- I(r);
9711
+ let z = G(async () => {
9712
+ if (!ee) return;
9713
+ let n = yc(ee, a, t, r);
9714
+ if (n.length > 0) {
9715
+ I(n);
9718
9716
  return;
9719
9717
  }
9720
- ee(!0);
9718
+ ne(!0);
9721
9719
  try {
9722
- await n(e, N), P(null), I([]), p();
9720
+ await Ae(e, ee), P(null), I([]), p();
9723
9721
  } catch (e) {
9724
9722
  I([`_error:${e instanceof Error ? e.message : "Create failed"}`]);
9725
9723
  } finally {
9726
- ee(!1);
9724
+ ne(!1);
9727
9725
  }
9728
9726
  }, [
9729
- N,
9727
+ ee,
9730
9728
  a,
9731
9729
  t,
9732
- i,
9730
+ r,
9733
9731
  e,
9734
9732
  p
9735
- ]), z = G((e) => {
9736
- A({}), O([]), T(e);
9737
- }, []), ue = G(async (e) => {
9738
- let n = j.current[e], r = n?.buffer ?? {};
9739
- if (Object.keys(r).length === 0) {
9740
- T(null), O([]);
9733
+ ]), ue = G((e) => {
9734
+ j({}), k([]), T(e);
9735
+ }, []), de = G(async (e) => {
9736
+ let n = M.current[e], i = n?.buffer ?? {};
9737
+ if (Object.keys(i).length === 0) {
9738
+ T(null), k([]);
9741
9739
  return;
9742
9740
  }
9743
9741
  let o = yc({
9744
- ...l.find((n) => E(xe(t, n)) === e) ?? {},
9745
- ...r
9746
- }, a, t, i);
9742
+ ...l.find((n) => O(xe(t, n)) === e) ?? {},
9743
+ ...i
9744
+ }, a, t, r);
9747
9745
  if (o.length > 0) {
9748
- O(o);
9746
+ k(o);
9749
9747
  return;
9750
9748
  }
9751
- await R(e, { ...r }, n?.ver ?? 0) && (T(null), O([]));
9749
+ await oe(e, { ...i }, n?.ver ?? 0) && (T(null), k([]));
9752
9750
  }, [
9753
9751
  l,
9754
9752
  t,
9755
9753
  a,
9756
- i,
9757
- R
9758
- ]), de = G((e) => {
9759
- A((t) => {
9754
+ r,
9755
+ oe
9756
+ ]), fe = G((e) => {
9757
+ j((t) => {
9760
9758
  if (!t[e]) return t;
9761
9759
  let { [e]: n, ...r } = t;
9762
9760
  return r;
9763
- }), O([]), T(null);
9764
- }, []), fe = G(async (t) => {
9765
- re(null), ae((e) => new Set(e).add(t));
9761
+ }), k([]), T(null);
9762
+ }, []), B = G(async (t) => {
9763
+ ie(null), R((e) => new Set(e).add(t));
9766
9764
  try {
9767
- await Ae(e, b.get(t) ?? t), p();
9765
+ await E(e, b.get(t) ?? t), p();
9768
9766
  } catch {} finally {
9769
- ae((e) => {
9767
+ R((e) => {
9770
9768
  let n = new Set(e);
9771
9769
  return n.delete(t), n;
9772
9770
  });
@@ -9801,9 +9799,9 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9801
9799
  borderRadius: 6
9802
9800
  } })]
9803
9801
  });
9804
- let B = l.length === 0 && !N;
9802
+ let pe = l.length === 0 && !ee;
9805
9803
  return /* @__PURE__ */ Q("div", { children: [
9806
- B && !o && /* @__PURE__ */ Z("div", {
9804
+ pe && !o && /* @__PURE__ */ Z("div", {
9807
9805
  style: {
9808
9806
  fontSize: 12.5,
9809
9807
  color: "var(--text-3)",
@@ -9811,7 +9809,7 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9811
9809
  },
9812
9810
  children: "No records yet."
9813
9811
  }),
9814
- (!B || o) && /* @__PURE__ */ Z("div", {
9812
+ (!pe || o) && /* @__PURE__ */ Z("div", {
9815
9813
  style: { overflowX: "auto" },
9816
9814
  children: /* @__PURE__ */ Q("table", {
9817
9815
  style: Ke,
@@ -9832,7 +9830,7 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9832
9830
  width: 40
9833
9831
  } })
9834
9832
  ] }) }), /* @__PURE__ */ Q("tbody", { children: [l.map((n) => {
9835
- let r = E(xe(t, n)), i = ie.has(r), l = k[r], d = _ && r ? _.replace(/:\w+/, r) : void 0, f = U(t.display?.name) || e, m = t.display?.icon;
9833
+ let r = O(xe(t, n)), i = ae.has(r), l = A[r], d = _ && r ? _.replace(/:\w+/, r) : void 0, f = U(t.display?.name) || e, m = t.display?.icon;
9836
9834
  return /* @__PURE__ */ Z(Tc, {
9837
9835
  rowId: r,
9838
9836
  row: n,
@@ -9849,17 +9847,17 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9849
9847
  activeCell: S,
9850
9848
  setActiveCell: C,
9851
9849
  rowState: l,
9852
- onCellChange: oe,
9850
+ onCellChange: se,
9853
9851
  onDeleteClick: (e) => {
9854
- re({
9852
+ ie({
9855
9853
  show: !0,
9856
9854
  rowId: e,
9857
9855
  label: Ue(n, t) ?? ""
9858
9856
  });
9859
9857
  },
9860
- onStartEdit: z,
9861
- onConfirmEdit: ue,
9862
- onCancelEdit: de,
9858
+ onStartEdit: ue,
9859
+ onConfirmEdit: de,
9860
+ onCancelEdit: fe,
9863
9861
  refs: u,
9864
9862
  identityCol: g,
9865
9863
  href: d,
@@ -9871,19 +9869,19 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9871
9869
  entityCode: e,
9872
9870
  onRowActionSuccess: p
9873
9871
  }, r);
9874
- }), N && /* @__PURE__ */ Z(Dc, {
9875
- draftRow: N,
9872
+ }), ee && /* @__PURE__ */ Z(Dc, {
9873
+ draftRow: ee,
9876
9874
  entity: t,
9877
9875
  columns: a,
9878
9876
  editableColumns: y,
9879
- foreignKey: i,
9877
+ foreignKey: r,
9880
9878
  draftErrors: F,
9881
9879
  draftSaving: L,
9882
9880
  onChange: (e, t) => P((n) => n && {
9883
9881
  ...n,
9884
9882
  [e]: t
9885
9883
  }),
9886
- onConfirm: le,
9884
+ onConfirm: z,
9887
9885
  onCancel: () => {
9888
9886
  P(null), I([]);
9889
9887
  },
@@ -9891,13 +9889,13 @@ function wc({ entityCode: e, entity: t, parentId: r, foreignKey: i, columns: a,
9891
9889
  })] })]
9892
9890
  })
9893
9891
  }),
9894
- ne && /* @__PURE__ */ Z(gr, {
9895
- open: ne.show,
9896
- onOpenChange: (e) => !e && re(null),
9892
+ re && /* @__PURE__ */ Z(gr, {
9893
+ open: re.show,
9894
+ onOpenChange: (e) => !e && ie(null),
9897
9895
  title: "Delete record",
9898
- description: ne.label ? `Are you sure you want to delete "${ne.label}"?` : "Are you sure you want to delete this record?",
9896
+ description: re.label ? `Are you sure you want to delete "${re.label}"?` : "Are you sure you want to delete this record?",
9899
9897
  confirmLabel: "Delete",
9900
- onConfirm: () => fe(ne.rowId),
9898
+ onConfirm: () => B(re.rowId),
9901
9899
  destructive: !0
9902
9900
  })
9903
9901
  ] });
@@ -10143,17 +10141,17 @@ var Oc = [
10143
10141
  "image/webp"
10144
10142
  ], kc = 5 * 1024 * 1024;
10145
10143
  function Ac() {
10146
- let e = $t(), n = We((e) => e.user), r = We((e) => e.activeTenant), i = We((e) => e.refreshMe), [o, s] = Y(!1), [c, l] = Y(!1), [u, d] = Y(!1), [p, m] = Y({
10144
+ let e = $t(), n = We((e) => e.user), r = We((e) => e.activeTenant), o = We((e) => e.refreshMe), [s, c] = Y(!1), [l, u] = Y(!1), [d, f] = Y(!1), [p, m] = Y({
10147
10145
  email: !0,
10148
10146
  inapp: !0,
10149
10147
  slack: !1,
10150
10148
  desktop: !1
10151
- }), h = J(null), g = n?.display_name || n?.email || "User", _ = n?.email ?? "", v = n?.roles && n.roles[0] || "Member", y = r?.env ? `${r.name} · ${r.env}` : r?.name ?? "—", S = n?.created_at ? new Date(n.created_at).toLocaleDateString() : "—", { data: C, refetch: w } = ln({
10149
+ }), h = J(null), g = n?.display_name || n?.email || "User", _ = n?.email ?? "", y = n?.roles && n.roles[0] || "Member", S = r?.env ? `${r.name} · ${r.env}` : r?.name ?? "—", C = n?.created_at ? new Date(n.created_at).toLocaleDateString() : "—", { data: w, refetch: E } = ln({
10152
10150
  queryKey: ["profile-files", n?.id],
10153
- queryFn: () => f("profile", { id: n.id }),
10151
+ queryFn: () => v("profile", { id: n.id }),
10154
10152
  enabled: !!n?.id,
10155
10153
  staleTime: 300 * 1e3
10156
- }), E = C?.data?.avatar, D = E?.derivations?.thumb_200 ?? E?.url ?? null;
10154
+ }), D = w?.data?.avatar, O = D?.derivations?.thumb_200 ?? D?.url ?? null;
10157
10155
  return /* @__PURE__ */ Q("div", {
10158
10156
  style: {
10159
10157
  flex: 1,
@@ -10182,17 +10180,17 @@ function Ac() {
10182
10180
  children: [
10183
10181
  /* @__PURE__ */ Q("div", {
10184
10182
  onClick: () => {
10185
- u || h.current?.click();
10183
+ d || h.current?.click();
10186
10184
  },
10187
10185
  title: "Click to change avatar",
10188
10186
  style: {
10189
10187
  position: "relative",
10190
- cursor: u ? "default" : "pointer",
10188
+ cursor: d ? "default" : "pointer",
10191
10189
  flexShrink: 0
10192
10190
  },
10193
10191
  children: [
10194
- D ? /* @__PURE__ */ Z("img", {
10195
- src: D,
10192
+ O ? /* @__PURE__ */ Z("img", {
10193
+ src: O,
10196
10194
  alt: "Avatar",
10197
10195
  style: {
10198
10196
  width: 56,
@@ -10214,11 +10212,11 @@ function Ac() {
10214
10212
  display: "flex",
10215
10213
  alignItems: "center",
10216
10214
  justifyContent: "center",
10217
- opacity: +!!u,
10215
+ opacity: +!!d,
10218
10216
  transition: "opacity 0.15s"
10219
10217
  },
10220
10218
  className: "avatar-upload-overlay",
10221
- children: u ? /* @__PURE__ */ Z(T, { size: 18 }) : /* @__PURE__ */ Z(t.upload, {
10219
+ children: d ? /* @__PURE__ */ Z(T, { size: 18 }) : /* @__PURE__ */ Z(t.upload, {
10222
10220
  size: 16,
10223
10221
  style: { color: "#fff" }
10224
10222
  })
@@ -10240,22 +10238,22 @@ function Ac() {
10240
10238
  $.error(r.message);
10241
10239
  return;
10242
10240
  }
10243
- d(!0);
10241
+ f(!0);
10244
10242
  try {
10245
10243
  let e = await kt({
10246
10244
  file: t,
10247
10245
  entityCode: "profile",
10248
10246
  fieldCode: "avatar"
10249
10247
  });
10250
- await ct("profile", { id: n.id }, { $files: { avatar: { set: [{
10248
+ await i("profile", { id: n.id }, { $files: { avatar: { set: [{
10251
10249
  file_id: e.id,
10252
10250
  filename: e.filename
10253
- }] } } }), await w(), $.success("Avatar updated.");
10251
+ }] } } }), await E(), $.success("Avatar updated.");
10254
10252
  } catch (e) {
10255
10253
  let t = e instanceof Error ? e.message : "Upload failed.";
10256
10254
  $.error(t);
10257
10255
  } finally {
10258
- d(!1);
10256
+ f(!1);
10259
10257
  }
10260
10258
  }
10261
10259
  }),
@@ -10295,12 +10293,12 @@ function Ac() {
10295
10293
  tone: "violet",
10296
10294
  size: "xs",
10297
10295
  dot: !0,
10298
- children: v
10296
+ children: y
10299
10297
  }),
10300
10298
  /* @__PURE__ */ Z(z, {
10301
10299
  tone: "slate",
10302
10300
  size: "xs",
10303
- children: y
10301
+ children: S
10304
10302
  }),
10305
10303
  n?.is_active && /* @__PURE__ */ Z(z, {
10306
10304
  tone: "emerald",
@@ -10312,12 +10310,12 @@ function Ac() {
10312
10310
  })
10313
10311
  ]
10314
10312
  }),
10315
- /* @__PURE__ */ Z(F, {
10313
+ /* @__PURE__ */ Z(P, {
10316
10314
  icon: /* @__PURE__ */ Z(t.edit, { size: 13 }),
10317
- onClick: () => l(!0),
10315
+ onClick: () => u(!0),
10318
10316
  children: "Edit profile"
10319
10317
  }),
10320
- /* @__PURE__ */ Z(F, {
10318
+ /* @__PURE__ */ Z(P, {
10321
10319
  icon: /* @__PURE__ */ Z(t.settings, { size: 13 }),
10322
10320
  onClick: () => e("/preferences"),
10323
10321
  children: "Preferences"
@@ -10372,7 +10370,7 @@ function Ac() {
10372
10370
  label: "Joined",
10373
10371
  children: /* @__PURE__ */ Z("span", {
10374
10372
  className: "mono",
10375
- children: S
10373
+ children: C
10376
10374
  })
10377
10375
  })
10378
10376
  ]
@@ -10392,9 +10390,9 @@ function Ac() {
10392
10390
  icon: /* @__PURE__ */ Z(t.key, { size: 13 }),
10393
10391
  label: "Password",
10394
10392
  hint: "Update at any time",
10395
- action: /* @__PURE__ */ Z(F, {
10393
+ action: /* @__PURE__ */ Z(P, {
10396
10394
  size: "xs",
10397
- onClick: () => s(!0),
10395
+ onClick: () => c(!0),
10398
10396
  children: "Change"
10399
10397
  })
10400
10398
  }),
@@ -10412,7 +10410,7 @@ function Ac() {
10412
10410
  icon: /* @__PURE__ */ Z(t.device, { size: 13 }),
10413
10411
  label: "Trusted devices",
10414
10412
  hint: "Sign-in sessions by device",
10415
- action: /* @__PURE__ */ Z(F, {
10413
+ action: /* @__PURE__ */ Z(P, {
10416
10414
  size: "xs",
10417
10415
  kind: "ghost",
10418
10416
  children: "Manage"
@@ -10422,7 +10420,7 @@ function Ac() {
10422
10420
  icon: /* @__PURE__ */ Z(t.activity, { size: 13 }),
10423
10421
  label: "Sign-in history",
10424
10422
  hint: "Audit trail of recent logins",
10425
- action: /* @__PURE__ */ Z(F, {
10423
+ action: /* @__PURE__ */ Z(P, {
10426
10424
  size: "xs",
10427
10425
  kind: "ghost",
10428
10426
  children: "View"
@@ -10447,7 +10445,7 @@ function Ac() {
10447
10445
  tone: "violet",
10448
10446
  size: "xs",
10449
10447
  dot: !0,
10450
- children: v
10448
+ children: y
10451
10449
  })
10452
10450
  }),
10453
10451
  /* @__PURE__ */ Z(oe, {
@@ -10565,24 +10563,24 @@ function Ac() {
10565
10563
  /* @__PURE__ */ Z("span", { children: "·" }),
10566
10564
  /* @__PURE__ */ Q("span", { children: ["Created ", /* @__PURE__ */ Z("span", {
10567
10565
  className: "mono",
10568
- children: S
10566
+ children: C
10569
10567
  })] })
10570
10568
  ]
10571
10569
  })
10572
10570
  ]
10573
10571
  }),
10574
10572
  /* @__PURE__ */ Z(jc, {
10575
- open: c,
10573
+ open: l,
10576
10574
  initialName: n?.display_name ?? "",
10577
10575
  userId: n?.id ?? "",
10578
- onClose: () => l(!1),
10576
+ onClose: () => u(!1),
10579
10577
  onSaved: async () => {
10580
- await i(), l(!1);
10578
+ await o(), u(!1);
10581
10579
  }
10582
10580
  }),
10583
10581
  /* @__PURE__ */ Z(ls, {
10584
- open: o,
10585
- onClose: () => s(!1),
10582
+ open: s,
10583
+ onClose: () => c(!1),
10586
10584
  onSubmit: async ({ current: e, next: t }) => {
10587
10585
  await b(e, t), $.success("Password changed. Sign in again to continue.");
10588
10586
  }
@@ -10590,14 +10588,14 @@ function Ac() {
10590
10588
  ]
10591
10589
  });
10592
10590
  }
10593
- function jc({ open: e, initialName: n, userId: r, onClose: i, onSaved: a }) {
10594
- let [o, s] = Y(n), [c, l] = Y(!1), [u, f] = Y(null);
10591
+ function jc({ open: e, initialName: n, userId: r, onClose: a, onSaved: o }) {
10592
+ let [s, c] = Y(n), [l, u] = Y(!1), [f, p] = Y(null);
10595
10593
  if (!e) return null;
10596
- let p = () => {
10597
- s(n), f(null), i();
10594
+ let m = () => {
10595
+ c(n), p(null), a();
10598
10596
  };
10599
10597
  return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z("div", {
10600
- onClick: p,
10598
+ onClick: m,
10601
10599
  style: {
10602
10600
  position: "fixed",
10603
10601
  inset: 0,
@@ -10660,7 +10658,7 @@ function jc({ open: e, initialName: n, userId: r, onClose: i, onSaved: a }) {
10660
10658
  }),
10661
10659
  /* @__PURE__ */ Z(B, {
10662
10660
  icon: /* @__PURE__ */ Z(t.x, { size: 14 }),
10663
- onClick: p
10661
+ onClick: m
10664
10662
  })
10665
10663
  ]
10666
10664
  }),
@@ -10675,11 +10673,11 @@ function jc({ open: e, initialName: n, userId: r, onClose: i, onSaved: a }) {
10675
10673
  required: !0,
10676
10674
  children: "Display name"
10677
10675
  }), /* @__PURE__ */ Z(N, {
10678
- value: o,
10679
- onChange: s,
10676
+ value: s,
10677
+ onChange: c,
10680
10678
  placeholder: "Your name",
10681
10679
  autoFocus: !0
10682
- })] }), u && /* @__PURE__ */ Q("div", {
10680
+ })] }), f && /* @__PURE__ */ Q("div", {
10683
10681
  style: {
10684
10682
  padding: "8px 10px",
10685
10683
  background: "var(--danger-soft)",
@@ -10689,7 +10687,7 @@ function jc({ open: e, initialName: n, userId: r, onClose: i, onSaved: a }) {
10689
10687
  display: "flex",
10690
10688
  gap: 6
10691
10689
  },
10692
- children: [/* @__PURE__ */ Z(t.info, { size: 13 }), /* @__PURE__ */ Z("span", { children: u })]
10690
+ children: [/* @__PURE__ */ Z(t.info, { size: 13 }), /* @__PURE__ */ Z("span", { children: f })]
10693
10691
  })]
10694
10692
  }),
10695
10693
  /* @__PURE__ */ Q("div", {
@@ -10703,29 +10701,29 @@ function jc({ open: e, initialName: n, userId: r, onClose: i, onSaved: a }) {
10703
10701
  },
10704
10702
  children: [
10705
10703
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
10706
- /* @__PURE__ */ Z(F, {
10707
- onClick: p,
10704
+ /* @__PURE__ */ Z(P, {
10705
+ onClick: m,
10708
10706
  children: "Cancel"
10709
10707
  }),
10710
- /* @__PURE__ */ Z(F, {
10708
+ /* @__PURE__ */ Z(P, {
10711
10709
  kind: "primary",
10712
- icon: Z(c ? T : t.check, { size: 13 }),
10710
+ icon: Z(l ? T : t.check, { size: 13 }),
10713
10711
  onClick: async () => {
10714
- if (!o.trim()) {
10715
- f("Display name is required.");
10712
+ if (!s.trim()) {
10713
+ p("Display name is required.");
10716
10714
  return;
10717
10715
  }
10718
- f(null), l(!0);
10716
+ p(null), u(!0);
10719
10717
  try {
10720
- await ct("profile", { id: r }, { display_name: o.trim() }), await a();
10718
+ await i("profile", { id: r }, { display_name: s.trim() }), await o();
10721
10719
  } catch (e) {
10722
- f(e instanceof Error ? e.message : "Failed to save.");
10720
+ p(e instanceof Error ? e.message : "Failed to save.");
10723
10721
  } finally {
10724
- l(!1);
10722
+ u(!1);
10725
10723
  }
10726
10724
  },
10727
- disabled: !o.trim() || c,
10728
- children: c ? "Saving…" : "Save"
10725
+ disabled: !s.trim() || l,
10726
+ children: l ? "Saving…" : "Save"
10729
10727
  })
10730
10728
  ]
10731
10729
  })
@@ -11135,12 +11133,12 @@ function Uc() {
11135
11133
  gap: 6,
11136
11134
  marginBottom: 14
11137
11135
  },
11138
- children: [/* @__PURE__ */ Z(F, {
11136
+ children: [/* @__PURE__ */ Z(P, {
11139
11137
  kind: t === "handlers" ? "primary" : "default",
11140
11138
  active: t === "handlers",
11141
11139
  onClick: () => n("handlers"),
11142
11140
  children: "Handlers"
11143
- }), /* @__PURE__ */ Z(F, {
11141
+ }), /* @__PURE__ */ Z(P, {
11144
11142
  kind: t === "actions" ? "primary" : "default",
11145
11143
  active: t === "actions",
11146
11144
  onClick: () => n("actions"),
@@ -11512,20 +11510,20 @@ function $c(e) {
11512
11510
  return e == null ? "all matching rows" : `${e.toLocaleString()} ${e === 1 ? "row" : "rows"}`;
11513
11511
  }
11514
11512
  function el(e) {
11515
- let { entityCode: n, entity: r, screen: i, viewState: a, visibleColumns: o, selectedRowPKs: s, totalRows: c, pageSize: l, locale: u, align: d = "end", variant: f = "toolbar", onBeforeOpen: p } = e, [m, h] = Y(!1), [g, _] = Y(!1), [v, y] = Y(null), b = J(null), x = Qc(r.export), S = Qc(i?.export);
11516
- if (!x || !S) return null;
11517
- async function w(e) {
11518
- y(null), _(!0);
11513
+ let { entityCode: n, entity: r, screen: i, viewState: a, visibleColumns: o, selectedRowPKs: s, totalRows: c, pageSize: l, locale: u, align: d = "end", variant: p = "toolbar", onBeforeOpen: m } = e, [h, g] = Y(!1), [_, v] = Y(!1), [y, b] = Y(null), x = J(null), S = Qc(r.export), w = Qc(i?.export);
11514
+ if (!S || !w) return null;
11515
+ async function T(e) {
11516
+ b(null), v(!0);
11519
11517
  try {
11520
- let { blob: t, filename: r } = await M(n, Zc(a, {
11518
+ let { blob: t, filename: r } = await f(n, Zc(a, {
11521
11519
  scope: e,
11522
11520
  visibleColumns: o,
11523
11521
  selectedRowPKs: e === "selected_rows" ? s : void 0,
11524
11522
  locale: u
11525
11523
  }));
11526
- nl(t, r || `${n}-${tl()}.csv`), h(!1);
11524
+ nl(t, r || `${n}-${tl()}.csv`), g(!1);
11527
11525
  } catch (e) {
11528
- y(e instanceof Et ? {
11526
+ b(e instanceof Et ? {
11529
11527
  code: e.code,
11530
11528
  message: e.message
11531
11529
  } : {
@@ -11533,58 +11531,58 @@ function el(e) {
11533
11531
  message: String(e)
11534
11532
  });
11535
11533
  } finally {
11536
- _(!1);
11534
+ v(!1);
11537
11535
  }
11538
11536
  }
11539
- if (f === "selection-menu-item") {
11540
- let e = g || s.length === 0;
11537
+ if (p === "selection-menu-item") {
11538
+ let e = _ || s.length === 0;
11541
11539
  return /* @__PURE__ */ Z(W, {
11542
11540
  icon: /* @__PURE__ */ Z(t.download, { size: 12 }),
11543
11541
  "data-testid": "export-selection-menu-item",
11544
11542
  onClick: e ? void 0 : () => {
11545
- p?.(), w("selected_rows");
11543
+ m?.(), T("selected_rows");
11546
11544
  },
11547
- children: g ? "Exporting…" : "Export selection (CSV)"
11545
+ children: _ ? "Exporting…" : "Export selection (CSV)"
11548
11546
  });
11549
11547
  }
11550
- let T = s.length > 0;
11551
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
11552
- ref: b,
11548
+ let E = s.length > 0;
11549
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
11550
+ ref: x,
11553
11551
  kind: "ghost",
11554
11552
  size: "sm",
11555
11553
  icon: /* @__PURE__ */ Z(t.download, { size: 12 }),
11556
11554
  onClick: () => {
11557
- p?.(), h((e) => !e);
11555
+ m?.(), g((e) => !e);
11558
11556
  },
11559
- disabled: g,
11560
- children: g ? "Exporting…" : "Export"
11557
+ disabled: _,
11558
+ children: _ ? "Exporting…" : "Export"
11561
11559
  }), /* @__PURE__ */ Q(C, {
11562
- open: m,
11563
- anchor: b.current,
11564
- onClose: () => h(!1),
11560
+ open: h,
11561
+ anchor: x.current,
11562
+ onClose: () => g(!1),
11565
11563
  align: d,
11566
11564
  width: 260,
11567
11565
  children: [
11568
11566
  /* @__PURE__ */ Q(W, {
11569
11567
  icon: /* @__PURE__ */ Z(t.download, { size: 12 }),
11570
- onClick: g ? void 0 : () => void w("current_view"),
11568
+ onClick: _ ? void 0 : () => void T("current_view"),
11571
11569
  children: ["Current view (CSV) · ", $c(c)]
11572
11570
  }),
11573
- T && /* @__PURE__ */ Q(W, {
11571
+ E && /* @__PURE__ */ Q(W, {
11574
11572
  icon: /* @__PURE__ */ Z(t.check, { size: 12 }),
11575
- onClick: g ? void 0 : () => void w("selected_rows"),
11573
+ onClick: _ ? void 0 : () => void T("selected_rows"),
11576
11574
  children: ["Selected rows (CSV) · ", s.length]
11577
11575
  }),
11578
11576
  /* @__PURE__ */ Q(W, {
11579
11577
  icon: /* @__PURE__ */ Z(t.columns, { size: 12 }),
11580
- onClick: g ? void 0 : () => void w("current_page"),
11578
+ onClick: _ ? void 0 : () => void T("current_page"),
11581
11579
  children: ["Current page (CSV) · ", l ? `${l} rows` : "page window"]
11582
11580
  }),
11583
11581
  /* @__PURE__ */ Z(W, {
11584
11582
  icon: /* @__PURE__ */ Z(t.grid, { size: 12 }),
11585
11583
  children: "XLSX (coming soon)"
11586
11584
  }),
11587
- v && /* @__PURE__ */ Q("div", {
11585
+ y && /* @__PURE__ */ Q("div", {
11588
11586
  role: "alert",
11589
11587
  style: {
11590
11588
  padding: "6px 10px",
@@ -11594,9 +11592,9 @@ function el(e) {
11594
11592
  borderTop: "1px solid var(--border)"
11595
11593
  },
11596
11594
  children: [
11597
- /* @__PURE__ */ Z("strong", { children: v.code }),
11595
+ /* @__PURE__ */ Z("strong", { children: y.code }),
11598
11596
  ": ",
11599
- v.message
11597
+ y.message
11600
11598
  ]
11601
11599
  })
11602
11600
  ]
@@ -12248,7 +12246,7 @@ function El({ entity: e, entityCode: n, record: r, title: i, recordId: a, avatar
12248
12246
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
12249
12247
  O.length > 0 && /* @__PURE__ */ Q("div", {
12250
12248
  style: { position: "relative" },
12251
- children: [/* @__PURE__ */ Z(F, {
12249
+ children: [/* @__PURE__ */ Z(P, {
12252
12250
  ref: w,
12253
12251
  kind: "default",
12254
12252
  icon: /* @__PURE__ */ Z(t.bolt, { size: 13 }),
@@ -12277,13 +12275,13 @@ function El({ entity: e, entityCode: n, record: r, title: i, recordId: a, avatar
12277
12275
  }, e))
12278
12276
  })]
12279
12277
  }),
12280
- D && /* @__PURE__ */ Z(F, {
12278
+ D && /* @__PURE__ */ Z(P, {
12281
12279
  kind: "default",
12282
12280
  icon: Tl(D.action, 13),
12283
12281
  onClick: () => k(D),
12284
12282
  children: U(D.action.display?.name) || D.code
12285
12283
  }),
12286
- /* @__PURE__ */ Z(F, {
12284
+ /* @__PURE__ */ Z(P, {
12287
12285
  kind: "primary",
12288
12286
  icon: /* @__PURE__ */ Z(t.edit, { size: 13 }),
12289
12287
  onClick: () => p(v ? g : null),
@@ -12459,7 +12457,7 @@ function Ul({ filters: e, onRemove: n, onClearAll: r, onChipClick: i, fieldLabel
12459
12457
  fieldLabel: a,
12460
12458
  onRemove: () => n(e.field),
12461
12459
  onClick: i
12462
- }, `${e.field}-${t}`) : null), /* @__PURE__ */ Z(F, {
12460
+ }, `${e.field}-${t}`) : null), /* @__PURE__ */ Z(P, {
12463
12461
  kind: "ghost",
12464
12462
  size: "xs",
12465
12463
  icon: /* @__PURE__ */ Z(t.x, { size: 11 }),
@@ -12479,7 +12477,7 @@ function Ul({ filters: e, onRemove: n, onClearAll: r, onChipClick: i, fieldLabel
12479
12477
  fieldLabel: a,
12480
12478
  onRemove: () => n(e.field),
12481
12479
  onClick: i
12482
- }, `${e.field}-${t}`)), /* @__PURE__ */ Z(F, {
12480
+ }, `${e.field}-${t}`)), /* @__PURE__ */ Z(P, {
12483
12481
  kind: "ghost",
12484
12482
  size: "xs",
12485
12483
  icon: /* @__PURE__ */ Z(t.x, { size: 11 }),
@@ -12641,11 +12639,11 @@ function Kl({ open: e, onClose: n, filters: r, onApply: i, availableFields: a })
12641
12639
  activeFields: d,
12642
12640
  onSelect: f,
12643
12641
  onCancel: () => l(!1)
12644
- }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
12642
+ }) : /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
12645
12643
  icon: /* @__PURE__ */ Z(t.plus, { size: 12 }),
12646
12644
  onClick: () => l(!0),
12647
12645
  children: "Add filter"
12648
- }), !u && o.some((e) => e.field) && /* @__PURE__ */ Z(F, {
12646
+ }), !u && o.some((e) => e.field) && /* @__PURE__ */ Z(P, {
12649
12647
  kind: "ghost",
12650
12648
  icon: /* @__PURE__ */ Z(t.plus, { size: 12 }),
12651
12649
  onClick: () => {
@@ -12666,7 +12664,7 @@ function Kl({ open: e, onClose: n, filters: r, onApply: i, availableFields: a })
12666
12664
  gap: 6
12667
12665
  },
12668
12666
  children: [
12669
- /* @__PURE__ */ Z(F, {
12667
+ /* @__PURE__ */ Z(P, {
12670
12668
  kind: "ghost",
12671
12669
  onClick: () => {
12672
12670
  s([]);
@@ -12674,11 +12672,11 @@ function Kl({ open: e, onClose: n, filters: r, onApply: i, availableFields: a })
12674
12672
  children: "Reset"
12675
12673
  }),
12676
12674
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
12677
- /* @__PURE__ */ Z(F, {
12675
+ /* @__PURE__ */ Z(P, {
12678
12676
  onClick: n,
12679
12677
  children: "Cancel"
12680
12678
  }),
12681
- /* @__PURE__ */ Z(F, {
12679
+ /* @__PURE__ */ Z(P, {
12682
12680
  kind: "primary",
12683
12681
  onClick: () => {
12684
12682
  i(o.map((e) => {
@@ -12823,7 +12821,7 @@ function Jl({ groups: e, availableFields: n, onChange: r }) {
12823
12821
  }
12824
12822
  }, `${t.field}-${i}`) : null;
12825
12823
  }),
12826
- /* @__PURE__ */ Z(F, {
12824
+ /* @__PURE__ */ Z(P, {
12827
12825
  kind: "ghost",
12828
12826
  size: "xs",
12829
12827
  icon: /* @__PURE__ */ Z(t.plus, { size: 11 }),
@@ -12837,7 +12835,7 @@ function Jl({ groups: e, availableFields: n, onChange: r }) {
12837
12835
  children: "Add condition"
12838
12836
  })
12839
12837
  ]
12840
- })] }, a)), /* @__PURE__ */ Z(F, {
12838
+ })] }, a)), /* @__PURE__ */ Z(P, {
12841
12839
  kind: "ghost",
12842
12840
  size: "xs",
12843
12841
  icon: /* @__PURE__ */ Z(t.plus, { size: 11 }),
@@ -12908,7 +12906,7 @@ function Yl({ fields: e, activeFields: n, onSelect: r, onCancel: i }) {
12908
12906
  children: "No fields available"
12909
12907
  })]
12910
12908
  }),
12911
- /* @__PURE__ */ Z(F, {
12909
+ /* @__PURE__ */ Z(P, {
12912
12910
  kind: "ghost",
12913
12911
  size: "xs",
12914
12912
  onClick: i,
@@ -13148,11 +13146,11 @@ function Ql({ open: e, pending: t, onClose: n, onSave: r }) {
13148
13146
  justifyContent: "flex-end",
13149
13147
  gap: 8
13150
13148
  },
13151
- children: [/* @__PURE__ */ Z(F, {
13149
+ children: [/* @__PURE__ */ Z(P, {
13152
13150
  onClick: n,
13153
13151
  disabled: t,
13154
13152
  children: "Cancel"
13155
- }), /* @__PURE__ */ Z(F, {
13153
+ }), /* @__PURE__ */ Z(P, {
13156
13154
  kind: "primary",
13157
13155
  onClick: () => void r(o),
13158
13156
  disabled: !o || t,
@@ -13164,16 +13162,16 @@ function Ql({ open: e, pending: t, onClose: n, onSave: r }) {
13164
13162
  }
13165
13163
  //#endregion
13166
13164
  //#region src/components/pages/list/ListHeader.tsx
13167
- function $l({ title: e, total: t, countMode: n, countPending: r, loaded: i, toolbarActions: a, screenActionLayout: o, entityActionLayout: s, selectedIds: c, data: l, rowKey: u, onActionSuccess: d, widgetContext: f }) {
13168
- let { run: p } = to(), m = q(() => {
13165
+ function $l({ title: e, total: t, countMode: r, countPending: i, loaded: a, toolbarActions: o, screenActionLayout: s, entityActionLayout: c, selectedIds: l, data: u, rowKey: d, onActionSuccess: f, widgetContext: p }) {
13166
+ let { run: m } = to(), h = q(() => {
13169
13167
  let e = {};
13170
- for (let { code: t, action: n } of a) e[t] = n;
13168
+ for (let { code: t, action: n } of o) e[t] = n;
13171
13169
  return e;
13172
- }, [a]), h = q(() => Is((o ?? s) || zs(m, "list_toolbar"), m, void 0, "list_toolbar"), [
13173
- o,
13170
+ }, [o]), g = q(() => Is((s ?? c) || zs(h, "list_toolbar"), h, void 0, "list_toolbar"), [
13174
13171
  s,
13175
- m
13176
- ]), g = q(() => Rs(h, m, void 0, Ls, "Select one or more rows first"), [h, m]), _ = q(() => Is(h, m, void 0, "list_toolbar", { excludeIf: Ls }), [h, m]), v = c.length > 0 ? _ : g;
13172
+ c,
13173
+ h
13174
+ ]), _ = q(() => Rs(g, h, void 0, Ls, "Select one or more rows first"), [g, h]), v = q(() => Is(g, h, void 0, "list_toolbar", { excludeIf: Ls }), [g, h]), y = l.length > 0 ? v : _;
13177
13175
  return /* @__PURE__ */ Q("div", {
13178
13176
  style: {
13179
13177
  display: "flex",
@@ -13209,71 +13207,71 @@ function $l({ title: e, total: t, countMode: n, countPending: r, loaded: i, tool
13209
13207
  },
13210
13208
  "data-testid": "list-count",
13211
13209
  children: [
13212
- i,
13210
+ a,
13213
13211
  " of",
13214
13212
  " ",
13215
- t === void 0 ? r ? /* @__PURE__ */ Z("span", {
13213
+ t === void 0 ? i ? /* @__PURE__ */ Z("span", {
13216
13214
  "data-testid": "list-count-pending",
13217
13215
  style: { display: "inline-flex" },
13218
13216
  children: /* @__PURE__ */ Z(T, { size: 10 })
13219
- }) : i : Hl(t, n ?? "exact")
13217
+ }) : a : Hl(t, r ?? "exact")
13220
13218
  ]
13221
13219
  })]
13222
13220
  })
13223
- }), v.length > 0 && /* @__PURE__ */ Z(fc, {
13224
- layout: v,
13221
+ }), y.length > 0 && /* @__PURE__ */ Z(fc, {
13222
+ layout: y,
13225
13223
  kind: "toolbar",
13226
- entityActions: m,
13224
+ entityActions: h,
13227
13225
  onRun: (e, t) => {
13228
- let n = pc(e, t, {});
13229
- if (n === null) return;
13230
- let r = U(t.display?.name) || e, i;
13231
- if (c.length > 0) {
13226
+ let r = pc(e, t, {});
13227
+ if (r === null) return;
13228
+ let i = U(t.display?.name) || e, a;
13229
+ if (l.length > 0) {
13232
13230
  let e = /* @__PURE__ */ new Map();
13233
- for (let t of l) e.set(u(t), t);
13234
- i = c.map((t) => e.get(t)).filter((e) => e !== void 0);
13231
+ for (let t of u) e.set(d(t), t);
13232
+ a = l.map((t) => e.get(t)).filter((e) => e !== void 0);
13235
13233
  }
13236
- return p({
13234
+ return m({
13237
13235
  action: t,
13238
- title: r,
13239
- bulkSelection: i,
13236
+ title: i,
13237
+ bulkSelection: a,
13240
13238
  execute: async (e) => {
13241
- let t = c.length > 0 ? c : void 0, r = await O(n, Me(e, t));
13242
- return t && t.length > 0 && d(), r;
13239
+ let t = l.length > 0 ? l : void 0, i = await M(r, n(e, t));
13240
+ return t && t.length > 0 && f(), i;
13243
13241
  }
13244
13242
  });
13245
13243
  },
13246
- widgetContext: f,
13244
+ widgetContext: p,
13247
13245
  ariaLabel: "List toolbar actions"
13248
13246
  })]
13249
13247
  });
13250
13248
  }
13251
13249
  //#endregion
13252
13250
  //#region src/components/pages/list/ListBulkBar.tsx
13253
- function eu({ selectedIds: e, floatbarActions: n, screenActionLayout: r, entityActionLayout: i, data: a, rowKey: o, entityCode: s, onClear: c, onActionSuccess: l, widgetContext: u }) {
13254
- let { run: d } = to(), f = un(), p = q(() => {
13251
+ function eu({ selectedIds: e, floatbarActions: r, screenActionLayout: i, entityActionLayout: a, data: o, rowKey: s, entityCode: c, onClear: l, onActionSuccess: u, widgetContext: d }) {
13252
+ let { run: f } = to(), p = un(), m = q(() => {
13255
13253
  let e = {};
13256
- for (let { code: t, action: r } of n) e[t] = r;
13254
+ for (let { code: t, action: n } of r) e[t] = n;
13257
13255
  return e;
13258
- }, [n]), m = q(() => Is((r ?? i) || zs(p, "list_floatbar"), p, void 0, "list_floatbar"), [
13259
- r,
13256
+ }, [r]), h = q(() => Is((i ?? a) || zs(m, "list_floatbar"), m, void 0, "list_floatbar"), [
13260
13257
  i,
13261
- p
13262
- ]), h = q(() => {
13258
+ a,
13259
+ m
13260
+ ]), g = q(() => {
13263
13261
  if (e.length === 0) return [];
13264
13262
  let t = /* @__PURE__ */ new Map();
13265
- for (let e of a) t.set(o(e), e);
13263
+ for (let e of o) t.set(s(e), e);
13266
13264
  return e.map((e) => t.get(e)).filter((e) => e !== void 0);
13267
13265
  }, [
13268
13266
  e,
13269
- a,
13270
- o
13271
- ]), g = q(() => Os(m, p, void 0, {}, h), [
13267
+ o,
13268
+ s
13269
+ ]), _ = q(() => Os(h, m, void 0, {}, g), [
13270
+ h,
13272
13271
  m,
13273
- p,
13274
- h
13272
+ g
13275
13273
  ]);
13276
- return g.length === 0 ? null : /* @__PURE__ */ Q("div", {
13274
+ return _.length === 0 ? null : /* @__PURE__ */ Q("div", {
13277
13275
  style: {
13278
13276
  position: "fixed",
13279
13277
  left: "50%",
@@ -13310,27 +13308,27 @@ function eu({ selectedIds: e, floatbarActions: n, screenActionLayout: r, entityA
13310
13308
  }), "selected"]
13311
13309
  }),
13312
13310
  /* @__PURE__ */ Z(fc, {
13313
- layout: g,
13311
+ layout: _,
13314
13312
  kind: "toolbar",
13315
- entityActions: p,
13316
- rowSelection: h,
13317
- onRun: (t, n) => {
13318
- let r = pc(t, n, {});
13319
- if (r !== null) return d({
13320
- action: n,
13321
- title: U(n.display?.name) || t,
13322
- bulkSelection: h,
13313
+ entityActions: m,
13314
+ rowSelection: g,
13315
+ onRun: (t, r) => {
13316
+ let i = pc(t, r, {});
13317
+ if (i !== null) return f({
13318
+ action: r,
13319
+ title: U(r.display?.name) || t,
13320
+ bulkSelection: g,
13323
13321
  execute: async (t) => {
13324
- let n = await O(r, Me(t, e));
13325
- return l(), s && (f.invalidateQueries({ queryKey: ["entity-data", s] }), f.invalidateQueries({ queryKey: ["entity-count", s] }), f.invalidateQueries({ queryKey: ["entity-item", s] })), n;
13322
+ let r = await M(i, n(t, e));
13323
+ return u(), c && (p.invalidateQueries({ queryKey: ["entity-data", c] }), p.invalidateQueries({ queryKey: ["entity-count", c] }), p.invalidateQueries({ queryKey: ["entity-item", c] })), r;
13326
13324
  }
13327
13325
  });
13328
13326
  },
13329
- widgetContext: u,
13327
+ widgetContext: d,
13330
13328
  ariaLabel: "Bulk action bar"
13331
13329
  }),
13332
13330
  /* @__PURE__ */ Z("button", {
13333
- onClick: c,
13331
+ onClick: l,
13334
13332
  style: {
13335
13333
  background: "none",
13336
13334
  border: "none",
@@ -13399,54 +13397,54 @@ function cu(e, t) {
13399
13397
  }
13400
13398
  //#endregion
13401
13399
  //#region src/components/pages/list/RowActionsCell.tsx
13402
- function lu({ row: e, rowId: n, screen: r, fullScreen: i, entity: a, entityCode: o, hasDefaultEditAction: s, hasDefaultDeleteAction: c, rowActions: l, tabNavigate: u, onPeek: d, locale: f }) {
13403
- let { run: p } = to(), m = q(() => ({
13404
- entity: a,
13405
- entityCode: o ?? "",
13406
- screen: i,
13407
- screenRoute: i.route,
13400
+ function lu({ row: e, rowId: r, screen: i, fullScreen: a, entity: o, entityCode: s, hasDefaultEditAction: c, hasDefaultDeleteAction: l, rowActions: u, tabNavigate: d, onPeek: f, locale: p }) {
13401
+ let { run: m } = to(), h = q(() => ({
13402
+ entity: o,
13403
+ entityCode: s ?? "",
13404
+ screen: a,
13405
+ screenRoute: a.route,
13408
13406
  selectedRows: [],
13409
13407
  selectedIds: [],
13410
- locale: f,
13411
- tabNavigate: (e, t) => u(e, {
13408
+ locale: p,
13409
+ tabNavigate: (e, t) => d(e, {
13412
13410
  title: t?.title,
13413
13411
  icon: t?.icon,
13414
13412
  search: t?.search
13415
13413
  }),
13416
- runActionApi: (e, t) => O(e, t)
13414
+ runActionApi: (e, t) => M(e, t)
13417
13415
  }), [
13418
- a,
13419
13416
  o,
13420
- i,
13421
- f,
13422
- u
13423
- ]), h = q(() => {
13417
+ s,
13418
+ a,
13419
+ p,
13420
+ d
13421
+ ]), g = q(() => {
13424
13422
  let e = {};
13425
- for (let { code: t, action: n } of l) e[t] = n;
13423
+ for (let { code: t, action: n } of u) e[t] = n;
13426
13424
  return e;
13427
- }, [l]), g = q(() => {
13428
- let e = r.action_layout ?? null, t = a.action_layout ?? null;
13429
- return Is((e ?? t) || zs(h, "list_row"), h, void 0, "list_row");
13425
+ }, [u]), _ = q(() => {
13426
+ let e = i.action_layout ?? null, t = o.action_layout ?? null;
13427
+ return Is((e ?? t) || zs(g, "list_row"), g, void 0, "list_row");
13430
13428
  }, [
13431
- r,
13432
- a,
13433
- h
13434
- ]), _ = q(() => Os(g, h, void 0, e, []), [
13429
+ i,
13430
+ o,
13431
+ g
13432
+ ]), v = q(() => Os(_, g, void 0, e, []), [
13433
+ _,
13435
13434
  g,
13436
- h,
13437
13435
  e
13438
- ]), v = G((t, r) => {
13439
- let i = pc(t, r, { row: e });
13440
- if (i !== null) return p({
13441
- action: r,
13442
- title: U(r.display?.name) || t,
13443
- execute: (e) => O(i, Me(e, [n]))
13436
+ ]), y = G((t, i) => {
13437
+ let a = pc(t, i, { row: e });
13438
+ if (a !== null) return m({
13439
+ action: i,
13440
+ title: U(i.display?.name) || t,
13441
+ execute: (e) => M(a, n(e, [r]))
13444
13442
  });
13445
13443
  }, [
13446
- p,
13447
- n,
13444
+ m,
13445
+ r,
13448
13446
  e
13449
- ]), y = s || c;
13447
+ ]), b = c || l;
13450
13448
  return /* @__PURE__ */ Q("div", {
13451
13449
  className: "sl-row-actions",
13452
13450
  style: {
@@ -13455,20 +13453,20 @@ function lu({ row: e, rowId: n, screen: r, fullScreen: i, entity: a, entityCode:
13455
13453
  gap: 2,
13456
13454
  justifyContent: "flex-end"
13457
13455
  },
13458
- children: [d && /* @__PURE__ */ Z(B, {
13456
+ children: [f && /* @__PURE__ */ Z(B, {
13459
13457
  size: 22,
13460
13458
  icon: /* @__PURE__ */ Z(t.eye, { size: 12 }),
13461
13459
  onClick: (e) => {
13462
- e.stopPropagation(), d();
13460
+ e.stopPropagation(), f();
13463
13461
  },
13464
13462
  title: "Peek"
13465
- }), (_.length > 0 || y) && /* @__PURE__ */ Z(fc, {
13466
- layout: _,
13463
+ }), (v.length > 0 || b) && /* @__PURE__ */ Z(fc, {
13464
+ layout: v,
13467
13465
  row: e,
13468
13466
  kind: "row",
13469
- entityActions: h,
13470
- onRun: v,
13471
- widgetContext: m,
13467
+ entityActions: g,
13468
+ onRun: y,
13469
+ widgetContext: h,
13472
13470
  ariaLabel: "Row actions"
13473
13471
  })]
13474
13472
  });
@@ -13491,13 +13489,13 @@ function du(e) {
13491
13489
  let _ = [];
13492
13490
  s && _.push({
13493
13491
  id: "_select",
13494
- header: ({ table: e }) => Bt(L, {
13492
+ header: ({ table: e }) => Bt(I, {
13495
13493
  checked: e.getIsAllRowsSelected(),
13496
13494
  indeterminate: e.getIsSomeRowsSelected(),
13497
13495
  onChange: () => e.toggleAllRowsSelected()
13498
13496
  }),
13499
13497
  size: 34,
13500
- cell: ({ row: e }) => Bt("span", { "data-testid": "row-select-checkbox" }, Bt(L, {
13498
+ cell: ({ row: e }) => Bt("span", { "data-testid": "row-select-checkbox" }, Bt(I, {
13501
13499
  checked: e.getIsSelected(),
13502
13500
  onChange: () => e.toggleSelected()
13503
13501
  }))
@@ -13603,7 +13601,7 @@ function du(e) {
13603
13601
  //#region src/components/columns/ColumnPicker.tsx
13604
13602
  function fu({ availableColumns: e, visibleColumns: n, onToggle: r, onReset: i, onShowAll: a, columnLabel: o = (e) => e }) {
13605
13603
  let s = J(null), [c, l] = Y(!1);
13606
- return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
13604
+ return /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
13607
13605
  ref: s,
13608
13606
  icon: /* @__PURE__ */ Z(t.columns, { size: 13 }),
13609
13607
  onClick: () => l(!c),
@@ -13757,7 +13755,7 @@ function mu({ views: e, activeViewId: n, isDirty: r, onSelect: i, onSave: a, onS
13757
13755
  })] })
13758
13756
  ]
13759
13757
  }),
13760
- r && n && a && /* @__PURE__ */ Z(F, {
13758
+ r && n && a && /* @__PURE__ */ Z(P, {
13761
13759
  icon: /* @__PURE__ */ Z(t.save, { size: 12 }),
13762
13760
  onClick: a,
13763
13761
  children: "Save"
@@ -14018,145 +14016,145 @@ function Au({ screenCode: e }) {
14018
14016
  return /* @__PURE__ */ Z(Ot, { children: /* @__PURE__ */ Z(ju, { screenCode: e }) });
14019
14017
  }
14020
14018
  function ju({ screenCode: e }) {
14021
- let n = vr(), r = un(), [i, a] = rn(), { data: s } = S(), c = Oe(), [l, u] = Y(null), [d, f] = Y({}), [p, h] = Y(!1), [g, _] = Y(!1), [v, y] = Y(null), { filters: b, activeCount: x, setFilters: C, clearFilters: w } = xl(), E = We((e) => e.user), D = We((e) => e.activeTenant), k = gu(e, E?.id), A = Mt(), j = `dcl:smartlist:default-view-cleared:${e}`, M = J(!1);
14019
+ let r = vr(), i = un(), [a, s] = rn(), { data: c } = S(), l = Oe(), [u, d] = Y(null), [f, p] = Y({}), [h, g] = Y(!1), [_, v] = Y(!1), [y, b] = Y(null), { filters: x, activeCount: C, setFilters: w, clearFilters: E } = xl(), D = We((e) => e.user), O = We((e) => e.activeTenant), k = gu(e, D?.id), A = Mt(), j = `dcl:smartlist:default-view-cleared:${e}`, ee = J(!1);
14022
14020
  K(() => {
14023
- if (M.current || !k || k.length === 0) return;
14024
- if (i.get("view")) {
14025
- M.current = !0;
14021
+ if (ee.current || !k || k.length === 0) return;
14022
+ if (a.get("view")) {
14023
+ ee.current = !0;
14026
14024
  return;
14027
14025
  }
14028
14026
  if (typeof window < "u" && window.sessionStorage?.getItem(j)) {
14029
- M.current = !0;
14027
+ ee.current = !0;
14030
14028
  return;
14031
14029
  }
14032
14030
  let e = k.find((e) => e.source === "personal" && e.is_default);
14033
14031
  if (!e || !e.id) return;
14034
- M.current = !0;
14035
- let t = Eu(i);
14036
- t.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && t.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && t.set("columns", e.columns.join(",")), e.sort && t.set("sort", e.sort), a(t, { replace: !0 });
14032
+ ee.current = !0;
14033
+ let t = Eu(a);
14034
+ t.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && t.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && t.set("columns", e.columns.join(",")), e.sort && t.set("sort", e.sort), s(t, { replace: !0 });
14037
14035
  }, [
14038
14036
  k,
14039
- i,
14040
14037
  a,
14038
+ s,
14041
14039
  j
14042
14040
  ]);
14043
- let P = s?.screens[e], I = P?.entity ? s?.entities[P.entity] : void 0, L = P?.entity, ee = $e(I, "create"), te = $e(I, "update"), ne = $e(I, "delete"), re = s?.actions, ie = q(() => ws(I?.actions, P?.actions, "list_toolbar", re), [
14041
+ let F = c?.screens[e], I = F?.entity ? c?.entities[F.entity] : void 0, L = F?.entity, te = $e(I, "create"), ne = $e(I, "update"), re = $e(I, "delete"), ie = c?.actions, ae = q(() => ws(I?.actions, F?.actions, "list_toolbar", ie), [
14044
14042
  I?.actions,
14045
- P?.actions,
14046
- re
14047
- ]), ae = q(() => ws(I?.actions, void 0, "list_floatbar", re), [I?.actions, re]), R = q(() => ws(I?.actions, P?.row_actions, "list_row", re), [
14043
+ F?.actions,
14044
+ ie
14045
+ ]), R = q(() => ws(I?.actions, void 0, "list_floatbar", ie), [I?.actions, ie]), oe = q(() => ws(I?.actions, F?.row_actions, "list_row", ie), [
14048
14046
  I?.actions,
14049
- P?.row_actions,
14050
- re
14051
- ]), oe = P?.row_actions !== void 0, se = q(() => ae.length > 0 || I?.export?.enabled !== !1 && P?.export?.enabled !== !1, [
14052
- ae,
14047
+ F?.row_actions,
14048
+ ie
14049
+ ]), se = F?.row_actions !== void 0, ce = q(() => R.length > 0 || I?.export?.enabled !== !1 && F?.export?.enabled !== !1, [
14050
+ R,
14053
14051
  I?.export?.enabled,
14054
- P?.export?.enabled
14055
- ]), ce = !!I?.soft_delete, le = ce && (E?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), ue = le && i.get("include_deleted") === "true", fe = $n(), { openTab: pe, updateTabSearch: me, findTabByPathname: V } = In();
14052
+ F?.export?.enabled
14053
+ ]), le = !!I?.soft_delete, ue = le && (D?.permissions ?? []).some((e) => e === "feature:view_deleted" || e === "feature:*" || e === "*"), fe = ue && a.get("include_deleted") === "true", pe = $n(), { openTab: me, updateTabSearch: V, findTabByPathname: he } = In();
14056
14054
  K(() => {
14057
- if (P?.route && I && !fe.enabled) {
14058
- let e = U(P.display?.name) || U(I.display.name_plural), t = P.display?.icon || I.display.icon;
14059
- pe({
14060
- pathname: P.route,
14061
- search: i.toString(),
14055
+ if (F?.route && I && !pe.enabled) {
14056
+ let e = U(F.display?.name) || U(I.display.name_plural), t = F.display?.icon || I.display.icon;
14057
+ me({
14058
+ pathname: F.route,
14059
+ search: a.toString(),
14062
14060
  title: e,
14063
14061
  icon: t,
14064
14062
  closable: !0
14065
14063
  });
14066
14064
  }
14067
14065
  }, [
14068
- P?.route,
14069
- P?.display?.name?.en,
14066
+ F?.route,
14067
+ F?.display?.name?.en,
14070
14068
  I?.display.name_plural?.en,
14071
- P?.display?.icon,
14069
+ F?.display?.icon,
14072
14070
  I?.display.icon,
14073
- fe.enabled
14071
+ pe.enabled
14074
14072
  ]), K(() => {
14075
- if (!P?.route || fe.enabled) return;
14076
- let e = V(P.route);
14077
- e && me(e.id, i.toString());
14073
+ if (!F?.route || pe.enabled) return;
14074
+ let e = he(F.route);
14075
+ e && V(e.id, a.toString());
14078
14076
  }, [
14079
- i,
14080
- P?.route,
14081
- fe.enabled
14077
+ a,
14078
+ F?.route,
14079
+ pe.enabled
14082
14080
  ]);
14083
- let he = parseInt(i.get("page") ?? "1", 10), ge = (() => {
14084
- let e = parseInt(i.get("per_page") ?? "", 10);
14081
+ let ge = parseInt(a.get("page") ?? "1", 10), _e = (() => {
14082
+ let e = parseInt(a.get("per_page") ?? "", 10);
14085
14083
  return !Number.isFinite(e) || e <= 0 || e > 1e3 ? 200 : e;
14086
- })(), _e = i.get("search") ?? "", be = i.get("sort") ?? P?.sort_default ?? "", Se = q(() => Nl(be), [be]), Ce = q(() => {
14084
+ })(), be = a.get("search") ?? "", Se = a.get("sort") ?? F?.sort_default ?? "", Ce = q(() => Nl(Se), [Se]), Te = q(() => {
14087
14085
  let e = /* @__PURE__ */ new Map();
14088
- for (let t of Se) t.nulls && e.set(t.field, t.nulls);
14086
+ for (let t of Ce) t.nulls && e.set(t.field, t.nulls);
14089
14087
  return e;
14090
- }, [Se]), Te = q(() => Pl(be), [be]), Ee = rl(_e, 300), De = q(() => {
14091
- let e = i.get("columns");
14092
- return e ? e.split(",").filter(Boolean) : P?.default_columns ?? P?.columns ?? [];
14088
+ }, [Ce]), Ee = q(() => Pl(Se), [Se]), De = rl(be, 300), ke = q(() => {
14089
+ let e = a.get("columns");
14090
+ return e ? e.split(",").filter(Boolean) : F?.default_columns ?? F?.columns ?? [];
14093
14091
  }, [
14094
- i,
14095
- P?.default_columns,
14096
- P?.columns
14097
- ]), ke = q(() => {
14098
- let e = [], t = [...P?.columns ?? [], ...De];
14092
+ a,
14093
+ F?.default_columns,
14094
+ F?.columns
14095
+ ]), Ae = q(() => {
14096
+ let e = [], t = [...F?.columns ?? [], ...ke];
14099
14097
  return t.some((e) => e.startsWith("$status.")) && e.push("statuses"), t.some((e) => e.startsWith("$property.")) && e.push("properties"), e.length > 0 && e.unshift("refs"), e.length > 0 ? e : void 0;
14100
- }, [P?.columns, De]), Ae = q(() => {
14101
- let e = De.filter((e) => e && !e.startsWith("$"));
14098
+ }, [F?.columns, ke]), je = q(() => {
14099
+ let e = ke.filter((e) => e && !e.startsWith("$"));
14102
14100
  return e.length > 0 ? e : void 0;
14103
- }, [De]), je = {
14104
- page: he,
14105
- per_page: ge,
14106
- sort: Te,
14107
- search: Ee || void 0,
14108
- filters: b.length > 0 ? b : void 0,
14109
- include_deleted: ue || void 0,
14110
- expand: ke,
14111
- select: Ae,
14101
+ }, [ke]), Me = {
14102
+ page: ge,
14103
+ per_page: _e,
14104
+ sort: Ee,
14105
+ search: De || void 0,
14106
+ filters: x.length > 0 ? x : void 0,
14107
+ include_deleted: fe || void 0,
14108
+ expand: Ae,
14109
+ select: je,
14112
14110
  preview: !0,
14113
- screen: P?.fixed_filters ? e : void 0
14114
- }, { data: Ne, isLoading: Pe, isFetching: Fe, isError: Ie, error: Le, refetch: Re } = nt(L, je), { data: ze, isLoading: Be, isError: Ve } = o(L, je), Ge = ze?.meta?.total, Ke = ze?.meta?.count_mode, qe = Su(Pe, `${L ?? ""}|${i.toString()}`), Ye = G(() => {
14115
- L && r.cancelQueries({ queryKey: ["entity-data", L] }), Re();
14111
+ screen: F?.fixed_filters ? e : void 0
14112
+ }, { data: Ne, isLoading: Pe, isFetching: Fe, isError: Ie, error: Le, refetch: Re } = nt(L, Me), { data: ze, isLoading: Be, isError: Ve } = o(L, Me), Ge = ze?.meta?.total, Ke = ze?.meta?.count_mode, qe = Su(Pe, `${L ?? ""}|${a.toString()}`), Ye = G(() => {
14113
+ L && i.cancelQueries({ queryKey: ["entity-data", L] }), Re();
14116
14114
  }, [
14117
14115
  L,
14118
- r,
14116
+ i,
14119
14117
  Re
14120
- ]), Xe = co((e) => e.degradedEntities), Ze = lo(I?.realtime, Xe, L ?? ""), et = gs(L ?? ""), tt = hs(L ?? ""), rt = ms("view"), it = q(() => Se.map((e) => ({
14118
+ ]), Xe = co((e) => e.degradedEntities), Ze = lo(I?.realtime, Xe, L ?? ""), et = gs(L ?? ""), tt = hs(L ?? ""), rt = ms("view"), it = q(() => Ce.map((e) => ({
14121
14119
  id: e.field,
14122
14120
  desc: e.dir === "desc"
14123
- })), [Se]), at = q(() => I?.fields.names().find((e) => I.fields.get(e)?.primary) ?? "id", [I]), ot = G((e) => I ? Du(I, e) : String(e[at] ?? ""), [I, at]), ct = Ne?.$refs, lt = J(ct);
14121
+ })), [Ce]), at = q(() => I?.fields.names().find((e) => I.fields.get(e)?.primary) ?? "id", [I]), ot = G((e) => I ? Du(I, e) : String(e[at] ?? ""), [I, at]), ct = Ne?.$refs, lt = J(ct);
14124
14122
  lt.current = ct;
14125
- let [ut, dt] = Y(null), ft = P?.on_row_click === "peek" && P.quick_peek?.enabled !== !1, pt = q(() => du({
14126
- visibleCols: De,
14123
+ let [ut, dt] = Y(null), ft = F?.on_row_click === "peek" && F.quick_peek?.enabled !== !1, pt = q(() => du({
14124
+ visibleCols: ke,
14127
14125
  entity: I,
14128
- screen: P,
14129
- schema: s,
14126
+ screen: F,
14127
+ schema: c,
14130
14128
  entityCode: L,
14131
- rowActions: R,
14132
- hasBatchActions: se,
14133
- hasExplicitRowActions: oe,
14134
- canUpdate: te,
14135
- canDelete: ne,
14129
+ rowActions: oe,
14130
+ hasBatchActions: ce,
14131
+ hasExplicitRowActions: se,
14132
+ canUpdate: ne,
14133
+ canDelete: re,
14136
14134
  peekEnabled: ft,
14137
- userLocale: c,
14138
- tabNavigate: n,
14135
+ userLocale: l,
14136
+ tabNavigate: r,
14139
14137
  refsRef: lt,
14140
14138
  rowSelectionKey: Du,
14141
14139
  setPeekRow: dt
14142
14140
  }), [
14143
- P,
14141
+ F,
14144
14142
  I,
14145
- De,
14146
- n,
14147
- se,
14148
- R,
14143
+ ke,
14144
+ r,
14145
+ ce,
14149
14146
  oe,
14147
+ se,
14150
14148
  L,
14151
14149
  ft,
14152
- s,
14153
14150
  c,
14154
- te,
14151
+ l,
14155
14152
  ne,
14153
+ re,
14156
14154
  lt
14157
14155
  ]), mt = q(() => Ne?.data ?? [], [Ne?.data]), ht = Ne?.meta, gt = q(() => {
14158
- if (!(Ge === void 0 || ge <= 0)) return Math.max(1, Math.ceil(Ge / ge));
14159
- }, [Ge, ge]), _t = ht?.has_more ?? (gt !== void 0 && he < gt), vt = _n({
14156
+ if (!(Ge === void 0 || _e <= 0)) return Math.max(1, Math.ceil(Ge / _e));
14157
+ }, [Ge, _e]), _t = ht?.has_more ?? (gt !== void 0 && ge < gt), vt = _n({
14160
14158
  data: mt,
14161
14159
  columns: pt,
14162
14160
  getCoreRowModel: gn(),
@@ -14164,14 +14162,14 @@ function ju({ screenCode: e }) {
14164
14162
  manualPagination: !0,
14165
14163
  state: {
14166
14164
  sorting: it,
14167
- rowSelection: d
14165
+ rowSelection: f
14168
14166
  },
14169
14167
  onSortingChange: (e) => {
14170
- let t = (typeof e == "function" ? e(it) : e).slice(0, 5), n = new URLSearchParams(i);
14168
+ let t = (typeof e == "function" ? e(it) : e).slice(0, 5), n = new URLSearchParams(a);
14171
14169
  if (t.length === 0) n.delete("sort");
14172
14170
  else {
14173
14171
  let e = t.map((e) => {
14174
- let t = Ce.get(e.id);
14172
+ let t = Te.get(e.id);
14175
14173
  return {
14176
14174
  field: e.id,
14177
14175
  dir: e.desc ? "desc" : "asc",
@@ -14180,57 +14178,57 @@ function ju({ screenCode: e }) {
14180
14178
  });
14181
14179
  n.set("sort", Fl(e));
14182
14180
  }
14183
- n.set("page", "1"), a(n);
14181
+ n.set("page", "1"), s(n);
14184
14182
  },
14185
- onRowSelectionChange: f,
14183
+ onRowSelectionChange: p,
14186
14184
  getRowId: ot,
14187
14185
  rowCount: Ge ?? mt.length
14188
- }), yt = q(() => Object.keys(d).filter((e) => d[e]), [d]), bt = q(() => Ou(I, mt, yt), [
14186
+ }), yt = q(() => Object.keys(f).filter((e) => f[e]), [f]), bt = q(() => Ou(I, mt, yt), [
14189
14187
  I,
14190
14188
  mt,
14191
14189
  yt
14192
14190
  ]), xt = G((e) => {
14193
- let t = e.slice(0, 5), n = new URLSearchParams(i);
14194
- t.length === 0 ? n.delete("sort") : n.set("sort", Fl(t)), n.set("page", "1"), a(n);
14195
- }, [i, a]), St = G((e, t, n) => {
14191
+ let t = e.slice(0, 5), n = new URLSearchParams(a);
14192
+ t.length === 0 ? n.delete("sort") : n.set("sort", Fl(t)), n.set("page", "1"), s(n);
14193
+ }, [a, s]), St = G((e, t, n) => {
14196
14194
  xt([{
14197
14195
  field: e,
14198
14196
  dir: t,
14199
14197
  ...n ? { nulls: n } : {}
14200
14198
  }]);
14201
14199
  }, [xt]), Ct = G((e) => {
14202
- xt(Il(Se, e));
14203
- }, [Se, xt]), wt = G((e, t, n) => {
14204
- xt(Ll(Se, {
14200
+ xt(Il(Ce, e));
14201
+ }, [Ce, xt]), wt = G((e, t, n) => {
14202
+ xt(Ll(Ce, {
14205
14203
  field: e,
14206
14204
  dir: t,
14207
14205
  ...n ? { nulls: n } : {}
14208
14206
  }));
14209
- }, [Se, xt]), Tt = G((e) => {
14210
- xt(Rl(Se, e));
14211
- }, [Se, xt]), Et = G(() => {
14207
+ }, [Ce, xt]), Tt = G((e) => {
14208
+ xt(Rl(Ce, e));
14209
+ }, [Ce, xt]), Et = G(() => {
14212
14210
  xt([]);
14213
14211
  }, [xt]);
14214
14212
  K(() => {
14215
- f({});
14213
+ p({});
14216
14214
  }, [
14217
- he,
14218
- Ee,
14219
- be,
14220
- b
14215
+ ge,
14216
+ De,
14217
+ Se,
14218
+ x
14221
14219
  ]), K(() => {
14222
14220
  let e = (e) => {
14223
14221
  let t = e.target?.tagName;
14224
14222
  if (t === "INPUT" || t === "TEXTAREA" || t === "SELECT") {
14225
- e.key === "Escape" && (e.target.blur(), h(!1));
14223
+ e.key === "Escape" && (e.target.blur(), g(!1));
14226
14224
  return;
14227
14225
  }
14228
- e.key === "/" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), document.querySelector("[placeholder*=\"Search\"]")?.focus()), e.key === "f" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), h((e) => !e)), e.key === "Escape" && h(!1);
14226
+ e.key === "/" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), document.querySelector("[placeholder*=\"Search\"]")?.focus()), e.key === "f" && !e.metaKey && !e.ctrlKey && (e.preventDefault(), g((e) => !e)), e.key === "Escape" && g(!1);
14229
14227
  };
14230
14228
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
14231
14229
  }, []);
14232
14230
  let Dt = J(null), { rows: Ot } = vt.getRowModel(), kt = m((e) => e.density), At = m((e) => e.zebra), jt = vn({
14233
- count: fe.enabled ? 0 : Ot.length,
14231
+ count: pe.enabled ? 0 : Ot.length,
14234
14232
  getScrollElement: () => Dt.current,
14235
14233
  estimateSize: () => 48,
14236
14234
  overscan: 10
@@ -14239,56 +14237,56 @@ function ju({ screenCode: e }) {
14239
14237
  jt.measure();
14240
14238
  }, [kt, jt]);
14241
14239
  let Nt = G((e) => {
14242
- a((t) => {
14240
+ s((t) => {
14243
14241
  let n = new URLSearchParams(t);
14244
14242
  return e ? n.set("search", e) : n.delete("search"), n.set("page", "1"), n;
14245
14243
  });
14246
- }, [a]), Pt = G(() => {
14247
- a((e) => {
14244
+ }, [s]), Pt = G(() => {
14245
+ s((e) => {
14248
14246
  let t = new URLSearchParams(e);
14249
14247
  return t.get("include_deleted") ? t.delete("include_deleted") : t.set("include_deleted", "true"), t.set("page", "1"), t;
14250
14248
  });
14251
- }, [a]), Ft = G((e) => {
14252
- a((t) => {
14249
+ }, [s]), Ft = G((e) => {
14250
+ s((t) => {
14253
14251
  let n = new URLSearchParams(t);
14254
14252
  return n.set("page", String(e)), n;
14255
14253
  });
14256
- }, [a]);
14254
+ }, [s]);
14257
14255
  K(() => {
14258
- gt !== void 0 && he > gt && Ft(gt);
14256
+ gt !== void 0 && ge > gt && Ft(gt);
14259
14257
  }, [
14260
14258
  gt,
14261
- he,
14259
+ ge,
14262
14260
  Ft
14263
14261
  ]);
14264
14262
  let It = G((e) => {
14265
- a((t) => {
14263
+ s((t) => {
14266
14264
  let n = new URLSearchParams(t);
14267
14265
  return n.set("per_page", String(e)), n.set("page", "1"), n;
14268
14266
  });
14269
- }, [a]), Lt = q(() => !P || !I ? !1 : ku(P, "_", I, s?.screens) !== null, [
14270
- P,
14267
+ }, [s]), Lt = q(() => !F || !I ? !1 : ku(F, "_", I, c?.screens) !== null, [
14268
+ F,
14271
14269
  I,
14272
- s?.screens
14270
+ c?.screens
14273
14271
  ]), Rt = G((e, t) => {
14274
- if (!I || !P) return;
14275
- let r = xe(I, e), i = st(I, r), a = ye(P, I, s?.screens, r);
14272
+ if (!I || !F) return;
14273
+ let n = xe(I, e), i = st(I, n), a = ye(F, I, c?.screens, n);
14276
14274
  if (!a) return;
14277
14275
  if (t?.draft) {
14278
14276
  kl(i, t.draft);
14279
14277
  let [e, n] = a.split("?", 2), r = new URLSearchParams(n ?? "");
14280
14278
  r.set("edit", "true"), a = `${e}?${r.toString()}`;
14281
14279
  }
14282
- let o = Ue(e, I) ?? U(I.display.name), c = P.display?.icon || I.display.icon;
14283
- n(a, {
14280
+ let o = Ue(e, I) ?? U(I.display.name), s = F.display?.icon || I.display.icon;
14281
+ r(a, {
14284
14282
  title: o,
14285
- icon: c
14283
+ icon: s
14286
14284
  });
14287
14285
  }, [
14288
14286
  I,
14289
- P,
14290
- s,
14291
- n
14287
+ F,
14288
+ c,
14289
+ r
14292
14290
  ]), zt = G((e, t) => {
14293
14291
  if (!e.target.closest("a, button, input, select, [role='button'], [role='menuitem']")) {
14294
14292
  if (ft) {
@@ -14299,10 +14297,10 @@ function ju({ screenCode: e }) {
14299
14297
  }
14300
14298
  }, [ft, Rt]), Bt = q(() => {
14301
14299
  if (!ft || !I || !ut) return [];
14302
- let e = P?.quick_peek?.fields, t = P?.quick_peek?.sections, n;
14300
+ let e = F?.quick_peek?.fields, t = F?.quick_peek?.sections, n;
14303
14301
  if (e && e.length > 0) n = e.filter((e) => I.fields.get(e) || I.files?.get(e));
14304
14302
  else if (t && t.length > 0) {
14305
- let e = Object.values(s?.screens ?? {}).find((e) => e.type === "detail" && e.entity === P?.entity)?.items ?? [], r = [], i = (e) => {
14303
+ let e = Object.values(c?.screens ?? {}).find((e) => e.type === "detail" && e.entity === F?.entity)?.items ?? [], r = [], i = (e) => {
14306
14304
  if (Array.isArray(e)) {
14307
14305
  for (let n of e) if (n && typeof n == "object" && "section" in n) {
14308
14306
  let e = n.section, r = typeof e?.name == "string" ? e.name : e?.name && typeof e.name == "object" ? Object.values(e.name)[0] : "";
@@ -14318,14 +14316,14 @@ function ju({ screenCode: e }) {
14318
14316
  return n.map((e) => {
14319
14317
  if (I.files?.get(e)) return {
14320
14318
  key: e,
14321
- label: H(I, e, s?.entities),
14319
+ label: H(I, e, c?.entities),
14322
14320
  kind: "file",
14323
- readOnly: !te
14321
+ readOnly: !ne
14324
14322
  };
14325
- let t = I.fields.get(e), n = te && !t.primary && !t.auto && !t.ref && t.files?.mode !== "rich_text_inline";
14323
+ let t = I.fields.get(e), n = ne && !t.primary && !t.auto && !t.ref && t.files?.mode !== "rich_text_inline";
14326
14324
  return {
14327
14325
  key: e,
14328
- label: we(t, e, s?.entities),
14326
+ label: we(t, e, c?.entities),
14329
14327
  kind: "field",
14330
14328
  field: t,
14331
14329
  readOnly: !n
@@ -14335,29 +14333,29 @@ function ju({ screenCode: e }) {
14335
14333
  ft,
14336
14334
  ut,
14337
14335
  I,
14338
- P,
14339
- s?.entities,
14340
- s?.screens,
14341
- te
14342
- ]), Vt = q(() => I?.actions ? I.actions : {}, [I?.actions]), Ht = G(async (e, t, n) => {
14343
- let r = I?.fields.names().find((e) => I.fields.get(e)?.primary), i = r && ut ? [String(ut[r] ?? "")] : void 0;
14344
- return O(t.entity ? `${t.entity}.${e}` : e, Me(n, i));
14336
+ F,
14337
+ c?.entities,
14338
+ c?.screens,
14339
+ ne
14340
+ ]), Vt = q(() => I?.actions ? I.actions : {}, [I?.actions]), Ht = G(async (e, t, r) => {
14341
+ let i = I?.fields.names().find((e) => I.fields.get(e)?.primary), a = i && ut ? [String(ut[i] ?? "")] : void 0;
14342
+ return M(t.entity ? `${t.entity}.${e}` : e, n(r, a));
14345
14343
  }, [I, ut]), Ut = G(async () => {
14346
- if (!l || l.ids.length === 0) return;
14347
- u(null);
14348
- let e = await Promise.allSettled(l.ids.map((e) => et.mutateAsync(e))), t = e.filter((e) => e.status === "rejected").length;
14349
- if (t === 0) f({});
14350
- else if (t < l.ids.length) {
14351
- let n = new Set(l.ids.filter((t, n) => e[n].status === "fulfilled"));
14352
- f((e) => {
14344
+ if (!u || u.ids.length === 0) return;
14345
+ d(null);
14346
+ let e = await Promise.allSettled(u.ids.map((e) => et.mutateAsync(e))), t = e.filter((e) => e.status === "rejected").length;
14347
+ if (t === 0) p({});
14348
+ else if (t < u.ids.length) {
14349
+ let n = new Set(u.ids.filter((t, n) => e[n].status === "fulfilled"));
14350
+ p((e) => {
14353
14351
  let t = {};
14354
14352
  for (let [r, i] of Object.entries(e)) n.has(r) || (t[r] = i);
14355
14353
  return t;
14356
- }), $.warning(`${t} of ${l.ids.length} deletes failed`);
14354
+ }), $.warning(`${t} of ${u.ids.length} deletes failed`);
14357
14355
  }
14358
- }, [l, et]);
14359
- if (!P || !I) return null;
14360
- let Wt = I.display, Gt = U(P.display?.name) || U(Wt.name), Kt = P.display?.icon || Wt.icon, qt = bt.map((e) => st(I, e)), Jt = [];
14356
+ }, [u, et]);
14357
+ if (!F || !I) return null;
14358
+ let Wt = I.display, Gt = U(F.display?.name) || U(Wt.name), Kt = F.display?.icon || Wt.icon, qt = bt.map((e) => st(I, e)), Jt = [];
14361
14359
  if (yt.length > 0) {
14362
14360
  let e = /* @__PURE__ */ new Map();
14363
14361
  for (let t of mt) e.set(ot(t), t);
@@ -14366,19 +14364,19 @@ function ju({ screenCode: e }) {
14366
14364
  let Yt = {
14367
14365
  entity: I,
14368
14366
  entityCode: L ?? "",
14369
- screen: P,
14370
- screenRoute: P.route,
14367
+ screen: F,
14368
+ screenRoute: F.route,
14371
14369
  selectedRows: Jt,
14372
14370
  selectedIds: qt,
14373
- locale: c,
14374
- tabNavigate: (e, t) => n(e, {
14371
+ locale: l,
14372
+ tabNavigate: (e, t) => r(e, {
14375
14373
  title: t?.title,
14376
14374
  icon: t?.icon,
14377
14375
  search: t?.search
14378
14376
  }),
14379
- runActionApi: (e, t) => O(e, t)
14377
+ runActionApi: (e, t) => M(e, t)
14380
14378
  }, Xt = (e, t, n) => {
14381
- let r = ce && e.original[I.soft_delete] != null, i = e.getIsSelected(), a = At && t % 2 == 1, o = i ? "var(--row-selected-bg)" : a ? "var(--surface-2)" : "transparent";
14379
+ let r = le && e.original[I.soft_delete] != null, i = e.getIsSelected(), a = At && t % 2 == 1, o = i ? "var(--row-selected-bg)" : a ? "var(--surface-2)" : "transparent";
14382
14380
  return /* @__PURE__ */ Z("tr", {
14383
14381
  "data-index": n ? t : void 0,
14384
14382
  ref: n ? (e) => jt.measureElement(e) : void 0,
@@ -14402,7 +14400,7 @@ function ju({ screenCode: e }) {
14402
14400
  dt(null), Rt(e.original);
14403
14401
  } : void 0,
14404
14402
  onContextMenu: (t) => {
14405
- t.preventDefault(), y({
14403
+ t.preventDefault(), b({
14406
14404
  x: t.clientX,
14407
14405
  y: t.clientY,
14408
14406
  row: e.original
@@ -14418,7 +14416,7 @@ function ju({ screenCode: e }) {
14418
14416
  style: {
14419
14417
  display: "flex",
14420
14418
  flexDirection: "column",
14421
- height: fe.enabled ? "auto" : "100%",
14419
+ height: pe.enabled ? "auto" : "100%",
14422
14420
  background: "var(--bg)"
14423
14421
  },
14424
14422
  children: [
@@ -14429,13 +14427,13 @@ function ju({ screenCode: e }) {
14429
14427
  countMode: Ke,
14430
14428
  countPending: Be && !Ve,
14431
14429
  loaded: mt.length,
14432
- toolbarActions: ie,
14433
- screenActionLayout: P.action_layout,
14430
+ toolbarActions: ae,
14431
+ screenActionLayout: F.action_layout,
14434
14432
  entityActionLayout: I.action_layout,
14435
14433
  selectedIds: yt,
14436
14434
  data: mt,
14437
14435
  rowKey: ot,
14438
- onActionSuccess: () => f({}),
14436
+ onActionSuccess: () => p({}),
14439
14437
  widgetContext: Yt
14440
14438
  }),
14441
14439
  /* @__PURE__ */ Q("div", {
@@ -14449,17 +14447,17 @@ function ju({ screenCode: e }) {
14449
14447
  children: [
14450
14448
  /* @__PURE__ */ Z(mu, {
14451
14449
  views: k,
14452
- activeViewId: i.get("view"),
14450
+ activeViewId: a.get("view"),
14453
14451
  isDirty: !1,
14454
14452
  onSelect: (e) => {
14455
14453
  if (!e.id) {
14456
- typeof window < "u" && window.sessionStorage?.setItem(j, "1"), a(Eu(i));
14454
+ typeof window < "u" && window.sessionStorage?.setItem(j, "1"), s(Eu(a));
14457
14455
  return;
14458
14456
  }
14459
- let t = new URLSearchParams(i);
14460
- t.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && t.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && t.set("columns", e.columns.join(",")), e.sort && t.set("sort", e.sort), t.set("page", "1"), a(t);
14457
+ let t = new URLSearchParams(a);
14458
+ t.set("view", e.id), e.filters && Array.isArray(e.filters) && e.filters.length > 0 && t.set("filters", JSON.stringify(e.filters)), e.columns && e.columns.length > 0 && t.set("columns", e.columns.join(",")), e.sort && t.set("sort", e.sort), t.set("page", "1"), s(t);
14461
14459
  },
14462
- onSaveAs: () => _(!0)
14460
+ onSaveAs: () => v(!0)
14463
14461
  }),
14464
14462
  /* @__PURE__ */ Q("div", {
14465
14463
  style: {
@@ -14467,7 +14465,7 @@ function ju({ screenCode: e }) {
14467
14465
  width: 260
14468
14466
  },
14469
14467
  children: [/* @__PURE__ */ Z(N, {
14470
- value: _e,
14468
+ value: be,
14471
14469
  onChange: Nt,
14472
14470
  placeholder: `Search ${Gt.toLowerCase()}…`,
14473
14471
  prefix: /* @__PURE__ */ Z(t.search, { size: 13 })
@@ -14482,31 +14480,31 @@ function ju({ screenCode: e }) {
14482
14480
  children: /* @__PURE__ */ Z(de, { children: "/" })
14483
14481
  })]
14484
14482
  }),
14485
- /* @__PURE__ */ Q(F, {
14483
+ /* @__PURE__ */ Q(P, {
14486
14484
  icon: /* @__PURE__ */ Z(t.filter, { size: 13 }),
14487
- onClick: () => h(!0),
14488
- active: x > 0,
14489
- children: ["Filters", x > 0 && /* @__PURE__ */ Z(z, {
14485
+ onClick: () => g(!0),
14486
+ active: C > 0,
14487
+ children: ["Filters", C > 0 && /* @__PURE__ */ Z(z, {
14490
14488
  tone: "violet",
14491
14489
  size: "xs",
14492
14490
  style: { marginLeft: 4 },
14493
- children: x
14491
+ children: C
14494
14492
  })]
14495
14493
  }),
14496
14494
  /* @__PURE__ */ Z(fu, {
14497
- availableColumns: P.columns ?? [],
14498
- visibleColumns: De,
14495
+ availableColumns: F.columns ?? [],
14496
+ visibleColumns: ke,
14499
14497
  onToggle: (e) => {
14500
- let t = new URLSearchParams(i), n = De.includes(e) ? De.filter((t) => t !== e) : [...De, e];
14501
- n.length !== 0 && (t.set("columns", n.join(",")), a(t));
14498
+ let t = new URLSearchParams(a), n = ke.includes(e) ? ke.filter((t) => t !== e) : [...ke, e];
14499
+ n.length !== 0 && (t.set("columns", n.join(",")), s(t));
14502
14500
  },
14503
14501
  onReset: () => {
14504
- let e = new URLSearchParams(i);
14505
- e.delete("columns"), a(e);
14502
+ let e = new URLSearchParams(a);
14503
+ e.delete("columns"), s(e);
14506
14504
  },
14507
14505
  onShowAll: () => {
14508
- let e = new URLSearchParams(i);
14509
- e.set("columns", (P.columns ?? []).join(",")), a(e);
14506
+ let e = new URLSearchParams(a);
14507
+ e.set("columns", (F.columns ?? []).join(",")), s(e);
14510
14508
  },
14511
14509
  columnLabel: (e) => {
14512
14510
  if (e.startsWith("$status.")) {
@@ -14517,7 +14515,7 @@ function ju({ screenCode: e }) {
14517
14515
  let t = e.slice(10), n = I.properties?.[t];
14518
14516
  return n ? U(n.name) || t : e;
14519
14517
  }
14520
- return H(I, e, s?.entities);
14518
+ return H(I, e, c?.entities);
14521
14519
  }
14522
14520
  }),
14523
14521
  /* @__PURE__ */ Z("span", { style: {
@@ -14555,42 +14553,42 @@ function ju({ screenCode: e }) {
14555
14553
  })
14556
14554
  }),
14557
14555
  /* @__PURE__ */ Z("div", { style: { flex: 1 } }),
14558
- le && /* @__PURE__ */ Z(F, {
14556
+ ue && /* @__PURE__ */ Z(P, {
14559
14557
  kind: "ghost",
14560
14558
  size: "sm",
14561
- icon: Z(ue ? t.eyeOff : t.eye, { size: 12 }),
14559
+ icon: Z(fe ? t.eyeOff : t.eye, { size: 12 }),
14562
14560
  onClick: Pt,
14563
- active: ue,
14564
- children: ue ? "Hide deleted" : "Show deleted"
14561
+ active: fe,
14562
+ children: fe ? "Hide deleted" : "Show deleted"
14565
14563
  }),
14566
14564
  L && I && /* @__PURE__ */ Z(el, {
14567
14565
  entityCode: L,
14568
14566
  entity: I,
14569
- screen: P,
14567
+ screen: F,
14570
14568
  viewState: {
14571
14569
  screenCode: e,
14572
- jsonFilters: b,
14573
- search: Ee,
14574
- sort: Te,
14575
- includeDeleted: ue || void 0,
14576
- page: he,
14577
- perPage: ge
14570
+ jsonFilters: x,
14571
+ search: De,
14572
+ sort: Ee,
14573
+ includeDeleted: fe || void 0,
14574
+ page: ge,
14575
+ perPage: _e
14578
14576
  },
14579
- visibleColumns: De,
14577
+ visibleColumns: ke,
14580
14578
  selectedRowPKs: bt,
14581
14579
  totalRows: Ge,
14582
- pageSize: ge,
14583
- locale: c
14580
+ pageSize: _e,
14581
+ locale: l
14584
14582
  })
14585
14583
  ]
14586
14584
  }),
14587
- b.length > 0 && /* @__PURE__ */ Z("div", {
14585
+ x.length > 0 && /* @__PURE__ */ Z("div", {
14588
14586
  style: { padding: "0 20px 10px" },
14589
14587
  children: /* @__PURE__ */ Z(Ul, {
14590
- filters: b,
14591
- onRemove: (e) => C(bl(b, e)),
14592
- onClearAll: w,
14593
- onChipClick: () => h(!0),
14588
+ filters: x,
14589
+ onRemove: (e) => w(bl(x, e)),
14590
+ onClearAll: E,
14591
+ onChipClick: () => g(!0),
14594
14592
  fieldLabel: (e) => {
14595
14593
  if (e.startsWith("$status.")) {
14596
14594
  let t = e.slice(8), n = I.status_groups?.[t];
@@ -14601,7 +14599,7 @@ function ju({ screenCode: e }) {
14601
14599
  return n ? U(n.name) || t : e;
14602
14600
  }
14603
14601
  let t = I.fields.get(e);
14604
- return t ? we(t, e, s?.entities) : e;
14602
+ return t ? we(t, e, c?.entities) : e;
14605
14603
  }
14606
14604
  })
14607
14605
  })
@@ -14612,20 +14610,20 @@ function ju({ screenCode: e }) {
14612
14610
  icon: "alert-circle",
14613
14611
  title: "Still loading data",
14614
14612
  description: "This table is taking longer than expected. Retry the request or check network and server health.",
14615
- action: /* @__PURE__ */ Z(F, {
14613
+ action: /* @__PURE__ */ Z(P, {
14616
14614
  kind: "primary",
14617
14615
  size: "sm",
14618
14616
  onClick: Ye,
14619
14617
  children: "Retry"
14620
14618
  })
14621
14619
  })
14622
- }) : Pe ? /* @__PURE__ */ Z(ul, { cols: P.columns?.length ?? 4 }) : Ie ? /* @__PURE__ */ Z("div", {
14620
+ }) : Pe ? /* @__PURE__ */ Z(ul, { cols: F.columns?.length ?? 4 }) : Ie ? /* @__PURE__ */ Z("div", {
14623
14621
  style: { padding: "0 20px" },
14624
14622
  children: /* @__PURE__ */ Z(il, {
14625
14623
  icon: "alert-circle",
14626
14624
  title: "Failed to load data",
14627
14625
  description: Cu(Le),
14628
- action: /* @__PURE__ */ Z(F, {
14626
+ action: /* @__PURE__ */ Z(P, {
14629
14627
  kind: "primary",
14630
14628
  size: "sm",
14631
14629
  onClick: Ye,
@@ -14635,13 +14633,13 @@ function ju({ screenCode: e }) {
14635
14633
  }) : mt.length === 0 ? /* @__PURE__ */ Z("div", {
14636
14634
  style: { padding: "0 20px" },
14637
14635
  children: (() => {
14638
- let e = !!Ee || x > 0, t = Wt.empty_state, n = U(t?.title), r = U(t?.body), i = sl(t?.learn_more_url), a = e ? "No results found" : n || `No ${U(Wt.name_plural).toLowerCase() || Gt.toLowerCase()} yet`, o;
14636
+ let e = !!De || C > 0, t = Wt.empty_state, n = U(t?.title), r = U(t?.body), i = sl(t?.learn_more_url), a = e ? "No results found" : n || `No ${U(Wt.name_plural).toLowerCase() || Gt.toLowerCase()} yet`, o;
14639
14637
  return o = e ? "Try adjusting your search or filters" : r ? /* @__PURE__ */ Q(X, { children: [r, i && /* @__PURE__ */ Q(X, { children: [" ", /* @__PURE__ */ Z("a", {
14640
14638
  href: i,
14641
14639
  target: "_blank",
14642
14640
  rel: "noopener noreferrer",
14643
14641
  children: "Learn more"
14644
- })] })] }) : ee ? `Create your first ${U(Wt.name).toLowerCase()} to get started` : void 0, /* @__PURE__ */ Z(il, {
14642
+ })] })] }) : te ? `Create your first ${U(Wt.name).toLowerCase()} to get started` : void 0, /* @__PURE__ */ Z(il, {
14645
14643
  icon: Kt,
14646
14644
  title: a,
14647
14645
  description: o
@@ -14649,7 +14647,7 @@ function ju({ screenCode: e }) {
14649
14647
  })()
14650
14648
  }) : /* @__PURE__ */ Z("div", {
14651
14649
  style: {
14652
- flex: fe.enabled ? "none" : 1,
14650
+ flex: pe.enabled ? "none" : 1,
14653
14651
  minHeight: 0,
14654
14652
  padding: "0 20px 16px",
14655
14653
  display: "flex",
@@ -14664,14 +14662,14 @@ function ju({ screenCode: e }) {
14664
14662
  boxShadow: "var(--shadow-xs)",
14665
14663
  display: "flex",
14666
14664
  flexDirection: "column",
14667
- flex: fe.enabled ? "none" : 1,
14665
+ flex: pe.enabled ? "none" : 1,
14668
14666
  minHeight: 0
14669
14667
  },
14670
14668
  children: [/* @__PURE__ */ Z("div", {
14671
14669
  ref: Dt,
14672
14670
  style: {
14673
- overflow: fe.enabled ? "visible" : "auto",
14674
- flex: fe.enabled ? "none" : 1,
14671
+ overflow: pe.enabled ? "visible" : "auto",
14672
+ flex: pe.enabled ? "none" : 1,
14675
14673
  minHeight: 0
14676
14674
  },
14677
14675
  children: /* @__PURE__ */ Q("table", {
@@ -14688,7 +14686,7 @@ function ju({ screenCode: e }) {
14688
14686
  background: "var(--surface-2)"
14689
14687
  },
14690
14688
  children: e.headers.map((e) => {
14691
- let n = Tu(e.id, I), r = e.column.getIsSorted(), i = e.id === "_select", a = e.id === "_actions", o = r ? Se.findIndex((t) => t.field === e.id) + 1 : 0, s = Se.length > 1 && o > 0, c = o > 0, l = Se.length < 5, u = n ? e.column.getToggleSortingHandler() : void 0;
14689
+ let n = Tu(e.id, I), r = e.column.getIsSorted(), i = e.id === "_select", a = e.id === "_actions", o = r ? Ce.findIndex((t) => t.field === e.id) + 1 : 0, s = Ce.length > 1 && o > 0, c = o > 0, l = Ce.length < 5, u = n ? e.column.getToggleSortingHandler() : void 0;
14692
14690
  return /* @__PURE__ */ Z("th", {
14693
14691
  onClick: n ? (t) => {
14694
14692
  if (t.shiftKey) {
@@ -14736,7 +14734,7 @@ function ju({ screenCode: e }) {
14736
14734
  children: [r === "asc" ? /* @__PURE__ */ Z(t.arrowUp, { size: 11 }) : r === "desc" ? /* @__PURE__ */ Z(t.arrowDown, { size: 11 }) : /* @__PURE__ */ Z(t.sort, {
14737
14735
  size: 11,
14738
14736
  style: { opacity: .35 }
14739
- }), r && Ce.get(e.id) === "first" ? /* @__PURE__ */ Z("span", {
14737
+ }), r && Te.get(e.id) === "first" ? /* @__PURE__ */ Z("span", {
14740
14738
  "aria-hidden": "true",
14741
14739
  style: {
14742
14740
  width: 4,
@@ -14761,7 +14759,7 @@ function ju({ screenCode: e }) {
14761
14759
  /* @__PURE__ */ Z(yu, {
14762
14760
  field: e.id,
14763
14761
  activeDir: r,
14764
- activeNulls: Ce.get(e.id),
14762
+ activeNulls: Te.get(e.id),
14765
14763
  inMultiSort: c,
14766
14764
  canAppend: l,
14767
14765
  onApply: (t, n) => St(e.id, t, n),
@@ -14773,7 +14771,7 @@ function ju({ screenCode: e }) {
14773
14771
  }) : hn(e.column.columnDef.header, e.getContext())
14774
14772
  }, e.id);
14775
14773
  })
14776
- }, e.id)) }), /* @__PURE__ */ Z("tbody", { children: fe.enabled ? Ot.map((e, t) => Xt(e, t, !1)) : /* @__PURE__ */ Q(X, { children: [
14774
+ }, e.id)) }), /* @__PURE__ */ Z("tbody", { children: pe.enabled ? Ot.map((e, t) => Xt(e, t, !1)) : /* @__PURE__ */ Q(X, { children: [
14777
14775
  jt.getVirtualItems().length > 0 && /* @__PURE__ */ Z("tr", { children: /* @__PURE__ */ Z("td", {
14778
14776
  style: { height: jt.getVirtualItems()[0]?.start ?? 0 },
14779
14777
  colSpan: pt.length
@@ -14836,7 +14834,7 @@ function ju({ screenCode: e }) {
14836
14834
  /* @__PURE__ */ Z("span", { children: "Rows per page" }),
14837
14835
  /* @__PURE__ */ Z("select", {
14838
14836
  "aria-label": "Rows per page",
14839
- value: ge,
14837
+ value: _e,
14840
14838
  onChange: (e) => It(parseInt(e.target.value, 10)),
14841
14839
  style: {
14842
14840
  fontSize: 11.5,
@@ -14852,7 +14850,7 @@ function ju({ screenCode: e }) {
14852
14850
  children: e
14853
14851
  }, e))
14854
14852
  }),
14855
- (_t || he > 1) && /* @__PURE__ */ Q("div", {
14853
+ (_t || ge > 1) && /* @__PURE__ */ Q("div", {
14856
14854
  style: {
14857
14855
  display: "flex",
14858
14856
  alignItems: "center",
@@ -14862,23 +14860,23 @@ function ju({ screenCode: e }) {
14862
14860
  /* @__PURE__ */ Z(B, {
14863
14861
  size: 22,
14864
14862
  icon: /* @__PURE__ */ Z(t.left, { size: 12 }),
14865
- onClick: () => Ft(he - 1),
14866
- disabled: he <= 1
14863
+ onClick: () => Ft(ge - 1),
14864
+ disabled: ge <= 1
14867
14865
  }),
14868
14866
  /* @__PURE__ */ Q("span", {
14869
14867
  className: "num",
14870
14868
  style: { padding: "0 6px" },
14871
14869
  children: [
14872
14870
  "Page ",
14873
- he,
14871
+ ge,
14874
14872
  gt === void 0 ? "" : ` of ${gt}`
14875
14873
  ]
14876
14874
  }),
14877
14875
  /* @__PURE__ */ Z(B, {
14878
14876
  size: 22,
14879
14877
  icon: /* @__PURE__ */ Z(t.right, { size: 12 }),
14880
- onClick: () => Ft(he + 1),
14881
- disabled: gt === void 0 ? !_t : he >= gt
14878
+ onClick: () => Ft(ge + 1),
14879
+ disabled: gt === void 0 ? !_t : ge >= gt
14882
14880
  })
14883
14881
  ]
14884
14882
  })
@@ -14887,62 +14885,62 @@ function ju({ screenCode: e }) {
14887
14885
  })
14888
14886
  }),
14889
14887
  /* @__PURE__ */ Z(Kl, {
14890
- open: p,
14891
- onClose: () => h(!1),
14892
- filters: b,
14893
- onApply: C,
14894
- availableFields: Xl(P, I, s?.entities)
14888
+ open: h,
14889
+ onClose: () => g(!1),
14890
+ filters: x,
14891
+ onApply: w,
14892
+ availableFields: Xl(F, I, c?.entities)
14895
14893
  }),
14896
14894
  /* @__PURE__ */ Z(Ql, {
14897
- open: g,
14895
+ open: _,
14898
14896
  pending: rt.isPending,
14899
- onClose: () => _(!1),
14897
+ onClose: () => v(!1),
14900
14898
  onSave: async (t) => {
14901
- if (!E?.id || !D?.id) return;
14899
+ if (!D?.id || !O?.id) return;
14902
14900
  let n = await rt.mutateAsync({
14903
- tenant_id: D.id,
14901
+ tenant_id: O.id,
14904
14902
  screen_code: e,
14905
- user_id: E.id,
14903
+ user_id: D.id,
14906
14904
  name: { en: t },
14907
- filters: b,
14908
- columns: De,
14909
- ...Te ? { sort: Te } : {},
14905
+ filters: x,
14906
+ columns: ke,
14907
+ ...Ee ? { sort: Ee } : {},
14910
14908
  is_shared: !1,
14911
14909
  is_default: !1
14912
14910
  }), r = String(n.data.id ?? "");
14913
14911
  if (r) {
14914
- let e = new URLSearchParams(i);
14915
- e.set("view", r), a(e);
14912
+ let e = new URLSearchParams(a);
14913
+ e.set("view", r), s(e);
14916
14914
  }
14917
- _(!1);
14915
+ v(!1);
14918
14916
  }
14919
14917
  }),
14920
14918
  /* @__PURE__ */ Z(gr, {
14921
- open: l !== null,
14922
- onOpenChange: (e) => !e && u(null),
14919
+ open: u !== null,
14920
+ onOpenChange: (e) => !e && d(null),
14923
14921
  title: `Delete ${U(Wt.name)}`,
14924
- description: l?.confirmation ? l.confirmation : ce ? `Are you sure you want to delete this ${U(Wt.name).toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${U(Wt.name).toLowerCase()}? This action cannot be undone.`,
14922
+ description: u?.confirmation ? u.confirmation : le ? `Are you sure you want to delete this ${U(Wt.name).toLowerCase()}? It can be restored later by an admin.` : `Are you sure you want to delete this ${U(Wt.name).toLowerCase()}? This action cannot be undone.`,
14925
14923
  confirmLabel: "Delete",
14926
14924
  onConfirm: Ut,
14927
14925
  destructive: !0
14928
14926
  }),
14929
14927
  yt.length > 0 && /* @__PURE__ */ Z(eu, {
14930
14928
  selectedIds: yt,
14931
- floatbarActions: ae,
14932
- screenActionLayout: P.action_layout,
14929
+ floatbarActions: R,
14930
+ screenActionLayout: F.action_layout,
14933
14931
  entityActionLayout: I.action_layout,
14934
14932
  data: mt,
14935
14933
  rowKey: ot,
14936
14934
  entityCode: L,
14937
- onClear: () => f({}),
14938
- onActionSuccess: () => f({}),
14935
+ onClear: () => p({}),
14936
+ onActionSuccess: () => p({}),
14939
14937
  widgetContext: Yt
14940
14938
  }),
14941
- v && I && /* @__PURE__ */ Q("div", {
14939
+ y && I && /* @__PURE__ */ Q("div", {
14942
14940
  style: {
14943
14941
  position: "fixed",
14944
- top: v.y,
14945
- left: v.x,
14942
+ top: y.y,
14943
+ left: y.x,
14946
14944
  zIndex: 100
14947
14945
  },
14948
14946
  onClick: (e) => e.stopPropagation(),
@@ -14959,31 +14957,31 @@ function ju({ screenCode: e }) {
14959
14957
  ft && /* @__PURE__ */ Z(W, {
14960
14958
  icon: /* @__PURE__ */ Z(t.eye, { size: 13 }),
14961
14959
  onClick: () => {
14962
- dt(v.row), y(null);
14960
+ dt(y.row), b(null);
14963
14961
  },
14964
14962
  children: "Quick peek"
14965
14963
  }),
14966
14964
  /* @__PURE__ */ Z(W, {
14967
14965
  icon: /* @__PURE__ */ Z(t.external, { size: 13 }),
14968
14966
  onClick: () => {
14969
- Rt(v.row), y(null);
14967
+ Rt(y.row), b(null);
14970
14968
  },
14971
14969
  children: "Open"
14972
14970
  }),
14973
- ne && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(W, { divider: !0 }), /* @__PURE__ */ Z(W, {
14971
+ re && /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(W, { divider: !0 }), /* @__PURE__ */ Z(W, {
14974
14972
  icon: /* @__PURE__ */ Z(t.trash, { size: 13 }),
14975
14973
  danger: !0,
14976
14974
  onClick: () => {
14977
- let e = I.fields.names()?.find((e) => I.fields.get(e)?.primary), t = e ? String(v.row[e] ?? "") : "";
14978
- y(null), t && u({ ids: [t] });
14975
+ let e = I.fields.names()?.find((e) => I.fields.get(e)?.primary), t = e ? String(y.row[e] ?? "") : "";
14976
+ b(null), t && d({ ids: [t] });
14979
14977
  },
14980
14978
  children: "Delete"
14981
14979
  })] })
14982
14980
  ]
14983
14981
  }), /* @__PURE__ */ Z("div", {
14984
- onClick: () => y(null),
14982
+ onClick: () => b(null),
14985
14983
  onContextMenu: (e) => {
14986
- e.preventDefault(), y(null);
14984
+ e.preventDefault(), b(null);
14987
14985
  },
14988
14986
  style: {
14989
14987
  position: "fixed",
@@ -14997,7 +14995,7 @@ function ju({ screenCode: e }) {
14997
14995
  entityCode: L,
14998
14996
  record: ut,
14999
14997
  title: (() => {
15000
- let e = P.columns?.find((e) => !e.startsWith("$status.") && !e.startsWith("$property."));
14998
+ let e = F.columns?.find((e) => !e.startsWith("$status.") && !e.startsWith("$property."));
15001
14999
  return e ? String(ut[e] ?? U(I.display.name)) : U(I.display.name);
15002
15000
  })(),
15003
15001
  recordId: (() => {
@@ -15005,7 +15003,7 @@ function ju({ screenCode: e }) {
15005
15003
  return e ? String(ut[e] ?? "") : void 0;
15006
15004
  })(),
15007
15005
  fields: Bt,
15008
- screen: P,
15006
+ screen: F,
15009
15007
  actions: Vt,
15010
15008
  executeAction: Ht,
15011
15009
  onClose: () => {
@@ -15057,7 +15055,7 @@ function Mu(e, t) {
15057
15055
  e,
15058
15056
  n
15059
15057
  ],
15060
- queryFn: () => f(e, t),
15058
+ queryFn: () => v(e, t),
15061
15059
  enabled: !!e && !!t && t !== "new" && n !== void 0
15062
15060
  });
15063
15061
  }
@@ -15122,14 +15120,14 @@ function Pu({ entityCode: e, recordId: n, assocKey: r, association: i, schema: a
15122
15120
  c,
15123
15121
  n
15124
15122
  ],
15125
- queryFn: () => w(c, [n])
15123
+ queryFn: () => F(c, [n])
15126
15124
  }), d = l?.target_entity ?? i.target, f = a.entities[d], p = q(() => l?.ids ?? [], [l?.ids]), m = q(() => f?.fields.names().find((e) => f.fields.get(e)?.primary) ?? "id", [f]), h = q(() => p.slice(0, 50), [p]), { data: g, isLoading: _ } = ln({
15127
15125
  queryKey: [
15128
15126
  "association-records",
15129
15127
  d,
15130
15128
  h
15131
15129
  ],
15132
- queryFn: () => v(d, {
15130
+ queryFn: () => w(d, {
15133
15131
  per_page: 50,
15134
15132
  filters: [{
15135
15133
  field: m,
@@ -15138,10 +15136,10 @@ function Pu({ entityCode: e, recordId: n, assocKey: r, association: i, schema: a
15138
15136
  }]
15139
15137
  }),
15140
15138
  enabled: h.length > 0 && !!f
15141
- }), y = g?.data ?? [], b = g?.$refs, x = q(() => f ? f.fields.names().filter((e) => {
15139
+ }), v = g?.data ?? [], y = g?.$refs, b = q(() => f ? f.fields.names().filter((e) => {
15142
15140
  let t = f.fields.get(e);
15143
15141
  return t && !t.primary && !t.auto && t.display?.is_listable !== !1;
15144
- }).slice(0, 6) : [], [f]), S = () => {
15142
+ }).slice(0, 6) : [], [f]), x = () => {
15145
15143
  let e = Ds(a, d);
15146
15144
  if (!e) return;
15147
15145
  let t = U(i.display?.name) || r, n = new URLSearchParams();
@@ -15154,33 +15152,33 @@ function Pu({ entityCode: e, recordId: n, assocKey: r, association: i, schema: a
15154
15152
  icon: i.display?.icon || e.icon,
15155
15153
  search: n.toString()
15156
15154
  });
15157
- }, C = {
15155
+ }, S = {
15158
15156
  fontSize: 12.5,
15159
15157
  color: "var(--text-3)",
15160
15158
  padding: "14px 16px"
15161
15159
  };
15162
15160
  if (u || _) return /* @__PURE__ */ Z("div", {
15163
- style: C,
15161
+ style: S,
15164
15162
  children: "Loading…"
15165
15163
  });
15166
15164
  if (!f) return /* @__PURE__ */ Z("div", {
15167
- style: C,
15165
+ style: S,
15168
15166
  children: "Entity not found."
15169
15167
  });
15170
15168
  if (p.length === 0) return /* @__PURE__ */ Z("div", {
15171
- style: C,
15169
+ style: S,
15172
15170
  children: "No related records."
15173
15171
  });
15174
- let T = Ds(a, d);
15172
+ let C = Ds(a, d);
15175
15173
  return /* @__PURE__ */ Q("div", {
15176
15174
  style: { padding: "8px 0" },
15177
15175
  children: [
15178
15176
  /* @__PURE__ */ Q("table", {
15179
15177
  style: Ke,
15180
- children: [/* @__PURE__ */ Z("thead", { children: /* @__PURE__ */ Z("tr", { children: x.map((e) => /* @__PURE__ */ Z("th", {
15178
+ children: [/* @__PURE__ */ Z("thead", { children: /* @__PURE__ */ Z("tr", { children: b.map((e) => /* @__PURE__ */ Z("th", {
15181
15179
  style: Re,
15182
15180
  children: we(f.fields.get(e), e, a.entities)
15183
- }, e)) }) }), /* @__PURE__ */ Z("tbody", { children: y.map((e, t) => /* @__PURE__ */ Z("tr", { children: x.map((t) => {
15181
+ }, e)) }) }), /* @__PURE__ */ Z("tbody", { children: v.map((e, t) => /* @__PURE__ */ Z("tr", { children: b.map((t) => {
15184
15182
  let n = f.fields.get(t);
15185
15183
  return n ? /* @__PURE__ */ Z("td", {
15186
15184
  style: Xe,
@@ -15190,20 +15188,20 @@ function Pu({ entityCode: e, recordId: n, assocKey: r, association: i, schema: a
15190
15188
  value: e[t],
15191
15189
  mode: "display",
15192
15190
  record: e,
15193
- refs: b,
15191
+ refs: y,
15194
15192
  locale: s
15195
15193
  })
15196
15194
  }, t) : /* @__PURE__ */ Z("td", {}, t);
15197
15195
  }) }, t)) })]
15198
15196
  }),
15199
- T && l && l.count > y.length && /* @__PURE__ */ Z("div", {
15197
+ C && l && l.count > v.length && /* @__PURE__ */ Z("div", {
15200
15198
  style: {
15201
15199
  padding: "10px 16px",
15202
15200
  textAlign: "center"
15203
15201
  },
15204
- children: /* @__PURE__ */ Q(F, {
15202
+ children: /* @__PURE__ */ Q(P, {
15205
15203
  icon: /* @__PURE__ */ Z(t.external, { size: 12 }),
15206
- onClick: S,
15204
+ onClick: x,
15207
15205
  children: [
15208
15206
  "View all ",
15209
15207
  l.count,
@@ -15211,15 +15209,15 @@ function Pu({ entityCode: e, recordId: n, assocKey: r, association: i, schema: a
15211
15209
  ]
15212
15210
  })
15213
15211
  }),
15214
- T && y.length > 0 && l && l.count <= y.length && /* @__PURE__ */ Z("div", {
15212
+ C && v.length > 0 && l && l.count <= v.length && /* @__PURE__ */ Z("div", {
15215
15213
  style: {
15216
15214
  padding: "10px 16px",
15217
15215
  textAlign: "center"
15218
15216
  },
15219
- children: /* @__PURE__ */ Z(F, {
15217
+ children: /* @__PURE__ */ Z(P, {
15220
15218
  kind: "ghost",
15221
15219
  icon: /* @__PURE__ */ Z(t.external, { size: 12 }),
15222
- onClick: S,
15220
+ onClick: x,
15223
15221
  children: "Open in list view"
15224
15222
  })
15225
15223
  })
@@ -15604,27 +15602,27 @@ function sd(e, t) {
15604
15602
  }
15605
15603
  //#endregion
15606
15604
  //#region src/components/detail-layout/useQuickAdd.ts
15607
- function cd(e, t, r, i) {
15608
- let [a, o] = Y(() => {
15609
- let t = e.quick_add, n = i.entities[e.entity], r = {};
15610
- if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (r[e] = u()) : r[e] = t.defaults[e];
15611
- return r;
15612
- }), s = un(), { mutate: c, isPending: l, error: d, reset: f } = cn({
15613
- mutationFn: (t) => n(e.entity, t),
15614
- onMutate: async (n) => {
15605
+ function cd(e, t, n, r) {
15606
+ let [i, a] = Y(() => {
15607
+ let t = e.quick_add, n = r.entities[e.entity], i = {};
15608
+ if (t?.fields) for (let e of t.fields) t.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" && (i[e] = u()) : i[e] = t.defaults[e];
15609
+ return i;
15610
+ }), o = un(), { mutate: s, isPending: c, error: l, reset: d } = cn({
15611
+ mutationFn: (t) => Ae(e.entity, t),
15612
+ onMutate: async (r) => {
15615
15613
  let i = [
15616
15614
  oo,
15617
15615
  t,
15618
- Array.isArray(r) ? me(r.map(String)) : r,
15616
+ Array.isArray(n) ? me(n.map(String)) : n,
15619
15617
  e.entity
15620
15618
  ];
15621
- await s.cancelQueries({ queryKey: i });
15622
- let a = s.getQueriesData({ queryKey: i }), o = {
15623
- ...n,
15619
+ await o.cancelQueries({ queryKey: i });
15620
+ let a = o.getQueriesData({ queryKey: i }), s = {
15621
+ ...r,
15624
15622
  id: `__optimistic_${crypto.randomUUID()}`,
15625
15623
  __optimistic: !0
15626
15624
  };
15627
- return s.setQueriesData({ queryKey: i }, (e) => {
15625
+ return o.setQueriesData({ queryKey: i }, (e) => {
15628
15626
  if (!e || typeof e != "object") return e;
15629
15627
  if ("pages" in e && Array.isArray(e.pages) && e.pages.length > 0) {
15630
15628
  let t = e, [n, ...r] = t.pages;
@@ -15632,7 +15630,7 @@ function cd(e, t, r, i) {
15632
15630
  ...t,
15633
15631
  pages: [{
15634
15632
  ...n,
15635
- data: [o, ...n.data]
15633
+ data: [s, ...n.data]
15636
15634
  }, ...r]
15637
15635
  };
15638
15636
  }
@@ -15640,41 +15638,41 @@ function cd(e, t, r, i) {
15640
15638
  }), { snapshots: a };
15641
15639
  },
15642
15640
  onError: (e, t, n) => {
15643
- if (n?.snapshots) for (let [e, t] of n.snapshots) s.setQueryData(e, t);
15641
+ if (n?.snapshots) for (let [e, t] of n.snapshots) o.setQueryData(e, t);
15644
15642
  },
15645
15643
  onSuccess: () => {
15646
- let t = e.quick_add, n = i.entities[e.entity], r = {};
15647
- if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? r[e] = u() : r[e] = "" : r[e] = t.defaults[e];
15648
- o(r);
15644
+ let t = e.quick_add, n = r.entities[e.entity], i = {};
15645
+ if (t?.fields) for (let e of t.fields) t?.defaults?.[e] == null ? n?.fields.get(e)?.type === "timestamp" ? i[e] = u() : i[e] = "" : i[e] = t.defaults[e];
15646
+ a(i);
15649
15647
  },
15650
15648
  onSettled: () => {
15651
- let n = Array.isArray(r) ? me(r.map(String)) : r;
15652
- s.invalidateQueries({ queryKey: [
15649
+ let r = Array.isArray(n) ? me(n.map(String)) : n;
15650
+ o.invalidateQueries({ queryKey: [
15653
15651
  oo,
15654
15652
  t,
15655
- n,
15653
+ r,
15656
15654
  e.entity
15657
15655
  ] });
15658
15656
  }
15659
- }), p = e.quick_add, m = i.entities[e.entity], h = sd(a, p?.fields.filter((e) => m?.fields.get(e)?.required) ?? []);
15660
- function g(t) {
15661
- t.preventDefault(), p && c(od(a, p.defaults, e.foreign_key, r));
15657
+ }), f = e.quick_add, p = r.entities[e.entity], m = sd(i, f?.fields.filter((e) => p?.fields.get(e)?.required) ?? []);
15658
+ function h(t) {
15659
+ t.preventDefault(), f && s(od(i, f.defaults, e.foreign_key, n));
15662
15660
  }
15663
- function _(e, t) {
15664
- d && f(), o((n) => ({
15661
+ function g(e, t) {
15662
+ l && d(), a((n) => ({
15665
15663
  ...n,
15666
15664
  [e]: t
15667
15665
  }));
15668
15666
  }
15669
15667
  return {
15670
- values: a,
15671
- quickAdd: p,
15672
- childEntity: m,
15673
- isPending: l,
15674
- error: d,
15675
- isReady: h,
15676
- handleSubmit: g,
15677
- handleFieldChange: _
15668
+ values: i,
15669
+ quickAdd: f,
15670
+ childEntity: p,
15671
+ isPending: c,
15672
+ error: l,
15673
+ isReady: m,
15674
+ handleSubmit: h,
15675
+ handleFieldChange: g
15678
15676
  };
15679
15677
  }
15680
15678
  //#endregion
@@ -15718,7 +15716,7 @@ function ld({ config: e, parentEntity: n, parentId: r, schema: i }) {
15718
15716
  })]
15719
15717
  }, e) : null;
15720
15718
  }),
15721
- /* @__PURE__ */ Z(F, {
15719
+ /* @__PURE__ */ Z(P, {
15722
15720
  type: "submit",
15723
15721
  kind: "primary",
15724
15722
  icon: /* @__PURE__ */ Z(t.plus, { size: 12 }),
@@ -16373,7 +16371,7 @@ function bd({ config: e, parentEntity: n, parentId: r, schema: i }) {
16373
16371
  }),
16374
16372
  " to add"
16375
16373
  ]
16376
- }), /* @__PURE__ */ Z(F, {
16374
+ }), /* @__PURE__ */ Z(P, {
16377
16375
  type: "submit",
16378
16376
  kind: "primary",
16379
16377
  icon: /* @__PURE__ */ Z(t.plus, { size: 13 }),
@@ -16467,7 +16465,7 @@ function Td({ config: e, parentEntity: t, parentId: n, schema: r }) {
16467
16465
  justifyContent: "center",
16468
16466
  padding: "6px 0"
16469
16467
  },
16470
- children: /* @__PURE__ */ Z(F, {
16468
+ children: /* @__PURE__ */ Z(P, {
16471
16469
  size: "xs",
16472
16470
  onClick: () => s(),
16473
16471
  disabled: l,
@@ -16625,46 +16623,46 @@ function Td({ config: e, parentEntity: t, parentId: n, schema: r }) {
16625
16623
  schema: r
16626
16624
  })] });
16627
16625
  }
16628
- function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a, parentId: o, timeline: s, editableFields: c, refs: l, isEditing: u, onStartEdit: d, onCancelEdit: f, onSaved: p, schema: m, optimistic: h = !1 }) {
16629
- let g = un(), _ = Oe(), [v, y] = Y({}), b = G(() => {
16630
- g.invalidateQueries({ queryKey: [
16626
+ function Ed({ row: e, rowId: n, childEntity: r, entityCode: a, parentEntity: o, parentId: s, timeline: c, editableFields: l, refs: u, isEditing: d, onStartEdit: f, onCancelEdit: p, onSaved: m, schema: h, optimistic: g = !1 }) {
16627
+ let _ = un(), v = Oe(), [y, b] = Y({}), x = G(() => {
16628
+ _.invalidateQueries({ queryKey: [
16631
16629
  oo,
16632
- a,
16633
16630
  o,
16634
- i
16631
+ s,
16632
+ a
16635
16633
  ] });
16636
16634
  }, [
16637
- g,
16638
- a,
16635
+ _,
16639
16636
  o,
16640
- i
16641
- ]), x = cn({
16642
- mutationFn: (e) => ct(i, n, e),
16637
+ s,
16638
+ a
16639
+ ]), S = cn({
16640
+ mutationFn: (e) => i(a, n, e),
16643
16641
  onSuccess: () => {
16644
- b(), $.success("Updated"), p();
16642
+ x(), $.success("Updated"), m();
16645
16643
  },
16646
16644
  onError: (e) => $.error(e.message)
16647
- }), S = cn({
16648
- mutationFn: () => Ae(i, n),
16645
+ }), C = cn({
16646
+ mutationFn: () => E(a, n),
16649
16647
  onSuccess: () => {
16650
- b(), $.success("Deleted");
16648
+ x(), $.success("Deleted");
16651
16649
  },
16652
16650
  onError: (e) => $.error(e.message)
16653
- }), C = G(() => {
16651
+ }), w = G(() => {
16654
16652
  let t = {};
16655
- for (let n of c) t[n] = e[n] ?? "";
16656
- y(t), d();
16653
+ for (let n of l) t[n] = e[n] ?? "";
16654
+ b(t), f();
16657
16655
  }, [
16658
16656
  e,
16659
- c,
16660
- d
16661
- ]), w = G((e, t) => {
16662
- y((n) => ({
16657
+ l,
16658
+ f
16659
+ ]), D = G((e, t) => {
16660
+ b((n) => ({
16663
16661
  ...n,
16664
16662
  [e]: t
16665
16663
  }));
16666
- }, []), E = s?.time_field, D = s?.type_field, O = s?.summary_field, k = s?.content_field, A = s?.author_field, j = s?.direction_field, M = s?.intent_field;
16667
- return u ? /* @__PURE__ */ Q("div", {
16664
+ }, []), O = c?.time_field, k = c?.type_field, A = c?.summary_field, j = c?.content_field, M = c?.author_field, N = c?.direction_field, ee = c?.intent_field;
16665
+ return d ? /* @__PURE__ */ Q("div", {
16668
16666
  style: {
16669
16667
  borderRadius: 10,
16670
16668
  border: "1px solid var(--accent)",
@@ -16674,7 +16672,7 @@ function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a,
16674
16672
  flexDirection: "column",
16675
16673
  gap: 8
16676
16674
  },
16677
- children: [c.map((e) => {
16675
+ children: [l.map((e) => {
16678
16676
  let t = r.fields.get(e);
16679
16677
  return t ? /* @__PURE__ */ Q("div", { children: [/* @__PURE__ */ Z("label", {
16680
16678
  style: {
@@ -16683,15 +16681,15 @@ function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a,
16683
16681
  marginBottom: 4,
16684
16682
  display: "block"
16685
16683
  },
16686
- children: we(t, e, m.entities)
16684
+ children: we(t, e, h.entities)
16687
16685
  }), V({
16688
16686
  field: t,
16689
16687
  fieldName: e,
16690
- value: v[e] ?? "",
16688
+ value: y[e] ?? "",
16691
16689
  mode: "edit",
16692
- onChange: (t) => w(e, t),
16693
- record: v,
16694
- locale: _
16690
+ onChange: (t) => D(e, t),
16691
+ record: y,
16692
+ locale: v
16695
16693
  })] }, e) : null;
16696
16694
  }), /* @__PURE__ */ Q("div", {
16697
16695
  style: {
@@ -16700,33 +16698,33 @@ function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a,
16700
16698
  gap: 6,
16701
16699
  paddingTop: 4
16702
16700
  },
16703
- children: [/* @__PURE__ */ Z(F, {
16701
+ children: [/* @__PURE__ */ Z(P, {
16704
16702
  kind: "primary",
16705
16703
  size: "xs",
16706
- icon: x.isPending ? /* @__PURE__ */ Z(T, { size: 12 }) : /* @__PURE__ */ Z(t.check, { size: 12 }),
16707
- onClick: () => x.mutate(v),
16708
- disabled: x.isPending,
16709
- children: x.isPending ? "Saving…" : "Save"
16710
- }), /* @__PURE__ */ Z(F, {
16704
+ icon: S.isPending ? /* @__PURE__ */ Z(T, { size: 12 }) : /* @__PURE__ */ Z(t.check, { size: 12 }),
16705
+ onClick: () => S.mutate(y),
16706
+ disabled: S.isPending,
16707
+ children: S.isPending ? "Saving…" : "Save"
16708
+ }), /* @__PURE__ */ Z(P, {
16711
16709
  size: "xs",
16712
16710
  icon: /* @__PURE__ */ Z(t.x, { size: 12 }),
16713
16711
  onClick: () => {
16714
- y({}), f();
16712
+ b({}), p();
16715
16713
  },
16716
- disabled: x.isPending,
16714
+ disabled: S.isPending,
16717
16715
  children: "Cancel"
16718
16716
  })]
16719
16717
  })]
16720
16718
  }) : /* @__PURE__ */ Q("div", {
16721
16719
  className: "group",
16722
- "data-optimistic": h || void 0,
16720
+ "data-optimistic": g || void 0,
16723
16721
  style: {
16724
16722
  borderRadius: 10,
16725
16723
  border: "1px solid var(--border)",
16726
16724
  background: "var(--surface)",
16727
16725
  padding: 12,
16728
16726
  transition: "border-color .12s",
16729
- opacity: h ? .6 : 1
16727
+ opacity: g ? .6 : 1
16730
16728
  },
16731
16729
  onMouseEnter: (e) => e.currentTarget.style.borderColor = "var(--border-strong)",
16732
16730
  onMouseLeave: (e) => e.currentTarget.style.borderColor = "var(--border)",
@@ -16741,62 +16739,62 @@ function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a,
16741
16739
  color: "var(--text-3)"
16742
16740
  },
16743
16741
  children: [
16744
- E && e[E] != null && r.fields.get(E) && /* @__PURE__ */ Z("span", {
16742
+ O && e[O] != null && r.fields.get(O) && /* @__PURE__ */ Z("span", {
16745
16743
  style: { fontWeight: 500 },
16746
16744
  children: V({
16747
- field: r.fields.get(E),
16748
- fieldName: E,
16749
- value: e[E],
16745
+ field: r.fields.get(O),
16746
+ fieldName: O,
16747
+ value: e[O],
16750
16748
  mode: "display",
16751
16749
  record: e,
16752
- refs: l,
16753
- locale: _
16750
+ refs: u,
16751
+ locale: v
16754
16752
  })
16755
16753
  }),
16756
- D && e[D] != null && r.fields.get(D) && /* @__PURE__ */ Z(z, {
16754
+ k && e[k] != null && r.fields.get(k) && /* @__PURE__ */ Z(z, {
16757
16755
  tone: "slate",
16758
16756
  size: "xs",
16759
16757
  children: V({
16760
- field: r.fields.get(D),
16761
- fieldName: D,
16762
- value: e[D],
16758
+ field: r.fields.get(k),
16759
+ fieldName: k,
16760
+ value: e[k],
16763
16761
  mode: "display",
16764
16762
  record: e,
16765
- refs: l,
16766
- locale: _
16763
+ refs: u,
16764
+ locale: v
16767
16765
  })
16768
16766
  }),
16769
- j && e[j] != null && r.fields.get(j) && /* @__PURE__ */ Z(Ad, {
16770
- value: e[j],
16771
- field: r.fields.get(j)
16767
+ N && e[N] != null && r.fields.get(N) && /* @__PURE__ */ Z(Ad, {
16768
+ value: e[N],
16769
+ field: r.fields.get(N)
16772
16770
  }),
16773
- M && e[M] != null && r.fields.get(M) && /* @__PURE__ */ Z(z, {
16771
+ ee && e[ee] != null && r.fields.get(ee) && /* @__PURE__ */ Z(z, {
16774
16772
  tone: "slate",
16775
16773
  size: "xs",
16776
16774
  children: V({
16777
- field: r.fields.get(M),
16778
- fieldName: M,
16779
- value: e[M],
16775
+ field: r.fields.get(ee),
16776
+ fieldName: ee,
16777
+ value: e[ee],
16780
16778
  mode: "display",
16781
16779
  record: e,
16782
- refs: l,
16783
- locale: _
16780
+ refs: u,
16781
+ locale: v
16784
16782
  })
16785
16783
  }),
16786
- A && e[A] != null && r.fields.get(A) && /* @__PURE__ */ Q("span", { children: [
16784
+ M && e[M] != null && r.fields.get(M) && /* @__PURE__ */ Q("span", { children: [
16787
16785
  "by",
16788
16786
  " ",
16789
16787
  V({
16790
- field: r.fields.get(A),
16791
- fieldName: A,
16792
- value: e[A],
16788
+ field: r.fields.get(M),
16789
+ fieldName: M,
16790
+ value: e[M],
16793
16791
  mode: "display",
16794
16792
  record: e,
16795
- refs: l,
16796
- locale: _
16793
+ refs: u,
16794
+ locale: v
16797
16795
  })
16798
16796
  ] }),
16799
- !h && /* @__PURE__ */ Q("div", {
16797
+ !g && /* @__PURE__ */ Q("div", {
16800
16798
  style: {
16801
16799
  marginLeft: "auto",
16802
16800
  display: "flex",
@@ -16806,47 +16804,47 @@ function Ed({ row: e, rowId: n, childEntity: r, entityCode: i, parentEntity: a,
16806
16804
  children: [/* @__PURE__ */ Z(B, {
16807
16805
  size: 22,
16808
16806
  icon: /* @__PURE__ */ Z(t.edit, { size: 11 }),
16809
- onClick: C,
16807
+ onClick: w,
16810
16808
  title: "Edit"
16811
16809
  }), /* @__PURE__ */ Z(B, {
16812
16810
  size: 22,
16813
16811
  icon: /* @__PURE__ */ Z(t.trash, { size: 11 }),
16814
- onClick: () => S.mutate(),
16812
+ onClick: () => C.mutate(),
16815
16813
  title: "Delete"
16816
16814
  })]
16817
16815
  })
16818
16816
  ]
16819
16817
  }),
16820
- O && e[O] != null && r.fields.get(O) && /* @__PURE__ */ Z("div", {
16818
+ A && e[A] != null && r.fields.get(A) && /* @__PURE__ */ Z("div", {
16821
16819
  style: {
16822
16820
  fontSize: 12.5,
16823
16821
  fontWeight: 500,
16824
16822
  marginTop: 6
16825
16823
  },
16826
16824
  children: V({
16827
- field: r.fields.get(O),
16828
- fieldName: O,
16829
- value: e[O],
16825
+ field: r.fields.get(A),
16826
+ fieldName: A,
16827
+ value: e[A],
16830
16828
  mode: "display",
16831
16829
  record: e,
16832
- refs: l,
16833
- locale: _
16830
+ refs: u,
16831
+ locale: v
16834
16832
  })
16835
16833
  }),
16836
- k && e[k] != null && k !== O && r.fields.get(k) && /* @__PURE__ */ Z("div", {
16834
+ j && e[j] != null && j !== A && r.fields.get(j) && /* @__PURE__ */ Z("div", {
16837
16835
  style: {
16838
16836
  fontSize: 12.5,
16839
16837
  fontWeight: 400,
16840
16838
  marginTop: 6
16841
16839
  },
16842
16840
  children: V({
16843
- field: r.fields.get(k),
16844
- fieldName: k,
16845
- value: e[k],
16841
+ field: r.fields.get(j),
16842
+ fieldName: j,
16843
+ value: e[j],
16846
16844
  mode: "display",
16847
16845
  record: e,
16848
- refs: l,
16849
- locale: _
16846
+ refs: u,
16847
+ locale: v
16850
16848
  })
16851
16849
  })
16852
16850
  ]
@@ -17092,7 +17090,7 @@ function Md({ config: e, childEntity: n, schema: r, rows: i, onChange: a, valida
17092
17090
  })
17093
17091
  }), /* @__PURE__ */ Z("div", {
17094
17092
  style: { marginTop: 8 },
17095
- children: /* @__PURE__ */ Z(F, {
17093
+ children: /* @__PURE__ */ Z(P, {
17096
17094
  kind: "ghost",
17097
17095
  size: "xs",
17098
17096
  icon: /* @__PURE__ */ Z(t.plus, { size: 12 }),
@@ -17103,7 +17101,7 @@ function Md({ config: e, childEntity: n, schema: r, rows: i, onChange: a, valida
17103
17101
  }
17104
17102
  //#endregion
17105
17103
  //#region src/components/detail-layout/ChildrenBlock.tsx
17106
- var Nd = Vt(() => import("./DraggableChildrenTable-B4JD8tAe.js").then((e) => ({ default: e.DraggableChildrenTable })));
17104
+ var Nd = Vt(() => import("./DraggableChildrenTable-8WlRET2T.js").then((e) => ({ default: e.DraggableChildrenTable })));
17107
17105
  function Pd({ node: e, ctx: t }) {
17108
17106
  let n = e.children;
17109
17107
  if (!n || t.isNew && t.mode !== "edit") return null;
@@ -18121,7 +18119,7 @@ function vf({ screenCode: e }) {
18121
18119
  d
18122
18120
  ]), C = q(() => {
18123
18121
  if (x) return typeof x == "string" ? x : _e(x);
18124
- }, [x]), { data: w, isLoading: T } = Mu(f, x), E = ms(f ?? ""), D = hs(f ?? ""), O = gs(f ?? ""), k = _s(f ?? ""), A = Object.keys(d?.status_groups ?? {}).length > 0, j = w?.data, M = j?.$statuses, N = j?.$properties, P = i.get("edit") === "true", [F, I] = Y(b || P), [L, ee] = Y({}), [te, re] = Y({}), [ie, ae] = Y({}), [R, oe] = Y(void 0), [se, ce] = Y(!1), [le, z] = Y(void 0), [ue, de] = Y({ show: !1 }), [fe, pe] = Y(!1), me = b ? p : m, V = F && me, he = $n();
18122
+ }, [x]), { data: w, isLoading: T } = Mu(f, x), E = ms(f ?? ""), D = hs(f ?? ""), O = gs(f ?? ""), k = _s(f ?? ""), A = Object.keys(d?.status_groups ?? {}).length > 0, j = w?.data, M = j?.$statuses, N = j?.$properties, ee = i.get("edit") === "true", [P, F] = Y(b || ee), [I, L] = Y({}), [te, re] = Y({}), [ie, ae] = Y({}), [R, oe] = Y(void 0), [se, ce] = Y(!1), [le, z] = Y(void 0), [ue, de] = Y({ show: !1 }), [fe, pe] = Y(!1), me = b ? p : m, V = P && me, he = $n();
18125
18123
  sr(V && !b, he.enabled);
18126
18124
  let [ge, ye] = Y(() => {
18127
18125
  let e = parseInt(l?.sidebar_width || "380", 10);
@@ -18147,8 +18145,8 @@ function vf({ screenCode: e }) {
18147
18145
  K(() => {
18148
18146
  if (!Te) return;
18149
18147
  let e = De.current;
18150
- De.current = Te, e && e !== Te && F && ce(!0);
18151
- }, [F, Te]);
18148
+ De.current = Te, e && e !== Te && P && ce(!0);
18149
+ }, [P, Te]);
18152
18150
  let ke = !!d?.soft_delete, Ae = ke && H != null && H[d.soft_delete] != null, je = Zt(), { openTab: Me, updateTabTitle: Ne, findTabByPathname: Fe } = In();
18153
18151
  K(() => {
18154
18152
  if (!d || v || he.enabled) return;
@@ -18192,8 +18190,8 @@ function vf({ screenCode: e }) {
18192
18190
  return e;
18193
18191
  }, [d, me]);
18194
18192
  K(() => {
18195
- if (!(!P || !H || !d || !m)) {
18196
- if (F || I(!0), Object.keys(L).length === 0) {
18193
+ if (!(!ee || !H || !d || !m)) {
18194
+ if (P || F(!0), Object.keys(I).length === 0) {
18197
18195
  let e = y ? Al(y) : null;
18198
18196
  e && ve(Je({
18199
18197
  entity: d,
@@ -18215,7 +18213,7 @@ function vf({ screenCode: e }) {
18215
18213
  }
18216
18214
  let i = Qe(d, H, n);
18217
18215
  t[n] = Pe(d, n) ? i ?? null : i ?? "";
18218
- }), ee(t);
18216
+ }), L(t);
18219
18217
  }
18220
18218
  if (d.children !== void 0 && d.children.length > 0 && R === void 0) {
18221
18219
  let e = H.$children;
@@ -18237,7 +18235,7 @@ function vf({ screenCode: e }) {
18237
18235
  }, { replace: !0 });
18238
18236
  }
18239
18237
  }, [
18240
- P,
18238
+ ee,
18241
18239
  H,
18242
18240
  Ie,
18243
18241
  m,
@@ -18252,14 +18250,14 @@ function vf({ screenCode: e }) {
18252
18250
  d?.children
18253
18251
  ]);
18254
18252
  let Re = G(async () => {
18255
- await c.flushAllDrafts(), b ? r(l?.route?.replace("/:id", "") ?? "/") : (I(!1), ee({}), re({}), ae({}), oe(void 0), z(void 0), pe(!1));
18253
+ await c.flushAllDrafts(), b ? r(l?.route?.replace("/:id", "") ?? "/") : (F(!1), L({}), re({}), ae({}), oe(void 0), z(void 0), pe(!1));
18256
18254
  }, [
18257
18255
  c,
18258
18256
  b,
18259
18257
  l,
18260
18258
  r
18261
18259
  ]), ze = G((e, t) => {
18262
- ee((n) => ({
18260
+ L((n) => ({
18263
18261
  ...n,
18264
18262
  [e]: t
18265
18263
  }));
@@ -18270,29 +18268,29 @@ function vf({ screenCode: e }) {
18270
18268
  }, [l]), Ve = q(() => !o?.screens || !Be || Be === "/" ? !1 : Object.values(o.screens).some((e) => e.route === Be), [o, Be]), Ge = Oe(), Ke = q(() => {
18271
18269
  if (!d) return {};
18272
18270
  let e = {};
18273
- for (let t of lf(d, L, b)) Ie.has(t) && (e[t] = "Required");
18274
- for (let t of df(d, L)) Ie.has(t) && (e[t] = "Invalid email address");
18271
+ for (let t of lf(d, I, b)) Ie.has(t) && (e[t] = "Required");
18272
+ for (let t of df(d, I)) Ie.has(t) && (e[t] = "Invalid email address");
18275
18273
  return e;
18276
18274
  }, [
18277
18275
  d,
18278
- L,
18276
+ I,
18279
18277
  b,
18280
18278
  Ie
18281
18279
  ]), qe = Object.keys(Ke).length > 0, Ye = G(() => {
18282
18280
  if (!f || !d || b && !p || !b && !m || (pe(!0), qe)) return;
18283
18281
  let e = {}, t = Je({
18284
18282
  entity: d,
18285
- formData: L,
18283
+ formData: I,
18286
18284
  record: H,
18287
18285
  isNew: b
18288
18286
  }), n = ve(t);
18289
- if (b) for (let [t, n] of Object.entries(L)) {
18287
+ if (b) for (let [t, n] of Object.entries(I)) {
18290
18288
  if (d.files?.has(t)) continue;
18291
18289
  let r = He(d, t, n);
18292
18290
  r !== "" && r != null && (e[t] = r);
18293
18291
  }
18294
18292
  else {
18295
- for (let [t, n] of Object.entries(L)) {
18293
+ for (let [t, n] of Object.entries(I)) {
18296
18294
  if (d.files?.has(t)) continue;
18297
18295
  let r = H ? Qe(d, H, t) : void 0, i = He(d, t, n), a = He(d, t, r);
18298
18296
  (i === "" ? null : i) !== (a === "" || a === void 0 ? null : a) && (e[t] = i);
@@ -18317,11 +18315,11 @@ function vf({ screenCode: e }) {
18317
18315
  Object.keys(t).length > 0 && (e.$children = t);
18318
18316
  }
18319
18317
  if (!b && Object.keys(e).length === 0) {
18320
- I(!1), re({}), ae({}), oe(void 0), z(void 0), pe(!1);
18318
+ F(!1), re({}), ae({}), oe(void 0), z(void 0), pe(!1);
18321
18319
  return;
18322
18320
  }
18323
18321
  let i = () => {
18324
- I(!1), ce(!1), pe(!1), re({}), ae({}), oe(void 0), z(void 0);
18322
+ F(!1), ce(!1), pe(!1), re({}), ae({}), oe(void 0), z(void 0);
18325
18323
  };
18326
18324
  b ? E.mutate(e, { onSuccess: (e) => {
18327
18325
  n.forEach((e) => c.markCommitted(e));
@@ -18344,7 +18342,7 @@ function vf({ screenCode: e }) {
18344
18342
  p,
18345
18343
  m,
18346
18344
  f,
18347
- L,
18345
+ I,
18348
18346
  qe,
18349
18347
  te,
18350
18348
  ie,
@@ -18416,7 +18414,7 @@ function vf({ screenCode: e }) {
18416
18414
  recordId: C ?? y ?? "",
18417
18415
  record: V ? {
18418
18416
  ...H ?? {},
18419
- ...L
18417
+ ...I
18420
18418
  } : H ?? {},
18421
18419
  isNew: b,
18422
18420
  mode: V ? "edit" : "display",
@@ -18482,7 +18480,7 @@ function vf({ screenCode: e }) {
18482
18480
  isNew: b,
18483
18481
  isSingletonByCaller: !!v,
18484
18482
  isRecordDeleted: Ae,
18485
- dirty: F,
18483
+ dirty: P,
18486
18484
  isSaving: ct,
18487
18485
  hasChildErrors: rt,
18488
18486
  hasFieldErrors: fe && qe,
@@ -18682,16 +18680,16 @@ function vf({ screenCode: e }) {
18682
18680
  ]
18683
18681
  });
18684
18682
  }
18685
- function yf({ title: e, recordId: n, editing: r, isNew: i, isSingletonByCaller: a, isRecordDeleted: o, dirty: s, isSaving: c, hasChildErrors: l, hasFieldErrors: u, canRestore: d, entity: f, screen: p, globalActions: m, entityCode: h, record: g, id: _, listRoute: v, listRouteExists: y, highlights: b, onBack: x, onCancelEdit: S, onSave: C, onRestore: w, isRestoring: E }) {
18686
- let { run: D } = to(), k = vr(), A = mr(), j = Oe(), M = p?.action_layout ?? null, N = f?.action_layout ?? null, P = M ?? N, I = Os(P ? Is(P, f?.actions, m, "detail") : zs(f?.actions, "detail"), f?.actions, m, g ?? {}, []), L = q(() => {
18687
- if (!f) return;
18688
- let e = _ ? [_] : [];
18683
+ function yf({ title: e, recordId: r, editing: i, isNew: a, isSingletonByCaller: o, isRecordDeleted: s, dirty: c, isSaving: l, hasChildErrors: u, hasFieldErrors: d, canRestore: f, entity: p, screen: m, globalActions: h, entityCode: g, record: _, id: v, listRoute: y, listRouteExists: b, highlights: x, onBack: S, onCancelEdit: C, onSave: w, onRestore: E, isRestoring: D }) {
18684
+ let { run: O } = to(), k = vr(), A = mr(), j = Oe(), N = m?.action_layout ?? null, ee = p?.action_layout ?? null, F = N ?? ee, I = Os(F ? Is(F, p?.actions, h, "detail") : zs(p?.actions, "detail"), p?.actions, h, _ ?? {}, []), L = q(() => {
18685
+ if (!p) return;
18686
+ let e = v ? [v] : [];
18689
18687
  return {
18690
- entity: f,
18691
- entityCode: h ?? "",
18692
- screen: p,
18693
- screenRoute: p?.route ?? "",
18694
- selectedRows: g ? [g] : [],
18688
+ entity: p,
18689
+ entityCode: g ?? "",
18690
+ screen: m,
18691
+ screenRoute: m?.route ?? "",
18692
+ selectedRows: _ ? [_] : [],
18695
18693
  selectedIds: e,
18696
18694
  locale: j,
18697
18695
  tabNavigate: (e, t) => k(e, {
@@ -18699,67 +18697,67 @@ function yf({ title: e, recordId: n, editing: r, isNew: i, isSingletonByCaller:
18699
18697
  icon: t?.icon,
18700
18698
  search: t?.search
18701
18699
  }),
18702
- runActionApi: (e, t) => O(e, t)
18700
+ runActionApi: (e, t) => M(e, t)
18703
18701
  };
18704
18702
  }, [
18705
- f,
18706
- h,
18707
18703
  p,
18708
- _,
18709
18704
  g,
18705
+ m,
18706
+ v,
18707
+ _,
18710
18708
  j,
18711
18709
  k
18712
- ]), ee = o ? d ? /* @__PURE__ */ Z(F, {
18710
+ ]), te = s ? f ? /* @__PURE__ */ Z(P, {
18713
18711
  kind: "primary",
18714
- icon: Z(E ? T : t.refresh, { size: 13 }),
18715
- onClick: w,
18716
- disabled: E,
18717
- children: E ? "Restoring…" : "Restore"
18718
- }) : null : r ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
18712
+ icon: Z(D ? T : t.refresh, { size: 13 }),
18713
+ onClick: E,
18714
+ disabled: D,
18715
+ children: D ? "Restoring…" : "Restore"
18716
+ }) : null : i ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
18719
18717
  icon: /* @__PURE__ */ Z(t.x, { size: 13 }),
18720
- onClick: S,
18721
- disabled: c,
18718
+ onClick: C,
18719
+ disabled: l,
18722
18720
  children: "Cancel"
18723
- }), /* @__PURE__ */ Z(F, {
18721
+ }), /* @__PURE__ */ Z(P, {
18724
18722
  kind: "primary",
18725
- icon: Z(c ? T : t.save, { size: 13 }),
18726
- onClick: C,
18727
- disabled: c || l || u,
18728
- title: l ? "Fix errors in child rows" : u ? "Fix the highlighted fields" : void 0,
18729
- children: c ? "Saving…" : "Save"
18730
- })] }) : !i && _ && I.length > 0 ? /* @__PURE__ */ Z(fc, {
18723
+ icon: Z(l ? T : t.save, { size: 13 }),
18724
+ onClick: w,
18725
+ disabled: l || u || d,
18726
+ title: u ? "Fix errors in child rows" : d ? "Fix the highlighted fields" : void 0,
18727
+ children: l ? "Saving…" : "Save"
18728
+ })] }) : !a && v && I.length > 0 ? /* @__PURE__ */ Z(fc, {
18731
18729
  layout: I,
18732
- row: g,
18730
+ row: _,
18733
18731
  onRun: (e, t) => {
18734
- let n = pc(e, t, { row: g ?? void 0 });
18735
- if (n === null) return;
18736
- let r = _ ? [_] : [], i = e === "__delete" && y ? v : null;
18737
- return D({
18732
+ let r = pc(e, t, { row: _ ?? void 0 });
18733
+ if (r === null) return;
18734
+ let i = v ? [v] : [], a = e === "__delete" && b ? y : null;
18735
+ return O({
18738
18736
  action: t,
18739
18737
  title: U(t.display?.name) || e,
18740
- execute: (e) => O(n, Me(e, r)),
18741
- onSuccess: i ? () => A(i, { replace: !0 }) : void 0
18738
+ execute: (e) => M(r, n(e, i)),
18739
+ onSuccess: a ? () => A(a, { replace: !0 }) : void 0
18742
18740
  });
18743
18741
  },
18744
18742
  kind: "detail",
18745
- entityActions: f?.actions,
18746
- globalActions: m,
18743
+ entityActions: p?.actions,
18744
+ globalActions: h,
18747
18745
  reservedRightWidth: 0,
18748
18746
  widgetContext: L
18749
18747
  }) : null;
18750
18748
  return /* @__PURE__ */ Z(cf, {
18751
- icon: f?.display.icon ? /* @__PURE__ */ Z(R, {
18752
- name: f.display.icon,
18749
+ icon: p?.display.icon ? /* @__PURE__ */ Z(R, {
18750
+ name: p.display.icon,
18753
18751
  size: 16
18754
18752
  }) : void 0,
18755
18753
  title: e,
18756
- recordId: n,
18757
- highlights: b,
18758
- mode: i ? "create" : r ? "edit" : "display",
18759
- dirty: s,
18760
- showBack: !a && y,
18761
- onBack: x,
18762
- right: ee
18754
+ recordId: r,
18755
+ highlights: x,
18756
+ mode: a ? "create" : i ? "edit" : "display",
18757
+ dirty: c,
18758
+ showBack: !o && b,
18759
+ onBack: S,
18760
+ right: te
18763
18761
  });
18764
18762
  }
18765
18763
  //#endregion
@@ -18770,13 +18768,11 @@ async function bf(e, t, n, r, i) {
18770
18768
  status_code: r
18771
18769
  };
18772
18770
  i != null && (a.note = i);
18773
- let o = (await dt(`/api/data/${e}`, {
18774
- method: "PATCH",
18775
- body: JSON.stringify([{
18776
- id: t,
18777
- $statuses: [a]
18778
- }])
18779
- }))[0]?.$statuses ?? [];
18771
+ let o = (await M(`${e}.__update`, {
18772
+ object_ids: [t],
18773
+ entity: e,
18774
+ fields: { $statuses: [a] }
18775
+ })).result?.rows?.[0]?.$statuses ?? [];
18780
18776
  return o.find((e) => e.group_code === n) ?? o[0];
18781
18777
  }
18782
18778
  //#endregion
@@ -18796,28 +18792,24 @@ function xf(e, t) {
18796
18792
  //#endregion
18797
18793
  //#region src/api/properties.ts
18798
18794
  async function Sf(e, t, n, r) {
18799
- let i = (await dt(`/api/data/${e}`, {
18800
- method: "PATCH",
18801
- body: JSON.stringify([{
18802
- id: t,
18803
- $properties: [{
18804
- property_code: n,
18805
- value: r
18806
- }]
18807
- }])
18808
- }))[0]?.$properties ?? [];
18795
+ let i = (await M(`${e}.__update`, {
18796
+ object_ids: [t],
18797
+ entity: e,
18798
+ fields: { $properties: [{
18799
+ property_code: n,
18800
+ value: r
18801
+ }] }
18802
+ })).result?.rows?.[0]?.$properties ?? [];
18809
18803
  return i.find((e) => e.property_code === n) ?? i[0];
18810
18804
  }
18811
18805
  async function Cf(e, t, n) {
18812
- await dt(`/api/data/${e}`, {
18813
- method: "PATCH",
18814
- body: JSON.stringify([{
18815
- id: t,
18816
- $properties: [{
18817
- property_code: n,
18818
- value: null
18819
- }]
18820
- }])
18806
+ await M(`${e}.__update`, {
18807
+ object_ids: [t],
18808
+ entity: e,
18809
+ fields: { $properties: [{
18810
+ property_code: n,
18811
+ value: null
18812
+ }] }
18821
18813
  });
18822
18814
  }
18823
18815
  //#endregion
@@ -19306,19 +19298,19 @@ function kf({ entityCode: e, recordId: n, items: r, schema: i, entity: a }) {
19306
19298
  alignItems: "center",
19307
19299
  gap: 6
19308
19300
  },
19309
- children: o && (d ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(F, {
19301
+ children: o && (d ? /* @__PURE__ */ Q(X, { children: [/* @__PURE__ */ Z(P, {
19310
19302
  size: "xs",
19311
19303
  icon: /* @__PURE__ */ Z(t.x, { size: 12 }),
19312
19304
  onClick: S,
19313
19305
  children: "Cancel"
19314
- }), /* @__PURE__ */ Z(F, {
19306
+ }), /* @__PURE__ */ Z(P, {
19315
19307
  kind: "primary",
19316
19308
  size: "xs",
19317
19309
  icon: l.isPending ? /* @__PURE__ */ Z(T, { size: 12 }) : /* @__PURE__ */ Z(t.save, { size: 12 }),
19318
19310
  onClick: C,
19319
19311
  disabled: l.isPending,
19320
19312
  children: l.isPending ? "Saving…" : "Save"
19321
- })] }) : /* @__PURE__ */ Z(F, {
19313
+ })] }) : /* @__PURE__ */ Z(P, {
19322
19314
  size: "xs",
19323
19315
  icon: /* @__PURE__ */ Z(t.edit, { size: 12 }),
19324
19316
  onClick: x,
@@ -19410,7 +19402,7 @@ var Af = class extends It {
19410
19402
  },
19411
19403
  children: this.state.error?.message || "An unexpected error occurred."
19412
19404
  }),
19413
- /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(F, {
19405
+ /* @__PURE__ */ Z("div", { children: /* @__PURE__ */ Z(P, {
19414
19406
  onClick: this.handleRetry,
19415
19407
  children: "Try again"
19416
19408
  }) })
@@ -19480,7 +19472,7 @@ var Mf = [
19480
19472
  () => import("./MarkdownRenderer-Dvo_0Zcx.js"),
19481
19473
  () => import("./JsonEditor-KelPV-OQ.js"),
19482
19474
  () => import("./Grid-BEEwkvX8.js"),
19483
- () => import("./DraggableChildrenTable-B4JD8tAe.js")
19475
+ () => import("./DraggableChildrenTable-8WlRET2T.js")
19484
19476
  ];
19485
19477
  function Nf() {
19486
19478
  for (let e of Mf) e().catch(() => {});
@@ -19750,10 +19742,18 @@ var Zf = class {
19750
19742
  return (await this.createMany([e]))[0];
19751
19743
  }
19752
19744
  async createMany(e) {
19753
- return (await dt(`/api/data/${this.entity}`, {
19754
- method: "POST",
19755
- body: JSON.stringify(e)
19756
- })).map((e) => Jf(e));
19745
+ if (e.length === 0) return [];
19746
+ let t = await Ct("system.batch", {
19747
+ actions: e.map((e) => ({
19748
+ action: `${this.entity}.__create`,
19749
+ params: {
19750
+ entity: this.entity,
19751
+ fields: e
19752
+ }
19753
+ })),
19754
+ atomic: !0
19755
+ });
19756
+ return Qf(t, `${this.entity}.__create`), t.results.map((e) => Jf($f(e)));
19757
19757
  }
19758
19758
  async update(e, t) {
19759
19759
  return (await this.updateMany([{
@@ -19762,45 +19762,81 @@ var Zf = class {
19762
19762
  }]))[0];
19763
19763
  }
19764
19764
  async updateMany(e) {
19765
- return ((await O(`${this.entity}.__update`, { items: e })).result ?? { rows: [] }).rows.map((e) => Jf(e));
19765
+ if (e.length === 0) return [];
19766
+ let t = await Ct("system.batch", {
19767
+ actions: e.map(({ id: e, ...t }) => ({
19768
+ action: `${this.entity}.__update`,
19769
+ params: {
19770
+ object_ids: [e],
19771
+ entity: this.entity,
19772
+ fields: t
19773
+ }
19774
+ })),
19775
+ atomic: !0
19776
+ });
19777
+ return Qf(t, `${this.entity}.__update`), t.results.map((e) => Jf($f(e)));
19766
19778
  }
19767
19779
  async delete(e) {
19768
19780
  await this.deleteMany([e]);
19769
19781
  }
19770
19782
  async deleteMany(e) {
19771
- return { count: (await O(`${this.entity}.__delete`, Me(void 0, e))).object_count ?? e.length };
19783
+ return e.length === 0 ? { count: 0 } : { count: (await M(`${this.entity}.__delete`, {
19784
+ object_ids: e,
19785
+ entity: this.entity
19786
+ })).object_count ?? e.length };
19772
19787
  }
19773
19788
  async restore(e) {
19774
19789
  await this.restoreMany([e]);
19775
19790
  }
19776
19791
  async restoreMany(e) {
19777
- return { count: (await dt(`/api/data/${this.entity}/restore`, {
19778
- method: "POST",
19779
- body: JSON.stringify(e.map((e) => ({ id: e })))
19780
- })).count ?? e.length };
19792
+ return e.length === 0 ? { count: 0 } : { count: (await M(`${this.entity}.__restore`, {
19793
+ object_ids: e,
19794
+ entity: this.entity
19795
+ })).object_count ?? e.length };
19781
19796
  }
19782
19797
  async upsert(e, t) {
19783
19798
  return (await this.upsertMany([e], t))[0];
19784
19799
  }
19785
19800
  async upsertMany(e, t) {
19786
- let n = encodeURIComponent(t.join(","));
19787
- return (await dt(`/api/data/${this.entity}?unique_fields=${n}`, {
19788
- method: "POST",
19789
- body: JSON.stringify(e)
19790
- })).map((e) => Jf(e));
19801
+ if (e.length === 0) return [];
19802
+ let n = await Ct("system.batch", {
19803
+ actions: e.map((e) => ({
19804
+ action: `${this.entity}.__upsert`,
19805
+ params: {
19806
+ entity: this.entity,
19807
+ fields: e,
19808
+ unique_by: t
19809
+ }
19810
+ })),
19811
+ atomic: !0
19812
+ });
19813
+ return Qf(n, `${this.entity}.__upsert`), n.results.map((e) => Jf(ep(e)));
19791
19814
  }
19792
19815
  };
19793
19816
  function Qf(e, t) {
19817
+ if (e.committed) return;
19818
+ let n = e.results.find((e) => !e.ok), r = n ? `${n.error_code ?? "ERROR"}: ${n.error ?? "unknown"}` : "batch did not commit";
19819
+ throw Error(`${t} batch failed: ${r}`);
19820
+ }
19821
+ function $f(e) {
19822
+ let t = e.result ?? {};
19823
+ return (Array.isArray(t.rows) ? t.rows[0] : void 0) ?? {};
19824
+ }
19825
+ function ep(e) {
19826
+ let t = e.result ?? {};
19827
+ return (Array.isArray(t.rows) ? t.rows[0] : void 0)?.row ?? {};
19828
+ }
19829
+ function tp(e, t) {
19794
19830
  return new Zf(e, t);
19795
19831
  }
19796
19832
  //#endregion
19797
19833
  //#region src/api/batch.ts
19798
- var $f = class {
19834
+ var np = class {
19799
19835
  ops = [];
19800
19836
  call(e, t) {
19801
19837
  return this.ops.push({
19802
19838
  action: e,
19803
- params: ep(t)
19839
+ params: rp(t)
19804
19840
  }), this;
19805
19841
  }
19806
19842
  upsert(e, t, n = "upsert", r = []) {
@@ -19822,13 +19858,13 @@ var $f = class {
19822
19858
  return this.ops;
19823
19859
  }
19824
19860
  };
19825
- function ep(e) {
19861
+ function rp(e) {
19826
19862
  return e == null ? null : typeof e == "object" && !Array.isArray(e) ? e : { value: e };
19827
19863
  }
19828
19864
  //#endregion
19829
19865
  //#region src/hooks/useAllEntityData.ts
19830
- var tp = 1e3, np = 20;
19831
- function rp(e, t = {}) {
19866
+ var ip = 1e3, ap = 20;
19867
+ function op(e, t = {}) {
19832
19868
  return ln({
19833
19869
  queryKey: [
19834
19870
  "entity-data-all",
@@ -19839,15 +19875,15 @@ function rp(e, t = {}) {
19839
19875
  queryFn: async ({ signal: n }) => {
19840
19876
  let r = {
19841
19877
  ...t,
19842
- per_page: tp,
19878
+ per_page: ip,
19843
19879
  count: "with"
19844
- }, i = await v(e, {
19880
+ }, i = await w(e, {
19845
19881
  ...r,
19846
19882
  page: 1
19847
19883
  }, { signal: n }), a = i.meta.total_pages ?? 1;
19848
19884
  if (a <= 1) return i;
19849
- if (a > np) throw Error(`useAllEntityData: entity "${e}" spans ${a} pages (limit ${np}); it is not a bounded entity. Use useEntityData with server-side pagination instead.`);
19850
- let o = await Promise.all(Array.from({ length: a - 1 }, (t, i) => v(e, {
19885
+ if (a > ap) throw Error(`useAllEntityData: entity "${e}" spans ${a} pages (limit ${ap}); it is not a bounded entity. Use useEntityData with server-side pagination instead.`);
19886
+ let o = await Promise.all(Array.from({ length: a - 1 }, (t, i) => w(e, {
19851
19887
  ...r,
19852
19888
  page: i + 2
19853
19889
  }, { signal: n }))), s = new Yf();
@@ -19869,7 +19905,7 @@ function rp(e, t = {}) {
19869
19905
  }
19870
19906
  //#endregion
19871
19907
  //#region src/hooks/useColumns.ts
19872
- function ip(e, t) {
19908
+ function sp(e, t) {
19873
19909
  let [n, r] = rn(), i = q(() => {
19874
19910
  let r = n.get("columns");
19875
19911
  return r ? r.split(",").filter(Boolean).filter((t) => e.includes(t)) : t.length > 0 ? t : e;
@@ -19879,7 +19915,7 @@ function ip(e, t) {
19879
19915
  t
19880
19916
  ]), a = G((e) => {
19881
19917
  let i = new URLSearchParams(n);
19882
- e.length === 0 || ap(e, t) ? i.delete("columns") : i.set("columns", e.join(",")), r(i);
19918
+ e.length === 0 || cp(e, t) ? i.delete("columns") : i.set("columns", e.join(",")), r(i);
19883
19919
  }, [
19884
19920
  n,
19885
19921
  r,
@@ -19905,12 +19941,12 @@ function ip(e, t) {
19905
19941
  }, [i, a])
19906
19942
  };
19907
19943
  }
19908
- function ap(e, t) {
19944
+ function cp(e, t) {
19909
19945
  return e.length === t.length ? e.every((e, n) => e === t[n]) : !1;
19910
19946
  }
19911
19947
  //#endregion
19912
19948
  //#region src/components/shared/PageHeader.tsx
19913
- function op({ title: e, backTo: n, actions: r }) {
19949
+ function lp({ title: e, backTo: n, actions: r }) {
19914
19950
  let i = $t(), { switchTab: a, findTabByPathname: o } = In();
19915
19951
  function s() {
19916
19952
  if (!n) return;
@@ -19961,7 +19997,7 @@ function op({ title: e, backTo: n, actions: r }) {
19961
19997
  }
19962
19998
  //#endregion
19963
19999
  //#region src/components/list/BulkBar.tsx
19964
- function sp({ count: e, actions: n, onClear: r, onDelete: i, onExport: a }) {
20000
+ function up({ count: e, actions: n, onClear: r, onDelete: i, onExport: a }) {
19965
20001
  let [o, s] = Y(!1), c = J(null), l = n.filter((e) => e.primary), u = n.filter((e) => !e.primary);
19966
20002
  return /* @__PURE__ */ Q("div", {
19967
20003
  style: {
@@ -20027,7 +20063,7 @@ function sp({ count: e, actions: n, onClear: r, onDelete: i, onExport: a }) {
20027
20063
  background: "var(--inverted-overlay)",
20028
20064
  margin: "0 4px"
20029
20065
  } }),
20030
- l.map((e) => /* @__PURE__ */ Z(cp, {
20066
+ l.map((e) => /* @__PURE__ */ Z(dp, {
20031
20067
  icon: e.icon,
20032
20068
  label: e.label,
20033
20069
  onClick: e.onRun
@@ -20091,7 +20127,7 @@ function sp({ count: e, actions: n, onClear: r, onDelete: i, onExport: a }) {
20091
20127
  ]
20092
20128
  });
20093
20129
  }
20094
- function cp({ icon: e, label: t, onClick: n }) {
20130
+ function dp({ icon: e, label: t, onClick: n }) {
20095
20131
  return /* @__PURE__ */ Q("button", {
20096
20132
  onClick: n,
20097
20133
  style: {
@@ -20115,7 +20151,7 @@ function cp({ icon: e, label: t, onClick: n }) {
20115
20151
  }
20116
20152
  //#endregion
20117
20153
  //#region src/components/list/RowMenu.tsx
20118
- function lp({ x: e, y: n, onClose: r, onPeek: i, onOpen: a, onEditInline: o, onDuplicate: s, onCopyLink: c, onDelete: l, actions: u }) {
20154
+ function fp({ x: e, y: n, onClose: r, onPeek: i, onOpen: a, onEditInline: o, onDuplicate: s, onCopyLink: c, onDelete: l, actions: u }) {
20119
20155
  let d = (e) => () => {
20120
20156
  r(), e && e();
20121
20157
  }, f = i || a || o || s || c, p = u && u.length > 0;
@@ -20193,23 +20229,23 @@ function lp({ x: e, y: n, onClose: r, onPeek: i, onOpen: a, onEditInline: o, onD
20193
20229
  }
20194
20230
  //#endregion
20195
20231
  //#region src/components/list/resolveActions.ts
20196
- var up = "list_toolbar", dp = "list_floatbar";
20197
- function fp(e) {
20232
+ var pp = "list_toolbar", mp = "list_floatbar";
20233
+ function hp(e) {
20198
20234
  return !1;
20199
20235
  }
20200
- function pp(e) {
20236
+ function gp(e) {
20201
20237
  let { actions: t, screen: n, selectionCount: r } = e, i = e.hasPermission ?? (() => !0), a = e.maxPrimary ?? 2, o = [];
20202
20238
  for (let [e, n] of Object.entries(t)) (n.visibility ?? []).includes("list_toolbar") && i(e) && o.push({
20203
20239
  code: e,
20204
20240
  action: n
20205
20241
  });
20206
- let s = new Map(o.map((e) => [e.code, e])), c = o.filter((e) => !fp(e.action)), l, u = n?.primary_actions;
20242
+ let s = new Map(o.map((e) => [e.code, e])), c = o.filter((e) => !hp(e.action)), l, u = n?.primary_actions;
20207
20243
  if (u && u.length > 0) {
20208
20244
  let e = new Set(c.map((e) => e.code));
20209
20245
  l = u.filter((t) => s.has(t) && e.has(t)).slice(0, a).map((e) => s.get(e));
20210
20246
  } else l = c.filter((e) => (e.action.position ?? 0) <= 10).slice(0, a);
20211
20247
  let d = [], f = [];
20212
- for (let e of o) fp(e.action) ? f.push(e) : d.push(e);
20248
+ for (let e of o) hp(e.action) ? f.push(e) : d.push(e);
20213
20249
  return {
20214
20250
  primary: l,
20215
20251
  global: d,
@@ -20217,7 +20253,7 @@ function pp(e) {
20217
20253
  selectionCount: r
20218
20254
  };
20219
20255
  }
20220
- function mp(e) {
20256
+ function _p(e) {
20221
20257
  let { actions: t, screen: n } = e, r = e.hasPermission ?? (() => !0), i = e.maxPrimary ?? 2, a = [];
20222
20258
  for (let [e, n] of Object.entries(t)) (n.visibility ?? []).includes("list_floatbar") && r(e) && a.push({
20223
20259
  code: e,
@@ -20231,7 +20267,7 @@ function mp(e) {
20231
20267
  }
20232
20268
  //#endregion
20233
20269
  //#region src/components/list/ListPage.tsx
20234
- function hp(e, n = 12) {
20270
+ function vp(e, n = 12) {
20235
20271
  let r = e.display?.icon;
20236
20272
  if (!r) return null;
20237
20273
  let i = t[r];
@@ -20240,8 +20276,8 @@ function hp(e, n = 12) {
20240
20276
  size: n
20241
20277
  });
20242
20278
  }
20243
- function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clearSelection: o, onNewRecord: s, screen: c, actions: l, hasPermission: u, executeAction: d, children: f, onBulkDelete: p, onBulkExport: m, onToolbarExport: h, onManageActions: g }) {
20244
- let _ = J(null), [v, y] = Y(!1), { run: b } = to(), x = q(() => pp({
20279
+ function yp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clearSelection: o, onNewRecord: s, screen: c, actions: l, hasPermission: u, executeAction: d, children: f, onBulkDelete: p, onBulkExport: m, onToolbarExport: h, onManageActions: g }) {
20280
+ let _ = J(null), [v, y] = Y(!1), { run: b } = to(), x = q(() => gp({
20245
20281
  actions: l,
20246
20282
  screen: c,
20247
20283
  selectionCount: a,
@@ -20251,7 +20287,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20251
20287
  c,
20252
20288
  a,
20253
20289
  u
20254
- ]), S = q(() => mp({
20290
+ ]), S = q(() => _p({
20255
20291
  actions: l,
20256
20292
  screen: c,
20257
20293
  selectionCount: a,
@@ -20272,7 +20308,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20272
20308
  }, T = q(() => S.entries.map(({ code: e, action: t }) => ({
20273
20309
  id: e,
20274
20310
  label: U(t.display?.name) || e,
20275
- icon: hp(t),
20311
+ icon: vp(t),
20276
20312
  primary: S.primaryCodes.has(e),
20277
20313
  destructive: t.destructive,
20278
20314
  onRun: () => w({
@@ -20327,15 +20363,15 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20327
20363
  })]
20328
20364
  })
20329
20365
  }),
20330
- x.primary.map((e) => /* @__PURE__ */ Z(F, {
20366
+ x.primary.map((e) => /* @__PURE__ */ Z(P, {
20331
20367
  kind: "default",
20332
- icon: hp(e.action, 13),
20368
+ icon: vp(e.action, 13),
20333
20369
  onClick: () => w(e, !1),
20334
20370
  children: U(e.action.display?.name) || e.code
20335
20371
  }, e.code)),
20336
20372
  /* @__PURE__ */ Q("div", {
20337
20373
  style: { position: "relative" },
20338
- children: [/* @__PURE__ */ Z(F, {
20374
+ children: [/* @__PURE__ */ Z(P, {
20339
20375
  ref: _,
20340
20376
  kind: "default",
20341
20377
  icon: /* @__PURE__ */ Z(t.bolt, { size: 13 }),
@@ -20352,9 +20388,9 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20352
20388
  width: 240,
20353
20389
  align: "end",
20354
20390
  children: [
20355
- x.global.length > 0 && /* @__PURE__ */ Z(_p, { children: "Global" }),
20391
+ x.global.length > 0 && /* @__PURE__ */ Z(bp, { children: "Global" }),
20356
20392
  x.global.map((e) => /* @__PURE__ */ Z(W, {
20357
- icon: hp(e.action),
20393
+ icon: vp(e.action),
20358
20394
  danger: e.action.destructive,
20359
20395
  onClick: () => {
20360
20396
  y(!1), w(e, !1);
@@ -20394,7 +20430,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20394
20430
  pointerEvents: a === 0 ? "none" : "auto"
20395
20431
  },
20396
20432
  children: /* @__PURE__ */ Z(W, {
20397
- icon: hp(e.action),
20433
+ icon: vp(e.action),
20398
20434
  danger: e.action.destructive,
20399
20435
  onClick: () => {
20400
20436
  y(!1), w(e, !0);
@@ -20429,7 +20465,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20429
20465
  background: "var(--divider)",
20430
20466
  margin: "0 2px"
20431
20467
  } }),
20432
- /* @__PURE__ */ Q(F, {
20468
+ /* @__PURE__ */ Q(P, {
20433
20469
  kind: "primary",
20434
20470
  icon: /* @__PURE__ */ Z(t.plus, { size: 13 }),
20435
20471
  onClick: s,
@@ -20438,7 +20474,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20438
20474
  ]
20439
20475
  }),
20440
20476
  f,
20441
- a > 0 && /* @__PURE__ */ Z(sp, {
20477
+ a > 0 && /* @__PURE__ */ Z(up, {
20442
20478
  count: a,
20443
20479
  actions: T,
20444
20480
  onClear: o,
@@ -20448,7 +20484,7 @@ function gp({ title: e, singular: n, total: r, shown: i, selectionCount: a, clea
20448
20484
  ]
20449
20485
  });
20450
20486
  }
20451
- function _p({ children: e }) {
20487
+ function bp({ children: e }) {
20452
20488
  return /* @__PURE__ */ Z("div", {
20453
20489
  style: {
20454
20490
  padding: "6px 8px 4px",
@@ -20463,7 +20499,7 @@ function _p({ children: e }) {
20463
20499
  }
20464
20500
  //#endregion
20465
20501
  //#region src/components/list/InlineEditCell.tsx
20466
- var vp = {
20502
+ var xp = {
20467
20503
  padding: "4px 6px",
20468
20504
  margin: "-4px -6px",
20469
20505
  borderRadius: 4,
@@ -20474,7 +20510,7 @@ var vp = {
20474
20510
  alignItems: "center",
20475
20511
  gap: 4
20476
20512
  };
20477
- function yp({ value: e, onSave: n, type: r = "text", options: i, trigger: o = "always", label: s, placeholder: c }) {
20513
+ function Sp({ value: e, onSave: n, type: r = "text", options: i, trigger: o = "always", label: s, placeholder: c }) {
20478
20514
  let [l, u] = Y(e), [d, f] = Y(e), [p, m] = Y(!1), [h, g] = Y(e), _ = J(null);
20479
20515
  K(() => {
20480
20516
  u(e), f(e), g(e);
@@ -20546,7 +20582,7 @@ function yp({ value: e, onSave: n, type: r = "text", options: i, trigger: o = "a
20546
20582
  onMouseLeave: (e) => {
20547
20583
  e.currentTarget.style.borderColor = "transparent";
20548
20584
  },
20549
- style: vp,
20585
+ style: xp,
20550
20586
  children: d ?? /* @__PURE__ */ Z("span", {
20551
20587
  style: { color: "var(--text-4)" },
20552
20588
  children: "Click to edit"
@@ -20555,7 +20591,7 @@ function yp({ value: e, onSave: n, type: r = "text", options: i, trigger: o = "a
20555
20591
  }
20556
20592
  //#endregion
20557
20593
  //#region src/components/pages/home/HomeStub.tsx
20558
- var bp = [
20594
+ var Cp = [
20559
20595
  {
20560
20596
  id: "a1",
20561
20597
  title: "James Gallagher moved to Discovery",
@@ -20571,7 +20607,7 @@ var bp = [
20571
20607
  title: "Refill enrichment job completed (32 leads)",
20572
20608
  when: "10:00 AM"
20573
20609
  }
20574
- ], xp = [
20610
+ ], wp = [
20575
20611
  {
20576
20612
  label: "Open leads",
20577
20613
  val: "127",
@@ -20596,7 +20632,7 @@ var bp = [
20596
20632
  delta: "2 failed",
20597
20633
  tone: "amber"
20598
20634
  }
20599
- ], Sp = [
20635
+ ], Tp = [
20600
20636
  [
20601
20637
  "leads",
20602
20638
  "Leads",
@@ -20628,7 +20664,7 @@ var bp = [
20628
20664
  "entity"
20629
20665
  ]
20630
20666
  ];
20631
- function Cp({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLabel: r = "Acme · production" }) {
20667
+ function Ep({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLabel: r = "Acme · production" }) {
20632
20668
  return /* @__PURE__ */ Z("div", {
20633
20669
  style: {
20634
20670
  padding: "22px 24px",
@@ -20672,7 +20708,7 @@ function Cp({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLa
20672
20708
  gap: 10,
20673
20709
  margin: "16px 0"
20674
20710
  },
20675
- children: xp.map((e) => /* @__PURE__ */ Q("div", {
20711
+ children: wp.map((e) => /* @__PURE__ */ Q("div", {
20676
20712
  style: {
20677
20713
  padding: 14,
20678
20714
  background: "var(--surface)",
@@ -20720,7 +20756,7 @@ function Cp({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLa
20720
20756
  gridTemplateColumns: "repeat(3,1fr)",
20721
20757
  gap: 8
20722
20758
  },
20723
- children: Sp.map(([n, r, i]) => {
20759
+ children: Tp.map(([n, r, i]) => {
20724
20760
  let a = t[i];
20725
20761
  return /* @__PURE__ */ Q("button", {
20726
20762
  onClick: () => e?.(n),
@@ -20765,7 +20801,7 @@ function Cp({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLa
20765
20801
  flexDirection: "column",
20766
20802
  gap: 8
20767
20803
  },
20768
- children: bp.slice(0, 3).map((e) => /* @__PURE__ */ Q("div", {
20804
+ children: Cp.slice(0, 3).map((e) => /* @__PURE__ */ Q("div", {
20769
20805
  style: {
20770
20806
  fontSize: 12,
20771
20807
  color: "var(--text-2)"
@@ -20794,19 +20830,19 @@ function Cp({ onOpenNav: e, greeting: n = "Good afternoon, Konstantin", tenantLa
20794
20830
  }
20795
20831
  //#endregion
20796
20832
  //#region src/components/pages/pipeline/Pipeline.tsx
20797
- var wp = {
20833
+ var Dp = {
20798
20834
  "1-New": { color: "slate" },
20799
20835
  "2-Contacted": { color: "sky" },
20800
20836
  "3-Qualified": { color: "violet" },
20801
20837
  "4-Proposal": { color: "amber" },
20802
20838
  "5-Won": { color: "emerald" },
20803
20839
  "6-Lost": { color: "rose" }
20804
- }, Tp = {
20840
+ }, Op = {
20805
20841
  P0: "rose",
20806
20842
  P1: "amber",
20807
20843
  P2: "sky",
20808
20844
  P3: "slate"
20809
- }, Ep = [
20845
+ }, kp = [
20810
20846
  {
20811
20847
  id: "l1",
20812
20848
  contact: "James Gallagher",
@@ -20872,11 +20908,11 @@ var wp = {
20872
20908
  score: 58
20873
20909
  }
20874
20910
  ];
20875
- function Dp() {
20876
- let e = Object.entries(wp).map(([e, t]) => ({
20911
+ function Ap() {
20912
+ let e = Object.entries(Dp).map(([e, t]) => ({
20877
20913
  key: e,
20878
20914
  color: t.color,
20879
- leads: Ep.filter((t) => t.pipeline === e)
20915
+ leads: kp.filter((t) => t.pipeline === e)
20880
20916
  }));
20881
20917
  return /* @__PURE__ */ Q("div", {
20882
20918
  style: {
@@ -20907,7 +20943,7 @@ function Dp() {
20907
20943
  fontSize: 12,
20908
20944
  color: "var(--text-3)"
20909
20945
  },
20910
- children: [Ep.length, " leads · $2.4M pipeline"]
20946
+ children: [kp.length, " leads · $2.4M pipeline"]
20911
20947
  })]
20912
20948
  }), /* @__PURE__ */ Z("div", {
20913
20949
  style: {
@@ -20993,7 +21029,7 @@ function Dp() {
20993
21029
  flexWrap: "wrap"
20994
21030
  },
20995
21031
  children: [e.priority && e.priority !== "-" && /* @__PURE__ */ Z(z, {
20996
- tone: Tp[e.priority] ?? "slate",
21032
+ tone: Op[e.priority] ?? "slate",
20997
21033
  size: "xs",
20998
21034
  dot: !0,
20999
21035
  children: e.priority
@@ -21012,7 +21048,7 @@ function Dp() {
21012
21048
  }
21013
21049
  //#endregion
21014
21050
  //#region src/components/pages/jobs/Jobs.tsx
21015
- var Op = [
21051
+ var jp = [
21016
21052
  {
21017
21053
  id: "job_91a4",
21018
21054
  name: "reparse_leads_with_llm",
@@ -21056,12 +21092,12 @@ var Op = [
21056
21092
  worker: "wk-us-01",
21057
21093
  took: "2m 02s"
21058
21094
  }
21059
- ], kp = {
21095
+ ], Mp = {
21060
21096
  running: "sky",
21061
21097
  success: "emerald",
21062
21098
  queued: "slate",
21063
21099
  failed: "rose"
21064
- }, Ap = [
21100
+ }, Np = [
21065
21101
  "ID",
21066
21102
  "Name",
21067
21103
  "Status",
@@ -21071,7 +21107,7 @@ var Op = [
21071
21107
  "Worker",
21072
21108
  ""
21073
21109
  ];
21074
- function jp() {
21110
+ function Pp() {
21075
21111
  return /* @__PURE__ */ Q("div", {
21076
21112
  style: {
21077
21113
  padding: "14px 20px",
@@ -21120,7 +21156,7 @@ function jp() {
21120
21156
  background: "var(--surface-2)",
21121
21157
  color: "var(--text-3)"
21122
21158
  },
21123
- children: Ap.map((e, t) => /* @__PURE__ */ Z("th", {
21159
+ children: Np.map((e, t) => /* @__PURE__ */ Z("th", {
21124
21160
  style: {
21125
21161
  padding: "0 10px",
21126
21162
  textAlign: "left",
@@ -21132,7 +21168,7 @@ function jp() {
21132
21168
  },
21133
21169
  children: e
21134
21170
  }, e || `_h${t}`))
21135
- }) }), /* @__PURE__ */ Z("tbody", { children: Op.map((e) => /* @__PURE__ */ Q("tr", {
21171
+ }) }), /* @__PURE__ */ Z("tbody", { children: jp.map((e) => /* @__PURE__ */ Q("tr", {
21136
21172
  style: { height: 32 },
21137
21173
  children: [
21138
21174
  /* @__PURE__ */ Z("td", {
@@ -21164,7 +21200,7 @@ function jp() {
21164
21200
  borderBottom: "1px solid var(--divider)"
21165
21201
  },
21166
21202
  children: /* @__PURE__ */ Z(z, {
21167
- tone: kp[e.status],
21203
+ tone: Mp[e.status],
21168
21204
  size: "xs",
21169
21205
  dot: !0,
21170
21206
  children: e.status
@@ -21194,7 +21230,7 @@ function jp() {
21194
21230
  display: "block",
21195
21231
  height: "100%",
21196
21232
  width: `${e.progress}%`,
21197
- background: `var(--pill-${kp[e.status]})`
21233
+ background: `var(--pill-${Mp[e.status]})`
21198
21234
  } })
21199
21235
  }), /* @__PURE__ */ Q("span", {
21200
21236
  className: "mono num",
@@ -21249,7 +21285,7 @@ function jp() {
21249
21285
  }
21250
21286
  //#endregion
21251
21287
  //#region src/components/layout/ImpersonationStartModal.tsx
21252
- function Mp({ open: e, targetUserId: t, targetUserLabel: n, onClose: r, onStarted: i }) {
21288
+ function Fp({ open: e, targetUserId: t, targetUserLabel: n, onClose: r, onStarted: i }) {
21253
21289
  let { start: a, isStarting: o } = Lr(), { value: s } = ii("impersonation.require_reason_min_length", 10), [c, l] = Y(""), [u, d] = Y("");
21254
21290
  if (!e) return null;
21255
21291
  let f = c.trim(), p = f.length >= s;
@@ -21409,7 +21445,7 @@ function Mp({ open: e, targetUserId: t, targetUserLabel: n, onClose: r, onStarte
21409
21445
  }
21410
21446
  //#endregion
21411
21447
  //#region src/components/agents/AgentVisualHints.tsx
21412
- function Np({ turn: e, navigate: t }) {
21448
+ function Ip({ turn: e, navigate: t }) {
21413
21449
  return K(() => {
21414
21450
  for (let n of e.hints) switch (n.kind) {
21415
21451
  case "navigate":
@@ -21448,7 +21484,7 @@ function Np({ turn: e, navigate: t }) {
21448
21484
  }
21449
21485
  //#endregion
21450
21486
  //#region src/components/agents/AgentConversationDrawer.tsx
21451
- function Pp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, onNew: o, onRefresh: s }) {
21487
+ function Lp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, onNew: o, onRefresh: s }) {
21452
21488
  return K(() => {
21453
21489
  e && s();
21454
21490
  }, [e, s]), e ? /* @__PURE__ */ Q("aside", {
@@ -21459,7 +21495,7 @@ function Pp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, o
21459
21495
  children: [/* @__PURE__ */ Z("span", {
21460
21496
  className: "font-semibold",
21461
21497
  children: "Conversations"
21462
- }), /* @__PURE__ */ Q(F, {
21498
+ }), /* @__PURE__ */ Q(P, {
21463
21499
  kind: "ghost",
21464
21500
  onClick: o,
21465
21501
  children: [/* @__PURE__ */ Z(t.plus, {}), " New"]
@@ -21475,7 +21511,7 @@ function Pp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, o
21475
21511
  className: `block w-full px-4 py-3 text-left border-b border-divider hover:bg-surface ${e.id === i ? "bg-surface" : ""}`,
21476
21512
  children: [/* @__PURE__ */ Z("div", {
21477
21513
  className: "text-sm font-medium truncate",
21478
- children: e.title || e.context ? Fp(e.context) : "Untitled"
21514
+ children: e.title || e.context ? Rp(e.context) : "Untitled"
21479
21515
  }), /* @__PURE__ */ Q("div", {
21480
21516
  className: "text-xs text-muted-foreground",
21481
21517
  children: [
@@ -21489,7 +21525,7 @@ function Pp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, o
21489
21525
  }),
21490
21526
  /* @__PURE__ */ Z("footer", {
21491
21527
  className: "border-t border-border p-2",
21492
- children: /* @__PURE__ */ Z(F, {
21528
+ children: /* @__PURE__ */ Z(P, {
21493
21529
  kind: "ghost",
21494
21530
  onClick: n,
21495
21531
  children: "Close"
@@ -21498,12 +21534,12 @@ function Pp({ open: e, onClose: n, conversations: r, activeId: i, onSelect: a, o
21498
21534
  ]
21499
21535
  }) : null;
21500
21536
  }
21501
- function Fp(e) {
21537
+ function Rp(e) {
21502
21538
  if (!e) return "";
21503
21539
  let t = e.entity ? String(e.entity) : "", n = e.pk ? `:${String(e.pk).slice(0, 6)}` : "";
21504
21540
  return t ? `${t}${n}` : "";
21505
21541
  }
21506
21542
  //#endregion
21507
- export { A as ActionBatchError, ro as ActionRunnerProvider, Qi as AgentChatPanel, Pp as AgentConversationDrawer, Gi as AgentElicitForm, Np as AgentVisualHints, Gf as App, Gf as Declarion, ko as AuthShell, x as Avatar, $f as Batch, a as BoolToggle, Ge as BrandGlyph, Kr as Breadcrumbs, F as Btn, sp as BulkBar, ls as ChangePasswordDialog, L as Check, ce as Chip, Ee as CircleImage, y as ClassifiedFieldLocked, fu as ColumnPicker, ui as CommandPalette, gr as ConfirmDialog, re as DateInput, C as Dropdown, R as DynamicIcon, il as EmptyState, Zf as EntityClient, d as FieldLabel, Ot as FileDraftScope, Ul as FilterChips, Kl as FilterDrawer, Qo as Forgot, Cp as HomeStub, h as HoverCard, t as Icon, B as IconBtn, Qr as ImpersonationBanner, ai as ImpersonationFrame, Mp as ImpersonationStartModal, yp as InlineEditCell, jp as JobsStub, l as JsonField, de as Kbd, Ma as MULTIPLE_VALUES, W as MenuItem, fl as NO_VALUE_OPS, pl as OP_LABELS, op as PageHeader, j as PasswordInput, z as Pill, Dp as PipelineStub, Bc as Preferences, Ac as Profile, Na as PropertyGridEditor, Dl as QEField, Ne as QuickEditCell, El as QuickPeek, Sn as Rail, _ as RecordIdBadge, Yf as RefCache, r as RefField, as as Reset, oe as RowField, lp as RowMenu, ae as SectionCard, je as Select, gp as ShellListPage, yr as Sidebar, qo as SignIn, Xo as SignUp, _f as SmartDetailPage, Au as SmartListPage, Ef as SmartRecordListPage, T as Spinner, Te as SquareImage, Yr as TabStrip, D as TagsInput, Ur as TenantChip, k as TextArea, N as TextInput, Jr as TopBar, os as TwoFA, Dt as UploadError, dp as VISIBILITY_LIST_BULK_BAR, up as VISIBILITY_LIST_TOOLBAR, p as ViewField, mu as ViewSwitcher, Ie as WideBanner, mi as approveInvocation, Me as buildActionBody, Ye as buildDetailHrefFromId, ye as buildEntityDetailHref, Oa as buildMassEditTargets, Fe as buildRowDetailHref, br as buildSections, gi as cancelConversation, ou as classificationTier, vl as countActiveFilters, di as createConversation, Se as cx, Ae as deleteEntity, Ra as detectCommonValue, Nt as discardFile, Qf as entityClient, Hr as envTone, O as executeAction, xe as extractPkValues, cu as fieldAccessInfo, iu as fieldClassification, we as fieldDisplayName, au as fieldRequiredPermission, Ft as formatBytes, Hl as formatCount, Bl as formatEstimatedCount, Vl as formatExactCount, ot as getFileWidget, pe as getImageCropper, Le as getPrimaryKeyFields, ge as hasFileWidget, gl as hasOrGroups, nu as isFieldReadable, su as isFieldSoDProtected, ru as isFieldWritable, _i as listConversations, yi as listPendingInvocations, bi as loadHistory, U as loc, ml as parseFiltersFromURL, Da as parseTargetFilter, me as pkValuePartsToId, tt as pkValuesFromId, st as pkValuesToDetailId, _e as pkValuesToId, it as registerFileWidget, Lf as registerScreen, hi as rejectInvocation, vi as rerunMessageTurn, mp as resolveBulkBarActions, te as resolveDetailRoute, pp as resolveToolbarActions, I as restoreEntity, pi as sendElicitResponse, fi as sendMessage, hl as setFiltersInURL, et as setImageCropper, kt as uploadFile, to as useActionRunner, Wi as useAgentConversation, rp as useAllEntityData, Ir as useAuth, ip as useColumns, ms as useCreateEntity, rl as useDebounce, gs as useDeleteEntity, Tf as useDeleteProperty, jt as useDraftRegistration, ee as useEntity, o as useEntityCount, nt as useEntityData, Mu as useEntityItem, Mt as useFileDraftScope, xl as useFilters, Lr as useImpersonation, Xt as useLocation, Qt as useNavigate, ii as useParam, en as useParams, ni as usePublicParams, ri as useResolvedParam, S as useSchema, hu as useScreen, nn as useSearchParams, wf as useSetProperty, xf as useSetStatus, vr as useTabNavigate, In as useTabStore, hs as useUpdateEntity, gu as useViews, Pt as validateClientSide };
21543
+ export { Me as ActionBatchError, ro as ActionRunnerProvider, Qi as AgentChatPanel, Lp as AgentConversationDrawer, Gi as AgentElicitForm, Ip as AgentVisualHints, Gf as App, Gf as Declarion, ko as AuthShell, x as Avatar, np as Batch, a as BoolToggle, Ge as BrandGlyph, Kr as Breadcrumbs, P as Btn, up as BulkBar, ls as ChangePasswordDialog, I as Check, ce as Chip, Ee as CircleImage, y as ClassifiedFieldLocked, fu as ColumnPicker, ui as CommandPalette, gr as ConfirmDialog, re as DateInput, C as Dropdown, R as DynamicIcon, il as EmptyState, Zf as EntityClient, d as FieldLabel, Ot as FileDraftScope, Ul as FilterChips, Kl as FilterDrawer, Qo as Forgot, Ep as HomeStub, h as HoverCard, t as Icon, B as IconBtn, Qr as ImpersonationBanner, ai as ImpersonationFrame, Fp as ImpersonationStartModal, Sp as InlineEditCell, Pp as JobsStub, l as JsonField, de as Kbd, Ma as MULTIPLE_VALUES, W as MenuItem, fl as NO_VALUE_OPS, pl as OP_LABELS, lp as PageHeader, j as PasswordInput, z as Pill, Ap as PipelineStub, Bc as Preferences, Ac as Profile, Na as PropertyGridEditor, Dl as QEField, Ne as QuickEditCell, El as QuickPeek, Sn as Rail, _ as RecordIdBadge, Yf as RefCache, r as RefField, as as Reset, oe as RowField, fp as RowMenu, ae as SectionCard, je as Select, yp as ShellListPage, yr as Sidebar, qo as SignIn, Xo as SignUp, _f as SmartDetailPage, Au as SmartListPage, Ef as SmartRecordListPage, T as Spinner, Te as SquareImage, Yr as TabStrip, D as TagsInput, Ur as TenantChip, k as TextArea, N as TextInput, Jr as TopBar, os as TwoFA, Dt as UploadError, mp as VISIBILITY_LIST_BULK_BAR, pp as VISIBILITY_LIST_TOOLBAR, p as ViewField, mu as ViewSwitcher, Ie as WideBanner, mi as approveInvocation, n as buildActionBody, Ye as buildDetailHrefFromId, ye as buildEntityDetailHref, Oa as buildMassEditTargets, Fe as buildRowDetailHref, br as buildSections, gi as cancelConversation, ou as classificationTier, vl as countActiveFilters, di as createConversation, Se as cx, E as deleteEntity, Ra as detectCommonValue, Nt as discardFile, tp as entityClient, Hr as envTone, M as executeAction, xe as extractPkValues, cu as fieldAccessInfo, iu as fieldClassification, we as fieldDisplayName, au as fieldRequiredPermission, Ft as formatBytes, Hl as formatCount, Bl as formatEstimatedCount, Vl as formatExactCount, ot as getFileWidget, pe as getImageCropper, Le as getPrimaryKeyFields, ge as hasFileWidget, gl as hasOrGroups, nu as isFieldReadable, su as isFieldSoDProtected, ru as isFieldWritable, _i as listConversations, yi as listPendingInvocations, bi as loadHistory, U as loc, ml as parseFiltersFromURL, Da as parseTargetFilter, me as pkValuePartsToId, tt as pkValuesFromId, st as pkValuesToDetailId, _e as pkValuesToId, it as registerFileWidget, Lf as registerScreen, hi as rejectInvocation, vi as rerunMessageTurn, _p as resolveBulkBarActions, te as resolveDetailRoute, gp as resolveToolbarActions, ct as restoreEntity, pi as sendElicitResponse, fi as sendMessage, hl as setFiltersInURL, et as setImageCropper, kt as uploadFile, to as useActionRunner, Wi as useAgentConversation, op as useAllEntityData, Ir as useAuth, sp as useColumns, ms as useCreateEntity, rl as useDebounce, gs as useDeleteEntity, Tf as useDeleteProperty, jt as useDraftRegistration, L as useEntity, o as useEntityCount, nt as useEntityData, Mu as useEntityItem, Mt as useFileDraftScope, xl as useFilters, Lr as useImpersonation, Xt as useLocation, Qt as useNavigate, ii as useParam, en as useParams, ni as usePublicParams, ri as useResolvedParam, S as useSchema, hu as useScreen, nn as useSearchParams, wf as useSetProperty, xf as useSetStatus, vr as useTabNavigate, In as useTabStore, hs as useUpdateEntity, gu as useViews, Pt as validateClientSide };
21508
21544
 
21509
21545
  //# sourceMappingURL=index.js.map