react-semaphor 0.0.269 → 0.0.271

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 { J as O, L as Ue, b as z, c as Ns, u as je, j as e, M as Cs, O as Ss, P as F, Q as ws, R as ks, U as zs, V as Fs, W as Ls, X as H, Y as Ce, Z as aa, _ as Ga, $ as Ka, a0 as Wa, a1 as Qa, a2 as Ja, a3 as Ya, a4 as Ps, f as X, a5 as He, a6 as Xa, a7 as ta, a8 as $e, a9 as ss, T as Ts, e as na, g as Is, aa as he, ab as me, ac as xe, ad as pe, ae as Se, af as fe, ag as Q, ah as Ds, G as c, ai as Ms, aj as Os, ak as As, w as la, v as ia, t as ue, al as Za, r as et, N as ra, s as st, am as at, B as tt, an as oa, ao as nt, S as Es, z as lt, n as Us, A as ca, ap as fs, aq as re, ar as Ne, as as Me, at as ls, au as da, av as it, aw as rt, ax as ua, ay as ot, az as ct, aA as dt, aB as ut, aC as ht, aD as gs, aE as mt, aF as xt, aG as _e, aH as js, aI as De, aJ as bs, aK as Gs, aL as pt, aM as ft, aN as gt, aO as jt, aP as bt, aQ as ps, aR as yt, aS as Ks, aT as vt, aU as Ws, aV as Nt, aW as Ct, aX as St, aY as ha, H as we, aZ as ma, l as wt, C as kt, E as Xe, d as zt, h as Ft, a_ as Lt, i as Tt, o as It, a$ as Dt, m as Mt, b0 as Ot, b1 as xa, b2 as pa, b3 as Ze, b4 as fa, b5 as es, b6 as Qs, b7 as At, b8 as Et, b9 as is, ba as rs, bb as os, bc as ga, K as Vt, bd as qt, be as Rt, bf as cs, bg as Le, bh as _t, bi as ja, bj as Ht, bk as $t, bl as as, bm as Bt, bn as Pt, bo as Ut, bp as Js, bq as Gt, br as Kt, bs as Wt, bt as Qt, bu as Jt, bv as Yt, bw as Xt, bx as Zt, by as Te, bz as P, bA as U, bB as Vs, bC as G, bD as en, bE as ba, bF as ya, bG as sn, bH as an, bI as tn, bJ as nn, bK as ln, bL as rn, bM as on, bN as cn, bO as dn } from "./index-aHW1mk38.js";
1
+ import { J as O, L as Ue, b as z, c as Cs, u as je, j as e, M as Ns, O as Ss, P as F, Q as ws, R as ks, U as zs, V as Fs, W as Ts, X as H, Y as Ne, Z as aa, _ as Ga, $ as Ka, a0 as Wa, a1 as Qa, a2 as Ja, a3 as Ya, a4 as Ps, f as X, a5 as He, a6 as Xa, a7 as ta, a8 as $e, a9 as ss, T as Ls, e as na, g as Is, aa as he, ab as me, ac as xe, ad as pe, ae as Se, af as fe, ag as Q, ah as Ds, G as c, ai as Ms, aj as Os, ak as As, w as la, v as ia, t as ue, al as Za, r as et, N as ra, s as st, am as at, B as tt, an as oa, ao as nt, S as Es, z as lt, n as Us, A as ca, ap as fs, aq as re, ar as Ce, as as Me, at as ls, au as da, av as it, aw as rt, ax as ua, ay as ot, az as ct, aA as dt, aB as ut, aC as ht, aD as gs, aE as mt, aF as xt, aG as _e, aH as js, aI as De, aJ as bs, aK as Gs, aL as pt, aM as ft, aN as gt, aO as jt, aP as bt, aQ as ps, aR as yt, aS as Ks, aT as vt, aU as Ws, aV as Ct, aW as Nt, aX as St, aY as ha, H as we, aZ as ma, l as wt, C as kt, E as Xe, d as zt, h as Ft, a_ as Tt, i as Lt, o as It, a$ as Dt, m as Mt, b0 as Ot, b1 as xa, b2 as pa, b3 as Ze, b4 as fa, b5 as es, b6 as Qs, b7 as At, b8 as Et, b9 as is, ba as rs, bb as os, bc as ga, K as Vt, bd as qt, be as Rt, bf as cs, bg as Te, bh as _t, bi as ja, bj as Ht, bk as $t, bl as as, bm as Bt, bn as Pt, bo as Ut, bp as Js, bq as Gt, br as Kt, bs as Wt, bt as Qt, bu as Jt, bv as Yt, bw as Xt, bx as Zt, by as Le, bz as P, bA as U, bB as Vs, bC as G, bD as en, bE as ba, bF as ya, bG as sn, bH as an, bI as tn, bJ as nn, bK as ln, bL as rn, bM as on, bN as cn, bO as dn } from "./index-8G7rNzmx.js";
2
2
  import * as Ys from "react";
3
3
  import ge, { useState as E, useMemo as ys, useEffect as Y, useRef as Be, Suspense as un } from "react";
4
4
  import "react-dom";
@@ -74,7 +74,7 @@ const va = O("ChartNoAxesGantt", [
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
76
  */
77
- const Na = O("ChartPie", [
77
+ const Ca = O("ChartPie", [
78
78
  [
79
79
  "path",
80
80
  {
@@ -90,7 +90,7 @@ const Na = O("ChartPie", [
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
92
  */
93
- const Ca = O("ChartScatter", [
93
+ const Na = O("ChartScatter", [
94
94
  ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }],
95
95
  ["circle", { cx: "18.5", cy: "5.5", r: ".5", fill: "currentColor", key: "lysivs" }],
96
96
  ["circle", { cx: "11.5", cy: "11.5", r: ".5", fill: "currentColor", key: "byv1b8" }],
@@ -208,7 +208,7 @@ const vn = O("Glasses", [
208
208
  * This source code is licensed under the ISC license.
209
209
  * See the LICENSE file in the root directory of this source tree.
210
210
  */
211
- const Nn = O("Hammer", [
211
+ const Cn = O("Hammer", [
212
212
  ["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
213
213
  ["path", { d: "m18 15 4-4", key: "16gjal" }],
214
214
  [
@@ -225,7 +225,7 @@ const Nn = O("Hammer", [
225
225
  * This source code is licensed under the ISC license.
226
226
  * See the LICENSE file in the root directory of this source tree.
227
227
  */
228
- const Cn = O("Hash", [
228
+ const Nn = O("Hash", [
229
229
  ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
230
230
  ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
231
231
  ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
@@ -312,7 +312,7 @@ const Pe = O("LoaderCircle", [
312
312
  * This source code is licensed under the ISC license.
313
313
  * See the LICENSE file in the root directory of this source tree.
314
314
  */
315
- const Ln = O("MessageSquareMore", [
315
+ const Tn = O("MessageSquareMore", [
316
316
  ["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }],
317
317
  ["path", { d: "M8 10h.01", key: "19clt8" }],
318
318
  ["path", { d: "M12 10h.01", key: "1nrarc" }],
@@ -324,7 +324,7 @@ const Ln = O("MessageSquareMore", [
324
324
  * This source code is licensed under the ISC license.
325
325
  * See the LICENSE file in the root directory of this source tree.
326
326
  */
327
- const Tn = O("Network", [
327
+ const Ln = O("Network", [
328
328
  ["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
329
329
  ["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
330
330
  ["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
@@ -512,7 +512,7 @@ function ka(s) {
512
512
  var o;
513
513
  return {
514
514
  ...l,
515
- cards: (o = l.cards) == null ? void 0 : o.map((r) => _n(r))
515
+ cards: (o = l.cards) == null ? void 0 : o.map((i) => _n(i))
516
516
  };
517
517
  })
518
518
  };
@@ -567,13 +567,13 @@ async function $n(s, n, a, t) {
567
567
  async function vs(s, n) {
568
568
  if (!n)
569
569
  return null;
570
- const { id: a, template: t, filterValues: l, isDefault: o, shared: r } = s;
570
+ const { id: a, template: t, filterValues: l, isDefault: o, shared: i } = s;
571
571
  return await Ue("https://semaphor.cloud/api/v1/lens", n, {
572
572
  lensId: a,
573
573
  template: t,
574
574
  filterValues: l,
575
575
  isDefault: o,
576
- shared: r,
576
+ shared: i,
577
577
  operation: "update"
578
578
  });
579
579
  }
@@ -584,20 +584,20 @@ async function Bn(s, n) {
584
584
  }) : null;
585
585
  }
586
586
  function Pn() {
587
- const [s, n] = E(""), [a, t] = E(!1), l = z((u) => u.lenses), { setLenses: o, setSelectedLensId: r } = Ns(), [d, i] = E(!1), [x, h] = E(!1), y = z((u) => u.dashboard), p = z((u) => u.filterValues), { authToken: m } = je();
587
+ const [s, n] = E(""), [a, t] = E(!1), l = z((m) => m.lenses), { setLenses: o, setSelectedLensId: i } = Cs(), [d, r] = E(!1), [x, u] = E(!1), v = z((m) => m.dashboard), p = z((m) => m.filterValues), { authToken: h } = je();
588
588
  async function f() {
589
- i(!0);
590
- const u = ka(
591
- y
589
+ r(!0);
590
+ const m = ka(
591
+ v
592
592
  ), k = await $n(
593
593
  s,
594
- u,
594
+ m,
595
595
  p,
596
- m == null ? void 0 : m.accessToken
596
+ h == null ? void 0 : h.accessToken
597
597
  );
598
- k && (o([...l || [], k]), r(k.id), h(!1)), i(!1);
598
+ k && (o([...l || [], k]), i(k.id), u(!1)), r(!1);
599
599
  }
600
- return /* @__PURE__ */ e.jsxs(Cs, { open: x, onOpenChange: h, children: [
600
+ return /* @__PURE__ */ e.jsxs(Ns, { open: x, onOpenChange: u, children: [
601
601
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
602
602
  F,
603
603
  {
@@ -613,16 +613,16 @@ function Pn() {
613
613
  /* @__PURE__ */ e.jsxs(ks, { className: "sm:max-w-[425px]", children: [
614
614
  /* @__PURE__ */ e.jsxs(zs, { children: [
615
615
  /* @__PURE__ */ e.jsx(Fs, { children: "Create Lens" }),
616
- /* @__PURE__ */ e.jsx(Ls, { children: "Lenses are private by default and are only visible to you." })
616
+ /* @__PURE__ */ e.jsx(Ts, { children: "Lenses are private by default and are only visible to you." })
617
617
  ] }),
618
618
  /* @__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: [
619
619
  /* @__PURE__ */ e.jsx(H, { className: "text-right", children: "Name" }),
620
620
  /* @__PURE__ */ e.jsx(
621
- Ce,
621
+ Ne,
622
622
  {
623
623
  value: s,
624
- onChange: (u) => {
625
- n(u.target.value);
624
+ onChange: (m) => {
625
+ n(m.target.value);
626
626
  },
627
627
  id: "name",
628
628
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -645,37 +645,37 @@ function Pn() {
645
645
  ] });
646
646
  }
647
647
  function Un() {
648
- const [s, n] = E(!1), a = z((h) => h.lenses), t = z((h) => h.selectedLensId), { setLenses: l, setSelectedLensId: o } = Ns(), { authToken: r } = je();
649
- async function d(h) {
650
- o(h);
648
+ const [s, n] = E(!1), a = z((u) => u.lenses), t = z((u) => u.selectedLensId), { setLenses: l, setSelectedLensId: o } = Cs(), { authToken: i } = je();
649
+ async function d(u) {
650
+ o(u);
651
651
  }
652
- async function i(h) {
653
- if (await Bn(h, r == null ? void 0 : r.accessToken)) {
654
- const p = a == null ? void 0 : a.filter((m) => m.id !== h);
652
+ async function r(u) {
653
+ if (await Bn(u, i == null ? void 0 : i.accessToken)) {
654
+ const p = a == null ? void 0 : a.filter((h) => h.id !== u);
655
655
  l(p || []), o("original");
656
656
  }
657
657
  }
658
- async function x(h) {
659
- const y = a == null ? void 0 : a.map((f) => f.id === h.id ? {
658
+ async function x(u) {
659
+ const v = a == null ? void 0 : a.map((f) => f.id === u.id ? {
660
660
  ...f,
661
- isDefault: !h.isDefault
661
+ isDefault: !u.isDefault
662
662
  } : {
663
663
  ...f,
664
664
  isDefault: !1
665
665
  });
666
- l(y || []);
666
+ l(v || []);
667
667
  const p = {
668
- ...h,
669
- isDefault: !h.isDefault
668
+ ...u,
669
+ isDefault: !u.isDefault
670
670
  };
671
- await vs(p, r == null ? void 0 : r.accessToken);
672
- const m = a == null ? void 0 : a.find((f) => f.isDefault);
673
- if (m && m.id !== h.id) {
671
+ await vs(p, i == null ? void 0 : i.accessToken);
672
+ const h = a == null ? void 0 : a.find((f) => f.isDefault);
673
+ if (h && h.id !== u.id) {
674
674
  const f = {
675
- ...m,
675
+ ...h,
676
676
  isDefault: !1
677
677
  };
678
- await vs(f, r == null ? void 0 : r.accessToken);
678
+ await vs(f, i == null ? void 0 : i.accessToken);
679
679
  }
680
680
  }
681
681
  return /* @__PURE__ */ e.jsxs(Ga, { open: s, onOpenChange: n, children: [
@@ -690,25 +690,25 @@ function Un() {
690
690
  onValueChange: d,
691
691
  children: [
692
692
  /* @__PURE__ */ e.jsx(Ps, { value: "original", children: "Original" }),
693
- a == null ? void 0 : a.map((h) => /* @__PURE__ */ e.jsxs(
693
+ a == null ? void 0 : a.map((u) => /* @__PURE__ */ e.jsxs(
694
694
  Ps,
695
695
  {
696
696
  className: "group flex justify-between gap-2",
697
- value: h.id,
697
+ value: u.id,
698
698
  children: [
699
- /* @__PURE__ */ e.jsx("p", { children: h.name }),
699
+ /* @__PURE__ */ e.jsx("p", { children: u.name }),
700
700
  /* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-3", children: [
701
701
  /* @__PURE__ */ e.jsx(
702
702
  Sn,
703
703
  {
704
- onClick: (y) => {
705
- y.preventDefault(), x(h);
704
+ onClick: (v) => {
705
+ v.preventDefault(), x(u);
706
706
  },
707
707
  className: X(
708
708
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
709
709
  {
710
- invisible: !h.isDefault,
711
- "text-green-500": h.isDefault
710
+ invisible: !u.isDefault,
711
+ "text-green-500": u.isDefault
712
712
  }
713
713
  ),
714
714
  strokeWidth: 1.5
@@ -717,8 +717,8 @@ function Un() {
717
717
  /* @__PURE__ */ e.jsx(
718
718
  He,
719
719
  {
720
- onClick: (y) => {
721
- y.preventDefault(), i(h.id);
720
+ onClick: (v) => {
721
+ v.preventDefault(), r(u.id);
722
722
  },
723
723
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
724
724
  strokeWidth: 1.5
@@ -727,7 +727,7 @@ function Un() {
727
727
  ] })
728
728
  ]
729
729
  },
730
- h.id
730
+ u.id
731
731
  ))
732
732
  ]
733
733
  }
@@ -736,25 +736,25 @@ function Un() {
736
736
  ] });
737
737
  }
738
738
  function Gn() {
739
- const { authToken: s } = je(), n = z((b) => b.lenses), a = z((b) => b.selectedLensId), t = n == null ? void 0 : n.find((b) => b.id === a), l = z((b) => b.dashboard);
740
- z((b) => b.selectedSheetId);
739
+ const { authToken: s } = je(), n = z((y) => y.lenses), a = z((y) => y.selectedLensId), t = n == null ? void 0 : n.find((y) => y.id === a), l = z((y) => y.dashboard);
740
+ z((y) => y.selectedSheetId);
741
741
  const o = z(
742
- (b) => b.isDashboardEditing
743
- ), [r, d] = E(!1), i = z((b) => b.filterValues), x = z((b) => b.isVisualEditing), h = z((b) => b.showFilters);
742
+ (y) => y.isDashboardEditing
743
+ ), [i, d] = E(!1), r = z((y) => y.filterValues), x = z((y) => y.isVisualEditing), u = z((y) => y.showFilters);
744
744
  z(
745
- (b) => b.showDashboardJSON
745
+ (y) => y.showDashboardJSON
746
746
  );
747
- const y = z((b) => b.onSaveFunction), p = z(
748
- (b) => b.actions.setShowFilters
749
- ), { addFrame: m, setSelectedFrameId: f } = z(
750
- (b) => b.actions
751
- ), { getSelectedSheet: u, setIsDashboardEditing: k, setShowDashboardJSON: I } = z((b) => b.actions), D = u(), { tenantId: N, endUserId: M } = ys(
747
+ const v = z((y) => y.onSaveFunction), p = z(
748
+ (y) => y.actions.setShowFilters
749
+ ), { addFrame: h, setSelectedFrameId: f } = z(
750
+ (y) => y.actions
751
+ ), { getSelectedSheet: m, setIsDashboardEditing: k, setShowDashboardJSON: I } = z((y) => y.actions), M = m(), { tenantId: j, endUserId: D } = ys(
752
752
  () => Xa(s == null ? void 0 : s.accessToken),
753
753
  [s == null ? void 0 : s.accessToken]
754
- ), A = ys(() => N || M, [N, M]), j = () => {
755
- if (!o || !D)
754
+ ), A = ys(() => j || D, [j, D]), g = () => {
755
+ if (!o || !M)
756
756
  return;
757
- const b = {
757
+ const y = {
758
758
  id: $e(),
759
759
  title: "Title",
760
760
  description: "Description",
@@ -771,24 +771,24 @@ function Gn() {
771
771
  data: []
772
772
  }, q = {
773
773
  id: $e(),
774
- cards: [b],
775
- activeCardId: b.id
774
+ cards: [y],
775
+ activeCardId: y.id
776
776
  };
777
- m(D.id, q), f(q.id);
777
+ h(M.id, q), f(q.id);
778
778
  }, S = () => {
779
779
  k(!0);
780
780
  };
781
- async function v() {
781
+ async function C() {
782
782
  if (d(!0), !a || !t)
783
783
  return;
784
- const b = ka(
784
+ const y = ka(
785
785
  l
786
- ), q = JSON.stringify(b), $ = {
786
+ ), q = JSON.stringify(y), $ = {
787
787
  ...t,
788
788
  template: q,
789
- filterValues: i
789
+ filterValues: r
790
790
  };
791
- await vs($, s == null ? void 0 : s.accessToken), ss.success("Lens saved"), y == null || y(b), d(!1);
791
+ await vs($, s == null ? void 0 : s.accessToken), ss.success("Lens saved"), v == null || v(y), d(!1);
792
792
  }
793
793
  return x ? null : /* @__PURE__ */ e.jsxs(
794
794
  "div",
@@ -807,7 +807,7 @@ function Gn() {
807
807
  className: "h-7 p-2",
808
808
  size: "sm",
809
809
  disabled: !o,
810
- onClick: j,
810
+ onClick: g,
811
811
  children: [
812
812
  /* @__PURE__ */ e.jsx(ws, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
813
813
  "Frame"
@@ -842,13 +842,13 @@ function Gn() {
842
842
  {
843
843
  className: "h-7 p-2",
844
844
  variant: "ghost",
845
- disabled: r,
846
- onClick: v,
845
+ disabled: i,
846
+ onClick: C,
847
847
  size: "sm",
848
848
  children: /* @__PURE__ */ e.jsx(Mn, { className: "h-4 w-4", strokeWidth: 1.5 })
849
849
  }
850
850
  ),
851
- !h && !x && o && /* @__PURE__ */ e.jsx(
851
+ !u && !x && o && /* @__PURE__ */ e.jsx(
852
852
  F,
853
853
  {
854
854
  className: "h-7 p-2",
@@ -872,37 +872,37 @@ function qe({
872
872
  isLoading: t,
873
873
  isError: l,
874
874
  connectionTooltip: o,
875
- onChange: r,
875
+ onChange: i,
876
876
  showNone: d = !1,
877
- className: i,
877
+ className: r,
878
878
  showIcon: x = !0,
879
- disabled: h = !1
879
+ disabled: u = !1
880
880
  }) {
881
- const y = t ? "Loading..." : l ? "Error" : a;
881
+ const v = t ? "Loading..." : l ? "Error" : a;
882
882
  function p() {
883
883
  if (s === "Connection")
884
884
  return /* @__PURE__ */ e.jsx(Dn, { className: "size-4 rotate-90" });
885
885
  if (s === "Database")
886
886
  return /* @__PURE__ */ e.jsx(fn, { className: "size-4" });
887
887
  if (s === "Schema")
888
- return /* @__PURE__ */ e.jsx(Tn, { className: "size-4" });
888
+ return /* @__PURE__ */ e.jsx(Ln, { className: "size-4" });
889
889
  if (s === "Table")
890
890
  return /* @__PURE__ */ e.jsx(Ds, { className: "size-4" });
891
891
  if (s === "Model")
892
892
  return /* @__PURE__ */ e.jsx(hn, { className: "size-4" });
893
893
  }
894
894
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
895
- x && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: o ? /* @__PURE__ */ e.jsxs(Ts, { children: [
895
+ x && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: o ? /* @__PURE__ */ e.jsxs(Ls, { children: [
896
896
  /* @__PURE__ */ e.jsx(na, { children: p() }),
897
897
  /* @__PURE__ */ e.jsx(Is, { className: "text-xs", align: "start", children: o })
898
898
  ] }) : p() }),
899
- /* @__PURE__ */ e.jsxs(he, { disabled: h, value: y, onValueChange: r, children: [
899
+ /* @__PURE__ */ e.jsxs(he, { disabled: u, value: v, onValueChange: i, children: [
900
900
  /* @__PURE__ */ e.jsx(
901
901
  me,
902
902
  {
903
903
  className: X(
904
904
  "h-9 w-full focus:ring-1 focus:ring-offset-0",
905
- i
905
+ r
906
906
  ),
907
907
  children: /* @__PURE__ */ e.jsx(
908
908
  xe,
@@ -916,39 +916,39 @@ function qe({
916
916
  t ? /* @__PURE__ */ e.jsx(fe, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(fe, { children: s }),
917
917
  /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
918
918
  d && /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }, "none"),
919
- n && n.map((m, f) => /* @__PURE__ */ e.jsx(Q, { value: m.id, children: m.name }, f))
919
+ n && n.map((h, f) => /* @__PURE__ */ e.jsx(Q, { value: h.id, children: h.name }, f))
920
920
  ] }),
921
- (t || l) && /* @__PURE__ */ e.jsx(Q, { value: y, children: y })
921
+ (t || l) && /* @__PURE__ */ e.jsx(Q, { value: v, children: v })
922
922
  ] }) })
923
923
  ] })
924
924
  ] });
925
925
  }
926
926
  function Kn({ column: s }) {
927
- const [n, a] = E(!1), t = c((m) => m.selectedTableName), l = c(
928
- (m) => m.selectedSchemaName
927
+ const [n, a] = E(!1), t = c((h) => h.selectedTableName), l = c(
928
+ (h) => h.selectedSchemaName
929
929
  ), o = c(
930
- (m) => m.selectedDatamodelId
931
- ), r = c((m) => m.sqlGen), { modelItems: d } = Oe(), i = c((m) => m.actions.setSqlGen), x = c((m) => m.actions.setCardSql), h = c((m) => m.actions.setRunSql);
932
- function y(m, f) {
933
- var D;
934
- const u = la(m, r, f), k = (D = d == null ? void 0 : d.find(
935
- (N) => N.id === o
936
- )) == null ? void 0 : D.name;
937
- i(u);
930
+ (h) => h.selectedDatamodelId
931
+ ), i = c((h) => h.sqlGen), { modelItems: d } = Oe(), r = c((h) => h.actions.setSqlGen), x = c((h) => h.actions.setCardSql), u = c((h) => h.actions.setRunSql);
932
+ function v(h, f) {
933
+ var M;
934
+ const m = la(h, i, f), k = (M = d == null ? void 0 : d.find(
935
+ (j) => j.id === o
936
+ )) == null ? void 0 : M.name;
937
+ r(m);
938
938
  const I = ia(
939
- u,
939
+ m,
940
940
  ue(l || ""),
941
941
  ue(t),
942
942
  k
943
943
  );
944
- I && (x(I), h(!0)), a(!1);
944
+ I && (x(I), u(!0)), a(!1);
945
945
  }
946
946
  function p() {
947
947
  return /* @__PURE__ */ e.jsxs("ul", { className: "text-xs", children: [
948
948
  /* @__PURE__ */ e.jsx(
949
949
  "li",
950
950
  {
951
- onClick: () => y(s, "COUNT"),
951
+ onClick: () => v(s, "COUNT"),
952
952
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
953
953
  children: "Count"
954
954
  }
@@ -956,7 +956,7 @@ function Kn({ column: s }) {
956
956
  /* @__PURE__ */ e.jsx(
957
957
  "li",
958
958
  {
959
- onClick: () => y(s, "AVG"),
959
+ onClick: () => v(s, "AVG"),
960
960
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
961
961
  children: "Avg"
962
962
  }
@@ -964,7 +964,7 @@ function Kn({ column: s }) {
964
964
  /* @__PURE__ */ e.jsx(
965
965
  "li",
966
966
  {
967
- onClick: () => y(s, "SUM"),
967
+ onClick: () => v(s, "SUM"),
968
968
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
969
969
  children: "Sum"
970
970
  }
@@ -972,7 +972,7 @@ function Kn({ column: s }) {
972
972
  /* @__PURE__ */ e.jsx(
973
973
  "li",
974
974
  {
975
- onClick: () => y(s, "MAX"),
975
+ onClick: () => v(s, "MAX"),
976
976
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
977
977
  children: "Max"
978
978
  }
@@ -980,7 +980,7 @@ function Kn({ column: s }) {
980
980
  /* @__PURE__ */ e.jsx(
981
981
  "li",
982
982
  {
983
- onClick: () => y(s, "MIN"),
983
+ onClick: () => v(s, "MIN"),
984
984
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
985
985
  children: "Min"
986
986
  }
@@ -1000,13 +1000,13 @@ function Kn({ column: s }) {
1000
1000
  ] });
1001
1001
  }
1002
1002
  function za({ column: s }) {
1003
- return /* @__PURE__ */ e.jsxs(Ts, { children: [
1003
+ return /* @__PURE__ */ e.jsxs(Ls, { children: [
1004
1004
  /* @__PURE__ */ e.jsx(Za, { asChild: !0, children: et.includes(s.data_type.toLowerCase()) ? (
1005
1005
  // <span className=" font-thin">T</span>
1006
1006
  /* @__PURE__ */ e.jsx(_s, { className: "size-3" })
1007
1007
  ) : ra.includes(s.data_type.toLowerCase()) ? (
1008
1008
  //
1009
- /* @__PURE__ */ e.jsx(Cn, { className: "size-3" })
1009
+ /* @__PURE__ */ e.jsx(Nn, { className: "size-3" })
1010
1010
  ) : st.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(at, { className: "size-3" }) : tt.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(qn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(On, { className: "size-3" }) }),
1011
1011
  /* @__PURE__ */ e.jsx(Is, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
1012
1012
  ] });
@@ -1017,56 +1017,56 @@ function Wn({
1017
1017
  columns: a,
1018
1018
  status: t
1019
1019
  }) {
1020
- const l = c((v) => v.sqlGen), o = c(
1021
- (v) => v.selectedConnectionId
1022
- ), r = c(
1023
- (v) => v.selectedDatabaseName
1020
+ const l = c((C) => C.sqlGen), o = c(
1021
+ (C) => C.selectedConnectionId
1022
+ ), i = c(
1023
+ (C) => C.selectedDatabaseName
1024
1024
  ), d = c(
1025
- (v) => v.selectedSchemaName
1026
- ), i = c((v) => v.selectedTableName), x = c(
1027
- (v) => v.selectedDatamodelId
1028
- ), h = z(
1029
- (v) => v.dashboard.aiScopeTables
1030
- ), { setAIScopeTables: y } = z((v) => v.actions), p = c((v) => v.actions.setRunSql), m = c((v) => v.actions.setSqlGen), f = c(
1031
- (v) => v.actions.setIsShowingVisual
1032
- ), u = c((v) => v.actions.setCardSql), { connectionType: k, modelItems: I } = Oe();
1033
- function D(v) {
1025
+ (C) => C.selectedSchemaName
1026
+ ), r = c((C) => C.selectedTableName), x = c(
1027
+ (C) => C.selectedDatamodelId
1028
+ ), u = z(
1029
+ (C) => C.dashboard.aiScopeTables
1030
+ ), { setAIScopeTables: v } = z((C) => C.actions), p = c((C) => C.actions.setRunSql), h = c((C) => C.actions.setSqlGen), f = c(
1031
+ (C) => C.actions.setIsShowingVisual
1032
+ ), m = c((C) => C.actions.setCardSql), { connectionType: k, modelItems: I } = Oe();
1033
+ function M(C) {
1034
1034
  var R;
1035
- const b = la(v, l);
1036
- m(b);
1035
+ const y = la(C, l);
1036
+ h(y);
1037
1037
  const q = (R = I == null ? void 0 : I.find(
1038
1038
  (B) => B.id === x
1039
- )) == null ? void 0 : R.name, $ = ia(b, ue(s), ue(n), q);
1040
- $ && (u($), p(!0));
1039
+ )) == null ? void 0 : R.name, $ = ia(y, ue(s), ue(n), q);
1040
+ $ && (m($), p(!0));
1041
1041
  }
1042
- function N() {
1043
- return (h == null ? void 0 : h.find(
1044
- (v) => v.connectinonId === o && v.tableName === i
1042
+ function j() {
1043
+ return (u == null ? void 0 : u.find(
1044
+ (C) => C.connectinonId === o && C.tableName === r
1045
1045
  )) !== void 0;
1046
1046
  }
1047
- function M(v) {
1048
- if (v === !0 && i && o) {
1049
- const b = {
1047
+ function D(C) {
1048
+ if (C === !0 && r && o) {
1049
+ const y = {
1050
1050
  connectinonId: o,
1051
1051
  connectionType: k,
1052
- databaseName: r,
1052
+ databaseName: i,
1053
1053
  schemaName: d,
1054
- tableName: i
1055
- }, $ = [...h || [], b].filter(
1054
+ tableName: r
1055
+ }, $ = [...u || [], y].filter(
1056
1056
  (R, B, ee) => ee.findIndex(
1057
1057
  (W) => W.connectinonId === R.connectinonId && W.tableName === R.tableName
1058
1058
  ) === B
1059
1059
  );
1060
- y($), ss.success(`Added '${i}' to AI Scope`, {
1060
+ v($), ss.success(`Added '${r}' to AI Scope`, {
1061
1061
  position: "top-right",
1062
1062
  duration: 2500,
1063
1063
  richColors: !0
1064
1064
  });
1065
1065
  } else {
1066
- const b = (h || []).filter(
1067
- (q) => q.connectinonId !== o && q.tableName !== i
1066
+ const y = (u || []).filter(
1067
+ (q) => q.connectinonId !== o && q.tableName !== r
1068
1068
  );
1069
- y(b), ss(`Removed '${i}' from AI Scope`, {
1069
+ v(y), ss(`Removed '${r}' from AI Scope`, {
1070
1070
  position: "top-right",
1071
1071
  duration: 2e3,
1072
1072
  richColors: !0
@@ -1075,40 +1075,40 @@ function Wn({
1075
1075
  }
1076
1076
  function A() {
1077
1077
  var R;
1078
- let v = ca(s, n);
1079
- const b = (R = I == null ? void 0 : I.find(
1078
+ let C = ca(s, n);
1079
+ const y = (R = I == null ? void 0 : I.find(
1080
1080
  (B) => B.id === x
1081
1081
  )) == null ? void 0 : R.name;
1082
- console.log("modelName", b), x && x !== "none" && (v = `${fs}.${b}`);
1083
- let q = v;
1082
+ console.log("modelName", y), x && x !== "none" && (C = `${fs}.${y}`);
1083
+ let q = C;
1084
1084
  return ((B) => /[A-Z]/.test(B))(n) && (q = q.split(".").map((ee) => `"${ee}"`).join(".")), q;
1085
1085
  }
1086
- function j() {
1087
- const v = A();
1086
+ function g() {
1087
+ const C = A();
1088
1088
  f(!1);
1089
- const b = k === "MSSQL" ? `SELECT top 10 * FROM ${v}` : `SELECT * FROM ${v} LIMIT 10`;
1090
- u(b), p(!0);
1089
+ const y = k === "MSSQL" ? `SELECT top 10 * FROM ${C}` : `SELECT * FROM ${C} LIMIT 10`;
1090
+ m(y), p(!0);
1091
1091
  }
1092
1092
  function S() {
1093
- const v = A();
1094
- u(`SELECT COUNT(*) as count FROM ${v}`), p(!0);
1093
+ const C = A();
1094
+ m(`SELECT COUNT(*) as count FROM ${C}`), p(!0);
1095
1095
  }
1096
1096
  return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
1097
1097
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
1098
1098
  /* @__PURE__ */ e.jsx(
1099
1099
  oa,
1100
1100
  {
1101
- title: `${N() ? "Remove from" : "Add to"} AI Scope`,
1102
- pressed: N(),
1103
- onPressedChange: M,
1101
+ title: `${j() ? "Remove from" : "Add to"} AI Scope`,
1102
+ pressed: j(),
1103
+ onPressedChange: D,
1104
1104
  variant: "outline",
1105
1105
  className: "h-9 px-2",
1106
1106
  children: /* @__PURE__ */ e.jsx(
1107
1107
  nt,
1108
1108
  {
1109
1109
  className: X("size-4", {
1110
- "text-primary": N(),
1111
- "text-muted-foreground": !N()
1110
+ "text-primary": j(),
1111
+ "text-muted-foreground": !j()
1112
1112
  })
1113
1113
  }
1114
1114
  )
@@ -1118,7 +1118,7 @@ function Wn({
1118
1118
  F,
1119
1119
  {
1120
1120
  disabled: t !== "Success",
1121
- onClick: j,
1121
+ onClick: g,
1122
1122
  size: "sm",
1123
1123
  variant: "secondary",
1124
1124
  className: "flex",
@@ -1148,32 +1148,32 @@ function Wn({
1148
1148
  {
1149
1149
  className: "flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",
1150
1150
  children: [
1151
- a == null ? void 0 : a.map((v) => /* @__PURE__ */ e.jsxs(
1151
+ a == null ? void 0 : a.map((C) => /* @__PURE__ */ e.jsxs(
1152
1152
  "div",
1153
1153
  {
1154
- onClick: () => D(v),
1154
+ onClick: () => M(C),
1155
1155
  className: X(
1156
1156
  "group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
1157
1157
  {
1158
- "bg-muted": lt(v, l)
1158
+ "bg-muted": lt(C, l)
1159
1159
  }
1160
1160
  ),
1161
1161
  children: [
1162
1162
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
1163
- /* @__PURE__ */ e.jsx(za, { column: v }),
1164
- /* @__PURE__ */ e.jsx("span", { children: v.column_name })
1163
+ /* @__PURE__ */ e.jsx(za, { column: C }),
1164
+ /* @__PURE__ */ e.jsx("span", { children: C.column_name })
1165
1165
  ] }),
1166
1166
  /* @__PURE__ */ e.jsx(
1167
1167
  "div",
1168
1168
  {
1169
- onClick: (b) => b.stopPropagation(),
1169
+ onClick: (y) => y.stopPropagation(),
1170
1170
  className: "flex items-center justify-end",
1171
- children: ra.includes(v.data_type) && /* @__PURE__ */ e.jsx(Kn, { column: v })
1171
+ children: ra.includes(C.data_type) && /* @__PURE__ */ e.jsx(Kn, { column: C })
1172
1172
  }
1173
1173
  )
1174
1174
  ]
1175
1175
  },
1176
- v.column_name
1176
+ C.column_name
1177
1177
  )),
1178
1178
  /* @__PURE__ */ e.jsx(Us, { orientation: "vertical" }),
1179
1179
  /* @__PURE__ */ e.jsx(Us, { orientation: "horizontal" })
@@ -1183,57 +1183,57 @@ function Wn({
1183
1183
  ] });
1184
1184
  }
1185
1185
  function Oe(s, n) {
1186
- var Ke, Ve, We, Qe, g;
1186
+ var Ke, Ve, We, Qe, b;
1187
1187
  let a = ys(() => [], []);
1188
1188
  const t = je().authToken || s, l = c(
1189
- (C) => C.selectedConnectionId
1189
+ (N) => N.selectedConnectionId
1190
1190
  ), o = c(
1191
- (C) => C.selectedDatamodelId
1192
- ), r = c(
1193
- (C) => C.selectedDatabaseName
1191
+ (N) => N.selectedDatamodelId
1192
+ ), i = c(
1193
+ (N) => N.selectedDatabaseName
1194
1194
  ), d = c(
1195
- (C) => C.selectedSchemaName
1196
- ), i = c((C) => C.selectedTableName), x = c(
1197
- (C) => C.actions.setCurrentColumns
1198
- ), h = c(
1199
- (C) => C.actions.setSelectedConnectionId
1200
- ), y = c(
1201
- (C) => C.actions.setSelectedDatamodelId
1195
+ (N) => N.selectedSchemaName
1196
+ ), r = c((N) => N.selectedTableName), x = c(
1197
+ (N) => N.actions.setCurrentColumns
1198
+ ), u = c(
1199
+ (N) => N.actions.setSelectedConnectionId
1200
+ ), v = c(
1201
+ (N) => N.actions.setSelectedDatamodelId
1202
1202
  ), p = c(
1203
- (C) => C.actions.setSelectedDatabaseName
1204
- ), m = c(
1205
- (C) => C.actions.setSelectedSchemaName
1203
+ (N) => N.actions.setSelectedDatabaseName
1204
+ ), h = c(
1205
+ (N) => N.actions.setSelectedSchemaName
1206
1206
  ), f = c(
1207
- (C) => C.actions.setSelectedTableName
1208
- ), u = c((C) => C.actions.setCardSql);
1209
- function k(C) {
1210
- return l && r && d && r !== "NA" ? !0 : l && C === "API" ? !1 : !!(l && C === "S3");
1207
+ (N) => N.actions.setSelectedTableName
1208
+ ), m = c((N) => N.actions.setCardSql);
1209
+ function k(N) {
1210
+ return l && i && d && i !== "NA" ? !0 : l && N === "API" ? !1 : !!(l && N === "S3");
1211
1211
  }
1212
- function I(C) {
1213
- return !!(l && r && r !== "NA" && d && i || l && (C === "S3" || C === "API") || o && o);
1212
+ function I(N) {
1213
+ return !!(l && i && i !== "NA" && d && r || l && (N === "S3" || N === "API") || o && o);
1214
1214
  }
1215
- function D(C) {
1216
- return l && C ? !(C === "API" || C === "S3") : !1;
1215
+ function M(N) {
1216
+ return l && N ? !(N === "API" || N === "S3") : !1;
1217
1217
  }
1218
1218
  const {
1219
- data: N,
1220
- isLoading: M,
1219
+ data: j,
1220
+ isLoading: D,
1221
1221
  isError: A
1222
1222
  } = re({
1223
1223
  queryKey: ["connections"],
1224
- queryFn: () => Ne(
1224
+ queryFn: () => Ce(
1225
1225
  "https://semaphor.cloud/api/v1/connections",
1226
1226
  (t == null ? void 0 : t.accessToken) || ""
1227
1227
  ),
1228
1228
  enabled: !!(t != null && t.accessToken)
1229
1229
  // Only fetch if authToken is present
1230
1230
  }), {
1231
- data: j,
1231
+ data: g,
1232
1232
  isLoading: S,
1233
- isError: v
1233
+ isError: C
1234
1234
  } = re({
1235
1235
  queryKey: ["models", l],
1236
- queryFn: () => Ne(
1236
+ queryFn: () => Ce(
1237
1237
  "https://semaphor.cloud/api/v1/datamodels",
1238
1238
  (t == null ? void 0 : t.accessToken) || "",
1239
1239
  {
@@ -1242,9 +1242,9 @@ function Oe(s, n) {
1242
1242
  ),
1243
1243
  enabled: !!(t != null && t.accessToken) && !!l
1244
1244
  // Only fetch if authToken is present
1245
- }), b = N == null ? void 0 : N.connections.find(
1246
- (C) => C.id === l
1247
- ), q = b == null ? void 0 : b.type, $ = (b == null ? void 0 : b.type) === "API" || (b == null ? void 0 : b.type) === "S3", {
1245
+ }), y = j == null ? void 0 : j.connections.find(
1246
+ (N) => N.id === l
1247
+ ), q = y == null ? void 0 : y.type, $ = (y == null ? void 0 : y.type) === "API" || (y == null ? void 0 : y.type) === "S3", {
1248
1248
  data: R,
1249
1249
  isLoading: B,
1250
1250
  isFetching: ee,
@@ -1252,14 +1252,14 @@ function Oe(s, n) {
1252
1252
  refetch: le
1253
1253
  } = re({
1254
1254
  queryKey: ["databases", l],
1255
- queryFn: () => Ne(
1255
+ queryFn: () => Ce(
1256
1256
  "https://semaphor.cloud/api/v1/databases",
1257
1257
  (t == null ? void 0 : t.accessToken) || "",
1258
1258
  {
1259
1259
  connection_id: l
1260
1260
  }
1261
1261
  ),
1262
- enabled: D(q)
1262
+ enabled: M(q)
1263
1263
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
1264
1264
  }), {
1265
1265
  data: K,
@@ -1268,20 +1268,20 @@ function Oe(s, n) {
1268
1268
  isError: V,
1269
1269
  refetch: Z
1270
1270
  } = re({
1271
- queryKey: ["schemas", l, r],
1272
- queryFn: () => Ne(
1271
+ queryKey: ["schemas", l, i],
1272
+ queryFn: () => Ce(
1273
1273
  "https://semaphor.cloud/api/v1/schemas",
1274
1274
  (t == null ? void 0 : t.accessToken) || "",
1275
1275
  {
1276
1276
  connection_id: l,
1277
- database_name: r
1277
+ database_name: i
1278
1278
  }
1279
1279
  ),
1280
- enabled: !!l && !!r && !$ && r !== "NA"
1280
+ enabled: !!l && !!i && !$ && i !== "NA"
1281
1281
  //currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
1282
1282
  }), {
1283
- data: T,
1284
- isLoading: L,
1283
+ data: L,
1284
+ isLoading: T,
1285
1285
  isFetching: se,
1286
1286
  isError: _,
1287
1287
  refetch: ae
@@ -1289,15 +1289,15 @@ function Oe(s, n) {
1289
1289
  queryKey: [
1290
1290
  "tables",
1291
1291
  l,
1292
- r,
1292
+ i,
1293
1293
  d
1294
1294
  ],
1295
- queryFn: () => Ne(
1295
+ queryFn: () => Ce(
1296
1296
  "https://semaphor.cloud/api/v1/tables",
1297
1297
  (t == null ? void 0 : t.accessToken) || "",
1298
1298
  {
1299
1299
  connection_id: l,
1300
- database_name: r,
1300
+ database_name: i,
1301
1301
  schema_name: d
1302
1302
  }
1303
1303
  ),
@@ -1311,21 +1311,21 @@ function Oe(s, n) {
1311
1311
  queryKey: [
1312
1312
  "columns",
1313
1313
  l,
1314
- r,
1314
+ i,
1315
1315
  o,
1316
1316
  d,
1317
- i
1317
+ r
1318
1318
  ],
1319
- queryFn: () => Ne(
1319
+ queryFn: () => Ce(
1320
1320
  "https://semaphor.cloud/api/v1/columns",
1321
1321
  (t == null ? void 0 : t.accessToken) || "",
1322
1322
  {
1323
1323
  connection_id: l,
1324
1324
  datamodel_id: o || "",
1325
1325
  // don't pass undefined. Pass empty string
1326
- database_name: r,
1326
+ database_name: i,
1327
1327
  schema_name: d,
1328
- table_name: i
1328
+ table_name: r
1329
1329
  }
1330
1330
  ),
1331
1331
  enabled: I(q)
@@ -1342,55 +1342,55 @@ function Oe(s, n) {
1342
1342
  }, [te, x, a]), Y(() => {
1343
1343
  }, [
1344
1344
  $,
1345
- u,
1346
- f,
1347
1345
  m,
1346
+ f,
1347
+ h,
1348
1348
  p,
1349
- b
1349
+ y
1350
1350
  ]);
1351
- const oe = (b == null ? void 0 : b.type) === "API" ? (Ke = b == null ? void 0 : b.type) == null ? void 0 : Ke.toLowerCase() : i || "", ce = $ ? "" : d || "";
1352
- function ze(C) {
1353
- m(C), f("");
1351
+ const oe = (y == null ? void 0 : y.type) === "API" ? (Ke = y == null ? void 0 : y.type) == null ? void 0 : Ke.toLowerCase() : r || "", ce = $ ? "" : d || "";
1352
+ function ze(N) {
1353
+ h(N), f("");
1354
1354
  }
1355
- function de(C) {
1356
- p(C === "none" ? "" : C), m(""), f(""), C !== "none" && C !== "" && y("");
1355
+ function de(N) {
1356
+ p(N === "none" ? "" : N), h(""), f(""), N !== "none" && N !== "" && v("");
1357
1357
  }
1358
- function ve(C) {
1359
- h(C);
1358
+ function ve(N) {
1359
+ u(N);
1360
1360
  }
1361
- function $s(C) {
1362
- y(C === "none" ? "" : C), C !== "none" && C !== "" && p("");
1361
+ function $s(N) {
1362
+ v(N === "none" ? "" : N), N !== "none" && N !== "" && p("");
1363
1363
  }
1364
- R && ((Ve = R == null ? void 0 : R.databases) == null ? void 0 : Ve.length) > 0, K && ((We = K == null ? void 0 : K.schemas) == null ? void 0 : We.length) > 0, te && ((Qe = te == null ? void 0 : te.columns) == null ? void 0 : Qe.length) > 0 && (a = te.columns.map((C) => ({
1365
- ...C,
1366
- data_type: C.data_type.toLowerCase()
1364
+ R && ((Ve = R == null ? void 0 : R.databases) == null ? void 0 : Ve.length) > 0, K && ((We = K == null ? void 0 : K.schemas) == null ? void 0 : We.length) > 0, te && ((Qe = te == null ? void 0 : te.columns) == null ? void 0 : Qe.length) > 0 && (a = te.columns.map((N) => ({
1365
+ ...N,
1366
+ data_type: N.data_type.toLowerCase()
1367
1367
  }))), W && (a = []), (J || A) && (a = []);
1368
- const Ie = N == null ? void 0 : N.connections.map(
1369
- (C) => ({
1370
- id: C.id,
1371
- name: C.name,
1372
- type: C.type
1368
+ const Ie = j == null ? void 0 : j.connections.map(
1369
+ (N) => ({
1370
+ id: N.id,
1371
+ name: N.name,
1372
+ type: N.type
1373
1373
  })
1374
- ), us = (g = j == null ? void 0 : j.datamodels) == null ? void 0 : g.map((C) => ({
1375
- id: C.id,
1376
- name: C.name
1377
- })), Ge = R == null ? void 0 : R.databases.map((C) => ({
1378
- id: C.database_name,
1379
- name: C.database_name
1380
- })), hs = K == null ? void 0 : K.schemas.map((C) => ({
1381
- id: C.schema_name,
1382
- name: C.schema_name
1383
- })), ms = T == null ? void 0 : T.tables.map((C) => ({
1384
- id: C.table_name,
1385
- name: C.table_name
1374
+ ), us = (b = g == null ? void 0 : g.datamodels) == null ? void 0 : b.map((N) => ({
1375
+ id: N.id,
1376
+ name: N.name
1377
+ })), Ge = R == null ? void 0 : R.databases.map((N) => ({
1378
+ id: N.database_name,
1379
+ name: N.database_name
1380
+ })), hs = K == null ? void 0 : K.schemas.map((N) => ({
1381
+ id: N.schema_name,
1382
+ name: N.schema_name
1383
+ })), ms = L == null ? void 0 : L.tables.map((N) => ({
1384
+ id: N.table_name,
1385
+ name: N.table_name
1386
1386
  }));
1387
1387
  return {
1388
1388
  connectionItems: Ie,
1389
- isConnectionsLoading: M,
1389
+ isConnectionsLoading: D,
1390
1390
  isConnectionsError: A,
1391
1391
  modelItems: us,
1392
1392
  isModelsLoading: S,
1393
- isModelsError: v,
1393
+ isModelsError: C,
1394
1394
  databaseItems: Ge,
1395
1395
  isDatabasesLoadingOrFetching: B || ee,
1396
1396
  isDatabaseError: W,
@@ -1398,7 +1398,7 @@ function Oe(s, n) {
1398
1398
  isSchemaLoadingOrFetching: ie || w,
1399
1399
  isSchemaError: V,
1400
1400
  tableItems: ms,
1401
- isTableLoadingOrFetching: L || se,
1401
+ isTableLoadingOrFetching: T || se,
1402
1402
  isTableError: _,
1403
1403
  columns: a,
1404
1404
  isColumnsLoadingOrFetching: ke || ye,
@@ -1425,28 +1425,28 @@ function Fa({
1425
1425
  (_) => _.selectedDatabaseName
1426
1426
  ), l = c(
1427
1427
  (_) => _.selectedSchemaName
1428
- ), o = c((_) => _.selectedTableName), r = c(
1428
+ ), o = c((_) => _.selectedTableName), i = c(
1429
1429
  (_) => _.actions.setSelectedTableName
1430
1430
  ), {
1431
1431
  connectionItems: d,
1432
- modelItems: i,
1432
+ modelItems: r,
1433
1433
  schemaItems: x,
1434
- databaseItems: h,
1435
- tableItems: y,
1434
+ databaseItems: u,
1435
+ tableItems: v,
1436
1436
  columns: p,
1437
- isConnectionsLoading: m,
1437
+ isConnectionsLoading: h,
1438
1438
  isModelsLoading: f,
1439
- isConnectionsError: u,
1439
+ isConnectionsError: m,
1440
1440
  isModelsError: k,
1441
1441
  isDatabasesLoadingOrFetching: I,
1442
- isDatabaseError: D,
1443
- isSchemaLoadingOrFetching: N,
1444
- isSchemaError: M,
1442
+ isDatabaseError: M,
1443
+ isSchemaLoadingOrFetching: j,
1444
+ isSchemaError: D,
1445
1445
  isColumnsError: A,
1446
- isColumnsLoadingOrFetching: j,
1446
+ isColumnsLoadingOrFetching: g,
1447
1447
  isTableLoadingOrFetching: S,
1448
- isTableError: v,
1449
- connectionType: b,
1448
+ isTableError: C,
1449
+ connectionType: y,
1450
1450
  isNonDbConnection: q,
1451
1451
  handleConnectionChange: $,
1452
1452
  handleDatabaseChange: R,
@@ -1462,7 +1462,7 @@ function Fa({
1462
1462
  schemaName: le,
1463
1463
  tableName: W,
1464
1464
  columns: p,
1465
- status: j ? "Loading..." : A ? "Error" : "Success"
1465
+ status: g ? "Loading..." : A ? "Error" : "Success"
1466
1466
  }
1467
1467
  );
1468
1468
  }
@@ -1470,7 +1470,7 @@ function Fa({
1470
1470
  window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
1471
1471
  }
1472
1472
  function w() {
1473
- if (!n || b === "S3" || b === "API")
1473
+ if (!n || y === "S3" || y === "API")
1474
1474
  return null;
1475
1475
  if (!a || a === "none")
1476
1476
  return /* @__PURE__ */ e.jsx(
@@ -1478,9 +1478,9 @@ function Fa({
1478
1478
  {
1479
1479
  showNone: !0,
1480
1480
  onChange: R,
1481
- isError: D,
1481
+ isError: M,
1482
1482
  isLoading: I,
1483
- items: h,
1483
+ items: u,
1484
1484
  value: t || "",
1485
1485
  title: "Database"
1486
1486
  }
@@ -1495,7 +1495,7 @@ function Fa({
1495
1495
  ] });
1496
1496
  }
1497
1497
  function Z() {
1498
- if (!n || b === "S3" || b === "API")
1498
+ if (!n || y === "S3" || y === "API")
1499
1499
  return null;
1500
1500
  if (!t || t === "none")
1501
1501
  return /* @__PURE__ */ e.jsx(
@@ -1505,36 +1505,36 @@ function Fa({
1505
1505
  onChange: ee,
1506
1506
  isError: k,
1507
1507
  isLoading: f,
1508
- items: i,
1508
+ items: r,
1509
1509
  value: a || "",
1510
1510
  title: "Model"
1511
1511
  }
1512
1512
  );
1513
1513
  }
1514
- function T() {
1515
- return !n || b === "S3" || b === "API" || !t || t === "none" ? null : /* @__PURE__ */ e.jsx(
1514
+ function L() {
1515
+ return !n || y === "S3" || y === "API" || !t || t === "none" ? null : /* @__PURE__ */ e.jsx(
1516
1516
  qe,
1517
1517
  {
1518
1518
  onChange: B,
1519
- isError: M,
1520
- isLoading: N,
1519
+ isError: D,
1520
+ isLoading: j,
1521
1521
  items: x,
1522
1522
  value: l || "",
1523
1523
  title: "Schema"
1524
1524
  }
1525
1525
  );
1526
1526
  }
1527
- function L() {
1527
+ function T() {
1528
1528
  function _() {
1529
1529
  let ae = !1;
1530
- return b === "API" ? (ae = !1, ae) : ((b === "S3" || n && t && t !== "none" && l) && (ae = !0), ae);
1530
+ return y === "API" ? (ae = !1, ae) : ((y === "S3" || n && t && t !== "none" && l) && (ae = !0), ae);
1531
1531
  }
1532
1532
  return _() ? /* @__PURE__ */ e.jsx(
1533
1533
  qe,
1534
1534
  {
1535
- onChange: r,
1536
- isError: v,
1537
- items: y,
1535
+ onChange: i,
1536
+ isError: C,
1537
+ items: v,
1538
1538
  isLoading: S,
1539
1539
  value: o || "",
1540
1540
  title: "Table"
@@ -1550,8 +1550,8 @@ function Fa({
1550
1550
  title: "Connection",
1551
1551
  value: n || "",
1552
1552
  onChange: $,
1553
- isLoading: m,
1554
- isError: u,
1553
+ isLoading: h,
1554
+ isError: m,
1555
1555
  connectionTooltip: ((se = d == null ? void 0 : d.find(
1556
1556
  (_) => _.id === n
1557
1557
  )) == null ? void 0 : se.type) || ""
@@ -1560,8 +1560,8 @@ function Fa({
1560
1560
  Z(),
1561
1561
  V(),
1562
1562
  w(),
1563
- T(),
1564
- L()
1563
+ L(),
1564
+ T()
1565
1565
  ] }),
1566
1566
  K(),
1567
1567
  /* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
@@ -1572,7 +1572,7 @@ function Fa({
1572
1572
  variant: "secondary",
1573
1573
  className: "w-full",
1574
1574
  children: [
1575
- /* @__PURE__ */ e.jsx(Ln, { className: "mr-2 size-4" }),
1575
+ /* @__PURE__ */ e.jsx(Tn, { className: "mr-2 size-4" }),
1576
1576
  "Help"
1577
1577
  ]
1578
1578
  }
@@ -1583,16 +1583,16 @@ function Qn(s) {
1583
1583
  const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1584
1584
  let o = s.length;
1585
1585
  if (l !== -1 && (o = l), t !== -1 && t < o && (o = t), n !== -1) {
1586
- const r = s.substring(0, n), d = s.substring(n);
1587
- return `${r} {{ filters | where }} AND ${d.substring(
1586
+ const i = s.substring(0, n), d = s.substring(n);
1587
+ return `${i} {{ filters | where }} AND ${d.substring(
1588
1588
  6
1589
1589
  )}`;
1590
1590
  } else if (a !== -1) {
1591
- const r = s.substring(0, a), d = s.substring(a);
1592
- return `${r} {{ filters | where }} ${d}`;
1591
+ const i = s.substring(0, a), d = s.substring(a);
1592
+ return `${i} {{ filters | where }} ${d}`;
1593
1593
  } else {
1594
- const r = s.substring(0, o), d = s.substring(o);
1595
- return `${r} {{ filters | where }} ${d}`;
1594
+ const i = s.substring(0, o), d = s.substring(o);
1595
+ return `${i} {{ filters | where }} ${d}`;
1596
1596
  }
1597
1597
  }
1598
1598
  function Jn({
@@ -1614,7 +1614,7 @@ function Jn({
1614
1614
  size: "sm",
1615
1615
  variant: "outline",
1616
1616
  children: [
1617
- /* @__PURE__ */ e.jsx(Nn, { className: "mr-2 h-4 w-4" }),
1617
+ /* @__PURE__ */ e.jsx(Cn, { className: "mr-2 h-4 w-4" }),
1618
1618
  "Debug with AI"
1619
1619
  ]
1620
1620
  }
@@ -1637,7 +1637,7 @@ function Xn() {
1637
1637
  (o) => o.selectedConnectionId
1638
1638
  ), { data: a } = re({
1639
1639
  queryKey: ["connections"],
1640
- queryFn: () => Ne(
1640
+ queryFn: () => Ce(
1641
1641
  "https://semaphor.cloud/api/v1/connections",
1642
1642
  (s == null ? void 0 : s.accessToken) || ""
1643
1643
  ),
@@ -1649,20 +1649,20 @@ function Xn() {
1649
1649
  return t == null ? void 0 : t.type;
1650
1650
  }
1651
1651
  function Zn() {
1652
- const { authToken: s } = je(), n = Be(null), a = c((i) => i.applyFilters), [t, l] = E(""), o = c((i) => i.filterValues), r = c((i) => i.card.sql), d = Xn();
1652
+ const { authToken: s } = je(), n = Be(null), a = c((r) => r.applyFilters), [t, l] = E(""), o = c((r) => r.filterValues), i = c((r) => r.card.sql), d = Xn();
1653
1653
  return /* @__PURE__ */ e.jsxs(
1654
1654
  Ms,
1655
1655
  {
1656
1656
  openDelay: 0,
1657
- onOpenChange: async (i) => {
1658
- if (!i)
1657
+ onOpenChange: async (r) => {
1658
+ if (!r)
1659
1659
  return;
1660
1660
  console.log("onOpenChange");
1661
1661
  const x = await Ue(
1662
1662
  "https://semaphor.cloud/api/v1/filter-sql",
1663
1663
  (s == null ? void 0 : s.accessToken) || "",
1664
1664
  {
1665
- sql: r,
1665
+ sql: i,
1666
1666
  active_filters: o,
1667
1667
  connection_type: d
1668
1668
  }
@@ -1746,21 +1746,21 @@ function sl({
1746
1746
  triggerAIRun: l,
1747
1747
  setTriggerAIRun: o
1748
1748
  }) {
1749
- const r = Be(null), d = Be(null), { authToken: i } = je(), [x, h] = E(!1), y = c((w) => w.actions.setCardSql), p = z((w) => w.dashboard.baseQueries), m = c((w) => w.actions.setRunSql), f = c((w) => w.actions.setCardType), [u, k] = E([]), I = c((w) => w.currentColumns), D = c((w) => w.card.sql), N = c((w) => w.selectedTableName), M = `
1749
+ const i = Be(null), d = Be(null), { authToken: r } = je(), [x, u] = E(!1), v = c((w) => w.actions.setCardSql), p = z((w) => w.dashboard.baseQueries), h = c((w) => w.actions.setRunSql), f = c((w) => w.actions.setCardType), [m, k] = E([]), I = c((w) => w.currentColumns), M = c((w) => w.card.sql), j = c((w) => w.selectedTableName), D = `
1750
1750
  ${a}
1751
1751
 
1752
- Database Query Dialect: ${N === "api" || N === "s3" ? "DuckDb" : ""}
1753
- Table Name: ${N}
1752
+ Database Query Dialect: ${j === "api" || j === "s3" ? "DuckDb" : ""}
1753
+ Table Name: ${j}
1754
1754
  Table Columns: ${I == null ? void 0 : I.map((w) => `${w.column_name} | ${w.data_type}`).join(", ")}
1755
- User SQL: ${D}
1755
+ User SQL: ${M}
1756
1756
  ${p && `Base Queries: ${JSON.stringify(p)} `}`, A = ` 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.
1757
- Visual Query Syntax: ${el}`, { data: j, isLoading: S, isFetching: v, isError: b, refetch: q } = re({
1757
+ Visual Query Syntax: ${el}`, { data: g, isLoading: S, isFetching: C, isError: y, refetch: q } = re({
1758
1758
  queryKey: ["ai-query"],
1759
- queryFn: () => Ne(
1759
+ queryFn: () => Ce(
1760
1760
  "https://semaphor.cloud/api/v1/ai",
1761
- (i == null ? void 0 : i.accessToken) || "",
1761
+ (r == null ? void 0 : r.accessToken) || "",
1762
1762
  {
1763
- user_content: `userContent: ${M} ${x ? A : ""}`
1763
+ user_content: `userContent: ${D} ${x ? A : ""}`
1764
1764
  }
1765
1765
  ),
1766
1766
  enabled: !1
@@ -1788,19 +1788,19 @@ function sl({
1788
1788
  return !0;
1789
1789
  }
1790
1790
  Y(() => {
1791
- j && k((w) => [...w, { role: "ai", content: j.response }]);
1792
- }, [j]), Y(() => {
1791
+ g && k((w) => [...w, { role: "ai", content: g.response }]);
1792
+ }, [g]), Y(() => {
1793
1793
  const w = setTimeout(() => {
1794
1794
  var V;
1795
1795
  d.current && (d.current.scroll({
1796
1796
  top: d.current.scrollHeight,
1797
1797
  behavior: "smooth"
1798
- }), (V = r.current) == null || V.focus());
1798
+ }), (V = i.current) == null || V.focus());
1799
1799
  }, 100);
1800
1800
  return () => clearTimeout(w);
1801
- }, [u]);
1801
+ }, [m]);
1802
1802
  function R() {
1803
- a && (k((w) => [...w, { role: "user", content: a }]), $(a) && h(!0), t(""), q());
1803
+ a && (k((w) => [...w, { role: "user", content: a }]), $(a) && u(!0), t(""), q());
1804
1804
  }
1805
1805
  Y(() => {
1806
1806
  l && (R(), o(!1));
@@ -1842,8 +1842,8 @@ function sl({
1842
1842
  F,
1843
1843
  {
1844
1844
  onClick: (Z) => {
1845
- const T = K(Z);
1846
- T && (n(!1), y(T), m(!0));
1845
+ const L = K(Z);
1846
+ L && (n(!1), v(L), h(!0));
1847
1847
  },
1848
1848
  size: "sm",
1849
1849
  variant: "outline",
@@ -1860,10 +1860,10 @@ function sl({
1860
1860
  if (!V)
1861
1861
  return;
1862
1862
  const Z = V.textContent || V.innerText;
1863
- return navigator.clipboard.writeText(Z).then(() => console.log("Text copied to clipboard")).catch((T) => console.error("Error in copying text: ", T)), Z;
1863
+ return navigator.clipboard.writeText(Z).then(() => console.log("Text copied to clipboard")).catch((L) => console.error("Error in copying text: ", L)), Z;
1864
1864
  }
1865
1865
  function ie() {
1866
- return u == null ? void 0 : u.map((w, V) => w.role === "user" ? /* @__PURE__ */ e.jsxs(
1866
+ return m == null ? void 0 : m.map((w, V) => w.role === "user" ? /* @__PURE__ */ e.jsxs(
1867
1867
  "div",
1868
1868
  {
1869
1869
  className: "flex items-start rounded-md bg-muted p-3 text-sm",
@@ -1878,12 +1878,12 @@ function sl({
1878
1878
  {
1879
1879
  className: "w-full overflow-auto py-1",
1880
1880
  components: le,
1881
- children: j == null ? void 0 : j.response.replace(/DuckDB/gi, "Semaphor")
1881
+ children: g == null ? void 0 : g.response.replace(/DuckDB/gi, "Semaphor")
1882
1882
  },
1883
1883
  V
1884
1884
  ) : /* @__PURE__ */ e.jsx("div", {}, V));
1885
1885
  }
1886
- return /* @__PURE__ */ e.jsxs(Cs, { open: s, onOpenChange: n, children: [
1886
+ return /* @__PURE__ */ e.jsxs(Ns, { open: s, onOpenChange: n, children: [
1887
1887
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1888
1888
  F,
1889
1889
  {
@@ -1900,7 +1900,7 @@ function sl({
1900
1900
  children: [
1901
1901
  /* @__PURE__ */ e.jsxs(zs, { children: [
1902
1902
  /* @__PURE__ */ e.jsx(Fs, { children: "Assistant" }),
1903
- /* @__PURE__ */ e.jsx(Ls, { children: "What can I help you with?" })
1903
+ /* @__PURE__ */ e.jsx(Ts, { children: "What can I help you with?" })
1904
1904
  ] }),
1905
1905
  /* @__PURE__ */ e.jsx(
1906
1906
  "div",
@@ -1918,7 +1918,7 @@ function sl({
1918
1918
  ua,
1919
1919
  {
1920
1920
  autoFocus: !0,
1921
- ref: r,
1921
+ ref: i,
1922
1922
  onKeyDown: (w) => {
1923
1923
  w.key === "Enter" && !w.shiftKey && (w.preventDefault(), t(""), R());
1924
1924
  },
@@ -1930,7 +1930,7 @@ function sl({
1930
1930
  className: X(
1931
1931
  "max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
1932
1932
  ),
1933
- disabled: S || v,
1933
+ disabled: S || C,
1934
1934
  value: a,
1935
1935
  onChange: (w) => t(w.target.value)
1936
1936
  }
@@ -1943,7 +1943,7 @@ function sl({
1943
1943
  size: "sm",
1944
1944
  variant: "ghost",
1945
1945
  onClick: R,
1946
- children: !S && !v ? /* @__PURE__ */ e.jsx(ot, {}) : /* @__PURE__ */ e.jsx(Pe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1946
+ children: !S && !C ? /* @__PURE__ */ e.jsx(ot, {}) : /* @__PURE__ */ e.jsx(Pe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1947
1947
  }
1948
1948
  )
1949
1949
  ] })
@@ -1954,13 +1954,13 @@ function sl({
1954
1954
  )
1955
1955
  ] });
1956
1956
  }
1957
- var La = {
1957
+ var Ta = {
1958
1958
  color: void 0,
1959
1959
  size: void 0,
1960
1960
  className: void 0,
1961
1961
  style: void 0,
1962
1962
  attr: void 0
1963
- }, Xs = ge.createContext && /* @__PURE__ */ ge.createContext(La), al = ["attr", "size", "title"];
1963
+ }, Xs = ge.createContext && /* @__PURE__ */ ge.createContext(Ta), al = ["attr", "size", "title"];
1964
1964
  function tl(s, n) {
1965
1965
  if (s == null)
1966
1966
  return {};
@@ -2030,15 +2030,15 @@ function rl(s, n) {
2030
2030
  }
2031
2031
  return (n === "string" ? String : Number)(s);
2032
2032
  }
2033
- function Ta(s) {
2033
+ function La(s) {
2034
2034
  return s && s.map((n, a) => /* @__PURE__ */ ge.createElement(n.tag, ns({
2035
2035
  key: a
2036
- }, n.attr), Ta(n.child)));
2036
+ }, n.attr), La(n.child)));
2037
2037
  }
2038
2038
  function be(s) {
2039
2039
  return (n) => /* @__PURE__ */ ge.createElement(ol, ts({
2040
2040
  attr: ns({}, s.attr)
2041
- }, n), Ta(s.child));
2041
+ }, n), La(s.child));
2042
2042
  }
2043
2043
  function ol(s) {
2044
2044
  var n = (a) => {
@@ -2046,13 +2046,13 @@ function ol(s) {
2046
2046
  attr: t,
2047
2047
  size: l,
2048
2048
  title: o
2049
- } = s, r = tl(s, al), d = l || a.size || "1em", i;
2050
- return a.className && (i = a.className), s.className && (i = (i ? i + " " : "") + s.className), /* @__PURE__ */ ge.createElement("svg", ts({
2049
+ } = s, i = tl(s, al), d = l || a.size || "1em", r;
2050
+ return a.className && (r = a.className), s.className && (r = (r ? r + " " : "") + s.className), /* @__PURE__ */ ge.createElement("svg", ts({
2051
2051
  stroke: "currentColor",
2052
2052
  fill: "currentColor",
2053
2053
  strokeWidth: "0"
2054
- }, a.attr, t, r, {
2055
- className: i,
2054
+ }, a.attr, t, i, {
2055
+ className: r,
2056
2056
  style: ns(ns({
2057
2057
  color: s.color || a.color
2058
2058
  }, a.style), s.style),
@@ -2061,29 +2061,29 @@ function ol(s) {
2061
2061
  xmlns: "http://www.w3.org/2000/svg"
2062
2062
  }), o && /* @__PURE__ */ ge.createElement("title", null, o), s.children);
2063
2063
  };
2064
- return Xs !== void 0 ? /* @__PURE__ */ ge.createElement(Xs.Consumer, null, (a) => n(a)) : n(La);
2064
+ return Xs !== void 0 ? /* @__PURE__ */ ge.createElement(Xs.Consumer, null, (a) => n(a)) : n(Ta);
2065
2065
  }
2066
2066
  function cl(s) {
2067
2067
  return be({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z" }, child: [] }] })(s);
2068
2068
  }
2069
2069
  function dl() {
2070
- const { theme: s } = ut(), n = Be(), a = Be(), [t, l] = E(!1), [o, r] = E(!1), [d, i] = E(!1), [x, h] = E(""), [y, p] = E(!1), { authToken: m } = je();
2071
- z((g) => g.selectedSheetId);
2072
- const f = z((g) => g.dashboard.baseQueries), u = c((g) => g.card), k = z((g) => g.theme), I = c((g) => g.isShowingVisual);
2073
- z((g) => g.onAcceptChanges);
2074
- const D = c(
2075
- (g) => g.selectedConnectionId
2076
- ), N = c(
2077
- (g) => g.selectedDatabaseName
2078
- ), M = c(
2079
- (g) => g.selectedDatamodelId
2070
+ const { theme: s } = ut(), n = Be(), a = Be(), [t, l] = E(!1), [o, i] = E(!1), [d, r] = E(!1), [x, u] = E(""), [v, p] = E(!1), { authToken: h } = je();
2071
+ z((b) => b.selectedSheetId);
2072
+ const f = z((b) => b.dashboard.baseQueries), m = c((b) => b.card), k = z((b) => b.theme), I = c((b) => b.isShowingVisual);
2073
+ z((b) => b.onAcceptChanges);
2074
+ const M = c(
2075
+ (b) => b.selectedConnectionId
2076
+ ), j = c(
2077
+ (b) => b.selectedDatabaseName
2078
+ ), D = c(
2079
+ (b) => b.selectedDatamodelId
2080
2080
  ), A = c(
2081
- (g) => g.selectedSchemaName
2081
+ (b) => b.selectedSchemaName
2082
2082
  );
2083
2083
  z(
2084
- (g) => g.actions.updateFrameCard
2084
+ (b) => b.actions.updateFrameCard
2085
2085
  );
2086
- const j = c((g) => g.selectedTableName), S = c((g) => g.card.sql), v = c((g) => g.card.python), b = ht(S, f), q = c((g) => g.selectedConnectionId), $ = c((g) => g.frame), R = z((g) => g.filterValues), B = c((g) => g.applyFilters), {
2086
+ const g = c((b) => b.selectedTableName), S = c((b) => b.card.sql), C = c((b) => b.card.python), y = ht(S, f), q = c((b) => b.selectedConnectionId), $ = c((b) => b.frame), R = z((b) => b.filterValues), B = c((b) => b.applyFilters), {
2087
2087
  setCardCustomCfg: ee,
2088
2088
  setQueryResultColumns: W,
2089
2089
  setFilterValues: le,
@@ -2092,10 +2092,10 @@ function dl() {
2092
2092
  setQueryError: w,
2093
2093
  setPythonStdOut: V,
2094
2094
  setCardPreferences: Z
2095
- } = c((g) => g.actions), T = c((g) => g.onSave), L = c(
2096
- (g) => g.actions.setApplyFilters
2097
- ), se = c((g) => g.onClose), _ = c((g) => g.actions.setCardData), ae = c((g) => g.actions.setSqlGen), te = c((g) => g.runSql), ke = c((g) => g.actions.setRunSql), ye = c(
2098
- (g) => g.actions.setIsSqlRunning
2095
+ } = c((b) => b.actions), L = c((b) => b.onSave), T = c(
2096
+ (b) => b.actions.setApplyFilters
2097
+ ), se = c((b) => b.onClose), _ = c((b) => b.actions.setCardData), ae = c((b) => b.actions.setSqlGen), te = c((b) => b.runSql), ke = c((b) => b.actions.setRunSql), ye = c(
2098
+ (b) => b.actions.setIsSqlRunning
2099
2099
  ), {
2100
2100
  data: J,
2101
2101
  isLoading: oe,
@@ -2106,14 +2106,14 @@ function dl() {
2106
2106
  status: $s,
2107
2107
  refetch: Ie
2108
2108
  } = re({
2109
- queryKey: [b, v],
2109
+ queryKey: [y, C],
2110
2110
  queryFn: () => Ue(
2111
2111
  "https://semaphor.cloud/api/v1/query",
2112
- (m == null ? void 0 : m.accessToken) || "",
2112
+ (h == null ? void 0 : h.accessToken) || "",
2113
2113
  {
2114
2114
  connection_id: q,
2115
- sql: b,
2116
- python: v === Gs ? "" : v,
2115
+ sql: y,
2116
+ python: C === Gs ? "" : C,
2117
2117
  active_filters: B ? R : []
2118
2118
  }
2119
2119
  ),
@@ -2125,8 +2125,8 @@ function dl() {
2125
2125
  position: "top-center",
2126
2126
  richColors: !0
2127
2127
  }), V((J == null ? void 0 : J.output) || ""), J.records.length > 0)) {
2128
- const { dimensionKeys: g } = gs(J.records);
2129
- W(g);
2128
+ const { dimensionKeys: b } = gs(J.records);
2129
+ W(b);
2130
2130
  }
2131
2131
  }, [J, _, W, V]), Y(() => {
2132
2132
  te && (Ie(), ke(!1));
@@ -2148,59 +2148,59 @@ function dl() {
2148
2148
  function us() {
2149
2149
  K(""), _([]), ae({}), ee(""), Z({});
2150
2150
  }
2151
- const Ge = (g) => {
2152
- a.current = g;
2151
+ const Ge = (b) => {
2152
+ a.current = b;
2153
2153
  };
2154
- function hs(g, C) {
2155
- if (g.length === 0)
2154
+ function hs(b, N) {
2155
+ if (b.length === 0)
2156
2156
  return "";
2157
- if (C) {
2158
- const Fe = g.find((ne) => ne.id === C);
2157
+ if (N) {
2158
+ const Fe = b.find((ne) => ne.id === N);
2159
2159
  if (Fe) {
2160
2160
  const ne = Fe.tabTitle;
2161
2161
  if (ne == "All__Header")
2162
- return g[0].id;
2162
+ return b[0].id;
2163
2163
  if (ne && ne.endsWith("__Header")) {
2164
- const Pa = ne.split("__")[0], Bs = g.find(
2164
+ const Pa = ne.split("__")[0], Bs = b.find(
2165
2165
  (Ua) => Ua.tabTitle === Pa
2166
2166
  );
2167
- return Bs ? Bs.id : g[0].id;
2167
+ return Bs ? Bs.id : b[0].id;
2168
2168
  }
2169
- return C;
2169
+ return N;
2170
2170
  }
2171
2171
  }
2172
- return g[0].id;
2172
+ return b[0].id;
2173
2173
  }
2174
2174
  function ms() {
2175
- let g = S;
2176
- S && !S.includes("{{") && (g = Qn(S), K(g));
2177
- const C = {
2178
- ...u,
2175
+ let b = S;
2176
+ S && !S.includes("{{") && (b = Qn(S), K(b));
2177
+ const N = {
2178
+ ...m,
2179
2179
  lastSelectedSchema: A,
2180
- lastSelectedDatamodelId: M,
2181
- lastSelectedDatabase: N,
2182
- lastSelectedTable: j,
2183
- connectionId: D,
2184
- type: I ? u.type : "table",
2185
- sql: g,
2186
- customCfg: I ? u.customCfg : null
2180
+ lastSelectedDatamodelId: D,
2181
+ lastSelectedDatabase: j,
2182
+ lastSelectedTable: g,
2183
+ connectionId: M,
2184
+ type: I ? m.type : "table",
2185
+ sql: b,
2186
+ customCfg: I ? m.customCfg : null
2187
2187
  }, Fe = $.cards.map(
2188
- (xs) => xs.id === u.id ? C : xs
2188
+ (xs) => xs.id === m.id ? N : xs
2189
2189
  ), ne = {
2190
2190
  ...$,
2191
2191
  cards: Fe,
2192
2192
  activeCardId: hs(Fe, $.activeCardId)
2193
2193
  };
2194
- T == null || T(ne);
2194
+ L == null || L(ne);
2195
2195
  }
2196
2196
  function Ke() {
2197
2197
  se == null || se();
2198
2198
  }
2199
2199
  Y(() => {
2200
- const g = n.current, C = a.current;
2201
- if (g) {
2200
+ const b = n.current, N = a.current;
2201
+ if (b) {
2202
2202
  const Fe = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ne = k === "system" ? Fe : k;
2203
- g.editor.defineTheme("default", {
2203
+ b.editor.defineTheme("default", {
2204
2204
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
2205
2205
  base: ne === "light" ? "vs" : "vs-dark",
2206
2206
  inherit: !0,
@@ -2209,18 +2209,18 @@ function dl() {
2209
2209
  // 'editor.background': activeTheme === 'light' ? '#ffffff' : '#020817',
2210
2210
  "editor.background": ne === "light" ? "#ffffff" : mt("--semaphor-background")
2211
2211
  }
2212
- }), g.editor.setTheme("default");
2212
+ }), b.editor.setTheme("default");
2213
2213
  }
2214
- return C && g && C.addCommand(
2215
- g.KeyMod.Shift | g.KeyCode.Enter,
2214
+ return N && b && N.addCommand(
2215
+ b.KeyMod.Shift | b.KeyCode.Enter,
2216
2216
  function() {
2217
2217
  return console.log("Executing query..."), Ie(), !1;
2218
2218
  }
2219
2219
  ), () => {
2220
2220
  };
2221
2221
  }, [s, k, n.current]);
2222
- function Ve(g) {
2223
- n.current = g;
2222
+ function Ve(b) {
2223
+ n.current = b;
2224
2224
  }
2225
2225
  function We() {
2226
2226
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
@@ -2235,7 +2235,7 @@ function dl() {
2235
2235
  Yn,
2236
2236
  {
2237
2237
  checked: B,
2238
- onCheckedChange: () => L(!B),
2238
+ onCheckedChange: () => T(!B),
2239
2239
  text: "Apply Filters"
2240
2240
  }
2241
2241
  ),
@@ -2243,7 +2243,7 @@ function dl() {
2243
2243
  R && o && /* @__PURE__ */ e.jsx(
2244
2244
  He,
2245
2245
  {
2246
- onClick: () => r(!1),
2246
+ onClick: () => i(!1),
2247
2247
  className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
2248
2248
  }
2249
2249
  )
@@ -2252,10 +2252,10 @@ function dl() {
2252
2252
  _e,
2253
2253
  {
2254
2254
  theme: "default",
2255
- onChange: (g) => {
2256
- if (g)
2255
+ onChange: (b) => {
2256
+ if (b)
2257
2257
  try {
2258
- JSON.parse(g), le(JSON.parse(g));
2258
+ JSON.parse(b), le(JSON.parse(b));
2259
2259
  } catch {
2260
2260
  }
2261
2261
  },
@@ -2285,7 +2285,7 @@ function dl() {
2285
2285
  R && !o && /* @__PURE__ */ e.jsx(
2286
2286
  ta,
2287
2287
  {
2288
- onClick: () => r(!0),
2288
+ onClick: () => i(!0),
2289
2289
  className: X(
2290
2290
  "absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
2291
2291
  {
@@ -2322,8 +2322,8 @@ function dl() {
2322
2322
  {
2323
2323
  theme: "default",
2324
2324
  className: "pt-3",
2325
- onChange: (g) => {
2326
- K(g);
2325
+ onChange: (b) => {
2326
+ K(b);
2327
2327
  },
2328
2328
  value: S,
2329
2329
  options: {
@@ -2369,10 +2369,10 @@ function dl() {
2369
2369
  {
2370
2370
  className: "pt-3",
2371
2371
  theme: "default",
2372
- onChange: (g) => {
2373
- ie(g && g.trim() || "");
2372
+ onChange: (b) => {
2373
+ ie(b && b.trim() || "");
2374
2374
  },
2375
- value: v || Gs,
2375
+ value: C || Gs,
2376
2376
  options: {
2377
2377
  minimap: {
2378
2378
  enabled: !1
@@ -2448,9 +2448,9 @@ function dl() {
2448
2448
  Jn,
2449
2449
  {
2450
2450
  error: ve.message,
2451
- setShowAIDialog: i,
2451
+ setShowAIDialog: r,
2452
2452
  setTriggerAIRun: p,
2453
- setUserInputforAI: h
2453
+ setUserInputforAI: u
2454
2454
  }
2455
2455
  ),
2456
2456
  /* @__PURE__ */ e.jsxs(
@@ -2470,7 +2470,7 @@ function dl() {
2470
2470
  oa,
2471
2471
  {
2472
2472
  pressed: t,
2473
- onPressedChange: (g) => l(g),
2473
+ onPressedChange: (b) => l(b),
2474
2474
  className: "",
2475
2475
  size: "sm",
2476
2476
  variant: "outline",
@@ -2481,11 +2481,11 @@ function dl() {
2481
2481
  sl,
2482
2482
  {
2483
2483
  open: d,
2484
- setOpen: i,
2484
+ setOpen: r,
2485
2485
  userInput: x,
2486
- triggerAIRun: y,
2486
+ triggerAIRun: v,
2487
2487
  setTriggerAIRun: p,
2488
- setUserInput: (g) => h(g)
2488
+ setUserInput: (b) => u(b)
2489
2489
  }
2490
2490
  )
2491
2491
  ] }),
@@ -2525,17 +2525,17 @@ function dl() {
2525
2525
  );
2526
2526
  }
2527
2527
  function ul({ data: s }) {
2528
- var r;
2528
+ var i;
2529
2529
  const [n, a] = ge.useState([]), l = Object.keys(s[0]).map((d) => ({
2530
2530
  // header: key,
2531
2531
  accessorKey: d,
2532
- header: ({ column: i }) => {
2533
- const x = i.getIsSorted();
2532
+ header: ({ column: r }) => {
2533
+ const x = r.getIsSorted();
2534
2534
  return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
2535
2535
  "div",
2536
2536
  {
2537
2537
  className: "flex cursor-pointer items-center",
2538
- onClick: () => i.toggleSorting(i.getIsSorted() === "asc"),
2538
+ onClick: () => r.toggleSorting(r.getIsSorted() === "asc"),
2539
2539
  children: [
2540
2540
  d,
2541
2541
  x === "asc" ? /* @__PURE__ */ e.jsx(pt, { className: "ml-2 h-5 w-5" }) : x === "desc" ? /* @__PURE__ */ e.jsx(ft, { className: "ml-2 h-5 w-5" }) : null
@@ -2546,8 +2546,8 @@ function ul({ data: s }) {
2546
2546
  })), o = gt({
2547
2547
  data: s,
2548
2548
  columns: l,
2549
- getCoreRowModel: Nt(),
2550
- getPaginationRowModel: Ct(),
2549
+ getCoreRowModel: Ct(),
2550
+ getPaginationRowModel: Nt(),
2551
2551
  onSortingChange: a,
2552
2552
  getSortedRowModel: St(),
2553
2553
  manualPagination: !0,
@@ -2556,67 +2556,72 @@ function ul({ data: s }) {
2556
2556
  }
2557
2557
  });
2558
2558
  return /* @__PURE__ */ e.jsxs(jt, { children: [
2559
- /* @__PURE__ */ e.jsx(bt, { children: o.getHeaderGroups().map((d) => /* @__PURE__ */ e.jsx(ps, { children: d.headers.map((i) => /* @__PURE__ */ e.jsx(yt, { className: "sticky top-0 bg-muted", children: i.isPlaceholder ? null : Ks(
2560
- i.column.columnDef.header,
2561
- i.getContext()
2562
- ) }, i.id)) }, d.id)) }),
2563
- /* @__PURE__ */ e.jsx(vt, { children: (r = o.getRowModel().rows) != null && r.length ? o.getRowModel().rows.map((d) => /* @__PURE__ */ e.jsx(
2559
+ /* @__PURE__ */ e.jsx(bt, { children: o.getHeaderGroups().map((d) => /* @__PURE__ */ e.jsx(ps, { children: d.headers.map((r) => /* @__PURE__ */ e.jsx(yt, { className: "sticky top-0 bg-muted", children: r.isPlaceholder ? null : Ks(
2560
+ r.column.columnDef.header,
2561
+ r.getContext()
2562
+ ) }, r.id)) }, d.id)) }),
2563
+ /* @__PURE__ */ e.jsx(vt, { children: (i = o.getRowModel().rows) != null && i.length ? o.getRowModel().rows.map((d) => /* @__PURE__ */ e.jsx(
2564
2564
  ps,
2565
2565
  {
2566
2566
  className: "whitespace-nowrap py-2",
2567
2567
  "data-state": d.getIsSelected() && "selected",
2568
- children: d.getVisibleCells().map((i) => /* @__PURE__ */ e.jsx(Ws, { children: Ks(i.column.columnDef.cell, i.getContext()) }, i.id))
2568
+ children: d.getVisibleCells().map((r) => /* @__PURE__ */ e.jsx(Ws, { children: Ks(r.column.columnDef.cell, r.getContext()) }, r.id))
2569
2569
  },
2570
2570
  d.id
2571
2571
  )) : /* @__PURE__ */ e.jsx(ps, { children: /* @__PURE__ */ e.jsx(Ws, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2572
2572
  ] });
2573
2573
  }
2574
2574
  function hl({ card: s }) {
2575
- var d, i, x, h, y, p, m, f;
2576
- (d = s.customCardPreferences) != null && d.inputData;
2577
- const { getCard: n } = ha(((i = s.customCardPreferences) == null ? void 0 : i.url) || ""), a = ((x = s.customCardPreferences) == null ? void 0 : x.visualType) || "single", t = c((u) => u.frame);
2578
- if (we(), !((h = s.customCardPreferences) != null && h.componentName))
2575
+ var x, u, v, p, h, f, m, k, I, M;
2576
+ const n = z((j) => j.themeStyle), a = {
2577
+ colors: ((u = (x = n == null ? void 0 : n.chart) == null ? void 0 : x.dataset) == null ? void 0 : u.backgroundColor) || []
2578
+ };
2579
+ (v = s.customCardPreferences) != null && v.inputData;
2580
+ const { getCard: t } = ha(((p = s.customCardPreferences) == null ? void 0 : p.url) || ""), l = ((h = s.customCardPreferences) == null ? void 0 : h.visualType) || "single", o = c((j) => j.frame);
2581
+ if (we(), !((f = s.customCardPreferences) != null && f.componentName))
2579
2582
  return null;
2580
- const l = n(
2581
- (y = s.customCardPreferences) == null ? void 0 : y.componentName
2582
- ), o = (u) => {
2583
- console.log("data", u), s.customCardPreferences;
2583
+ const i = t(
2584
+ (m = s.customCardPreferences) == null ? void 0 : m.componentName
2585
+ ), d = (j) => {
2586
+ console.log("data", j), s.customCardPreferences;
2584
2587
  }, r = Object.keys(
2585
- ((p = s.customCardPreferences) == null ? void 0 : p.dataInputCardIds) || {}
2586
- ).map((u) => {
2587
- var D, N, M;
2588
- const k = (N = (D = s.customCardPreferences) == null ? void 0 : D.dataInputCardIds) == null ? void 0 : N[u].cardId, I = (M = t == null ? void 0 : t.cards) == null ? void 0 : M.find((A) => A.id === k);
2589
- return I || null;
2588
+ ((k = s.customCardPreferences) == null ? void 0 : k.dataInputCardIds) || {}
2589
+ ).map((j) => {
2590
+ var g, S, C;
2591
+ const D = (S = (g = s.customCardPreferences) == null ? void 0 : g.dataInputCardIds) == null ? void 0 : S[j].cardId, A = (C = o == null ? void 0 : o.cards) == null ? void 0 : C.find((y) => y.id === D);
2592
+ return A || null;
2590
2593
  });
2591
2594
  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(
2592
2595
  un,
2593
2596
  {
2594
2597
  fallback: /* @__PURE__ */ e.jsx(e.Fragment, {}),
2595
2598
  children: [
2596
- l && a === "single" && /* @__PURE__ */ e.jsx(
2597
- l,
2599
+ i && l === "single" && /* @__PURE__ */ e.jsx(
2600
+ i,
2598
2601
  {
2599
- settings: (m = s.customCardPreferences) == null ? void 0 : m.settings,
2600
- onDataChange: o,
2602
+ theme: a,
2603
+ settings: (I = s.customCardPreferences) == null ? void 0 : I.settings,
2604
+ onDataChange: d,
2601
2605
  data: s.data
2602
2606
  }
2603
2607
  ),
2604
- l && a === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2605
- l,
2608
+ i && l === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2609
+ i,
2606
2610
  {
2607
- onDataChange: o,
2611
+ theme: a,
2612
+ onDataChange: d,
2608
2613
  settings: r.map(
2609
- (u) => {
2610
- var k;
2611
- return (k = u == null ? void 0 : u.customCardPreferences) == null ? void 0 : k.settings;
2614
+ (j) => {
2615
+ var D;
2616
+ return (D = j == null ? void 0 : j.customCardPreferences) == null ? void 0 : D.settings;
2612
2617
  }
2613
2618
  ),
2614
- data: r.map((u) => (u == null ? void 0 : u.data) || [])
2619
+ data: r.map((j) => (j == null ? void 0 : j.data) || [])
2615
2620
  }
2616
2621
  ) })
2617
2622
  ]
2618
2623
  },
2619
- (f = s.customCardPreferences) == null ? void 0 : f.componentName
2624
+ (M = s.customCardPreferences) == null ? void 0 : M.componentName
2620
2625
  ) });
2621
2626
  }
2622
2627
  function Ia({
@@ -2625,11 +2630,11 @@ function Ia({
2625
2630
  className: s,
2626
2631
  ...n
2627
2632
  }) {
2628
- var y;
2633
+ var v;
2629
2634
  ge.useState(0);
2630
2635
  const a = z((p) => p.themeStyle), t = c((p) => p.card), l = c((p) => p.frame), o = z((p) => p.dashboard.filters);
2631
2636
  z((p) => p.filterValues), c((p) => p.actions.setRunSql);
2632
- const { updateFilter: r } = Ns(), d = o == null ? void 0 : o.find((p) => p.id === l.filterId), i = c((p) => p.actions.setCard);
2637
+ const { updateFilter: i } = Cs(), d = o == null ? void 0 : o.find((p) => p.id === l.filterId), r = c((p) => p.actions.setCard);
2633
2638
  if (Y(() => {
2634
2639
  }, [
2635
2640
  t.data,
@@ -2648,7 +2653,7 @@ function Ia({
2648
2653
  customCfg: t.customCfg,
2649
2654
  preferences: t.preferences
2650
2655
  }));
2651
- function h(p) {
2656
+ function u(p) {
2652
2657
  return /* @__PURE__ */ e.jsx(hl, { card: p });
2653
2658
  }
2654
2659
  return /* @__PURE__ */ e.jsxs(
@@ -2664,7 +2669,7 @@ function Ia({
2664
2669
  Xe,
2665
2670
  {
2666
2671
  text: t.title,
2667
- onSave: (p) => i({ ...t, title: p }),
2672
+ onSave: (p) => r({ ...t, title: p }),
2668
2673
  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(zt, { className: "text-base", children: t.title }) })
2669
2674
  },
2670
2675
  t.title
@@ -2673,7 +2678,7 @@ function Ia({
2673
2678
  Xe,
2674
2679
  {
2675
2680
  text: t.description || "",
2676
- onSave: (p) => i({ ...t, description: p }),
2681
+ onSave: (p) => r({ ...t, description: p }),
2677
2682
  children: /* @__PURE__ */ e.jsxs(Ft, { children: [
2678
2683
  " ",
2679
2684
  t.description
@@ -2688,22 +2693,22 @@ function Ia({
2688
2693
  {
2689
2694
  className: "my-1",
2690
2695
  text: d.title || d.column,
2691
- onSave: (p) => r({ ...d, title: p }),
2696
+ onSave: (p) => i({ ...d, title: p }),
2692
2697
  children: /* @__PURE__ */ e.jsx(H, { children: d.title })
2693
2698
  }
2694
2699
  ),
2695
- Lt(d)
2700
+ Tt(d)
2696
2701
  ] })
2697
2702
  ] }),
2698
- /* @__PURE__ */ e.jsxs(Tt, { className: "flex grow flex-col", children: [
2699
- t.type === "custom" && h(t),
2703
+ /* @__PURE__ */ e.jsxs(Lt, { className: "flex grow flex-col", children: [
2704
+ t.type === "custom" && u(t),
2700
2705
  !["table", "custom"].includes(t.type) && x && // <ChartJsVisual key={visualKey} cfg={cfg} />
2701
2706
  /* @__PURE__ */ e.jsx(
2702
2707
  It,
2703
2708
  {
2704
2709
  cfg: x
2705
2710
  },
2706
- JSON.stringify(x) + JSON.stringify(t.preferences) + ((y = t == null ? void 0 : t.preferences) == null ? void 0 : y.customVisualCode)
2711
+ JSON.stringify(x) + JSON.stringify(t.preferences) + ((v = t == null ? void 0 : t.preferences) == null ? void 0 : v.customVisualCode)
2707
2712
  ),
2708
2713
  t.type === "table" && t.data && t.data.length > 0 && // All of the below css classes are #IMPORTANT for the table to scroll properly
2709
2714
  /* @__PURE__ */ e.jsx(Dt, { className: "flex min-h-0 flex-1 grow basis-0", children: /* @__PURE__ */ e.jsx(Mt, { card: t, data: t == null ? void 0 : t.data }) })
@@ -2713,61 +2718,61 @@ function Ia({
2713
2718
  );
2714
2719
  }
2715
2720
  function ml() {
2716
- const [s, n] = E(!1), [a, t] = E(""), [l, o] = E(""), [r, d] = E(""), [i, x] = E(""), h = c((N) => N.card), y = c(
2717
- (N) => N.card.customCfg
2718
- ), { setCardCustomCfg: p, setCustomVisualCode: m } = we();
2719
- function f(N) {
2720
- var j, S;
2721
- const M = {
2722
- ...N,
2721
+ const [s, n] = E(!1), [a, t] = E(""), [l, o] = E(""), [i, d] = E(""), [r, x] = E(""), u = c((j) => j.card), v = c(
2722
+ (j) => j.card.customCfg
2723
+ ), { setCardCustomCfg: p, setCustomVisualCode: h } = we();
2724
+ function f(j) {
2725
+ var g, S;
2726
+ const D = {
2727
+ ...j,
2723
2728
  data: {
2724
- ...N == null ? void 0 : N.data,
2725
- datasets: (S = (j = N == null ? void 0 : N.data) == null ? void 0 : j.datasets) == null ? void 0 : S.map((v) => ({
2726
- ...v,
2729
+ ...j == null ? void 0 : j.data,
2730
+ datasets: (S = (g = j == null ? void 0 : j.data) == null ? void 0 : g.datasets) == null ? void 0 : S.map((C) => ({
2731
+ ...C,
2727
2732
  data: []
2728
2733
  }))
2729
2734
  }
2730
2735
  };
2731
- return JSON.stringify(M, null, 1);
2736
+ return JSON.stringify(D, null, 1);
2732
2737
  }
2733
- function u() {
2734
- var M, A;
2735
- if (!h.data || h.data.length === 0)
2738
+ function m() {
2739
+ var D, A;
2740
+ if (!u.data || u.data.length === 0)
2736
2741
  return;
2737
- const N = ma({
2738
- data: h.data,
2739
- cardType: h.type,
2740
- cfg: h.cfg,
2741
- preferences: h.preferences
2742
+ const j = ma({
2743
+ data: u.data,
2744
+ cardType: u.type,
2745
+ cfg: u.cfg,
2746
+ preferences: u.preferences
2742
2747
  });
2743
- N && (t(JSON.stringify(N, null, 1)), (M = h == null ? void 0 : h.preferences) != null && M.customVisualCode && d((A = h == null ? void 0 : h.preferences) == null ? void 0 : A.customVisualCode), y && o(JSON.stringify(y, null, 1)));
2748
+ j && (t(JSON.stringify(j, null, 1)), (D = u == null ? void 0 : u.preferences) != null && D.customVisualCode && d((A = u == null ? void 0 : u.preferences) == null ? void 0 : A.customVisualCode), v && o(JSON.stringify(v, null, 1)));
2744
2749
  }
2745
2750
  function k() {
2746
- if (r && m(r), !!l)
2751
+ if (i && h(i), !!l)
2747
2752
  try {
2748
- const N = JSON.parse(l);
2749
- return N ? (p(N), x(""), o(""), N) : void 0;
2750
- } catch (N) {
2751
- console.log(N), x("Invalid JSON");
2753
+ const j = JSON.parse(l);
2754
+ return j ? (p(j), x(""), o(""), j) : void 0;
2755
+ } catch (j) {
2756
+ console.log(j), x("Invalid JSON");
2752
2757
  }
2753
2758
  }
2754
2759
  function I() {
2755
2760
  o(""), p(null);
2756
2761
  }
2757
- function D() {
2758
- let N;
2759
- if (y) {
2760
- const M = Qs.cloneDeep(h.cfg), A = Qs.merge(M, y);
2761
- return N = f(A), N;
2762
+ function M() {
2763
+ let j;
2764
+ if (v) {
2765
+ const D = Qs.cloneDeep(u.cfg), A = Qs.merge(D, v);
2766
+ return j = f(A), j;
2762
2767
  }
2763
- return a ? (N = f(JSON.parse(a)), N) : "";
2768
+ return a ? (j = f(JSON.parse(a)), j) : "";
2764
2769
  }
2765
- return /* @__PURE__ */ e.jsxs(Cs, { open: s, onOpenChange: n, children: [
2770
+ return /* @__PURE__ */ e.jsxs(Ns, { open: s, onOpenChange: n, children: [
2766
2771
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2767
2772
  F,
2768
2773
  {
2769
- onClick: u,
2770
- className: ` ${y && "border-foreground/50 dark:border-foreground/70"}`,
2774
+ onClick: m,
2775
+ className: ` ${v && "border-foreground/50 dark:border-foreground/70"}`,
2771
2776
  size: "sm",
2772
2777
  variant: "outline",
2773
2778
  children: /* @__PURE__ */ e.jsx(Ot, { className: "h-4 w-4" })
@@ -2781,12 +2786,12 @@ function ml() {
2781
2786
  /* @__PURE__ */ e.jsxs(zs, { className: "", children: [
2782
2787
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2783
2788
  /* @__PURE__ */ e.jsx(Fs, { children: "Customize Card" }),
2784
- /* @__PURE__ */ e.jsxs(Ts, { children: [
2789
+ /* @__PURE__ */ e.jsxs(Ls, { children: [
2785
2790
  /* @__PURE__ */ e.jsx(na, { children: /* @__PURE__ */ e.jsx(
2786
2791
  wn,
2787
2792
  {
2788
2793
  onClick: () => {
2789
- navigator.clipboard.writeText(h.id);
2794
+ navigator.clipboard.writeText(u.id);
2790
2795
  },
2791
2796
  className: "size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"
2792
2797
  }
@@ -2794,7 +2799,7 @@ function ml() {
2794
2799
  /* @__PURE__ */ e.jsx(Is, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
2795
2800
  ] })
2796
2801
  ] }),
2797
- /* @__PURE__ */ e.jsxs(Ls, { children: [
2802
+ /* @__PURE__ */ e.jsxs(Ts, { children: [
2798
2803
  "See the configuration options and documentation",
2799
2804
  /* @__PURE__ */ e.jsx(
2800
2805
  "a",
@@ -2812,8 +2817,8 @@ function ml() {
2812
2817
  /* @__PURE__ */ e.jsxs(xa, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
2813
2818
  /* @__PURE__ */ e.jsxs(pa, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
2814
2819
  /* @__PURE__ */ e.jsxs(Ze, { value: "custom-config", children: [
2815
- y && /* @__PURE__ */ e.jsx(fa, { className: "mr-1 h-5 w-5 text-green-600" }),
2816
- y ? "Custom Config" : "Default Config"
2820
+ v && /* @__PURE__ */ e.jsx(fa, { className: "mr-1 h-5 w-5 text-green-600" }),
2821
+ v ? "Custom Config" : "Default Config"
2817
2822
  ] }),
2818
2823
  /* @__PURE__ */ e.jsx(Ze, { className: "", value: "output", children: "Output" }),
2819
2824
  /* @__PURE__ */ e.jsx(Ze, { className: "", value: "custom-code", children: "Custom Code" })
@@ -2856,8 +2861,8 @@ function ml() {
2856
2861
  renderLineHighlight: "none"
2857
2862
  },
2858
2863
  defaultLanguage: "json",
2859
- value: D(),
2860
- onChange: (N) => o(N)
2864
+ value: M(),
2865
+ onChange: (j) => o(j)
2861
2866
  }
2862
2867
  )
2863
2868
  }
@@ -2885,8 +2890,8 @@ function ml() {
2885
2890
  renderLineHighlight: "none"
2886
2891
  },
2887
2892
  defaultLanguage: "javascript",
2888
- value: r,
2889
- onChange: (N) => d(N || "")
2893
+ value: i,
2894
+ onChange: (j) => d(j || "")
2890
2895
  }
2891
2896
  )
2892
2897
  }
@@ -2894,11 +2899,11 @@ function ml() {
2894
2899
  ] })
2895
2900
  ] }),
2896
2901
  /* @__PURE__ */ e.jsxs(aa, { className: "flex items-center", children: [
2897
- /* @__PURE__ */ e.jsx(H, { className: "mr-2 text-red-500", children: i }),
2902
+ /* @__PURE__ */ e.jsx(H, { className: "mr-2 text-red-500", children: r }),
2898
2903
  /* @__PURE__ */ e.jsx(
2899
2904
  F,
2900
2905
  {
2901
- disabled: !y,
2906
+ disabled: !v,
2902
2907
  onClick: I,
2903
2908
  variant: "outline",
2904
2909
  children: "Reset"
@@ -2953,24 +2958,27 @@ function xl({
2953
2958
  var o;
2954
2959
  if (t) {
2955
2960
  const d = (await Promise.all(
2956
- (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.map(async (i) => (await Et(i.value)).visuals.map((y) => ({
2957
- name: y.name,
2958
- icon: y.icon,
2959
- url: i.value
2961
+ (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.map(async (r) => (await Et(r.value)).visuals.map((v) => ({
2962
+ name: v.name,
2963
+ icon: v.icon,
2964
+ url: r.value
2960
2965
  })))
2961
2966
  )).flat();
2962
2967
  a(d);
2963
2968
  }
2964
2969
  })();
2965
- }, [t]), /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: n.map((l, o) => /* @__PURE__ */ e.jsx(
2966
- pl,
2967
- {
2968
- text: l.name,
2969
- onClick: () => s("custom", l),
2970
- icon: l.icon
2971
- },
2972
- l.url + l.name + o
2973
- )) });
2970
+ }, [t]), n.length === 0 ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2971
+ /* @__PURE__ */ e.jsx(Me, { className: "my-2" }),
2972
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: n.map((l, o) => /* @__PURE__ */ e.jsx(
2973
+ pl,
2974
+ {
2975
+ text: l.name,
2976
+ onClick: () => s("custom", l),
2977
+ icon: l.icon
2978
+ },
2979
+ l.url + l.name + o
2980
+ )) })
2981
+ ] });
2974
2982
  }
2975
2983
  const pl = ({
2976
2984
  text: s,
@@ -2980,22 +2988,22 @@ const pl = ({
2980
2988
  const [t, l] = E(null);
2981
2989
  Y(() => {
2982
2990
  n && (async () => {
2983
- const i = (await import("./lucide-react-nEOSuAeg.js"))[n];
2984
- l(i);
2991
+ const r = (await import("./lucide-react-5OzzAy3W.js"))[n];
2992
+ l(r);
2985
2993
  })();
2986
2994
  }, [n]);
2987
2995
  const o = s.charAt(0).toUpperCase();
2988
2996
  return /* @__PURE__ */ e.jsx(F, { onClick: a, title: s, variant: "ghost", children: t ? /* @__PURE__ */ e.jsx(t, { className: "h-4 w-4" }) : o });
2989
2997
  };
2990
2998
  function fl() {
2991
- const [s, n] = E(!1), a = c((x) => x.card.type), { setCardType: t, setCardPreferences: l, setChartOrientation: o } = c((x) => x.actions), { setCardCustomCfg: r, setCustomCardPreferences: d } = we();
2992
- function i(x, h) {
2993
- r(null), l({}), t(x), h && d({
2999
+ const [s, n] = E(!1), a = c((x) => x.card.type), { setCardType: t, setCardPreferences: l, setChartOrientation: o } = c((x) => x.actions), { setCardCustomCfg: i, setCustomCardPreferences: d } = we();
3000
+ function r(x, u) {
3001
+ i(null), l({}), t(x), u && d({
2994
3002
  type: "component",
2995
3003
  visualType: "single",
2996
- url: h.url,
2997
- componentName: h.name,
2998
- icon: h.icon
3004
+ url: u.url,
3005
+ componentName: u.name,
3006
+ icon: u.icon
2999
3007
  }), n(!1);
3000
3008
  }
3001
3009
  return /* @__PURE__ */ e.jsxs(is, { open: s, onOpenChange: n, children: [
@@ -3005,7 +3013,7 @@ function fl() {
3005
3013
  /* @__PURE__ */ e.jsx(
3006
3014
  F,
3007
3015
  {
3008
- onClick: () => i("bar"),
3016
+ onClick: () => r("bar"),
3009
3017
  className: "font-normal",
3010
3018
  variant: "ghost",
3011
3019
  children: /* @__PURE__ */ e.jsx(qs, { className: "size-5" })
@@ -3014,7 +3022,7 @@ function fl() {
3014
3022
  /* @__PURE__ */ e.jsx(
3015
3023
  F,
3016
3024
  {
3017
- onClick: () => i("line"),
3025
+ onClick: () => r("line"),
3018
3026
  variant: "ghost",
3019
3027
  children: /* @__PURE__ */ e.jsx(Rs, { className: "size-5" })
3020
3028
  }
@@ -3022,7 +3030,7 @@ function fl() {
3022
3030
  /* @__PURE__ */ e.jsx(
3023
3031
  F,
3024
3032
  {
3025
- onClick: () => i("stackedBar"),
3033
+ onClick: () => r("stackedBar"),
3026
3034
  variant: "ghost",
3027
3035
  children: /* @__PURE__ */ e.jsx(Va, { className: "size-5", strokeWidth: 0 })
3028
3036
  }
@@ -3030,7 +3038,7 @@ function fl() {
3030
3038
  /* @__PURE__ */ e.jsx(
3031
3039
  F,
3032
3040
  {
3033
- onClick: () => i("stackedLine"),
3041
+ onClick: () => r("stackedLine"),
3034
3042
  variant: "ghost",
3035
3043
  children: /* @__PURE__ */ e.jsx(Ea, { className: "size-5", strokeWidth: 0 })
3036
3044
  }
@@ -3038,15 +3046,15 @@ function fl() {
3038
3046
  /* @__PURE__ */ e.jsx(
3039
3047
  F,
3040
3048
  {
3041
- onClick: () => i("scatter"),
3049
+ onClick: () => r("scatter"),
3042
3050
  variant: "ghost",
3043
- children: /* @__PURE__ */ e.jsx(Ca, { className: "size-5" })
3051
+ children: /* @__PURE__ */ e.jsx(Na, { className: "size-5" })
3044
3052
  }
3045
3053
  ),
3046
3054
  /* @__PURE__ */ e.jsx(
3047
3055
  F,
3048
3056
  {
3049
- onClick: () => i("bubble"),
3057
+ onClick: () => r("bubble"),
3050
3058
  variant: "ghost",
3051
3059
  children: /* @__PURE__ */ e.jsx(Aa, { className: "size-4" })
3052
3060
  }
@@ -3054,15 +3062,15 @@ function fl() {
3054
3062
  /* @__PURE__ */ e.jsx(
3055
3063
  F,
3056
3064
  {
3057
- onClick: () => i("pie"),
3065
+ onClick: () => r("pie"),
3058
3066
  variant: "ghost",
3059
- children: /* @__PURE__ */ e.jsx(Na, { className: "size-5" })
3067
+ children: /* @__PURE__ */ e.jsx(Ca, { className: "size-5" })
3060
3068
  }
3061
3069
  ),
3062
3070
  /* @__PURE__ */ e.jsx(
3063
3071
  F,
3064
3072
  {
3065
- onClick: () => i("doughnut"),
3073
+ onClick: () => r("doughnut"),
3066
3074
  variant: "ghost",
3067
3075
  children: /* @__PURE__ */ e.jsx(Ma, { className: "size-5", strokeWidth: 1 })
3068
3076
  }
@@ -3070,7 +3078,7 @@ function fl() {
3070
3078
  /* @__PURE__ */ e.jsx(
3071
3079
  F,
3072
3080
  {
3073
- onClick: () => i("radar"),
3081
+ onClick: () => r("radar"),
3074
3082
  variant: "ghost",
3075
3083
  children: /* @__PURE__ */ e.jsx(
3076
3084
  Da,
@@ -3084,7 +3092,7 @@ function fl() {
3084
3092
  /* @__PURE__ */ e.jsx(
3085
3093
  F,
3086
3094
  {
3087
- onClick: () => i("polarArea"),
3095
+ onClick: () => r("polarArea"),
3088
3096
  variant: "ghost",
3089
3097
  children: /* @__PURE__ */ e.jsx(Oa, { className: "size-5" })
3090
3098
  }
@@ -3092,7 +3100,7 @@ function fl() {
3092
3100
  /* @__PURE__ */ e.jsx(
3093
3101
  F,
3094
3102
  {
3095
- onClick: () => i("pyramid"),
3103
+ onClick: () => r("pyramid"),
3096
3104
  variant: "ghost",
3097
3105
  children: /* @__PURE__ */ e.jsx(Ra, { className: "size-5" })
3098
3106
  }
@@ -3100,7 +3108,7 @@ function fl() {
3100
3108
  /* @__PURE__ */ e.jsx(
3101
3109
  F,
3102
3110
  {
3103
- onClick: () => i("range"),
3111
+ onClick: () => r("range"),
3104
3112
  variant: "ghost",
3105
3113
  children: /* @__PURE__ */ e.jsx(va, { className: "size-5" })
3106
3114
  }
@@ -3108,7 +3116,7 @@ function fl() {
3108
3116
  /* @__PURE__ */ e.jsx(
3109
3117
  F,
3110
3118
  {
3111
- onClick: () => i("table"),
3119
+ onClick: () => r("table"),
3112
3120
  variant: "ghost",
3113
3121
  children: /* @__PURE__ */ e.jsx(Ds, { className: "size-5" })
3114
3122
  }
@@ -3116,7 +3124,7 @@ function fl() {
3116
3124
  /* @__PURE__ */ e.jsx(
3117
3125
  F,
3118
3126
  {
3119
- onClick: () => i("kpi"),
3127
+ onClick: () => r("kpi"),
3120
3128
  variant: "ghost",
3121
3129
  children: /* @__PURE__ */ e.jsx(qa, { className: "size-6" })
3122
3130
  }
@@ -3124,7 +3132,7 @@ function fl() {
3124
3132
  /* @__PURE__ */ e.jsx(
3125
3133
  F,
3126
3134
  {
3127
- onClick: () => i("text"),
3135
+ onClick: () => r("text"),
3128
3136
  variant: "ghost",
3129
3137
  children: /* @__PURE__ */ e.jsx(_s, { className: "size-4" })
3130
3138
  }
@@ -3132,14 +3140,13 @@ function fl() {
3132
3140
  /* @__PURE__ */ e.jsx(
3133
3141
  F,
3134
3142
  {
3135
- onClick: () => i("custom"),
3143
+ onClick: () => r("custom"),
3136
3144
  variant: "ghost",
3137
3145
  children: /* @__PURE__ */ e.jsx(wa, { className: "size-4" })
3138
3146
  }
3139
3147
  )
3140
3148
  ] }),
3141
- /* @__PURE__ */ e.jsx(Me, { className: "my-2" }),
3142
- /* @__PURE__ */ e.jsx(xl, { onChartTypeChange: i })
3149
+ /* @__PURE__ */ e.jsx(xl, { onChartTypeChange: r })
3143
3150
  ] })
3144
3151
  ] });
3145
3152
  }
@@ -3150,11 +3157,11 @@ function gl({ chartType: s, className: n }) {
3150
3157
  case "line":
3151
3158
  return /* @__PURE__ */ e.jsx(Rs, { className: n });
3152
3159
  case "pie":
3153
- return /* @__PURE__ */ e.jsx(Na, { className: n });
3160
+ return /* @__PURE__ */ e.jsx(Ca, { className: n });
3154
3161
  case "radar":
3155
3162
  return /* @__PURE__ */ e.jsx(Da, { className: n });
3156
3163
  case "scatter":
3157
- return /* @__PURE__ */ e.jsx(Ca, { className: n });
3164
+ return /* @__PURE__ */ e.jsx(Na, { className: n });
3158
3165
  case "bubble":
3159
3166
  return /* @__PURE__ */ e.jsx(Aa, { className: n });
3160
3167
  case "doughnut":
@@ -3180,13 +3187,13 @@ function gl({ chartType: s, className: n }) {
3180
3187
  }
3181
3188
  }
3182
3189
  function ea() {
3183
- const s = c((j) => j.frame), n = c((j) => j.card), a = c((j) => j.card.data), t = c((j) => j.isShowingVisual), l = c((j) => j.isSqlRunning), o = c((j) => j.queryError), r = c((j) => j.pythonStdOut), d = c((j) => j.actions.setRunSql);
3184
- c((j) => j.onSave), c((j) => j.onClose), c((j) => j.actions.setCardSql), c((j) => j.actions.setCardType), c((j) => j.actions.setSqlGen);
3185
- const { setFrame: i, setCard: x, updateCardInFrame: h } = we();
3190
+ const s = c((g) => g.frame), n = c((g) => g.card), a = c((g) => g.card.data), t = c((g) => g.isShowingVisual), l = c((g) => g.isSqlRunning), o = c((g) => g.queryError), i = c((g) => g.pythonStdOut), d = c((g) => g.actions.setRunSql);
3191
+ c((g) => g.onSave), c((g) => g.onClose), c((g) => g.actions.setCardSql), c((g) => g.actions.setCardType), c((g) => g.actions.setSqlGen);
3192
+ const { setFrame: r, setCard: x, updateCardInFrame: u } = we();
3186
3193
  if (!n)
3187
3194
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3188
- function y() {
3189
- const j = {
3195
+ function v() {
3196
+ const g = {
3190
3197
  id: $e(),
3191
3198
  title: "Title",
3192
3199
  description: "Description",
@@ -3202,118 +3209,118 @@ function ea() {
3202
3209
  sql: "",
3203
3210
  data: []
3204
3211
  };
3205
- p(j);
3212
+ p(g);
3206
3213
  }
3207
- function p(j) {
3214
+ function p(g) {
3208
3215
  const S = {
3209
3216
  ...s,
3210
- cards: [...s.cards, j],
3211
- activeCardId: j.id
3217
+ cards: [...s.cards, g],
3218
+ activeCardId: g.id
3212
3219
  };
3213
- i(S), x(j);
3220
+ r(S), x(g);
3214
3221
  }
3215
- function m() {
3216
- const j = {
3222
+ function h() {
3223
+ const g = {
3217
3224
  ...n,
3218
3225
  id: $e(),
3219
3226
  title: `${n.title} Copy`,
3220
3227
  tabTitle: `${n.tabTitle} Copy`
3221
3228
  };
3222
- p(j);
3229
+ p(g);
3223
3230
  }
3224
- function f(j) {
3225
- const S = s.cards.filter((q) => q.id !== j), v = S[0], b = {
3231
+ function f(g) {
3232
+ const S = s.cards.filter((q) => q.id !== g), C = S[0], y = {
3226
3233
  ...s,
3227
3234
  cards: S,
3228
3235
  // update the active card to the first card in the frame
3229
- activeCardId: v.id
3236
+ activeCardId: C.id
3230
3237
  };
3231
- i(b), x(v);
3238
+ r(y), x(C);
3232
3239
  }
3233
- function u(j) {
3240
+ function m(g) {
3234
3241
  const S = {
3235
3242
  ...s,
3236
- cards: s.cards.map((b) => b.id === n.id ? n : b),
3237
- activeCardId: j
3243
+ cards: s.cards.map((y) => y.id === n.id ? n : y),
3244
+ activeCardId: g
3238
3245
  };
3239
- i(S);
3240
- const v = S.cards.find((b) => b.id === j);
3241
- x(v), v.sql && v.data && v.data.length === 0 && d(!0);
3246
+ r(S);
3247
+ const C = S.cards.find((y) => y.id === g);
3248
+ x(C), C.sql && C.data && C.data.length === 0 && d(!0);
3242
3249
  }
3243
- const k = (j, S) => {
3244
- console.log("handleDragStart", S), j.dataTransfer.setData("tabIndex", S.toString());
3245
- }, I = (j) => {
3246
- j.preventDefault();
3247
- }, D = (j, S) => {
3248
- const v = j.dataTransfer.getData("tabIndex");
3249
- if (v === S.toString())
3250
+ const k = (g, S) => {
3251
+ console.log("handleDragStart", S), g.dataTransfer.setData("tabIndex", S.toString());
3252
+ }, I = (g) => {
3253
+ g.preventDefault();
3254
+ }, M = (g, S) => {
3255
+ const C = g.dataTransfer.getData("tabIndex");
3256
+ if (C === S.toString())
3250
3257
  return;
3251
- const b = Array.from(s.cards), [q] = b.splice(parseInt(v), 1);
3252
- b.splice(S, 0, q), i({ ...s, cards: b });
3258
+ const y = Array.from(s.cards), [q] = y.splice(parseInt(C), 1);
3259
+ y.splice(S, 0, q), r({ ...s, cards: y });
3253
3260
  };
3254
- function N(j, S) {
3255
- return j.cards.length === 1 && (S.displayTab === !0 || S.displayTab === void 0) || j.activeCardId !== S.id && (S.displayTab === !0 || S.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
3261
+ function j(g, S) {
3262
+ return g.cards.length === 1 && (S.displayTab === !0 || S.displayTab === void 0) || g.activeCardId !== S.id && (S.displayTab === !0 || S.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
3256
3263
  "div",
3257
3264
  {
3258
3265
  onClick: () => {
3259
- const v = S.displayTab === void 0 ? !1 : !S.displayTab;
3260
- x({ ...S, displayTab: v }), h({
3266
+ const C = S.displayTab === void 0 ? !1 : !S.displayTab;
3267
+ x({ ...S, displayTab: C }), u({
3261
3268
  ...S,
3262
- displayTab: v
3269
+ displayTab: C
3263
3270
  });
3264
3271
  },
3265
3272
  children: S.displayTab === !0 || S.displayTab === void 0 ? /* @__PURE__ */ e.jsx(yn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e.jsx(bn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
3266
3273
  }
3267
3274
  );
3268
3275
  }
3269
- function M() {
3276
+ function D() {
3270
3277
  return /* @__PURE__ */ e.jsxs(
3271
3278
  xa,
3272
3279
  {
3273
- onValueChange: u,
3280
+ onValueChange: m,
3274
3281
  value: s.activeCardId,
3275
3282
  className: "flex grow flex-col",
3276
3283
  children: [
3277
- s.cards.map((j) => /* @__PURE__ */ e.jsx(es, { className: "mt-0 grow", value: j.id, children: A() }, j.id)),
3284
+ s.cards.map((g) => /* @__PURE__ */ e.jsx(es, { className: "mt-0 grow", value: g.id, children: A() }, g.id)),
3278
3285
  /* @__PURE__ */ e.jsx(pa, { className: "group mx-6 justify-between", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
3279
- s.cards.map((j, S) => /* @__PURE__ */ e.jsx(
3286
+ s.cards.map((g, S) => /* @__PURE__ */ e.jsx(
3280
3287
  Xe,
3281
3288
  {
3282
- text: j.tabTitle || j.title,
3283
- onSave: (v) => {
3284
- x({ ...n, tabTitle: v }), h({ ...n, tabTitle: v });
3289
+ text: g.tabTitle || g.title,
3290
+ onSave: (C) => {
3291
+ x({ ...n, tabTitle: C }), u({ ...n, tabTitle: C });
3285
3292
  },
3286
3293
  children: /* @__PURE__ */ e.jsxs(
3287
3294
  Ze,
3288
3295
  {
3289
3296
  draggable: !0,
3290
- onDragStart: (v) => k(v, S),
3297
+ onDragStart: (C) => k(C, S),
3291
3298
  onDragOver: I,
3292
- onDrop: (v) => D(v, S),
3299
+ onDrop: (C) => M(C, S),
3293
3300
  className: "",
3294
- value: j.id,
3301
+ value: g.id,
3295
3302
  children: [
3296
- N(s, j),
3297
- j.tabTitle || j.title,
3298
- s.activeCardId === j.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
3303
+ j(s, g),
3304
+ g.tabTitle || g.title,
3305
+ s.activeCardId === g.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
3299
3306
  ga,
3300
3307
  {
3301
3308
  className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
3302
- onClick: () => f(j.id)
3309
+ onClick: () => f(g.id)
3303
3310
  }
3304
3311
  )
3305
3312
  ]
3306
3313
  }
3307
3314
  )
3308
3315
  },
3309
- j.id
3316
+ g.id
3310
3317
  )),
3311
3318
  /* @__PURE__ */ e.jsx(
3312
3319
  F,
3313
3320
  {
3314
3321
  className: "ml-1 h-8 px-2 hover:bg-muted-foreground/50",
3315
3322
  variant: "outline",
3316
- onClick: y,
3323
+ onClick: v,
3317
3324
  children: /* @__PURE__ */ e.jsx(ws, { className: "h-4 w-4" })
3318
3325
  }
3319
3326
  ),
@@ -3322,7 +3329,7 @@ function ea() {
3322
3329
  {
3323
3330
  className: "invisible ml-1 h-8 px-2 hover:bg-muted-foreground/50 group-hover:visible",
3324
3331
  variant: "outline",
3325
- onClick: m,
3332
+ onClick: h,
3326
3333
  children: /* @__PURE__ */ e.jsx(pn, { className: "h-4 w-4" })
3327
3334
  }
3328
3335
  )
@@ -3343,8 +3350,8 @@ function ea() {
3343
3350
  ] }),
3344
3351
  /* @__PURE__ */ e.jsx(bl, {})
3345
3352
  ] }),
3346
- t ? M() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
3347
- r && /* @__PURE__ */ e.jsx(jl, {}),
3353
+ t ? D() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
3354
+ i && /* @__PURE__ */ e.jsx(jl, {}),
3348
3355
  n.data && n.data.length > 0 && /* @__PURE__ */ e.jsx(ul, { data: a || [] }),
3349
3356
  o && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: o })
3350
3357
  ] })
@@ -3397,7 +3404,7 @@ function yl({
3397
3404
  className: "flex gap-4",
3398
3405
  defaultValue: s[0].value,
3399
3406
  children: s.map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3400
- /* @__PURE__ */ e.jsx(Le, { value: t.value, id: t.value }),
3407
+ /* @__PURE__ */ e.jsx(Te, { value: t.value, id: t.value }),
3401
3408
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: t.value, children: t.label })
3402
3409
  ] }, t.value))
3403
3410
  }
@@ -3427,111 +3434,111 @@ function Re({
3427
3434
  function vl() {
3428
3435
  var f;
3429
3436
  const s = c(
3430
- (u) => u.card.customCardPreferences
3437
+ (m) => m.card.customCardPreferences
3431
3438
  ), { data: n } = _a(), a = (n == null ? void 0 : n.plugins) || [];
3432
- c((u) => u.card);
3433
- const t = c((u) => u.frame), l = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: o } = we(), { components: r, manifest: d } = ha(
3439
+ c((m) => m.card);
3440
+ const t = c((m) => m.frame), l = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: o } = we(), { components: i, manifest: d } = ha(
3434
3441
  (s == null ? void 0 : s.url) || ""
3435
- ), i = (f = d == null ? void 0 : d.visuals) == null ? void 0 : f.find(
3436
- (u) => u.name === (s == null ? void 0 : s.componentName)
3442
+ ), r = (f = d == null ? void 0 : d.visuals) == null ? void 0 : f.find(
3443
+ (m) => m.name === (s == null ? void 0 : s.componentName)
3437
3444
  );
3438
- function x(u, k) {
3445
+ function x(m, k) {
3439
3446
  if (!s)
3440
3447
  return;
3441
- const D = {
3448
+ const M = {
3442
3449
  ...(s == null ? void 0 : s.dataInputCardIds) || {},
3443
- [u]: {
3450
+ [m]: {
3444
3451
  cardId: k,
3445
3452
  hookRef: null
3446
3453
  }
3447
3454
  };
3448
3455
  o({
3449
3456
  ...s,
3450
- dataInputCardIds: D
3457
+ dataInputCardIds: M
3451
3458
  });
3452
3459
  }
3453
- function h(u) {
3454
- var I, D;
3455
- const k = (I = t == null ? void 0 : t.cards) == null ? void 0 : I.filter((N) => {
3456
- var M;
3457
- return ((M = N == null ? void 0 : N.customCardPreferences) == null ? void 0 : M.visualType) !== "multiple";
3458
- }).map((N) => ({
3459
- value: N.id,
3460
- label: N.tabTitle || N.title
3460
+ function u(m) {
3461
+ var I, M;
3462
+ const k = (I = t == null ? void 0 : t.cards) == null ? void 0 : I.filter((j) => {
3463
+ var D;
3464
+ return ((D = j == null ? void 0 : j.customCardPreferences) == null ? void 0 : D.visualType) !== "multiple";
3465
+ }).map((j) => ({
3466
+ value: j.id,
3467
+ label: j.tabTitle || j.title
3461
3468
  }));
3462
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (D = u == null ? void 0 : u.dataInputs) == null ? void 0 : D.map((N, M) => {
3463
- var A, j;
3469
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (M = m == null ? void 0 : m.dataInputs) == null ? void 0 : M.map((j, D) => {
3470
+ var A, g;
3464
3471
  return /* @__PURE__ */ e.jsxs(
3465
3472
  "div",
3466
3473
  {
3467
3474
  className: "grid grid-cols-10 gap-2",
3468
3475
  children: [
3469
- /* @__PURE__ */ e.jsx("div", { className: "col-span-4 flex items-center", children: N }),
3476
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-4 flex items-center", children: j }),
3470
3477
  /* @__PURE__ */ e.jsx(
3471
3478
  Re,
3472
3479
  {
3473
3480
  className: "col-span-6 h-8 w-full justify-between",
3474
3481
  label: "",
3475
3482
  options: k || [],
3476
- value: ((j = (A = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : A[M]) == null ? void 0 : j.cardId) || "",
3477
- onValueChange: (S) => x(M, S)
3483
+ value: ((g = (A = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : A[D]) == null ? void 0 : g.cardId) || "",
3484
+ onValueChange: (S) => x(D, S)
3478
3485
  }
3479
3486
  )
3480
3487
  ]
3481
3488
  },
3482
- M + Math.random()
3489
+ D + Math.random()
3483
3490
  );
3484
3491
  }) });
3485
3492
  }
3486
- function y(u, k, I = []) {
3487
- var D, N;
3488
- return s ? u === "input" ? /* @__PURE__ */ e.jsx(
3489
- Ce,
3493
+ function v(m, k, I = []) {
3494
+ var M, j;
3495
+ return s ? m === "input" ? /* @__PURE__ */ e.jsx(
3496
+ Ne,
3490
3497
  {
3491
3498
  className: `h-8 w-full ${_t}`,
3492
- value: ((D = s == null ? void 0 : s.settings) == null ? void 0 : D[k]) || "",
3493
- onChange: (M) => {
3499
+ value: ((M = s == null ? void 0 : s.settings) == null ? void 0 : M[k]) || "",
3500
+ onChange: (D) => {
3494
3501
  o({
3495
3502
  ...s,
3496
3503
  settings: {
3497
3504
  ...s == null ? void 0 : s.settings,
3498
- [k]: M.target.value
3505
+ [k]: D.target.value
3499
3506
  }
3500
3507
  });
3501
3508
  }
3502
3509
  },
3503
3510
  k
3504
- ) : u === "select" ? /* @__PURE__ */ e.jsx(
3511
+ ) : m === "select" ? /* @__PURE__ */ e.jsx(
3505
3512
  Re,
3506
3513
  {
3507
3514
  className: "h-8 w-full",
3508
3515
  label: "",
3509
3516
  options: I,
3510
- value: ((N = s == null ? void 0 : s.settings) == null ? void 0 : N[k]) || "",
3511
- onValueChange: (M) => {
3517
+ value: ((j = s == null ? void 0 : s.settings) == null ? void 0 : j[k]) || "",
3518
+ onValueChange: (D) => {
3512
3519
  o({
3513
3520
  ...s,
3514
- settings: { ...s == null ? void 0 : s.settings, [k]: M }
3521
+ settings: { ...s == null ? void 0 : s.settings, [k]: D }
3515
3522
  });
3516
3523
  }
3517
3524
  }
3518
3525
  ) : null : null;
3519
3526
  }
3520
- function p(u) {
3521
- const k = Object.entries((u == null ? void 0 : u.settings) || {});
3522
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: k.map(([I, D]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3523
- /* @__PURE__ */ e.jsx(H, { children: D.title }),
3524
- y(
3525
- D.ui,
3527
+ function p(m) {
3528
+ const k = Object.entries((m == null ? void 0 : m.settings) || {});
3529
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: k.map(([I, M]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3530
+ /* @__PURE__ */ e.jsx(H, { children: M.title }),
3531
+ v(
3532
+ M.ui,
3526
3533
  I,
3527
- D.options
3534
+ M.options
3528
3535
  )
3529
3536
  ] }, I)) });
3530
3537
  }
3531
- function m(u) {
3538
+ function h(m) {
3532
3539
  s && o({
3533
3540
  ...s,
3534
- visualType: u,
3541
+ visualType: m,
3535
3542
  componentName: ""
3536
3543
  });
3537
3544
  }
@@ -3545,12 +3552,12 @@ function vl() {
3545
3552
  label: "",
3546
3553
  options: a,
3547
3554
  value: (s == null ? void 0 : s.url) || "",
3548
- onValueChange: (u) => o({
3555
+ onValueChange: (m) => o({
3549
3556
  ...s || {
3550
3557
  url: "",
3551
3558
  componentName: ""
3552
3559
  },
3553
- url: u
3560
+ url: m
3554
3561
  })
3555
3562
  }
3556
3563
  ) })
@@ -3563,38 +3570,38 @@ function vl() {
3563
3570
  { value: "multiple", label: "Multi-Visual" }
3564
3571
  ],
3565
3572
  value: l,
3566
- onValueChange: m
3573
+ onValueChange: h
3567
3574
  }
3568
3575
  ),
3569
3576
  ((s == null ? void 0 : s.type) === "component" || (s == null ? void 0 : s.type) === void 0) && s && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3570
3577
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3571
3578
  /* @__PURE__ */ e.jsx(H, { children: "Component" }),
3572
- /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: r && /* @__PURE__ */ e.jsx(
3579
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: i && /* @__PURE__ */ e.jsx(
3573
3580
  Re,
3574
3581
  {
3575
3582
  className: "h-8 w-full",
3576
3583
  label: "",
3577
- options: (r == null ? void 0 : r.filter((u) => u.type === l).map((u) => ({
3578
- value: u.name,
3579
- label: u.name
3584
+ options: (i == null ? void 0 : i.filter((m) => m.type === l).map((m) => ({
3585
+ value: m.name,
3586
+ label: m.name
3580
3587
  }))) || [],
3581
3588
  value: s.componentName,
3582
- onValueChange: (u) => {
3583
- console.log("changing value", u), o({
3589
+ onValueChange: (m) => {
3590
+ console.log("changing value", m), o({
3584
3591
  ...s,
3585
- componentName: u
3592
+ componentName: m
3586
3593
  });
3587
3594
  }
3588
3595
  }
3589
3596
  ) })
3590
3597
  ] }),
3591
- i && i.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3598
+ r && r.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3592
3599
  /* @__PURE__ */ e.jsx(H, { children: "Input Mapping" }),
3593
- /* @__PURE__ */ e.jsx("div", { className: "px-2", children: h(i) })
3600
+ /* @__PURE__ */ e.jsx("div", { className: "px-2", children: u(r) })
3594
3601
  ] }),
3595
- i && i.settings && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3602
+ r && r.settings && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3596
3603
  /* @__PURE__ */ e.jsx(H, { children: "Settings" }),
3597
- /* @__PURE__ */ e.jsx("div", { className: "px-2", children: p(i) })
3604
+ /* @__PURE__ */ e.jsx("div", { className: "px-2", children: p(r) })
3598
3605
  ] })
3599
3606
  ] })
3600
3607
  ] });
@@ -3602,27 +3609,27 @@ function vl() {
3602
3609
  function Ae() {
3603
3610
  const [s, n] = E([]);
3604
3611
  c(
3605
- (h) => h.card.cfg
3612
+ (u) => u.card.cfg
3606
3613
  );
3607
- const a = c((h) => h.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: o } = c((h) => h.actions), r = c(
3608
- (h) => h.queryResultColumns
3614
+ const a = c((u) => u.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: o } = c((u) => u.actions), i = c(
3615
+ (u) => u.queryResultColumns
3609
3616
  );
3610
3617
  c(
3611
- (h) => {
3612
- var y;
3613
- return (y = h.card.preferences) == null ? void 0 : y.filterOnClickColumnIndex;
3618
+ (u) => {
3619
+ var v;
3620
+ return (v = u.card.preferences) == null ? void 0 : v.filterOnClickColumnIndex;
3614
3621
  }
3615
3622
  ), Y(() => {
3616
- r && n(new Array(r.length).fill(!1));
3617
- }, [r]);
3618
- function d(h, y) {
3619
- var p, m;
3620
- y ? a != null && a.onClickFilter && ((p = a == null ? void 0 : a.onClickFilter) == null ? void 0 : p.length) > 0 ? o({
3623
+ i && n(new Array(i.length).fill(!1));
3624
+ }, [i]);
3625
+ function d(u, v) {
3626
+ var p, h;
3627
+ v ? a != null && a.onClickFilter && ((p = a == null ? void 0 : a.onClickFilter) == null ? void 0 : p.length) > 0 ? o({
3621
3628
  ...a,
3622
3629
  onClickFilter: [
3623
3630
  ...a.onClickFilter,
3624
3631
  {
3625
- columnIndex: h,
3632
+ columnIndex: u,
3626
3633
  expression: ""
3627
3634
  }
3628
3635
  ]
@@ -3630,39 +3637,39 @@ function Ae() {
3630
3637
  ...a,
3631
3638
  onClickFilter: [
3632
3639
  {
3633
- columnIndex: h,
3640
+ columnIndex: u,
3634
3641
  expression: ""
3635
3642
  }
3636
3643
  ]
3637
3644
  }) : (o({
3638
3645
  ...a,
3639
- onClickFilter: (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.filter(
3640
- (f) => f.columnIndex !== h
3646
+ onClickFilter: (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.filter(
3647
+ (f) => f.columnIndex !== u
3641
3648
  )
3642
3649
  }), n((f) => {
3643
- const u = [...f];
3644
- return u[h] = !1, u;
3650
+ const m = [...f];
3651
+ return m[u] = !1, m;
3645
3652
  }));
3646
3653
  }
3647
- function i(h, y) {
3648
- var m;
3649
- const p = (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.map((f) => f.columnIndex === h ? {
3654
+ function r(u, v) {
3655
+ var h;
3656
+ const p = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.map((f) => f.columnIndex === u ? {
3650
3657
  ...f,
3651
- expression: y.target.value
3658
+ expression: v.target.value
3652
3659
  } : f);
3653
3660
  o({
3654
3661
  ...a,
3655
3662
  onClickFilter: p
3656
3663
  });
3657
3664
  }
3658
- function x(h) {
3659
- var y, p, m, f;
3660
- if (s != null && s[h] || (p = (y = a == null ? void 0 : a.onClickFilter) == null ? void 0 : y.find((u) => u.columnIndex === h)) != null && p.expression)
3665
+ function x(u) {
3666
+ var v, p, h, f;
3667
+ if (s != null && s[u] || (p = (v = a == null ? void 0 : a.onClickFilter) == null ? void 0 : v.find((m) => m.columnIndex === u)) != null && p.expression)
3661
3668
  return /* @__PURE__ */ e.jsx(
3662
- Ce,
3669
+ Ne,
3663
3670
  {
3664
- value: (f = (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.find((u) => u.columnIndex === h)) == null ? void 0 : f.expression,
3665
- onChange: (u) => i(h, u),
3671
+ value: (f = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find((m) => m.columnIndex === u)) == null ? void 0 : f.expression,
3672
+ onChange: (m) => r(u, m),
3666
3673
  type: "text",
3667
3674
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
3668
3675
  placeholder: "Expression"
@@ -3671,8 +3678,8 @@ function Ae() {
3671
3678
  }
3672
3679
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3673
3680
  /* @__PURE__ */ e.jsx(H, { children: "On Click" }),
3674
- r == null ? void 0 : r.map((h, y) => {
3675
- var p, m;
3681
+ i == null ? void 0 : i.map((u, v) => {
3682
+ var p, h;
3676
3683
  return /* @__PURE__ */ e.jsx(
3677
3684
  "div",
3678
3685
  {
@@ -3683,64 +3690,64 @@ function Ae() {
3683
3690
  ls,
3684
3691
  {
3685
3692
  checked: !!((p = a == null ? void 0 : a.onClickFilter) != null && p.find(
3686
- (f) => f.columnIndex === y
3693
+ (f) => f.columnIndex === v
3687
3694
  )),
3688
- onCheckedChange: (f) => d(y, f)
3695
+ onCheckedChange: (f) => d(v, f)
3689
3696
  }
3690
3697
  ),
3691
3698
  /* @__PURE__ */ e.jsx(
3692
3699
  "label",
3693
3700
  {
3694
3701
  className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
3695
- children: h
3702
+ children: u
3696
3703
  }
3697
3704
  ),
3698
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.find(
3699
- (f) => f.columnIndex === y
3705
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find(
3706
+ (f) => f.columnIndex === v
3700
3707
  )) && /* @__PURE__ */ e.jsx(
3701
3708
  Sa,
3702
3709
  {
3703
3710
  onClick: () => {
3704
3711
  n((f) => {
3705
- const u = [...f];
3706
- return u[y] = !f[y], u;
3712
+ const m = [...f];
3713
+ return m[v] = !f[v], m;
3707
3714
  });
3708
3715
  },
3709
3716
  className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
3710
3717
  }
3711
3718
  ) })
3712
3719
  ] }),
3713
- x(y)
3720
+ x(v)
3714
3721
  ] })
3715
3722
  },
3716
- h
3723
+ u
3717
3724
  );
3718
3725
  })
3719
3726
  ] });
3720
3727
  }
3721
3728
  function ds() {
3722
- var r, d, i;
3729
+ var i, d, r;
3723
3730
  const s = c((x) => x.card.preferences), n = c(
3724
3731
  (x) => x.card.cfg
3725
3732
  ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: l } = c((x) => x.actions);
3726
- (r = n == null ? void 0 : n.options) != null && r.indexAxis;
3733
+ (i = n == null ? void 0 : n.options) != null && i.indexAxis;
3727
3734
  function o(x) {
3728
3735
  l(x);
3729
3736
  }
3730
3737
  return /* @__PURE__ */ e.jsxs(
3731
3738
  cs,
3732
3739
  {
3733
- value: ((d = s == null ? void 0 : s.chartOptions) == null ? void 0 : d.indexAxis) || ((i = n == null ? void 0 : n.options) == null ? void 0 : i.indexAxis) || "x",
3740
+ value: ((d = s == null ? void 0 : s.chartOptions) == null ? void 0 : d.indexAxis) || ((r = n == null ? void 0 : n.options) == null ? void 0 : r.indexAxis) || "x",
3734
3741
  onValueChange: o,
3735
3742
  className: "flex gap-3",
3736
3743
  defaultValue: "x",
3737
3744
  children: [
3738
3745
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3739
- /* @__PURE__ */ e.jsx(Le, { value: "x", id: "r1" }),
3746
+ /* @__PURE__ */ e.jsx(Te, { value: "x", id: "r1" }),
3740
3747
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Vertical" })
3741
3748
  ] }),
3742
3749
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3743
- /* @__PURE__ */ e.jsx(Le, { value: "y", id: "r2" }),
3750
+ /* @__PURE__ */ e.jsx(Te, { value: "y", id: "r2" }),
3744
3751
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Horizontal" })
3745
3752
  ] })
3746
3753
  ]
@@ -3755,38 +3762,38 @@ function sa(s, n) {
3755
3762
  }
3756
3763
  function Ha() {
3757
3764
  var le, K, ie, w, V, Z;
3758
- const [s, n] = E(!1), a = c((T) => {
3759
- var L;
3760
- return (L = T.card) == null ? void 0 : L.preferences;
3761
- }), t = c((T) => {
3762
- var L;
3763
- return (L = T.card) == null ? void 0 : L.cfg;
3764
- }), l = ja(a, t), [o, r] = E(
3765
+ const [s, n] = E(!1), a = c((L) => {
3766
+ var T;
3767
+ return (T = L.card) == null ? void 0 : T.preferences;
3768
+ }), t = c((L) => {
3769
+ var T;
3770
+ return (T = L.card) == null ? void 0 : T.cfg;
3771
+ }), l = ja(a, t), [o, i] = E(
3765
3772
  sa(a)
3766
- ), [d, i] = E(
3773
+ ), [d, r] = E(
3767
3774
  ((ie = (K = (le = a == null ? void 0 : a.chartOptions) == null ? void 0 : le.scales) == null ? void 0 : K[l]) == null ? void 0 : ie.min) || ""
3768
- ), [x, h] = E(
3775
+ ), [x, u] = E(
3769
3776
  ((Z = (V = (w = a == null ? void 0 : a.chartOptions) == null ? void 0 : w.scales) == null ? void 0 : V[l]) == null ? void 0 : Z.max) || ""
3770
- ), [y, p] = E(d || x ? "custom" : "auto"), [m, f] = E(""), [u, k] = E(0), [I, D] = E(""), [N, M] = E(""), [A, j] = E(""), S = c(
3771
- (T) => T.actions.setCardPreferences
3772
- ), { updateCardInFrame: v } = we(), b = c((T) => T.card), q = c((T) => {
3773
- var L;
3774
- return (L = T.card) == null ? void 0 : L.type;
3777
+ ), [v, p] = E(d || x ? "custom" : "auto"), [h, f] = E(""), [m, k] = E(0), [I, M] = E(""), [j, D] = E(""), [A, g] = E(""), S = c(
3778
+ (L) => L.actions.setCardPreferences
3779
+ ), { updateCardInFrame: C } = we(), y = c((L) => L.card), q = c((L) => {
3780
+ var T;
3781
+ return (T = L.card) == null ? void 0 : T.type;
3775
3782
  }), $ = ["pie", "doughnut", "polarArea"].includes(q);
3776
3783
  Y(() => {
3777
- var T, L, se, _, ae, te, ke, ye, J, oe, ce, ze, de, ve;
3778
- r(sa(a)), i(
3779
- ((se = (L = (T = a == null ? void 0 : a.chartOptions) == null ? void 0 : T.scales) == null ? void 0 : L[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3780
- ), h(((te = (ae = (_ = a == null ? void 0 : a.chartOptions) == null ? void 0 : _.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), f(
3784
+ var L, T, se, _, ae, te, ke, ye, J, oe, ce, ze, de, ve;
3785
+ i(sa(a)), r(
3786
+ ((se = (T = (L = a == null ? void 0 : a.chartOptions) == null ? void 0 : L.scales) == null ? void 0 : T[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3787
+ ), u(((te = (ae = (_ = a == null ? void 0 : a.chartOptions) == null ? void 0 : _.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), f(
3781
3788
  ((oe = (J = (ye = (ke = a == null ? void 0 : a.chartOptions) == null ? void 0 : ke.scales) == null ? void 0 : ye[l]) == null ? void 0 : J.ticks) == null ? void 0 : oe.stepSize) || ""
3782
- ), k(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.decimalPlaces) || 0), D(((ze = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ze.suffix) || ""), M(((de = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : de.currency) || ""), j(((ve = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ve.locale) || "");
3789
+ ), k(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.decimalPlaces) || 0), M(((ze = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ze.suffix) || ""), D(((de = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : de.currency) || ""), g(((ve = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ve.locale) || "");
3783
3790
  }, [s, a, l]);
3784
- function R(T, L) {
3785
- return L === "" || /^[0-9\b]+$/.test(L) ? Number(L) : Number(T);
3791
+ function R(L, T) {
3792
+ return T === "" || /^[0-9\b]+$/.test(T) ? Number(T) : Number(L);
3786
3793
  }
3787
3794
  function B() {
3788
- const T = [
3789
- ...new Set(as.map((L) => L.currency))
3795
+ const L = [
3796
+ ...new Set(as.map((T) => T.currency))
3790
3797
  ];
3791
3798
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3792
3799
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-6 items-center gap-2", children: [
@@ -3808,19 +3815,19 @@ function Ha() {
3808
3815
  /* @__PURE__ */ e.jsxs(
3809
3816
  he,
3810
3817
  {
3811
- value: N || "none",
3812
- onValueChange: (L) => M(L === "none" ? "" : L),
3818
+ value: j || "none",
3819
+ onValueChange: (T) => D(T === "none" ? "" : T),
3813
3820
  children: [
3814
3821
  /* @__PURE__ */ e.jsx(me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
3815
3822
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3816
3823
  /* @__PURE__ */ e.jsx(fe, { children: "Currency" }),
3817
3824
  /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }),
3818
- T.map((L) => /* @__PURE__ */ e.jsx(Q, { value: L, children: L }, L))
3825
+ L.map((T) => /* @__PURE__ */ e.jsx(Q, { value: T, children: T }, T))
3819
3826
  ] }) })
3820
3827
  ]
3821
3828
  }
3822
3829
  ),
3823
- /* @__PURE__ */ e.jsxs(he, { value: A, onValueChange: (L) => j(L), children: [
3830
+ /* @__PURE__ */ e.jsxs(he, { value: A, onValueChange: (T) => g(T), children: [
3824
3831
  /* @__PURE__ */ e.jsx(
3825
3832
  me,
3826
3833
  {
@@ -3830,17 +3837,17 @@ function Ha() {
3830
3837
  ),
3831
3838
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3832
3839
  /* @__PURE__ */ e.jsx(fe, { children: "Locale" }),
3833
- as.map((L) => /* @__PURE__ */ e.jsx(Q, { value: L.locale, children: L.locale }, L.locale))
3840
+ as.map((T) => /* @__PURE__ */ e.jsx(Q, { value: T.locale, children: T.locale }, T.locale))
3834
3841
  ] }) })
3835
3842
  ] })
3836
3843
  ] }),
3837
3844
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-9 items-center gap-2", children: [
3838
3845
  /* @__PURE__ */ e.jsx(H, { className: "col-span-3", htmlFor: "format", children: "Decimals" }),
3839
3846
  /* @__PURE__ */ e.jsx(
3840
- Ce,
3847
+ Ne,
3841
3848
  {
3842
- value: u,
3843
- onChange: (L) => k(Number(L.target.value)),
3849
+ value: m,
3850
+ onChange: (T) => k(Number(T.target.value)),
3844
3851
  id: "format",
3845
3852
  className: `col-span-6 h-8 w-full tracking-wide ${Je}`
3846
3853
  }
@@ -3853,19 +3860,19 @@ function Ha() {
3853
3860
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
3854
3861
  /* @__PURE__ */ e.jsx(H, { htmlFor: "range", children: "Range" }),
3855
3862
  /* @__PURE__ */ e.jsx(
3856
- Ce,
3863
+ Ne,
3857
3864
  {
3858
3865
  id: "min",
3859
3866
  value: d,
3860
- onChange: (T) => i((L) => R(L, T.target.value)),
3867
+ onChange: (L) => r((T) => R(T, L.target.value)),
3861
3868
  className: `col-span-1 h-8 w-full ${Je}`
3862
3869
  }
3863
3870
  ),
3864
3871
  /* @__PURE__ */ e.jsx(
3865
- Ce,
3872
+ Ne,
3866
3873
  {
3867
3874
  value: x,
3868
- onChange: (T) => h((L) => R(L, T.target.value)),
3875
+ onChange: (L) => u((T) => R(T, L.target.value)),
3869
3876
  id: "max",
3870
3877
  className: `col-span-1 h-8 w-full ${Je}`
3871
3878
  }
@@ -3874,10 +3881,10 @@ function Ha() {
3874
3881
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
3875
3882
  /* @__PURE__ */ e.jsx(H, { htmlFor: "step-size", children: "Step Size" }),
3876
3883
  /* @__PURE__ */ e.jsx(
3877
- Ce,
3884
+ Ne,
3878
3885
  {
3879
- value: m,
3880
- onChange: (T) => f((L) => R(L, T.target.value)),
3886
+ value: h,
3887
+ onChange: (L) => f((T) => R(T, L.target.value)),
3881
3888
  id: "step-size",
3882
3889
  className: `col-span-1 h-8 w-full ${Je}`
3883
3890
  }
@@ -3887,15 +3894,15 @@ function Ha() {
3887
3894
  }
3888
3895
  function W() {
3889
3896
  var _;
3890
- let T = {};
3891
- y === "custom" && (T = {
3897
+ let L = {};
3898
+ v === "custom" && (L = {
3892
3899
  min: d,
3893
3900
  max: x,
3894
3901
  ticks: {
3895
- stepSize: m
3902
+ stepSize: h
3896
3903
  }
3897
3904
  });
3898
- const L = {
3905
+ const T = {
3899
3906
  ...a || {},
3900
3907
  chartOptions: {
3901
3908
  ...a == null ? void 0 : a.chartOptions,
@@ -3904,25 +3911,25 @@ function Ha() {
3904
3911
  [l]: {
3905
3912
  // ...cardPreferences?.chartOptions?.scales?.[axis],
3906
3913
  type: o,
3907
- ...o === "linear" ? T : {}
3914
+ ...o === "linear" ? L : {}
3908
3915
  }
3909
3916
  }
3910
3917
  },
3911
3918
  numberAxisFormat: {
3912
- decimalPlaces: u,
3919
+ decimalPlaces: m,
3913
3920
  suffix: I,
3914
- currency: N,
3921
+ currency: j,
3915
3922
  locale: A
3916
3923
  }
3917
3924
  };
3918
- console.log(L), S(L);
3925
+ console.log(T), S(T);
3919
3926
  const se = {
3920
- ...b,
3921
- preferences: L
3927
+ ...y,
3928
+ preferences: T
3922
3929
  };
3923
- v(se);
3930
+ C(se);
3924
3931
  }
3925
- return /* @__PURE__ */ e.jsxs(is, { onOpenChange: (T) => n(T), children: [
3932
+ return /* @__PURE__ */ e.jsxs(is, { onOpenChange: (L) => n(L), children: [
3926
3933
  /* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsx(Ht, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
3927
3934
  /* @__PURE__ */ e.jsx(os, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
3928
3935
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
@@ -3937,7 +3944,7 @@ function Ha() {
3937
3944
  {
3938
3945
  disabled: $,
3939
3946
  value: o,
3940
- onValueChange: (T) => r(T),
3947
+ onValueChange: (L) => i(L),
3941
3948
  children: [
3942
3949
  /* @__PURE__ */ e.jsx(me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
3943
3950
  /* @__PURE__ */ e.jsx(pe, { id: "type", children: /* @__PURE__ */ e.jsxs(Se, { children: [
@@ -3956,24 +3963,24 @@ function Ha() {
3956
3963
  {
3957
3964
  disabled: $,
3958
3965
  id: "scale-option",
3959
- value: y,
3960
- onValueChange: (T) => p(T),
3966
+ value: v,
3967
+ onValueChange: (L) => p(L),
3961
3968
  className: "col-span-2 flex gap-3",
3962
3969
  defaultValue: "x",
3963
3970
  children: [
3964
3971
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3965
- /* @__PURE__ */ e.jsx(Le, { value: "auto", id: "r1" }),
3972
+ /* @__PURE__ */ e.jsx(Te, { value: "auto", id: "r1" }),
3966
3973
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Auto" })
3967
3974
  ] }),
3968
3975
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3969
- /* @__PURE__ */ e.jsx(Le, { value: "custom", id: "r2" }),
3976
+ /* @__PURE__ */ e.jsx(Te, { value: "custom", id: "r2" }),
3970
3977
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Custom" })
3971
3978
  ] })
3972
3979
  ]
3973
3980
  }
3974
3981
  )
3975
3982
  ] }),
3976
- y === "custom" && o == "linear" && ee(),
3983
+ v === "custom" && o == "linear" && ee(),
3977
3984
  B(),
3978
3985
  /* @__PURE__ */ e.jsx($t, {}),
3979
3986
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
@@ -3989,25 +3996,25 @@ function Ha() {
3989
3996
  ] }) })
3990
3997
  ] });
3991
3998
  }
3992
- function Nl({ idx: s }) {
3999
+ function Cl({ idx: s }) {
3993
4000
  var d;
3994
- const n = c((i) => {
4001
+ const n = c((r) => {
3995
4002
  var x;
3996
- return (x = i.card) == null ? void 0 : x.preferences;
4003
+ return (x = r.card) == null ? void 0 : x.preferences;
3997
4004
  }), a = c(
3998
- (i) => {
4005
+ (r) => {
3999
4006
  var x;
4000
- return (x = i.card.preferences) == null ? void 0 : x.datasetOptions;
4007
+ return (x = r.card.preferences) == null ? void 0 : x.datasetOptions;
4001
4008
  }
4002
4009
  ), t = c(
4003
- (i) => i.actions.setCardPreferences
4004
- ), l = (d = n == null ? void 0 : n.chartOptions) == null ? void 0 : d.indexAxis, o = a == null ? void 0 : a.find((i) => i.idx === s);
4005
- function r(i, x) {
4006
- (i === "end" || i === "start") && Bt(Pt());
4007
- const h = {
4008
- display: i !== "none",
4009
- align: i,
4010
- anchor: i,
4010
+ (r) => r.actions.setCardPreferences
4011
+ ), l = (d = n == null ? void 0 : n.chartOptions) == null ? void 0 : d.indexAxis, o = a == null ? void 0 : a.find((r) => r.idx === s);
4012
+ function i(r, x) {
4013
+ (r === "end" || r === "start") && Bt(Pt());
4014
+ const u = {
4015
+ display: r !== "none",
4016
+ align: r,
4017
+ anchor: r,
4011
4018
  clamp: !0
4012
4019
  };
4013
4020
  if (!o)
@@ -4017,15 +4024,15 @@ function Nl({ idx: s }) {
4017
4024
  ...a || [],
4018
4025
  {
4019
4026
  idx: x,
4020
- datalabels: h
4027
+ datalabels: u
4021
4028
  }
4022
4029
  ]
4023
4030
  });
4024
4031
  else {
4025
- const y = { ...o };
4026
- y.datalabels = h;
4032
+ const v = { ...o };
4033
+ v.datalabels = u;
4027
4034
  const p = a == null ? void 0 : a.map(
4028
- (m) => m.idx === x ? y : m
4035
+ (h) => h.idx === x ? v : h
4029
4036
  );
4030
4037
  t({
4031
4038
  ...n,
@@ -4039,7 +4046,7 @@ function Nl({ idx: s }) {
4039
4046
  /* @__PURE__ */ e.jsx(
4040
4047
  F,
4041
4048
  {
4042
- onClick: () => r("none", s),
4049
+ onClick: () => i("none", s),
4043
4050
  size: "sm",
4044
4051
  variant: "secondary",
4045
4052
  className: "h-7 p-1 text-xs font-normal",
@@ -4049,7 +4056,7 @@ function Nl({ idx: s }) {
4049
4056
  /* @__PURE__ */ e.jsx(
4050
4057
  F,
4051
4058
  {
4052
- onClick: () => r("start", s),
4059
+ onClick: () => i("start", s),
4053
4060
  size: "sm",
4054
4061
  variant: "secondary",
4055
4062
  className: "h-7 p-1 text-xs font-normal",
@@ -4066,7 +4073,7 @@ function Nl({ idx: s }) {
4066
4073
  /* @__PURE__ */ e.jsx(
4067
4074
  F,
4068
4075
  {
4069
- onClick: () => r("center", s),
4076
+ onClick: () => i("center", s),
4070
4077
  size: "sm",
4071
4078
  variant: "secondary",
4072
4079
  className: "h-7 p-1 text-xs font-normal",
@@ -4083,7 +4090,7 @@ function Nl({ idx: s }) {
4083
4090
  /* @__PURE__ */ e.jsx(
4084
4091
  F,
4085
4092
  {
4086
- onClick: () => r("end", s),
4093
+ onClick: () => i("end", s),
4087
4094
  size: "sm",
4088
4095
  variant: "secondary",
4089
4096
  className: "h-7 p-1 text-xs font-normal",
@@ -4101,51 +4108,51 @@ function Nl({ idx: s }) {
4101
4108
  ] });
4102
4109
  }
4103
4110
  function $a() {
4104
- const s = c((i) => i.card), n = c(
4105
- (i) => {
4106
- var x, h, y;
4107
- return (y = (h = (x = i == null ? void 0 : i.card) == null ? void 0 : x.preferences) == null ? void 0 : h.chartOptions) == null ? void 0 : y.indexAxis;
4111
+ const s = c((r) => r.card), n = c(
4112
+ (r) => {
4113
+ var x, u, v;
4114
+ return (v = (u = (x = r == null ? void 0 : r.card) == null ? void 0 : x.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : v.indexAxis;
4108
4115
  }
4109
4116
  ), a = n === "y" ? "Y axis" : "X axis", t = n === "y" ? "X axis" : "Y axis", {
4110
4117
  keys: l,
4111
4118
  metricKeys: o,
4112
- dimensionKeys: r
4119
+ dimensionKeys: i
4113
4120
  } = gs(s.data || []);
4114
4121
  let d = o;
4115
4122
  if (["stackedBar", "stackedLine"].includes(s.type)) {
4116
- const i = Ut({
4123
+ const r = Ut({
4117
4124
  dataArray: s.data || [],
4118
- groupKey: r[0],
4119
- pivotKey: r[1],
4125
+ groupKey: i[0],
4126
+ pivotKey: i[1],
4120
4127
  valueKey: d[0]
4121
- }), { metricKeys: x } = gs(i);
4128
+ }), { metricKeys: x } = gs(r);
4122
4129
  d = x;
4123
4130
  }
4124
4131
  return l.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4125
4132
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4126
4133
  /* @__PURE__ */ e.jsx(H, { children: a }),
4127
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: r[0] }) }) })
4134
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: i[0] }) }) })
4128
4135
  ] }),
4129
4136
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4130
4137
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
4131
4138
  /* @__PURE__ */ e.jsx(H, { children: t }),
4132
4139
  /* @__PURE__ */ e.jsx(Ha, {})
4133
4140
  ] }),
4134
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: d.map((i, x) => /* @__PURE__ */ e.jsx(Cl, { col: i, idx: x }, i)) })
4141
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: d.map((r, x) => /* @__PURE__ */ e.jsx(Nl, { col: r, idx: x }, r)) })
4135
4142
  ] })
4136
4143
  ] });
4137
4144
  }
4138
- function Cl({ col: s, idx: n }) {
4145
+ function Nl({ col: s, idx: n }) {
4139
4146
  const a = c((d) => {
4140
- var i;
4141
- return (i = d.card) == null ? void 0 : i.preferences;
4147
+ var r;
4148
+ return (r = d.card) == null ? void 0 : r.preferences;
4142
4149
  }), t = c(
4143
4150
  (d) => {
4144
- var i;
4145
- return (i = d.card.preferences) == null ? void 0 : i.datasetOptions;
4151
+ var r;
4152
+ return (r = d.card.preferences) == null ? void 0 : r.datasetOptions;
4146
4153
  }
4147
4154
  ), l = t == null ? void 0 : t.find((d) => d.idx === n), { setCardPreferences: o } = c((d) => d.actions);
4148
- function r(d) {
4155
+ function i(d) {
4149
4156
  if (!l)
4150
4157
  o({
4151
4158
  ...a,
@@ -4159,10 +4166,10 @@ function Cl({ col: s, idx: n }) {
4159
4166
  ]
4160
4167
  });
4161
4168
  else {
4162
- const i = { ...l };
4163
- i.type = d === "area" ? "line" : d, i.fill = d === "area" ? "origin" : "";
4169
+ const r = { ...l };
4170
+ r.type = d === "area" ? "line" : d, r.fill = d === "area" ? "origin" : "";
4164
4171
  const x = t == null ? void 0 : t.map(
4165
- (h) => h.idx === n ? i : h
4172
+ (u) => u.idx === n ? r : u
4166
4173
  );
4167
4174
  o({
4168
4175
  ...a,
@@ -4176,21 +4183,21 @@ function Cl({ col: s, idx: n }) {
4176
4183
  /* @__PURE__ */ e.jsx(
4177
4184
  qs,
4178
4185
  {
4179
- onClick: () => r("bar"),
4186
+ onClick: () => i("bar"),
4180
4187
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4181
4188
  }
4182
4189
  ),
4183
4190
  /* @__PURE__ */ e.jsx(
4184
4191
  Rs,
4185
4192
  {
4186
- onClick: () => r("line"),
4193
+ onClick: () => i("line"),
4187
4194
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4188
4195
  }
4189
4196
  ),
4190
4197
  /* @__PURE__ */ e.jsx(
4191
4198
  mn,
4192
4199
  {
4193
- onClick: () => r("area"),
4200
+ onClick: () => i("area"),
4194
4201
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4195
4202
  }
4196
4203
  ),
@@ -4201,37 +4208,37 @@ function Cl({ col: s, idx: n }) {
4201
4208
  className: "invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"
4202
4209
  }
4203
4210
  ),
4204
- /* @__PURE__ */ e.jsx(Nl, { idx: n })
4211
+ /* @__PURE__ */ e.jsx(Cl, { idx: n })
4205
4212
  ] })
4206
4213
  ] });
4207
4214
  }
4208
4215
  function Ba() {
4209
- const s = c((p) => p.selectedConnectionId), n = c((p) => p.selectedDatamodelId), a = c((p) => p.selectedDatabaseName), t = c((p) => p.selectedSchemaName), l = c((p) => p.selectedTableName), o = z((p) => p.dashboard.filters) || [], r = z((p) => p.actions.addFilter), d = z((p) => p.actions.removeFilter), i = z(
4216
+ const s = c((p) => p.selectedConnectionId), n = c((p) => p.selectedDatamodelId), a = c((p) => p.selectedDatabaseName), t = c((p) => p.selectedSchemaName), l = c((p) => p.selectedTableName), o = z((p) => p.dashboard.filters) || [], i = z((p) => p.actions.addFilter), d = z((p) => p.actions.removeFilter), r = z(
4210
4217
  (p) => p.actions.removeFilterValue
4211
- ), { modelItems: x, tableName: h } = Oe();
4212
- function y(p, m = "dashboard") {
4213
- var j;
4214
- const f = ue(p.column_name), u = ue(a || ""), k = ue(t || ""), I = ue(h);
4215
- let D = ca(
4218
+ ), { modelItems: x, tableName: u } = Oe();
4219
+ function v(p, h = "dashboard") {
4220
+ var g;
4221
+ const f = ue(p.column_name), m = ue(a || ""), k = ue(t || ""), I = ue(u);
4222
+ let M = ca(
4216
4223
  k,
4217
4224
  I
4218
- ), N = `${D}.${f}`;
4219
- const M = (j = x == null ? void 0 : x.find(
4225
+ ), j = `${M}.${f}`;
4226
+ const D = (g = x == null ? void 0 : x.find(
4220
4227
  (S) => S.id === n
4221
- )) == null ? void 0 : j.name;
4222
- n && n !== "none" && (N = `${fs}.${M}.${f}`, D = `${fs}.${M}`);
4228
+ )) == null ? void 0 : g.name;
4229
+ n && n !== "none" && (j = `${fs}.${D}.${f}`, M = `${fs}.${D}`);
4223
4230
  const A = o == null ? void 0 : o.find(
4224
- (S) => S.column === N && S.table === I && (S.database === u || S.database === a)
4231
+ (S) => S.column === j && S.table === I && (S.database === m || S.database === a)
4225
4232
  );
4226
4233
  if (A)
4227
- i(A.id), d(A.id);
4234
+ r(A.id), d(A.id);
4228
4235
  else {
4229
4236
  const S = $e();
4230
- return h === "api" && s ? (r({
4231
- location: m,
4237
+ return u === "api" && s ? (i({
4238
+ location: h,
4232
4239
  id: S,
4233
4240
  //uuidv4(),
4234
- column: N,
4241
+ column: j,
4235
4242
  title: p.column_name,
4236
4243
  dataType: p.data_type,
4237
4244
  table: "api",
@@ -4241,15 +4248,15 @@ function Ba() {
4241
4248
  operation: "in",
4242
4249
  sql: Js(
4243
4250
  p.data_type,
4244
- D,
4251
+ M,
4245
4252
  f
4246
4253
  )
4247
4254
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4248
- }), S) : (r({
4255
+ }), S) : (i({
4249
4256
  id: S,
4250
4257
  //uuidv4(),
4251
- location: m,
4252
- column: N,
4258
+ location: h,
4259
+ column: j,
4253
4260
  //columnName, //`${qualifiedTableName}.${formattedColumnName}`,
4254
4261
  title: p.column_name,
4255
4262
  dataType: p.data_type,
@@ -4259,35 +4266,35 @@ function Ba() {
4259
4266
  operation: "in",
4260
4267
  sql: Js(
4261
4268
  p.data_type,
4262
- D,
4269
+ M,
4263
4270
  f
4264
4271
  )
4265
4272
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4266
4273
  }), S);
4267
4274
  }
4268
4275
  }
4269
- return { assignFilter: y };
4276
+ return { assignFilter: v };
4270
4277
  }
4271
4278
  function Ee() {
4272
4279
  const s = z(
4273
4280
  (d) => d.dashboard.filters
4274
4281
  ), n = c((d) => d.frame), { setFrame: a } = we(), { columns: t } = Oe(), { assignFilter: l } = Ba();
4275
4282
  function o(d) {
4276
- const i = l(d, "frame");
4277
- a({ ...n, filterId: i });
4283
+ const r = l(d, "frame");
4284
+ a({ ...n, filterId: r });
4278
4285
  }
4279
- const r = s == null ? void 0 : s.find((d) => d.id === n.filterId);
4286
+ const i = s == null ? void 0 : s.find((d) => d.id === n.filterId);
4280
4287
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
4281
4288
  /* @__PURE__ */ e.jsx(H, { children: "Card Filter" }),
4282
4289
  /* @__PURE__ */ e.jsx(Sl, { onSelect: o, columns: t }),
4283
- r && /* @__PURE__ */ e.jsx(Gt, { filter: r })
4290
+ i && /* @__PURE__ */ e.jsx(Gt, { filter: i })
4284
4291
  ] });
4285
4292
  }
4286
4293
  function Sl({
4287
4294
  columns: s,
4288
4295
  onSelect: n
4289
4296
  }) {
4290
- var r;
4297
+ var i;
4291
4298
  const [a, t] = Ys.useState(!1), [l, o] = Ys.useState("");
4292
4299
  return /* @__PURE__ */ e.jsxs(is, { open: a, onOpenChange: t, children: [
4293
4300
  /* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
@@ -4299,7 +4306,7 @@ function Sl({
4299
4306
  "aria-expanded": a,
4300
4307
  className: "w-full justify-between font-normal",
4301
4308
  children: [
4302
- l ? (r = s.find((d) => d.column_name === l)) == null ? void 0 : r.column_name : "Select Column...",
4309
+ l ? (i = s.find((d) => d.column_name === l)) == null ? void 0 : i.column_name : "Select Column...",
4303
4310
  /* @__PURE__ */ e.jsx(Kt, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
4304
4311
  ]
4305
4312
  }
@@ -4312,8 +4319,8 @@ function Sl({
4312
4319
  Zt,
4313
4320
  {
4314
4321
  value: d.column_name,
4315
- onSelect: (i) => {
4316
- const x = i === l ? "" : i;
4322
+ onSelect: (r) => {
4323
+ const x = r === l ? "" : r;
4317
4324
  o(x), t(!1), x && n(d);
4318
4325
  },
4319
4326
  children: [
@@ -4338,7 +4345,7 @@ function Sl({
4338
4345
  function wl({
4339
4346
  cardType: s
4340
4347
  }) {
4341
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4348
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4342
4349
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4343
4350
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} Chart` }),
4344
4351
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -4381,13 +4388,13 @@ function wl({
4381
4388
  ] }) });
4382
4389
  }
4383
4390
  function Hs() {
4384
- var l, o, r;
4391
+ var l, o, i;
4385
4392
  const s = c(
4386
4393
  (d) => d.card.cfg
4387
4394
  ), n = c((d) => d.actions.setCardCfg), a = c((d) => d.card.type);
4388
4395
  function t(d) {
4389
- var h;
4390
- const i = {
4396
+ var u;
4397
+ const r = {
4391
4398
  datalabels: {
4392
4399
  display: d !== "none",
4393
4400
  align: d,
@@ -4399,8 +4406,8 @@ function Hs() {
4399
4406
  options: {
4400
4407
  ...s == null ? void 0 : s.options,
4401
4408
  plugins: {
4402
- ...(h = s == null ? void 0 : s.options) == null ? void 0 : h.plugins,
4403
- ...i
4409
+ ...(u = s == null ? void 0 : s.options) == null ? void 0 : u.plugins,
4410
+ ...r
4404
4411
  }
4405
4412
  }
4406
4413
  };
@@ -4414,7 +4421,7 @@ function Hs() {
4414
4421
  /* @__PURE__ */ e.jsxs(
4415
4422
  he,
4416
4423
  {
4417
- value: (r = (o = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : o.datalabels) == null ? void 0 : r.anchor,
4424
+ value: (i = (o = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : o.datalabels) == null ? void 0 : i.anchor,
4418
4425
  onValueChange: t,
4419
4426
  defaultValue: "none",
4420
4427
  children: [
@@ -4461,7 +4468,7 @@ function kl({
4461
4468
  ] })
4462
4469
  ] });
4463
4470
  }
4464
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4471
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4465
4472
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4466
4473
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} Chart` }),
4467
4474
  /* @__PURE__ */ e.jsx(G, { className: "space-y-4 font-mono text-xs", children: n(s) })
@@ -4502,16 +4509,16 @@ const zl = {
4502
4509
  }
4503
4510
  ]
4504
4511
  };
4505
- function Ll() {
4512
+ function Tl() {
4506
4513
  const s = c((n) => n.card.type);
4507
4514
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
4508
4515
  /* @__PURE__ */ e.jsx(
4509
- Te,
4516
+ Le,
4510
4517
  {
4511
4518
  className: " ",
4512
4519
  type: "single",
4513
4520
  collapsible: !0,
4514
- children: Tl(s)
4521
+ children: Ll(s)
4515
4522
  }
4516
4523
  ),
4517
4524
  /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(ds, {}) }),
@@ -4522,7 +4529,7 @@ function Ll() {
4522
4529
  ] })
4523
4530
  ] });
4524
4531
  }
4525
- function Tl(s) {
4532
+ function Ll(s) {
4526
4533
  if (["line", "bar"].includes(s))
4527
4534
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4528
4535
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
@@ -4620,52 +4627,52 @@ function Tl(s) {
4620
4627
  ] }) });
4621
4628
  }
4622
4629
  function Il() {
4623
- var i, x, h, y, p;
4624
- const s = c((m) => m.card.preferences), n = c(
4625
- (m) => m.actions.setCardPreferences
4630
+ var r, x, u, v, p;
4631
+ const s = c((h) => h.card.preferences), n = c(
4632
+ (h) => h.actions.setCardPreferences
4626
4633
  ), a = c(
4627
- (m) => m.actions.setNumberFormat
4634
+ (h) => h.actions.setNumberFormat
4628
4635
  );
4629
4636
  c(
4630
- (m) => {
4631
- var f, u;
4632
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.decimalPlaces;
4637
+ (h) => {
4638
+ var f, m;
4639
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.decimalPlaces;
4633
4640
  }
4634
4641
  );
4635
4642
  const t = c(
4636
- (m) => {
4637
- var f, u;
4638
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.locale;
4643
+ (h) => {
4644
+ var f, m;
4645
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.locale;
4639
4646
  }
4640
4647
  ), l = c(
4641
- (m) => {
4642
- var f, u;
4643
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.currency;
4648
+ (h) => {
4649
+ var f, m;
4650
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.currency;
4644
4651
  }
4645
4652
  );
4646
4653
  c(
4647
- (m) => m.actions.setFilterOnClickField
4654
+ (h) => h.actions.setFilterOnClickField
4648
4655
  );
4649
4656
  const o = c(
4650
- (m) => {
4651
- var f, u;
4652
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.colorRanges;
4657
+ (h) => {
4658
+ var f, m;
4659
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.colorRanges;
4653
4660
  }
4654
- ) || [], r = c(
4655
- (m) => m.actions.setColorRanges
4656
- ), d = [...new Set(as.map((m) => m.currency))];
4661
+ ) || [], i = c(
4662
+ (h) => h.actions.setColorRanges
4663
+ ), d = [...new Set(as.map((h) => h.currency))];
4657
4664
  return /* @__PURE__ */ e.jsxs("div", { children: [
4658
4665
  /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
4659
4666
  /* @__PURE__ */ e.jsx(
4660
4667
  ls,
4661
4668
  {
4662
- checked: !!((i = s == null ? void 0 : s.formatNumber) != null && i.enabled),
4663
- onCheckedChange: (m) => {
4669
+ checked: !!((r = s == null ? void 0 : s.formatNumber) != null && r.enabled),
4670
+ onCheckedChange: (h) => {
4664
4671
  n({
4665
4672
  ...s,
4666
4673
  formatNumber: {
4667
4674
  ...s == null ? void 0 : s.formatNumber,
4668
- enabled: m
4675
+ enabled: h
4669
4676
  }
4670
4677
  });
4671
4678
  }
@@ -4682,12 +4689,12 @@ function Il() {
4682
4689
  he,
4683
4690
  {
4684
4691
  value: t || "en-US",
4685
- onValueChange: (m) => {
4686
- var f, u, k;
4692
+ onValueChange: (h) => {
4693
+ var f, m, k;
4687
4694
  return a(
4688
4695
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4689
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.currency) || "",
4690
- m || "en-US",
4696
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.currency) || "",
4697
+ h || "en-US",
4691
4698
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4692
4699
  );
4693
4700
  },
@@ -4695,7 +4702,7 @@ function Il() {
4695
4702
  /* @__PURE__ */ e.jsx(me, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
4696
4703
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
4697
4704
  /* @__PURE__ */ e.jsx(fe, { children: "Format" }),
4698
- as.map((m) => /* @__PURE__ */ e.jsx(Q, { value: m.locale, children: m.locale }, m.locale))
4705
+ as.map((h) => /* @__PURE__ */ e.jsx(Q, { value: h.locale, children: h.locale }, h.locale))
4699
4706
  ] }) })
4700
4707
  ]
4701
4708
  }
@@ -4707,12 +4714,12 @@ function Il() {
4707
4714
  he,
4708
4715
  {
4709
4716
  value: l || "none",
4710
- onValueChange: (m) => {
4711
- var f, u, k;
4717
+ onValueChange: (h) => {
4718
+ var f, m, k;
4712
4719
  return a(
4713
4720
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4714
- m === "none" ? "" : m,
4715
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.locale) || "",
4721
+ h === "none" ? "" : h,
4722
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.locale) || "",
4716
4723
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4717
4724
  );
4718
4725
  },
@@ -4721,7 +4728,7 @@ function Il() {
4721
4728
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
4722
4729
  /* @__PURE__ */ e.jsx(fe, { children: "Currency" }),
4723
4730
  /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }, "none"),
4724
- d.map((m) => /* @__PURE__ */ e.jsx(Q, { value: m, children: m }, m))
4731
+ d.map((h) => /* @__PURE__ */ e.jsx(Q, { value: h, children: h }, h))
4725
4732
  ] }) })
4726
4733
  ]
4727
4734
  }
@@ -4734,19 +4741,19 @@ function Il() {
4734
4741
  /* @__PURE__ */ e.jsxs(
4735
4742
  he,
4736
4743
  {
4737
- value: ((y = (h = s == null ? void 0 : s.formatNumber) == null ? void 0 : h.decimalPlaces) == null ? void 0 : y.toString()) || "0",
4738
- onValueChange: (m) => {
4739
- var f, u, k;
4744
+ value: ((v = (u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.decimalPlaces) == null ? void 0 : v.toString()) || "0",
4745
+ onValueChange: (h) => {
4746
+ var f, m, k;
4740
4747
  return a(
4741
- Number(m),
4748
+ Number(h),
4742
4749
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.currency) || "",
4743
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.locale) || "",
4750
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.locale) || "",
4744
4751
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4745
4752
  );
4746
4753
  },
4747
4754
  children: [
4748
4755
  /* @__PURE__ */ e.jsx(me, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
4749
- /* @__PURE__ */ e.jsx(pe, { children: ["0", "1", "2", "3", "4"].map((m) => /* @__PURE__ */ e.jsx(Q, { value: m, children: m }, m)) })
4756
+ /* @__PURE__ */ e.jsx(pe, { children: ["0", "1", "2", "3", "4"].map((h) => /* @__PURE__ */ e.jsx(Q, { value: h, children: h }, h)) })
4750
4757
  ]
4751
4758
  }
4752
4759
  )
@@ -4754,18 +4761,18 @@ function Il() {
4754
4761
  /* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
4755
4762
  /* @__PURE__ */ e.jsx(H, { children: "Suffix" }),
4756
4763
  /* @__PURE__ */ e.jsx(
4757
- Ce,
4764
+ Ne,
4758
4765
  {
4759
4766
  value: ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.suffix) || "",
4760
4767
  className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
4761
4768
  placeholder: "K, M, B, %",
4762
- onChange: (m) => {
4763
- var f, u, k;
4769
+ onChange: (h) => {
4770
+ var f, m, k;
4764
4771
  return a(
4765
4772
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4766
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.currency) || "",
4773
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.currency) || "",
4767
4774
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.locale) || "",
4768
- m.target.value
4775
+ h.target.value
4769
4776
  );
4770
4777
  }
4771
4778
  }
@@ -4778,7 +4785,7 @@ function Il() {
4778
4785
  en,
4779
4786
  {
4780
4787
  colorRanges: o,
4781
- setColorRanges: r
4788
+ setColorRanges: i
4782
4789
  }
4783
4790
  )
4784
4791
  ] })
@@ -4786,7 +4793,7 @@ function Il() {
4786
4793
  }
4787
4794
  function Dl() {
4788
4795
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
4789
- /* @__PURE__ */ e.jsx(Te, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4796
+ /* @__PURE__ */ e.jsx(Le, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4790
4797
  /* @__PURE__ */ e.jsx(U, { className: "", children: "KPI Query" }),
4791
4798
  /* @__PURE__ */ e.jsxs(G, { className: "font-mono", children: [
4792
4799
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
@@ -4836,11 +4843,11 @@ function Ml() {
4836
4843
  defaultValue: "x",
4837
4844
  children: [
4838
4845
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4839
- /* @__PURE__ */ e.jsx(Le, { value: "static", id: "r1" }),
4846
+ /* @__PURE__ */ e.jsx(Te, { value: "static", id: "r1" }),
4840
4847
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Static" })
4841
4848
  ] }),
4842
4849
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4843
- /* @__PURE__ */ e.jsx(Le, { value: "dynamic", id: "r2" }),
4850
+ /* @__PURE__ */ e.jsx(Te, { value: "dynamic", id: "r2" }),
4844
4851
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Dynamic" })
4845
4852
  ] })
4846
4853
  ]
@@ -4852,7 +4859,7 @@ function Ye({
4852
4859
  docContent: n,
4853
4860
  suffix: a = "Chart"
4854
4861
  }) {
4855
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4862
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4856
4863
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4857
4864
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} ${a}` }),
4858
4865
  /* @__PURE__ */ e.jsx(G, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
@@ -4931,7 +4938,7 @@ function Ol() {
4931
4938
  )
4932
4939
  ] });
4933
4940
  }
4934
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4941
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4935
4942
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4936
4943
  /* @__PURE__ */ e.jsx(U, { children: "Stacked Chart" }),
4937
4944
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -4987,7 +4994,7 @@ function Al({}) {
4987
4994
  });
4988
4995
  };
4989
4996
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
4990
- /* @__PURE__ */ e.jsx(Te, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(P, { value: "item-3", children: [
4997
+ /* @__PURE__ */ e.jsx(Le, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(P, { value: "item-3", children: [
4991
4998
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
4992
4999
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
4993
5000
  /* @__PURE__ */ e.jsx(Ae, {}),
@@ -5094,7 +5101,7 @@ function Rl() {
5094
5101
  case "custom":
5095
5102
  return /* @__PURE__ */ e.jsx(vl, {});
5096
5103
  default:
5097
- return /* @__PURE__ */ e.jsx(Ll, {});
5104
+ return /* @__PURE__ */ e.jsx(Tl, {});
5098
5105
  }
5099
5106
  }
5100
5107
  return /* @__PURE__ */ e.jsx(Es, { className: "h-full w-full text-sm", children: n(s) });
@@ -5146,7 +5153,7 @@ function _l() {
5146
5153
  );
5147
5154
  }
5148
5155
  function Hl({ authToken: s, onSave: n, onClose: a }) {
5149
- const t = c((r) => r.actions.setOnSave), l = c((r) => r.actions.setOnClose), o = z((r) => r.actions.setAuthToken);
5156
+ const t = c((i) => i.actions.setOnSave), l = c((i) => i.actions.setOnClose), o = z((i) => i.actions.setAuthToken);
5150
5157
  return Y(() => {
5151
5158
  n && t(n), a && l(a);
5152
5159
  }, [n, t, a, l]), Y(() => {
@@ -5157,10 +5164,10 @@ function Hl({ authToken: s, onSave: n, onClose: a }) {
5157
5164
  ] }) });
5158
5165
  }
5159
5166
  function $l() {
5160
- z((r) => r.selectedCardId);
5161
- const s = z((r) => r.selectedSheetId), { setIsVisualEditing: n } = z((r) => r.actions), a = z((r) => r.isVisualEditing), t = z((r) => r.actions.updateFrame);
5162
- function l(r) {
5163
- s && (t(s, r), n(!1));
5167
+ z((i) => i.selectedCardId);
5168
+ const s = z((i) => i.selectedSheetId), { setIsVisualEditing: n } = z((i) => i.actions), a = z((i) => i.isVisualEditing), t = z((i) => i.actions.updateFrame);
5169
+ function l(i) {
5170
+ s && (t(s, i), n(!1));
5164
5171
  }
5165
5172
  function o() {
5166
5173
  n(!1);
@@ -5178,22 +5185,22 @@ function $l() {
5178
5185
  );
5179
5186
  }
5180
5187
  function Bl() {
5181
- c((r) => r.selectedConnectionId), c((r) => r.selectedDatamodelId);
5182
- const s = c((r) => r.selectedDatabaseName);
5183
- c((r) => r.selectedSchemaName);
5184
- const n = c((r) => r.selectedTableName), a = z((r) => r.dashboard.filters) || [];
5185
- z((r) => r.actions.addFilter), z((r) => r.actions.removeFilter), z(
5186
- (r) => r.actions.removeFilterValue
5188
+ c((i) => i.selectedConnectionId), c((i) => i.selectedDatamodelId);
5189
+ const s = c((i) => i.selectedDatabaseName);
5190
+ c((i) => i.selectedSchemaName);
5191
+ const n = c((i) => i.selectedTableName), a = z((i) => i.dashboard.filters) || [];
5192
+ z((i) => i.actions.addFilter), z((i) => i.actions.removeFilter), z(
5193
+ (i) => i.actions.removeFilterValue
5187
5194
  );
5188
5195
  const { modelItems: t, columns: l } = Oe(), { assignFilter: o } = Ba();
5189
- return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: l == null ? void 0 : l.map((r) => {
5196
+ return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: l == null ? void 0 : l.map((i) => {
5190
5197
  const d = a == null ? void 0 : a.find(
5191
- (i) => i.column === ue(r.column_name) && i.table === n && i.database === s
5198
+ (r) => r.column === ue(i.column_name) && r.table === n && r.database === s
5192
5199
  );
5193
5200
  return /* @__PURE__ */ e.jsx(
5194
5201
  "div",
5195
5202
  {
5196
- onClick: () => o(r),
5203
+ onClick: () => o(i),
5197
5204
  className: X(
5198
5205
  "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",
5199
5206
  {
@@ -5201,11 +5208,11 @@ function Bl() {
5201
5208
  }
5202
5209
  ),
5203
5210
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
5204
- /* @__PURE__ */ e.jsx(za, { column: r }),
5205
- /* @__PURE__ */ e.jsx("span", { children: r.column_name })
5211
+ /* @__PURE__ */ e.jsx(za, { column: i }),
5212
+ /* @__PURE__ */ e.jsx("span", { children: i.column_name })
5206
5213
  ] })
5207
5214
  },
5208
- r.column_name
5215
+ i.column_name
5209
5216
  );
5210
5217
  }) });
5211
5218
  }
@@ -5327,11 +5334,11 @@ export {
5327
5334
  gn as E,
5328
5335
  _s as F,
5329
5336
  vn as G,
5330
- Nn as H,
5337
+ Cn as H,
5331
5338
  wn as K,
5332
5339
  Pe as L,
5333
- Ln as M,
5334
- Tn as N,
5340
+ Tn as M,
5341
+ Ln as N,
5335
5342
  Sa as P,
5336
5343
  qe as S,
5337
5344
  Vn as T,
@@ -5340,8 +5347,8 @@ export {
5340
5347
  Rs as b,
5341
5348
  _n as c,
5342
5349
  va as d,
5343
- Na as e,
5344
- Ca as f,
5350
+ Ca as e,
5351
+ Na as f,
5345
5352
  ka as g,
5346
5353
  xn as h,
5347
5354
  pn as i,
@@ -5349,7 +5356,7 @@ export {
5349
5356
  jn as k,
5350
5357
  yn as l,
5351
5358
  bn as m,
5352
- Cn as n,
5359
+ Nn as n,
5353
5360
  Sn as o,
5354
5361
  kn as p,
5355
5362
  zn as q,