react-semaphor 0.0.344 → 0.0.346

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.
@@ -1,4 +1,4 @@
1
- import { c as R, u as vs, v as M, w as is, x as Se, y as e, z as Cs, A as Ns, H as O, o as Ss, J as ws, K as ks, M as zs, N as Os, O as H, Q as re, R as ta, V as na, W as la, Y as ra, Z as st, _ as at, $ as tt, a0 as Gs, a1 as Y, a2 as Be, i as nt, a3 as h, a4 as lt, P as ia, F as oa, a5 as Ue, a6 as Ge, a7 as Ds, a8 as ca, a9 as Ms, aa as ue, ab as he, ac as me, ad as xe, ae as ve, af as pe, ag as X, T as Is, ah as Ts, ai as Ls, aj as Fs, ak as da, al as ua, am as ce, an as rt, ao as it, ap as ha, aq as ot, C as ct, ar as dt, as as ma, B as ut, at as fe, au as ht, av as Ke, aw as xa, ax as gs, ay as be, az as ze, aA as Ce, aB as pa, aC as mt, aD as xt, aE as pt, aF as ft, l as gt, aG as jt, aH as bt, aI as De, aJ as ne, aK as yt, aL as fa, aM as os, aN as vt, aO as Ct, aP as js, a as Nt, aQ as ss, aR as ye, aS as as, aT as St, aU as wt, aV as kt, aW as zt, aX as fs, aY as Ot, aZ as Ks, a_ as Dt, a$ as Qs, b0 as Mt, b1 as It, b2 as Tt, b3 as Lt, b4 as ga, b5 as Ft, b6 as Es, b7 as ja, b8 as Et, b9 as At, ba as Xe, bb as Vt, bc as qt, bd as ba, be as Rt, s as _t, bf as Ht, bg as Pt, r as $t, bh as cs, bi as ya, bj as va, bk as Ca, bl as Ze, bm as Na, bn as es, bo as Js, bp as Bt, bq as Ut, br as ds, bs as us, bt as hs, bu as Gt, I as Kt, X as Sa, bv as Qt, bw as Jt, bx as Wt, E as Yt, by as ms, bz as Oe, f as Xt, bA as Pe, bB as As, bC as wa, bD as Zt, bE as en, bF as ts, bG as sn, bH as an, bI as tn, bJ as Ws, bK as ka, bL as nn, bM as ln, bN as rn, bO as on, bP as cn, bQ as dn, bR as un, bS as Me, bT as Q, bU as J, bV as Vs, bW as W, bX as hn, bY as za, bZ as mn, b_ as xn, b$ as pn, c0 as fn, c1 as gn, c2 as jn, c3 as bn, c4 as yn, c5 as vn } from "./index-DzAvZhsF.js";
1
+ import { c as R, u as vs, v as M, w as is, x as Se, y as e, z as Cs, A as Ns, H as O, o as Ss, J as ws, K as ks, M as zs, N as Os, O as H, Q as ie, R as ta, V as na, W as la, Y as ra, Z as st, _ as at, $ as tt, a0 as Gs, a1 as Y, a2 as Be, i as nt, a3 as u, a4 as lt, P as ia, F as oa, a5 as Ue, a6 as Ge, a7 as Ds, a8 as ca, a9 as Ms, aa as ue, ab as he, ac as me, ad as xe, ae as ve, af as pe, ag as X, T as Is, ah as Ts, ai as Ls, aj as Fs, ak as da, al as ua, am as ce, an as rt, ao as it, ap as ha, aq as ot, C as ct, ar as dt, as as ma, B as ut, at as fe, au as ht, av as Ke, aw as xa, ax as gs, ay as be, az as ze, aA as Ce, aB as pa, aC as mt, aD as xt, aE as pt, aF as ft, l as gt, aG as jt, aH as bt, aI as De, aJ as ne, aK as fa, aL as yt, aM as os, aN as vt, aO as Ct, aP as js, a as Nt, aQ as ss, aR as ye, aS as as, aT as St, aU as wt, aV as kt, aW as zt, aX as fs, aY as Ot, aZ as Ks, a_ as Dt, a$ as Qs, b0 as Mt, b1 as It, b2 as Tt, b3 as Lt, b4 as ga, b5 as Ft, b6 as Es, b7 as ja, b8 as Et, b9 as At, ba as Xe, bb as Vt, bc as qt, bd as ba, be as Rt, s as _t, bf as Ht, bg as Pt, r as $t, bh as cs, bi as ya, bj as va, bk as Ca, bl as Ze, bm as Na, bn as es, bo as Js, bp as Bt, bq as Ut, br as ds, bs as us, bt as hs, bu as Gt, I as Kt, X as Sa, bv as Qt, bw as Jt, bx as Wt, E as Yt, by as ms, bz as Oe, f as Xt, bA as Pe, bB as As, bC as wa, bD as Zt, bE as en, bF as ts, bG as sn, bH as an, bI as tn, bJ as Ws, bK as ka, bL as nn, bM as ln, bN as rn, bO as on, bP as cn, bQ as dn, bR as un, bS as Me, bT as Q, bU as J, bV as Vs, bW as W, bX as hn, bY as za, bZ as mn, b_ as xn, b$ as pn, c0 as fn, c1 as gn, c2 as jn, c3 as bn, c4 as yn, c5 as vn } from "./index-ggRRMgwy.js";
2
2
  import * as Ys from "react";
3
3
  import Ne, { useState as q, useMemo as bs, useEffect as Z, useRef as ns, useCallback as Oa, Suspense as Cn } from "react";
4
4
  import "react-dom";
@@ -516,7 +516,7 @@ function Ea(s) {
516
516
  var r;
517
517
  return {
518
518
  ...l,
519
- cards: (r = l.cards) == null ? void 0 : r.map((c) => Wn(c))
519
+ cards: (r = l.cards) == null ? void 0 : r.map((o) => Wn(o))
520
520
  };
521
521
  })
522
522
  };
@@ -571,13 +571,13 @@ async function Xn(s, n, a, t) {
571
571
  async function ys(s, n) {
572
572
  if (!n)
573
573
  return null;
574
- const { id: a, template: t, filterValues: l, isDefault: r, shared: c } = s;
574
+ const { id: a, template: t, filterValues: l, isDefault: r, shared: o } = s;
575
575
  return await vs("https://semaphor.cloud/api/v1/lens", n, {
576
576
  lensId: a,
577
577
  template: t,
578
578
  filterValues: l,
579
579
  isDefault: r,
580
- shared: c,
580
+ shared: o,
581
581
  operation: "update"
582
582
  });
583
583
  }
@@ -588,20 +588,20 @@ async function Zn(s, n) {
588
588
  }) : null;
589
589
  }
590
590
  function el() {
591
- const [s, n] = q(""), [a, t] = q(!1), l = M((y) => y.lenses), { setLenses: r, setSelectedLensId: c } = is(), [i, u] = q(!1), [p, d] = q(!1), j = M((y) => y.dashboard), g = M((y) => y.filterValues), { authToken: o } = Se();
592
- async function x() {
593
- u(!0);
594
- const y = Ea(
595
- j
596
- ), z = await Xn(
591
+ const [s, n] = q(""), [a, t] = q(!1), l = M((p) => p.lenses), { setLenses: r, setSelectedLensId: o } = is(), [i, d] = q(!1), [x, c] = q(!1), b = M((p) => p.dashboard), g = M((p) => p.filterValues), { authToken: h } = Se();
592
+ async function f() {
593
+ d(!0);
594
+ const p = Ea(
595
+ b
596
+ ), N = await Xn(
597
597
  s,
598
- y,
598
+ p,
599
599
  g,
600
- o == null ? void 0 : o.accessToken
600
+ h == null ? void 0 : h.accessToken
601
601
  );
602
- z && (r([...l || [], z]), c(z.id), d(!1)), u(!1);
602
+ N && (r([...l || [], N]), o(N.id), c(!1)), d(!1);
603
603
  }
604
- return /* @__PURE__ */ e.jsxs(Cs, { open: p, onOpenChange: d, children: [
604
+ return /* @__PURE__ */ e.jsxs(Cs, { open: x, onOpenChange: c, children: [
605
605
  /* @__PURE__ */ e.jsx(Ns, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
606
606
  O,
607
607
  {
@@ -622,11 +622,11 @@ function el() {
622
622
  /* @__PURE__ */ e.jsx("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-8 items-center gap-4", children: [
623
623
  /* @__PURE__ */ e.jsx(H, { className: "text-right", children: "Name" }),
624
624
  /* @__PURE__ */ e.jsx(
625
- re,
625
+ ie,
626
626
  {
627
627
  value: s,
628
- onChange: (y) => {
629
- n(y.target.value);
628
+ onChange: (p) => {
629
+ n(p.target.value);
630
630
  },
631
631
  id: "name",
632
632
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -640,7 +640,7 @@ function el() {
640
640
  size: "sm",
641
641
  variant: "outline",
642
642
  type: "submit",
643
- onClick: x,
643
+ onClick: f,
644
644
  disabled: i,
645
645
  children: i ? "Creating..." : "Add"
646
646
  }
@@ -649,37 +649,37 @@ function el() {
649
649
  ] });
650
650
  }
651
651
  function sl() {
652
- const [s, n] = q(!1), a = M((d) => d.lenses), t = M((d) => d.selectedLensId), { setLenses: l, setSelectedLensId: r } = is(), { authToken: c } = Se();
653
- async function i(d) {
654
- r(d);
652
+ const [s, n] = q(!1), a = M((c) => c.lenses), t = M((c) => c.selectedLensId), { setLenses: l, setSelectedLensId: r } = is(), { authToken: o } = Se();
653
+ async function i(c) {
654
+ r(c);
655
655
  }
656
- async function u(d) {
657
- if (await Zn(d, c == null ? void 0 : c.accessToken)) {
658
- const g = a == null ? void 0 : a.filter((o) => o.id !== d);
656
+ async function d(c) {
657
+ if (await Zn(c, o == null ? void 0 : o.accessToken)) {
658
+ const g = a == null ? void 0 : a.filter((h) => h.id !== c);
659
659
  l(g || []), r("original");
660
660
  }
661
661
  }
662
- async function p(d) {
663
- const j = a == null ? void 0 : a.map((x) => x.id === d.id ? {
664
- ...x,
665
- isDefault: !d.isDefault
662
+ async function x(c) {
663
+ const b = a == null ? void 0 : a.map((f) => f.id === c.id ? {
664
+ ...f,
665
+ isDefault: !c.isDefault
666
666
  } : {
667
- ...x,
667
+ ...f,
668
668
  isDefault: !1
669
669
  });
670
- l(j || []);
670
+ l(b || []);
671
671
  const g = {
672
- ...d,
673
- isDefault: !d.isDefault
672
+ ...c,
673
+ isDefault: !c.isDefault
674
674
  };
675
- await ys(g, c == null ? void 0 : c.accessToken);
676
- const o = a == null ? void 0 : a.find((x) => x.isDefault);
677
- if (o && o.id !== d.id) {
678
- const x = {
679
- ...o,
675
+ await ys(g, o == null ? void 0 : o.accessToken);
676
+ const h = a == null ? void 0 : a.find((f) => f.isDefault);
677
+ if (h && h.id !== c.id) {
678
+ const f = {
679
+ ...h,
680
680
  isDefault: !1
681
681
  };
682
- await ys(x, c == null ? void 0 : c.accessToken);
682
+ await ys(f, o == null ? void 0 : o.accessToken);
683
683
  }
684
684
  }
685
685
  return /* @__PURE__ */ e.jsxs(na, { open: s, onOpenChange: n, children: [
@@ -694,25 +694,25 @@ function sl() {
694
694
  onValueChange: i,
695
695
  children: [
696
696
  /* @__PURE__ */ e.jsx(Gs, { value: "original", children: "Original" }),
697
- a == null ? void 0 : a.map((d) => /* @__PURE__ */ e.jsxs(
697
+ a == null ? void 0 : a.map((c) => /* @__PURE__ */ e.jsxs(
698
698
  Gs,
699
699
  {
700
700
  className: "group flex justify-between gap-2",
701
- value: d.id,
701
+ value: c.id,
702
702
  children: [
703
- /* @__PURE__ */ e.jsx("p", { children: d.name }),
703
+ /* @__PURE__ */ e.jsx("p", { children: c.name }),
704
704
  /* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-3", children: [
705
705
  /* @__PURE__ */ e.jsx(
706
706
  Fn,
707
707
  {
708
- onClick: (j) => {
709
- j.preventDefault(), p(d);
708
+ onClick: (b) => {
709
+ b.preventDefault(), x(c);
710
710
  },
711
711
  className: Y(
712
712
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
713
713
  {
714
- invisible: !d.isDefault,
715
- "text-green-500": d.isDefault
714
+ invisible: !c.isDefault,
715
+ "text-green-500": c.isDefault
716
716
  }
717
717
  ),
718
718
  strokeWidth: 1.5
@@ -721,8 +721,8 @@ function sl() {
721
721
  /* @__PURE__ */ e.jsx(
722
722
  Be,
723
723
  {
724
- onClick: (j) => {
725
- j.preventDefault(), u(d.id);
724
+ onClick: (b) => {
725
+ b.preventDefault(), d(c.id);
726
726
  },
727
727
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
728
728
  strokeWidth: 1.5
@@ -731,7 +731,7 @@ function sl() {
731
731
  ] })
732
732
  ]
733
733
  },
734
- d.id
734
+ c.id
735
735
  ))
736
736
  ]
737
737
  }
@@ -743,18 +743,18 @@ function al({
743
743
  iconClassName: s
744
744
  }) {
745
745
  const [n, a] = q(!1), { authToken: t } = Se(), l = M((i) => i.theme), r = M((i) => i.filterValues);
746
- async function c() {
746
+ async function o() {
747
747
  {
748
748
  a(!0);
749
749
  const i = new URLSearchParams();
750
750
  i.set("token", (t == null ? void 0 : t.accessToken) || ""), i.set("theme", l || "light"), i.set("filterValues", JSON.stringify(r));
751
- const u = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(i.toString())}`, d = await (await fetch(u, {
751
+ const d = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(i.toString())}`, c = await (await fetch(d, {
752
752
  method: "GET",
753
753
  headers: {
754
754
  Authorization: `Bearer ${t == null ? void 0 : t.accessToken}`
755
755
  }
756
- })).blob(), j = URL.createObjectURL(d);
757
- window.open(j, "_blank"), a(!1);
756
+ })).blob(), b = URL.createObjectURL(c);
757
+ window.open(b, "_blank"), a(!1);
758
758
  }
759
759
  }
760
760
  return /* @__PURE__ */ e.jsx(
@@ -763,7 +763,7 @@ function al({
763
763
  variant: "link",
764
764
  className: "group h-7 p-2",
765
765
  size: "sm",
766
- onClick: c,
766
+ onClick: o,
767
767
  children: n ? /* @__PURE__ */ e.jsx(Ve, { className: Y("size-3.5 animate-spin", s) }) : /* @__PURE__ */ e.jsx(
768
768
  nt,
769
769
  {
@@ -775,30 +775,29 @@ function al({
775
775
  );
776
776
  }
777
777
  function tl() {
778
- q(!1);
779
778
  const { authToken: s } = Se();
780
- M((f) => f.theme);
781
- const n = M((f) => f.lenses), a = M((f) => f.selectedLensId), t = n == null ? void 0 : n.find((f) => f.id === a), l = M((f) => f.dashboard);
782
- M((f) => f.selectedSheetId);
779
+ M((j) => j.theme);
780
+ const n = M((j) => j.lenses), a = M((j) => j.selectedLensId), t = n == null ? void 0 : n.find((j) => j.id === a), l = M((j) => j.dashboard);
781
+ M((j) => j.selectedSheetId);
783
782
  const r = M(
784
- (f) => f.isDashboardEditing
785
- ), c = h(
786
- (f) => f.selectedConnectionId
787
- ), [i, u] = q(!1), p = M((f) => f.filterValues), d = M((f) => f.isVisualEditing), j = M((f) => f.showFilters);
783
+ (j) => j.isDashboardEditing
784
+ ), o = u(
785
+ (j) => j.selectedConnectionId
786
+ ), [i, d] = q(!1), x = M((j) => j.filterValues), c = M((j) => j.isVisualEditing), b = M((j) => j.showFilters);
788
787
  M(
789
- (f) => f.showDashboardJSON
788
+ (j) => j.showDashboardJSON
790
789
  );
791
- const g = M((f) => f.onSaveFunction), o = M(
792
- (f) => f.actions.setShowFilters
793
- ), { addFrame: x, setSelectedFrameId: y } = M(
794
- (f) => f.actions
795
- ), { getSelectedSheet: z, setIsDashboardEditing: b, setShowDashboardJSON: A } = M((f) => f.actions), I = z(), { tenantId: k, endUserId: T } = bs(
790
+ const g = M((j) => j.onSaveFunction), h = M(
791
+ (j) => j.actions.setShowFilters
792
+ ), { addFrame: f, setSelectedFrameId: p } = M(
793
+ (j) => j.actions
794
+ ), { getSelectedSheet: N, setIsDashboardEditing: y, setShowDashboardJSON: A } = M((j) => j.actions), I = N(), { tenantId: z, endUserId: T } = bs(
796
795
  () => lt(s == null ? void 0 : s.accessToken),
797
796
  [s == null ? void 0 : s.accessToken]
798
- ), L = bs(() => k || T, [k, T]), V = () => {
797
+ ), L = bs(() => z || T, [z, T]), V = () => {
799
798
  if (!r || !I) return;
800
- const f = {
801
- connectionId: c,
799
+ const j = {
800
+ connectionId: o,
802
801
  id: Ue(),
803
802
  title: "Title",
804
803
  description: "Description",
@@ -815,36 +814,36 @@ function tl() {
815
814
  data: []
816
815
  }, D = {
817
816
  id: Ue(),
818
- cards: [f],
819
- activeCardId: f.id
817
+ cards: [j],
818
+ activeCardId: j.id
820
819
  };
821
- x(I.id, D), y(D.id);
820
+ f(I.id, D), p(D.id);
822
821
  }, m = () => {
823
- b(!0);
822
+ y(!0);
824
823
  };
825
824
  async function v() {
826
- if (u(!0), !a || !t) return;
827
- const f = Ea(
825
+ if (d(!0), !a || !t) return;
826
+ const j = Ea(
828
827
  l
829
- ), D = JSON.stringify(f), N = {
828
+ ), D = JSON.stringify(j), S = {
830
829
  ...t,
831
830
  template: D,
832
- filterValues: p
831
+ filterValues: x
833
832
  };
834
- await ys(N, s == null ? void 0 : s.accessToken), Ge.success("Lens saved"), g == null || g(f), u(!1);
833
+ await ys(S, s == null ? void 0 : s.accessToken), Ge.success("Lens saved"), g == null || g(j), d(!1);
835
834
  }
836
- return d ? null : /* @__PURE__ */ e.jsxs(
835
+ return c ? null : /* @__PURE__ */ e.jsxs(
837
836
  "div",
838
837
  {
839
838
  className: "flex items-center justify-between gap-2 border-b bg-muted/50 py-2 pl-3 pr-2",
840
839
  role: "dashboard-controls",
841
840
  children: [
842
- !d && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx(H, { children: t == null ? void 0 : t.name }) }),
841
+ !c && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx(H, { children: t == null ? void 0 : t.name }) }),
843
842
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
844
843
  /* @__PURE__ */ e.jsx(al, {}),
845
- r && !d && L && /* @__PURE__ */ e.jsx(el, {}),
846
- !d && L && /* @__PURE__ */ e.jsx(sl, {}),
847
- r && !d && /* @__PURE__ */ e.jsxs(
844
+ r && !c && L && /* @__PURE__ */ e.jsx(el, {}),
845
+ !c && L && /* @__PURE__ */ e.jsx(sl, {}),
846
+ r && !c && /* @__PURE__ */ e.jsxs(
848
847
  O,
849
848
  {
850
849
  variant: "secondary",
@@ -868,20 +867,20 @@ function tl() {
868
867
  children: /* @__PURE__ */ e.jsx(ia, { className: "h-4 w-4", strokeWidth: 1.5 })
869
868
  }
870
869
  ),
871
- r && !d && /* @__PURE__ */ e.jsx(
870
+ r && !c && /* @__PURE__ */ e.jsx(
872
871
  O,
873
872
  {
874
873
  variant: "ghost",
875
874
  role: "close",
876
875
  className: "h-7 p-2",
877
876
  onClick: () => {
878
- b(!1), A(!1);
877
+ y(!1), A(!1);
879
878
  },
880
879
  size: "sm",
881
880
  children: /* @__PURE__ */ e.jsx(Be, { className: "h-4 w-4", strokeWidth: 1.5 })
882
881
  }
883
882
  ),
884
- r && !d && L && /* @__PURE__ */ e.jsx(
883
+ r && !c && L && /* @__PURE__ */ e.jsx(
885
884
  O,
886
885
  {
887
886
  className: "h-7 p-2",
@@ -892,18 +891,18 @@ function tl() {
892
891
  children: /* @__PURE__ */ e.jsx($n, { className: "h-4 w-4", strokeWidth: 1.5 })
893
892
  }
894
893
  ),
895
- !j && !d && r && /* @__PURE__ */ e.jsx(
894
+ !b && !c && r && /* @__PURE__ */ e.jsx(
896
895
  O,
897
896
  {
898
897
  className: "h-7 p-2",
899
898
  variant: "ghost",
900
- onClick: () => o(!0),
899
+ onClick: () => h(!0),
901
900
  size: "sm",
902
901
  children: /* @__PURE__ */ e.jsx(oa, { className: "h-4 w-4", strokeWidth: 1.5 })
903
902
  }
904
903
  ),
905
- !d && r && !1,
906
- !d && !1
904
+ !c && r && !1,
905
+ !c && !1
907
906
  ] })
908
907
  ]
909
908
  }
@@ -916,13 +915,13 @@ function He({
916
915
  isLoading: t,
917
916
  isError: l,
918
917
  connectionTooltip: r,
919
- onChange: c,
918
+ onChange: o,
920
919
  showNone: i = !1,
921
- className: u,
922
- showIcon: p = !0,
923
- disabled: d = !1
920
+ className: d,
921
+ showIcon: x = !0,
922
+ disabled: c = !1
924
923
  }) {
925
- const j = t ? "Loading..." : l ? "Error" : a;
924
+ const b = t ? "Loading..." : l ? "Error" : a;
926
925
  function g() {
927
926
  if (s === "Connection")
928
927
  return /* @__PURE__ */ e.jsx(Pn, { className: "size-4 rotate-90" });
@@ -936,17 +935,17 @@ function He({
936
935
  return /* @__PURE__ */ e.jsx(Nn, { className: "size-4" });
937
936
  }
938
937
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
939
- p && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: r ? /* @__PURE__ */ e.jsxs(Ds, { children: [
938
+ x && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: r ? /* @__PURE__ */ e.jsxs(Ds, { children: [
940
939
  /* @__PURE__ */ e.jsx(ca, { children: g() }),
941
940
  /* @__PURE__ */ e.jsx(Ms, { className: "text-xs", align: "start", children: r })
942
941
  ] }) : g() }),
943
- /* @__PURE__ */ e.jsxs(ue, { disabled: d, value: j, onValueChange: c, children: [
942
+ /* @__PURE__ */ e.jsxs(ue, { disabled: c, value: b, onValueChange: o, children: [
944
943
  /* @__PURE__ */ e.jsx(
945
944
  he,
946
945
  {
947
946
  className: Y(
948
947
  "h-9 w-full focus:ring-1 focus:ring-offset-0",
949
- u
948
+ d
950
949
  ),
951
950
  children: /* @__PURE__ */ e.jsx(
952
951
  me,
@@ -960,39 +959,39 @@ function He({
960
959
  t ? /* @__PURE__ */ e.jsx(pe, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(pe, { children: s }),
961
960
  /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
962
961
  i && /* @__PURE__ */ e.jsx(X, { value: "none", children: "None" }, "none"),
963
- n && n.map((o, x) => /* @__PURE__ */ e.jsx(X, { value: o.id, children: o.name }, x))
962
+ n && n.map((h, f) => /* @__PURE__ */ e.jsx(X, { value: h.id, children: h.name }, f))
964
963
  ] }),
965
- (t || l) && /* @__PURE__ */ e.jsx(X, { value: j, children: j })
964
+ (t || l) && /* @__PURE__ */ e.jsx(X, { value: b, children: b })
966
965
  ] }) })
967
966
  ] })
968
967
  ] });
969
968
  }
970
969
  function nl({ column: s }) {
971
- const [n, a] = q(!1), t = h((o) => o.selectedTableName), l = h(
972
- (o) => o.selectedSchemaName
973
- ), r = h(
974
- (o) => o.selectedDatamodelId
975
- ), c = h((o) => o.sqlGen), { modelItems: i } = qe(), u = h((o) => o.actions.setSqlGen), p = h((o) => o.actions.setCardSql), d = h((o) => o.actions.setRunSql);
976
- function j(o, x) {
970
+ const [n, a] = q(!1), t = u((h) => h.selectedTableName), l = u(
971
+ (h) => h.selectedSchemaName
972
+ ), r = u(
973
+ (h) => h.selectedDatamodelId
974
+ ), o = u((h) => h.sqlGen), { modelItems: i } = qe(), d = u((h) => h.actions.setSqlGen), x = u((h) => h.actions.setCardSql), c = u((h) => h.actions.setRunSql);
975
+ function b(h, f) {
977
976
  var A;
978
- const y = da(o, c, x), z = (A = i == null ? void 0 : i.find(
977
+ const p = da(h, o, f), N = (A = i == null ? void 0 : i.find(
979
978
  (I) => I.id === r
980
979
  )) == null ? void 0 : A.name;
981
- u(y);
982
- const b = ua(
983
- y,
980
+ d(p);
981
+ const y = ua(
982
+ p,
984
983
  ce(l || ""),
985
984
  ce(t),
986
- z
985
+ N
987
986
  );
988
- b && (p(b), d(!0)), a(!1);
987
+ y && (x(y), c(!0)), a(!1);
989
988
  }
990
989
  function g() {
991
990
  return /* @__PURE__ */ e.jsxs("ul", { className: "text-xs", children: [
992
991
  /* @__PURE__ */ e.jsx(
993
992
  "li",
994
993
  {
995
- onClick: () => j(s, "COUNT"),
994
+ onClick: () => b(s, "COUNT"),
996
995
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
997
996
  children: "Count"
998
997
  }
@@ -1000,7 +999,7 @@ function nl({ column: s }) {
1000
999
  /* @__PURE__ */ e.jsx(
1001
1000
  "li",
1002
1001
  {
1003
- onClick: () => j(s, "AVG"),
1002
+ onClick: () => b(s, "AVG"),
1004
1003
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
1005
1004
  children: "Avg"
1006
1005
  }
@@ -1008,7 +1007,7 @@ function nl({ column: s }) {
1008
1007
  /* @__PURE__ */ e.jsx(
1009
1008
  "li",
1010
1009
  {
1011
- onClick: () => j(s, "SUM"),
1010
+ onClick: () => b(s, "SUM"),
1012
1011
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
1013
1012
  children: "Sum"
1014
1013
  }
@@ -1016,7 +1015,7 @@ function nl({ column: s }) {
1016
1015
  /* @__PURE__ */ e.jsx(
1017
1016
  "li",
1018
1017
  {
1019
- onClick: () => j(s, "MAX"),
1018
+ onClick: () => b(s, "MAX"),
1020
1019
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
1021
1020
  children: "Max"
1022
1021
  }
@@ -1024,7 +1023,7 @@ function nl({ column: s }) {
1024
1023
  /* @__PURE__ */ e.jsx(
1025
1024
  "li",
1026
1025
  {
1027
- onClick: () => j(s, "MIN"),
1026
+ onClick: () => b(s, "MIN"),
1028
1027
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
1029
1028
  children: "Min"
1030
1029
  }
@@ -1061,56 +1060,56 @@ function ll({
1061
1060
  columns: a,
1062
1061
  status: t
1063
1062
  }) {
1064
- const l = h((m) => m.sqlGen), r = h(
1063
+ const l = u((m) => m.sqlGen), r = u(
1065
1064
  (m) => m.selectedConnectionId
1066
- ), c = h(
1065
+ ), o = u(
1067
1066
  (m) => m.selectedDatabaseName
1068
- ), i = h(
1067
+ ), i = u(
1069
1068
  (m) => m.selectedSchemaName
1070
- ), u = h((m) => m.selectedTableName), p = h(
1069
+ ), d = u((m) => m.selectedTableName), x = u(
1071
1070
  (m) => m.selectedDatamodelId
1072
- ), d = M(
1071
+ ), c = M(
1073
1072
  (m) => m.dashboard.aiScopeTables
1074
- ), { setAIScopeTables: j } = M((m) => m.actions), g = h((m) => m.actions.setRunSql), o = h((m) => m.actions.setSqlGen), x = h(
1073
+ ), { setAIScopeTables: b } = M((m) => m.actions), g = u((m) => m.actions.setRunSql), h = u((m) => m.actions.setSqlGen), f = u(
1075
1074
  (m) => m.actions.setIsShowingVisual
1076
- ), y = h((m) => m.actions.setCardSql), { connectionType: z, modelItems: b } = qe();
1075
+ ), p = u((m) => m.actions.setCardSql), { connectionType: N, modelItems: y } = qe();
1077
1076
  function A(m) {
1078
- var N;
1077
+ var S;
1079
1078
  const v = da(m, l);
1080
- o(v);
1081
- const f = (N = b == null ? void 0 : b.find(
1082
- (_) => _.id === p
1083
- )) == null ? void 0 : N.name, D = ua(v, ce(s), ce(n), f);
1084
- D && (y(D), g(!0));
1079
+ h(v);
1080
+ const j = (S = y == null ? void 0 : y.find(
1081
+ (_) => _.id === x
1082
+ )) == null ? void 0 : S.name, D = ua(v, ce(s), ce(n), j);
1083
+ D && (p(D), g(!0));
1085
1084
  }
1086
1085
  function I() {
1087
- return (d == null ? void 0 : d.find(
1088
- (m) => m.connectinonId === r && m.tableName === u
1086
+ return (c == null ? void 0 : c.find(
1087
+ (m) => m.connectinonId === r && m.tableName === d
1089
1088
  )) !== void 0;
1090
1089
  }
1091
- function k(m) {
1092
- if (m === !0 && u && r) {
1090
+ function z(m) {
1091
+ if (m === !0 && d && r) {
1093
1092
  const v = {
1094
1093
  connectinonId: r,
1095
- connectionType: z,
1096
- databaseName: c,
1094
+ connectionType: N,
1095
+ databaseName: o,
1097
1096
  schemaName: i,
1098
- tableName: u
1099
- }, D = [...d || [], v].filter(
1100
- (N, _, $) => $.findIndex(
1101
- (K) => K.connectinonId === N.connectinonId && K.tableName === N.tableName
1097
+ tableName: d
1098
+ }, D = [...c || [], v].filter(
1099
+ (S, _, $) => $.findIndex(
1100
+ (K) => K.connectinonId === S.connectinonId && K.tableName === S.tableName
1102
1101
  ) === _
1103
1102
  );
1104
- j(D), Ge.success(`Added '${u}' to AI Scope`, {
1103
+ b(D), Ge.success(`Added '${d}' to AI Scope`, {
1105
1104
  position: "top-right",
1106
1105
  duration: 2500,
1107
1106
  richColors: !0
1108
1107
  });
1109
1108
  } else {
1110
- const v = (d || []).filter(
1111
- (f) => f.connectinonId !== r && f.tableName !== u
1109
+ const v = (c || []).filter(
1110
+ (j) => j.connectinonId !== r && j.tableName !== d
1112
1111
  );
1113
- j(v), Ge(`Removed '${u}' from AI Scope`, {
1112
+ b(v), Ge(`Removed '${d}' from AI Scope`, {
1114
1113
  position: "top-right",
1115
1114
  duration: 2e3,
1116
1115
  richColors: !0
@@ -1118,24 +1117,24 @@ function ll({
1118
1117
  }
1119
1118
  }
1120
1119
  function T() {
1121
- var N;
1120
+ var S;
1122
1121
  let m = xa(s, n);
1123
- const v = (N = b == null ? void 0 : b.find(
1124
- (_) => _.id === p
1125
- )) == null ? void 0 : N.name;
1126
- p && p !== "none" && (m = `${gs}.${v}`);
1127
- let f = m;
1128
- return ((_) => /[A-Z]/.test(_))(n) && (f = f.split(".").map(($) => `"${$}"`).join(".")), f;
1122
+ const v = (S = y == null ? void 0 : y.find(
1123
+ (_) => _.id === x
1124
+ )) == null ? void 0 : S.name;
1125
+ x && x !== "none" && (m = `${gs}.${v}`);
1126
+ let j = m;
1127
+ return ((_) => /[A-Z]/.test(_))(n) && (j = j.split(".").map(($) => `"${$}"`).join(".")), j;
1129
1128
  }
1130
1129
  function L() {
1131
1130
  const m = T();
1132
- x(!1);
1133
- const v = z === "MSSQL" ? `SELECT top 10 * FROM ${m}` : `SELECT * FROM ${m} LIMIT 10`;
1134
- y(v), g(!0);
1131
+ f(!1);
1132
+ const v = N === "MSSQL" ? `SELECT top 10 * FROM ${m}` : `SELECT * FROM ${m} LIMIT 10`;
1133
+ p(v), g(!0);
1135
1134
  }
1136
1135
  function V() {
1137
1136
  const m = T();
1138
- y(`SELECT COUNT(*) as count FROM ${m}`), g(!0);
1137
+ p(`SELECT COUNT(*) as count FROM ${m}`), g(!0);
1139
1138
  }
1140
1139
  return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
1141
1140
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
@@ -1144,7 +1143,7 @@ function ll({
1144
1143
  {
1145
1144
  title: `${I() ? "Remove from" : "Add to"} AI Scope`,
1146
1145
  pressed: I(),
1147
- onPressedChange: k,
1146
+ onPressedChange: z,
1148
1147
  variant: "outline",
1149
1148
  className: "h-9 px-2",
1150
1149
  children: /* @__PURE__ */ e.jsx(
@@ -1229,39 +1228,39 @@ function ll({
1229
1228
  function qe(s, n) {
1230
1229
  var Je, Ps, $s, Bs, Us;
1231
1230
  let a = bs(() => [], []);
1232
- const t = Se().authToken || s, l = h(
1231
+ const t = Se().authToken || s, l = u(
1233
1232
  (C) => C.selectedConnectionId
1234
- ), r = h(
1233
+ ), r = u(
1235
1234
  (C) => C.selectedDatamodelId
1236
- ), c = h(
1235
+ ), o = u(
1237
1236
  (C) => C.selectedDatabaseName
1238
- ), i = h(
1237
+ ), i = u(
1239
1238
  (C) => C.selectedSchemaName
1240
- ), u = h((C) => C.selectedTableName), p = h(
1239
+ ), d = u((C) => C.selectedTableName), x = u(
1241
1240
  (C) => C.actions.setCurrentColumns
1242
- ), d = h(
1241
+ ), c = u(
1243
1242
  (C) => C.actions.setSelectedConnectionId
1244
- ), j = h(
1243
+ ), b = u(
1245
1244
  (C) => C.actions.setSelectedDatamodelId
1246
- ), g = h(
1245
+ ), g = u(
1247
1246
  (C) => C.actions.setSelectedDatabaseName
1248
- ), o = h(
1247
+ ), h = u(
1249
1248
  (C) => C.actions.setSelectedSchemaName
1250
- ), x = h(
1249
+ ), f = u(
1251
1250
  (C) => C.actions.setSelectedTableName
1252
- ), y = h((C) => C.actions.setCardSql);
1253
- function z(C) {
1254
- return l && c && i && c !== "NA" ? !0 : l && C === "API" ? !1 : !!(l && C === "S3");
1251
+ ), p = u((C) => C.actions.setCardSql);
1252
+ function N(C) {
1253
+ return l && o && i && o !== "NA" ? !0 : l && C === "API" ? !1 : !!(l && C === "S3");
1255
1254
  }
1256
- function b(C) {
1257
- return !!(l && c && c !== "NA" && i && u || l && (C === "S3" || C === "API") || r && r);
1255
+ function y(C) {
1256
+ return !!(l && o && o !== "NA" && i && d || l && (C === "S3" || C === "API") || r && r);
1258
1257
  }
1259
1258
  function A(C) {
1260
1259
  return l && C ? !(C === "API" || C === "S3") : !1;
1261
1260
  }
1262
1261
  const {
1263
1262
  data: I,
1264
- isLoading: k,
1263
+ isLoading: z,
1265
1264
  isError: T
1266
1265
  } = be({
1267
1266
  queryKey: ["connections"],
@@ -1288,8 +1287,8 @@ function qe(s, n) {
1288
1287
  // Only fetch if authToken is present
1289
1288
  }), v = I == null ? void 0 : I.connections.find(
1290
1289
  (C) => C.id === l
1291
- ), f = v == null ? void 0 : v.type, D = (v == null ? void 0 : v.type) === "API" || (v == null ? void 0 : v.type) === "S3", {
1292
- data: N,
1290
+ ), j = v == null ? void 0 : v.type, D = (v == null ? void 0 : v.type) === "API" || (v == null ? void 0 : v.type) === "S3", {
1291
+ data: S,
1293
1292
  isLoading: _,
1294
1293
  isFetching: $,
1295
1294
  isError: K,
@@ -1303,37 +1302,37 @@ function qe(s, n) {
1303
1302
  connection_id: l
1304
1303
  }
1305
1304
  ),
1306
- enabled: A(f)
1305
+ enabled: A(j)
1307
1306
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
1308
1307
  }), {
1309
1308
  data: G,
1310
1309
  isLoading: se,
1311
- isFetching: w,
1310
+ isFetching: k,
1312
1311
  isError: P,
1313
1312
  refetch: U
1314
1313
  } = be({
1315
- queryKey: ["schemas", l, c],
1314
+ queryKey: ["schemas", l, o],
1316
1315
  queryFn: () => ze(
1317
1316
  "https://semaphor.cloud/api/v1/schemas",
1318
1317
  (t == null ? void 0 : t.accessToken) || "",
1319
1318
  {
1320
1319
  connection_id: l,
1321
- database_name: c
1320
+ database_name: o
1322
1321
  }
1323
1322
  ),
1324
- enabled: !!l && !!c && !D && c !== "NA"
1323
+ enabled: !!l && !!o && !D && o !== "NA"
1325
1324
  //currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
1326
1325
  }), {
1327
1326
  data: E,
1328
1327
  isLoading: F,
1329
- isFetching: le,
1328
+ isFetching: re,
1330
1329
  isError: B,
1331
1330
  refetch: ae
1332
1331
  } = be({
1333
1332
  queryKey: [
1334
1333
  "tables",
1335
1334
  l,
1336
- c,
1335
+ o,
1337
1336
  i
1338
1337
  ],
1339
1338
  queryFn: () => ze(
@@ -1341,11 +1340,11 @@ function qe(s, n) {
1341
1340
  (t == null ? void 0 : t.accessToken) || "",
1342
1341
  {
1343
1342
  connection_id: l,
1344
- database_name: c,
1343
+ database_name: o,
1345
1344
  schema_name: i
1346
1345
  }
1347
1346
  ),
1348
- enabled: z(f)
1347
+ enabled: N(j)
1349
1348
  }), {
1350
1349
  data: te,
1351
1350
  isLoading: je,
@@ -1355,10 +1354,10 @@ function qe(s, n) {
1355
1354
  queryKey: [
1356
1355
  "columns",
1357
1356
  l,
1358
- c,
1357
+ o,
1359
1358
  r,
1360
1359
  i,
1361
- u
1360
+ d
1362
1361
  ],
1363
1362
  queryFn: () => ze(
1364
1363
  "https://semaphor.cloud/api/v1/columns",
@@ -1367,12 +1366,12 @@ function qe(s, n) {
1367
1366
  connection_id: l,
1368
1367
  datamodel_id: r || "",
1369
1368
  // don't pass undefined. Pass empty string
1370
- database_name: c,
1369
+ database_name: o,
1371
1370
  schema_name: i,
1372
- table_name: u
1371
+ table_name: d
1373
1372
  }
1374
1373
  ),
1375
- enabled: b(f)
1374
+ enabled: y(j)
1376
1375
  // (!!selectedConnectionId &&
1377
1376
  // !!selectedDatabaseName &&
1378
1377
  // !!selectedSchemaName &&
@@ -1382,30 +1381,30 @@ function qe(s, n) {
1382
1381
  // && currentConnection?.type !== 'API', // Only fetch if connectionId, database, and table is present
1383
1382
  });
1384
1383
  Z(() => {
1385
- p(a);
1386
- }, [te, p, a]), Z(() => {
1384
+ x(a);
1385
+ }, [te, x, a]), Z(() => {
1387
1386
  }, [
1388
1387
  D,
1389
- y,
1390
- x,
1391
- o,
1388
+ p,
1389
+ f,
1390
+ h,
1392
1391
  g,
1393
1392
  v
1394
1393
  ]);
1395
- const Le = (v == null ? void 0 : v.type) === "API" ? (Je = v == null ? void 0 : v.type) == null ? void 0 : Je.toLowerCase() : u || "", Fe = D ? "" : i || "";
1394
+ const Le = (v == null ? void 0 : v.type) === "API" ? (Je = v == null ? void 0 : v.type) == null ? void 0 : Je.toLowerCase() : d || "", Fe = D ? "" : i || "";
1396
1395
  function Ee(C) {
1397
- o(C), x("");
1396
+ h(C), f("");
1398
1397
  }
1399
1398
  function Ae(C) {
1400
- g(C === "none" ? "" : C), o(""), x(""), C !== "none" && C !== "" && j("");
1399
+ g(C === "none" ? "" : C), h(""), f(""), C !== "none" && C !== "" && b("");
1401
1400
  }
1402
- function S(C) {
1403
- d(C);
1401
+ function w(C) {
1402
+ c(C);
1404
1403
  }
1405
- function ie(C) {
1406
- j(C === "none" ? "" : C), C !== "none" && C !== "" && g("");
1404
+ function le(C) {
1405
+ b(C === "none" ? "" : C), C !== "none" && C !== "" && g("");
1407
1406
  }
1408
- N && ((Ps = N == null ? void 0 : N.databases) == null ? void 0 : Ps.length) > 0, G && (($s = G == null ? void 0 : G.schemas) == null ? void 0 : $s.length) > 0, te && ((Bs = te == null ? void 0 : te.columns) == null ? void 0 : Bs.length) > 0 && (a = te.columns.map((C) => ({
1407
+ S && ((Ps = S == null ? void 0 : S.databases) == null ? void 0 : Ps.length) > 0, G && (($s = G == null ? void 0 : G.schemas) == null ? void 0 : $s.length) > 0, te && ((Bs = te == null ? void 0 : te.columns) == null ? void 0 : Bs.length) > 0 && (a = te.columns.map((C) => ({
1409
1408
  ...C,
1410
1409
  data_type: C.data_type.toLowerCase()
1411
1410
  }))), K && (a = []), (we || T) && (a = []);
@@ -1418,7 +1417,7 @@ function qe(s, n) {
1418
1417
  ), oe = (Us = L == null ? void 0 : L.datamodels) == null ? void 0 : Us.map((C) => ({
1419
1418
  id: C.id,
1420
1419
  name: C.name
1421
- })), _e = N == null ? void 0 : N.databases.map((C) => ({
1420
+ })), _e = S == null ? void 0 : S.databases.map((C) => ({
1422
1421
  id: C.database_name,
1423
1422
  name: C.database_name
1424
1423
  })), ps = G == null ? void 0 : G.schemas.map((C) => ({
@@ -1430,7 +1429,7 @@ function qe(s, n) {
1430
1429
  }));
1431
1430
  return {
1432
1431
  connectionItems: ke,
1433
- isConnectionsLoading: k,
1432
+ isConnectionsLoading: z,
1434
1433
  isConnectionsError: T,
1435
1434
  modelItems: oe,
1436
1435
  isModelsLoading: V,
@@ -1439,20 +1438,20 @@ function qe(s, n) {
1439
1438
  isDatabasesLoadingOrFetching: _ || $,
1440
1439
  isDatabaseError: K,
1441
1440
  schemaItems: ps,
1442
- isSchemaLoadingOrFetching: se || w,
1441
+ isSchemaLoadingOrFetching: se || k,
1443
1442
  isSchemaError: P,
1444
1443
  tableItems: Qe,
1445
- isTableLoadingOrFetching: F || le,
1444
+ isTableLoadingOrFetching: F || re,
1446
1445
  isTableError: B,
1447
1446
  columns: a,
1448
1447
  isColumnsLoadingOrFetching: je || Te,
1449
1448
  isColumnsError: we,
1450
1449
  isNonDbConnection: D,
1451
- connectionType: f,
1450
+ connectionType: j,
1452
1451
  tableName: Le,
1453
1452
  schemaName: Fe,
1454
- handleConnectionChange: S,
1455
- handleDatamodelChange: ie,
1453
+ handleConnectionChange: w,
1454
+ handleDatamodelChange: le,
1456
1455
  handleDatabaseChange: Ae,
1457
1456
  handleSchemaChange: Ee
1458
1457
  };
@@ -1460,40 +1459,40 @@ function qe(s, n) {
1460
1459
  function Va({
1461
1460
  ColumnsComponent: s
1462
1461
  }) {
1463
- var le;
1464
- const n = h(
1462
+ var re;
1463
+ const n = u(
1465
1464
  (B) => B.selectedConnectionId
1466
- ), a = h(
1465
+ ), a = u(
1467
1466
  (B) => B.selectedDatamodelId
1468
- ), t = h(
1467
+ ), t = u(
1469
1468
  (B) => B.selectedDatabaseName
1470
- ), l = h(
1469
+ ), l = u(
1471
1470
  (B) => B.selectedSchemaName
1472
- ), r = h((B) => B.selectedTableName), c = h(
1471
+ ), r = u((B) => B.selectedTableName), o = u(
1473
1472
  (B) => B.actions.setSelectedTableName
1474
1473
  ), {
1475
1474
  connectionItems: i,
1476
- modelItems: u,
1477
- schemaItems: p,
1478
- databaseItems: d,
1479
- tableItems: j,
1475
+ modelItems: d,
1476
+ schemaItems: x,
1477
+ databaseItems: c,
1478
+ tableItems: b,
1480
1479
  columns: g,
1481
- isConnectionsLoading: o,
1482
- isModelsLoading: x,
1483
- isConnectionsError: y,
1484
- isModelsError: z,
1485
- isDatabasesLoadingOrFetching: b,
1480
+ isConnectionsLoading: h,
1481
+ isModelsLoading: f,
1482
+ isConnectionsError: p,
1483
+ isModelsError: N,
1484
+ isDatabasesLoadingOrFetching: y,
1486
1485
  isDatabaseError: A,
1487
1486
  isSchemaLoadingOrFetching: I,
1488
- isSchemaError: k,
1487
+ isSchemaError: z,
1489
1488
  isColumnsError: T,
1490
1489
  isColumnsLoadingOrFetching: L,
1491
1490
  isTableLoadingOrFetching: V,
1492
1491
  isTableError: m,
1493
1492
  connectionType: v,
1494
- isNonDbConnection: f,
1493
+ isNonDbConnection: j,
1495
1494
  handleConnectionChange: D,
1496
- handleDatabaseChange: N,
1495
+ handleDatabaseChange: S,
1497
1496
  handleSchemaChange: _,
1498
1497
  handleDatamodelChange: $,
1499
1498
  tableName: K,
@@ -1513,24 +1512,24 @@ function Va({
1513
1512
  function se() {
1514
1513
  window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
1515
1514
  }
1516
- function w() {
1515
+ function k() {
1517
1516
  if (!n || v === "S3" || v === "API") return null;
1518
1517
  if (!a || a === "none")
1519
1518
  return /* @__PURE__ */ e.jsx(
1520
1519
  He,
1521
1520
  {
1522
1521
  showNone: !0,
1523
- onChange: N,
1522
+ onChange: S,
1524
1523
  isError: A,
1525
- isLoading: b,
1526
- items: d,
1524
+ isLoading: y,
1525
+ items: c,
1527
1526
  value: t || "",
1528
1527
  title: "Database"
1529
1528
  }
1530
1529
  );
1531
1530
  }
1532
1531
  function P() {
1533
- if (n && !f && (!t || t === "none") && (!a || a === "none"))
1532
+ if (n && !j && (!t || t === "none") && (!a || a === "none"))
1534
1533
  return /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3", children: [
1535
1534
  /* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(Ce, {}) }),
1536
1535
  /* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(H, { children: "OR" }) }),
@@ -1545,9 +1544,9 @@ function Va({
1545
1544
  {
1546
1545
  showNone: !0,
1547
1546
  onChange: $,
1548
- isError: z,
1549
- isLoading: x,
1550
- items: u,
1547
+ isError: N,
1548
+ isLoading: f,
1549
+ items: d,
1551
1550
  value: a || "",
1552
1551
  title: "Model"
1553
1552
  }
@@ -1558,9 +1557,9 @@ function Va({
1558
1557
  He,
1559
1558
  {
1560
1559
  onChange: _,
1561
- isError: k,
1560
+ isError: z,
1562
1561
  isLoading: I,
1563
- items: p,
1562
+ items: x,
1564
1563
  value: l || "",
1565
1564
  title: "Schema"
1566
1565
  }
@@ -1574,9 +1573,9 @@ function Va({
1574
1573
  return B() ? /* @__PURE__ */ e.jsx(
1575
1574
  He,
1576
1575
  {
1577
- onChange: c,
1576
+ onChange: o,
1578
1577
  isError: m,
1579
- items: j,
1578
+ items: b,
1580
1579
  isLoading: V,
1581
1580
  value: r || "",
1582
1581
  title: "Table"
@@ -1592,16 +1591,16 @@ function Va({
1592
1591
  title: "Connection",
1593
1592
  value: n || "",
1594
1593
  onChange: D,
1595
- isLoading: o,
1596
- isError: y,
1597
- connectionTooltip: ((le = i == null ? void 0 : i.find(
1594
+ isLoading: h,
1595
+ isError: p,
1596
+ connectionTooltip: ((re = i == null ? void 0 : i.find(
1598
1597
  (B) => B.id === n
1599
- )) == null ? void 0 : le.type) || ""
1598
+ )) == null ? void 0 : re.type) || ""
1600
1599
  }
1601
1600
  ),
1602
1601
  U(),
1603
1602
  P(),
1604
- w(),
1603
+ k(),
1605
1604
  E(),
1606
1605
  F()
1607
1606
  ] }),
@@ -1625,16 +1624,16 @@ function rl(s) {
1625
1624
  const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1626
1625
  let r = s.length;
1627
1626
  if (l !== -1 && (r = l), t !== -1 && t < r && (r = t), n !== -1) {
1628
- const c = s.substring(0, n), i = s.substring(n);
1629
- return `${c} {{ filters | where }} AND ${i.substring(
1627
+ const o = s.substring(0, n), i = s.substring(n);
1628
+ return `${o} {{ filters | where }} AND ${i.substring(
1630
1629
  6
1631
1630
  )}`;
1632
1631
  } else if (a !== -1) {
1633
- const c = s.substring(0, a), i = s.substring(a);
1634
- return `${c} {{ filters | where }} ${i}`;
1632
+ const o = s.substring(0, a), i = s.substring(a);
1633
+ return `${o} {{ filters | where }} ${i}`;
1635
1634
  } else {
1636
- const c = s.substring(0, r), i = s.substring(r);
1637
- return `${c} {{ filters | where }} ${i}`;
1635
+ const o = s.substring(0, r), i = s.substring(r);
1636
+ return `${o} {{ filters | where }} ${i}`;
1638
1637
  }
1639
1638
  }
1640
1639
  function il({
@@ -1726,64 +1725,64 @@ function cl({
1726
1725
  triggerAIRun: l,
1727
1726
  setTriggerAIRun: r
1728
1727
  }) {
1729
- const c = ns(null), i = ns(null), { authToken: u } = Se(), [p, d] = q(!1), j = h((w) => w.actions.setCardSql), g = M((w) => w.dashboard.baseQueries), o = h((w) => w.actions.setRunSql), x = h((w) => w.actions.setCardType), [y, z] = q([]), b = h((w) => w.currentColumns), A = h((w) => w.card.sql), I = h((w) => w.selectedTableName), k = `
1728
+ const o = ns(null), i = ns(null), { authToken: d } = Se(), [x, c] = q(!1), b = u((k) => k.actions.setCardSql), g = M((k) => k.dashboard.baseQueries), h = u((k) => k.actions.setRunSql), f = u((k) => k.actions.setCardType), [p, N] = q([]), y = u((k) => k.currentColumns), A = u((k) => k.card.sql), I = u((k) => k.selectedTableName), z = `
1730
1729
  ${a}
1731
1730
 
1732
1731
  Database Query Dialect: ${I === "api" || I === "s3" ? "DuckDb" : ""}
1733
1732
  Table Name: ${I}
1734
- Table Columns: ${b == null ? void 0 : b.map((w) => `${w.column_name} | ${w.data_type}`).join(", ")}
1733
+ Table Columns: ${y == null ? void 0 : y.map((k) => `${k.column_name} | ${k.data_type}`).join(", ")}
1735
1734
  User SQL: ${A}
1736
1735
  ${g && `Base Queries: ${JSON.stringify(g)} `}`, T = ` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
1737
- Visual Query Syntax: ${ol}`, { data: L, isLoading: V, isFetching: m, isError: v, refetch: f } = be({
1736
+ Visual Query Syntax: ${ol}`, { data: L, isLoading: V, isFetching: m, isError: v, refetch: j } = be({
1738
1737
  queryKey: ["ai-query"],
1739
1738
  queryFn: () => ze(
1740
1739
  "https://semaphor.cloud/api/v1/ai",
1741
- (u == null ? void 0 : u.accessToken) || "",
1740
+ (d == null ? void 0 : d.accessToken) || "",
1742
1741
  {
1743
- user_content: `userContent: ${k} ${p ? T : ""}`
1742
+ user_content: `userContent: ${z} ${x ? T : ""}`
1744
1743
  }
1745
1744
  ),
1746
1745
  enabled: !1
1747
1746
  // Do not run by default.
1748
1747
  });
1749
- function D(w) {
1750
- if (w.toLowerCase().includes("bar"))
1751
- x("bar");
1752
- else if (w.toLowerCase().includes("line"))
1753
- x("line");
1754
- else if (w.toLowerCase().includes("bubble"))
1755
- x("bubble");
1756
- else if (w.toLowerCase().includes("scatter"))
1757
- x("scatter");
1758
- else if (w.toLowerCase().includes("stacked"))
1759
- x("stackedBar");
1760
- else if (w.toLowerCase().includes("pie"))
1761
- x("pie");
1762
- else if (w.toLowerCase().includes("donut") || w.toLowerCase().includes("doughnut"))
1763
- x("doughnut");
1764
- else if (w.toLowerCase().includes("radar"))
1765
- x("radar");
1748
+ function D(k) {
1749
+ if (k.toLowerCase().includes("bar"))
1750
+ f("bar");
1751
+ else if (k.toLowerCase().includes("line"))
1752
+ f("line");
1753
+ else if (k.toLowerCase().includes("bubble"))
1754
+ f("bubble");
1755
+ else if (k.toLowerCase().includes("scatter"))
1756
+ f("scatter");
1757
+ else if (k.toLowerCase().includes("stacked"))
1758
+ f("stackedBar");
1759
+ else if (k.toLowerCase().includes("pie"))
1760
+ f("pie");
1761
+ else if (k.toLowerCase().includes("donut") || k.toLowerCase().includes("doughnut"))
1762
+ f("doughnut");
1763
+ else if (k.toLowerCase().includes("radar"))
1764
+ f("radar");
1766
1765
  else
1767
- return x("bar"), !1;
1766
+ return f("bar"), !1;
1768
1767
  return !0;
1769
1768
  }
1770
1769
  Z(() => {
1771
- L && z((w) => [...w, { role: "ai", content: L.response }]);
1770
+ L && N((k) => [...k, { role: "ai", content: L.response }]);
1772
1771
  }, [L]), Z(() => {
1773
- const w = setTimeout(() => {
1772
+ const k = setTimeout(() => {
1774
1773
  var P;
1775
1774
  i.current && (i.current.scroll({
1776
1775
  top: i.current.scrollHeight,
1777
1776
  behavior: "smooth"
1778
- }), (P = c.current) == null || P.focus());
1777
+ }), (P = o.current) == null || P.focus());
1779
1778
  }, 100);
1780
- return () => clearTimeout(w);
1781
- }, [y]);
1782
- function N() {
1783
- a && (z((w) => [...w, { role: "user", content: a }]), D(a) && d(!0), t(""), f());
1779
+ return () => clearTimeout(k);
1780
+ }, [p]);
1781
+ function S() {
1782
+ a && (N((k) => [...k, { role: "user", content: a }]), D(a) && c(!0), t(""), j());
1784
1783
  }
1785
1784
  Z(() => {
1786
- l && (N(), r(!1));
1785
+ l && (S(), r(!1));
1787
1786
  }, [l, r]);
1788
1787
  const _ = {
1789
1788
  //seleect a darker color
@@ -1812,9 +1811,9 @@ function cl({
1812
1811
  listStyleType: "disc"
1813
1812
  }, ee = {
1814
1813
  // Override how paragraphs are rendered
1815
- p: ({ node: w, ...P }) => /* @__PURE__ */ e.jsx("p", { style: _, ...P }),
1816
- code: ({ node: w, ...P }) => /* @__PURE__ */ e.jsx("code", { className: "rounded-sm bg-muted px-2 py-1 text-sm", ...P }),
1817
- pre: ({ node: w, ...P }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style: $, children: [
1814
+ p: ({ node: k, ...P }) => /* @__PURE__ */ e.jsx("p", { style: _, ...P }),
1815
+ code: ({ node: k, ...P }) => /* @__PURE__ */ e.jsx("code", { className: "rounded-sm bg-muted px-2 py-1 text-sm", ...P }),
1816
+ pre: ({ node: k, ...P }) => /* @__PURE__ */ e.jsxs("pre", { className: "space-y-2 rounded-sm bg-muted/50 p-3", style: $, children: [
1818
1817
  /* @__PURE__ */ e.jsx("code", { className: "whitespace-normal text-sm", children: P.children }),
1819
1818
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-start gap-2", children: [
1820
1819
  /* @__PURE__ */ e.jsx(O, { onClick: G, size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(pt, {}) }),
@@ -1823,7 +1822,7 @@ function cl({
1823
1822
  {
1824
1823
  onClick: (U) => {
1825
1824
  const E = G(U);
1826
- E && (n(!1), j(E), o(!0));
1825
+ E && (n(!1), b(E), h(!0));
1827
1826
  },
1828
1827
  size: "sm",
1829
1828
  variant: "outline",
@@ -1832,27 +1831,27 @@ function cl({
1832
1831
  )
1833
1832
  ] })
1834
1833
  ] }),
1835
- li: ({ node: w, ...P }) => /* @__PURE__ */ e.jsx("li", { style: K, ...P })
1834
+ li: ({ node: k, ...P }) => /* @__PURE__ */ e.jsx("li", { style: K, ...P })
1836
1835
  // You can add more overrides for other elements like h1, h2, etc.
1837
1836
  };
1838
- function G(w) {
1839
- const P = w.currentTarget.closest("pre");
1837
+ function G(k) {
1838
+ const P = k.currentTarget.closest("pre");
1840
1839
  if (!P) return;
1841
1840
  const U = P.textContent || P.innerText;
1842
1841
  return navigator.clipboard.writeText(U).then(() => console.log("Text copied to clipboard")).catch((E) => console.error("Error in copying text: ", E)), U;
1843
1842
  }
1844
1843
  function se() {
1845
- return y == null ? void 0 : y.map((w, P) => w.role === "user" ? /* @__PURE__ */ e.jsxs(
1844
+ return p == null ? void 0 : p.map((k, P) => k.role === "user" ? /* @__PURE__ */ e.jsxs(
1846
1845
  "div",
1847
1846
  {
1848
1847
  className: "flex items-start rounded-md bg-muted p-3 text-sm",
1849
1848
  children: [
1850
1849
  /* @__PURE__ */ e.jsx(Jn, { className: "mr-2 h-5 w-5" }),
1851
- /* @__PURE__ */ e.jsx("div", { children: w.content })
1850
+ /* @__PURE__ */ e.jsx("div", { children: k.content })
1852
1851
  ]
1853
1852
  },
1854
1853
  P
1855
- ) : w.role === "ai" ? /* @__PURE__ */ e.jsx(
1854
+ ) : k.role === "ai" ? /* @__PURE__ */ e.jsx(
1856
1855
  xt,
1857
1856
  {
1858
1857
  className: "w-full overflow-auto py-1",
@@ -1897,13 +1896,13 @@ function cl({
1897
1896
  pa,
1898
1897
  {
1899
1898
  autoFocus: !0,
1900
- ref: c,
1901
- onKeyDown: (w) => {
1902
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), t(""), N());
1899
+ ref: o,
1900
+ onKeyDown: (k) => {
1901
+ k.key === "Enter" && !k.shiftKey && (k.preventDefault(), t(""), S());
1903
1902
  },
1904
1903
  placeholder: "Type your question here...",
1905
- onFocus: (w) => {
1906
- const P = w.target, U = P.value.length;
1904
+ onFocus: (k) => {
1905
+ const P = k.target, U = P.value.length;
1907
1906
  P.setSelectionRange(U, U);
1908
1907
  },
1909
1908
  className: Y(
@@ -1911,7 +1910,7 @@ function cl({
1911
1910
  ),
1912
1911
  disabled: V || m,
1913
1912
  value: a,
1914
- onChange: (w) => t(w.target.value)
1913
+ onChange: (k) => t(k.target.value)
1915
1914
  }
1916
1915
  ),
1917
1916
  " ",
@@ -1921,7 +1920,7 @@ function cl({
1921
1920
  className: "h-8",
1922
1921
  size: "sm",
1923
1922
  variant: "ghost",
1924
- onClick: N,
1923
+ onClick: S,
1925
1924
  children: !V && !m ? /* @__PURE__ */ e.jsx(mt, {}) : /* @__PURE__ */ e.jsx(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1926
1925
  }
1927
1926
  )
@@ -2024,13 +2023,13 @@ function fl(s) {
2024
2023
  attr: t,
2025
2024
  size: l,
2026
2025
  title: r
2027
- } = s, c = ul(s, dl), i = l || a.size || "1em", u;
2028
- return a.className && (u = a.className), s.className && (u = (u ? u + " " : "") + s.className), /* @__PURE__ */ Ne.createElement("svg", ls({
2026
+ } = s, o = ul(s, dl), i = l || a.size || "1em", d;
2027
+ return a.className && (d = a.className), s.className && (d = (d ? d + " " : "") + s.className), /* @__PURE__ */ Ne.createElement("svg", ls({
2029
2028
  stroke: "currentColor",
2030
2029
  fill: "currentColor",
2031
2030
  strokeWidth: "0"
2032
- }, a.attr, t, c, {
2033
- className: u,
2031
+ }, a.attr, t, o, {
2032
+ className: d,
2034
2033
  style: rs(rs({
2035
2034
  color: s.color || a.color
2036
2035
  }, a.style), s.style),
@@ -2061,70 +2060,70 @@ function jl({ sql: s }) {
2061
2060
  ] });
2062
2061
  }
2063
2062
  function _a(s) {
2064
- const { theme: n } = jt(), a = M((o) => o.theme), t = h((o) => o.card), l = h((o) => o.activeTabCardId), r = bt(), { refetch: c } = De(t), { updateCardTab: i, setRunSql: u } = ne(), p = ns(), d = ns({}), j = Oa(() => {
2065
- let o = "";
2066
- return s === "python" && (o = fa), o;
2067
- }, [s]);
2063
+ const { theme: n } = jt(), a = M((p) => p.theme), t = u((p) => p.frame), l = u((p) => p.card), r = u((p) => p.activeTabCardId), o = bt(), { refetch: i } = De(l), { updateCardTab: d, setRunSql: x } = ne(), c = ns(), b = ns({}), g = t.cards.find((p) => p.id === r), h = Oa(() => {
2064
+ let p = "";
2065
+ return s === "python" && (p = (g == null ? void 0 : g.python) || fa), s === "sql" && (p = (g == null ? void 0 : g.sql) || ""), p;
2066
+ }, [s, g]);
2068
2067
  Z(() => {
2069
- if (l && t.id && t.id !== l) {
2070
- if (p.current && r) {
2071
- const o = p.current.getModel();
2072
- o && (d.current[t.id] = o);
2073
- let x = d.current[l];
2074
- if (!x) {
2075
- const y = j();
2076
- x = r.editor.createModel(y, s), d.current[l] = x;
2068
+ if (r && l.id && l.id !== r) {
2069
+ if (c.current && o) {
2070
+ const p = c.current.getModel();
2071
+ p && (b.current[l.id] = p);
2072
+ let N = b.current[r];
2073
+ if (!N) {
2074
+ const y = h();
2075
+ N = o.editor.createModel(y, s), b.current[r] = N;
2077
2076
  }
2078
- p.current.setModel(x);
2077
+ c.current.setModel(N);
2079
2078
  }
2080
- i(l, t), u(!0);
2079
+ d(r, l), x(!0);
2081
2080
  }
2082
2081
  }, [
2083
- l,
2084
- t,
2085
- i,
2086
2082
  r,
2087
- u,
2083
+ l,
2084
+ d,
2085
+ o,
2086
+ x,
2088
2087
  s,
2089
- j
2088
+ h
2090
2089
  ]), Z(() => {
2091
- if (!r) return;
2092
- const o = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", x = a === "system" ? o : a;
2093
- r.editor.defineTheme("default", {
2090
+ if (!o) return;
2091
+ const p = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", N = a === "system" ? p : a;
2092
+ o.editor.defineTheme("default", {
2094
2093
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
2095
- base: x === "light" ? "vs" : "vs-dark",
2094
+ base: N === "light" ? "vs" : "vs-dark",
2096
2095
  inherit: !0,
2097
2096
  rules: [],
2098
2097
  colors: {
2099
- "editor.background": x === "light" ? "#ffffff" : yt("240 10% 10%")
2098
+ "editor.background": N === "light" ? "#ffffff" : yt("240 10% 10%")
2100
2099
  // 'editor.background':
2101
2100
  // activeTheme === 'light'
2102
2101
  // ? '#ffffff'
2103
2102
  // : getCssVariableValue('--semaphor-background'),
2104
2103
  }
2105
- }), r.editor.setTheme("default");
2106
- }, [n, a, r]), Z(() => {
2107
- const o = p.current;
2108
- o && r && t && o.addCommand(
2109
- r.KeyMod.Shift | r.KeyCode.Enter,
2104
+ }), o.editor.setTheme("default");
2105
+ }, [n, a, o]), Z(() => {
2106
+ const p = c.current;
2107
+ p && o && l && p.addCommand(
2108
+ o.KeyMod.Shift | o.KeyCode.Enter,
2110
2109
  function() {
2111
- return c(), !1;
2110
+ return i(), !1;
2112
2111
  }
2113
2112
  );
2114
- }, [r, c, t]);
2115
- function g(o, x) {
2116
- if (p.current = o, !d.current[t.id]) {
2117
- const y = o.getModel(), z = j();
2118
- d.current[t.id] = y || (x == null ? void 0 : x.editor.createModel(z, s)) || o.getModel();
2113
+ }, [o, i, l]);
2114
+ function f(p, N) {
2115
+ if (c.current = p, !b.current[l.id]) {
2116
+ const y = p.getModel(), A = h();
2117
+ b.current[l.id] = y || (N == null ? void 0 : N.editor.createModel(A, s)) || p.getModel();
2119
2118
  }
2120
- o.setModel(d.current[t.id]);
2119
+ p.setModel(b.current[l.id]);
2121
2120
  }
2122
- return { handleEditorDidMount: g };
2121
+ return { handleEditorDidMount: f };
2123
2122
  }
2124
2123
  function bl() {
2125
- const s = h((c) => c.card.sql), n = h((c) => c.sqlGen), { setCardSql: a, setSqlGen: t } = ne(), { handleEditorDidMount: l } = _a("sql");
2126
- function r(c) {
2127
- c && (a(c), vt(n) || t({}));
2124
+ const s = u((o) => o.card.sql), n = u((o) => o.sqlGen), { setCardSql: a, setSqlGen: t } = ne(), { handleEditorDidMount: l } = _a("sql");
2125
+ function r(o) {
2126
+ a(o), vt(n) || t({});
2128
2127
  }
2129
2128
  return /* @__PURE__ */ e.jsx(
2130
2129
  os,
@@ -2132,7 +2131,7 @@ function bl() {
2132
2131
  theme: "default",
2133
2132
  className: "pt-3",
2134
2133
  onChange: r,
2135
- value: s,
2134
+ value: s || "",
2136
2135
  options: {
2137
2136
  minimap: {
2138
2137
  enabled: !1
@@ -2151,15 +2150,16 @@ function bl() {
2151
2150
  );
2152
2151
  }
2153
2152
  function yl() {
2154
- const s = h((t) => t.card.python), { setCardPython: n } = ne(), { handleEditorDidMount: a } = _a("python");
2153
+ const s = u((l) => l.card.python), { setCardPython: n } = ne(), { handleEditorDidMount: a } = _a("python");
2154
+ function t(l) {
2155
+ n(l);
2156
+ }
2155
2157
  return /* @__PURE__ */ e.jsx(
2156
2158
  os,
2157
2159
  {
2158
2160
  className: "pt-3",
2159
2161
  theme: "default",
2160
- onChange: (t) => {
2161
- n(t && t.trim() || "");
2162
- },
2162
+ onChange: t,
2163
2163
  value: s || fa,
2164
2164
  options: {
2165
2165
  minimap: {
@@ -2182,7 +2182,7 @@ function vl() {
2182
2182
  const s = M((r) => r.dashboard.filters), n = M((r) => r.filterValues), a = M((r) => r.selectedSheetId), t = s == null ? void 0 : s.filter(
2183
2183
  (r) => r.sheetId === a || !r.sheetId
2184
2184
  ), l = n == null ? void 0 : n.filter(
2185
- (r) => (t == null ? void 0 : t.some((c) => c.id === r.filterId)) || r.filterId.endsWith(a)
2185
+ (r) => (t == null ? void 0 : t.some((o) => o.id === r.filterId)) || r.filterId.endsWith(a)
2186
2186
  );
2187
2187
  return /* @__PURE__ */ e.jsx(
2188
2188
  os,
@@ -2213,110 +2213,113 @@ function Cl() {
2213
2213
  const [s, n] = q({
2214
2214
  queryKey: [],
2215
2215
  queryData: null
2216
- }), a = Ct(), [t, l] = q(!1), [r, c] = q(!1), [i, u] = q(!1), [p, d] = q(""), [j, g] = q(!1), o = h((S) => S.frame), x = h((S) => S.card), y = h((S) => S.isShowingVisual), z = h(
2217
- (S) => S.selectedConnectionId
2218
- ), b = h(
2219
- (S) => S.selectedDatabaseName
2220
- ), A = h(
2221
- (S) => S.selectedDatamodelId
2222
- ), I = h(
2223
- (S) => S.selectedSchemaName
2224
- ), k = h((S) => S.selectedTableName), T = h((S) => S.card.sql), L = h((S) => S.applyFilters), {
2216
+ }), a = Ct(), [t, l] = q(!1), [r, o] = q(!1), [i, d] = q(!1), [x, c] = q(""), [b, g] = q(!1), h = u((w) => w.frame), f = u((w) => w.card), p = u((w) => w.isShowingVisual), N = u(
2217
+ (w) => w.selectedConnectionId
2218
+ ), y = u(
2219
+ (w) => w.selectedDatabaseName
2220
+ ), A = u(
2221
+ (w) => w.selectedDatamodelId
2222
+ ), I = u(
2223
+ (w) => w.selectedSchemaName
2224
+ ), z = u((w) => w.selectedTableName), T = u((w) => {
2225
+ var le;
2226
+ return (le = w == null ? void 0 : w.card) == null ? void 0 : le.sql;
2227
+ }), L = u((w) => w.applyFilters), {
2225
2228
  setCardCustomCfg: V,
2226
2229
  setQueryResultColumns: m,
2227
2230
  setCardSql: v,
2228
- setQueryError: f,
2231
+ setQueryError: j,
2229
2232
  setPythonStdOut: D,
2230
- setCardPreferences: N,
2233
+ setCardPreferences: S,
2231
2234
  setCardType: _
2232
- } = ne(), $ = h((S) => S.onSave), K = h((S) => S.onClose), ee = h((S) => S.actions.setSqlGen), G = h((S) => S.runSql), se = h((S) => S.actions.setRunSql), w = h((S) => S.actions.setCardCfg), P = h(
2233
- (S) => S.actions.setIsSqlRunning
2235
+ } = ne(), $ = u((w) => w.onSave), K = u((w) => w.onClose), ee = u((w) => w.actions.setSqlGen), G = u((w) => w.runSql), se = u((w) => w.actions.setRunSql), k = u((w) => w.actions.setCardCfg), P = u(
2236
+ (w) => w.actions.setIsSqlRunning
2234
2237
  ), {
2235
2238
  data: U,
2236
2239
  isLoading: E,
2237
2240
  isFetching: F,
2238
- isSuccess: le,
2241
+ isSuccess: re,
2239
2242
  isError: B,
2240
2243
  error: ae,
2241
2244
  queryKey: te,
2242
2245
  refetch: je
2243
- } = De(x);
2246
+ } = De(f);
2244
2247
  Z(() => {
2245
2248
  if (U && (U.rowLimitExceeded && Ge.error("Row limit (10,000) exceeded. Refine your query.", {
2246
2249
  position: "top-center",
2247
2250
  richColors: !0
2248
2251
  }), D((U == null ? void 0 : U.output) || ""), U.records.length > 0)) {
2249
- const { dimensionKeys: S } = js(U.records);
2250
- m(S);
2252
+ const { dimensionKeys: w } = js(U.records);
2253
+ m(w);
2251
2254
  }
2252
2255
  }, [U, m, D]), Z(() => {
2253
- (E || F) && P(!0), (B || le) && P(!1), B ? (f(ae.message), m([]), D("")) : f("");
2256
+ (E || F) && P(!0), (B || re) && P(!1), B ? (j(ae.message), m([]), D("")) : j("");
2254
2257
  }, [
2255
2258
  E,
2256
2259
  F,
2257
2260
  U,
2258
2261
  D,
2259
2262
  B,
2260
- le,
2263
+ re,
2261
2264
  P,
2262
2265
  m,
2263
- f,
2266
+ j,
2264
2267
  ae
2265
2268
  ]), Z(() => {
2266
2269
  G && (a.getQueryData(te) || je(), se(!1));
2267
2270
  }, [G, je, se, te, a]);
2268
2271
  function Te() {
2269
- const S = a.getQueryData(te);
2272
+ const w = a.getQueryData(te);
2270
2273
  s.queryData || n({
2271
2274
  queryKey: te,
2272
- queryData: S
2273
- }), a.setQueryData(te, null), v(""), ee({}), w(void 0), V(""), N({}), _("bar");
2275
+ queryData: w
2276
+ }), a.setQueryData(te, null), v(""), ee({}), k(void 0), V(""), S({}), _("bar");
2274
2277
  }
2275
- function we(S, ie) {
2276
- if (S.length === 0)
2278
+ function we(w, le) {
2279
+ if (w.length === 0)
2277
2280
  return "";
2278
- if (ie) {
2279
- const ke = S.find((oe) => oe.id === ie);
2281
+ if (le) {
2282
+ const ke = w.find((oe) => oe.id === le);
2280
2283
  if (ke) {
2281
2284
  const oe = ke.tabTitle;
2282
2285
  if (oe == "All__Header")
2283
- return S[0].id;
2286
+ return w[0].id;
2284
2287
  if (oe && oe.endsWith("__Header")) {
2285
- const ps = oe.split("__")[0], Qe = S.find(
2288
+ const ps = oe.split("__")[0], Qe = w.find(
2286
2289
  (Je) => Je.tabTitle === ps
2287
2290
  );
2288
- return Qe ? Qe.id : S[0].id;
2291
+ return Qe ? Qe.id : w[0].id;
2289
2292
  }
2290
- return ie;
2293
+ return le;
2291
2294
  }
2292
2295
  }
2293
- return S[0].id;
2296
+ return w[0].id;
2294
2297
  }
2295
2298
  function Le() {
2296
- let S = T;
2297
- T && !T.includes("{{") && (S = rl(T), v(S));
2298
- const ie = {
2299
- ...x,
2299
+ let w = T;
2300
+ T && !T.includes("{{") && (w = rl(T), v(w));
2301
+ const le = {
2302
+ ...f,
2300
2303
  lastSelectedSchema: I,
2301
2304
  lastSelectedDatamodelId: A,
2302
- lastSelectedDatabase: b,
2303
- lastSelectedTable: k,
2304
- connectionId: z,
2305
- type: y ? x.type : "table",
2306
- sql: S,
2307
- customCfg: y ? x.customCfg : null
2308
- }, ke = o.cards.map(
2309
- (_e) => _e.id === x.id ? ie : _e
2305
+ lastSelectedDatabase: y,
2306
+ lastSelectedTable: z,
2307
+ connectionId: N,
2308
+ type: p ? f.type : "table",
2309
+ sql: w,
2310
+ customCfg: p ? f.customCfg : null
2311
+ }, ke = h.cards.map(
2312
+ (_e) => _e.id === f.id ? le : _e
2310
2313
  ), oe = {
2311
- ...o,
2314
+ ...h,
2312
2315
  cards: ke,
2313
- activeCardId: we(ke, o.activeCardId)
2316
+ activeCardId: we(ke, h.activeCardId)
2314
2317
  };
2315
2318
  $ == null || $(oe);
2316
2319
  }
2317
2320
  function Fe() {
2318
- const { queryKey: S, queryData: ie } = s;
2319
- S && ie && a.setQueryData(S, ie), K == null || K();
2321
+ const { queryKey: w, queryData: le } = s;
2322
+ w && le && a.setQueryData(w, le), K == null || K();
2320
2323
  }
2321
2324
  function Ee() {
2322
2325
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
@@ -2331,7 +2334,7 @@ function Cl() {
2331
2334
  r && /* @__PURE__ */ e.jsx(
2332
2335
  Be,
2333
2336
  {
2334
- onClick: () => c(!1),
2337
+ onClick: () => o(!1),
2335
2338
  className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
2336
2339
  }
2337
2340
  )
@@ -2343,7 +2346,7 @@ function Cl() {
2343
2346
  !r && /* @__PURE__ */ e.jsx(
2344
2347
  oa,
2345
2348
  {
2346
- onClick: () => c(!0),
2349
+ onClick: () => o(!0),
2347
2350
  className: Y(
2348
2351
  "absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
2349
2352
  {
@@ -2449,9 +2452,9 @@ function Cl() {
2449
2452
  il,
2450
2453
  {
2451
2454
  error: ae.message,
2452
- setShowAIDialog: u,
2455
+ setShowAIDialog: d,
2453
2456
  setTriggerAIRun: g,
2454
- setUserInputforAI: d
2457
+ setUserInputforAI: c
2455
2458
  }
2456
2459
  ),
2457
2460
  /* @__PURE__ */ e.jsxs(
@@ -2471,7 +2474,7 @@ function Cl() {
2471
2474
  ma,
2472
2475
  {
2473
2476
  pressed: t,
2474
- onPressedChange: (S) => l(S),
2477
+ onPressedChange: (w) => l(w),
2475
2478
  className: "",
2476
2479
  size: "sm",
2477
2480
  variant: "outline",
@@ -2482,11 +2485,11 @@ function Cl() {
2482
2485
  cl,
2483
2486
  {
2484
2487
  open: i,
2485
- setOpen: u,
2486
- userInput: p,
2487
- triggerAIRun: j,
2488
+ setOpen: d,
2489
+ userInput: x,
2490
+ triggerAIRun: b,
2488
2491
  setTriggerAIRun: g,
2489
- setUserInput: (S) => d(S)
2492
+ setUserInput: (w) => c(w)
2490
2493
  }
2491
2494
  )
2492
2495
  ] }),
@@ -2527,20 +2530,20 @@ function Cl() {
2527
2530
  );
2528
2531
  }
2529
2532
  function Nl({ data: s }) {
2530
- var c;
2533
+ var o;
2531
2534
  const [n, a] = Ne.useState([]), l = Object.keys(s[0]).map((i) => ({
2532
2535
  // header: key,
2533
2536
  accessorKey: i,
2534
- header: ({ column: u }) => {
2535
- const p = u.getIsSorted();
2537
+ header: ({ column: d }) => {
2538
+ const x = d.getIsSorted();
2536
2539
  return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
2537
2540
  "div",
2538
2541
  {
2539
2542
  className: "flex cursor-pointer items-center",
2540
- onClick: () => u.toggleSorting(u.getIsSorted() === "asc"),
2543
+ onClick: () => d.toggleSorting(d.getIsSorted() === "asc"),
2541
2544
  children: [
2542
2545
  i,
2543
- p === "asc" ? /* @__PURE__ */ e.jsx(St, { className: "ml-2 h-5 w-5" }) : p === "desc" ? /* @__PURE__ */ e.jsx(wt, { className: "ml-2 h-5 w-5" }) : null
2546
+ x === "asc" ? /* @__PURE__ */ e.jsx(St, { className: "ml-2 h-5 w-5" }) : x === "desc" ? /* @__PURE__ */ e.jsx(wt, { className: "ml-2 h-5 w-5" }) : null
2544
2547
  ]
2545
2548
  }
2546
2549
  ) });
@@ -2558,57 +2561,57 @@ function Nl({ data: s }) {
2558
2561
  }
2559
2562
  });
2560
2563
  return /* @__PURE__ */ e.jsx("div", { className: "font-mono text-xs text-foreground/95", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full", children: [
2561
- /* @__PURE__ */ e.jsx(zt, { children: r.getHeaderGroups().map((i) => /* @__PURE__ */ e.jsx(fs, { children: i.headers.map((u) => /* @__PURE__ */ e.jsx(
2564
+ /* @__PURE__ */ e.jsx(zt, { children: r.getHeaderGroups().map((i) => /* @__PURE__ */ e.jsx(fs, { children: i.headers.map((d) => /* @__PURE__ */ e.jsx(
2562
2565
  Ot,
2563
2566
  {
2564
2567
  className: "sticky top-0 h-11 bg-muted font-semibold",
2565
- children: u.isPlaceholder ? null : Ks(
2566
- u.column.columnDef.header,
2567
- u.getContext()
2568
+ children: d.isPlaceholder ? null : Ks(
2569
+ d.column.columnDef.header,
2570
+ d.getContext()
2568
2571
  )
2569
2572
  },
2570
- u.id
2573
+ d.id
2571
2574
  )) }, i.id)) }),
2572
- /* @__PURE__ */ e.jsx(Dt, { children: (c = r.getRowModel().rows) != null && c.length ? r.getRowModel().rows.map((i) => /* @__PURE__ */ e.jsx(
2575
+ /* @__PURE__ */ e.jsx(Dt, { children: (o = r.getRowModel().rows) != null && o.length ? r.getRowModel().rows.map((i) => /* @__PURE__ */ e.jsx(
2573
2576
  fs,
2574
2577
  {
2575
2578
  className: "whitespace-nowrap py-2",
2576
2579
  "data-state": i.getIsSelected() && "selected",
2577
- children: i.getVisibleCells().map((u) => /* @__PURE__ */ e.jsx(Qs, { className: "py-3", children: Ks(u.column.columnDef.cell, u.getContext()) }, u.id))
2580
+ children: i.getVisibleCells().map((d) => /* @__PURE__ */ e.jsx(Qs, { className: "py-3", children: Ks(d.column.columnDef.cell, d.getContext()) }, d.id))
2578
2581
  },
2579
2582
  i.id
2580
2583
  )) : /* @__PURE__ */ e.jsx(fs, { children: /* @__PURE__ */ e.jsx(Qs, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2581
2584
  ] }) });
2582
2585
  }
2583
2586
  function Sl({ card: s }) {
2584
- var b, A, I, k, T, L, V, m, v, f, D;
2587
+ var y, A, I, z, T, L, V, m, v, j, D;
2585
2588
  const [n, a] = q(!1), [t, l] = q(
2586
2589
  []
2587
- ), { authToken: r } = Se(), c = Lt(r == null ? void 0 : r.accessToken), i = M((N) => N.themeStyle), u = {
2588
- colors: ((A = (b = i == null ? void 0 : i.chart) == null ? void 0 : b.dataset) == null ? void 0 : A.backgroundColor) || []
2590
+ ), { authToken: r } = Se(), o = Lt(r == null ? void 0 : r.accessToken), i = M((S) => S.themeStyle), d = {
2591
+ colors: ((A = (y = i == null ? void 0 : i.chart) == null ? void 0 : y.dataset) == null ? void 0 : A.backgroundColor) || []
2589
2592
  };
2590
2593
  (I = s.customCardPreferences) != null && I.inputData;
2591
- const { getCard: p } = ga(((k = s.customCardPreferences) == null ? void 0 : k.url) || ""), d = ((T = s.customCardPreferences) == null ? void 0 : T.visualType) || "single", j = h((N) => N.frame);
2594
+ const { getCard: x } = ga(((z = s.customCardPreferences) == null ? void 0 : z.url) || ""), c = ((T = s.customCardPreferences) == null ? void 0 : T.visualType) || "single", b = u((S) => S.frame);
2592
2595
  ne();
2593
- const { data: g } = De(s), o = Oa((N, _) => {
2596
+ const { data: g } = De(s), h = Oa((S, _) => {
2594
2597
  l(($) => ({
2595
2598
  ...$,
2596
- [N]: _
2599
+ [S]: _
2597
2600
  }));
2598
2601
  }, []);
2599
2602
  if (!((L = s.customCardPreferences) != null && L.componentName))
2600
2603
  return null;
2601
- const x = p(
2604
+ const f = x(
2602
2605
  (V = s.customCardPreferences) == null ? void 0 : V.componentName
2603
2606
  );
2604
- function y(N) {
2605
- a(N);
2607
+ function p(S) {
2608
+ a(S);
2606
2609
  }
2607
- const z = Object.keys(
2610
+ const N = Object.keys(
2608
2611
  ((m = s.customCardPreferences) == null ? void 0 : m.dataInputCardIds) || {}
2609
- ).map((N) => {
2612
+ ).map((S) => {
2610
2613
  var K, ee, G;
2611
- const _ = (ee = (K = s.customCardPreferences) == null ? void 0 : K.dataInputCardIds) == null ? void 0 : ee[N].cardId, $ = (G = j == null ? void 0 : j.cards) == null ? void 0 : G.find((se) => se.id === _);
2614
+ const _ = (ee = (K = s.customCardPreferences) == null ? void 0 : K.dataInputCardIds) == null ? void 0 : ee[S].cardId, $ = (G = b == null ? void 0 : b.cards) == null ? void 0 : G.find((se) => se.id === _);
2612
2615
  return $ || null;
2613
2616
  });
2614
2617
  return /* @__PURE__ */ e.jsx("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ e.jsxs(
@@ -2616,48 +2619,48 @@ function Sl({ card: s }) {
2616
2619
  {
2617
2620
  fallback: /* @__PURE__ */ e.jsx(e.Fragment, {}),
2618
2621
  children: [
2619
- x && d === "single" && /* @__PURE__ */ e.jsx(
2620
- x,
2622
+ f && c === "single" && /* @__PURE__ */ e.jsx(
2623
+ f,
2621
2624
  {
2622
- params: c,
2623
- theme: u,
2625
+ params: o,
2626
+ theme: d,
2624
2627
  settings: (v = s.customCardPreferences) == null ? void 0 : v.settings,
2625
- onDataChange: o,
2628
+ onDataChange: h,
2626
2629
  data: (g == null ? void 0 : g.records) || []
2627
2630
  }
2628
2631
  ),
2629
- x && d === "multiple" && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2632
+ f && c === "multiple" && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2630
2633
  Object.keys(
2631
- ((f = s.customCardPreferences) == null ? void 0 : f.dataInputCardIds) || {}
2632
- ).map((N) => {
2634
+ ((j = s.customCardPreferences) == null ? void 0 : j.dataInputCardIds) || {}
2635
+ ).map((S) => {
2633
2636
  var K, ee, G;
2634
- const _ = (ee = (K = s.customCardPreferences) == null ? void 0 : K.dataInputCardIds) == null ? void 0 : ee[N].cardId, $ = (G = j == null ? void 0 : j.cards) == null ? void 0 : G.find(
2637
+ const _ = (ee = (K = s.customCardPreferences) == null ? void 0 : K.dataInputCardIds) == null ? void 0 : ee[S].cardId, $ = (G = b == null ? void 0 : b.cards) == null ? void 0 : G.find(
2635
2638
  (se) => se.id === _
2636
2639
  );
2637
2640
  if ($)
2638
2641
  return /* @__PURE__ */ e.jsx(
2639
2642
  Ft,
2640
2643
  {
2641
- onLoadingStatus: y,
2642
- onDataChange: o,
2643
- dataInputIndex: N,
2644
+ onLoadingStatus: p,
2645
+ onDataChange: h,
2646
+ dataInputIndex: S,
2644
2647
  card: $
2645
2648
  },
2646
- $.id + N
2649
+ $.id + S
2647
2650
  );
2648
2651
  }),
2649
2652
  /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2650
- x,
2653
+ f,
2651
2654
  {
2652
- theme: u,
2653
- onDataChange: o,
2654
- settings: z.map(
2655
- (N) => {
2655
+ theme: d,
2656
+ onDataChange: h,
2657
+ settings: N.map(
2658
+ (S) => {
2656
2659
  var _;
2657
- return (_ = N == null ? void 0 : N.customCardPreferences) == null ? void 0 : _.settings;
2660
+ return (_ = S == null ? void 0 : S.customCardPreferences) == null ? void 0 : _.settings;
2658
2661
  }
2659
2662
  ),
2660
- data: z.map((N) => N != null && N.id ? t == null ? void 0 : t[N.id] : [])
2663
+ data: N.map((S) => S != null && S.id ? t == null ? void 0 : t[S.id] : [])
2661
2664
  }
2662
2665
  ) })
2663
2666
  ] })
@@ -2672,43 +2675,43 @@ function Ha({
2672
2675
  className: s,
2673
2676
  ...n
2674
2677
  }) {
2675
- var z;
2676
- const a = h((b) => b.card), t = ((z = a.customCardPreferences) == null ? void 0 : z.showCardHeader) ?? !0, l = h((b) => b.frame), r = M((b) => b.dashboard.filters);
2677
- h((b) => b.actions.setRunSql);
2678
- const { updateFilter: c } = is(), i = r == null ? void 0 : r.find((b) => b.id === l.filterId), { data: u, isLoading: p, isFetching: d } = De(a), { setCard: j } = ne(), { data: g } = Es(a);
2678
+ var N;
2679
+ const a = u((y) => y.card), t = ((N = a.customCardPreferences) == null ? void 0 : N.showCardHeader) ?? !0, l = u((y) => y.frame), r = M((y) => y.dashboard.filters);
2680
+ u((y) => y.actions.setRunSql);
2681
+ const { updateFilter: o } = is(), i = r == null ? void 0 : r.find((y) => y.id === l.filterId), { data: d, isLoading: x, isFetching: c } = De(a), { setCard: b } = ne(), { data: g } = Es(a);
2679
2682
  if (!a.id) return null;
2680
- let o;
2681
- u != null && u.records && (u == null ? void 0 : u.records.length) > 0 && (o = ja({
2682
- data: u == null ? void 0 : u.records,
2683
+ let h;
2684
+ d != null && d.records && (d == null ? void 0 : d.records.length) > 0 && (h = ja({
2685
+ data: d == null ? void 0 : d.records,
2683
2686
  cardType: a.type,
2684
2687
  cfg: a.cfg,
2685
2688
  customCfg: a.customCfg,
2686
2689
  preferences: a.preferences,
2687
2690
  topoJson: g
2688
2691
  }));
2689
- function x(b) {
2690
- return /* @__PURE__ */ e.jsx(Sl, { card: b });
2692
+ function f(y) {
2693
+ return /* @__PURE__ */ e.jsx(Sl, { card: y });
2691
2694
  }
2692
- function y() {
2693
- var b;
2694
- if (u != null && u.records && (u == null ? void 0 : u.records.length) === 0 && !p && !d)
2695
+ function p() {
2696
+ var y;
2697
+ if (d != null && d.records && (d == null ? void 0 : d.records.length) === 0 && !x && !c)
2695
2698
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-2", children: [
2696
2699
  /* @__PURE__ */ e.jsx(_t, { className: "size-8 text-muted-foreground" }),
2697
2700
  /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "No records to display" })
2698
2701
  ] });
2699
2702
  if (a.type === "custom")
2700
- return x(a);
2701
- if (!["table", "custom"].includes(a.type) && o)
2703
+ return f(a);
2704
+ if (!["table", "custom"].includes(a.type) && h)
2702
2705
  return /* @__PURE__ */ e.jsx(
2703
2706
  Ht,
2704
2707
  {
2705
- cfg: o
2708
+ cfg: h
2706
2709
  },
2707
- JSON.stringify(o) + JSON.stringify(a.preferences) + ((b = a == null ? void 0 : a.preferences) == null ? void 0 : b.customVisualCode)
2710
+ JSON.stringify(h) + JSON.stringify(a.preferences) + ((y = a == null ? void 0 : a.preferences) == null ? void 0 : y.customVisualCode)
2708
2711
  );
2709
- if (a.type === "table" && (u != null && u.records) && (u == null ? void 0 : u.records.length) > 0)
2712
+ if (a.type === "table" && (d != null && d.records) && (d == null ? void 0 : d.records.length) > 0)
2710
2713
  return /* @__PURE__ */ e.jsxs(fe, { className: "relative mb-2 flex h-full min-h-0 w-full flex-1 grow basis-0", children: [
2711
- /* @__PURE__ */ e.jsx(Pt, { card: a, data: u == null ? void 0 : u.records }),
2714
+ /* @__PURE__ */ e.jsx(Pt, { card: a, data: d == null ? void 0 : d.records }),
2712
2715
  /* @__PURE__ */ e.jsx(Ke, { orientation: "horizontal" })
2713
2716
  ] });
2714
2717
  }
@@ -2725,7 +2728,7 @@ function Ha({
2725
2728
  Xe,
2726
2729
  {
2727
2730
  text: a.title,
2728
- onSave: (b) => j({ ...a, title: b }),
2731
+ onSave: (y) => b({ ...a, title: y }),
2729
2732
  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-5", children: /* @__PURE__ */ e.jsx(Vt, { className: "text-base", children: a.title || "Edit title..." }) })
2730
2733
  },
2731
2734
  a.title
@@ -2734,7 +2737,7 @@ function Ha({
2734
2737
  Xe,
2735
2738
  {
2736
2739
  text: a.description || "",
2737
- onSave: (b) => j({ ...a, description: b }),
2740
+ onSave: (y) => b({ ...a, description: y }),
2738
2741
  children: /* @__PURE__ */ e.jsx(qt, { children: a.description || "Edit description..." })
2739
2742
  },
2740
2743
  a.description
@@ -2746,14 +2749,14 @@ function Ha({
2746
2749
  {
2747
2750
  className: "my-1",
2748
2751
  text: i.title || i.column,
2749
- onSave: (b) => c({ ...i, title: b }),
2752
+ onSave: (y) => o({ ...i, title: y }),
2750
2753
  children: /* @__PURE__ */ e.jsx(H, { children: i.title })
2751
2754
  }
2752
2755
  ),
2753
2756
  /* @__PURE__ */ e.jsx(ba, { filter: i })
2754
2757
  ] })
2755
2758
  ] }),
2756
- /* @__PURE__ */ e.jsx(Rt, { className: "flex grow flex-col", children: y() })
2759
+ /* @__PURE__ */ e.jsx(Rt, { className: "flex grow flex-col", children: p() })
2757
2760
  ]
2758
2761
  }
2759
2762
  );
@@ -2876,14 +2879,14 @@ const ea = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2876
2879
  /* @__PURE__ */ e.jsx(O, { onClick: l, variant: "outline", children: "Close" })
2877
2880
  ] });
2878
2881
  function Ol() {
2879
- const [s, n] = q(!1), [a, t] = q(""), [l, r] = q(""), [c, i] = q(""), [u, p] = q(""), d = h((k) => k.card), j = h((k) => k.card.customCfg), { data: g } = De(d), { data: o } = Es(d), { setCardCustomCfg: x, setCustomVisualCode: y } = ne(), z = (k) => {
2882
+ const [s, n] = q(!1), [a, t] = q(""), [l, r] = q(""), [o, i] = q(""), [d, x] = q(""), c = u((z) => z.card), b = u((z) => z.card.customCfg), { data: g } = De(c), { data: h } = Es(c), { setCardCustomCfg: f, setCustomVisualCode: p } = ne(), N = (z) => {
2880
2883
  var T, L;
2881
2884
  return JSON.stringify(
2882
2885
  {
2883
- ...k,
2886
+ ...z,
2884
2887
  data: {
2885
- ...k.data,
2886
- datasets: (L = (T = k.data) == null ? void 0 : T.datasets) == null ? void 0 : L.map((V) => ({
2888
+ ...z.data,
2889
+ datasets: (L = (T = z.data) == null ? void 0 : T.datasets) == null ? void 0 : L.map((V) => ({
2887
2890
  ...V,
2888
2891
  data: []
2889
2892
  }))
@@ -2892,68 +2895,68 @@ function Ol() {
2892
2895
  null,
2893
2896
  2
2894
2897
  );
2895
- }, b = () => {
2898
+ }, y = () => {
2896
2899
  var T, L;
2897
2900
  if (!((T = g == null ? void 0 : g.records) != null && T.length)) return;
2898
- const k = ja({
2901
+ const z = ja({
2899
2902
  data: g.records,
2900
- cardType: d.type,
2901
- cfg: d.cfg,
2902
- preferences: d.preferences,
2903
- topoJson: o
2903
+ cardType: c.type,
2904
+ cfg: c.cfg,
2905
+ preferences: c.preferences,
2906
+ topoJson: h
2904
2907
  });
2905
- k && (t(z(k)), i(((L = d.preferences) == null ? void 0 : L.customVisualCode) || ""), r(
2906
- j ? JSON.stringify(j, null, 2) : ""
2908
+ z && (t(N(z)), i(((L = c.preferences) == null ? void 0 : L.customVisualCode) || ""), r(
2909
+ b ? JSON.stringify(b, null, 2) : ""
2907
2910
  ));
2908
2911
  }, A = () => {
2909
2912
  try {
2910
- if (c && y(c), l) {
2911
- const k = JSON.parse(l);
2912
- x(k), p("");
2913
+ if (o && p(o), l) {
2914
+ const z = JSON.parse(l);
2915
+ f(z), x("");
2913
2916
  }
2914
2917
  } catch {
2915
- p("Invalid JSON configuration");
2918
+ x("Invalid JSON configuration");
2916
2919
  }
2917
2920
  }, I = () => {
2918
- if (j) {
2919
- const k = Js.merge(Js.cloneDeep(d.cfg), j);
2920
- return z(k);
2921
+ if (b) {
2922
+ const z = Js.merge(Js.cloneDeep(c.cfg), b);
2923
+ return N(z);
2921
2924
  }
2922
- return a ? z(JSON.parse(a)) : "";
2925
+ return a ? N(JSON.parse(a)) : "";
2923
2926
  };
2924
2927
  return /* @__PURE__ */ e.jsxs(Cs, { open: s, onOpenChange: n, children: [
2925
2928
  /* @__PURE__ */ e.jsx(Ns, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2926
2929
  O,
2927
2930
  {
2928
- onClick: b,
2931
+ onClick: y,
2929
2932
  size: "sm",
2930
2933
  variant: "outline",
2931
- className: j ? "border-foreground/50 dark:border-foreground/70" : "",
2934
+ className: b ? "border-foreground/50 dark:border-foreground/70" : "",
2932
2935
  children: /* @__PURE__ */ e.jsx($t, { className: "h-4 w-4" })
2933
2936
  }
2934
2937
  ) }),
2935
2938
  /* @__PURE__ */ e.jsxs(ws, { className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]", children: [
2936
- /* @__PURE__ */ e.jsx(wl, { card: d }),
2939
+ /* @__PURE__ */ e.jsx(wl, { card: c }),
2937
2940
  /* @__PURE__ */ e.jsxs("div", { className: "flex grow gap-2", children: [
2938
2941
  /* @__PURE__ */ e.jsx(cs, { FallbackComponent: ya, children: /* @__PURE__ */ e.jsx(Ha, { className: "w-1/2 rounded shadow-none" }) }),
2939
2942
  /* @__PURE__ */ e.jsx(
2940
2943
  kl,
2941
2944
  {
2942
2945
  defaultConfig: a,
2943
- customCode: c,
2946
+ customCode: o,
2944
2947
  customConfig: I(),
2945
- onConfigChange: (k) => r(k ?? ""),
2946
- onCodeChange: (k) => i(k ?? "")
2948
+ onConfigChange: (z) => r(z ?? ""),
2949
+ onCodeChange: (z) => i(z ?? "")
2947
2950
  }
2948
2951
  )
2949
2952
  ] }),
2950
2953
  /* @__PURE__ */ e.jsx(
2951
2954
  zl,
2952
2955
  {
2953
- error: u,
2954
- hasCustomConfig: !!j,
2956
+ error: d,
2957
+ hasCustomConfig: !!b,
2955
2958
  onReset: () => {
2956
- r(""), x(null);
2959
+ r(""), f(null);
2957
2960
  },
2958
2961
  onApply: A,
2959
2962
  onClose: () => n(!1)
@@ -2990,7 +2993,7 @@ function Wa(s) {
2990
2993
  const [n, a] = q(null);
2991
2994
  return Z(() => {
2992
2995
  s && (async () => {
2993
- const r = (await import("./lucide-react-DzzsKkzx.js"))[s];
2996
+ const r = (await import("./lucide-react-Be4cg6f4.js"))[s];
2994
2997
  a(r);
2995
2998
  })();
2996
2999
  }, [s]), n;
@@ -3012,10 +3015,10 @@ function Dl({
3012
3015
  var r;
3013
3016
  if (t) {
3014
3017
  const i = (await Promise.all(
3015
- (r = t == null ? void 0 : t.plugins) == null ? void 0 : r.map(async (u) => (await Ut(u.value)).visuals.map((j) => ({
3016
- name: j.name,
3017
- icon: j.icon,
3018
- url: u.value
3018
+ (r = t == null ? void 0 : t.plugins) == null ? void 0 : r.map(async (d) => (await Ut(d.value)).visuals.map((b) => ({
3019
+ name: b.name,
3020
+ icon: b.icon,
3021
+ url: d.value
3019
3022
  })))
3020
3023
  )).flat();
3021
3024
  a(i);
@@ -3043,15 +3046,15 @@ const Ml = ({
3043
3046
  return /* @__PURE__ */ e.jsx(O, { onClick: a, title: s, variant: "ghost", children: t ? /* @__PURE__ */ e.jsx(t, { className: "h-4 w-4" }) : l });
3044
3047
  };
3045
3048
  function Il() {
3046
- var d, j;
3047
- const [s, n] = q(!1), a = h((g) => g.card), t = a.type, { setCardType: l, setCardPreferences: r, setChartOrientation: c } = h((g) => g.actions), { setCardCustomCfg: i, setCustomCardPreferences: u } = ne();
3048
- function p(g, o) {
3049
- i(null), r({}), l(g), o && u({
3049
+ var c, b;
3050
+ const [s, n] = q(!1), a = u((g) => g.card), t = a.type, { setCardType: l, setCardPreferences: r, setChartOrientation: o } = u((g) => g.actions), { setCardCustomCfg: i, setCustomCardPreferences: d } = ne();
3051
+ function x(g, h) {
3052
+ i(null), r({}), l(g), h && d({
3050
3053
  type: "component",
3051
3054
  visualType: "single",
3052
- url: o.url,
3053
- componentName: o.name,
3054
- icon: o.icon
3055
+ url: h.url,
3056
+ componentName: h.name,
3057
+ icon: h.icon
3055
3058
  }), n(!1);
3056
3059
  }
3057
3060
  return /* @__PURE__ */ e.jsxs(ds, { open: s, onOpenChange: n, children: [
@@ -3060,8 +3063,8 @@ function Il() {
3060
3063
  {
3061
3064
  className: "h-4 w-4",
3062
3065
  chartType: t,
3063
- customIcon: (d = a.customCardPreferences) == null ? void 0 : d.icon,
3064
- componentName: (j = a.customCardPreferences) == null ? void 0 : j.componentName
3066
+ customIcon: (c = a.customCardPreferences) == null ? void 0 : c.icon,
3067
+ componentName: (b = a.customCardPreferences) == null ? void 0 : b.componentName
3065
3068
  }
3066
3069
  ) }) }),
3067
3070
  /* @__PURE__ */ e.jsxs(hs, { className: "w-50", children: [
@@ -3069,7 +3072,7 @@ function Il() {
3069
3072
  /* @__PURE__ */ e.jsx(
3070
3073
  O,
3071
3074
  {
3072
- onClick: () => p("bar"),
3075
+ onClick: () => x("bar"),
3073
3076
  className: "font-normal",
3074
3077
  variant: "ghost",
3075
3078
  children: /* @__PURE__ */ e.jsx(qs, { className: "size-5" })
@@ -3078,7 +3081,7 @@ function Il() {
3078
3081
  /* @__PURE__ */ e.jsx(
3079
3082
  O,
3080
3083
  {
3081
- onClick: () => p("line"),
3084
+ onClick: () => x("line"),
3082
3085
  variant: "ghost",
3083
3086
  children: /* @__PURE__ */ e.jsx(Rs, { className: "size-5" })
3084
3087
  }
@@ -3086,7 +3089,7 @@ function Il() {
3086
3089
  /* @__PURE__ */ e.jsx(
3087
3090
  O,
3088
3091
  {
3089
- onClick: () => p("stackedBar"),
3092
+ onClick: () => x("stackedBar"),
3090
3093
  variant: "ghost",
3091
3094
  children: /* @__PURE__ */ e.jsx(Ka, { className: "size-5", strokeWidth: 0 })
3092
3095
  }
@@ -3094,7 +3097,7 @@ function Il() {
3094
3097
  /* @__PURE__ */ e.jsx(
3095
3098
  O,
3096
3099
  {
3097
- onClick: () => p("stackedLine"),
3100
+ onClick: () => x("stackedLine"),
3098
3101
  variant: "ghost",
3099
3102
  children: /* @__PURE__ */ e.jsx(Ga, { className: "size-5", strokeWidth: 0 })
3100
3103
  }
@@ -3102,7 +3105,7 @@ function Il() {
3102
3105
  /* @__PURE__ */ e.jsx(
3103
3106
  O,
3104
3107
  {
3105
- onClick: () => p("scatter"),
3108
+ onClick: () => x("scatter"),
3106
3109
  variant: "ghost",
3107
3110
  children: /* @__PURE__ */ e.jsx(Ia, { className: "size-5" })
3108
3111
  }
@@ -3110,7 +3113,7 @@ function Il() {
3110
3113
  /* @__PURE__ */ e.jsx(
3111
3114
  O,
3112
3115
  {
3113
- onClick: () => p("bubble"),
3116
+ onClick: () => x("bubble"),
3114
3117
  variant: "ghost",
3115
3118
  children: /* @__PURE__ */ e.jsx(Ua, { className: "size-4" })
3116
3119
  }
@@ -3118,7 +3121,7 @@ function Il() {
3118
3121
  /* @__PURE__ */ e.jsx(
3119
3122
  O,
3120
3123
  {
3121
- onClick: () => p("pie"),
3124
+ onClick: () => x("pie"),
3122
3125
  variant: "ghost",
3123
3126
  children: /* @__PURE__ */ e.jsx(Ma, { className: "size-5" })
3124
3127
  }
@@ -3126,7 +3129,7 @@ function Il() {
3126
3129
  /* @__PURE__ */ e.jsx(
3127
3130
  O,
3128
3131
  {
3129
- onClick: () => p("doughnut"),
3132
+ onClick: () => x("doughnut"),
3130
3133
  variant: "ghost",
3131
3134
  children: /* @__PURE__ */ e.jsx($a, { className: "size-5", strokeWidth: 1 })
3132
3135
  }
@@ -3134,7 +3137,7 @@ function Il() {
3134
3137
  /* @__PURE__ */ e.jsx(
3135
3138
  O,
3136
3139
  {
3137
- onClick: () => p("radar"),
3140
+ onClick: () => x("radar"),
3138
3141
  variant: "ghost",
3139
3142
  children: /* @__PURE__ */ e.jsx(
3140
3143
  Pa,
@@ -3148,7 +3151,7 @@ function Il() {
3148
3151
  /* @__PURE__ */ e.jsx(
3149
3152
  O,
3150
3153
  {
3151
- onClick: () => p("polarArea"),
3154
+ onClick: () => x("polarArea"),
3152
3155
  variant: "ghost",
3153
3156
  children: /* @__PURE__ */ e.jsx(Ba, { className: "size-5" })
3154
3157
  }
@@ -3156,7 +3159,7 @@ function Il() {
3156
3159
  /* @__PURE__ */ e.jsx(
3157
3160
  O,
3158
3161
  {
3159
- onClick: () => p("pyramid"),
3162
+ onClick: () => x("pyramid"),
3160
3163
  variant: "ghost",
3161
3164
  children: /* @__PURE__ */ e.jsx(Ja, { className: "size-5" })
3162
3165
  }
@@ -3164,7 +3167,7 @@ function Il() {
3164
3167
  /* @__PURE__ */ e.jsx(
3165
3168
  O,
3166
3169
  {
3167
- onClick: () => p("range"),
3170
+ onClick: () => x("range"),
3168
3171
  variant: "ghost",
3169
3172
  children: /* @__PURE__ */ e.jsx(Da, { className: "size-5" })
3170
3173
  }
@@ -3172,7 +3175,7 @@ function Il() {
3172
3175
  /* @__PURE__ */ e.jsx(
3173
3176
  O,
3174
3177
  {
3175
- onClick: () => p("table"),
3178
+ onClick: () => x("table"),
3176
3179
  variant: "ghost",
3177
3180
  children: /* @__PURE__ */ e.jsx(Is, { className: "size-5" })
3178
3181
  }
@@ -3180,7 +3183,7 @@ function Il() {
3180
3183
  /* @__PURE__ */ e.jsx(
3181
3184
  O,
3182
3185
  {
3183
- onClick: () => p("kpi"),
3186
+ onClick: () => x("kpi"),
3184
3187
  variant: "ghost",
3185
3188
  children: /* @__PURE__ */ e.jsx(Qa, { className: "size-6" })
3186
3189
  }
@@ -3188,7 +3191,7 @@ function Il() {
3188
3191
  /* @__PURE__ */ e.jsx(
3189
3192
  O,
3190
3193
  {
3191
- onClick: () => p("text"),
3194
+ onClick: () => x("text"),
3192
3195
  variant: "ghost",
3193
3196
  children: /* @__PURE__ */ e.jsx(_s, { className: "size-4" })
3194
3197
  }
@@ -3196,7 +3199,7 @@ function Il() {
3196
3199
  /* @__PURE__ */ e.jsx(
3197
3200
  O,
3198
3201
  {
3199
- onClick: () => p("map"),
3202
+ onClick: () => x("map"),
3200
3203
  variant: "ghost",
3201
3204
  children: /* @__PURE__ */ e.jsx(La, { className: "size-4" })
3202
3205
  }
@@ -3204,13 +3207,13 @@ function Il() {
3204
3207
  /* @__PURE__ */ e.jsx(
3205
3208
  O,
3206
3209
  {
3207
- onClick: () => p("custom"),
3210
+ onClick: () => x("custom"),
3208
3211
  variant: "ghost",
3209
3212
  children: /* @__PURE__ */ e.jsx(Fa, { className: "size-4" })
3210
3213
  }
3211
3214
  )
3212
3215
  ] }),
3213
- /* @__PURE__ */ e.jsx(Dl, { onChartTypeChange: p })
3216
+ /* @__PURE__ */ e.jsx(Dl, { onChartTypeChange: x })
3214
3217
  ] })
3215
3218
  ] });
3216
3219
  }
@@ -3260,7 +3263,7 @@ function Tl({
3260
3263
  }
3261
3264
  function Ll() {
3262
3265
  var n;
3263
- const s = h((a) => a.card);
3266
+ const s = u((a) => a.card);
3264
3267
  return (n = s.customCardPreferences) == null || n.showCardHeader, ne(), /* @__PURE__ */ e.jsxs(na, { children: [
3265
3268
  /* @__PURE__ */ e.jsx(la, { asChild: !0, children: /* @__PURE__ */ e.jsx(Ta, { className: "size-4 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground" }) }),
3266
3269
  /* @__PURE__ */ e.jsx(ra, { align: "start", className: "w-40 text-muted-foreground", children: /* @__PURE__ */ e.jsxs(
@@ -3279,11 +3282,11 @@ function Ll() {
3279
3282
  ] });
3280
3283
  }
3281
3284
  function sa() {
3282
- const s = h((m) => m.frame), n = h((m) => m.card), a = h((m) => m.isShowingVisual), t = h((m) => m.isSqlRunning), l = h((m) => m.queryError), r = h((m) => m.pythonStdOut);
3283
- h((m) => m.actions.setRunSql), h((m) => m.onSave), h((m) => m.onClose), h((m) => m.actions.setCardSql), h((m) => m.actions.setCardType), h((m) => m.actions.setSqlGen);
3284
- const { setFrame: c, setCard: i, updateCardInFrame: u, setActiveTabCardId: p } = ne(), { data: d, isLoading: j, isFetching: g } = De(n);
3285
+ const s = u((m) => m.frame), n = u((m) => m.card), a = u((m) => m.isShowingVisual), t = u((m) => m.isSqlRunning), l = u((m) => m.queryError), r = u((m) => m.pythonStdOut);
3286
+ u((m) => m.actions.setRunSql);
3287
+ const { setFrame: o, setCard: i, updateCardInFrame: d, setActiveTabCardId: x } = ne(), { data: c, isLoading: b, isFetching: g } = De(n);
3285
3288
  if (!n) return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3286
- function o() {
3289
+ function h() {
3287
3290
  const m = {
3288
3291
  connectionId: n.connectionId,
3289
3292
  id: Ue(),
@@ -3301,56 +3304,56 @@ function sa() {
3301
3304
  sql: "",
3302
3305
  data: []
3303
3306
  };
3304
- x(m);
3307
+ f(m);
3305
3308
  }
3306
- function x(m) {
3309
+ function f(m) {
3307
3310
  const v = {
3308
3311
  ...s,
3309
3312
  cards: [...s.cards, m],
3310
3313
  activeCardId: m.id
3311
3314
  };
3312
- c(v), i(m);
3315
+ o(v), x(m.id);
3313
3316
  }
3314
- function y() {
3317
+ function p() {
3315
3318
  const m = {
3316
3319
  ...n,
3317
3320
  id: Ue(),
3318
3321
  title: `${n.title} Copy`,
3319
3322
  tabTitle: `${n.tabTitle || n.title} Copy`
3320
3323
  };
3321
- x(m);
3324
+ f(m);
3322
3325
  }
3323
- function z(m) {
3324
- const v = s.cards.filter((N) => N.id !== m), f = v[0], D = {
3326
+ function N(m) {
3327
+ const v = s.cards.filter((S) => S.id !== m), j = v[0], D = {
3325
3328
  ...s,
3326
3329
  cards: v,
3327
3330
  // update the active card to the first card in the frame
3328
- activeCardId: f.id
3331
+ activeCardId: j.id
3329
3332
  };
3330
- c(D), i(f);
3333
+ o(D), i(j);
3331
3334
  }
3332
- function b(m) {
3333
- p(m);
3335
+ function y(m) {
3336
+ x(m);
3334
3337
  }
3335
3338
  const A = (m, v) => {
3336
3339
  console.log("handleDragStart", v), m.dataTransfer.setData("tabIndex", v.toString());
3337
3340
  }, I = (m) => {
3338
3341
  m.preventDefault();
3339
- }, k = (m, v) => {
3340
- const f = m.dataTransfer.getData("tabIndex");
3341
- if (f === v.toString()) return;
3342
- const D = Array.from(s.cards), [N] = D.splice(parseInt(f), 1);
3343
- D.splice(v, 0, N), c({ ...s, cards: D });
3342
+ }, z = (m, v) => {
3343
+ const j = m.dataTransfer.getData("tabIndex");
3344
+ if (j === v.toString()) return;
3345
+ const D = Array.from(s.cards), [S] = D.splice(parseInt(j), 1);
3346
+ D.splice(v, 0, S), o({ ...s, cards: D });
3344
3347
  };
3345
3348
  function T(m, v) {
3346
3349
  return m.cards.length === 1 && (v.displayTab === !0 || v.displayTab === void 0) || m.activeCardId !== v.id && (v.displayTab === !0 || v.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
3347
3350
  "div",
3348
3351
  {
3349
3352
  onClick: () => {
3350
- const f = v.displayTab === void 0 ? !1 : !v.displayTab;
3351
- i({ ...v, displayTab: f }), u({
3353
+ const j = v.displayTab === void 0 ? !1 : !v.displayTab;
3354
+ i({ ...v, displayTab: j }), d({
3352
3355
  ...v,
3353
- displayTab: f
3356
+ displayTab: j
3354
3357
  });
3355
3358
  },
3356
3359
  children: v.displayTab === !0 || v.displayTab === void 0 ? /* @__PURE__ */ e.jsx(Yt, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e.jsx(Mn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
@@ -3361,7 +3364,7 @@ function sa() {
3361
3364
  return /* @__PURE__ */ e.jsxs(
3362
3365
  va,
3363
3366
  {
3364
- onValueChange: b,
3367
+ onValueChange: y,
3365
3368
  value: s.activeCardId,
3366
3369
  className: "flex grow flex-col",
3367
3370
  children: [
@@ -3371,16 +3374,16 @@ function sa() {
3371
3374
  Xe,
3372
3375
  {
3373
3376
  text: m.tabTitle || m.title,
3374
- onSave: (f) => {
3375
- i({ ...n, tabTitle: f }), u({ ...n, tabTitle: f });
3377
+ onSave: (j) => {
3378
+ i({ ...n, tabTitle: j }), d({ ...n, tabTitle: j });
3376
3379
  },
3377
3380
  children: /* @__PURE__ */ e.jsxs(
3378
3381
  Ze,
3379
3382
  {
3380
3383
  draggable: !0,
3381
- onDragStart: (f) => A(f, v),
3384
+ onDragStart: (j) => A(j, v),
3382
3385
  onDragOver: I,
3383
- onDrop: (f) => k(f, v),
3386
+ onDrop: (j) => z(j, v),
3384
3387
  className: "",
3385
3388
  value: m.id,
3386
3389
  children: [
@@ -3390,7 +3393,7 @@ function sa() {
3390
3393
  Sa,
3391
3394
  {
3392
3395
  className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
3393
- onClick: () => z(m.id)
3396
+ onClick: () => N(m.id)
3394
3397
  }
3395
3398
  )
3396
3399
  ]
@@ -3404,7 +3407,7 @@ function sa() {
3404
3407
  {
3405
3408
  className: "ml-1 h-8 px-2 hover:bg-muted-foreground/50",
3406
3409
  variant: "outline",
3407
- onClick: o,
3410
+ onClick: h,
3408
3411
  children: /* @__PURE__ */ e.jsx(Ss, { className: "h-4 w-4" })
3409
3412
  }
3410
3413
  ),
@@ -3413,7 +3416,7 @@ function sa() {
3413
3416
  {
3414
3417
  className: "invisible ml-1 h-8 px-2 hover:bg-muted-foreground/50 group-hover:visible",
3415
3418
  variant: "outline",
3416
- onClick: y,
3419
+ onClick: p,
3417
3420
  children: /* @__PURE__ */ e.jsx(zn, { className: "h-4 w-4" })
3418
3421
  }
3419
3422
  )
@@ -3423,17 +3426,17 @@ function sa() {
3423
3426
  );
3424
3427
  }
3425
3428
  function V() {
3426
- return n.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Qt, { card: n, data: d == null ? void 0 : d.records }) }) }) : n.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(fe, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e.jsx(
3429
+ return n.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Qt, { card: n, data: c == null ? void 0 : c.records }) }) }) : n.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(fe, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e.jsx(
3427
3430
  Jt,
3428
3431
  {
3429
3432
  isLoading: t,
3430
3433
  card: n,
3431
- data: d == null ? void 0 : d.records
3434
+ data: c == null ? void 0 : c.records
3432
3435
  }
3433
3436
  ) }) }) }) : /* @__PURE__ */ e.jsx(cs, { FallbackComponent: ya, children: /* @__PURE__ */ e.jsx(Ha, { className: "grow border-none shadow-none" }) });
3434
3437
  }
3435
3438
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col py-3", children: [
3436
- (j || g) && /* @__PURE__ */ e.jsx(Ve, { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto h-10 w-10 animate-spin text-foreground/10" }),
3439
+ (b || g) && /* @__PURE__ */ e.jsx(Ve, { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto h-10 w-10 animate-spin text-foreground/10" }),
3437
3440
  /* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
3438
3441
  a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
3439
3442
  /* @__PURE__ */ e.jsx(Il, {}),
@@ -3470,7 +3473,7 @@ function sa() {
3470
3473
  minSize: 10,
3471
3474
  className: "relative flex h-full min-h-0 w-full flex-1 basis-0",
3472
3475
  children: /* @__PURE__ */ e.jsxs(fe, { className: "relative flex h-full min-h-0 w-full flex-1 basis-0", children: [
3473
- (d == null ? void 0 : d.records) && (d == null ? void 0 : d.records.length) > 0 && /* @__PURE__ */ e.jsx(Nl, { data: (d == null ? void 0 : d.records) || [] }),
3476
+ (c == null ? void 0 : c.records) && (c == null ? void 0 : c.records.length) > 0 && /* @__PURE__ */ e.jsx(Nl, { data: (c == null ? void 0 : c.records) || [] }),
3474
3477
  l && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-xs", children: l }),
3475
3478
  /* @__PURE__ */ e.jsx(Ke, { orientation: "horizontal" })
3476
3479
  ] })
@@ -3482,7 +3485,7 @@ function sa() {
3482
3485
  ] });
3483
3486
  }
3484
3487
  function Fl() {
3485
- const s = h((a) => a.pythonStdOut);
3488
+ const s = u((a) => a.pythonStdOut);
3486
3489
  if (!s) return null;
3487
3490
  const n = s.replace(/\n/g, "<br>");
3488
3491
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full flex-col border-r", children: [
@@ -3494,7 +3497,7 @@ function Fl() {
3494
3497
  ] });
3495
3498
  }
3496
3499
  function El() {
3497
- const s = h((a) => a.isShowingVisual), n = h(
3500
+ const s = u((a) => a.isShowingVisual), n = u(
3498
3501
  (a) => a.actions.setIsShowingVisual
3499
3502
  );
3500
3503
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
@@ -3572,30 +3575,30 @@ function $e({
3572
3575
  );
3573
3576
  }
3574
3577
  function Vl() {
3575
- var y, z;
3576
- const s = h(
3577
- (b) => b.card.customCardPreferences
3578
- ), { data: n } = Ya(), a = (n == null ? void 0 : n.plugins) || [], t = h((b) => b.card), l = h((b) => b.frame), r = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: c } = ne(), { components: i, manifest: u } = ga(
3578
+ var p, N;
3579
+ const s = u(
3580
+ (y) => y.card.customCardPreferences
3581
+ ), { data: n } = Ya(), a = (n == null ? void 0 : n.plugins) || [], t = u((y) => y.card), l = u((y) => y.frame), r = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: o } = ne(), { components: i, manifest: d } = ga(
3579
3582
  (s == null ? void 0 : s.url) || ""
3580
- ), p = (y = u == null ? void 0 : u.visuals) == null ? void 0 : y.find(
3581
- (b) => b.name === (s == null ? void 0 : s.componentName)
3583
+ ), x = (p = d == null ? void 0 : d.visuals) == null ? void 0 : p.find(
3584
+ (y) => y.name === (s == null ? void 0 : s.componentName)
3582
3585
  );
3583
- function d(b, A) {
3586
+ function c(y, A) {
3584
3587
  if (!s) return;
3585
- const k = {
3588
+ const z = {
3586
3589
  ...(s == null ? void 0 : s.dataInputCardIds) || {},
3587
- [b]: {
3590
+ [y]: {
3588
3591
  cardId: A,
3589
3592
  hookRef: null
3590
3593
  }
3591
3594
  };
3592
- c({
3595
+ o({
3593
3596
  ...s,
3594
- dataInputCardIds: k
3597
+ dataInputCardIds: z
3595
3598
  });
3596
3599
  }
3597
- function j(b) {
3598
- var I, k;
3600
+ function b(y) {
3601
+ var I, z;
3599
3602
  const A = (I = l == null ? void 0 : l.cards) == null ? void 0 : I.filter((T) => {
3600
3603
  var L;
3601
3604
  return ((L = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : L.visualType) !== "multiple";
@@ -3603,7 +3606,7 @@ function Vl() {
3603
3606
  value: T.id,
3604
3607
  label: T.tabTitle || T.title
3605
3608
  }));
3606
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (k = b == null ? void 0 : b.dataInputs) == null ? void 0 : k.map((T, L) => {
3609
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (z = y == null ? void 0 : y.dataInputs) == null ? void 0 : z.map((T, L) => {
3607
3610
  var V, m;
3608
3611
  return /* @__PURE__ */ e.jsxs(
3609
3612
  "div",
@@ -3618,7 +3621,7 @@ function Vl() {
3618
3621
  label: "",
3619
3622
  options: A || [],
3620
3623
  value: ((m = (V = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : V[L]) == null ? void 0 : m.cardId) || "",
3621
- onValueChange: (v) => d(L, v)
3624
+ onValueChange: (v) => c(L, v)
3622
3625
  }
3623
3626
  )
3624
3627
  ]
@@ -3627,15 +3630,15 @@ function Vl() {
3627
3630
  );
3628
3631
  }) });
3629
3632
  }
3630
- function g(b, A, I = []) {
3631
- var k, T;
3632
- return s ? b === "input" ? /* @__PURE__ */ e.jsx(
3633
- re,
3633
+ function g(y, A, I = []) {
3634
+ var z, T;
3635
+ return s ? y === "input" ? /* @__PURE__ */ e.jsx(
3636
+ ie,
3634
3637
  {
3635
3638
  className: `h-8 w-full ${Pe}`,
3636
- value: ((k = s == null ? void 0 : s.settings) == null ? void 0 : k[A]) || "",
3639
+ value: ((z = s == null ? void 0 : s.settings) == null ? void 0 : z[A]) || "",
3637
3640
  onChange: (L) => {
3638
- c({
3641
+ o({
3639
3642
  ...s,
3640
3643
  settings: {
3641
3644
  ...s == null ? void 0 : s.settings,
@@ -3645,7 +3648,7 @@ function Vl() {
3645
3648
  }
3646
3649
  },
3647
3650
  A
3648
- ) : b === "select" ? /* @__PURE__ */ e.jsx(
3651
+ ) : y === "select" ? /* @__PURE__ */ e.jsx(
3649
3652
  de,
3650
3653
  {
3651
3654
  className: "h-8 w-full",
@@ -3653,7 +3656,7 @@ function Vl() {
3653
3656
  options: I,
3654
3657
  value: ((T = s == null ? void 0 : s.settings) == null ? void 0 : T[A]) || "",
3655
3658
  onValueChange: (L) => {
3656
- c({
3659
+ o({
3657
3660
  ...s,
3658
3661
  settings: { ...s == null ? void 0 : s.settings, [A]: L }
3659
3662
  });
@@ -3661,21 +3664,21 @@ function Vl() {
3661
3664
  }
3662
3665
  ) : null : null;
3663
3666
  }
3664
- function o(b) {
3665
- const A = Object.entries((b == null ? void 0 : b.settings) || {});
3666
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: A.map(([I, k]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3667
- /* @__PURE__ */ e.jsx(H, { children: k.title }),
3667
+ function h(y) {
3668
+ const A = Object.entries((y == null ? void 0 : y.settings) || {});
3669
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: A.map(([I, z]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3670
+ /* @__PURE__ */ e.jsx(H, { children: z.title }),
3668
3671
  g(
3669
- k.ui,
3672
+ z.ui,
3670
3673
  I,
3671
- k.options
3674
+ z.options
3672
3675
  )
3673
3676
  ] }, I)) });
3674
3677
  }
3675
- function x(b) {
3676
- s && c({
3678
+ function f(y) {
3679
+ s && o({
3677
3680
  ...s,
3678
- visualType: b,
3681
+ visualType: y,
3679
3682
  componentName: ""
3680
3683
  });
3681
3684
  }
@@ -3692,12 +3695,12 @@ function Vl() {
3692
3695
  label: "",
3693
3696
  options: a,
3694
3697
  value: (s == null ? void 0 : s.url) || "",
3695
- onValueChange: (b) => c({
3698
+ onValueChange: (y) => o({
3696
3699
  ...s || {
3697
3700
  url: "",
3698
3701
  componentName: ""
3699
3702
  },
3700
- url: b
3703
+ url: y
3701
3704
  })
3702
3705
  }
3703
3706
  ) }) }),
@@ -3709,7 +3712,7 @@ function Vl() {
3709
3712
  { value: "multiple", label: "Multi-Visual" }
3710
3713
  ],
3711
3714
  value: r,
3712
- onValueChange: x
3715
+ onValueChange: f
3713
3716
  }
3714
3717
  ),
3715
3718
  ((s == null ? void 0 : s.type) === "component" || (s == null ? void 0 : s.type) === void 0) && s && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
@@ -3720,16 +3723,16 @@ function Vl() {
3720
3723
  className: "h-8 w-full",
3721
3724
  label: "",
3722
3725
  options: (i == null ? void 0 : i.filter(
3723
- (b) => b.type === r
3724
- ).map((b) => ({
3725
- value: b.name,
3726
- label: b.name
3726
+ (y) => y.type === r
3727
+ ).map((y) => ({
3728
+ value: y.name,
3729
+ label: y.name
3727
3730
  }))) || [],
3728
3731
  value: s.componentName,
3729
- onValueChange: (b) => {
3730
- console.log("changing value", b), c({
3732
+ onValueChange: (y) => {
3733
+ console.log("changing value", y), o({
3731
3734
  ...s,
3732
- componentName: b
3735
+ componentName: y
3733
3736
  });
3734
3737
  }
3735
3738
  }
@@ -3737,12 +3740,12 @@ function Vl() {
3737
3740
  ] }) })
3738
3741
  ] }) }) }),
3739
3742
  /* @__PURE__ */ e.jsx(Ce, { className: "my-4" }),
3740
- ((z = t == null ? void 0 : t.customCardPreferences) == null ? void 0 : z.componentName) && /* @__PURE__ */ e.jsxs($e, { summary: "Component Settings", children: [
3741
- p && p.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3743
+ ((N = t == null ? void 0 : t.customCardPreferences) == null ? void 0 : N.componentName) && /* @__PURE__ */ e.jsxs($e, { summary: "Component Settings", children: [
3744
+ x && x.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3742
3745
  /* @__PURE__ */ e.jsx(H, { children: "Input Mapping" }),
3743
- /* @__PURE__ */ e.jsx("div", { className: "px-2", children: j(p) })
3746
+ /* @__PURE__ */ e.jsx("div", { className: "px-2", children: b(x) })
3744
3747
  ] }),
3745
- p && p.settings && /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ e.jsx("div", { className: "px-2", children: o(p) }) })
3748
+ x && x.settings && /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: /* @__PURE__ */ e.jsx("div", { className: "px-2", children: h(x) }) })
3746
3749
  ] })
3747
3750
  ]
3748
3751
  }
@@ -3750,28 +3753,28 @@ function Vl() {
3750
3753
  }
3751
3754
  function Ie() {
3752
3755
  const [s, n] = q([]);
3753
- h(
3754
- (d) => d.card.cfg
3756
+ u(
3757
+ (c) => c.card.cfg
3755
3758
  );
3756
- const a = h((d) => d.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: r } = h((d) => d.actions), c = h(
3757
- (d) => d.queryResultColumns
3759
+ const a = u((c) => c.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: r } = u((c) => c.actions), o = u(
3760
+ (c) => c.queryResultColumns
3758
3761
  );
3759
- h(
3760
- (d) => {
3761
- var j;
3762
- return (j = d.card.preferences) == null ? void 0 : j.filterOnClickColumnIndex;
3762
+ u(
3763
+ (c) => {
3764
+ var b;
3765
+ return (b = c.card.preferences) == null ? void 0 : b.filterOnClickColumnIndex;
3763
3766
  }
3764
3767
  ), Z(() => {
3765
- c && n(new Array(c.length).fill(!1));
3766
- }, [c]);
3767
- function i(d, j) {
3768
- var g, o;
3769
- j ? a != null && a.onClickFilter && ((g = a == null ? void 0 : a.onClickFilter) == null ? void 0 : g.length) > 0 ? r({
3768
+ o && n(new Array(o.length).fill(!1));
3769
+ }, [o]);
3770
+ function i(c, b) {
3771
+ var g, h;
3772
+ b ? a != null && a.onClickFilter && ((g = a == null ? void 0 : a.onClickFilter) == null ? void 0 : g.length) > 0 ? r({
3770
3773
  ...a,
3771
3774
  onClickFilter: [
3772
3775
  ...a.onClickFilter,
3773
3776
  {
3774
- columnIndex: d,
3777
+ columnIndex: c,
3775
3778
  expression: ""
3776
3779
  }
3777
3780
  ]
@@ -3779,39 +3782,39 @@ function Ie() {
3779
3782
  ...a,
3780
3783
  onClickFilter: [
3781
3784
  {
3782
- columnIndex: d,
3785
+ columnIndex: c,
3783
3786
  expression: ""
3784
3787
  }
3785
3788
  ]
3786
3789
  }) : (r({
3787
3790
  ...a,
3788
- onClickFilter: (o = a == null ? void 0 : a.onClickFilter) == null ? void 0 : o.filter(
3789
- (x) => x.columnIndex !== d
3791
+ onClickFilter: (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.filter(
3792
+ (f) => f.columnIndex !== c
3790
3793
  )
3791
- }), n((x) => {
3792
- const y = [...x];
3793
- return y[d] = !1, y;
3794
+ }), n((f) => {
3795
+ const p = [...f];
3796
+ return p[c] = !1, p;
3794
3797
  }));
3795
3798
  }
3796
- function u(d, j) {
3797
- var o;
3798
- const g = (o = a == null ? void 0 : a.onClickFilter) == null ? void 0 : o.map((x) => x.columnIndex === d ? {
3799
- ...x,
3800
- expression: j.target.value
3801
- } : x);
3799
+ function d(c, b) {
3800
+ var h;
3801
+ const g = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.map((f) => f.columnIndex === c ? {
3802
+ ...f,
3803
+ expression: b.target.value
3804
+ } : f);
3802
3805
  r({
3803
3806
  ...a,
3804
3807
  onClickFilter: g
3805
3808
  });
3806
3809
  }
3807
- function p(d) {
3808
- var j, g, o, x;
3809
- if (s != null && s[d] || (g = (j = a == null ? void 0 : a.onClickFilter) == null ? void 0 : j.find((y) => y.columnIndex === d)) != null && g.expression)
3810
+ function x(c) {
3811
+ var b, g, h, f;
3812
+ if (s != null && s[c] || (g = (b = a == null ? void 0 : a.onClickFilter) == null ? void 0 : b.find((p) => p.columnIndex === c)) != null && g.expression)
3810
3813
  return /* @__PURE__ */ e.jsx(
3811
- re,
3814
+ ie,
3812
3815
  {
3813
- value: (x = (o = a == null ? void 0 : a.onClickFilter) == null ? void 0 : o.find((y) => y.columnIndex === d)) == null ? void 0 : x.expression,
3814
- onChange: (y) => u(d, y),
3816
+ value: (f = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find((p) => p.columnIndex === c)) == null ? void 0 : f.expression,
3817
+ onChange: (p) => d(c, p),
3815
3818
  type: "text",
3816
3819
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
3817
3820
  placeholder: "Expression"
@@ -3820,8 +3823,8 @@ function Ie() {
3820
3823
  }
3821
3824
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3822
3825
  /* @__PURE__ */ e.jsx(H, { children: "On Click" }),
3823
- c == null ? void 0 : c.map((d, j) => {
3824
- var g, o;
3826
+ o == null ? void 0 : o.map((c, b) => {
3827
+ var g, h;
3825
3828
  return /* @__PURE__ */ e.jsx(
3826
3829
  "div",
3827
3830
  {
@@ -3832,54 +3835,54 @@ function Ie() {
3832
3835
  As,
3833
3836
  {
3834
3837
  checked: !!((g = a == null ? void 0 : a.onClickFilter) != null && g.find(
3835
- (x) => x.columnIndex === j
3838
+ (f) => f.columnIndex === b
3836
3839
  )),
3837
- onCheckedChange: (x) => i(j, x)
3840
+ onCheckedChange: (f) => i(b, f)
3838
3841
  }
3839
3842
  ),
3840
3843
  /* @__PURE__ */ e.jsx(
3841
3844
  "label",
3842
3845
  {
3843
3846
  className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
3844
- children: d
3847
+ children: c
3845
3848
  }
3846
3849
  ),
3847
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((o = a == null ? void 0 : a.onClickFilter) == null ? void 0 : o.find(
3848
- (x) => x.columnIndex === j
3850
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find(
3851
+ (f) => f.columnIndex === b
3849
3852
  )) && /* @__PURE__ */ e.jsx(
3850
3853
  ia,
3851
3854
  {
3852
3855
  onClick: () => {
3853
- n((x) => {
3854
- const y = [...x];
3855
- return y[j] = !x[j], y;
3856
+ n((f) => {
3857
+ const p = [...f];
3858
+ return p[b] = !f[b], p;
3856
3859
  });
3857
3860
  },
3858
3861
  className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
3859
3862
  }
3860
3863
  ) })
3861
3864
  ] }),
3862
- p(j)
3865
+ x(b)
3863
3866
  ] })
3864
3867
  },
3865
- d
3868
+ c
3866
3869
  );
3867
3870
  })
3868
3871
  ] });
3869
3872
  }
3870
3873
  function xs() {
3871
- var c, i, u;
3872
- const s = h((p) => p.card.preferences), n = h(
3873
- (p) => p.card.cfg
3874
- ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: l } = h((p) => p.actions);
3875
- (c = n == null ? void 0 : n.options) != null && c.indexAxis;
3876
- function r(p) {
3877
- l(p);
3874
+ var o, i, d;
3875
+ const s = u((x) => x.card.preferences), n = u(
3876
+ (x) => x.card.cfg
3877
+ ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: l } = u((x) => x.actions);
3878
+ (o = n == null ? void 0 : n.options) != null && o.indexAxis;
3879
+ function r(x) {
3880
+ l(x);
3878
3881
  }
3879
3882
  return /* @__PURE__ */ e.jsxs(
3880
3883
  ms,
3881
3884
  {
3882
- value: ((i = s == null ? void 0 : s.chartOptions) == null ? void 0 : i.indexAxis) || ((u = n == null ? void 0 : n.options) == null ? void 0 : u.indexAxis) || "x",
3885
+ value: ((i = s == null ? void 0 : s.chartOptions) == null ? void 0 : i.indexAxis) || ((d = n == null ? void 0 : n.options) == null ? void 0 : d.indexAxis) || "x",
3883
3886
  onValueChange: r,
3884
3887
  className: "flex gap-3",
3885
3888
  defaultValue: "x",
@@ -3903,34 +3906,34 @@ function aa(s, n) {
3903
3906
  return ((r = (l = (t = s == null ? void 0 : s.chartOptions) == null ? void 0 : t.scales) == null ? void 0 : l[a]) == null ? void 0 : r.type) || "linear";
3904
3907
  }
3905
3908
  function Xa() {
3906
- var ee, G, se, w, P, U;
3907
- const [s, n] = q(!1), a = h((E) => {
3909
+ var ee, G, se, k, P, U;
3910
+ const [s, n] = q(!1), a = u((E) => {
3908
3911
  var F;
3909
3912
  return (F = E.card) == null ? void 0 : F.preferences;
3910
- }), t = h((E) => {
3913
+ }), t = u((E) => {
3911
3914
  var F;
3912
3915
  return (F = E.card) == null ? void 0 : F.cfg;
3913
- }), l = wa(a, t), [r, c] = q(
3916
+ }), l = wa(a, t), [r, o] = q(
3914
3917
  aa(a)
3915
- ), [i, u] = q(
3918
+ ), [i, d] = q(
3916
3919
  ((se = (G = (ee = a == null ? void 0 : a.chartOptions) == null ? void 0 : ee.scales) == null ? void 0 : G[l]) == null ? void 0 : se.min) || ""
3917
- ), [p, d] = q(
3918
- ((U = (P = (w = a == null ? void 0 : a.chartOptions) == null ? void 0 : w.scales) == null ? void 0 : P[l]) == null ? void 0 : U.max) || ""
3919
- ), [j, g] = q(i || p ? "custom" : "auto"), [o, x] = q(""), [y, z] = q(0), [b, A] = q(""), [I, k] = q(""), [T, L] = q(""), V = h(
3920
+ ), [x, c] = q(
3921
+ ((U = (P = (k = a == null ? void 0 : a.chartOptions) == null ? void 0 : k.scales) == null ? void 0 : P[l]) == null ? void 0 : U.max) || ""
3922
+ ), [b, g] = q(i || x ? "custom" : "auto"), [h, f] = q(""), [p, N] = q(0), [y, A] = q(""), [I, z] = q(""), [T, L] = q(""), V = u(
3920
3923
  (E) => E.actions.setCardPreferences
3921
- ), { updateCardInFrame: m } = ne(), v = h((E) => E.card), f = h((E) => {
3924
+ ), { updateCardInFrame: m } = ne(), v = u((E) => E.card), j = u((E) => {
3922
3925
  var F;
3923
3926
  return (F = E.card) == null ? void 0 : F.type;
3924
- }), D = ["pie", "doughnut", "polarArea"].includes(f);
3927
+ }), D = ["pie", "doughnut", "polarArea"].includes(j);
3925
3928
  Z(() => {
3926
- var E, F, le, B, ae, te, je, Te, we, Le, Fe, Ee, Ae, S;
3927
- c(aa(a)), u(
3928
- ((le = (F = (E = a == null ? void 0 : a.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : F[l]) == null ? void 0 : le.min) === 0 ? 0 : ""
3929
- ), d(((te = (ae = (B = a == null ? void 0 : a.chartOptions) == null ? void 0 : B.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), x(
3929
+ var E, F, re, B, ae, te, je, Te, we, Le, Fe, Ee, Ae, w;
3930
+ o(aa(a)), d(
3931
+ ((re = (F = (E = a == null ? void 0 : a.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : F[l]) == null ? void 0 : re.min) === 0 ? 0 : ""
3932
+ ), c(((te = (ae = (B = a == null ? void 0 : a.chartOptions) == null ? void 0 : B.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), f(
3930
3933
  ((Le = (we = (Te = (je = a == null ? void 0 : a.chartOptions) == null ? void 0 : je.scales) == null ? void 0 : Te[l]) == null ? void 0 : we.ticks) == null ? void 0 : Le.stepSize) || ""
3931
- ), z(((Fe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Fe.decimalPlaces) || 0), A(((Ee = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Ee.suffix) || ""), k(((Ae = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Ae.currency) || ""), L(((S = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : S.locale) || "");
3934
+ ), N(((Fe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Fe.decimalPlaces) || 0), A(((Ee = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Ee.suffix) || ""), z(((Ae = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Ae.currency) || ""), L(((w = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : w.locale) || "");
3932
3935
  }, [s, a, l]);
3933
- function N(E, F) {
3936
+ function S(E, F) {
3934
3937
  return F === "" || /^[0-9\b]+$/.test(F) ? Number(F) : Number(E);
3935
3938
  }
3936
3939
  function _() {
@@ -3958,7 +3961,7 @@ function Xa() {
3958
3961
  ue,
3959
3962
  {
3960
3963
  value: I || "none",
3961
- onValueChange: (F) => k(F === "none" ? "" : F),
3964
+ onValueChange: (F) => z(F === "none" ? "" : F),
3962
3965
  children: [
3963
3966
  /* @__PURE__ */ e.jsx(he, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(me, {}) }),
3964
3967
  /* @__PURE__ */ e.jsx(xe, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
@@ -3986,10 +3989,10 @@ function Xa() {
3986
3989
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-9 items-center gap-2", children: [
3987
3990
  /* @__PURE__ */ e.jsx(H, { className: "col-span-3", htmlFor: "format", children: "Decimals" }),
3988
3991
  /* @__PURE__ */ e.jsx(
3989
- re,
3992
+ ie,
3990
3993
  {
3991
- value: y,
3992
- onChange: (F) => z(Number(F.target.value)),
3994
+ value: p,
3995
+ onChange: (F) => N(Number(F.target.value)),
3993
3996
  id: "format",
3994
3997
  className: `col-span-6 h-8 w-full tracking-wide ${We}`
3995
3998
  }
@@ -4002,19 +4005,19 @@ function Xa() {
4002
4005
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
4003
4006
  /* @__PURE__ */ e.jsx(H, { htmlFor: "range", children: "Range" }),
4004
4007
  /* @__PURE__ */ e.jsx(
4005
- re,
4008
+ ie,
4006
4009
  {
4007
4010
  id: "min",
4008
4011
  value: i,
4009
- onChange: (E) => u((F) => N(F, E.target.value)),
4012
+ onChange: (E) => d((F) => S(F, E.target.value)),
4010
4013
  className: `col-span-1 h-8 w-full ${We}`
4011
4014
  }
4012
4015
  ),
4013
4016
  /* @__PURE__ */ e.jsx(
4014
- re,
4017
+ ie,
4015
4018
  {
4016
- value: p,
4017
- onChange: (E) => d((F) => N(F, E.target.value)),
4019
+ value: x,
4020
+ onChange: (E) => c((F) => S(F, E.target.value)),
4018
4021
  id: "max",
4019
4022
  className: `col-span-1 h-8 w-full ${We}`
4020
4023
  }
@@ -4023,10 +4026,10 @@ function Xa() {
4023
4026
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
4024
4027
  /* @__PURE__ */ e.jsx(H, { htmlFor: "step-size", children: "Step Size" }),
4025
4028
  /* @__PURE__ */ e.jsx(
4026
- re,
4029
+ ie,
4027
4030
  {
4028
- value: o,
4029
- onChange: (E) => x((F) => N(F, E.target.value)),
4031
+ value: h,
4032
+ onChange: (E) => f((F) => S(F, E.target.value)),
4030
4033
  id: "step-size",
4031
4034
  className: `col-span-1 h-8 w-full ${We}`
4032
4035
  }
@@ -4037,11 +4040,11 @@ function Xa() {
4037
4040
  function K() {
4038
4041
  var B;
4039
4042
  let E = {};
4040
- j === "custom" && (E = {
4043
+ b === "custom" && (E = {
4041
4044
  min: i,
4042
- max: p,
4045
+ max: x,
4043
4046
  ticks: {
4044
- stepSize: o
4047
+ stepSize: h
4045
4048
  }
4046
4049
  });
4047
4050
  const F = {
@@ -4058,18 +4061,18 @@ function Xa() {
4058
4061
  }
4059
4062
  },
4060
4063
  numberAxisFormat: {
4061
- decimalPlaces: y,
4062
- suffix: b,
4064
+ decimalPlaces: p,
4065
+ suffix: y,
4063
4066
  currency: I,
4064
4067
  locale: T
4065
4068
  }
4066
4069
  };
4067
4070
  console.log(F), V(F);
4068
- const le = {
4071
+ const re = {
4069
4072
  ...v,
4070
4073
  preferences: F
4071
4074
  };
4072
- m(le);
4075
+ m(re);
4073
4076
  }
4074
4077
  return /* @__PURE__ */ e.jsxs(ds, { onOpenChange: (E) => n(E), children: [
4075
4078
  /* @__PURE__ */ e.jsx(us, { asChild: !0, children: /* @__PURE__ */ e.jsx(Zt, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
@@ -4086,7 +4089,7 @@ function Xa() {
4086
4089
  {
4087
4090
  disabled: D,
4088
4091
  value: r,
4089
- onValueChange: (E) => c(E),
4092
+ onValueChange: (E) => o(E),
4090
4093
  children: [
4091
4094
  /* @__PURE__ */ e.jsx(he, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(me, {}) }),
4092
4095
  /* @__PURE__ */ e.jsx(xe, { id: "type", children: /* @__PURE__ */ e.jsxs(ve, { children: [
@@ -4105,7 +4108,7 @@ function Xa() {
4105
4108
  {
4106
4109
  disabled: D,
4107
4110
  id: "scale-option",
4108
- value: j,
4111
+ value: b,
4109
4112
  onValueChange: (E) => g(E),
4110
4113
  className: "col-span-2 flex gap-3",
4111
4114
  defaultValue: "x",
@@ -4122,7 +4125,7 @@ function Xa() {
4122
4125
  }
4123
4126
  )
4124
4127
  ] }),
4125
- j === "custom" && r == "linear" && $(),
4128
+ b === "custom" && r == "linear" && $(),
4126
4129
  _(),
4127
4130
  /* @__PURE__ */ e.jsx(en, {}),
4128
4131
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
@@ -4140,23 +4143,23 @@ function Xa() {
4140
4143
  }
4141
4144
  function ql({ idx: s }) {
4142
4145
  var i;
4143
- const n = h((u) => {
4144
- var p;
4145
- return (p = u.card) == null ? void 0 : p.preferences;
4146
- }), a = h(
4147
- (u) => {
4148
- var p;
4149
- return (p = u.card.preferences) == null ? void 0 : p.datasetOptions;
4146
+ const n = u((d) => {
4147
+ var x;
4148
+ return (x = d.card) == null ? void 0 : x.preferences;
4149
+ }), a = u(
4150
+ (d) => {
4151
+ var x;
4152
+ return (x = d.card.preferences) == null ? void 0 : x.datasetOptions;
4150
4153
  }
4151
- ), t = h(
4152
- (u) => u.actions.setCardPreferences
4153
- ), l = (i = n == null ? void 0 : n.chartOptions) == null ? void 0 : i.indexAxis, r = a == null ? void 0 : a.find((u) => u.idx === s);
4154
- function c(u, p) {
4155
- (u === "end" || u === "start") && sn(an());
4156
- const d = {
4157
- display: u !== "none",
4158
- align: u,
4159
- anchor: u,
4154
+ ), t = u(
4155
+ (d) => d.actions.setCardPreferences
4156
+ ), l = (i = n == null ? void 0 : n.chartOptions) == null ? void 0 : i.indexAxis, r = a == null ? void 0 : a.find((d) => d.idx === s);
4157
+ function o(d, x) {
4158
+ (d === "end" || d === "start") && sn(an());
4159
+ const c = {
4160
+ display: d !== "none",
4161
+ align: d,
4162
+ anchor: d,
4160
4163
  clamp: !0
4161
4164
  };
4162
4165
  if (!r)
@@ -4165,16 +4168,16 @@ function ql({ idx: s }) {
4165
4168
  datasetOptions: [
4166
4169
  ...a || [],
4167
4170
  {
4168
- idx: p,
4169
- datalabels: d
4171
+ idx: x,
4172
+ datalabels: c
4170
4173
  }
4171
4174
  ]
4172
4175
  });
4173
4176
  else {
4174
- const j = { ...r };
4175
- j.datalabels = d;
4177
+ const b = { ...r };
4178
+ b.datalabels = c;
4176
4179
  const g = a == null ? void 0 : a.map(
4177
- (o) => o.idx === p ? j : o
4180
+ (h) => h.idx === x ? b : h
4178
4181
  );
4179
4182
  t({
4180
4183
  ...n,
@@ -4188,7 +4191,7 @@ function ql({ idx: s }) {
4188
4191
  /* @__PURE__ */ e.jsx(
4189
4192
  O,
4190
4193
  {
4191
- onClick: () => c("none", s),
4194
+ onClick: () => o("none", s),
4192
4195
  size: "sm",
4193
4196
  variant: "secondary",
4194
4197
  className: "h-7 p-1 text-xs font-normal",
@@ -4198,7 +4201,7 @@ function ql({ idx: s }) {
4198
4201
  /* @__PURE__ */ e.jsx(
4199
4202
  O,
4200
4203
  {
4201
- onClick: () => c("start", s),
4204
+ onClick: () => o("start", s),
4202
4205
  size: "sm",
4203
4206
  variant: "secondary",
4204
4207
  className: "h-7 p-1 text-xs font-normal",
@@ -4215,7 +4218,7 @@ function ql({ idx: s }) {
4215
4218
  /* @__PURE__ */ e.jsx(
4216
4219
  O,
4217
4220
  {
4218
- onClick: () => c("center", s),
4221
+ onClick: () => o("center", s),
4219
4222
  size: "sm",
4220
4223
  variant: "secondary",
4221
4224
  className: "h-7 p-1 text-xs font-normal",
@@ -4232,7 +4235,7 @@ function ql({ idx: s }) {
4232
4235
  /* @__PURE__ */ e.jsx(
4233
4236
  O,
4234
4237
  {
4235
- onClick: () => c("end", s),
4238
+ onClick: () => o("end", s),
4236
4239
  size: "sm",
4237
4240
  variant: "secondary",
4238
4241
  className: "h-7 p-1 text-xs font-normal",
@@ -4250,25 +4253,25 @@ function ql({ idx: s }) {
4250
4253
  ] });
4251
4254
  }
4252
4255
  function Za() {
4253
- const s = h((p) => p.card), n = h(
4254
- (p) => {
4255
- var d, j, g;
4256
- return (g = (j = (d = p == null ? void 0 : p.card) == null ? void 0 : d.preferences) == null ? void 0 : j.chartOptions) == null ? void 0 : g.indexAxis;
4256
+ const s = u((x) => x.card), n = u(
4257
+ (x) => {
4258
+ var c, b, g;
4259
+ return (g = (b = (c = x == null ? void 0 : x.card) == null ? void 0 : c.preferences) == null ? void 0 : b.chartOptions) == null ? void 0 : g.indexAxis;
4257
4260
  }
4258
4261
  ), { data: a } = De(s), t = n === "y" ? "Y axis" : "X axis", l = n === "y" ? "X axis" : "Y axis", {
4259
4262
  keys: r,
4260
- metricKeys: c,
4263
+ metricKeys: o,
4261
4264
  dimensionKeys: i
4262
4265
  } = js((a == null ? void 0 : a.records) || []);
4263
- let u = c;
4266
+ let d = o;
4264
4267
  if (["stackedBar", "stackedLine"].includes(s.type)) {
4265
- const p = tn({
4268
+ const x = tn({
4266
4269
  dataArray: (a == null ? void 0 : a.records) || [],
4267
4270
  groupKey: i[0],
4268
4271
  pivotKey: i[1],
4269
- valueKey: u[0]
4270
- }), { metricKeys: d } = js(p);
4271
- u = d;
4272
+ valueKey: d[0]
4273
+ }), { metricKeys: c } = js(x);
4274
+ d = c;
4272
4275
  }
4273
4276
  return r.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4274
4277
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
@@ -4280,21 +4283,21 @@ function Za() {
4280
4283
  /* @__PURE__ */ e.jsx(H, { children: l }),
4281
4284
  /* @__PURE__ */ e.jsx(Xa, {})
4282
4285
  ] }),
4283
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: u.map((p, d) => /* @__PURE__ */ e.jsx(Rl, { col: p, idx: d }, p)) })
4286
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: d.map((x, c) => /* @__PURE__ */ e.jsx(Rl, { col: x, idx: c }, x)) })
4284
4287
  ] })
4285
4288
  ] });
4286
4289
  }
4287
4290
  function Rl({ col: s, idx: n }) {
4288
- const a = h((i) => {
4289
- var u;
4290
- return (u = i.card) == null ? void 0 : u.preferences;
4291
- }), t = h(
4291
+ const a = u((i) => {
4292
+ var d;
4293
+ return (d = i.card) == null ? void 0 : d.preferences;
4294
+ }), t = u(
4292
4295
  (i) => {
4293
- var u;
4294
- return (u = i.card.preferences) == null ? void 0 : u.datasetOptions;
4296
+ var d;
4297
+ return (d = i.card.preferences) == null ? void 0 : d.datasetOptions;
4295
4298
  }
4296
- ), l = t == null ? void 0 : t.find((i) => i.idx === n), { setCardPreferences: r } = h((i) => i.actions);
4297
- function c(i) {
4299
+ ), l = t == null ? void 0 : t.find((i) => i.idx === n), { setCardPreferences: r } = u((i) => i.actions);
4300
+ function o(i) {
4298
4301
  if (!l)
4299
4302
  r({
4300
4303
  ...a,
@@ -4308,14 +4311,14 @@ function Rl({ col: s, idx: n }) {
4308
4311
  ]
4309
4312
  });
4310
4313
  else {
4311
- const u = { ...l };
4312
- u.type = i === "area" ? "line" : i, u.fill = i === "area" ? "origin" : "";
4313
- const p = t == null ? void 0 : t.map(
4314
- (d) => d.idx === n ? u : d
4314
+ const d = { ...l };
4315
+ d.type = i === "area" ? "line" : i, d.fill = i === "area" ? "origin" : "";
4316
+ const x = t == null ? void 0 : t.map(
4317
+ (c) => c.idx === n ? d : c
4315
4318
  );
4316
4319
  r({
4317
4320
  ...a,
4318
- datasetOptions: p
4321
+ datasetOptions: x
4319
4322
  });
4320
4323
  }
4321
4324
  }
@@ -4325,21 +4328,21 @@ function Rl({ col: s, idx: n }) {
4325
4328
  /* @__PURE__ */ e.jsx(
4326
4329
  qs,
4327
4330
  {
4328
- onClick: () => c("bar"),
4331
+ onClick: () => o("bar"),
4329
4332
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4330
4333
  }
4331
4334
  ),
4332
4335
  /* @__PURE__ */ e.jsx(
4333
4336
  Rs,
4334
4337
  {
4335
- onClick: () => c("line"),
4338
+ onClick: () => o("line"),
4336
4339
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4337
4340
  }
4338
4341
  ),
4339
4342
  /* @__PURE__ */ e.jsx(
4340
4343
  wn,
4341
4344
  {
4342
- onClick: () => c("area"),
4345
+ onClick: () => o("area"),
4343
4346
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4344
4347
  }
4345
4348
  ),
@@ -4348,27 +4351,27 @@ function Rl({ col: s, idx: n }) {
4348
4351
  ] });
4349
4352
  }
4350
4353
  function et() {
4351
- const s = h((g) => g.selectedConnectionId), n = h((g) => g.selectedDatamodelId), a = h((g) => g.selectedDatabaseName), t = h((g) => g.selectedSchemaName), l = h((g) => g.selectedTableName), r = M((g) => g.dashboard.filters) || [], c = M((g) => g.actions.addFilter), i = M((g) => g.actions.removeFilter), { removeFilterValues: u } = is(), { modelItems: p, tableName: d } = qe();
4352
- function j(g, o = "dashboard") {
4354
+ const s = u((g) => g.selectedConnectionId), n = u((g) => g.selectedDatamodelId), a = u((g) => g.selectedDatabaseName), t = u((g) => g.selectedSchemaName), l = u((g) => g.selectedTableName), r = M((g) => g.dashboard.filters) || [], o = M((g) => g.actions.addFilter), i = M((g) => g.actions.removeFilter), { removeFilterValues: d } = is(), { modelItems: x, tableName: c } = qe();
4355
+ function b(g, h = "dashboard") {
4353
4356
  var L;
4354
- const x = ce(g.column_name), y = ce(a || ""), z = ce(t || ""), b = ce(d);
4357
+ const f = ce(g.column_name), p = ce(a || ""), N = ce(t || ""), y = ce(c);
4355
4358
  let A = xa(
4356
- z,
4357
- b
4358
- ), I = `${A}.${x}`;
4359
- const k = (L = p == null ? void 0 : p.find(
4359
+ N,
4360
+ y
4361
+ ), I = `${A}.${f}`;
4362
+ const z = (L = x == null ? void 0 : x.find(
4360
4363
  (V) => V.id === n
4361
4364
  )) == null ? void 0 : L.name;
4362
- n && n !== "none" && (I = `${gs}.${k}.${x}`, A = `${gs}.${k}`);
4365
+ n && n !== "none" && (I = `${gs}.${z}.${f}`, A = `${gs}.${z}`);
4363
4366
  const T = r == null ? void 0 : r.find(
4364
- (V) => V.column === I && V.table === b && (V.database === y || V.database === a)
4367
+ (V) => V.column === I && V.table === y && (V.database === p || V.database === a)
4365
4368
  );
4366
4369
  if (T)
4367
- u(T.id), i(T.id);
4370
+ d(T.id), i(T.id);
4368
4371
  else {
4369
4372
  const V = Ue();
4370
- return d === "api" && s ? (c({
4371
- location: o,
4373
+ return c === "api" && s ? (o({
4374
+ location: h,
4372
4375
  id: V,
4373
4376
  //uuidv4(),
4374
4377
  column: I,
@@ -4382,13 +4385,13 @@ function et() {
4382
4385
  sql: Ws(
4383
4386
  g.data_type,
4384
4387
  A,
4385
- x
4388
+ f
4386
4389
  )
4387
4390
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4388
- }), V) : (c({
4391
+ }), V) : (o({
4389
4392
  id: V,
4390
4393
  //uuidv4(),
4391
- location: o,
4394
+ location: h,
4392
4395
  column: I,
4393
4396
  //columnName, //`${qualifiedTableName}.${formattedColumnName}`,
4394
4397
  title: g.column_name,
@@ -4400,34 +4403,34 @@ function et() {
4400
4403
  sql: Ws(
4401
4404
  g.data_type,
4402
4405
  A,
4403
- x
4406
+ f
4404
4407
  )
4405
4408
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4406
4409
  }), V);
4407
4410
  }
4408
4411
  }
4409
- return { assignFilter: j };
4412
+ return { assignFilter: b };
4410
4413
  }
4411
4414
  function Re() {
4412
4415
  const s = M(
4413
4416
  (i) => i.dashboard.filters
4414
- ), n = h((i) => i.frame), { setFrame: a } = ne(), { columns: t } = qe(), { assignFilter: l } = et();
4417
+ ), n = u((i) => i.frame), { setFrame: a } = ne(), { columns: t } = qe(), { assignFilter: l } = et();
4415
4418
  function r(i) {
4416
- const u = l(i, "frame");
4417
- a({ ...n, filterId: u });
4419
+ const d = l(i, "frame");
4420
+ a({ ...n, filterId: d });
4418
4421
  }
4419
- const c = s == null ? void 0 : s.find((i) => i.id === n.filterId);
4422
+ const o = s == null ? void 0 : s.find((i) => i.id === n.filterId);
4420
4423
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
4421
4424
  /* @__PURE__ */ e.jsx(H, { children: "Card Filter" }),
4422
4425
  /* @__PURE__ */ e.jsx(_l, { onSelect: r, columns: t }),
4423
- c && /* @__PURE__ */ e.jsx(ka, { filter: c })
4426
+ o && /* @__PURE__ */ e.jsx(ka, { filter: o })
4424
4427
  ] });
4425
4428
  }
4426
4429
  function _l({
4427
4430
  columns: s,
4428
4431
  onSelect: n
4429
4432
  }) {
4430
- var c;
4433
+ var o;
4431
4434
  const [a, t] = Ys.useState(!1), [l, r] = Ys.useState("");
4432
4435
  return /* @__PURE__ */ e.jsxs(ds, { open: a, onOpenChange: t, children: [
4433
4436
  /* @__PURE__ */ e.jsx(us, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
@@ -4439,7 +4442,7 @@ function _l({
4439
4442
  "aria-expanded": a,
4440
4443
  className: "w-full justify-between font-normal",
4441
4444
  children: [
4442
- l ? (c = s.find((i) => i.column_name === l)) == null ? void 0 : c.column_name : "Select Column...",
4445
+ l ? (o = s.find((i) => i.column_name === l)) == null ? void 0 : o.column_name : "Select Column...",
4443
4446
  /* @__PURE__ */ e.jsx(nn, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
4444
4447
  ]
4445
4448
  }
@@ -4452,9 +4455,9 @@ function _l({
4452
4455
  un,
4453
4456
  {
4454
4457
  value: i.column_name,
4455
- onSelect: (u) => {
4456
- const p = u === l ? "" : u;
4457
- r(p), t(!1), p && n(i);
4458
+ onSelect: (d) => {
4459
+ const x = d === l ? "" : d;
4460
+ r(x), t(!1), x && n(i);
4458
4461
  },
4459
4462
  children: [
4460
4463
  i.column_name,
@@ -4521,30 +4524,30 @@ function Hl({
4521
4524
  ] }) });
4522
4525
  }
4523
4526
  function Hs() {
4524
- var l, r, c;
4525
- const s = h(
4527
+ var l, r, o;
4528
+ const s = u(
4526
4529
  (i) => i.card.cfg
4527
- ), n = h((i) => i.actions.setCardCfg), a = h((i) => i.card.type);
4530
+ ), n = u((i) => i.actions.setCardCfg), a = u((i) => i.card.type);
4528
4531
  function t(i) {
4529
- var d;
4530
- const u = {
4532
+ var c;
4533
+ const d = {
4531
4534
  datalabels: {
4532
4535
  display: i !== "none",
4533
4536
  align: i,
4534
4537
  anchor: i,
4535
4538
  clamp: !0
4536
4539
  }
4537
- }, p = {
4540
+ }, x = {
4538
4541
  ...s,
4539
4542
  options: {
4540
4543
  ...s == null ? void 0 : s.options,
4541
4544
  plugins: {
4542
- ...(d = s == null ? void 0 : s.options) == null ? void 0 : d.plugins,
4543
- ...u
4545
+ ...(c = s == null ? void 0 : s.options) == null ? void 0 : c.plugins,
4546
+ ...d
4544
4547
  }
4545
4548
  }
4546
4549
  };
4547
- n(p), console.log(i);
4550
+ n(x), console.log(i);
4548
4551
  }
4549
4552
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4550
4553
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4554,7 +4557,7 @@ function Hs() {
4554
4557
  /* @__PURE__ */ e.jsxs(
4555
4558
  ue,
4556
4559
  {
4557
- value: (c = (r = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : r.datalabels) == null ? void 0 : c.anchor,
4560
+ value: (o = (r = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : r.datalabels) == null ? void 0 : o.anchor,
4558
4561
  onValueChange: t,
4559
4562
  defaultValue: "none",
4560
4563
  children: [
@@ -4642,7 +4645,7 @@ const $l = {
4642
4645
  ]
4643
4646
  };
4644
4647
  function Ul() {
4645
- const s = h((n) => n.card.type);
4648
+ const s = u((n) => n.card.type);
4646
4649
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
4647
4650
  /* @__PURE__ */ e.jsx(
4648
4651
  Me,
@@ -4759,52 +4762,52 @@ function Gl(s) {
4759
4762
  ] }) });
4760
4763
  }
4761
4764
  function Kl() {
4762
- var u, p, d, j, g;
4763
- const s = h((o) => o.card.preferences), n = h(
4764
- (o) => o.actions.setCardPreferences
4765
- ), a = h(
4766
- (o) => o.actions.setNumberFormat
4765
+ var d, x, c, b, g;
4766
+ const s = u((h) => h.card.preferences), n = u(
4767
+ (h) => h.actions.setCardPreferences
4768
+ ), a = u(
4769
+ (h) => h.actions.setNumberFormat
4767
4770
  );
4768
- h(
4769
- (o) => {
4770
- var x, y;
4771
- return (y = (x = o.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : y.decimalPlaces;
4771
+ u(
4772
+ (h) => {
4773
+ var f, p;
4774
+ return (p = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : p.decimalPlaces;
4772
4775
  }
4773
4776
  );
4774
- const t = h(
4775
- (o) => {
4776
- var x, y;
4777
- return (y = (x = o.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : y.locale;
4777
+ const t = u(
4778
+ (h) => {
4779
+ var f, p;
4780
+ return (p = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : p.locale;
4778
4781
  }
4779
- ), l = h(
4780
- (o) => {
4781
- var x, y;
4782
- return (y = (x = o.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : y.currency;
4782
+ ), l = u(
4783
+ (h) => {
4784
+ var f, p;
4785
+ return (p = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : p.currency;
4783
4786
  }
4784
4787
  );
4785
- h(
4786
- (o) => o.actions.setFilterOnClickField
4788
+ u(
4789
+ (h) => h.actions.setFilterOnClickField
4787
4790
  );
4788
- const r = h(
4789
- (o) => {
4790
- var x, y;
4791
- return (y = (x = o.card.preferences) == null ? void 0 : x.formatNumber) == null ? void 0 : y.colorRanges;
4791
+ const r = u(
4792
+ (h) => {
4793
+ var f, p;
4794
+ return (p = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : p.colorRanges;
4792
4795
  }
4793
- ) || [], c = h(
4794
- (o) => o.actions.setColorRanges
4795
- ), i = [...new Set(ts.map((o) => o.currency))];
4796
+ ) || [], o = u(
4797
+ (h) => h.actions.setColorRanges
4798
+ ), i = [...new Set(ts.map((h) => h.currency))];
4796
4799
  return /* @__PURE__ */ e.jsxs("div", { children: [
4797
4800
  /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
4798
4801
  /* @__PURE__ */ e.jsx(
4799
4802
  As,
4800
4803
  {
4801
- checked: !!((u = s == null ? void 0 : s.formatNumber) != null && u.enabled),
4802
- onCheckedChange: (o) => {
4804
+ checked: !!((d = s == null ? void 0 : s.formatNumber) != null && d.enabled),
4805
+ onCheckedChange: (h) => {
4803
4806
  n({
4804
4807
  ...s,
4805
4808
  formatNumber: {
4806
4809
  ...s == null ? void 0 : s.formatNumber,
4807
- enabled: o
4810
+ enabled: h
4808
4811
  }
4809
4812
  });
4810
4813
  }
@@ -4812,7 +4815,7 @@ function Kl() {
4812
4815
  ),
4813
4816
  /* @__PURE__ */ e.jsx(H, { children: "Format Number" })
4814
4817
  ] }),
4815
- ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
4818
+ ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.enabled) === !0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
4816
4819
  /* @__PURE__ */ e.jsx("div", { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 p-2", children: [
4817
4820
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
4818
4821
  /* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
@@ -4821,13 +4824,13 @@ function Kl() {
4821
4824
  ue,
4822
4825
  {
4823
4826
  value: t || "none",
4824
- onValueChange: (o) => {
4825
- var x, y, z;
4827
+ onValueChange: (h) => {
4828
+ var f, p, N;
4826
4829
  return a(
4827
- ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
4828
- ((y = s == null ? void 0 : s.formatNumber) == null ? void 0 : y.currency) || "",
4829
- o,
4830
- ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
4830
+ ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4831
+ ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.currency) || "",
4832
+ h,
4833
+ ((N = s == null ? void 0 : s.formatNumber) == null ? void 0 : N.suffix) || ""
4831
4834
  );
4832
4835
  },
4833
4836
  children: [
@@ -4835,7 +4838,7 @@ function Kl() {
4835
4838
  /* @__PURE__ */ e.jsx(xe, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
4836
4839
  /* @__PURE__ */ e.jsx(pe, { children: "Format" }),
4837
4840
  /* @__PURE__ */ e.jsx(X, { value: "none", children: "None" }, "none"),
4838
- ts.map((o) => /* @__PURE__ */ e.jsx(X, { value: o.locale, children: o.locale }, o.locale))
4841
+ ts.map((h) => /* @__PURE__ */ e.jsx(X, { value: h.locale, children: h.locale }, h.locale))
4839
4842
  ] }) })
4840
4843
  ]
4841
4844
  }
@@ -4847,13 +4850,13 @@ function Kl() {
4847
4850
  ue,
4848
4851
  {
4849
4852
  value: l || "none",
4850
- onValueChange: (o) => {
4851
- var x, y, z;
4852
- console.log("currency", o), a(
4853
- ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
4854
- o === "none" ? "" : o,
4855
- ((y = s == null ? void 0 : s.formatNumber) == null ? void 0 : y.locale) || "",
4856
- ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
4853
+ onValueChange: (h) => {
4854
+ var f, p, N;
4855
+ console.log("currency", h), a(
4856
+ ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4857
+ h === "none" ? "" : h,
4858
+ ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.locale) || "",
4859
+ ((N = s == null ? void 0 : s.formatNumber) == null ? void 0 : N.suffix) || ""
4857
4860
  );
4858
4861
  },
4859
4862
  children: [
@@ -4861,7 +4864,7 @@ function Kl() {
4861
4864
  /* @__PURE__ */ e.jsx(xe, { children: /* @__PURE__ */ e.jsxs(ve, { children: [
4862
4865
  /* @__PURE__ */ e.jsx(pe, { children: "Currency" }),
4863
4866
  /* @__PURE__ */ e.jsx(X, { value: "none", children: "None" }, "none"),
4864
- i.map((o) => /* @__PURE__ */ e.jsx(X, { value: o, children: o }, o))
4867
+ i.map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h))
4865
4868
  ] }) })
4866
4869
  ]
4867
4870
  }
@@ -4874,19 +4877,19 @@ function Kl() {
4874
4877
  /* @__PURE__ */ e.jsxs(
4875
4878
  ue,
4876
4879
  {
4877
- value: ((j = (d = s == null ? void 0 : s.formatNumber) == null ? void 0 : d.decimalPlaces) == null ? void 0 : j.toString()) || "0",
4878
- onValueChange: (o) => {
4879
- var x, y, z;
4880
+ value: ((b = (c = s == null ? void 0 : s.formatNumber) == null ? void 0 : c.decimalPlaces) == null ? void 0 : b.toString()) || "0",
4881
+ onValueChange: (h) => {
4882
+ var f, p, N;
4880
4883
  return a(
4881
- Number(o),
4882
- ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.currency) || "",
4883
- ((y = s == null ? void 0 : s.formatNumber) == null ? void 0 : y.locale) || "",
4884
- ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.suffix) || ""
4884
+ Number(h),
4885
+ ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.currency) || "",
4886
+ ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.locale) || "",
4887
+ ((N = s == null ? void 0 : s.formatNumber) == null ? void 0 : N.suffix) || ""
4885
4888
  );
4886
4889
  },
4887
4890
  children: [
4888
4891
  /* @__PURE__ */ e.jsx(he, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(me, {}) }),
4889
- /* @__PURE__ */ e.jsx(xe, { children: ["0", "1", "2", "3", "4"].map((o) => /* @__PURE__ */ e.jsx(X, { value: o, children: o }, o)) })
4892
+ /* @__PURE__ */ e.jsx(xe, { children: ["0", "1", "2", "3", "4"].map((h) => /* @__PURE__ */ e.jsx(X, { value: h, children: h }, h)) })
4890
4893
  ]
4891
4894
  }
4892
4895
  )
@@ -4894,18 +4897,18 @@ function Kl() {
4894
4897
  /* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
4895
4898
  /* @__PURE__ */ e.jsx(H, { children: "Suffix" }),
4896
4899
  /* @__PURE__ */ e.jsx(
4897
- re,
4900
+ ie,
4898
4901
  {
4899
4902
  value: ((g = s == null ? void 0 : s.formatNumber) == null ? void 0 : g.suffix) || "",
4900
4903
  className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
4901
4904
  placeholder: "K, M, B, %",
4902
- onChange: (o) => {
4903
- var x, y, z;
4905
+ onChange: (h) => {
4906
+ var f, p, N;
4904
4907
  return a(
4905
- ((x = s == null ? void 0 : s.formatNumber) == null ? void 0 : x.decimalPlaces) || 0,
4906
- ((y = s == null ? void 0 : s.formatNumber) == null ? void 0 : y.currency) || "",
4907
- ((z = s == null ? void 0 : s.formatNumber) == null ? void 0 : z.locale) || "",
4908
- o.target.value
4908
+ ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4909
+ ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.currency) || "",
4910
+ ((N = s == null ? void 0 : s.formatNumber) == null ? void 0 : N.locale) || "",
4911
+ h.target.value
4909
4912
  );
4910
4913
  }
4911
4914
  }
@@ -4918,7 +4921,7 @@ function Kl() {
4918
4921
  hn,
4919
4922
  {
4920
4923
  colorRanges: r,
4921
- setColorRanges: c
4924
+ setColorRanges: o
4922
4925
  }
4923
4926
  )
4924
4927
  ] })
@@ -5056,12 +5059,12 @@ const Jl = [
5056
5059
  value: s
5057
5060
  }));
5058
5061
  function Xl() {
5059
- var u, p, d, j, g, o, x, y, z, b, A, I, k, T, L, V, m, v;
5060
- const s = h((f) => f.card), n = (p = (u = s == null ? void 0 : s.preferences) == null ? void 0 : u.mapVisualOptions) == null ? void 0 : p.topoJsonUrl, [a, t] = q(
5061
- ((j = (d = s == null ? void 0 : s.preferences) == null ? void 0 : d.mapVisualOptions) == null ? void 0 : j.customTopoJsonUrl) || ""
5062
- ), { setCardPreferences: l } = ne(), { data: r } = Es(s), c = Object.keys((r == null ? void 0 : r.objects) || {}).map((f) => ({
5063
- label: f,
5064
- value: f
5062
+ var d, x, c, b, g, h, f, p, N, y, A, I, z, T, L, V, m, v;
5063
+ const s = u((j) => j.card), n = (x = (d = s == null ? void 0 : s.preferences) == null ? void 0 : d.mapVisualOptions) == null ? void 0 : x.topoJsonUrl, [a, t] = q(
5064
+ ((b = (c = s == null ? void 0 : s.preferences) == null ? void 0 : c.mapVisualOptions) == null ? void 0 : b.customTopoJsonUrl) || ""
5065
+ ), { setCardPreferences: l } = ne(), { data: r } = Es(s), o = Object.keys((r == null ? void 0 : r.objects) || {}).map((j) => ({
5066
+ label: j,
5067
+ value: j
5065
5068
  })) || [], i = [
5066
5069
  {
5067
5070
  label: "US States 10m",
@@ -5085,11 +5088,11 @@ function Xl() {
5085
5088
  {
5086
5089
  className: "h-9",
5087
5090
  options: i,
5088
- onValueChange: (f) => {
5089
- console.log("value", f), l({
5091
+ onValueChange: (j) => {
5092
+ console.log("value", j), l({
5090
5093
  ...s.preferences,
5091
5094
  mapVisualOptions: {
5092
- topoJsonUrl: f
5095
+ topoJsonUrl: j
5093
5096
  // customTopoJson: undefined,
5094
5097
  }
5095
5098
  });
@@ -5099,17 +5102,17 @@ function Xl() {
5099
5102
  }
5100
5103
  ),
5101
5104
  n === "custom" && /* @__PURE__ */ e.jsx(
5102
- re,
5105
+ ie,
5103
5106
  {
5104
- onChange: (f) => {
5105
- t(f.target.value);
5107
+ onChange: (j) => {
5108
+ t(j.target.value);
5106
5109
  },
5107
5110
  onBlur: () => {
5108
- var f;
5111
+ var j;
5109
5112
  console.log("onBlur", a), l({
5110
5113
  ...s.preferences,
5111
5114
  mapVisualOptions: {
5112
- ...(f = s.preferences) == null ? void 0 : f.mapVisualOptions,
5115
+ ...(j = s.preferences) == null ? void 0 : j.mapVisualOptions,
5113
5116
  customTopoJsonUrl: a
5114
5117
  }
5115
5118
  });
@@ -5126,16 +5129,16 @@ function Xl() {
5126
5129
  de,
5127
5130
  {
5128
5131
  className: "h-9",
5129
- options: c,
5130
- value: ((o = (g = s.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : o.objectKey) || "",
5132
+ options: o,
5133
+ value: ((h = (g = s.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : h.objectKey) || "",
5131
5134
  label: "Map Object",
5132
- onValueChange: (f) => {
5135
+ onValueChange: (j) => {
5133
5136
  var D;
5134
5137
  l({
5135
5138
  ...s.preferences,
5136
5139
  mapVisualOptions: {
5137
5140
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5138
- objectKey: f
5141
+ objectKey: j
5139
5142
  }
5140
5143
  });
5141
5144
  }
@@ -5149,15 +5152,15 @@ function Xl() {
5149
5152
  {
5150
5153
  className: "h-9",
5151
5154
  options: Jl,
5152
- value: ((y = (x = s.preferences) == null ? void 0 : x.mapVisualOptions) == null ? void 0 : y.projection) || "",
5155
+ value: ((p = (f = s.preferences) == null ? void 0 : f.mapVisualOptions) == null ? void 0 : p.projection) || "",
5153
5156
  label: "Projection",
5154
- onValueChange: (f) => {
5157
+ onValueChange: (j) => {
5155
5158
  var D;
5156
5159
  l({
5157
5160
  ...s.preferences,
5158
5161
  mapVisualOptions: {
5159
5162
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5160
- projection: f
5163
+ projection: j
5161
5164
  }
5162
5165
  });
5163
5166
  }
@@ -5171,15 +5174,15 @@ function Xl() {
5171
5174
  {
5172
5175
  className: "h-9",
5173
5176
  options: Yl,
5174
- value: ((b = (z = s.preferences) == null ? void 0 : z.mapVisualOptions) == null ? void 0 : b.colorScale) || "",
5177
+ value: ((y = (N = s.preferences) == null ? void 0 : N.mapVisualOptions) == null ? void 0 : y.colorScale) || "",
5175
5178
  label: "Select Color Scale",
5176
- onValueChange: (f) => {
5179
+ onValueChange: (j) => {
5177
5180
  var D;
5178
5181
  l({
5179
5182
  ...s.preferences,
5180
5183
  mapVisualOptions: {
5181
5184
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5182
- colorScale: f
5185
+ colorScale: j
5183
5186
  }
5184
5187
  });
5185
5188
  }
@@ -5191,19 +5194,19 @@ function Xl() {
5191
5194
  /* @__PURE__ */ e.jsx(Ce, { className: "my-4" }),
5192
5195
  /* @__PURE__ */ e.jsx($e, { className: "", summary: "Scale Options", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
5193
5196
  /* @__PURE__ */ e.jsx(
5194
- re,
5197
+ ie,
5195
5198
  {
5196
5199
  className: `h-9 w-full ${Pe}`,
5197
5200
  type: "number",
5198
5201
  step: 0.1,
5199
5202
  value: ((I = (A = s.preferences) == null ? void 0 : A.mapVisualOptions) == null ? void 0 : I.projectionScale) || 1,
5200
- onChange: (f) => {
5203
+ onChange: (j) => {
5201
5204
  var D;
5202
5205
  l({
5203
5206
  ...s.preferences,
5204
5207
  mapVisualOptions: {
5205
5208
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5206
- projectionScale: Number(f.target.value)
5209
+ projectionScale: Number(j.target.value)
5207
5210
  }
5208
5211
  });
5209
5212
  }
@@ -5211,21 +5214,21 @@ function Xl() {
5211
5214
  ),
5212
5215
  /* @__PURE__ */ e.jsx(H, { children: "X" }),
5213
5216
  /* @__PURE__ */ e.jsx(
5214
- re,
5217
+ ie,
5215
5218
  {
5216
5219
  className: `h-9 w-full ${Pe}`,
5217
5220
  type: "number",
5218
5221
  step: 10,
5219
- value: ((L = (T = (k = s.preferences) == null ? void 0 : k.mapVisualOptions) == null ? void 0 : T.projectionOffset) == null ? void 0 : L[0]) || 0,
5220
- onChange: (f) => {
5221
- var D, N, _, $;
5222
+ value: ((L = (T = (z = s.preferences) == null ? void 0 : z.mapVisualOptions) == null ? void 0 : T.projectionOffset) == null ? void 0 : L[0]) || 0,
5223
+ onChange: (j) => {
5224
+ var D, S, _, $;
5222
5225
  l({
5223
5226
  ...s.preferences,
5224
5227
  mapVisualOptions: {
5225
5228
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5226
5229
  projectionOffset: [
5227
- Number(f.target.value),
5228
- (($ = (_ = (N = s.preferences) == null ? void 0 : N.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : $[1]) || 0
5230
+ Number(j.target.value),
5231
+ (($ = (_ = (S = s.preferences) == null ? void 0 : S.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : $[1]) || 0
5229
5232
  ]
5230
5233
  }
5231
5234
  });
@@ -5234,21 +5237,21 @@ function Xl() {
5234
5237
  ),
5235
5238
  /* @__PURE__ */ e.jsx(H, { children: "Y" }),
5236
5239
  /* @__PURE__ */ e.jsx(
5237
- re,
5240
+ ie,
5238
5241
  {
5239
5242
  className: `h-9 w-full ${Pe}`,
5240
5243
  type: "number",
5241
5244
  step: 10,
5242
5245
  value: ((v = (m = (V = s.preferences) == null ? void 0 : V.mapVisualOptions) == null ? void 0 : m.projectionOffset) == null ? void 0 : v[1]) || 0,
5243
- onChange: (f) => {
5244
- var D, N, _, $;
5246
+ onChange: (j) => {
5247
+ var D, S, _, $;
5245
5248
  l({
5246
5249
  ...s.preferences,
5247
5250
  mapVisualOptions: {
5248
5251
  ...(D = s.preferences) == null ? void 0 : D.mapVisualOptions,
5249
5252
  projectionOffset: [
5250
- (($ = (_ = (N = s.preferences) == null ? void 0 : N.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : $[0]) || 0,
5251
- Number(f.target.value)
5253
+ (($ = (_ = (S = s.preferences) == null ? void 0 : S.mapVisualOptions) == null ? void 0 : _.projectionOffset) == null ? void 0 : $[0]) || 0,
5254
+ Number(j.target.value)
5252
5255
  ]
5253
5256
  }
5254
5257
  });
@@ -5262,7 +5265,7 @@ function Xl() {
5262
5265
  }
5263
5266
  function Zl() {
5264
5267
  var t;
5265
- const s = h((l) => l.card.preferences), { setCardPreferences: n } = h((l) => l.actions);
5268
+ const s = u((l) => l.card.preferences), { setCardPreferences: n } = u((l) => l.actions);
5266
5269
  function a(l) {
5267
5270
  n({
5268
5271
  ...s,
@@ -5341,7 +5344,7 @@ function Ye({
5341
5344
  ] }) });
5342
5345
  }
5343
5346
  function er() {
5344
- const s = h(
5347
+ const s = u(
5345
5348
  (t) => {
5346
5349
  var l, r;
5347
5350
  return (r = (l = t == null ? void 0 : t.card) == null ? void 0 : l.preferences) == null ? void 0 : r.sortChart;
@@ -5421,10 +5424,10 @@ function er() {
5421
5424
  ] }) });
5422
5425
  }
5423
5426
  function sr({}) {
5424
- const s = h((t) => {
5427
+ const s = u((t) => {
5425
5428
  var l;
5426
5429
  return (l = t.card) == null ? void 0 : l.preferences;
5427
- }), n = h(
5430
+ }), n = u(
5428
5431
  (t) => t.actions.setCardPreferences
5429
5432
  ), a = (t) => {
5430
5433
  n({
@@ -5503,7 +5506,7 @@ const ar = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
5503
5506
  ] })
5504
5507
  ] });
5505
5508
  function lr() {
5506
- const s = h((a) => a.card.type);
5509
+ const s = u((a) => a.card.type);
5507
5510
  function n(a) {
5508
5511
  switch (a) {
5509
5512
  case "stackedBar":
@@ -5548,7 +5551,7 @@ function lr() {
5548
5551
  return /* @__PURE__ */ e.jsx(fe, { className: "h-full w-full text-sm", children: n(s) });
5549
5552
  }
5550
5553
  function rr() {
5551
- const s = h((n) => n.isShowingVisual);
5554
+ const s = u((n) => n.isShowingVisual);
5552
5555
  return /* @__PURE__ */ e.jsxs(
5553
5556
  ss,
5554
5557
  {
@@ -5594,8 +5597,8 @@ function rr() {
5594
5597
  );
5595
5598
  }
5596
5599
  function ir({ authToken: s, onSave: n, onClose: a }) {
5597
- M((c) => c.themeStyle);
5598
- const t = h((c) => c.actions.setOnSave), l = h((c) => c.actions.setOnClose), r = M((c) => c.actions.setAuthToken);
5600
+ M((o) => o.themeStyle);
5601
+ const t = u((o) => o.actions.setOnSave), l = u((o) => o.actions.setOnClose), r = M((o) => o.actions.setAuthToken);
5599
5602
  return Z(() => {
5600
5603
  n && t(n), a && l(a);
5601
5604
  }, [n, t, a, l]), Z(() => {
@@ -5617,10 +5620,10 @@ function ir({ authToken: s, onSave: n, onClose: a }) {
5617
5620
  ) });
5618
5621
  }
5619
5622
  function or() {
5620
- M((c) => c.selectedCardId);
5621
- const s = M((c) => c.selectedSheetId), { setIsVisualEditing: n } = M((c) => c.actions), a = M((c) => c.isVisualEditing), t = M((c) => c.actions.updateFrame);
5622
- function l(c) {
5623
- s && (t(s, c), n(!1));
5623
+ M((o) => o.selectedCardId);
5624
+ const s = M((o) => o.selectedSheetId), { setIsVisualEditing: n } = M((o) => o.actions), a = M((o) => o.isVisualEditing), t = M((o) => o.actions.updateFrame);
5625
+ function l(o) {
5626
+ s && (t(s, o), n(!1));
5624
5627
  }
5625
5628
  function r() {
5626
5629
  n(!1);
@@ -5637,9 +5640,9 @@ function or() {
5637
5640
  );
5638
5641
  }
5639
5642
  function cr() {
5640
- const s = h((r) => r.selectedDatabaseName), n = h((r) => r.selectedTableName), a = M((r) => r.dashboard.filters) || [], { columns: t } = qe(), { assignFilter: l } = et();
5643
+ const s = u((r) => r.selectedDatabaseName), n = u((r) => r.selectedTableName), a = M((r) => r.dashboard.filters) || [], { columns: t } = qe(), { assignFilter: l } = et();
5641
5644
  return /* @__PURE__ */ e.jsx(fe, { className: "flex-1 basis-0 flex-col px-3", children: t == null ? void 0 : t.map((r) => {
5642
- const c = a == null ? void 0 : a.find(
5645
+ const o = a == null ? void 0 : a.find(
5643
5646
  (i) => i.column === ce(r.column_name) && i.table === n && i.database === s
5644
5647
  );
5645
5648
  return /* @__PURE__ */ e.jsx(
@@ -5649,7 +5652,7 @@ function cr() {
5649
5652
  className: Y(
5650
5653
  "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",
5651
5654
  {
5652
- "bg-muted": c
5655
+ "bg-muted": o
5653
5656
  }
5654
5657
  ),
5655
5658
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [