@standardbeagle/edit-db 0.4.685 → 0.4.688

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/editor.es.js CHANGED
@@ -2,8 +2,8 @@ import * as e from "react";
2
2
  import t, { Children as n, Component as r, createContext as i, forwardRef as a, isValidElement as o, memo as s, useCallback as c, useContext as l, useEffect as u, useMemo as d, useReducer as f, useRef as p, useState as m } from "react";
3
3
  import { QueryClient as h, QueryClientProvider as g, useMutation as _, useQuery as v, useQueryClient as y } from "@tanstack/react-query";
4
4
  import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
5
- import { AlertCircle as C, ArrowDown as w, ArrowUp as T, ArrowUpDown as E, Binary as D, Braces as O, Calendar as k, Check as A, CheckCircle2 as j, CheckIcon as M, ChevronDown as N, ChevronDownIcon as P, ChevronLeft as F, ChevronRight as I, ChevronRightIcon as L, ChevronUp as ee, ChevronUpIcon as te, ChevronsLeft as ne, ChevronsRight as R, Code as z, Columns3 as re, Copy as ie, Database as B, Download as ae, Expand as V, EyeOff as H, FileText as U, Filter as W, FilterX as oe, Hash as se, Home as ce, Key as le, Link2 as ue, List as de, Loader2 as fe, LoaderCircle as pe, Maximize2 as me, Minimize2 as he, MoreVertical as ge, MousePointerClick as _e, PanelLeft as ve, PanelRight as ye, Pencil as be, Plus as xe, RotateCcw as Se, Rows3 as Ce, Save as we, Search as Te, Table2 as Ee, ToggleLeft as De, Trash2 as Oe, Type as ke, Unlink as Ae, WrapText as je, X as Me, XIcon as Ne } from "lucide-react";
6
- import { Checkbox as Pe, Dialog as G, DropdownMenu as Fe, HoverCard as Ie, Label as Le, Select as Re } from "radix-ui";
5
+ import { AlertCircle as C, ArrowDown as w, ArrowUp as T, ArrowUpDown as E, Binary as D, Braces as O, Calendar as k, Check as A, CheckCircle2 as j, CheckIcon as M, ChevronDown as N, ChevronDownIcon as P, ChevronLeft as F, ChevronRight as I, ChevronRightIcon as L, ChevronUp as ee, ChevronUpIcon as te, ChevronsLeft as ne, ChevronsRight as R, Code as z, Columns3 as re, Copy as ie, Database as B, Download as V, Expand as H, EyeOff as ae, FileText as U, Filter as W, FilterX as oe, Hash as se, Home as G, Key as ce, Link2 as le, List as ue, Loader2 as de, LoaderCircle as fe, Maximize2 as pe, Minimize2 as me, MoreVertical as he, MousePointerClick as ge, PanelLeft as _e, PanelRight as ve, Pencil as ye, Plus as be, RotateCcw as xe, Rows3 as Se, Save as Ce, Search as we, Table2 as Te, ToggleLeft as Ee, Trash2 as De, Type as Oe, Unlink as ke, WrapText as Ae, X as je, XIcon as Me } from "lucide-react";
6
+ import { Checkbox as Ne, Dialog as Pe, DropdownMenu as Fe, HoverCard as Ie, Label as Le, Select as Re } from "radix-ui";
7
7
  import { Slot as ze } from "@radix-ui/react-slot";
8
8
  import { useForm as Be, useStore as Ve } from "@tanstack/react-form";
9
9
  import { flexRender as He, getCoreRowModel as Ue, useReactTable as We } from "@tanstack/react-table";
@@ -856,18 +856,18 @@ var Ht = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Ut = Vt, Wt
856
856
  In,
857
857
  tr,
858
858
  Xn
859
- ], ae = () => [
859
+ ], V = () => [
860
860
  "",
861
861
  "none",
862
862
  m,
863
863
  J,
864
864
  q
865
- ], V = () => [
865
+ ], H = () => [
866
866
  "none",
867
867
  K,
868
868
  J,
869
869
  q
870
- ], H = () => [
870
+ ], ae = () => [
871
871
  "none",
872
872
  K,
873
873
  J,
@@ -1626,7 +1626,7 @@ var Ht = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Ut = Vt, Wt
1626
1626
  J,
1627
1627
  q
1628
1628
  ] }],
1629
- blur: [{ blur: ae() }],
1629
+ blur: [{ blur: V() }],
1630
1630
  brightness: [{ brightness: [
1631
1631
  K,
1632
1632
  J,
@@ -1679,7 +1679,7 @@ var Ht = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Ut = Vt, Wt
1679
1679
  J,
1680
1680
  q
1681
1681
  ] }],
1682
- "backdrop-blur": [{ "backdrop-blur": ae() }],
1682
+ "backdrop-blur": [{ "backdrop-blur": V() }],
1683
1683
  "backdrop-brightness": [{ "backdrop-brightness": [
1684
1684
  K,
1685
1685
  J,
@@ -1772,14 +1772,14 @@ var Ht = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, Ut = Vt, Wt
1772
1772
  q
1773
1773
  ] }],
1774
1774
  "perspective-origin": [{ "perspective-origin": x() }],
1775
- rotate: [{ rotate: V() }],
1776
- "rotate-x": [{ "rotate-x": V() }],
1777
- "rotate-y": [{ "rotate-y": V() }],
1778
- "rotate-z": [{ "rotate-z": V() }],
1779
- scale: [{ scale: H() }],
1780
- "scale-x": [{ "scale-x": H() }],
1781
- "scale-y": [{ "scale-y": H() }],
1782
- "scale-z": [{ "scale-z": H() }],
1775
+ rotate: [{ rotate: H() }],
1776
+ "rotate-x": [{ "rotate-x": H() }],
1777
+ "rotate-y": [{ "rotate-y": H() }],
1778
+ "rotate-z": [{ "rotate-z": H() }],
1779
+ scale: [{ scale: ae() }],
1780
+ "scale-x": [{ "scale-x": ae() }],
1781
+ "scale-y": [{ "scale-y": ae() }],
1782
+ "scale-z": [{ "scale-z": ae() }],
1783
1783
  "scale-3d": ["scale-3d"],
1784
1784
  skew: [{ skew: U() }],
1785
1785
  "skew-x": [{ "skew-x": U() }],
@@ -3235,7 +3235,7 @@ function Qa({ children: e }) {
3235
3235
  onClick: () => a(e.id),
3236
3236
  "aria-label": "Dismiss notification",
3237
3237
  className: "shrink-0 opacity-60 hover:opacity-100",
3238
- children: /* @__PURE__ */ x(Me, { className: "size-3.5" })
3238
+ children: /* @__PURE__ */ x(je, { className: "size-3.5" })
3239
3239
  })
3240
3240
  ]
3241
3241
  }, e.id))
@@ -3289,7 +3289,7 @@ function ao({ stats: e, maxRowCount: t }) {
3289
3289
  className: "flex-1 min-w-[1.5em] h-[0.5em] rounded-full bg-muted/70 overflow-hidden",
3290
3290
  children: /* @__PURE__ */ x("span", { className: "block h-full w-1/3 rounded-full bg-muted-foreground/30 animate-pulse" })
3291
3291
  }),
3292
- /* @__PURE__ */ x(fe, { className: "size-[1em] shrink-0 animate-spin" }),
3292
+ /* @__PURE__ */ x(de, { className: "size-[1em] shrink-0 animate-spin" }),
3293
3293
  /* @__PURE__ */ x(ro, { count: e.fkCount })
3294
3294
  ]
3295
3295
  }) : e.error ? /* @__PURE__ */ S("div", {
@@ -3350,7 +3350,7 @@ function oo({ table: e, stats: t, maxRowCount: n, showStats: r, active: i, actio
3350
3350
  type: "button",
3351
3351
  "aria-label": `Actions for ${e.label}`,
3352
3352
  className: "shrink-0 px-1 opacity-0 group-hover/tablerow:opacity-100 focus:opacity-100 data-[state=open]:opacity-100 text-muted-foreground hover:text-foreground",
3353
- children: /* @__PURE__ */ x(ge, { className: "size-3.5" })
3353
+ children: /* @__PURE__ */ x(he, { className: "size-3.5" })
3354
3354
  })
3355
3355
  }), /* @__PURE__ */ x(wr, {
3356
3356
  align: "start",
@@ -3405,13 +3405,13 @@ function lo() {
3405
3405
  {
3406
3406
  id: "download-csv",
3407
3407
  label: "Download CSV",
3408
- icon: ae,
3408
+ icon: V,
3409
3409
  onSelect: (e) => s(e, "csv")
3410
3410
  },
3411
3411
  {
3412
3412
  id: "download-json",
3413
3413
  label: "Download JSON",
3414
- icon: ae,
3414
+ icon: V,
3415
3415
  onSelect: (e) => s(e, "json")
3416
3416
  },
3417
3417
  ...t ?? []
@@ -3476,7 +3476,7 @@ function lo() {
3476
3476
  });
3477
3477
  return n ? /* @__PURE__ */ S("div", {
3478
3478
  className: "flex items-center justify-center gap-2 p-4",
3479
- children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
3479
+ children: [/* @__PURE__ */ x(de, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
3480
3480
  className: "text-sm text-muted-foreground",
3481
3481
  children: "Loading..."
3482
3482
  })]
@@ -3501,7 +3501,7 @@ function lo() {
3501
3501
  children: [/* @__PURE__ */ S("div", {
3502
3502
  className: "relative",
3503
3503
  children: [
3504
- /* @__PURE__ */ x(Te, { className: "absolute left-2 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none" }),
3504
+ /* @__PURE__ */ x(we, { className: "absolute left-2 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none" }),
3505
3505
  /* @__PURE__ */ x(xr, {
3506
3506
  type: "search",
3507
3507
  value: h,
@@ -3515,7 +3515,7 @@ function lo() {
3515
3515
  onClick: () => g(""),
3516
3516
  "aria-label": "Clear search",
3517
3517
  className: "absolute right-1.5 top-1/2 -translate-y-1/2 p-0.5 rounded text-muted-foreground hover:text-foreground hover:bg-muted",
3518
- children: /* @__PURE__ */ x(Me, { className: "size-4" })
3518
+ children: /* @__PURE__ */ x(je, { className: "size-4" })
3519
3519
  })
3520
3520
  ]
3521
3521
  }), E && /* @__PURE__ */ S("p", {
@@ -3676,7 +3676,7 @@ function _o({ className: e, size: t = "default", children: n, ...r }) {
3676
3676
  })]
3677
3677
  });
3678
3678
  }
3679
- function vo({ className: e, children: t, position: n = "item-aligned", align: r = "center", ...i }) {
3679
+ function vo({ className: e, children: t, position: n = "popper", align: r = "center", ...i }) {
3680
3680
  return /* @__PURE__ */ x(Re.Portal, { children: /* @__PURE__ */ S(Re.Content, {
3681
3681
  "data-slot": "select-content",
3682
3682
  className: Y("relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95", n === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1", e),
@@ -3807,7 +3807,7 @@ function wo({ column: e }) {
3807
3807
  onClick: () => {
3808
3808
  c(), i("_contains"), o(""), e.setFilterValue(void 0);
3809
3809
  },
3810
- children: [/* @__PURE__ */ x(Me, { className: "size-3" }), "Clear filter"]
3810
+ children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Clear filter"]
3811
3811
  })
3812
3812
  ]
3813
3813
  });
@@ -3919,7 +3919,7 @@ function ko({ column: e }) {
3919
3919
  size: "sm",
3920
3920
  className: "h-7 text-xs justify-start",
3921
3921
  onClick: E,
3922
- children: [/* @__PURE__ */ x(Me, { className: "size-3" }), "Clear filter"]
3922
+ children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Clear filter"]
3923
3923
  })
3924
3924
  ]
3925
3925
  });
@@ -4018,7 +4018,7 @@ function jo({ column: e }) {
4018
4018
  size: "sm",
4019
4019
  className: "h-7 text-xs justify-start",
4020
4020
  onClick: y,
4021
- children: [/* @__PURE__ */ x(Me, { className: "size-3" }), "Clear filter"]
4021
+ children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Clear filter"]
4022
4022
  })
4023
4023
  ]
4024
4024
  });
@@ -4087,7 +4087,7 @@ function Po({ column: e }) {
4087
4087
  onClick: () => {
4088
4088
  e.setFilterValue(void 0);
4089
4089
  },
4090
- children: [/* @__PURE__ */ x(Me, { className: "size-3" }), "Clear filter"]
4090
+ children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Clear filter"]
4091
4091
  })]
4092
4092
  });
4093
4093
  }
@@ -4140,7 +4140,7 @@ function Io({ column: e, joinTable: t, joinLabelColumn: n, joinFkColumn: r }) {
4140
4140
  onClick: () => {
4141
4141
  e.setFilterValue(void 0);
4142
4142
  },
4143
- children: [/* @__PURE__ */ x(Me, { className: "size-3" }), "Clear filter"]
4143
+ children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Clear filter"]
4144
4144
  })]
4145
4145
  });
4146
4146
  }
@@ -4183,7 +4183,7 @@ function Wo(e) {
4183
4183
  }
4184
4184
  function Go(e) {
4185
4185
  let t = e.paramType.replace("!", "");
4186
- return e.isPrimaryKey ? /* @__PURE__ */ x(le, { className: "size-3.5" }) : Rr(t) ? /* @__PURE__ */ x(se, { className: "size-3.5" }) : Br(t) ? /* @__PURE__ */ x(k, { className: "size-3.5" }) : x(t === "Boolean" ? De : ke, { className: "size-3.5" });
4186
+ return e.isPrimaryKey ? /* @__PURE__ */ x(ce, { className: "size-3.5" }) : Rr(t) ? /* @__PURE__ */ x(se, { className: "size-3.5" }) : Br(t) ? /* @__PURE__ */ x(k, { className: "size-3.5" }) : x(t === "Boolean" ? Ee : Oe, { className: "size-3.5" });
4187
4187
  }
4188
4188
  function Ko({ column: e, fkMeta: t }) {
4189
4189
  let n = Wo(e), r = e.isNullable, i = e.isPrimaryKey, a = e.isIdentity, o = e.defaultValue;
@@ -4219,7 +4219,7 @@ function Ko({ column: e, fkMeta: t }) {
4219
4219
  children: "Primary Key"
4220
4220
  }), /* @__PURE__ */ S("dd", {
4221
4221
  className: "text-foreground text-primary flex items-center gap-1",
4222
- children: [/* @__PURE__ */ x(le, { className: "size-3" }), "Yes"]
4222
+ children: [/* @__PURE__ */ x(ce, { className: "size-3" }), "Yes"]
4223
4223
  })] }),
4224
4224
  a && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("dt", {
4225
4225
  className: "text-muted-foreground",
@@ -4234,7 +4234,7 @@ function Ko({ column: e, fkMeta: t }) {
4234
4234
  }), /* @__PURE__ */ S("dd", {
4235
4235
  className: "text-foreground text-primary flex items-center gap-1",
4236
4236
  children: [
4237
- /* @__PURE__ */ x(ue, { className: "size-3" }),
4237
+ /* @__PURE__ */ x(le, { className: "size-3" }),
4238
4238
  t.joinTable,
4239
4239
  t.isSelfReference && /* @__PURE__ */ x("span", {
4240
4240
  className: "ml-1 px-1 rounded bg-primary/10 text-[10px] font-medium",
@@ -4333,11 +4333,11 @@ function qo({ column: e, table: t, title: n }) {
4333
4333
  }) })] })] }),
4334
4334
  e.getCanHide() && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Or, {}), /* @__PURE__ */ S(Tr, {
4335
4335
  onClick: () => e.toggleVisibility(!1),
4336
- children: [/* @__PURE__ */ x(H, { className: "size-3.5 text-muted-foreground" }), "Hide"]
4336
+ children: [/* @__PURE__ */ x(ae, { className: "size-3.5 text-muted-foreground" }), "Hide"]
4337
4337
  })] }),
4338
4338
  r && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Or, {}), /* @__PURE__ */ S(Tr, {
4339
4339
  onClick: r,
4340
- children: [/* @__PURE__ */ x(Se, { className: "size-3.5 text-muted-foreground" }), "Reset column widths"]
4340
+ children: [/* @__PURE__ */ x(xe, { className: "size-3.5 text-muted-foreground" }), "Reset column widths"]
4341
4341
  })] })
4342
4342
  ]
4343
4343
  })] })
@@ -4477,7 +4477,7 @@ function as({ value: e, dbType: t, onExpand: n, deferred: r }) {
4477
4477
  e.stopPropagation(), n();
4478
4478
  },
4479
4479
  "aria-label": "Expand content",
4480
- children: /* @__PURE__ */ x(V, { className: "size-3" })
4480
+ children: /* @__PURE__ */ x(H, { className: "size-3" })
4481
4481
  })
4482
4482
  ]
4483
4483
  });
@@ -4501,7 +4501,7 @@ function as({ value: e, dbType: t, onExpand: n, deferred: r }) {
4501
4501
  e.stopPropagation(), n();
4502
4502
  },
4503
4503
  "aria-label": "Expand content",
4504
- children: /* @__PURE__ */ x(V, { className: "size-3" })
4504
+ children: /* @__PURE__ */ x(H, { className: "size-3" })
4505
4505
  })
4506
4506
  ]
4507
4507
  });
@@ -4550,7 +4550,7 @@ function as({ value: e, dbType: t, onExpand: n, deferred: r }) {
4550
4550
  e.stopPropagation(), n();
4551
4551
  },
4552
4552
  "aria-label": "Expand content",
4553
- children: /* @__PURE__ */ x(V, { className: "size-3" })
4553
+ children: /* @__PURE__ */ x(H, { className: "size-3" })
4554
4554
  })]
4555
4555
  }) : /* @__PURE__ */ S("span", {
4556
4556
  className: "inline-flex items-center gap-1.5",
@@ -4567,7 +4567,7 @@ function as({ value: e, dbType: t, onExpand: n, deferred: r }) {
4567
4567
  e.stopPropagation(), n();
4568
4568
  },
4569
4569
  "aria-label": "Expand content",
4570
- children: /* @__PURE__ */ x(V, { className: "size-3" })
4570
+ children: /* @__PURE__ */ x(H, { className: "size-3" })
4571
4571
  })
4572
4572
  ]
4573
4573
  });
@@ -4750,7 +4750,7 @@ function Ts(e, t, n, r, i, a) {
4750
4750
  },
4751
4751
  "aria-label": "Open in side column",
4752
4752
  title: "Open in side column",
4753
- children: /* @__PURE__ */ x(ye, { className: "size-3" })
4753
+ children: /* @__PURE__ */ x(ve, { className: "size-3" })
4754
4754
  })]
4755
4755
  });
4756
4756
  }
@@ -4863,7 +4863,7 @@ var Ds = (e, t, n, r) => {
4863
4863
  children: /* @__PURE__ */ S(st, {
4864
4864
  to: "/" + i?.name + "/from/" + e.name + "/" + o,
4865
4865
  className: "inline-flex items-center gap-1 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs font-medium text-primary hover:bg-muted hover:border-primary/40 transition-colors",
4866
- children: [/* @__PURE__ */ x(de, { className: "size-3" }), c]
4866
+ children: [/* @__PURE__ */ x(ue, { className: "size-3" }), c]
4867
4867
  })
4868
4868
  }), /* @__PURE__ */ S(mo, {
4869
4869
  align: "start",
@@ -4871,7 +4871,7 @@ var Ds = (e, t, n, r) => {
4871
4871
  className: "w-auto max-w-xs p-3",
4872
4872
  children: [/* @__PURE__ */ S("div", {
4873
4873
  className: "flex items-center gap-2 border-b pb-2 mb-2",
4874
- children: [/* @__PURE__ */ x(de, { className: "size-3.5 text-primary" }), /* @__PURE__ */ S("span", {
4874
+ children: [/* @__PURE__ */ x(ue, { className: "size-3.5 text-primary" }), /* @__PURE__ */ S("span", {
4875
4875
  className: "text-xs font-semibold text-foreground",
4876
4876
  children: [
4877
4877
  c,
@@ -4908,7 +4908,7 @@ var Ds = (e, t, n, r) => {
4908
4908
  },
4909
4909
  "aria-label": "Open in side column",
4910
4910
  title: "Open in side column",
4911
- children: /* @__PURE__ */ x(ye, { className: "size-3" })
4911
+ children: /* @__PURE__ */ x(ve, { className: "size-3" })
4912
4912
  })]
4913
4913
  });
4914
4914
  }
@@ -4921,162 +4921,172 @@ function Os(e, t, n, r, i) {
4921
4921
  let a = la(t, n, r, i);
4922
4922
  return a ? qi(e, a.parentTable) : qi(e, t);
4923
4923
  }
4924
- function ks(e, t, n, r, i, a) {
4925
- let { search: o } = at(), s = nt(), l = o.get("filter") ?? "", f = o.get("cf") ?? "", h = o.get("gb"), g = o.get("gs"), _ = d(() => Mi(l).variables, [l]), y = Mt(), b = St(), [x, S] = m([]), [C, w] = m(cs), [T, E] = m(() => Hi(f)), [D, O] = m(0), [k, A] = m(50), j = p(e);
4926
- e && e !== j.current && (j.current = e, x.length > 0 && S([]), C !== cs && w(cs), D !== 0 && O(0)), u(() => {
4927
- E((e) => bs(e, f));
4924
+ function ks(e, t) {
4925
+ if (!e || !t) return [];
4926
+ let n = t[e.name] ?? t["*"];
4927
+ if (!n) return [];
4928
+ let r = e.columns.find((e) => e.name === n.column);
4929
+ return !r || pi(r) || di(r) ? [] : [{
4930
+ id: r.name,
4931
+ desc: n.desc === !0
4932
+ }];
4933
+ }
4934
+ function As(e, t, n, r, i, a) {
4935
+ let { search: o } = at(), s = nt(), l = o.get("filter") ?? "", f = o.get("cf") ?? "", h = o.get("gb"), g = o.get("gs"), _ = d(() => Mi(l).variables, [l]), y = Mt(), b = St(), { defaultSort: x } = kt(), S = d(() => ks(e, x), [e, x]), [C, w] = m(S), [T, E] = m(cs), [D, O] = m(() => Hi(f)), [k, A] = m(0), [j, M] = m(50), N = p(e);
4936
+ e && e !== N.current && (N.current = e, C !== S && w(S), T !== cs && E(cs), k !== 0 && A(0)), u(() => {
4937
+ O((e) => bs(e, f));
4928
4938
  }, [f]);
4929
- let M = d(() => bs(T, f), [T, f]), N = p(e?.name), P = N.current !== e?.name;
4930
- P && (N.current = e?.name);
4931
- let F = d(() => P ? null : ss(h, e), [
4932
- P,
4939
+ let P = d(() => bs(D, f), [D, f]), F = p(e?.name), I = F.current !== e?.name;
4940
+ I && (F.current = e?.name);
4941
+ let L = d(() => I ? null : ss(h, e), [
4942
+ I,
4933
4943
  h,
4934
4944
  e
4935
- ]), I = d(() => P ? null : ls(g, e), [
4936
- P,
4945
+ ]), ee = d(() => I ? null : ls(g, e), [
4946
+ I,
4937
4947
  g,
4938
4948
  e
4939
4949
  ]);
4940
4950
  u(() => {
4941
- if (!P || !h) return;
4951
+ if (!I || !h) return;
4942
4952
  let e = ds(o).toString();
4943
4953
  s(e ? `?${e}` : "?");
4944
4954
  }, [
4945
- P,
4955
+ I,
4946
4956
  h,
4947
4957
  o,
4948
4958
  s
4949
4959
  ]);
4950
- let L = d(() => {
4960
+ let te = d(() => {
4951
4961
  if (!e) return "id";
4952
4962
  let t = Gi(e)[0]?.name;
4953
4963
  return t && e.columns.some((e) => e.name === t) ? t : Ki(e, (e) => !pi(e) && !di(e)) || (e.columns.find((e) => !pi(e) && !di(e))?.name ?? e.columns.at(0)?.name ?? "id");
4954
- }, [e]), ee = d(() => {
4955
- if (x.length > 0 && e) {
4956
- let t = x[0];
4964
+ }, [e]), ne = d(() => {
4965
+ if (C.length > 0 && e) {
4966
+ let t = C[0];
4957
4967
  if (e.columns.some((e) => e.name === t.id)) return [`${t.id}_${t.desc ? "desc" : "asc"}`];
4958
4968
  }
4959
- return e ? [`${L}_asc`] : [];
4969
+ return e ? [`${te}_asc`] : [];
4960
4970
  }, [
4961
- x,
4971
+ C,
4962
4972
  e,
4963
- L
4964
- ]), te = d(() => ia(e, y, l, M, t, n, r), [
4973
+ te
4974
+ ]), R = d(() => ia(e, y, l, P, t, n, r), [
4965
4975
  e,
4966
4976
  y,
4967
4977
  l,
4968
- M,
4978
+ P,
4969
4979
  t,
4970
4980
  n,
4971
4981
  r
4972
- ]), ne = d(() => e ? zi(M, e).variables : {}, [M, e]), R = d(() => {
4982
+ ]), z = d(() => e ? zi(P, e).variables : {}, [P, e]), re = d(() => {
4973
4983
  if (!e) return null;
4974
- let t = Bi(e, l, M);
4984
+ let t = Bi(e, l, P);
4975
4985
  return t.length === 0 ? null : /* @__PURE__ */ Error(`These rows can't be shown because the filter can't be applied: ${t.join(" ")}`);
4976
4986
  }, [
4977
4987
  e,
4978
4988
  l,
4979
- M
4980
- ]), z = D * k, re = d(() => ({
4981
- sort: ee,
4982
- limit: k,
4983
- offset: z,
4989
+ P
4990
+ ]), ie = k * j, B = d(() => ({
4991
+ sort: ne,
4992
+ limit: j,
4993
+ offset: ie,
4984
4994
  ...t && e ? Os(t, e, y, n, r) : {},
4985
4995
  ..._,
4986
- ...ne
4996
+ ...z
4987
4997
  }), [
4988
- ee,
4989
- k,
4990
- z,
4998
+ ne,
4999
+ j,
5000
+ ie,
4991
5001
  t,
4992
5002
  e,
4993
5003
  y,
4994
5004
  n,
4995
5005
  r,
4996
5006
  _,
4997
- ne
4998
- ]), { isLoading: ie, isFetching: B, error: ae, data: V } = v({
5007
+ z
5008
+ ]), { isLoading: V, isFetching: H, error: ae, data: U } = v({
4999
5009
  queryKey: [
5000
5010
  "tableData",
5001
5011
  e?.name,
5002
- te,
5003
- re
5012
+ R,
5013
+ B
5004
5014
  ],
5005
- queryFn: ({ signal: e }) => b.query(te, re, { signal: e }),
5006
- enabled: !!te && !!e && ee.length > 0,
5015
+ queryFn: ({ signal: e }) => b.query(R, B, { signal: e }),
5016
+ enabled: !!R && !!e && ne.length > 0,
5007
5017
  placeholderData: (t, n) => n?.queryKey?.[1] === e?.name ? t : void 0
5008
- }), H = d(() => e && F ? ps(e, F, M, l, I, C) : null, [
5018
+ }), W = d(() => e && L ? ps(e, L, P, l, ee, T) : null, [
5009
5019
  e,
5010
- F,
5011
- I,
5012
- M,
5020
+ L,
5021
+ ee,
5022
+ P,
5013
5023
  l,
5014
- C
5015
- ]), U = v({
5024
+ T
5025
+ ]), oe = v({
5016
5026
  queryKey: [
5017
5027
  "tableGrouping",
5018
5028
  e?.name,
5019
- H?.query,
5020
- H?.variables
5029
+ W?.query,
5030
+ W?.variables
5021
5031
  ],
5022
- queryFn: ({ signal: e }) => b.query(H.query, H.variables, { signal: e }),
5023
- enabled: H !== null,
5032
+ queryFn: ({ signal: e }) => b.query(W.query, W.variables, { signal: e }),
5033
+ enabled: W !== null,
5024
5034
  placeholderData: void 0
5025
- }), W = d(() => e ? Ds(e, y, i, a) : [], [
5035
+ }), se = d(() => e ? Ds(e, y, i, a) : [], [
5026
5036
  e,
5027
5037
  y,
5028
5038
  i,
5029
5039
  a
5030
- ]), oe = d(() => t && (n || r) && e ? la(e, y, n, r) : null, [
5040
+ ]), G = d(() => t && (n || r) && e ? la(e, y, n, r) : null, [
5031
5041
  t,
5032
5042
  n,
5033
5043
  r,
5034
5044
  e,
5035
5045
  y
5036
- ]), se, ce;
5037
- if (oe && !aa(oe.childJoin)) {
5038
- let e = ca(V, oe.parentTable.name, oe.childField);
5039
- se = e.data, ce = e.total;
5046
+ ]), ce, le;
5047
+ if (G && !aa(G.childJoin)) {
5048
+ let e = ca(U, G.parentTable.name, G.childField);
5049
+ ce = e.data, le = e.total;
5040
5050
  } else {
5041
- let t = V?.[e?.name ?? ""];
5042
- se = t?.data ?? [], ce = t?.total ?? 0;
5051
+ let t = U?.[e?.name ?? ""];
5052
+ ce = t?.data ?? [], le = t?.total ?? 0;
5043
5053
  }
5044
- let le = Math.max(1, Math.ceil(ce / k));
5054
+ let ue = Math.max(1, Math.ceil(le / j));
5045
5055
  u(() => {
5046
- let e = ys(D, le);
5047
- e !== D && O(e);
5048
- }, [D, le]);
5049
- let ue = c((e) => {
5056
+ let e = ys(k, ue);
5057
+ e !== k && A(e);
5058
+ }, [k, ue]);
5059
+ let de = c((e) => {
5050
5060
  let t = new URLSearchParams(o), n = Vi(e);
5051
5061
  n ? t.set("cf", n) : t.delete("cf");
5052
5062
  let r = t.toString();
5053
5063
  s(r ? `?${r}` : "?");
5054
- }, [o, s]), de = c((e) => {
5055
- S(e), O(0);
5056
- }, []), fe = c((e) => {
5057
- E(e), O(0), ue(e);
5058
- }, [ue]), pe = c((e) => {
5059
- O(e);
5060
- }, []), me = c((e) => {
5061
- A(e), O(0);
5064
+ }, [o, s]), fe = c((e) => {
5065
+ w(e), A(0);
5066
+ }, []), pe = c((e) => {
5067
+ O(e), A(0), de(e);
5068
+ }, [de]), me = c((e) => {
5069
+ A(e);
5062
5070
  }, []), he = c((e) => {
5071
+ M(e), A(0);
5072
+ }, []), ge = c((e) => {
5063
5073
  let t = us(o, "gb", e);
5064
5074
  e || t.delete("gs");
5065
5075
  let n = t.toString();
5066
5076
  s(n ? `?${n}` : "?");
5067
- }, [o, s]), ge = c((e) => {
5077
+ }, [o, s]), _e = c((e) => {
5068
5078
  let t = us(o, "gs", e).toString();
5069
5079
  s(t ? `?${t}` : "?");
5070
- }, [o, s]), _e = e?.primaryKeys ?? [], ve = d(() => e ? ia(e, y, l, M, t, n, r, { fields: "export" }) : null, [
5080
+ }, [o, s]), ve = e?.primaryKeys ?? [], ye = d(() => e ? ia(e, y, l, P, t, n, r, { fields: "export" }) : null, [
5071
5081
  e,
5072
5082
  y,
5073
5083
  l,
5074
- M,
5084
+ P,
5075
5085
  t,
5076
5086
  n,
5077
5087
  r
5078
- ]), ye = c(async (t) => {
5079
- if (!ve || !e) return null;
5088
+ ]), be = c(async (t) => {
5089
+ if (!ye || !e) return null;
5080
5090
  let n = ra(e), r = n.map((e) => e.label), i = n.map((e) => e.name);
5081
5091
  return Ha({
5082
5092
  headers: r,
@@ -5087,12 +5097,12 @@ function ks(e, t, n, r, i, a) {
5087
5097
  csv: { bom: !0 },
5088
5098
  fetchPage: async (t, n, r) => {
5089
5099
  let a = {
5090
- ...re,
5100
+ ...B,
5091
5101
  limit: n,
5092
5102
  offset: t
5093
- }, o = await b.query(ve, a, { signal: r }), s, c;
5094
- if (oe && !aa(oe.childJoin)) {
5095
- let e = ca(o, oe.parentTable.name, oe.childField);
5103
+ }, o = await b.query(ye, a, { signal: r }), s, c;
5104
+ if (G && !aa(G.childJoin)) {
5105
+ let e = ca(o, G.parentTable.name, G.childField);
5096
5106
  s = e.data, c = e.total;
5097
5107
  } else {
5098
5108
  let t = o?.[e.name];
@@ -5105,70 +5115,70 @@ function ks(e, t, n, r, i, a) {
5105
5115
  }
5106
5116
  });
5107
5117
  }, [
5108
- ve,
5118
+ ye,
5109
5119
  e,
5110
- re,
5120
+ B,
5111
5121
  b,
5112
- oe
5122
+ G
5113
5123
  ]);
5114
5124
  return {
5115
- columns: W,
5116
- sorting: x,
5117
- columnFilters: T,
5118
- primaryKeys: _e,
5119
- pageIndex: D,
5120
- pageSize: k,
5121
- pageCount: le,
5122
- rows: se,
5123
- totalRows: ce,
5124
- grouping: H ? {
5125
- column: H.groupBy,
5126
- sumColumn: H.sumBy,
5127
- rows: gs(U.data, e, H.groupBy, H.sumBy, H.sort),
5128
- loading: U.isLoading,
5129
- error: U.error,
5130
- sort: H.sort,
5131
- onSortChange: w,
5132
- memberRequest: (t) => _s(e, H.groupBy, t, M, l, ee)
5125
+ columns: se,
5126
+ sorting: C,
5127
+ columnFilters: D,
5128
+ primaryKeys: ve,
5129
+ pageIndex: k,
5130
+ pageSize: j,
5131
+ pageCount: ue,
5132
+ rows: ce,
5133
+ totalRows: le,
5134
+ grouping: W ? {
5135
+ column: W.groupBy,
5136
+ sumColumn: W.sumBy,
5137
+ rows: gs(oe.data, e, W.groupBy, W.sumBy, W.sort),
5138
+ loading: oe.isLoading,
5139
+ error: oe.error,
5140
+ sort: W.sort,
5141
+ onSortChange: E,
5142
+ memberRequest: (t) => _s(e, W.groupBy, t, P, l, ne)
5133
5143
  } : null,
5134
- exportRows: ye,
5135
- loading: ie,
5136
- fetching: B && !ie,
5137
- error: R ?? ae,
5138
- onSortingChange: de,
5139
- onColumnFiltersChange: fe,
5140
- onPageIndexChange: pe,
5141
- onPageSizeChange: me,
5142
- onGroupingChange: he,
5143
- onGroupingSumChange: ge
5144
+ exportRows: be,
5145
+ loading: V,
5146
+ fetching: H && !V,
5147
+ error: re ?? ae,
5148
+ onSortingChange: fe,
5149
+ onColumnFiltersChange: pe,
5150
+ onPageIndexChange: me,
5151
+ onPageSizeChange: he,
5152
+ onGroupingChange: ge,
5153
+ onGroupingSumChange: _e
5144
5154
  };
5145
5155
  }
5146
5156
  //#endregion
5147
5157
  //#region src/lib/invalidate.ts
5148
- var As = /* @__PURE__ */ new Set([
5158
+ var js = /* @__PURE__ */ new Set([
5149
5159
  "tableData",
5150
5160
  "editRecord",
5151
5161
  "tableRowCounts",
5152
5162
  "m2mRows",
5153
5163
  "fkPreview"
5154
- ]), js = /* @__PURE__ */ new Set([
5164
+ ]), Ms = /* @__PURE__ */ new Set([
5155
5165
  "tableRef",
5156
5166
  "tableRefValue",
5157
5167
  "compositeTableRef",
5158
5168
  "m2mTargets"
5159
5169
  ]);
5160
- function Ms(e, t) {
5170
+ function Ns(e, t) {
5161
5171
  return e.invalidateQueries({ predicate: (e) => {
5162
5172
  let [n, r] = e.queryKey;
5163
- return typeof n == "string" ? As.has(n) ? !0 : js.has(n) ? r === t : !1 : !1;
5173
+ return typeof n == "string" ? js.has(n) ? !0 : Ms.has(n) ? r === t : !1 : !1;
5164
5174
  } });
5165
5175
  }
5166
5176
  //#endregion
5167
5177
  //#region src/hooks/useDeleteMutation.tsx
5168
- function Ns(e) {
5178
+ function Ps(e) {
5169
5179
  return typeof e == "object" && !!e;
5170
5180
  }
5171
- function Ps(e, t) {
5181
+ function Fs(e, t) {
5172
5182
  if (e == null) return null;
5173
5183
  if (!t) return e;
5174
5184
  let n = Mr(t);
@@ -5183,7 +5193,7 @@ function Ps(e, t) {
5183
5193
  }
5184
5194
  return n === "Boolean" ? typeof e == "boolean" ? e : e === "true" || e === 1 : String(e);
5185
5195
  }
5186
- function Fs(e) {
5196
+ function Is(e) {
5187
5197
  X(e.name, "delete mutation table name");
5188
5198
  let t = St(), n = y(), { toast: r } = $a(), i = d(() => {
5189
5199
  let t = /* @__PURE__ */ new Map();
@@ -5192,18 +5202,18 @@ function Fs(e) {
5192
5202
  }, [e]), a = d(() => e.primaryKeys ?? [], [e]), o = (t) => {
5193
5203
  if (a.length === 0) throw Error(`Cannot delete from '${e.name}': the table has no primary key.`);
5194
5204
  let n = {};
5195
- if (Ns(t)) {
5205
+ if (Ps(t)) {
5196
5206
  for (let e of a) {
5197
5207
  let r = t[e];
5198
5208
  if (r == null) throw Error(`Cannot delete row: missing value for primary-key column '${e}'.`);
5199
- n[e] = Ps(r, i.get(e));
5209
+ n[e] = Fs(r, i.get(e));
5200
5210
  }
5201
5211
  return n;
5202
5212
  }
5203
5213
  if (a.length !== 1) throw Error(`Cannot delete from '${e.name}': composite primary key requires an object key, not a scalar.`);
5204
5214
  if (t == null) throw Error(`Cannot delete row: missing value for primary-key column '${a[0]}'.`);
5205
5215
  let r = a[0];
5206
- return n[r] = Ps(t, i.get(r)), n;
5216
+ return n[r] = Fs(t, i.get(r)), n;
5207
5217
  }, s = d(() => `mutation deleteSingle($detail: Delete_${e.name}){
5208
5218
  ${e.name}(delete: $detail)
5209
5219
  }`, [e]), c = d(() => `mutation deleteMany($delta: ${e.name}_delta){
@@ -5211,12 +5221,12 @@ function Fs(e) {
5211
5221
  }`, [e]), l = _({
5212
5222
  mutationFn: (e) => t.query(s, { detail: e }),
5213
5223
  onSuccess: () => {
5214
- Ms(n, e.name), r("Row deleted");
5224
+ Ns(n, e.name), r("Row deleted");
5215
5225
  }
5216
5226
  }), u = _({
5217
5227
  mutationFn: (e) => t.query(c, { delta: { deleted: e } }),
5218
5228
  onSuccess: (t, i) => {
5219
- Ms(n, e.name);
5229
+ Ns(n, e.name);
5220
5230
  let a = i.length;
5221
5231
  r(`${a} ${a === 1 ? "row" : "rows"} deleted`);
5222
5232
  }
@@ -5246,18 +5256,18 @@ function Fs(e) {
5246
5256
  }
5247
5257
  //#endregion
5248
5258
  //#region src/hooks/useDeltaMutation.tsx
5249
- function Is(e) {
5259
+ function Ls(e) {
5250
5260
  return (e.inserted?.length ?? 0) + (e.updated?.length ?? 0) + (e.deleted?.length ?? 0);
5251
5261
  }
5252
- function Ls(e) {
5262
+ function Rs(e) {
5253
5263
  X(e.name, "delta mutation table name");
5254
5264
  let t = St(), n = y(), { toast: r } = $a(), i = d(() => `mutation saveDelta($delta: ${e.name}_delta){
5255
5265
  ${e.name}(delta: $delta)
5256
5266
  }`, [e]), a = _({
5257
5267
  mutationFn: (e) => t.query(i, { delta: e }),
5258
5268
  onSuccess: (t, i) => {
5259
- Ms(n, e.name);
5260
- let a = Is(i);
5269
+ Ns(n, e.name);
5270
+ let a = Ls(i);
5261
5271
  r(`${a} ${a === 1 ? "change" : "changes"} saved`);
5262
5272
  }
5263
5273
  });
@@ -5269,13 +5279,13 @@ function Ls(e) {
5269
5279
  }
5270
5280
  //#endregion
5271
5281
  //#region src/lib/field-validation.ts
5272
- function Rs(e) {
5282
+ function zs(e) {
5273
5283
  return Rr(e.paramType);
5274
5284
  }
5275
- function zs(e) {
5285
+ function Bs(e) {
5276
5286
  return Lr(e.paramType);
5277
5287
  }
5278
- var Bs = {
5288
+ var Vs = {
5279
5289
  Int: {
5280
5290
  min: -2147483648,
5281
5291
  max: 2147483647
@@ -5288,28 +5298,28 @@ var Bs = {
5288
5298
  min: 0,
5289
5299
  max: 255
5290
5300
  }
5291
- }, Vs = -(2n ** 63n), Hs = 2n ** 63n - 1n;
5292
- function Us(e) {
5301
+ }, Hs = -(2n ** 63n), Us = 2n ** 63n - 1n;
5302
+ function Ws(e) {
5293
5303
  let t = (e.dbType ?? "").toLowerCase().trim(), n = t.includes("(") ? t.slice(0, t.indexOf("(")).trimEnd() : t;
5294
5304
  if (n === "datetimeoffset" || n === "datetime" || n === "datetime2" || n === "smalldatetime" || n.startsWith("timestamp")) return "datetime";
5295
5305
  if (n === "date") return "date";
5296
5306
  if (n.startsWith("time")) return "time";
5297
5307
  }
5298
- function Ws(e) {
5308
+ function Gs(e) {
5299
5309
  let t = /^[+-]?(\d*)(?:\.\d*)?$/.exec(e.trim());
5300
5310
  if (t) return t[1].replace(/^0+/, "").length;
5301
5311
  }
5302
- function Gs(e) {
5312
+ function Ks(e) {
5303
5313
  return e.startsWith("^") ? e : `^(?:${e})$`;
5304
5314
  }
5305
- function Ks(e) {
5315
+ function qs(e) {
5306
5316
  if (e !== e.trim() || /\s/.test(e)) return !1;
5307
5317
  let t = e.lastIndexOf("@");
5308
5318
  if (t <= 0 || t === e.length - 1) return !1;
5309
5319
  let n = e.slice(t + 1);
5310
5320
  return n.includes(".") && !n.startsWith(".") && !n.endsWith(".");
5311
5321
  }
5312
- function qs(e) {
5322
+ function Js(e) {
5313
5323
  try {
5314
5324
  let t = new URL(e);
5315
5325
  return t.protocol === "http:" || t.protocol === "https:";
@@ -5317,7 +5327,7 @@ function qs(e) {
5317
5327
  return !1;
5318
5328
  }
5319
5329
  }
5320
- function Js(e, t, n) {
5330
+ function Ys(e, t, n) {
5321
5331
  let r = e.label;
5322
5332
  if (n && (t == null || t === "")) return `${r} is required`;
5323
5333
  if (t == null || t === "") return;
@@ -5325,7 +5335,7 @@ function Js(e, t, n) {
5325
5335
  if (e.pattern) {
5326
5336
  let n;
5327
5337
  try {
5328
- n = new RegExp(Gs(e.pattern));
5338
+ n = new RegExp(Ks(e.pattern));
5329
5339
  } catch {
5330
5340
  return `${r} has an invalid validation pattern`;
5331
5341
  }
@@ -5333,10 +5343,10 @@ function Js(e, t, n) {
5333
5343
  }
5334
5344
  if (e.minLength && t.length < e.minLength) return `${r} must be at least ${e.minLength} characters`;
5335
5345
  if (e.maxLength && t.length > e.maxLength) return `${r} must be at most ${e.maxLength} characters`;
5336
- if (e.inputType === "email" && !Ks(t)) return "Invalid email address";
5337
- if (e.inputType === "url" && !qs(t)) return "Invalid URL";
5346
+ if (e.inputType === "email" && !qs(t)) return "Invalid email address";
5347
+ if (e.inputType === "url" && !Js(t)) return "Invalid URL";
5338
5348
  }
5339
- let i = Us(e);
5349
+ let i = Ws(e);
5340
5350
  if (i && typeof t == "string") {
5341
5351
  if (!(i === "time" ? /^\d{1,2}:\d{2}(:\d{2}(\.\d+)?)?$/.test(t.trim()) : !Number.isNaN(new Date(t).getTime()))) return `${r} must be a valid ${i === "datetime" ? "date/time" : i}`;
5342
5352
  if (i !== "time") {
@@ -5350,37 +5360,37 @@ function Js(e, t, n) {
5350
5360
  let e = t.trim();
5351
5361
  if (!/^[+-]?\d+$/.test(e)) return `${r} must be a whole number`;
5352
5362
  let n = BigInt(e);
5353
- return n < Vs || n > Hs ? `${r} is out of range for a 64-bit integer` : void 0;
5363
+ return n < Hs || n > Us ? `${r} is out of range for a 64-bit integer` : void 0;
5354
5364
  }
5355
5365
  if (e.precision != null && (typeof t == "string" || typeof t == "number")) {
5356
- let n = Math.max(e.precision - (e.scale ?? 0), 0), i = Ws(String(t));
5366
+ let n = Math.max(e.precision - (e.scale ?? 0), 0), i = Gs(String(t));
5357
5367
  if (i !== void 0 && i > n) return `${r} must have at most ${n} digits before the decimal point`;
5358
5368
  }
5359
- if (Rs(e)) {
5369
+ if (zs(e)) {
5360
5370
  let n = Number(t);
5361
5371
  if (!Number.isFinite(n)) return `${r} must be a number`;
5362
- if (zs(e) && !Number.isInteger(n)) return `${r} must be a whole number`;
5363
- let i = Bs[Mr(e.paramType)];
5372
+ if (Bs(e) && !Number.isInteger(n)) return `${r} must be a whole number`;
5373
+ let i = Vs[Mr(e.paramType)];
5364
5374
  if (i && (n < i.min || n > i.max)) return `${r} must be between ${i.min} and ${i.max}`;
5365
5375
  let a = e.min == null ? NaN : Number(e.min), o = e.max == null ? NaN : Number(e.max);
5366
5376
  if (!Number.isNaN(a) && n < a) return `${r} must be at least ${e.min}`;
5367
5377
  if (!Number.isNaN(o) && n > o) return `${r} must be at most ${e.max}`;
5368
5378
  }
5369
5379
  }
5370
- function Ys(e, t) {
5380
+ function Xs(e, t) {
5371
5381
  let n = [];
5372
5382
  for (let r of e) {
5373
5383
  let e = t[r.name];
5374
5384
  if (e == null || e === "") continue;
5375
- let i = Js(r, e, !1);
5385
+ let i = Ys(r, e, !1);
5376
5386
  i && n.push(i);
5377
5387
  }
5378
5388
  return n;
5379
5389
  }
5380
5390
  //#endregion
5381
5391
  //#region src/lib/mutation-payload.ts
5382
- var Xs = (e) => Rr(e) && !zr(e), Zs = ["Boolean", "Boolean!"];
5383
- function Qs(e, t, n) {
5392
+ var Zs = (e) => Rr(e) && !zr(e), Qs = ["Boolean", "Boolean!"];
5393
+ function $s(e, t, n) {
5384
5394
  let r = Mr(t), i = Lr(t);
5385
5395
  if (typeof e == "number") {
5386
5396
  if (Number.isFinite(e) && (!i || Number.isInteger(e))) return e;
@@ -5392,22 +5402,22 @@ function Qs(e, t, n) {
5392
5402
  if (!Number.isFinite(o)) throw Error(`Invalid ${r} value for column '${n}'.`);
5393
5403
  return o;
5394
5404
  }
5395
- function $s(e, t, n, r, i) {
5405
+ function ec(e, t, n, r, i) {
5396
5406
  let a = { ...e };
5397
5407
  for (let { column: e } of t) {
5398
5408
  if (a[e.name] === null) {
5399
5409
  a[e.name] = i ? void 0 : null;
5400
5410
  continue;
5401
5411
  }
5402
- if (Xs(e.paramType)) {
5412
+ if (Zs(e.paramType)) {
5403
5413
  let t = a[e.name];
5404
- a[e.name] = t == null ? void 0 : t === "" ? i ? void 0 : null : Qs(t, e.paramType, e.name);
5414
+ a[e.name] = t == null ? void 0 : t === "" ? i ? void 0 : null : $s(t, e.paramType, e.name);
5405
5415
  }
5406
5416
  if (zr(e.paramType)) {
5407
5417
  let t = a[e.name];
5408
5418
  a[e.name] = t == null ? void 0 : t === "" ? i ? void 0 : null : String(t);
5409
5419
  }
5410
- if (Zs.some((t) => t === e.paramType)) {
5420
+ if (Qs.some((t) => t === e.paramType)) {
5411
5421
  let t = a[e.name];
5412
5422
  e.isNullable && t == null ? a[e.name] = i ? void 0 : null : a[e.name] = !!t;
5413
5423
  }
@@ -5420,11 +5430,11 @@ function $s(e, t, n, r, i) {
5420
5430
  }
5421
5431
  if (!i && r) for (let e of n) {
5422
5432
  let t = r[e.name];
5423
- Xs(e.paramType) ? a[e.name] = t == null ? null : Qs(t, e.paramType, e.name) : a[e.name] = t;
5433
+ Zs(e.paramType) ? a[e.name] = t == null ? null : $s(t, e.paramType, e.name) : a[e.name] = t;
5424
5434
  }
5425
5435
  return a;
5426
5436
  }
5427
- function ec(e, t, n, r, i) {
5437
+ function tc(e, t, n, r, i) {
5428
5438
  let a = t.map((e) => ({ column: e }));
5429
5439
  return r.map((r) => {
5430
5440
  let o = ei(r, e);
@@ -5432,12 +5442,12 @@ function ec(e, t, n, r, i) {
5432
5442
  let s = {};
5433
5443
  for (let e of t) s[e.name] = r[e.name] ?? null;
5434
5444
  Object.assign(s, i);
5435
- let c = Ys(t, s);
5445
+ let c = Xs(t, s);
5436
5446
  if (c.length > 0) throw Error(c.join(" "));
5437
- return $s(s, a, n, o, !1);
5447
+ return ec(s, a, n, o, !1);
5438
5448
  });
5439
5449
  }
5440
- function tc(e, t, n, r, i) {
5450
+ function nc(e, t, n, r, i) {
5441
5451
  return r.map((r) => {
5442
5452
  let a = i(r);
5443
5453
  if (!a || Object.keys(a).length === 0) throw Error("Cannot save: a fetched row carries no staged changes.");
@@ -5446,14 +5456,14 @@ function tc(e, t, n, r, i) {
5446
5456
  let s = t.filter((e) => !e.isNullable || e.name in a), c = {};
5447
5457
  for (let e of s) c[e.name] = r[e.name] ?? null;
5448
5458
  Object.assign(c, a);
5449
- let l = Ys(s, c);
5459
+ let l = Xs(s, c);
5450
5460
  if (l.length > 0) throw Error(l.join(" "));
5451
- return $s(c, s.map((e) => ({ column: e })), n, o, !1);
5461
+ return ec(c, s.map((e) => ({ column: e })), n, o, !1);
5452
5462
  });
5453
5463
  }
5454
5464
  //#endregion
5455
5465
  //#region src/hooks/useTableMutation.tsx
5456
- function nc(e, t, n, r) {
5466
+ function rc(e, t, n, r) {
5457
5467
  X(e.name, "table mutation table name");
5458
5468
  let i = St(), a = y(), { toast: o } = $a(), s = r === void 0 || r === "", c = d(() => `mutation updateSingle($detail: Update_${e.name}){
5459
5469
  ${e.name}(update: $detail)
@@ -5462,12 +5472,12 @@ function nc(e, t, n, r) {
5462
5472
  }`, [e]), u = _({
5463
5473
  mutationFn: (e) => i.query(c, { detail: e }),
5464
5474
  onSuccess: () => {
5465
- Ms(a, e.name), o(`${e.label ?? e.name} saved`);
5475
+ Ns(a, e.name), o(`${e.label ?? e.name} saved`);
5466
5476
  }
5467
5477
  }), f = _({
5468
5478
  mutationFn: (e) => i.query(l, { detail: e }),
5469
5479
  onSuccess: () => {
5470
- Ms(a, e.name), o(`${e.label ?? e.name} created`);
5480
+ Ns(a, e.name), o(`${e.label ?? e.name} created`);
5471
5481
  }
5472
5482
  }), p = d(() => s || !r ? null : ri(r, e), [
5473
5483
  s,
@@ -5478,22 +5488,22 @@ function nc(e, t, n, r) {
5478
5488
  return g(t), Promise.reject(t);
5479
5489
  }, b = (r) => {
5480
5490
  if (g(null), !p || n.length === 0) return v(/* @__PURE__ */ Error(`Cannot update ${e.label ?? e.name}: the record has no resolvable primary key.`));
5481
- let i = Ys(t.map((e) => e.column), r);
5491
+ let i = Xs(t.map((e) => e.column), r);
5482
5492
  if (i.length > 0) return v(Error(i.join(" ")));
5483
5493
  let a;
5484
5494
  try {
5485
- a = $s(r, t, n, p, !1);
5495
+ a = ec(r, t, n, p, !1);
5486
5496
  } catch (e) {
5487
5497
  return v(e);
5488
5498
  }
5489
5499
  return u.mutateAsync(a);
5490
5500
  }, x = (e) => {
5491
5501
  g(null);
5492
- let r = Ys(t.map((e) => e.column), e);
5502
+ let r = Xs(t.map((e) => e.column), e);
5493
5503
  if (r.length > 0) return v(Error(r.join(" ")));
5494
5504
  let i;
5495
5505
  try {
5496
- i = $s(e, t, n, null, !0);
5506
+ i = ec(e, t, n, null, !0);
5497
5507
  } catch (e) {
5498
5508
  return v(e);
5499
5509
  }
@@ -5508,15 +5518,15 @@ function nc(e, t, n, r) {
5508
5518
  }
5509
5519
  //#endregion
5510
5520
  //#region src/lib/table-ref.ts
5511
- var rc = 1e3;
5512
- function ic(e) {
5521
+ var ic = 1e3;
5522
+ function ac(e) {
5513
5523
  let t = e.labelColumn || Gi(e)[0]?.name || e.columns[0]?.name;
5514
5524
  if (!t) throw Error(`Table '${e.name}' has no usable label column for a reference dropdown.`);
5515
5525
  return t;
5516
5526
  }
5517
- function ac(e, t, n) {
5527
+ function oc(e, t, n) {
5518
5528
  X(e.name, "reference table name"), X(t, "reference key column");
5519
- let r = ic(e);
5529
+ let r = ac(e);
5520
5530
  if (X(r, "reference label column"), !e.columns.some((e) => e.name === t)) throw Error(`Reference table '${e.name}' has no key column '${t}'.`);
5521
5531
  let i = e.columns.find((e) => e.name === r)?.paramType?.replace("!", "") === "String", a = !!n && n.trim() !== "" && i, o = a ? "$limit: Int, $search: String" : "$limit: Int", s = a ? `filter: {${r}: {_contains: $search}} ` : "";
5522
5532
  return {
@@ -5532,9 +5542,9 @@ function ac(e, t, n) {
5532
5542
  serverSearch: i
5533
5543
  };
5534
5544
  }
5535
- function oc(e, t) {
5545
+ function sc(e, t) {
5536
5546
  X(e.name, "reference table name"), X(t, "reference key column");
5537
- let n = ic(e);
5547
+ let n = ac(e);
5538
5548
  X(n, "reference label column");
5539
5549
  let r = e.columns.find((e) => e.name === t);
5540
5550
  if (!r) throw Error(`Reference table '${e.name}' has no key column '${t}'.`);
@@ -5551,16 +5561,16 @@ function oc(e, t) {
5551
5561
  keyType: i
5552
5562
  };
5553
5563
  }
5554
- function sc(e, t) {
5564
+ function cc(e, t) {
5555
5565
  return Ur(t, e);
5556
5566
  }
5557
5567
  //#endregion
5558
5568
  //#region src/hooks/useTableRef.tsx
5559
- function cc(e, t) {
5569
+ function lc(e, t) {
5560
5570
  return e?.data?.find((e) => e.graphQlName === t);
5561
5571
  }
5562
- function lc(e, t, n, r = "", i = !0) {
5563
- let a = St(), o = d(() => cc(e, t), [e, t]), s = r.trim(), c = d(() => e.loading || e.error || !o ? null : ac(o, n, s), [
5572
+ function uc(e, t, n, r = "", i = !0) {
5573
+ let a = St(), o = d(() => lc(e, t), [e, t]), s = r.trim(), c = d(() => e.loading || e.error || !o ? null : oc(o, n, s), [
5564
5574
  n,
5565
5575
  o,
5566
5576
  e.loading,
@@ -5576,7 +5586,7 @@ function lc(e, t, n, r = "", i = !0) {
5576
5586
  queryFn: ({ signal: e }) => a.query(c.query, l ? {
5577
5587
  limit: 50,
5578
5588
  search: l
5579
- } : { limit: rc }, { signal: e }),
5589
+ } : { limit: ic }, { signal: e }),
5580
5590
  enabled: !!c && i
5581
5591
  });
5582
5592
  return {
@@ -5586,8 +5596,8 @@ function lc(e, t, n, r = "", i = !0) {
5586
5596
  serverSearch: c?.serverSearch ?? !1
5587
5597
  };
5588
5598
  }
5589
- function uc(e, t, n, r) {
5590
- let i = St(), a = d(() => cc(e, t), [e, t]), o = !e.loading && !e.error && !!a && r != null && r !== "", s = d(() => o ? oc(a, n) : null, [
5599
+ function dc(e, t, n, r) {
5600
+ let i = St(), a = d(() => lc(e, t), [e, t]), o = !e.loading && !e.error && !!a && r != null && r !== "", s = d(() => o ? sc(a, n) : null, [
5591
5601
  o,
5592
5602
  a,
5593
5603
  n
@@ -5598,7 +5608,7 @@ function uc(e, t, n, r) {
5598
5608
  n,
5599
5609
  String(r ?? "")
5600
5610
  ],
5601
- queryFn: ({ signal: e }) => i.query(s.query, { key: sc(s.keyType, r) }, { signal: e }),
5611
+ queryFn: ({ signal: e }) => i.query(s.query, { key: cc(s.keyType, r) }, { signal: e }),
5602
5612
  enabled: !!s
5603
5613
  });
5604
5614
  return {
@@ -5609,8 +5619,8 @@ function uc(e, t, n, r) {
5609
5619
  }
5610
5620
  //#endregion
5611
5621
  //#region src/hooks/useCompositeTableRef.ts
5612
- var dc = 500, fc = 50;
5613
- function pc(e, t, n, r = {}) {
5622
+ var fc = 500, pc = 50;
5623
+ function mc(e, t, n, r = {}) {
5614
5624
  let i = St(), { search: a = "", enabled: o = !0, currentValues: s = null } = r, c = a.trim(), l = d(() => e?.data?.find((e) => e.graphQlName === t), [e, t]), u = d(() => l?.labelColumn || n[0], [l, n]), f = d(() => l?.columns.find((e) => e.name === u)?.paramType?.replace("!", "") === "String", [l, u]), p = d(() => {
5615
5625
  if (!l || n.length === 0 || !Ti(t) || !Ti(u)) return !1;
5616
5626
  let e = new Set(l.columns.map((e) => e.name));
@@ -5647,9 +5657,9 @@ function pc(e, t, n, r = {}) {
5647
5657
  _
5648
5658
  ],
5649
5659
  queryFn: () => i.query(g, _ ? {
5650
- limit: fc,
5660
+ limit: pc,
5651
5661
  search: _
5652
- } : { limit: dc }),
5662
+ } : { limit: fc }),
5653
5663
  enabled: !!g && o
5654
5664
  }), S = d(() => {
5655
5665
  if (!l || !x) return [];
@@ -5733,14 +5743,14 @@ function pc(e, t, n, r = {}) {
5733
5743
  }
5734
5744
  //#endregion
5735
5745
  //#region src/lib/date-input.ts
5736
- var mc = /* @__PURE__ */ new Set(["DateTime", "DateTime!"]);
5737
- function hc(e) {
5738
- return mc.has(e.paramType);
5739
- }
5746
+ var hc = /* @__PURE__ */ new Set(["DateTime", "DateTime!"]);
5740
5747
  function gc(e) {
5748
+ return hc.has(e.paramType);
5749
+ }
5750
+ function _c(e) {
5741
5751
  return _a(e) === "datetime";
5742
5752
  }
5743
- function _c(e, t) {
5753
+ function vc(e, t) {
5744
5754
  if (!e) return "";
5745
5755
  let n = e.match(/^(\d{4}-\d{2}-\d{2})(?:[T ](\d{2}:\d{2}(?::\d{2})?))?/);
5746
5756
  if (!n || n[1] === "0001-01-01") return "";
@@ -5748,81 +5758,81 @@ function _c(e, t) {
5748
5758
  let r = n[2].length === 5 ? `${n[2]}:00` : n[2];
5749
5759
  return `${n[1]}T${r}`;
5750
5760
  }
5751
- function vc(e, t, n) {
5761
+ function yc(e, t, n) {
5752
5762
  let r = { ...e };
5753
5763
  for (let e of n) {
5754
- if (!hc(e)) continue;
5764
+ if (!gc(e)) continue;
5755
5765
  let n = t[e.name];
5756
- typeof n == "string" && n !== "" && _c(n, gc(e)) === r[e.name] && (r[e.name] = n);
5766
+ typeof n == "string" && n !== "" && vc(n, _c(e)) === r[e.name] && (r[e.name] = n);
5757
5767
  }
5758
5768
  return r;
5759
5769
  }
5760
5770
  //#endregion
5761
5771
  //#region src/lib/label-match.ts
5762
- function yc(e, t, n) {
5772
+ function bc(e, t, n) {
5763
5773
  let r = e;
5764
5774
  return String(r.label ?? r[t] ?? "").toLowerCase().includes(n.toLowerCase());
5765
5775
  }
5766
5776
  //#endregion
5767
5777
  //#region src/components/ui/dialog.tsx
5768
- var bc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(G.Root, {
5778
+ var xc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(Pe.Root, {
5769
5779
  "data-slot": "dialog",
5770
5780
  ...e
5771
5781
  }));
5772
- bc.displayName = "Dialog";
5773
- var xc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(G.Trigger, {
5782
+ xc.displayName = "Dialog";
5783
+ var Sc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(Pe.Trigger, {
5774
5784
  "data-slot": "dialog-trigger",
5775
5785
  ...e
5776
5786
  }));
5777
- xc.displayName = "DialogTrigger";
5778
- var Sc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(G.Portal, {
5787
+ Sc.displayName = "DialogTrigger";
5788
+ var Cc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(Pe.Portal, {
5779
5789
  "data-slot": "dialog-portal",
5780
5790
  ...e
5781
5791
  }));
5782
- Sc.displayName = "DialogPortal";
5783
- var Cc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(G.Close, {
5792
+ Cc.displayName = "DialogPortal";
5793
+ var wc = e.forwardRef(({ ...e }, t) => /* @__PURE__ */ x(Pe.Close, {
5784
5794
  "data-slot": "dialog-close",
5785
5795
  ...e
5786
5796
  }));
5787
- Cc.displayName = "DialogClose";
5788
- var wc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(G.Overlay, {
5797
+ wc.displayName = "DialogClose";
5798
+ var Tc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(Pe.Overlay, {
5789
5799
  ref: n,
5790
5800
  "data-slot": "dialog-overlay",
5791
5801
  className: Y("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", e),
5792
5802
  ...t
5793
5803
  }));
5794
- wc.displayName = "DialogOverlay";
5795
- var Tc = e.forwardRef(({ className: e, children: t, showCloseButton: n = !0, ...r }, i) => /* @__PURE__ */ S(Sc, {
5804
+ Tc.displayName = "DialogOverlay";
5805
+ var Ec = e.forwardRef(({ className: e, children: t, showCloseButton: n = !0, ...r }, i) => /* @__PURE__ */ S(Cc, {
5796
5806
  "data-slot": "dialog-portal",
5797
- children: [/* @__PURE__ */ x(wc, {}), /* @__PURE__ */ S(G.Content, {
5807
+ children: [/* @__PURE__ */ x(Tc, {}), /* @__PURE__ */ S(Pe.Content, {
5798
5808
  ref: i,
5799
5809
  "data-slot": "dialog-content",
5800
5810
  className: Y("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg", e),
5801
5811
  ...r,
5802
- children: [t, n && /* @__PURE__ */ S(G.Close, {
5812
+ children: [t, n && /* @__PURE__ */ S(Pe.Close, {
5803
5813
  "data-slot": "dialog-close",
5804
5814
  className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
5805
- children: [/* @__PURE__ */ x(Ne, {}), /* @__PURE__ */ x("span", {
5815
+ children: [/* @__PURE__ */ x(Me, {}), /* @__PURE__ */ x("span", {
5806
5816
  className: "sr-only",
5807
5817
  children: "Close"
5808
5818
  })]
5809
5819
  })]
5810
5820
  })]
5811
5821
  }));
5812
- Tc.displayName = "DialogContent";
5813
- var Ec = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x("div", {
5822
+ Ec.displayName = "DialogContent";
5823
+ var Dc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x("div", {
5814
5824
  ref: n,
5815
5825
  "data-slot": "dialog-header",
5816
5826
  className: Y("flex flex-col gap-2 text-center sm:text-left", e),
5817
5827
  ...t
5818
5828
  }));
5819
- Ec.displayName = "DialogHeader";
5820
- var Dc = e.forwardRef(({ className: e, showCloseButton: t = !1, children: n, ...r }, i) => /* @__PURE__ */ S("div", {
5829
+ Dc.displayName = "DialogHeader";
5830
+ var Oc = e.forwardRef(({ className: e, showCloseButton: t = !1, children: n, ...r }, i) => /* @__PURE__ */ S("div", {
5821
5831
  ref: i,
5822
5832
  "data-slot": "dialog-footer",
5823
5833
  className: Y("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
5824
5834
  ...r,
5825
- children: [n, t && /* @__PURE__ */ x(G.Close, {
5835
+ children: [n, t && /* @__PURE__ */ x(Pe.Close, {
5826
5836
  asChild: !0,
5827
5837
  children: /* @__PURE__ */ x(Z, {
5828
5838
  variant: "outline",
@@ -5830,29 +5840,29 @@ var Dc = e.forwardRef(({ className: e, showCloseButton: t = !1, children: n, ...
5830
5840
  })
5831
5841
  })]
5832
5842
  }));
5833
- Dc.displayName = "DialogFooter";
5834
- var Oc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(G.Title, {
5843
+ Oc.displayName = "DialogFooter";
5844
+ var kc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(Pe.Title, {
5835
5845
  ref: n,
5836
5846
  "data-slot": "dialog-title",
5837
5847
  className: Y("text-lg leading-none font-semibold", e),
5838
5848
  ...t
5839
5849
  }));
5840
- Oc.displayName = "DialogTitle";
5841
- var kc = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(G.Description, {
5850
+ kc.displayName = "DialogTitle";
5851
+ var Ac = e.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ x(Pe.Description, {
5842
5852
  ref: n,
5843
5853
  "data-slot": "dialog-description",
5844
5854
  className: Y("text-sm text-muted-foreground", e),
5845
5855
  ...t
5846
5856
  }));
5847
- kc.displayName = "DialogDescription";
5857
+ Ac.displayName = "DialogDescription";
5848
5858
  //#endregion
5849
5859
  //#region src/components/ui/checkbox.tsx
5850
- function Ac({ className: e, ...t }) {
5851
- return /* @__PURE__ */ x(Pe.Root, {
5860
+ function jc({ className: e, ...t }) {
5861
+ return /* @__PURE__ */ x(Ne.Root, {
5852
5862
  "data-slot": "checkbox",
5853
5863
  className: Y("peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary", e),
5854
5864
  ...t,
5855
- children: /* @__PURE__ */ x(Pe.Indicator, {
5865
+ children: /* @__PURE__ */ x(Ne.Indicator, {
5856
5866
  "data-slot": "checkbox-indicator",
5857
5867
  className: "grid place-content-center text-current transition-none",
5858
5868
  children: /* @__PURE__ */ x(M, { className: "size-3.5" })
@@ -5861,7 +5871,7 @@ function Ac({ className: e, ...t }) {
5861
5871
  }
5862
5872
  //#endregion
5863
5873
  //#region src/components/ui/label.tsx
5864
- function jc({ className: e, ...t }) {
5874
+ function Mc({ className: e, ...t }) {
5865
5875
  return /* @__PURE__ */ x(Le.Root, {
5866
5876
  "data-slot": "label",
5867
5877
  className: Y("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", e),
@@ -5870,16 +5880,16 @@ function jc({ className: e, ...t }) {
5870
5880
  }
5871
5881
  //#endregion
5872
5882
  //#region src/components/confirm-dialog.tsx
5873
- function Mc({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i = "Confirm", cancelLabel: a = "Cancel", variant: o = "default", isPending: s = !1, onConfirm: c }) {
5874
- return /* @__PURE__ */ x(bc, {
5883
+ function Nc({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i = "Confirm", cancelLabel: a = "Cancel", variant: o = "default", isPending: s = !1, onConfirm: c }) {
5884
+ return /* @__PURE__ */ x(xc, {
5875
5885
  open: e,
5876
5886
  onOpenChange: t,
5877
- children: /* @__PURE__ */ S(Tc, {
5887
+ children: /* @__PURE__ */ S(Ec, {
5878
5888
  showCloseButton: !1,
5879
- children: [/* @__PURE__ */ S(Ec, { children: [/* @__PURE__ */ x(Oc, { children: n }), /* @__PURE__ */ x(kc, {
5889
+ children: [/* @__PURE__ */ S(Dc, { children: [/* @__PURE__ */ x(kc, { children: n }), /* @__PURE__ */ x(Ac, {
5880
5890
  asChild: !0,
5881
5891
  children: /* @__PURE__ */ x("div", { children: r })
5882
- })] }), /* @__PURE__ */ S(Dc, { children: [/* @__PURE__ */ x(Z, {
5892
+ })] }), /* @__PURE__ */ S(Oc, { children: [/* @__PURE__ */ x(Z, {
5883
5893
  variant: "outline",
5884
5894
  onClick: () => t(!1),
5885
5895
  disabled: s,
@@ -5895,12 +5905,12 @@ function Mc({ open: e, onOpenChange: t, title: n, description: r, confirmLabel:
5895
5905
  }
5896
5906
  //#endregion
5897
5907
  //#region src/components/content-editor.tsx
5898
- function Nc({ name: e, label: t, value: n, dbType: r, onChange: i, onBlur: a, required: o, invalid: s }) {
5908
+ function Pc({ name: e, label: t, value: n, dbType: r, onChange: i, onBlur: a, required: o, invalid: s }) {
5899
5909
  let l = li(r), d = fi(r), f = mi(n, r), [h, g] = m(null), _ = p(null), v = c(() => {
5900
5910
  let e = _.current;
5901
5911
  e && (e.style.height = "auto", e.style.height = Math.min(e.scrollHeight, 400) + "px");
5902
5912
  }, []);
5903
- return u(v, [n, v]), l ? /* @__PURE__ */ x(Pc, {
5913
+ return u(v, [n, v]), l ? /* @__PURE__ */ x(Fc, {
5904
5914
  name: e,
5905
5915
  label: t,
5906
5916
  value: n
@@ -5926,7 +5936,7 @@ function Nc({ name: e, label: t, value: n, dbType: r, onChange: i, onBlur: a, re
5926
5936
  g("Could not format XML");
5927
5937
  }
5928
5938
  },
5929
- children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Format"]
5939
+ children: [/* @__PURE__ */ x(Ae, { className: "size-3" }), "Format"]
5930
5940
  }), /* @__PURE__ */ x(Z, {
5931
5941
  type: "button",
5932
5942
  variant: "ghost",
@@ -5962,12 +5972,12 @@ function Nc({ name: e, label: t, value: n, dbType: r, onChange: i, onBlur: a, re
5962
5972
  ]
5963
5973
  });
5964
5974
  }
5965
- function Pc({ name: e, label: t, value: n }) {
5975
+ function Fc({ name: e, label: t, value: n }) {
5966
5976
  let r = n ? Math.ceil(n.length * 3 / 4) : 0, i = r < 1024 ? `${r} bytes` : r < 1048576 ? `${(r / 1024).toFixed(1)} KB` : `${(r / 1048576).toFixed(1)} MB`, a = n ? n.slice(0, 256) + (n.length > 256 ? "..." : "") : "(empty)", o = n ? _i(n) : null;
5967
5977
  return /* @__PURE__ */ S("div", {
5968
5978
  className: "grid gap-2",
5969
5979
  children: [
5970
- /* @__PURE__ */ S(jc, {
5980
+ /* @__PURE__ */ S(Mc, {
5971
5981
  htmlFor: e,
5972
5982
  className: "flex items-center gap-1.5",
5973
5983
  children: [
@@ -6003,23 +6013,23 @@ function Pc({ name: e, label: t, value: n }) {
6003
6013
  }
6004
6014
  //#endregion
6005
6015
  //#region src/data-edit.tsx
6006
- var Fc = ["Boolean", "Boolean!"], Ic = "__none__";
6007
- function Lc(e, t) {
6008
- return e == null || e === "" ? t ? Ic : "" : String(e);
6016
+ var Ic = ["Boolean", "Boolean!"], Lc = "__none__";
6017
+ function Rc(e, t) {
6018
+ return e == null || e === "" ? t ? Lc : "" : String(e);
6009
6019
  }
6010
- function Rc(e) {
6020
+ function zc(e) {
6011
6021
  return (t) => {
6012
6022
  t !== "" && e(t);
6013
6023
  };
6014
6024
  }
6015
- function zc(e, t) {
6016
- let n = ({ value: n }) => Js(e, n, t);
6025
+ function Bc(e, t) {
6026
+ let n = ({ value: n }) => Ys(e, n, t);
6017
6027
  return {
6018
6028
  onSubmit: n,
6019
6029
  onBlur: n
6020
6030
  };
6021
6031
  }
6022
- function Bc(e, t) {
6032
+ function Vc(e, t) {
6023
6033
  let n = e.state.meta.errors.length > 0;
6024
6034
  return {
6025
6035
  hasError: n,
@@ -6029,18 +6039,18 @@ function Bc(e, t) {
6029
6039
  }
6030
6040
  };
6031
6041
  }
6032
- function Vc(e) {
6042
+ function Hc(e) {
6033
6043
  return li(e.dbType) || fi(e.dbType) || di(e);
6034
6044
  }
6035
- var Hc = {
6045
+ var Uc = {
6036
6046
  filterText: "",
6037
6047
  variables: {},
6038
6048
  params: []
6039
6049
  };
6040
- function Uc(e, t) {
6050
+ function Wc(e, t) {
6041
6051
  return t !== "none" || (e.enumValues?.length ?? 0) > 0;
6042
6052
  }
6043
- function Wc(e, t) {
6053
+ function Gc(e, t) {
6044
6054
  return d(() => {
6045
6055
  let n = e?.data?.find((e) => e.graphQlName === t);
6046
6056
  if (!n) throw Error(`useTable: table '${t}' not found in schema`);
@@ -6068,12 +6078,12 @@ function Wc(e, t) {
6068
6078
  ];
6069
6079
  }, [e, t]);
6070
6080
  }
6071
- function Gc(e, t, n) {
6081
+ function Kc(e, t, n) {
6072
6082
  let r = St(), i = n === void 0 || n === "", a = d(() => i ? null : ri(n, e), [
6073
6083
  i,
6074
6084
  n,
6075
6085
  e
6076
- ]), o = d(() => i || !a ? Hc : ti(a, e) ?? Hc, [
6086
+ ]), o = d(() => i || !a ? Uc : ti(a, e) ?? Uc, [
6077
6087
  i,
6078
6088
  a,
6079
6089
  e
@@ -6104,9 +6114,9 @@ function Gc(e, t, n) {
6104
6114
  defaultValues: d(() => {
6105
6115
  let e = {};
6106
6116
  for (let { column: n, fkRole: r } of t) {
6107
- let t = Uc(n, r);
6108
- if (hc(n)) e[n.name] = _c(h[n.name], gc(n));
6109
- else if (Fc.some((e) => e === n.paramType)) {
6117
+ let t = Wc(n, r);
6118
+ if (gc(n)) e[n.name] = vc(h[n.name], _c(n));
6119
+ else if (Ic.some((e) => e === n.paramType)) {
6110
6120
  let t = h[n.name];
6111
6121
  e[n.name] = n.isNullable && t == null ? null : !!t;
6112
6122
  } else if (di(n)) {
@@ -6123,55 +6133,55 @@ function Gc(e, t, n) {
6123
6133
  recordNotFound: m
6124
6134
  };
6125
6135
  }
6126
- function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6127
- let i = n === void 0 || n === "", [a, o, s] = Wc(t, e), c = a.labelColumn, l = a.label, u = nc(a, o, s, n), { isLoading: d, error: f, value: p, defaultValues: h, pkResolveFailed: g, recordNotFound: _ } = Gc(a, o, n), v = Be({
6136
+ function qc({ table: e, schema: t, editId: n, onClose: r }) {
6137
+ let i = n === void 0 || n === "", [a, o, s] = Gc(t, e), c = a.labelColumn, l = a.label, u = rc(a, o, s, n), { isLoading: d, error: f, value: p, defaultValues: h, pkResolveFailed: g, recordNotFound: _ } = Kc(a, o, n), v = Be({
6128
6138
  defaultValues: h,
6129
6139
  onSubmit: async ({ value: e }) => {
6130
- let t = vc(e, p, o.map(({ column: e }) => e));
6140
+ let t = yc(e, p, o.map(({ column: e }) => e));
6131
6141
  await (i ? u.insert : u.update)(t), r();
6132
6142
  }
6133
6143
  }), y = Ve(v.store, (e) => e.isDirty), [b, w] = m(!1), T = () => {
6134
6144
  y ? w(!0) : r();
6135
6145
  };
6136
- if (d && !i) return /* @__PURE__ */ x(bc, {
6146
+ if (d && !i) return /* @__PURE__ */ x(xc, {
6137
6147
  open: !0,
6138
6148
  onOpenChange: (e) => {
6139
6149
  e || r();
6140
6150
  },
6141
- children: /* @__PURE__ */ S(Tc, {
6151
+ children: /* @__PURE__ */ S(Ec, {
6142
6152
  showCloseButton: !1,
6143
6153
  className: "sm:max-w-2xl",
6144
6154
  children: [
6145
- /* @__PURE__ */ x(Oc, {
6155
+ /* @__PURE__ */ x(kc, {
6146
6156
  className: "sr-only",
6147
6157
  children: "Loading record"
6148
6158
  }),
6149
- /* @__PURE__ */ x(kc, {
6159
+ /* @__PURE__ */ x(Ac, {
6150
6160
  className: "sr-only",
6151
6161
  children: "Loading record for editing"
6152
6162
  }),
6153
6163
  /* @__PURE__ */ S("div", {
6154
6164
  className: "flex items-center justify-center gap-2 py-10 text-sm text-muted-foreground",
6155
- children: [/* @__PURE__ */ x(pe, { className: "size-4 animate-spin" }), "Loading…"]
6165
+ children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin" }), "Loading…"]
6156
6166
  })
6157
6167
  ]
6158
6168
  })
6159
6169
  });
6160
6170
  if (f) return /* @__PURE__ */ S("div", { children: ["Error: ", f.message] });
6161
- if (g || _) return /* @__PURE__ */ x(bc, {
6171
+ if (g || _) return /* @__PURE__ */ x(xc, {
6162
6172
  open: !0,
6163
6173
  onOpenChange: (e) => {
6164
6174
  e || r();
6165
6175
  },
6166
- children: /* @__PURE__ */ S(Tc, {
6176
+ children: /* @__PURE__ */ S(Ec, {
6167
6177
  showCloseButton: !1,
6168
6178
  className: "sm:max-w-md",
6169
6179
  children: [
6170
- /* @__PURE__ */ x(Oc, {
6180
+ /* @__PURE__ */ x(kc, {
6171
6181
  className: "text-sm font-semibold",
6172
6182
  children: "Cannot edit record"
6173
6183
  }),
6174
- /* @__PURE__ */ S(kc, {
6184
+ /* @__PURE__ */ S(Ac, {
6175
6185
  className: "text-sm text-muted-foreground",
6176
6186
  children: [
6177
6187
  g ? `This record can't be opened for editing: its key (${n || "empty"}) is missing or malformed for the ${l} table.` : `No ${l} record matches the key ${n}. It may have been deleted or is no longer visible to you.`,
@@ -6191,13 +6201,13 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6191
6201
  ]
6192
6202
  })
6193
6203
  });
6194
- let E = p?.[c] ?? n, D = o.filter(({ column: e }) => Fc.some((t) => t === e.paramType)), O = o.filter(({ column: e }) => Vc(e)), k = o.filter(({ column: e }) => !Fc.some((t) => t === e.paramType) && !Vc(e));
6195
- return /* @__PURE__ */ S(bc, {
6204
+ let E = p?.[c] ?? n, D = o.filter(({ column: e }) => Ic.some((t) => t === e.paramType)), O = o.filter(({ column: e }) => Hc(e)), k = o.filter(({ column: e }) => !Ic.some((t) => t === e.paramType) && !Hc(e));
6205
+ return /* @__PURE__ */ S(xc, {
6196
6206
  open: !0,
6197
6207
  onOpenChange: (e) => {
6198
6208
  e || T();
6199
6209
  },
6200
- children: [/* @__PURE__ */ S(Tc, {
6210
+ children: [/* @__PURE__ */ S(Ec, {
6201
6211
  showCloseButton: !1,
6202
6212
  className: "sm:max-w-2xl max-h-[90vh] flex flex-col gap-0 p-0 overflow-hidden",
6203
6213
  children: [
@@ -6205,10 +6215,10 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6205
6215
  className: "flex items-center justify-between px-5 py-3 border-b border-border bg-muted/30 shrink-0",
6206
6216
  children: [/* @__PURE__ */ S("div", {
6207
6217
  className: "min-w-0",
6208
- children: [/* @__PURE__ */ x(Oc, {
6218
+ children: [/* @__PURE__ */ x(kc, {
6209
6219
  className: "text-sm font-semibold truncate",
6210
6220
  children: i ? `New ${l}` : `${l} : ${E}`
6211
- }), /* @__PURE__ */ S(kc, {
6221
+ }), /* @__PURE__ */ S(Ac, {
6212
6222
  className: "sr-only",
6213
6223
  children: [
6214
6224
  i ? "Create" : "Edit",
@@ -6224,7 +6234,7 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6224
6234
  onClick: T,
6225
6235
  "aria-label": "Close",
6226
6236
  className: "shrink-0 -mr-1",
6227
- children: /* @__PURE__ */ x(Me, { className: "size-4" })
6237
+ children: /* @__PURE__ */ x(je, { className: "size-4" })
6228
6238
  })]
6229
6239
  }),
6230
6240
  u.error && /* @__PURE__ */ S("div", {
@@ -6244,7 +6254,7 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6244
6254
  children: [
6245
6255
  k.length > 0 && /* @__PURE__ */ x("div", {
6246
6256
  className: "grid grid-cols-1 sm:grid-cols-2 gap-x-4 gap-y-3",
6247
- children: k.map(({ column: e, join: n, fkRole: r }) => /* @__PURE__ */ x(Zc, {
6257
+ children: k.map(({ column: e, join: n, fkRole: r }) => /* @__PURE__ */ x(Qc, {
6248
6258
  column: e,
6249
6259
  join: n,
6250
6260
  fkRole: r,
@@ -6256,7 +6266,7 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6256
6266
  className: k.length > 0 ? "mt-4 pt-4 border-t border-border" : "",
6257
6267
  children: /* @__PURE__ */ x("div", {
6258
6268
  className: "flex flex-wrap gap-x-6 gap-y-2",
6259
- children: D.map(({ column: e }) => /* @__PURE__ */ x(tl, {
6269
+ children: D.map(({ column: e }) => /* @__PURE__ */ x(nl, {
6260
6270
  column: e,
6261
6271
  form: v
6262
6272
  }, e.name))
@@ -6266,7 +6276,7 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6266
6276
  className: k.length > 0 || D.length > 0 ? "mt-4 pt-4 border-t border-border" : "",
6267
6277
  children: /* @__PURE__ */ x("div", {
6268
6278
  className: "grid gap-3",
6269
- children: O.map(({ column: e }) => /* @__PURE__ */ x(nl, {
6279
+ children: O.map(({ column: e }) => /* @__PURE__ */ x(rl, {
6270
6280
  column: e,
6271
6281
  form: v
6272
6282
  }, e.name))
@@ -6285,12 +6295,12 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6285
6295
  type: "submit",
6286
6296
  size: "sm",
6287
6297
  disabled: u.isPending,
6288
- children: [u.isPending ? /* @__PURE__ */ x(pe, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ x(we, { className: "size-3.5" }), i ? "Create" : "Save"]
6298
+ children: [u.isPending ? /* @__PURE__ */ x(fe, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ x(Ce, { className: "size-3.5" }), i ? "Create" : "Save"]
6289
6299
  })]
6290
6300
  })]
6291
6301
  })
6292
6302
  ]
6293
- }), /* @__PURE__ */ x(Mc, {
6303
+ }), /* @__PURE__ */ x(Nc, {
6294
6304
  open: b,
6295
6305
  onOpenChange: w,
6296
6306
  title: "Discard unsaved changes?",
@@ -6304,19 +6314,19 @@ function Kc({ table: e, schema: t, editId: n, onClose: r }) {
6304
6314
  })]
6305
6315
  });
6306
6316
  }
6307
- function qc() {
6317
+ function Jc() {
6308
6318
  let { table: e, editId: t } = it(), n = nt();
6309
6319
  if (!e) return /* @__PURE__ */ x("div", { children: "Table missing" });
6310
6320
  let r = t ? "../.." : "..";
6311
- return /* @__PURE__ */ x(Jc, {
6321
+ return /* @__PURE__ */ x(Yc, {
6312
6322
  table: e,
6313
6323
  editId: t ?? "",
6314
6324
  onClose: () => n(r)
6315
6325
  });
6316
6326
  }
6317
- function Jc({ table: e, editId: t, onClose: n }) {
6327
+ function Yc({ table: e, editId: t, onClose: n }) {
6318
6328
  let r = Mt();
6319
- return e ? r.loading ? /* @__PURE__ */ x("div", { children: "Loading..." }) : r.error ? /* @__PURE__ */ S("div", { children: ["Error: ", r.error.message] }) : r.findTable(e) ? /* @__PURE__ */ x(Kc, {
6329
+ return e ? r.loading ? /* @__PURE__ */ x("div", { children: "Loading..." }) : r.error ? /* @__PURE__ */ S("div", { children: ["Error: ", r.error.message] }) : r.findTable(e) ? /* @__PURE__ */ x(qc, {
6320
6330
  table: e,
6321
6331
  schema: r,
6322
6332
  editId: t,
@@ -6326,7 +6336,7 @@ function Jc({ table: e, editId: t, onClose: n }) {
6326
6336
  children: ["Table not found: ", e]
6327
6337
  }) : /* @__PURE__ */ x("div", { children: "Table missing" });
6328
6338
  }
6329
- function Yc({ current: e, max: t }) {
6339
+ function Xc({ current: e, max: t }) {
6330
6340
  let n = t - e;
6331
6341
  return /* @__PURE__ */ x("div", {
6332
6342
  className: "text-xs text-right mt-0.5",
@@ -6341,7 +6351,7 @@ function Yc({ current: e, max: t }) {
6341
6351
  })
6342
6352
  });
6343
6353
  }
6344
- function Xc({ min: e, max: t, step: n }) {
6354
+ function Zc({ min: e, max: t, step: n }) {
6345
6355
  if (e === void 0 && t === void 0) return null;
6346
6356
  let r = "";
6347
6357
  return e != null && t != null ? r = `Range: ${e} to ${t}` : e == null ? t != null && (r = `Max: ${t}`) : r = `Min: ${e}`, n != null && n !== 1 && (r += ` (step: ${n})`), /* @__PURE__ */ x("div", {
@@ -6350,32 +6360,32 @@ function Xc({ min: e, max: t, step: n }) {
6350
6360
  children: r
6351
6361
  });
6352
6362
  }
6353
- function Zc({ column: e, join: t, fkRole: n, form: r, schema: i }) {
6363
+ function Qc({ column: e, join: t, fkRole: n, form: r, schema: i }) {
6354
6364
  let a = e.name, o = !e.isNullable;
6355
6365
  if (n === "member-composite") return null;
6356
- let s = hc(e), c = Rr(e.paramType), l = e.maxLength && e.maxLength > 0 && !s && !c;
6357
- if (e.enumValues && e.enumValues.length > 0) return /* @__PURE__ */ x(Qc, {
6366
+ let s = gc(e), c = Rr(e.paramType), l = e.maxLength && e.maxLength > 0 && !s && !c;
6367
+ if (e.enumValues && e.enumValues.length > 0) return /* @__PURE__ */ x($c, {
6358
6368
  column: e,
6359
6369
  form: r,
6360
6370
  isRequired: o
6361
6371
  });
6362
- if (t && i) return x(n === "anchor-composite" ? ol : al, {
6372
+ if (t && i) return x(n === "anchor-composite" ? sl : ol, {
6363
6373
  column: e,
6364
6374
  join: t,
6365
6375
  form: r,
6366
6376
  schema: i,
6367
6377
  isRequired: o
6368
6378
  });
6369
- let u = zr(e.paramType), d = e.inputType || (s ? gc(e) ? "datetime-local" : "date" : u ? "text" : c ? "number" : "text"), f = u ? Lr(e.paramType) ? "numeric" : "decimal" : void 0, p = `${a}-error`;
6379
+ let u = zr(e.paramType), d = e.inputType || (s ? _c(e) ? "datetime-local" : "date" : u ? "text" : c ? "number" : "text"), f = u ? Lr(e.paramType) ? "numeric" : "decimal" : void 0, p = `${a}-error`;
6370
6380
  return /* @__PURE__ */ x(r.Field, {
6371
6381
  name: a,
6372
- validators: zc(e, o),
6382
+ validators: Bc(e, o),
6373
6383
  children: (t) => {
6374
- let { ariaProps: n } = Bc(t, p);
6384
+ let { ariaProps: n } = Vc(t, p);
6375
6385
  return /* @__PURE__ */ S("div", {
6376
6386
  className: "grid gap-1",
6377
6387
  children: [
6378
- /* @__PURE__ */ S(jc, {
6388
+ /* @__PURE__ */ S(Mc, {
6379
6389
  htmlFor: a,
6380
6390
  className: "text-xs text-muted-foreground",
6381
6391
  children: [e.label, o && /* @__PURE__ */ x("span", {
@@ -6401,16 +6411,16 @@ function Zc({ column: e, join: t, fkRole: n, form: r, schema: i }) {
6401
6411
  ...n,
6402
6412
  className: "h-8 text-sm"
6403
6413
  }),
6404
- l && /* @__PURE__ */ x(Yc, {
6414
+ l && /* @__PURE__ */ x(Xc, {
6405
6415
  current: String(t.state.value ?? "").length,
6406
6416
  max: e.maxLength
6407
6417
  }),
6408
- c && (e.min !== void 0 || e.max !== void 0) && /* @__PURE__ */ x(Xc, {
6418
+ c && (e.min !== void 0 || e.max !== void 0) && /* @__PURE__ */ x(Zc, {
6409
6419
  min: e.min,
6410
6420
  max: e.max,
6411
6421
  step: e.step
6412
6422
  }),
6413
- /* @__PURE__ */ x(sl, {
6423
+ /* @__PURE__ */ x(cl, {
6414
6424
  errors: t.state.meta.errors,
6415
6425
  id: p
6416
6426
  })
@@ -6419,17 +6429,17 @@ function Zc({ column: e, join: t, fkRole: n, form: r, schema: i }) {
6419
6429
  }
6420
6430
  });
6421
6431
  }
6422
- function Qc({ column: e, form: t, isRequired: n }) {
6432
+ function $c({ column: e, form: t, isRequired: n }) {
6423
6433
  let r = e.name, i = e.enumValues || [], a = Ea(e) ?? i, o = `${r}-error`;
6424
6434
  return /* @__PURE__ */ x(t.Field, {
6425
6435
  name: r,
6426
- validators: zc(e, n),
6436
+ validators: Bc(e, n),
6427
6437
  children: (t) => {
6428
- let { ariaProps: s } = Bc(t, o);
6438
+ let { ariaProps: s } = Vc(t, o);
6429
6439
  return /* @__PURE__ */ S("div", {
6430
6440
  className: "grid gap-1",
6431
6441
  children: [
6432
- /* @__PURE__ */ S(jc, {
6442
+ /* @__PURE__ */ S(Mc, {
6433
6443
  htmlFor: r,
6434
6444
  className: "text-xs text-muted-foreground",
6435
6445
  children: [e.label, n && /* @__PURE__ */ x("span", {
@@ -6438,8 +6448,8 @@ function Qc({ column: e, form: t, isRequired: n }) {
6438
6448
  })]
6439
6449
  }),
6440
6450
  /* @__PURE__ */ S(ho, {
6441
- value: Lc(t.state.value, !n),
6442
- onValueChange: Rc((e) => t.handleChange(e === "__none__" ? null : e)),
6451
+ value: Rc(t.state.value, !n),
6452
+ onValueChange: zc((e) => t.handleChange(e === "__none__" ? null : e)),
6443
6453
  children: [/* @__PURE__ */ x(_o, {
6444
6454
  id: r,
6445
6455
  className: "w-full h-8 text-sm",
@@ -6454,7 +6464,7 @@ function Qc({ column: e, form: t, isRequired: n }) {
6454
6464
  children: a[t] || e
6455
6465
  }, e))] })]
6456
6466
  }),
6457
- /* @__PURE__ */ x(sl, {
6467
+ /* @__PURE__ */ x(cl, {
6458
6468
  errors: t.state.meta.errors,
6459
6469
  id: o
6460
6470
  })
@@ -6463,38 +6473,38 @@ function Qc({ column: e, form: t, isRequired: n }) {
6463
6473
  }
6464
6474
  });
6465
6475
  }
6466
- var $c = "true", el = "false";
6467
- function tl({ column: e, form: t }) {
6476
+ var el = "true", tl = "false";
6477
+ function nl({ column: e, form: t }) {
6468
6478
  let n = e.name;
6469
6479
  return e.isNullable ? /* @__PURE__ */ x(t.Field, {
6470
6480
  name: n,
6471
6481
  children: (t) => {
6472
- let r = t.state.value, i = r == null ? Ic : r ? $c : el;
6482
+ let r = t.state.value, i = r == null ? Lc : r ? el : tl;
6473
6483
  return /* @__PURE__ */ S("div", {
6474
6484
  className: "grid gap-1 min-w-[10rem]",
6475
- children: [/* @__PURE__ */ x(jc, {
6485
+ children: [/* @__PURE__ */ x(Mc, {
6476
6486
  htmlFor: n,
6477
6487
  className: "text-xs text-muted-foreground",
6478
6488
  children: e.label
6479
6489
  }), /* @__PURE__ */ S(ho, {
6480
6490
  value: i,
6481
- onValueChange: Rc((e) => t.handleChange(e === "__none__" ? null : e === $c)),
6491
+ onValueChange: zc((e) => t.handleChange(e === "__none__" ? null : e === el)),
6482
6492
  children: [/* @__PURE__ */ x(_o, {
6483
6493
  id: n,
6484
6494
  className: "w-full h-8 text-sm",
6485
6495
  children: /* @__PURE__ */ x(go, {})
6486
6496
  }), /* @__PURE__ */ S(vo, { children: [
6487
6497
  /* @__PURE__ */ x(Q, {
6488
- value: Ic,
6498
+ value: Lc,
6489
6499
  className: "text-muted-foreground",
6490
6500
  children: "(unset)"
6491
6501
  }),
6492
6502
  /* @__PURE__ */ x(Q, {
6493
- value: $c,
6503
+ value: el,
6494
6504
  children: "Yes"
6495
6505
  }),
6496
6506
  /* @__PURE__ */ x(Q, {
6497
- value: el,
6507
+ value: tl,
6498
6508
  children: "No"
6499
6509
  })
6500
6510
  ] })]
@@ -6506,7 +6516,7 @@ function tl({ column: e, form: t }) {
6506
6516
  children: (t) => /* @__PURE__ */ S("label", {
6507
6517
  htmlFor: n,
6508
6518
  className: "flex items-center gap-2 cursor-pointer select-none",
6509
- children: [/* @__PURE__ */ x(Ac, {
6519
+ children: [/* @__PURE__ */ x(jc, {
6510
6520
  id: n,
6511
6521
  checked: !!t.state.value,
6512
6522
  onCheckedChange: (e) => t.handleChange(!!e),
@@ -6518,17 +6528,17 @@ function tl({ column: e, form: t }) {
6518
6528
  })
6519
6529
  });
6520
6530
  }
6521
- function nl({ column: e, form: t }) {
6531
+ function rl({ column: e, form: t }) {
6522
6532
  let n = e.name, r = !e.isNullable, i = `${n}-error`;
6523
6533
  return /* @__PURE__ */ x(t.Field, {
6524
6534
  name: n,
6525
- validators: zc(e, r),
6535
+ validators: Bc(e, r),
6526
6536
  children: (t) => {
6527
- let { hasError: a } = Bc(t, i);
6537
+ let { hasError: a } = Vc(t, i);
6528
6538
  return /* @__PURE__ */ S("div", {
6529
6539
  className: "grid gap-1",
6530
6540
  children: [
6531
- /* @__PURE__ */ S(jc, {
6541
+ /* @__PURE__ */ S(Mc, {
6532
6542
  htmlFor: n,
6533
6543
  className: "text-xs text-muted-foreground",
6534
6544
  children: [e.label, r && /* @__PURE__ */ x("span", {
@@ -6536,7 +6546,7 @@ function nl({ column: e, form: t }) {
6536
6546
  children: "*"
6537
6547
  })]
6538
6548
  }),
6539
- /* @__PURE__ */ x(Nc, {
6549
+ /* @__PURE__ */ x(Pc, {
6540
6550
  name: n,
6541
6551
  label: e.label,
6542
6552
  value: String(t.state.value ?? ""),
@@ -6546,7 +6556,7 @@ function nl({ column: e, form: t }) {
6546
6556
  required: r,
6547
6557
  invalid: a
6548
6558
  }),
6549
- /* @__PURE__ */ x(sl, {
6559
+ /* @__PURE__ */ x(cl, {
6550
6560
  errors: t.state.meta.errors,
6551
6561
  id: i
6552
6562
  })
@@ -6555,7 +6565,7 @@ function nl({ column: e, form: t }) {
6555
6565
  }
6556
6566
  });
6557
6567
  }
6558
- function rl() {
6568
+ function il() {
6559
6569
  let [e, t] = m(""), [n, r] = m(""), [i, a] = m(!1);
6560
6570
  return u(() => {
6561
6571
  let t = setTimeout(() => r(e), 300);
@@ -6570,12 +6580,12 @@ function rl() {
6570
6580
  }
6571
6581
  };
6572
6582
  }
6573
- function il({ field: e, column: t, isRequired: n, errorId: r, value: i, onValueChange: a, search: o, setSearch: s, onOpenChange: c, loadError: l, composite: u, children: d }) {
6574
- let { ariaProps: f } = Bc(e, r);
6583
+ function al({ field: e, column: t, isRequired: n, errorId: r, value: i, onValueChange: a, search: o, setSearch: s, onOpenChange: c, loadError: l, composite: u, children: d }) {
6584
+ let { ariaProps: f } = Vc(e, r);
6575
6585
  return /* @__PURE__ */ S("div", {
6576
6586
  className: u ? "grid gap-1 sm:col-span-2" : "grid gap-1",
6577
6587
  children: [
6578
- /* @__PURE__ */ S(jc, {
6588
+ /* @__PURE__ */ S(Mc, {
6579
6589
  htmlFor: t.name,
6580
6590
  className: "text-xs text-muted-foreground",
6581
6591
  children: [
@@ -6596,7 +6606,7 @@ function il({ field: e, column: t, isRequired: n, errorId: r, value: i, onValueC
6596
6606
  }),
6597
6607
  /* @__PURE__ */ S(ho, {
6598
6608
  value: i,
6599
- onValueChange: Rc(a),
6609
+ onValueChange: zc(a),
6600
6610
  onOpenChange: c,
6601
6611
  children: [/* @__PURE__ */ x(_o, {
6602
6612
  id: t.name,
@@ -6626,27 +6636,27 @@ function il({ field: e, column: t, isRequired: n, errorId: r, value: i, onValueC
6626
6636
  String(l?.message ?? l)
6627
6637
  ]
6628
6638
  }),
6629
- /* @__PURE__ */ x(sl, {
6639
+ /* @__PURE__ */ x(cl, {
6630
6640
  errors: e.state.meta.errors,
6631
6641
  id: r
6632
6642
  })
6633
6643
  ]
6634
6644
  });
6635
6645
  }
6636
- function al({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6637
- let a = e.name, o = t.destinationColumnNames[0], { search: s, setSearch: c, debounced: l, open: u, onOpenChange: d } = rl(), f = lc(r, t.destinationTable, o, l, u), p = Ve(n.store, (e) => e.values?.[a]), m = p == null || p === "" || f.data.some((e) => String(e.key) === String(p)), h = uc(r, t.destinationTable, o, !f.loading && !m ? p : null), g = `${a}-error`, _ = l.trim(), v = f.serverSearch || !_ ? f.data : f.data.filter((e) => yc(e, "key", _)), y = p == null || p === "" ? null : f.data.find((e) => String(e.key) === String(p)) ?? h.value ?? {
6646
+ function ol({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6647
+ let a = e.name, o = t.destinationColumnNames[0], { search: s, setSearch: c, debounced: l, open: u, onOpenChange: d } = il(), f = uc(r, t.destinationTable, o, l, u), p = Ve(n.store, (e) => e.values?.[a]), m = p == null || p === "" || f.data.some((e) => String(e.key) === String(p)), h = dc(r, t.destinationTable, o, !f.loading && !m ? p : null), g = `${a}-error`, _ = l.trim(), v = f.serverSearch || !_ ? f.data : f.data.filter((e) => bc(e, "key", _)), y = p == null || p === "" ? null : f.data.find((e) => String(e.key) === String(p)) ?? h.value ?? {
6638
6648
  key: String(p),
6639
6649
  label: String(p)
6640
6650
  };
6641
6651
  return /* @__PURE__ */ x(n.Field, {
6642
6652
  name: a,
6643
- validators: zc(e, i),
6644
- children: (t) => /* @__PURE__ */ S(il, {
6653
+ validators: Bc(e, i),
6654
+ children: (t) => /* @__PURE__ */ S(al, {
6645
6655
  field: t,
6646
6656
  column: e,
6647
6657
  isRequired: i,
6648
6658
  errorId: g,
6649
- value: Lc(t.state.value, !i),
6659
+ value: Rc(t.state.value, !i),
6650
6660
  onValueChange: (e) => t.handleChange(e === "__none__" ? null : e),
6651
6661
  search: s,
6652
6662
  setSearch: c,
@@ -6674,12 +6684,12 @@ function al({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6674
6684
  })
6675
6685
  });
6676
6686
  }
6677
- function ol({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6678
- let a = d(() => t.sourceColumnNames ?? [], [t.sourceColumnNames]), o = d(() => t.destinationColumnNames ?? [], [t.destinationColumnNames]), { search: s, setSearch: c, debounced: l, open: u, onOpenChange: f } = rl(), p = Ve(n.store, (e) => {
6687
+ function sl({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6688
+ let a = d(() => t.sourceColumnNames ?? [], [t.sourceColumnNames]), o = d(() => t.destinationColumnNames ?? [], [t.destinationColumnNames]), { search: s, setSearch: c, debounced: l, open: u, onOpenChange: f } = il(), p = Ve(n.store, (e) => {
6679
6689
  let t = {};
6680
6690
  for (let n = 0; n < a.length; n++) t[o[n]] = e.values?.[a[n]];
6681
6691
  return t;
6682
- }), m = pc(r, t.destinationTable, o, {
6692
+ }), m = mc(r, t.destinationTable, o, {
6683
6693
  search: l,
6684
6694
  enabled: u,
6685
6695
  currentValues: p
@@ -6704,8 +6714,8 @@ function ol({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6704
6714
  }, y = `${e.name}-error`;
6705
6715
  return /* @__PURE__ */ x(n.Field, {
6706
6716
  name: e.name,
6707
- validators: zc(e, i),
6708
- children: (t) => /* @__PURE__ */ S(il, {
6717
+ validators: Bc(e, i),
6718
+ children: (t) => /* @__PURE__ */ S(al, {
6709
6719
  field: t,
6710
6720
  column: e,
6711
6721
  isRequired: i,
@@ -6727,7 +6737,7 @@ function ol({ column: e, join: t, form: n, schema: r, isRequired: i }) {
6727
6737
  })
6728
6738
  });
6729
6739
  }
6730
- function sl({ errors: e, id: t }) {
6740
+ function cl({ errors: e, id: t }) {
6731
6741
  return e.length === 0 ? null : /* @__PURE__ */ x("div", {
6732
6742
  id: t,
6733
6743
  role: "alert",
@@ -6737,7 +6747,7 @@ function sl({ errors: e, id: t }) {
6737
6747
  }, t))
6738
6748
  });
6739
6749
  }
6740
- function cl({ className: e, ...t }) {
6750
+ function ll({ className: e, ...t }) {
6741
6751
  return /* @__PURE__ */ x("div", {
6742
6752
  "data-slot": "table-container",
6743
6753
  className: "relative w-full h-full overflow-x-auto",
@@ -6748,21 +6758,21 @@ function cl({ className: e, ...t }) {
6748
6758
  })
6749
6759
  });
6750
6760
  }
6751
- function ll({ className: e, ...t }) {
6761
+ function ul({ className: e, ...t }) {
6752
6762
  return /* @__PURE__ */ x("thead", {
6753
6763
  "data-slot": "table-header",
6754
6764
  className: Y("[&_tr]:border-b", e),
6755
6765
  ...t
6756
6766
  });
6757
6767
  }
6758
- function ul({ className: e, ...t }) {
6768
+ function dl({ className: e, ...t }) {
6759
6769
  return /* @__PURE__ */ x("tbody", {
6760
6770
  "data-slot": "table-body",
6761
6771
  className: Y("[&_tr:last-child]:border-0 [&_tr:nth-child(even)]:bg-muted/25", e),
6762
6772
  ...t
6763
6773
  });
6764
6774
  }
6765
- function dl({ className: e, style: t, ...n }) {
6775
+ function fl({ className: e, style: t, ...n }) {
6766
6776
  return /* @__PURE__ */ x("tr", {
6767
6777
  "data-slot": "table-row",
6768
6778
  className: Y("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted", e),
@@ -6773,7 +6783,7 @@ function dl({ className: e, style: t, ...n }) {
6773
6783
  ...n
6774
6784
  });
6775
6785
  }
6776
- function fl({ className: e, style: t, ...n }) {
6786
+ function pl({ className: e, style: t, ...n }) {
6777
6787
  return /* @__PURE__ */ x("th", {
6778
6788
  "data-slot": "table-head",
6779
6789
  className: Y("px-2 text-left align-middle font-medium whitespace-nowrap text-muted-foreground text-xs border-r border-border last:border-r-0 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", e),
@@ -6784,7 +6794,7 @@ function fl({ className: e, style: t, ...n }) {
6784
6794
  ...n
6785
6795
  });
6786
6796
  }
6787
- function pl({ className: e, ...t }) {
6797
+ function ml({ className: e, ...t }) {
6788
6798
  return /* @__PURE__ */ x("td", {
6789
6799
  "data-slot": "table-cell",
6790
6800
  className: Y("px-2 py-1 align-middle whitespace-nowrap text-[13px] overflow-hidden text-ellipsis border-r border-border last:border-r-0 [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", e),
@@ -6793,7 +6803,7 @@ function pl({ className: e, ...t }) {
6793
6803
  }
6794
6804
  //#endregion
6795
6805
  //#region src/components/row-actions.tsx
6796
- function ml({ anchorEl: e, onEdit: t, onDelete: n, onMouseEnter: r, onDismiss: i }) {
6806
+ function hl({ anchorEl: e, onEdit: t, onDelete: n, onMouseEnter: r, onDismiss: i }) {
6797
6807
  let a = p(null);
6798
6808
  return u(() => {
6799
6809
  let t = a.current;
@@ -6832,7 +6842,7 @@ function ml({ anchorEl: e, onEdit: t, onDelete: n, onMouseEnter: r, onDismiss: i
6832
6842
  "aria-label": "Edit row",
6833
6843
  title: "Edit",
6834
6844
  className: "size-6",
6835
- children: /* @__PURE__ */ x(be, { className: "size-3.5" })
6845
+ children: /* @__PURE__ */ x(ye, { className: "size-3.5" })
6836
6846
  }), n && /* @__PURE__ */ x(Z, {
6837
6847
  variant: "ghost",
6838
6848
  size: "icon-sm",
@@ -6840,13 +6850,13 @@ function ml({ anchorEl: e, onEdit: t, onDelete: n, onMouseEnter: r, onDismiss: i
6840
6850
  "aria-label": "Delete row",
6841
6851
  title: "Delete",
6842
6852
  className: "size-6 text-destructive hover:text-destructive",
6843
- children: /* @__PURE__ */ x(Oe, { className: "size-3.5" })
6853
+ children: /* @__PURE__ */ x(De, { className: "size-3.5" })
6844
6854
  })]
6845
6855
  });
6846
6856
  }
6847
6857
  //#endregion
6848
6858
  //#region src/components/export-button.tsx
6849
- function hl({ exportRows: e, total: t, tableName: n, rowCap: r = Ua }) {
6859
+ function gl({ exportRows: e, total: t, tableName: n, rowCap: r = Ua }) {
6850
6860
  let { toast: i } = $a(), a = Ja(), [o, s] = m(!1), [l, d] = m(0), f = p(null);
6851
6861
  u(() => () => f.current?.abort(), []);
6852
6862
  let h = c(async (c) => {
@@ -6883,7 +6893,7 @@ function hl({ exportRows: e, total: t, tableName: n, rowCap: r = Ua }) {
6883
6893
  onClick: g,
6884
6894
  title: "Cancel export",
6885
6895
  children: [
6886
- /* @__PURE__ */ x(Me, { className: "size-3.5" }),
6896
+ /* @__PURE__ */ x(je, { className: "size-3.5" }),
6887
6897
  "Cancel (",
6888
6898
  l.toLocaleString(),
6889
6899
  ")"
@@ -6894,7 +6904,7 @@ function hl({ exportRows: e, total: t, tableName: n, rowCap: r = Ua }) {
6894
6904
  variant: "outline",
6895
6905
  size: "sm",
6896
6906
  children: [
6897
- /* @__PURE__ */ x(ae, { className: "size-3.5" }),
6907
+ /* @__PURE__ */ x(V, { className: "size-3.5" }),
6898
6908
  "Export",
6899
6909
  /* @__PURE__ */ x(N, { className: "size-3.5" })
6900
6910
  ]
@@ -6910,31 +6920,31 @@ function hl({ exportRows: e, total: t, tableName: n, rowCap: r = Ua }) {
6910
6920
  })]
6911
6921
  })] });
6912
6922
  }
6913
- var gl = "bifrost-col-sizes:";
6914
- function _l(e) {
6923
+ var _l = "bifrost-col-sizes:";
6924
+ function vl(e) {
6915
6925
  try {
6916
- let t = localStorage.getItem(gl + e);
6917
- return t ? vl(JSON.parse(t)) : {};
6926
+ let t = localStorage.getItem(_l + e);
6927
+ return t ? yl(JSON.parse(t)) : {};
6918
6928
  } catch {
6919
6929
  return {};
6920
6930
  }
6921
6931
  }
6922
- function vl(e) {
6932
+ function yl(e) {
6923
6933
  if (typeof e != "object" || !e || Array.isArray(e)) return {};
6924
6934
  let t = {};
6925
6935
  for (let [n, r] of Object.entries(e)) typeof r != "number" || !Number.isFinite(r) || (t[n] = Math.min(Math.max(r, 60), 450));
6926
6936
  return t;
6927
6937
  }
6928
- function yl(e, t) {
6938
+ function bl(e, t) {
6929
6939
  try {
6930
- Object.keys(t).length === 0 ? localStorage.removeItem(gl + e) : localStorage.setItem(gl + e, JSON.stringify(t));
6940
+ Object.keys(t).length === 0 ? localStorage.removeItem(_l + e) : localStorage.setItem(_l + e, JSON.stringify(t));
6931
6941
  } catch {}
6932
6942
  }
6933
- function bl(e) {
6934
- let [t, n] = m(() => e ? _l(e) : {}), r = p(null), i = p(!0);
6943
+ function xl(e) {
6944
+ let [t, n] = m(() => e ? vl(e) : {}), r = p(null), i = p(!0);
6935
6945
  u(() => {
6936
6946
  let n = r.current;
6937
- if (n && n.tableName !== e && (r.current = null, yl(n.tableName, n.sizing)), !e) return;
6947
+ if (n && n.tableName !== e && (r.current = null, bl(n.tableName, n.sizing)), !e) return;
6938
6948
  if (i.current) {
6939
6949
  i.current = !1;
6940
6950
  return;
@@ -6944,71 +6954,71 @@ function bl(e) {
6944
6954
  sizing: t
6945
6955
  };
6946
6956
  let a = setTimeout(() => {
6947
- r.current = null, yl(e, t);
6957
+ r.current = null, bl(e, t);
6948
6958
  }, 300);
6949
6959
  return () => clearTimeout(a);
6950
6960
  }, [e, t]), u(() => () => {
6951
6961
  let e = r.current;
6952
- e && yl(e.tableName, e.sizing);
6962
+ e && bl(e.tableName, e.sizing);
6953
6963
  }, []);
6954
6964
  let a = p(e);
6955
- return e && e !== a.current && (a.current = e, i.current = !0, n(_l(e))), {
6965
+ return e && e !== a.current && (a.current = e, i.current = !0, n(vl(e))), {
6956
6966
  columnSizing: t,
6957
6967
  setColumnSizing: n
6958
6968
  };
6959
6969
  }
6960
6970
  //#endregion
6961
6971
  //#region src/hooks/useColumnVisibilityPersistence.ts
6962
- var xl = "bifrost-col-visibility:";
6963
- function Sl(e) {
6964
- return xl + e;
6965
- }
6972
+ var Sl = "bifrost-col-visibility:";
6966
6973
  function Cl(e) {
6974
+ return Sl + e;
6975
+ }
6976
+ function wl(e) {
6967
6977
  try {
6968
- let t = localStorage.getItem(Sl(e));
6969
- return t ? wl(JSON.parse(t)) : null;
6978
+ let t = localStorage.getItem(Cl(e));
6979
+ return t ? Tl(JSON.parse(t)) : null;
6970
6980
  } catch {
6971
6981
  return null;
6972
6982
  }
6973
6983
  }
6974
- function wl(e) {
6984
+ function Tl(e) {
6975
6985
  if (typeof e != "object" || !e || Array.isArray(e)) return null;
6976
6986
  let t = {};
6977
6987
  for (let [n, r] of Object.entries(e)) typeof r == "boolean" && (t[n] = r);
6978
6988
  return t;
6979
6989
  }
6980
- function Tl(e, t) {
6990
+ function El(e, t) {
6981
6991
  try {
6982
- localStorage.setItem(Sl(e), JSON.stringify(t));
6992
+ localStorage.setItem(Cl(e), JSON.stringify(t));
6983
6993
  } catch {}
6984
6994
  }
6985
- function El(e) {
6995
+ function Dl(e) {
6986
6996
  try {
6987
- localStorage.removeItem(Sl(e));
6997
+ localStorage.removeItem(Cl(e));
6988
6998
  } catch {}
6989
6999
  }
6990
- function Dl(e, t) {
7000
+ function Ol(e, t) {
6991
7001
  if (!t || t.length === 0) return {};
6992
7002
  let n = new Set(t), r = {};
6993
7003
  for (let t of e) r[t] = n.has(t);
6994
7004
  return r;
6995
7005
  }
6996
- function Ol(e, t) {
6997
- let [n, r] = m(() => (e ? Cl(e) : null) ?? t), i = p(n), a = c((e) => {
7006
+ function kl(e, t) {
7007
+ let [n, r] = m(() => (e ? wl(e) : null) ?? t), i = p(n), a = c((e) => {
6998
7008
  i.current = e, r(e);
6999
7009
  }, []), o = c((t) => {
7000
7010
  let n = typeof t == "function" ? t(i.current) : t;
7001
- a(n), e && Tl(e, n);
7011
+ a(n), e && El(e, n);
7002
7012
  }, [a, e]), s = c(() => {
7003
- e && El(e), a(t);
7013
+ e && Dl(e), a(t);
7004
7014
  }, [
7005
7015
  a,
7006
7016
  t,
7007
7017
  e
7008
7018
  ]), l = p(e);
7009
- e && e !== l.current && (l.current = e, a(Cl(e) ?? t));
7019
+ e && e !== l.current && (l.current = e, a(wl(e) ?? t));
7010
7020
  let u = p(t);
7011
- return e && u.current !== t && (u.current = t, Cl(e) === null && a(t)), {
7021
+ return e && u.current !== t && (u.current = t, wl(e) === null && a(t)), {
7012
7022
  columnVisibility: n,
7013
7023
  setColumnVisibility: o,
7014
7024
  resetColumnVisibility: s
@@ -7016,8 +7026,8 @@ function Ol(e, t) {
7016
7026
  }
7017
7027
  //#endregion
7018
7028
  //#region src/hooks/useRowHoverActions.ts
7019
- var kl = 500;
7020
- function Al() {
7029
+ var Al = 500;
7030
+ function jl() {
7021
7031
  let [e, t] = m(null), n = p(null), r = c((e, r) => {
7022
7032
  n.current &&= (clearTimeout(n.current), null), t({
7023
7033
  rowId: e,
@@ -7039,7 +7049,7 @@ function Al() {
7039
7049
  startPress: c((e, t, n) => {
7040
7050
  n.pointerType === "touch" && (s.current = !1, u(), o.current = setTimeout(() => {
7041
7051
  s.current || (l.current = !0, r(e, t));
7042
- }, kl));
7052
+ }, Al));
7043
7053
  }, [u, r]),
7044
7054
  onPressMove: c(() => {
7045
7055
  s.current = !0, u();
@@ -7049,13 +7059,13 @@ function Al() {
7049
7059
  }
7050
7060
  //#endregion
7051
7061
  //#region src/hooks/useFitMode.ts
7052
- function jl(e) {
7062
+ function Ml(e) {
7053
7063
  return Math.max(5, Math.floor((e - 32) / 40));
7054
7064
  }
7055
- function Ml(e, t) {
7065
+ function Nl(e, t) {
7056
7066
  let [n, r] = m(!0), i = p(0), a = c(() => {
7057
7067
  let t = e.current;
7058
- return t ? jl(t.clientHeight) : 10;
7068
+ return t ? Ml(t.clientHeight) : 10;
7059
7069
  }, [e]);
7060
7070
  return u(() => {
7061
7071
  if (!n) return;
@@ -7083,14 +7093,14 @@ function Ml(e, t) {
7083
7093
  }
7084
7094
  //#endregion
7085
7095
  //#region src/lib/column-order.ts
7086
- function Nl(e) {
7096
+ function Pl(e) {
7087
7097
  return e.id ?? ("accessorKey" in e ? String(e.accessorKey) : void 0);
7088
7098
  }
7089
- function Pl(e, t) {
7090
- return t.map((t) => e.find((e) => Nl(e) === t)).filter((e) => e !== void 0);
7099
+ function Fl(e, t) {
7100
+ return t.map((t) => e.find((e) => Pl(e) === t)).filter((e) => e !== void 0);
7091
7101
  }
7092
- function Fl(e, { leading: t, trailing: n }) {
7093
- let r = t ? Pl(e, t) : [], i = n ? Pl(e, n) : [];
7102
+ function Il(e, { leading: t, trailing: n }) {
7103
+ let r = t ? Fl(e, t) : [], i = n ? Fl(e, n) : [];
7094
7104
  if (r.length === 0 && i.length === 0) return e;
7095
7105
  let a = /* @__PURE__ */ new Set([...r, ...i]), o = e.filter((e) => !a.has(e));
7096
7106
  return [
@@ -7101,7 +7111,7 @@ function Fl(e, { leading: t, trailing: n }) {
7101
7111
  }
7102
7112
  //#endregion
7103
7113
  //#region src/components/grouped-grid-summary.tsx
7104
- function Il({ label: e, rows: t, loading: n, error: r, sumLabel: i, pageSize: a, sort: o, onSortChange: s, memberRequest: c }) {
7114
+ function Ll({ label: e, rows: t, loading: n, error: r, sumLabel: i, pageSize: a, sort: o, onSortChange: s, memberRequest: c }) {
7105
7115
  let l = St(), [d, f] = m(0), [p, h] = m(null), g = p === null ? null : c(p.value), _ = v({
7106
7116
  queryKey: [
7107
7117
  "groupMembers",
@@ -7236,16 +7246,16 @@ function Il({ label: e, rows: t, loading: n, error: r, sumLabel: i, pageSize: a,
7236
7246
  }
7237
7247
  //#endregion
7238
7248
  //#region src/components/data-table.tsx
7239
- var Ll = [
7249
+ var Rl = [
7240
7250
  10,
7241
7251
  20,
7242
7252
  30,
7243
7253
  50,
7244
7254
  100
7245
7255
  ];
7246
- function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pageSize: a, sorting: o, columnFilters: s, loading: l, fetching: f = !1, selectable: h = !1, primaryKeys: g = [], selectedRowId: _, onRowSelect: v, onSortingChange: y, onColumnFiltersChange: C, onPageIndexChange: w, onPageSizeChange: T, onEditRow: E, onDeleteRow: D, onDeleteSelected: O, onBulkEditSelected: k, inlineEditableColumns: A, inlineBooleanColumns: j, pendingEdits: M, onCellCommit: P, onSaveAllEdits: L, onDiscardAllEdits: ee, savingEdits: te = !1, stackingEnabled: z, onToggleStacking: ie, exportRows: B, totalRows: ae, onVisualize: V, groupableColumns: H, grouping: U, onGroupingChange: W, onGroupingSumChange: se }) {
7247
- let { hoveredRow: ce, hoverRow: le, scheduleDismiss: ue, cancelDismiss: de, suppressClick: fe, startPress: pe, onPressMove: me, cancelPress: he } = Al(), { defaultColumns: ge, trailingColumns: _e } = kt(), [ve, xe] = m({}), [Se, we] = m(null), { columnSizing: Te, setColumnSizing: Ee } = bl(n), De = p(null), { fitMode: ke, setFitMode: Ae, computeFitSize: je } = Ml(De, T), Me = c((e) => {
7248
- let t = De.current;
7256
+ function zl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pageSize: a, sorting: o, columnFilters: s, loading: l, fetching: f = !1, selectable: h = !1, primaryKeys: g = [], selectedRowId: _, onRowSelect: v, onSortingChange: y, onColumnFiltersChange: C, onPageIndexChange: w, onPageSizeChange: T, onEditRow: E, onDeleteRow: D, onDeleteSelected: O, onBulkEditSelected: k, inlineEditableColumns: A, inlineBooleanColumns: j, pendingEdits: M, onCellCommit: P, onSaveAllEdits: L, onDiscardAllEdits: ee, savingEdits: te = !1, stackingEnabled: z, onToggleStacking: ie, exportRows: B, totalRows: V, onVisualize: H, groupableColumns: ae, grouping: U, onGroupingChange: W, onGroupingSumChange: se }) {
7257
+ let { hoveredRow: G, hoverRow: ce, scheduleDismiss: le, cancelDismiss: ue, suppressClick: de, startPress: fe, onPressMove: pe, cancelPress: me } = jl(), { defaultColumns: he, trailingColumns: ge } = kt(), [_e, be] = m({}), [xe, Ce] = m(null), { columnSizing: we, setColumnSizing: Te } = xl(n), Ee = p(null), { fitMode: Oe, setFitMode: ke, computeFitSize: Ae } = Nl(Ee, T), je = c((e) => {
7258
+ let t = Ee.current;
7249
7259
  if (!t) return;
7250
7260
  let n = t.querySelectorAll(`[data-col-id="${e}"]`), r = 60;
7251
7261
  n.forEach((e) => {
@@ -7253,26 +7263,26 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7253
7263
  t > r && (r = t);
7254
7264
  });
7255
7265
  let i = Math.min(r, 450);
7256
- Ee((t) => ({
7266
+ Te((t) => ({
7257
7267
  ...t,
7258
7268
  [e]: i
7259
7269
  }));
7260
- }, [Ee]), Ne = c(() => {
7261
- Ee({});
7262
- }, [Ee]);
7270
+ }, [Te]), Me = c(() => {
7271
+ Te({});
7272
+ }, [Te]);
7263
7273
  u(() => {
7264
- xe({});
7274
+ be({});
7265
7275
  }, [t, i]);
7266
- let Pe = d(() => {
7276
+ let Ne = d(() => {
7267
7277
  let t = [];
7268
7278
  return h && t.push({
7269
7279
  id: "_select",
7270
- header: ({ table: e }) => /* @__PURE__ */ x(Ac, {
7280
+ header: ({ table: e }) => /* @__PURE__ */ x(jc, {
7271
7281
  checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
7272
7282
  onCheckedChange: (t) => e.toggleAllPageRowsSelected(!!t),
7273
7283
  "aria-label": "Select all"
7274
7284
  }),
7275
- cell: ({ row: e }) => /* @__PURE__ */ x(Ac, {
7285
+ cell: ({ row: e }) => /* @__PURE__ */ x(jc, {
7276
7286
  checked: e.getIsSelected(),
7277
7287
  onCheckedChange: (t) => e.toggleSelected(!!t),
7278
7288
  onClick: (e) => e.stopPropagation(),
@@ -7282,23 +7292,23 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7282
7292
  enableHiding: !1,
7283
7293
  enableResizing: !1,
7284
7294
  size: 32
7285
- }), t.push(...Fl(e, {
7286
- leading: n ? ge?.[n] : void 0,
7287
- trailing: _e
7295
+ }), t.push(...Il(e, {
7296
+ leading: n ? he?.[n] : void 0,
7297
+ trailing: ge
7288
7298
  })), t;
7289
7299
  }, [
7290
7300
  e,
7291
7301
  h,
7292
- ge,
7302
+ he,
7293
7303
  n,
7294
- _e
7295
- ]), { columnVisibility: G, setColumnVisibility: Fe, resetColumnVisibility: Ie } = Ol(n, d(() => Dl(Pe.filter((e) => e.enableHiding !== !1).map((e) => e.id).filter((e) => e !== void 0), n ? ge?.[n] : void 0), [
7296
- Pe,
7297
- ge,
7304
+ ge
7305
+ ]), { columnVisibility: Pe, setColumnVisibility: Fe, resetColumnVisibility: Ie } = kl(n, d(() => Ol(Ne.filter((e) => e.enableHiding !== !1).map((e) => e.id).filter((e) => e !== void 0), n ? he?.[n] : void 0), [
7306
+ Ne,
7307
+ he,
7298
7308
  n
7299
7309
  ])), Le = We({
7300
7310
  data: t,
7301
- columns: Pe,
7311
+ columns: Ne,
7302
7312
  pageCount: r,
7303
7313
  getRowId: (e, t) => $r(e, { primaryKeys: g }, t),
7304
7314
  state: {
@@ -7308,9 +7318,9 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7308
7318
  pageIndex: i,
7309
7319
  pageSize: a
7310
7320
  },
7311
- columnVisibility: G,
7312
- rowSelection: ve,
7313
- columnSizing: Te
7321
+ columnVisibility: Pe,
7322
+ rowSelection: _e,
7323
+ columnSizing: we
7314
7324
  },
7315
7325
  defaultColumn: {
7316
7326
  minSize: 60,
@@ -7318,8 +7328,8 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7318
7328
  },
7319
7329
  columnResizeMode: "onChange",
7320
7330
  enableColumnResizing: !0,
7321
- onColumnSizingChange: Ee,
7322
- meta: { onResetColumnWidths: Ne },
7331
+ onColumnSizingChange: Te,
7332
+ meta: { onResetColumnWidths: Me },
7323
7333
  onSortingChange: (e) => {
7324
7334
  y(typeof e == "function" ? e(o) : e);
7325
7335
  },
@@ -7334,13 +7344,13 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7334
7344
  C(typeof e == "function" ? e(s) : e);
7335
7345
  },
7336
7346
  onColumnVisibilityChange: Fe,
7337
- onRowSelectionChange: xe,
7347
+ onRowSelectionChange: be,
7338
7348
  enableRowSelection: h,
7339
7349
  getCoreRowModel: Ue(),
7340
7350
  manualSorting: !0,
7341
7351
  manualFiltering: !0,
7342
7352
  manualPagination: !0
7343
- }), Re = Object.keys(ve).length, ze = Le.getVisibleLeafColumns().map((e) => e.id).join("|"), Be = c(() => {
7353
+ }), Re = Object.keys(_e).length, ze = Le.getVisibleLeafColumns().map((e) => e.id).join("|"), Be = c(() => {
7344
7354
  let e = [];
7345
7355
  for (let t of Le.getSelectedRowModel().rows) {
7346
7356
  let n = ei(t.original, { primaryKeys: g });
@@ -7356,13 +7366,13 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7356
7366
  let e = Be();
7357
7367
  e.length > 0 && k(e);
7358
7368
  }, [Be, k]), Ke = c((e, t) => {
7359
- we({
7369
+ Ce({
7360
7370
  rowId: e,
7361
7371
  columnId: t
7362
7372
  });
7363
7373
  }, []), qe = c((e, t, n) => {
7364
- we(null), !te && P?.(e, t, n);
7365
- }, [P, te]), Je = c(() => we(null), []), Ye = c((e) => {
7374
+ Ce(null), !te && P?.(e, t, n);
7375
+ }, [P, te]), Je = c(() => Ce(null), []), Ye = c((e) => {
7366
7376
  let t = Le.getRow(e);
7367
7377
  return t ? ei(t.original, { primaryKeys: g }) : null;
7368
7378
  }, [Le, g]), Xe = c((e) => {
@@ -7374,10 +7384,10 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7374
7384
  let t = Ye(e);
7375
7385
  t && D(t);
7376
7386
  }, [D, Ye]), Qe = c(() => {
7377
- ce && Xe(ce.rowId);
7378
- }, [ce, Xe]), $e = c(() => {
7379
- ce && Ze(ce.rowId);
7380
- }, [ce, Ze]);
7387
+ G && Xe(G.rowId);
7388
+ }, [G, Xe]), $e = c(() => {
7389
+ G && Ze(G.rowId);
7390
+ }, [G, Ze]);
7381
7391
  return /* @__PURE__ */ S("div", {
7382
7392
  className: "flex flex-col w-full min-h-0 flex-1",
7383
7393
  children: [/* @__PURE__ */ S("div", {
@@ -7402,14 +7412,14 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7402
7412
  size: "sm",
7403
7413
  onClick: Ge,
7404
7414
  title: "Apply one set of field changes to every selected row in one transaction",
7405
- children: [/* @__PURE__ */ x(be, { className: "size-3.5" }), "Edit"]
7415
+ children: [/* @__PURE__ */ x(ye, { className: "size-3.5" }), "Edit"]
7406
7416
  }),
7407
7417
  O && /* @__PURE__ */ S(Z, {
7408
7418
  variant: "outline",
7409
7419
  size: "sm",
7410
7420
  onClick: Ve,
7411
7421
  className: "text-destructive hover:text-destructive",
7412
- children: [/* @__PURE__ */ x(Oe, { className: "size-3.5" }), "Delete"]
7422
+ children: [/* @__PURE__ */ x(De, { className: "size-3.5" }), "Delete"]
7413
7423
  })
7414
7424
  ] }),
7415
7425
  (M?.size ?? 0) > 0 && L && /* @__PURE__ */ S(b, { children: [
@@ -7439,16 +7449,16 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7439
7449
  }), /* @__PURE__ */ S("div", {
7440
7450
  className: "flex items-center gap-2",
7441
7451
  children: [
7442
- V && /* @__PURE__ */ x(Z, {
7452
+ H && /* @__PURE__ */ x(Z, {
7443
7453
  variant: "outline",
7444
7454
  size: "sm",
7445
- onClick: V,
7455
+ onClick: H,
7446
7456
  title: "Open a chart using this table and its active filters",
7447
7457
  children: "Visualize"
7448
7458
  }),
7449
- B && /* @__PURE__ */ x(hl, {
7459
+ B && /* @__PURE__ */ x(gl, {
7450
7460
  exportRows: B,
7451
- total: ae ?? 0,
7461
+ total: V ?? 0,
7452
7462
  tableName: n ?? "export"
7453
7463
  }),
7454
7464
  ie && /* @__PURE__ */ S(Z, {
@@ -7458,9 +7468,9 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7458
7468
  "aria-checked": !!z,
7459
7469
  onClick: () => ie(!z),
7460
7470
  title: z ? "Stacked drill-down active — click for flat grid" : "Flat grid active — click for stacked drill-down",
7461
- children: [x(z ? ye : Ce, { className: "size-3.5" }), z ? "Stacked" : "Grid"]
7471
+ children: [x(z ? ve : Se, { className: "size-3.5" }), z ? "Stacked" : "Grid"]
7462
7472
  }),
7463
- W && H && /* @__PURE__ */ S(ho, {
7473
+ W && ae && /* @__PURE__ */ S(ho, {
7464
7474
  value: U?.column.name ?? "__none",
7465
7475
  onValueChange: (e) => W(e === "__none" ? null : e),
7466
7476
  children: [/* @__PURE__ */ x(_o, {
@@ -7471,12 +7481,12 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7471
7481
  }), /* @__PURE__ */ S(vo, { children: [/* @__PURE__ */ x(Q, {
7472
7482
  value: "__none",
7473
7483
  children: "No grouping"
7474
- }), H.map((e) => /* @__PURE__ */ x(Q, {
7484
+ }), ae.map((e) => /* @__PURE__ */ x(Q, {
7475
7485
  value: e.name,
7476
7486
  children: e.label
7477
7487
  }, e.name))] })]
7478
7488
  }),
7479
- U && se && H && /* @__PURE__ */ S(ho, {
7489
+ U && se && ae && /* @__PURE__ */ S(ho, {
7480
7490
  value: U.sumColumn?.name ?? "__none",
7481
7491
  onValueChange: (e) => se(e === "__none" ? null : e),
7482
7492
  children: [/* @__PURE__ */ x(_o, {
@@ -7487,7 +7497,7 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7487
7497
  }), /* @__PURE__ */ S(vo, { children: [/* @__PURE__ */ x(Q, {
7488
7498
  value: "__none",
7489
7499
  children: "Count only"
7490
- }), H.filter((e) => /^(byte|short|int|long|float|double|decimal|numeric|money|real)/i.test(e.paramType.replace(/[![\]]/g, ""))).map((e) => /* @__PURE__ */ S(Q, {
7500
+ }), ae.filter((e) => /^(byte|short|int|long|float|double|decimal|numeric|money|real)/i.test(e.paramType.replace(/[![\]]/g, ""))).map((e) => /* @__PURE__ */ S(Q, {
7491
7501
  value: e.name,
7492
7502
  children: ["Sum ", e.label]
7493
7503
  }, e.name))] })]
@@ -7523,7 +7533,7 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7523
7533
  })] })
7524
7534
  ]
7525
7535
  })]
7526
- }), U ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Il, {
7536
+ }), U ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Ll, {
7527
7537
  label: U.column.label,
7528
7538
  rows: U.rows,
7529
7539
  loading: U.loading,
@@ -7552,42 +7562,42 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7552
7562
  })
7553
7563
  }),
7554
7564
  /* @__PURE__ */ S("div", {
7555
- ref: De,
7565
+ ref: Ee,
7556
7566
  className: "relative flex-1 overflow-auto min-h-0",
7557
7567
  "aria-busy": f || l,
7558
- children: [/* @__PURE__ */ S(cl, {
7568
+ children: [/* @__PURE__ */ S(ll, {
7559
7569
  style: {
7560
7570
  tableLayout: "fixed",
7561
7571
  width: Le.getTotalSize()
7562
7572
  },
7563
7573
  children: [
7564
7574
  /* @__PURE__ */ x("colgroup", { children: Le.getVisibleLeafColumns().map((e) => /* @__PURE__ */ x("col", { style: { width: e.getSize() } }, e.id)) }),
7565
- /* @__PURE__ */ x(ll, { children: Le.getHeaderGroups().map((e) => /* @__PURE__ */ x(dl, { children: e.headers.map((e) => /* @__PURE__ */ S(fl, {
7575
+ /* @__PURE__ */ x(ul, { children: Le.getHeaderGroups().map((e) => /* @__PURE__ */ x(fl, { children: e.headers.map((e) => /* @__PURE__ */ S(pl, {
7566
7576
  "data-col-id": e.column.id,
7567
7577
  className: "relative",
7568
7578
  "aria-sort": e.column.getIsSorted() === "asc" ? "ascending" : e.column.getIsSorted() === "desc" ? "descending" : e.column.getCanSort() ? "none" : void 0,
7569
7579
  children: [e.isPlaceholder ? null : He(e.column.columnDef.header, e.getContext()), e.column.getCanResize() && /* @__PURE__ */ x("div", {
7570
7580
  onMouseDown: e.getResizeHandler(),
7571
7581
  onTouchStart: e.getResizeHandler(),
7572
- onDoubleClick: () => Me(e.column.id),
7582
+ onDoubleClick: () => je(e.column.id),
7573
7583
  className: `absolute top-0 right-0 w-1 h-full cursor-col-resize select-none touch-none opacity-0 hover:opacity-100 transition-opacity ${e.column.getIsResizing() ? "bg-primary opacity-100" : "bg-border hover:bg-muted-foreground"}`
7574
7584
  })]
7575
7585
  }, e.id)) }, e.id)) }),
7576
- /* @__PURE__ */ x(ul, { children: l ? /* @__PURE__ */ x(dl, { children: /* @__PURE__ */ x(pl, {
7577
- colSpan: Pe.length,
7586
+ /* @__PURE__ */ x(dl, { children: l ? /* @__PURE__ */ x(fl, { children: /* @__PURE__ */ x(ml, {
7587
+ colSpan: Ne.length,
7578
7588
  className: "h-24 text-center",
7579
7589
  children: "Loading..."
7580
- }) }) : Le.getRowModel().rows.length === 0 ? /* @__PURE__ */ x(dl, { children: /* @__PURE__ */ x(pl, {
7581
- colSpan: Pe.length,
7590
+ }) }) : Le.getRowModel().rows.length === 0 ? /* @__PURE__ */ x(fl, { children: /* @__PURE__ */ x(ml, {
7591
+ colSpan: Ne.length,
7582
7592
  className: "h-24 text-center",
7583
7593
  children: "No results."
7584
- }) }) : Le.getRowModel().rows.map((e) => /* @__PURE__ */ x(Bl, {
7594
+ }) }) : Le.getRowModel().rows.map((e) => /* @__PURE__ */ x(Vl, {
7585
7595
  row: e,
7586
7596
  isSelected: _ != null && e.id === _,
7587
7597
  checked: e.getIsSelected(),
7588
7598
  visibleKey: ze,
7589
7599
  pending: M?.get(e.id),
7590
- editingColumnId: Se?.rowId === e.id ? Se.columnId : null,
7600
+ editingColumnId: xe?.rowId === e.id ? xe.columnId : null,
7591
7601
  inlineEditableColumns: P && !te ? A : void 0,
7592
7602
  inlineBooleanColumns: j,
7593
7603
  onStartEditCell: P && !te ? Ke : void 0,
@@ -7596,20 +7606,20 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7596
7606
  onRowSelect: v,
7597
7607
  onEditRow: E ? Xe : void 0,
7598
7608
  onDeleteRow: D ? Ze : void 0,
7599
- suppressClick: fe,
7600
- hoverRow: le,
7601
- scheduleDismiss: ue,
7602
- startPress: pe,
7603
- onPressMove: me,
7604
- cancelPress: he
7609
+ suppressClick: de,
7610
+ hoverRow: ce,
7611
+ scheduleDismiss: le,
7612
+ startPress: fe,
7613
+ onPressMove: pe,
7614
+ cancelPress: me
7605
7615
  }, e.id)) })
7606
7616
  ]
7607
- }), ce && (E || D) && /* @__PURE__ */ x(ml, {
7608
- anchorEl: ce.el,
7617
+ }), G && (E || D) && /* @__PURE__ */ x(hl, {
7618
+ anchorEl: G.el,
7609
7619
  onEdit: E ? Qe : void 0,
7610
7620
  onDelete: D ? $e : void 0,
7611
- onMouseEnter: de,
7612
- onDismiss: ue
7621
+ onMouseEnter: ue,
7622
+ onDismiss: le
7613
7623
  })]
7614
7624
  }),
7615
7625
  /* @__PURE__ */ S("div", {
@@ -7617,20 +7627,20 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7617
7627
  children: [/* @__PURE__ */ S("div", {
7618
7628
  className: "flex items-center gap-2 text-xs text-muted-foreground",
7619
7629
  children: [/* @__PURE__ */ x("span", { children: "Rows per page" }), /* @__PURE__ */ S(ho, {
7620
- value: ke ? "-1" : String(a),
7630
+ value: Oe ? "-1" : String(a),
7621
7631
  onValueChange: (e) => {
7622
7632
  let t = Number(e);
7623
- t === -1 ? (Ae(!0), T(je())) : (Ae(!1), T(t));
7633
+ t === -1 ? (ke(!0), T(Ae())) : (ke(!1), T(t));
7624
7634
  },
7625
7635
  children: [/* @__PURE__ */ x(_o, {
7626
7636
  size: "sm",
7627
7637
  className: "w-auto h-7 text-xs",
7628
7638
  "aria-label": "Rows per page",
7629
- children: /* @__PURE__ */ x(go, { children: ke ? "Fit" : a })
7639
+ children: /* @__PURE__ */ x(go, { children: Oe ? "Fit" : a })
7630
7640
  }), /* @__PURE__ */ S(vo, { children: [/* @__PURE__ */ x(Q, {
7631
7641
  value: "-1",
7632
7642
  children: "Fit"
7633
- }), Ll.map((e) => /* @__PURE__ */ x(Q, {
7643
+ }), Rl.map((e) => /* @__PURE__ */ x(Q, {
7634
7644
  value: String(e),
7635
7645
  children: e
7636
7646
  }, e))] })]
@@ -7689,9 +7699,9 @@ function Rl({ columns: e, data: t, tableName: n, pageCount: r, pageIndex: i, pag
7689
7699
  ] })]
7690
7700
  });
7691
7701
  }
7692
- function zl({ row: e, isSelected: t, checked: n, pending: r, editingColumnId: i, inlineEditableColumns: a, inlineBooleanColumns: o, onStartEditCell: s, onCommitCell: c, onCancelEditCell: l, onRowSelect: u, onEditRow: d, onDeleteRow: f, suppressClick: p, hoverRow: m, scheduleDismiss: h, startPress: g, onPressMove: _, cancelPress: v }) {
7702
+ function Bl({ row: e, isSelected: t, checked: n, pending: r, editingColumnId: i, inlineEditableColumns: a, inlineBooleanColumns: o, onStartEditCell: s, onCommitCell: c, onCancelEditCell: l, onRowSelect: u, onEditRow: d, onDeleteRow: f, suppressClick: p, hoverRow: m, scheduleDismiss: h, startPress: g, onPressMove: _, cancelPress: v }) {
7693
7703
  let y = !!(u || d || f);
7694
- return /* @__PURE__ */ x(dl, {
7704
+ return /* @__PURE__ */ x(fl, {
7695
7705
  "data-state": t || n ? "selected" : void 0,
7696
7706
  className: u ? "cursor-pointer group/row focus-visible:outline-2 focus-visible:outline-primary" : "group/row focus-visible:outline-2 focus-visible:outline-primary",
7697
7707
  tabIndex: y ? 0 : void 0,
@@ -7723,13 +7733,13 @@ function zl({ row: e, isSelected: t, checked: n, pending: r, editingColumnId: i,
7723
7733
  onPointerCancel: v,
7724
7734
  children: e.getVisibleCells().map((t) => {
7725
7735
  let n = t.column.id, u = !!s && !!a?.has(n), d = i === n, f = !!r && n in r;
7726
- return /* @__PURE__ */ x(pl, {
7736
+ return /* @__PURE__ */ x(ml, {
7727
7737
  "data-col-id": n,
7728
7738
  "data-dirty": f ? "true" : void 0,
7729
7739
  className: f ? "bg-amber-500/10 border-l-2 border-l-amber-500" : void 0,
7730
7740
  title: u && !d ? "Double-click to edit" : void 0,
7731
7741
  onDoubleClick: u && !d ? () => s(e.id, n) : void 0,
7732
- children: d && c && l ? /* @__PURE__ */ x(Vl, {
7742
+ children: d && c && l ? /* @__PURE__ */ x(Hl, {
7733
7743
  initialValue: f ? r[n] : e.original[n],
7734
7744
  boolean: !!o?.has(n),
7735
7745
  onCommit: (t) => c(e.id, n, t),
@@ -7742,8 +7752,8 @@ function zl({ row: e, isSelected: t, checked: n, pending: r, editingColumnId: i,
7742
7752
  })
7743
7753
  });
7744
7754
  }
7745
- var Bl = s(zl);
7746
- function Vl({ initialValue: e, boolean: t, onCommit: n, onCancel: r }) {
7755
+ var Vl = s(Bl);
7756
+ function Hl({ initialValue: e, boolean: t, onCommit: n, onCancel: r }) {
7747
7757
  let [i, a] = m(e == null ? "" : String(e));
7748
7758
  return t ? /* @__PURE__ */ x("input", {
7749
7759
  type: "checkbox",
@@ -7771,8 +7781,8 @@ function Vl({ initialValue: e, boolean: t, onCommit: n, onCancel: r }) {
7771
7781
  }
7772
7782
  //#endregion
7773
7783
  //#region src/components/bulk-edit-dialog.tsx
7774
- function Hl({ table: e, pks: t, onClose: n }) {
7775
- let r = St(), { toast: i } = $a(), a = Ls(e), [o, s] = m({}), [c, l] = m(null), [u, f] = m(!1), p = d(() => e.columns.filter((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !li(e.dbType)), [e]), h = d(() => e.columns.some((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !e.isNullable && li(e.dbType)), [e]), g = d(() => {
7784
+ function Ul({ table: e, pks: t, onClose: n }) {
7785
+ let r = St(), { toast: i } = $a(), a = Rs(e), [o, s] = m({}), [c, l] = m(null), [u, f] = m(!1), p = d(() => e.columns.filter((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !li(e.dbType)), [e]), h = d(() => e.columns.some((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !e.isNullable && li(e.dbType)), [e]), g = d(() => {
7776
7786
  let t = new Map(e.columns.map((e) => [e.name, e]));
7777
7787
  return (e.primaryKeys ?? []).map((e) => t.get(e)).filter((e) => !!e);
7778
7788
  }, [e]), _ = p.filter((e) => o[e.name]?.enabled), v = u || a.isPending, y = (e, t) => s((n) => {
@@ -7792,21 +7802,21 @@ function Hl({ table: e, pks: t, onClose: n }) {
7792
7802
  let t = o[e.name];
7793
7803
  return t.setNull ? null : e.paramType.startsWith("Boolean") ? t.value === "true" : t.value;
7794
7804
  };
7795
- return /* @__PURE__ */ x(bc, {
7805
+ return /* @__PURE__ */ x(xc, {
7796
7806
  open: !0,
7797
7807
  onOpenChange: (e) => {
7798
7808
  !e && !v && n();
7799
7809
  },
7800
- children: /* @__PURE__ */ S(Tc, {
7810
+ children: /* @__PURE__ */ S(Ec, {
7801
7811
  showCloseButton: !1,
7802
7812
  className: "max-w-lg",
7803
7813
  children: [
7804
- /* @__PURE__ */ S(Ec, { children: [/* @__PURE__ */ S(Oc, { children: [
7814
+ /* @__PURE__ */ S(Dc, { children: [/* @__PURE__ */ S(kc, { children: [
7805
7815
  "Edit ",
7806
7816
  t.length,
7807
7817
  " ",
7808
7818
  t.length === 1 ? "row" : "rows"
7809
- ] }), /* @__PURE__ */ x(kc, { children: "Chosen fields are applied to every selected row and saved in one transaction — if any row fails, nothing changes." })] }),
7819
+ ] }), /* @__PURE__ */ x(Ac, { children: "Chosen fields are applied to every selected row and saved in one transaction — if any row fails, nothing changes." })] }),
7810
7820
  h ? /* @__PURE__ */ x("p", {
7811
7821
  className: "text-sm text-destructive",
7812
7822
  children: "This table has a required binary column, which bulk edit cannot echo. Edit rows individually."
@@ -7821,12 +7831,12 @@ function Hl({ table: e, pks: t, onClose: n }) {
7821
7831
  return /* @__PURE__ */ S("div", {
7822
7832
  className: "flex items-center gap-2",
7823
7833
  children: [
7824
- /* @__PURE__ */ x(Ac, {
7834
+ /* @__PURE__ */ x(jc, {
7825
7835
  id: `bulk-${e.name}`,
7826
7836
  checked: t.enabled,
7827
7837
  onCheckedChange: (t) => y(e.name, { enabled: t === !0 })
7828
7838
  }),
7829
- /* @__PURE__ */ x(jc, {
7839
+ /* @__PURE__ */ x(Mc, {
7830
7840
  htmlFor: `bulk-${e.name}`,
7831
7841
  className: "w-40 truncate",
7832
7842
  title: e.label ?? e.name,
@@ -7852,7 +7862,7 @@ function Hl({ table: e, pks: t, onClose: n }) {
7852
7862
  }),
7853
7863
  e.isNullable && /* @__PURE__ */ S("label", {
7854
7864
  className: "flex items-center gap-1 text-xs text-muted-foreground",
7855
- children: [/* @__PURE__ */ x(Ac, {
7865
+ children: [/* @__PURE__ */ x(jc, {
7856
7866
  checked: t.setNull,
7857
7867
  disabled: !t.enabled,
7858
7868
  onCheckedChange: (t) => y(e.name, { setNull: t === !0 })
@@ -7866,7 +7876,7 @@ function Hl({ table: e, pks: t, onClose: n }) {
7866
7876
  className: "text-sm text-destructive",
7867
7877
  children: c
7868
7878
  }),
7869
- /* @__PURE__ */ S(Dc, { children: [/* @__PURE__ */ x(Z, {
7879
+ /* @__PURE__ */ S(Oc, { children: [/* @__PURE__ */ x(Z, {
7870
7880
  variant: "outline",
7871
7881
  onClick: n,
7872
7882
  disabled: v,
@@ -7885,7 +7895,7 @@ function Hl({ table: e, pks: t, onClose: n }) {
7885
7895
  if (!s) throw Error("The selected rows have no resolvable primary keys.");
7886
7896
  let c = (await r.query(s.query, s.variables))?.value?.data ?? [];
7887
7897
  if (c.length !== t.length) throw Error(`Only ${c.length} of ${t.length} selected rows still exist. Refresh and retry.`);
7888
- let l = ec(e, o, g, c, i);
7898
+ let l = tc(e, o, g, c, i);
7889
7899
  await a.saveDelta({ updated: l }), n();
7890
7900
  } catch (e) {
7891
7901
  let t = e.message ?? String(e);
@@ -7903,56 +7913,56 @@ function Hl({ table: e, pks: t, onClose: n }) {
7903
7913
  }
7904
7914
  //#endregion
7905
7915
  //#region src/components/ui/sheet.tsx
7906
- function Ul({ ...e }) {
7907
- return /* @__PURE__ */ x(G.Root, {
7916
+ function Wl({ ...e }) {
7917
+ return /* @__PURE__ */ x(Pe.Root, {
7908
7918
  "data-slot": "sheet",
7909
7919
  ...e
7910
7920
  });
7911
7921
  }
7912
- function Wl({ ...e }) {
7913
- return /* @__PURE__ */ x(G.Portal, {
7922
+ function Gl({ ...e }) {
7923
+ return /* @__PURE__ */ x(Pe.Portal, {
7914
7924
  "data-slot": "sheet-portal",
7915
7925
  ...e
7916
7926
  });
7917
7927
  }
7918
- function Gl({ className: e, ...t }) {
7919
- return /* @__PURE__ */ x(G.Overlay, {
7928
+ function Kl({ className: e, ...t }) {
7929
+ return /* @__PURE__ */ x(Pe.Overlay, {
7920
7930
  "data-slot": "sheet-overlay",
7921
7931
  className: Y("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0", e),
7922
7932
  ...t
7923
7933
  });
7924
7934
  }
7925
- function Kl({ className: e, children: t, side: n = "right", ...r }) {
7926
- return /* @__PURE__ */ S(Wl, { children: [/* @__PURE__ */ x(Gl, {}), /* @__PURE__ */ S(G.Content, {
7935
+ function ql({ className: e, children: t, side: n = "right", ...r }) {
7936
+ return /* @__PURE__ */ S(Gl, { children: [/* @__PURE__ */ x(Kl, {}), /* @__PURE__ */ S(Pe.Content, {
7927
7937
  "data-slot": "sheet-content",
7928
7938
  className: Y("fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out duration-200 outline-none", "data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:duration-200 data-[state=open]:duration-200", n === "right" && "inset-y-0 right-0 h-full w-3/4 max-w-md border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right", n === "left" && "inset-y-0 left-0 h-full w-3/4 max-w-md border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left", n === "top" && "inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top", n === "bottom" && "inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom", e),
7929
7939
  ...r,
7930
- children: [t, /* @__PURE__ */ S(G.Close, {
7940
+ children: [t, /* @__PURE__ */ S(Pe.Close, {
7931
7941
  "data-slot": "sheet-close",
7932
7942
  className: "absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
7933
- children: [/* @__PURE__ */ x(Ne, {}), /* @__PURE__ */ x("span", {
7943
+ children: [/* @__PURE__ */ x(Me, {}), /* @__PURE__ */ x("span", {
7934
7944
  className: "sr-only",
7935
7945
  children: "Close"
7936
7946
  })]
7937
7947
  })]
7938
7948
  })] });
7939
7949
  }
7940
- function ql({ className: e, ...t }) {
7950
+ function Jl({ className: e, ...t }) {
7941
7951
  return /* @__PURE__ */ x("div", {
7942
7952
  "data-slot": "sheet-header",
7943
7953
  className: Y("flex flex-col gap-2 p-4 pb-0", e),
7944
7954
  ...t
7945
7955
  });
7946
7956
  }
7947
- function Jl({ className: e, ...t }) {
7948
- return /* @__PURE__ */ x(G.Title, {
7957
+ function Yl({ className: e, ...t }) {
7958
+ return /* @__PURE__ */ x(Pe.Title, {
7949
7959
  "data-slot": "sheet-title",
7950
7960
  className: Y("text-lg leading-none font-semibold", e),
7951
7961
  ...t
7952
7962
  });
7953
7963
  }
7954
- function Yl({ className: e, ...t }) {
7955
- return /* @__PURE__ */ x(G.Description, {
7964
+ function Xl({ className: e, ...t }) {
7965
+ return /* @__PURE__ */ x(Pe.Description, {
7956
7966
  "data-slot": "sheet-description",
7957
7967
  className: Y("text-sm text-muted-foreground", e),
7958
7968
  ...t
@@ -7960,14 +7970,14 @@ function Yl({ className: e, ...t }) {
7960
7970
  }
7961
7971
  //#endregion
7962
7972
  //#region src/components/content-panel.tsx
7963
- var Xl = {
7973
+ var Zl = {
7964
7974
  json: O,
7965
7975
  xml: z,
7966
7976
  "php-serialized": B,
7967
7977
  binary: D,
7968
7978
  longtext: U,
7969
7979
  text: U
7970
- }, Zl = {
7980
+ }, Ql = {
7971
7981
  json: "JSON",
7972
7982
  xml: "XML",
7973
7983
  "php-serialized": "PHP Serialized",
@@ -7975,7 +7985,7 @@ var Xl = {
7975
7985
  longtext: "Text",
7976
7986
  text: "Text"
7977
7987
  };
7978
- function Ql(e, t) {
7988
+ function $l(e, t) {
7979
7989
  if (t === "json") try {
7980
7990
  return JSON.stringify(JSON.parse(e), null, 2);
7981
7991
  } catch {
@@ -7983,8 +7993,8 @@ function Ql(e, t) {
7983
7993
  }
7984
7994
  return t === "xml" ? e.replace(/>\s*</g, ">\n<").trim() : e;
7985
7995
  }
7986
- function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev: i, canNavigateNext: a }) {
7987
- let { toast: o } = $a(), [s, l] = m(!1), [d, f] = m(!1), [h, g] = m(""), [_, v] = m(!1), [y, C] = m(!1), w = p(null), T = e?.value ?? "", E = mi(T, e?.dbType), D = Xl[E], O = Ql(T, E), k = E === "binary" && T ? _i(T) : null, j = c(() => {
7996
+ function eu({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev: i, canNavigateNext: a }) {
7997
+ let { toast: o } = $a(), [s, l] = m(!1), [d, f] = m(!1), [h, g] = m(""), [_, v] = m(!1), [y, C] = m(!1), w = p(null), T = e?.value ?? "", E = mi(T, e?.dbType), D = Zl[E], O = $l(T, E), k = E === "binary" && T ? _i(T) : null, j = c(() => {
7988
7998
  !e || !k || qa(T, `${e.columnName}${k.extension}`, k.mime);
7989
7999
  }, [
7990
8000
  e,
@@ -8055,7 +8065,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8055
8065
  }),
8056
8066
  /* @__PURE__ */ x("span", {
8057
8067
  className: "text-xs text-muted-foreground shrink-0",
8058
- children: k ? k.kind === "image" ? k.mime.replace("image/", "").toUpperCase() + " image" : k.kind === "pdf" ? "PDF document" : Zl[E] : Zl[E]
8068
+ children: k ? k.kind === "image" ? k.mime.replace("image/", "").toUpperCase() + " image" : k.kind === "pdf" ? "PDF document" : Ql[E] : Ql[E]
8059
8069
  }),
8060
8070
  /* @__PURE__ */ x("span", {
8061
8071
  className: "text-xs text-muted-foreground shrink-0",
@@ -8079,7 +8089,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8079
8089
  size: "sm",
8080
8090
  className: "h-7 text-xs px-2",
8081
8091
  onClick: j,
8082
- children: [/* @__PURE__ */ x(ae, { className: "size-3" }), "Download"]
8092
+ children: [/* @__PURE__ */ x(V, { className: "size-3" }), "Download"]
8083
8093
  }),
8084
8094
  R && !d && /* @__PURE__ */ S(Z, {
8085
8095
  type: "button",
@@ -8087,7 +8097,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8087
8097
  size: "sm",
8088
8098
  className: "h-7 text-xs px-2",
8089
8099
  onClick: F,
8090
- children: [/* @__PURE__ */ x(be, { className: "size-3" }), "Edit"]
8100
+ children: [/* @__PURE__ */ x(ye, { className: "size-3" }), "Edit"]
8091
8101
  }),
8092
8102
  d && ne && /* @__PURE__ */ S(Z, {
8093
8103
  type: "button",
@@ -8095,7 +8105,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8095
8105
  size: "sm",
8096
8106
  className: "h-7 text-xs px-2",
8097
8107
  onClick: te,
8098
- children: [/* @__PURE__ */ x(je, { className: "size-3" }), "Format"]
8108
+ children: [/* @__PURE__ */ x(Ae, { className: "size-3" }), "Format"]
8099
8109
  }),
8100
8110
  /* @__PURE__ */ S("div", {
8101
8111
  className: "flex items-center gap-1 ml-auto",
@@ -8127,7 +8137,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8127
8137
  onClick: () => l((e) => !e),
8128
8138
  "aria-label": s ? "Exit full screen" : "Full screen",
8129
8139
  title: s ? "Exit full screen" : "Full screen",
8130
- children: x(s ? he : me, { className: "size-4" })
8140
+ children: x(s ? me : pe, { className: "size-4" })
8131
8141
  })
8132
8142
  ]
8133
8143
  })
@@ -8176,17 +8186,17 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8176
8186
  className: "text-xs font-mono leading-relaxed whitespace-pre-wrap break-all",
8177
8187
  children: O
8178
8188
  })
8179
- }), V = !!e;
8180
- return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Ul, {
8181
- open: V && !s,
8189
+ }), H = !!e;
8190
+ return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Wl, {
8191
+ open: H && !s,
8182
8192
  onOpenChange: (e) => {
8183
8193
  e || t();
8184
8194
  },
8185
- children: /* @__PURE__ */ S(Kl, {
8195
+ children: /* @__PURE__ */ S(ql, {
8186
8196
  side: "right",
8187
8197
  className: "w-[480px] max-w-[90vw]",
8188
8198
  children: [
8189
- /* @__PURE__ */ S(ql, { children: [/* @__PURE__ */ x(Jl, { children: z }), /* @__PURE__ */ x(Yl, {
8199
+ /* @__PURE__ */ S(Jl, { children: [/* @__PURE__ */ x(Yl, { children: z }), /* @__PURE__ */ x(Xl, {
8190
8200
  className: "sr-only",
8191
8201
  children: "Content viewer panel"
8192
8202
  })] }),
@@ -8194,15 +8204,15 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8194
8204
  B
8195
8205
  ]
8196
8206
  })
8197
- }), /* @__PURE__ */ x(bc, {
8198
- open: V && s,
8207
+ }), /* @__PURE__ */ x(xc, {
8208
+ open: H && s,
8199
8209
  onOpenChange: (e) => {
8200
8210
  e || l(!1);
8201
8211
  },
8202
- children: /* @__PURE__ */ S(Tc, {
8212
+ children: /* @__PURE__ */ S(Ec, {
8203
8213
  className: "max-w-[90vw] max-h-[90vh] w-full h-full flex flex-col",
8204
8214
  children: [
8205
- /* @__PURE__ */ S(Ec, { children: [/* @__PURE__ */ x(Oc, { children: z }), /* @__PURE__ */ x(kc, {
8215
+ /* @__PURE__ */ S(Dc, { children: [/* @__PURE__ */ x(kc, { children: z }), /* @__PURE__ */ x(Ac, {
8206
8216
  className: "sr-only",
8207
8217
  children: "Content viewer full screen"
8208
8218
  })] }),
@@ -8214,7 +8224,7 @@ function $l({ target: e, onClose: t, onNavigate: n, onSave: r, canNavigatePrev:
8214
8224
  }
8215
8225
  //#endregion
8216
8226
  //#region src/table-view.tsx
8217
- function eu(e, t) {
8227
+ function tu(e, t) {
8218
8228
  if (zi(e, t).filterTexts.length === 0) return;
8219
8229
  let n = [];
8220
8230
  for (let r of e) {
@@ -8223,8 +8233,8 @@ function eu(e, t) {
8223
8233
  }
8224
8234
  return n.length === 1 ? n[0] : n.length > 1 ? { and: n } : void 0;
8225
8235
  }
8226
- function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i, onRowSelect: a, onOpenColumn: o, stackingEnabled: s, onToggleStacking: l }) {
8227
- let f = Fs(e), [h, g] = m(null), [_, y] = m(null), [C, w] = m(null), T = p([]), E = c((t) => {
8236
+ function nu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i, onRowSelect: a, onOpenColumn: o, stackingEnabled: s, onToggleStacking: l }) {
8237
+ let f = Is(e), [h, g] = m(null), [_, y] = m(null), [C, w] = m(null), T = p([]), E = c((t) => {
8228
8238
  y(ni(t, e));
8229
8239
  }, [e]), D = c((e) => {
8230
8240
  g({
@@ -8240,7 +8250,7 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8240
8250
  e.length !== 0 && A(e);
8241
8251
  }, []), [M, N] = m(/* @__PURE__ */ new Map()), P = p(M);
8242
8252
  P.current = M;
8243
- let [F, I] = m(!1), L = Ls(e), ee = c((t, n) => {
8253
+ let [F, I] = m(!1), L = Rs(e), ee = c((t, n) => {
8244
8254
  let r = T.current[t];
8245
8255
  w({
8246
8256
  columnName: n,
@@ -8248,112 +8258,112 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8248
8258
  rowIndex: t,
8249
8259
  tableName: e.name
8250
8260
  });
8251
- }, [e]), { columns: te, sorting: ne, columnFilters: R, pageIndex: z, pageSize: re, pageCount: ie, rows: B, totalRows: ae, grouping: V, exportRows: H, loading: U, fetching: W, error: oe, onSortingChange: se, onColumnFiltersChange: ce, onPageIndexChange: le, onPageSizeChange: ue, onGroupingChange: de, onGroupingSumChange: fe } = ks(e, t, n, r, ee, o), pe = c(async () => {
8261
+ }, [e]), { columns: te, sorting: ne, columnFilters: R, pageIndex: z, pageSize: re, pageCount: ie, rows: B, totalRows: V, grouping: H, exportRows: ae, loading: U, fetching: W, error: oe, onSortingChange: se, onColumnFiltersChange: G, onPageIndexChange: ce, onPageSizeChange: le, onGroupingChange: ue, onGroupingSumChange: de } = As(e, t, n, r, ee, o), fe = c(async () => {
8252
8262
  if (h) try {
8253
8263
  h.type === "single" ? await f.deleteRow(h.pk) : await f.deleteRows(h.pks), g(null);
8254
8264
  } catch {}
8255
- }, [h, f]), me = h?.type === "batch" ? h.pks.length : 1;
8265
+ }, [h, f]), pe = h?.type === "batch" ? h.pks.length : 1;
8256
8266
  T.current = B;
8257
- let { toast: he } = $a(), ge = St(), _e = e.isEditable !== !1, ve = d(() => C?.pk ? ni(C.pk, e) : null, [C, e]), ye = d(() => !C || C.tableName !== e.name ? -1 : ve === null ? C.rowIndex < B.length ? C.rowIndex : -1 : B.findIndex((t) => {
8267
+ let { toast: me } = $a(), he = St(), ge = e.isEditable !== !1, _e = d(() => C?.pk ? ni(C.pk, e) : null, [C, e]), ve = d(() => !C || C.tableName !== e.name ? -1 : _e === null ? C.rowIndex < B.length ? C.rowIndex : -1 : B.findIndex((t) => {
8258
8268
  let n = ei(t, e);
8259
- return n !== null && ni(n, e) === ve;
8269
+ return n !== null && ni(n, e) === _e;
8260
8270
  }), [
8261
8271
  C,
8262
- ve,
8272
+ _e,
8263
8273
  B,
8264
8274
  e
8265
- ]), be = ye >= 0 ? B[ye] : void 0, xe = d(() => C?.pk ? ti(C.pk, e) : null, [C, e]), Se = C ? e.columns.find((e) => e.name === C.columnName) : void 0, Ce = !!C && !!Se && !!xe && pi(Se) && be !== void 0 && !(Se.name in be), { data: we, isLoading: Te, error: Ee } = v({
8275
+ ]), ye = ve >= 0 ? B[ve] : void 0, be = d(() => C?.pk ? ti(C.pk, e) : null, [C, e]), xe = C ? e.columns.find((e) => e.name === C.columnName) : void 0, Se = !!C && !!xe && !!be && pi(xe) && ye !== void 0 && !(xe.name in ye), { data: Ce, isLoading: we, error: Te } = v({
8266
8276
  queryKey: [
8267
8277
  "contentPanelValue",
8268
8278
  e.name,
8269
8279
  C?.columnName,
8270
- ve
8280
+ _e
8271
8281
  ],
8272
8282
  queryFn: async () => {
8273
- let t = Ji(e, xe, [Se.name]), n = (await ge.query(t, xe.variables))?.value?.data?.at(0);
8283
+ let t = Ji(e, be, [xe.name]), n = (await he.query(t, be.variables))?.value?.data?.at(0);
8274
8284
  if (!n) throw Error("Row no longer exists.");
8275
- return n[Se.name] ?? null;
8285
+ return n[xe.name] ?? null;
8276
8286
  },
8277
- enabled: Ce
8287
+ enabled: Se
8278
8288
  });
8279
8289
  u(() => {
8280
- C !== null && Ce && Ee && (w(null), he(`Could not load content: ${Ee.message}`, "error"));
8290
+ C !== null && Se && Te && (w(null), me(`Could not load content: ${Te.message}`, "error"));
8281
8291
  }, [
8282
8292
  C,
8283
- Ce,
8284
- Ee,
8285
- he
8293
+ Se,
8294
+ Te,
8295
+ me
8286
8296
  ]), u(() => {
8287
8297
  C !== null && C.tableName !== e.name && w(null);
8288
8298
  }, [C, e.name]), u(() => {
8289
- C !== null && C.tableName === e.name && !U && ye === -1 && (w(null), he("Row is no longer in the current view; panel closed.", "error"));
8299
+ C !== null && C.tableName === e.name && !U && ve === -1 && (w(null), me("Row is no longer in the current view; panel closed.", "error"));
8290
8300
  }, [
8291
8301
  C,
8292
8302
  e.name,
8293
8303
  U,
8294
- ye,
8295
- he
8304
+ ve,
8305
+ me
8296
8306
  ]);
8297
- let De = d(() => {
8298
- if (!C || !be) return null;
8307
+ let Ee = d(() => {
8308
+ if (!C || !ye) return null;
8299
8309
  let t = e.columns.find((e) => e.name === C.columnName);
8300
- if (!t || Ce && (Te || Ee)) return null;
8301
- let n = Ce ? we : be[C.columnName], r = di(t);
8310
+ if (!t || Se && (we || Te)) return null;
8311
+ let n = Se ? Ce : ye[C.columnName], r = di(t);
8302
8312
  return {
8303
8313
  value: n == null ? "" : r || typeof n == "object" ? JSON.stringify(n, null, 2) : String(n),
8304
8314
  columnName: t.name,
8305
8315
  columnLabel: t.label,
8306
8316
  dbType: t.dbType,
8307
- rowKey: ve ?? `row-${C.rowIndex}`,
8317
+ rowKey: _e ?? `row-${C.rowIndex}`,
8308
8318
  isReadOnly: t.isReadOnly || t.isPrimaryKey || t.isIdentity
8309
8319
  };
8310
8320
  }, [
8311
8321
  C,
8312
- be,
8313
- ve,
8322
+ ye,
8323
+ _e,
8314
8324
  e,
8325
+ Se,
8315
8326
  Ce,
8316
8327
  we,
8317
- Te,
8318
- Ee
8319
- ]), Oe = d(() => e.columns.filter((e) => !e.isReadOnly && !e.isIdentity), [e]), ke = d(() => Oe.filter((e) => !e.isNullable || e.name === C?.columnName), [Oe, C?.columnName]), Ae = nc(e, d(() => ke.map((e) => ({ column: e })), [ke]), d(() => {
8328
+ Te
8329
+ ]), De = d(() => e.columns.filter((e) => !e.isReadOnly && !e.isIdentity), [e]), Oe = d(() => De.filter((e) => !e.isNullable || e.name === C?.columnName), [De, C?.columnName]), ke = rc(e, d(() => Oe.map((e) => ({ column: e })), [Oe]), d(() => {
8320
8330
  let t = new Map(e.columns.map((e) => [e.name, e]));
8321
8331
  return (e.primaryKeys ?? []).map((e) => t.get(e)).filter((e) => !!e);
8322
- }, [e]), ve ?? ""), je = _e && xe !== null && !Ae.isPending, Me = c(async (t) => {
8323
- if (!C || !xe) return;
8332
+ }, [e]), _e ?? ""), Ae = ge && be !== null && !ke.isPending, je = c(async (t) => {
8333
+ if (!C || !be) return;
8324
8334
  let n = e.columns.find((e) => e.name === C.columnName), r = t;
8325
8335
  if (n && di(n)) try {
8326
8336
  r = JSON.parse(t);
8327
8337
  } catch {}
8328
8338
  try {
8329
- let t = Ji(e, xe, ke.map((e) => e.name)), n = (await ge.query(t, xe.variables))?.value?.data?.[0];
8339
+ let t = Ji(e, be, Oe.map((e) => e.name)), n = (await he.query(t, be.variables))?.value?.data?.[0];
8330
8340
  if (!n) throw Error("Row no longer exists.");
8331
8341
  let i = {};
8332
- for (let e of ke) i[e.name] = n[e.name] ?? null;
8333
- i[C.columnName] = r, await Ae.update(i);
8342
+ for (let e of Oe) i[e.name] = n[e.name] ?? null;
8343
+ i[C.columnName] = r, await ke.update(i);
8334
8344
  } catch (e) {
8335
- throw he(`Save failed: ${e.message}`, "error"), e;
8345
+ throw me(`Save failed: ${e.message}`, "error"), e;
8336
8346
  }
8337
8347
  }, [
8338
8348
  C,
8339
- xe,
8349
+ be,
8340
8350
  e,
8351
+ Oe,
8341
8352
  ke,
8342
- Ae,
8343
- ge,
8344
- he
8345
- ]), Ne = c(() => {
8353
+ he,
8354
+ me
8355
+ ]), Me = c(() => {
8346
8356
  w(null);
8347
- }, []), Pe = c((e) => {
8348
- if (!C || ye < 0) return;
8349
- let t = e === "prev" ? Math.max(0, ye - 1) : Math.min(B.length - 1, ye + 1);
8357
+ }, []), Ne = c((e) => {
8358
+ if (!C || ve < 0) return;
8359
+ let t = e === "prev" ? Math.max(0, ve - 1) : Math.min(B.length - 1, ve + 1);
8350
8360
  ee(t, C.columnName);
8351
8361
  }, [
8352
8362
  C,
8353
- ye,
8363
+ ve,
8354
8364
  B.length,
8355
8365
  ee
8356
- ]), G = d(() => new Set(e.columns.filter((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !li(e.dbType) && !pi(e)).map((e) => e.name)), [e]), Fe = d(() => new Set(e.columns.filter((e) => e.paramType.startsWith("Boolean")).map((e) => e.name)), [e]), Ie = c((t, n, r) => {
8366
+ ]), Pe = d(() => new Set(e.columns.filter((e) => !e.isReadOnly && !e.isIdentity && !e.isPrimaryKey && !li(e.dbType) && !pi(e)).map((e) => e.name)), [e]), Fe = d(() => new Set(e.columns.filter((e) => e.paramType.startsWith("Boolean")).map((e) => e.name)), [e]), Ie = c((t, n, r) => {
8357
8367
  let i = ri(t, e);
8358
8368
  if (!i) return;
8359
8369
  let a = T.current.find((n) => $r(n, e, -1) === t);
@@ -8369,30 +8379,30 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8369
8379
  if (t.length !== 0) {
8370
8380
  I(!0);
8371
8381
  try {
8372
- let n = e.columns.filter((e) => G.has(e.name)), r = (e.primaryKeys ?? []).map((t) => e.columns.find((e) => e.name === t)).filter((e) => !!e), i = new Set(t.flatMap(([, e]) => Object.keys(e.changes))), a = n.filter((e) => !e.isNullable || i.has(e.name)), o = [.../* @__PURE__ */ new Set([...e.primaryKeys ?? [], ...a.map((e) => e.name)])], s = Yi(e, t.map(([, e]) => e.pk), o);
8382
+ let n = e.columns.filter((e) => Pe.has(e.name)), r = (e.primaryKeys ?? []).map((t) => e.columns.find((e) => e.name === t)).filter((e) => !!e), i = new Set(t.flatMap(([, e]) => Object.keys(e.changes))), a = n.filter((e) => !e.isNullable || i.has(e.name)), o = [.../* @__PURE__ */ new Set([...e.primaryKeys ?? [], ...a.map((e) => e.name)])], s = Yi(e, t.map(([, e]) => e.pk), o);
8373
8383
  if (!s) throw Error("The edited rows have no resolvable primary keys.");
8374
- let c = (await ge.query(s.query, s.variables))?.value?.data ?? [];
8384
+ let c = (await he.query(s.query, s.variables))?.value?.data ?? [];
8375
8385
  if (c.length !== t.length) throw Error(`Only ${c.length} of ${t.length} edited rows still exist. Refresh and retry.`);
8376
- let l = tc(e, n, r, c, (t) => P.current.get($r(t, e, -1))?.changes);
8386
+ let l = nc(e, n, r, c, (t) => P.current.get($r(t, e, -1))?.changes);
8377
8387
  await L.saveDelta({ updated: l }), N(/* @__PURE__ */ new Map());
8378
8388
  } catch (e) {
8379
- he(`Save failed: ${e.message}`, "error");
8389
+ me(`Save failed: ${e.message}`, "error");
8380
8390
  } finally {
8381
8391
  I(!1);
8382
8392
  }
8383
8393
  }
8384
8394
  }, [
8385
8395
  e,
8386
- G,
8396
+ Pe,
8387
8397
  L,
8388
- ge,
8389
- he
8398
+ he,
8399
+ me
8390
8400
  ]), ze = p(e.name);
8391
8401
  u(() => {
8392
- ze.current !== e.name && (ze.current = e.name, P.current.size > 0 && (N(/* @__PURE__ */ new Map()), he("Unsaved cell edits were discarded on table switch", "error")));
8393
- }, [e.name, he]);
8402
+ ze.current !== e.name && (ze.current = e.name, P.current.size > 0 && (N(/* @__PURE__ */ new Map()), me("Unsaved cell edits were discarded on table switch", "error")));
8403
+ }, [e.name, me]);
8394
8404
  let Be = d(() => new Map([...M].map(([e, t]) => [e, t.changes])), [M]), Ve = c(() => {
8395
- let t = eu(R, e);
8405
+ let t = tu(R, e);
8396
8406
  window.dispatchEvent(new CustomEvent("bifrostql:visualize", { detail: {
8397
8407
  table: e.graphQlName,
8398
8408
  filter: t,
@@ -8404,7 +8414,7 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8404
8414
  className: "m-2",
8405
8415
  children: /* @__PURE__ */ S(br, { children: ["Error: ", oe.message] })
8406
8416
  }) : /* @__PURE__ */ S(b, { children: [
8407
- /* @__PURE__ */ x(Rl, {
8417
+ /* @__PURE__ */ x(zl, {
8408
8418
  columns: te,
8409
8419
  data: B,
8410
8420
  tableName: e.name,
@@ -8416,63 +8426,63 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8416
8426
  loading: U,
8417
8427
  fetching: W,
8418
8428
  primaryKeys: e.primaryKeys ?? [],
8419
- selectable: _e && !V,
8429
+ selectable: ge && !H,
8420
8430
  selectedRowId: i,
8421
8431
  onRowSelect: a,
8422
8432
  onSortingChange: se,
8423
- onColumnFiltersChange: ce,
8424
- onPageIndexChange: le,
8425
- onPageSizeChange: ue,
8426
- onEditRow: _e && !V ? E : void 0,
8427
- onDeleteRow: _e && !V ? D : void 0,
8428
- onDeleteSelected: _e && !V ? O : void 0,
8429
- onBulkEditSelected: _e && !V ? j : void 0,
8430
- inlineEditableColumns: G,
8433
+ onColumnFiltersChange: G,
8434
+ onPageIndexChange: ce,
8435
+ onPageSizeChange: le,
8436
+ onEditRow: ge && !H ? E : void 0,
8437
+ onDeleteRow: ge && !H ? D : void 0,
8438
+ onDeleteSelected: ge && !H ? O : void 0,
8439
+ onBulkEditSelected: ge && !H ? j : void 0,
8440
+ inlineEditableColumns: Pe,
8431
8441
  inlineBooleanColumns: Fe,
8432
8442
  pendingEdits: Be,
8433
- onCellCommit: _e && !V ? Ie : void 0,
8443
+ onCellCommit: ge && !H ? Ie : void 0,
8434
8444
  onSaveAllEdits: Re,
8435
8445
  onDiscardAllEdits: Le,
8436
8446
  savingEdits: F,
8437
8447
  stackingEnabled: s,
8438
8448
  onToggleStacking: l,
8439
- exportRows: H,
8440
- totalRows: ae,
8449
+ exportRows: ae,
8450
+ totalRows: V,
8441
8451
  groupableColumns: e.columns,
8442
- grouping: V,
8443
- onGroupingChange: de,
8444
- onGroupingSumChange: fe,
8452
+ grouping: H,
8453
+ onGroupingChange: ue,
8454
+ onGroupingSumChange: de,
8445
8455
  onVisualize: Ve
8446
8456
  }),
8447
- /* @__PURE__ */ x(Mc, {
8457
+ /* @__PURE__ */ x(Nc, {
8448
8458
  open: h !== null,
8449
8459
  onOpenChange: (e) => {
8450
8460
  e || g(null);
8451
8461
  },
8452
- title: `Delete ${me} ${me === 1 ? "row" : "rows"}?`,
8462
+ title: `Delete ${pe} ${pe === 1 ? "row" : "rows"}?`,
8453
8463
  description: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("p", { children: "This action cannot be undone." }), f.error && /* @__PURE__ */ x("p", {
8454
8464
  className: "mt-2 text-sm text-destructive",
8455
8465
  children: f.error.message
8456
8466
  })] }),
8457
- confirmLabel: `Delete ${me === 1 ? "row" : `${me} rows`}`,
8467
+ confirmLabel: `Delete ${pe === 1 ? "row" : `${pe} rows`}`,
8458
8468
  variant: "destructive",
8459
8469
  isPending: f.isPending,
8460
- onConfirm: pe
8470
+ onConfirm: fe
8461
8471
  }),
8462
- /* @__PURE__ */ x($l, {
8463
- target: De,
8464
- onClose: Ne,
8465
- onNavigate: Pe,
8466
- onSave: je ? Me : void 0,
8467
- canNavigatePrev: ye > 0,
8468
- canNavigateNext: ye >= 0 && ye < B.length - 1
8472
+ /* @__PURE__ */ x(eu, {
8473
+ target: Ee,
8474
+ onClose: Me,
8475
+ onNavigate: Ne,
8476
+ onSave: Ae ? je : void 0,
8477
+ canNavigatePrev: ve > 0,
8478
+ canNavigateNext: ve >= 0 && ve < B.length - 1
8469
8479
  }),
8470
- k !== null && /* @__PURE__ */ x(Hl, {
8480
+ k !== null && /* @__PURE__ */ x(Ul, {
8471
8481
  table: e,
8472
8482
  pks: k,
8473
8483
  onClose: () => A(null)
8474
8484
  }),
8475
- _ !== null && /* @__PURE__ */ x(Jc, {
8485
+ _ !== null && /* @__PURE__ */ x(Yc, {
8476
8486
  table: e.graphQlName,
8477
8487
  editId: _,
8478
8488
  onClose: () => y(null)
@@ -8481,11 +8491,11 @@ function tu({ table: e, id: t, filterTable: n, filterColumn: r, selectedRowId: i
8481
8491
  }
8482
8492
  //#endregion
8483
8493
  //#region src/lib/m2m.ts
8484
- function nu(e) {
8494
+ function ru(e) {
8485
8495
  return new Set((e.manyToManyJoins ?? []).map((e) => e.junctionTable));
8486
8496
  }
8487
- function ru(e) {
8488
- let t = nu(e), n = e.multiJoins.filter((e) => !t.has(e.destinationTable)).map((e) => ({
8497
+ function iu(e) {
8498
+ let t = ru(e), n = e.multiJoins.filter((e) => !t.has(e.destinationTable)).map((e) => ({
8489
8499
  kind: "child",
8490
8500
  key: `child:${e.fieldName ?? e.destinationTable}`,
8491
8501
  join: e
@@ -8496,11 +8506,11 @@ function ru(e) {
8496
8506
  }));
8497
8507
  return [...n, ...r];
8498
8508
  }
8499
- function iu(e, t) {
8509
+ function au(e, t) {
8500
8510
  let n = /* @__PURE__ */ new Set([...t.junctionSourceColumnNames, ...t.junctionTargetColumnNames]);
8501
8511
  return e.columns.filter((e) => !e.isPrimaryKey && !n.has(e.name));
8502
8512
  }
8503
- function au(e, t, n, r) {
8513
+ function ou(e, t, n, r) {
8504
8514
  let i = n.junctionSourceColumnNames;
8505
8515
  if (i.length === 0) throw Error(`Many-to-many relationship '${n.name}' has no junction source columns.`);
8506
8516
  let a = Qr(r, i.length), o = new Map(e.columns.map((e) => [e.name, e])), s = [], c = [], l = {};
@@ -8510,7 +8520,7 @@ function au(e, t, n, r) {
8510
8520
  let u = i.paramType.replace("!", ""), d = `src${r}`;
8511
8521
  s.push(`$${d}: ${u}`), c.push(`{ ${t}: { _eq: $${d} } }`), l[d] = Ur(a[r], u);
8512
8522
  });
8513
- let u = c.length === 1 ? c[0] : `{ and: [${c.join(", ")}] }`, d = e.primaryKeys ?? [], f = iu(e, n).map((e) => e.name), p = t.primaryKeys?.length ? t.primaryKeys : n.targetColumnNames, m = t.labelColumn, h = [...p];
8523
+ let u = c.length === 1 ? c[0] : `{ and: [${c.join(", ")}] }`, d = e.primaryKeys ?? [], f = au(e, n).map((e) => e.name), p = t.primaryKeys?.length ? t.primaryKeys : n.targetColumnNames, m = t.labelColumn, h = [...p];
8514
8524
  m && !p.includes(m) && h.push(`label: ${m}`);
8515
8525
  let g = `${n.junctionTargetField} { ${h.join(" ")} }`, _ = [
8516
8526
  ...d,
@@ -8522,13 +8532,13 @@ function au(e, t, n, r) {
8522
8532
  variables: l
8523
8533
  };
8524
8534
  }
8525
- function ou(e, t) {
8535
+ function su(e, t) {
8526
8536
  let n = Gi(e).map((e) => e.name);
8527
8537
  return n.length > 0 ? n : [...t.targetColumnNames];
8528
8538
  }
8529
- function su(e, t, n) {
8539
+ function cu(e, t, n) {
8530
8540
  X(e.name, "many-to-many target table name");
8531
- let r = ou(e, t), i = t.targetColumnNames[0], a = e.labelColumn || r[0];
8541
+ let r = su(e, t), i = t.targetColumnNames[0], a = e.labelColumn || r[0];
8532
8542
  for (let e of r) X(e, "many-to-many target identity column");
8533
8543
  X(i, "many-to-many junction target column"), X(a, "many-to-many target label column");
8534
8544
  let o = `${[.../* @__PURE__ */ new Set([...r, i])].join(" ")} label: ${a}`, s = e.columns.find((e) => e.name === a);
@@ -8541,7 +8551,7 @@ function su(e, t, n) {
8541
8551
  serverSearch: c
8542
8552
  };
8543
8553
  }
8544
- function cu(e, t, n) {
8554
+ function lu(e, t, n) {
8545
8555
  let r = e[t.junctionTargetField];
8546
8556
  if (!r) return null;
8547
8557
  let i = $r(r, n, 0);
@@ -8550,7 +8560,7 @@ function cu(e, t, n) {
8550
8560
  label: r.label == null ? i : String(r.label)
8551
8561
  };
8552
8562
  }
8553
- function lu(e, t, n) {
8563
+ function uu(e, t, n) {
8554
8564
  if (e.junctionSourceColumnNames.length !== 1 || e.junctionTargetColumnNames.length !== 1) throw Error("attachJunctionDetail supports single-column junction FKs only; this relationship uses a composite key which is not yet supported.");
8555
8565
  let [r] = Qr(t, 1);
8556
8566
  return {
@@ -8560,13 +8570,13 @@ function lu(e, t, n) {
8560
8570
  }
8561
8571
  //#endregion
8562
8572
  //#region src/components/m2m-panel.tsx
8563
- var uu = 200, du = 50, fu = 500;
8564
- function pu({ m2m: e, parentRowId: t, onOpenColumn: n }) {
8573
+ var du = 200, fu = 50, pu = 500;
8574
+ function mu({ m2m: e, parentRowId: t, onOpenColumn: n }) {
8565
8575
  let r = Mt(), i = r.findTable(e.junctionTable), a = r.findTable(e.targetTable);
8566
8576
  return !i || !a ? /* @__PURE__ */ x("div", {
8567
8577
  className: "p-4 text-sm text-muted-foreground",
8568
8578
  children: "Relationship schema unavailable."
8569
- }) : /* @__PURE__ */ x(mu, {
8579
+ }) : /* @__PURE__ */ x(hu, {
8570
8580
  m2m: e,
8571
8581
  parentRowId: t,
8572
8582
  onOpenColumn: n,
@@ -8574,13 +8584,13 @@ function pu({ m2m: e, parentRowId: t, onOpenColumn: n }) {
8574
8584
  target: a
8575
8585
  });
8576
8586
  }
8577
- function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i }) {
8578
- let a = St(), o = y(), { toast: s } = $a(), [l, u] = m(!1), [f, p] = m(null), h = Fs(r), g = {
8587
+ function hu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i }) {
8588
+ let a = St(), o = y(), { toast: s } = $a(), [l, u] = m(!1), [f, p] = m(null), h = Is(r), g = {
8579
8589
  query: null,
8580
8590
  variables: {}
8581
8591
  }, _ = null;
8582
8592
  try {
8583
- g = au(r, i, e, t);
8593
+ g = ou(r, i, e, t);
8584
8594
  } catch (e) {
8585
8595
  _ = e;
8586
8596
  }
@@ -8597,7 +8607,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8597
8607
  queryKey: w,
8598
8608
  queryFn: () => a.query(b, {
8599
8609
  ...C,
8600
- limit: uu,
8610
+ limit: du,
8601
8611
  offset: 0
8602
8612
  }),
8603
8613
  enabled: !!b
@@ -8614,7 +8624,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8614
8624
  className: "p-4 text-sm text-destructive",
8615
8625
  children: ["Relationship misconfigured: ", _.message]
8616
8626
  });
8617
- let A = T?.[r.name]?.data ?? [], j = iu(r, e), M = r.isEditable !== !1, N = ou(i, e), P = /* @__PURE__ */ new Set();
8627
+ let A = T?.[r.name]?.data ?? [], j = au(r, e), M = r.isEditable !== !1, N = su(i, e), P = /* @__PURE__ */ new Set();
8618
8628
  for (let t of A) {
8619
8629
  let n = t[e.junctionTargetField];
8620
8630
  n && (N.some((e) => n[e] == null) || P.add(Zr(N.map((e) => n[e]))));
@@ -8628,7 +8638,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8628
8638
  className: "inline-flex items-center gap-1 rounded-full border border-border bg-muted/40 px-2 py-0.5 text-xs text-muted-foreground",
8629
8639
  title: `Linked through ${r.label}`,
8630
8640
  children: [
8631
- /* @__PURE__ */ x(ue, { className: "size-3" }),
8641
+ /* @__PURE__ */ x(le, { className: "size-3" }),
8632
8642
  "via ",
8633
8643
  r.label
8634
8644
  ]
@@ -8637,7 +8647,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8637
8647
  size: "sm",
8638
8648
  className: "h-7 px-2 text-xs ml-auto",
8639
8649
  onClick: () => u(!0),
8640
- children: [/* @__PURE__ */ x(xe, { className: "size-3 mr-1" }), " Add link"]
8650
+ children: [/* @__PURE__ */ x(be, { className: "size-3 mr-1" }), " Add link"]
8641
8651
  })]
8642
8652
  }),
8643
8653
  /* @__PURE__ */ S("div", {
@@ -8649,7 +8659,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8649
8659
  }),
8650
8660
  E && /* @__PURE__ */ S("div", {
8651
8661
  className: "flex items-center gap-2 p-3 text-sm text-muted-foreground",
8652
- children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin" }), " Loading…"]
8662
+ children: [/* @__PURE__ */ x(de, { className: "size-4 animate-spin" }), " Loading…"]
8653
8663
  }),
8654
8664
  !E && A.length === 0 && /* @__PURE__ */ S("div", {
8655
8665
  className: "p-3 text-sm text-muted-foreground",
@@ -8678,7 +8688,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8678
8688
  })
8679
8689
  ]
8680
8690
  }) }), /* @__PURE__ */ x("tbody", { children: A.map((t, r) => {
8681
- let a = cu(t, e, i);
8691
+ let a = lu(t, e, i);
8682
8692
  return /* @__PURE__ */ S("tr", {
8683
8693
  className: "border-b border-border/50 hover:bg-muted/30",
8684
8694
  children: [
@@ -8700,7 +8710,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8700
8710
  }),
8701
8711
  "aria-label": `Open ${a.label} in side column`,
8702
8712
  title: "Open in side column",
8703
- children: /* @__PURE__ */ x(Te, { className: "size-3" })
8713
+ children: /* @__PURE__ */ x(we, { className: "size-3" })
8704
8714
  })]
8705
8715
  }) : /* @__PURE__ */ x("span", {
8706
8716
  className: "text-muted-foreground",
@@ -8721,24 +8731,24 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8721
8731
  disabled: h.isPending,
8722
8732
  "aria-label": `Detach ${a?.label ?? "link"}`,
8723
8733
  title: "Detach",
8724
- children: /* @__PURE__ */ x(Ae, { className: "size-3.5" })
8734
+ children: /* @__PURE__ */ x(ke, { className: "size-3.5" })
8725
8735
  })
8726
8736
  })
8727
8737
  ]
8728
8738
  }, r);
8729
8739
  }) })]
8730
8740
  }),
8731
- A.length >= uu && /* @__PURE__ */ S("div", {
8741
+ A.length >= du && /* @__PURE__ */ S("div", {
8732
8742
  className: "px-3 py-2 text-xs text-muted-foreground italic border-t border-border",
8733
8743
  children: [
8734
8744
  "Showing the first ",
8735
- uu,
8745
+ du,
8736
8746
  " links. Detach some or narrow the parent selection to see more."
8737
8747
  ]
8738
8748
  })
8739
8749
  ]
8740
8750
  }),
8741
- l && /* @__PURE__ */ x(hu, {
8751
+ l && /* @__PURE__ */ x(gu, {
8742
8752
  target: i,
8743
8753
  junction: r,
8744
8754
  m2m: e,
@@ -8747,7 +8757,7 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8747
8757
  onClose: () => u(!1),
8748
8758
  onLinked: O
8749
8759
  }),
8750
- /* @__PURE__ */ x(Mc, {
8760
+ /* @__PURE__ */ x(Nc, {
8751
8761
  open: f !== null,
8752
8762
  onOpenChange: (e) => {
8753
8763
  e || p(null);
@@ -8774,15 +8784,15 @@ function mu({ m2m: e, parentRowId: t, onOpenColumn: n, junction: r, target: i })
8774
8784
  ]
8775
8785
  });
8776
8786
  }
8777
- function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onClose: a, onLinked: o }) {
8778
- let s = St(), l = nc(t, t.columns.filter((e) => n.junctionSourceColumnNames.includes(e.name) || n.junctionTargetColumnNames.includes(e.name)).map((e) => ({ column: e })), []), [d, f] = m(""), [p, h] = m("");
8787
+ function gu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onClose: a, onLinked: o }) {
8788
+ let s = St(), l = rc(t, t.columns.filter((e) => n.junctionSourceColumnNames.includes(e.name) || n.junctionTargetColumnNames.includes(e.name)).map((e) => ({ column: e })), []), [d, f] = m(""), [p, h] = m("");
8779
8789
  u(() => {
8780
8790
  let e = setTimeout(() => h(d), 300);
8781
8791
  return () => clearTimeout(e);
8782
8792
  }, [d]);
8783
8793
  let g = p.trim(), _ = null, y = null;
8784
8794
  try {
8785
- _ = su(e, n, g);
8795
+ _ = cu(e, n, g);
8786
8796
  } catch (e) {
8787
8797
  y = e;
8788
8798
  }
@@ -8791,7 +8801,7 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8791
8801
  identityColumns: [],
8792
8802
  linkColumn: "",
8793
8803
  serverSearch: !1
8794
- }, E = T ? du : fu, { data: D, isLoading: O } = v({
8804
+ }, E = T ? fu : pu, { data: D, isLoading: O } = v({
8795
8805
  queryKey: [
8796
8806
  "m2mTargets",
8797
8807
  e.name,
@@ -8802,11 +8812,11 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8802
8812
  search: g
8803
8813
  } : { limit: E }, { signal: e }),
8804
8814
  enabled: _ !== null
8805
- }), k = D?.[e.name]?.data ?? [], A = T || !g ? k : k.filter((e) => yc(e, "label", g)), j = k.length >= E, [M, N] = m(null), P = c(async (e, t) => {
8815
+ }), k = D?.[e.name]?.data ?? [], A = T || !g ? k : k.filter((e) => bc(e, "label", g)), j = k.length >= E, [M, N] = m(null), P = c(async (e, t) => {
8806
8816
  if (i.has(e)) return;
8807
8817
  let s;
8808
8818
  try {
8809
- s = lu(n, r, t);
8819
+ s = uu(n, r, t);
8810
8820
  } catch (e) {
8811
8821
  N(e);
8812
8822
  return;
@@ -8826,14 +8836,14 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8826
8836
  o,
8827
8837
  a
8828
8838
  ]);
8829
- return y ? /* @__PURE__ */ x(bc, {
8839
+ return y ? /* @__PURE__ */ x(xc, {
8830
8840
  open: !0,
8831
8841
  onOpenChange: (e) => {
8832
8842
  e || a();
8833
8843
  },
8834
- children: /* @__PURE__ */ S(Tc, {
8844
+ children: /* @__PURE__ */ S(Ec, {
8835
8845
  className: "max-w-md",
8836
- children: [/* @__PURE__ */ x(Ec, { children: /* @__PURE__ */ S(Oc, { children: [
8846
+ children: [/* @__PURE__ */ x(Dc, { children: /* @__PURE__ */ S(kc, { children: [
8837
8847
  "Add ",
8838
8848
  e.label,
8839
8849
  " link"
@@ -8842,22 +8852,22 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8842
8852
  children: ["Relationship misconfigured: ", y.message]
8843
8853
  })]
8844
8854
  })
8845
- }) : /* @__PURE__ */ x(bc, {
8855
+ }) : /* @__PURE__ */ x(xc, {
8846
8856
  open: !0,
8847
8857
  onOpenChange: (e) => {
8848
8858
  e || a();
8849
8859
  },
8850
- children: /* @__PURE__ */ S(Tc, {
8860
+ children: /* @__PURE__ */ S(Ec, {
8851
8861
  className: "max-w-md",
8852
8862
  children: [
8853
- /* @__PURE__ */ x(Ec, { children: /* @__PURE__ */ S(Oc, { children: [
8863
+ /* @__PURE__ */ x(Dc, { children: /* @__PURE__ */ S(kc, { children: [
8854
8864
  "Add ",
8855
8865
  e.label,
8856
8866
  " link"
8857
8867
  ] }) }),
8858
8868
  /* @__PURE__ */ S("div", {
8859
8869
  className: "flex items-center gap-2",
8860
- children: [/* @__PURE__ */ x(Te, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ x(xr, {
8870
+ children: [/* @__PURE__ */ x(we, { className: "size-4 text-muted-foreground" }), /* @__PURE__ */ x(xr, {
8861
8871
  autoFocus: !0,
8862
8872
  placeholder: `Search ${e.label}…`,
8863
8873
  value: d,
@@ -8877,7 +8887,7 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8877
8887
  children: [
8878
8888
  O && /* @__PURE__ */ S("div", {
8879
8889
  className: "flex items-center gap-2 p-3 text-sm text-muted-foreground",
8880
- children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin" }), " Loading…"]
8890
+ children: [/* @__PURE__ */ x(de, { className: "size-4 animate-spin" }), " Loading…"]
8881
8891
  }),
8882
8892
  !O && A.length === 0 && /* @__PURE__ */ x("div", {
8883
8893
  className: "p-3 text-sm text-muted-foreground",
@@ -8911,11 +8921,11 @@ function hu({ target: e, junction: t, m2m: n, parentRowId: r, linkedIds: i, onCl
8911
8921
  }
8912
8922
  //#endregion
8913
8923
  //#region src/components/detail-panel.tsx
8914
- function gu(e) {
8924
+ function _u(e) {
8915
8925
  return e.kind === "child" ? e.join.destinationTable : e.m2m.targetTable;
8916
8926
  }
8917
- function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8918
- let i = Mt(), a = ru(e), [o, s] = m(a[0]?.key ?? ""), [c, l] = m(!1), [d, f] = m(null), p = a.find((e) => e.key === o) ?? a[0];
8927
+ function vu({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8928
+ let i = Mt(), a = iu(e), [o, s] = m(a[0]?.key ?? ""), [c, l] = m(!1), [d, f] = m(null), p = a.find((e) => e.key === o) ?? a[0];
8919
8929
  if (u(() => {
8920
8930
  f(null);
8921
8931
  }, [o, t]), a.length === 0 || !i.data) return null;
@@ -8940,7 +8950,7 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8940
8950
  /* @__PURE__ */ x("div", {
8941
8951
  className: "flex items-center gap-0.5 overflow-x-auto",
8942
8952
  children: a.map((n) => {
8943
- let a = i.findTable(gu(n))?.label ?? gu(n), o = n.key === p.key;
8953
+ let a = i.findTable(_u(n))?.label ?? _u(n), o = n.key === p.key;
8944
8954
  return /* @__PURE__ */ S("span", {
8945
8955
  className: "group/tab inline-flex items-center",
8946
8956
  children: [/* @__PURE__ */ x(Z, {
@@ -8961,7 +8971,7 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8961
8971
  }),
8962
8972
  "aria-label": "Open in side column",
8963
8973
  title: "Open in side column",
8964
- children: /* @__PURE__ */ x(ye, { className: "size-3" })
8974
+ children: /* @__PURE__ */ x(ve, { className: "size-3" })
8965
8975
  })]
8966
8976
  }, n.key);
8967
8977
  })
@@ -8973,7 +8983,7 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8973
8983
  className: "ml-auto shrink-0",
8974
8984
  "aria-label": "Close detail panel",
8975
8985
  title: "Close detail panel",
8976
- children: /* @__PURE__ */ x(Me, { className: "size-3.5" })
8986
+ children: /* @__PURE__ */ x(je, { className: "size-3.5" })
8977
8987
  })
8978
8988
  ]
8979
8989
  }), !c && /* @__PURE__ */ x("div", {
@@ -8983,7 +8993,7 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8983
8993
  children: "This related table is not available."
8984
8994
  }) : p.kind === "child" ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("div", {
8985
8995
  className: "flex-1 min-h-[11rem] overflow-hidden flex flex-col",
8986
- children: /* @__PURE__ */ x(tu, {
8996
+ children: /* @__PURE__ */ x(nu, {
8987
8997
  table: h,
8988
8998
  id: t,
8989
8999
  filterTable: e.name,
@@ -8994,13 +9004,13 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
8994
9004
  }, `${p.key}-${t}`)
8995
9005
  }), g && d && /* @__PURE__ */ x("div", {
8996
9006
  className: "flex-1 flex flex-col",
8997
- children: /* @__PURE__ */ x(_u, {
9007
+ children: /* @__PURE__ */ x(vu, {
8998
9008
  parentTable: h,
8999
9009
  selectedRowId: d,
9000
9010
  onClose: () => f(null),
9001
9011
  onOpenColumn: r
9002
9012
  })
9003
- })] }) : /* @__PURE__ */ x(pu, {
9013
+ })] }) : /* @__PURE__ */ x(mu, {
9004
9014
  m2m: p.m2m,
9005
9015
  parentRowId: t,
9006
9016
  onOpenColumn: r
@@ -9010,17 +9020,17 @@ function _u({ parentTable: e, selectedRowId: t, onClose: n, onOpenColumn: r }) {
9010
9020
  }
9011
9021
  //#endregion
9012
9022
  //#region src/hooks/useColumnNav.tsx
9013
- var vu = i({
9023
+ var yu = i({
9014
9024
  mainTable: null,
9015
9025
  columns: [],
9016
9026
  focusedIndex: 0,
9017
9027
  focusColumn: () => {},
9018
9028
  closeColumn: () => {}
9019
- }), yu = i({
9029
+ }), bu = i({
9020
9030
  register: () => {},
9021
9031
  unregister: () => {}
9022
9032
  });
9023
- function bu({ children: e }) {
9033
+ function xu({ children: e }) {
9024
9034
  let [t, n] = m(null), [r, i] = m(0), a = c((e) => {
9025
9035
  n(e);
9026
9036
  }, []), o = c(() => {
@@ -9054,35 +9064,35 @@ function bu({ children: e }) {
9054
9064
  register: a,
9055
9065
  unregister: o
9056
9066
  }), [a, o]);
9057
- return /* @__PURE__ */ x(yu.Provider, {
9067
+ return /* @__PURE__ */ x(bu.Provider, {
9058
9068
  value: p,
9059
- children: /* @__PURE__ */ x(vu.Provider, {
9069
+ children: /* @__PURE__ */ x(yu.Provider, {
9060
9070
  value: f,
9061
9071
  children: e
9062
9072
  })
9063
9073
  });
9064
9074
  }
9065
- function xu() {
9066
- return l(vu);
9067
- }
9068
9075
  function Su() {
9069
9076
  return l(yu);
9070
9077
  }
9078
+ function Cu() {
9079
+ return l(bu);
9080
+ }
9071
9081
  //#endregion
9072
9082
  //#region src/lib/drill-stack.ts
9073
- function Cu(e, t) {
9083
+ function wu(e, t) {
9074
9084
  return e.tableName === t.tableName && e.filterTable === t.filterTable && e.filterId === t.filterId && e.filterColumn === t.filterColumn;
9075
9085
  }
9076
- function wu(e, t) {
9086
+ function Tu(e, t) {
9077
9087
  let n = e[e.length - 1];
9078
- if (n && Cu(n, t)) return e;
9079
- let r = e.findIndex((e) => Cu(e, t));
9088
+ if (n && wu(n, t)) return e;
9089
+ let r = e.findIndex((e) => wu(e, t));
9080
9090
  return r >= 0 ? e.slice(0, r + 1) : [...e, t];
9081
9091
  }
9082
- function Tu(e, t) {
9092
+ function Eu(e, t) {
9083
9093
  return t < 0 ? [] : t >= e.length ? e : e.slice(0, t);
9084
9094
  }
9085
- function Eu(e, t, n) {
9095
+ function Du(e, t, n) {
9086
9096
  let r = (e) => n(e) ?? e, i = [{
9087
9097
  index: -1,
9088
9098
  label: r(e)
@@ -9100,27 +9110,27 @@ function Eu(e, t, n) {
9100
9110
  }
9101
9111
  //#endregion
9102
9112
  //#region src/hooks/usePanelSize.ts
9103
- var Du = "edit-db:panel:", Ou = 16;
9104
- function ku(e, t, n) {
9113
+ var Ou = "edit-db:panel:", ku = 16;
9114
+ function Au(e, t, n) {
9105
9115
  return Math.min(n, Math.max(t, e));
9106
9116
  }
9107
- function Au(e, t, n, r) {
9117
+ function ju(e, t, n, r) {
9108
9118
  try {
9109
- let i = localStorage.getItem(Du + e), a = i === null ? NaN : Number(i);
9110
- return Number.isFinite(a) ? ku(a, n, r) : t;
9119
+ let i = localStorage.getItem(Ou + e), a = i === null ? NaN : Number(i);
9120
+ return Number.isFinite(a) ? Au(a, n, r) : t;
9111
9121
  } catch {
9112
9122
  return t;
9113
9123
  }
9114
9124
  }
9115
- function ju(e, t) {
9125
+ function Mu(e, t) {
9116
9126
  try {
9117
- localStorage.setItem(Du + e, String(Math.round(t)));
9127
+ localStorage.setItem(Ou + e, String(Math.round(t)));
9118
9128
  } catch {}
9119
9129
  }
9120
- function Mu({ key: e, initial: t, min: n, max: r, axis: i, invert: a = !1 }) {
9121
- let [o, s] = m(() => Au(e, t, n, r)), l = p(null), u = c((t) => {
9122
- let i = ku(t, n, r);
9123
- return s(i), ju(e, i), i;
9130
+ function Nu({ key: e, initial: t, min: n, max: r, axis: i, invert: a = !1 }) {
9131
+ let [o, s] = m(() => ju(e, t, n, r)), l = p(null), u = c((t) => {
9132
+ let i = Au(t, n, r);
9133
+ return s(i), Mu(e, i), i;
9124
9134
  }, [
9125
9135
  e,
9126
9136
  n,
@@ -9159,7 +9169,7 @@ function Mu({ key: e, initial: t, min: n, max: r, axis: i, invert: a = !1 }) {
9159
9169
  if (e.key !== t && e.key !== n) return;
9160
9170
  e.preventDefault();
9161
9171
  let r = (e.key === t ? 1 : -1) * (a ? -1 : 1);
9162
- u(o + r * Ou);
9172
+ u(o + r * ku);
9163
9173
  }, [
9164
9174
  u,
9165
9175
  i,
@@ -9170,11 +9180,11 @@ function Mu({ key: e, initial: t, min: n, max: r, axis: i, invert: a = !1 }) {
9170
9180
  }
9171
9181
  //#endregion
9172
9182
  //#region src/data-panel.tsx
9173
- function Nu(e, t) {
9183
+ function Pu(e, t) {
9174
9184
  return e.find((e) => e.name === t);
9175
9185
  }
9176
- function Pu() {
9177
- let { table: e, id: t, filterTable: n } = it(), { loading: r, error: i, data: a } = Mt(), [o, s] = m(null), l = Mu({
9186
+ function Fu() {
9187
+ let { table: e, id: t, filterTable: n } = it(), { loading: r, error: i, data: a } = Mt(), [o, s] = m(null), l = Nu({
9178
9188
  key: "detail-height",
9179
9189
  initial: 300,
9180
9190
  min: 120,
@@ -9188,16 +9198,16 @@ function Pu() {
9188
9198
  let n = new Set(t);
9189
9199
  return n.has(e) ? n.delete(e) : n.add(e), n;
9190
9200
  });
9191
- }, []), { register: T, unregister: E } = Su(), D = p(null), O = p(/* @__PURE__ */ new Map()), k = d(() => a ? Nu(a, e) : void 0, [a, e]), A = k ? ru(k).length > 0 : !1, j = c((e) => {
9192
- h((t) => wu(t, e));
9201
+ }, []), { register: T, unregister: E } = Cu(), D = p(null), O = p(/* @__PURE__ */ new Map()), k = d(() => a ? Pu(a, e) : void 0, [a, e]), A = k ? iu(k).length > 0 : !1, j = c((e) => {
9202
+ h((t) => Tu(t, e));
9193
9203
  }, []), M = c((e) => {
9194
9204
  _(e), e || h([]);
9195
9205
  }, []), N = g ? j : void 0, P = c((e) => {
9196
9206
  h((t) => t.filter((t, n) => n !== e));
9197
9207
  }, []), F = c((e) => {
9198
- h((t) => Tu(t, e + 1));
9199
- }, []), I = d(() => Eu(e ?? "", f, (e) => {
9200
- if (a) return Nu(a, e)?.label;
9208
+ h((t) => Eu(t, e + 1));
9209
+ }, []), I = d(() => Du(e ?? "", f, (e) => {
9210
+ if (a) return Pu(a, e)?.label;
9201
9211
  }), [
9202
9212
  e,
9203
9213
  f,
@@ -9225,7 +9235,7 @@ function Pu() {
9225
9235
  });
9226
9236
  if (r) return /* @__PURE__ */ S("div", {
9227
9237
  className: "flex items-center justify-center gap-2 p-5",
9228
- children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
9238
+ children: [/* @__PURE__ */ x(de, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
9229
9239
  className: "text-sm text-muted-foreground",
9230
9240
  children: "Loading..."
9231
9241
  })]
@@ -9239,7 +9249,7 @@ function Pu() {
9239
9249
  className: "p-5 text-center text-muted-foreground",
9240
9250
  children: "Table not found"
9241
9251
  });
9242
- let L = /* @__PURE__ */ x(tu, {
9252
+ let L = /* @__PURE__ */ x(nu, {
9243
9253
  table: k,
9244
9254
  id: t,
9245
9255
  filterTable: n,
@@ -9269,7 +9279,7 @@ function Pu() {
9269
9279
  }), /* @__PURE__ */ x("div", {
9270
9280
  className: "min-h-0 overflow-y-auto flex flex-col",
9271
9281
  style: { flex: `0 0 ${l.size}px` },
9272
- children: /* @__PURE__ */ x(_u, {
9282
+ children: /* @__PURE__ */ x(vu, {
9273
9283
  parentTable: k,
9274
9284
  selectedRowId: o,
9275
9285
  onClose: () => s(null),
@@ -9281,13 +9291,13 @@ function Pu() {
9281
9291
  let ee = f.length - 1, te = (e, t) => t || v.has(e);
9282
9292
  return /* @__PURE__ */ S("div", {
9283
9293
  className: "flex flex-col flex-1 min-h-0",
9284
- children: [/* @__PURE__ */ x(Fu, {
9294
+ children: [/* @__PURE__ */ x(Iu, {
9285
9295
  crumbs: I,
9286
9296
  onCrumbClick: F,
9287
9297
  activeIndex: f.length - 1
9288
9298
  }), /* @__PURE__ */ S("div", {
9289
9299
  className: "flex-1 min-h-0 overflow-y-auto flex flex-col gap-0.5 p-0.5",
9290
- children: [/* @__PURE__ */ x(Iu, {
9300
+ children: [/* @__PURE__ */ x(Lu, {
9291
9301
  title: k.label,
9292
9302
  selectedRowId: f[0]?.filterId,
9293
9303
  expanded: te(-1, !1),
@@ -9299,8 +9309,8 @@ function Pu() {
9299
9309
  children: L
9300
9310
  }), f.map((e, t) => {
9301
9311
  let n = t === ee;
9302
- return /* @__PURE__ */ x(Iu, {
9303
- title: Nu(a, e.tableName)?.label ?? e.tableName,
9312
+ return /* @__PURE__ */ x(Lu, {
9313
+ title: Pu(a, e.tableName)?.label ?? e.tableName,
9304
9314
  selectedRowId: f[t + 1]?.filterId,
9305
9315
  expanded: te(t, n),
9306
9316
  active: n,
@@ -9309,8 +9319,8 @@ function Pu() {
9309
9319
  onRef: (e) => {
9310
9320
  O.current.set(t + 1, e);
9311
9321
  },
9312
- children: /* @__PURE__ */ x(tu, {
9313
- table: Nu(a, e.tableName),
9322
+ children: /* @__PURE__ */ x(nu, {
9323
+ table: Pu(a, e.tableName),
9314
9324
  id: e.filterId,
9315
9325
  filterTable: e.filterTable,
9316
9326
  filterColumn: e.filterColumn,
@@ -9321,7 +9331,7 @@ function Pu() {
9321
9331
  })]
9322
9332
  });
9323
9333
  }
9324
- function Fu({ crumbs: e, onCrumbClick: t, activeIndex: n }) {
9334
+ function Iu({ crumbs: e, onCrumbClick: t, activeIndex: n }) {
9325
9335
  return /* @__PURE__ */ x("nav", {
9326
9336
  "aria-label": "Drill-down breadcrumb",
9327
9337
  className: "flex items-center gap-1 px-2 py-1 bg-muted/20 border-b border-border shrink-0 overflow-x-auto",
@@ -9337,7 +9347,7 @@ function Fu({ crumbs: e, onCrumbClick: t, activeIndex: n }) {
9337
9347
  "aria-current": i ? "page" : void 0,
9338
9348
  title: e.detail ? `${e.label} (${e.detail})` : e.label,
9339
9349
  children: [
9340
- a && /* @__PURE__ */ x(ce, { className: "size-3" }),
9350
+ a && /* @__PURE__ */ x(G, { className: "size-3" }),
9341
9351
  /* @__PURE__ */ x("span", {
9342
9352
  className: "truncate max-w-[12rem]",
9343
9353
  children: e.label
@@ -9352,7 +9362,7 @@ function Fu({ crumbs: e, onCrumbClick: t, activeIndex: n }) {
9352
9362
  })
9353
9363
  });
9354
9364
  }
9355
- function Iu({ title: e, selectedRowId: t, expanded: n, active: r, onToggle: i, onClose: a, onRef: o, children: s }) {
9365
+ function Lu({ title: e, selectedRowId: t, expanded: n, active: r, onToggle: i, onClose: a, onRef: o, children: s }) {
9356
9366
  return /* @__PURE__ */ S("div", {
9357
9367
  ref: o,
9358
9368
  className: "shrink-0 flex flex-col border border-border rounded-sm overflow-hidden",
@@ -9388,7 +9398,7 @@ function Iu({ title: e, selectedRowId: t, expanded: n, active: r, onToggle: i, o
9388
9398
  onClick: a,
9389
9399
  "aria-label": "Close column",
9390
9400
  title: "Close column",
9391
- children: /* @__PURE__ */ x(Me, { className: "size-3.5" })
9401
+ children: /* @__PURE__ */ x(je, { className: "size-3.5" })
9392
9402
  })
9393
9403
  ]
9394
9404
  }), n && /* @__PURE__ */ x("div", {
@@ -9398,19 +9408,29 @@ function Iu({ title: e, selectedRowId: t, expanded: n, active: r, onToggle: i, o
9398
9408
  });
9399
9409
  }
9400
9410
  //#endregion
9411
+ //#region src/lib/search-column.ts
9412
+ function Ru(e, t) {
9413
+ if (!e || e.length === 0) return "";
9414
+ if (t) {
9415
+ let n = e.find((e) => e.key === t);
9416
+ if (n) return n.value;
9417
+ }
9418
+ return e[0].value;
9419
+ }
9420
+ //#endregion
9401
9421
  //#region src/header.tsx
9402
- function Lu() {
9403
- let e = it(), { loading: t, error: n, data: r } = Mt(), { columns: i, focusedIndex: a, focusColumn: o, closeColumn: s } = xu(), [c, l] = m(""), f = nt(), { search: p } = at(), h = !!p.get("filter"), { back: g, hasBack: _ } = rt(), v = e?.table, y = i.length > 0, b = d(() => r?.find((e) => e.graphQlName === v), [r, v]), C = d(() => b?.columns?.filter((e) => Vr(e.paramType) || Rr(e.paramType)).map((e) => ({
9422
+ function zu() {
9423
+ let e = it(), { loading: t, error: n, data: r } = Mt(), { columns: i, focusedIndex: a, focusColumn: o, closeColumn: s } = Su(), [c, l] = m(""), f = nt(), { search: p } = at(), h = !!p.get("filter"), { back: g, hasBack: _ } = rt(), v = e?.table, y = i.length > 0, b = d(() => r?.find((e) => e.graphQlName === v), [r, v]), C = d(() => b?.columns?.filter((e) => Vr(e.paramType) || Rr(e.paramType)).map((e) => ({
9404
9424
  key: e.name,
9405
9425
  value: `${e.name},${e.paramType}`,
9406
9426
  label: e.label
9407
- })), [b]), [w, T] = m(C?.at(0)?.value ?? "");
9427
+ })), [b]), { defaultSearchColumns: w } = kt(), T = v ? w?.[v] : void 0, [E, D] = m(() => Ru(C, T));
9408
9428
  u(() => {
9409
- l(""), T(C?.at(0)?.value ?? "");
9410
- }, [C]);
9411
- let E = () => {
9429
+ l(""), D(Ru(C, T));
9430
+ }, [C, T]);
9431
+ let O = () => {
9412
9432
  if (!c) return;
9413
- let [e, t] = w.split(",");
9433
+ let [e, t] = E.split(",");
9414
9434
  if (!t) return;
9415
9435
  let n = t.replace("!", "");
9416
9436
  if (Rr(n)) {
@@ -9421,7 +9441,7 @@ function Lu() {
9421
9441
  };
9422
9442
  return t ? /* @__PURE__ */ S("div", {
9423
9443
  className: "flex items-center gap-2 p-2.5",
9424
- children: [/* @__PURE__ */ x(fe, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
9444
+ children: [/* @__PURE__ */ x(de, { className: "size-4 animate-spin text-muted-foreground" }), /* @__PURE__ */ x("span", {
9425
9445
  className: "text-sm text-muted-foreground",
9426
9446
  children: "Loading..."
9427
9447
  })]
@@ -9466,7 +9486,7 @@ function Lu() {
9466
9486
  },
9467
9487
  className: "rounded-sm hover:bg-background/50 p-px",
9468
9488
  "aria-label": `Close ${n}`,
9469
- children: /* @__PURE__ */ x(Me, { className: "size-3" })
9489
+ children: /* @__PURE__ */ x(je, { className: "size-3" })
9470
9490
  })]
9471
9491
  }, `${e.panel.tableName}-${e.panel.filterId ?? t}`);
9472
9492
  })]
@@ -9479,8 +9499,8 @@ function Lu() {
9479
9499
  className: "flex items-center border border-border rounded-md overflow-hidden flex-[2_2_16rem] min-w-[12rem]",
9480
9500
  children: [
9481
9501
  /* @__PURE__ */ S(ho, {
9482
- value: w,
9483
- onValueChange: T,
9502
+ value: E,
9503
+ onValueChange: D,
9484
9504
  children: [/* @__PURE__ */ x(_o, {
9485
9505
  size: "sm",
9486
9506
  className: "w-auto min-w-[120px] shrink-0 border-0 rounded-none border-r border-border h-8 text-xs",
@@ -9492,11 +9512,11 @@ function Lu() {
9492
9512
  }),
9493
9513
  /* @__PURE__ */ S("div", {
9494
9514
  className: "relative flex-1 min-w-[180px]",
9495
- children: [/* @__PURE__ */ x(Te, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none" }), /* @__PURE__ */ x(xr, {
9515
+ children: [/* @__PURE__ */ x(we, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-3.5 text-muted-foreground pointer-events-none" }), /* @__PURE__ */ x(xr, {
9496
9516
  type: "search",
9497
9517
  value: c,
9498
9518
  onChange: (e) => l(e.target.value),
9499
- onKeyDown: (e) => e.key === "Enter" && E(),
9519
+ onKeyDown: (e) => e.key === "Enter" && O(),
9500
9520
  className: "h-8 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0",
9501
9521
  style: { paddingLeft: "2.25rem" },
9502
9522
  placeholder: "Search..."
@@ -9505,7 +9525,7 @@ function Lu() {
9505
9525
  /* @__PURE__ */ S(Z, {
9506
9526
  variant: "ghost",
9507
9527
  size: "sm",
9508
- onClick: E,
9528
+ onClick: O,
9509
9529
  className: "shrink-0 rounded-none border-l border-border h-8 px-3 text-xs",
9510
9530
  children: [/* @__PURE__ */ x(W, { className: "size-3.5" }), "Filter"]
9511
9531
  }),
@@ -9522,7 +9542,7 @@ function Lu() {
9522
9542
  title: "Clear filter",
9523
9543
  "aria-label": "Clear filter",
9524
9544
  className: "shrink-0 rounded-none border-l border-border h-8 px-2 text-xs text-muted-foreground",
9525
- children: /* @__PURE__ */ x(Me, { className: "size-3.5" })
9545
+ children: /* @__PURE__ */ x(je, { className: "size-3.5" })
9526
9546
  })
9527
9547
  ]
9528
9548
  }),
@@ -9534,13 +9554,13 @@ function Lu() {
9534
9554
  onClick: () => f("/"),
9535
9555
  title: "Back to table list",
9536
9556
  className: "text-muted-foreground text-xs h-8 px-3 rounded-none",
9537
- children: [/* @__PURE__ */ x(ce, { className: "size-3.5" }), "Home"]
9557
+ children: [/* @__PURE__ */ x(G, { className: "size-3.5" }), "Home"]
9538
9558
  }), b?.isEditable && /* @__PURE__ */ S(Z, {
9539
9559
  variant: "default",
9540
9560
  size: "sm",
9541
9561
  onClick: () => f("edit/"),
9542
9562
  className: "h-8 text-xs px-4 rounded-none",
9543
- children: [/* @__PURE__ */ x(xe, { className: "size-3.5" }), "Add"]
9563
+ children: [/* @__PURE__ */ x(be, { className: "size-3.5" }), "Add"]
9544
9564
  })]
9545
9565
  })
9546
9566
  ]
@@ -9548,7 +9568,7 @@ function Lu() {
9548
9568
  }
9549
9569
  //#endregion
9550
9570
  //#region src/error-boundary.tsx
9551
- var Ru = class extends r {
9571
+ var Bu = class extends r {
9552
9572
  constructor(e) {
9553
9573
  super(e), this.state = {
9554
9574
  hasError: !1,
@@ -9598,7 +9618,7 @@ var Ru = class extends r {
9598
9618
  };
9599
9619
  //#endregion
9600
9620
  //#region src/main-frame.tsx
9601
- function zu() {
9621
+ function Vu() {
9602
9622
  let { loading: e, error: t, data: n } = Mt();
9603
9623
  return e ? /* @__PURE__ */ S("div", {
9604
9624
  className: "flex flex-col items-center justify-center h-full gap-3 text-muted-foreground",
@@ -9636,7 +9656,7 @@ function zu() {
9636
9656
  children: [
9637
9657
  /* @__PURE__ */ S("div", {
9638
9658
  className: "flex items-center gap-3 text-muted-foreground/50",
9639
- children: [/* @__PURE__ */ x(Ee, { className: "size-10" }), /* @__PURE__ */ x(_e, { className: "size-6" })]
9659
+ children: [/* @__PURE__ */ x(Te, { className: "size-10" }), /* @__PURE__ */ x(ge, { className: "size-6" })]
9640
9660
  }),
9641
9661
  /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("h2", {
9642
9662
  className: "text-lg font-semibold text-foreground",
@@ -9663,11 +9683,11 @@ function zu() {
9663
9683
  ]
9664
9684
  });
9665
9685
  }
9666
- function Bu({ children: e }) {
9686
+ function Hu({ children: e }) {
9667
9687
  let { loading: t, error: n } = Mt();
9668
9688
  return t ? /* @__PURE__ */ S("div", {
9669
9689
  className: "flex items-center justify-center flex-1 gap-3 text-muted-foreground",
9670
- children: [/* @__PURE__ */ x(fe, { className: "size-6 animate-spin" }), /* @__PURE__ */ x("span", {
9690
+ children: [/* @__PURE__ */ x(de, { className: "size-6 animate-spin" }), /* @__PURE__ */ x("span", {
9671
9691
  className: "text-sm",
9672
9692
  children: "Connecting to database..."
9673
9693
  })]
@@ -9693,15 +9713,15 @@ function Bu({ children: e }) {
9693
9713
  })
9694
9714
  }) : /* @__PURE__ */ x(b, { children: e });
9695
9715
  }
9696
- function Vu() {
9697
- let [e, t] = m(!0), n = Mu({
9716
+ function Uu() {
9717
+ let [e, t] = m(!0), n = Nu({
9698
9718
  key: "sidebar-width",
9699
9719
  initial: 240,
9700
9720
  min: 150,
9701
9721
  max: 560,
9702
9722
  axis: "x"
9703
9723
  });
9704
- return /* @__PURE__ */ x(Bu, { children: /* @__PURE__ */ x(bu, { children: /* @__PURE__ */ S("div", {
9724
+ return /* @__PURE__ */ x(Hu, { children: /* @__PURE__ */ x(xu, { children: /* @__PURE__ */ S("div", {
9705
9725
  className: "grid h-full flex-1 min-h-0 grid-rows-[auto_1fr]",
9706
9726
  style: { gridTemplateColumns: e ? `${n.size}px 1fr` : "0px 1fr" },
9707
9727
  children: [
@@ -9714,23 +9734,23 @@ function Vu() {
9714
9734
  onClick: () => t(!e),
9715
9735
  "aria-label": "Toggle sidebar",
9716
9736
  title: "Toggle sidebar",
9717
- children: /* @__PURE__ */ x(ve, { className: "size-5" })
9737
+ children: /* @__PURE__ */ x(_e, { className: "size-5" })
9718
9738
  }), /* @__PURE__ */ x("div", {
9719
9739
  className: "flex-1 min-w-0",
9720
- children: /* @__PURE__ */ x(Ru, {
9740
+ children: /* @__PURE__ */ x(Bu, {
9721
9741
  section: "Header",
9722
9742
  children: /* @__PURE__ */ S(ct, { children: [
9723
9743
  /* @__PURE__ */ x(dt, {
9724
9744
  path: "/:table/*",
9725
- element: /* @__PURE__ */ x(Lu, {})
9745
+ element: /* @__PURE__ */ x(zu, {})
9726
9746
  }),
9727
9747
  /* @__PURE__ */ x(dt, {
9728
9748
  path: "/:table",
9729
- element: /* @__PURE__ */ x(Lu, {})
9749
+ element: /* @__PURE__ */ x(zu, {})
9730
9750
  }),
9731
9751
  /* @__PURE__ */ x(dt, {
9732
9752
  path: "/",
9733
- element: /* @__PURE__ */ x(Lu, {})
9753
+ element: /* @__PURE__ */ x(zu, {})
9734
9754
  })
9735
9755
  ] })
9736
9756
  })
@@ -9739,7 +9759,7 @@ function Vu() {
9739
9759
  /* @__PURE__ */ S("nav", {
9740
9760
  "aria-label": "Tables",
9741
9761
  className: `relative border-r border-border overflow-hidden min-h-0 ${e ? "" : "hidden"} md:block`,
9742
- children: [/* @__PURE__ */ x(Ru, {
9762
+ children: [/* @__PURE__ */ x(Bu, {
9743
9763
  section: "Table List",
9744
9764
  children: /* @__PURE__ */ x(lo, {})
9745
9765
  }), /* @__PURE__ */ x("div", {
@@ -9755,60 +9775,60 @@ function Vu() {
9755
9775
  }),
9756
9776
  /* @__PURE__ */ S("main", {
9757
9777
  className: "flex flex-col overflow-hidden min-h-0 px-1 py-0.5",
9758
- children: [/* @__PURE__ */ x(Ru, {
9778
+ children: [/* @__PURE__ */ x(Bu, {
9759
9779
  section: "Data Panel",
9760
9780
  children: /* @__PURE__ */ S(ct, { children: [
9761
9781
  /* @__PURE__ */ x(dt, {
9762
9782
  path: "/:table/from/:filterTable/:id/edit/:editId",
9763
- element: /* @__PURE__ */ x(Pu, {})
9783
+ element: /* @__PURE__ */ x(Fu, {})
9764
9784
  }),
9765
9785
  /* @__PURE__ */ x(dt, {
9766
9786
  path: "/:table/from/:filterTable/:id",
9767
- element: /* @__PURE__ */ x(Pu, {})
9787
+ element: /* @__PURE__ */ x(Fu, {})
9768
9788
  }),
9769
9789
  /* @__PURE__ */ x(dt, {
9770
9790
  path: "/:table/:id/edit/:editId",
9771
- element: /* @__PURE__ */ x(Pu, {})
9791
+ element: /* @__PURE__ */ x(Fu, {})
9772
9792
  }),
9773
9793
  /* @__PURE__ */ x(dt, {
9774
9794
  path: "/:table/:id",
9775
- element: /* @__PURE__ */ x(Pu, {})
9795
+ element: /* @__PURE__ */ x(Fu, {})
9776
9796
  }),
9777
9797
  /* @__PURE__ */ x(dt, {
9778
9798
  path: "/:table/edit/:editId",
9779
- element: /* @__PURE__ */ x(Pu, {})
9799
+ element: /* @__PURE__ */ x(Fu, {})
9780
9800
  }),
9781
9801
  /* @__PURE__ */ x(dt, {
9782
9802
  path: "/:table/edit",
9783
- element: /* @__PURE__ */ x(Pu, {})
9803
+ element: /* @__PURE__ */ x(Fu, {})
9784
9804
  }),
9785
9805
  /* @__PURE__ */ x(dt, {
9786
9806
  path: "/:table",
9787
- element: /* @__PURE__ */ x(Pu, {})
9807
+ element: /* @__PURE__ */ x(Fu, {})
9788
9808
  }),
9789
9809
  /* @__PURE__ */ x(dt, {
9790
9810
  path: "/",
9791
- element: /* @__PURE__ */ x(zu, {})
9811
+ element: /* @__PURE__ */ x(Vu, {})
9792
9812
  })
9793
9813
  ] })
9794
- }), /* @__PURE__ */ x(Ru, {
9814
+ }), /* @__PURE__ */ x(Bu, {
9795
9815
  section: "Data Edit",
9796
9816
  children: /* @__PURE__ */ S(ct, { children: [
9797
9817
  /* @__PURE__ */ x(dt, {
9798
9818
  path: "/:table/from/:filterTable/:id/edit/:editId",
9799
- element: /* @__PURE__ */ x(qc, {})
9819
+ element: /* @__PURE__ */ x(Jc, {})
9800
9820
  }),
9801
9821
  /* @__PURE__ */ x(dt, {
9802
9822
  path: "/:table/:id/edit/:editId",
9803
- element: /* @__PURE__ */ x(qc, {})
9823
+ element: /* @__PURE__ */ x(Jc, {})
9804
9824
  }),
9805
9825
  /* @__PURE__ */ x(dt, {
9806
9826
  path: "/:table/edit/:editId",
9807
- element: /* @__PURE__ */ x(qc, {})
9827
+ element: /* @__PURE__ */ x(Jc, {})
9808
9828
  }),
9809
9829
  /* @__PURE__ */ x(dt, {
9810
9830
  path: "/:table/edit",
9811
- element: /* @__PURE__ */ x(qc, {})
9831
+ element: /* @__PURE__ */ x(Jc, {})
9812
9832
  })
9813
9833
  ] })
9814
9834
  })]
@@ -9816,43 +9836,47 @@ function Vu() {
9816
9836
  ]
9817
9837
  }) }) });
9818
9838
  }
9819
- function Hu({ onLocate: e }) {
9839
+ function Wu({ onLocate: e }) {
9820
9840
  let t = tt();
9821
9841
  return u(() => {
9822
9842
  e?.(t);
9823
- }, [t, e]), /* @__PURE__ */ x(Vu, {});
9843
+ }, [t, e]), /* @__PURE__ */ x(Uu, {});
9824
9844
  }
9825
9845
  //#endregion
9826
9846
  //#region src/editor.tsx
9827
- function Uu({ uri: e, fetcher: t, uiPath: n, onLocate: r, showStats: i = !1, tables: a, defaultColumns: o, trailingColumns: s, tableActions: c, saveFile: l }) {
9828
- let u = d(() => t || (e ? new yt(e) : null), [e, t]), f = d(() => ({
9847
+ function Gu({ uri: e, fetcher: t, uiPath: n, onLocate: r, showStats: i = !1, tables: a, defaultColumns: o, trailingColumns: s, defaultSort: c, defaultSearchColumns: l, tableActions: u, saveFile: f }) {
9848
+ let p = d(() => t || (e ? new yt(e) : null), [e, t]), m = d(() => ({
9829
9849
  showStats: i,
9830
9850
  tables: a,
9831
9851
  defaultColumns: o,
9832
9852
  trailingColumns: s,
9833
- tableActions: c,
9834
- saveFile: l
9853
+ defaultSort: c,
9854
+ defaultSearchColumns: l,
9855
+ tableActions: u,
9856
+ saveFile: f
9835
9857
  }), [
9836
9858
  i,
9837
9859
  a,
9838
9860
  o,
9839
9861
  s,
9840
9862
  c,
9841
- l
9842
- ]), p = d(() => new h({ defaultOptions: { queries: {
9863
+ l,
9864
+ u,
9865
+ f
9866
+ ]), _ = d(() => new h({ defaultOptions: { queries: {
9843
9867
  staleTime: 3e5,
9844
9868
  retry: 1
9845
9869
  } } }), []);
9846
- if (!u) throw Error("Editor requires either a `fetcher` (GraphQLFetcher) or a `uri` prop to reach the GraphQL endpoint; neither was provided.");
9870
+ if (!p) throw Error("Editor requires either a `fetcher` (GraphQLFetcher) or a `uri` prop to reach the GraphQL endpoint; neither was provided.");
9847
9871
  return /* @__PURE__ */ x(g, {
9848
- client: p,
9872
+ client: _,
9849
9873
  children: /* @__PURE__ */ x(xt, {
9850
- value: u,
9874
+ value: p,
9851
9875
  children: /* @__PURE__ */ x(Ot, {
9852
- config: f,
9876
+ config: m,
9853
9877
  children: /* @__PURE__ */ x(Qa, { children: /* @__PURE__ */ x(ot, {
9854
9878
  path: n || "/",
9855
- children: /* @__PURE__ */ x(jt, { children: /* @__PURE__ */ x(Hu, { onLocate: r }) })
9879
+ children: /* @__PURE__ */ x(jt, { children: /* @__PURE__ */ x(Wu, { onLocate: r }) })
9856
9880
  }) })
9857
9881
  })
9858
9882
  })
@@ -9860,18 +9884,18 @@ function Uu({ uri: e, fetcher: t, uiPath: n, onLocate: r, showStats: i = !1, tab
9860
9884
  }
9861
9885
  //#endregion
9862
9886
  //#region src/common/saved-objects.ts
9863
- var Wu = [
9887
+ var Ku = [
9864
9888
  "query",
9865
9889
  "form",
9866
9890
  "report",
9867
9891
  "dashboard"
9868
- ], Gu = class extends Error {
9892
+ ], qu = class extends Error {
9869
9893
  constructor(e) {
9870
9894
  super(e), this.name = "SavedObjectConflictError";
9871
9895
  }
9872
- }, Ku = "/_saved-objects";
9873
- function qu(e = "") {
9874
- let t = `${e}${Ku}`, n = encodeURIComponent;
9896
+ }, Ju = "/_saved-objects";
9897
+ function Yu(e = "") {
9898
+ let t = `${e}${Ju}`, n = encodeURIComponent;
9875
9899
  async function r(e) {
9876
9900
  try {
9877
9901
  return (await e.json())?.error ?? `${e.status} ${e.statusText}`;
@@ -9885,14 +9909,14 @@ function qu(e = "") {
9885
9909
  if (!s.ok) throw Error(`Failed to list saved objects: ${await r(s)}`);
9886
9910
  let c = await s.json();
9887
9911
  if (!Array.isArray(c)) throw Error("Failed to list saved objects: the server did not return a list.");
9888
- let l = c.map(Ju), u = l.filter((e) => e !== null);
9912
+ let l = c.map(Xu), u = l.filter((e) => e !== null);
9889
9913
  return u.length !== l.length && a?.(l.length - u.length), u;
9890
9914
  },
9891
9915
  async get(e, i, a) {
9892
9916
  let o = await fetch(`${t}/${n(e)}/${n(i)}`, { signal: a });
9893
9917
  if (o.status === 404) return null;
9894
9918
  if (!o.ok) throw Error(`Failed to load saved object: ${await r(o)}`);
9895
- return Ju(await o.json());
9919
+ return Xu(await o.json());
9896
9920
  },
9897
9921
  async put(e, i) {
9898
9922
  let a = await fetch(`${t}/${n(e.type)}/${n(e.id)}`, {
@@ -9901,9 +9925,9 @@ function qu(e = "") {
9901
9925
  body: JSON.stringify(e),
9902
9926
  signal: i
9903
9927
  });
9904
- if (a.status === 409) throw new Gu(await r(a));
9928
+ if (a.status === 409) throw new qu(await r(a));
9905
9929
  if (!a.ok) throw Error(`Failed to save object: ${await r(a)}`);
9906
- let o = Ju(await a.json());
9930
+ let o = Xu(await a.json());
9907
9931
  if (o === null) throw Error("Server returned a malformed saved object.");
9908
9932
  return o;
9909
9933
  },
@@ -9916,10 +9940,10 @@ function qu(e = "") {
9916
9940
  }
9917
9941
  };
9918
9942
  }
9919
- function Ju(e) {
9943
+ function Xu(e) {
9920
9944
  if (typeof e != "object" || !e) return null;
9921
9945
  let t = e;
9922
- return typeof t.id != "string" || t.id.length === 0 || typeof t.type != "string" || !Wu.includes(t.type) || typeof t.name != "string" || typeof t.version != "number" || !("definition" in t) ? null : {
9946
+ return typeof t.id != "string" || t.id.length === 0 || typeof t.type != "string" || !Ku.includes(t.type) || typeof t.name != "string" || typeof t.version != "number" || !("definition" in t) ? null : {
9923
9947
  id: t.id,
9924
9948
  type: t.type,
9925
9949
  name: t.name,
@@ -9930,7 +9954,7 @@ function Ju(e) {
9930
9954
  }
9931
9955
  //#endregion
9932
9956
  //#region src/lib/form-definition.ts
9933
- var Yu = 4, Xu = /* @__PURE__ */ new Set([
9957
+ var Zu = 4, Qu = /* @__PURE__ */ new Set([
9934
9958
  "text",
9935
9959
  "textarea",
9936
9960
  "number",
@@ -9939,25 +9963,25 @@ var Yu = 4, Xu = /* @__PURE__ */ new Set([
9939
9963
  "datetime",
9940
9964
  "select"
9941
9965
  ]);
9942
- function Zu(e) {
9943
- return typeof e == "string" && Xu.has(e) ? e : "text";
9966
+ function $u(e) {
9967
+ return typeof e == "string" && Qu.has(e) ? e : "text";
9944
9968
  }
9945
- function Qu(e) {
9946
- return typeof e != "number" || !Number.isFinite(e) ? 1 : Math.min(Yu, Math.max(1, Math.trunc(e)));
9969
+ function ed(e) {
9970
+ return typeof e != "number" || !Number.isFinite(e) ? 1 : Math.min(Zu, Math.max(1, Math.trunc(e)));
9947
9971
  }
9948
- function $u(e) {
9972
+ function td(e) {
9949
9973
  if (typeof e != "object" || !e) return null;
9950
9974
  let t = e;
9951
9975
  return typeof t.column != "string" || t.column === "" ? null : {
9952
9976
  column: t.column,
9953
9977
  label: typeof t.label == "string" ? t.label : t.column,
9954
- control: Zu(t.control),
9978
+ control: $u(t.control),
9955
9979
  readOnly: t.readOnly === !0,
9956
9980
  required: t.required === !0,
9957
9981
  include: t.include !== !1
9958
9982
  };
9959
9983
  }
9960
- function ed(e) {
9984
+ function nd(e) {
9961
9985
  if (typeof e != "object" || !e) return null;
9962
9986
  let t = e;
9963
9987
  return typeof t.relationship != "string" || typeof t.childTable != "string" || !Array.isArray(t.parentColumns) || !Array.isArray(t.childColumns) || !t.parentColumns.every((e) => typeof e == "string") || !t.childColumns.every((e) => typeof e == "string") || t.parentColumns.length === 0 || t.parentColumns.length !== t.childColumns.length ? null : {
@@ -9969,25 +9993,25 @@ function ed(e) {
9969
9993
  mode: t.mode === "stacked" ? "stacked" : "grid"
9970
9994
  };
9971
9995
  }
9972
- function td(e) {
9996
+ function rd(e) {
9973
9997
  if (typeof e != "object" || !e) return null;
9974
9998
  let t = e;
9975
9999
  if (typeof t.table != "string" || t.table === "" || !Array.isArray(t.fields)) return null;
9976
- let n = t.fields.map($u).filter((e) => e !== null);
10000
+ let n = t.fields.map(td).filter((e) => e !== null);
9977
10001
  return n.length === 0 ? null : {
9978
10002
  table: t.table,
9979
10003
  title: typeof t.title == "string" ? t.title : t.table,
9980
- columns: Qu(t.columns),
10004
+ columns: ed(t.columns),
9981
10005
  fields: n,
9982
- subforms: Array.isArray(t.subforms) ? t.subforms.map(ed).filter((e) => e !== null) : void 0
10006
+ subforms: Array.isArray(t.subforms) ? t.subforms.map(nd).filter((e) => e !== null) : void 0
9983
10007
  };
9984
10008
  }
9985
- function nd(e) {
10009
+ function id(e) {
9986
10010
  return e.fields.filter((e) => e.include);
9987
10011
  }
9988
10012
  //#endregion
9989
10013
  //#region src/lib/form-widget.ts
9990
- var rd = /* @__PURE__ */ new Set([
10014
+ var ad = /* @__PURE__ */ new Set([
9991
10015
  "text",
9992
10016
  "textarea",
9993
10017
  "number",
@@ -9996,17 +10020,17 @@ var rd = /* @__PURE__ */ new Set([
9996
10020
  "datetime",
9997
10021
  "select"
9998
10022
  ]);
9999
- function id(e) {
10000
- return e !== void 0 && rd.has(e) ? e : void 0;
10023
+ function od(e) {
10024
+ return e !== void 0 && ad.has(e) ? e : void 0;
10001
10025
  }
10002
- function ad(e, t) {
10026
+ function sd(e, t) {
10003
10027
  return {
10004
- control: id(t?.widget) ?? e.control,
10028
+ control: od(t?.widget) ?? e.control,
10005
10029
  readOnly: e.readOnly || t?.readOnly === !0,
10006
10030
  visible: e.include && t?.visible !== !1
10007
10031
  };
10008
10032
  }
10009
- function od(e) {
10033
+ function cd(e) {
10010
10034
  switch (e) {
10011
10035
  case "textarea": return { kind: "textarea" };
10012
10036
  case "checkbox": return { kind: "checkbox" };
@@ -10031,7 +10055,7 @@ function od(e) {
10031
10055
  }
10032
10056
  //#endregion
10033
10057
  //#region src/lib/form-runner-nav.ts
10034
- function sd(e, t, n) {
10058
+ function ld(e, t, n) {
10035
10059
  let r = Math.max(0, t - 1);
10036
10060
  switch (n) {
10037
10061
  case "first": return 0;
@@ -10040,19 +10064,19 @@ function sd(e, t, n) {
10040
10064
  case "next": return Math.max(0, Math.min(r, e + 1));
10041
10065
  }
10042
10066
  }
10043
- function cd(e, t, n) {
10044
- return sd(e, t, n) !== e;
10067
+ function ud(e, t, n) {
10068
+ return ld(e, t, n) !== e;
10045
10069
  }
10046
- function ld(e, t) {
10070
+ function dd(e, t) {
10047
10071
  return t <= 0 ? "0 of 0" : `${e + 1} of ${t}`;
10048
10072
  }
10049
10073
  //#endregion
10050
10074
  //#region src/lib/form-subform.ts
10051
- function ud(e, t, n) {
10075
+ function fd(e, t, n) {
10052
10076
  return n.sourceColumnNames.length > 0 && n.sourceColumnNames.length === n.destinationColumnNames.length && n.sourceColumnNames.every((t) => e.columns.some((e) => e.name === t)) && n.destinationColumnNames.every((e) => t.columns.some((t) => t.name === e));
10053
10077
  }
10054
- function dd(e, t, n, r) {
10055
- if (!r || !ud(e, t, n)) return null;
10078
+ function pd(e, t, n, r) {
10079
+ if (!r || !fd(e, t, n)) return null;
10056
10080
  let i = [], a = [], o = {};
10057
10081
  for (let e = 0; e < n.sourceColumnNames.length; e++) {
10058
10082
  let s = n.sourceColumnNames[e], c = n.destinationColumnNames[e], l = r[s];
@@ -10066,12 +10090,12 @@ function dd(e, t, n, r) {
10066
10090
  variables: o
10067
10091
  };
10068
10092
  }
10069
- function fd(e, t) {
10093
+ function md(e, t) {
10070
10094
  return !t || e.sourceColumnNames.length !== e.destinationColumnNames.length ? {} : Object.fromEntries(e.destinationColumnNames.map((n, r) => [n, t[e.sourceColumnNames[r]]]));
10071
10095
  }
10072
10096
  //#endregion
10073
10097
  //#region src/components/form-subform.tsx
10074
- function pd(e) {
10098
+ function hd(e) {
10075
10099
  return {
10076
10100
  table: e.name,
10077
10101
  title: e.label,
@@ -10086,14 +10110,14 @@ function pd(e) {
10086
10110
  }))
10087
10111
  };
10088
10112
  }
10089
- function md({ parent: e, child: t, subform: n, row: r }) {
10090
- let i = St(), a = y(), o = Fs(t), [s, c] = m(null), l = d(() => ({
10113
+ function gd({ parent: e, child: t, subform: n, row: r }) {
10114
+ let i = St(), a = y(), o = Is(t), [s, c] = m(null), l = d(() => ({
10091
10115
  name: n.relationship,
10092
10116
  fieldName: n.relationship,
10093
10117
  sourceColumnNames: n.parentColumns,
10094
10118
  destinationTable: t.name,
10095
10119
  destinationColumnNames: n.childColumns
10096
- }), [n, t.name]), u = d(() => dd(e, t, l, r), [
10120
+ }), [n, t.name]), u = d(() => pd(e, t, l, r), [
10097
10121
  e,
10098
10122
  t,
10099
10123
  l,
@@ -10111,13 +10135,13 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10111
10135
  queryKey: h,
10112
10136
  queryFn: () => i.query(p, u.variables),
10113
10137
  enabled: !!p
10114
- }), C = d(() => pd(t), [t]), w = d(() => fd(l, r), [l, r]);
10138
+ }), C = d(() => hd(t), [t]), w = d(() => md(l, r), [l, r]);
10115
10139
  if (!u) return /* @__PURE__ */ x("p", {
10116
- style: hd.notice,
10140
+ style: _d.notice,
10117
10141
  children: "Related records unavailable: this relationship is incomplete."
10118
10142
  });
10119
10143
  if (_) return /* @__PURE__ */ S("p", {
10120
- style: hd.notice,
10144
+ style: _d.notice,
10121
10145
  children: [
10122
10146
  "Loading ",
10123
10147
  n.label,
@@ -10126,7 +10150,7 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10126
10150
  });
10127
10151
  if (b) return /* @__PURE__ */ S("p", {
10128
10152
  role: "alert",
10129
- style: hd.error,
10153
+ style: _d.error,
10130
10154
  children: [
10131
10155
  "Failed to load ",
10132
10156
  n.label,
@@ -10141,11 +10165,11 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10141
10165
  c(null), await a.invalidateQueries({ queryKey: h });
10142
10166
  };
10143
10167
  return /* @__PURE__ */ S("section", {
10144
- style: hd.root,
10168
+ style: _d.root,
10145
10169
  "aria-label": n.label,
10146
10170
  children: [
10147
10171
  /* @__PURE__ */ x("h3", {
10148
- style: hd.title,
10172
+ style: _d.title,
10149
10173
  children: n.label
10150
10174
  }),
10151
10175
  /* @__PURE__ */ S("button", {
@@ -10154,8 +10178,8 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10154
10178
  children: ["Add ", n.label]
10155
10179
  }),
10156
10180
  s ? /* @__PURE__ */ x("div", {
10157
- style: hd.childForm,
10158
- children: /* @__PURE__ */ x(wd, {
10181
+ style: _d.childForm,
10182
+ children: /* @__PURE__ */ x(Ed, {
10159
10183
  table: t,
10160
10184
  definition: C,
10161
10185
  hiddenFields: n.childColumns,
@@ -10167,15 +10191,15 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10167
10191
  }
10168
10192
  }, s.kind === "create" ? "create" : $r(s.row, t, s.index ?? 0))
10169
10193
  }) : T.length === 0 ? /* @__PURE__ */ x("p", {
10170
- style: hd.notice,
10194
+ style: _d.notice,
10171
10195
  children: "No related records."
10172
10196
  }) : n.mode === "grid" ? /* @__PURE__ */ S("table", {
10173
- style: hd.table,
10197
+ style: _d.table,
10174
10198
  children: [/* @__PURE__ */ x("thead", { children: /* @__PURE__ */ S("tr", { children: [t.columns.map((e) => /* @__PURE__ */ x("th", {
10175
- style: hd.cell,
10199
+ style: _d.cell,
10176
10200
  children: e.label
10177
10201
  }, e.name)), /* @__PURE__ */ x("th", {})] }) }), /* @__PURE__ */ x("tbody", { children: T.map((e, n) => /* @__PURE__ */ S("tr", { children: [t.columns.map((t) => /* @__PURE__ */ x("td", {
10178
- style: hd.cell,
10202
+ style: _d.cell,
10179
10203
  children: String(e[t.name] ?? "")
10180
10204
  }, t.name)), /* @__PURE__ */ S("td", { children: [/* @__PURE__ */ x("button", {
10181
10205
  type: "button",
@@ -10192,7 +10216,7 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10192
10216
  children: "Delete"
10193
10217
  })] })] }, $r(e, t, n))) })]
10194
10218
  }) : /* @__PURE__ */ x("div", { children: T.map((e, n) => /* @__PURE__ */ S("article", {
10195
- style: hd.card,
10219
+ style: _d.card,
10196
10220
  children: [
10197
10221
  t.columns.map((t) => /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ S("strong", { children: [t.label, ": "] }), String(e[t.name] ?? "")] }, t.name)),
10198
10222
  /* @__PURE__ */ x("button", {
@@ -10215,7 +10239,7 @@ function md({ parent: e, child: t, subform: n, row: r }) {
10215
10239
  ]
10216
10240
  });
10217
10241
  }
10218
- var hd = {
10242
+ var _d = {
10219
10243
  root: {
10220
10244
  marginTop: 20,
10221
10245
  borderTop: "1px solid #d1d5db",
@@ -10256,33 +10280,33 @@ var hd = {
10256
10280
  borderRadius: 6,
10257
10281
  marginTop: 8
10258
10282
  }
10259
- }, gd = {};
10260
- function _d(e) {
10283
+ }, vd = {};
10284
+ function yd(e) {
10261
10285
  let t = e.lastIndexOf(".");
10262
10286
  return t >= 0 ? e.slice(t + 1) : e;
10263
10287
  }
10264
- function vd(e, t) {
10288
+ function bd(e, t) {
10265
10289
  let n = e.findTable(t);
10266
10290
  if (n) return n;
10267
- let r = _d(t);
10291
+ let r = yd(t);
10268
10292
  return e.data.find((e) => e.graphQlName === t || e.dbName === t || e.graphQlName === r || e.dbName === r);
10269
10293
  }
10270
- var yd = "\0new";
10271
- function bd(e, t) {
10294
+ var xd = "\0new";
10295
+ function Sd(e, t) {
10272
10296
  let n = /* @__PURE__ */ new Set();
10273
10297
  for (let t of e) n.add(t.column.name);
10274
10298
  for (let e of t.primaryKeys ?? []) n.add(e);
10275
10299
  return [...n];
10276
10300
  }
10277
- function xd(e, t) {
10301
+ function Cd(e, t) {
10278
10302
  X(e.name, "form browse table name");
10279
10303
  for (let e of t) X(e, "form browse selection field");
10280
10304
  return `query FormBrowse_${e.name}($limit: Int, $offset: Int) { ${e.name}(limit: $limit offset: $offset) { total data { ${t.join(" ")} } } }`;
10281
10305
  }
10282
- function Sd(e, t, n) {
10283
- return e === "checkbox" ? !!n : (e === "date" || e === "datetime") && (n == null || typeof n == "string") ? _c(n ?? void 0, e === "datetime" || hc(t) && !1) : n == null ? "" : String(n);
10306
+ function wd(e, t, n) {
10307
+ return e === "checkbox" ? !!n : (e === "date" || e === "datetime") && (n == null || typeof n == "string") ? vc(n ?? void 0, e === "datetime" || gc(t) && !1) : n == null ? "" : String(n);
10284
10308
  }
10285
- function Cd(e, t) {
10309
+ function Td(e, t) {
10286
10310
  let n = {
10287
10311
  fields: {},
10288
10312
  form: null
@@ -10297,17 +10321,17 @@ function Cd(e, t) {
10297
10321
  }
10298
10322
  return n.form = e instanceof Error ? e.message : String(e), n;
10299
10323
  }
10300
- function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i, initialValues: a = gd, hiddenFields: o = [], startInNewMode: s = !1, initialPkRoute: l }) {
10324
+ function Ed({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i, initialValues: a = vd, hiddenFields: o = [], startInNewMode: s = !1, initialPkRoute: l }) {
10301
10325
  let f = St(), h = y(), g = d(() => new Map(e.columns.map((e) => [e.name, e])), [e]), [_, b] = m(l ? {
10302
10326
  kind: "pk",
10303
10327
  route: l
10304
10328
  } : {
10305
10329
  kind: "offset",
10306
10330
  index: 0
10307
- }), [C, w] = m(s ? "new" : "browse"), [T, E] = m(a), [D, O] = m({}), [k, A] = m(null), [j, M] = m(""), [N, P] = m(0), F = C === "new", I = d(() => nd(t).map((e) => {
10331
+ }), [C, w] = m(s ? "new" : "browse"), [T, E] = m(a), [D, O] = m({}), [k, A] = m(null), [j, M] = m(""), [N, P] = m(0), F = C === "new", I = d(() => id(t).map((e) => {
10308
10332
  let t = g.get(e.column);
10309
10333
  if (!t) return null;
10310
- let r = ad(e, n?.[e.column]);
10334
+ let r = sd(e, n?.[e.column]);
10311
10335
  return r.visible ? {
10312
10336
  field: e,
10313
10337
  column: t,
@@ -10319,7 +10343,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10319
10343
  g,
10320
10344
  n
10321
10345
  ]), L = c((e) => !(e.readOnly || e.column.isReadOnly || e.column.isIdentity || e.column.isPrimaryKey && !F), [F]), ee = d(() => I.filter(L).map((e) => ({ column: e.column })), [I, L]), te = d(() => (e.primaryKeys ?? []).map((e) => g.get(e)).filter((e) => !!e), [e, g]), ne = d(() => new Set(ee.map((e) => e.column.name)), [ee]), R = d(() => {
10322
- let n = new Set(bd(I, e));
10346
+ let n = new Set(Sd(I, e));
10323
10347
  for (let e of t.subforms ?? []) for (let t of e.parentColumns) n.add(t);
10324
10348
  return [...n];
10325
10349
  }, [
@@ -10329,7 +10353,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10329
10353
  ]), z = d(() => {
10330
10354
  if (F || I.length === 0) return null;
10331
10355
  if (_.kind === "offset") return {
10332
- text: xd(e, R),
10356
+ text: Cd(e, R),
10333
10357
  variables: {
10334
10358
  limit: 1,
10335
10359
  offset: _.index
@@ -10357,7 +10381,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10357
10381
  ],
10358
10382
  queryFn: () => f.query(z.text, z.variables),
10359
10383
  enabled: !F && z !== null
10360
- }), ae = d(() => !re || !z ? null : z.kind === "offset" ? re[e.name]?.data?.[0] ?? null : re.value?.data?.[0] ?? null, [
10384
+ }), V = d(() => !re || !z ? null : z.kind === "offset" ? re[e.name]?.data?.[0] ?? null : re.value?.data?.[0] ?? null, [
10361
10385
  re,
10362
10386
  z,
10363
10387
  e.name
@@ -10372,51 +10396,51 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10372
10396
  z,
10373
10397
  e.name
10374
10398
  ]);
10375
- let V = F ? yd : ae ? $r(ae, e, 0) : null, H = p(null), U = p(!1);
10399
+ let H = F ? xd : V ? $r(V, e, 0) : null, ae = p(null), U = p(!1);
10376
10400
  u(() => {
10377
- if (H.current === V && U.current) return;
10378
- if (H.current = V, U.current = !1, O({}), A(null), F) {
10401
+ if (ae.current === H && U.current) return;
10402
+ if (ae.current = H, U.current = !1, O({}), A(null), F) {
10379
10403
  E(a);
10380
10404
  return;
10381
10405
  }
10382
10406
  let e = {};
10383
- for (let t of I) e[t.column.name] = ae?.[t.column.name] ?? null;
10407
+ for (let t of I) e[t.column.name] = V?.[t.column.name] ?? null;
10384
10408
  E(e);
10385
10409
  }, [
10410
+ H,
10386
10411
  V,
10387
- ae,
10388
10412
  F,
10389
10413
  I,
10390
10414
  a
10391
10415
  ]);
10392
- let W = _.kind === "offset" ? _.index : -1, oe = nc(e, ee, te, d(() => F || !ae ? "" : $r(ae, e, W < 0 ? 0 : W), [
10416
+ let W = _.kind === "offset" ? _.index : -1, oe = rc(e, ee, te, d(() => F || !V ? "" : $r(V, e, W < 0 ? 0 : W), [
10393
10417
  F,
10394
- ae,
10418
+ V,
10395
10419
  e,
10396
10420
  W
10397
- ])), se = Fs(e), ce = c((e) => {
10421
+ ])), se = Is(e), G = c((e) => {
10398
10422
  w("browse"), b((t) => ({
10399
10423
  kind: "offset",
10400
- index: sd(t.kind === "offset" ? t.index : 0, N, e)
10424
+ index: ld(t.kind === "offset" ? t.index : 0, N, e)
10401
10425
  }));
10402
- }, [N]), le = c(() => {
10426
+ }, [N]), ce = c(() => {
10403
10427
  w("new");
10404
- }, []), ue = c(() => {
10428
+ }, []), le = c(() => {
10405
10429
  let e = j.trim();
10406
10430
  e !== "" && (w("browse"), b({
10407
10431
  kind: "pk",
10408
10432
  route: e
10409
10433
  }));
10410
- }, [j]), de = c((e, t) => {
10434
+ }, [j]), ue = c((e, t) => {
10411
10435
  U.current = !0, E((n) => ({
10412
10436
  ...n,
10413
10437
  [e]: t
10414
10438
  }));
10415
- }, []), fe = c(async () => {
10439
+ }, []), de = c(async () => {
10416
10440
  let t = {};
10417
10441
  for (let e of I) {
10418
10442
  if (!L(e)) continue;
10419
- let n = e.field.required || !e.column.isNullable, r = Js(e.column, T[e.column.name], n);
10443
+ let n = e.field.required || !e.column.isNullable, r = Ys(e.column, T[e.column.name], n);
10420
10444
  r && (t[e.column.name] = r);
10421
10445
  }
10422
10446
  if (Object.keys(t).length > 0) {
@@ -10439,7 +10463,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10439
10463
  });
10440
10464
  } else await oe.update(n), U.current = !1, await h.invalidateQueries({ queryKey: ["formRunner", e.name] });
10441
10465
  } catch (e) {
10442
- let t = Cd(e, ne);
10466
+ let t = Td(e, ne);
10443
10467
  O(t.fields), A(t.form);
10444
10468
  }
10445
10469
  }, [
@@ -10452,8 +10476,8 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10452
10476
  e,
10453
10477
  g,
10454
10478
  h
10455
- ]), pe = c(async () => {
10456
- let t = ei(ae, e);
10479
+ ]), fe = c(async () => {
10480
+ let t = ei(V, e);
10457
10481
  if (t) try {
10458
10482
  await se.deleteRow(t), w("browse"), b({
10459
10483
  kind: "offset",
@@ -10463,7 +10487,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10463
10487
  A(e instanceof Error ? e.message : String(e));
10464
10488
  }
10465
10489
  }, [
10466
- ae,
10490
+ V,
10467
10491
  e,
10468
10492
  se,
10469
10493
  W,
@@ -10473,7 +10497,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10473
10497
  style: $.notice,
10474
10498
  children: "This form has no fields that match the current schema."
10475
10499
  });
10476
- let me = _.kind === "pk" ? `key ${_.route}` : ld(W, N), he = !F && _.kind === "offset" && N === 0 && !ie;
10500
+ let pe = _.kind === "pk" ? `key ${_.route}` : dd(W, N), me = !F && _.kind === "offset" && N === 0 && !ie;
10477
10501
  return /* @__PURE__ */ S("div", {
10478
10502
  style: $.root,
10479
10503
  children: [
@@ -10485,37 +10509,37 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10485
10509
  /* @__PURE__ */ x("button", {
10486
10510
  type: "button",
10487
10511
  style: $.btn,
10488
- onClick: () => ce("first"),
10489
- disabled: F || !cd(W, N, "first"),
10512
+ onClick: () => G("first"),
10513
+ disabled: F || !ud(W, N, "first"),
10490
10514
  "aria-label": "First record",
10491
10515
  children: "⏮"
10492
10516
  }),
10493
10517
  /* @__PURE__ */ x("button", {
10494
10518
  type: "button",
10495
10519
  style: $.btn,
10496
- onClick: () => ce("prev"),
10497
- disabled: F || !cd(W, N, "prev"),
10520
+ onClick: () => G("prev"),
10521
+ disabled: F || !ud(W, N, "prev"),
10498
10522
  "aria-label": "Previous record",
10499
10523
  children: "◀"
10500
10524
  }),
10501
10525
  /* @__PURE__ */ x("span", {
10502
10526
  style: $.position,
10503
10527
  "aria-label": "Record position",
10504
- children: F ? "New record" : me
10528
+ children: F ? "New record" : pe
10505
10529
  }),
10506
10530
  /* @__PURE__ */ x("button", {
10507
10531
  type: "button",
10508
10532
  style: $.btn,
10509
- onClick: () => ce("next"),
10510
- disabled: F || !cd(W, N, "next"),
10533
+ onClick: () => G("next"),
10534
+ disabled: F || !ud(W, N, "next"),
10511
10535
  "aria-label": "Next record",
10512
10536
  children: "▶"
10513
10537
  }),
10514
10538
  /* @__PURE__ */ x("button", {
10515
10539
  type: "button",
10516
10540
  style: $.btn,
10517
- onClick: () => ce("last"),
10518
- disabled: F || !cd(W, N, "last"),
10541
+ onClick: () => G("last"),
10542
+ disabled: F || !ud(W, N, "last"),
10519
10543
  "aria-label": "Last record",
10520
10544
  children: "⏭"
10521
10545
  }),
@@ -10530,14 +10554,14 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10530
10554
  /* @__PURE__ */ x("button", {
10531
10555
  type: "button",
10532
10556
  style: $.btn,
10533
- onClick: ue,
10557
+ onClick: le,
10534
10558
  "aria-label": "Go to key",
10535
10559
  children: "Go"
10536
10560
  }),
10537
10561
  /* @__PURE__ */ x("button", {
10538
10562
  type: "button",
10539
10563
  style: $.btn,
10540
- onClick: le,
10564
+ onClick: ce,
10541
10565
  "aria-label": "New record",
10542
10566
  children: "New"
10543
10567
  }),
@@ -10567,7 +10591,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10567
10591
  style: $.formError,
10568
10592
  children: ["Failed to load record: ", B.message]
10569
10593
  }),
10570
- he ? /* @__PURE__ */ x("p", {
10594
+ me ? /* @__PURE__ */ x("p", {
10571
10595
  style: $.notice,
10572
10596
  children: "No records. Use “New” to create one."
10573
10597
  }) : /* @__PURE__ */ x("div", {
@@ -10587,7 +10611,7 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10587
10611
  children: " *"
10588
10612
  })]
10589
10613
  }),
10590
- Td(e, n, t, i, de),
10614
+ Dd(e, n, t, i, ue),
10591
10615
  r && /* @__PURE__ */ x("span", {
10592
10616
  role: "alert",
10593
10617
  style: $.fieldError,
@@ -10597,13 +10621,13 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10597
10621
  }, e.column.name);
10598
10622
  })
10599
10623
  }),
10600
- !F && ae && i && (t.subforms ?? []).map((t) => {
10601
- let n = vd(i, t.childTable);
10602
- return n ? /* @__PURE__ */ x(md, {
10624
+ !F && V && i && (t.subforms ?? []).map((t) => {
10625
+ let n = bd(i, t.childTable);
10626
+ return n ? /* @__PURE__ */ x(gd, {
10603
10627
  parent: e,
10604
10628
  child: n,
10605
10629
  subform: t,
10606
- row: ae
10630
+ row: V
10607
10631
  }, t.relationship) : /* @__PURE__ */ S("p", {
10608
10632
  style: $.notice,
10609
10633
  children: [t.label, " is not available in this schema."]
@@ -10616,13 +10640,13 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10616
10640
  children: [/* @__PURE__ */ x("button", {
10617
10641
  type: "button",
10618
10642
  style: $.primaryBtn,
10619
- onClick: fe,
10620
- disabled: oe.isPending || he && !F,
10643
+ onClick: de,
10644
+ disabled: oe.isPending || me && !F,
10621
10645
  children: F ? "Create" : "Save"
10622
- }), !F && !he && /* @__PURE__ */ x("button", {
10646
+ }), !F && !me && /* @__PURE__ */ x("button", {
10623
10647
  type: "button",
10624
10648
  style: $.btn,
10625
- onClick: pe,
10649
+ onClick: fe,
10626
10650
  disabled: se.isPending,
10627
10651
  children: "Delete"
10628
10652
  })]
@@ -10630,8 +10654,8 @@ function wd({ table: e, definition: t, fieldMetadata: n, onClose: r, schema: i,
10630
10654
  ]
10631
10655
  });
10632
10656
  }
10633
- function Td(e, t, n, r, i) {
10634
- let a = e.column.name, o = od(e.control), s = {
10657
+ function Dd(e, t, n, r, i) {
10658
+ let a = e.column.name, o = cd(e.control), s = {
10635
10659
  id: a,
10636
10660
  "aria-label": e.field.label,
10637
10661
  disabled: !n,
@@ -10640,21 +10664,21 @@ function Td(e, t, n, r, i) {
10640
10664
  if (o.kind === "checkbox") return /* @__PURE__ */ x("input", {
10641
10665
  ...s,
10642
10666
  type: "checkbox",
10643
- checked: !!Sd("checkbox", e.column, t),
10667
+ checked: !!wd("checkbox", e.column, t),
10644
10668
  onChange: (e) => i(a, e.target.checked)
10645
10669
  });
10646
10670
  if (o.kind === "textarea") return /* @__PURE__ */ x("textarea", {
10647
10671
  ...s,
10648
10672
  rows: 3,
10649
10673
  required: r,
10650
- value: String(Sd("text", e.column, t)),
10674
+ value: String(wd("text", e.column, t)),
10651
10675
  onChange: (e) => i(a, e.target.value)
10652
10676
  });
10653
10677
  if (o.kind === "select") {
10654
10678
  let n = e.column.enumValues ?? [], o = e.column.enumLabels && e.column.enumLabels.length === n.length ? e.column.enumLabels : n;
10655
10679
  return /* @__PURE__ */ S("select", {
10656
10680
  ...s,
10657
- value: String(Sd("text", e.column, t)),
10681
+ value: String(wd("text", e.column, t)),
10658
10682
  onChange: (e) => i(a, e.target.value === "" ? null : e.target.value),
10659
10683
  children: [!r && /* @__PURE__ */ x("option", {
10660
10684
  value: "",
@@ -10669,11 +10693,11 @@ function Td(e, t, n, r, i) {
10669
10693
  ...s,
10670
10694
  type: o.type,
10671
10695
  required: r,
10672
- value: String(Sd(e.control, e.column, t)),
10696
+ value: String(wd(e.control, e.column, t)),
10673
10697
  onChange: (e) => i(a, e.target.value)
10674
10698
  });
10675
10699
  }
10676
- function Ed({ definition: e, fieldMetadata: t, onClose: n }) {
10700
+ function Od({ definition: e, fieldMetadata: t, onClose: n }) {
10677
10701
  let r = Mt();
10678
10702
  if (r.loading) return /* @__PURE__ */ x("div", {
10679
10703
  style: $.notice,
@@ -10683,8 +10707,8 @@ function Ed({ definition: e, fieldMetadata: t, onClose: n }) {
10683
10707
  style: $.notice,
10684
10708
  children: ["Could not load schema: ", r.error.message]
10685
10709
  });
10686
- let i = vd(r, e.table);
10687
- return i ? /* @__PURE__ */ x(wd, {
10710
+ let i = bd(r, e.table);
10711
+ return i ? /* @__PURE__ */ x(Ed, {
10688
10712
  table: i,
10689
10713
  definition: e,
10690
10714
  fieldMetadata: t,
@@ -10806,7 +10830,7 @@ var $ = {
10806
10830
  };
10807
10831
  //#endregion
10808
10832
  //#region src/components/form-runner-host.tsx
10809
- function Dd({ fetcher: e, definition: t, fieldMetadata: n, onClose: r }) {
10833
+ function kd({ fetcher: e, definition: t, fieldMetadata: n, onClose: r }) {
10810
10834
  let i = d(() => new h({ defaultOptions: { queries: {
10811
10835
  staleTime: 3e5,
10812
10836
  retry: 1
@@ -10815,7 +10839,7 @@ function Dd({ fetcher: e, definition: t, fieldMetadata: n, onClose: r }) {
10815
10839
  client: i,
10816
10840
  children: /* @__PURE__ */ x(xt, {
10817
10841
  value: e,
10818
- children: /* @__PURE__ */ x(Qa, { children: /* @__PURE__ */ x(jt, { children: /* @__PURE__ */ x(Ed, {
10842
+ children: /* @__PURE__ */ x(Qa, { children: /* @__PURE__ */ x(jt, { children: /* @__PURE__ */ x(Od, {
10819
10843
  definition: t,
10820
10844
  fieldMetadata: n,
10821
10845
  onClose: r
@@ -10825,6 +10849,6 @@ function Dd({ fetcher: e, definition: t, fieldMetadata: n, onClose: r }) {
10825
10849
  }
10826
10850
  //#endregion
10827
10851
  //#region src/index.ts
10828
- var Od = Uu;
10852
+ var Ad = Gu;
10829
10853
  //#endregion
10830
- export { Ua as DEFAULT_ROW_CAP, Uu as Editor, Ed as FormRunner, Dd as FormRunnerHost, wd as FormRunnerView, vt as GraphQLRequestError, yt as HttpGraphQLFetcher, Ku as SAVED_OBJECTS_PATH, Gu as SavedObjectConflictError, ja as UTF8_BOM, Ia as buildCsv, za as buildJson, qu as createSavedObjectsClient, Od as default, Hi as deserializeColumnFilters, Ka as downloadTextFile, Ha as exportAllRows, Ga as filenameFor, Pa as formatCsvCell, Wa as mimeFor, td as parseFormDefinition, Ju as parseSavedObject, vd as resolveDefinitionTable, Vi as serializeColumnFilters, nc as useTableMutation, nd as visibleFields };
10854
+ export { Ua as DEFAULT_ROW_CAP, Gu as Editor, Od as FormRunner, kd as FormRunnerHost, Ed as FormRunnerView, vt as GraphQLRequestError, yt as HttpGraphQLFetcher, Ju as SAVED_OBJECTS_PATH, qu as SavedObjectConflictError, ja as UTF8_BOM, Ia as buildCsv, za as buildJson, Yu as createSavedObjectsClient, Ad as default, Hi as deserializeColumnFilters, Ka as downloadTextFile, Ha as exportAllRows, Ga as filenameFor, Pa as formatCsvCell, Wa as mimeFor, rd as parseFormDefinition, Xu as parseSavedObject, bd as resolveDefinitionTable, Vi as serializeColumnFilters, rc as useTableMutation, id as visibleFields };