yamlite 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +7 -3
  2. package/dist/browser/chokidar.mjs +1 -1
  3. package/dist/browser/expose.mjs +10 -17
  4. package/dist/browser/fs.d.mts +5 -0
  5. package/dist/browser/fs.mjs +1 -1
  6. package/dist/cli.mjs +3 -2
  7. package/dist/core.d.mts +22 -13
  8. package/dist/core.mjs +3 -3
  9. package/dist/{fs-DZ4QHM93.mjs → fs-BM30qNPb.mjs} +8 -1
  10. package/dist/{index-OSyELQEX.d.mts → index-CDLxve55.d.mts} +2 -0
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +1 -1
  13. package/dist/{src-DdRmp-vT.mjs → src-NOJw_gTE.mjs} +185 -12
  14. package/dist/ui/assets/{ErdView-Cv4lBB9J.js → ErdView-Dqs3Ly-E.js} +1 -1
  15. package/dist/ui/assets/{MarkdownField-UKgTcG0X.js → MarkdownField-Bg4zDZM_.js} +1 -1
  16. package/dist/ui/assets/PageView-D0hs43d8.js +1 -0
  17. package/dist/ui/assets/access-DSnHSuXB.js +1 -0
  18. package/dist/ui/assets/{index-BnlDexUD.js → index-LbUt_Zkt.js} +58 -57
  19. package/dist/ui/assets/load-ylhnQAWa.js +2 -0
  20. package/dist/ui/index.html +1 -1
  21. package/dist/ui-embed/{ErdView-Dk-iexgy.js → ErdView-CgNnAf5I.js} +2 -2
  22. package/dist/ui-embed/{HintPopover-D5P2UuTa.js → HintPopover-8CeJLQO5.js} +1611 -1605
  23. package/dist/ui-embed/{PageView-BzCYlXPg.js → PageView-B29tXeqW.js} +158 -141
  24. package/dist/ui-embed/{activity-letLdXN4.js → activity-DecWPHxS.js} +1 -1
  25. package/dist/ui-embed/embed.js +875 -852
  26. package/dist/ui-embed/{pageFrame-CFoU6UjD.js → pageFrame-ClOBfTt9.js} +1 -1
  27. package/dist/{workspace-B4WnIeHR.mjs → workspace-Cp5-yHYp.mjs} +7 -3
  28. package/package.json +1 -1
  29. package/dist/ui/assets/PageView-SFpedZG6.js +0 -1
  30. package/dist/ui/assets/load-S46Mj3YT.js +0 -2
@@ -1,7 +1,7 @@
1
1
  import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, c as u, d, f, g as p, h as m, i as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w, v as T, w as ee, x as te, y as E } from "./theme-BwJfOY1V.js";
2
- import { A as D, At as O, B as ne, Ct as re, D as k, E as A, F as ie, Ft as ae, G as j, H as oe, I as se, It as ce, L as le, M, Mt as ue, Nt as de, O as fe, Ot as pe, P as me, Pt as he, R as ge, Rt as N, S as P, St as _e, T as ve, Tt as ye, U as be, V as xe, W as F, _ as Se, a as Ce, b as we, bt as Te, c as I, ct as Ee, d as De, f as Oe, g as ke, gt as Ae, h as je, ht as Me, i as Ne, j as Pe, jt as Fe, kt as Ie, l as L, m as Le, mt as Re, n as ze, o as Be, p as Ve, pt as He, t as Ue, u as We, v as Ge, w as Ke, wt as qe, x as Je, xt as Ye, y as Xe, yt as Ze, z as R, zt as Qe } from "./HintPopover-D5P2UuTa.js";
3
- import { $ as $e, A as et, B as tt, C as nt, E as rt, F as it, G as at, H as ot, I as st, J as ct, K as lt, L as ut, M as dt, N as ft, O as pt, P as mt, Q as ht, R as gt, S as _t, T as vt, U as yt, V as bt, W as xt, X as St, Y as Ct, Z as wt, a as Tt, at as Et, b as Dt, c as Ot, ct as kt, d as At, dt as jt, et as Mt, f as Nt, g as Pt, h as Ft, i as It, it as Lt, j as Rt, k as zt, l as Bt, lt as Vt, m as Ht, n as Ut, nt as Wt, o as z, ot as Gt, p as Kt, q as qt, r as Jt, rt as Yt, s as Xt, st as Zt, tt as Qt, u as $t, ut as en, v as tn, w as nn, x as rn, y as an, z as on } from "./pageFrame-CFoU6UjD.js";
4
- import { a as sn, c as cn, d as ln, f as un, i as dn, l as fn, o as pn, r as mn, s as hn, t as gn, u as _n } from "./activity-letLdXN4.js";
2
+ import { A as D, At as O, B as ne, Ct as re, D as k, E as A, F as ie, Ft as ae, G as j, H as oe, I as se, It as ce, L as le, M, Mt as ue, Nt as de, O as fe, Ot as pe, P as me, Pt as he, R as ge, Rt as N, S as P, St as _e, T as ve, Tt as ye, U as be, V as xe, W as F, _ as Se, a as Ce, b as we, bt as Te, c as I, ct as Ee, d as De, f as Oe, g as ke, gt as Ae, h as je, ht as Me, i as Ne, j as Pe, jt as Fe, kt as Ie, l as L, m as Le, mt as Re, n as ze, o as Be, p as Ve, pt as He, t as Ue, u as We, v as Ge, w as Ke, wt as qe, x as Je, xt as Ye, y as Xe, yt as Ze, z as R, zt as Qe } from "./HintPopover-8CeJLQO5.js";
3
+ import { $ as $e, A as et, B as tt, C as nt, E as rt, F as it, G as at, H as ot, I as st, J as ct, K as lt, L as ut, M as dt, N as ft, O as pt, P as mt, Q as ht, R as gt, S as _t, T as vt, U as yt, V as bt, W as xt, X as St, Y as Ct, Z as wt, a as Tt, at as Et, b as Dt, c as Ot, ct as kt, d as At, dt as jt, et as Mt, f as Nt, g as Pt, h as Ft, i as It, it as Lt, j as Rt, k as zt, l as Bt, lt as Vt, m as Ht, n as Ut, nt as Wt, o as z, ot as Gt, p as Kt, q as qt, r as Jt, rt as Yt, s as Xt, st as Zt, tt as Qt, u as $t, ut as en, v as tn, w as nn, x as rn, y as an, z as on } from "./pageFrame-ClOBfTt9.js";
4
+ import { a as sn, c as cn, d as ln, f as un, i as dn, l as fn, o as pn, r as mn, s as hn, t as gn, u as _n } from "./activity-DecWPHxS.js";
5
5
  import { F as vn, I as yn, at as bn, c as xn, ct as Sn, it as Cn, l as wn, ot as Tn, st as En, u as Dn, z as On } from "./tabs-CLBiDAgo.js";
6
6
  import { i as kn, n as An, r as jn } from "./dist-CkcIwL4M.js";
7
7
  //#region ui/src/lib/locale.ts
@@ -11966,31 +11966,54 @@ var pv = {
11966
11966
  clip: "rect(0, 0, 0, 0)",
11967
11967
  whiteSpace: "nowrap",
11968
11968
  borderWidth: "0"
11969
- }, mv = 30, hv = (e) => [...e.trim()].length >= 2, gv = (e) => e.replace(/^[ \t]*(?:#{1,6}|[-*+]|>)[ \t]+/gm, "").replace(/\s+/g, " ");
11970
- function _v(e, t, n = mv) {
11971
- let r = e.toLowerCase().indexOf(t.toLowerCase());
11972
- if (r < 0) {
11969
+ }, mv = [
11970
+ " ",
11971
+ " ",
11972
+ "\n",
11973
+ "\r",
11974
+ "-",
11975
+ "_",
11976
+ ".",
11977
+ "/"
11978
+ ], hv = (e) => mv.includes(e), gv = (e) => [...e].filter((e) => !hv(e)).join(""), _v = 30, vv = (e) => [...gv(e.trim())].length >= 2, yv = (e) => e.replace(/^[ \t]*(?:#{1,6}|[-*+]|>)[ \t]+/gm, "").replace(/\s+/g, " ");
11979
+ function bv(e, t) {
11980
+ let n = gv(t.toLowerCase());
11981
+ if (n === "") return null;
11982
+ let r = "", i = [];
11983
+ for (let t = 0; t < e.length; t++) {
11984
+ if (hv(e[t])) continue;
11985
+ let n = e[t].toLowerCase();
11986
+ r += n;
11987
+ for (let e = 0; e < n.length; e++) i.push(t);
11988
+ }
11989
+ let a = r.indexOf(n);
11990
+ return a < 0 ? null : [i[a], i[a + n.length - 1] + 1];
11991
+ }
11992
+ function xv(e, t, n = _v) {
11993
+ let r = bv(e, t);
11994
+ if (!r) {
11973
11995
  let t = e.slice(0, n * 2);
11974
11996
  return {
11975
11997
  before: "",
11976
11998
  match: "",
11977
- after: gv(t) + (e.length > t.length ? "…" : "")
11999
+ after: yv(t) + (e.length > t.length ? "…" : "")
11978
12000
  };
11979
12001
  }
11980
- let i = r + t.length, a = Math.max(0, r - n), o = Math.min(e.length, i + n);
12002
+ let [i, a] = r, o = Math.max(0, i - n), s = Math.min(e.length, a + n);
11981
12003
  return {
11982
- before: (a > 0 ? "…" : "") + gv(e.slice(a, r)),
11983
- match: gv(e.slice(r, i)),
11984
- after: gv(e.slice(i, o)) + (o < e.length ? "…" : "")
12004
+ before: (o > 0 ? "…" : "") + yv(e.slice(o, i)),
12005
+ match: yv(e.slice(i, a)),
12006
+ after: yv(e.slice(a, s)) + (s < e.length ? "…" : "")
11985
12007
  };
11986
12008
  }
11987
- function vv(e, t) {
11988
- let n = new Map(e.map((e) => [e, V_(e.value, t)]));
12009
+ var Sv = 200;
12010
+ function Cv(e, t) {
12011
+ let n = new Map(e.map((e) => [e, V_(e.value.slice(0, Sv), t)]));
11989
12012
  return [...e].sort((e, t) => e.rank - t.rank || (n.get(t) ?? 0) - (n.get(e) ?? 0) || e.table.localeCompare(t.table) || e.key.localeCompare(t.key));
11990
12013
  }
11991
- function yv(e, t) {
12014
+ function wv(e, t) {
11992
12015
  let n = /* @__PURE__ */ new Map();
11993
- for (let r of vv(e, t)) {
12016
+ for (let r of Cv(e, t)) {
11994
12017
  let e = n.get(r.table) ?? {
11995
12018
  table: r.table,
11996
12019
  total: r.total,
@@ -12000,7 +12023,7 @@ function yv(e, t) {
12000
12023
  }
12001
12024
  return [...n.values()];
12002
12025
  }
12003
- function bv(e, t) {
12026
+ function Tv(e, t) {
12004
12027
  let n = e.trim();
12005
12028
  return j({
12006
12029
  queryKey: [
@@ -12009,26 +12032,26 @@ function bv(e, t) {
12009
12032
  t
12010
12033
  ],
12011
12034
  queryFn: () => ge.search(n, t),
12012
- enabled: hv(n),
12035
+ enabled: vv(n),
12013
12036
  placeholderData: Ee
12014
12037
  });
12015
12038
  }
12016
12039
  //#endregion
12017
12040
  //#region ui/src/components/Snippet.tsx
12018
- var xv = "rounded-[3px] bg-tomato-soft text-inherit";
12019
- function Sv({ value: e, needle: t, around: n }) {
12020
- let r = _v(e, t, n);
12041
+ var Ev = "rounded-[3px] bg-tomato-soft text-inherit";
12042
+ function Dv({ value: e, needle: t, around: n }) {
12043
+ let r = xv(e, t, n);
12021
12044
  return /* @__PURE__ */ (0, V.jsxs)("span", { children: [
12022
12045
  r.before,
12023
12046
  r.match && /* @__PURE__ */ (0, V.jsx)("mark", {
12024
- className: xv,
12047
+ className: Ev,
12025
12048
  children: r.match
12026
12049
  }),
12027
12050
  r.after
12028
12051
  ] });
12029
12052
  }
12030
- function Cv({ text: e, needle: t }) {
12031
- return /* @__PURE__ */ (0, V.jsx)(Sv, {
12053
+ function Ov({ text: e, needle: t }) {
12054
+ return /* @__PURE__ */ (0, V.jsx)(Dv, {
12032
12055
  value: e,
12033
12056
  needle: t,
12034
12057
  around: Infinity
@@ -12036,7 +12059,7 @@ function Cv({ text: e, needle: t }) {
12036
12059
  }
12037
12060
  //#endregion
12038
12061
  //#region ui/src/lib/useDebounced.ts
12039
- function wv(e, t) {
12062
+ function kv(e, t) {
12040
12063
  let [n, r] = (0, B.useState)(e);
12041
12064
  return (0, B.useEffect)(() => {
12042
12065
  let n = setTimeout(() => r(e), t);
@@ -12045,7 +12068,7 @@ function wv(e, t) {
12045
12068
  }
12046
12069
  //#endregion
12047
12070
  //#region ui/src/routes.ts
12048
- var Tv = fr()({ beforeLoad: ({ context: e, matches: t }) => {
12071
+ var Av = fr()({ beforeLoad: ({ context: e, matches: t }) => {
12049
12072
  if (e.app === void 0) return;
12050
12073
  let n = t.at(-1);
12051
12074
  if (n?.routeId !== "/app/$page" || n.params.page !== e.app) throw pe({
@@ -12053,8 +12076,8 @@ var Tv = fr()({ beforeLoad: ({ context: e, matches: t }) => {
12053
12076
  params: { page: e.app },
12054
12077
  replace: !0
12055
12078
  });
12056
- } }), Ev = dr({
12057
- getParentRoute: () => Tv,
12079
+ } }), jv = dr({
12080
+ getParentRoute: () => Av,
12058
12081
  path: "/t/$table",
12059
12082
  validateSearch: (e) => ({
12060
12083
  key: typeof e.key == "string" ? e.key : void 0,
@@ -12062,20 +12085,20 @@ var Tv = fr()({ beforeLoad: ({ context: e, matches: t }) => {
12062
12085
  q: typeof e.q == "string" ? e.q : void 0,
12063
12086
  filter: Array.isArray(e.filter) ? e.filter : void 0
12064
12087
  })
12065
- }), Dv = dr({
12066
- getParentRoute: () => Tv,
12088
+ }), Mv = dr({
12089
+ getParentRoute: () => Av,
12067
12090
  path: "/sql"
12068
- }), Ov = dr({
12069
- getParentRoute: () => Tv,
12091
+ }), Nv = dr({
12092
+ getParentRoute: () => Av,
12070
12093
  path: "/sync"
12071
- }), kv = dr({
12072
- getParentRoute: () => Tv,
12094
+ }), Pv = dr({
12095
+ getParentRoute: () => Av,
12073
12096
  path: "/erd"
12074
- }), Av = dr({
12075
- getParentRoute: () => Tv,
12097
+ }), Fv = dr({
12098
+ getParentRoute: () => Av,
12076
12099
  path: "/p/$page"
12077
- }), jv = dr({
12078
- getParentRoute: () => Tv,
12100
+ }), Iv = dr({
12101
+ getParentRoute: () => Av,
12079
12102
  path: "/app/$page",
12080
12103
  beforeLoad: ({ context: e, params: t }) => {
12081
12104
  if (e.app === void 0) throw pe({
@@ -12084,15 +12107,15 @@ var Tv = fr()({ beforeLoad: ({ context: e, matches: t }) => {
12084
12107
  replace: !0
12085
12108
  });
12086
12109
  }
12087
- }), Mv = dr({
12088
- getParentRoute: () => Tv,
12110
+ }), Lv = dr({
12111
+ getParentRoute: () => Av,
12089
12112
  path: "/search",
12090
12113
  validateSearch: (e) => ({ q: typeof e.q == "string" ? e.q : void 0 })
12091
- }), Nv = 20;
12092
- function Pv() {
12093
- let { q: e } = Mv.useSearch(), t = Ae(), [n, r] = (0, B.useState)(e ?? "");
12114
+ }), Rv = 20;
12115
+ function zv() {
12116
+ let { q: e } = Lv.useSearch(), t = Ae(), [n, r] = (0, B.useState)(e ?? "");
12094
12117
  (0, B.useEffect)(() => r((t) => t.trim() === (e ?? "") ? t : e ?? ""), [e]);
12095
- let i = wv(n.trim(), 200);
12118
+ let i = kv(n.trim(), 200);
12096
12119
  (0, B.useEffect)(() => {
12097
12120
  i !== (e ?? "") && t({
12098
12121
  to: "/search",
@@ -12104,7 +12127,7 @@ function Pv() {
12104
12127
  e,
12105
12128
  t
12106
12129
  ]);
12107
- let a = (e ?? "").trim(), o = hv(a), { data: s, isPending: c, error: l } = bv(a, Nv), u = o && s ? yv(s.hits, a) : [], d;
12130
+ let a = (e ?? "").trim(), o = vv(a), { data: s, isPending: c, error: l } = Tv(a, Rv), u = o && s ? wv(s.hits, a) : [], d;
12108
12131
  if (!o) d = /* @__PURE__ */ (0, V.jsx)("p", {
12109
12132
  className: "text-muted-foreground",
12110
12133
  children: ud()
@@ -12165,13 +12188,13 @@ function Pv() {
12165
12188
  className: "flex min-w-0 items-baseline gap-2.5",
12166
12189
  children: [/* @__PURE__ */ (0, V.jsx)("span", {
12167
12190
  className: "truncate text-[17px] font-semibold",
12168
- children: /* @__PURE__ */ (0, V.jsx)(Cv, {
12191
+ children: /* @__PURE__ */ (0, V.jsx)(Ov, {
12169
12192
  text: t.label ?? t.key,
12170
12193
  needle: a
12171
12194
  })
12172
12195
  }), t.label !== null && /* @__PURE__ */ (0, V.jsx)("span", {
12173
12196
  className: "shrink-0 font-mono text-[13px] text-muted-foreground",
12174
- children: /* @__PURE__ */ (0, V.jsx)(Cv, {
12197
+ children: /* @__PURE__ */ (0, V.jsx)(Ov, {
12175
12198
  text: t.key,
12176
12199
  needle: a
12177
12200
  })
@@ -12188,7 +12211,7 @@ function Pv() {
12188
12211
  children: t.column
12189
12212
  }), /* @__PURE__ */ (0, V.jsx)("span", {
12190
12213
  className: "truncate text-[15px] text-muted-foreground",
12191
- children: /* @__PURE__ */ (0, V.jsx)(Sv, {
12214
+ children: /* @__PURE__ */ (0, V.jsx)(Dv, {
12192
12215
  value: t.value,
12193
12216
  needle: a
12194
12217
  })
@@ -12227,14 +12250,14 @@ function Pv() {
12227
12250
  }
12228
12251
  //#endregion
12229
12252
  //#region ui/src/components/ui/sonner.tsx
12230
- var Fv = (e) => {
12253
+ var Bv = (e) => {
12231
12254
  let t = new MutationObserver(e);
12232
12255
  return t.observe(document.documentElement, {
12233
12256
  attributes: !0,
12234
12257
  attributeFilter: ["data-theme"]
12235
12258
  }), () => t.disconnect();
12236
- }, Iv = () => document.documentElement.dataset.theme, Lv = ({ ...e }) => {
12237
- let t = (0, B.useSyncExternalStore)(Fv, Iv);
12259
+ }, Vv = () => document.documentElement.dataset.theme, Hv = ({ ...e }) => {
12260
+ let t = (0, B.useSyncExternalStore)(Bv, Vv);
12238
12261
  return /* @__PURE__ */ (0, V.jsx)(be, {
12239
12262
  theme: t,
12240
12263
  className: "toaster group",
@@ -12254,24 +12277,24 @@ var Fv = (e) => {
12254
12277
  },
12255
12278
  ...e
12256
12279
  });
12257
- }, Rv = "yamlite-ai", zv = {};
12258
- function Bv() {
12280
+ }, Uv = "yamlite-ai", Wv = {};
12281
+ function Gv() {
12259
12282
  try {
12260
- return JSON.parse(localStorage.getItem(Rv) ?? "{}");
12283
+ return JSON.parse(localStorage.getItem(Uv) ?? "{}");
12261
12284
  } catch {
12262
12285
  return {};
12263
12286
  }
12264
12287
  }
12265
- function Vv(e) {
12288
+ function Kv(e) {
12266
12289
  try {
12267
- localStorage.setItem(Rv, JSON.stringify(e));
12290
+ localStorage.setItem(Uv, JSON.stringify(e));
12268
12291
  } catch {}
12269
12292
  }
12270
- function Hv() {
12293
+ function qv() {
12271
12294
  let e = fe();
12272
12295
  return me() ? null : e.data?.ai?.providers ?? null;
12273
12296
  }
12274
- function Uv() {
12297
+ function Jv() {
12275
12298
  let e = fe(), t = me() ? null : e.data?.ai;
12276
12299
  return t ? {
12277
12300
  viewerKeys: t.viewerKeys,
@@ -12279,39 +12302,39 @@ function Uv() {
12279
12302
  unavailable: t.unavailable ?? !1
12280
12303
  } : null;
12281
12304
  }
12282
- function Wv(e) {
12283
- return zv[e] ?? Bv().keys?.[e] ?? "";
12305
+ function Yv(e) {
12306
+ return Wv[e] ?? Gv().keys?.[e] ?? "";
12284
12307
  }
12285
- function Gv(e) {
12286
- return !!Bv().keys?.[e];
12308
+ function Xv(e) {
12309
+ return !!Gv().keys?.[e];
12287
12310
  }
12288
- function Kv(e, { viewerKeys: t } = { viewerKeys: !0 }) {
12289
- let n = Bv(), r = e.find((e) => e.id === n.provider) ?? e.find((e) => e.hasKey) ?? e[0];
12311
+ function Zv(e, { viewerKeys: t } = { viewerKeys: !0 }) {
12312
+ let n = Gv(), r = e.find((e) => e.id === n.provider) ?? e.find((e) => e.hasKey) ?? e[0];
12290
12313
  if (!r) return null;
12291
- let i = r.id === n.provider && n.model ? n.model : void 0, a = i && (!r.fixedModels || r.models.includes(i)) ? i : r.models[0], o = t ? Wv(r.id) : "";
12314
+ let i = r.id === n.provider && n.model ? n.model : void 0, a = i && (!r.fixedModels || r.models.includes(i)) ? i : r.models[0], o = t ? Yv(r.id) : "";
12292
12315
  return o || r.hasKey ? {
12293
12316
  provider: r.id,
12294
12317
  model: a,
12295
12318
  apiKey: o
12296
12319
  } : null;
12297
12320
  }
12298
- function qv(e, t) {
12299
- let n = { ...Bv().keys };
12300
- delete n[e.provider], delete zv[e.provider], e.apiKey && (t ? n[e.provider] = e.apiKey : zv[e.provider] = e.apiKey), Vv({
12321
+ function Qv(e, t) {
12322
+ let n = { ...Gv().keys };
12323
+ delete n[e.provider], delete Wv[e.provider], e.apiKey && (t ? n[e.provider] = e.apiKey : Wv[e.provider] = e.apiKey), Kv({
12301
12324
  provider: e.provider,
12302
12325
  model: e.model,
12303
12326
  keys: n
12304
12327
  });
12305
12328
  }
12306
- var Jv = {
12329
+ var $v = {
12307
12330
  get: () => R("GET", "/api/ai/instructions"),
12308
12331
  save: (e) => R("PUT", "/api/ai/instructions", e)
12309
- }, Yv = {
12332
+ }, ey = {
12310
12333
  items: [],
12311
12334
  busy: !1,
12312
12335
  closed: !1
12313
12336
  };
12314
- function Xv(e, t) {
12337
+ function ty(e, t) {
12315
12338
  let n = e.items;
12316
12339
  switch (t.type) {
12317
12340
  case "user": return {
@@ -12412,20 +12435,20 @@ function Xv(e, t) {
12412
12435
  };
12413
12436
  }
12414
12437
  }
12415
- var Zv = encodeURIComponent, Qv = (e) => `/api/agent/conversations/${Zv(e)}`, $v = {
12438
+ var ny = encodeURIComponent, ry = (e) => `/api/agent/conversations/${ny(e)}`, iy = {
12416
12439
  conversations: () => R("GET", "/api/agent/conversations"),
12417
12440
  start: (e) => R("POST", "/api/agent/conversations", {
12418
12441
  provider: e.provider,
12419
12442
  model: e.model,
12420
12443
  ...e.apiKey ? { apiKey: e.apiKey } : {}
12421
12444
  }),
12422
- prompt: (e, t) => R("POST", `${Qv(e)}/prompt`, { text: t }),
12423
- cancel: (e) => R("POST", `${Qv(e)}/cancel`),
12445
+ prompt: (e, t) => R("POST", `${ry(e)}/prompt`, { text: t }),
12446
+ cancel: (e) => R("POST", `${ry(e)}/cancel`),
12424
12447
  proposals: () => R("GET", "/api/agent/proposals"),
12425
- apply: (e) => R("POST", `/api/agent/proposals/${Zv(e)}/apply`),
12426
- discard: (e) => R("POST", `/api/agent/proposals/${Zv(e)}/discard`)
12448
+ apply: (e) => R("POST", `/api/agent/proposals/${ny(e)}/apply`),
12449
+ discard: (e) => R("POST", `/api/agent/proposals/${ny(e)}/discard`)
12427
12450
  };
12428
- function ey(e, t) {
12451
+ function ay(e, t) {
12429
12452
  let n = /* @__PURE__ */ new Map();
12430
12453
  for (let r of e) if (r.status === "pending") for (let e of r.rows) e.table === t && n.set(e.key, {
12431
12454
  op: e.op,
@@ -12435,9 +12458,9 @@ function ey(e, t) {
12435
12458
  });
12436
12459
  return n;
12437
12460
  }
12438
- var ty = 2, ny = ["agent-proposals"], ry = ["agent-conversations"], iy = new class {
12461
+ var oy = 2, sy = ["agent-proposals"], cy = ["agent-conversations"], ly = new class {
12439
12462
  make;
12440
- state = Yv;
12463
+ state = ey;
12441
12464
  id = null;
12442
12465
  source = null;
12443
12466
  listeners = /* @__PURE__ */ new Set();
@@ -12448,16 +12471,16 @@ var ty = 2, ny = ["agent-proposals"], ry = ["agent-conversations"], iy = new cla
12448
12471
  return this.listeners.add(e), () => this.listeners.delete(e);
12449
12472
  }
12450
12473
  async start(e) {
12451
- let { id: t } = await $v.start(e);
12474
+ let { id: t } = await iy.start(e);
12452
12475
  this.open(t);
12453
12476
  }
12454
12477
  open(e) {
12455
- ve.invalidateQueries({ queryKey: ry }), this.source?.close(), this.id = e, this.set(Yv);
12456
- let t = this.make(`${Qv(e)}/events`);
12478
+ ve.invalidateQueries({ queryKey: cy }), this.source?.close(), this.id = e, this.set(ey);
12479
+ let t = this.make(`${ry(e)}/events`);
12457
12480
  this.source = t;
12458
12481
  let n = !1;
12459
12482
  t.addEventListener("open", () => {
12460
- this.source === t && (n && this.set(Yv), n = !0);
12483
+ this.source === t && (n && this.set(ey), n = !0);
12461
12484
  }), t.addEventListener("agent", (e) => {
12462
12485
  if (this.source !== t || !(e instanceof MessageEvent) || typeof e.data != "string") return;
12463
12486
  let n;
@@ -12466,25 +12489,25 @@ var ty = 2, ny = ["agent-proposals"], ry = ["agent-conversations"], iy = new cla
12466
12489
  } catch {
12467
12490
  return;
12468
12491
  }
12469
- n.type === "proposal" && ve.invalidateQueries({ queryKey: ny }), this.set(Xv(this.state, n)), n.type === "closed" && this.disconnect(t);
12492
+ n.type === "proposal" && ve.invalidateQueries({ queryKey: sy }), this.set(ty(this.state, n)), n.type === "closed" && this.disconnect(t);
12470
12493
  }), t.addEventListener("error", () => {
12471
- if (this.source === t && t.readyState === ty && (this.disconnect(t), !this.state.closed)) {
12472
- let e = Xv(this.state, {
12494
+ if (this.source === t && t.readyState === oy && (this.disconnect(t), !this.state.closed)) {
12495
+ let e = ty(this.state, {
12473
12496
  type: "error",
12474
12497
  message: qr()
12475
12498
  });
12476
- this.set(Xv(e, { type: "closed" }));
12499
+ this.set(ty(e, { type: "closed" }));
12477
12500
  }
12478
12501
  });
12479
12502
  }
12480
12503
  async send(e) {
12481
- this.id && await $v.prompt(this.id, e);
12504
+ this.id && await iy.prompt(this.id, e);
12482
12505
  }
12483
12506
  async stop() {
12484
- this.id && await $v.cancel(this.id);
12507
+ this.id && await iy.cancel(this.id);
12485
12508
  }
12486
12509
  async reset() {
12487
- ve.invalidateQueries({ queryKey: ry }), this.source?.close(), this.source = null, this.id = null, this.set(Yv);
12510
+ ve.invalidateQueries({ queryKey: cy }), this.source?.close(), this.source = null, this.id = null, this.set(ey);
12488
12511
  }
12489
12512
  disconnect(e) {
12490
12513
  e.close(), this.source === e && (this.source = null);
@@ -12493,19 +12516,19 @@ var ty = 2, ny = ["agent-proposals"], ry = ["agent-conversations"], iy = new cla
12493
12516
  this.state = e;
12494
12517
  for (let e of this.listeners) e();
12495
12518
  }
12496
- }(), ay = () => (0, B.useSyncExternalStore)((e) => iy.subscribe(e), () => iy.state);
12497
- function oy() {
12498
- let e = Hv() !== null;
12519
+ }(), uy = () => (0, B.useSyncExternalStore)((e) => ly.subscribe(e), () => ly.state);
12520
+ function dy() {
12521
+ let e = qv() !== null;
12499
12522
  return j({
12500
- queryKey: ny,
12501
- queryFn: $v.proposals,
12523
+ queryKey: sy,
12524
+ queryFn: iy.proposals,
12502
12525
  enabled: e
12503
12526
  }).data?.proposals ?? [];
12504
12527
  }
12505
- function sy(e) {
12528
+ function fy(e) {
12506
12529
  let t = j({
12507
- queryKey: ry,
12508
- queryFn: $v.conversations,
12530
+ queryKey: cy,
12531
+ queryFn: iy.conversations,
12509
12532
  enabled: e,
12510
12533
  staleTime: 0
12511
12534
  });
@@ -12514,29 +12537,29 @@ function sy(e) {
12514
12537
  loading: t.isPending
12515
12538
  };
12516
12539
  }
12517
- var cy = () => ve.invalidateQueries({ queryKey: ny }), ly = !1, uy = /* @__PURE__ */ new Set(), dy = (e) => {
12518
- ly = e;
12519
- for (let e of uy) e();
12520
- }, fy = {
12521
- open: () => dy(!0),
12522
- close: () => dy(!1),
12523
- toggle: () => dy(!ly)
12524
- }, py = () => (0, B.useSyncExternalStore)((e) => (uy.add(e), () => uy.delete(e)), () => ly);
12540
+ var py = () => ve.invalidateQueries({ queryKey: sy }), my = !1, hy = /* @__PURE__ */ new Set(), gy = (e) => {
12541
+ my = e;
12542
+ for (let e of hy) e();
12543
+ }, _y = {
12544
+ open: () => gy(!0),
12545
+ close: () => gy(!1),
12546
+ toggle: () => gy(!my)
12547
+ }, vy = () => (0, B.useSyncExternalStore)((e) => (hy.add(e), () => hy.delete(e)), () => my);
12525
12548
  //#endregion
12526
12549
  //#region ui/src/components/ui/dropdown-menu.tsx
12527
- function my({ ...e }) {
12550
+ function yy({ ...e }) {
12528
12551
  return /* @__PURE__ */ (0, V.jsx)(Cm, {
12529
12552
  "data-slot": "dropdown-menu",
12530
12553
  ...e
12531
12554
  });
12532
12555
  }
12533
- function hy({ ...e }) {
12556
+ function by({ ...e }) {
12534
12557
  return /* @__PURE__ */ (0, V.jsx)(Tm, {
12535
12558
  "data-slot": "dropdown-menu-trigger",
12536
12559
  ...e
12537
12560
  });
12538
12561
  }
12539
- function gy({ className: e, sideOffset: t = 4, ...n }) {
12562
+ function xy({ className: e, sideOffset: t = 4, ...n }) {
12540
12563
  return /* @__PURE__ */ (0, V.jsx)(Em, { children: /* @__PURE__ */ (0, V.jsx)(Om, {
12541
12564
  "data-slot": "dropdown-menu-content",
12542
12565
  sideOffset: t,
@@ -12544,7 +12567,7 @@ function gy({ className: e, sideOffset: t = 4, ...n }) {
12544
12567
  ...n
12545
12568
  }) });
12546
12569
  }
12547
- function _y({ className: e, inset: t, variant: n = "default", ...r }) {
12570
+ function Sy({ className: e, inset: t, variant: n = "default", ...r }) {
12548
12571
  return /* @__PURE__ */ (0, V.jsx)(km, {
12549
12572
  "data-slot": "dropdown-menu-item",
12550
12573
  "data-inset": t,
@@ -12553,7 +12576,7 @@ function _y({ className: e, inset: t, variant: n = "default", ...r }) {
12553
12576
  ...r
12554
12577
  });
12555
12578
  }
12556
- function vy({ className: e, children: t, checked: n, ...r }) {
12579
+ function Cy({ className: e, children: t, checked: n, ...r }) {
12557
12580
  return /* @__PURE__ */ (0, V.jsxs)(Am, {
12558
12581
  "data-slot": "dropdown-menu-checkbox-item",
12559
12582
  className: E("relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", e),
@@ -12567,26 +12590,26 @@ function vy({ className: e, children: t, checked: n, ...r }) {
12567
12590
  }
12568
12591
  //#endregion
12569
12592
  //#region ui/src/lib/format.ts
12570
- var yy = {
12593
+ var wy = {
12571
12594
  hour: "2-digit",
12572
12595
  minute: "2-digit"
12573
- }, by = (e) => new Date(e).toLocaleTimeString(o(), yy), xy = (e) => new Date(e).toLocaleTimeString(o());
12574
- function Sy(e, t = /* @__PURE__ */ new Date()) {
12596
+ }, Ty = (e) => new Date(e).toLocaleTimeString(o(), wy), Ey = (e) => new Date(e).toLocaleTimeString(o());
12597
+ function Dy(e, t = /* @__PURE__ */ new Date()) {
12575
12598
  let n = new Date(e);
12576
- return n.toDateString() === t.toDateString() ? by(e) : n.toLocaleString(o(), {
12599
+ return n.toDateString() === t.toDateString() ? Ty(e) : n.toLocaleString(o(), {
12577
12600
  month: "numeric",
12578
12601
  day: "numeric",
12579
- ...yy
12602
+ ...wy
12580
12603
  });
12581
12604
  }
12582
- function Cy(e, t) {
12605
+ function Oy(e, t) {
12583
12606
  if (!e) return "—";
12584
12607
  let n = Math.max(0, Math.round((t - Date.parse(e)) / 1e3)), r = new Intl.RelativeTimeFormat(o(), { numeric: "always" });
12585
12608
  return n < 60 ? r.format(-n, "second") : r.format(-Math.round(n / 60), "minute");
12586
12609
  }
12587
12610
  //#endregion
12588
12611
  //#region ui/src/lib/git.ts
12589
- var wy = ["git"], Ty = {
12612
+ var ky = ["git"], Ay = {
12590
12613
  state: () => R("GET", "/api/git").then((e) => e.git),
12591
12614
  review: (e) => R("POST", "/api/git/review", e),
12592
12615
  openPr: () => R("GET", "/api/git/pr").then((e) => e.url),
@@ -12596,7 +12619,7 @@ var wy = ["git"], Ty = {
12596
12619
  defaultChanges: () => R("GET", "/api/git/default").then((e) => e.files),
12597
12620
  restoreDefault: (e) => R("POST", "/api/git/restore-default", { files: e })
12598
12621
  };
12599
- async function Ey(e) {
12622
+ async function jy(e) {
12600
12623
  for (let { table: t, key: n, before: r, after: i } of e) if (r === null) await ge.remove(t, n);
12601
12624
  else if (i === null) await ge.create(t, n, r);
12602
12625
  else {
@@ -12607,16 +12630,16 @@ async function Ey(e) {
12607
12630
  }, i);
12608
12631
  }
12609
12632
  }
12610
- function Dy() {
12633
+ function My() {
12611
12634
  let e = !me();
12612
12635
  return j({
12613
- queryKey: wy,
12614
- queryFn: Ty.state,
12636
+ queryKey: ky,
12637
+ queryFn: Ay.state,
12615
12638
  enabled: e,
12616
12639
  refetchOnWindowFocus: !0
12617
12640
  }).data ?? null;
12618
12641
  }
12619
- function Oy(e) {
12642
+ function Ny(e) {
12620
12643
  let t = /* @__PURE__ */ new Map();
12621
12644
  for (let n of e) t.set(n.table, [...t.get(n.table) ?? [], n]);
12622
12645
  return [...t.entries()].sort(([e], [t]) => e === null ? 1 : t === null ? -1 : e.localeCompare(t)).map(([e, t]) => ({
@@ -12626,11 +12649,11 @@ function Oy(e) {
12626
12649
  }
12627
12650
  //#endregion
12628
12651
  //#region ui/src/components/AiInstructionsDialog.tsx
12629
- var ky = ["ai-instructions"];
12630
- function Ay({ open: e, onOpenChange: t }) {
12652
+ var Py = ["ai-instructions"];
12653
+ function Fy({ open: e, onOpenChange: t }) {
12631
12654
  let n = He(), r = j({
12632
- queryKey: ky,
12633
- queryFn: Jv.get,
12655
+ queryKey: Py,
12656
+ queryFn: $v.get,
12634
12657
  enabled: e,
12635
12658
  staleTime: Infinity,
12636
12659
  refetchOnWindowFocus: !1
@@ -12639,16 +12662,16 @@ function Ay({ open: e, onOpenChange: t }) {
12639
12662
  r.data && !c && (a(r.data.instructions ?? ""), s(r.data.pullRequests ?? ""), l(!0));
12640
12663
  }, [r.data, c]);
12641
12664
  let u = Zt({
12642
- mutationFn: () => Jv.save({
12665
+ mutationFn: () => $v.save({
12643
12666
  instructions: i,
12644
12667
  pullRequests: o,
12645
12668
  base: r.data?.base ?? ""
12646
12669
  }),
12647
12670
  onSuccess: (e) => {
12648
- n.setQueryData(ky, e), n.invalidateQueries({ queryKey: wy }), F.success(Ri()), t(!1);
12671
+ n.setQueryData(Py, e), n.invalidateQueries({ queryKey: ky }), F.success(Ri()), t(!1);
12649
12672
  }
12650
12673
  }), d = (e) => {
12651
- t(e), e || (u.reset(), n.removeQueries({ queryKey: ky }));
12674
+ t(e), e || (u.reset(), n.removeQueries({ queryKey: Py }));
12652
12675
  }, f = u.error instanceof le && u.error.status === 409 ? Ni() : u.error instanceof Error ? u.error.message : r.error instanceof Error ? r.error.message : null;
12653
12676
  return /* @__PURE__ */ (0, V.jsx)(dt, {
12654
12677
  open: e,
@@ -12709,9 +12732,9 @@ function Ay({ open: e, onOpenChange: t }) {
12709
12732
  }
12710
12733
  //#endregion
12711
12734
  //#region ui/src/components/AiSettings.tsx
12712
- var jy = "w-full rounded-md border bg-panel px-2.5 py-1.5 text-[15px]";
12713
- function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12714
- let [i, a] = (0, B.useState)(n?.provider ?? t[0]?.id ?? ""), o = t.find((e) => e.id === i) ?? t[0], [s, c] = (0, B.useState)(n?.provider === o.id ? n.model : o.models[0]), l = (t) => e ? Wv(t) : "", u = (t) => e && Gv(t), [d, f] = (0, B.useState)(() => n?.provider === o.id ? n.apiKey : l(o.id)), [p, m] = (0, B.useState)(() => u(o.id)), h = s.trim(), g = h !== "" && (!e || d.trim() !== "" || o.hasKey);
12735
+ var Iy = "w-full rounded-md border bg-panel px-2.5 py-1.5 text-[15px]";
12736
+ function Ly({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12737
+ let [i, a] = (0, B.useState)(n?.provider ?? t[0]?.id ?? ""), o = t.find((e) => e.id === i) ?? t[0], [s, c] = (0, B.useState)(n?.provider === o.id ? n.model : o.models[0]), l = (t) => e ? Yv(t) : "", u = (t) => e && Xv(t), [d, f] = (0, B.useState)(() => n?.provider === o.id ? n.apiKey : l(o.id)), [p, m] = (0, B.useState)(() => u(o.id)), h = s.trim(), g = h !== "" && (!e || d.trim() !== "" || o.hasKey);
12715
12738
  return /* @__PURE__ */ (0, V.jsxs)("form", {
12716
12739
  "aria-label": gi(),
12717
12740
  className: "flex flex-col gap-3 border-b p-3.5 text-[15px]",
@@ -12726,7 +12749,7 @@ function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12726
12749
  /* @__PURE__ */ (0, V.jsxs)("label", {
12727
12750
  className: "flex flex-col gap-1",
12728
12751
  children: [si(), /* @__PURE__ */ (0, V.jsx)("select", {
12729
- className: jy,
12752
+ className: Iy,
12730
12753
  value: o.id,
12731
12754
  onChange: (e) => {
12732
12755
  let n = t.find((t) => t.id === e.target.value);
@@ -12741,7 +12764,7 @@ function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12741
12764
  o.fixedModels ? /* @__PURE__ */ (0, V.jsxs)("label", {
12742
12765
  className: "flex flex-col gap-1",
12743
12766
  children: [Qr(), /* @__PURE__ */ (0, V.jsx)("select", {
12744
- className: jy,
12767
+ className: Iy,
12745
12768
  value: s,
12746
12769
  onChange: (e) => c(e.target.value),
12747
12770
  children: o.models.map((e) => /* @__PURE__ */ (0, V.jsx)("option", {
@@ -12754,7 +12777,7 @@ function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12754
12777
  children: [
12755
12778
  Qr(),
12756
12779
  /* @__PURE__ */ (0, V.jsx)("input", {
12757
- className: jy,
12780
+ className: Iy,
12758
12781
  list: `ai-models-${o.id}`,
12759
12782
  autoComplete: "off",
12760
12783
  spellCheck: !1,
@@ -12775,7 +12798,7 @@ function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12775
12798
  /* @__PURE__ */ (0, V.jsxs)("label", {
12776
12799
  className: "flex flex-col gap-1",
12777
12800
  children: [Vr(), /* @__PURE__ */ (0, V.jsx)("input", {
12778
- className: jy,
12801
+ className: Iy,
12779
12802
  type: "password",
12780
12803
  autoComplete: "off",
12781
12804
  spellCheck: !1,
@@ -12808,48 +12831,48 @@ function My({ viewerKeys: e, providers: t, initial: n, onSave: r }) {
12808
12831
  }
12809
12832
  //#endregion
12810
12833
  //#region ui/src/lib/jsondiff.ts
12811
- var Ny = (e) => typeof e == "object" && !!e && !Array.isArray(e), Py = (e) => typeof e != "object" || !e, Fy = (e) => Array.isArray(e) ? `[${e.map(Fy).join(",")}]` : Ny(e) ? `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${Fy(e[t])}`).join(",")}}` : JSON.stringify(e) ?? "null", Iy = (e, t) => e === "" ? t : `${e} › ${t}`, Ly = [
12834
+ var Ry = (e) => typeof e == "object" && !!e && !Array.isArray(e), zy = (e) => typeof e != "object" || !e, By = (e) => Array.isArray(e) ? `[${e.map(By).join(",")}]` : Ry(e) ? `{${Object.keys(e).sort().map((t) => `${JSON.stringify(t)}:${By(e[t])}`).join(",")}}` : JSON.stringify(e) ?? "null", Vy = (e, t) => e === "" ? t : `${e} › ${t}`, Hy = [
12812
12835
  "id",
12813
12836
  "key",
12814
12837
  "name"
12815
- ], Ry = /(^|_)(id|key|code|uuid|slug|name)$/i, zy = /^[\w.\-:/]{1,64}$/;
12816
- function By(e) {
12838
+ ], Uy = /(^|_)(id|key|code|uuid|slug|name)$/i, Wy = /^[\w.\-:/]{1,64}$/;
12839
+ function Gy(e) {
12817
12840
  return typeof e == "string" ? e.length <= 64 && !/\s/.test(e) : typeof e == "number" || typeof e == "boolean";
12818
12841
  }
12819
- function Vy(e, t) {
12842
+ function Ky(e, t) {
12820
12843
  let n = [...e, ...t];
12821
12844
  if (n.length === 0) return null;
12822
- let r = (r) => n.every((e) => Object.hasOwn(e, r) && By(e[r])) && new Set(n.map((e) => typeof e[r])).size === 1 && [e, t].every((e) => new Set(e.map((e) => e[r])).size === e.length), i = (n) => {
12845
+ let r = (r) => n.every((e) => Object.hasOwn(e, r) && Gy(e[r])) && new Set(n.map((e) => typeof e[r])).size === 1 && [e, t].every((e) => new Set(e.map((e) => e[r])).size === e.length), i = (n) => {
12823
12846
  if (e.length === 0 || t.length === 0) return 1;
12824
12847
  let r = new Set(t.map((e) => e[n]));
12825
12848
  return e.filter((e) => r.has(e[n])).length;
12826
- }, a = Ly.find((e) => r(e) && i(e) > 0);
12849
+ }, a = Hy.find((e) => r(e) && i(e) > 0);
12827
12850
  if (a) return a;
12828
- let o = Math.ceil(Math.min(e.length, t.length) / 2), s = Object.keys(n[0]).filter((e) => !Ly.includes(e) && r(e) && i(e) >= Math.max(o, 1)), c = (e) => n.every((t) => typeof t[e] != "string" || zy.test(t[e]));
12829
- return s.find((e) => Ry.test(e)) ?? s.find((e) => c(e) && n.every((t) => typeof t[e] == "string" || Number.isInteger(t[e]))) ?? null;
12851
+ let o = Math.ceil(Math.min(e.length, t.length) / 2), s = Object.keys(n[0]).filter((e) => !Hy.includes(e) && r(e) && i(e) >= Math.max(o, 1)), c = (e) => n.every((t) => typeof t[e] != "string" || Wy.test(t[e]));
12852
+ return s.find((e) => Uy.test(e)) ?? s.find((e) => c(e) && n.every((t) => typeof t[e] == "string" || Number.isInteger(t[e]))) ?? null;
12830
12853
  }
12831
- function Hy(e, t) {
12854
+ function qy(e, t) {
12832
12855
  let n = Array.from({ length: e.length + 1 }, () => Array.from({ length: t.length + 1 }, () => 0));
12833
12856
  for (let r = e.length - 1; r >= 0; r--) for (let i = t.length - 1; i >= 0; i--) n[r][i] = e[r] === t[i] ? n[r + 1][i + 1] + 1 : Math.max(n[r + 1][i], n[r][i + 1]);
12834
12857
  let r = [], i = 0, a = 0;
12835
12858
  for (; i < e.length && a < t.length;) e[i] === t[a] ? r.push([i++, a++]) : n[i + 1][a] >= n[i][a + 1] ? i++ : a++;
12836
12859
  return r;
12837
12860
  }
12838
- function Uy(e, t, n, r) {
12839
- if (e.every(Ny) && t.every(Ny)) {
12840
- let i = Vy(e, t);
12861
+ function Jy(e, t, n, r) {
12862
+ if (e.every(Ry) && t.every(Ry)) {
12863
+ let i = Ky(e, t);
12841
12864
  if (i !== null) {
12842
12865
  let a = (e) => new Map(e.map((e) => [String(e[i]), e])), o = a(e), s = a(t);
12843
12866
  for (let [e, t] of o) {
12844
- let i = s.get(e), a = Iy(n, e);
12867
+ let i = s.get(e), a = Vy(n, e);
12845
12868
  i === void 0 ? r.push({
12846
12869
  path: a,
12847
12870
  kind: "removed",
12848
12871
  before: t
12849
- }) : Wy(t, i, a, r);
12872
+ }) : Yy(t, i, a, r);
12850
12873
  }
12851
12874
  for (let [e, t] of s) o.has(e) || r.push({
12852
- path: Iy(n, e),
12875
+ path: Vy(n, e),
12853
12876
  kind: "added",
12854
12877
  after: t
12855
12878
  });
@@ -12857,10 +12880,10 @@ function Uy(e, t, n, r) {
12857
12880
  }
12858
12881
  }
12859
12882
  if (e.length === t.length) {
12860
- e.forEach((e, i) => Wy(e, t[i], Iy(n, `[${i}]`), r));
12883
+ e.forEach((e, i) => Yy(e, t[i], Vy(n, `[${i}]`), r));
12861
12884
  return;
12862
12885
  }
12863
- let i = e.map(Fy), a = t.map(Fy), o = 0;
12886
+ let i = e.map(By), a = t.map(By), o = 0;
12864
12887
  for (; o < i.length && o < a.length && i[o] === a[o];) o++;
12865
12888
  let s = i.length, c = a.length;
12866
12889
  for (; s > o && c > o && i[s - 1] === a[c - 1];) s--, c--;
@@ -12873,57 +12896,57 @@ function Uy(e, t, n, r) {
12873
12896
  });
12874
12897
  return;
12875
12898
  }
12876
- let l = Hy(i.slice(o, s), a.slice(o, c)), u = new Set(l.map(([e]) => e + o)), d = new Set(l.map(([, e]) => e + o));
12899
+ let l = qy(i.slice(o, s), a.slice(o, c)), u = new Set(l.map(([e]) => e + o)), d = new Set(l.map(([, e]) => e + o));
12877
12900
  for (let t = o; t < s; t++) u.has(t) || r.push({
12878
- path: Iy(n, `[${t}]`),
12901
+ path: Vy(n, `[${t}]`),
12879
12902
  kind: "removed",
12880
12903
  before: e[t]
12881
12904
  });
12882
12905
  for (let e = o; e < c; e++) d.has(e) || r.push({
12883
- path: Iy(n, `[${e}]`),
12906
+ path: Vy(n, `[${e}]`),
12884
12907
  kind: "added",
12885
12908
  after: t[e]
12886
12909
  });
12887
12910
  }
12888
- function Wy(e, t, n, r) {
12889
- if (Ny(e) && Ny(t)) {
12890
- for (let i of Object.keys(e)) Object.hasOwn(t, i) ? Wy(e[i], t[i], Iy(n, i), r) : r.push({
12891
- path: Iy(n, i),
12911
+ function Yy(e, t, n, r) {
12912
+ if (Ry(e) && Ry(t)) {
12913
+ for (let i of Object.keys(e)) Object.hasOwn(t, i) ? Yy(e[i], t[i], Vy(n, i), r) : r.push({
12914
+ path: Vy(n, i),
12892
12915
  kind: "removed",
12893
12916
  before: e[i]
12894
12917
  });
12895
12918
  for (let i of Object.keys(t)) Object.hasOwn(e, i) || r.push({
12896
- path: Iy(n, i),
12919
+ path: Vy(n, i),
12897
12920
  kind: "added",
12898
12921
  after: t[i]
12899
12922
  });
12900
- } else Array.isArray(e) && Array.isArray(t) && !(e.every(Py) && t.every(Py)) ? Uy(e, t, n, r) : Fy(e) !== Fy(t) && r.push({
12923
+ } else Array.isArray(e) && Array.isArray(t) && !(e.every(zy) && t.every(zy)) ? Jy(e, t, n, r) : By(e) !== By(t) && r.push({
12901
12924
  path: n,
12902
12925
  kind: "changed",
12903
12926
  before: e,
12904
12927
  after: t
12905
12928
  });
12906
12929
  }
12907
- function Gy(e, t) {
12930
+ function Xy(e, t) {
12908
12931
  let n = [];
12909
- return Wy(e, t, "", n), n;
12932
+ return Yy(e, t, "", n), n;
12910
12933
  }
12911
- var Ky = (e) => typeof e == "object" && !!e, qy = (e) => e == null ? "—" : typeof e == "string" ? e : JSON.stringify(e), Jy = {
12934
+ var Zy = (e) => typeof e == "object" && !!e, Qy = (e) => e == null ? "—" : typeof e == "string" ? e : JSON.stringify(e), $y = {
12912
12935
  insert: qs,
12913
12936
  update: Js,
12914
12937
  delete: Ks
12915
- }, Yy = {
12938
+ }, eb = {
12916
12939
  applied: Ts,
12917
12940
  discarded: Fs,
12918
12941
  stale: Zs,
12919
12942
  failed: Is
12920
- }, Xy = {
12943
+ }, tb = {
12921
12944
  added: As,
12922
12945
  removed: Ms,
12923
12946
  changed: js
12924
- }, Zy = 200, Qy = 50;
12925
- function $y({ value: e }) {
12926
- let t = JSON.stringify(e) ?? "null", [n, r] = (0, B.useState)(!1), i = t.length > Zy;
12947
+ }, nb = 200, rb = 50;
12948
+ function ib({ value: e }) {
12949
+ let t = JSON.stringify(e) ?? "null", [n, r] = (0, B.useState)(!1), i = t.length > nb;
12927
12950
  return /* @__PURE__ */ (0, V.jsxs)("div", {
12928
12951
  className: "min-w-0",
12929
12952
  children: [/* @__PURE__ */ (0, V.jsx)("p", {
@@ -12937,12 +12960,12 @@ function $y({ value: e }) {
12937
12960
  })]
12938
12961
  });
12939
12962
  }
12940
- function eb({ field: e, before: t, after: n }) {
12941
- let r = (0, B.useMemo)(() => Gy({ [e]: t }, { [e]: n }), [
12963
+ function ab({ field: e, before: t, after: n }) {
12964
+ let r = (0, B.useMemo)(() => Xy({ [e]: t }, { [e]: n }), [
12942
12965
  e,
12943
12966
  t,
12944
12967
  n
12945
- ]), i = r.slice(0, Qy);
12968
+ ]), i = r.slice(0, rb);
12946
12969
  return r.length === 0 ? /* @__PURE__ */ (0, V.jsxs)("p", {
12947
12970
  className: "text-[14px] text-muted-foreground",
12948
12971
  children: [
@@ -12963,27 +12986,27 @@ function eb({ field: e, before: t, after: n }) {
12963
12986
  className: "flex items-baseline gap-2 text-[14px]",
12964
12987
  children: [/* @__PURE__ */ (0, V.jsx)("span", {
12965
12988
  className: E("shrink-0 rounded-full border px-2", e.kind === "removed" ? "border-err text-err" : e.kind === "added" ? "border-ok text-ok" : "text-muted-foreground"),
12966
- children: Xy[e.kind]()
12989
+ children: tb[e.kind]()
12967
12990
  }), /* @__PURE__ */ (0, V.jsx)("span", {
12968
12991
  className: "font-mono [overflow-wrap:anywhere]",
12969
12992
  children: e.path
12970
12993
  })]
12971
12994
  }),
12972
- e.kind !== "added" && /* @__PURE__ */ (0, V.jsx)($y, { value: e.before }),
12995
+ e.kind !== "added" && /* @__PURE__ */ (0, V.jsx)(ib, { value: e.before }),
12973
12996
  e.kind === "changed" && /* @__PURE__ */ (0, V.jsx)("span", {
12974
12997
  className: "text-[14px] text-muted-foreground",
12975
12998
  children: "→"
12976
12999
  }),
12977
- e.kind !== "removed" && /* @__PURE__ */ (0, V.jsx)($y, { value: e.after })
13000
+ e.kind !== "removed" && /* @__PURE__ */ (0, V.jsx)(ib, { value: e.after })
12978
13001
  ]
12979
- }, `${e.kind}:${e.path}`)), r.length > Qy && /* @__PURE__ */ (0, V.jsx)("li", {
13002
+ }, `${e.kind}:${e.path}`)), r.length > rb && /* @__PURE__ */ (0, V.jsx)("li", {
12980
13003
  className: "text-[14px] text-muted-foreground",
12981
- children: Hs({ count: r.length - Qy })
13004
+ children: Hs({ count: r.length - rb })
12982
13005
  })]
12983
13006
  });
12984
13007
  }
12985
- function tb({ row: e }) {
12986
- let t = e.op === "update" ? e.changed : Object.keys(e.after ?? e.before ?? {}), n = (t) => e.op === "update" && Ky(e.before?.[t]) && Ky(e.after?.[t]), r = t.filter((e) => !n(e));
13008
+ function ob({ row: e }) {
13009
+ let t = e.op === "update" ? e.changed : Object.keys(e.after ?? e.before ?? {}), n = (t) => e.op === "update" && Zy(e.before?.[t]) && Zy(e.after?.[t]), r = t.filter((e) => !n(e));
12987
13010
  return /* @__PURE__ */ (0, V.jsxs)("div", {
12988
13011
  className: "flex flex-col gap-1.5 border-b border-dashed py-2.5 last:border-b-0",
12989
13012
  children: [
@@ -12994,19 +13017,19 @@ function tb({ row: e }) {
12994
13017
  children: e.key
12995
13018
  }), /* @__PURE__ */ (0, V.jsx)("span", {
12996
13019
  className: E("rounded-full border px-2 text-[14px]", e.op === "delete" ? "border-err text-err" : "border-ok text-ok"),
12997
- children: Jy[e.op]()
13020
+ children: $y[e.op]()
12998
13021
  })]
12999
13022
  }),
13000
13023
  e.op !== "delete" && r.length > 0 && /* @__PURE__ */ (0, V.jsx)(z, {
13001
13024
  labels: [ks(), ws()],
13002
- format: qy,
13025
+ format: Qy,
13003
13026
  rows: r.map((t) => ({
13004
13027
  field: t,
13005
13028
  a: e.before?.[t],
13006
13029
  b: e.after?.[t]
13007
13030
  }))
13008
13031
  }),
13009
- e.op !== "delete" && t.filter(n).map((t) => /* @__PURE__ */ (0, V.jsx)(eb, {
13032
+ e.op !== "delete" && t.filter(n).map((t) => /* @__PURE__ */ (0, V.jsx)(ab, {
13010
13033
  field: t,
13011
13034
  before: e.before?.[t],
13012
13035
  after: e.after?.[t]
@@ -13014,12 +13037,12 @@ function tb({ row: e }) {
13014
13037
  ]
13015
13038
  });
13016
13039
  }
13017
- var nb = {
13040
+ var sb = {
13018
13041
  done: ho,
13019
13042
  failed: go,
13020
13043
  skipped: Lo
13021
13044
  };
13022
- function rb(e) {
13045
+ function cb(e) {
13023
13046
  switch (e.kind) {
13024
13047
  case "create_branch": return e.from ? po({
13025
13048
  name: e.name,
@@ -13032,7 +13055,7 @@ function rb(e) {
13032
13055
  case "open_pr": return bo({ title: e.title });
13033
13056
  }
13034
13057
  }
13035
- function ib({ git: e, ran: t }) {
13058
+ function lb({ git: e, ran: t }) {
13036
13059
  let n = t || e.results.some((e) => e.status !== "skipped");
13037
13060
  return /* @__PURE__ */ (0, V.jsx)("ol", {
13038
13061
  className: "flex flex-col gap-2 py-2.5",
@@ -13048,10 +13071,10 @@ function ib({ git: e, ran: t }) {
13048
13071
  className: "text-muted-foreground",
13049
13072
  children: `${r + 1}.`
13050
13073
  }),
13051
- /* @__PURE__ */ (0, V.jsx)("span", { children: rb(t) }),
13074
+ /* @__PURE__ */ (0, V.jsx)("span", { children: cb(t) }),
13052
13075
  n && i && /* @__PURE__ */ (0, V.jsx)("span", {
13053
13076
  className: E("ml-auto shrink-0 rounded-full border px-2 text-[14px]", i.status === "done" ? "border-ok text-ok" : i.status === "failed" ? "border-err text-err" : "text-muted-foreground"),
13054
- children: nb[i.status]()
13077
+ children: sb[i.status]()
13055
13078
  })
13056
13079
  ]
13057
13080
  }),
@@ -13079,10 +13102,10 @@ function ib({ git: e, ran: t }) {
13079
13102
  })
13080
13103
  });
13081
13104
  }
13082
- function ab({ proposal: e }) {
13105
+ function ub({ proposal: e }) {
13083
13106
  let t = Zt({
13084
- mutationFn: (t) => t === "apply" ? $v.apply(e.id) : $v.discard(e.id),
13085
- onSettled: () => cy(),
13107
+ mutationFn: (t) => t === "apply" ? iy.apply(e.id) : iy.discard(e.id),
13108
+ onSettled: () => py(),
13086
13109
  onError: (e) => F.error(e.message)
13087
13110
  }), n = [...new Set(e.rows.map((e) => e.table))], r = e.git ? e.git.steps.length : e.table ? 1 : e.rows.length;
13088
13111
  return /* @__PURE__ */ (0, V.jsxs)("section", {
@@ -13104,7 +13127,7 @@ function ab({ proposal: e }) {
13104
13127
  }),
13105
13128
  /* @__PURE__ */ (0, V.jsx)("div", {
13106
13129
  className: "max-h-[360px] overflow-auto px-3",
13107
- children: e.git ? /* @__PURE__ */ (0, V.jsx)(ib, {
13130
+ children: e.git ? /* @__PURE__ */ (0, V.jsx)(lb, {
13108
13131
  git: e.git,
13109
13132
  ran: e.status !== "pending"
13110
13133
  }) : e.table ? /* @__PURE__ */ (0, V.jsx)("p", {
@@ -13113,7 +13136,7 @@ function ab({ proposal: e }) {
13113
13136
  name: e.table.name,
13114
13137
  key: e.table.key
13115
13138
  })
13116
- }) : e.rows.map((e) => /* @__PURE__ */ (0, V.jsx)(tb, { row: e }, `${e.table}/${e.key}`))
13139
+ }) : e.rows.map((e) => /* @__PURE__ */ (0, V.jsx)(ob, { row: e }, `${e.table}/${e.key}`))
13117
13140
  }),
13118
13141
  e.warnings.length > 0 && /* @__PURE__ */ (0, V.jsx)("ul", {
13119
13142
  className: "border-t bg-warn-soft px-3 py-2 text-[14px] text-warn",
@@ -13151,7 +13174,7 @@ function ab({ proposal: e }) {
13151
13174
  ] }) : /* @__PURE__ */ (0, V.jsxs)("p", {
13152
13175
  className: E("text-[14px]", e.status === "applied" ? "text-ok" : e.status === "discarded" ? "text-muted-foreground" : "text-err"),
13153
13176
  children: [
13154
- Yy[e.status](),
13177
+ eb[e.status](),
13155
13178
  e.stale && `: ${e.stale.join(", ")}`,
13156
13179
  e.error && `: ${e.error}`
13157
13180
  ]
@@ -13162,7 +13185,7 @@ function ab({ proposal: e }) {
13162
13185
  }
13163
13186
  //#endregion
13164
13187
  //#region ui/src/components/AgentPanel.tsx
13165
- var ob = "max-w-none min-w-0 [overflow-wrap:anywhere] [&_a]:underline [&_code]:font-mono [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-1.5 [&_pre]:overflow-auto [&_table]:text-[14px] [&_ul]:list-disc [&_ul]:pl-5", sb = {
13188
+ var db = "max-w-none min-w-0 [overflow-wrap:anywhere] [&_a]:underline [&_code]:font-mono [&_h1]:font-semibold [&_h2]:font-semibold [&_h3]:font-semibold [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-1.5 [&_pre]:overflow-auto [&_table]:text-[14px] [&_ul]:list-disc [&_ul]:pl-5", fb = {
13166
13189
  schema: Oi,
13167
13190
  query: Di,
13168
13191
  get_records: wi,
@@ -13172,9 +13195,9 @@ var ob = "max-w-none min-w-0 [overflow-wrap:anywhere] [&_a]:underline [&_code]:f
13172
13195
  check: Si,
13173
13196
  web_search: ki,
13174
13197
  code_execution: Ci
13175
- }, cb = (e) => sb[e]?.() ?? e;
13176
- function lb({ busy: e, last: t }) {
13177
- let n = t?.kind === "tool" && t.status === "in_progress" ? cb(t.title) : null;
13198
+ }, pb = (e) => fb[e]?.() ?? e;
13199
+ function mb({ busy: e, last: t }) {
13200
+ let n = t?.kind === "tool" && t.status === "in_progress" ? pb(t.title) : null;
13178
13201
  return /* @__PURE__ */ (0, V.jsx)("p", {
13179
13202
  role: "status",
13180
13203
  "aria-live": "polite",
@@ -13193,8 +13216,8 @@ function lb({ busy: e, last: t }) {
13193
13216
  }), n ? pi({ tool: n }) : xi()] })
13194
13217
  });
13195
13218
  }
13196
- function ub({ item: e }) {
13197
- let t = cb(e.title), n = e.input, r = n?.sql ?? (e.title === "web_search" ? n?.query : void 0);
13219
+ function hb({ item: e }) {
13220
+ let t = pb(e.title), n = e.input, r = n?.sql ?? (e.title === "web_search" ? n?.query : void 0);
13198
13221
  return /* @__PURE__ */ (0, V.jsxs)("details", {
13199
13222
  className: "min-w-0 rounded-md border bg-panel px-2.5 py-1.5 text-[14px] text-muted-foreground",
13200
13223
  children: [
@@ -13206,12 +13229,12 @@ function ub({ item: e }) {
13206
13229
  className: "mt-1.5 font-mono text-[14px] whitespace-pre-wrap text-foreground [overflow-wrap:anywhere]",
13207
13230
  children: r ?? JSON.stringify(e.input, null, 2)
13208
13231
  }),
13209
- e.sources && /* @__PURE__ */ (0, V.jsx)(fb, { sources: e.sources })
13232
+ e.sources && /* @__PURE__ */ (0, V.jsx)(_b, { sources: e.sources })
13210
13233
  ]
13211
13234
  });
13212
13235
  }
13213
- var db = (e) => URL.parse(e)?.hostname || e;
13214
- function fb({ sources: e }) {
13236
+ var gb = (e) => URL.parse(e)?.hostname || e;
13237
+ function _b({ sources: e }) {
13215
13238
  return /* @__PURE__ */ (0, V.jsx)("ul", {
13216
13239
  className: "mt-1.5 flex flex-col gap-1",
13217
13240
  children: e.map((e) => /* @__PURE__ */ (0, V.jsx)("li", {
@@ -13221,41 +13244,41 @@ function fb({ sources: e }) {
13221
13244
  target: "_blank",
13222
13245
  rel: "noreferrer noopener",
13223
13246
  title: e.url,
13224
- children: e.title || db(e.url)
13247
+ children: e.title || gb(e.url)
13225
13248
  })
13226
13249
  }, e.url))
13227
13250
  });
13228
13251
  }
13229
- function pb({ sources: e }) {
13252
+ function vb({ sources: e }) {
13230
13253
  return /* @__PURE__ */ (0, V.jsxs)("details", {
13231
13254
  className: "mt-2 text-[14px] text-muted-foreground",
13232
13255
  children: [/* @__PURE__ */ (0, V.jsx)("summary", {
13233
13256
  className: "cursor-pointer",
13234
13257
  children: yi({ count: e.length })
13235
- }), /* @__PURE__ */ (0, V.jsx)(fb, { sources: e })]
13258
+ }), /* @__PURE__ */ (0, V.jsx)(_b, { sources: e })]
13236
13259
  });
13237
13260
  }
13238
- var mb = () => iy.reset().catch(() => {});
13239
- function hb({ current: e, onPick: t }) {
13240
- let [n, r] = (0, B.useState)(!1), { conversations: i, loading: a } = sy(n);
13241
- return /* @__PURE__ */ (0, V.jsxs)(my, {
13261
+ var yb = () => ly.reset().catch(() => {});
13262
+ function bb({ current: e, onPick: t }) {
13263
+ let [n, r] = (0, B.useState)(!1), { conversations: i, loading: a } = fy(n);
13264
+ return /* @__PURE__ */ (0, V.jsxs)(yy, {
13242
13265
  open: n,
13243
13266
  onOpenChange: r,
13244
- children: [/* @__PURE__ */ (0, V.jsx)(hy, {
13267
+ children: [/* @__PURE__ */ (0, V.jsx)(by, {
13245
13268
  asChild: !0,
13246
13269
  children: /* @__PURE__ */ (0, V.jsxs)(L, {
13247
13270
  variant: "ghost",
13248
13271
  className: "text-[14px]",
13249
13272
  children: [/* @__PURE__ */ (0, V.jsx)(Ug, { className: "size-4" }), Kr()]
13250
13273
  })
13251
- }), /* @__PURE__ */ (0, V.jsx)(gy, {
13274
+ }), /* @__PURE__ */ (0, V.jsx)(xy, {
13252
13275
  align: "start",
13253
13276
  className: "w-80 max-w-[calc(100vw-2rem)]",
13254
- children: i.length === 0 ? /* @__PURE__ */ (0, V.jsx)(_y, {
13277
+ children: i.length === 0 ? /* @__PURE__ */ (0, V.jsx)(Sy, {
13255
13278
  disabled: !0,
13256
13279
  className: "text-[14px]",
13257
13280
  children: a ? Wt() : ti()
13258
- }) : i.map((n) => /* @__PURE__ */ (0, V.jsxs)(_y, {
13281
+ }) : i.map((n) => /* @__PURE__ */ (0, V.jsxs)(Sy, {
13259
13282
  "aria-current": n.id === e ? "true" : void 0,
13260
13283
  className: "flex cursor-pointer flex-col items-stretch gap-0.5 py-2 aria-[current]:bg-panel-2",
13261
13284
  onSelect: () => t(n),
@@ -13264,29 +13287,29 @@ function hb({ current: e, onPick: t }) {
13264
13287
  children: n.title || Ai()
13265
13288
  }), /* @__PURE__ */ (0, V.jsxs)("span", {
13266
13289
  className: "flex gap-2 text-[14px] text-muted-foreground",
13267
- children: [/* @__PURE__ */ (0, V.jsx)("span", { children: Sy(n.updatedAt) }), /* @__PURE__ */ (0, V.jsx)("span", { children: n.model })]
13290
+ children: [/* @__PURE__ */ (0, V.jsx)("span", { children: Dy(n.updatedAt) }), /* @__PURE__ */ (0, V.jsx)("span", { children: n.model })]
13268
13291
  })]
13269
13292
  }, n.id))
13270
13293
  })]
13271
13294
  });
13272
13295
  }
13273
- function gb({ url: e }) {
13296
+ function xb({ url: e }) {
13274
13297
  return e ? /* @__PURE__ */ (0, V.jsx)("a", {
13275
13298
  href: e,
13276
13299
  className: "underline",
13277
13300
  children: ri()
13278
13301
  }) : null;
13279
13302
  }
13280
- function _b(e) {
13303
+ function Sb(e) {
13281
13304
  return e instanceof le && e.body.code === "no_key" ? Zr() : e instanceof Error ? e.message : String(e);
13282
13305
  }
13283
- function vb() {
13284
- let e = Hv(), t = Uv(), n = t?.viewerKeys ?? !0, r = ay(), [i, a] = (0, B.useState)(() => e ? Kv(e, { viewerKeys: n }) : null), [o, s] = (0, B.useState)(!1), [c, l] = (0, B.useState)(!1), [u, d] = (0, B.useState)(""), [f, p] = (0, B.useState)(null), [m, h] = (0, B.useState)(!1), g = (0, B.useRef)(!1), _ = (0, B.useRef)(null), v = (0, B.useRef)(null), y = oy(), b = new Set(r.items.flatMap((e) => e.kind === "proposal" ? [e.proposal.id] : [])), x = y.filter((e) => !b.has(e.id));
13306
+ function Cb() {
13307
+ let e = qv(), t = Jv(), n = t?.viewerKeys ?? !0, r = uy(), [i, a] = (0, B.useState)(() => e ? Zv(e, { viewerKeys: n }) : null), [o, s] = (0, B.useState)(!1), [c, l] = (0, B.useState)(!1), [u, d] = (0, B.useState)(""), [f, p] = (0, B.useState)(null), [m, h] = (0, B.useState)(!1), g = (0, B.useRef)(!1), _ = (0, B.useRef)(null), v = (0, B.useRef)(null), y = dy(), b = new Set(r.items.flatMap((e) => e.kind === "proposal" ? [e.proposal.id] : [])), x = y.filter((e) => !b.has(e.id));
13285
13308
  if ((0, B.useEffect)(() => {
13286
13309
  let e = (e) => {
13287
13310
  if (e.key !== "Escape" || e.defaultPrevented || e.isComposing || e.keyCode === 229 || document.querySelector("[role=\"dialog\"], [role=\"alertdialog\"], [data-radix-popper-content-wrapper], aside[data-record-drawer]")) return;
13288
13311
  let t = e.target instanceof HTMLElement ? e.target : null;
13289
- t && t !== v.current && t.closest("input, textarea, select, [contenteditable]") || v.current?.value.trim() || fy.close();
13312
+ t && t !== v.current && t.closest("input, textarea, select, [contenteditable]") || v.current?.value.trim() || _y.close();
13290
13313
  };
13291
13314
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
13292
13315
  }, []), (0, B.useEffect)(() => {
@@ -13299,9 +13322,9 @@ function vb() {
13299
13322
  else {
13300
13323
  g.current = !0, h(!0), p(null);
13301
13324
  try {
13302
- (!iy.id || r.closed) && (await iy.reset(), await iy.start(i)), await iy.send(e), d("");
13325
+ (!ly.id || r.closed) && (await ly.reset(), await ly.start(i)), await ly.send(e), d("");
13303
13326
  } catch (e) {
13304
- p(_b(e)), e instanceof le && e.body.code === "no_key" && s(!0);
13327
+ p(Sb(e)), e instanceof le && e.body.code === "no_key" && s(!0);
13305
13328
  } finally {
13306
13329
  g.current = !1, h(!1);
13307
13330
  }
@@ -13316,7 +13339,7 @@ function vb() {
13316
13339
  "aria-label": Qo(),
13317
13340
  children: [
13318
13341
  /* @__PURE__ */ (0, V.jsxs)(Bt, {
13319
- onClose: fy.close,
13342
+ onClose: _y.close,
13320
13343
  className: "justify-between",
13321
13344
  children: [/* @__PURE__ */ (0, V.jsxs)("div", {
13322
13345
  className: "flex min-w-0 items-center gap-1",
@@ -13332,10 +13355,10 @@ function vb() {
13332
13355
  children: i ? `${e.find((e) => e.id === i.provider)?.name ?? i.provider} · ${i.model}` : gi()
13333
13356
  })]
13334
13357
  }),
13335
- /* @__PURE__ */ (0, V.jsx)(hb, {
13336
- current: iy.id,
13358
+ /* @__PURE__ */ (0, V.jsx)(bb, {
13359
+ current: ly.id,
13337
13360
  onPick: (e) => {
13338
- p(null), iy.open(e.id);
13361
+ p(null), ly.open(e.id);
13339
13362
  }
13340
13363
  }),
13341
13364
  /* @__PURE__ */ (0, V.jsx)(L, {
@@ -13346,7 +13369,7 @@ function vb() {
13346
13369
  onClick: () => l(!0),
13347
13370
  children: /* @__PURE__ */ (0, V.jsx)(Gg, { className: "size-4" })
13348
13371
  }),
13349
- c && /* @__PURE__ */ (0, V.jsx)(Ay, {
13372
+ c && /* @__PURE__ */ (0, V.jsx)(Fy, {
13350
13373
  open: !0,
13351
13374
  onOpenChange: l
13352
13375
  })
@@ -13357,7 +13380,7 @@ function vb() {
13357
13380
  variant: "ghost",
13358
13381
  className: "text-[14px]",
13359
13382
  onClick: () => {
13360
- p(null), mb();
13383
+ p(null), yb();
13361
13384
  },
13362
13385
  children: ei()
13363
13386
  })
@@ -13365,14 +13388,14 @@ function vb() {
13365
13388
  }),
13366
13389
  w && /* @__PURE__ */ (0, V.jsxs)("div", {
13367
13390
  className: "flex flex-col items-start gap-2 border-b p-3.5 text-[15px]",
13368
- children: [/* @__PURE__ */ (0, V.jsx)("p", { children: t?.unavailable ? Br() : ni() }), /* @__PURE__ */ (0, V.jsx)(gb, { url: t?.settingsUrl })]
13391
+ children: [/* @__PURE__ */ (0, V.jsx)("p", { children: t?.unavailable ? Br() : ni() }), /* @__PURE__ */ (0, V.jsx)(xb, { url: t?.settingsUrl })]
13369
13392
  }),
13370
- T && /* @__PURE__ */ (0, V.jsx)(My, {
13393
+ T && /* @__PURE__ */ (0, V.jsx)(Ly, {
13371
13394
  viewerKeys: n,
13372
13395
  providers: e,
13373
13396
  initial: i,
13374
13397
  onSave: (e, t) => {
13375
- qv(e, t), a(e), s(!1), p(null), mb();
13398
+ Qv(e, t), a(e), s(!1), p(null), yb();
13376
13399
  }
13377
13400
  }),
13378
13401
  /* @__PURE__ */ (0, V.jsxs)("div", {
@@ -13391,7 +13414,7 @@ function vb() {
13391
13414
  className: "text-[14px] text-muted-foreground",
13392
13415
  children: ai()
13393
13416
  }),
13394
- x.map((e) => /* @__PURE__ */ (0, V.jsx)(ab, { proposal: e }, e.id))
13417
+ x.map((e) => /* @__PURE__ */ (0, V.jsx)(ub, { proposal: e }, e.id))
13395
13418
  ]
13396
13419
  }),
13397
13420
  r.items.length === 0 && /* @__PURE__ */ (0, V.jsx)("p", {
@@ -13402,7 +13425,7 @@ function vb() {
13402
13425
  className: "max-w-[85%] self-end rounded-xl rounded-br-sm bg-panel-2 px-3 py-2 whitespace-pre-wrap [overflow-wrap:anywhere]",
13403
13426
  children: e.text
13404
13427
  }, r) : e.kind === "agent" ? /* @__PURE__ */ (0, V.jsxs)("div", {
13405
- className: ob,
13428
+ className: db,
13406
13429
  children: [/* @__PURE__ */ (0, V.jsx)(kn, {
13407
13430
  remarkPlugins: [jn],
13408
13431
  disallowedElements: ["img"],
@@ -13413,20 +13436,20 @@ function vb() {
13413
13436
  rel: "noreferrer noopener"
13414
13437
  }) },
13415
13438
  children: e.text
13416
- }), e.sources && /* @__PURE__ */ (0, V.jsx)(pb, { sources: e.sources })]
13417
- }, r) : e.kind === "tool" ? /* @__PURE__ */ (0, V.jsx)(ub, { item: e }, e.id) : e.kind === "proposal" ? /* @__PURE__ */ (0, V.jsx)(ab, { proposal: e.proposal }, e.proposal.id) : !n && e.code === "auth" ? /* @__PURE__ */ (0, V.jsxs)("div", {
13439
+ }), e.sources && /* @__PURE__ */ (0, V.jsx)(vb, { sources: e.sources })]
13440
+ }, r) : e.kind === "tool" ? /* @__PURE__ */ (0, V.jsx)(hb, { item: e }, e.id) : e.kind === "proposal" ? /* @__PURE__ */ (0, V.jsx)(ub, { proposal: e.proposal }, e.proposal.id) : !n && e.code === "auth" ? /* @__PURE__ */ (0, V.jsxs)("div", {
13418
13441
  role: "alert",
13419
13442
  className: "flex flex-col items-start gap-2 rounded-md border border-err px-3 py-2",
13420
13443
  children: [/* @__PURE__ */ (0, V.jsx)("p", {
13421
13444
  className: "text-err",
13422
13445
  children: Jr()
13423
- }), /* @__PURE__ */ (0, V.jsx)(gb, { url: t?.settingsUrl })]
13446
+ }), /* @__PURE__ */ (0, V.jsx)(xb, { url: t?.settingsUrl })]
13424
13447
  }, r) : /* @__PURE__ */ (0, V.jsx)("p", {
13425
13448
  role: "alert",
13426
13449
  className: "rounded-md border border-err px-3 py-2 text-err",
13427
13450
  children: e.message
13428
13451
  }, r)),
13429
- /* @__PURE__ */ (0, V.jsx)(lb, {
13452
+ /* @__PURE__ */ (0, V.jsx)(mb, {
13430
13453
  busy: r.busy,
13431
13454
  last: r.items.at(-1)
13432
13455
  }),
@@ -13466,7 +13489,7 @@ function vb() {
13466
13489
  }), r.busy ? /* @__PURE__ */ (0, V.jsxs)(L, {
13467
13490
  type: "button",
13468
13491
  variant: "outline",
13469
- onClick: () => void iy.stop(),
13492
+ onClick: () => void ly.stop(),
13470
13493
  children: [
13471
13494
  /* @__PURE__ */ (0, V.jsx)($g, { className: "size-4" }),
13472
13495
  " ",
@@ -13484,24 +13507,24 @@ function vb() {
13484
13507
  }
13485
13508
  //#endregion
13486
13509
  //#region ui/src/components/RestoreDefaultDialog.tsx
13487
- var yb = {
13510
+ var wb = {
13488
13511
  added: Cl,
13489
13512
  modified: Tl,
13490
13513
  deleted: wl
13491
- }, bb = {
13514
+ }, Tb = {
13492
13515
  added: "text-ok",
13493
13516
  modified: "text-warn",
13494
13517
  deleted: "text-err"
13495
13518
  };
13496
- function xb({ branch: e, open: t, onOpenChange: n }) {
13519
+ function Eb({ branch: e, open: t, onOpenChange: n }) {
13497
13520
  let r = He(), { data: i, error: a } = j({
13498
- queryKey: [...wy, "default"],
13499
- queryFn: Ty.defaultChanges,
13521
+ queryKey: [...ky, "default"],
13522
+ queryFn: Ay.defaultChanges,
13500
13523
  enabled: t
13501
13524
  }), [o, s] = (0, B.useState)(/* @__PURE__ */ new Set()), [c, l] = (0, B.useState)(null), u = (i ?? []).filter((e) => o.has(e.path)), d = u.some((e) => e.unsent), f = JSON.stringify(u.map((e) => e.path)), p = c === f, m = (e) => {
13502
13525
  n(e), e || (h.reset(), s(/* @__PURE__ */ new Set()), l(null));
13503
13526
  }, h = Zt({
13504
- mutationFn: () => Ty.restoreDefault(u.map((e) => e.path)),
13527
+ mutationFn: () => Ay.restoreDefault(u.map((e) => e.path)),
13505
13528
  onSuccess: (t) => {
13506
13529
  F.success(fc({
13507
13530
  count: t.files.length,
@@ -13509,7 +13532,7 @@ function xb({ branch: e, open: t, onOpenChange: n }) {
13509
13532
  })), m(!1);
13510
13533
  },
13511
13534
  onSettled: () => {
13512
- l(null), r.invalidateQueries({ queryKey: wy });
13535
+ l(null), r.invalidateQueries({ queryKey: ky });
13513
13536
  }
13514
13537
  }), g = (e) => s((t) => {
13515
13538
  let n = new Set(t);
@@ -13536,7 +13559,7 @@ function xb({ branch: e, open: t, onOpenChange: n }) {
13536
13559
  children: [/* @__PURE__ */ (0, V.jsx)("legend", {
13537
13560
  className: "px-1 text-[13px] text-muted-foreground",
13538
13561
  children: Kc({ count: u.length })
13539
- }), Oy(i).map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
13562
+ }), Ny(i).map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
13540
13563
  className: "flex flex-col gap-0.5",
13541
13564
  children: [/* @__PURE__ */ (0, V.jsx)("div", {
13542
13565
  className: "text-[12.5px] font-semibold text-muted-foreground",
@@ -13560,8 +13583,8 @@ function xb({ branch: e, open: t, onOpenChange: n }) {
13560
13583
  children: kc()
13561
13584
  }),
13562
13585
  /* @__PURE__ */ (0, V.jsx)("span", {
13563
- className: E("ml-auto shrink-0 text-[12.5px]", bb[e.status]),
13564
- children: yb[e.status]()
13586
+ className: E("ml-auto shrink-0 text-[12.5px]", Tb[e.status]),
13587
+ children: wb[e.status]()
13565
13588
  })
13566
13589
  ]
13567
13590
  }, e.path))]
@@ -13591,15 +13614,15 @@ function xb({ branch: e, open: t, onOpenChange: n }) {
13591
13614
  }
13592
13615
  //#endregion
13593
13616
  //#region ui/src/components/ReviewDialog.tsx
13594
- var Sb = {
13617
+ var Db = {
13595
13618
  added: Cl,
13596
13619
  modified: Tl,
13597
13620
  deleted: wl
13598
- }, Cb = {
13621
+ }, Ob = {
13599
13622
  added: "text-ok",
13600
13623
  modified: "text-warn",
13601
13624
  deleted: "text-err"
13602
- }, wb = (e) => e.records === null ? {
13625
+ }, kb = (e) => e.records === null ? {
13603
13626
  records: [],
13604
13627
  files: e.status === "added" ? [] : [e.path]
13605
13628
  } : {
@@ -13608,11 +13631,11 @@ var Sb = {
13608
13631
  key: t.key
13609
13632
  })),
13610
13633
  files: []
13611
- }, Tb = (e) => e == null ? "—" : typeof e == "string" ? e : JSON.stringify(e);
13612
- function Eb({ path: e, many: t }) {
13634
+ }, Ab = (e) => e == null ? "—" : typeof e == "string" ? e : JSON.stringify(e);
13635
+ function jb({ path: e, many: t }) {
13613
13636
  let { data: n, error: r } = j({
13614
13637
  queryKey: ["gitdiff", e],
13615
- queryFn: () => Ty.diff(e)
13638
+ queryFn: () => Ay.diff(e)
13616
13639
  });
13617
13640
  return r ? /* @__PURE__ */ (0, V.jsx)("p", {
13618
13641
  className: "text-[13px] text-err",
@@ -13629,7 +13652,7 @@ function Eb({ path: e, many: t }) {
13629
13652
  children: qc()
13630
13653
  }) : /* @__PURE__ */ (0, V.jsx)(z, {
13631
13654
  labels: [Fc(), $c()],
13632
- format: Tb,
13655
+ format: Ab,
13633
13656
  rows: e.fields.map((e) => ({
13634
13657
  field: e.field,
13635
13658
  a: e.from,
@@ -13642,8 +13665,8 @@ function Eb({ path: e, many: t }) {
13642
13665
  children: Zc()
13643
13666
  });
13644
13667
  }
13645
- function Db({ table: e, record: t, busy: n, onRevert: r }) {
13646
- return t.kind === "added" ? /* @__PURE__ */ (0, V.jsx)(kb, {
13668
+ function Mb({ table: e, record: t, busy: n, onRevert: r }) {
13669
+ return t.kind === "added" ? /* @__PURE__ */ (0, V.jsx)(Pb, {
13647
13670
  label: Bc({ record: t.key }),
13648
13671
  confirm: Lc(),
13649
13672
  remove: !0,
@@ -13672,9 +13695,9 @@ function Db({ table: e, record: t, busy: n, onRevert: r }) {
13672
13695
  children: /* @__PURE__ */ (0, V.jsx)(s_, { className: "size-4" })
13673
13696
  });
13674
13697
  }
13675
- function Ob({ change: e, busy: t, onRevert: n }) {
13698
+ function Nb({ change: e, busy: t, onRevert: n }) {
13676
13699
  let r = e.status === "added";
13677
- return /* @__PURE__ */ (0, V.jsx)(kb, {
13700
+ return /* @__PURE__ */ (0, V.jsx)(Pb, {
13678
13701
  label: r ? Bc({ record: e.path }) : sl({ record: e.path }),
13679
13702
  confirm: r ? Lc() : il(),
13680
13703
  remove: r,
@@ -13685,7 +13708,7 @@ function Ob({ change: e, busy: t, onRevert: n }) {
13685
13708
  })
13686
13709
  });
13687
13710
  }
13688
- function kb({ label: e, confirm: t, remove: n = !1, busy: r, onConfirm: i }) {
13711
+ function Pb({ label: e, confirm: t, remove: n = !1, busy: r, onConfirm: i }) {
13689
13712
  let [a, o] = (0, B.useState)(!1);
13690
13713
  return (0, B.useEffect)(() => {
13691
13714
  r || o(!1);
@@ -13708,7 +13731,7 @@ function kb({ label: e, confirm: t, remove: n = !1, busy: r, onConfirm: i }) {
13708
13731
  children: n ? /* @__PURE__ */ (0, V.jsx)(ot, { className: "size-4" }) : /* @__PURE__ */ (0, V.jsx)(s_, { className: "size-4" })
13709
13732
  });
13710
13733
  }
13711
- function Ab({ label: e, kind: t, fields: n, action: r }) {
13734
+ function Fb({ label: e, kind: t, fields: n, action: r }) {
13712
13735
  return /* @__PURE__ */ (0, V.jsxs)("div", {
13713
13736
  className: "flex min-w-0 flex-1 items-center gap-2",
13714
13737
  children: [
@@ -13721,8 +13744,8 @@ function Ab({ label: e, kind: t, fields: n, action: r }) {
13721
13744
  children: n.join(", ")
13722
13745
  }),
13723
13746
  /* @__PURE__ */ (0, V.jsx)("span", {
13724
- className: E("ml-auto shrink-0 text-[12.5px]", Cb[t]),
13725
- children: Sb[t]()
13747
+ className: E("ml-auto shrink-0 text-[12.5px]", Ob[t]),
13748
+ children: Db[t]()
13726
13749
  }),
13727
13750
  /* @__PURE__ */ (0, V.jsx)("span", {
13728
13751
  className: "flex min-w-7 shrink-0 justify-end",
@@ -13731,7 +13754,7 @@ function Ab({ label: e, kind: t, fields: n, action: r }) {
13731
13754
  ]
13732
13755
  });
13733
13756
  }
13734
- function jb({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a }) {
13757
+ function Ib({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a }) {
13735
13758
  let [o, s] = (0, B.useState)(!1), { table: c, records: l } = e, u = !t && c !== null && l?.length === 1 ? l[0] : null;
13736
13759
  return /* @__PURE__ */ (0, V.jsxs)("div", {
13737
13760
  className: "flex flex-col gap-1 rounded-md px-1 py-1",
@@ -13753,20 +13776,20 @@ function jb({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a
13753
13776
  onClick: () => s(!o),
13754
13777
  children: /* @__PURE__ */ (0, V.jsx)(rg, { className: E("size-4 transition-transform", o && "rotate-90") })
13755
13778
  }) : /* @__PURE__ */ (0, V.jsx)("span", { className: "w-5 shrink-0" }),
13756
- u && c ? /* @__PURE__ */ (0, V.jsx)(Ab, {
13779
+ u && c ? /* @__PURE__ */ (0, V.jsx)(Fb, {
13757
13780
  label: u.key,
13758
13781
  kind: u.kind,
13759
13782
  fields: u.fields,
13760
- action: /* @__PURE__ */ (0, V.jsx)(Db, {
13783
+ action: /* @__PURE__ */ (0, V.jsx)(Mb, {
13761
13784
  table: c,
13762
13785
  record: u,
13763
13786
  busy: r,
13764
13787
  onRevert: a
13765
13788
  })
13766
- }) : /* @__PURE__ */ (0, V.jsx)(Ab, {
13789
+ }) : /* @__PURE__ */ (0, V.jsx)(Fb, {
13767
13790
  label: e.path,
13768
13791
  kind: e.status,
13769
- action: l === null && /* @__PURE__ */ (0, V.jsx)(Ob, {
13792
+ action: l === null && /* @__PURE__ */ (0, V.jsx)(Nb, {
13770
13793
  change: e,
13771
13794
  busy: r,
13772
13795
  onRevert: a
@@ -13776,11 +13799,11 @@ function jb({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a
13776
13799
  }),
13777
13800
  !u && c && l && l.length > 0 && /* @__PURE__ */ (0, V.jsx)("div", {
13778
13801
  className: "ml-12 flex flex-col gap-1",
13779
- children: l.map((e) => /* @__PURE__ */ (0, V.jsx)(Ab, {
13802
+ children: l.map((e) => /* @__PURE__ */ (0, V.jsx)(Fb, {
13780
13803
  label: e.key,
13781
13804
  kind: e.kind,
13782
13805
  fields: e.fields,
13783
- action: /* @__PURE__ */ (0, V.jsx)(Db, {
13806
+ action: /* @__PURE__ */ (0, V.jsx)(Mb, {
13784
13807
  table: c,
13785
13808
  record: e,
13786
13809
  busy: r,
@@ -13790,7 +13813,7 @@ function jb({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a
13790
13813
  }),
13791
13814
  o && /* @__PURE__ */ (0, V.jsx)("div", {
13792
13815
  className: "mt-1 ml-12 border-t pt-2",
13793
- children: /* @__PURE__ */ (0, V.jsx)(Eb, {
13816
+ children: /* @__PURE__ */ (0, V.jsx)(jb, {
13794
13817
  path: e.path,
13795
13818
  many: !u
13796
13819
  })
@@ -13798,19 +13821,19 @@ function jb({ change: e, list: t, checked: n, busy: r, onToggle: i, onRevert: a
13798
13821
  ]
13799
13822
  });
13800
13823
  }
13801
- function Mb({ git: e, open: t, onOpenChange: n }) {
13802
- let r = He(), { data: i } = fe(), [a, s] = (0, B.useState)(""), [c, l] = (0, B.useState)(""), [u, d] = (0, B.useState)(""), [f, p] = (0, B.useState)(!1), [m, h] = (0, B.useState)(/* @__PURE__ */ new Set()), [g, _] = (0, B.useState)(null), v = e.changes.map((e) => e.path).filter((e) => !m.has(e)), y = e.branch === e.defaultBranch, b = () => void r.invalidateQueries({ queryKey: wy }), x = j({
13824
+ function Lb({ git: e, open: t, onOpenChange: n }) {
13825
+ let r = He(), { data: i } = fe(), [a, s] = (0, B.useState)(""), [c, l] = (0, B.useState)(""), [u, d] = (0, B.useState)(""), [f, p] = (0, B.useState)(!1), [m, h] = (0, B.useState)(/* @__PURE__ */ new Set()), [g, _] = (0, B.useState)(null), v = e.changes.map((e) => e.path).filter((e) => !m.has(e)), y = e.branch === e.defaultBranch, b = () => void r.invalidateQueries({ queryKey: ky }), x = j({
13803
13826
  queryKey: [
13804
- ...wy,
13827
+ ...ky,
13805
13828
  "pr",
13806
13829
  e.branch
13807
13830
  ],
13808
- queryFn: Ty.openPr,
13831
+ queryFn: Ay.openPr,
13809
13832
  enabled: t && !y,
13810
13833
  staleTime: 3e4
13811
- }), S = y ? null : x.data ?? null, C = y || x.isSuccess || x.isError, w = (0, B.useRef)(0), T = Hv(), ee = Uv(), te = T ? Kv(T, { viewerKeys: ee?.viewerKeys ?? !0 }) : null, E = Zt({
13834
+ }), S = y ? null : x.data ?? null, C = y || x.isSuccess || x.isError, w = (0, B.useRef)(0), T = qv(), ee = Jv(), te = T ? Zv(T, { viewerKeys: ee?.viewerKeys ?? !0 }) : null, E = Zt({
13812
13835
  mutationFn: async (e) => ({
13813
- ...await Ty.draft({
13836
+ ...await Ay.draft({
13814
13837
  paths: v,
13815
13838
  mode: S ? "commit" : "pr",
13816
13839
  locale: o(),
@@ -13822,15 +13845,15 @@ function Mb({ git: e, open: t, onOpenChange: n }) {
13822
13845
  e.at === w.current && (s(e.title), e.body !== void 0 && l(e.body));
13823
13846
  }
13824
13847
  }), D = Zt({
13825
- mutationFn: () => Ty.review({
13848
+ mutationFn: () => Ay.review({
13826
13849
  title: a.trim(),
13827
13850
  body: S ? "" : c,
13828
13851
  paths: v,
13829
13852
  ...y && u.trim() ? { branch: u.trim() } : {}
13830
13853
  }),
13831
13854
  onSettled: b
13832
- }), O = (e) => void Ey(e).then(b).catch((e) => F.error(e instanceof Error ? e.message : String(e))), ne = Zt({
13833
- mutationFn: (e) => Ty.revert(e),
13855
+ }), O = (e) => void jy(e).then(b).catch((e) => F.error(e instanceof Error ? e.message : String(e))), ne = Zt({
13856
+ mutationFn: (e) => Ay.revert(e),
13834
13857
  onSuccess: ({ reverted: e, files: t }) => F.success(gl({ count: e.length + t.length }), t.length > 0 ? {} : { action: {
13835
13858
  label: Dl(),
13836
13859
  onClick: () => O(e)
@@ -13838,7 +13861,7 @@ function Mb({ git: e, open: t, onOpenChange: n }) {
13838
13861
  onSettled: () => {
13839
13862
  _(null), b();
13840
13863
  }
13841
- }), re = D.isPending || ne.isPending || E.isPending, k = e.changes.filter((e) => !m.has(e.path)).map(wb), A = {
13864
+ }), re = D.isPending || ne.isPending || E.isPending, k = e.changes.filter((e) => !m.has(e.path)).map(kb), A = {
13842
13865
  records: k.flatMap((e) => e.records),
13843
13866
  files: k.flatMap((e) => e.files)
13844
13867
  }, ie = A.records.length + A.files.length, ae = JSON.stringify(A), oe = g === ae, se = (e) => {
@@ -13898,12 +13921,12 @@ function Mb({ git: e, open: t, onOpenChange: n }) {
13898
13921
  children: [/* @__PURE__ */ (0, V.jsx)("legend", {
13899
13922
  className: "px-1 text-[13px] text-muted-foreground",
13900
13923
  children: Kc({ count: v.length })
13901
- }), Oy(e.changes).map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
13924
+ }), Ny(e.changes).map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
13902
13925
  className: "flex flex-col gap-0.5",
13903
13926
  children: [/* @__PURE__ */ (0, V.jsx)("div", {
13904
13927
  className: "text-[12.5px] font-semibold text-muted-foreground",
13905
13928
  children: e.table ?? tl()
13906
- }), e.changes.map((e) => /* @__PURE__ */ (0, V.jsx)(jb, {
13929
+ }), e.changes.map((e) => /* @__PURE__ */ (0, V.jsx)(Ib, {
13907
13930
  change: e,
13908
13931
  list: e.table !== null && M.has(e.table),
13909
13932
  checked: !m.has(e.path),
@@ -13941,7 +13964,7 @@ function Mb({ git: e, open: t, onOpenChange: n }) {
13941
13964
  onClick: () => p(!0),
13942
13965
  children: Uc()
13943
13966
  }),
13944
- f && /* @__PURE__ */ (0, V.jsx)(Ay, {
13967
+ f && /* @__PURE__ */ (0, V.jsx)(Fy, {
13945
13968
  open: !0,
13946
13969
  onOpenChange: p
13947
13970
  }),
@@ -13986,8 +14009,8 @@ function Mb({ git: e, open: t, onOpenChange: n }) {
13986
14009
  }
13987
14010
  //#endregion
13988
14011
  //#region ui/src/components/SendForReview.tsx
13989
- function Nb() {
13990
- let e = Dy(), [t, n] = (0, B.useState)(!1), [r, i] = (0, B.useState)(!1), a = e?.restoresDefault === !0 && e.defaultBranch !== null;
14012
+ function Rb() {
14013
+ let e = My(), [t, n] = (0, B.useState)(!1), [r, i] = (0, B.useState)(!1), a = e?.restoresDefault === !0 && e.defaultBranch !== null;
13991
14014
  return me() || !e || e.changes.length === 0 && !t && !a ? null : /* @__PURE__ */ (0, V.jsxs)("div", {
13992
14015
  className: "flex shrink-0 items-center gap-2.5",
13993
14016
  children: [
@@ -14007,12 +14030,12 @@ function Nb() {
14007
14030
  onClick: () => n(!0),
14008
14031
  children: [/* @__PURE__ */ (0, V.jsx)(Yh, { className: "size-3.5" }), Io()]
14009
14032
  })] }),
14010
- t && /* @__PURE__ */ (0, V.jsx)(Mb, {
14033
+ t && /* @__PURE__ */ (0, V.jsx)(Lb, {
14011
14034
  git: e,
14012
14035
  open: t,
14013
14036
  onOpenChange: n
14014
14037
  }),
14015
- r && e.defaultBranch && /* @__PURE__ */ (0, V.jsx)(xb, {
14038
+ r && e.defaultBranch && /* @__PURE__ */ (0, V.jsx)(Eb, {
14016
14039
  branch: e.defaultBranch,
14017
14040
  open: r,
14018
14041
  onOpenChange: i
@@ -14022,7 +14045,7 @@ function Nb() {
14022
14045
  }
14023
14046
  //#endregion
14024
14047
  //#region ui/src/components/AppFooter.tsx
14025
- function Pb() {
14048
+ function zb() {
14026
14049
  let e = (0, B.useRef)(null);
14027
14050
  return (0, B.useEffect)(() => {
14028
14051
  let t = Pt();
@@ -14032,19 +14055,19 @@ function Pb() {
14032
14055
  children: [/* @__PURE__ */ (0, V.jsx)("div", {
14033
14056
  ref: e,
14034
14057
  className: "app-footer-host min-w-0 flex-1"
14035
- }), /* @__PURE__ */ (0, V.jsx)(Nb, {})]
14058
+ }), /* @__PURE__ */ (0, V.jsx)(Rb, {})]
14036
14059
  });
14037
14060
  }
14038
14061
  //#endregion
14039
14062
  //#region ui/src/components/ui/command.tsx
14040
- function Fb({ className: e, ...t }) {
14063
+ function Bb({ className: e, ...t }) {
14041
14064
  return /* @__PURE__ */ (0, V.jsx)(nv, {
14042
14065
  "data-slot": "command",
14043
14066
  className: E("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground", e),
14044
14067
  ...t
14045
14068
  });
14046
14069
  }
14047
- function Ib({ title: e = "Command Palette", description: t = "Search for a command to run...", children: n, className: r, showCloseButton: i = !0, filter: a, value: o, onValueChange: s, ...c }) {
14070
+ function Vb({ title: e = "Command Palette", description: t = "Search for a command to run...", children: n, className: r, showCloseButton: i = !0, filter: a, value: o, onValueChange: s, ...c }) {
14048
14071
  return /* @__PURE__ */ (0, V.jsxs)(dt, {
14049
14072
  ...c,
14050
14073
  children: [/* @__PURE__ */ (0, V.jsxs)(ut, {
@@ -14053,7 +14076,7 @@ function Ib({ title: e = "Command Palette", description: t = "Search for a comma
14053
14076
  }), /* @__PURE__ */ (0, V.jsx)(mt, {
14054
14077
  className: E("overflow-hidden p-0", r),
14055
14078
  showCloseButton: i,
14056
- children: /* @__PURE__ */ (0, V.jsx)(Fb, {
14079
+ children: /* @__PURE__ */ (0, V.jsx)(Bb, {
14057
14080
  filter: a,
14058
14081
  value: o,
14059
14082
  onValueChange: s,
@@ -14063,7 +14086,7 @@ function Ib({ title: e = "Command Palette", description: t = "Search for a comma
14063
14086
  })]
14064
14087
  });
14065
14088
  }
14066
- function Lb({ className: e, ...t }) {
14089
+ function Hb({ className: e, ...t }) {
14067
14090
  return /* @__PURE__ */ (0, V.jsxs)("div", {
14068
14091
  "data-slot": "command-input-wrapper",
14069
14092
  className: "flex h-9 items-center gap-2 border-b px-3",
@@ -14074,28 +14097,28 @@ function Lb({ className: e, ...t }) {
14074
14097
  })]
14075
14098
  });
14076
14099
  }
14077
- function Rb({ className: e, ...t }) {
14100
+ function Ub({ className: e, ...t }) {
14078
14101
  return /* @__PURE__ */ (0, V.jsx)(nv.List, {
14079
14102
  "data-slot": "command-list",
14080
14103
  className: E("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto", e),
14081
14104
  ...t
14082
14105
  });
14083
14106
  }
14084
- function zb({ ...e }) {
14107
+ function Wb({ ...e }) {
14085
14108
  return /* @__PURE__ */ (0, V.jsx)(nv.Empty, {
14086
14109
  "data-slot": "command-empty",
14087
14110
  className: "py-6 text-center text-sm",
14088
14111
  ...e
14089
14112
  });
14090
14113
  }
14091
- function Bb({ className: e, ...t }) {
14114
+ function Gb({ className: e, ...t }) {
14092
14115
  return /* @__PURE__ */ (0, V.jsx)(nv.Group, {
14093
14116
  "data-slot": "command-group",
14094
14117
  className: E("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground", e),
14095
14118
  ...t
14096
14119
  });
14097
14120
  }
14098
- function Vb({ className: e, ...t }) {
14121
+ function Kb({ className: e, ...t }) {
14099
14122
  return /* @__PURE__ */ (0, V.jsx)(nv.Item, {
14100
14123
  "data-slot": "command-item",
14101
14124
  className: E("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground", e),
@@ -14104,20 +14127,20 @@ function Vb({ className: e, ...t }) {
14104
14127
  }
14105
14128
  //#endregion
14106
14129
  //#region ui/src/lib/commandMenu.ts
14107
- var Hb = !1, Ub = /* @__PURE__ */ new Set();
14108
- function Wb(e) {
14109
- Hb = typeof e == "function" ? e(Hb) : e;
14110
- for (let e of Ub) e();
14130
+ var qb = !1, Jb = /* @__PURE__ */ new Set();
14131
+ function Yb(e) {
14132
+ qb = typeof e == "function" ? e(qb) : e;
14133
+ for (let e of Jb) e();
14111
14134
  }
14112
- var Gb = () => Wb(!0), Kb = (e) => (Ub.add(e), () => {
14113
- Ub.delete(e);
14114
- }), qb = () => (0, B.useSyncExternalStore)(Kb, () => Hb), Jb = "\0", Yb = (e, t, n) => e.startsWith(Jb) ? 1 : V_(e, t, n), Xb = 10, Zb = 10;
14115
- function Qb() {
14116
- let e = qb(), t = Ae(), { data: n } = fe(), r = Hv(), [i, a] = (0, B.useState)("");
14135
+ var Xb = () => Yb(!0), Zb = (e) => (Jb.add(e), () => {
14136
+ Jb.delete(e);
14137
+ }), Qb = () => (0, B.useSyncExternalStore)(Zb, () => qb), $b = "\0", ex = (e, t, n) => e.startsWith($b) ? 1 : V_(e, t, n), tx = 10, nx = 10;
14138
+ function rx() {
14139
+ let e = Qb(), t = Ae(), { data: n } = fe(), r = qv(), [i, a] = (0, B.useState)("");
14117
14140
  (0, B.useEffect)(() => {
14118
14141
  e || a("");
14119
14142
  }, [e]);
14120
- let o = wv(i.trim(), 200), s = hv(o), { data: c, isFetching: l } = bv(o, 5), u = s && c ? vv(c.hits, o).slice(0, Xb) : [], d = s && c ? [...new Map(c.hits.map((e) => [e.table, e.total])).values()].reduce((e, t) => e + t, 0) : 0, f = s && (u.length > 0 || l), p = (e) => `${Jb}${e.table}${Jb}${e.key}`, [m, h] = (0, B.useState)(""), g = u[0] ? p(u[0]) : null;
14143
+ let o = kv(i.trim(), 200), s = vv(o), { data: c, isFetching: l } = Tv(o, 5), u = s && c ? Cv(c.hits, o).slice(0, tx) : [], d = s && c ? [...new Map(c.hits.map((e) => [e.table, e.total])).values()].reduce((e, t) => e + t, 0) : 0, f = s && (u.length > 0 || l), p = (e) => `${$b}${e.table}${$b}${e.key}`, [m, h] = (0, B.useState)(""), g = u[0] ? p(u[0]) : null;
14121
14144
  (0, B.useEffect)(() => {
14122
14145
  g && h(g);
14123
14146
  }, [g]);
@@ -14127,22 +14150,22 @@ function Qb() {
14127
14150
  }));
14128
14151
  (0, B.useEffect)(() => {
14129
14152
  let e = (e) => {
14130
- e.key === "k" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), Wb((e) => !e));
14153
+ e.key === "k" && (e.metaKey || e.ctrlKey) && (e.preventDefault(), Yb((e) => !e));
14131
14154
  };
14132
14155
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
14133
14156
  }, []);
14134
14157
  let v = (e) => {
14135
- Wb(!1), e();
14158
+ Yb(!1), e();
14136
14159
  };
14137
- return /* @__PURE__ */ (0, V.jsxs)(Ib, {
14160
+ return /* @__PURE__ */ (0, V.jsxs)(Vb, {
14138
14161
  open: e,
14139
- onOpenChange: Wb,
14140
- filter: Yb,
14162
+ onOpenChange: Yb,
14163
+ filter: ex,
14141
14164
  value: m,
14142
14165
  onValueChange: h,
14143
14166
  className: "sm:max-w-2xl",
14144
14167
  children: [
14145
- /* @__PURE__ */ (0, V.jsx)(Lb, {
14168
+ /* @__PURE__ */ (0, V.jsx)(Hb, {
14146
14169
  placeholder: qi(),
14147
14170
  className: "max-md:pr-10",
14148
14171
  value: i,
@@ -14151,18 +14174,18 @@ function Qb() {
14151
14174
  e.key === "Enter" && (e.metaKey || e.ctrlKey) && u.length > 0 && (e.preventDefault(), _());
14152
14175
  }
14153
14176
  }),
14154
- /* @__PURE__ */ (0, V.jsxs)(Rb, {
14177
+ /* @__PURE__ */ (0, V.jsxs)(Ub, {
14155
14178
  className: "max-h-[min(480px,60vh)] max-md:max-h-none",
14156
14179
  children: [
14157
- !f && /* @__PURE__ */ (0, V.jsx)(zb, { children: Ui() }),
14158
- f && /* @__PURE__ */ (0, V.jsxs)(Bb, {
14180
+ !f && /* @__PURE__ */ (0, V.jsx)(Wb, { children: Ui() }),
14181
+ f && /* @__PURE__ */ (0, V.jsxs)(Gb, {
14159
14182
  heading: /* @__PURE__ */ (0, V.jsxs)("span", {
14160
14183
  className: "flex justify-between",
14161
14184
  children: [/* @__PURE__ */ (0, V.jsx)("span", { children: Ji() }), d > 0 && /* @__PURE__ */ (0, V.jsx)("span", { children: pd({ count: d }) })]
14162
14185
  }),
14163
14186
  forceMount: !0,
14164
14187
  children: [
14165
- u.map((e) => /* @__PURE__ */ (0, V.jsxs)(Vb, {
14188
+ u.map((e) => /* @__PURE__ */ (0, V.jsxs)(Kb, {
14166
14189
  value: p(e),
14167
14190
  className: "gap-3",
14168
14191
  onSelect: () => v(() => t({
@@ -14183,14 +14206,14 @@ function Qb() {
14183
14206
  children: [
14184
14207
  /* @__PURE__ */ (0, V.jsx)("span", {
14185
14208
  className: "truncate text-base font-semibold",
14186
- children: /* @__PURE__ */ (0, V.jsx)(Cv, {
14209
+ children: /* @__PURE__ */ (0, V.jsx)(Ov, {
14187
14210
  text: e.label ?? e.key,
14188
14211
  needle: o
14189
14212
  })
14190
14213
  }),
14191
14214
  e.label !== null && /* @__PURE__ */ (0, V.jsx)("span", {
14192
14215
  className: "shrink-0 font-mono text-xs text-muted-foreground",
14193
- children: /* @__PURE__ */ (0, V.jsx)(Cv, {
14216
+ children: /* @__PURE__ */ (0, V.jsx)(Ov, {
14194
14217
  text: e.key,
14195
14218
  needle: o
14196
14219
  })
@@ -14202,21 +14225,21 @@ function Qb() {
14202
14225
  ]
14203
14226
  }), e.value !== e.key && e.value !== e.label && /* @__PURE__ */ (0, V.jsxs)("span", {
14204
14227
  className: "truncate text-sm text-muted-foreground",
14205
- children: [`${e.column}: `, /* @__PURE__ */ (0, V.jsx)(Sv, {
14228
+ children: [`${e.column}: `, /* @__PURE__ */ (0, V.jsx)(Dv, {
14206
14229
  value: e.value,
14207
14230
  needle: o,
14208
- around: Zb
14231
+ around: nx
14209
14232
  })]
14210
14233
  })]
14211
14234
  })]
14212
- }, `${e.table}${Jb}${e.key}`)),
14213
- u.length === 0 && /* @__PURE__ */ (0, V.jsx)(Vb, {
14214
- value: `${Jb}searching`,
14235
+ }, `${e.table}${$b}${e.key}`)),
14236
+ u.length === 0 && /* @__PURE__ */ (0, V.jsx)(Kb, {
14237
+ value: `${$b}searching`,
14215
14238
  disabled: !0,
14216
14239
  children: Yi()
14217
14240
  }),
14218
- u.length > 0 && /* @__PURE__ */ (0, V.jsxs)(Vb, {
14219
- value: `${Jb}all`,
14241
+ u.length > 0 && /* @__PURE__ */ (0, V.jsxs)(Kb, {
14242
+ value: `${$b}all`,
14220
14243
  className: "font-semibold text-tomato",
14221
14244
  onSelect: _,
14222
14245
  children: [Hi({ count: d }), /* @__PURE__ */ (0, V.jsx)(fn, {
@@ -14226,9 +14249,9 @@ function Qb() {
14226
14249
  })
14227
14250
  ]
14228
14251
  }),
14229
- /* @__PURE__ */ (0, V.jsx)(Bb, {
14252
+ /* @__PURE__ */ (0, V.jsx)(Gb, {
14230
14253
  heading: ys(),
14231
- children: n?.tables.map((e) => /* @__PURE__ */ (0, V.jsx)(Vb, {
14254
+ children: n?.tables.map((e) => /* @__PURE__ */ (0, V.jsx)(Kb, {
14232
14255
  onSelect: () => v(() => t({
14233
14256
  to: "/t/$table",
14234
14257
  params: { table: e.name }
@@ -14236,9 +14259,9 @@ function Qb() {
14236
14259
  children: e.name
14237
14260
  }, e.name))
14238
14261
  }),
14239
- n && n.views.length > 0 && /* @__PURE__ */ (0, V.jsx)(Bb, {
14262
+ n && n.views.length > 0 && /* @__PURE__ */ (0, V.jsx)(Gb, {
14240
14263
  heading: Xi(),
14241
- children: n.views.map((e) => /* @__PURE__ */ (0, V.jsx)(Vb, {
14264
+ children: n.views.map((e) => /* @__PURE__ */ (0, V.jsx)(Kb, {
14242
14265
  onSelect: () => v(() => t({
14243
14266
  to: "/t/$table",
14244
14267
  params: { table: e.name }
@@ -14246,9 +14269,9 @@ function Qb() {
14246
14269
  children: e.name
14247
14270
  }, e.name))
14248
14271
  }),
14249
- n && n.pages.length > 0 && /* @__PURE__ */ (0, V.jsx)(Bb, {
14272
+ n && n.pages.length > 0 && /* @__PURE__ */ (0, V.jsx)(Gb, {
14250
14273
  heading: ns(),
14251
- children: n.pages.map((e) => /* @__PURE__ */ (0, V.jsx)(Vb, {
14274
+ children: n.pages.map((e) => /* @__PURE__ */ (0, V.jsx)(Kb, {
14252
14275
  onSelect: () => v(() => t({
14253
14276
  to: "/p/$page",
14254
14277
  params: { page: e.name }
@@ -14256,23 +14279,23 @@ function Qb() {
14256
14279
  children: e.title
14257
14280
  }, e.name))
14258
14281
  }),
14259
- /* @__PURE__ */ (0, V.jsxs)(Bb, {
14282
+ /* @__PURE__ */ (0, V.jsxs)(Gb, {
14260
14283
  heading: bs(),
14261
14284
  children: [
14262
- /* @__PURE__ */ (0, V.jsx)(Vb, {
14285
+ /* @__PURE__ */ (0, V.jsx)(Kb, {
14263
14286
  onSelect: () => v(() => t({ to: "/sql" })),
14264
14287
  children: ms()
14265
14288
  }),
14266
- /* @__PURE__ */ (0, V.jsx)(Vb, {
14289
+ /* @__PURE__ */ (0, V.jsx)(Kb, {
14267
14290
  onSelect: () => v(() => t({ to: "/erd" })),
14268
14291
  children: ln()
14269
14292
  }),
14270
- !me() && /* @__PURE__ */ (0, V.jsx)(Vb, {
14293
+ !me() && /* @__PURE__ */ (0, V.jsx)(Kb, {
14271
14294
  onSelect: () => v(() => t({ to: "/sync" })),
14272
14295
  children: hs()
14273
14296
  }),
14274
- r !== null && /* @__PURE__ */ (0, V.jsx)(Vb, {
14275
- onSelect: () => v(fy.open),
14297
+ r !== null && /* @__PURE__ */ (0, V.jsx)(Kb, {
14298
+ onSelect: () => v(_y.open),
14276
14299
  children: Qo()
14277
14300
  })
14278
14301
  ]
@@ -14295,7 +14318,7 @@ function Qb() {
14295
14318
  }
14296
14319
  //#endregion
14297
14320
  //#region ui/src/components/SessionBanner.tsx
14298
- function $b() {
14321
+ function ix() {
14299
14322
  return (0, B.useSyncExternalStore)(ne.subscribe, ne.expired) ? /* @__PURE__ */ (0, V.jsx)("div", {
14300
14323
  role: "alert",
14301
14324
  className: "bg-err-soft px-4 py-2 text-[12px] text-err",
@@ -14304,7 +14327,7 @@ function $b() {
14304
14327
  }
14305
14328
  //#endregion
14306
14329
  //#region ui/src/components/ConflictToasts.tsx
14307
- function ex() {
14330
+ function ax() {
14308
14331
  let e = A(), t = Ae(), n = Dt();
14309
14332
  return (0, B.useEffect)(() => e.listen((e) => {
14310
14333
  e.type === "conflict" && F.warning(ta({
@@ -14326,14 +14349,14 @@ function ex() {
14326
14349
  }
14327
14350
  //#endregion
14328
14351
  //#region ui/src/components/NewTableDialog.tsx
14329
- var tx = [
14352
+ var ox = [
14330
14353
  "TEXT",
14331
14354
  "INTEGER",
14332
14355
  "REAL",
14333
14356
  "BOOLEAN",
14334
14357
  "JSON"
14335
14358
  ];
14336
- function nx({ open: e, onOpenChange: t, adopt: n }) {
14359
+ function sx({ open: e, onOpenChange: t, adopt: n }) {
14337
14360
  let r = He(), i = Ae(), { connected: a } = k(), { data: o } = fe(), s = (0, B.useId)(), [c, l] = (0, B.useState)(""), [u, d] = (0, B.useState)(n ?? ""), [f, p] = (0, B.useState)("files"), [m, h] = (0, B.useState)("id"), [g, _] = (0, B.useState)([]), v = Zt({
14338
14361
  mutationFn: () => ge.createTable({
14339
14362
  name: u,
@@ -14440,7 +14463,7 @@ function nx({ open: e, onOpenChange: t, adopt: n }) {
14440
14463
  ...n,
14441
14464
  type: e.target.value
14442
14465
  } : n)),
14443
- children: tx.map((e) => /* @__PURE__ */ (0, V.jsx)("option", { children: e }, e))
14466
+ children: ox.map((e) => /* @__PURE__ */ (0, V.jsx)("option", { children: e }, e))
14444
14467
  }),
14445
14468
  /* @__PURE__ */ (0, V.jsx)(L, {
14446
14469
  variant: "ghost",
@@ -14482,14 +14505,14 @@ function nx({ open: e, onOpenChange: t, adopt: n }) {
14482
14505
  }
14483
14506
  //#endregion
14484
14507
  //#region ui/src/components/ui/sheet.tsx
14485
- var rx = xt, ix = {
14508
+ var cx = xt, lx = {
14486
14509
  left: "inset-y-0 left-0 h-dvh w-[82%] max-w-[320px] border-r animate-[y-slide-right_160ms_ease-out]",
14487
14510
  bottom: "inset-x-0 bottom-0 max-h-dvh border-t animate-[y-slide-up_160ms_ease-out]"
14488
14511
  };
14489
- function ax({ side: e, title: t, className: n, children: r, ...i }) {
14512
+ function ux({ side: e, title: t, className: n, children: r, ...i }) {
14490
14513
  return /* @__PURE__ */ (0, V.jsxs)(qt, { children: [/* @__PURE__ */ (0, V.jsx)(lt, { className: "fixed inset-0 z-50 bg-black/40" }), /* @__PURE__ */ (0, V.jsxs)(at, {
14491
14514
  "aria-describedby": void 0,
14492
- className: E("fixed z-50 flex flex-col bg-panel shadow-xl outline-none", ix[e], n),
14515
+ className: E("fixed z-50 flex flex-col bg-panel shadow-xl outline-none", lx[e], n),
14493
14516
  ...i,
14494
14517
  children: [/* @__PURE__ */ (0, V.jsx)(ct, {
14495
14518
  className: "sr-only",
@@ -14499,20 +14522,20 @@ function ax({ side: e, title: t, className: n, children: r, ...i }) {
14499
14522
  }
14500
14523
  //#endregion
14501
14524
  //#region ui/src/lib/screen.ts
14502
- function ox(e, t) {
14525
+ function dx(e, t) {
14503
14526
  let [, n, r] = e.split("/"), i = r ? decodeURIComponent(r) : "";
14504
14527
  return n === "t" && i ? i : n === "p" && i ? t.find((e) => e.name === i)?.title ?? i : n === "sql" ? ms() : n === "sync" ? hs() : n === "erd" ? ln() : "yamlite";
14505
14528
  }
14506
14529
  //#endregion
14507
14530
  //#region ui/src/lib/embedded.ts
14508
- var sx = !1;
14509
- function cx(e) {
14510
- sx = e;
14531
+ var fx = !1;
14532
+ function px(e) {
14533
+ fx = e;
14511
14534
  }
14512
- var lx = () => sx;
14535
+ var mx = () => fx;
14513
14536
  //#endregion
14514
14537
  //#region ui/src/lib/split.ts
14515
- function ux(e, t) {
14538
+ function hx(e, t) {
14516
14539
  return t.value === null ? {
14517
14540
  col: e.column,
14518
14541
  op: "null"
@@ -14522,38 +14545,38 @@ function ux(e, t) {
14522
14545
  value: t.value
14523
14546
  };
14524
14547
  }
14525
- function dx(e, t, n) {
14548
+ function gx(e, t, n) {
14526
14549
  if (e.length !== 1) return !1;
14527
- let [r] = e, i = ux(t, n);
14550
+ let [r] = e, i = hx(t, n);
14528
14551
  return r.col === i.col && r.op === i.op && r.value === i.value;
14529
14552
  }
14530
- var fx = (e, t) => (e.captures ?? []).some((e) => e.column === t);
14531
- function px(e, t) {
14553
+ var _x = (e, t) => (e.captures ?? []).some((e) => e.column === t);
14554
+ function vx(e, t) {
14532
14555
  if (Object.hasOwn(e.columns, t)) return [t];
14533
14556
  let [n, ...r] = t.split(".");
14534
14557
  return !n || r.length === 0 || r.some((e) => e === "") ? null : Object.hasOwn(e.columns, n) && e.columns[n] === "JSON" ? [n, ...r] : null;
14535
14558
  }
14536
- var mx = (e) => typeof e == "object" && !!e && !Array.isArray(e);
14537
- function hx(e, t, n) {
14559
+ var yx = (e) => typeof e == "object" && !!e && !Array.isArray(e);
14560
+ function bx(e, t, n) {
14538
14561
  let [r, ...i] = t;
14539
14562
  return i.length === 0 ? {
14540
14563
  ...e,
14541
14564
  [r]: n
14542
14565
  } : {
14543
14566
  ...e,
14544
- [r]: hx(mx(e[r]) ? e[r] : {}, i, n)
14567
+ [r]: bx(yx(e[r]) ? e[r] : {}, i, n)
14545
14568
  };
14546
14569
  }
14547
- function gx(e, t) {
14570
+ function xx(e, t) {
14548
14571
  let n = {};
14549
14572
  for (let r of t) {
14550
- if (r.col === e.key || fx(e, r.col)) continue;
14551
- let t = px(e, r.col);
14552
- t !== null && (r.op === "eq" ? n = hx(n, t, r.value) : r.op === "has" && (n = hx(n, t, t.length > 1 ? r.value : [r.value])));
14573
+ if (r.col === e.key || _x(e, r.col)) continue;
14574
+ let t = vx(e, r.col);
14575
+ t !== null && (r.op === "eq" ? n = bx(n, t, r.value) : r.op === "has" && (n = bx(n, t, t.length > 1 ? r.value : [r.value])));
14553
14576
  }
14554
14577
  return n;
14555
14578
  }
14556
- function _x(e, t) {
14579
+ function Sx(e, t) {
14557
14580
  let n = [...e.captures ?? []].sort((e, t) => e.segment - t.segment), r = "";
14558
14581
  for (let [e, i] of n.entries()) {
14559
14582
  if (i.segment !== e) break;
@@ -14565,7 +14588,7 @@ function _x(e, t) {
14565
14588
  }
14566
14589
  //#endregion
14567
14590
  //#region ui/src/components/Logo.tsx
14568
- function vx({ className: e }) {
14591
+ function Cx({ className: e }) {
14569
14592
  return /* @__PURE__ */ (0, V.jsxs)("svg", {
14570
14593
  xmlns: "http://www.w3.org/2000/svg",
14571
14594
  viewBox: "0 0 64 64",
@@ -14602,8 +14625,8 @@ function vx({ className: e }) {
14602
14625
  }
14603
14626
  //#endregion
14604
14627
  //#region ui/src/components/Sidebar.tsx
14605
- var yx = "flex items-center gap-2 rounded-md px-2.5 py-1.5 mx-1.5 text-[13px] hover:bg-panel-2 max-md:py-2.5 max-md:text-[15px]", bx = { className: E(yx, "bg-tomato text-[var(--y-on-accent)] font-semibold hover:bg-tomato [&>[data-count]]:text-current [&>[data-count]]:opacity-80") };
14606
- function xx({ count: e, fallback: t }) {
14628
+ var wx = "flex items-center gap-2 rounded-md px-2.5 py-1.5 mx-1.5 text-[13px] hover:bg-panel-2 max-md:py-2.5 max-md:text-[15px]", Tx = { className: E(wx, "bg-tomato text-[var(--y-on-accent)] font-semibold hover:bg-tomato [&>[data-count]]:text-current [&>[data-count]]:opacity-80") };
14629
+ function Ex({ count: e, fallback: t }) {
14607
14630
  return e === 0 ? t : /* @__PURE__ */ (0, V.jsxs)("span", {
14608
14631
  role: "img",
14609
14632
  "aria-label": Cs({ count: e }),
@@ -14612,14 +14635,14 @@ function xx({ count: e, fallback: t }) {
14612
14635
  children: [/* @__PURE__ */ (0, V.jsx)(pn, { className: "size-3" }), e]
14613
14636
  });
14614
14637
  }
14615
- function Sx({ onNewTable: e, onSearch: t }) {
14616
- let { data: n } = fe(), r = Hv(), { warnings: i, connected: a } = k(), o = me(), { data: s } = j({
14638
+ function Dx({ onNewTable: e, onSearch: t }) {
14639
+ let { data: n } = fe(), r = qv(), { warnings: i, connected: a } = k(), o = me(), { data: s } = j({
14617
14640
  queryKey: ["conflicts"],
14618
14641
  queryFn: ge.conflicts,
14619
14642
  enabled: !o
14620
14643
  }), c = s?.conflicts.length ?? 0, l = new Set(n?.views.map((e) => e.name)), [u, d] = p_(), [f, p] = m_(), m = Fr({ select: (e) => e.matches.find((e) => e.routeId === "/t/$table") }), h = m?.params?.table, g = m?.search?.filter ?? [], _ = n?.views.find((e) => e.name === h), v = (e) => {
14621
14644
  let t = e.split;
14622
- return t !== null && h === e.name ? t.items.find((e) => dx(g, t, e)) : void 0;
14645
+ return t !== null && h === e.name ? t.items.find((e) => gx(g, t, e)) : void 0;
14623
14646
  }, y = _?.table ?? n?.tables.find((e) => v(e) !== void 0)?.name ?? null, [b, x] = (0, B.useState)(null);
14624
14647
  b !== null && b !== y && x(null);
14625
14648
  let S = (e) => {
@@ -14630,10 +14653,10 @@ function Sx({ onNewTable: e, onSearch: t }) {
14630
14653
  children: [/* @__PURE__ */ (0, V.jsxs)(Re, {
14631
14654
  to: "/t/$table",
14632
14655
  params: { table: e.name },
14633
- className: E(yx, "min-w-0 flex-1"),
14634
- activeProps: s ? {} : { className: E(bx.className, "min-w-0 flex-1") },
14656
+ className: E(wx, "min-w-0 flex-1"),
14657
+ activeProps: s ? {} : { className: E(Tx.className, "min-w-0 flex-1") },
14635
14658
  children: [
14636
- /* @__PURE__ */ (0, V.jsx)(xx, {
14659
+ /* @__PURE__ */ (0, V.jsx)(Ex, {
14637
14660
  count: r(null),
14638
14661
  fallback: /* @__PURE__ */ (0, V.jsx)(hn, { className: "size-3.5 opacity-70" })
14639
14662
  }),
@@ -14661,8 +14684,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14661
14684
  u && a?.items.map((t) => /* @__PURE__ */ (0, V.jsxs)(Re, {
14662
14685
  to: "/t/$table",
14663
14686
  params: { table: e.name },
14664
- search: { filter: [ux(a, t)] },
14665
- className: E(t === s ? bx.className : yx, "min-w-0"),
14687
+ search: { filter: [hx(a, t)] },
14688
+ className: E(t === s ? Tx.className : wx, "min-w-0"),
14666
14689
  activeProps: {},
14667
14690
  style: { paddingLeft: "24px" },
14668
14691
  children: [
@@ -14681,11 +14704,11 @@ function Sx({ onNewTable: e, onSearch: t }) {
14681
14704
  u && o.map((e) => /* @__PURE__ */ (0, V.jsxs)(Re, {
14682
14705
  to: "/t/$table",
14683
14706
  params: { table: e.name },
14684
- className: yx,
14685
- activeProps: bx,
14707
+ className: wx,
14708
+ activeProps: Tx,
14686
14709
  style: { paddingLeft: `${10 + e.depth * 14}px` },
14687
14710
  children: [
14688
- /* @__PURE__ */ (0, V.jsx)(xx, {
14711
+ /* @__PURE__ */ (0, V.jsx)(Ex, {
14689
14712
  count: r(e.name),
14690
14713
  fallback: /* @__PURE__ */ (0, V.jsx)(cn, { className: "size-3.5 shrink-0 opacity-70" })
14691
14714
  }),
@@ -14708,10 +14731,10 @@ function Sx({ onNewTable: e, onSearch: t }) {
14708
14731
  children: [
14709
14732
  /* @__PURE__ */ (0, V.jsx)("div", {
14710
14733
  className: "flex items-center gap-2 px-3.5 pt-3.5 pb-2.5 text-base font-bold tracking-tight",
14711
- children: !lx() && /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [
14712
- /* @__PURE__ */ (0, V.jsx)(vx, { className: "size-6" }),
14734
+ children: !mx() && /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [
14735
+ /* @__PURE__ */ (0, V.jsx)(Cx, { className: "size-6" }),
14713
14736
  "YAMLite",
14714
- /* @__PURE__ */ (0, V.jsx)(Cx, {})
14737
+ /* @__PURE__ */ (0, V.jsx)(Ox, {})
14715
14738
  ] })
14716
14739
  }),
14717
14740
  /* @__PURE__ */ (0, V.jsxs)("div", {
@@ -14720,7 +14743,7 @@ function Sx({ onNewTable: e, onSearch: t }) {
14720
14743
  type: "button",
14721
14744
  className: "flex min-w-0 flex-1 justify-between rounded-md border bg-background px-2 py-1.5 text-[12px] text-muted-foreground max-md:py-2.5 max-md:text-[14px]",
14722
14745
  onClick: () => {
14723
- t?.(), Gb();
14746
+ t?.(), Xb();
14724
14747
  },
14725
14748
  children: [/* @__PURE__ */ (0, V.jsx)("span", { children: us() }), /* @__PURE__ */ (0, V.jsx)("kbd", {
14726
14749
  className: "rounded border px-1 font-mono text-[10px] max-md:hidden",
@@ -14732,8 +14755,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14732
14755
  title: Qo(),
14733
14756
  className: "grid place-items-center rounded-md border bg-background px-2 hover:bg-panel-2 max-md:px-3",
14734
14757
  onClick: () => {
14735
- if (!t) return fy.toggle();
14736
- t(), fy.open();
14758
+ if (!t) return _y.toggle();
14759
+ t(), _y.open();
14737
14760
  },
14738
14761
  children: /* @__PURE__ */ (0, V.jsx)(Zg, { className: "size-4" })
14739
14762
  })]
@@ -14766,7 +14789,7 @@ function Sx({ onNewTable: e, onSearch: t }) {
14766
14789
  type: "button",
14767
14790
  disabled: !a,
14768
14791
  title: a ? void 0 : Yt(),
14769
- className: E(yx, "text-muted-foreground disabled:opacity-50"),
14792
+ className: E(wx, "text-muted-foreground disabled:opacity-50"),
14770
14793
  onClick: e,
14771
14794
  children: [
14772
14795
  /* @__PURE__ */ (0, V.jsx)(Vg, { className: "size-3.5" }),
@@ -14783,8 +14806,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14783
14806
  children: n.pages.map((e) => /* @__PURE__ */ (0, V.jsxs)(Re, {
14784
14807
  to: "/p/$page",
14785
14808
  params: { page: e.name },
14786
- className: yx,
14787
- activeProps: bx,
14809
+ className: wx,
14810
+ activeProps: Tx,
14788
14811
  children: [/* @__PURE__ */ (0, V.jsx)(yg, { className: "size-3.5 opacity-70" }), /* @__PURE__ */ (0, V.jsx)("span", {
14789
14812
  className: "truncate",
14790
14813
  children: e.title
@@ -14800,8 +14823,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14800
14823
  children: [
14801
14824
  /* @__PURE__ */ (0, V.jsxs)(Re, {
14802
14825
  to: "/sql",
14803
- className: yx,
14804
- activeProps: bx,
14826
+ className: wx,
14827
+ activeProps: Tx,
14805
14828
  children: [
14806
14829
  /* @__PURE__ */ (0, V.jsx)(a_, { className: "size-3.5 opacity-70" }),
14807
14830
  " ",
@@ -14810,8 +14833,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14810
14833
  }),
14811
14834
  /* @__PURE__ */ (0, V.jsxs)(Re, {
14812
14835
  to: "/erd",
14813
- className: yx,
14814
- activeProps: bx,
14836
+ className: wx,
14837
+ activeProps: Tx,
14815
14838
  children: [
14816
14839
  /* @__PURE__ */ (0, V.jsx)(jg, { className: "size-3.5 opacity-70" }),
14817
14840
  " ",
@@ -14820,8 +14843,8 @@ function Sx({ onNewTable: e, onSearch: t }) {
14820
14843
  }),
14821
14844
  !o && /* @__PURE__ */ (0, V.jsxs)(Re, {
14822
14845
  to: "/sync",
14823
- className: yx,
14824
- activeProps: bx,
14846
+ className: wx,
14847
+ activeProps: Tx,
14825
14848
  children: [
14826
14849
  /* @__PURE__ */ (0, V.jsx)(qh, { className: "size-3.5 opacity-70" }),
14827
14850
  " ",
@@ -14834,11 +14857,11 @@ function Sx({ onNewTable: e, onSearch: t }) {
14834
14857
  })
14835
14858
  ]
14836
14859
  }),
14837
- !o && /* @__PURE__ */ (0, V.jsx)(wx, {})
14860
+ !o && /* @__PURE__ */ (0, V.jsx)(kx, {})
14838
14861
  ]
14839
14862
  });
14840
14863
  }
14841
- function Cx() {
14864
+ function Ox() {
14842
14865
  let { data: e } = fe(), t = e?.root ?? "", n = t.split(/[\\/]/).filter(Boolean).at(-1) ?? t;
14843
14866
  return /* @__PURE__ */ (0, V.jsxs)(Ne, { children: [/* @__PURE__ */ (0, V.jsx)(Be, {
14844
14867
  asChild: !0,
@@ -14893,8 +14916,8 @@ function Cx() {
14893
14916
  })]
14894
14917
  })] });
14895
14918
  }
14896
- function wx() {
14897
- let e = Dy(), [t, n] = (0, B.useState)(!1), [r, i] = (0, B.useState)(!1);
14919
+ function kx() {
14920
+ let e = My(), [t, n] = (0, B.useState)(!1), [r, i] = (0, B.useState)(!1);
14898
14921
  if (!e) return null;
14899
14922
  let a = e.changes.length;
14900
14923
  return /* @__PURE__ */ (0, V.jsxs)("div", {
@@ -14934,12 +14957,12 @@ function wx() {
14934
14957
  children: jo({ branch: e.defaultBranch })
14935
14958
  })]
14936
14959
  }),
14937
- t && /* @__PURE__ */ (0, V.jsx)(Mb, {
14960
+ t && /* @__PURE__ */ (0, V.jsx)(Lb, {
14938
14961
  git: e,
14939
14962
  open: t,
14940
14963
  onOpenChange: n
14941
14964
  }),
14942
- r && e.defaultBranch && /* @__PURE__ */ (0, V.jsx)(xb, {
14965
+ r && e.defaultBranch && /* @__PURE__ */ (0, V.jsx)(Eb, {
14943
14966
  branch: e.defaultBranch,
14944
14967
  open: r,
14945
14968
  onOpenChange: i
@@ -14949,60 +14972,60 @@ function wx() {
14949
14972
  }
14950
14973
  //#endregion
14951
14974
  //#region ui/src/components/MobileNav.tsx
14952
- var Tx = "grid size-10 shrink-0 place-items-center rounded-md hover:bg-panel-2";
14953
- function Ex({ onNewTable: e }) {
14954
- let [t, n] = (0, B.useState)(!1), { data: r } = fe(), i = Hv(), a = Dy(), [o, s] = (0, B.useState)(!1), c = a?.branch ? a.changes.length : 0, l = Fr({ select: (e) => e.location.pathname });
14975
+ var Ax = "grid size-10 shrink-0 place-items-center rounded-md hover:bg-panel-2";
14976
+ function jx({ onNewTable: e }) {
14977
+ let [t, n] = (0, B.useState)(!1), { data: r } = fe(), i = qv(), a = My(), [o, s] = (0, B.useState)(!1), c = a?.branch ? a.changes.length : 0, l = Fr({ select: (e) => e.location.pathname });
14955
14978
  return /* @__PURE__ */ (0, V.jsxs)("div", {
14956
14979
  className: "flex items-center gap-1 border-b bg-background px-2 pt-[env(safe-area-inset-top)]",
14957
14980
  children: [
14958
14981
  /* @__PURE__ */ (0, V.jsx)("button", {
14959
14982
  type: "button",
14960
14983
  "aria-label": $o(),
14961
- className: Tx,
14984
+ className: Ax,
14962
14985
  onClick: () => n(!0),
14963
14986
  children: /* @__PURE__ */ (0, V.jsx)(Tg, { className: "size-5" })
14964
14987
  }),
14965
14988
  /* @__PURE__ */ (0, V.jsx)("h1", {
14966
14989
  className: "min-w-0 flex-1 truncate text-[16px] font-semibold",
14967
- children: ox(l, r?.pages ?? [])
14990
+ children: dx(l, r?.pages ?? [])
14968
14991
  }),
14969
14992
  /* @__PURE__ */ (0, V.jsx)("button", {
14970
14993
  type: "button",
14971
14994
  "aria-label": ls(),
14972
- className: Tx,
14973
- onClick: Gb,
14995
+ className: Ax,
14996
+ onClick: Xb,
14974
14997
  children: /* @__PURE__ */ (0, V.jsx)(qg, { className: "size-5" })
14975
14998
  }),
14976
14999
  i !== null && /* @__PURE__ */ (0, V.jsx)("button", {
14977
15000
  type: "button",
14978
15001
  "aria-label": Qo(),
14979
- className: Tx,
14980
- onClick: fy.open,
15002
+ className: Ax,
15003
+ onClick: _y.open,
14981
15004
  children: /* @__PURE__ */ (0, V.jsx)(Zg, { className: "size-5" })
14982
15005
  }),
14983
15006
  a && c > 0 && /* @__PURE__ */ (0, V.jsxs)("button", {
14984
15007
  type: "button",
14985
15008
  "aria-label": `${Io()} (${ro({ count: c })})`,
14986
- className: `${Tx} relative`,
15009
+ className: `${Ax} relative`,
14987
15010
  onClick: () => s(!0),
14988
15011
  children: [/* @__PURE__ */ (0, V.jsx)(Yh, { className: "size-5" }), /* @__PURE__ */ (0, V.jsx)("span", {
14989
15012
  className: "absolute top-1 right-1 min-w-4 rounded-full bg-tomato px-1 text-[10.5px] leading-4 font-semibold text-[var(--y-on-accent)]",
14990
15013
  children: c
14991
15014
  })]
14992
15015
  }),
14993
- a && o && /* @__PURE__ */ (0, V.jsx)(Mb, {
15016
+ a && o && /* @__PURE__ */ (0, V.jsx)(Lb, {
14994
15017
  git: a,
14995
15018
  open: o,
14996
15019
  onOpenChange: s
14997
15020
  }),
14998
- /* @__PURE__ */ (0, V.jsx)(rx, {
15021
+ /* @__PURE__ */ (0, V.jsx)(cx, {
14999
15022
  open: t,
15000
15023
  onOpenChange: n,
15001
- children: /* @__PURE__ */ (0, V.jsx)(ax, {
15024
+ children: /* @__PURE__ */ (0, V.jsx)(ux, {
15002
15025
  side: "left",
15003
15026
  title: $o(),
15004
15027
  onClick: (e) => e.target instanceof Element && e.target.closest("a") && n(!1),
15005
- children: /* @__PURE__ */ (0, V.jsx)(Sx, {
15028
+ children: /* @__PURE__ */ (0, V.jsx)(Dx, {
15006
15029
  onSearch: () => n(!1),
15007
15030
  onNewTable: () => {
15008
15031
  n(!1), e();
@@ -15015,19 +15038,19 @@ function Ex({ onNewTable: e }) {
15015
15038
  }
15016
15039
  //#endregion
15017
15040
  //#region ui/src/components/ui/select.tsx
15018
- function Dx({ ...e }) {
15041
+ function Mx({ ...e }) {
15019
15042
  return /* @__PURE__ */ (0, V.jsx)($m, {
15020
15043
  "data-slot": "select",
15021
15044
  ...e
15022
15045
  });
15023
15046
  }
15024
- function Ox({ ...e }) {
15047
+ function Nx({ ...e }) {
15025
15048
  return /* @__PURE__ */ (0, V.jsx)(rh, {
15026
15049
  "data-slot": "select-value",
15027
15050
  ...e
15028
15051
  });
15029
15052
  }
15030
- function kx({ className: e, size: t = "default", children: n, ...r }) {
15053
+ function Px({ className: e, size: t = "default", children: n, ...r }) {
15031
15054
  return /* @__PURE__ */ (0, V.jsxs)(th, {
15032
15055
  "data-slot": "select-trigger",
15033
15056
  "data-size": t,
@@ -15039,7 +15062,7 @@ function kx({ className: e, size: t = "default", children: n, ...r }) {
15039
15062
  })]
15040
15063
  });
15041
15064
  }
15042
- function Ax({ className: e, children: t, position: n = "item-aligned", align: r = "center", ...i }) {
15065
+ function Fx({ className: e, children: t, position: n = "item-aligned", align: r = "center", ...i }) {
15043
15066
  return /* @__PURE__ */ (0, V.jsx)(sh, { children: /* @__PURE__ */ (0, V.jsxs)(lh, {
15044
15067
  "data-slot": "select-content",
15045
15068
  className: E("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),
@@ -15047,16 +15070,16 @@ function Ax({ className: e, children: t, position: n = "item-aligned", align: r
15047
15070
  align: r,
15048
15071
  ...i,
15049
15072
  children: [
15050
- /* @__PURE__ */ (0, V.jsx)(Mx, {}),
15073
+ /* @__PURE__ */ (0, V.jsx)(Lx, {}),
15051
15074
  /* @__PURE__ */ (0, V.jsx)(xh, {
15052
15075
  className: E("p-1", n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),
15053
15076
  children: t
15054
15077
  }),
15055
- /* @__PURE__ */ (0, V.jsx)(Nx, {})
15078
+ /* @__PURE__ */ (0, V.jsx)(Rx, {})
15056
15079
  ]
15057
15080
  }) });
15058
15081
  }
15059
- function jx({ className: e, children: t, ...n }) {
15082
+ function Ix({ className: e, children: t, ...n }) {
15060
15083
  return /* @__PURE__ */ (0, V.jsxs)(Dh, {
15061
15084
  "data-slot": "select-item",
15062
15085
  className: E("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2", e),
@@ -15068,7 +15091,7 @@ function jx({ className: e, children: t, ...n }) {
15068
15091
  }), /* @__PURE__ */ (0, V.jsx)(kh, { children: t })]
15069
15092
  });
15070
15093
  }
15071
- function Mx({ className: e, ...t }) {
15094
+ function Lx({ className: e, ...t }) {
15072
15095
  return /* @__PURE__ */ (0, V.jsx)(Nh, {
15073
15096
  "data-slot": "select-scroll-up-button",
15074
15097
  className: E("flex cursor-default items-center justify-center py-1", e),
@@ -15076,7 +15099,7 @@ function Mx({ className: e, ...t }) {
15076
15099
  children: /* @__PURE__ */ (0, V.jsx)(tg, { className: "size-4" })
15077
15100
  });
15078
15101
  }
15079
- function Nx({ className: e, ...t }) {
15102
+ function Rx({ className: e, ...t }) {
15080
15103
  return /* @__PURE__ */ (0, V.jsx)(Fh, {
15081
15104
  "data-slot": "select-scroll-down-button",
15082
15105
  className: E("flex cursor-default items-center justify-center py-1", e),
@@ -15086,39 +15109,39 @@ function Nx({ className: e, ...t }) {
15086
15109
  }
15087
15110
  //#endregion
15088
15111
  //#region ui/src/components/LanguageSelect.tsx
15089
- var Px = {
15112
+ var zx = {
15090
15113
  en: "English",
15091
15114
  ja: "日本語"
15092
15115
  };
15093
- function Fx() {
15116
+ function Bx() {
15094
15117
  let e = o();
15095
- return /* @__PURE__ */ (0, V.jsxs)(Dx, {
15118
+ return /* @__PURE__ */ (0, V.jsxs)(Mx, {
15096
15119
  value: e,
15097
15120
  onValueChange: (t) => t !== e && n(t),
15098
- children: [/* @__PURE__ */ (0, V.jsxs)(kx, {
15121
+ children: [/* @__PURE__ */ (0, V.jsxs)(Px, {
15099
15122
  size: "sm",
15100
15123
  "aria-label": Zo(),
15101
15124
  className: "h-6 gap-1 border-0 px-1.5 text-[11px] shadow-none max-md:size-10 max-md:justify-center max-md:p-0 max-md:[&>[data-slot=select-value]]:hidden max-md:[&>svg:last-child]:hidden",
15102
- children: [/* @__PURE__ */ (0, V.jsx)(_g, { className: "size-3.5 max-md:size-4.5" }), /* @__PURE__ */ (0, V.jsx)(Ox, {})]
15103
- }), /* @__PURE__ */ (0, V.jsx)(Ax, {
15125
+ children: [/* @__PURE__ */ (0, V.jsx)(_g, { className: "size-3.5 max-md:size-4.5" }), /* @__PURE__ */ (0, V.jsx)(Nx, {})]
15126
+ }), /* @__PURE__ */ (0, V.jsx)(Fx, {
15104
15127
  position: "popper",
15105
15128
  align: "end",
15106
- children: r.map((e) => /* @__PURE__ */ (0, V.jsx)(jx, {
15129
+ children: r.map((e) => /* @__PURE__ */ (0, V.jsx)(Ix, {
15107
15130
  value: e,
15108
15131
  lang: e,
15109
- children: Px[e]
15132
+ children: zx[e]
15110
15133
  }, e))
15111
15134
  })]
15112
15135
  });
15113
15136
  }
15114
15137
  //#endregion
15115
15138
  //#region ui/src/components/StatusBar.tsx
15116
- var Ix = {
15139
+ var Vx = {
15117
15140
  light: op,
15118
15141
  dark: ap,
15119
15142
  system: sp
15120
15143
  };
15121
- function Lx() {
15144
+ function Hx() {
15122
15145
  let { connected: e, lastSyncAt: t, warnings: n } = k(), { data: r } = fe(), i = se(), { data: a } = j({
15123
15146
  queryKey: ["conflicts"],
15124
15147
  queryFn: ge.conflicts,
@@ -15135,7 +15158,7 @@ function Lx() {
15135
15158
  /* @__PURE__ */ (0, V.jsxs)("span", {
15136
15159
  className: "flex items-center gap-1.5",
15137
15160
  "aria-live": "polite",
15138
- children: [/* @__PURE__ */ (0, V.jsx)("span", { className: `size-[7px] rounded-full ${e ? "bg-ok" : "bg-err"}` }), e ? lx() ? Jd() : /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)("span", {
15161
+ children: [/* @__PURE__ */ (0, V.jsx)("span", { className: `size-[7px] rounded-full ${e ? "bg-ok" : "bg-err"}` }), e ? mx() ? Jd() : /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)("span", {
15139
15162
  className: "max-md:hidden",
15140
15163
  children: df({ root: r?.root ?? "" })
15141
15164
  }), /* @__PURE__ */ (0, V.jsx)("span", {
@@ -15145,9 +15168,9 @@ function Lx() {
15145
15168
  }),
15146
15169
  /* @__PURE__ */ (0, V.jsx)("span", {
15147
15170
  className: "max-md:hidden",
15148
- children: Qd({ ago: Cy(t, o) })
15171
+ children: Qd({ ago: Oy(t, o) })
15149
15172
  }),
15150
- !lx() && /* @__PURE__ */ (0, V.jsx)("span", {
15173
+ !mx() && /* @__PURE__ */ (0, V.jsx)("span", {
15151
15174
  className: "max-md:hidden",
15152
15175
  children: location.host
15153
15176
  })
@@ -15166,10 +15189,10 @@ function Lx() {
15166
15189
  className: "text-err",
15167
15190
  children: qd({ count: d })
15168
15191
  }),
15169
- /* @__PURE__ */ (0, V.jsx)(Fx, {}),
15192
+ /* @__PURE__ */ (0, V.jsx)(Bx, {}),
15170
15193
  /* @__PURE__ */ (0, V.jsx)("button", {
15171
15194
  type: "button",
15172
- "aria-label": af({ theme: Ix[c]() }),
15195
+ "aria-label": af({ theme: Vx[c]() }),
15173
15196
  className: "rounded p-1 hover:bg-panel-2 max-md:grid max-md:size-10 max-md:place-items-center",
15174
15197
  onClick: () => {
15175
15198
  let e = v(c);
@@ -15183,13 +15206,13 @@ function Lx() {
15183
15206
  }
15184
15207
  //#endregion
15185
15208
  //#region ui/src/components/Shell.tsx
15186
- function Rx() {
15209
+ function Ux() {
15187
15210
  return rn() ? /* @__PURE__ */ (0, V.jsx)(Ft.Provider, {
15188
15211
  value: !0,
15189
- children: /* @__PURE__ */ (0, V.jsx)(Bx, {})
15190
- }) : /* @__PURE__ */ (0, V.jsx)(Vx, {});
15212
+ children: /* @__PURE__ */ (0, V.jsx)(Gx, {})
15213
+ }) : /* @__PURE__ */ (0, V.jsx)(Kx, {});
15191
15214
  }
15192
- function zx() {
15215
+ function Wx() {
15193
15216
  let { configError: e } = k();
15194
15217
  return e ? /* @__PURE__ */ (0, V.jsx)("div", {
15195
15218
  role: "alert",
@@ -15197,38 +15220,38 @@ function zx() {
15197
15220
  children: wd({ error: e })
15198
15221
  }) : null;
15199
15222
  }
15200
- function Bx() {
15223
+ function Gx() {
15201
15224
  let e = ze();
15202
15225
  return /* @__PURE__ */ (0, V.jsxs)("div", {
15203
15226
  className: "grid h-[var(--y-shell-h,100dvh)] grid-cols-1 grid-rows-[auto_1fr_auto]",
15204
15227
  children: [
15205
- /* @__PURE__ */ (0, V.jsxs)("div", { children: [/* @__PURE__ */ (0, V.jsx)($b, {}), /* @__PURE__ */ (0, V.jsx)(zx, {})] }),
15228
+ /* @__PURE__ */ (0, V.jsxs)("div", { children: [/* @__PURE__ */ (0, V.jsx)(ix, {}), /* @__PURE__ */ (0, V.jsx)(Wx, {})] }),
15206
15229
  /* @__PURE__ */ (0, V.jsx)("main", {
15207
15230
  className: "flex min-h-0 min-w-0",
15208
15231
  children: /* @__PURE__ */ (0, V.jsx)(Tr, {})
15209
15232
  }),
15210
- /* @__PURE__ */ (0, V.jsx)(Pb, {}),
15211
- /* @__PURE__ */ (0, V.jsx)(Lv, { position: e ? "top-center" : "bottom-right" }),
15212
- /* @__PURE__ */ (0, V.jsx)(ex, {})
15233
+ /* @__PURE__ */ (0, V.jsx)(zb, {}),
15234
+ /* @__PURE__ */ (0, V.jsx)(Hv, { position: e ? "top-center" : "bottom-right" }),
15235
+ /* @__PURE__ */ (0, V.jsx)(ax, {})
15213
15236
  ]
15214
15237
  });
15215
15238
  }
15216
- function Vx() {
15217
- let [e, t] = (0, B.useState)(!1), n = ze(), r = Hv(), i = py() && r !== null, [a, o] = Nt("yamlite-sidebar-width", 220, At);
15239
+ function Kx() {
15240
+ let [e, t] = (0, B.useState)(!1), n = ze(), r = qv(), i = vy() && r !== null, [a, o] = Nt("yamlite-sidebar-width", 220, At);
15218
15241
  return /* @__PURE__ */ (0, V.jsxs)("div", {
15219
15242
  className: "grid h-[var(--y-shell-h,100dvh)] grid-cols-1 grid-rows-[auto_1fr_auto]",
15220
15243
  children: [
15221
15244
  /* @__PURE__ */ (0, V.jsxs)("div", { children: [
15222
- /* @__PURE__ */ (0, V.jsx)($b, {}),
15223
- /* @__PURE__ */ (0, V.jsx)(zx, {}),
15224
- n && /* @__PURE__ */ (0, V.jsx)(Ex, { onNewTable: () => t(!0) })
15245
+ /* @__PURE__ */ (0, V.jsx)(ix, {}),
15246
+ /* @__PURE__ */ (0, V.jsx)(Wx, {}),
15247
+ n && /* @__PURE__ */ (0, V.jsx)(jx, { onNewTable: () => t(!0) })
15225
15248
  ] }),
15226
15249
  /* @__PURE__ */ (0, V.jsxs)("div", {
15227
15250
  className: "grid min-h-0 grid-cols-1",
15228
15251
  style: n ? void 0 : { gridTemplateColumns: `${a}px 1fr` },
15229
15252
  children: [!n && /* @__PURE__ */ (0, V.jsxs)("div", {
15230
15253
  className: "relative min-h-0",
15231
- children: [/* @__PURE__ */ (0, V.jsx)(Sx, { onNewTable: () => t(!0) }), /* @__PURE__ */ (0, V.jsx)($t, {
15254
+ children: [/* @__PURE__ */ (0, V.jsx)(Dx, { onNewTable: () => t(!0) }), /* @__PURE__ */ (0, V.jsx)($t, {
15232
15255
  width: a,
15233
15256
  label: fs(),
15234
15257
  onResize: o,
@@ -15240,41 +15263,41 @@ function Vx() {
15240
15263
  children: [/* @__PURE__ */ (0, V.jsx)("div", {
15241
15264
  className: "flex min-h-0 min-w-0 flex-1",
15242
15265
  children: /* @__PURE__ */ (0, V.jsx)(Tr, {})
15243
- }), i && /* @__PURE__ */ (0, V.jsx)(vb, {})]
15266
+ }), i && /* @__PURE__ */ (0, V.jsx)(Cb, {})]
15244
15267
  })]
15245
15268
  }),
15246
- /* @__PURE__ */ (0, V.jsx)(Lx, {}),
15247
- /* @__PURE__ */ (0, V.jsx)(Qb, {}),
15248
- e && /* @__PURE__ */ (0, V.jsx)(nx, {
15269
+ /* @__PURE__ */ (0, V.jsx)(Hx, {}),
15270
+ /* @__PURE__ */ (0, V.jsx)(rx, {}),
15271
+ e && /* @__PURE__ */ (0, V.jsx)(sx, {
15249
15272
  open: !0,
15250
15273
  onOpenChange: t
15251
15274
  }),
15252
- /* @__PURE__ */ (0, V.jsx)(Lv, { position: n ? "top-center" : "bottom-right" }),
15253
- /* @__PURE__ */ (0, V.jsx)(ex, {})
15275
+ /* @__PURE__ */ (0, V.jsx)(Hv, { position: n ? "top-center" : "bottom-right" }),
15276
+ /* @__PURE__ */ (0, V.jsx)(ax, {})
15254
15277
  ]
15255
15278
  });
15256
15279
  }
15257
15280
  //#endregion
15258
15281
  //#region ui/src/lib/history.ts
15259
- var Hx = "yamlite-sql-history", Ux = 50;
15260
- function Wx() {
15282
+ var qx = "yamlite-sql-history", Jx = 50;
15283
+ function Yx() {
15261
15284
  try {
15262
- let e = JSON.parse(localStorage.getItem(Hx) ?? "[]");
15285
+ let e = JSON.parse(localStorage.getItem(qx) ?? "[]");
15263
15286
  return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
15264
15287
  } catch {
15265
15288
  return [];
15266
15289
  }
15267
15290
  }
15268
- function Gx(e) {
15269
- let t = [e, ...Wx().filter((t) => t !== e)].slice(0, Ux);
15291
+ function Xx(e) {
15292
+ let t = [e, ...Yx().filter((t) => t !== e)].slice(0, Jx);
15270
15293
  try {
15271
- localStorage.setItem(Hx, JSON.stringify(t));
15294
+ localStorage.setItem(qx, JSON.stringify(t));
15272
15295
  } catch {}
15273
15296
  return t;
15274
15297
  }
15275
15298
  //#endregion
15276
15299
  //#region src/serve/sqltext.ts
15277
- function Kx(e, t = !0, n = !1) {
15300
+ function Zx(e, t = !0, n = !1) {
15278
15301
  let r = "", i = 0;
15279
15302
  for (; i < e.length;) {
15280
15303
  let a = e[i], o = e[i + 1];
@@ -15295,19 +15318,19 @@ function Kx(e, t = !0, n = !1) {
15295
15318
  }
15296
15319
  return r;
15297
15320
  }
15298
- var qx = (e) => /^\s*([A-Za-z]+)/.exec(Kx(e))?.[1]?.toUpperCase() ?? "";
15321
+ var Qx = (e) => /^\s*([A-Za-z]+)/.exec(Zx(e))?.[1]?.toUpperCase() ?? "";
15299
15322
  //#endregion
15300
15323
  //#region ui/src/lib/sqlguard.ts
15301
- function Jx(e) {
15302
- let t = qx(e);
15303
- return t === "DROP" ? Ad() : (t === "DELETE" || t === "UPDATE") && !/\bWHERE\b/i.test(Kx(e)) ? jd() : null;
15324
+ function $x(e) {
15325
+ let t = Qx(e);
15326
+ return t === "DROP" ? Ad() : (t === "DELETE" || t === "UPDATE") && !/\bWHERE\b/i.test(Zx(e)) ? jd() : null;
15304
15327
  }
15305
15328
  //#endregion
15306
15329
  //#region node_modules/.pnpm/@tanstack+virtual-core@3.19.5/node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js
15307
- function Yx(e) {
15330
+ function eS(e) {
15308
15331
  return typeof e == "object" ? e.key : e;
15309
15332
  }
15310
- function Xx(e, t) {
15333
+ function tS(e, t) {
15311
15334
  let n = e.length;
15312
15335
  return new Proxy(e, { get(e, r, i) {
15313
15336
  if (typeof r == "string") {
@@ -15337,7 +15360,7 @@ function Xx(e, t) {
15337
15360
  }
15338
15361
  //#endregion
15339
15362
  //#region node_modules/.pnpm/@tanstack+virtual-core@3.19.5/node_modules/@tanstack/virtual-core/dist/esm/utils.js
15340
- function Zx(e, t, n) {
15363
+ function nS(e, t, n) {
15341
15364
  let r = n.initialDeps ?? [], i, a = !0;
15342
15365
  function o() {
15343
15366
  let o = e();
@@ -15347,11 +15370,11 @@ function Zx(e, t, n) {
15347
15370
  r = e;
15348
15371
  }, o;
15349
15372
  }
15350
- function Qx(e, t) {
15373
+ function rS(e, t) {
15351
15374
  if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`);
15352
15375
  return e;
15353
15376
  }
15354
- var $x = (e, t) => Math.abs(e - t) < 1.01, eS = (e, t, n) => {
15377
+ var iS = (e, t) => Math.abs(e - t) < 1.01, aS = (e, t, n) => {
15355
15378
  let r;
15356
15379
  return Object.assign(function(...i) {
15357
15380
  e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n);
@@ -15361,47 +15384,47 @@ var $x = (e, t) => Math.abs(e - t) < 1.01, eS = (e, t, n) => {
15361
15384
  };
15362
15385
  //#endregion
15363
15386
  //#region node_modules/.pnpm/@tanstack+virtual-core@3.19.5/node_modules/@tanstack/virtual-core/dist/esm/scroll-classifier.js
15364
- function tS({ offset: e, isScrolling: t, elementMax: n, holdOffset: r, scrollOffset: i, pendingWrite: a, clampedMaxAtWrite: o }) {
15387
+ function oS({ offset: e, isScrolling: t, elementMax: n, holdOffset: r, scrollOffset: i, pendingWrite: a, clampedMaxAtWrite: o }) {
15365
15388
  return t && a === null && e === i ? "spurious" : a !== null && Math.abs(e - a.target) < 1.5 ? "readBack" : a !== null && !a.smooth && n !== null && a.target > n + r + .5 && Math.abs(e - (n + r)) < 1.5 || a !== null && !a.smooth && a.lowMaxes?.some((t) => Math.abs(e - t) < 1.5) ? "clampedReadBack" : o !== null && Math.abs(e - o) < 1.5 ? "clampedEcho" : "external";
15366
15389
  }
15367
- var nS = (e) => e === "smooth" || e === "smoothFinishing";
15368
- function rS({ kind: e, offset: t, command: n, target: r }) {
15369
- return e !== "spurious" && e !== "readBack" && e !== "clampedReadBack" && n?.index != null && n.phase !== "queued" && !nS(n.phase) && !$x(t, n.lastTargetOffset) && !$x(t, r()) && e !== "clampedEcho";
15390
+ var sS = (e) => e === "smooth" || e === "smoothFinishing";
15391
+ function cS({ kind: e, offset: t, command: n, target: r }) {
15392
+ return e !== "spurious" && e !== "readBack" && e !== "clampedReadBack" && n?.index != null && n.phase !== "queued" && !sS(n.phase) && !iS(t, n.lastTargetOffset) && !iS(t, r()) && e !== "clampedEcho";
15370
15393
  }
15371
- var iS = 40;
15372
- function aS(e) {
15394
+ var lS = 40;
15395
+ function uS(e) {
15373
15396
  let t = e[e.length - 1];
15374
15397
  if (t === void 0) return !1;
15375
15398
  let n = e.length - 2;
15376
- for (; n >= 0 && t.t - e[n].t < iS;) n--;
15399
+ for (; n >= 0 && t.t - e[n].t < lS;) n--;
15377
15400
  if (n < 0) return !1;
15378
15401
  let r = e[n], i = n - 1;
15379
- for (; i >= 0 && r.t - e[i].t < iS;) i--;
15402
+ for (; i >= 0 && r.t - e[i].t < lS;) i--;
15380
15403
  if (i < 0) return !1;
15381
15404
  let a = e[i], o = (t.offset - r.offset) / (t.t - r.t), s = (r.offset - a.offset) / (r.t - a.t);
15382
15405
  return o * s >= 0 && Math.abs(o) >= 2 * Math.abs(s) && Math.abs(o) - Math.abs(s) >= .8;
15383
15406
  }
15384
- function oS(e) {
15407
+ function dS(e) {
15385
15408
  let t = e[e.length - 1];
15386
15409
  if (t === void 0) return !1;
15387
15410
  let n = e.length - 2;
15388
- for (; n >= 0 && t.t - e[n].t < iS;) n--;
15411
+ for (; n >= 0 && t.t - e[n].t < lS;) n--;
15389
15412
  if (n < 0) return !1;
15390
15413
  let r = e[n];
15391
15414
  return Math.abs(t.offset - r.offset) / (t.t - r.t) >= .05;
15392
15415
  }
15393
15416
  //#endregion
15394
15417
  //#region node_modules/.pnpm/@tanstack+virtual-core@3.19.5/node_modules/@tanstack/virtual-core/dist/esm/ios-gesture.js
15395
- var sS, cS = () => {
15396
- if (sS !== void 0) return sS;
15397
- if (typeof navigator > "u") return sS = !1;
15398
- if (/iP(hone|od|ad)/.test(navigator.userAgent)) return sS = !0;
15418
+ var fS, pS = () => {
15419
+ if (fS !== void 0) return fS;
15420
+ if (typeof navigator > "u") return fS = !1;
15421
+ if (/iP(hone|od|ad)/.test(navigator.userAgent)) return fS = !0;
15399
15422
  let e = navigator.maxTouchPoints;
15400
- return sS = navigator.platform === "MacIntel" && e !== void 0 && e > 0;
15401
- }, lS, uS = () => lS === void 0 ? lS = cS() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("overflow-anchor: auto") : lS, dS = {
15423
+ return fS = navigator.platform === "MacIntel" && e !== void 0 && e > 0;
15424
+ }, mS, hS = () => mS === void 0 ? mS = pS() && typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("overflow-anchor: auto") : mS, gS = {
15402
15425
  capture: !0,
15403
15426
  passive: !0
15404
- }, fS = class {
15427
+ }, _S = class {
15405
15428
  constructor(e) {
15406
15429
  this.host = e, this._touch = null, this.inMotion = () => this._touch !== null && this._touch.phase !== "lateFling", this.dragging = () => this._touch?.phase === "down" && this._touch.moved, this.tail = () => this._touch?.phase === "tail" ? this._touch.moved ? "fling" : "tap" : null, this.onScroll = ({ isScrolling: e, ownReadBack: t, moved: n, external: r }) => (e && this._touch?.phase === "tail" ? this._openTail(this._touch.moved || !t, !1) : this._touch?.phase === "lateFling" && (this.host.now() > this._touch.until ? this._touch = null : r && e && n && this._openTail(!0, !1)), !t && e && n && this._touch?.phase === "down" ? (this._touch.moved = !0, !0) : !1), this.touchStart = () => {
15407
15430
  this.end(), this._touch = {
@@ -15416,12 +15439,12 @@ var sS, cS = () => {
15416
15439
  this._touch?.phase === "tail" && e != null && e.clearTimeout(this._touch.timerId), this._touch = null;
15417
15440
  }, this.listen = (e) => {
15418
15441
  let t = () => this.touchStart(), n = () => this.touchEnd();
15419
- return e.addEventListener("touchstart", t, dS), e.addEventListener("touchend", n, dS), e.addEventListener("touchcancel", n, dS), () => {
15420
- e.removeEventListener("touchstart", t, dS), e.removeEventListener("touchend", n, dS), e.removeEventListener("touchcancel", n, dS), this.end();
15442
+ return e.addEventListener("touchstart", t, gS), e.addEventListener("touchend", n, gS), e.addEventListener("touchcancel", n, gS), () => {
15443
+ e.removeEventListener("touchstart", t, gS), e.removeEventListener("touchend", n, gS), e.removeEventListener("touchcancel", n, gS), this.end();
15421
15444
  };
15422
15445
  }, this._openTail = (e, t) => {
15423
15446
  let n = this.host.getWindow();
15424
- if (!cS() || n == null) return;
15447
+ if (!pS() || n == null) return;
15425
15448
  this.end();
15426
15449
  let r = {
15427
15450
  phase: "tail",
@@ -15440,13 +15463,13 @@ var sS, cS = () => {
15440
15463
  get touch() {
15441
15464
  return this._touch;
15442
15465
  }
15443
- }, pS = (e) => {
15466
+ }, vS = (e) => {
15444
15467
  let { offsetWidth: t, offsetHeight: n } = e;
15445
15468
  return {
15446
15469
  width: t,
15447
15470
  height: n
15448
15471
  };
15449
- }, mS = (e) => {
15472
+ }, yS = (e) => {
15450
15473
  let t = /* @__PURE__ */ new Set();
15451
15474
  return {
15452
15475
  schedule: (n) => {
@@ -15459,11 +15482,11 @@ var sS, cS = () => {
15459
15482
  t.forEach((t) => e.cancelAnimationFrame(t)), t.clear();
15460
15483
  }
15461
15484
  };
15462
- }, hS = (e) => e, gS = (e) => {
15485
+ }, bS = (e) => e, xS = (e) => {
15463
15486
  let t = e.overscan * Math.max(e.lanes ?? 1, 1), n = Math.max(e.startIndex - t, 0), r = Math.min(e.endIndex + t, e.count - 1) - n + 1, i = Array(r);
15464
15487
  for (let e = 0; e < r; e++) i[e] = n + e;
15465
15488
  return i;
15466
- }, _S = (e, t) => {
15489
+ }, SS = (e, t) => {
15467
15490
  let n = e.scrollElement;
15468
15491
  if (!n) return;
15469
15492
  let r = e.targetWindow;
@@ -15475,8 +15498,8 @@ var sS, cS = () => {
15475
15498
  height: Math.round(r)
15476
15499
  });
15477
15500
  };
15478
- if (i(pS(n)), !r.ResizeObserver) return () => {};
15479
- let a = mS(r), o = new r.ResizeObserver((t) => {
15501
+ if (i(vS(n)), !r.ResizeObserver) return () => {};
15502
+ let a = yS(r), o = new r.ResizeObserver((t) => {
15480
15503
  let r = () => {
15481
15504
  let e = t[0];
15482
15505
  if (e?.borderBoxSize) {
@@ -15489,28 +15512,28 @@ var sS, cS = () => {
15489
15512
  return;
15490
15513
  }
15491
15514
  }
15492
- i(pS(n));
15515
+ i(vS(n));
15493
15516
  };
15494
15517
  e.options.useAnimationFrameWithResizeObserver ? a.schedule(r) : r();
15495
15518
  });
15496
15519
  return o.observe(n, { box: "border-box" }), () => {
15497
15520
  o.unobserve(n), a.cancel();
15498
15521
  };
15499
- }, vS = { passive: !0 }, yS = typeof window > "u" || "onscrollend" in window, bS = (e, t, n) => {
15522
+ }, CS = { passive: !0 }, wS = typeof window > "u" || "onscrollend" in window, TS = (e, t, n) => {
15500
15523
  let r = e.scrollElement;
15501
15524
  if (!r) return;
15502
15525
  let i = e.targetWindow;
15503
15526
  if (!i) return;
15504
- let a = e.options.useScrollendEvent && yS, o = 0, s = a ? null : eS(i, () => t(n(r), !1), e.options.isScrollingResetDelay), c = (e) => () => {
15527
+ let a = e.options.useScrollendEvent && wS, o = 0, s = a ? null : aS(i, () => t(n(r), !1), e.options.isScrollingResetDelay), c = (e) => () => {
15505
15528
  o = n(r), s?.(), t(o, e);
15506
15529
  }, l = c(!0), u = c(!1);
15507
- return r.addEventListener("scroll", l, vS), a && r.addEventListener("scrollend", u, vS), () => {
15530
+ return r.addEventListener("scroll", l, CS), a && r.addEventListener("scrollend", u, CS), () => {
15508
15531
  r.removeEventListener("scroll", l), a && r.removeEventListener("scrollend", u), s?.cancel();
15509
15532
  };
15510
- }, xS = (e, t) => bS(e, t, (t) => {
15533
+ }, ES = (e, t) => TS(e, t, (t) => {
15511
15534
  let { horizontal: n, isRtl: r } = e.options;
15512
15535
  return n ? t.scrollLeft * (r && -1 || 1) : t.scrollTop;
15513
- }), SS = (e, t, n) => {
15536
+ }), DS = (e, t, n) => {
15514
15537
  if (n.options.useCachedMeasurements) {
15515
15538
  let t = n.indexFromElement(e), r = n.options.getItemKey(t);
15516
15539
  return n.itemSizeCache.get(r) ?? n.options.estimateSize(t);
@@ -15524,14 +15547,14 @@ var sS, cS = () => {
15524
15547
  if (i !== void 0) return i;
15525
15548
  }
15526
15549
  return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"];
15527
- }, CS = (e, { adjustments: t = 0, behavior: n }, r) => {
15550
+ }, OS = (e, { adjustments: t = 0, behavior: n }, r) => {
15528
15551
  var i, a;
15529
15552
  (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, {
15530
15553
  [r.options.horizontal ? "left" : "top"]: e + t,
15531
15554
  behavior: n
15532
15555
  });
15533
- }, wS = (e, t) => e === "smooth" ? t ? "smoothLanded" : "smooth" : "instant", TS = (e) => e?.phase === "smooth" || e?.phase === "smoothLanded";
15534
- function ES(e, t, n, r) {
15556
+ }, kS = (e, t) => e === "smooth" ? t ? "smoothLanded" : "smooth" : "instant", AS = (e) => e?.phase === "smooth" || e?.phase === "smoothLanded";
15557
+ function jS(e, t, n, r) {
15535
15558
  if (t === 0) return !1;
15536
15559
  let i = r(0), a = /* @__PURE__ */ new Set(), o = 0;
15537
15560
  for (; o < e;) {
@@ -15545,9 +15568,9 @@ function ES(e, t, n, r) {
15545
15568
  for (let e = s; e < t; e++) if (a.has(r(e))) return !1;
15546
15569
  return !0;
15547
15570
  }
15548
- var DS = class {
15571
+ var MS = class {
15549
15572
  constructor(e) {
15550
- this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this._holdOffset = 0, this._reportedOverscroll = !1, this._iosGesture = new fS({
15573
+ this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this._holdOffset = 0, this._reportedOverscroll = !1, this._iosGesture = new _S({
15551
15574
  getWindow: () => this.targetWindow,
15552
15575
  now: () => this.now(),
15553
15576
  tailStillMoving: () => {
@@ -15561,7 +15584,7 @@ var DS = class {
15561
15584
  },
15562
15585
  onTailClosed: () => {
15563
15586
  let e = this.scrollState;
15564
- e?.phase === "queued" && oS(e.samples ?? []) && (this.scrollState = null), this._flushHoldIfReady(!0), this._writeAwaitingCommand();
15587
+ e?.phase === "queued" && dS(e.samples ?? []) && (this.scrollState = null), this._flushHoldIfReady(!0), this._writeAwaitingCommand();
15565
15588
  }
15566
15589
  }), this._lastElementOffset = null, this.pendingWrite = null, this._clampedAdjustment = null, this.elementsCache = /* @__PURE__ */ new Map(), this._resizeBatch = null, this.now = () => {
15567
15590
  var e;
@@ -15571,7 +15594,7 @@ var DS = class {
15571
15594
  if (e) return e;
15572
15595
  let n = this.targetWindow;
15573
15596
  if (!n || !n.ResizeObserver) return null;
15574
- let i = t = mS(n);
15597
+ let i = t = yS(n);
15575
15598
  return e = new n.ResizeObserver((e) => {
15576
15599
  let t = () => {
15577
15600
  let t = { sync: !1 };
@@ -15613,10 +15636,10 @@ var DS = class {
15613
15636
  scrollPaddingStart: 0,
15614
15637
  scrollPaddingEnd: 0,
15615
15638
  horizontal: !1,
15616
- getItemKey: hS,
15617
- rangeExtractor: gS,
15639
+ getItemKey: bS,
15640
+ rangeExtractor: xS,
15618
15641
  onChange: () => {},
15619
- measureElement: SS,
15642
+ measureElement: DS,
15620
15643
  initialRect: {
15621
15644
  width: 0,
15622
15645
  height: 0
@@ -15643,13 +15666,13 @@ var DS = class {
15643
15666
  }
15644
15667
  let n = this.options, r = null, i = null, a = !1;
15645
15668
  if (n !== void 0 && n.enabled && t.enabled && t.anchorTo === "end" && this.scrollElement !== null) {
15646
- let e = n.count, o = t.count, s = this.getMeasurements(), c = this._singleLaneMeasurements?.items ?? s, l = (e) => Yx(c[e]), u = e > 0 ? l(0) : null, d = e > 0 ? l(e - 1) : null;
15669
+ let e = n.count, o = t.count, s = this.getMeasurements(), c = this._singleLaneMeasurements?.items ?? s, l = (e) => eS(c[e]), u = e > 0 ? l(0) : null, d = e > 0 ? l(e - 1) : null;
15647
15670
  if (o !== e || e > 0 && o > 0 && (t.getItemKey(0) !== u || t.getItemKey(o - 1) !== d)) {
15648
15671
  a = !0;
15649
15672
  let c = e > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? s[0] : null;
15650
15673
  c && (r = [c.key, this.getScrollOffset() - c.start]);
15651
15674
  let u = t.followOnAppend === !0 ? "auto" : t.followOnAppend || null;
15652
- u && o > 0 && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== d) && (o > e || ES(e, o, l, t.getItemKey)) && (i = u);
15675
+ u && o > 0 && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== d) && (o > e || jS(e, o, l, t.getItemKey)) && (i = u);
15653
15676
  }
15654
15677
  }
15655
15678
  this.options = t, a && (this.pendingMin = 0, this.itemSizeCacheVersion++);
@@ -15675,7 +15698,7 @@ var DS = class {
15675
15698
  }, this.notify = (e) => {
15676
15699
  var t, n;
15677
15700
  (n = (t = this.options).onChange) == null || n.call(t, this, e);
15678
- }, this.maybeNotify = Zx(() => (this.calculateRange(), [
15701
+ }, this.maybeNotify = nS(() => (this.calculateRange(), [
15679
15702
  this.isScrolling,
15680
15703
  this.range ? this.range.startIndex : null,
15681
15704
  this.range ? this.range.endIndex : null
@@ -15712,7 +15735,7 @@ var DS = class {
15712
15735
  this._lastElementOffset = i, e = this._toLayoutOffset(e);
15713
15736
  let a = this._classifyScrollEvent(e, t, n);
15714
15737
  if (a === "spurious") return;
15715
- a === "readBack" ? e = this.pendingWrite.target : a === "clampedReadBack" && this.scrollState?.index != null && e < this.getMaxScrollOffset() - 1.5 ? this.scrollState.lastTargetOffset = e : rS({
15738
+ a === "readBack" ? e = this.pendingWrite.target : a === "clampedReadBack" && this.scrollState?.index != null && e < this.getMaxScrollOffset() - 1.5 ? this.scrollState.lastTargetOffset = e : cS({
15716
15739
  kind: a,
15717
15740
  offset: e,
15718
15741
  command: this.scrollState,
@@ -15728,7 +15751,7 @@ var DS = class {
15728
15751
  c.samples = [...(c.samples ?? []).filter((t) => e - t.t <= 200), {
15729
15752
  t: e,
15730
15753
  offset: i
15731
- }], (s !== null && this.scrollDirection !== s || aS(c.samples)) && (this.scrollState = null);
15754
+ }], (s !== null && this.scrollDirection !== s || uS(c.samples)) && (this.scrollState = null);
15732
15755
  }
15733
15756
  }
15734
15757
  this._iosGesture.onScroll({
@@ -15741,8 +15764,8 @@ var DS = class {
15741
15764
  }
15742
15765
  this._noteClampMax();
15743
15766
  let t = this.pendingScrollAnchor;
15744
- this.pendingScrollAnchor = null, t && this.scrollElement && this.options.enabled && (t.kind === "anchor" ? this._canWriteScroll() ? TS(this.scrollState) && !$x(this.getScrollOffset() - t.delta, this.scrollState.lastTargetOffset) || (this._followOffsetTarget(t.delta), this._scrollToOffset(this.getScrollOffset())) : (this._holdOffset += t.delta, this._followOffsetTarget(t.delta), this.notify(!1)) : this.scrollToEnd({ behavior: t.behavior })), this._flushHoldIfReady(!1), this._retryClampedAdjustment();
15745
- }, this._classifyScrollEvent = (e, t, n) => tS({
15767
+ this.pendingScrollAnchor = null, t && this.scrollElement && this.options.enabled && (t.kind === "anchor" ? this._canWriteScroll() ? AS(this.scrollState) && !iS(this.getScrollOffset() - t.delta, this.scrollState.lastTargetOffset) || (this._followOffsetTarget(t.delta), this._scrollToOffset(this.getScrollOffset())) : (this._holdOffset += t.delta, this._followOffsetTarget(t.delta), this.notify(!1)) : this.scrollToEnd({ behavior: t.behavior })), this._flushHoldIfReady(!1), this._retryClampedAdjustment();
15768
+ }, this._classifyScrollEvent = (e, t, n) => oS({
15746
15769
  offset: e,
15747
15770
  isScrolling: t,
15748
15771
  elementMax: n,
@@ -15763,18 +15786,18 @@ var DS = class {
15763
15786
  let { behavior: t } = e;
15764
15787
  this.getMeasurements();
15765
15788
  let n = this.getScrollStateTarget(e);
15766
- e.lastTargetOffset = n, this._clampedAdjustment = null, e.phase = wS(t, e.index != null && $x(n, this.getScrollOffset())), this._scrollToOffset(n, { behavior: t }), this.scheduleScrollReconcile();
15789
+ e.lastTargetOffset = n, this._clampedAdjustment = null, e.phase = kS(t, e.index != null && iS(n, this.getScrollOffset())), this._scrollToOffset(n, { behavior: t }), this.scheduleScrollReconcile();
15767
15790
  }, this._readElementOffset = () => {
15768
15791
  let e = this.scrollElement;
15769
15792
  if (e == null) return null;
15770
15793
  let { horizontal: t, isRtl: n } = this.options;
15771
15794
  return typeof e.scrollTop == "number" ? t ? e.scrollLeft * (n && -1 || 1) : e.scrollTop : typeof e.scrollY == "number" ? t ? e.scrollX : e.scrollY : null;
15772
- }, this._canWriteScroll = () => !(cS() && this._iosGesture.inMotion()) && !this._reportedOverscroll, this._flushHoldIfReady = (e) => {
15795
+ }, this._canWriteScroll = () => !(pS() && this._iosGesture.inMotion()) && !this._reportedOverscroll, this._flushHoldIfReady = (e) => {
15773
15796
  if (this._holdOffset === 0 || !this.scrollElement || !this.options.enabled || !this._canWriteScroll() || this.scrollState?.phase === "smooth") return;
15774
15797
  this._holdOffset = 0, this.scrollOffset !== null && this.scrollOffset < 0 && (this.scrollOffset = 0), this.notify(e);
15775
15798
  let t = this.getCommandWrittenOffset() ?? this.getScrollOffset();
15776
15799
  this._clampedAdjustment = this._clampedBy(t), this._scrollToOffset(t);
15777
- }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getMeasurementOptions = Zx(() => [
15800
+ }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getMeasurementOptions = nS(() => [
15778
15801
  this.options.count,
15779
15802
  this.options.paddingStart,
15780
15803
  this.options.scrollMargin,
@@ -15792,7 +15815,7 @@ var DS = class {
15792
15815
  lanes: a,
15793
15816
  laneAssignmentMode: o,
15794
15817
  gap: s
15795
- }), { key: !1 }), this.isIndexInRange = (e) => e >= 0 && e < this.options.count, this.getMeasurements = Zx(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o, gap: s }, c) => {
15818
+ }), { key: !1 }), this.isIndexInRange = (e) => e >= 0 && e < this.options.count, this.getMeasurements = nS(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o, gap: s }, c) => {
15796
15819
  let l = this.itemSizeCache;
15797
15820
  if (!i) return this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), [];
15798
15821
  if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t);
@@ -15822,7 +15845,7 @@ var DS = class {
15822
15845
  flat: a,
15823
15846
  items: o
15824
15847
  };
15825
- let d = Xx(o, a);
15848
+ let d = tS(o, a);
15826
15849
  return this.measurementsCache = d, d;
15827
15850
  }
15828
15851
  let d = this.measurementsCache.slice(0, u), f = Array(a).fill(void 0), p = new Float64Array(a), m = 0;
@@ -15858,15 +15881,15 @@ var DS = class {
15858
15881
  }, {
15859
15882
  key: !1,
15860
15883
  debug: () => this.options.debug
15861
- }), this.calculateRange = Zx(() => [
15884
+ }), this.calculateRange = nS(() => [
15862
15885
  this.getMeasurements(),
15863
15886
  this.getSize(),
15864
15887
  this.getScrollOffset(),
15865
15888
  this.options.lanes
15866
- ], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = AS(e, t, n, r, r === 1 && this._singleLaneMeasurements !== null ? this._singleLaneMeasurements.flat : null), this.range), {
15889
+ ], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = FS(e, t, n, r, r === 1 && this._singleLaneMeasurements !== null ? this._singleLaneMeasurements.flat : null), this.range), {
15867
15890
  key: !1,
15868
15891
  debug: () => this.options.debug
15869
- }), this.getVirtualIndexes = Zx(() => {
15892
+ }), this.getVirtualIndexes = nS(() => {
15870
15893
  let e = null, t = null, n = this.calculateRange();
15871
15894
  return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([
15872
15895
  this.isScrolling,
@@ -15893,7 +15916,7 @@ var DS = class {
15893
15916
  let t = this.options.indexAttribute, n = e.getAttribute(t);
15894
15917
  return n ? parseInt(n, 10) : (console.warn(`Missing attribute name '${t}={index}' on measured element.`), -1);
15895
15918
  }, this.shouldMeasureDuringScroll = (e) => {
15896
- if (!TS(this.scrollState)) return !0;
15919
+ if (!AS(this.scrollState)) return !0;
15897
15920
  let t = this.scrollState.index ?? this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;
15898
15921
  if (t !== void 0 && this.range) {
15899
15922
  let n = Math.max(this.options.overscan, Math.ceil((this.range.endIndex - this.range.startIndex) / 2)), r = Math.max(0, t - n), i = Math.min(this.options.count - 1, t + n);
@@ -15924,7 +15947,7 @@ var DS = class {
15924
15947
  }
15925
15948
  let s = this.itemSizeCache.get(a) ?? r, c = t - s;
15926
15949
  if (c !== 0) {
15927
- let o = this.options.anchorTo === "end" && !TS(this.scrollState) && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, l = o ? this._getLayoutTotalSize() : 0, u = this.getScrollOffset(), d = this.itemSizeCache.has(a) ? i + s <= u && this.scrollDirection !== "backward" : i < u, f = !TS(this.scrollState) && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? d : this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e] ?? {
15950
+ let o = this.options.anchorTo === "end" && !AS(this.scrollState) && this.getVirtualDistanceFromEnd() <= this.options.scrollEndThreshold, l = o ? this._getLayoutTotalSize() : 0, u = this.getScrollOffset(), d = this.itemSizeCache.has(a) ? i + s <= u && this.scrollDirection !== "backward" : i < u, f = !AS(this.scrollState) && (this.shouldAdjustScrollPositionOnItemSizeChange === void 0 ? d : this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e] ?? {
15928
15951
  index: e,
15929
15952
  key: a,
15930
15953
  start: i,
@@ -15940,7 +15963,7 @@ var DS = class {
15940
15963
  }
15941
15964
  this.notify(p), this._noteClampMax(), this._flushHoldIfReady(!0), this._retryClampedAdjustment();
15942
15965
  }
15943
- }, this.getVirtualItems = Zx(() => [
15966
+ }, this.getVirtualItems = nS(() => [
15944
15967
  this.getVirtualIndexes(),
15945
15968
  this.getMeasurements(),
15946
15969
  this._holdOffset
@@ -15962,7 +15985,7 @@ var DS = class {
15962
15985
  let t = this.getMeasurements();
15963
15986
  if (t.length === 0) return;
15964
15987
  let n = this._singleLaneMeasurements?.flat, r = this.options.lanes === 1 && n != null;
15965
- return Qx(t[OS(0, t.length - 1, r ? (e) => n[e * 2] : (e) => Qx(t[e]).start, e)]);
15988
+ return rS(t[NS(0, t.length - 1, r ? (e) => n[e * 2] : (e) => rS(t[e]).start, e)]);
15966
15989
  }, this._noteClampMax = () => {
15967
15990
  if (!this._awaitingCommandReadBack()) return;
15968
15991
  let e = this._elementMaxScrollOffset();
@@ -16097,7 +16120,7 @@ var DS = class {
16097
16120
  }, this), r;
16098
16121
  }, this.getCommandWrittenOffset = () => this.scrollState !== null && this.pendingWrite !== null && !this.pendingWrite.smooth ? this.pendingWrite.target : null, this._awaitingCommandReadBack = () => {
16099
16122
  let e = this.getCommandWrittenOffset();
16100
- return !(cS() && this._iosGesture.dragging()) && e !== null && !$x(e, this.getScrollOffset());
16123
+ return !(pS() && this._iosGesture.dragging()) && e !== null && !iS(e, this.getScrollOffset());
16101
16124
  }, this._followOffsetTarget = (e) => {
16102
16125
  this.scrollState !== null && this.scrollState.index == null && (this.scrollState.lastTargetOffset += e);
16103
16126
  }, this.measure = () => {
@@ -16141,13 +16164,13 @@ var DS = class {
16141
16164
  }
16142
16165
  this.getMeasurements();
16143
16166
  let e = this.getScrollStateTarget(this.scrollState), t = this.scrollState.index == null ? 1 : this.options.useAnimationFrameWithResizeObserver ? 3 : 2, n = e !== this.scrollState.lastTargetOffset;
16144
- if (!n && $x(e, this.getScrollOffset())) {
16167
+ if (!n && iS(e, this.getScrollOffset())) {
16145
16168
  if (this.scrollState.phase === "smooth" ? this.scrollState.phase = "smoothLanded" : this.scrollState.phase === "smoothFinishing" && (this.scrollState.phase = "instant"), this.scrollState.stableFrames++, this.scrollState.stableFrames >= t) {
16146
16169
  this.getScrollOffset() !== e && this._scrollToOffset(e, { behavior: "auto" }), this.scrollState = null;
16147
16170
  return;
16148
16171
  }
16149
16172
  } else if (this.scrollState.stableFrames = 0, n) {
16150
- let t = this.getSize() || 600, n = Math.abs(e - this.getScrollOffset()), r = TS(this.scrollState) && n > t;
16173
+ let t = this.getSize() || 600, n = Math.abs(e - this.getScrollOffset()), r = AS(this.scrollState) && n > t;
16151
16174
  this.scrollState.lastTargetOffset = e, r ? this.scrollState.phase = "smooth" : this.scrollState.phase === "smooth" ? this.scrollState.phase = "smoothFinishing" : this.scrollState.phase === "smoothLanded" && (this.scrollState.phase = "instant"), this._scrollToOffset(e, { behavior: r ? "smooth" : "auto" });
16152
16175
  }
16153
16176
  this.scheduleScrollReconcile();
@@ -16155,7 +16178,7 @@ var DS = class {
16155
16178
  _startScroll(e, t, n, r) {
16156
16179
  let i = this._iosGesture.tail();
16157
16180
  if (r === "absolute" && i !== null) {
16158
- if (i === "fling" && uS()) {
16181
+ if (i === "fling" && hS()) {
16159
16182
  this._stopMomentum(() => {
16160
16183
  this.scrollState?.phase !== "queued" || this._iosGesture.tail() !== "fling" || this._reportedOverscroll || (this._iosGesture.end(), this._flushHoldIfReady(!0), this._writeAwaitingCommand());
16161
16184
  }), this.scrollState = {
@@ -16177,10 +16200,10 @@ var DS = class {
16177
16200
  lastTargetOffset: t,
16178
16201
  stableFrames: 0,
16179
16202
  behavior: n,
16180
- phase: wS(n, e.index != null && $x(t, this.getScrollOffset()))
16203
+ phase: kS(n, e.index != null && iS(t, this.getScrollOffset()))
16181
16204
  }, this._scrollToOffset(t, { behavior: n }), this.scheduleScrollReconcile();
16182
16205
  }
16183
- }, OS = (e, t, n, r) => {
16206
+ }, NS = (e, t, n, r) => {
16184
16207
  for (; e <= t;) {
16185
16208
  let i = (e + t) / 2 | 0, a = n(i);
16186
16209
  if (a < r) e = i + 1;
@@ -16189,7 +16212,7 @@ var DS = class {
16189
16212
  }
16190
16213
  return e > 0 ? e - 1 : 0;
16191
16214
  };
16192
- function kS(e, t, n) {
16215
+ function PS(e, t, n) {
16193
16216
  let r = 0;
16194
16217
  for (; r <= t;) {
16195
16218
  let i = (r + t) / 2 | 0, a = e[i * 2];
@@ -16199,21 +16222,21 @@ function kS(e, t, n) {
16199
16222
  }
16200
16223
  return r > 0 ? r - 1 : 0;
16201
16224
  }
16202
- function AS(e, t, n, r, i) {
16225
+ function FS(e, t, n, r, i) {
16203
16226
  let a = e.length - 1;
16204
16227
  if (e.length <= r) return {
16205
16228
  startIndex: 0,
16206
16229
  endIndex: a
16207
16230
  };
16208
16231
  if (r === 1 && i !== null) {
16209
- let e = kS(i, a, n), r = e, o = n + t;
16232
+ let e = PS(i, a, n), r = e, o = n + t;
16210
16233
  for (; r < a && i[r * 2] + i[r * 2 + 1] < o;) r++;
16211
16234
  return {
16212
16235
  startIndex: e,
16213
16236
  endIndex: r
16214
16237
  };
16215
16238
  }
16216
- let o = OS(0, a, (t) => e[t].start, n), s = o;
16239
+ let o = NS(0, a, (t) => e[t].start, n), s = o;
16217
16240
  if (r === 1) for (; s < a && e[s].end < n + t;) s++;
16218
16241
  else if (r > 1) {
16219
16242
  let i = Array(r).fill(0);
@@ -16235,8 +16258,8 @@ function AS(e, t, n, r, i) {
16235
16258
  }
16236
16259
  //#endregion
16237
16260
  //#region node_modules/.pnpm/@tanstack+react-virtual@3.14.20_react-dom@19.3.1_react@19.3.1__react@19.3.1/node_modules/@tanstack/react-virtual/dist/esm/index.js
16238
- var jS = typeof document < "u" ? B.useLayoutEffect : B.useEffect;
16239
- function MS({ useFlushSync: e = !0, directDomUpdates: t = !1, directDomUpdatesMode: n = "transform", ...r }) {
16261
+ var IS = typeof document < "u" ? B.useLayoutEffect : B.useEffect;
16262
+ function LS({ useFlushSync: e = !0, directDomUpdates: t = !1, directDomUpdatesMode: n = "transform", ...r }) {
16240
16263
  let i = B.useReducer((e) => e + 1, 0)[1], a = B.useRef({
16241
16264
  enabled: t,
16242
16265
  mode: n,
@@ -16284,7 +16307,7 @@ function MS({ useFlushSync: e = !0, directDomUpdates: t = !1, directDomUpdatesMo
16284
16307
  u && (e && n && !o.current ? (0, Fm.flushSync)(i) : i()), (s = r.onChange) == null || s.call(r, t, n);
16285
16308
  }
16286
16309
  }, [d] = B.useState(() => {
16287
- let e = new DS(u), t = e.measureElement;
16310
+ let e = new MS(u), t = e.measureElement;
16288
16311
  return e.measureElement = (n) => {
16289
16312
  o.current = !0;
16290
16313
  try {
@@ -16302,22 +16325,22 @@ function MS({ useFlushSync: e = !0, directDomUpdates: t = !1, directDomUpdatesMo
16302
16325
  n.container = t, n.lastSize = null, t !== null && l(e);
16303
16326
  } });
16304
16327
  });
16305
- return d.setOptions(u), jS(() => d._didMount(), []), jS(() => (s(d), d._willUpdate())), jS(() => {
16328
+ return d.setOptions(u), IS(() => d._didMount(), []), IS(() => (s(d), d._willUpdate())), IS(() => {
16306
16329
  l(d);
16307
16330
  }), d;
16308
16331
  }
16309
- function NS(e) {
16310
- return MS({
16311
- observeElementRect: _S,
16312
- observeElementOffset: xS,
16313
- scrollToFn: CS,
16332
+ function RS(e) {
16333
+ return LS({
16334
+ observeElementRect: SS,
16335
+ observeElementOffset: ES,
16336
+ scrollToFn: OS,
16314
16337
  ...e
16315
16338
  });
16316
16339
  }
16317
16340
  //#endregion
16318
16341
  //#region ui/src/lib/highlight.tsx
16319
- var PS = (0, B.createContext)("");
16320
- function FS(e, t) {
16342
+ var zS = (0, B.createContext)("");
16343
+ function BS(e, t) {
16321
16344
  if (t === "") return [{
16322
16345
  text: e,
16323
16346
  match: !1
@@ -16335,8 +16358,8 @@ function FS(e, t) {
16335
16358
  match: !1
16336
16359
  }), i;
16337
16360
  }
16338
- function IS({ text: e }) {
16339
- let t = FS(e, (0, B.useContext)(PS));
16361
+ function VS({ text: e }) {
16362
+ let t = BS(e, (0, B.useContext)(zS));
16340
16363
  return t.length === 1 && !t[0]?.match ? e : t.map((e, t) => e.match ? /* @__PURE__ */ (0, V.jsx)("mark", {
16341
16364
  className: "rounded-[2px] bg-warn-soft text-foreground",
16342
16365
  children: e.text
@@ -16344,7 +16367,7 @@ function IS({ text: e }) {
16344
16367
  }
16345
16368
  //#endregion
16346
16369
  //#region ui/src/components/JsonTree.tsx
16347
- function LS({ value: e }) {
16370
+ function HS({ value: e }) {
16348
16371
  return typeof e == "string" ? /* @__PURE__ */ (0, V.jsx)("span", {
16349
16372
  className: "text-syn-str",
16350
16373
  children: JSON.stringify(e)
@@ -16356,8 +16379,8 @@ function LS({ value: e }) {
16356
16379
  children: String(e)
16357
16380
  });
16358
16381
  }
16359
- function RS({ value: e }) {
16360
- if (wn(e)) return /* @__PURE__ */ (0, V.jsx)(LS, { value: e });
16382
+ function US({ value: e }) {
16383
+ if (wn(e)) return /* @__PURE__ */ (0, V.jsx)(HS, { value: e });
16361
16384
  let t = Array.isArray(e) ? e.map((e, t) => [String(t), e]) : Object.entries(e);
16362
16385
  return /* @__PURE__ */ (0, V.jsx)("div", {
16363
16386
  className: "font-mono text-[12px] leading-[1.7]",
@@ -16367,19 +16390,19 @@ function RS({ value: e }) {
16367
16390
  children: t
16368
16391
  }),
16369
16392
  !Array.isArray(e) && ": ",
16370
- wn(n) ? /* @__PURE__ */ (0, V.jsx)(LS, { value: n }) : /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)("span", {
16393
+ wn(n) ? /* @__PURE__ */ (0, V.jsx)(HS, { value: n }) : /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)("span", {
16371
16394
  className: "text-muted-foreground",
16372
16395
  children: Array.isArray(n) ? `[${n.length}]` : `{${Object.keys(n).length}}`
16373
16396
  }), /* @__PURE__ */ (0, V.jsx)("div", {
16374
16397
  className: "ml-[3px] border-l pl-3.5",
16375
- children: /* @__PURE__ */ (0, V.jsx)(RS, { value: n })
16398
+ children: /* @__PURE__ */ (0, V.jsx)(US, { value: n })
16376
16399
  })] })
16377
16400
  ] }, t))
16378
16401
  });
16379
16402
  }
16380
16403
  //#endregion
16381
16404
  //#region ui/src/components/JsonPopover.tsx
16382
- function zS({ title: e, value: t, children: n }) {
16405
+ function WS({ title: e, value: t, children: n }) {
16383
16406
  return /* @__PURE__ */ (0, V.jsxs)(Ne, { children: [/* @__PURE__ */ (0, V.jsx)(Be, {
16384
16407
  asChild: !0,
16385
16408
  children: n
@@ -16395,13 +16418,13 @@ function zS({ title: e, value: t, children: n }) {
16395
16418
  onClick: () => void navigator.clipboard?.writeText(JSON.stringify(t, null, 2)),
16396
16419
  children: Xo()
16397
16420
  })]
16398
- }), /* @__PURE__ */ (0, V.jsx)(RS, { value: t })]
16421
+ }), /* @__PURE__ */ (0, V.jsx)(US, { value: t })]
16399
16422
  })] });
16400
16423
  }
16401
16424
  //#endregion
16402
16425
  //#region ui/src/components/Cell.tsx
16403
- var BS = "inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]";
16404
- function VS({ value: e, type: t, format: n, column: r, rowKey: i }) {
16426
+ var GS = "inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]";
16427
+ function KS({ value: e, type: t, format: n, column: r, rowKey: i }) {
16405
16428
  let a = xn(e, t, n);
16406
16429
  switch (a.kind) {
16407
16430
  case "null": return /* @__PURE__ */ (0, V.jsx)("span", {
@@ -16419,17 +16442,17 @@ function VS({ value: e, type: t, format: n, column: r, rowKey: i }) {
16419
16442
  });
16420
16443
  case "number": return /* @__PURE__ */ (0, V.jsx)("span", {
16421
16444
  className: "font-mono tabular-nums",
16422
- children: /* @__PURE__ */ (0, V.jsx)(IS, { text: a.text })
16445
+ children: /* @__PURE__ */ (0, V.jsx)(VS, { text: a.text })
16423
16446
  });
16424
- case "text": return /* @__PURE__ */ (0, V.jsx)("span", { children: /* @__PURE__ */ (0, V.jsx)(IS, { text: a.text }) });
16447
+ case "text": return /* @__PURE__ */ (0, V.jsx)("span", { children: /* @__PURE__ */ (0, V.jsx)(VS, { text: a.text }) });
16425
16448
  case "chips": return /* @__PURE__ */ (0, V.jsxs)("span", { children: [a.items.map((e, t) => /* @__PURE__ */ (0, V.jsx)("span", {
16426
- className: BS,
16427
- children: /* @__PURE__ */ (0, V.jsx)(IS, { text: e })
16449
+ className: GS,
16450
+ children: /* @__PURE__ */ (0, V.jsx)(VS, { text: e })
16428
16451
  }, `${t}-${e}`)), a.more > 0 && /* @__PURE__ */ (0, V.jsxs)("span", {
16429
16452
  className: "inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]",
16430
16453
  children: ["+", a.more]
16431
16454
  })] });
16432
- case "map": return /* @__PURE__ */ (0, V.jsx)(zS, {
16455
+ case "map": return /* @__PURE__ */ (0, V.jsx)(WS, {
16433
16456
  title: `${r} · ${i}`,
16434
16457
  value: e,
16435
16458
  children: /* @__PURE__ */ (0, V.jsxs)("button", {
@@ -16441,14 +16464,14 @@ function VS({ value: e, type: t, format: n, column: r, rowKey: i }) {
16441
16464
  children: [/* @__PURE__ */ (0, V.jsx)("span", {
16442
16465
  className: "mr-0.5 text-[11px] text-muted-foreground",
16443
16466
  children: e
16444
- }), /* @__PURE__ */ (0, V.jsx)(IS, { text: t })]
16467
+ }), /* @__PURE__ */ (0, V.jsx)(VS, { text: t })]
16445
16468
  }, e)), a.more > 0 && /* @__PURE__ */ (0, V.jsxs)("span", {
16446
16469
  className: "text-muted-foreground",
16447
16470
  children: ["+", a.more]
16448
16471
  })]
16449
16472
  })
16450
16473
  });
16451
- case "nested": return /* @__PURE__ */ (0, V.jsx)(zS, {
16474
+ case "nested": return /* @__PURE__ */ (0, V.jsx)(WS, {
16452
16475
  title: `${r} · ${i}`,
16453
16476
  value: e,
16454
16477
  children: /* @__PURE__ */ (0, V.jsxs)("button", {
@@ -16468,21 +16491,21 @@ function VS({ value: e, type: t, format: n, column: r, rowKey: i }) {
16468
16491
  }
16469
16492
  //#endregion
16470
16493
  //#region ui/src/components/Grid.tsx
16471
- function HS({ column: e, row: t, rowKey: n }) {
16494
+ function qS({ column: e, row: t, rowKey: n }) {
16472
16495
  let r = t[e.name], i = xn(r, e.type, e.format), { reference: a } = e;
16473
16496
  return a && (i.kind === "text" || i.kind === "number") ? /* @__PURE__ */ (0, V.jsx)(_t, {
16474
16497
  reference: a,
16475
16498
  value: String(r),
16476
- children: /* @__PURE__ */ (0, V.jsx)(IS, { text: String(r) })
16499
+ children: /* @__PURE__ */ (0, V.jsx)(VS, { text: String(r) })
16477
16500
  }) : a && i.kind === "chips" ? /* @__PURE__ */ (0, V.jsxs)("span", { children: [i.items.map((e, t) => /* @__PURE__ */ (0, V.jsx)(_t, {
16478
16501
  reference: a,
16479
16502
  value: e,
16480
- className: `${BS} hover:underline`,
16481
- children: /* @__PURE__ */ (0, V.jsx)(IS, { text: e })
16503
+ className: `${GS} hover:underline`,
16504
+ children: /* @__PURE__ */ (0, V.jsx)(VS, { text: e })
16482
16505
  }, `${t}-${e}`)), i.more > 0 && /* @__PURE__ */ (0, V.jsxs)("span", {
16483
16506
  className: "inline-block rounded-full bg-chip px-[7px] text-[11.5px] text-chip-foreground mr-[3px]",
16484
16507
  children: ["+", i.more]
16485
- })] }) : /* @__PURE__ */ (0, V.jsx)(VS, {
16508
+ })] }) : /* @__PURE__ */ (0, V.jsx)(KS, {
16486
16509
  value: r,
16487
16510
  type: e.type,
16488
16511
  format: e.format,
@@ -16490,8 +16513,8 @@ function HS({ column: e, row: t, rowKey: n }) {
16490
16513
  rowKey: n
16491
16514
  });
16492
16515
  }
16493
- var US = 34, WS = 44, GS = "sticky left-0 z-[1] bg-background shadow-[1px_0_0_var(--border)]", KS = 16;
16494
- function qS({ column: e, width: t, onResize: n }) {
16516
+ var JS = 34, YS = 44, XS = "sticky left-0 z-[1] bg-background shadow-[1px_0_0_var(--border)]", ZS = 16;
16517
+ function QS({ column: e, width: t, onResize: n }) {
16495
16518
  let r = (e) => t ?? e.parentElement?.getBoundingClientRect().width ?? 0;
16496
16519
  return /* @__PURE__ */ (0, V.jsx)("div", {
16497
16520
  role: "separator",
@@ -16511,14 +16534,14 @@ function qS({ column: e, width: t, onResize: n }) {
16511
16534
  },
16512
16535
  onDoubleClick: () => n(e, null),
16513
16536
  onKeyDown: (t) => {
16514
- let i = t.key === "ArrowRight" ? KS : t.key === "ArrowLeft" ? -16 : 0;
16537
+ let i = t.key === "ArrowRight" ? ZS : t.key === "ArrowLeft" ? -16 : 0;
16515
16538
  i !== 0 && (t.preventDefault(), n(e, r(t.currentTarget) + i));
16516
16539
  },
16517
16540
  className: "absolute inset-y-0 -right-[3px] z-[2] w-1.5 cursor-col-resize touch-none outline-none hover:bg-primary/40 focus-visible:bg-primary/40"
16518
16541
  });
16519
16542
  }
16520
- function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, selectedKey: a, onSelect: o, onEndReached: s, flagged: c, sort: l, onSort: u, widths: d, onResize: f, pinned: p = !0, onTogglePin: m, preview: h }) {
16521
- let g = (0, B.useRef)(null), _ = ze(), v = _ ? WS : US, y = NS({
16543
+ function $S({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, selectedKey: a, onSelect: o, onEndReached: s, flagged: c, sort: l, onSort: u, widths: d, onResize: f, pinned: p = !0, onTogglePin: m, preview: h }) {
16544
+ let g = (0, B.useRef)(null), _ = ze(), v = _ ? YS : JS, y = RS({
16522
16545
  count: t.length,
16523
16546
  getScrollElement: () => g.current,
16524
16547
  estimateSize: () => v,
@@ -16550,7 +16573,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16550
16573
  style: { gridTemplateColumns: w },
16551
16574
  children: e.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
16552
16575
  role: "columnheader",
16553
- className: E("group/header relative flex min-w-0 items-center", e.name === T && GS),
16576
+ className: E("group/header relative flex min-w-0 items-center", e.name === T && XS),
16554
16577
  children: [
16555
16578
  /* @__PURE__ */ (0, V.jsxs)("button", {
16556
16579
  type: "button",
@@ -16577,7 +16600,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16577
16600
  onClick: m,
16578
16601
  children: p ? /* @__PURE__ */ (0, V.jsx)(Lg, { className: "size-3.5" }) : /* @__PURE__ */ (0, V.jsx)(Fg, { className: "size-3.5" })
16579
16602
  }),
16580
- f && !_ && /* @__PURE__ */ (0, V.jsx)(qS, {
16603
+ f && !_ && /* @__PURE__ */ (0, V.jsx)(QS, {
16581
16604
  column: e.name,
16582
16605
  width: d?.[e.name],
16583
16606
  onResize: f
@@ -16605,7 +16628,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16605
16628
  onClick: () => d?.op !== "insert" && o?.(l, s),
16606
16629
  children: e.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
16607
16630
  role: "gridcell",
16608
- className: E("flex items-center overflow-hidden px-3 whitespace-nowrap", e.name === n && "font-mono text-[12px] max-md:text-[13px]", e.name === T && GS, e.name === T && d && "bg-warn-soft", e.name === T && !d && (u ? "bg-tomato-soft" : "md:group-hover:bg-panel")),
16631
+ className: E("flex items-center overflow-hidden px-3 whitespace-nowrap", e.name === n && "font-mono text-[12px] max-md:text-[13px]", e.name === T && XS, e.name === T && d && "bg-warn-soft", e.name === T && !d && (u ? "bg-tomato-soft" : "md:group-hover:bg-panel")),
16609
16632
  children: [e.name === n && (c?.has(l) ? /* @__PURE__ */ (0, V.jsx)(Ue, {
16610
16633
  label: "has warnings",
16611
16634
  hint: c.get(l)?.join("\n"),
@@ -16620,7 +16643,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16620
16643
  /* @__PURE__ */ (0, V.jsx)("span", {
16621
16644
  "data-testid": "preview-old",
16622
16645
  className: "text-muted-foreground line-through",
16623
- children: /* @__PURE__ */ (0, V.jsx)(HS, {
16646
+ children: /* @__PURE__ */ (0, V.jsx)(qS, {
16624
16647
  column: e,
16625
16648
  row: d.before ?? s,
16626
16649
  rowKey: l
@@ -16629,7 +16652,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16629
16652
  "→",
16630
16653
  /* @__PURE__ */ (0, V.jsx)("span", {
16631
16654
  className: "font-semibold text-ok",
16632
- children: /* @__PURE__ */ (0, V.jsx)(HS, {
16655
+ children: /* @__PURE__ */ (0, V.jsx)(qS, {
16633
16656
  column: e,
16634
16657
  row: d.after ?? s,
16635
16658
  rowKey: l
@@ -16638,7 +16661,7 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16638
16661
  ]
16639
16662
  }) : /* @__PURE__ */ (0, V.jsx)("span", {
16640
16663
  className: "truncate",
16641
- children: /* @__PURE__ */ (0, V.jsx)(HS, {
16664
+ children: /* @__PURE__ */ (0, V.jsx)(qS, {
16642
16665
  column: e,
16643
16666
  row: s,
16644
16667
  rowKey: l
@@ -16653,14 +16676,14 @@ function JS({ columns: e, rows: t, keyCol: n, stickyCol: r = n, rowId: i, select
16653
16676
  }
16654
16677
  //#endregion
16655
16678
  //#region ui/src/components/SqlConsole.tsx
16656
- var YS = {
16679
+ var eC = {
16657
16680
  toFile: "M",
16658
16681
  deleteFile: "−",
16659
16682
  toDb: "M",
16660
16683
  deleteDb: "−"
16661
16684
  };
16662
- function XS() {
16663
- let e = c(), t = ze(), { data: n } = fe(), r = A(), [i, a] = (0, B.useState)(Wx), [o, s] = (0, B.useState)(() => i[0] ?? "select * from "), [l, u] = (0, B.useState)(null), [d, f] = (0, B.useState)([]), [p, m] = (0, B.useState)(null), h = (0, B.useRef)(() => {}), g = () => {
16685
+ function tC() {
16686
+ let e = c(), t = ze(), { data: n } = fe(), r = A(), [i, a] = (0, B.useState)(Yx), [o, s] = (0, B.useState)(() => i[0] ?? "select * from "), [l, u] = (0, B.useState)(null), [d, f] = (0, B.useState)([]), [p, m] = (0, B.useState)(null), h = (0, B.useRef)(() => {}), g = () => {
16664
16687
  h.current(), f([]);
16665
16688
  let e = r.listen((e) => {
16666
16689
  if (e.type !== "sync") return;
@@ -16680,7 +16703,7 @@ function XS() {
16680
16703
  mutationFn: (e) => ge.sql(e),
16681
16704
  onMutate: g,
16682
16705
  onSuccess: (e, t) => {
16683
- a(Gx(t)), "columns" in e && (h.current(), f([]));
16706
+ a(Xx(t)), "columns" in e && (h.current(), f([]));
16684
16707
  },
16685
16708
  onError: () => {
16686
16709
  h.current(), f([]);
@@ -16688,7 +16711,7 @@ function XS() {
16688
16711
  }), v = (0, B.useRef)(() => {});
16689
16712
  v.current = () => {
16690
16713
  if (_.isPending) return;
16691
- let e = me() ? null : Jx(o);
16714
+ let e = me() ? null : $x(o);
16692
16715
  e ? u(e) : _.mutate(o);
16693
16716
  };
16694
16717
  let y = (0, B.useMemo)(() => [
@@ -16710,7 +16733,7 @@ function XS() {
16710
16733
  children: ms()
16711
16734
  }),
16712
16735
  /* @__PURE__ */ (0, V.jsx)("span", { className: "flex-1" }),
16713
- /* @__PURE__ */ (0, V.jsxs)(my, { children: [/* @__PURE__ */ (0, V.jsx)(hy, {
16736
+ /* @__PURE__ */ (0, V.jsxs)(yy, { children: [/* @__PURE__ */ (0, V.jsx)(by, {
16714
16737
  asChild: !0,
16715
16738
  children: /* @__PURE__ */ (0, V.jsxs)(L, {
16716
16739
  variant: "outline",
@@ -16722,9 +16745,9 @@ function XS() {
16722
16745
  Pd()
16723
16746
  ]
16724
16747
  })
16725
- }), /* @__PURE__ */ (0, V.jsx)(gy, {
16748
+ }), /* @__PURE__ */ (0, V.jsx)(xy, {
16726
16749
  className: "max-w-[min(480px,calc(100vw-2rem))]",
16727
- children: i.map((e) => /* @__PURE__ */ (0, V.jsx)(_y, {
16750
+ children: i.map((e) => /* @__PURE__ */ (0, V.jsx)(Sy, {
16728
16751
  className: "truncate font-mono text-[12px]",
16729
16752
  onSelect: () => s(e),
16730
16753
  children: e
@@ -16779,7 +16802,7 @@ function XS() {
16779
16802
  x.ms,
16780
16803
  " ms"
16781
16804
  ]
16782
- }), /* @__PURE__ */ (0, V.jsx)(JS, {
16805
+ }), /* @__PURE__ */ (0, V.jsx)($S, {
16783
16806
  columns: x.columns.map((e) => ({
16784
16807
  name: e,
16785
16808
  type: "TEXT"
@@ -16815,7 +16838,7 @@ function XS() {
16815
16838
  children: Bd()
16816
16839
  }), d.map((e, t) => /* @__PURE__ */ (0, V.jsxs)("div", { children: [/* @__PURE__ */ (0, V.jsx)("span", {
16817
16840
  className: "mr-1.5 font-bold text-warn",
16818
- children: YS[e.op]
16841
+ children: eC[e.op]
16819
16842
  }), b(e.table, e.key)] }, `${t}-${e.table}-${e.key}`))]
16820
16843
  })
16821
16844
  ] })
@@ -16843,7 +16866,7 @@ function XS() {
16843
16866
  })] })
16844
16867
  ] })
16845
16868
  }),
16846
- p && /* @__PURE__ */ (0, V.jsx)(nx, {
16869
+ p && /* @__PURE__ */ (0, V.jsx)(sx, {
16847
16870
  open: !0,
16848
16871
  adopt: p,
16849
16872
  onOpenChange: (e) => !e && m(null)
@@ -16853,7 +16876,7 @@ function XS() {
16853
16876
  }
16854
16877
  //#endregion
16855
16878
  //#region ui/src/lib/diff.ts
16856
- function ZS(e, t, n) {
16879
+ function nC(e, t, n) {
16857
16880
  let r = e ?? {}, i = t ?? {}, a = new Set(nn(r, i));
16858
16881
  return [.../* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])].filter((e) => e !== n).map((e) => ({
16859
16882
  field: e,
@@ -16862,18 +16885,18 @@ function ZS(e, t, n) {
16862
16885
  same: !a.has(e)
16863
16886
  }));
16864
16887
  }
16865
- function QS(e) {
16888
+ function rC(e) {
16866
16889
  return e === "file" ? Ec() : e === "db" ? Dc() : Oc();
16867
16890
  }
16868
16891
  //#endregion
16869
16892
  //#region ui/src/components/SyncView.tsx
16870
- var $S = {
16893
+ var iC = {
16871
16894
  ok: "text-ok",
16872
16895
  warn: "text-warn",
16873
16896
  err: "text-err",
16874
16897
  muted: "text-muted-foreground"
16875
- }, eC = (e) => e === void 0 ? "—" : JSON.stringify(e);
16876
- function tC({ entry: e, detail: t, keyCol: n }) {
16898
+ }, aC = (e) => e === void 0 ? "—" : JSON.stringify(e);
16899
+ function oC({ entry: e, detail: t, keyCol: n }) {
16877
16900
  return /* @__PURE__ */ (0, V.jsx)(z, {
16878
16901
  className: "md:text-[11.5px]",
16879
16902
  labels: [/* @__PURE__ */ (0, V.jsx)("span", {
@@ -16881,8 +16904,8 @@ function tC({ entry: e, detail: t, keyCol: n }) {
16881
16904
  children: yf({ winner: e.winner ?? "" })
16882
16905
  }), pf()],
16883
16906
  note: t.deleted ? X() : void 0,
16884
- format: eC,
16885
- rows: ZS(t.current, t.saved, n).map((e) => ({
16907
+ format: aC,
16908
+ rows: nC(t.current, t.saved, n).map((e) => ({
16886
16909
  field: e.field,
16887
16910
  a: e.winner,
16888
16911
  b: e.saved,
@@ -16890,7 +16913,7 @@ function tC({ entry: e, detail: t, keyCol: n }) {
16890
16913
  }))
16891
16914
  });
16892
16915
  }
16893
- function nC({ entry: e }) {
16916
+ function sC({ entry: e }) {
16894
16917
  let [t, n] = (0, B.useState)(!1), [r, i] = (0, B.useState)(!1), a = He(), { connected: o } = k(), s = ze(), { data: c } = fe(), l = c?.tables.find((t) => t.name === e.table)?.key, u = j({
16895
16918
  queryKey: ["conflict", e.id],
16896
16919
  queryFn: () => ge.conflict(e.id),
@@ -16936,7 +16959,7 @@ function nC({ entry: e }) {
16936
16959
  /* @__PURE__ */ (0, V.jsxs)("span", {
16937
16960
  className: "truncate text-[11.5px] text-muted-foreground max-md:basis-full max-md:pl-5 max-md:text-[12.5px] max-md:whitespace-normal",
16938
16961
  children: [
16939
- xy(e.at),
16962
+ Ey(e.at),
16940
16963
  " · ",
16941
16964
  e.winner ? Bf({ winner: e.winner }) : Tf()
16942
16965
  ]
@@ -16949,7 +16972,7 @@ function nC({ entry: e }) {
16949
16972
  disabled: !o || !e.restorable || f.isPending,
16950
16973
  title: m,
16951
16974
  onClick: () => i(!0),
16952
- children: QS(e.restorable ? e.winner : null)
16975
+ children: rC(e.restorable ? e.winner : null)
16953
16976
  }),
16954
16977
  /* @__PURE__ */ (0, V.jsx)(L, {
16955
16978
  size: s ? "default" : "sm",
@@ -16967,7 +16990,7 @@ function nC({ entry: e }) {
16967
16990
  }),
16968
16991
  t && u.data && /* @__PURE__ */ (0, V.jsx)("div", {
16969
16992
  className: "mt-2",
16970
- children: /* @__PURE__ */ (0, V.jsx)(tC, {
16993
+ children: /* @__PURE__ */ (0, V.jsx)(oC, {
16971
16994
  entry: e,
16972
16995
  detail: u.data,
16973
16996
  keyCol: l
@@ -16981,7 +17004,7 @@ function nC({ entry: e }) {
16981
17004
  table: e.table,
16982
17005
  key: e.key ?? ""
16983
17006
  }) }) }),
16984
- u.data ? /* @__PURE__ */ (0, V.jsx)(tC, {
17007
+ u.data ? /* @__PURE__ */ (0, V.jsx)(oC, {
16985
17008
  entry: e,
16986
17009
  detail: u.data,
16987
17010
  keyCol: l
@@ -17000,14 +17023,14 @@ function nC({ entry: e }) {
17000
17023
  }), /* @__PURE__ */ (0, V.jsx)(L, {
17001
17024
  disabled: !u.data || f.isPending,
17002
17025
  onClick: () => u.data && f.mutate(u.data.current),
17003
- children: QS(e.winner)
17026
+ children: rC(e.winner)
17004
17027
  })] })
17005
17028
  ] })
17006
17029
  })
17007
17030
  ]
17008
17031
  });
17009
17032
  }
17010
- function rC({ title: e, count: t, tone: n, children: r }) {
17033
+ function cC({ title: e, count: t, tone: n, children: r }) {
17011
17034
  return /* @__PURE__ */ (0, V.jsxs)("div", {
17012
17035
  className: "mb-3.5 overflow-hidden rounded-[10px] border",
17013
17036
  children: [/* @__PURE__ */ (0, V.jsxs)("h3", {
@@ -17019,7 +17042,7 @@ function rC({ title: e, count: t, tone: n, children: r }) {
17019
17042
  }), r]
17020
17043
  });
17021
17044
  }
17022
- function iC() {
17045
+ function lC() {
17023
17046
  let e = A(), { activity: t, warnings: n, connected: r, lastSyncAt: i } = k(), { data: a } = j({
17024
17047
  queryKey: ["conflicts"],
17025
17048
  queryFn: ge.conflicts
@@ -17035,21 +17058,21 @@ function iC() {
17035
17058
  children: hs()
17036
17059
  }), /* @__PURE__ */ (0, V.jsxs)("span", {
17037
17060
  className: "text-[12px] text-muted-foreground",
17038
- children: [r ? Lf() : Yd(), i && Sf({ at: xy(i) })]
17061
+ children: [r ? Lf() : Yd(), i && Sf({ at: Ey(i) })]
17039
17062
  })]
17040
17063
  }), /* @__PURE__ */ (0, V.jsxs)("div", {
17041
17064
  className: "overflow-auto px-[18px] py-3.5 max-md:px-3",
17042
17065
  children: [
17043
- /* @__PURE__ */ (0, V.jsx)(rC, {
17066
+ /* @__PURE__ */ (0, V.jsx)(cC, {
17044
17067
  title: mf(),
17045
17068
  count: o.length,
17046
17069
  tone: "err",
17047
17070
  children: o.length === 0 ? /* @__PURE__ */ (0, V.jsx)("p", {
17048
17071
  className: "px-3.5 py-2.5 text-[12px] text-muted-foreground",
17049
17072
  children: wf()
17050
- }) : o.map((e) => /* @__PURE__ */ (0, V.jsx)(nC, { entry: e }, e.id))
17073
+ }) : o.map((e) => /* @__PURE__ */ (0, V.jsx)(sC, { entry: e }, e.id))
17051
17074
  }),
17052
- /* @__PURE__ */ (0, V.jsx)(rC, {
17075
+ /* @__PURE__ */ (0, V.jsx)(cC, {
17053
17076
  title: If(),
17054
17077
  count: c.length,
17055
17078
  tone: "warn",
@@ -17087,7 +17110,7 @@ function iC() {
17087
17110
  ]
17088
17111
  }, `${t}-${e.text}`))
17089
17112
  }),
17090
- /* @__PURE__ */ (0, V.jsx)(rC, {
17113
+ /* @__PURE__ */ (0, V.jsx)(cC, {
17091
17114
  title: ff(),
17092
17115
  children: l.length === 0 ? /* @__PURE__ */ (0, V.jsx)("p", {
17093
17116
  className: "px-3.5 py-2.5 text-[12px] text-muted-foreground",
@@ -17096,7 +17119,7 @@ function iC() {
17096
17119
  className: "flex flex-wrap gap-x-3 border-b px-3.5 py-2 text-[12px] last:border-b-0 max-md:text-[13px]",
17097
17120
  children: [
17098
17121
  /* @__PURE__ */ (0, V.jsx)("span", {
17099
- className: `w-3 font-mono font-bold ${$S[e.tone]}`,
17122
+ className: `w-3 font-mono font-bold ${iC[e.tone]}`,
17100
17123
  children: e.symbol
17101
17124
  }),
17102
17125
  /* @__PURE__ */ (0, V.jsx)("span", {
@@ -17106,7 +17129,7 @@ function iC() {
17106
17129
  /* @__PURE__ */ (0, V.jsxs)("span", {
17107
17130
  className: "text-muted-foreground",
17108
17131
  children: [
17109
- xy(e.at),
17132
+ Ey(e.at),
17110
17133
  " · ",
17111
17134
  e.detail
17112
17135
  ]
@@ -17118,10 +17141,10 @@ function iC() {
17118
17141
  })]
17119
17142
  });
17120
17143
  }
17121
- var aC = (e) => `yamlite-grid:${e}`;
17122
- function oC(e) {
17144
+ var uC = (e) => `yamlite-grid:${e}`;
17145
+ function dC(e) {
17123
17146
  try {
17124
- let t = JSON.parse(localStorage.getItem(aC(e)) ?? "{}");
17147
+ let t = JSON.parse(localStorage.getItem(uC(e)) ?? "{}");
17125
17148
  return {
17126
17149
  widths: Object.fromEntries(Object.entries(t.widths ?? {}).filter(([, e]) => typeof e == "number" && Number.isFinite(e))),
17127
17150
  unpinned: t.unpinned === !0
@@ -17133,11 +17156,11 @@ function oC(e) {
17133
17156
  };
17134
17157
  }
17135
17158
  }
17136
- function sC(e) {
17137
- let [t, n] = (0, B.useState)(() => oC(e)), r = (t) => {
17159
+ function fC(e) {
17160
+ let [t, n] = (0, B.useState)(() => dC(e)), r = (t) => {
17138
17161
  n(t);
17139
17162
  try {
17140
- localStorage.setItem(aC(e), JSON.stringify(t));
17163
+ localStorage.setItem(uC(e), JSON.stringify(t));
17141
17164
  } catch {}
17142
17165
  };
17143
17166
  return {
@@ -17160,22 +17183,22 @@ function sC(e) {
17160
17183
  }
17161
17184
  //#endregion
17162
17185
  //#region ui/src/components/FilterBar.tsx
17163
- var cC = (e) => () => e, lC = [
17164
- ["eq", cC("=")],
17165
- ["ne", cC("≠")],
17166
- ["lt", cC("<")],
17167
- ["lte", cC("≤")],
17168
- ["gt", cC(">")],
17169
- ["gte", cC("≥")],
17186
+ var pC = (e) => () => e, mC = [
17187
+ ["eq", pC("=")],
17188
+ ["ne", pC("≠")],
17189
+ ["lt", pC("<")],
17190
+ ["lte", pC("≤")],
17191
+ ["gt", pC(">")],
17192
+ ["gte", pC("≥")],
17170
17193
  ["contains", Ka],
17171
17194
  ["has", qa],
17172
17195
  ["null", Ya],
17173
17196
  ["notnull", Ja]
17174
- ], uC = (e) => `${e.col} ${lC.find(([t]) => t === e.op)?.[1]() ?? e.op}${e.value === void 0 ? "" : ` ${JSON.stringify(e.value)}`}`;
17175
- function dC(e, t) {
17197
+ ], hC = (e) => `${e.col} ${mC.find(([t]) => t === e.op)?.[1]() ?? e.op}${e.value === void 0 ? "" : ` ${JSON.stringify(e.value)}`}`;
17198
+ function gC(e, t) {
17176
17199
  return t === "BOOLEAN" ? e === "true" : (t === "INTEGER" || t === "REAL") && e.trim() !== "" && !Number.isNaN(Number(e)) ? t === "INTEGER" && !Number.isSafeInteger(Number(e)) ? e : Number(e) : e;
17177
17200
  }
17178
- function fC({ columns: e, filters: t, search: n, onChange: r }) {
17201
+ function _C({ columns: e, filters: t, search: n, onChange: r }) {
17179
17202
  let i = Object.keys(e), [a, o] = (0, B.useState)({
17180
17203
  col: i[0] ?? "",
17181
17204
  op: "eq",
@@ -17196,7 +17219,7 @@ function fC({ columns: e, filters: t, search: n, onChange: r }) {
17196
17219
  r
17197
17220
  ]);
17198
17221
  let d = () => {
17199
- let i = a.op !== "null" && a.op !== "notnull", o = i ? dC(a.text, (Object.hasOwn(e, a.col) ? e[a.col] : void 0) ?? "TEXT") : void 0;
17222
+ let i = a.op !== "null" && a.op !== "notnull", o = i ? gC(a.text, (Object.hasOwn(e, a.col) ? e[a.col] : void 0) ?? "TEXT") : void 0;
17200
17223
  r({
17201
17224
  filters: [...t, {
17202
17225
  col: a.col,
@@ -17231,8 +17254,8 @@ function fC({ columns: e, filters: t, search: n, onChange: r }) {
17231
17254
  filters: t.filter((e, t) => t !== i),
17232
17255
  search: n
17233
17256
  }),
17234
- children: [uC(e), " ×"]
17235
- }, `${i}-${uC(e)}`)),
17257
+ children: [hC(e), " ×"]
17258
+ }, `${i}-${hC(e)}`)),
17236
17259
  /* @__PURE__ */ (0, V.jsxs)(Ne, {
17237
17260
  open: l,
17238
17261
  onOpenChange: u,
@@ -17264,7 +17287,7 @@ function fC({ columns: e, filters: t, search: n, onChange: r }) {
17264
17287
  ...a,
17265
17288
  op: e.target.value
17266
17289
  }),
17267
- children: lC.map(([e, t]) => /* @__PURE__ */ (0, V.jsx)("option", {
17290
+ children: mC.map(([e, t]) => /* @__PURE__ */ (0, V.jsx)("option", {
17268
17291
  value: e,
17269
17292
  children: t()
17270
17293
  }, e))
@@ -17291,7 +17314,7 @@ function fC({ columns: e, filters: t, search: n, onChange: r }) {
17291
17314
  }
17292
17315
  //#endregion
17293
17316
  //#region ui/src/components/ui/badge.tsx
17294
- var pC = l("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3", {
17317
+ var vC = l("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3", {
17295
17318
  variants: { variant: {
17296
17319
  default: "bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
17297
17320
  secondary: "bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
@@ -17302,18 +17325,18 @@ var pC = l("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflo
17302
17325
  } },
17303
17326
  defaultVariants: { variant: "default" }
17304
17327
  });
17305
- function mC({ className: e, variant: t = "default", asChild: n = !1, ...r }) {
17328
+ function yC({ className: e, variant: t = "default", asChild: n = !1, ...r }) {
17306
17329
  let i = n ? m : "span";
17307
17330
  return /* @__PURE__ */ (0, V.jsx)(i, {
17308
17331
  "data-slot": "badge",
17309
17332
  "data-variant": t,
17310
- className: E(pC({ variant: t }), e),
17333
+ className: E(vC({ variant: t }), e),
17311
17334
  ...r
17312
17335
  });
17313
17336
  }
17314
17337
  //#endregion
17315
17338
  //#region ui/src/components/ui/section-card.tsx
17316
- function hC({ title: e, heading: t, actions: n, flush: r = !1, children: i }) {
17339
+ function bC({ title: e, heading: t, actions: n, flush: r = !1, children: i }) {
17317
17340
  return /* @__PURE__ */ (0, V.jsxs)("section", {
17318
17341
  "data-slot": "section-card",
17319
17342
  className: "overflow-hidden rounded-lg border",
@@ -17338,7 +17361,7 @@ function hC({ title: e, heading: t, actions: n, flush: r = !1, children: i }) {
17338
17361
  }
17339
17362
  //#endregion
17340
17363
  //#region ui/src/lib/rules.ts
17341
- function gC(e) {
17364
+ function xC(e) {
17342
17365
  return {
17343
17366
  required: [...e.required],
17344
17367
  values: { ...e.values },
@@ -17348,60 +17371,60 @@ function gC(e) {
17348
17371
  references: Object.fromEntries(e.references.map((e) => [e.column, e.target ? `${e.table}.${e.target}` : e.table]))
17349
17372
  };
17350
17373
  }
17351
- var _C = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
17352
- function vC(e, t) {
17374
+ var SC = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
17375
+ function CC(e, t) {
17353
17376
  return e !== void 0 && t !== void 0 ? `${e} – ${t}` : e === void 0 ? t === void 0 ? null : `≤ ${t}` : `≥ ${e}`;
17354
17377
  }
17355
- function yC(e, t) {
17378
+ function wC(e, t) {
17356
17379
  let n = [];
17357
17380
  e.required.includes(t) && n.push("required");
17358
- let r = _C(e.values, t);
17381
+ let r = SC(e.values, t);
17359
17382
  r && n.push(`values ${r.length}`);
17360
- let i = _C(e.formats, t);
17383
+ let i = SC(e.formats, t);
17361
17384
  i && n.push(i);
17362
- let a = vC(_C(e.min, t), _C(e.max, t));
17385
+ let a = CC(SC(e.min, t), SC(e.max, t));
17363
17386
  a && n.push(a);
17364
- let o = _C(e.references, t);
17387
+ let o = SC(e.references, t);
17365
17388
  return o && n.push(`→ ${o}`), n;
17366
17389
  }
17367
- var bC = /^\w+__\w+: /;
17368
- function xC(e, t, n) {
17390
+ var TC = /^\w+__\w+: /;
17391
+ function EC(e, t, n) {
17369
17392
  return t.filter((t) => {
17370
17393
  let r = t;
17371
17394
  if (n) {
17372
17395
  let e = `${n}: `;
17373
17396
  if (!t.startsWith(e)) return !1;
17374
17397
  r = t.slice(e.length);
17375
- } else if (bC.test(t)) return !1;
17398
+ } else if (TC.test(t)) return !1;
17376
17399
  return r.startsWith(`${e} `) || r.startsWith(`references.${e}:`);
17377
17400
  });
17378
17401
  }
17379
- var SC = (e, t) => e === "INTEGER" || e === "REAL" ? "number" : t === "date" || t === "datetime" ? t : null, CC = (e) => e.columns ? {
17402
+ var DC = (e, t) => e === "INTEGER" || e === "REAL" ? "number" : t === "date" || t === "datetime" ? t : null, OC = (e) => e.columns ? {
17380
17403
  columns: [...e.columns],
17381
17404
  unique: e.unique
17382
17405
  } : {
17383
17406
  expr: e.expr ?? "",
17384
17407
  unique: e.unique
17385
- }, wC = (e) => `${e.unique ? "unique " : ""}(${"columns" in e ? e.columns.join(", ") : e.expr})`, TC = (e) => JSON.stringify([
17408
+ }, kC = (e) => `${e.unique ? "unique " : ""}(${"columns" in e ? e.columns.join(", ") : e.expr})`, AC = (e) => JSON.stringify([
17386
17409
  "columns" in e ? e.columns : null,
17387
17410
  "expr" in e ? e.expr : null,
17388
17411
  e.unique
17389
- ]), EC = (e, t) => DC(e.map(TC), t.map(TC)), DC = (e, t) => {
17412
+ ]), jC = (e, t) => MC(e.map(AC), t.map(AC)), MC = (e, t) => {
17390
17413
  let n = new Set(e);
17391
17414
  return n.size === new Set(t).size && t.every((e) => n.has(e));
17392
- }, OC = (e, t) => JSON.stringify([
17415
+ }, NC = (e, t) => JSON.stringify([
17393
17416
  e.required.includes(t),
17394
- _C(e.values, t) ?? null,
17395
- _C(e.formats, t) ?? null,
17396
- _C(e.min, t) ?? null,
17397
- _C(e.max, t) ?? null,
17398
- _C(e.references, t) ?? null
17417
+ SC(e.values, t) ?? null,
17418
+ SC(e.formats, t) ?? null,
17419
+ SC(e.min, t) ?? null,
17420
+ SC(e.max, t) ?? null,
17421
+ SC(e.references, t) ?? null
17399
17422
  ]);
17400
- function kC({ indexes: e, known: t, columns: n, onChange: r }) {
17423
+ function PC({ indexes: e, known: t, columns: n, onChange: r }) {
17401
17424
  let [i, a] = (0, B.useState)(!1), [o, s] = (0, B.useState)([]), [c, l] = (0, B.useState)(""), [u, d] = (0, B.useState)(!1), f = new Map(t.map((e) => [e.definition, e.inDb])), p = n.filter((e) => !o.includes(e)), m = () => {
17402
17425
  a(!1), s([]), l(""), d(!1);
17403
17426
  };
17404
- return /* @__PURE__ */ (0, V.jsxs)(hC, {
17427
+ return /* @__PURE__ */ (0, V.jsxs)(bC, {
17405
17428
  title: Ku(),
17406
17429
  actions: !i && /* @__PURE__ */ (0, V.jsx)(L, {
17407
17430
  type: "button",
@@ -17418,7 +17441,7 @@ function kC({ indexes: e, known: t, columns: n, onChange: r }) {
17418
17441
  e.length > 0 && /* @__PURE__ */ (0, V.jsx)("ul", {
17419
17442
  className: "flex flex-col gap-1",
17420
17443
  children: e.map((t) => {
17421
- let n = wC(t), i = f.get(n);
17444
+ let n = kC(t), i = f.get(n);
17422
17445
  return /* @__PURE__ */ (0, V.jsxs)("li", {
17423
17446
  className: "flex items-center gap-3 rounded-md border px-3 py-1.5",
17424
17447
  children: [
@@ -17434,7 +17457,7 @@ function kC({ indexes: e, known: t, columns: n, onChange: r }) {
17434
17457
  type: "button",
17435
17458
  "aria-label": fu({ index: n }),
17436
17459
  className: `px-1 text-[15px] text-muted-foreground hover:text-foreground ${i === void 0 ? "ml-auto" : ""}`,
17437
- onClick: () => r(e.filter((e) => wC(e) !== n)),
17460
+ onClick: () => r(e.filter((e) => kC(e) !== n)),
17438
17461
  children: "×"
17439
17462
  })
17440
17463
  ]
@@ -17508,8 +17531,8 @@ function kC({ indexes: e, known: t, columns: n, onChange: r }) {
17508
17531
  let t = {
17509
17532
  columns: o,
17510
17533
  unique: u
17511
- }, n = wC(t);
17512
- e.some((e) => wC(e) === n) || r([...e, t]), m();
17534
+ }, n = kC(t);
17535
+ e.some((e) => kC(e) === n) || r([...e, t]), m();
17513
17536
  },
17514
17537
  children: kl()
17515
17538
  })]
@@ -17521,19 +17544,19 @@ function kC({ indexes: e, known: t, columns: n, onChange: r }) {
17521
17544
  }
17522
17545
  //#endregion
17523
17546
  //#region ui/src/components/RuleForm.tsx
17524
- var AC = {
17547
+ var FC = {
17525
17548
  TEXT: [
17526
17549
  "date",
17527
17550
  "datetime",
17528
17551
  "markdown"
17529
17552
  ],
17530
17553
  JSON: ["list", "map"]
17531
- }, jC = [
17554
+ }, IC = [
17532
17555
  "markdown",
17533
17556
  "list",
17534
17557
  "map"
17535
- ], MC = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
17536
- function NC(e, t) {
17558
+ ], LC = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
17559
+ function RC(e, t) {
17537
17560
  let n = t.trim();
17538
17561
  if (n !== "") {
17539
17562
  if (e === "INTEGER" || e === "REAL") {
@@ -17543,7 +17566,7 @@ function NC(e, t) {
17543
17566
  return e === "BOOLEAN" ? n === "true" || n !== "false" && void 0 : n;
17544
17567
  }
17545
17568
  }
17546
- function PC({ title: e, children: t, hints: n = [] }) {
17569
+ function zC({ title: e, children: t, hints: n = [] }) {
17547
17570
  return /* @__PURE__ */ (0, V.jsxs)("section", {
17548
17571
  className: "flex flex-col gap-1.5",
17549
17572
  children: [
@@ -17552,25 +17575,25 @@ function PC({ title: e, children: t, hints: n = [] }) {
17552
17575
  children: e
17553
17576
  }),
17554
17577
  t,
17555
- /* @__PURE__ */ (0, V.jsx)(FC, { hints: n })
17578
+ /* @__PURE__ */ (0, V.jsx)(BC, { hints: n })
17556
17579
  ]
17557
17580
  });
17558
17581
  }
17559
- function FC({ hints: e }) {
17582
+ function BC({ hints: e }) {
17560
17583
  return e.length === 0 ? null : /* @__PURE__ */ (0, V.jsx)("ul", {
17561
17584
  className: "flex flex-col gap-0.5 text-[12.5px] text-warn",
17562
17585
  children: e.map((e) => /* @__PURE__ */ (0, V.jsx)("li", { children: e }, e))
17563
17586
  });
17564
17587
  }
17565
- function IC(e, t) {
17588
+ function VC(e, t) {
17566
17589
  return t.includes(`references.${e}: `) || / not found in \S+ \(/.test(t) ? "references" : t.includes(`${e} missing (`) ? "required" : t.includes(" not in values (") ? "values" : "other";
17567
17590
  }
17568
- function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleRequired: o, onBack: s }) {
17569
- let c = MC(n.formats, e), l = MC(n.values, e) ?? [], u = SC(t, c), d = MC(n.references, e) ?? "", f = d.indexOf("."), p = f < 0 ? d : d.slice(0, f), m = f < 0 ? "" : d.slice(f + 1), h = (t) => i.filter((n) => IC(e, n) === t), g = !jC.includes(c), _ = AC[t], v = (n) => {
17570
- let r = [...new Set(n.map((e) => l.find((t) => String(t) === e) ?? NC(t, e)))];
17591
+ function HC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleRequired: o, onBack: s }) {
17592
+ let c = LC(n.formats, e), l = LC(n.values, e) ?? [], u = DC(t, c), d = LC(n.references, e) ?? "", f = d.indexOf("."), p = f < 0 ? d : d.slice(0, f), m = f < 0 ? "" : d.slice(f + 1), h = (t) => i.filter((n) => VC(e, n) === t), g = !IC.includes(c), _ = FC[t], v = (n) => {
17593
+ let r = [...new Set(n.map((e) => l.find((t) => String(t) === e) ?? RC(t, e)))];
17571
17594
  a("values", e, r.length === 0 ? void 0 : r);
17572
17595
  }, y = (n) => {
17573
- a("formats", e, n), jC.includes(n) && a("values", e, void 0), SC(t, n) !== u && (a("min", e, void 0), a("max", e, void 0));
17596
+ a("formats", e, n), IC.includes(n) && a("values", e, void 0), DC(t, n) !== u && (a("min", e, void 0), a("max", e, void 0));
17574
17597
  }, b = (t, n) => {
17575
17598
  let r = n === "" ? void 0 : u === "number" ? Number(n) : n;
17576
17599
  a(t, e, r !== void 0 && typeof r == "number" && !Number.isFinite(r) ? void 0 : r);
@@ -17598,7 +17621,7 @@ function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleR
17598
17621
  children: Au({ type: t })
17599
17622
  })]
17600
17623
  }),
17601
- /* @__PURE__ */ (0, V.jsx)(PC, {
17624
+ /* @__PURE__ */ (0, V.jsx)(zC, {
17602
17625
  title: Tu(),
17603
17626
  hints: h("required"),
17604
17627
  children: /* @__PURE__ */ (0, V.jsxs)("label", {
@@ -17612,7 +17635,7 @@ function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleR
17612
17635
  }), /* @__PURE__ */ (0, V.jsx)("span", { children: Eu() })]
17613
17636
  })
17614
17637
  }),
17615
- g && /* @__PURE__ */ (0, V.jsx)(PC, {
17638
+ g && /* @__PURE__ */ (0, V.jsx)(zC, {
17616
17639
  title: Mu(),
17617
17640
  hints: h("values"),
17618
17641
  children: /* @__PURE__ */ (0, V.jsx)(nt, {
@@ -17621,11 +17644,11 @@ function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleR
17621
17644
  onChange: v,
17622
17645
  placeholder: Nu(),
17623
17646
  removeLabel: (e) => hu({ value: e }),
17624
- accept: (e) => NC(t, e) !== void 0,
17647
+ accept: (e) => RC(t, e) !== void 0,
17625
17648
  unique: !0
17626
17649
  })
17627
17650
  }),
17628
- _ && /* @__PURE__ */ (0, V.jsx)(PC, {
17651
+ _ && /* @__PURE__ */ (0, V.jsx)(zC, {
17629
17652
  title: Gl(),
17630
17653
  children: /* @__PURE__ */ (0, V.jsxs)("select", {
17631
17654
  "aria-label": Gl(),
@@ -17643,19 +17666,19 @@ function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleR
17643
17666
  }),
17644
17667
  u && /* @__PURE__ */ (0, V.jsx)("div", {
17645
17668
  className: "flex flex-wrap gap-3 max-md:flex-col",
17646
- children: ["min", "max"].map((t) => /* @__PURE__ */ (0, V.jsx)(PC, {
17669
+ children: ["min", "max"].map((t) => /* @__PURE__ */ (0, V.jsx)(zC, {
17647
17670
  title: t === "min" ? tu() : eu(),
17648
17671
  children: /* @__PURE__ */ (0, V.jsx)(tt, {
17649
17672
  "aria-label": t === "min" ? tu() : eu(),
17650
17673
  type: u === "number" ? "number" : u === "date" ? "date" : "text",
17651
17674
  className: "w-56 max-md:w-full",
17652
- value: String(MC(n[t], e) ?? ""),
17675
+ value: String(LC(n[t], e) ?? ""),
17653
17676
  onChange: (e) => b(t, e.target.value)
17654
17677
  })
17655
17678
  }, t))
17656
17679
  }),
17657
- /* @__PURE__ */ (0, V.jsx)(FC, { hints: g ? h("other") : [...h("values"), ...h("other")] }),
17658
- /* @__PURE__ */ (0, V.jsx)(PC, {
17680
+ /* @__PURE__ */ (0, V.jsx)(BC, { hints: g ? h("other") : [...h("values"), ...h("other")] }),
17681
+ /* @__PURE__ */ (0, V.jsx)(zC, {
17659
17682
  title: G(),
17660
17683
  hints: h("references"),
17661
17684
  children: /* @__PURE__ */ (0, V.jsxs)("div", {
@@ -17687,13 +17710,13 @@ function LC({ column: e, type: t, draft: n, tables: r, hints: i, set: a, toggleR
17687
17710
  }
17688
17711
  //#endregion
17689
17712
  //#region ui/src/components/ViewEditor.tsx
17690
- function RC({ fields: e, names: t, json: n, onChange: r }) {
17713
+ function UC({ fields: e, names: t, json: n, onChange: r }) {
17691
17714
  let i = n.filter((t) => !e.includes(t)), [a, o] = (0, B.useState)(!1), [s, c] = (0, B.useState)(""), l = i.includes(s) ? s : "", u = (e) => Object.hasOwn(t, e) ? t[e] : e, d = () => {
17692
17715
  o(!1), c("");
17693
17716
  }, f = (n) => {
17694
17717
  (!Object.hasOwn(t, n) || window.confirm(xu({ view: u(n) }))) && r(e.filter((e) => e !== n));
17695
17718
  };
17696
- return /* @__PURE__ */ (0, V.jsxs)(hC, {
17719
+ return /* @__PURE__ */ (0, V.jsxs)(bC, {
17697
17720
  title: Wu(),
17698
17721
  actions: i.length > 0 && !a && /* @__PURE__ */ (0, V.jsx)(L, {
17699
17722
  type: "button",
@@ -17758,18 +17781,18 @@ function RC({ fields: e, names: t, json: n, onChange: r }) {
17758
17781
  }
17759
17782
  //#endregion
17760
17783
  //#region ui/src/components/RuleEditor.tsx
17761
- var zC = (e) => e instanceof le && e.status === 409 && "current" in e.body, BC = (e) => e instanceof Error ? e.message : String(e);
17762
- function VC(e) {
17784
+ var WC = (e) => e instanceof le && e.status === 409 && "current" in e.body, GC = (e) => e instanceof Error ? e.message : String(e);
17785
+ function KC(e) {
17763
17786
  let t = He(), { data: n } = fe(), r = ze(), i = Object.keys(e.columns), [a, o] = (0, B.useState)(() => r ? null : i.find((t) => !e.fixed.includes(t)) ?? null), [s] = (0, B.useState)(e.base), c = e.views.filter((t) => t.path.length === e.target.path.length + 1), [l] = (0, B.useState)(() => ({
17764
17787
  rules: e.initial,
17765
- indexes: (e.indexes ?? []).map(CC),
17788
+ indexes: (e.indexes ?? []).map(OC),
17766
17789
  views: c.map((e) => e.path.at(-1))
17767
17790
  })), [u, d] = (0, B.useState)(l), f = u.rules, p = (e) => d((t) => ({
17768
17791
  ...t,
17769
17792
  rules: e(t.rules)
17770
- })), [m, h] = (0, B.useState)(null), [g, _] = (0, B.useState)(null), [v, y] = (0, B.useState)(null), [b, x] = (0, B.useState)(!1), S = wv(u, 300), C = (t) => ({
17771
- ...e.indexes !== void 0 && !EC(t.indexes, l.indexes) ? { indexes: t.indexes } : {},
17772
- ...DC(t.views, l.views) ? {} : { views: t.views }
17793
+ })), [m, h] = (0, B.useState)(null), [g, _] = (0, B.useState)(null), [v, y] = (0, B.useState)(null), [b, x] = (0, B.useState)(!1), S = kv(u, 300), C = (t) => ({
17794
+ ...e.indexes !== void 0 && !jC(t.indexes, l.indexes) ? { indexes: t.indexes } : {},
17795
+ ...MC(t.views, l.views) ? {} : { views: t.views }
17773
17796
  }), w = JSON.stringify(u.rules) !== JSON.stringify(l.rules) || Object.keys(C(u)).length > 0, T = (e) => {
17774
17797
  (!w || window.confirm(Hl())) && e();
17775
17798
  }, ee = (t) => T(() => e.onOpenView(t)), te = e.views.filter((t) => u.views.includes(t.path[e.target.path.length]));
@@ -17778,7 +17801,7 @@ function VC(e) {
17778
17801
  return ge.previewRules(e.target, S.rules, s, C(S)).then((e) => {
17779
17802
  t && (h(e), _(S), y(null));
17780
17803
  }, (e) => {
17781
- t && (zC(e) ? x(!0) : y(BC(e)));
17804
+ t && (WC(e) ? x(!0) : y(GC(e)));
17782
17805
  }), () => {
17783
17806
  t = !1;
17784
17807
  };
@@ -17794,7 +17817,7 @@ function VC(e) {
17794
17817
  onSuccess: () => {
17795
17818
  E(), e.onDone();
17796
17819
  },
17797
- onError: (e) => zC(e) ? x(!0) : y(BC(e))
17820
+ onError: (e) => WC(e) ? x(!0) : y(GC(e))
17798
17821
  }), O = (e, t, n) => p((r) => {
17799
17822
  let i = { ...r[e] };
17800
17823
  return n === void 0 ? delete i[t] : i[t] = n, {
@@ -17809,7 +17832,7 @@ function VC(e) {
17809
17832
  }, k = m?.added ?? [], A = m?.removed ?? [], ie = [...(m?.indexes?.added ?? []).map((e) => Jl({ index: e })), ...(m?.indexes?.removed ?? []).map((e) => Ql({ index: e }))], ae = a === null ? void 0 : e.columns[a], j = /* @__PURE__ */ (0, V.jsxs)("nav", {
17810
17833
  className: "flex flex-col gap-1",
17811
17834
  children: [i.map((t) => {
17812
- let n = e.fixed.includes(t), r = yC(f, t), i = !n && OC(f, t) !== OC(l.rules, t), s = a === t;
17835
+ let n = e.fixed.includes(t), r = wC(f, t), i = !n && NC(f, t) !== NC(l.rules, t), s = a === t;
17813
17836
  return /* @__PURE__ */ (0, V.jsxs)("button", {
17814
17837
  type: "button",
17815
17838
  disabled: n,
@@ -17835,12 +17858,12 @@ function VC(e) {
17835
17858
  }, e.name))]
17836
17859
  }), oe = a !== null && ae !== void 0 && /* @__PURE__ */ (0, V.jsx)("div", {
17837
17860
  className: "flex flex-col gap-3",
17838
- children: /* @__PURE__ */ (0, V.jsx)(LC, {
17861
+ children: /* @__PURE__ */ (0, V.jsx)(HC, {
17839
17862
  column: a,
17840
17863
  type: ae,
17841
17864
  draft: f,
17842
17865
  tables: (n?.tables ?? []).map((e) => e.name),
17843
- hints: xC(a, k, e.viewName),
17866
+ hints: EC(a, k, e.viewName),
17844
17867
  set: O,
17845
17868
  toggleRequired: ne,
17846
17869
  onBack: r ? () => o(null) : void 0
@@ -17936,7 +17959,7 @@ function VC(e) {
17936
17959
  return /* @__PURE__ */ (0, V.jsxs)("div", {
17937
17960
  className: "flex flex-col gap-4 text-[13px]",
17938
17961
  children: [
17939
- /* @__PURE__ */ (0, V.jsx)(hC, {
17962
+ /* @__PURE__ */ (0, V.jsx)(bC, {
17940
17963
  title: Ru(),
17941
17964
  heading: ce,
17942
17965
  flush: !0,
@@ -17948,7 +17971,7 @@ function VC(e) {
17948
17971
  }), M || /* @__PURE__ */ (0, V.jsx)("div", {})]
17949
17972
  })
17950
17973
  }),
17951
- e.indexes !== void 0 && /* @__PURE__ */ (0, V.jsx)(kC, {
17974
+ e.indexes !== void 0 && /* @__PURE__ */ (0, V.jsx)(PC, {
17952
17975
  indexes: u.indexes,
17953
17976
  known: e.indexes,
17954
17977
  columns: i,
@@ -17957,7 +17980,7 @@ function VC(e) {
17957
17980
  indexes: e
17958
17981
  }))
17959
17982
  }),
17960
- /* @__PURE__ */ (0, V.jsx)(RC, {
17983
+ /* @__PURE__ */ (0, V.jsx)(UC, {
17961
17984
  fields: u.views,
17962
17985
  names: Object.fromEntries(c.map((e) => [e.path.at(-1), e.name])),
17963
17986
  json: i.filter((t) => e.columns[t] === "JSON"),
@@ -17972,17 +17995,17 @@ function VC(e) {
17972
17995
  }
17973
17996
  //#endregion
17974
17997
  //#region ui/src/components/SchemaDialog.tsx
17975
- var HC = (e, t) => e !== void 0 && t !== void 0 ? `${e} – ${t}` : e === void 0 ? t === void 0 ? null : `≤ ${t}` : `≥ ${e}`, UC = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, WC = "border-b px-2 py-1.5 text-left align-top", GC = "w-full [&_tr:last-child>td]:border-b-0", KC = () => /* @__PURE__ */ (0, V.jsx)("p", {
17998
+ var qC = (e, t) => e !== void 0 && t !== void 0 ? `${e} – ${t}` : e === void 0 ? t === void 0 ? null : `≤ ${t}` : `≥ ${e}`, JC = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, YC = "border-b px-2 py-1.5 text-left align-top", XC = "w-full [&_tr:last-child>td]:border-b-0", ZC = () => /* @__PURE__ */ (0, V.jsx)("p", {
17976
17999
  className: "text-[12px] text-muted-foreground",
17977
18000
  children: Yu()
17978
- }), qC = (e) => ({
18001
+ }), QC = (e) => ({
17979
18002
  target: {
17980
18003
  table: e.table,
17981
18004
  path: e.path
17982
18005
  },
17983
18006
  viewName: e.name
17984
18007
  });
17985
- function JC({ editing: e, meta: t, schema: n, onEdit: r, onDone: i, footer: a }) {
18008
+ function $C({ editing: e, meta: t, schema: n, onEdit: r, onDone: i, footer: a }) {
17986
18009
  let o = e.viewName === void 0 ? void 0 : t.views.find((t) => t.name === e.viewName), s = t.tables.find((t) => t.name === e.target.table), c = o ?? s;
17987
18010
  if (!c || n.base === void 0) return null;
17988
18011
  let l = e.target.path.length, u = [{
@@ -17995,15 +18018,15 @@ function JC({ editing: e, meta: t, schema: n, onEdit: r, onDone: i, footer: a })
17995
18018
  let a = t.views.find((t) => t.table === e.target.table && t.path.length === i + 1 && t.path.every((t, n) => e.target.path[n] === t));
17996
18019
  return a ? [{
17997
18020
  label: n,
17998
- onOpen: () => r(qC(a))
18021
+ onOpen: () => r(QC(a))
17999
18022
  }] : [];
18000
18023
  })], d = t.views.filter((t) => t.table === e.target.table && t.path.length > l && e.target.path.every((e, n) => t.path[n] === e));
18001
- return /* @__PURE__ */ (0, V.jsx)(VC, {
18024
+ return /* @__PURE__ */ (0, V.jsx)(KC, {
18002
18025
  target: e.target,
18003
18026
  viewName: e.viewName,
18004
18027
  columns: o ? o.columns : n.columns,
18005
18028
  fixed: o ? o.identity : [n.key],
18006
- initial: gC(c),
18029
+ initial: xC(c),
18007
18030
  base: n.base,
18008
18031
  indexes: o ? void 0 : n.indexes,
18009
18032
  views: d.map((e) => ({
@@ -18014,16 +18037,16 @@ function JC({ editing: e, meta: t, schema: n, onEdit: r, onDone: i, footer: a })
18014
18037
  here: e.target.path.at(-1),
18015
18038
  onOpenView: (e) => {
18016
18039
  let n = t.views.find((t) => t.name === e);
18017
- n && r(qC(n));
18040
+ n && r(QC(n));
18018
18041
  },
18019
18042
  onDone: i,
18020
18043
  footer: a
18021
18044
  }, `${e.target.table}/${e.target.path.join(".")}`);
18022
18045
  }
18023
- function YC({ view: e, editor: t }) {
18046
+ function ew({ view: e, editor: t }) {
18024
18047
  return /* @__PURE__ */ (0, V.jsxs)("div", {
18025
18048
  className: "flex flex-col gap-4 text-[12.5px]",
18026
- children: [/* @__PURE__ */ (0, V.jsx)(hC, {
18049
+ children: [/* @__PURE__ */ (0, V.jsx)(bC, {
18027
18050
  title: od(),
18028
18051
  children: /* @__PURE__ */ (0, V.jsxs)("dl", {
18029
18052
  className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1",
@@ -18051,35 +18074,35 @@ function YC({ view: e, editor: t }) {
18051
18074
  /* @__PURE__ */ (0, V.jsx)("dd", { children: e.inDb ? cd() : Qu() })
18052
18075
  ]
18053
18076
  })
18054
- }), t ?? /* @__PURE__ */ (0, V.jsx)(hC, {
18077
+ }), t ?? /* @__PURE__ */ (0, V.jsx)(bC, {
18055
18078
  title: Ru(),
18056
18079
  children: /* @__PURE__ */ (0, V.jsx)("div", {
18057
18080
  className: "-mx-2 overflow-x-auto",
18058
18081
  children: /* @__PURE__ */ (0, V.jsx)("table", {
18059
- className: GC,
18082
+ className: XC,
18060
18083
  children: /* @__PURE__ */ (0, V.jsx)("tbody", { children: Object.entries(e.columns).map(([t, n]) => /* @__PURE__ */ (0, V.jsxs)("tr", { children: [
18061
18084
  /* @__PURE__ */ (0, V.jsx)("td", {
18062
- className: `${WC} font-mono`,
18085
+ className: `${YC} font-mono`,
18063
18086
  children: t
18064
18087
  }),
18065
18088
  /* @__PURE__ */ (0, V.jsx)("td", {
18066
- className: `${WC} font-mono text-muted-foreground`,
18089
+ className: `${YC} font-mono text-muted-foreground`,
18067
18090
  children: n
18068
18091
  }),
18069
18092
  /* @__PURE__ */ (0, V.jsx)("td", {
18070
- className: `${WC} text-muted-foreground`,
18093
+ className: `${YC} text-muted-foreground`,
18071
18094
  children: e.identity.includes(t) ? Gu() : [
18072
18095
  Object.hasOwn(e.declared, t) ? Vu() : qu(),
18073
18096
  ...e.required.includes(t) ? [q()] : [],
18074
- ...UC(e.formats, t) ? [UC(e.formats, t)] : [],
18097
+ ...JC(e.formats, t) ? [JC(e.formats, t)] : [],
18075
18098
  ...(() => {
18076
- let n = HC(UC(e.min, t), UC(e.max, t));
18099
+ let n = qC(JC(e.min, t), JC(e.max, t));
18077
18100
  return n ? [n] : [];
18078
18101
  })()
18079
18102
  ].join(" · ")
18080
18103
  }),
18081
18104
  /* @__PURE__ */ (0, V.jsx)("td", {
18082
- className: `${WC} font-mono text-muted-foreground`,
18105
+ className: `${YC} font-mono text-muted-foreground`,
18083
18106
  children: Object.hasOwn(e.values, t) ? e.values[t]?.map(String).join(", ") : ""
18084
18107
  })
18085
18108
  ] }, t)) })
@@ -18088,12 +18111,12 @@ function YC({ view: e, editor: t }) {
18088
18111
  })]
18089
18112
  });
18090
18113
  }
18091
- function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18114
+ function tw({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18092
18115
  let [a, o] = (0, B.useState)(null), [s, c] = (0, B.useState)(null), { data: l } = fe(), u = t?.table ?? e, { data: d, error: f } = j({
18093
18116
  queryKey: ["schema", u],
18094
18117
  queryFn: () => ge.schema(u),
18095
18118
  enabled: r && (!t || a !== null)
18096
- }), p = t !== void 0 && (a === null || a.viewName !== void 0), m = !me() && l !== void 0 && !l.configError && (t !== void 0 || d !== void 0), h = a && l && d ? /* @__PURE__ */ (0, V.jsx)(JC, {
18119
+ }), p = t !== void 0 && (a === null || a.viewName !== void 0), m = !me() && l !== void 0 && !l.configError && (t !== void 0 || d !== void 0), h = a && l && d ? /* @__PURE__ */ (0, V.jsx)($C, {
18097
18120
  editing: a,
18098
18121
  meta: l,
18099
18122
  schema: d,
@@ -18113,7 +18136,7 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18113
18136
  children: [
18114
18137
  /* @__PURE__ */ (0, V.jsxs)("div", {
18115
18138
  className: "flex items-center gap-2 max-sm:justify-center",
18116
- children: [/* @__PURE__ */ (0, V.jsx)(gt, { children: id({ table: e }) }), a && /* @__PURE__ */ (0, V.jsx)(mC, {
18139
+ children: [/* @__PURE__ */ (0, V.jsx)(gt, { children: id({ table: e }) }), a && /* @__PURE__ */ (0, V.jsx)(yC, {
18117
18140
  variant: "outline",
18118
18141
  className: "border-tomato text-[12px] text-tomato",
18119
18142
  children: Uu()
@@ -18129,7 +18152,7 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18129
18152
  variant: "outline",
18130
18153
  size: "sm",
18131
18154
  className: "self-start",
18132
- onClick: () => o(t ? qC(t) : { target: {
18155
+ onClick: () => o(t ? QC(t) : { target: {
18133
18156
  table: e,
18134
18157
  path: []
18135
18158
  } }),
@@ -18137,7 +18160,7 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18137
18160
  })
18138
18161
  ]
18139
18162
  }),
18140
- /* @__PURE__ */ (0, V.jsx)(ft, { children: p ? /* @__PURE__ */ (0, V.jsx)(YC, {
18163
+ /* @__PURE__ */ (0, V.jsx)(ft, { children: p ? /* @__PURE__ */ (0, V.jsx)(ew, {
18141
18164
  view: t,
18142
18165
  editor: h ?? (a && f ? /* @__PURE__ */ (0, V.jsx)("p", {
18143
18166
  className: "text-[12px] text-err",
@@ -18149,7 +18172,7 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18149
18172
  }), d && /* @__PURE__ */ (0, V.jsxs)("div", {
18150
18173
  className: "flex flex-col gap-4 text-[12.5px]",
18151
18174
  children: [
18152
- /* @__PURE__ */ (0, V.jsx)(hC, {
18175
+ /* @__PURE__ */ (0, V.jsx)(bC, {
18153
18176
  title: J(),
18154
18177
  children: /* @__PURE__ */ (0, V.jsxs)("dl", {
18155
18178
  className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1",
@@ -18178,43 +18201,43 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18178
18201
  ]
18179
18202
  })
18180
18203
  }),
18181
- h ?? /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)(hC, {
18204
+ h ?? /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)(bC, {
18182
18205
  title: Ru(),
18183
18206
  children: /* @__PURE__ */ (0, V.jsx)("div", {
18184
18207
  className: "-mx-2 overflow-x-auto",
18185
18208
  children: /* @__PURE__ */ (0, V.jsx)("table", {
18186
- className: GC,
18209
+ className: XC,
18187
18210
  children: /* @__PURE__ */ (0, V.jsx)("tbody", { children: Object.entries(d.columns).map(([e, t]) => /* @__PURE__ */ (0, V.jsxs)("tr", { children: [
18188
18211
  /* @__PURE__ */ (0, V.jsx)("td", {
18189
- className: `${WC} font-mono`,
18212
+ className: `${YC} font-mono`,
18190
18213
  children: e
18191
18214
  }),
18192
18215
  /* @__PURE__ */ (0, V.jsx)("td", {
18193
- className: `${WC} font-mono text-muted-foreground`,
18216
+ className: `${YC} font-mono text-muted-foreground`,
18194
18217
  children: t
18195
18218
  }),
18196
18219
  /* @__PURE__ */ (0, V.jsx)("td", {
18197
- className: `${WC} text-muted-foreground`,
18220
+ className: `${YC} text-muted-foreground`,
18198
18221
  children: e === d.key ? Ju() : [
18199
18222
  e in d.declared ? Vu() : qu(),
18200
18223
  ...d.required.includes(e) ? [q()] : [],
18201
- ...UC(d.formats, e) ? [UC(d.formats, e)] : [],
18224
+ ...JC(d.formats, e) ? [JC(d.formats, e)] : [],
18202
18225
  ...(() => {
18203
- let t = HC(UC(d.min, e), UC(d.max, e));
18226
+ let t = qC(JC(d.min, e), JC(d.max, e));
18204
18227
  return t ? [t] : [];
18205
18228
  })()
18206
18229
  ].join(" · ")
18207
18230
  }),
18208
18231
  /* @__PURE__ */ (0, V.jsx)("td", {
18209
- className: `${WC} font-mono text-muted-foreground`,
18232
+ className: `${YC} font-mono text-muted-foreground`,
18210
18233
  children: Object.hasOwn(d.values, e) ? d.values[e]?.map(String).join(", ") : ""
18211
18234
  })
18212
18235
  ] }, e)) })
18213
18236
  })
18214
18237
  })
18215
- }), /* @__PURE__ */ (0, V.jsx)(hC, {
18238
+ }), /* @__PURE__ */ (0, V.jsx)(bC, {
18216
18239
  title: ed(),
18217
- children: d.references.length === 0 ? /* @__PURE__ */ (0, V.jsx)(KC, {}) : d.references.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
18240
+ children: d.references.length === 0 ? /* @__PURE__ */ (0, V.jsx)(ZC, {}) : d.references.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
18218
18241
  className: "rounded-md border px-3 py-2",
18219
18242
  children: [/* @__PURE__ */ (0, V.jsxs)("div", {
18220
18243
  className: "flex items-center gap-2 font-mono",
@@ -18236,30 +18259,30 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18236
18259
  })]
18237
18260
  }, e.column))
18238
18261
  })] }),
18239
- !h && /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsxs)(hC, {
18262
+ !h && /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsxs)(bC, {
18240
18263
  title: Ku(),
18241
- children: [d.indexes.length === 0 && d.otherIndexes.length === 0 ? /* @__PURE__ */ (0, V.jsx)(KC, {}) : /* @__PURE__ */ (0, V.jsx)("div", {
18264
+ children: [d.indexes.length === 0 && d.otherIndexes.length === 0 ? /* @__PURE__ */ (0, V.jsx)(ZC, {}) : /* @__PURE__ */ (0, V.jsx)("div", {
18242
18265
  className: "-mx-2 overflow-x-auto",
18243
18266
  children: /* @__PURE__ */ (0, V.jsx)("table", {
18244
- className: GC,
18267
+ className: XC,
18245
18268
  children: /* @__PURE__ */ (0, V.jsxs)("tbody", { children: [d.indexes.map((e) => /* @__PURE__ */ (0, V.jsxs)("tr", { children: [
18246
18269
  /* @__PURE__ */ (0, V.jsx)("td", {
18247
- className: `${WC} font-mono`,
18270
+ className: `${YC} font-mono`,
18248
18271
  children: e.definition
18249
18272
  }),
18250
18273
  /* @__PURE__ */ (0, V.jsx)("td", {
18251
- className: `${WC} font-mono text-[11px] text-muted-foreground`,
18274
+ className: `${YC} font-mono text-[11px] text-muted-foreground`,
18252
18275
  children: e.name
18253
18276
  }),
18254
18277
  /* @__PURE__ */ (0, V.jsx)("td", {
18255
- className: `${WC} ${e.inDb ? "text-ok" : "text-warn"}`,
18278
+ className: `${YC} ${e.inDb ? "text-ok" : "text-warn"}`,
18256
18279
  children: e.inDb ? zu() : Xu()
18257
18280
  })
18258
18281
  ] }, e.name)), d.otherIndexes.map((e) => /* @__PURE__ */ (0, V.jsxs)("tr", { children: [/* @__PURE__ */ (0, V.jsx)("td", {
18259
- className: `${WC} font-mono`,
18282
+ className: `${YC} font-mono`,
18260
18283
  children: e
18261
18284
  }), /* @__PURE__ */ (0, V.jsx)("td", {
18262
- className: `${WC} text-[11px] text-muted-foreground`,
18285
+ className: `${YC} text-[11px] text-muted-foreground`,
18263
18286
  colSpan: 2,
18264
18287
  children: ad()
18265
18288
  })] }, e))] })
@@ -18268,9 +18291,9 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18268
18291
  className: "text-[11px] text-muted-foreground",
18269
18292
  children: Zu()
18270
18293
  })]
18271
- }), /* @__PURE__ */ (0, V.jsx)(hC, {
18294
+ }), /* @__PURE__ */ (0, V.jsx)(bC, {
18272
18295
  title: Wu(),
18273
- children: d.views.length === 0 ? /* @__PURE__ */ (0, V.jsx)(KC, {}) : d.views.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
18296
+ children: d.views.length === 0 ? /* @__PURE__ */ (0, V.jsx)(ZC, {}) : d.views.map((e) => /* @__PURE__ */ (0, V.jsxs)("div", {
18274
18297
  className: "rounded-md border px-3 py-2",
18275
18298
  style: { marginLeft: `${(e.depth - 1) * 16}px` },
18276
18299
  children: [
@@ -18309,7 +18332,7 @@ function XC({ table: e, view: t, path: n, open: r, onOpenChange: i }) {
18309
18332
  }
18310
18333
  //#endregion
18311
18334
  //#region ui/src/components/TableWarnings.tsx
18312
- function ZC({ items: e, onOpenRecord: t }) {
18335
+ function nw({ items: e, onOpenRecord: t }) {
18313
18336
  return e.length === 0 ? null : /* @__PURE__ */ (0, V.jsxs)(Ne, { children: [/* @__PURE__ */ (0, V.jsx)(Be, {
18314
18337
  asChild: !0,
18315
18338
  children: /* @__PURE__ */ (0, V.jsxs)(L, {
@@ -18353,22 +18376,22 @@ function ZC({ items: e, onOpenRecord: t }) {
18353
18376
  }
18354
18377
  //#endregion
18355
18378
  //#region ui/src/components/ViewRowDrawer.tsx
18356
- var QC = (e) => typeof e == "object" && !!e && !Array.isArray(e);
18357
- function $C(e, t) {
18379
+ var rw = (e) => typeof e == "object" && !!e && !Array.isArray(e);
18380
+ function iw(e, t) {
18358
18381
  return e.path.flatMap((n, r) => {
18359
18382
  let i = t[e.identity[r + 1]];
18360
18383
  return [n, typeof i == "number" ? i : String(i)];
18361
18384
  });
18362
18385
  }
18363
- function ew(e, t) {
18386
+ function aw(e, t) {
18364
18387
  let n = e;
18365
18388
  for (let e of t) if (Array.isArray(n) && (typeof e == "number" || /^\d+$/.test(e))) n = n[Number(e)];
18366
- else if (QC(n) && typeof e == "string" && Object.hasOwn(n, e)) n = n[e];
18389
+ else if (rw(n) && typeof e == "string" && Object.hasOwn(n, e)) n = n[e];
18367
18390
  else return;
18368
18391
  return n;
18369
18392
  }
18370
- var tw = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
18371
- function nw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18393
+ var ow = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0;
18394
+ function sw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18372
18395
  let a = He(), o = D(), { connected: s } = k(), c = ze(), l = n ? String(n[e.identity[0]]) : void 0, { data: u, error: d } = j({
18373
18396
  queryKey: [
18374
18397
  "record",
@@ -18377,13 +18400,13 @@ function nw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18377
18400
  ],
18378
18401
  queryFn: () => ge.record(e.table, l),
18379
18402
  enabled: l !== void 0
18380
- }), f = n ? $C(e, n) : [], p = u ? ew(u.row, f) : void 0, m = p !== void 0 && !QC(p), h = Object.keys(e.columns).filter((t) => !e.identity.includes(t)), g = p === void 0 ? void 0 : m ? { value: p } : Object.fromEntries(h.map((e) => [e, tw(p, e) ?? null])), [_, v] = (0, B.useState)(null), [y, b] = (0, B.useState)(null), [x, S] = (0, B.useState)(/* @__PURE__ */ new Set()), [C, w] = (0, B.useState)(0), T = _ !== null && y !== null && nn(_, y).length > 0, ee = s && !me() && p !== void 0, te = g ? JSON.stringify(g) : void 0;
18403
+ }), f = n ? iw(e, n) : [], p = u ? aw(u.row, f) : void 0, m = p !== void 0 && !rw(p), h = Object.keys(e.columns).filter((t) => !e.identity.includes(t)), g = p === void 0 ? void 0 : m ? { value: p } : Object.fromEntries(h.map((e) => [e, ow(p, e) ?? null])), [_, v] = (0, B.useState)(null), [y, b] = (0, B.useState)(null), [x, S] = (0, B.useState)(/* @__PURE__ */ new Set()), [C, w] = (0, B.useState)(0), T = _ !== null && y !== null && nn(_, y).length > 0, ee = s && !me() && p !== void 0, te = g ? JSON.stringify(g) : void 0;
18381
18404
  (0, B.useEffect)(() => {
18382
18405
  g && !T && (v(g), b(g), S(/* @__PURE__ */ new Set()), w((e) => e + 1));
18383
18406
  }, [te, T]);
18384
18407
  let E = Zt({
18385
18408
  mutationFn: ({ detail: t, values: n }) => {
18386
- let r = e.path[0], i = ew(t.row, f), a = m ? n.value : Object.fromEntries(Object.entries({
18409
+ let r = e.path[0], i = aw(t.row, f), a = m ? n.value : Object.fromEntries(Object.entries({
18387
18410
  ...i,
18388
18411
  ...n
18389
18412
  }).filter(([, e]) => e != null)), o = vt(t.row, f, a);
@@ -18487,7 +18510,7 @@ function nw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18487
18510
  disabled: !ee,
18488
18511
  className: "m-0 min-w-0 border-0 p-0",
18489
18512
  children: ne.map((t) => {
18490
- let n = e.references.find((e) => e.column === t), r = tw(e.formats, t), i = tw(e.columns, t), a = e.required.includes(t);
18513
+ let n = e.references.find((e) => e.column === t), r = ow(e.formats, t), i = ow(e.columns, t), a = e.required.includes(t);
18491
18514
  return /* @__PURE__ */ (0, V.jsx)("div", {
18492
18515
  className: "mb-3.5",
18493
18516
  children: /* @__PURE__ */ (0, V.jsx)(Ht, {
@@ -18509,9 +18532,9 @@ function nw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18509
18532
  value: y[t],
18510
18533
  type: i,
18511
18534
  format: r,
18512
- allowed: tw(e.values, t),
18513
- min: tw(e.min, t),
18514
- max: tw(e.max, t),
18535
+ allowed: ow(e.values, t),
18536
+ min: ow(e.min, t),
18537
+ max: ow(e.max, t),
18515
18538
  reference: n,
18516
18539
  onChange: (e) => b({
18517
18540
  ...y,
@@ -18564,21 +18587,21 @@ function nw({ view: e, rowKey: t, row: n, onClose: r, onOpenRecord: i }) {
18564
18587
  }
18565
18588
  //#endregion
18566
18589
  //#region ui/src/components/TableView.tsx
18567
- var rw = 100;
18568
- function iw(e) {
18590
+ var cw = 100;
18591
+ function lw(e) {
18569
18592
  try {
18570
18593
  return new Set(JSON.parse(localStorage.getItem(`yamlite-hidden:${e}`) ?? "[]"));
18571
18594
  } catch {
18572
18595
  return /* @__PURE__ */ new Set();
18573
18596
  }
18574
18597
  }
18575
- function aw(e, t) {
18598
+ function uw(e, t) {
18576
18599
  try {
18577
18600
  localStorage.setItem(`yamlite-hidden:${e}`, JSON.stringify([...t]));
18578
18601
  } catch {}
18579
18602
  }
18580
- function ow({ drawer: e, headerActions: t }) {
18581
- let { table: n } = Ev.useParams(), r = Ev.useSearch(), i = Ae({ from: Ev.fullPath }), a = Ae(), { data: o } = fe(), { warnings: s } = k(), c = o?.tables.find((e) => e.name === n), l = c ? void 0 : o?.views.find((e) => e.name === n), u = r.filter ?? [], [d, f] = (0, B.useState)(() => iw(n)), [p, m] = (0, B.useState)(!1), h = sC(n), g = Gt({
18603
+ function dw({ drawer: e, headerActions: t }) {
18604
+ let { table: n } = jv.useParams(), r = jv.useSearch(), i = Ae({ from: jv.fullPath }), a = Ae(), { data: o } = fe(), { warnings: s } = k(), c = o?.tables.find((e) => e.name === n), l = c ? void 0 : o?.views.find((e) => e.name === n), u = r.filter ?? [], [d, f] = (0, B.useState)(() => lw(n)), [p, m] = (0, B.useState)(!1), h = fC(n), g = Gt({
18582
18605
  queryKey: l ? [
18583
18606
  "rows",
18584
18607
  l.table,
@@ -18598,7 +18621,7 @@ function ow({ drawer: e, headerActions: t }) {
18598
18621
  }
18599
18622
  ],
18600
18623
  queryFn: ({ pageParam: e }) => ge.rows(n, {
18601
- limit: rw,
18624
+ limit: cw,
18602
18625
  offset: e,
18603
18626
  sort: r.sort,
18604
18627
  filters: u,
@@ -18610,7 +18633,7 @@ function ow({ drawer: e, headerActions: t }) {
18610
18633
  return n < e.total ? n : void 0;
18611
18634
  },
18612
18635
  enabled: c !== void 0 || l !== void 0
18613
- }), _ = (0, B.useMemo)(() => g.data?.pages.flatMap((e) => e.rows) ?? [], [g.data]), v = oy(), y = c?.name, b = (0, B.useMemo)(() => y ? ey(v, y) : void 0, [v, y]), x = (0, B.useMemo)(() => {
18636
+ }), _ = (0, B.useMemo)(() => g.data?.pages.flatMap((e) => e.rows) ?? [], [g.data]), v = dy(), y = c?.name, b = (0, B.useMemo)(() => y ? ay(v, y) : void 0, [v, y]), x = (0, B.useMemo)(() => {
18614
18637
  if (!b) return _;
18615
18638
  let e = [...b.values()].filter((e) => e.op === "insert" && e.after).map((e) => e.after);
18616
18639
  return e.length > 0 ? [...e, ..._] : _;
@@ -18677,7 +18700,7 @@ function ow({ drawer: e, headerActions: t }) {
18677
18700
  /* @__PURE__ */ (0, V.jsxs)("div", {
18678
18701
  className: "ml-auto flex shrink-0 items-center gap-2.5 max-md:ml-0 max-md:w-full max-md:shrink max-md:overflow-x-auto max-md:pb-0.5",
18679
18702
  children: [
18680
- /* @__PURE__ */ (0, V.jsx)(ZC, {
18703
+ /* @__PURE__ */ (0, V.jsx)(nw, {
18681
18704
  items: ce,
18682
18705
  onOpenRecord: le
18683
18706
  }),
@@ -18691,7 +18714,7 @@ function ow({ drawer: e, headerActions: t }) {
18691
18714
  np()
18692
18715
  ]
18693
18716
  }),
18694
- /* @__PURE__ */ (0, V.jsxs)(my, { children: [/* @__PURE__ */ (0, V.jsx)(hy, {
18717
+ /* @__PURE__ */ (0, V.jsxs)(yy, { children: [/* @__PURE__ */ (0, V.jsx)(by, {
18695
18718
  asChild: !0,
18696
18719
  children: /* @__PURE__ */ (0, V.jsxs)(L, {
18697
18720
  variant: "outline",
@@ -18702,11 +18725,11 @@ function ow({ drawer: e, headerActions: t }) {
18702
18725
  Vf()
18703
18726
  ]
18704
18727
  })
18705
- }), /* @__PURE__ */ (0, V.jsx)(gy, { children: Object.keys(O).filter((e) => !re.includes(e)).map((e) => /* @__PURE__ */ (0, V.jsx)(vy, {
18728
+ }), /* @__PURE__ */ (0, V.jsx)(xy, { children: Object.keys(O).filter((e) => !re.includes(e)).map((e) => /* @__PURE__ */ (0, V.jsx)(Cy, {
18706
18729
  checked: !d.has(e),
18707
18730
  onCheckedChange: (t) => {
18708
18731
  let r = new Set(d);
18709
- t ? r.delete(e) : r.add(e), f(r), aw(n, r);
18732
+ t ? r.delete(e) : r.add(e), f(r), uw(n, r);
18710
18733
  },
18711
18734
  children: e
18712
18735
  }, e)) })] }),
@@ -18715,7 +18738,7 @@ function ow({ drawer: e, headerActions: t }) {
18715
18738
  })
18716
18739
  ]
18717
18740
  }),
18718
- /* @__PURE__ */ (0, V.jsx)(fC, {
18741
+ /* @__PURE__ */ (0, V.jsx)(_C, {
18719
18742
  columns: O,
18720
18743
  filters: u,
18721
18744
  search: r.q,
@@ -18726,9 +18749,9 @@ function ow({ drawer: e, headerActions: t }) {
18726
18749
  className: "border-b px-[18px] py-2 text-err",
18727
18750
  children: g.error.message
18728
18751
  }),
18729
- (!g.isError || _.length > 0) && /* @__PURE__ */ (0, V.jsx)(PS.Provider, {
18752
+ (!g.isError || _.length > 0) && /* @__PURE__ */ (0, V.jsx)(zS.Provider, {
18730
18753
  value: r.q?.trim() ?? "",
18731
- children: /* @__PURE__ */ (0, V.jsx)(JS, {
18754
+ children: /* @__PURE__ */ (0, V.jsx)($S, {
18732
18755
  columns: A,
18733
18756
  rows: x,
18734
18757
  preview: b,
@@ -18749,14 +18772,14 @@ function ow({ drawer: e, headerActions: t }) {
18749
18772
  ]
18750
18773
  }),
18751
18774
  c && r.key !== void 0 && e?.(c, r.key),
18752
- l && r.key !== void 0 && /* @__PURE__ */ (0, V.jsx)(nw, {
18775
+ l && r.key !== void 0 && /* @__PURE__ */ (0, V.jsx)(sw, {
18753
18776
  view: l,
18754
18777
  rowKey: r.key,
18755
18778
  row: j,
18756
18779
  onClose: () => E({ key: void 0 }),
18757
18780
  onOpenRecord: () => j && le(String(j[ne]))
18758
18781
  }, r.key),
18759
- p && /* @__PURE__ */ (0, V.jsx)(XC, {
18782
+ p && /* @__PURE__ */ (0, V.jsx)(tw, {
18760
18783
  table: n,
18761
18784
  view: l,
18762
18785
  path: ue,
@@ -18768,15 +18791,15 @@ function ow({ drawer: e, headerActions: t }) {
18768
18791
  }
18769
18792
  //#endregion
18770
18793
  //#region ui/src/router.tsx
18771
- function sw() {
18794
+ function fw() {
18772
18795
  let { data: e } = fe(), t = e?.tables[0];
18773
18796
  return e ? t ? /* @__PURE__ */ (0, V.jsx)(Me, {
18774
18797
  to: "/t/$table",
18775
18798
  params: { table: t.name }
18776
18799
  }) : /* @__PURE__ */ (0, V.jsx)(sn, { title: un() }) : null;
18777
18800
  }
18778
- function cw({ table: e }) {
18779
- let [t, n] = (0, B.useState)(!1), { connected: r } = k(), i = ze(), { filter: a } = Ev.useSearch(), o = gx(e, a ?? []), s = _x(e, a ?? []);
18801
+ function pw({ table: e }) {
18802
+ let [t, n] = (0, B.useState)(!1), { connected: r } = k(), i = ze(), { filter: a } = jv.useSearch(), o = xx(e, a ?? []), s = Sx(e, a ?? []);
18780
18803
  return /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)(L, {
18781
18804
  size: i ? "lg" : "sm",
18782
18805
  disabled: !r,
@@ -18792,7 +18815,7 @@ function cw({ table: e }) {
18792
18815
  initialKey: s
18793
18816
  }, JSON.stringify([o, s]))] });
18794
18817
  }
18795
- function lw({ table: e, recordKey: t }) {
18818
+ function mw({ table: e, recordKey: t }) {
18796
18819
  let [n, r] = (0, B.useState)(!1), { connected: i } = k();
18797
18820
  return /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)("button", {
18798
18821
  type: "button",
@@ -18808,74 +18831,74 @@ function lw({ table: e, recordKey: t }) {
18808
18831
  onOpenChange: r
18809
18832
  })] });
18810
18833
  }
18811
- function uw() {
18812
- let { table: e } = Ev.useParams();
18813
- return /* @__PURE__ */ (0, V.jsx)(ow, {
18814
- headerActions: me() ? void 0 : (e) => /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)(h_, { table: e }), /* @__PURE__ */ (0, V.jsx)(cw, { table: e })] }),
18834
+ function hw() {
18835
+ let { table: e } = jv.useParams();
18836
+ return /* @__PURE__ */ (0, V.jsx)(dw, {
18837
+ headerActions: me() ? void 0 : (e) => /* @__PURE__ */ (0, V.jsxs)(V.Fragment, { children: [/* @__PURE__ */ (0, V.jsx)(h_, { table: e }), /* @__PURE__ */ (0, V.jsx)(pw, { table: e })] }),
18815
18838
  drawer: (e, t) => /* @__PURE__ */ (0, V.jsx)(Jt, {
18816
18839
  table: e,
18817
18840
  recordKey: t,
18818
- headerActions: me() ? void 0 : /* @__PURE__ */ (0, V.jsx)(lw, {
18841
+ headerActions: me() ? void 0 : /* @__PURE__ */ (0, V.jsx)(mw, {
18819
18842
  table: e,
18820
18843
  recordKey: t
18821
18844
  })
18822
18845
  }, `${e.name}:${t}`)
18823
18846
  }, e);
18824
18847
  }
18825
- var dw = hr(() => import("./PageView-BzCYlXPg.js"), "PageView");
18826
- function fw() {
18827
- let { page: e } = Av.useParams();
18828
- return /* @__PURE__ */ (0, V.jsx)(dw, { name: e }, e);
18848
+ var gw = hr(() => import("./PageView-B29tXeqW.js"), "PageView");
18849
+ function _w() {
18850
+ let { page: e } = Fv.useParams();
18851
+ return /* @__PURE__ */ (0, V.jsx)(gw, { name: e }, e);
18829
18852
  }
18830
- function pw() {
18831
- let { page: e } = jv.useParams();
18832
- return /* @__PURE__ */ (0, V.jsx)(dw, {
18853
+ function vw() {
18854
+ let { page: e } = Iv.useParams();
18855
+ return /* @__PURE__ */ (0, V.jsx)(gw, {
18833
18856
  name: e,
18834
18857
  app: !0
18835
18858
  }, e);
18836
18859
  }
18837
- Tv.update({ component: Rx }), Ev.update({ component: uw }), Dv.update({ component: XS }), Mv.update({ component: Pv }), Av.update({ component: fw }), jv.update({ component: pw }), Ov.update({ component: () => me() ? /* @__PURE__ */ (0, V.jsx)(Me, { to: "/" }) : /* @__PURE__ */ (0, V.jsx)(iC, {}) }), kv.update({ component: hr(() => import("./ErdView-Dk-iexgy.js"), "ErdView") });
18838
- var mw = dr({
18839
- getParentRoute: () => Tv,
18860
+ Av.update({ component: Ux }), jv.update({ component: hw }), Mv.update({ component: tC }), Lv.update({ component: zv }), Fv.update({ component: _w }), Iv.update({ component: vw }), Nv.update({ component: () => me() ? /* @__PURE__ */ (0, V.jsx)(Me, { to: "/" }) : /* @__PURE__ */ (0, V.jsx)(lC, {}) }), Pv.update({ component: hr(() => import("./ErdView-CgNnAf5I.js"), "ErdView") });
18861
+ var yw = dr({
18862
+ getParentRoute: () => Av,
18840
18863
  path: "/",
18841
- component: sw
18842
- }), hw = Tv.addChildren([
18843
- mw,
18844
- Ev,
18845
- Dv,
18846
- Ov,
18847
- kv,
18848
- Av,
18864
+ component: fw
18865
+ }), bw = Av.addChildren([
18866
+ yw,
18849
18867
  jv,
18850
- Mv
18868
+ Mv,
18869
+ Nv,
18870
+ Pv,
18871
+ Fv,
18872
+ Iv,
18873
+ Lv
18851
18874
  ]);
18852
- function gw(e) {
18875
+ function xw(e) {
18853
18876
  return jr({
18854
- routeTree: hw,
18877
+ routeTree: bw,
18855
18878
  history: e === void 0 ? qe() : ye({ initialEntries: [`/app/${encodeURIComponent(e)}`] }),
18856
18879
  context: { app: e }
18857
18880
  });
18858
18881
  }
18859
18882
  //#endregion
18860
18883
  //#region ui/src/app.tsx
18861
- function _w(e, t = {}) {
18862
- let n = gw(t.app);
18884
+ function Sw(e, t = {}) {
18885
+ let n = xw(t.app);
18863
18886
  document.documentElement.lang = o();
18864
18887
  let r = (0, c_.createRoot)(e);
18865
18888
  return r.render(/* @__PURE__ */ (0, V.jsx)(B.StrictMode, { children: /* @__PURE__ */ (0, V.jsx)(Ke, { children: /* @__PURE__ */ (0, V.jsx)(Pr, { router: n }) }) })), () => r.unmount();
18866
18889
  }
18867
18890
  //#endregion
18868
18891
  //#region ui/src/lib/mount.ts
18869
- function vw(e, t) {
18870
- ie(t.readOnly ?? !1), cx(t.embedded ?? !1), Ut(t.pageFrame), an(t.appLink ?? null), tn(t.appFooter), t.fit === "container" ? e.style.setProperty("--y-shell-h", "100%") : e.style.removeProperty("--y-shell-h"), document.documentElement.dataset.theme = h(x(), matchMedia("(prefers-color-scheme: dark)").matches);
18892
+ function Cw(e, t) {
18893
+ ie(t.readOnly ?? !1), px(t.embedded ?? !1), Ut(t.pageFrame), an(t.appLink ?? null), tn(t.appFooter), t.fit === "container" ? e.style.setProperty("--y-shell-h", "100%") : e.style.removeProperty("--y-shell-h"), document.documentElement.dataset.theme = h(x(), matchMedia("(prefers-color-scheme: dark)").matches);
18871
18894
  }
18872
18895
  //#endregion
18873
18896
  //#region ui/src/lib/workerTransport.ts
18874
- function yw(e) {
18897
+ function ww(e) {
18875
18898
  let t = 1, n = /* @__PURE__ */ new Map();
18876
18899
  e.onmessage = (e) => {
18877
18900
  let t = e.data, r = n.get(t.id);
18878
- r && (t.kind === "head" ? r.head?.(t) : t.kind === "chunk" ? r.chunk(t.data) : (n.delete(t.id), r.end()));
18901
+ r && (t.kind === "head" ? r.head?.(t) : t.kind === "chunk" ? r.chunk(new Uint8Array(t.data)) : (n.delete(t.id), r.end()));
18879
18902
  }, e.start?.();
18880
18903
  function r(r, i, a) {
18881
18904
  let o = t++;
@@ -18893,70 +18916,70 @@ function yw(e) {
18893
18916
  let i = ((t, i = {}) => new Promise((a, o) => {
18894
18917
  let s = i.signal, c = () => s?.reason ?? new DOMException("The operation was aborted.", "AbortError");
18895
18918
  if (s?.aborted) return o(c());
18896
- let l = new TextEncoder(), u, d = !1, f = new ReadableStream({
18897
- start: (e) => void (u = e),
18898
- cancel: () => h()
18899
- }), p = (e, t) => {
18900
- d = !0;
18919
+ let l, u = !1, d = new ReadableStream({
18920
+ start: (e) => void (l = e),
18921
+ cancel: () => m()
18922
+ }), f = (e, t) => {
18923
+ u = !0;
18901
18924
  let n = [
18902
18925
  101,
18903
18926
  204,
18904
18927
  205,
18905
18928
  304
18906
18929
  ].includes(e);
18907
- n && f.cancel(), a(new Response(n ? null : f, {
18930
+ n && d.cancel(), a(new Response(n ? null : d, {
18908
18931
  status: e,
18909
18932
  headers: t
18910
18933
  }));
18911
- }, m = () => {
18912
- h();
18934
+ }, p = () => {
18935
+ m();
18913
18936
  let e = c();
18914
- d ? u.error(e) : o(e);
18915
- }, h = () => {
18916
- s?.removeEventListener("abort", m), n.delete(g) && e.postMessage({
18917
- id: g,
18937
+ u ? l.error(e) : o(e);
18938
+ }, m = () => {
18939
+ s?.removeEventListener("abort", p), n.delete(h) && e.postMessage({
18940
+ id: h,
18918
18941
  kind: "abort"
18919
18942
  });
18920
- }, g = r(String(t), i, {
18921
- head: (e) => p(e.status, e.headers),
18922
- chunk: (e) => u.enqueue(l.encode(e)),
18943
+ }, h = r(String(t), i, {
18944
+ head: (e) => f(e.status, e.headers),
18945
+ chunk: (e) => l.enqueue(e),
18923
18946
  end: () => {
18924
- s?.removeEventListener("abort", m), d || p(500), u.close();
18947
+ s?.removeEventListener("abort", p), u || f(500), l.close();
18925
18948
  }
18926
18949
  });
18927
- s?.addEventListener("abort", m, { once: !0 });
18950
+ s?.addEventListener("abort", p, { once: !0 });
18928
18951
  }));
18929
18952
  function a(t) {
18930
- let n = new EventTarget(), i = "", a = 0, o = n;
18931
- o.readyState = 0, o.url = t, o.CONNECTING = 0, o.OPEN = 1, o.CLOSED = 2, o.onopen = o.onmessage = o.onerror = null;
18932
- let s = (e) => {
18933
- n.dispatchEvent(e), (e.type === "open" || e.type === "message" || e.type === "error") && o[`on${e.type}`]?.call(n, e);
18953
+ let n = new EventTarget(), i = "", a = new TextDecoder(), o = 0, s = n;
18954
+ s.readyState = 0, s.url = t, s.CONNECTING = 0, s.OPEN = 1, s.CLOSED = 2, s.onopen = s.onmessage = s.onerror = null;
18955
+ let c = (e) => {
18956
+ n.dispatchEvent(e), (e.type === "open" || e.type === "message" || e.type === "error") && s[`on${e.type}`]?.call(n, e);
18934
18957
  };
18935
- o.close = () => {
18936
- o.readyState !== 2 && (o.readyState = 2, e.postMessage({
18937
- id: a,
18958
+ s.close = () => {
18959
+ s.readyState !== 2 && (s.readyState = 2, e.postMessage({
18960
+ id: o,
18938
18961
  kind: "abort"
18939
18962
  }));
18940
18963
  };
18941
- let c = () => {
18964
+ let l = () => {
18942
18965
  let e;
18943
18966
  for (; (e = i.indexOf("\n\n")) >= 0;) {
18944
18967
  let t = i.slice(0, e);
18945
18968
  i = i.slice(e + 2);
18946
18969
  let n = "message", r = [];
18947
18970
  for (let e of t.split("\n")) e.startsWith(":") || (e.startsWith("event:") ? n = e.slice(6).trim() : e.startsWith("data:") && r.push(e.slice(5).replace(/^ /, "")));
18948
- r.length > 0 && s(new MessageEvent(n, { data: r.join("\n") }));
18971
+ r.length > 0 && c(new MessageEvent(n, { data: r.join("\n") }));
18949
18972
  }
18950
18973
  };
18951
- return a = r(t, {}, {
18974
+ return o = r(t, {}, {
18952
18975
  head: () => {
18953
- o.readyState !== 2 && (o.readyState = 1, s(new Event("open")));
18976
+ s.readyState !== 2 && (s.readyState = 1, c(new Event("open")));
18954
18977
  },
18955
18978
  chunk: (e) => {
18956
- o.readyState !== 2 && (i += e, c());
18979
+ s.readyState !== 2 && (i += a.decode(e, { stream: !0 }), l());
18957
18980
  },
18958
18981
  end: () => {
18959
- o.readyState !== 2 && (o.readyState = 2, s(new Event("error")));
18982
+ s.readyState !== 2 && (s.readyState = 2, c(new Event("error")));
18960
18983
  }
18961
18984
  }), n;
18962
18985
  }
@@ -18967,8 +18990,8 @@ function yw(e) {
18967
18990
  }
18968
18991
  //#endregion
18969
18992
  //#region ui/src/embed.tsx
18970
- function bw(e, t) {
18971
- return xe(t.transport), vw(e, t), _w(e, { app: t.app });
18993
+ function Tw(e, t) {
18994
+ return xe(t.transport), Cw(e, t), Sw(e, { app: t.app });
18972
18995
  }
18973
18996
  //#endregion
18974
- export { yw as createWorkerTransport, bw as mount };
18997
+ export { ww as createWorkerTransport, Tw as mount };