react-semaphor 0.0.400 → 0.0.401

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { c as L, p as Tt, u as O, a as Ke, b as Te, d as oa, e as ca, B as $, P as nt, f as da, g as ha, h as ua, i as ma, L as H, I as de, j as pa, k as fa, l as ga, m as G, n as ya, o as ba, q as xa, r as zs, s as Kt, t as Y, C as pt, v as Is, S as xe, w as ve, x as Ne, y as Ce, z as ze, A as Se, E as ie, T as va, F as qe, G as Re, H as ft, J as De, K as At, M as gt, N as Lt, O as yt, Q as we, R as Os, U as bt, V as Na, W as Me, X as Qt, Y as Ee, Z as m, _ as Ca, $ as Sa, a0 as et, a1 as ct, a2 as Ts, a3 as wa, a4 as ka, a5 as Ma, a6 as Da, a7 as za, a8 as Ia, a9 as As, aa as Oa, ab as Ta, ac as Aa, ad as La, ae as Fa, af as be, ag as Ls, ah as Fs, ai as Ea, aj as Es, ak as Vs, al as qs, am as Va, an as Oe, ao as Rs, ap as Ue, aq as dt, ar as kt, as as js, at as _s, au as Hs, av as je, aw as ne, ax as qa, ay as Ps, az as xt, aA as $s, aB as Bs, aC as Us, aD as Wt, aE as Gs, aF as Js, aG as Ks, aH as Qs, aI as Mt, aJ as Ws, aK as Ge, aL as tt, aM as fe, aN as at, aO as Zs, aP as Ys, aQ as Xs, aR as en, aS as St, aT as tn, aU as Zt, aV as an, aW as Yt, aX as sn, aY as nn, aZ as ln, a_ as rn, a$ as Ra, b0 as on, b1 as Ft, b2 as ja, b3 as cn, b4 as dn, b5 as ot, b6 as hn, b7 as un, b8 as _a, b9 as mn, ba as pn, bb as fn, bc as gn, bd as yn, be as vt, bf as Ha, bg as bn, bh as Pa, bi as $a, bj as Dt, bk as zt, bl as xn, bm as vn, bn as Nn, bo as Et, bp as Ba, bq as Vt, br as st, bs as Cn, bt as ht, bu as Ua, bv as Sn, bw as Ga, bx as wn, by as kn, bz as Mn, bA as Dn, bB as zn, bC as qt, bD as In, bE as On, bF as Tn, bG as An, bH as Xt, bI as ea, bJ as Ja, bK as Ln, bL as Fn, bM as _e, bN as ee, bO as te, bP as ae, bQ as En, bR as Vn, bS as qn, bT as Rn, bU as jn, bV as _n, bW as Hn, bX as Pn, bY as $n, bZ as wt, b_ as Ka, b$ as Bn, c0 as Un, c1 as Gn, c2 as Jn, c3 as Kn, c4 as Qn } from "./chunks/index-BQjgev3I.js";
1
+ import { c as L, p as Tt, u as I, a as Ke, b as Ae, d as oa, e as ca, B as $, P as nt, f as da, g as ha, h as ua, i as ma, L as H, I as de, j as pa, k as fa, l as ga, m as U, n as ya, o as ba, q as xa, r as zs, s as Kt, t as Z, C as pt, v as Is, S as xe, w as ve, x as Ne, y as Ce, z as Ie, A as Se, E as le, T as va, F as Re, G as je, H as ft, J as ze, K as At, M as gt, N as Lt, O as yt, Q as we, R as Os, U as bt, V as Na, W as De, X as Qt, Y as Ve, Z as m, _ as Ca, $ as Sa, a0 as et, a1 as ct, a2 as Ts, a3 as wa, a4 as ka, a5 as Ma, a6 as Da, a7 as za, a8 as Ia, a9 as As, aa as Oa, ab as Ta, ac as Aa, ad as La, ae as Fa, af as be, ag as Ls, ah as Fs, ai as Ea, aj as Es, ak as Vs, al as qs, am as Va, an as Te, ao as Rs, ap as Ue, aq as dt, ar as kt, as as js, at as _s, au as Hs, av as _e, aw as ne, ax as qa, ay as Ps, az as xt, aA as $s, aB as Bs, aC as Us, aD as Wt, aE as Gs, aF as Js, aG as Ks, aH as Qs, aI as Mt, aJ as Ws, aK as Ge, aL as tt, aM as ge, aN as at, aO as Zs, aP as Ys, aQ as Xs, aR as en, aS as St, aT as tn, aU as Zt, aV as an, aW as Yt, aX as sn, aY as nn, aZ as ln, a_ as rn, a$ as Ra, b0 as on, b1 as Ft, b2 as ja, b3 as cn, b4 as dn, b5 as ot, b6 as hn, b7 as un, b8 as _a, b9 as mn, ba as pn, bb as fn, bc as gn, bd as yn, be as vt, bf as Ha, bg as bn, bh as Pa, bi as $a, bj as Dt, bk as zt, bl as xn, bm as vn, bn as Nn, bo as Et, bp as Ba, bq as Vt, br as st, bs as Cn, bt as ht, bu as Ua, bv as Sn, bw as Ga, bx as wn, by as kn, bz as Mn, bA as Dn, bB as zn, bC as qt, bD as In, bE as On, bF as Tn, bG as An, bH as Xt, bI as ea, bJ as Ja, bK as Ln, bL as Fn, bM as He, bN as ee, bO as te, bP as ae, bQ as En, bR as Vn, bS as qn, bT as Rn, bU as jn, bV as _n, bW as Hn, bX as Pn, bY as $n, bZ as wt, b_ as Ka, b$ as Bn, c0 as Un, c1 as Gn, c2 as Jn, c3 as Kn, c4 as Qn } from "./chunks/index-BQjgev3I.js";
2
2
  import { D as vr, c9 as Nr, c7 as Cr, c7 as Sr, cc as wr, cb as kr, ca as Mr, cd as Dr, c8 as zr, c5 as Ir, c6 as Or } from "./chunks/index-BQjgev3I.js";
3
3
  import { jsxs as n, jsx as e, Fragment as se } from "react/jsx-runtime";
4
4
  import * as Be from "react";
5
- import Ie, { useState as j, useMemo as It, useEffect as oe, useRef as Je, useCallback as Qa, Suspense as Wn } from "react";
5
+ import Oe, { useState as j, useMemo as It, useEffect as oe, useRef as Je, useCallback as Qa, Suspense as Wn } from "react";
6
6
  import "react-dom";
7
7
  /**
8
8
  * @license lucide-react v0.453.0 - ISC
@@ -504,7 +504,7 @@ const wl = L("ListX", [
504
504
  * This source code is licensed under the ISC license.
505
505
  * See the LICENSE file in the root directory of this source tree.
506
506
  */
507
- const Ve = L("LoaderCircle", [
507
+ const qe = L("LoaderCircle", [
508
508
  ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
509
509
  ]);
510
510
  /**
@@ -906,20 +906,20 @@ async function Bl(t, s) {
906
906
  }) : null;
907
907
  }
908
908
  function Ul() {
909
- const [t, s] = j(""), [a, l] = j(!1), i = O((b) => b.lenses), { setLenses: o, setSelectedLensId: r } = Ke(), [d, u] = j(!1), [y, h] = j(!1), g = O((b) => b.dashboard), v = O((b) => b.filterValues), { authToken: c } = Te();
910
- async function p() {
909
+ const [t, s] = j(""), [a, l] = j(!1), i = I((f) => f.lenses), { setLenses: o, setSelectedLensId: r } = Ke(), [d, u] = j(!1), [b, h] = j(!1), y = I((f) => f.dashboard), v = I((f) => f.filterValues), { authToken: c } = Ae();
910
+ async function g() {
911
911
  u(!0);
912
- const b = cs(
913
- g
912
+ const f = cs(
913
+ y
914
914
  ), C = await $l(
915
915
  t,
916
- b,
916
+ f,
917
917
  v,
918
918
  c == null ? void 0 : c.accessToken
919
919
  );
920
920
  C && (o([...i || [], C]), r(C.id), h(!1)), u(!1);
921
921
  }
922
- return /* @__PURE__ */ n(oa, { open: y, onOpenChange: h, children: [
922
+ return /* @__PURE__ */ n(oa, { open: b, onOpenChange: h, children: [
923
923
  /* @__PURE__ */ e(ca, { asChild: !0, children: /* @__PURE__ */ n(
924
924
  $,
925
925
  {
@@ -943,8 +943,8 @@ function Ul() {
943
943
  de,
944
944
  {
945
945
  value: t,
946
- onChange: (b) => {
947
- s(b.target.value);
946
+ onChange: (f) => {
947
+ s(f.target.value);
948
948
  },
949
949
  id: "name",
950
950
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -958,7 +958,7 @@ function Ul() {
958
958
  size: "sm",
959
959
  variant: "outline",
960
960
  type: "submit",
961
- onClick: p,
961
+ onClick: g,
962
962
  disabled: d,
963
963
  children: d ? "Creating..." : "Add"
964
964
  }
@@ -967,7 +967,7 @@ function Ul() {
967
967
  ] });
968
968
  }
969
969
  function Gl() {
970
- const [t, s] = j(!1), a = O((h) => h.lenses), l = O((h) => h.selectedLensId), { setLenses: i, setSelectedLensId: o } = Ke(), { authToken: r } = Te();
970
+ const [t, s] = j(!1), a = I((h) => h.lenses), l = I((h) => h.selectedLensId), { setLenses: i, setSelectedLensId: o } = Ke(), { authToken: r } = Ae();
971
971
  async function d(h) {
972
972
  o(h);
973
973
  }
@@ -977,31 +977,31 @@ function Gl() {
977
977
  i(v || []), o("original");
978
978
  }
979
979
  }
980
- async function y(h) {
981
- const g = a == null ? void 0 : a.map((p) => p.id === h.id ? {
982
- ...p,
980
+ async function b(h) {
981
+ const y = a == null ? void 0 : a.map((g) => g.id === h.id ? {
982
+ ...g,
983
983
  isDefault: !h.isDefault
984
984
  } : {
985
- ...p,
985
+ ...g,
986
986
  isDefault: !1
987
987
  });
988
- i(g || []);
988
+ i(y || []);
989
989
  const v = {
990
990
  ...h,
991
991
  isDefault: !h.isDefault
992
992
  };
993
993
  await Ot(v, r == null ? void 0 : r.accessToken);
994
- const c = a == null ? void 0 : a.find((p) => p.isDefault);
994
+ const c = a == null ? void 0 : a.find((g) => g.isDefault);
995
995
  if (c && c.id !== h.id) {
996
- const p = {
996
+ const g = {
997
997
  ...c,
998
998
  isDefault: !1
999
999
  };
1000
- await Ot(p, r == null ? void 0 : r.accessToken);
1000
+ await Ot(g, r == null ? void 0 : r.accessToken);
1001
1001
  }
1002
1002
  }
1003
1003
  return /* @__PURE__ */ n(fa, { open: t, onOpenChange: s, children: [
1004
- /* @__PURE__ */ e(ga, { asChild: !0, children: /* @__PURE__ */ e(G, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(gl, { className: "h-4 w-4" }) }) }),
1004
+ /* @__PURE__ */ e(ga, { asChild: !0, children: /* @__PURE__ */ e(U, { tooltip: "Lenses", className: "h-7 p-2", children: /* @__PURE__ */ e(gl, { className: "h-4 w-4" }) }) }),
1005
1005
  /* @__PURE__ */ n(ya, { align: "end", className: "w-60", children: [
1006
1006
  /* @__PURE__ */ e(ba, { className: "px-3", children: "Lenses" }),
1007
1007
  /* @__PURE__ */ e(xa, {}),
@@ -1023,10 +1023,10 @@ function Gl() {
1023
1023
  /* @__PURE__ */ e(
1024
1024
  vl,
1025
1025
  {
1026
- onClick: (g) => {
1027
- g.preventDefault(), y(h);
1026
+ onClick: (y) => {
1027
+ y.preventDefault(), b(h);
1028
1028
  },
1029
- className: Y(
1029
+ className: Z(
1030
1030
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
1031
1031
  {
1032
1032
  invisible: !h.isDefault,
@@ -1039,8 +1039,8 @@ function Gl() {
1039
1039
  /* @__PURE__ */ e(
1040
1040
  pt,
1041
1041
  {
1042
- onClick: (g) => {
1043
- g.preventDefault(), u(h.id);
1042
+ onClick: (y) => {
1043
+ y.preventDefault(), u(h.id);
1044
1044
  },
1045
1045
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
1046
1046
  strokeWidth: 1.5
@@ -1059,7 +1059,7 @@ function Gl() {
1059
1059
  }
1060
1060
  function ds() {
1061
1061
  var o;
1062
- const t = O.getState().authToken, s = O.getState().theme, a = O.getState().filterValues, l = (o = O.getState().dashboard) == null ? void 0 : o.title, i = O.getState().selectedSheetId;
1062
+ const t = I.getState().authToken, s = I.getState().theme, a = I.getState().filterValues, l = (o = I.getState().dashboard) == null ? void 0 : o.title, i = I.getState().selectedSheetId;
1063
1063
  return {
1064
1064
  authToken: t,
1065
1065
  theme: s || "light",
@@ -1069,46 +1069,46 @@ function ds() {
1069
1069
  };
1070
1070
  }
1071
1071
  async function Jl() {
1072
- const t = O.getState().isDownloadingPdf, { authToken: s, theme: a, filterValues: l, dashboardTitle: i, selectedSheetId: o } = ds();
1072
+ const t = I.getState().isDownloadingPdf, { authToken: s, theme: a, filterValues: l, dashboardTitle: i, selectedSheetId: o } = ds();
1073
1073
  if (t)
1074
1074
  return;
1075
1075
  const r = new URLSearchParams();
1076
1076
  r.set("token", (s == null ? void 0 : s.accessToken) || ""), r.set("theme", a), r.set("filterValues", JSON.stringify(l)), r.set("selectedSheetId", o || "");
1077
1077
  const d = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(r.toString())}`;
1078
- O.setState({ isDownloadingPdf: !0 });
1078
+ I.setState({ isDownloadingPdf: !0 });
1079
1079
  const h = (await (await fetch(d, {
1080
1080
  method: "GET",
1081
1081
  headers: {
1082
1082
  Authorization: `Bearer ${s == null ? void 0 : s.accessToken}`
1083
1083
  }
1084
- })).json()).url, g = document.createElement("a");
1085
- g.href = h;
1084
+ })).json()).url, y = document.createElement("a");
1085
+ y.href = h;
1086
1086
  const v = `${i}-${(/* @__PURE__ */ new Date()).toISOString()}.pdf`;
1087
- g.download = v, g.click(), O.setState({ isDownloadingPdf: !1 });
1087
+ y.download = v, y.click(), I.setState({ isDownloadingPdf: !1 });
1088
1088
  }
1089
1089
  function Kl({
1090
1090
  iconClassName: t
1091
1091
  }) {
1092
- const { authToken: s } = Te();
1093
- O((i) => {
1092
+ const { authToken: s } = Ae();
1093
+ I((i) => {
1094
1094
  var o;
1095
1095
  return (o = i.dashboard) == null ? void 0 : o.title;
1096
- }), O((i) => i.theme), O((i) => i.filterValues);
1097
- const a = O((i) => i.isDownloadingPdf);
1096
+ }), I((i) => i.theme), I((i) => i.filterValues);
1097
+ const a = I((i) => i.isDownloadingPdf);
1098
1098
  async function l() {
1099
1099
  await Jl();
1100
1100
  }
1101
1101
  return /* @__PURE__ */ e(
1102
- G,
1102
+ U,
1103
1103
  {
1104
1104
  tooltip: "Download PDF",
1105
1105
  className: "h-7 p-2",
1106
1106
  onClick: l,
1107
- children: a ? /* @__PURE__ */ e(Ve, { className: Y("size-3.5 animate-spin", t) }) : /* @__PURE__ */ e(Is, { className: Y("size-4", t) })
1107
+ children: a ? /* @__PURE__ */ e(qe, { className: Z("size-3.5 animate-spin", t) }) : /* @__PURE__ */ e(Is, { className: Z("size-4", t) })
1108
1108
  }
1109
1109
  );
1110
1110
  }
1111
- function ge({
1111
+ function ye({
1112
1112
  defaultValue: t,
1113
1113
  label: s,
1114
1114
  options: a,
@@ -1126,13 +1126,13 @@ function ge({
1126
1126
  /* @__PURE__ */ e(
1127
1127
  ve,
1128
1128
  {
1129
- className: Y("w-full focus:ring-0 focus:ring-offset-0", o),
1129
+ className: Z("w-full focus:ring-0 focus:ring-offset-0", o),
1130
1130
  children: /* @__PURE__ */ e(Ne, { placeholder: s })
1131
1131
  }
1132
1132
  ),
1133
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
1133
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
1134
1134
  /* @__PURE__ */ e(Se, { children: s }),
1135
- a.map((r) => /* @__PURE__ */ e(ie, { value: r.value, children: r.label }, r.value))
1135
+ a.map((r) => /* @__PURE__ */ e(le, { value: r.value, children: r.label }, r.value))
1136
1136
  ] }) })
1137
1137
  ]
1138
1138
  }
@@ -1144,17 +1144,26 @@ const ta = [
1144
1144
  { value: "biweekly", label: "Bi-Weekly" },
1145
1145
  { value: "monthly", label: "Monthly" }
1146
1146
  ];
1147
- function Ql() {
1147
+ function Ql({
1148
+ triggerButtonClassName: t
1149
+ }) {
1148
1150
  const {
1149
- data: t,
1150
- handleScheduleSubscription: s,
1151
- handleDeleteSubscription: a,
1152
- status: l,
1153
- error: i,
1154
- isDeleting: o
1155
- } = Wl(), [r, d] = j(""), [u, y] = j(ta[0].value), [h, g] = j("00:00"), [v, c] = j("");
1156
- return /* @__PURE__ */ e(va, { delayDuration: 0, children: /* @__PURE__ */ n(qe, { children: [
1157
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ e(G, { tooltip: "Schedule Dashboard", className: "h-7 p-2", children: /* @__PURE__ */ e(cl, { className: "size-4" }) }) }),
1151
+ data: s,
1152
+ handleScheduleSubscription: a,
1153
+ handleDeleteSubscription: l,
1154
+ status: i,
1155
+ error: o,
1156
+ isDeleting: r
1157
+ } = Wl(), [d, u] = j(""), [b, h] = j(ta[0].value), [y, v] = j("06:00"), [c, g] = j("");
1158
+ return /* @__PURE__ */ e(va, { delayDuration: 0, children: /* @__PURE__ */ n(Re, { children: [
1159
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(
1160
+ U,
1161
+ {
1162
+ tooltip: "Schedule Dashboard",
1163
+ className: Z("h-7 p-2", t),
1164
+ children: /* @__PURE__ */ e(cl, { className: "size-4" })
1165
+ }
1166
+ ) }),
1158
1167
  /* @__PURE__ */ e(ft, { align: "end", className: "w-80", children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
1159
1168
  /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1160
1169
  /* @__PURE__ */ e("h4", { className: "font-medium leading-none", children: "Schedule Subscription" }),
@@ -1167,9 +1176,9 @@ function Ql() {
1167
1176
  de,
1168
1177
  {
1169
1178
  id: "email",
1170
- value: r,
1171
- onChange: (p) => d(p.target.value),
1172
- className: `col-span-2 h-8 ${De}`
1179
+ value: d,
1180
+ onChange: (f) => u(f.target.value),
1181
+ className: `col-span-2 h-8 ${ze}`
1173
1182
  }
1174
1183
  )
1175
1184
  ] }),
@@ -1180,24 +1189,24 @@ function Ql() {
1180
1189
  {
1181
1190
  id: "subject",
1182
1191
  placeholder: "Monthly Sales Report",
1183
- value: v,
1184
- onChange: (p) => {
1185
- c(p.target.value.replace(/[^a-zA-Z0-9\s-_]/g, ""));
1192
+ value: c,
1193
+ onChange: (f) => {
1194
+ g(f.target.value.replace(/[^a-zA-Z0-9\s-_]/g, ""));
1186
1195
  },
1187
- className: `col-span-2 h-8 ${De}`
1196
+ className: `col-span-2 h-8 ${ze}`
1188
1197
  }
1189
1198
  )
1190
1199
  ] }),
1191
1200
  /* @__PURE__ */ n("div", { className: "grid grid-cols-3 items-center gap-4", children: [
1192
1201
  /* @__PURE__ */ e(H, { htmlFor: "frequency", children: "Frequency" }),
1193
1202
  /* @__PURE__ */ e(
1194
- ge,
1203
+ ye,
1195
1204
  {
1196
1205
  className: "col-span-2 h-8",
1197
1206
  label: "Select Frequency",
1198
1207
  options: ta,
1199
- value: u,
1200
- onValueChange: (p) => y(p)
1208
+ value: b,
1209
+ onValueChange: (f) => h(f)
1201
1210
  }
1202
1211
  )
1203
1212
  ] }),
@@ -1208,9 +1217,9 @@ function Ql() {
1208
1217
  {
1209
1218
  id: "time",
1210
1219
  type: "time",
1211
- value: h,
1212
- onChange: (p) => g(p.target.value),
1213
- className: `col-span-2 h-8 ${De}`
1220
+ value: y,
1221
+ onChange: (f) => v(f.target.value),
1222
+ className: `col-span-2 h-8 ${ze}`
1214
1223
  }
1215
1224
  )
1216
1225
  ] }),
@@ -1218,27 +1227,27 @@ function Ql() {
1218
1227
  $,
1219
1228
  {
1220
1229
  onClick: async () => {
1221
- await s({
1222
- email: r,
1223
- frequency: u,
1224
- time: h,
1225
- subject: v
1226
- }), g("00:00"), d(""), c("");
1230
+ await a({
1231
+ email: d,
1232
+ frequency: b,
1233
+ time: y,
1234
+ subject: c
1235
+ }), v("00:00"), u(""), g("");
1227
1236
  },
1228
1237
  className: "h-8 p-2",
1229
- disabled: l === "loading" || !r,
1238
+ disabled: i === "loading" || !d,
1230
1239
  children: [
1231
- l === "loading" && /* @__PURE__ */ e(Ve, { className: "mr-2 size-4 animate-spin" }),
1232
- l === "success" && /* @__PURE__ */ e(At, { className: "mr-2 size-4" }),
1233
- l === "error" && /* @__PURE__ */ n(gt, { children: [
1240
+ i === "loading" && /* @__PURE__ */ e(qe, { className: "mr-2 size-4 animate-spin" }),
1241
+ i === "success" && /* @__PURE__ */ e(At, { className: "mr-2 size-4" }),
1242
+ i === "error" && /* @__PURE__ */ n(gt, { children: [
1234
1243
  /* @__PURE__ */ e(Lt, { children: /* @__PURE__ */ e(es, { className: "mr-2 size-4 text-destructive" }) }),
1235
- /* @__PURE__ */ e(yt, { children: /* @__PURE__ */ e("p", { children: i }) })
1244
+ /* @__PURE__ */ e(yt, { children: /* @__PURE__ */ e("p", { children: o }) })
1236
1245
  ] }),
1237
1246
  "Schedule"
1238
1247
  ]
1239
1248
  }
1240
1249
  ) }),
1241
- t && t.length > 0 && /* @__PURE__ */ n("div", { className: "space-y-4", children: [
1250
+ s && s.length > 0 && /* @__PURE__ */ n("div", { className: "space-y-4", children: [
1242
1251
  /* @__PURE__ */ e(we, { className: "my-2" }),
1243
1252
  /* @__PURE__ */ e("div", { className: "space-y-2", children: /* @__PURE__ */ n("div", { className: "flex items-start justify-between", children: [
1244
1253
  /* @__PURE__ */ n("div", { className: "space-y-2", children: [
@@ -1247,38 +1256,38 @@ function Ql() {
1247
1256
  ] }),
1248
1257
  Os
1249
1258
  ] }) }),
1250
- /* @__PURE__ */ e("div", { className: "grid gap-2", children: t == null ? void 0 : t.map((p) => /* @__PURE__ */ n(
1259
+ /* @__PURE__ */ e("div", { className: "grid gap-2", children: s == null ? void 0 : s.map((f) => /* @__PURE__ */ n(
1251
1260
  "div",
1252
1261
  {
1253
1262
  className: "group grid grid-cols-5 gap-3",
1254
1263
  children: [
1255
1264
  /* @__PURE__ */ e("div", { className: "col-span-3 text-sm", children: /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-2", children: [
1256
1265
  /* @__PURE__ */ n("div", { className: "boder-border rounded-md border bg-muted px-2 py-1", children: [
1257
- bt(p.frequency),
1266
+ bt(f.frequency),
1258
1267
  " "
1259
1268
  ] }),
1260
- /* @__PURE__ */ e(H, { children: p.time })
1269
+ /* @__PURE__ */ e(H, { children: f.time })
1261
1270
  ] }) }),
1262
1271
  /* @__PURE__ */ n("div", { className: "col-span-2 flex items-center justify-end gap-4", children: [
1263
1272
  /* @__PURE__ */ e(
1264
1273
  aa,
1265
1274
  {
1266
- tooltip: `Next Run: ${new Date(p.nextRun).toLocaleString()} ${p.timezone}`,
1275
+ tooltip: `Next Run: ${new Date(f.nextRun).toLocaleString()} ${f.timezone}`,
1267
1276
  children: /* @__PURE__ */ e(ol, { className: "size-3.5" })
1268
1277
  }
1269
1278
  ),
1270
- /* @__PURE__ */ e(aa, { tooltip: `${p.endUserEmail}`, children: /* @__PURE__ */ e(Ml, { className: "size-3.5" }) }),
1271
- o === p.id ? /* @__PURE__ */ e(Ve, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ e(
1279
+ /* @__PURE__ */ e(aa, { tooltip: `${f.endUserEmail}`, children: /* @__PURE__ */ e(Ml, { className: "size-3.5" }) }),
1280
+ r === f.id ? /* @__PURE__ */ e(qe, { className: "size-3.5 animate-spin" }) : /* @__PURE__ */ e(
1272
1281
  _l,
1273
1282
  {
1274
- onClick: () => a(p.id),
1283
+ onClick: () => l(f.id),
1275
1284
  className: "size-3.5 cursor-pointer"
1276
1285
  }
1277
1286
  )
1278
1287
  ] })
1279
1288
  ]
1280
1289
  },
1281
- p.id
1290
+ f.id
1282
1291
  )) })
1283
1292
  ] })
1284
1293
  ] })
@@ -1293,28 +1302,28 @@ const aa = ({
1293
1302
  /* @__PURE__ */ e(yt, { children: s })
1294
1303
  ] }) });
1295
1304
  function Wl() {
1296
- const [t, s] = j("idle"), [a, l] = j(""), [i, o] = j(null), r = O((N) => N.authToken), d = O((N) => N.dashboard.id), u = O((N) => N.dashboard.title), { endUserId: y } = Na((r == null ? void 0 : r.accessToken) || ""), h = "https://semaphor.cloud/api/v1/subscriptions/get", g = {
1305
+ const [t, s] = j("idle"), [a, l] = j(""), [i, o] = j(null), r = I((N) => N.authToken), d = I((N) => N.dashboard.id), u = I((N) => N.dashboard.title), { endUserId: b } = Na((r == null ? void 0 : r.accessToken) || ""), h = "https://semaphor.cloud/api/v1/subscriptions/get", y = {
1297
1306
  dashboardId: d,
1298
- endUserId: y
1299
- }, { data: v, isLoading: c, isError: p, isFetching: b, refetch: C } = Me({
1300
- queryKey: ["subscriptions", d, y],
1301
- queryFn: () => Ee(h, (r == null ? void 0 : r.accessToken) || "", g),
1302
- enabled: !!(r != null && r.accessToken) && !!d && !!y
1307
+ endUserId: b
1308
+ }, { data: v, isLoading: c, isError: g, isFetching: f, refetch: C } = De({
1309
+ queryKey: ["subscriptions", d, b],
1310
+ queryFn: () => Ve(h, (r == null ? void 0 : r.accessToken) || "", y),
1311
+ enabled: !!(r != null && r.accessToken) && !!d && !!b
1303
1312
  });
1304
1313
  async function x({
1305
1314
  email: N,
1306
- subject: I,
1315
+ subject: O,
1307
1316
  frequency: z,
1308
1317
  time: q
1309
1318
  }) {
1310
- const { authToken: P, ..._ } = ds(), U = Intl.DateTimeFormat().resolvedOptions().timeZone, f = {
1319
+ const { authToken: P, ..._ } = ds(), Q = Intl.DateTimeFormat().resolvedOptions().timeZone, p = {
1311
1320
  email: N,
1312
1321
  frequency: z,
1313
1322
  time: q,
1314
- timezone: U,
1315
- endUserId: y,
1323
+ timezone: Q,
1324
+ endUserId: b,
1316
1325
  endUserEmail: N,
1317
- subject: I || u || "Scheduled Dashboard",
1326
+ subject: O || u || "Scheduled Dashboard",
1318
1327
  dashboardId: d,
1319
1328
  dashboardParams: _
1320
1329
  };
@@ -1325,7 +1334,7 @@ function Wl() {
1325
1334
  T,
1326
1335
  (P == null ? void 0 : P.accessToken) || "",
1327
1336
  {
1328
- ...f
1337
+ ...p
1329
1338
  }
1330
1339
  );
1331
1340
  s("success"), l(""), C(), setTimeout(() => {
@@ -1336,10 +1345,10 @@ function Wl() {
1336
1345
  }
1337
1346
  }
1338
1347
  async function D(N) {
1339
- const I = "https://semaphor.cloud/api/v1/subscriptions/delete";
1348
+ const O = "https://semaphor.cloud/api/v1/subscriptions/delete";
1340
1349
  o(N);
1341
1350
  try {
1342
- await Qt(I, (r == null ? void 0 : r.accessToken) || "", { id: N }), C(), setTimeout(() => {
1351
+ await Qt(O, (r == null ? void 0 : r.accessToken) || "", { id: N }), C(), setTimeout(() => {
1343
1352
  o(null);
1344
1353
  }, 2e3);
1345
1354
  } catch (z) {
@@ -1349,8 +1358,8 @@ function Wl() {
1349
1358
  return {
1350
1359
  data: v,
1351
1360
  isLoading: c,
1352
- isFetching: b,
1353
- isError: p,
1361
+ isFetching: f,
1362
+ isError: g,
1354
1363
  isDeleting: i,
1355
1364
  refetch: C,
1356
1365
  handleScheduleSubscription: x,
@@ -1360,28 +1369,28 @@ function Wl() {
1360
1369
  };
1361
1370
  }
1362
1371
  function Zl() {
1363
- const { authToken: t } = Te();
1364
- O((f) => f.theme);
1365
- const s = O((f) => f.lenses), a = O((f) => f.selectedLensId), l = s == null ? void 0 : s.find((f) => f.id === a), i = O((f) => f.dashboard);
1366
- O((f) => f.selectedSheetId);
1367
- const o = O(
1368
- (f) => f.isDashboardEditing
1372
+ const { authToken: t } = Ae();
1373
+ I((p) => p.theme);
1374
+ const s = I((p) => p.lenses), a = I((p) => p.selectedLensId), l = s == null ? void 0 : s.find((p) => p.id === a), i = I((p) => p.dashboard);
1375
+ I((p) => p.selectedSheetId);
1376
+ const o = I(
1377
+ (p) => p.isDashboardEditing
1369
1378
  ), r = m(
1370
- (f) => f.selectedConnectionId
1371
- ), [d, u] = j(!1), y = O((f) => f.filterValues), h = O((f) => f.isVisualEditing), g = O((f) => f.showFilters);
1372
- O(
1373
- (f) => f.showDashboardJSON
1379
+ (p) => p.selectedConnectionId
1380
+ ), [d, u] = j(!1), b = I((p) => p.filterValues), h = I((p) => p.isVisualEditing), y = I((p) => p.showFilters);
1381
+ I(
1382
+ (p) => p.showDashboardJSON
1374
1383
  );
1375
- const v = O((f) => f.onSaveFunction), c = O(
1376
- (f) => f.actions.setShowFilters
1377
- ), { addFrame: p, setSelectedFrameId: b } = O(
1378
- (f) => f.actions
1379
- ), { getSelectedSheet: C, setIsDashboardEditing: x, setShowDashboardJSON: D } = O((f) => f.actions), N = C(), { tenantId: I, endUserId: z } = It(
1384
+ const v = I((p) => p.onSaveFunction), c = I(
1385
+ (p) => p.actions.setShowFilters
1386
+ ), { addFrame: g, setSelectedFrameId: f } = I(
1387
+ (p) => p.actions
1388
+ ), { getSelectedSheet: C, setIsDashboardEditing: x, setShowDashboardJSON: D } = I((p) => p.actions), N = C(), { tenantId: O, endUserId: z } = It(
1380
1389
  () => Na(t == null ? void 0 : t.accessToken),
1381
1390
  [t == null ? void 0 : t.accessToken]
1382
- ), q = It(() => I || z, [I, z]), P = () => {
1391
+ ), q = It(() => O || z, [O, z]), P = () => {
1383
1392
  if (!o || !N) return;
1384
- const f = {
1393
+ const p = {
1385
1394
  connectionId: r,
1386
1395
  id: et(),
1387
1396
  title: "Title",
@@ -1399,23 +1408,23 @@ function Zl() {
1399
1408
  data: []
1400
1409
  }, T = {
1401
1410
  id: et(),
1402
- cards: [f],
1403
- activeCardId: f.id
1411
+ cards: [p],
1412
+ activeCardId: p.id
1404
1413
  };
1405
- p(N.id, T), b(T.id);
1414
+ g(N.id, T), f(T.id);
1406
1415
  }, _ = () => {
1407
1416
  x(!0);
1408
1417
  };
1409
- async function U() {
1418
+ async function Q() {
1410
1419
  if (u(!0), !a || !l) return;
1411
- const f = cs(
1420
+ const p = cs(
1412
1421
  i
1413
- ), T = JSON.stringify(f), B = {
1422
+ ), T = JSON.stringify(p), B = {
1414
1423
  ...l,
1415
1424
  template: T,
1416
- filterValues: y
1425
+ filterValues: b
1417
1426
  };
1418
- await Ot(B, t == null ? void 0 : t.accessToken), ct.success("Lens saved"), v == null || v(f), u(!1);
1427
+ await Ot(B, t == null ? void 0 : t.accessToken), ct.success("Lens saved"), v == null || v(p), u(!1);
1419
1428
  }
1420
1429
  return h ? null : /* @__PURE__ */ n(
1421
1430
  "div",
@@ -1455,7 +1464,7 @@ function Zl() {
1455
1464
  }
1456
1465
  ),
1457
1466
  o && !h && /* @__PURE__ */ e(
1458
- G,
1467
+ U,
1459
1468
  {
1460
1469
  className: "h-7 p-2",
1461
1470
  onClick: () => {
@@ -1470,12 +1479,12 @@ function Zl() {
1470
1479
  className: "h-7 p-2",
1471
1480
  variant: "ghost",
1472
1481
  disabled: d,
1473
- onClick: U,
1482
+ onClick: Q,
1474
1483
  size: "sm",
1475
1484
  children: /* @__PURE__ */ e(Fl, { className: "h-4 w-4" })
1476
1485
  }
1477
1486
  ),
1478
- !g && !h && o && /* @__PURE__ */ e(
1487
+ !y && !h && o && /* @__PURE__ */ e(
1479
1488
  $,
1480
1489
  {
1481
1490
  className: "h-7 p-2",
@@ -1503,31 +1512,31 @@ function Yl({
1503
1512
  className: d,
1504
1513
  showNone: u = !1
1505
1514
  }) {
1506
- const y = Be.useRef(null), [h, g] = Be.useState(!1), [v, c] = Be.useState("100%"), p = u ? [...s || [], { id: "none", name: "None" }] : s;
1515
+ const b = Be.useRef(null), [h, y] = Be.useState(!1), [v, c] = Be.useState("100%"), g = u ? [...s || [], { id: "none", name: "None" }] : s;
1507
1516
  Be.useLayoutEffect(() => {
1508
- y.current && c(y.current.offsetWidth);
1517
+ b.current && c(b.current.offsetWidth);
1509
1518
  }, []);
1510
- function b() {
1519
+ function f() {
1511
1520
  var x;
1512
1521
  return i ? "Loading..." : o ? "Error" : a ? (x = s == null ? void 0 : s.find((D) => D.id === a)) == null ? void 0 : x.name : `Select ${t}`;
1513
1522
  }
1514
1523
  function C(x, D) {
1515
- l(D), g(!1);
1524
+ l(D), y(!1);
1516
1525
  }
1517
- return /* @__PURE__ */ n(qe, { open: h, onOpenChange: g, children: [
1518
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ n(
1526
+ return /* @__PURE__ */ n(Re, { open: h, onOpenChange: y, children: [
1527
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n(
1519
1528
  $,
1520
1529
  {
1521
- ref: y,
1530
+ ref: b,
1522
1531
  variant: "outline",
1523
1532
  role: "combobox",
1524
1533
  "aria-expanded": h,
1525
- className: Y(
1534
+ className: Z(
1526
1535
  "flex h-9 w-full max-w-[226px] justify-between",
1527
1536
  d
1528
1537
  ),
1529
1538
  children: [
1530
- /* @__PURE__ */ e("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: b() }),
1539
+ /* @__PURE__ */ e("span", { className: "overflow-hidden text-ellipsis whitespace-nowrap", children: f() }),
1531
1540
  /* @__PURE__ */ e(Ts, { className: "size-4 opacity-50" })
1532
1541
  ]
1533
1542
  }
@@ -1540,10 +1549,10 @@ function Yl({
1540
1549
  children: /* @__PURE__ */ n(wa, { children: [
1541
1550
  /* @__PURE__ */ n("div", { className: "flex h-9 items-center justify-between border-b pr-1", children: [
1542
1551
  /* @__PURE__ */ e(ka, { className: "h-9", placeholder: "Search..." }),
1543
- /* @__PURE__ */ e(G, { className: "h-7", onClick: r, children: /* @__PURE__ */ e(
1552
+ /* @__PURE__ */ e(U, { className: "h-7", onClick: r, children: /* @__PURE__ */ e(
1544
1553
  ls,
1545
1554
  {
1546
- className: Y(
1555
+ className: Z(
1547
1556
  "size-3.5 opacity-50",
1548
1557
  i && "animate-spin"
1549
1558
  )
@@ -1556,7 +1565,7 @@ function Yl({
1556
1565
  t == null ? void 0 : t.toLowerCase(),
1557
1566
  " found."
1558
1567
  ] }),
1559
- /* @__PURE__ */ e(za, { children: p == null ? void 0 : p.map((x) => /* @__PURE__ */ e(
1568
+ /* @__PURE__ */ e(za, { children: g == null ? void 0 : g.map((x) => /* @__PURE__ */ e(
1560
1569
  Ia,
1561
1570
  {
1562
1571
  className: "overflow-x-auto",
@@ -1566,7 +1575,7 @@ function Yl({
1566
1575
  /* @__PURE__ */ e(
1567
1576
  At,
1568
1577
  {
1569
- className: Y(
1578
+ className: Z(
1570
1579
  "size-4",
1571
1580
  a === x.id ? "opacity-100" : "opacity-0"
1572
1581
  )
@@ -1593,13 +1602,13 @@ function Ye({
1593
1602
  connectionTooltip: r,
1594
1603
  onChange: d,
1595
1604
  showNone: u = !1,
1596
- className: y,
1605
+ className: b,
1597
1606
  showIcon: h = !0,
1598
- disabled: g = !1,
1607
+ disabled: y = !1,
1599
1608
  type: v = "combobox"
1600
1609
  }) {
1601
1610
  const c = l ? "Loading..." : i ? "Error" : a;
1602
- function p() {
1611
+ function g() {
1603
1612
  if (t === "Connection")
1604
1613
  return /* @__PURE__ */ e(Tl, { className: "size-4 rotate-90" });
1605
1614
  if (t === "Database")
@@ -1611,14 +1620,14 @@ function Ye({
1611
1620
  if (t === "Model")
1612
1621
  return /* @__PURE__ */ e(ll, { className: "size-4" });
1613
1622
  }
1614
- function b() {
1615
- return /* @__PURE__ */ n(xe, { disabled: g, value: c, onValueChange: d, children: [
1623
+ function f() {
1624
+ return /* @__PURE__ */ n(xe, { disabled: y, value: c, onValueChange: d, children: [
1616
1625
  /* @__PURE__ */ e(
1617
1626
  ve,
1618
1627
  {
1619
- className: Y(
1628
+ className: Z(
1620
1629
  "h-9 w-full border-muted focus:ring-1 focus:ring-offset-0",
1621
- y
1630
+ b
1622
1631
  ),
1623
1632
  children: /* @__PURE__ */ e(
1624
1633
  Ne,
@@ -1628,13 +1637,13 @@ function Ye({
1628
1637
  )
1629
1638
  }
1630
1639
  ),
1631
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
1640
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
1632
1641
  l ? /* @__PURE__ */ e(Se, { children: "Loading..." }) : /* @__PURE__ */ n(Se, { className: "flex items-center justify-between gap-2", children: [
1633
1642
  t,
1634
1643
  /* @__PURE__ */ e(
1635
1644
  ls,
1636
1645
  {
1637
- className: Y(
1646
+ className: Z(
1638
1647
  "mr-1 size-3 cursor-pointer text-muted-foreground hover:text-foreground",
1639
1648
  l && "animate-spin"
1640
1649
  ),
@@ -1643,10 +1652,10 @@ function Ye({
1643
1652
  )
1644
1653
  ] }),
1645
1654
  /* @__PURE__ */ n(se, { children: [
1646
- u && /* @__PURE__ */ e(ie, { value: "none", children: "None" }, "none"),
1647
- s && s.map((x, D) => /* @__PURE__ */ e(ie, { value: x.id, children: x.name }, D))
1655
+ u && /* @__PURE__ */ e(le, { value: "none", children: "None" }, "none"),
1656
+ s && s.map((x, D) => /* @__PURE__ */ e(le, { value: x.id, children: x.name }, D))
1648
1657
  ] }),
1649
- (l || i) && /* @__PURE__ */ e(ie, { value: c, children: c })
1658
+ (l || i) && /* @__PURE__ */ e(le, { value: c, children: c })
1650
1659
  ] }) })
1651
1660
  ] });
1652
1661
  }
@@ -1668,24 +1677,24 @@ function Ye({
1668
1677
  }
1669
1678
  return /* @__PURE__ */ e(As, { delayDuration: 0, children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
1670
1679
  h && /* @__PURE__ */ e("div", { className: "shrink-0", children: r ? /* @__PURE__ */ n(gt, { children: [
1671
- /* @__PURE__ */ e(Lt, { children: p() }),
1680
+ /* @__PURE__ */ e(Lt, { children: g() }),
1672
1681
  /* @__PURE__ */ e(yt, { className: "text-xs", align: "start", children: r })
1673
- ] }) : p() }),
1674
- v === "select" ? b() : C()
1682
+ ] }) : g() }),
1683
+ v === "select" ? f() : C()
1675
1684
  ] }) });
1676
1685
  }
1677
1686
  function Xl({ column: t }) {
1678
- const [s, a] = j(!1), l = m((p) => p.selectedTableName), i = m(
1679
- (p) => p.selectedSchemaName
1687
+ const [s, a] = j(!1), l = m((g) => g.selectedTableName), i = m(
1688
+ (g) => g.selectedSchemaName
1680
1689
  ), o = m(
1681
- (p) => p.selectedDatamodelId
1682
- ), r = m((p) => p.sqlGen), { modelItems: d, connectionType: u } = He(), y = m((p) => p.actions.setSqlGen), h = m((p) => p.actions.setCardSql), g = m((p) => p.actions.setRunSql);
1683
- function v(p, b) {
1690
+ (g) => g.selectedDatamodelId
1691
+ ), r = m((g) => g.sqlGen), { modelItems: d, connectionType: u } = Pe(), b = m((g) => g.actions.setSqlGen), h = m((g) => g.actions.setCardSql), y = m((g) => g.actions.setRunSql);
1692
+ function v(g, f) {
1684
1693
  var N;
1685
- const C = La(p, r, b), x = (N = d == null ? void 0 : d.find(
1686
- (I) => I.id === o
1694
+ const C = La(g, r, f), x = (N = d == null ? void 0 : d.find(
1695
+ (O) => O.id === o
1687
1696
  )) == null ? void 0 : N.name;
1688
- y(C);
1697
+ b(C);
1689
1698
  const D = Fa(
1690
1699
  C,
1691
1700
  be(i || ""),
@@ -1693,7 +1702,7 @@ function Xl({ column: t }) {
1693
1702
  x,
1694
1703
  u
1695
1704
  );
1696
- D && (h(D), g(!0)), a(!1);
1705
+ D && (h(D), y(!0)), a(!1);
1697
1706
  }
1698
1707
  function c() {
1699
1708
  return /* @__PURE__ */ n("ul", { className: "text-xs", children: [
@@ -1763,48 +1772,48 @@ function ei({
1763
1772
  columns: a,
1764
1773
  status: l
1765
1774
  }) {
1766
- const i = m((f) => f.sqlGen), o = m(
1767
- (f) => f.selectedConnectionId
1775
+ const i = m((p) => p.sqlGen), o = m(
1776
+ (p) => p.selectedConnectionId
1768
1777
  ), r = m(
1769
- (f) => f.selectedDatabaseName
1778
+ (p) => p.selectedDatabaseName
1770
1779
  ), d = m(
1771
- (f) => f.selectedSchemaName
1772
- ), u = m((f) => f.selectedTableName), y = m(
1773
- (f) => f.selectedDatamodelId
1774
- ), h = O(
1775
- (f) => f.dashboard.aiScopeTables
1776
- ), { addToAIScope: g, removeFromAIScope: v } = Ke(), { setAIScopeTables: c } = O((f) => f.actions), p = m((f) => f.actions.setRunSql), b = m((f) => f.actions.setSqlGen), C = m(
1777
- (f) => f.actions.setIsShowingVisual
1778
- ), x = m((f) => f.actions.setCardSql), { connectionType: D, modelItems: N, selectedDatamodelName: I } = He();
1779
- function z(f) {
1780
- var J;
1781
- const T = La(f, i);
1782
- b(T);
1783
- const B = (J = N == null ? void 0 : N.find(
1784
- (W) => W.id === y
1785
- )) == null ? void 0 : J.name, V = Fa(
1780
+ (p) => p.selectedSchemaName
1781
+ ), u = m((p) => p.selectedTableName), b = m(
1782
+ (p) => p.selectedDatamodelId
1783
+ ), h = I(
1784
+ (p) => p.dashboard.aiScopeTables
1785
+ ), { addToAIScope: y, removeFromAIScope: v } = Ke(), { setAIScopeTables: c } = I((p) => p.actions), g = m((p) => p.actions.setRunSql), f = m((p) => p.actions.setSqlGen), C = m(
1786
+ (p) => p.actions.setIsShowingVisual
1787
+ ), x = m((p) => p.actions.setCardSql), { connectionType: D, modelItems: N, selectedDatamodelName: O } = Pe();
1788
+ function z(p) {
1789
+ var G;
1790
+ const T = La(p, i);
1791
+ f(T);
1792
+ const B = (G = N == null ? void 0 : N.find(
1793
+ (W) => W.id === b
1794
+ )) == null ? void 0 : G.name, V = Fa(
1786
1795
  T,
1787
1796
  be(t),
1788
1797
  be(s),
1789
1798
  B,
1790
1799
  D
1791
1800
  );
1792
- V && (x(V), p(!0));
1801
+ V && (x(V), g(!0));
1793
1802
  }
1794
1803
  function q() {
1795
1804
  return (h == null ? void 0 : h.find(
1796
- (f) => f.connectionId === o && (f.tableName === u || f.datamodelName === I)
1805
+ (p) => p.connectionId === o && (p.tableName === u || p.datamodelName === O)
1797
1806
  )) !== void 0;
1798
1807
  }
1799
- function P(f) {
1800
- f === !0 && (u || I) && o ? (g({
1808
+ function P(p) {
1809
+ p === !0 && (u || O) && o ? (y({
1801
1810
  connectionId: o,
1802
1811
  connectionType: D === "S3" || D === "API" ? "DuckDb" : D,
1803
1812
  databaseName: r || "",
1804
1813
  schemaName: d || "",
1805
1814
  tableName: u || "",
1806
- datamodelName: dt(I),
1807
- datamodelId: y || ""
1815
+ datamodelName: dt(O),
1816
+ datamodelId: b || ""
1808
1817
  }), ct.success("Added to Assistant Scope", {
1809
1818
  position: "top-right",
1810
1819
  duration: 2500,
@@ -1813,8 +1822,8 @@ function ei({
1813
1822
  connectionId: o || "",
1814
1823
  connectionType: D || "",
1815
1824
  tableName: u || "",
1816
- datamodelName: dt(I),
1817
- datamodelId: y || "",
1825
+ datamodelName: dt(O),
1826
+ datamodelId: b || "",
1818
1827
  databaseName: r || "",
1819
1828
  schemaName: d || ""
1820
1829
  }), ct("Removed from Assistant Scope", {
@@ -1824,24 +1833,24 @@ function ei({
1824
1833
  }));
1825
1834
  }
1826
1835
  function _() {
1827
- const f = kt({
1836
+ const p = kt({
1828
1837
  schemaName: t,
1829
1838
  tableName: s,
1830
- modelName: I,
1839
+ modelName: O,
1831
1840
  connectionType: D
1832
1841
  });
1833
1842
  C(!1);
1834
- const T = D === "MSSQL" ? `SELECT top 10 * FROM ${f}` : `SELECT * FROM ${f} LIMIT 10`;
1835
- x(T), p(!0);
1843
+ const T = D === "MSSQL" ? `SELECT top 10 * FROM ${p}` : `SELECT * FROM ${p} LIMIT 10`;
1844
+ x(T), g(!0);
1836
1845
  }
1837
- function U() {
1838
- const f = kt({
1846
+ function Q() {
1847
+ const p = kt({
1839
1848
  schemaName: t,
1840
1849
  tableName: s,
1841
- modelName: I,
1850
+ modelName: O,
1842
1851
  connectionType: D
1843
1852
  });
1844
- x(`SELECT COUNT(*) as count FROM ${f}`), p(!0);
1853
+ x(`SELECT COUNT(*) as count FROM ${p}`), g(!0);
1845
1854
  }
1846
1855
  return /* @__PURE__ */ n("div", { className: "flex grow flex-col space-y-4 px-4", children: [
1847
1856
  /* @__PURE__ */ n("div", { className: "mx-2 flex items-center justify-center gap-2", children: [
@@ -1852,14 +1861,14 @@ function ei({
1852
1861
  pressed: q(),
1853
1862
  onPressedChange: P,
1854
1863
  variant: "outline",
1855
- className: Y("h-9 px-2", {
1864
+ className: Z("h-9 px-2", {
1856
1865
  // 'outline outline-1 outline-green-400': isInAIScopeTable(),
1857
1866
  }),
1858
1867
  children: [
1859
1868
  /* @__PURE__ */ e(
1860
1869
  nt,
1861
1870
  {
1862
- className: Y("mr-1 size-4", {
1871
+ className: Z("mr-1 size-4", {
1863
1872
  "text-green-400": q(),
1864
1873
  "text-muted-foreground": !q()
1865
1874
  })
@@ -1878,7 +1887,7 @@ function ei({
1878
1887
  variant: "secondary",
1879
1888
  className: "flex",
1880
1889
  children: [
1881
- l !== "Success" ? /* @__PURE__ */ e(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e(kl, { className: "mr-2 size-4" }),
1890
+ l !== "Success" ? /* @__PURE__ */ e(qe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e(kl, { className: "mr-2 size-4" }),
1882
1891
  "Top 10"
1883
1892
  ]
1884
1893
  }
@@ -1887,48 +1896,48 @@ function ei({
1887
1896
  $,
1888
1897
  {
1889
1898
  disabled: l !== "Success",
1890
- onClick: U,
1899
+ onClick: Q,
1891
1900
  size: "sm",
1892
1901
  variant: "secondary",
1893
1902
  className: "w-full",
1894
1903
  children: [
1895
- l !== "Success" ? /* @__PURE__ */ e(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e(Vl, { className: "mr-2 size-4" }),
1904
+ l !== "Success" ? /* @__PURE__ */ e(qe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e(Vl, { className: "mr-2 size-4" }),
1896
1905
  "Count"
1897
1906
  ]
1898
1907
  }
1899
1908
  )
1900
1909
  ] }),
1901
1910
  /* @__PURE__ */ n(
1902
- Oe,
1911
+ Te,
1903
1912
  {
1904
1913
  className: "flex-1 basis-0 border-b border-t border-muted py-3",
1905
1914
  children: [
1906
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-1", children: a == null ? void 0 : a.map((f) => /* @__PURE__ */ n(
1915
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-1", children: a == null ? void 0 : a.map((p) => /* @__PURE__ */ n(
1907
1916
  "div",
1908
1917
  {
1909
- onClick: () => z(f),
1910
- className: Y(
1918
+ onClick: () => z(p),
1919
+ className: Z(
1911
1920
  "group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-1 text-sm transition-colors hover:bg-muted/50",
1912
1921
  {
1913
- "border border-dashed border-muted-foreground bg-muted": Rs(f, i)
1922
+ "border border-dashed border-muted-foreground bg-muted": Rs(p, i)
1914
1923
  }
1915
1924
  ),
1916
1925
  children: [
1917
1926
  /* @__PURE__ */ n("div", { className: "flex items-center space-x-2", children: [
1918
- /* @__PURE__ */ e(hs, { column: f }),
1919
- /* @__PURE__ */ e("span", { children: f.column_name })
1927
+ /* @__PURE__ */ e(hs, { column: p }),
1928
+ /* @__PURE__ */ e("span", { children: p.column_name })
1920
1929
  ] }),
1921
1930
  /* @__PURE__ */ e(
1922
1931
  "div",
1923
1932
  {
1924
1933
  onClick: (T) => T.stopPropagation(),
1925
1934
  className: "flex items-center justify-end",
1926
- children: Ea(f.data_type) && /* @__PURE__ */ e(Xl, { column: f })
1935
+ children: Ea(p.data_type) && /* @__PURE__ */ e(Xl, { column: p })
1927
1936
  }
1928
1937
  )
1929
1938
  ]
1930
1939
  },
1931
- f.column_name
1940
+ p.column_name
1932
1941
  )) }),
1933
1942
  /* @__PURE__ */ e(Ue, { orientation: "vertical" }),
1934
1943
  /* @__PURE__ */ e(Ue, { orientation: "horizontal" })
@@ -1937,10 +1946,10 @@ function ei({
1937
1946
  )
1938
1947
  ] });
1939
1948
  }
1940
- function He(t, s) {
1949
+ function Pe(t, s) {
1941
1950
  var Pt, $t, Bt, Ut, Gt, Jt;
1942
1951
  let a = It(() => [], []);
1943
- const l = Te().authToken || t, i = m(
1952
+ const l = Ae().authToken || t, i = m(
1944
1953
  (k) => k.selectedConnectionId
1945
1954
  ), o = m(
1946
1955
  (k) => k.selectedDatamodelId
@@ -1948,21 +1957,21 @@ function He(t, s) {
1948
1957
  (k) => k.selectedDatabaseName
1949
1958
  ), d = m(
1950
1959
  (k) => k.selectedSchemaName
1951
- ), u = m((k) => k.selectedTableName), y = m(
1960
+ ), u = m((k) => k.selectedTableName), b = m(
1952
1961
  (k) => k.actions.setCurrentColumns
1953
1962
  ), h = m(
1954
1963
  (k) => k.actions.setSelectedConnectionId
1955
- ), g = m(
1964
+ ), y = m(
1956
1965
  (k) => k.actions.setSelectedDatamodelId
1957
1966
  ), v = m(
1958
1967
  (k) => k.actions.setSelectedDatabaseName
1959
1968
  ), c = m(
1960
1969
  (k) => k.actions.setSelectedSchemaName
1961
- ), p = m(
1970
+ ), g = m(
1962
1971
  (k) => k.actions.setSelectedTableName
1963
1972
  );
1964
1973
  m((k) => k.actions.setCardSql);
1965
- function b(k) {
1974
+ function f(k) {
1966
1975
  return i && r && d && r !== "NA" ? !0 : i && k === "API" ? !1 : !!(i && k === "S3");
1967
1976
  }
1968
1977
  function C(k) {
@@ -1974,11 +1983,11 @@ function He(t, s) {
1974
1983
  const {
1975
1984
  refetch: D,
1976
1985
  data: N,
1977
- isLoading: I,
1986
+ isLoading: O,
1978
1987
  isError: z
1979
- } = Me({
1988
+ } = De({
1980
1989
  queryKey: ["connections"],
1981
- queryFn: () => Ee(
1990
+ queryFn: () => Ve(
1982
1991
  "https://semaphor.cloud/api/v1/connections",
1983
1992
  (l == null ? void 0 : l.accessToken) || ""
1984
1993
  ),
@@ -1988,10 +1997,10 @@ function He(t, s) {
1988
1997
  refetch: q,
1989
1998
  data: P,
1990
1999
  isLoading: _,
1991
- isError: U
1992
- } = Me({
2000
+ isError: Q
2001
+ } = De({
1993
2002
  queryKey: ["models", i],
1994
- queryFn: () => Ee(
2003
+ queryFn: () => Ve(
1995
2004
  "https://semaphor.cloud/api/v1/datamodels",
1996
2005
  (l == null ? void 0 : l.accessToken) || "",
1997
2006
  {
@@ -2000,17 +2009,17 @@ function He(t, s) {
2000
2009
  ),
2001
2010
  enabled: !!(l != null && l.accessToken) && !!i
2002
2011
  // Only fetch if authToken is present
2003
- }), f = N == null ? void 0 : N.connections.find(
2012
+ }), p = N == null ? void 0 : N.connections.find(
2004
2013
  (k) => k.id === i
2005
- ), T = f == null ? void 0 : f.type, B = (f == null ? void 0 : f.type) === "API" || (f == null ? void 0 : f.type) === "S3", {
2014
+ ), T = p == null ? void 0 : p.type, B = (p == null ? void 0 : p.type) === "API" || (p == null ? void 0 : p.type) === "S3", {
2006
2015
  data: V,
2007
- isLoading: J,
2016
+ isLoading: G,
2008
2017
  isFetching: W,
2009
2018
  isError: S,
2010
2019
  refetch: w
2011
- } = Me({
2020
+ } = De({
2012
2021
  queryKey: ["databases", i],
2013
- queryFn: () => Ee(
2022
+ queryFn: () => Ve(
2014
2023
  "https://semaphor.cloud/api/v1/databases",
2015
2024
  (l == null ? void 0 : l.accessToken) || "",
2016
2025
  {
@@ -2021,13 +2030,13 @@ function He(t, s) {
2021
2030
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
2022
2031
  }), {
2023
2032
  data: A,
2024
- isLoading: Q,
2033
+ isLoading: K,
2025
2034
  isFetching: X,
2026
- isError: le,
2035
+ isError: ie,
2027
2036
  refetch: R
2028
- } = Me({
2037
+ } = De({
2029
2038
  queryKey: ["schemas", i, r],
2030
- queryFn: () => Ee(
2039
+ queryFn: () => Ve(
2031
2040
  "https://semaphor.cloud/api/v1/schemas",
2032
2041
  (l == null ? void 0 : l.accessToken) || "",
2033
2042
  {
@@ -2041,16 +2050,16 @@ function He(t, s) {
2041
2050
  data: E,
2042
2051
  isLoading: re,
2043
2052
  isFetching: M,
2044
- isError: K,
2053
+ isError: J,
2045
2054
  refetch: he
2046
- } = Me({
2055
+ } = De({
2047
2056
  queryKey: [
2048
2057
  "tables",
2049
2058
  i,
2050
2059
  r,
2051
2060
  d
2052
2061
  ],
2053
- queryFn: () => Ee(
2062
+ queryFn: () => Ve(
2054
2063
  "https://semaphor.cloud/api/v1/tables",
2055
2064
  (l == null ? void 0 : l.accessToken) || "",
2056
2065
  {
@@ -2059,14 +2068,14 @@ function He(t, s) {
2059
2068
  schema_name: d
2060
2069
  }
2061
2070
  ),
2062
- enabled: b(T)
2071
+ enabled: f(T)
2063
2072
  }), {
2064
2073
  data: ce,
2065
2074
  isLoading: ke,
2066
- isFetching: ye,
2067
- isError: Z,
2068
- refetch: ue
2069
- } = Me({
2075
+ isFetching: Me,
2076
+ isError: pe,
2077
+ refetch: Y
2078
+ } = De({
2070
2079
  queryKey: [
2071
2080
  "columns",
2072
2081
  i,
@@ -2075,7 +2084,7 @@ function He(t, s) {
2075
2084
  d,
2076
2085
  u
2077
2086
  ],
2078
- queryFn: () => Ee(
2087
+ queryFn: () => Ve(
2079
2088
  "https://semaphor.cloud/api/v1/columns",
2080
2089
  (l == null ? void 0 : l.accessToken) || "",
2081
2090
  {
@@ -2097,34 +2106,34 @@ function He(t, s) {
2097
2106
  // && currentConnection?.type !== 'API', // Only fetch if connectionId, database, and table is present
2098
2107
  });
2099
2108
  oe(() => {
2100
- y(a);
2101
- }, [ce, y, a]), oe(() => {
2102
- (T === "S3" || T === "API") && (v(""), c(""), g(""), T === "API" && p("api"));
2109
+ b(a);
2110
+ }, [ce, b, a]), oe(() => {
2111
+ (T === "S3" || T === "API") && (v(""), c(""), y(""), T === "API" && g("api"));
2103
2112
  }, [
2104
2113
  T,
2105
- p,
2114
+ g,
2106
2115
  v,
2107
2116
  c,
2108
- g
2117
+ y
2109
2118
  ]);
2110
- const $e = (f == null ? void 0 : f.type) === "API" ? (Pt = f == null ? void 0 : f.type) == null ? void 0 : Pt.toLowerCase() : u || "", Ae = B ? "" : d || "";
2111
- function Le(k) {
2112
- c(k), p("");
2119
+ const ue = (p == null ? void 0 : p.type) === "API" ? (Pt = p == null ? void 0 : p.type) == null ? void 0 : Pt.toLowerCase() : u || "", Le = B ? "" : d || "";
2120
+ function Fe(k) {
2121
+ c(k), g("");
2113
2122
  }
2114
2123
  function F(k) {
2115
- v(k === "none" ? "" : k), c(""), p(""), k !== "none" && k !== "" && g("");
2124
+ v(k === "none" ? "" : k), c(""), g(""), k !== "none" && k !== "" && y("");
2116
2125
  }
2117
2126
  function me(k) {
2118
2127
  h(k);
2119
2128
  }
2120
- function Fe(k) {
2121
- g(k === "none" ? "" : k), k !== "none" && k !== "" && v("");
2129
+ function Ee(k) {
2130
+ y(k === "none" ? "" : k), k !== "none" && k !== "" && v("");
2122
2131
  }
2123
2132
  V && (($t = V == null ? void 0 : V.databases) == null ? void 0 : $t.length) > 0, A && ((Bt = A == null ? void 0 : A.schemas) == null ? void 0 : Bt.length) > 0, ce && ((Ut = ce == null ? void 0 : ce.columns) == null ? void 0 : Ut.length) > 0 && (a = ce.columns.map((k) => ({
2124
2133
  ...k,
2125
2134
  data_type: k.data_type.toLowerCase()
2126
- }))), S && (a = []), (Z || z) && (a = []);
2127
- const pe = N == null ? void 0 : N.connections.map(
2135
+ }))), S && (a = []), (pe || z) && (a = []);
2136
+ const fe = N == null ? void 0 : N.connections.map(
2128
2137
  (k) => ({
2129
2138
  id: k.id,
2130
2139
  name: k.name,
@@ -2146,221 +2155,232 @@ function He(t, s) {
2146
2155
  (k) => k.id === o
2147
2156
  )) == null ? void 0 : Jt.name;
2148
2157
  return {
2149
- connectionItems: pe,
2150
- isConnectionsLoading: I,
2158
+ connectionItems: fe,
2159
+ isConnectionsLoading: O,
2151
2160
  isConnectionsError: z,
2152
2161
  modelItems: Ze,
2153
2162
  selectedDatamodelId: o,
2154
2163
  selectedDatamodelName: Ds,
2155
2164
  isModelsLoading: _,
2156
- isModelsError: U,
2165
+ isModelsError: Q,
2157
2166
  databaseItems: Nt,
2158
- isDatabasesLoadingOrFetching: J || W,
2167
+ isDatabasesLoadingOrFetching: G || W,
2159
2168
  isDatabaseError: S,
2160
2169
  schemaItems: lt,
2161
- isSchemaLoadingOrFetching: Q || X,
2162
- isSchemaError: le,
2170
+ isSchemaLoadingOrFetching: K || X,
2171
+ isSchemaError: ie,
2163
2172
  tableItems: Ct,
2164
2173
  isTableLoadingOrFetching: re || M,
2165
- isTableError: K,
2174
+ isTableError: J,
2166
2175
  columns: a,
2167
- isColumnsLoadingOrFetching: ke || ye,
2168
- isColumnsError: Z,
2176
+ isColumnsLoadingOrFetching: ke || Me,
2177
+ isColumnsError: pe,
2169
2178
  isNonDbConnection: B,
2170
2179
  connectionType: T,
2171
- tableName: $e,
2172
- schemaName: Ae,
2180
+ tableName: ue,
2181
+ schemaName: Le,
2173
2182
  refetchConnections: D,
2174
2183
  refetchModels: q,
2175
2184
  refetchDatabases: w,
2176
2185
  refetchSchemas: R,
2177
2186
  refetchTables: he,
2178
- refetchColumns: ue,
2187
+ refetchColumns: Y,
2179
2188
  handleConnectionChange: me,
2180
- handleDatamodelChange: Fe,
2189
+ handleDatamodelChange: Ee,
2181
2190
  handleDatabaseChange: F,
2182
- handleSchemaChange: Le
2191
+ handleSchemaChange: Fe
2183
2192
  };
2184
2193
  }
2185
2194
  function us({
2186
2195
  ColumnsComponent: t
2187
2196
  }) {
2188
- var ye;
2197
+ var pe;
2189
2198
  const s = m(
2190
- (Z) => Z.selectedConnectionId
2191
- ), a = m(
2192
- (Z) => Z.selectedDatamodelId
2193
- ), l = m(
2194
- (Z) => Z.selectedDatabaseName
2199
+ (Y) => Y.selectedConnectionId
2200
+ ), a = I((Y) => Y.showFilters), l = m(
2201
+ (Y) => Y.selectedDatamodelId
2195
2202
  ), i = m(
2196
- (Z) => Z.selectedSchemaName
2197
- ), o = m((Z) => Z.selectedTableName), r = m(
2198
- (Z) => Z.actions.setSelectedTableName
2203
+ (Y) => Y.selectedDatabaseName
2204
+ ), o = m(
2205
+ (Y) => Y.selectedSchemaName
2206
+ ), r = m((Y) => Y.selectedTableName), d = m(
2207
+ (Y) => Y.actions.setSelectedTableName
2199
2208
  ), {
2200
- connectionItems: d,
2201
- modelItems: u,
2202
- schemaItems: y,
2203
- databaseItems: h,
2204
- tableItems: g,
2205
- columns: v,
2206
- isConnectionsLoading: c,
2207
- isModelsLoading: p,
2208
- isConnectionsError: b,
2209
- isModelsError: C,
2210
- isDatabasesLoadingOrFetching: x,
2211
- isDatabaseError: D,
2212
- isSchemaLoadingOrFetching: N,
2213
- isSchemaError: I,
2214
- isColumnsError: z,
2215
- isColumnsLoadingOrFetching: q,
2216
- isTableLoadingOrFetching: P,
2217
- isTableError: _,
2218
- connectionType: U,
2219
- isNonDbConnection: f,
2220
- refetchDatabases: T,
2221
- refetchModels: B,
2222
- refetchSchemas: V,
2223
- refetchTables: J,
2224
- refetchColumns: W,
2225
- refetchConnections: S,
2226
- handleConnectionChange: w,
2227
- handleDatabaseChange: A,
2228
- handleSchemaChange: Q,
2229
- handleDatamodelChange: X,
2230
- tableName: le,
2231
- schemaName: R
2232
- } = He();
2233
- function E() {
2234
- return t ? t(R, le, v) : /* @__PURE__ */ e(
2209
+ connectionItems: u,
2210
+ modelItems: b,
2211
+ schemaItems: h,
2212
+ databaseItems: y,
2213
+ tableItems: v,
2214
+ columns: c,
2215
+ isConnectionsLoading: g,
2216
+ isModelsLoading: f,
2217
+ isConnectionsError: C,
2218
+ isModelsError: x,
2219
+ isDatabasesLoadingOrFetching: D,
2220
+ isDatabaseError: N,
2221
+ isSchemaLoadingOrFetching: O,
2222
+ isSchemaError: z,
2223
+ isColumnsError: q,
2224
+ isColumnsLoadingOrFetching: P,
2225
+ isTableLoadingOrFetching: _,
2226
+ isTableError: Q,
2227
+ connectionType: p,
2228
+ isNonDbConnection: T,
2229
+ refetchDatabases: B,
2230
+ refetchModels: V,
2231
+ refetchSchemas: G,
2232
+ refetchTables: W,
2233
+ refetchColumns: S,
2234
+ refetchConnections: w,
2235
+ handleConnectionChange: A,
2236
+ handleDatabaseChange: K,
2237
+ handleSchemaChange: X,
2238
+ handleDatamodelChange: ie,
2239
+ tableName: R,
2240
+ schemaName: E
2241
+ } = Pe();
2242
+ function re() {
2243
+ return t ? t(E, R, c) : /* @__PURE__ */ e(
2235
2244
  ei,
2236
2245
  {
2237
- schemaName: R,
2238
- tableName: le,
2239
- columns: v,
2240
- status: q ? "Loading..." : z ? "Error" : "Success"
2246
+ schemaName: E,
2247
+ tableName: R,
2248
+ columns: c,
2249
+ status: P ? "Loading..." : q ? "Error" : "Success"
2241
2250
  }
2242
2251
  );
2243
2252
  }
2244
- function re() {
2253
+ function M() {
2245
2254
  window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
2246
2255
  }
2247
- function M() {
2248
- if (!s || U === "S3" || U === "API") return null;
2249
- if (!a || a === "none")
2256
+ function J() {
2257
+ if (!s || p === "S3" || p === "API") return null;
2258
+ if (!l || l === "none")
2250
2259
  return /* @__PURE__ */ e(
2251
2260
  Ye,
2252
2261
  {
2253
- refetch: T,
2262
+ refetch: B,
2254
2263
  showNone: !0,
2255
- onChange: A,
2256
- isError: D,
2257
- isLoading: x,
2258
- items: h,
2259
- value: l || "",
2264
+ onChange: K,
2265
+ isError: N,
2266
+ isLoading: D,
2267
+ items: y,
2268
+ value: i || "",
2260
2269
  title: "Database",
2261
2270
  type: "combobox"
2262
2271
  }
2263
2272
  );
2264
2273
  }
2265
- function K() {
2266
- if (s && !f && (!l || l === "none") && (!a || a === "none"))
2274
+ function he() {
2275
+ if (s && !T && (!i || i === "none") && (!l || l === "none"))
2267
2276
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-3", children: [
2268
2277
  /* @__PURE__ */ e("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e(we, {}) }),
2269
2278
  /* @__PURE__ */ e("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e(H, { children: "OR" }) }),
2270
2279
  /* @__PURE__ */ e("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e(we, {}) })
2271
2280
  ] });
2272
2281
  }
2273
- function he() {
2274
- if (!s || U === "S3" || U === "API") return null;
2275
- if (!l || l === "none")
2282
+ function ce() {
2283
+ if (!s || p === "S3" || p === "API") return null;
2284
+ if (!i || i === "none")
2276
2285
  return /* @__PURE__ */ e(
2277
2286
  Ye,
2278
2287
  {
2279
- refetch: B,
2288
+ refetch: V,
2280
2289
  showNone: !0,
2281
- onChange: X,
2282
- isError: C,
2283
- isLoading: p,
2284
- items: u,
2285
- value: a || "",
2290
+ onChange: ie,
2291
+ isError: x,
2292
+ isLoading: f,
2293
+ items: b,
2294
+ value: l || "",
2286
2295
  title: "Model",
2287
2296
  type: "combobox"
2288
2297
  }
2289
2298
  );
2290
2299
  }
2291
- function ce() {
2292
- return !s || U === "S3" || U === "API" || !l || l === "none" ? null : /* @__PURE__ */ e(
2300
+ function ke() {
2301
+ return !s || p === "S3" || p === "API" || !i || i === "none" ? null : /* @__PURE__ */ e(
2293
2302
  Ye,
2294
2303
  {
2295
- refetch: V,
2296
- onChange: Q,
2297
- isError: I,
2298
- isLoading: N,
2299
- items: y,
2300
- value: i || "",
2304
+ refetch: G,
2305
+ onChange: X,
2306
+ isError: z,
2307
+ isLoading: O,
2308
+ items: h,
2309
+ value: o || "",
2301
2310
  title: "Schema",
2302
2311
  type: "combobox"
2303
2312
  }
2304
2313
  );
2305
2314
  }
2306
- function ke() {
2307
- function Z() {
2315
+ function Me() {
2316
+ function Y() {
2308
2317
  let ue = !1;
2309
- return U === "API" ? (ue = !1, ue) : ((U === "S3" || s && l && l !== "none" && i) && (ue = !0), ue);
2318
+ return p === "API" ? (ue = !1, ue) : ((p === "S3" || s && i && i !== "none" && o) && (ue = !0), ue);
2310
2319
  }
2311
- return Z() ? /* @__PURE__ */ e(
2320
+ return Y() ? /* @__PURE__ */ e(
2312
2321
  Ye,
2313
2322
  {
2314
- refetch: J,
2315
- onChange: r,
2316
- isError: _,
2317
- items: g,
2318
- isLoading: P,
2319
- value: o || "",
2323
+ refetch: W,
2324
+ onChange: d,
2325
+ isError: Q,
2326
+ items: v,
2327
+ isLoading: _,
2328
+ value: r || "",
2320
2329
  title: "Table",
2321
2330
  type: "combobox"
2322
2331
  }
2323
2332
  ) : null;
2324
2333
  }
2325
- return /* @__PURE__ */ n("aside", { className: "flex h-full min-w-[300px] flex-col justify-between rounded-none border-r-[1px]", children: [
2326
- /* @__PURE__ */ n("section", { className: "space-y-3 px-6 py-4", children: [
2327
- /* @__PURE__ */ e(
2328
- Ye,
2334
+ return /* @__PURE__ */ n(
2335
+ "aside",
2336
+ {
2337
+ className: Z(
2338
+ "flex h-full min-w-[300px] flex-col justify-between rounded-none",
2329
2339
  {
2330
- refetch: S,
2331
- items: d,
2332
- title: "Connection",
2333
- value: s || "",
2334
- onChange: w,
2335
- isLoading: c,
2336
- isError: b,
2337
- type: "combobox",
2338
- connectionTooltip: ((ye = d == null ? void 0 : d.find(
2339
- (Z) => Z.id === s
2340
- )) == null ? void 0 : ye.type) || ""
2340
+ "border-r-[1px]": !a
2341
2341
  }
2342
2342
  ),
2343
- M(),
2344
- K(),
2345
- he(),
2346
- ce(),
2347
- ke()
2348
- ] }),
2349
- E(),
2350
- /* @__PURE__ */ e("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ n(
2351
- $,
2352
- {
2353
- onClick: re,
2354
- size: "sm",
2355
- variant: "secondary",
2356
- className: "w-full",
2357
- children: [
2358
- /* @__PURE__ */ e(Dl, { className: "mr-2 size-4" }),
2359
- "Help"
2360
- ]
2361
- }
2362
- ) })
2363
- ] });
2343
+ children: [
2344
+ /* @__PURE__ */ n("section", { className: "space-y-3 px-6 py-4", children: [
2345
+ /* @__PURE__ */ e(
2346
+ Ye,
2347
+ {
2348
+ refetch: w,
2349
+ items: u,
2350
+ title: "Connection",
2351
+ value: s || "",
2352
+ onChange: A,
2353
+ isLoading: g,
2354
+ isError: C,
2355
+ type: "combobox",
2356
+ connectionTooltip: ((pe = u == null ? void 0 : u.find(
2357
+ (Y) => Y.id === s
2358
+ )) == null ? void 0 : pe.type) || ""
2359
+ }
2360
+ ),
2361
+ J(),
2362
+ he(),
2363
+ ce(),
2364
+ ke(),
2365
+ Me()
2366
+ ] }),
2367
+ re(),
2368
+ /* @__PURE__ */ e("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ n(
2369
+ $,
2370
+ {
2371
+ onClick: M,
2372
+ size: "sm",
2373
+ variant: "secondary",
2374
+ className: "w-full",
2375
+ children: [
2376
+ /* @__PURE__ */ e(Dl, { className: "mr-2 size-4" }),
2377
+ "Help"
2378
+ ]
2379
+ }
2380
+ ) })
2381
+ ]
2382
+ }
2383
+ );
2364
2384
  }
2365
2385
  function ti(t) {
2366
2386
  const s = t.toUpperCase().indexOf("WHERE"), a = t.toUpperCase().indexOf("GROUP BY"), l = t.toUpperCase().indexOf("LIMIT"), i = t.toUpperCase().indexOf("ORDER BY");
@@ -2387,7 +2407,7 @@ function ai({ sql: t, error: s, onClick: a }) {
2387
2407
  align: "start",
2388
2408
  className: "w-full min-w-fit max-w-[700px]",
2389
2409
  children: /* @__PURE__ */ e("div", { className: "flex justify-between space-x-4", children: /* @__PURE__ */ n("div", { className: "flex grow flex-col space-y-2", children: [
2390
- /* @__PURE__ */ n(Oe, { className: "max-h-[250px] min-h-0 overflow-scroll text-xs leading-relaxed text-foreground/80", children: [
2410
+ /* @__PURE__ */ n(Te, { className: "max-h-[250px] min-h-0 overflow-scroll text-xs leading-relaxed text-foreground/80", children: [
2391
2411
  s && s,
2392
2412
  t && /* @__PURE__ */ n("div", { className: "flex flex-col space-y-1.5", children: [
2393
2413
  /* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: "Resolved SQL" }),
@@ -2409,7 +2429,7 @@ var ms = {
2409
2429
  className: void 0,
2410
2430
  style: void 0,
2411
2431
  attr: void 0
2412
- }, sa = Ie.createContext && /* @__PURE__ */ Ie.createContext(ms), si = ["attr", "size", "title"];
2432
+ }, sa = Oe.createContext && /* @__PURE__ */ Oe.createContext(ms), si = ["attr", "size", "title"];
2413
2433
  function ni(t, s) {
2414
2434
  if (t == null) return {};
2415
2435
  var a = li(t, s), l, i;
@@ -2479,12 +2499,12 @@ function oi(t, s) {
2479
2499
  return (s === "string" ? String : Number)(t);
2480
2500
  }
2481
2501
  function ps(t) {
2482
- return t && t.map((s, a) => /* @__PURE__ */ Ie.createElement(s.tag, mt({
2502
+ return t && t.map((s, a) => /* @__PURE__ */ Oe.createElement(s.tag, mt({
2483
2503
  key: a
2484
2504
  }, s.attr), ps(s.child)));
2485
2505
  }
2486
2506
  function Qe(t) {
2487
- return (s) => /* @__PURE__ */ Ie.createElement(ci, ut({
2507
+ return (s) => /* @__PURE__ */ Oe.createElement(ci, ut({
2488
2508
  attr: mt({}, t.attr)
2489
2509
  }, s), ps(t.child));
2490
2510
  }
@@ -2495,7 +2515,7 @@ function ci(t) {
2495
2515
  size: i,
2496
2516
  title: o
2497
2517
  } = t, r = ni(t, si), d = i || a.size || "1em", u;
2498
- return a.className && (u = a.className), t.className && (u = (u ? u + " " : "") + t.className), /* @__PURE__ */ Ie.createElement("svg", ut({
2518
+ return a.className && (u = a.className), t.className && (u = (u ? u + " " : "") + t.className), /* @__PURE__ */ Oe.createElement("svg", ut({
2499
2519
  stroke: "currentColor",
2500
2520
  fill: "currentColor",
2501
2521
  strokeWidth: "0"
@@ -2507,43 +2527,43 @@ function ci(t) {
2507
2527
  height: d,
2508
2528
  width: d,
2509
2529
  xmlns: "http://www.w3.org/2000/svg"
2510
- }), o && /* @__PURE__ */ Ie.createElement("title", null, o), t.children);
2530
+ }), o && /* @__PURE__ */ Oe.createElement("title", null, o), t.children);
2511
2531
  };
2512
- return sa !== void 0 ? /* @__PURE__ */ Ie.createElement(sa.Consumer, null, (a) => s(a)) : s(ms);
2532
+ return sa !== void 0 ? /* @__PURE__ */ Oe.createElement(sa.Consumer, null, (a) => s(a)) : s(ms);
2513
2533
  }
2514
2534
  function di(t) {
2515
2535
  return Qe({ attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z" }, child: [] }] })(t);
2516
2536
  }
2517
2537
  function fs(t) {
2518
- const { theme: s } = _s(), a = O((b) => b.theme), l = m((b) => b.frame), i = m((b) => b.card), o = m((b) => b.activeTabCardId), r = Hs(), { refetch: d } = je(i), { updateCardTab: u, setRunSql: y } = ne(), h = Je(), g = Je({}), v = l.cards.find((b) => b.id === o), c = Qa(() => {
2519
- let b = "";
2520
- return t === "python" && (b = (v == null ? void 0 : v.python) || qa), t === "sql" && (b = (v == null ? void 0 : v.sql) || ""), b;
2538
+ const { theme: s } = _s(), a = I((f) => f.theme), l = m((f) => f.frame), i = m((f) => f.card), o = m((f) => f.activeTabCardId), r = Hs(), { refetch: d } = _e(i), { updateCardTab: u, setRunSql: b } = ne(), h = Je(), y = Je({}), v = l.cards.find((f) => f.id === o), c = Qa(() => {
2539
+ let f = "";
2540
+ return t === "python" && (f = (v == null ? void 0 : v.python) || qa), t === "sql" && (f = (v == null ? void 0 : v.sql) || ""), f;
2521
2541
  }, [t, v]);
2522
2542
  oe(() => {
2523
2543
  if (o && i.id && i.id !== o) {
2524
2544
  if (h.current && r) {
2525
- const b = h.current.getModel();
2526
- b && (g.current[i.id] = b);
2527
- let C = g.current[o];
2545
+ const f = h.current.getModel();
2546
+ f && (y.current[i.id] = f);
2547
+ let C = y.current[o];
2528
2548
  if (!C) {
2529
2549
  const x = c();
2530
- C = r.editor.createModel(x, t), g.current[o] = C;
2550
+ C = r.editor.createModel(x, t), y.current[o] = C;
2531
2551
  }
2532
2552
  h.current.setModel(C);
2533
2553
  }
2534
- u(o, i), y(!0);
2554
+ u(o, i), b(!0);
2535
2555
  }
2536
2556
  }, [
2537
2557
  o,
2538
2558
  i,
2539
2559
  u,
2540
2560
  r,
2541
- y,
2561
+ b,
2542
2562
  t,
2543
2563
  c
2544
2564
  ]), oe(() => {
2545
2565
  if (!r) return;
2546
- const b = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", C = a === "system" ? b : a;
2566
+ const f = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", C = a === "system" ? f : a;
2547
2567
  r.editor.defineTheme("default", {
2548
2568
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
2549
2569
  base: C === "light" ? "vs" : "vs-dark",
@@ -2558,22 +2578,22 @@ function fs(t) {
2558
2578
  }
2559
2579
  }), r.editor.setTheme("default");
2560
2580
  }, [s, a, r]), oe(() => {
2561
- const b = h.current;
2562
- b && r && i && b.addCommand(
2581
+ const f = h.current;
2582
+ f && r && i && f.addCommand(
2563
2583
  r.KeyMod.Shift | r.KeyCode.Enter,
2564
2584
  function() {
2565
2585
  return d(), !1;
2566
2586
  }
2567
2587
  );
2568
2588
  }, [r, d, i]);
2569
- function p(b, C) {
2570
- if (h.current = b, !g.current[i.id]) {
2571
- const x = b.getModel(), D = c();
2572
- g.current[i.id] = x || (C == null ? void 0 : C.editor.createModel(D, t)) || b.getModel();
2589
+ function g(f, C) {
2590
+ if (h.current = f, !y.current[i.id]) {
2591
+ const x = f.getModel(), D = c();
2592
+ y.current[i.id] = x || (C == null ? void 0 : C.editor.createModel(D, t)) || f.getModel();
2573
2593
  }
2574
- b.setModel(g.current[i.id]);
2594
+ f.setModel(y.current[i.id]);
2575
2595
  }
2576
- return { handleEditorDidMount: p };
2596
+ return { handleEditorDidMount: g };
2577
2597
  }
2578
2598
  function hi() {
2579
2599
  const t = m((r) => r.card.sql), s = m((r) => r.sqlGen), { setCardSql: a, setSqlGen: l } = ne(), { handleEditorDidMount: i } = fs("sql");
@@ -2660,30 +2680,30 @@ function mi({ jsonString: t }) {
2660
2680
  );
2661
2681
  }
2662
2682
  function gs(t) {
2663
- const [s, a] = j(""), [l, i] = j(null), { authToken: o } = Te(), r = m((M) => {
2664
- var K;
2665
- return (K = M == null ? void 0 : M.card) == null ? void 0 : K.sql;
2683
+ const [s, a] = j(""), [l, i] = j(null), { authToken: o } = Ae(), r = m((M) => {
2684
+ var J;
2685
+ return (J = M == null ? void 0 : M.card) == null ? void 0 : J.sql;
2666
2686
  }), d = m((M) => {
2667
- var K;
2668
- return (K = M == null ? void 0 : M.card) == null ? void 0 : K.python;
2669
- }), u = m((M) => M.actions.setCardSql), y = m((M) => M.actions.setRunSql), h = m(
2687
+ var J;
2688
+ return (J = M == null ? void 0 : M.card) == null ? void 0 : J.python;
2689
+ }), u = m((M) => M.actions.setCardSql), b = m((M) => M.actions.setRunSql), h = m(
2670
2690
  (M) => M.actions.switchCardType
2671
- ), g = m((M) => M.currentAssitantScope) || [], v = m((M) => M.userInputForAI), c = m((M) => M.triggerAIRun), p = m(
2691
+ ), y = m((M) => M.currentAssitantScope) || [], v = m((M) => M.userInputForAI), c = m((M) => M.triggerAIRun), g = m(
2672
2692
  (M) => M.selectedDatabaseName
2673
- ), b = m((M) => M.selectedTableName), C = m(
2693
+ ), f = m((M) => M.selectedTableName), C = m(
2674
2694
  (M) => M.selectedConnectionId
2675
2695
  ), x = m(
2676
2696
  (M) => M.selectedSchemaName
2677
- ), D = O(
2697
+ ), D = I(
2678
2698
  (M) => M.dashboard.aiScopeTables
2679
- ), { setTriggerAIRun: N, setCurrentAssitantScope: I } = ne(), { selectedDatamodelName: z, connectionType: q, selectedDatamodelId: P } = He(), {
2699
+ ), { setTriggerAIRun: N, setCurrentAssitantScope: O } = ne(), { selectedDatamodelName: z, connectionType: q, selectedDatamodelId: P } = Pe(), {
2680
2700
  messages: _,
2681
- setMessages: U,
2682
- reload: f,
2701
+ setMessages: Q,
2702
+ reload: p,
2683
2703
  append: T,
2684
2704
  input: B,
2685
2705
  setInput: V,
2686
- status: J,
2706
+ status: G,
2687
2707
  handleInputChange: W,
2688
2708
  handleSubmit: S,
2689
2709
  stop: w
@@ -2698,8 +2718,8 @@ function gs(t) {
2698
2718
  maxSteps: 10,
2699
2719
  //maxToolRoundtrips: 5,
2700
2720
  onToolCall: A,
2701
- onFinish(M, K) {
2702
- Q(K.usage), a(""), K.finishReason === "stop" && a("");
2721
+ onFinish(M, J) {
2722
+ K(J.usage), a(""), J.finishReason === "stop" && a("");
2703
2723
  }
2704
2724
  });
2705
2725
  oe(() => {
@@ -2719,8 +2739,8 @@ function gs(t) {
2719
2739
  toolCall: M
2720
2740
  }) {
2721
2741
  if (M.toolName === "createChart") {
2722
- const K = M.args.sql, he = M.args.chartType;
2723
- return h(he), u(K), y(!0), {
2742
+ const J = M.args.sql, he = M.args.chartType;
2743
+ return h(he), u(J), b(!0), {
2724
2744
  status: "success",
2725
2745
  message: "Let the user know that chart is created"
2726
2746
  // query: sql,
@@ -2740,74 +2760,74 @@ function gs(t) {
2740
2760
  if (M.toolName === "getCurrentTableScope")
2741
2761
  return a("Getting table scope..."), E(), {
2742
2762
  status: "success",
2743
- tables: g
2763
+ tables: y
2744
2764
  };
2745
2765
  a("Analyzing...");
2746
2766
  }
2747
2767
  }
2748
- function Q(M) {
2749
- i((K) => K ? {
2750
- promptTokens: K.promptTokens + M.promptTokens,
2751
- completionTokens: K.completionTokens + M.completionTokens,
2752
- totalTokens: K.totalTokens + M.totalTokens
2768
+ function K(M) {
2769
+ i((J) => J ? {
2770
+ promptTokens: J.promptTokens + M.promptTokens,
2771
+ completionTokens: J.completionTokens + M.completionTokens,
2772
+ totalTokens: J.totalTokens + M.totalTokens
2753
2773
  } : M);
2754
2774
  }
2755
2775
  function X(M) {
2756
- const K = Us(g, M);
2757
- le(K);
2776
+ const J = Us(y, M);
2777
+ ie(J);
2758
2778
  }
2759
- function le(M) {
2760
- const K = Js(M);
2761
- I(K), U((he) => [
2779
+ function ie(M) {
2780
+ const J = Js(M);
2781
+ O(J), Q((he) => [
2762
2782
  ...he,
2763
2783
  {
2764
2784
  id: crypto.randomUUID(),
2765
2785
  role: "system",
2766
- content: `Current scope of tables | ${JSON.stringify(K)}`
2786
+ content: `Current scope of tables | ${JSON.stringify(J)}`
2767
2787
  }
2768
2788
  ]);
2769
2789
  }
2770
2790
  function R() {
2771
2791
  const M = {
2772
- databaseName: p || "",
2792
+ databaseName: g || "",
2773
2793
  schemaName: x || "",
2774
- tableName: b || "",
2794
+ tableName: f || "",
2775
2795
  datamodelId: P || "",
2776
2796
  datamodelName: dt(z),
2777
2797
  connectionId: C || "",
2778
2798
  connectionType: q || ""
2779
- }, K = Wt([...g, M]);
2780
- le(K);
2799
+ }, J = Wt([...y, M]);
2800
+ ie(J);
2781
2801
  }
2782
2802
  function E() {
2783
2803
  const M = {
2784
- databaseName: p || "",
2804
+ databaseName: g || "",
2785
2805
  schemaName: x || "",
2786
- tableName: b || "",
2806
+ tableName: f || "",
2787
2807
  datamodelName: dt(z),
2788
2808
  connectionId: C || "",
2789
2809
  connectionType: q || "",
2790
2810
  datamodelId: P || ""
2791
2811
  };
2792
2812
  if (!Gs(
2793
- [...D || [], ...g],
2813
+ [...D || [], ...y],
2794
2814
  M
2795
- ) || g.length === 0) {
2815
+ ) || y.length === 0) {
2796
2816
  const he = Wt([
2797
2817
  ...D || [],
2798
- ...g,
2818
+ ...y,
2799
2819
  M
2800
2820
  ]).filter(
2801
2821
  (ce) => ce.connectionId === M.connectionId
2802
2822
  );
2803
- le(he);
2823
+ ie(he);
2804
2824
  }
2805
2825
  }
2806
- const re = !["ready", "error"].includes(J);
2826
+ const re = !["ready", "error"].includes(G);
2807
2827
  return {
2808
2828
  messages: _,
2809
- setMessages: U,
2810
- reload: f,
2829
+ setMessages: Q,
2830
+ reload: p,
2811
2831
  append: T,
2812
2832
  input: B,
2813
2833
  setInput: V,
@@ -2815,56 +2835,56 @@ function gs(t) {
2815
2835
  handleSetAIScope: E,
2816
2836
  handleAddCurrentTableToScope: R,
2817
2837
  removeFromCurrentSelections: X,
2818
- currentAssitantScope: g,
2819
- setCurrentAssitantScope: I,
2838
+ currentAssitantScope: y,
2839
+ setCurrentAssitantScope: O,
2820
2840
  handleInputChange: W,
2821
2841
  handleSubmit: S,
2822
2842
  stop: w,
2823
- chatStatus: J,
2843
+ chatStatus: G,
2824
2844
  toolStatus: s,
2825
2845
  llmUsage: l,
2826
2846
  onFinish: t
2827
2847
  };
2828
2848
  }
2829
2849
  function pi() {
2830
- var Le;
2850
+ var Fe;
2831
2851
  const [t, s] = j({
2832
2852
  queryKey: [],
2833
2853
  queryData: null
2834
- }), a = Ks(), [l, i] = j(!1), [o, r] = j(!1), d = m((F) => F.frame), u = m((F) => F.card), y = m((F) => F.isShowingVisual), h = m(
2854
+ }), a = Ks(), [l, i] = j(!1), [o, r] = j(!1), d = m((F) => F.frame), u = m((F) => F.card), b = m((F) => F.isShowingVisual), h = m(
2835
2855
  (F) => F.selectedConnectionId
2836
- ), g = m(
2856
+ ), y = m(
2837
2857
  (F) => F.selectedDatabaseName
2838
2858
  ), v = m(
2839
2859
  (F) => F.selectedDatamodelId
2840
2860
  ), c = m(
2841
2861
  (F) => F.selectedSchemaName
2842
- ), p = m((F) => F.showAIDialog), b = m((F) => F.selectedTableName), C = m((F) => {
2862
+ ), g = m((F) => F.showAIDialog), f = m((F) => F.selectedTableName), C = m((F) => {
2843
2863
  var me;
2844
2864
  return (me = F == null ? void 0 : F.card) == null ? void 0 : me.sql;
2845
2865
  }), { sheetFilterValues: x } = Qs(), {
2846
2866
  setCardCustomCfg: D,
2847
2867
  setQueryResultColumns: N,
2848
- setCardSql: I,
2868
+ setCardSql: O,
2849
2869
  // setQueryError,
2850
2870
  setPythonStdOut: z,
2851
2871
  setCardPreferences: q,
2852
2872
  setCardType: P,
2853
2873
  setCardPython: _,
2854
- runAssistant: U,
2855
- setShowAIDialog: f
2856
- } = ne(), T = m((F) => F.onSave), B = m((F) => F.onClose), V = m((F) => F.actions.setSqlGen), J = m((F) => F.runSql), W = m((F) => F.actions.setRunSql), S = m((F) => F.actions.setCardCfg), w = m(
2874
+ runAssistant: Q,
2875
+ setShowAIDialog: p
2876
+ } = ne(), T = m((F) => F.onSave), B = m((F) => F.onClose), V = m((F) => F.actions.setSqlGen), G = m((F) => F.runSql), W = m((F) => F.actions.setRunSql), S = m((F) => F.actions.setCardCfg), w = m(
2857
2877
  (F) => F.actions.setIsSqlRunning
2858
2878
  ), {
2859
2879
  data: A,
2860
- isLoading: Q,
2880
+ isLoading: K,
2861
2881
  isFetching: X,
2862
- isSuccess: le,
2882
+ isSuccess: ie,
2863
2883
  isError: R,
2864
2884
  error: E,
2865
2885
  queryKey: re,
2866
2886
  refetch: M
2867
- } = je(u), { handleSetAIScope: K } = gs();
2887
+ } = _e(u), { handleSetAIScope: J } = gs();
2868
2888
  oe(() => {
2869
2889
  if (A && (A.rowLimitExceeded && ct.error("Row limit (10,000) exceeded. Refine your query.", {
2870
2890
  position: "top-center",
@@ -2874,39 +2894,39 @@ function pi() {
2874
2894
  N(F);
2875
2895
  }
2876
2896
  }, [A, N, z]), oe(() => {
2877
- (Q || X) && w(!0), (R || le) && w(!1), R && (N([]), z(""));
2897
+ (K || X) && w(!0), (R || ie) && w(!1), R && (N([]), z(""));
2878
2898
  }, [
2879
- Q,
2899
+ K,
2880
2900
  X,
2881
2901
  A,
2882
2902
  z,
2883
2903
  R,
2884
- le,
2904
+ ie,
2885
2905
  w,
2886
2906
  N,
2887
2907
  // setQueryError,
2888
2908
  E
2889
2909
  ]), oe(() => {
2890
- J && (a.getQueryData(re) || M(), W(!1));
2891
- }, [J, M, W, re, a]);
2910
+ G && (a.getQueryData(re) || M(), W(!1));
2911
+ }, [G, M, W, re, a]);
2892
2912
  function he() {
2893
2913
  const F = a.getQueryData(re);
2894
2914
  t.queryData || s({
2895
2915
  queryKey: re,
2896
2916
  queryData: F
2897
- }), a.setQueryData(re, null), a.removeQueries({ queryKey: re, exact: !0 }), I(""), V({}), _(""), S(void 0), D(""), q({}), P("bar");
2917
+ }), a.setQueryData(re, null), a.removeQueries({ queryKey: re, exact: !0 }), O(""), V({}), _(""), S(void 0), D(""), q({}), P("bar");
2898
2918
  }
2899
2919
  function ce(F, me) {
2900
2920
  if (F.length === 0)
2901
2921
  return "";
2902
2922
  if (me) {
2903
- const Fe = F.find((pe) => pe.id === me);
2904
- if (Fe) {
2905
- const pe = Fe.tabTitle;
2906
- if (pe == "All__Header")
2923
+ const Ee = F.find((fe) => fe.id === me);
2924
+ if (Ee) {
2925
+ const fe = Ee.tabTitle;
2926
+ if (fe == "All__Header")
2907
2927
  return F[0].id;
2908
- if (pe && pe.endsWith("__Header")) {
2909
- const Nt = pe.split("__")[0], lt = F.find(
2928
+ if (fe && fe.endsWith("__Header")) {
2929
+ const Nt = fe.split("__")[0], lt = F.find(
2910
2930
  (Ct) => Ct.tabTitle === Nt
2911
2931
  );
2912
2932
  return lt ? lt.id : F[0].id;
@@ -2918,45 +2938,45 @@ function pi() {
2918
2938
  }
2919
2939
  function ke() {
2920
2940
  let F = C;
2921
- C && !C.includes("{{") && (F = ti(C), I(F));
2941
+ C && !C.includes("{{") && (F = ti(C), O(F));
2922
2942
  const me = {
2923
2943
  ...u,
2924
2944
  lastSelectedSchema: c,
2925
2945
  lastSelectedDatamodelId: v,
2926
- lastSelectedDatabase: g,
2927
- lastSelectedTable: b,
2946
+ lastSelectedDatabase: y,
2947
+ lastSelectedTable: f,
2928
2948
  connectionId: h,
2929
- type: y ? u.type : "table",
2949
+ type: b ? u.type : "table",
2930
2950
  sql: F,
2931
- customCfg: y ? u.customCfg : null
2932
- }, Fe = d.cards.map(
2951
+ customCfg: b ? u.customCfg : null
2952
+ }, Ee = d.cards.map(
2933
2953
  (Ze) => Ze.id === u.id ? me : Ze
2934
- ), pe = {
2954
+ ), fe = {
2935
2955
  ...d,
2936
- cards: Fe,
2937
- activeCardId: ce(Fe, d.activeCardId)
2956
+ cards: Ee,
2957
+ activeCardId: ce(Ee, d.activeCardId)
2938
2958
  };
2939
- T == null || T(pe);
2959
+ T == null || T(fe);
2940
2960
  }
2941
- function ye() {
2961
+ function Me() {
2942
2962
  const { queryKey: F, queryData: me } = t;
2943
2963
  F && me && a.setQueryData(F, me), V({}), B == null || B();
2944
2964
  }
2945
- async function Z() {
2965
+ async function pe() {
2946
2966
  const F = `Can you help me debug this query in the current table scope?
2947
2967
 
2948
2968
  Error:
2949
2969
 
2950
- ${Ae}
2970
+ ${Le}
2951
2971
 
2952
2972
  Query:
2953
2973
 
2954
2974
  ${C}
2955
2975
 
2956
2976
  `;
2957
- U(F);
2977
+ Q(F);
2958
2978
  }
2959
- function ue() {
2979
+ function Y() {
2960
2980
  return /* @__PURE__ */ n(se, { children: [
2961
2981
  o && /* @__PURE__ */ e(
2962
2982
  "div",
@@ -2982,7 +3002,7 @@ function pi() {
2982
3002
  )
2983
3003
  ] });
2984
3004
  }
2985
- function $e() {
3005
+ function ue() {
2986
3006
  return /* @__PURE__ */ n(
2987
3007
  tt,
2988
3008
  {
@@ -2991,7 +3011,7 @@ function pi() {
2991
3011
  role: "editor-resizable-group",
2992
3012
  children: [
2993
3013
  /* @__PURE__ */ n(
2994
- fe,
3014
+ ge,
2995
3015
  {
2996
3016
  id: "1",
2997
3017
  order: 1,
@@ -3013,7 +3033,7 @@ function pi() {
3013
3033
  l && /* @__PURE__ */ n(se, { children: [
3014
3034
  /* @__PURE__ */ e(at, { withHandle: !0, className: "border" }),
3015
3035
  /* @__PURE__ */ n(
3016
- fe,
3036
+ ge,
3017
3037
  {
3018
3038
  id: "2",
3019
3039
  order: 2,
@@ -3037,7 +3057,7 @@ function pi() {
3037
3057
  }
3038
3058
  );
3039
3059
  }
3040
- const Ae = (E == null ? void 0 : E.message) || ((Le = A == null ? void 0 : A.error) == null ? void 0 : Le.message);
3060
+ const Le = (E == null ? void 0 : E.message) || ((Fe = A == null ? void 0 : A.error) == null ? void 0 : Fe.message);
3041
3061
  return (
3042
3062
  // This is a tricky css, the pt-8 is to make sure the editor doesn't slide under the header
3043
3063
  /* @__PURE__ */ n(
@@ -3047,8 +3067,8 @@ function pi() {
3047
3067
  className: "flex grow flex-col justify-end",
3048
3068
  children: [
3049
3069
  /* @__PURE__ */ n("div", { className: "relative flex grow justify-between overflow-y-scroll", children: [
3050
- $e(),
3051
- ue()
3070
+ ue(),
3071
+ Y()
3052
3072
  ] }),
3053
3073
  /* @__PURE__ */ n(
3054
3074
  "div",
@@ -3061,14 +3081,14 @@ function pi() {
3061
3081
  $,
3062
3082
  {
3063
3083
  title: "Shift + Enter",
3064
- disabled: Q || X,
3084
+ disabled: K || X,
3065
3085
  onClick: () => {
3066
3086
  M();
3067
3087
  },
3068
3088
  className: "shrink-0",
3069
3089
  size: "sm",
3070
3090
  children: [
3071
- Q || X ? /* @__PURE__ */ e(Ve, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(Ws, { className: "mr-2 h-4 w-4" }),
3091
+ K || X ? /* @__PURE__ */ e(qe, { className: "mr-2 h-4 w-4 animate-spin" }) : /* @__PURE__ */ e(Ws, { className: "mr-2 h-4 w-4" }),
3072
3092
  "Run"
3073
3093
  ]
3074
3094
  }
@@ -3077,8 +3097,8 @@ function pi() {
3077
3097
  ai,
3078
3098
  {
3079
3099
  sql: A == null ? void 0 : A.sql,
3080
- error: Ae,
3081
- onClick: Z
3100
+ error: Le,
3101
+ onClick: pe
3082
3102
  }
3083
3103
  ),
3084
3104
  /* @__PURE__ */ n(
@@ -3107,12 +3127,12 @@ function pi() {
3107
3127
  /* @__PURE__ */ e(
3108
3128
  "button",
3109
3129
  {
3110
- disabled: p,
3130
+ disabled: g,
3111
3131
  onClick: () => {
3112
- K(), f(!0);
3132
+ J(), p(!0);
3113
3133
  },
3114
3134
  className: "h-9 w-full cursor-text px-3 text-left text-sm text-muted-foreground",
3115
- children: p ? "" : "Type your question..."
3135
+ children: g ? "" : "Type your question..."
3116
3136
  }
3117
3137
  )
3118
3138
  ] }),
@@ -3120,7 +3140,7 @@ function pi() {
3120
3140
  /* @__PURE__ */ n(
3121
3141
  $,
3122
3142
  {
3123
- onClick: ye,
3143
+ onClick: Me,
3124
3144
  className: "w-full",
3125
3145
  size: "sm",
3126
3146
  variant: "secondary",
@@ -3153,11 +3173,11 @@ function pi() {
3153
3173
  }
3154
3174
  function fi({ data: t }) {
3155
3175
  var r;
3156
- const [s, a] = Ie.useState([]), i = Object.keys(t[0]).map((d) => ({
3176
+ const [s, a] = Oe.useState([]), i = Object.keys(t[0]).map((d) => ({
3157
3177
  // header: key,
3158
3178
  accessorKey: d,
3159
3179
  header: ({ column: u }) => {
3160
- const y = u.getIsSorted();
3180
+ const b = u.getIsSorted();
3161
3181
  return /* @__PURE__ */ e("div", { className: "flex gap-2", children: /* @__PURE__ */ n(
3162
3182
  "div",
3163
3183
  {
@@ -3165,7 +3185,7 @@ function fi({ data: t }) {
3165
3185
  onClick: () => u.toggleSorting(u.getIsSorted() === "asc"),
3166
3186
  children: [
3167
3187
  d,
3168
- y === "asc" ? /* @__PURE__ */ e(Zs, { className: "ml-2 h-5 w-5" }) : y === "desc" ? /* @__PURE__ */ e(Ys, { className: "ml-2 h-5 w-5" }) : null
3188
+ b === "asc" ? /* @__PURE__ */ e(Zs, { className: "ml-2 h-5 w-5" }) : b === "desc" ? /* @__PURE__ */ e(Ys, { className: "ml-2 h-5 w-5" }) : null
3169
3189
  ]
3170
3190
  }
3171
3191
  ) });
@@ -3206,32 +3226,32 @@ function fi({ data: t }) {
3206
3226
  ] }) });
3207
3227
  }
3208
3228
  function gi({ card: t }) {
3209
- var D, N, I, z, q, P, _, U, f, T, B;
3229
+ var D, N, O, z, q, P, _, Q, p, T, B;
3210
3230
  const [s, a] = j(!1), [l, i] = j(
3211
3231
  []
3212
- ), { authToken: o } = Te(), r = rn(o == null ? void 0 : o.accessToken), d = O((V) => V.themeStyle), u = {
3232
+ ), { authToken: o } = Ae(), r = rn(o == null ? void 0 : o.accessToken), d = I((V) => V.themeStyle), u = {
3213
3233
  colors: ((N = (D = d == null ? void 0 : d.chart) == null ? void 0 : D.dataset) == null ? void 0 : N.backgroundColor) || []
3214
3234
  };
3215
- (I = t.customCardPreferences) != null && I.inputData;
3216
- const { getCard: y } = Ra(((z = t.customCardPreferences) == null ? void 0 : z.url) || ""), h = ((q = t.customCardPreferences) == null ? void 0 : q.visualType) || "single", g = m((V) => V.frame), { setCustomCardPreferences: v } = ne(), { data: c } = je(t), p = Qa((V, J) => {
3235
+ (O = t.customCardPreferences) != null && O.inputData;
3236
+ const { getCard: b } = Ra(((z = t.customCardPreferences) == null ? void 0 : z.url) || ""), h = ((q = t.customCardPreferences) == null ? void 0 : q.visualType) || "single", y = m((V) => V.frame), { setCustomCardPreferences: v } = ne(), { data: c } = _e(t), g = Qa((V, G) => {
3217
3237
  i((W) => ({
3218
3238
  ...W,
3219
- [V]: J
3239
+ [V]: G
3220
3240
  }));
3221
3241
  }, []);
3222
3242
  if (!((P = t.customCardPreferences) != null && P.componentName))
3223
3243
  return null;
3224
- const b = y(
3244
+ const f = b(
3225
3245
  (_ = t.customCardPreferences) == null ? void 0 : _.componentName
3226
3246
  );
3227
3247
  function C(V) {
3228
3248
  a(V);
3229
3249
  }
3230
3250
  const x = Object.keys(
3231
- ((U = t.customCardPreferences) == null ? void 0 : U.dataInputCardIds) || {}
3251
+ ((Q = t.customCardPreferences) == null ? void 0 : Q.dataInputCardIds) || {}
3232
3252
  ).map((V) => {
3233
3253
  var S, w, A;
3234
- const J = (w = (S = t.customCardPreferences) == null ? void 0 : S.dataInputCardIds) == null ? void 0 : w[V].cardId, W = (A = g == null ? void 0 : g.cards) == null ? void 0 : A.find((Q) => Q.id === J);
3254
+ const G = (w = (S = t.customCardPreferences) == null ? void 0 : S.dataInputCardIds) == null ? void 0 : w[V].cardId, W = (A = y == null ? void 0 : y.cards) == null ? void 0 : A.find((K) => K.id === G);
3235
3255
  return W || null;
3236
3256
  });
3237
3257
  return /* @__PURE__ */ e("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ n(
@@ -3239,30 +3259,30 @@ function gi({ card: t }) {
3239
3259
  {
3240
3260
  fallback: /* @__PURE__ */ e(se, {}),
3241
3261
  children: [
3242
- b && h === "single" && /* @__PURE__ */ e(
3243
- b,
3262
+ f && h === "single" && /* @__PURE__ */ e(
3263
+ f,
3244
3264
  {
3245
3265
  params: r,
3246
3266
  theme: u,
3247
- settings: (f = t.customCardPreferences) == null ? void 0 : f.settings,
3248
- onDataChange: p,
3267
+ settings: (p = t.customCardPreferences) == null ? void 0 : p.settings,
3268
+ onDataChange: g,
3249
3269
  data: (c == null ? void 0 : c.records) || []
3250
3270
  }
3251
3271
  ),
3252
- b && h === "multiple" && /* @__PURE__ */ n(se, { children: [
3272
+ f && h === "multiple" && /* @__PURE__ */ n(se, { children: [
3253
3273
  Object.keys(
3254
3274
  ((T = t.customCardPreferences) == null ? void 0 : T.dataInputCardIds) || {}
3255
3275
  ).map((V) => {
3256
3276
  var S, w, A;
3257
- const J = (w = (S = t.customCardPreferences) == null ? void 0 : S.dataInputCardIds) == null ? void 0 : w[V].cardId, W = (A = g == null ? void 0 : g.cards) == null ? void 0 : A.find(
3258
- (Q) => Q.id === J
3277
+ const G = (w = (S = t.customCardPreferences) == null ? void 0 : S.dataInputCardIds) == null ? void 0 : w[V].cardId, W = (A = y == null ? void 0 : y.cards) == null ? void 0 : A.find(
3278
+ (K) => K.id === G
3259
3279
  );
3260
3280
  if (W)
3261
3281
  return /* @__PURE__ */ e(
3262
3282
  on,
3263
3283
  {
3264
3284
  onLoadingStatus: C,
3265
- onDataChange: p,
3285
+ onDataChange: g,
3266
3286
  dataInputIndex: V,
3267
3287
  card: W
3268
3288
  },
@@ -3270,14 +3290,14 @@ function gi({ card: t }) {
3270
3290
  );
3271
3291
  }),
3272
3292
  /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e(
3273
- b,
3293
+ f,
3274
3294
  {
3275
3295
  theme: u,
3276
- onDataChange: p,
3296
+ onDataChange: g,
3277
3297
  settings: x.map(
3278
3298
  (V) => {
3279
- var J;
3280
- return (J = V == null ? void 0 : V.customCardPreferences) == null ? void 0 : J.settings;
3299
+ var G;
3300
+ return (G = V == null ? void 0 : V.customCardPreferences) == null ? void 0 : G.settings;
3281
3301
  }
3282
3302
  ),
3283
3303
  data: x.map((V) => V != null && V.id ? l == null ? void 0 : l[V.id] : [])
@@ -3296,9 +3316,9 @@ function ys({
3296
3316
  ...s
3297
3317
  }) {
3298
3318
  var C;
3299
- const a = m((x) => x.card), l = ((C = a.customCardPreferences) == null ? void 0 : C.showCardHeader) ?? !0, i = m((x) => x.frame), o = O((x) => x.dashboard.filters);
3319
+ const a = m((x) => x.card), l = ((C = a.customCardPreferences) == null ? void 0 : C.showCardHeader) ?? !0, i = m((x) => x.frame), o = I((x) => x.dashboard.filters);
3300
3320
  m((x) => x.actions.setRunSql);
3301
- const { updateFilter: r } = Ke(), d = o == null ? void 0 : o.find((x) => x.id === i.filterId), { data: u, isLoading: y, isFetching: h } = je(a), { setCard: g } = ne(), { data: v } = Ft(a);
3321
+ const { updateFilter: r } = Ke(), d = o == null ? void 0 : o.find((x) => x.id === i.filterId), { data: u, isLoading: b, isFetching: h } = _e(a), { setCard: y } = ne(), { data: v } = Ft(a);
3302
3322
  if (!a.id) return null;
3303
3323
  let c;
3304
3324
  u != null && u.records && (u == null ? void 0 : u.records.length) > 0 && (c = ja({
@@ -3309,18 +3329,18 @@ function ys({
3309
3329
  preferences: a.preferences,
3310
3330
  topoJson: v
3311
3331
  }));
3312
- function p(x) {
3332
+ function g(x) {
3313
3333
  return /* @__PURE__ */ e(gi, { card: x });
3314
3334
  }
3315
- function b() {
3335
+ function f() {
3316
3336
  var x;
3317
- if (u != null && u.records && (u == null ? void 0 : u.records.length) === 0 && !y && !h)
3337
+ if (u != null && u.records && (u == null ? void 0 : u.records.length) === 0 && !b && !h)
3318
3338
  return /* @__PURE__ */ n("div", { className: "flex h-full flex-col items-center justify-center gap-2", children: [
3319
3339
  /* @__PURE__ */ e(pn, { className: "size-8 text-muted-foreground" }),
3320
3340
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "No records to display" })
3321
3341
  ] });
3322
3342
  if (a.type === "custom")
3323
- return p(a);
3343
+ return g(a);
3324
3344
  if (!["table", "custom"].includes(a.type) && c)
3325
3345
  return /* @__PURE__ */ e(
3326
3346
  fn,
@@ -3330,7 +3350,7 @@ function ys({
3330
3350
  JSON.stringify(c) + JSON.stringify(a.preferences) + ((x = a == null ? void 0 : a.preferences) == null ? void 0 : x.customVisualCode)
3331
3351
  );
3332
3352
  if (a.type === "table" && (u != null && u.records) && (u == null ? void 0 : u.records.length) > 0)
3333
- return /* @__PURE__ */ n(Oe, { className: "relative mb-2 flex h-full min-h-0 w-full flex-1 grow basis-0", children: [
3353
+ return /* @__PURE__ */ n(Te, { className: "relative mb-2 flex h-full min-h-0 w-full flex-1 grow basis-0", children: [
3334
3354
  /* @__PURE__ */ e(gn, { card: a, data: u == null ? void 0 : u.records }),
3335
3355
  /* @__PURE__ */ e(Ue, { orientation: "horizontal" })
3336
3356
  ] });
@@ -3339,7 +3359,7 @@ function ys({
3339
3359
  cn,
3340
3360
  {
3341
3361
  role: "editor-visual-card",
3342
- className: Y("relative flex h-full flex-col rounded-none", t),
3362
+ className: Z("relative flex h-full flex-col rounded-none", t),
3343
3363
  ...s,
3344
3364
  children: [
3345
3365
  l && /* @__PURE__ */ n(dn, { className: "flex flex-row items-start justify-between py-4", children: [
@@ -3348,7 +3368,7 @@ function ys({
3348
3368
  ot,
3349
3369
  {
3350
3370
  text: a.title,
3351
- onSave: (x) => g({ ...a, title: x }),
3371
+ onSave: (x) => y({ ...a, title: x }),
3352
3372
  children: /* @__PURE__ */ e("div", { className: "flex items-center gap-5", children: /* @__PURE__ */ e(hn, { className: "text-base", children: a.title || "Edit title..." }) })
3353
3373
  },
3354
3374
  a.title
@@ -3357,7 +3377,7 @@ function ys({
3357
3377
  ot,
3358
3378
  {
3359
3379
  text: a.description || "",
3360
- onSave: (x) => g({ ...a, description: x }),
3380
+ onSave: (x) => y({ ...a, description: x }),
3361
3381
  children: /* @__PURE__ */ e(un, { children: a.description || "Edit description..." })
3362
3382
  },
3363
3383
  a.description
@@ -3376,7 +3396,7 @@ function ys({
3376
3396
  /* @__PURE__ */ e(_a, { filter: d })
3377
3397
  ] })
3378
3398
  ] }),
3379
- /* @__PURE__ */ e(mn, { className: "flex grow flex-col", children: b() })
3399
+ /* @__PURE__ */ e(mn, { className: "flex grow flex-col", children: f() })
3380
3400
  ]
3381
3401
  }
3382
3402
  );
@@ -3475,14 +3495,14 @@ const la = ({
3475
3495
  /* @__PURE__ */ e($, { onClick: i, variant: "outline", children: "Close" })
3476
3496
  ] });
3477
3497
  function vi() {
3478
- const [t, s] = j(!1), [a, l] = j(""), [i, o] = j(""), [r, d] = j(""), [u, y] = j(""), h = m((N) => N.card), g = m((N) => N.card.customCfg), { data: v } = je(h), { data: c } = Ft(h), { setCardCustomCfg: p, setCustomVisualCode: b } = ne(), C = (N) => {
3479
- var I, z;
3498
+ const [t, s] = j(!1), [a, l] = j(""), [i, o] = j(""), [r, d] = j(""), [u, b] = j(""), h = m((N) => N.card), y = m((N) => N.card.customCfg), { data: v } = _e(h), { data: c } = Ft(h), { setCardCustomCfg: g, setCustomVisualCode: f } = ne(), C = (N) => {
3499
+ var O, z;
3480
3500
  return JSON.stringify(
3481
3501
  {
3482
3502
  ...N,
3483
3503
  data: {
3484
3504
  ...N.data,
3485
- datasets: (z = (I = N.data) == null ? void 0 : I.datasets) == null ? void 0 : z.map((q) => ({
3505
+ datasets: (z = (O = N.data) == null ? void 0 : O.datasets) == null ? void 0 : z.map((q) => ({
3486
3506
  ...q,
3487
3507
  data: []
3488
3508
  }))
@@ -3494,12 +3514,12 @@ function vi() {
3494
3514
  };
3495
3515
  return /* @__PURE__ */ n(oa, { open: t, onOpenChange: s, children: [
3496
3516
  /* @__PURE__ */ e(ca, { asChild: !0, children: /* @__PURE__ */ e(
3497
- G,
3517
+ U,
3498
3518
  {
3499
3519
  tooltip: "Customize Visual",
3500
3520
  onClick: () => {
3501
- var I, z;
3502
- if (!((I = v == null ? void 0 : v.records) != null && I.length)) return;
3521
+ var O, z;
3522
+ if (!((O = v == null ? void 0 : v.records) != null && O.length)) return;
3503
3523
  const N = ja({
3504
3524
  data: v.records,
3505
3525
  cardType: h.type,
@@ -3509,11 +3529,11 @@ function vi() {
3509
3529
  });
3510
3530
  if (N) {
3511
3531
  l(C(N)), d(((z = h.preferences) == null ? void 0 : z.customVisualCode) || "");
3512
- const q = bn(N, g);
3532
+ const q = bn(N, y);
3513
3533
  o(C(q));
3514
3534
  }
3515
3535
  },
3516
- className: g ? "text-green-600 hover:text-green-700" : "",
3536
+ className: y ? "text-green-600 hover:text-green-700" : "",
3517
3537
  children: /* @__PURE__ */ e(yn, { className: "h-4 w-4" })
3518
3538
  }
3519
3539
  ) }),
@@ -3535,23 +3555,23 @@ function vi() {
3535
3555
  xi,
3536
3556
  {
3537
3557
  error: u,
3538
- hasCustomConfig: !!g,
3558
+ hasCustomConfig: !!y,
3539
3559
  onReset: () => {
3540
- o(a), p(null);
3560
+ o(a), g(null);
3541
3561
  },
3542
3562
  onApply: () => {
3543
3563
  try {
3544
- if (r && b(r), i) {
3564
+ if (r && f(r), i) {
3545
3565
  const N = JSON.parse(
3546
3566
  i
3547
- ), I = xn(
3567
+ ), O = xn(
3548
3568
  JSON.parse(a),
3549
3569
  N
3550
3570
  );
3551
- p(I), y("");
3571
+ g(O), b("");
3552
3572
  }
3553
3573
  } catch {
3554
- y("Invalid JSON configuration");
3574
+ b("Invalid JSON configuration");
3555
3575
  }
3556
3576
  },
3557
3577
  onClose: () => s(!1)
@@ -3580,7 +3600,7 @@ function Cs(t) {
3580
3600
  return s;
3581
3601
  }
3582
3602
  function Ss() {
3583
- const { authToken: t } = Te(), { data: s, isLoading: a, isFetching: l, isError: i } = Me({
3603
+ const { authToken: t } = Ae(), { data: s, isLoading: a, isFetching: l, isError: i } = De({
3584
3604
  queryKey: ["plugins", t == null ? void 0 : t.accessToken],
3585
3605
  queryFn: () => vn(t == null ? void 0 : t.accessToken)
3586
3606
  // staleTime: Infinity,
@@ -3596,9 +3616,9 @@ function Ci({
3596
3616
  var o;
3597
3617
  if (l) {
3598
3618
  const d = (await Promise.all(
3599
- (o = l == null ? void 0 : l.plugins) == null ? void 0 : o.map(async (u) => (await Nn(u.value)).visuals.map((g) => ({
3600
- name: g.name,
3601
- icon: g.icon,
3619
+ (o = l == null ? void 0 : l.plugins) == null ? void 0 : o.map(async (u) => (await Nn(u.value)).visuals.map((y) => ({
3620
+ name: y.name,
3621
+ icon: y.icon,
3602
3622
  url: u.value
3603
3623
  })))
3604
3624
  )).flat();
@@ -3627,24 +3647,24 @@ const Si = ({
3627
3647
  return /* @__PURE__ */ e($, { onClick: a, title: t, variant: "ghost", children: l ? /* @__PURE__ */ e(l, { className: "h-4 w-4" }) : i });
3628
3648
  };
3629
3649
  function wi() {
3630
- var g, v;
3631
- const [t, s] = j(!1), a = m((c) => c.card), l = a.type, i = O((c) => c.isVisualEditing), { setCardType: o, setCardPreferences: r, setChartOrientation: d } = m((c) => c.actions), { setCardCustomCfg: u, setCustomCardPreferences: y } = ne();
3632
- function h(c, p) {
3633
- u(null), r({}), o(c), p && y({
3650
+ var y, v;
3651
+ const [t, s] = j(!1), a = m((c) => c.card), l = a.type, i = I((c) => c.isVisualEditing), { setCardType: o, setCardPreferences: r, setChartOrientation: d } = m((c) => c.actions), { setCardCustomCfg: u, setCustomCardPreferences: b } = ne();
3652
+ function h(c, g) {
3653
+ u(null), r({}), o(c), g && b({
3634
3654
  type: "component",
3635
3655
  visualType: "single",
3636
- url: p.url,
3637
- componentName: p.name,
3638
- icon: p.icon
3656
+ url: g.url,
3657
+ componentName: g.name,
3658
+ icon: g.icon
3639
3659
  }), s(!1);
3640
3660
  }
3641
- return /* @__PURE__ */ n(qe, { open: t, onOpenChange: s, children: [
3642
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ e($, { size: "sm", variant: i ? "ghost" : "outline", children: /* @__PURE__ */ e(
3661
+ return /* @__PURE__ */ n(Re, { open: t, onOpenChange: s, children: [
3662
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e($, { size: "sm", variant: i ? "ghost" : "outline", children: /* @__PURE__ */ e(
3643
3663
  ki,
3644
3664
  {
3645
3665
  className: "size-4",
3646
3666
  chartType: l,
3647
- customIcon: (g = a.customCardPreferences) == null ? void 0 : g.icon,
3667
+ customIcon: (y = a.customCardPreferences) == null ? void 0 : y.icon,
3648
3668
  componentName: (v = a.customCardPreferences) == null ? void 0 : v.componentName
3649
3669
  }
3650
3670
  ) }) }),
@@ -3656,7 +3676,7 @@ function wi() {
3656
3676
  children: [
3657
3677
  /* @__PURE__ */ n("div", { className: "grid grid-cols-4 place-items-center", children: [
3658
3678
  /* @__PURE__ */ e(
3659
- G,
3679
+ U,
3660
3680
  {
3661
3681
  tooltip: "Bar Chart",
3662
3682
  onClick: () => h("bar"),
@@ -3665,7 +3685,7 @@ function wi() {
3665
3685
  }
3666
3686
  ),
3667
3687
  /* @__PURE__ */ e(
3668
- G,
3688
+ U,
3669
3689
  {
3670
3690
  tooltip: "Line Chart",
3671
3691
  onClick: () => h("line"),
@@ -3674,7 +3694,7 @@ function wi() {
3674
3694
  }
3675
3695
  ),
3676
3696
  /* @__PURE__ */ e(
3677
- G,
3697
+ U,
3678
3698
  {
3679
3699
  tooltip: "Stacked Bar Chart",
3680
3700
  onClick: () => h("stackedBar"),
@@ -3683,7 +3703,7 @@ function wi() {
3683
3703
  }
3684
3704
  ),
3685
3705
  /* @__PURE__ */ e(
3686
- G,
3706
+ U,
3687
3707
  {
3688
3708
  tooltip: "Stacked Line Chart",
3689
3709
  onClick: () => h("stackedLine"),
@@ -3692,7 +3712,7 @@ function wi() {
3692
3712
  }
3693
3713
  ),
3694
3714
  /* @__PURE__ */ e(
3695
- G,
3715
+ U,
3696
3716
  {
3697
3717
  tooltip: "Scatter Chart",
3698
3718
  onClick: () => h("scatter"),
@@ -3701,7 +3721,7 @@ function wi() {
3701
3721
  }
3702
3722
  ),
3703
3723
  /* @__PURE__ */ e(
3704
- G,
3724
+ U,
3705
3725
  {
3706
3726
  tooltip: "Bubble Chart",
3707
3727
  onClick: () => h("bubble"),
@@ -3710,7 +3730,7 @@ function wi() {
3710
3730
  }
3711
3731
  ),
3712
3732
  /* @__PURE__ */ e(
3713
- G,
3733
+ U,
3714
3734
  {
3715
3735
  tooltip: "Pie Chart",
3716
3736
  onClick: () => h("pie"),
@@ -3719,7 +3739,7 @@ function wi() {
3719
3739
  }
3720
3740
  ),
3721
3741
  /* @__PURE__ */ e(
3722
- G,
3742
+ U,
3723
3743
  {
3724
3744
  tooltip: "Doughnut Chart",
3725
3745
  onClick: () => h("doughnut"),
@@ -3728,7 +3748,7 @@ function wi() {
3728
3748
  }
3729
3749
  ),
3730
3750
  /* @__PURE__ */ e(
3731
- G,
3751
+ U,
3732
3752
  {
3733
3753
  tooltip: "Radar Chart",
3734
3754
  onClick: () => h("radar"),
@@ -3737,7 +3757,7 @@ function wi() {
3737
3757
  }
3738
3758
  ),
3739
3759
  /* @__PURE__ */ e(
3740
- G,
3760
+ U,
3741
3761
  {
3742
3762
  tooltip: "Polar Area Chart",
3743
3763
  onClick: () => h("polarArea"),
@@ -3746,7 +3766,7 @@ function wi() {
3746
3766
  }
3747
3767
  ),
3748
3768
  /* @__PURE__ */ e(
3749
- G,
3769
+ U,
3750
3770
  {
3751
3771
  tooltip: "Pyramid Chart",
3752
3772
  onClick: () => h("pyramid"),
@@ -3755,7 +3775,7 @@ function wi() {
3755
3775
  }
3756
3776
  ),
3757
3777
  /* @__PURE__ */ e(
3758
- G,
3778
+ U,
3759
3779
  {
3760
3780
  tooltip: "Range Chart",
3761
3781
  onClick: () => h("range"),
@@ -3764,7 +3784,7 @@ function wi() {
3764
3784
  }
3765
3785
  ),
3766
3786
  /* @__PURE__ */ e(
3767
- G,
3787
+ U,
3768
3788
  {
3769
3789
  tooltip: "Table",
3770
3790
  onClick: () => h("table"),
@@ -3773,7 +3793,7 @@ function wi() {
3773
3793
  }
3774
3794
  ),
3775
3795
  /* @__PURE__ */ e(
3776
- G,
3796
+ U,
3777
3797
  {
3778
3798
  tooltip: "KPI",
3779
3799
  onClick: () => h("kpi"),
@@ -3782,7 +3802,7 @@ function wi() {
3782
3802
  }
3783
3803
  ),
3784
3804
  /* @__PURE__ */ e(
3785
- G,
3805
+ U,
3786
3806
  {
3787
3807
  tooltip: "Text",
3788
3808
  onClick: () => h("text"),
@@ -3791,7 +3811,7 @@ function wi() {
3791
3811
  }
3792
3812
  ),
3793
3813
  /* @__PURE__ */ e(
3794
- G,
3814
+ U,
3795
3815
  {
3796
3816
  tooltip: "Map",
3797
3817
  onClick: () => h("map"),
@@ -3800,7 +3820,7 @@ function wi() {
3800
3820
  }
3801
3821
  ),
3802
3822
  /* @__PURE__ */ e(
3803
- G,
3823
+ U,
3804
3824
  {
3805
3825
  tooltip: "Custom",
3806
3826
  onClick: () => h("custom"),
@@ -3866,7 +3886,7 @@ function ia(t, s) {
3866
3886
  return ((o = (i = (l = t == null ? void 0 : t.chartOptions) == null ? void 0 : l.scales) == null ? void 0 : i[a]) == null ? void 0 : o.type) || "linear";
3867
3887
  }
3868
3888
  function Mi() {
3869
- var S, w, A, Q, X, le;
3889
+ var S, w, A, K, X, ie;
3870
3890
  const [t, s] = j(!1), a = m((R) => {
3871
3891
  var E;
3872
3892
  return (E = R.card) == null ? void 0 : E.preferences;
@@ -3877,21 +3897,21 @@ function Mi() {
3877
3897
  ia(a)
3878
3898
  ), [d, u] = j(
3879
3899
  ((A = (w = (S = a == null ? void 0 : a.chartOptions) == null ? void 0 : S.scales) == null ? void 0 : w[i]) == null ? void 0 : A.min) || ""
3880
- ), [y, h] = j(
3881
- ((le = (X = (Q = a == null ? void 0 : a.chartOptions) == null ? void 0 : Q.scales) == null ? void 0 : X[i]) == null ? void 0 : le.max) || ""
3882
- ), [g, v] = j(d || y ? "custom" : "auto"), [c, p] = j(""), [b, C] = j(0), [x, D] = j(""), [N, I] = j(""), [z, q] = j(""), P = m(
3900
+ ), [b, h] = j(
3901
+ ((ie = (X = (K = a == null ? void 0 : a.chartOptions) == null ? void 0 : K.scales) == null ? void 0 : X[i]) == null ? void 0 : ie.max) || ""
3902
+ ), [y, v] = j(d || b ? "custom" : "auto"), [c, g] = j(""), [f, C] = j(0), [x, D] = j(""), [N, O] = j(""), [z, q] = j(""), P = m(
3883
3903
  (R) => R.actions.setCardPreferences
3884
- ), { updateCardInFrame: _ } = ne(), U = m((R) => R.card), f = m((R) => {
3904
+ ), { updateCardInFrame: _ } = ne(), Q = m((R) => R.card), p = m((R) => {
3885
3905
  var E;
3886
3906
  return (E = R.card) == null ? void 0 : E.type;
3887
- }), T = ["pie", "doughnut", "polarArea"].includes(f);
3907
+ }), T = ["pie", "doughnut", "polarArea"].includes(p);
3888
3908
  oe(() => {
3889
- var R, E, re, M, K, he, ce, ke, ye, Z, ue, $e, Ae, Le;
3909
+ var R, E, re, M, J, he, ce, ke, Me, pe, Y, ue, Le, Fe;
3890
3910
  r(ia(a)), u(
3891
3911
  ((re = (E = (R = a == null ? void 0 : a.chartOptions) == null ? void 0 : R.scales) == null ? void 0 : E[i]) == null ? void 0 : re.min) === 0 ? 0 : ""
3892
- ), h(((he = (K = (M = a == null ? void 0 : a.chartOptions) == null ? void 0 : M.scales) == null ? void 0 : K[i]) == null ? void 0 : he.max) || ""), p(
3893
- ((Z = (ye = (ke = (ce = a == null ? void 0 : a.chartOptions) == null ? void 0 : ce.scales) == null ? void 0 : ke[i]) == null ? void 0 : ye.ticks) == null ? void 0 : Z.stepSize) || ""
3894
- ), C(((ue = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ue.decimalPlaces) || 0), D((($e = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : $e.suffix) || ""), I(((Ae = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Ae.currency) || ""), q(((Le = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Le.locale) || "");
3912
+ ), h(((he = (J = (M = a == null ? void 0 : a.chartOptions) == null ? void 0 : M.scales) == null ? void 0 : J[i]) == null ? void 0 : he.max) || ""), g(
3913
+ ((pe = (Me = (ke = (ce = a == null ? void 0 : a.chartOptions) == null ? void 0 : ce.scales) == null ? void 0 : ke[i]) == null ? void 0 : Me.ticks) == null ? void 0 : pe.stepSize) || ""
3914
+ ), C(((Y = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Y.decimalPlaces) || 0), D(((ue = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ue.suffix) || ""), O(((Le = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Le.currency) || ""), q(((Fe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Fe.locale) || "");
3895
3915
  }, [t, a, i]);
3896
3916
  function B(R, E) {
3897
3917
  return E === "" || /^[0-9\b]+$/.test(E) ? Number(E) : Number(R);
@@ -3921,13 +3941,13 @@ function Mi() {
3921
3941
  xe,
3922
3942
  {
3923
3943
  value: N || "none",
3924
- onValueChange: (E) => I(E === "none" ? "" : E),
3944
+ onValueChange: (E) => O(E === "none" ? "" : E),
3925
3945
  children: [
3926
3946
  /* @__PURE__ */ e(ve, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, {}) }),
3927
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
3947
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
3928
3948
  /* @__PURE__ */ e(Se, { children: "Currency" }),
3929
- /* @__PURE__ */ e(ie, { value: "none", children: "None" }),
3930
- R.map((E) => /* @__PURE__ */ e(ie, { value: E, children: E }, E))
3949
+ /* @__PURE__ */ e(le, { value: "none", children: "None" }),
3950
+ R.map((E) => /* @__PURE__ */ e(le, { value: E, children: E }, E))
3931
3951
  ] }) })
3932
3952
  ]
3933
3953
  }
@@ -3940,9 +3960,9 @@ function Mi() {
3940
3960
  children: /* @__PURE__ */ e(Ne, {})
3941
3961
  }
3942
3962
  ),
3943
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
3963
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
3944
3964
  /* @__PURE__ */ e(Se, { children: "Locale" }),
3945
- ht.map((E) => /* @__PURE__ */ e(ie, { value: E.locale, children: E.locale }, E.locale))
3965
+ ht.map((E) => /* @__PURE__ */ e(le, { value: E.locale, children: E.locale }, E.locale))
3946
3966
  ] }) })
3947
3967
  ] })
3948
3968
  ] }),
@@ -3951,7 +3971,7 @@ function Mi() {
3951
3971
  /* @__PURE__ */ e(
3952
3972
  de,
3953
3973
  {
3954
- value: b,
3974
+ value: f,
3955
3975
  onChange: (E) => C(Number(E.target.value)),
3956
3976
  id: "format",
3957
3977
  className: `col-span-6 h-8 w-full tracking-wide ${it}`
@@ -3960,7 +3980,7 @@ function Mi() {
3960
3980
  ] })
3961
3981
  ] });
3962
3982
  }
3963
- function J() {
3983
+ function G() {
3964
3984
  return /* @__PURE__ */ n(se, { children: [
3965
3985
  /* @__PURE__ */ n("div", { className: "grid grid-cols-3 items-center gap-2", children: [
3966
3986
  /* @__PURE__ */ e(H, { htmlFor: "range", children: "Range" }),
@@ -3976,7 +3996,7 @@ function Mi() {
3976
3996
  /* @__PURE__ */ e(
3977
3997
  de,
3978
3998
  {
3979
- value: y,
3999
+ value: b,
3980
4000
  onChange: (R) => h((E) => B(E, R.target.value)),
3981
4001
  id: "max",
3982
4002
  className: `col-span-1 h-8 w-full ${it}`
@@ -3989,7 +4009,7 @@ function Mi() {
3989
4009
  de,
3990
4010
  {
3991
4011
  value: c,
3992
- onChange: (R) => p((E) => B(E, R.target.value)),
4012
+ onChange: (R) => g((E) => B(E, R.target.value)),
3993
4013
  id: "step-size",
3994
4014
  className: `col-span-1 h-8 w-full ${it}`
3995
4015
  }
@@ -4000,9 +4020,9 @@ function Mi() {
4000
4020
  function W() {
4001
4021
  var M;
4002
4022
  let R = {};
4003
- g === "custom" && (R = {
4023
+ y === "custom" && (R = {
4004
4024
  min: d,
4005
- max: y,
4025
+ max: b,
4006
4026
  ticks: {
4007
4027
  stepSize: c
4008
4028
  }
@@ -4021,7 +4041,7 @@ function Mi() {
4021
4041
  }
4022
4042
  },
4023
4043
  numberAxisFormat: {
4024
- decimalPlaces: b,
4044
+ decimalPlaces: f,
4025
4045
  suffix: x,
4026
4046
  currency: N,
4027
4047
  locale: z
@@ -4029,13 +4049,13 @@ function Mi() {
4029
4049
  };
4030
4050
  console.log(E), P(E);
4031
4051
  const re = {
4032
- ...U,
4052
+ ...Q,
4033
4053
  preferences: E
4034
4054
  };
4035
4055
  _(re);
4036
4056
  }
4037
- return /* @__PURE__ */ n(qe, { onOpenChange: (R) => s(R), children: [
4038
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ e(G, { tooltip: "Scale Options", children: /* @__PURE__ */ e(Ll, { className: "size-4 rotate-45" }) }) }),
4057
+ return /* @__PURE__ */ n(Re, { onOpenChange: (R) => s(R), children: [
4058
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(U, { tooltip: "Scale Options", children: /* @__PURE__ */ e(Ll, { className: "size-4 rotate-45" }) }) }),
4039
4059
  /* @__PURE__ */ e(Et, { align: "center", className: "max-w-65", children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
4040
4060
  /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4041
4061
  /* @__PURE__ */ e("h4", { className: "font-medium leading-none", children: "Scale Options" }),
@@ -4052,10 +4072,10 @@ function Mi() {
4052
4072
  onValueChange: (R) => r(R),
4053
4073
  children: [
4054
4074
  /* @__PURE__ */ e(ve, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, {}) }),
4055
- /* @__PURE__ */ e(Ce, { id: "type", children: /* @__PURE__ */ n(ze, { children: [
4075
+ /* @__PURE__ */ e(Ce, { id: "type", children: /* @__PURE__ */ n(Ie, { children: [
4056
4076
  /* @__PURE__ */ e(Se, { children: "Option" }),
4057
- /* @__PURE__ */ e(ie, { value: "linear", children: "Linear" }),
4058
- /* @__PURE__ */ e(ie, { value: "logarithmic", children: "Logarithmic" })
4077
+ /* @__PURE__ */ e(le, { value: "linear", children: "Linear" }),
4078
+ /* @__PURE__ */ e(le, { value: "logarithmic", children: "Logarithmic" })
4059
4079
  ] }) })
4060
4080
  ]
4061
4081
  }
@@ -4068,7 +4088,7 @@ function Mi() {
4068
4088
  {
4069
4089
  disabled: T,
4070
4090
  id: "scale-option",
4071
- value: g,
4091
+ value: y,
4072
4092
  onValueChange: (R) => v(R),
4073
4093
  className: "col-span-2 flex gap-3",
4074
4094
  defaultValue: "x",
@@ -4085,7 +4105,7 @@ function Mi() {
4085
4105
  }
4086
4106
  )
4087
4107
  ] }),
4088
- g === "custom" && o == "linear" && J(),
4108
+ y === "custom" && o == "linear" && G(),
4089
4109
  V(),
4090
4110
  /* @__PURE__ */ e(Cn, {}),
4091
4111
  /* @__PURE__ */ e("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e(
@@ -4104,18 +4124,18 @@ function Mi() {
4104
4124
  function Di() {
4105
4125
  const t = m(
4106
4126
  (d) => {
4107
- var u, y, h, g;
4108
- return (g = (h = (y = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : y.plugins) == null ? void 0 : h.legend) == null ? void 0 : g.position;
4127
+ var u, b, h, y;
4128
+ return (y = (h = (b = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : b.plugins) == null ? void 0 : h.legend) == null ? void 0 : y.position;
4109
4129
  }
4110
4130
  ), s = m(
4111
4131
  (d) => {
4112
- var u, y, h, g;
4113
- return (g = (h = (y = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : y.plugins) == null ? void 0 : h.legend) == null ? void 0 : g.align;
4132
+ var u, b, h, y;
4133
+ return (y = (h = (b = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : b.plugins) == null ? void 0 : h.legend) == null ? void 0 : y.align;
4114
4134
  }
4115
4135
  ), a = m(
4116
4136
  (d) => {
4117
- var u, y, h, g;
4118
- return (g = (h = (y = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : y.plugins) == null ? void 0 : h.legend) == null ? void 0 : g.display;
4137
+ var u, b, h, y;
4138
+ return (y = (h = (b = (u = d.card.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : b.plugins) == null ? void 0 : h.legend) == null ? void 0 : y.display;
4119
4139
  }
4120
4140
  ), { setLegendOptions: l } = ne(), i = (d) => {
4121
4141
  l({
@@ -4136,8 +4156,8 @@ function Di() {
4136
4156
  align: d
4137
4157
  });
4138
4158
  };
4139
- return /* @__PURE__ */ n(qe, { children: [
4140
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ e(G, { tooltip: "Legend Settings", children: /* @__PURE__ */ e(Nl, { className: "size-4" }) }) }),
4159
+ return /* @__PURE__ */ n(Re, { children: [
4160
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ e(U, { tooltip: "Legend Settings", children: /* @__PURE__ */ e(Nl, { className: "size-4" }) }) }),
4141
4161
  /* @__PURE__ */ e(Et, { className: "w-72", children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
4142
4162
  /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4143
4163
  /* @__PURE__ */ e("h4", { className: "font-medium leading-none", children: "Legend Options" }),
@@ -4160,7 +4180,7 @@ function Di() {
4160
4180
  /* @__PURE__ */ e(H, { htmlFor: "position", children: "Position" }),
4161
4181
  /* @__PURE__ */ n("div", { className: "col-span-2 flex h-8 items-center", children: [
4162
4182
  /* @__PURE__ */ e(
4163
- G,
4183
+ U,
4164
4184
  {
4165
4185
  tooltip: "Top",
4166
4186
  onClick: () => o("top"),
@@ -4168,7 +4188,7 @@ function Di() {
4168
4188
  }
4169
4189
  ),
4170
4190
  /* @__PURE__ */ e(
4171
- G,
4191
+ U,
4172
4192
  {
4173
4193
  tooltip: "Left",
4174
4194
  onClick: () => o("left"),
@@ -4176,7 +4196,7 @@ function Di() {
4176
4196
  }
4177
4197
  ),
4178
4198
  /* @__PURE__ */ e(
4179
- G,
4199
+ U,
4180
4200
  {
4181
4201
  tooltip: "Bottom",
4182
4202
  onClick: () => o("bottom"),
@@ -4184,7 +4204,7 @@ function Di() {
4184
4204
  }
4185
4205
  ),
4186
4206
  /* @__PURE__ */ e(
4187
- G,
4207
+ U,
4188
4208
  {
4189
4209
  tooltip: "Right",
4190
4210
  onClick: () => o("right"),
@@ -4197,7 +4217,7 @@ function Di() {
4197
4217
  /* @__PURE__ */ e(H, { htmlFor: "align", children: "Align" }),
4198
4218
  /* @__PURE__ */ n("div", { className: "col-span-2 flex h-8 items-center", children: [
4199
4219
  /* @__PURE__ */ e(
4200
- G,
4220
+ U,
4201
4221
  {
4202
4222
  tooltip: "Start",
4203
4223
  onClick: () => r("start"),
@@ -4205,7 +4225,7 @@ function Di() {
4205
4225
  }
4206
4226
  ),
4207
4227
  /* @__PURE__ */ e(
4208
- G,
4228
+ U,
4209
4229
  {
4210
4230
  tooltip: "Center",
4211
4231
  onClick: () => r("center"),
@@ -4213,7 +4233,7 @@ function Di() {
4213
4233
  }
4214
4234
  ),
4215
4235
  /* @__PURE__ */ e(
4216
- G,
4236
+ U,
4217
4237
  {
4218
4238
  tooltip: "End",
4219
4239
  onClick: () => r("end"),
@@ -4227,7 +4247,7 @@ function Di() {
4227
4247
  ] });
4228
4248
  }
4229
4249
  function zi() {
4230
- var d, u, y;
4250
+ var d, u, b;
4231
4251
  const t = m((h) => h.card.preferences), s = m(
4232
4252
  (h) => h.card.cfg
4233
4253
  ), { setCardCfg: a, setCardPreferences: l, setChartOrientation: i } = m((h) => h.actions);
@@ -4235,9 +4255,9 @@ function zi() {
4235
4255
  function o(h) {
4236
4256
  i(h);
4237
4257
  }
4238
- const r = ((u = t == null ? void 0 : t.chartOptions) == null ? void 0 : u.indexAxis) || ((y = s == null ? void 0 : s.options) == null ? void 0 : y.indexAxis) || "x";
4258
+ const r = ((u = t == null ? void 0 : t.chartOptions) == null ? void 0 : u.indexAxis) || ((b = s == null ? void 0 : s.options) == null ? void 0 : b.indexAxis) || "x";
4239
4259
  return /* @__PURE__ */ e(
4240
- G,
4260
+ U,
4241
4261
  {
4242
4262
  onClick: () => o(r === "y" ? "x" : "y"),
4243
4263
  tooltip: "Chart Orientation",
@@ -4279,7 +4299,7 @@ function Ii() {
4279
4299
  "kpi",
4280
4300
  "text",
4281
4301
  "map"
4282
- ].includes(t.type) && /* @__PURE__ */ n(G, { tooltip: "Grid Style", onClick: o, children: [
4302
+ ].includes(t.type) && /* @__PURE__ */ n(U, { tooltip: "Grid Style", onClick: o, children: [
4283
4303
  (l === "xy" || !l) && /* @__PURE__ */ e(yl, { className: "size-4" }),
4284
4304
  l === "x" && /* @__PURE__ */ e(dl, { className: "size-4" }),
4285
4305
  l === "y" && /* @__PURE__ */ e(Al, { className: "size-4" }),
@@ -4289,7 +4309,7 @@ function Ii() {
4289
4309
  }
4290
4310
  function ra() {
4291
4311
  var W;
4292
- const t = m((S) => S.frame), s = m((S) => S.card), a = m((S) => S.isShowingVisual), l = O((S) => S.isVisualEditing), i = m((S) => S.isSqlRunning), o = m((S) => S.pythonStdOut), r = m(
4312
+ const t = m((S) => S.frame), s = m((S) => S.card), a = m((S) => S.isShowingVisual), l = I((S) => S.isVisualEditing), i = m((S) => S.isSqlRunning), o = m((S) => S.pythonStdOut), r = m(
4293
4313
  (S) => {
4294
4314
  var w;
4295
4315
  return (w = S.card.preferences) == null ? void 0 : w.chartOptions;
@@ -4299,11 +4319,11 @@ function ra() {
4299
4319
  const {
4300
4320
  setFrame: d,
4301
4321
  setCard: u,
4302
- updateCardInFrame: y,
4322
+ updateCardInFrame: b,
4303
4323
  setActiveTabCardId: h,
4304
- runAssistant: g,
4324
+ runAssistant: y,
4305
4325
  setChartGrid: v
4306
- } = ne(), { data: c, isLoading: p, isFetching: b, error: C } = je(s);
4326
+ } = ne(), { data: c, isLoading: g, isFetching: f, error: C } = _e(s);
4307
4327
  if (!s) return /* @__PURE__ */ e(se, { children: "No Active Card" });
4308
4328
  function x() {
4309
4329
  const S = {
@@ -4342,14 +4362,14 @@ function ra() {
4342
4362
  };
4343
4363
  D(S);
4344
4364
  }
4345
- function I(S) {
4346
- const w = t.cards.filter((X) => X.id !== S), A = w[0], Q = {
4365
+ function O(S) {
4366
+ const w = t.cards.filter((X) => X.id !== S), A = w[0], K = {
4347
4367
  ...t,
4348
4368
  cards: w,
4349
4369
  // update the active card to the first card in the frame
4350
4370
  activeCardId: A.id
4351
4371
  };
4352
- d(Q), h(A.id), u(A);
4372
+ d(K), h(A.id), u(A);
4353
4373
  }
4354
4374
  function z(S) {
4355
4375
  h(S);
@@ -4361,16 +4381,16 @@ function ra() {
4361
4381
  }, _ = (S, w) => {
4362
4382
  const A = S.dataTransfer.getData("tabIndex");
4363
4383
  if (A === w.toString()) return;
4364
- const Q = Array.from(t.cards), [X] = Q.splice(parseInt(A), 1);
4365
- Q.splice(w, 0, X), d({ ...t, cards: Q });
4384
+ const K = Array.from(t.cards), [X] = K.splice(parseInt(A), 1);
4385
+ K.splice(w, 0, X), d({ ...t, cards: K });
4366
4386
  };
4367
- function U(S, w) {
4387
+ function Q(S, w) {
4368
4388
  return S.cards.length === 1 && (w.displayTab === !0 || w.displayTab === void 0) || S.activeCardId !== w.id && (w.displayTab === !0 || w.displayTab === void 0) ? null : /* @__PURE__ */ e(
4369
4389
  "div",
4370
4390
  {
4371
4391
  onClick: () => {
4372
4392
  const A = w.displayTab === void 0 ? !1 : !w.displayTab;
4373
- u({ ...w, displayTab: A }), y({
4393
+ u({ ...w, displayTab: A }), b({
4374
4394
  ...w,
4375
4395
  displayTab: A
4376
4396
  });
@@ -4379,7 +4399,7 @@ function ra() {
4379
4399
  }
4380
4400
  );
4381
4401
  }
4382
- function f() {
4402
+ function p() {
4383
4403
  return /* @__PURE__ */ n(
4384
4404
  Pa,
4385
4405
  {
@@ -4394,7 +4414,7 @@ function ra() {
4394
4414
  {
4395
4415
  text: S.tabTitle || S.title,
4396
4416
  onSave: (A) => {
4397
- u({ ...s, tabTitle: A }), y({ ...s, tabTitle: A });
4417
+ u({ ...s, tabTitle: A }), b({ ...s, tabTitle: A });
4398
4418
  },
4399
4419
  children: /* @__PURE__ */ n(
4400
4420
  Dt,
@@ -4406,13 +4426,13 @@ function ra() {
4406
4426
  className: "",
4407
4427
  value: S.id,
4408
4428
  children: [
4409
- U(t, S),
4429
+ Q(t, S),
4410
4430
  S.tabTitle || S.title,
4411
4431
  t.activeCardId === S.id && t.cards.length > 1 && /* @__PURE__ */ e(
4412
4432
  Ge,
4413
4433
  {
4414
4434
  className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
4415
- onClick: () => I(S.id)
4435
+ onClick: () => O(S.id)
4416
4436
  }
4417
4437
  )
4418
4438
  ]
@@ -4445,7 +4465,7 @@ function ra() {
4445
4465
  );
4446
4466
  }
4447
4467
  function T() {
4448
- return s.type === "kpi" ? /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e(kn, { card: s, data: c == null ? void 0 : c.records }) }) }) : s.type === "text" ? /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e(Oe, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e(
4468
+ return s.type === "kpi" ? /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e(kn, { card: s, data: c == null ? void 0 : c.records }) }) }) : s.type === "text" ? /* @__PURE__ */ e("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e(Te, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e(
4449
4469
  Mn,
4450
4470
  {
4451
4471
  isLoading: i,
@@ -4455,29 +4475,29 @@ function ra() {
4455
4475
  ) }) }) }) : /* @__PURE__ */ e(vt, { FallbackComponent: Ha, children: /* @__PURE__ */ e(ys, { className: "grow border-none shadow-none" }) });
4456
4476
  }
4457
4477
  function B() {
4458
- const S = JSON.stringify(c == null ? void 0 : c.records, null, 2), w = new Blob([S], { type: "application/json" }), A = URL.createObjectURL(w), Q = document.createElement("a");
4459
- Q.href = A, Q.download = `${s.title}.json`, Q.click();
4478
+ const S = JSON.stringify(c == null ? void 0 : c.records, null, 2), w = new Blob([S], { type: "application/json" }), A = URL.createObjectURL(w), K = document.createElement("a");
4479
+ K.href = A, K.download = `${s.title}.json`, K.click();
4460
4480
  }
4461
4481
  function V() {
4462
4482
  const w = [
4463
4483
  Object.keys(
4464
- c == null ? void 0 : c.records.reduce((le, R) => ({ ...le, ...R }), {})
4484
+ c == null ? void 0 : c.records.reduce((ie, R) => ({ ...ie, ...R }), {})
4465
4485
  ).join(","),
4466
- ...((c == null ? void 0 : c.records) || []).map((le) => Object.values(le).join(","))
4486
+ ...((c == null ? void 0 : c.records) || []).map((ie) => Object.values(ie).join(","))
4467
4487
  ].join(`
4468
- `), A = new Blob([w], { type: "text/csv" }), Q = URL.createObjectURL(A), X = document.createElement("a");
4469
- X.href = Q, X.download = `${s.title}.csv`, X.click();
4488
+ `), A = new Blob([w], { type: "text/csv" }), K = URL.createObjectURL(A), X = document.createElement("a");
4489
+ X.href = K, X.download = `${s.title}.csv`, X.click();
4470
4490
  }
4471
- function J() {
4491
+ function G() {
4472
4492
  const S = `Can you get the documentation for ${s.type} chart?`;
4473
- g(S);
4493
+ y(S);
4474
4494
  }
4475
4495
  return /* @__PURE__ */ n(
4476
4496
  "div",
4477
4497
  {
4478
4498
  className: "relative isolate flex h-full flex-col py-3",
4479
4499
  children: [
4480
- (p || b) && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto flex h-10 w-10 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ e(Ve, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }),
4500
+ (g || f) && /* @__PURE__ */ e("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto flex h-10 w-10 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ e(qe, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }),
4481
4501
  /* @__PURE__ */ n(
4482
4502
  "div",
4483
4503
  {
@@ -4485,7 +4505,7 @@ function ra() {
4485
4505
  children: [
4486
4506
  a && /* @__PURE__ */ n("div", { className: "flex grow items-center", children: [
4487
4507
  /* @__PURE__ */ e(wi, {}),
4488
- l && /* @__PURE__ */ e(G, { tooltip: "Visual Docs", onClick: J, children: /* @__PURE__ */ e(sl, { className: "size-4" }) }),
4508
+ l && /* @__PURE__ */ e(U, { tooltip: "Visual Docs", onClick: G, children: /* @__PURE__ */ e(sl, { className: "size-4" }) }),
4489
4509
  !["table", "custom"].includes(s.type) && l && /* @__PURE__ */ e(vi, {})
4490
4510
  ] }),
4491
4511
  !a && /* @__PURE__ */ n("div", { className: "flex grow items-center gap-1", children: [
@@ -4522,7 +4542,7 @@ function ra() {
4522
4542
  ]
4523
4543
  }
4524
4544
  ),
4525
- a ? f() : /* @__PURE__ */ n(
4545
+ a ? p() : /* @__PURE__ */ n(
4526
4546
  tt,
4527
4547
  {
4528
4548
  className: "px-6",
@@ -4530,7 +4550,7 @@ function ra() {
4530
4550
  children: [
4531
4551
  o && /* @__PURE__ */ n(se, { children: [
4532
4552
  /* @__PURE__ */ e(
4533
- fe,
4553
+ ge,
4534
4554
  {
4535
4555
  id: "1",
4536
4556
  order: 1,
@@ -4543,13 +4563,13 @@ function ra() {
4543
4563
  /* @__PURE__ */ e(at, {})
4544
4564
  ] }),
4545
4565
  /* @__PURE__ */ e(
4546
- fe,
4566
+ ge,
4547
4567
  {
4548
4568
  id: "2",
4549
4569
  order: 2,
4550
4570
  minSize: 10,
4551
4571
  className: "relative flex h-full min-h-0 w-full flex-1 basis-0",
4552
- children: /* @__PURE__ */ n(Oe, { className: "relative flex h-full min-h-0 w-full flex-1 basis-0", children: [
4572
+ children: /* @__PURE__ */ n(Te, { className: "relative flex h-full min-h-0 w-full flex-1 basis-0", children: [
4553
4573
  (c == null ? void 0 : c.records) && (c == null ? void 0 : c.records.length) > 0 && /* @__PURE__ */ e(fi, { data: (c == null ? void 0 : c.records) || [] }),
4554
4574
  (C || (c == null ? void 0 : c.error)) && /* @__PURE__ */ e("span", { className: "font-mono text-xs", children: (C == null ? void 0 : C.message) || ((W = c == null ? void 0 : c.error) == null ? void 0 : W.message) }),
4555
4575
  /* @__PURE__ */ e(Ue, { orientation: "horizontal" })
@@ -4569,7 +4589,7 @@ function Oi() {
4569
4589
  const s = t.replace(/\n/g, "<br>");
4570
4590
  return /* @__PURE__ */ n("div", { className: "relative flex w-full flex-col border-r", children: [
4571
4591
  /* @__PURE__ */ e("div", { className: "sticky top-0 flex max-h-11 min-h-11 grow items-center border-b bg-muted px-3 font-mono text-xs font-semibold text-foreground/70", children: "Python Output" }),
4572
- /* @__PURE__ */ n(Oe, { className: "overflow-y-auto px-2 pt-1 font-mono text-xs text-foreground/90", children: [
4592
+ /* @__PURE__ */ n(Te, { className: "overflow-y-auto px-2 pt-1 font-mono text-xs text-foreground/90", children: [
4573
4593
  /* @__PURE__ */ e("div", { dangerouslySetInnerHTML: { __html: s } }),
4574
4594
  /* @__PURE__ */ e(Ue, { orientation: "horizontal" })
4575
4595
  ] })
@@ -4621,7 +4641,7 @@ function Xe({
4621
4641
  "details",
4622
4642
  {
4623
4643
  open: a,
4624
- className: Y("space-y-4 [&_summary>svg]:open:-rotate-180", l),
4644
+ className: Z("space-y-4 [&_summary>svg]:open:-rotate-180", l),
4625
4645
  children: [
4626
4646
  /* @__PURE__ */ n("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-4", children: [
4627
4647
  /* @__PURE__ */ e(H, { children: s }),
@@ -4633,17 +4653,17 @@ function Xe({
4633
4653
  );
4634
4654
  }
4635
4655
  function Li() {
4636
- var b, C;
4656
+ var f, C;
4637
4657
  const t = m(
4638
4658
  (x) => x.card.customCardPreferences
4639
4659
  ), { data: s } = Ss(), a = (s == null ? void 0 : s.plugins) || [], l = m((x) => x.card), i = m((x) => x.frame), o = (t == null ? void 0 : t.visualType) || "single", { setCustomCardPreferences: r } = ne(), { components: d, manifest: u } = Ra(
4640
4660
  (t == null ? void 0 : t.url) || ""
4641
- ), y = (b = u == null ? void 0 : u.visuals) == null ? void 0 : b.find(
4661
+ ), b = (f = u == null ? void 0 : u.visuals) == null ? void 0 : f.find(
4642
4662
  (x) => x.name === (t == null ? void 0 : t.componentName)
4643
4663
  );
4644
4664
  function h(x, D) {
4645
4665
  if (!t) return;
4646
- const I = {
4666
+ const O = {
4647
4667
  ...(t == null ? void 0 : t.dataInputCardIds) || {},
4648
4668
  [x]: {
4649
4669
  cardId: D,
@@ -4652,11 +4672,11 @@ function Li() {
4652
4672
  };
4653
4673
  r({
4654
4674
  ...t,
4655
- dataInputCardIds: I
4675
+ dataInputCardIds: O
4656
4676
  });
4657
4677
  }
4658
- function g(x) {
4659
- var N, I;
4678
+ function y(x) {
4679
+ var N, O;
4660
4680
  const D = (N = i == null ? void 0 : i.cards) == null ? void 0 : N.filter((z) => {
4661
4681
  var q;
4662
4682
  return ((q = z == null ? void 0 : z.customCardPreferences) == null ? void 0 : q.visualType) !== "multiple";
@@ -4664,7 +4684,7 @@ function Li() {
4664
4684
  value: z.id,
4665
4685
  label: z.tabTitle || z.title
4666
4686
  }));
4667
- return /* @__PURE__ */ e("div", { className: "space-y-2", children: (I = x == null ? void 0 : x.dataInputs) == null ? void 0 : I.map((z, q) => {
4687
+ return /* @__PURE__ */ e("div", { className: "space-y-2", children: (O = x == null ? void 0 : x.dataInputs) == null ? void 0 : O.map((z, q) => {
4668
4688
  var P, _;
4669
4689
  return /* @__PURE__ */ n(
4670
4690
  "div",
@@ -4673,13 +4693,13 @@ function Li() {
4673
4693
  children: [
4674
4694
  /* @__PURE__ */ e("div", { className: "col-span-4 flex items-center", children: z }),
4675
4695
  /* @__PURE__ */ e(
4676
- ge,
4696
+ ye,
4677
4697
  {
4678
4698
  className: "col-span-6 h-8 w-full justify-between",
4679
4699
  label: "",
4680
4700
  options: D || [],
4681
4701
  value: ((_ = (P = t == null ? void 0 : t.dataInputCardIds) == null ? void 0 : P[q]) == null ? void 0 : _.cardId) || "",
4682
- onValueChange: (U) => h(q, U)
4702
+ onValueChange: (Q) => h(q, Q)
4683
4703
  }
4684
4704
  )
4685
4705
  ]
@@ -4689,12 +4709,12 @@ function Li() {
4689
4709
  }) });
4690
4710
  }
4691
4711
  function v(x, D, N = []) {
4692
- var I, z;
4712
+ var O, z;
4693
4713
  return t ? x === "input" ? /* @__PURE__ */ e(
4694
4714
  de,
4695
4715
  {
4696
- className: `h-8 w-full ${De}`,
4697
- value: ((I = t == null ? void 0 : t.settings) == null ? void 0 : I[D]) || "",
4716
+ className: `h-8 w-full ${ze}`,
4717
+ value: ((O = t == null ? void 0 : t.settings) == null ? void 0 : O[D]) || "",
4698
4718
  onChange: (q) => {
4699
4719
  r({
4700
4720
  ...t,
@@ -4707,7 +4727,7 @@ function Li() {
4707
4727
  },
4708
4728
  D
4709
4729
  ) : x === "select" ? /* @__PURE__ */ e(
4710
- ge,
4730
+ ye,
4711
4731
  {
4712
4732
  className: "h-8 w-full",
4713
4733
  label: "",
@@ -4724,16 +4744,16 @@ function Li() {
4724
4744
  }
4725
4745
  function c(x) {
4726
4746
  const D = Object.entries((x == null ? void 0 : x.settings) || {});
4727
- return /* @__PURE__ */ e("div", { className: "space-y-3", children: D.map(([N, I]) => /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4728
- /* @__PURE__ */ e(H, { children: I.title }),
4747
+ return /* @__PURE__ */ e("div", { className: "space-y-3", children: D.map(([N, O]) => /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4748
+ /* @__PURE__ */ e(H, { children: O.title }),
4729
4749
  v(
4730
- I.ui,
4750
+ O.ui,
4731
4751
  N,
4732
- I.options
4752
+ O.options
4733
4753
  )
4734
4754
  ] }, N)) });
4735
4755
  }
4736
- function p(x) {
4756
+ function g(x) {
4737
4757
  t && r({
4738
4758
  ...t,
4739
4759
  visualType: x,
@@ -4747,7 +4767,7 @@ function Li() {
4747
4767
  children: [
4748
4768
  /* @__PURE__ */ e(Xe, { summary: "Plugin Settings", children: /* @__PURE__ */ e("div", { className: "space-y-4 text-sm", children: /* @__PURE__ */ n("div", { className: "space-y-4 text-sm", children: [
4749
4769
  /* @__PURE__ */ e("div", { className: "space-y-2", children: /* @__PURE__ */ e("div", { className: "px-2", children: /* @__PURE__ */ e(
4750
- ge,
4770
+ ye,
4751
4771
  {
4752
4772
  className: "h-8 w-full",
4753
4773
  label: "",
@@ -4770,13 +4790,13 @@ function Li() {
4770
4790
  { value: "multiple", label: "Multi-Visual" }
4771
4791
  ],
4772
4792
  value: o,
4773
- onValueChange: p
4793
+ onValueChange: g
4774
4794
  }
4775
4795
  ),
4776
4796
  ((t == null ? void 0 : t.type) === "component" || (t == null ? void 0 : t.type) === void 0) && t && /* @__PURE__ */ e(se, { children: /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4777
4797
  /* @__PURE__ */ e(H, { children: "Component" }),
4778
4798
  /* @__PURE__ */ e("div", { className: "space-y-2 px-2", children: d && /* @__PURE__ */ e(
4779
- ge,
4799
+ ye,
4780
4800
  {
4781
4801
  className: "h-8 w-full",
4782
4802
  label: "",
@@ -4799,17 +4819,17 @@ function Li() {
4799
4819
  ] }) }) }),
4800
4820
  /* @__PURE__ */ e(we, { className: "my-4" }),
4801
4821
  ((C = l == null ? void 0 : l.customCardPreferences) == null ? void 0 : C.componentName) && /* @__PURE__ */ n(Xe, { summary: "Component Settings", children: [
4802
- y && y.dataInputs && /* @__PURE__ */ n("div", { className: "space-y-3", children: [
4822
+ b && b.dataInputs && /* @__PURE__ */ n("div", { className: "space-y-3", children: [
4803
4823
  /* @__PURE__ */ e(H, { children: "Input Mapping" }),
4804
- /* @__PURE__ */ e("div", { className: "px-2", children: g(y) })
4824
+ /* @__PURE__ */ e("div", { className: "px-2", children: y(b) })
4805
4825
  ] }),
4806
- y && y.settings && /* @__PURE__ */ e("div", { className: "space-y-3", children: /* @__PURE__ */ e("div", { className: "px-2", children: c(y) }) })
4826
+ b && b.settings && /* @__PURE__ */ e("div", { className: "space-y-3", children: /* @__PURE__ */ e("div", { className: "px-2", children: c(b) }) })
4807
4827
  ] })
4808
4828
  ]
4809
4829
  }
4810
4830
  );
4811
4831
  }
4812
- function Pe() {
4832
+ function $e() {
4813
4833
  const [t, s] = j([]);
4814
4834
  m(
4815
4835
  (h) => h.card.cfg
@@ -4819,15 +4839,15 @@ function Pe() {
4819
4839
  );
4820
4840
  m(
4821
4841
  (h) => {
4822
- var g;
4823
- return (g = h.card.preferences) == null ? void 0 : g.filterOnClickColumnIndex;
4842
+ var y;
4843
+ return (y = h.card.preferences) == null ? void 0 : y.filterOnClickColumnIndex;
4824
4844
  }
4825
4845
  ), oe(() => {
4826
4846
  r && s(new Array(r.length).fill(!1));
4827
4847
  }, [r]);
4828
- function d(h, g) {
4848
+ function d(h, y) {
4829
4849
  var v, c;
4830
- g ? a != null && a.onClickFilter && ((v = a == null ? void 0 : a.onClickFilter) == null ? void 0 : v.length) > 0 ? o({
4850
+ y ? a != null && a.onClickFilter && ((v = a == null ? void 0 : a.onClickFilter) == null ? void 0 : v.length) > 0 ? o({
4831
4851
  ...a,
4832
4852
  onClickFilter: [
4833
4853
  ...a.onClickFilter,
@@ -4847,32 +4867,32 @@ function Pe() {
4847
4867
  }) : (o({
4848
4868
  ...a,
4849
4869
  onClickFilter: (c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.filter(
4850
- (p) => p.columnIndex !== h
4870
+ (g) => g.columnIndex !== h
4851
4871
  )
4852
- }), s((p) => {
4853
- const b = [...p];
4854
- return b[h] = !1, b;
4872
+ }), s((g) => {
4873
+ const f = [...g];
4874
+ return f[h] = !1, f;
4855
4875
  }));
4856
4876
  }
4857
- function u(h, g) {
4877
+ function u(h, y) {
4858
4878
  var c;
4859
- const v = (c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.map((p) => p.columnIndex === h ? {
4860
- ...p,
4861
- expression: g.target.value
4862
- } : p);
4879
+ const v = (c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.map((g) => g.columnIndex === h ? {
4880
+ ...g,
4881
+ expression: y.target.value
4882
+ } : g);
4863
4883
  o({
4864
4884
  ...a,
4865
4885
  onClickFilter: v
4866
4886
  });
4867
4887
  }
4868
- function y(h) {
4869
- var g, v, c, p;
4870
- if (t != null && t[h] || (v = (g = a == null ? void 0 : a.onClickFilter) == null ? void 0 : g.find((b) => b.columnIndex === h)) != null && v.expression)
4888
+ function b(h) {
4889
+ var y, v, c, g;
4890
+ if (t != null && t[h] || (v = (y = a == null ? void 0 : a.onClickFilter) == null ? void 0 : y.find((f) => f.columnIndex === h)) != null && v.expression)
4871
4891
  return /* @__PURE__ */ e(
4872
4892
  de,
4873
4893
  {
4874
- value: (p = (c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.find((b) => b.columnIndex === h)) == null ? void 0 : p.expression,
4875
- onChange: (b) => u(h, b),
4894
+ value: (g = (c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.find((f) => f.columnIndex === h)) == null ? void 0 : g.expression,
4895
+ onChange: (f) => u(h, f),
4876
4896
  type: "text",
4877
4897
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
4878
4898
  placeholder: "Expression"
@@ -4881,7 +4901,7 @@ function Pe() {
4881
4901
  }
4882
4902
  return /* @__PURE__ */ n("div", { className: "space-y-2", children: [
4883
4903
  /* @__PURE__ */ e(H, { children: "On Click" }),
4884
- r == null ? void 0 : r.map((h, g) => {
4904
+ r == null ? void 0 : r.map((h, y) => {
4885
4905
  var v, c;
4886
4906
  return /* @__PURE__ */ e(
4887
4907
  "div",
@@ -4893,9 +4913,9 @@ function Pe() {
4893
4913
  qt,
4894
4914
  {
4895
4915
  checked: !!((v = a == null ? void 0 : a.onClickFilter) != null && v.find(
4896
- (p) => p.columnIndex === g
4916
+ (g) => g.columnIndex === y
4897
4917
  )),
4898
- onCheckedChange: (p) => d(g, p)
4918
+ onCheckedChange: (g) => d(y, g)
4899
4919
  }
4900
4920
  ),
4901
4921
  /* @__PURE__ */ e(
@@ -4906,21 +4926,21 @@ function Pe() {
4906
4926
  }
4907
4927
  ),
4908
4928
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: ((c = a == null ? void 0 : a.onClickFilter) == null ? void 0 : c.find(
4909
- (p) => p.columnIndex === g
4929
+ (g) => g.columnIndex === y
4910
4930
  )) && /* @__PURE__ */ e(
4911
4931
  Ca,
4912
4932
  {
4913
4933
  onClick: () => {
4914
- s((p) => {
4915
- const b = [...p];
4916
- return b[g] = !p[g], b;
4934
+ s((g) => {
4935
+ const f = [...g];
4936
+ return f[y] = !g[y], f;
4917
4937
  });
4918
4938
  },
4919
4939
  className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
4920
4940
  }
4921
4941
  ) })
4922
4942
  ] }),
4923
- y(g)
4943
+ b(y)
4924
4944
  ] })
4925
4945
  },
4926
4946
  h
@@ -4931,17 +4951,17 @@ function Pe() {
4931
4951
  function Fi({ idx: t }) {
4932
4952
  var d;
4933
4953
  const s = m((u) => {
4934
- var y;
4935
- return (y = u.card) == null ? void 0 : y.preferences;
4954
+ var b;
4955
+ return (b = u.card) == null ? void 0 : b.preferences;
4936
4956
  }), a = m(
4937
4957
  (u) => {
4938
- var y;
4939
- return (y = u.card.preferences) == null ? void 0 : y.datasetOptions;
4958
+ var b;
4959
+ return (b = u.card.preferences) == null ? void 0 : b.datasetOptions;
4940
4960
  }
4941
4961
  ), l = m(
4942
4962
  (u) => u.actions.setCardPreferences
4943
4963
  ), i = (d = s == null ? void 0 : s.chartOptions) == null ? void 0 : d.indexAxis, o = a == null ? void 0 : a.find((u) => u.idx === t);
4944
- function r(u, y) {
4964
+ function r(u, b) {
4945
4965
  (u === "end" || u === "start") && In(On());
4946
4966
  const h = {
4947
4967
  display: u !== "none",
@@ -4955,16 +4975,16 @@ function Fi({ idx: t }) {
4955
4975
  datasetOptions: [
4956
4976
  ...a || [],
4957
4977
  {
4958
- idx: y,
4978
+ idx: b,
4959
4979
  datalabels: h
4960
4980
  }
4961
4981
  ]
4962
4982
  });
4963
4983
  else {
4964
- const g = { ...o };
4965
- g.datalabels = h;
4984
+ const y = { ...o };
4985
+ y.datalabels = h;
4966
4986
  const v = a == null ? void 0 : a.map(
4967
- (c) => c.idx === y ? g : c
4987
+ (c) => c.idx === b ? y : c
4968
4988
  );
4969
4989
  l({
4970
4990
  ...s,
@@ -4972,8 +4992,8 @@ function Fi({ idx: t }) {
4972
4992
  });
4973
4993
  }
4974
4994
  }
4975
- return /* @__PURE__ */ n(qe, { children: [
4976
- /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(Rl, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
4995
+ return /* @__PURE__ */ n(Re, { children: [
4996
+ /* @__PURE__ */ e(je, { children: /* @__PURE__ */ e(Rl, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
4977
4997
  /* @__PURE__ */ e(ft, { className: "w-fit p-1", children: /* @__PURE__ */ n("div", { className: "flex gap-1", children: [
4978
4998
  /* @__PURE__ */ e(
4979
4999
  $,
@@ -4995,7 +5015,7 @@ function Fi({ idx: t }) {
4995
5015
  children: /* @__PURE__ */ e(
4996
5016
  Cl,
4997
5017
  {
4998
- className: Y("h-4 w-4", {
5018
+ className: Z("h-4 w-4", {
4999
5019
  "rotate-90": i === "y"
5000
5020
  })
5001
5021
  }
@@ -5012,7 +5032,7 @@ function Fi({ idx: t }) {
5012
5032
  children: /* @__PURE__ */ e(
5013
5033
  wl,
5014
5034
  {
5015
- className: Y("h-4 w-4", {
5035
+ className: Z("h-4 w-4", {
5016
5036
  "rotate-90": i === "y"
5017
5037
  })
5018
5038
  }
@@ -5029,7 +5049,7 @@ function Fi({ idx: t }) {
5029
5049
  children: /* @__PURE__ */ e(
5030
5050
  Sl,
5031
5051
  {
5032
- className: Y("h-4 w-4", {
5052
+ className: Z("h-4 w-4", {
5033
5053
  "rotate-90": i === "y"
5034
5054
  })
5035
5055
  }
@@ -5040,24 +5060,24 @@ function Fi({ idx: t }) {
5040
5060
  ] });
5041
5061
  }
5042
5062
  function ws() {
5043
- const t = m((y) => y.card), s = m(
5044
- (y) => {
5045
- var h, g, v;
5046
- return (v = (g = (h = y == null ? void 0 : y.card) == null ? void 0 : h.preferences) == null ? void 0 : g.chartOptions) == null ? void 0 : v.indexAxis;
5063
+ const t = m((b) => b.card), s = m(
5064
+ (b) => {
5065
+ var h, y, v;
5066
+ return (v = (y = (h = b == null ? void 0 : b.card) == null ? void 0 : h.preferences) == null ? void 0 : y.chartOptions) == null ? void 0 : v.indexAxis;
5047
5067
  }
5048
- ), { data: a } = je(t), l = s === "y" ? "Y axis" : "X axis", i = s === "y" ? "X axis" : "Y axis", {
5068
+ ), { data: a } = _e(t), l = s === "y" ? "Y axis" : "X axis", i = s === "y" ? "X axis" : "Y axis", {
5049
5069
  keys: o,
5050
5070
  metricKeys: r,
5051
5071
  dimensionKeys: d
5052
5072
  } = Mt((a == null ? void 0 : a.records) || []);
5053
5073
  let u = r;
5054
5074
  if (["stackedBar", "stackedLine"].includes(t.type)) {
5055
- const y = Tn({
5075
+ const b = Tn({
5056
5076
  dataArray: (a == null ? void 0 : a.records) || [],
5057
5077
  groupKey: d[0],
5058
5078
  pivotKey: d[1],
5059
5079
  valueKey: u[0]
5060
- }), { metricKeys: h } = Mt(y);
5080
+ }), { metricKeys: h } = Mt(b);
5061
5081
  u = h;
5062
5082
  }
5063
5083
  return o.length === 0 ? null : /* @__PURE__ */ n("div", { className: "space-y-4", children: [
@@ -5067,7 +5087,7 @@ function ws() {
5067
5087
  ] }),
5068
5088
  /* @__PURE__ */ n("div", { className: "space-y-2", children: [
5069
5089
  /* @__PURE__ */ e(H, { children: i }),
5070
- /* @__PURE__ */ e("div", { className: "my-1 max-h-[125px] space-y-1 overflow-y-auto", children: u.map((y, h) => /* @__PURE__ */ e(Ei, { col: y, idx: h }, y)) })
5090
+ /* @__PURE__ */ e("div", { className: "my-1 max-h-[125px] space-y-1 overflow-y-auto", children: u.map((b, h) => /* @__PURE__ */ e(Ei, { col: b, idx: h }, b)) })
5071
5091
  ] })
5072
5092
  ] });
5073
5093
  }
@@ -5100,12 +5120,12 @@ function Ei({ col: t, idx: s }) {
5100
5120
  else {
5101
5121
  const u = { ...i };
5102
5122
  u.type = d === "area" ? "line" : d, u.fill = d === "area" ? "origin" : "";
5103
- const y = l == null ? void 0 : l.map(
5123
+ const b = l == null ? void 0 : l.map(
5104
5124
  (h) => h.idx === s ? u : h
5105
5125
  );
5106
5126
  o({
5107
5127
  ...a,
5108
- datasetOptions: y
5128
+ datasetOptions: b
5109
5129
  });
5110
5130
  }
5111
5131
  }
@@ -5138,31 +5158,31 @@ function Ei({ col: t, idx: s }) {
5138
5158
  ] });
5139
5159
  }
5140
5160
  function Ms() {
5141
- const t = m((c) => c.selectedConnectionId), s = m((c) => c.selectedDatamodelId), a = m((c) => c.selectedDatabaseName), l = m((c) => c.selectedSchemaName), i = m((c) => c.selectedTableName), o = O((c) => c.dashboard.filters) || [], r = O((c) => c.actions.addFilter), d = O((c) => c.actions.removeFilter), { removeFilterValues: u } = Ke(), { modelItems: y, tableName: h, connectionType: g } = He();
5142
- function v(c, p = "dashboard") {
5161
+ const t = m((c) => c.selectedConnectionId), s = m((c) => c.selectedDatamodelId), a = m((c) => c.selectedDatabaseName), l = m((c) => c.selectedSchemaName), i = m((c) => c.selectedTableName), o = I((c) => c.dashboard.filters) || [], r = I((c) => c.actions.addFilter), d = I((c) => c.actions.removeFilter), { removeFilterValues: u } = Ke(), { modelItems: b, tableName: h, connectionType: y } = Pe();
5162
+ function v(c, g = "dashboard") {
5143
5163
  var P;
5144
- const b = be(c.column_name), C = be(a || ""), x = be(l || ""), D = be(h);
5164
+ const f = be(c.column_name), C = be(a || ""), x = be(l || ""), D = be(h);
5145
5165
  let N = An(
5146
5166
  x,
5147
5167
  D,
5148
- g
5149
- ), I = `${N}.${b}`;
5150
- const z = (P = y == null ? void 0 : y.find(
5168
+ y
5169
+ ), O = `${N}.${f}`;
5170
+ const z = (P = b == null ? void 0 : b.find(
5151
5171
  (_) => _.id === s
5152
5172
  )) == null ? void 0 : P.name;
5153
- s && s !== "none" && (I = `${ea}.${z}.${b}`, N = `${ea}.${z}`);
5173
+ s && s !== "none" && (O = `${ea}.${z}.${f}`, N = `${ea}.${z}`);
5154
5174
  const q = o == null ? void 0 : o.find(
5155
- (_) => _.column === I && _.table === D && (_.database === C || _.database === a)
5175
+ (_) => _.column === O && _.table === D && (_.database === C || _.database === a)
5156
5176
  );
5157
5177
  if (q)
5158
5178
  u(q.id), d(q.id);
5159
5179
  else {
5160
5180
  const _ = et();
5161
5181
  return h === "api" && t ? (r({
5162
- location: p,
5182
+ location: g,
5163
5183
  id: _,
5164
5184
  //uuidv4(),
5165
- column: I,
5185
+ column: O,
5166
5186
  title: c.column_name,
5167
5187
  dataType: c.data_type,
5168
5188
  table: "api",
@@ -5173,14 +5193,14 @@ function Ms() {
5173
5193
  sql: Xt(
5174
5194
  c.data_type,
5175
5195
  N,
5176
- b
5196
+ f
5177
5197
  )
5178
5198
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
5179
5199
  }), _) : (r({
5180
5200
  id: _,
5181
5201
  //uuidv4(),
5182
- location: p,
5183
- column: I,
5202
+ location: g,
5203
+ column: O,
5184
5204
  //columnName, //`${qualifiedTableName}.${formattedColumnName}`,
5185
5205
  title: c.column_name,
5186
5206
  dataType: c.data_type,
@@ -5191,7 +5211,7 @@ function Ms() {
5191
5211
  sql: Xt(
5192
5212
  c.data_type,
5193
5213
  N,
5194
- b
5214
+ f
5195
5215
  )
5196
5216
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
5197
5217
  }), _);
@@ -5200,9 +5220,9 @@ function Ms() {
5200
5220
  return { assignFilter: v };
5201
5221
  }
5202
5222
  function We() {
5203
- const t = O(
5223
+ const t = I(
5204
5224
  (d) => d.dashboard.filters
5205
- ), s = m((d) => d.frame), { setFrame: a } = ne(), { columns: l } = He(), { assignFilter: i } = Ms();
5225
+ ), s = m((d) => d.frame), { setFrame: a } = ne(), { columns: l } = Pe(), { assignFilter: i } = Ms();
5206
5226
  function o(d) {
5207
5227
  const u = i(d, "frame");
5208
5228
  a({ ...s, filterId: u });
@@ -5220,8 +5240,8 @@ function Vi({
5220
5240
  }) {
5221
5241
  var r;
5222
5242
  const [a, l] = Be.useState(!1), [i, o] = Be.useState("");
5223
- return /* @__PURE__ */ n(qe, { open: a, onOpenChange: l, children: [
5224
- /* @__PURE__ */ e(Re, { asChild: !0, children: /* @__PURE__ */ n(
5243
+ return /* @__PURE__ */ n(Re, { open: a, onOpenChange: l, children: [
5244
+ /* @__PURE__ */ e(je, { asChild: !0, children: /* @__PURE__ */ n(
5225
5245
  $,
5226
5246
  {
5227
5247
  size: "sm",
@@ -5244,15 +5264,15 @@ function Vi({
5244
5264
  {
5245
5265
  value: d.column_name,
5246
5266
  onSelect: (u) => {
5247
- const y = u === i ? "" : u;
5248
- o(y), l(!1), y && s(d);
5267
+ const b = u === i ? "" : u;
5268
+ o(b), l(!1), b && s(d);
5249
5269
  },
5250
5270
  children: [
5251
5271
  d.column_name,
5252
5272
  /* @__PURE__ */ e(
5253
5273
  Fn,
5254
5274
  {
5255
- className: Y(
5275
+ className: Z(
5256
5276
  "ml-auto h-4 w-4",
5257
5277
  i === d.column_name ? "opacity-100" : "opacity-0"
5258
5278
  )
@@ -5269,7 +5289,7 @@ function Vi({
5269
5289
  function qi({
5270
5290
  cardType: t
5271
5291
  }) {
5272
- return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(_e, { defaultValue: ["item-2"], type: "multiple", children: [
5292
+ return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(He, { defaultValue: ["item-2"], type: "multiple", children: [
5273
5293
  /* @__PURE__ */ n(ee, { value: "item-1", children: [
5274
5294
  /* @__PURE__ */ e(te, { children: `${bt(t)} Chart` }),
5275
5295
  /* @__PURE__ */ n(ae, { className: "space-y-4 font-mono text-xs", children: [
@@ -5302,7 +5322,7 @@ function qi({
5302
5322
  /* @__PURE__ */ n(ee, { value: "item-3", children: [
5303
5323
  /* @__PURE__ */ e(te, { children: "Filters" }),
5304
5324
  /* @__PURE__ */ n(ae, { className: "space-y-4 px-2", children: [
5305
- /* @__PURE__ */ e(Pe, {}),
5325
+ /* @__PURE__ */ e($e, {}),
5306
5326
  /* @__PURE__ */ e(We, {})
5307
5327
  ] })
5308
5328
  ] })
@@ -5322,7 +5342,7 @@ function Ht() {
5322
5342
  anchor: d,
5323
5343
  clamp: !0
5324
5344
  }
5325
- }, y = {
5345
+ }, b = {
5326
5346
  ...t,
5327
5347
  options: {
5328
5348
  ...t == null ? void 0 : t.options,
@@ -5332,7 +5352,7 @@ function Ht() {
5332
5352
  }
5333
5353
  }
5334
5354
  };
5335
- s(y), console.log(d);
5355
+ s(b), console.log(d);
5336
5356
  }
5337
5357
  return /* @__PURE__ */ n("div", { className: "space-y-2", children: [
5338
5358
  /* @__PURE__ */ e("label", { className: "font-medium", children: "Data Labels" }),
@@ -5344,12 +5364,12 @@ function Ht() {
5344
5364
  defaultValue: "none",
5345
5365
  children: [
5346
5366
  /* @__PURE__ */ e(ve, { className: "h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, { placeholder: "Select position" }) }),
5347
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
5367
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
5348
5368
  /* @__PURE__ */ e(Se, { children: "Data Labels" }),
5349
- /* @__PURE__ */ e(ie, { value: "none", children: "None" }),
5350
- a !== "pyramid" && /* @__PURE__ */ e(ie, { value: "start", children: "Start" }),
5351
- /* @__PURE__ */ e(ie, { value: "center", children: "Center" }),
5352
- a !== "pyramid" && /* @__PURE__ */ e(ie, { value: "end", children: "End" })
5369
+ /* @__PURE__ */ e(le, { value: "none", children: "None" }),
5370
+ a !== "pyramid" && /* @__PURE__ */ e(le, { value: "start", children: "Start" }),
5371
+ /* @__PURE__ */ e(le, { value: "center", children: "Center" }),
5372
+ a !== "pyramid" && /* @__PURE__ */ e(le, { value: "end", children: "End" })
5353
5373
  ] }) })
5354
5374
  ]
5355
5375
  }
@@ -5385,7 +5405,7 @@ function Ri({
5385
5405
  ] })
5386
5406
  ] });
5387
5407
  }
5388
- return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(_e, { defaultValue: ["item-2"], type: "multiple", children: [
5408
+ return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(He, { defaultValue: ["item-2"], type: "multiple", children: [
5389
5409
  /* @__PURE__ */ n(ee, { value: "item-1", children: [
5390
5410
  /* @__PURE__ */ e(te, { children: `${bt(t)} Chart` }),
5391
5411
  /* @__PURE__ */ e(ae, { className: "space-y-4 font-mono text-xs", children: s(t) })
@@ -5397,7 +5417,7 @@ function Ri({
5397
5417
  /* @__PURE__ */ n(ee, { value: "item-3", children: [
5398
5418
  /* @__PURE__ */ e(te, { children: "Filters" }),
5399
5419
  /* @__PURE__ */ n(ae, { className: "space-y-4 px-2", children: [
5400
- /* @__PURE__ */ e(Pe, {}),
5420
+ /* @__PURE__ */ e($e, {}),
5401
5421
  /* @__PURE__ */ e(We, {})
5402
5422
  ] })
5403
5423
  ] })
@@ -5430,7 +5450,7 @@ function Hi() {
5430
5450
  const t = m((s) => s.card.type);
5431
5451
  return /* @__PURE__ */ n("div", { className: "space-y-6 p-6", children: [
5432
5452
  /* @__PURE__ */ e(
5433
- _e,
5453
+ He,
5434
5454
  {
5435
5455
  className: " ",
5436
5456
  type: "single",
@@ -5440,7 +5460,7 @@ function Hi() {
5440
5460
  ),
5441
5461
  !["kpi"].includes(t) && /* @__PURE__ */ n("div", { className: "space-y-4", children: [
5442
5462
  /* @__PURE__ */ e(Ht, {}),
5443
- /* @__PURE__ */ e(Pe, {}),
5463
+ /* @__PURE__ */ e($e, {}),
5444
5464
  /* @__PURE__ */ e(We, {})
5445
5465
  ] })
5446
5466
  ] });
@@ -5543,7 +5563,7 @@ function Pi(t) {
5543
5563
  ] }) });
5544
5564
  }
5545
5565
  function $i() {
5546
- var u, y, h, g, v;
5566
+ var u, b, h, y, v;
5547
5567
  const t = m((c) => c.card.preferences), s = m(
5548
5568
  (c) => c.actions.setCardPreferences
5549
5569
  ), a = m(
@@ -5551,19 +5571,19 @@ function $i() {
5551
5571
  );
5552
5572
  m(
5553
5573
  (c) => {
5554
- var p, b;
5555
- return (b = (p = c.card.preferences) == null ? void 0 : p.formatNumber) == null ? void 0 : b.decimalPlaces;
5574
+ var g, f;
5575
+ return (f = (g = c.card.preferences) == null ? void 0 : g.formatNumber) == null ? void 0 : f.decimalPlaces;
5556
5576
  }
5557
5577
  );
5558
5578
  const l = m(
5559
5579
  (c) => {
5560
- var p, b;
5561
- return (b = (p = c.card.preferences) == null ? void 0 : p.formatNumber) == null ? void 0 : b.locale;
5580
+ var g, f;
5581
+ return (f = (g = c.card.preferences) == null ? void 0 : g.formatNumber) == null ? void 0 : f.locale;
5562
5582
  }
5563
5583
  ), i = m(
5564
5584
  (c) => {
5565
- var p, b;
5566
- return (b = (p = c.card.preferences) == null ? void 0 : p.formatNumber) == null ? void 0 : b.currency;
5585
+ var g, f;
5586
+ return (f = (g = c.card.preferences) == null ? void 0 : g.formatNumber) == null ? void 0 : f.currency;
5567
5587
  }
5568
5588
  );
5569
5589
  m(
@@ -5571,8 +5591,8 @@ function $i() {
5571
5591
  );
5572
5592
  const o = m(
5573
5593
  (c) => {
5574
- var p, b;
5575
- return (b = (p = c.card.preferences) == null ? void 0 : p.formatNumber) == null ? void 0 : b.colorRanges;
5594
+ var g, f;
5595
+ return (f = (g = c.card.preferences) == null ? void 0 : g.formatNumber) == null ? void 0 : f.colorRanges;
5576
5596
  }
5577
5597
  ) || [], r = m(
5578
5598
  (c) => c.actions.setColorRanges
@@ -5596,7 +5616,7 @@ function $i() {
5596
5616
  ),
5597
5617
  /* @__PURE__ */ e(H, { children: "Format Number" })
5598
5618
  ] }),
5599
- ((y = t == null ? void 0 : t.formatNumber) == null ? void 0 : y.enabled) === !0 && /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: [
5619
+ ((b = t == null ? void 0 : t.formatNumber) == null ? void 0 : b.enabled) === !0 && /* @__PURE__ */ n("div", { className: "flex flex-col gap-2", children: [
5600
5620
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ n("div", { className: "space-y-4 p-2", children: [
5601
5621
  /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
5602
5622
  /* @__PURE__ */ n("div", { className: "w-full space-y-1", children: [
@@ -5606,20 +5626,20 @@ function $i() {
5606
5626
  {
5607
5627
  value: l || "none",
5608
5628
  onValueChange: (c) => {
5609
- var p, b, C;
5629
+ var g, f, C;
5610
5630
  return a(
5611
- ((p = t == null ? void 0 : t.formatNumber) == null ? void 0 : p.decimalPlaces) || 0,
5612
- ((b = t == null ? void 0 : t.formatNumber) == null ? void 0 : b.currency) || "",
5631
+ ((g = t == null ? void 0 : t.formatNumber) == null ? void 0 : g.decimalPlaces) || 0,
5632
+ ((f = t == null ? void 0 : t.formatNumber) == null ? void 0 : f.currency) || "",
5613
5633
  c,
5614
5634
  ((C = t == null ? void 0 : t.formatNumber) == null ? void 0 : C.suffix) || ""
5615
5635
  );
5616
5636
  },
5617
5637
  children: [
5618
5638
  /* @__PURE__ */ e(ve, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, {}) }),
5619
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
5639
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
5620
5640
  /* @__PURE__ */ e(Se, { children: "Format" }),
5621
- /* @__PURE__ */ e(ie, { value: "none", children: "None" }, "none"),
5622
- ht.map((c) => /* @__PURE__ */ e(ie, { value: c.locale, children: c.locale }, c.locale))
5641
+ /* @__PURE__ */ e(le, { value: "none", children: "None" }, "none"),
5642
+ ht.map((c) => /* @__PURE__ */ e(le, { value: c.locale, children: c.locale }, c.locale))
5623
5643
  ] }) })
5624
5644
  ]
5625
5645
  }
@@ -5632,20 +5652,20 @@ function $i() {
5632
5652
  {
5633
5653
  value: i || "none",
5634
5654
  onValueChange: (c) => {
5635
- var p, b, C;
5655
+ var g, f, C;
5636
5656
  console.log("currency", c), a(
5637
- ((p = t == null ? void 0 : t.formatNumber) == null ? void 0 : p.decimalPlaces) || 0,
5657
+ ((g = t == null ? void 0 : t.formatNumber) == null ? void 0 : g.decimalPlaces) || 0,
5638
5658
  c === "none" ? "" : c,
5639
- ((b = t == null ? void 0 : t.formatNumber) == null ? void 0 : b.locale) || "",
5659
+ ((f = t == null ? void 0 : t.formatNumber) == null ? void 0 : f.locale) || "",
5640
5660
  ((C = t == null ? void 0 : t.formatNumber) == null ? void 0 : C.suffix) || ""
5641
5661
  );
5642
5662
  },
5643
5663
  children: [
5644
5664
  /* @__PURE__ */ e(ve, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, {}) }),
5645
- /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(ze, { children: [
5665
+ /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ n(Ie, { children: [
5646
5666
  /* @__PURE__ */ e(Se, { children: "Currency" }),
5647
- /* @__PURE__ */ e(ie, { value: "none", children: "None" }, "none"),
5648
- d.map((c) => /* @__PURE__ */ e(ie, { value: c, children: c }, c))
5667
+ /* @__PURE__ */ e(le, { value: "none", children: "None" }, "none"),
5668
+ d.map((c) => /* @__PURE__ */ e(le, { value: c, children: c }, c))
5649
5669
  ] }) })
5650
5670
  ]
5651
5671
  }
@@ -5658,19 +5678,19 @@ function $i() {
5658
5678
  /* @__PURE__ */ n(
5659
5679
  xe,
5660
5680
  {
5661
- value: ((g = (h = t == null ? void 0 : t.formatNumber) == null ? void 0 : h.decimalPlaces) == null ? void 0 : g.toString()) || "0",
5681
+ value: ((y = (h = t == null ? void 0 : t.formatNumber) == null ? void 0 : h.decimalPlaces) == null ? void 0 : y.toString()) || "0",
5662
5682
  onValueChange: (c) => {
5663
- var p, b, C;
5683
+ var g, f, C;
5664
5684
  return a(
5665
5685
  Number(c),
5666
- ((p = t == null ? void 0 : t.formatNumber) == null ? void 0 : p.currency) || "",
5667
- ((b = t == null ? void 0 : t.formatNumber) == null ? void 0 : b.locale) || "",
5686
+ ((g = t == null ? void 0 : t.formatNumber) == null ? void 0 : g.currency) || "",
5687
+ ((f = t == null ? void 0 : t.formatNumber) == null ? void 0 : f.locale) || "",
5668
5688
  ((C = t == null ? void 0 : t.formatNumber) == null ? void 0 : C.suffix) || ""
5669
5689
  );
5670
5690
  },
5671
5691
  children: [
5672
5692
  /* @__PURE__ */ e(ve, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e(Ne, {}) }),
5673
- /* @__PURE__ */ e(Ce, { children: ["0", "1", "2", "3", "4"].map((c) => /* @__PURE__ */ e(ie, { value: c, children: c }, c)) })
5693
+ /* @__PURE__ */ e(Ce, { children: ["0", "1", "2", "3", "4"].map((c) => /* @__PURE__ */ e(le, { value: c, children: c }, c)) })
5674
5694
  ]
5675
5695
  }
5676
5696
  )
@@ -5684,10 +5704,10 @@ function $i() {
5684
5704
  className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
5685
5705
  placeholder: "K, M, B, %",
5686
5706
  onChange: (c) => {
5687
- var p, b, C;
5707
+ var g, f, C;
5688
5708
  return a(
5689
- ((p = t == null ? void 0 : t.formatNumber) == null ? void 0 : p.decimalPlaces) || 0,
5690
- ((b = t == null ? void 0 : t.formatNumber) == null ? void 0 : b.currency) || "",
5709
+ ((g = t == null ? void 0 : t.formatNumber) == null ? void 0 : g.decimalPlaces) || 0,
5710
+ ((f = t == null ? void 0 : t.formatNumber) == null ? void 0 : f.currency) || "",
5691
5711
  ((C = t == null ? void 0 : t.formatNumber) == null ? void 0 : C.locale) || "",
5692
5712
  c.target.value
5693
5713
  );
@@ -5710,7 +5730,7 @@ function $i() {
5710
5730
  }
5711
5731
  function Bi() {
5712
5732
  return /* @__PURE__ */ n("div", { className: "space-y-6 px-6 py-2", children: [
5713
- /* @__PURE__ */ e(_e, { type: "single", collapsible: !0, children: /* @__PURE__ */ n(ee, { value: "item-1", children: [
5733
+ /* @__PURE__ */ e(He, { type: "single", collapsible: !0, children: /* @__PURE__ */ n(ee, { value: "item-1", children: [
5714
5734
  /* @__PURE__ */ e(te, { className: "", children: "KPI Query" }),
5715
5735
  /* @__PURE__ */ n(ae, { className: "font-mono", children: [
5716
5736
  /* @__PURE__ */ e("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
@@ -5840,19 +5860,19 @@ const Ui = [
5840
5860
  value: t
5841
5861
  }));
5842
5862
  function Ki() {
5843
- var u, y, h, g, v, c, p, b, C, x, D, N, I, z, q, P, _, U;
5844
- const t = m((f) => f.card), s = (y = (u = t == null ? void 0 : t.preferences) == null ? void 0 : u.mapVisualOptions) == null ? void 0 : y.topoJsonUrl, [a, l] = j(
5845
- ((g = (h = t == null ? void 0 : t.preferences) == null ? void 0 : h.mapVisualOptions) == null ? void 0 : g.customTopoJsonUrl) || ""
5846
- ), { setCardPreferences: i } = ne(), { data: o } = Ft(t), r = Object.keys((o == null ? void 0 : o.objects) || {}).map((f) => ({
5847
- label: f,
5848
- value: f
5863
+ var u, b, h, y, v, c, g, f, C, x, D, N, O, z, q, P, _, Q;
5864
+ const t = m((p) => p.card), s = (b = (u = t == null ? void 0 : t.preferences) == null ? void 0 : u.mapVisualOptions) == null ? void 0 : b.topoJsonUrl, [a, l] = j(
5865
+ ((y = (h = t == null ? void 0 : t.preferences) == null ? void 0 : h.mapVisualOptions) == null ? void 0 : y.customTopoJsonUrl) || ""
5866
+ ), { setCardPreferences: i } = ne(), { data: o } = Ft(t), r = Object.keys((o == null ? void 0 : o.objects) || {}).map((p) => ({
5867
+ label: p,
5868
+ value: p
5849
5869
  })) || [];
5850
5870
  return /* @__PURE__ */ n("div", { className: "p-6", children: [
5851
5871
  /* @__PURE__ */ e(Xe, { summary: "Map Chart", children: /* @__PURE__ */ e("p", { className: "rounded-md bg-muted p-2 font-mono text-xs", children: "SELECT country, value FROM table" }) }),
5852
5872
  /* @__PURE__ */ e(we, { className: "my-4" }),
5853
5873
  /* @__PURE__ */ e(Xe, { open: !0, summary: "Settings", children: /* @__PURE__ */ n("div", { className: "space-y-3 px-2", children: [
5854
5874
  /* @__PURE__ */ e(
5855
- ge,
5875
+ ye,
5856
5876
  {
5857
5877
  className: "h-9",
5858
5878
  options: [
@@ -5869,11 +5889,11 @@ function Ki() {
5869
5889
  value: "custom"
5870
5890
  }
5871
5891
  ],
5872
- onValueChange: (f) => {
5873
- console.log("value", f), i({
5892
+ onValueChange: (p) => {
5893
+ console.log("value", p), i({
5874
5894
  ...t.preferences,
5875
5895
  mapVisualOptions: {
5876
- topoJsonUrl: f
5896
+ topoJsonUrl: p
5877
5897
  // customTopoJson: undefined,
5878
5898
  }
5879
5899
  });
@@ -5885,21 +5905,21 @@ function Ki() {
5885
5905
  s === "custom" && /* @__PURE__ */ e(
5886
5906
  de,
5887
5907
  {
5888
- onChange: (f) => {
5889
- l(f.target.value);
5908
+ onChange: (p) => {
5909
+ l(p.target.value);
5890
5910
  },
5891
5911
  onBlur: () => {
5892
- var f;
5912
+ var p;
5893
5913
  console.log("onBlur", a), i({
5894
5914
  ...t.preferences,
5895
5915
  mapVisualOptions: {
5896
- ...(f = t.preferences) == null ? void 0 : f.mapVisualOptions,
5916
+ ...(p = t.preferences) == null ? void 0 : p.mapVisualOptions,
5897
5917
  customTopoJsonUrl: a
5898
5918
  }
5899
5919
  });
5900
5920
  },
5901
5921
  value: a,
5902
- className: `h-9 w-full ${De}`,
5922
+ className: `h-9 w-full ${ze}`,
5903
5923
  placeholder: "Custom URL"
5904
5924
  }
5905
5925
  ),
@@ -5907,19 +5927,19 @@ function Ki() {
5907
5927
  /* @__PURE__ */ n("div", { className: "space-y-1", children: [
5908
5928
  /* @__PURE__ */ e(H, { children: "Map Object" }),
5909
5929
  /* @__PURE__ */ e(
5910
- ge,
5930
+ ye,
5911
5931
  {
5912
5932
  className: "h-9",
5913
5933
  options: r,
5914
5934
  value: ((c = (v = t.preferences) == null ? void 0 : v.mapVisualOptions) == null ? void 0 : c.objectKey) || "",
5915
5935
  label: "Map Object",
5916
- onValueChange: (f) => {
5936
+ onValueChange: (p) => {
5917
5937
  var T;
5918
5938
  i({
5919
5939
  ...t.preferences,
5920
5940
  mapVisualOptions: {
5921
5941
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
5922
- objectKey: f
5942
+ objectKey: p
5923
5943
  }
5924
5944
  });
5925
5945
  }
@@ -5929,19 +5949,19 @@ function Ki() {
5929
5949
  /* @__PURE__ */ n("div", { className: "space-y-1", children: [
5930
5950
  /* @__PURE__ */ e(H, { children: "Projection" }),
5931
5951
  /* @__PURE__ */ e(
5932
- ge,
5952
+ ye,
5933
5953
  {
5934
5954
  className: "h-9",
5935
5955
  options: Ui,
5936
- value: ((b = (p = t.preferences) == null ? void 0 : p.mapVisualOptions) == null ? void 0 : b.projection) || "",
5956
+ value: ((f = (g = t.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : f.projection) || "",
5937
5957
  label: "Projection",
5938
- onValueChange: (f) => {
5958
+ onValueChange: (p) => {
5939
5959
  var T;
5940
5960
  i({
5941
5961
  ...t.preferences,
5942
5962
  mapVisualOptions: {
5943
5963
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
5944
- projection: f
5964
+ projection: p
5945
5965
  }
5946
5966
  });
5947
5967
  }
@@ -5951,19 +5971,19 @@ function Ki() {
5951
5971
  /* @__PURE__ */ n("div", { className: "space-y-1", children: [
5952
5972
  /* @__PURE__ */ e(H, { children: "Colors" }),
5953
5973
  /* @__PURE__ */ e(
5954
- ge,
5974
+ ye,
5955
5975
  {
5956
5976
  className: "h-9",
5957
5977
  options: Ji,
5958
5978
  value: ((x = (C = t.preferences) == null ? void 0 : C.mapVisualOptions) == null ? void 0 : x.colorScale) || "",
5959
5979
  label: "Select Color Scale",
5960
- onValueChange: (f) => {
5980
+ onValueChange: (p) => {
5961
5981
  var T;
5962
5982
  i({
5963
5983
  ...t.preferences,
5964
5984
  mapVisualOptions: {
5965
5985
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
5966
- colorScale: f
5986
+ colorScale: p
5967
5987
  }
5968
5988
  });
5969
5989
  }
@@ -5977,17 +5997,17 @@ function Ki() {
5977
5997
  /* @__PURE__ */ e(
5978
5998
  de,
5979
5999
  {
5980
- className: `h-9 w-full ${De}`,
6000
+ className: `h-9 w-full ${ze}`,
5981
6001
  type: "number",
5982
6002
  step: 0.1,
5983
6003
  value: ((N = (D = t.preferences) == null ? void 0 : D.mapVisualOptions) == null ? void 0 : N.projectionScale) || 1,
5984
- onChange: (f) => {
6004
+ onChange: (p) => {
5985
6005
  var T;
5986
6006
  i({
5987
6007
  ...t.preferences,
5988
6008
  mapVisualOptions: {
5989
6009
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
5990
- projectionScale: Number(f.target.value)
6010
+ projectionScale: Number(p.target.value)
5991
6011
  }
5992
6012
  });
5993
6013
  }
@@ -5997,19 +6017,19 @@ function Ki() {
5997
6017
  /* @__PURE__ */ e(
5998
6018
  de,
5999
6019
  {
6000
- className: `h-9 w-full ${De}`,
6020
+ className: `h-9 w-full ${ze}`,
6001
6021
  type: "number",
6002
6022
  step: 10,
6003
- value: ((q = (z = (I = t.preferences) == null ? void 0 : I.mapVisualOptions) == null ? void 0 : z.projectionOffset) == null ? void 0 : q[0]) || 0,
6004
- onChange: (f) => {
6005
- var T, B, V, J;
6023
+ value: ((q = (z = (O = t.preferences) == null ? void 0 : O.mapVisualOptions) == null ? void 0 : z.projectionOffset) == null ? void 0 : q[0]) || 0,
6024
+ onChange: (p) => {
6025
+ var T, B, V, G;
6006
6026
  i({
6007
6027
  ...t.preferences,
6008
6028
  mapVisualOptions: {
6009
6029
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
6010
6030
  projectionOffset: [
6011
- Number(f.target.value),
6012
- ((J = (V = (B = t.preferences) == null ? void 0 : B.mapVisualOptions) == null ? void 0 : V.projectionOffset) == null ? void 0 : J[1]) || 0
6031
+ Number(p.target.value),
6032
+ ((G = (V = (B = t.preferences) == null ? void 0 : B.mapVisualOptions) == null ? void 0 : V.projectionOffset) == null ? void 0 : G[1]) || 0
6013
6033
  ]
6014
6034
  }
6015
6035
  });
@@ -6020,19 +6040,19 @@ function Ki() {
6020
6040
  /* @__PURE__ */ e(
6021
6041
  de,
6022
6042
  {
6023
- className: `h-9 w-full ${De}`,
6043
+ className: `h-9 w-full ${ze}`,
6024
6044
  type: "number",
6025
6045
  step: 10,
6026
- value: ((U = (_ = (P = t.preferences) == null ? void 0 : P.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : U[1]) || 0,
6027
- onChange: (f) => {
6028
- var T, B, V, J;
6046
+ value: ((Q = (_ = (P = t.preferences) == null ? void 0 : P.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : Q[1]) || 0,
6047
+ onChange: (p) => {
6048
+ var T, B, V, G;
6029
6049
  i({
6030
6050
  ...t.preferences,
6031
6051
  mapVisualOptions: {
6032
6052
  ...(T = t.preferences) == null ? void 0 : T.mapVisualOptions,
6033
6053
  projectionOffset: [
6034
- ((J = (V = (B = t.preferences) == null ? void 0 : B.mapVisualOptions) == null ? void 0 : V.projectionOffset) == null ? void 0 : J[0]) || 0,
6035
- Number(f.target.value)
6054
+ ((G = (V = (B = t.preferences) == null ? void 0 : B.mapVisualOptions) == null ? void 0 : V.projectionOffset) == null ? void 0 : G[0]) || 0,
6055
+ Number(p.target.value)
6036
6056
  ]
6037
6057
  }
6038
6058
  });
@@ -6041,7 +6061,7 @@ function Ki() {
6041
6061
  )
6042
6062
  ] }) }),
6043
6063
  /* @__PURE__ */ e(we, { className: "my-4" }),
6044
- /* @__PURE__ */ e(Pe, {})
6064
+ /* @__PURE__ */ e($e, {})
6045
6065
  ] });
6046
6066
  }
6047
6067
  function Qi() {
@@ -6081,7 +6101,7 @@ function rt({
6081
6101
  docContent: s,
6082
6102
  suffix: a = "Chart"
6083
6103
  }) {
6084
- return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(_e, { defaultValue: ["item-2"], type: "multiple", children: [
6104
+ return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(He, { defaultValue: ["item-2"], type: "multiple", children: [
6085
6105
  /* @__PURE__ */ n(ee, { value: "item-1", children: [
6086
6106
  /* @__PURE__ */ e(te, { children: `${bt(t)} ${a}` }),
6087
6107
  /* @__PURE__ */ e(ae, { children: s || /* @__PURE__ */ n("div", { className: "space-y-4 font-mono text-xs", children: [
@@ -6116,7 +6136,7 @@ function rt({
6116
6136
  !["range", "text"].includes(t) && /* @__PURE__ */ n(ee, { value: "item-3", children: [
6117
6137
  /* @__PURE__ */ e(te, { children: "Filters" }),
6118
6138
  /* @__PURE__ */ n(ae, { className: "space-y-4 px-2", children: [
6119
- /* @__PURE__ */ e(Pe, {}),
6139
+ /* @__PURE__ */ e($e, {}),
6120
6140
  /* @__PURE__ */ e(We, {})
6121
6141
  ] })
6122
6142
  ] })
@@ -6133,7 +6153,7 @@ function Wi() {
6133
6153
  return /* @__PURE__ */ n("div", { className: "space-y-2", children: [
6134
6154
  /* @__PURE__ */ e(H, { children: "Sort" }),
6135
6155
  /* @__PURE__ */ e(
6136
- ge,
6156
+ ye,
6137
6157
  {
6138
6158
  className: "h-8",
6139
6159
  label: "Sort Chart",
@@ -6159,7 +6179,7 @@ function Wi() {
6159
6179
  )
6160
6180
  ] });
6161
6181
  }
6162
- return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(_e, { defaultValue: ["item-2"], type: "multiple", children: [
6182
+ return /* @__PURE__ */ e("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ n(He, { defaultValue: ["item-2"], type: "multiple", children: [
6163
6183
  /* @__PURE__ */ n(ee, { value: "item-1", children: [
6164
6184
  /* @__PURE__ */ e(te, { children: "Stacked Chart" }),
6165
6185
  /* @__PURE__ */ n(ae, { className: "space-y-4 font-mono text-xs", children: [
@@ -6195,7 +6215,7 @@ function Wi() {
6195
6215
  /* @__PURE__ */ n(ee, { value: "item-3", children: [
6196
6216
  /* @__PURE__ */ e(te, { children: "Filters" }),
6197
6217
  /* @__PURE__ */ n(ae, { className: "space-y-4 px-2", children: [
6198
- /* @__PURE__ */ e(Pe, {}),
6218
+ /* @__PURE__ */ e($e, {}),
6199
6219
  /* @__PURE__ */ e(We, {})
6200
6220
  ] })
6201
6221
  ] })
@@ -6212,10 +6232,10 @@ function Zi({
6212
6232
  (i) => i.actions.setCardPreferences
6213
6233
  );
6214
6234
  return /* @__PURE__ */ n("div", { className: "space-y-6 px-6 py-2", children: [
6215
- /* @__PURE__ */ e(_e, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ n(ee, { value: "item-3", children: [
6235
+ /* @__PURE__ */ e(He, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ n(ee, { value: "item-3", children: [
6216
6236
  /* @__PURE__ */ e(te, { children: "Filters" }),
6217
6237
  /* @__PURE__ */ n(ae, { className: "space-y-4 px-2", children: [
6218
- /* @__PURE__ */ e(Pe, {}),
6238
+ /* @__PURE__ */ e($e, {}),
6219
6239
  /* @__PURE__ */ e(We, {})
6220
6240
  ] })
6221
6241
  ] }) }),
@@ -6329,7 +6349,7 @@ function tr() {
6329
6349
  return /* @__PURE__ */ e(Hi, {});
6330
6350
  }
6331
6351
  }
6332
- return /* @__PURE__ */ n(Oe, { className: "h-full w-full text-sm", children: [
6352
+ return /* @__PURE__ */ n(Te, { className: "h-full w-full text-sm", children: [
6333
6353
  s(t),
6334
6354
  /* @__PURE__ */ e(Ue, { orientation: "horizontal" })
6335
6355
  ] });
@@ -6346,7 +6366,7 @@ function ar() {
6346
6366
  className: "min-h-[250px] min-w-full max-w-lg",
6347
6367
  children: [
6348
6368
  /* @__PURE__ */ e(
6349
- fe,
6369
+ ge,
6350
6370
  {
6351
6371
  role: "query-section",
6352
6372
  className: "flex",
@@ -6357,7 +6377,7 @@ function ar() {
6357
6377
  ),
6358
6378
  /* @__PURE__ */ e(at, { withHandle: !0, className: "border" }),
6359
6379
  /* @__PURE__ */ e(
6360
- fe,
6380
+ ge,
6361
6381
  {
6362
6382
  className: "pb-1",
6363
6383
  role: "visual-section",
@@ -6365,7 +6385,7 @@ function ar() {
6365
6385
  defaultSize: 60,
6366
6386
  children: s && !a ? /* @__PURE__ */ n(tt, { direction: "horizontal", children: [
6367
6387
  /* @__PURE__ */ e(se, { children: /* @__PURE__ */ e(
6368
- fe,
6388
+ ge,
6369
6389
  {
6370
6390
  ref: t,
6371
6391
  className: "flex",
@@ -6375,7 +6395,7 @@ function ar() {
6375
6395
  }
6376
6396
  ) }),
6377
6397
  !a && /* @__PURE__ */ e(at, { className: "border" }),
6378
- /* @__PURE__ */ e(fe, { minSize: 40, defaultSize: 75, maxSize: 100, children: /* @__PURE__ */ e(ra, {}) })
6398
+ /* @__PURE__ */ e(ge, { minSize: 40, defaultSize: 75, maxSize: 100, children: /* @__PURE__ */ e(ra, {}) })
6379
6399
  ] }) : /* @__PURE__ */ e(ra, {})
6380
6400
  }
6381
6401
  )
@@ -6394,22 +6414,22 @@ const sr = !1, nr = [
6394
6414
  }
6395
6415
  ];
6396
6416
  function lr() {
6397
- const t = Je(null), s = Je(null), [a, l] = j(!1), [i, o] = j(sr), [r, d] = j(!1), u = m((w) => w.actions.setCardSql), y = m((w) => w.actions.setRunSql), h = m((w) => w.showAIDialog), { setShowAIDialog: g } = ne(), {
6417
+ const t = Je(null), s = Je(null), [a, l] = j(!1), [i, o] = j(sr), [r, d] = j(!1), u = m((w) => w.actions.setCardSql), b = m((w) => w.actions.setRunSql), h = m((w) => w.showAIDialog), { setShowAIDialog: y } = ne(), {
6398
6418
  messages: v,
6399
6419
  setMessages: c,
6400
- reload: p,
6401
- append: b,
6420
+ reload: g,
6421
+ append: f,
6402
6422
  input: C,
6403
6423
  setInput: x,
6404
6424
  isLoading: D,
6405
6425
  handleAddCurrentTableToScope: N,
6406
- removeFromCurrentSelections: I,
6426
+ removeFromCurrentSelections: O,
6407
6427
  currentAssitantScope: z,
6408
6428
  handleInputChange: q,
6409
6429
  handleSubmit: P,
6410
6430
  stop: _,
6411
- chatStatus: U,
6412
- toolStatus: f,
6431
+ chatStatus: Q,
6432
+ toolStatus: p,
6413
6433
  llmUsage: T
6414
6434
  } = gs();
6415
6435
  Vn({
@@ -6421,16 +6441,16 @@ function lr() {
6421
6441
  h && ((w = s.current) == null || w.focus());
6422
6442
  }, [h]);
6423
6443
  function B(w) {
6424
- u(w), y(!0);
6444
+ u(w), b(!0);
6425
6445
  }
6426
6446
  function V(w) {
6427
6447
  const A = {
6428
6448
  role: "user",
6429
6449
  content: w.title + " " + w.subtitle
6430
6450
  };
6431
- b(A);
6451
+ f(A);
6432
6452
  }
6433
- function J() {
6453
+ function G() {
6434
6454
  return /* @__PURE__ */ n(fa, { children: [
6435
6455
  /* @__PURE__ */ e(ga, { asChild: !0, children: /* @__PURE__ */ e($, { className: "h-7 p-2", size: "sm", variant: "ghost", children: /* @__PURE__ */ e(as, { className: "size-3.5 text-muted-foreground/70 hover:text-muted-foreground" }) }) }),
6436
6456
  /* @__PURE__ */ n(ya, { align: "end", children: [
@@ -6481,7 +6501,7 @@ function lr() {
6481
6501
  "button",
6482
6502
  {
6483
6503
  onClick: () => {
6484
- I(w);
6504
+ O(w);
6485
6505
  },
6486
6506
  children: /* @__PURE__ */ e(Ge, { className: "size-3 text-muted-foreground hover:text-foreground" })
6487
6507
  }
@@ -6523,7 +6543,7 @@ function lr() {
6523
6543
  children: [
6524
6544
  W(),
6525
6545
  /* @__PURE__ */ n("div", { "data-role": "header-actions", className: "flex items-center", children: [
6526
- J(),
6546
+ G(),
6527
6547
  /* @__PURE__ */ e(
6528
6548
  $,
6529
6549
  {
@@ -6531,7 +6551,7 @@ function lr() {
6531
6551
  size: "sm",
6532
6552
  variant: "ghost",
6533
6553
  onClick: () => {
6534
- c([]), p();
6554
+ c([]), g();
6535
6555
  },
6536
6556
  children: /* @__PURE__ */ e(qn, { className: "size-3.5 text-muted-foreground" })
6537
6557
  }
@@ -6543,7 +6563,7 @@ function lr() {
6543
6563
  size: "sm",
6544
6564
  variant: "ghost",
6545
6565
  onClick: () => {
6546
- g(!1);
6566
+ y(!1);
6547
6567
  },
6548
6568
  children: /* @__PURE__ */ e(Ge, { className: "size-4" })
6549
6569
  }
@@ -6570,7 +6590,7 @@ function lr() {
6570
6590
  /* @__PURE__ */ e(
6571
6591
  _n,
6572
6592
  {
6573
- status: Hn(U, f),
6593
+ status: Hn(Q, p),
6574
6594
  isLoading: D
6575
6595
  }
6576
6596
  )
@@ -6615,17 +6635,17 @@ function lr() {
6615
6635
  );
6616
6636
  }
6617
6637
  function ir({ authToken: t, onSave: s, onClose: a }) {
6618
- const l = Je(null), i = m((g) => g.showAIDialog), { setAuthToken: o } = Ke(), { setShowAIDialog: r, setOnSave: d, setOnClose: u } = ne();
6638
+ const l = Je(null), i = m((y) => y.showAIDialog), { setAuthToken: o } = Ke(), { setShowAIDialog: r, setOnSave: d, setOnClose: u } = ne();
6619
6639
  oe(() => {
6620
6640
  s && d(s), a && u(a);
6621
6641
  }, [s, d, a, u]), oe(() => {
6622
6642
  t && t.accessToken && o(t);
6623
6643
  }, [t, o]), oe(() => {
6624
- var g, v;
6625
- i ? ((g = l.current) == null || g.resize(40), r(!0)) : (r(!1), (v = l.current) == null || v.resize(0));
6644
+ var y, v;
6645
+ i ? ((y = l.current) == null || y.resize(40), r(!0)) : (r(!1), (v = l.current) == null || v.resize(0));
6626
6646
  }, [i, r]);
6627
- function y(g) {
6628
- g < 1 ? r(!1) : i || r(!0);
6647
+ function b(y) {
6648
+ y < 1 ? r(!1) : i || r(!0);
6629
6649
  }
6630
6650
  function h() {
6631
6651
  return /* @__PURE__ */ n(
@@ -6635,14 +6655,14 @@ function ir({ authToken: t, onSave: s, onClose: a }) {
6635
6655
  className: "grow",
6636
6656
  direction: "horizontal",
6637
6657
  children: [
6638
- /* @__PURE__ */ e(fe, { className: "min-w-[510px] rounded-none border-x-[1px]", children: /* @__PURE__ */ e(ar, {}) }),
6658
+ /* @__PURE__ */ e(ge, { className: "min-w-[510px] rounded-none border-x-[1px]", children: /* @__PURE__ */ e(ar, {}) }),
6639
6659
  /* @__PURE__ */ e(at, {}),
6640
6660
  /* @__PURE__ */ e(
6641
- fe,
6661
+ ge,
6642
6662
  {
6643
6663
  "data-role": "editor-assistant-panel",
6644
6664
  ref: l,
6645
- onResize: y,
6665
+ onResize: b,
6646
6666
  defaultSize: 0,
6647
6667
  children: /* @__PURE__ */ e(lr, {})
6648
6668
  }
@@ -6657,8 +6677,8 @@ function ir({ authToken: t, onSave: s, onClose: a }) {
6657
6677
  ] }) });
6658
6678
  }
6659
6679
  function rr() {
6660
- O((r) => r.selectedCardId);
6661
- const t = O((r) => r.selectedSheetId), { setIsVisualEditing: s } = O((r) => r.actions), a = O((r) => r.isVisualEditing), l = O((r) => r.actions.updateFrame);
6680
+ I((r) => r.selectedCardId);
6681
+ const t = I((r) => r.selectedSheetId), { setIsVisualEditing: s } = I((r) => r.actions), a = I((r) => r.isVisualEditing), l = I((r) => r.actions.updateFrame);
6662
6682
  function i(r) {
6663
6683
  t && (l(t, r), s(!1));
6664
6684
  }
@@ -6669,7 +6689,7 @@ function rr() {
6669
6689
  "div",
6670
6690
  {
6671
6691
  role: "editor-container",
6672
- className: Y("flex grow", {
6692
+ className: Z("flex grow", {
6673
6693
  "max-h-0 overflow-hidden": !a
6674
6694
  }),
6675
6695
  children: /* @__PURE__ */ e(ir, { onSave: i, onClose: o })
@@ -6677,8 +6697,8 @@ function rr() {
6677
6697
  );
6678
6698
  }
6679
6699
  function or() {
6680
- const t = m((o) => o.selectedDatabaseName), s = m((o) => o.selectedTableName), a = O((o) => o.dashboard.filters) || [], { columns: l } = He(), { assignFilter: i } = Ms();
6681
- return /* @__PURE__ */ e(Oe, { className: "flex-1 basis-0 flex-col px-3", children: l == null ? void 0 : l.map((o) => {
6700
+ const t = m((o) => o.selectedDatabaseName), s = m((o) => o.selectedTableName), a = I((o) => o.dashboard.filters) || [], { columns: l } = Pe(), { assignFilter: i } = Ms();
6701
+ return /* @__PURE__ */ e(Te, { className: "flex-1 basis-0 flex-col px-3", children: l == null ? void 0 : l.map((o) => {
6682
6702
  const r = a == null ? void 0 : a.find(
6683
6703
  (d) => d.column === be(o.column_name) && d.table === s && d.database === t
6684
6704
  );
@@ -6686,7 +6706,7 @@ function or() {
6686
6706
  "div",
6687
6707
  {
6688
6708
  onClick: () => i(o),
6689
- className: Y(
6709
+ className: Z(
6690
6710
  "group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",
6691
6711
  {
6692
6712
  "bg-muted": r
@@ -6702,8 +6722,8 @@ function or() {
6702
6722
  }) });
6703
6723
  }
6704
6724
  function cr() {
6705
- O((s) => s.showFilters);
6706
- const t = O(
6725
+ I((s) => s.showFilters);
6726
+ const t = I(
6707
6727
  (s) => s.actions.setShowFilters
6708
6728
  );
6709
6729
  return /* @__PURE__ */ n("section", { className: "relative flex min-w-[320px] grow flex-col border-l px-1", children: [
@@ -6734,11 +6754,11 @@ function cr() {
6734
6754
  ] });
6735
6755
  }
6736
6756
  function dr() {
6737
- const t = O((l) => l.dashboard.filters), s = O((l) => l.theme), a = t == null ? void 0 : t.filter((l) => l.hide);
6757
+ const t = I((l) => l.dashboard.filters), s = I((l) => l.theme), a = t == null ? void 0 : t.filter((l) => l.hide);
6738
6758
  return a != null && a.length ? /* @__PURE__ */ e(
6739
6759
  "div",
6740
6760
  {
6741
- className: Y("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
6761
+ className: Z("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
6742
6762
  "bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": s === "light",
6743
6763
  "bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": s === "dark"
6744
6764
  }),
@@ -6757,14 +6777,14 @@ function dr() {
6757
6777
  ) : null;
6758
6778
  }
6759
6779
  function hr() {
6760
- const t = O((l) => l.showFilters), s = O((l) => l.isVisualEditing), a = O(
6780
+ const t = I((l) => l.showFilters), s = I((l) => l.isVisualEditing), a = I(
6761
6781
  (l) => l.isDashboardEditing
6762
6782
  );
6763
6783
  return /* @__PURE__ */ n(
6764
6784
  "div",
6765
6785
  {
6766
6786
  role: "dashboard-plus-main",
6767
- className: Y("", {
6787
+ className: Z("", {
6768
6788
  "max-h-0 overflow-hidden": s,
6769
6789
  "flex grow overflow-auto": !s
6770
6790
  // can't do h-full because parent container has dashboard controls (10px height)
@@ -6781,15 +6801,15 @@ function hr() {
6781
6801
  );
6782
6802
  }
6783
6803
  function ur() {
6784
- const t = O((i) => i.dashboard), s = O((i) => i.actions.setDashboard), a = O(
6804
+ const t = I((i) => i.dashboard), s = I((i) => i.actions.setDashboard), a = I(
6785
6805
  (i) => i.showDashboardJSON
6786
- ), l = O(
6806
+ ), l = I(
6787
6807
  (i) => i.actions.setShowDashboardJSON
6788
6808
  );
6789
6809
  return /* @__PURE__ */ n(
6790
6810
  "div",
6791
6811
  {
6792
- className: Y("relative p-2", {
6812
+ className: Z("relative p-2", {
6793
6813
  hidden: !a
6794
6814
  }),
6795
6815
  children: [
@@ -6884,10 +6904,10 @@ export {
6884
6904
  dt as resolveDatamodelName,
6885
6905
  zr as useCard,
6886
6906
  Ke as useDashboardActions,
6887
- O as useDashboardStore,
6907
+ I as useDashboardStore,
6888
6908
  Ir as useDateFilterHook,
6889
6909
  ne as useEditorActions,
6890
- He as useEditorAside,
6910
+ Pe as useEditorAside,
6891
6911
  m as useEditorStore,
6892
6912
  Or as useTextFilterHook
6893
6913
  };