react-semaphor 0.0.366 → 0.0.368

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,6 +1,6 @@
1
- import { c as _, w as Cs, x as k, y as Re, z as Ie, A as e, B as Ss, H as ws, J as T, p as Qe, K as ks, M as zs, N as Is, Q as ca, R as H, V as oe, W as da, Y as Os, Z as Ds, _ as Ts, $ as ua, a0 as ma, a1 as tt, a2 as Zs, a3 as Z, a4 as Ge, i as nt, a5 as u, a6 as lt, a7 as rt, P as ha, F as xa, a8 as Ue, a9 as Je, aa as pa, ab as it, ac as fa, ad as pe, ae as fe, af as ge, ag as je, ah as we, ai as be, aj as ee, ak as Ms, al as Fs, am as Ls, an as ga, ao as ja, ap as he, aq as ot, ar as ct, as as ba, at as dt, C as ut, au as mt, av as va, aw as ve, ax as ht, ay as We, az as ts, aA as Te, aB as qe, aC as ke, aD as xt, X as Es, aE as Xs, aF as pt, aG as ft, aH as gt, aI as jt, l as bt, aJ as vt, aK as yt, aL as Fe, aM as ne, aN as ya, aO as Nt, aP as ds, aQ as Ct, aR as St, aS as vs, o as wt, a as kt, aT as ns, aU as Se, aV as ls, aW as zt, aX as It, aY as Ot, aZ as Dt, a_ as bs, a$ as Tt, b0 as Ys, b1 as Mt, b2 as ea, b3 as Ft, b4 as Lt, b5 as Et, b6 as Vt, b7 as Na, b8 as At, b9 as Vs, ba as Ca, bb as qt, bc as Rt, bd as es, be as _t, bf as Ht, bg as Sa, bh as Pt, t as $t, bi as Bt, bj as Gt, s as Ut, bk as us, bl as wa, bm as ka, bn as za, bo as ss, bp as as, bq as Jt, br as Ce, bs as Wt, bt as Kt, bu as ms, bv as hs, bw as xs, bx as Qt, I as Zt, by as Xt, bz as Yt, bA as en, E as sn, bB as ps, bC as Me, f as an, bD as $e, bE as As, bF as Ia, bG as tn, bH as nn, bI as rs, bJ as ln, bK as rn, bL as on, bM as cn, bN as sa, bO as aa, bP as Oa, bQ as dn, bR as un, bS as mn, bT as hn, bU as xn, bV as pn, bW as fn, bX as gn, bY as Le, bZ as W, b_ as K, b$ as qs, c0 as Q, c1 as jn, c2 as Da, c3 as bn, c4 as vn, c5 as yn, c6 as Nn, c7 as Cn, c8 as Sn, c9 as wn, ca as kn, cb as zn } from "./index-B0y-9ayw.js";
1
+ import { c as _, w as Ss, x as k, y as Re, z as Ie, A as e, B as ws, H as ks, J as T, p as Qe, K as zs, M as Is, N as Os, Q as ca, R as H, V as oe, W as da, Y as Ds, Z as Ts, _ as Ms, $ as ua, a0 as ma, a1 as tt, a2 as Zs, a3 as Z, a4 as Ge, i as nt, a5 as u, a6 as lt, a7 as rt, P as ha, F as xa, a8 as Ue, a9 as Je, aa as pa, ab as it, ac as fa, ad as pe, ae as fe, af as ge, ag as je, ah as we, ai as be, aj as ee, ak as Fs, al as Ls, am as Es, an as ga, ao as ja, ap as he, aq as ot, ar as ct, as as ba, at as dt, C as ut, au as mt, av as va, aw as ve, ax as ht, ay as We, az as ts, aA as Te, aB as qe, aC as ke, aD as xt, X as ds, aE as Xs, aF as pt, aG as ft, aH as gt, aI as jt, l as bt, aJ as vt, aK as yt, aL as Fe, aM as ne, aN as ya, aO as Nt, aP as us, aQ as Ct, aR as St, aS as ys, o as wt, a as kt, aT as ns, aU as Se, aV as ls, aW as zt, aX as It, aY as Ot, aZ as Dt, a_ as vs, a$ as Tt, b0 as Ys, b1 as Mt, b2 as ea, b3 as Ft, b4 as Lt, b5 as Et, b6 as Vt, b7 as Na, b8 as At, b9 as Vs, ba as Ca, bb as qt, bc as Rt, bd as es, be as _t, bf as Ht, bg as Sa, bh as Pt, t as $t, bi as Bt, bj as Gt, s as Ut, bk as ms, bl as wa, bm as ka, bn as za, bo as ss, bp as as, bq as Jt, br as Ce, bs as Wt, bt as Kt, bu as hs, bv as xs, bw as ps, bx as Qt, I as Zt, by as Xt, bz as Yt, bA as en, E as sn, bB as fs, bC as Me, f as an, bD as $e, bE as As, bF as Ia, bG as tn, bH as nn, bI as rs, bJ as ln, bK as rn, bL as on, bM as cn, bN as sa, bO as aa, bP as Oa, bQ as dn, bR as un, bS as mn, bT as hn, bU as xn, bV as pn, bW as fn, bX as gn, bY as Le, bZ as W, b_ as K, b$ as qs, c0 as Q, c1 as jn, c2 as Da, c3 as bn, c4 as vn, c5 as yn, c6 as Nn, c7 as Cn, c8 as Sn, c9 as wn, ca as kn, cb as zn } from "./index-Dn9R0tUI.js";
2
2
  import * as ta from "react";
3
- import ze, { useState as q, useMemo as ys, useEffect as se, useRef as is, useCallback as Ta, Suspense as In } from "react";
3
+ import ze, { useState as q, useMemo as Ns, useEffect as se, useRef as is, useCallback as Ta, Suspense as In } from "react";
4
4
  import "react-dom";
5
5
  /**
6
6
  * @license lucide-react v0.453.0 - ISC
@@ -504,14 +504,14 @@ const $s = _("Type", [
504
504
  ["line", { x1: "12", x2: "12", y1: "4", y2: "20", key: "1tx1rr" }]
505
505
  ]);
506
506
  function Aa(s) {
507
- var n;
507
+ var t;
508
508
  return {
509
509
  ...s,
510
- sheets: (n = s == null ? void 0 : s.sheets) == null ? void 0 : n.map((a) => {
511
- var t;
510
+ sheets: (t = s == null ? void 0 : s.sheets) == null ? void 0 : t.map((a) => {
511
+ var n;
512
512
  return {
513
513
  ...a,
514
- frames: (t = a.frames) == null ? void 0 : t.map((l) => {
514
+ frames: (n = a.frames) == null ? void 0 : n.map((l) => {
515
515
  var r;
516
516
  return {
517
517
  ...l,
@@ -523,15 +523,15 @@ function Aa(s) {
523
523
  };
524
524
  }
525
525
  function el(s) {
526
- var n, a, t, l;
526
+ var t, a, n, l;
527
527
  return {
528
528
  ...s,
529
529
  cfg: {
530
530
  ...s.cfg,
531
531
  data: {
532
- ...(n = s.cfg) == null ? void 0 : n.data,
532
+ ...(t = s.cfg) == null ? void 0 : t.data,
533
533
  labels: [],
534
- datasets: (l = (t = (a = s.cfg) == null ? void 0 : a.data) == null ? void 0 : t.datasets) == null ? void 0 : l.map((r) => ({
534
+ datasets: (l = (n = (a = s.cfg) == null ? void 0 : a.data) == null ? void 0 : n.datasets) == null ? void 0 : l.map((r) => ({
535
535
  ...r,
536
536
  data: []
537
537
  }))
@@ -543,53 +543,53 @@ function el(s) {
543
543
  };
544
544
  }
545
545
  function sl(s) {
546
- var n, a;
546
+ var t, a;
547
547
  return s ? {
548
548
  ...s,
549
549
  data: {
550
550
  ...s == null ? void 0 : s.data,
551
551
  labels: [],
552
- datasets: (a = (n = s == null ? void 0 : s.data) == null ? void 0 : n.datasets) == null ? void 0 : a.map((t) => ({
553
- ...t,
552
+ datasets: (a = (t = s == null ? void 0 : s.data) == null ? void 0 : t.datasets) == null ? void 0 : a.map((n) => ({
553
+ ...n,
554
554
  data: []
555
555
  }))
556
556
  }
557
557
  } : null;
558
558
  }
559
- async function al(s, n, a, t) {
560
- if (!t)
559
+ async function al(s, t, a, n) {
560
+ if (!n)
561
561
  return null;
562
- const l = JSON.stringify(n);
563
- return await Cs("https://semaphor.cloud/api/v1/lens", t, {
562
+ const l = JSON.stringify(t);
563
+ return await Ss("https://semaphor.cloud/api/v1/lens", n, {
564
564
  name: s,
565
565
  template: l,
566
566
  filterValues: a,
567
567
  operation: "create"
568
568
  });
569
569
  }
570
- async function Ns(s, n) {
571
- if (!n)
570
+ async function Cs(s, t) {
571
+ if (!t)
572
572
  return null;
573
- const { id: a, template: t, filterValues: l, isDefault: r, shared: i } = s;
574
- return await Cs("https://semaphor.cloud/api/v1/lens", n, {
573
+ const { id: a, template: n, filterValues: l, isDefault: r, shared: i } = s;
574
+ return await Ss("https://semaphor.cloud/api/v1/lens", t, {
575
575
  lensId: a,
576
- template: t,
576
+ template: n,
577
577
  filterValues: l,
578
578
  isDefault: r,
579
579
  shared: i,
580
580
  operation: "update"
581
581
  });
582
582
  }
583
- async function tl(s, n) {
584
- return n ? await Cs("https://semaphor.cloud/api/v1/lens", n, {
583
+ async function tl(s, t) {
584
+ return t ? await Ss("https://semaphor.cloud/api/v1/lens", t, {
585
585
  operation: "delete",
586
586
  lensId: s
587
587
  }) : null;
588
588
  }
589
589
  function nl() {
590
- const [s, n] = q(""), [a, t] = q(!1), l = k((g) => g.lenses), { setLenses: r, setSelectedLensId: i } = Re(), [c, o] = q(!1), [m, x] = q(!1), j = k((g) => g.dashboard), b = k((g) => g.filterValues), { authToken: d } = Ie();
590
+ const [s, t] = q(""), [a, n] = q(!1), l = k((g) => g.lenses), { setLenses: r, setSelectedLensId: i } = Re(), [o, c] = q(!1), [m, x] = q(!1), j = k((g) => g.dashboard), b = k((g) => g.filterValues), { authToken: d } = Ie();
591
591
  async function f() {
592
- o(!0);
592
+ c(!0);
593
593
  const g = Aa(
594
594
  j
595
595
  ), N = await al(
@@ -598,10 +598,10 @@ function nl() {
598
598
  b,
599
599
  d == null ? void 0 : d.accessToken
600
600
  );
601
- N && (r([...l || [], N]), i(N.id), x(!1)), o(!1);
601
+ N && (r([...l || [], N]), i(N.id), x(!1)), c(!1);
602
602
  }
603
- return /* @__PURE__ */ e.jsxs(Ss, { open: m, onOpenChange: x, children: [
604
- /* @__PURE__ */ e.jsx(ws, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
603
+ return /* @__PURE__ */ e.jsxs(ws, { open: m, onOpenChange: x, children: [
604
+ /* @__PURE__ */ e.jsx(ks, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
605
605
  T,
606
606
  {
607
607
  variant: "secondary",
@@ -613,9 +613,9 @@ function nl() {
613
613
  ]
614
614
  }
615
615
  ) }),
616
- /* @__PURE__ */ e.jsxs(ks, { className: "sm:max-w-[425px]", children: [
617
- /* @__PURE__ */ e.jsxs(zs, { children: [
618
- /* @__PURE__ */ e.jsx(Is, { children: "Create Lens" }),
616
+ /* @__PURE__ */ e.jsxs(zs, { className: "sm:max-w-[425px]", children: [
617
+ /* @__PURE__ */ e.jsxs(Is, { children: [
618
+ /* @__PURE__ */ e.jsx(Os, { children: "Create Lens" }),
619
619
  /* @__PURE__ */ e.jsx(ca, { children: "Lenses are private by default and are only visible to you." })
620
620
  ] }),
621
621
  /* @__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: [
@@ -625,7 +625,7 @@ function nl() {
625
625
  {
626
626
  value: s,
627
627
  onChange: (g) => {
628
- n(g.target.value);
628
+ t(g.target.value);
629
629
  },
630
630
  id: "name",
631
631
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -640,19 +640,19 @@ function nl() {
640
640
  variant: "outline",
641
641
  type: "submit",
642
642
  onClick: f,
643
- disabled: c,
644
- children: c ? "Creating..." : "Add"
643
+ disabled: o,
644
+ children: o ? "Creating..." : "Add"
645
645
  }
646
646
  ) })
647
647
  ] })
648
648
  ] });
649
649
  }
650
650
  function ll() {
651
- const [s, n] = q(!1), a = k((x) => x.lenses), t = k((x) => x.selectedLensId), { setLenses: l, setSelectedLensId: r } = Re(), { authToken: i } = Ie();
652
- async function c(x) {
651
+ const [s, t] = q(!1), a = k((x) => x.lenses), n = k((x) => x.selectedLensId), { setLenses: l, setSelectedLensId: r } = Re(), { authToken: i } = Ie();
652
+ async function o(x) {
653
653
  r(x);
654
654
  }
655
- async function o(x) {
655
+ async function c(x) {
656
656
  if (await tl(x, i == null ? void 0 : i.accessToken)) {
657
657
  const b = a == null ? void 0 : a.filter((d) => d.id !== x);
658
658
  l(b || []), r("original");
@@ -671,26 +671,26 @@ function ll() {
671
671
  ...x,
672
672
  isDefault: !x.isDefault
673
673
  };
674
- await Ns(b, i == null ? void 0 : i.accessToken);
674
+ await Cs(b, i == null ? void 0 : i.accessToken);
675
675
  const d = a == null ? void 0 : a.find((f) => f.isDefault);
676
676
  if (d && d.id !== x.id) {
677
677
  const f = {
678
678
  ...d,
679
679
  isDefault: !1
680
680
  };
681
- await Ns(f, i == null ? void 0 : i.accessToken);
681
+ await Cs(f, i == null ? void 0 : i.accessToken);
682
682
  }
683
683
  }
684
- return /* @__PURE__ */ e.jsxs(Os, { open: s, onOpenChange: n, children: [
685
- /* @__PURE__ */ e.jsx(Ds, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "ghost", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(An, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
686
- /* @__PURE__ */ e.jsxs(Ts, { align: "end", className: "w-60", children: [
684
+ return /* @__PURE__ */ e.jsxs(Ds, { open: s, onOpenChange: t, children: [
685
+ /* @__PURE__ */ e.jsx(Ts, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "ghost", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(An, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
686
+ /* @__PURE__ */ e.jsxs(Ms, { align: "end", className: "w-60", children: [
687
687
  /* @__PURE__ */ e.jsx(ua, { className: "px-3", children: "Lenses" }),
688
688
  /* @__PURE__ */ e.jsx(ma, {}),
689
689
  /* @__PURE__ */ e.jsxs(
690
690
  tt,
691
691
  {
692
- value: t,
693
- onValueChange: c,
692
+ value: n,
693
+ onValueChange: o,
694
694
  children: [
695
695
  /* @__PURE__ */ e.jsx(Zs, { value: "original", children: "Original" }),
696
696
  a == null ? void 0 : a.map((x) => /* @__PURE__ */ e.jsxs(
@@ -721,7 +721,7 @@ function ll() {
721
721
  Ge,
722
722
  {
723
723
  onClick: (j) => {
724
- j.preventDefault(), o(x.id);
724
+ j.preventDefault(), c(x.id);
725
725
  },
726
726
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
727
727
  strokeWidth: 1.5
@@ -739,32 +739,32 @@ function ll() {
739
739
  ] });
740
740
  }
741
741
  async function rl() {
742
- var b;
743
- const s = k.getState().authToken, n = k.getState().theme, a = k.getState().filterValues, t = (b = k.getState().dashboard) == null ? void 0 : b.title;
744
- if (k.getState().isDownloadingPdf)
742
+ var d;
743
+ const s = k.getState().authToken, t = k.getState().theme, a = k.getState().filterValues, n = (d = k.getState().dashboard) == null ? void 0 : d.title, l = k.getState().isDownloadingPdf, r = k.getState().selectedSheetId;
744
+ if (l)
745
745
  return;
746
- const r = new URLSearchParams();
747
- r.set("token", (s == null ? void 0 : s.accessToken) || ""), r.set("theme", n || "light"), r.set("filterValues", JSON.stringify(a));
748
- const i = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(r.toString())}`;
746
+ const i = new URLSearchParams();
747
+ i.set("token", (s == null ? void 0 : s.accessToken) || ""), i.set("theme", t || "light"), i.set("filterValues", JSON.stringify(a)), i.set("selectedSheetId", r || "");
748
+ const o = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(i.toString())}`;
749
749
  k.setState({ isDownloadingPdf: !0 });
750
- const m = (await (await fetch(i, {
750
+ const x = (await (await fetch(o, {
751
751
  method: "GET",
752
752
  headers: {
753
753
  Authorization: `Bearer ${s == null ? void 0 : s.accessToken}`
754
754
  }
755
- })).json()).url, x = document.createElement("a");
756
- x.href = m;
757
- const j = `${t}-${(/* @__PURE__ */ new Date()).toISOString()}.pdf`;
758
- x.download = j, x.click(), k.setState({ isDownloadingPdf: !1 });
755
+ })).json()).url, j = document.createElement("a");
756
+ j.href = x;
757
+ const b = `${n}-${(/* @__PURE__ */ new Date()).toISOString()}.pdf`;
758
+ j.download = b, j.click(), k.setState({ isDownloadingPdf: !1 });
759
759
  }
760
760
  function il({
761
761
  iconClassName: s
762
762
  }) {
763
- Ie(), k((t) => {
763
+ Ie(), k((n) => {
764
764
  var l;
765
- return (l = t.dashboard) == null ? void 0 : l.title;
766
- }), k((t) => t.theme), k((t) => t.filterValues);
767
- const n = k((t) => t.isDownloadingPdf);
765
+ return (l = n.dashboard) == null ? void 0 : l.title;
766
+ }), k((n) => n.theme), k((n) => n.filterValues);
767
+ const t = k((n) => n.isDownloadingPdf);
768
768
  async function a() {
769
769
  await rl();
770
770
  }
@@ -775,7 +775,7 @@ function il({
775
775
  className: "group h-7 p-2",
776
776
  size: "sm",
777
777
  onClick: a,
778
- children: n ? /* @__PURE__ */ e.jsx(Ke, { className: Z("size-3.5 animate-spin", s) }) : /* @__PURE__ */ e.jsx(
778
+ children: t ? /* @__PURE__ */ e.jsx(Ke, { className: Z("size-3.5 animate-spin", s) }) : /* @__PURE__ */ e.jsx(
779
779
  nt,
780
780
  {
781
781
  className: Z("size-3.5", s),
@@ -788,13 +788,13 @@ function il({
788
788
  function ol() {
789
789
  const { authToken: s } = Ie();
790
790
  k((p) => p.theme);
791
- const n = k((p) => p.lenses), a = k((p) => p.selectedLensId), t = n == null ? void 0 : n.find((p) => p.id === a), l = k((p) => p.dashboard);
791
+ const t = k((p) => p.lenses), a = k((p) => p.selectedLensId), n = t == null ? void 0 : t.find((p) => p.id === a), l = k((p) => p.dashboard);
792
792
  k((p) => p.selectedSheetId);
793
793
  const r = k(
794
794
  (p) => p.isDashboardEditing
795
795
  ), i = u(
796
796
  (p) => p.selectedConnectionId
797
- ), [c, o] = q(!1), m = k((p) => p.filterValues), x = k((p) => p.isVisualEditing), j = k((p) => p.showFilters);
797
+ ), [o, c] = q(!1), m = k((p) => p.filterValues), x = k((p) => p.isVisualEditing), j = k((p) => p.showFilters);
798
798
  k(
799
799
  (p) => p.showDashboardJSON
800
800
  );
@@ -802,10 +802,10 @@ function ol() {
802
802
  (p) => p.actions.setShowFilters
803
803
  ), { addFrame: f, setSelectedFrameId: g } = k(
804
804
  (p) => p.actions
805
- ), { getSelectedSheet: N, setIsDashboardEditing: v, setShowDashboardJSON: V } = k((p) => p.actions), F = N(), { tenantId: S, endUserId: w } = ys(
805
+ ), { getSelectedSheet: N, setIsDashboardEditing: v, setShowDashboardJSON: V } = k((p) => p.actions), F = N(), { tenantId: S, endUserId: w } = Ns(
806
806
  () => lt(s == null ? void 0 : s.accessToken),
807
807
  [s == null ? void 0 : s.accessToken]
808
- ), D = ys(() => S || w, [S, w]), R = () => {
808
+ ), D = Ns(() => S || w, [S, w]), R = () => {
809
809
  if (!r || !F) return;
810
810
  const p = {
811
811
  connectionId: i,
@@ -833,15 +833,15 @@ function ol() {
833
833
  v(!0);
834
834
  };
835
835
  async function h() {
836
- if (o(!0), !a || !t) return;
836
+ if (c(!0), !a || !n) return;
837
837
  const p = Aa(
838
838
  l
839
839
  ), I = JSON.stringify(p), O = {
840
- ...t,
840
+ ...n,
841
841
  template: I,
842
842
  filterValues: m
843
843
  };
844
- await Ns(O, s == null ? void 0 : s.accessToken), Je.success("Lens saved"), b == null || b(p), o(!1);
844
+ await Cs(O, s == null ? void 0 : s.accessToken), Je.success("Lens saved"), b == null || b(p), c(!1);
845
845
  }
846
846
  return x ? null : /* @__PURE__ */ e.jsxs(
847
847
  "div",
@@ -849,7 +849,7 @@ function ol() {
849
849
  className: "flex items-center justify-between gap-2 border-b bg-muted/50 py-2 pl-3 pr-2",
850
850
  role: "dashboard-controls",
851
851
  children: [
852
- !x && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx(H, { children: t == null ? void 0 : t.name }) }),
852
+ !x && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx(H, { children: n == null ? void 0 : n.name }) }),
853
853
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
854
854
  /* @__PURE__ */ e.jsx("button", { onClick: rt, children: /* @__PURE__ */ e.jsx(Xn, { className: "h-4 w-4", strokeWidth: 1.5 }) }),
855
855
  /* @__PURE__ */ e.jsx(il, {}),
@@ -897,7 +897,7 @@ function ol() {
897
897
  {
898
898
  className: "h-7 p-2",
899
899
  variant: "ghost",
900
- disabled: c,
900
+ disabled: o,
901
901
  onClick: h,
902
902
  size: "sm",
903
903
  children: /* @__PURE__ */ e.jsx(Jn, { className: "h-4 w-4", strokeWidth: 1.5 })
@@ -922,18 +922,18 @@ function ol() {
922
922
  }
923
923
  function Pe({
924
924
  title: s,
925
- items: n,
925
+ items: t,
926
926
  value: a,
927
- isLoading: t,
927
+ isLoading: n,
928
928
  isError: l,
929
929
  connectionTooltip: r,
930
930
  onChange: i,
931
- showNone: c = !1,
932
- className: o,
931
+ showNone: o = !1,
932
+ className: c,
933
933
  showIcon: m = !0,
934
934
  disabled: x = !1
935
935
  }) {
936
- const j = t ? "Loading..." : l ? "Error" : a;
936
+ const j = n ? "Loading..." : l ? "Error" : a;
937
937
  function b() {
938
938
  if (s === "Connection")
939
939
  return /* @__PURE__ */ e.jsx(Un, { className: "size-4 rotate-90" });
@@ -957,45 +957,45 @@ function Pe({
957
957
  {
958
958
  className: Z(
959
959
  "h-9 w-full focus:ring-1 focus:ring-offset-0",
960
- o
960
+ c
961
961
  ),
962
962
  children: /* @__PURE__ */ e.jsx(
963
963
  ge,
964
964
  {
965
- placeholder: t ? "Loading..." : l ? "Error" : `Select ${s}`
965
+ placeholder: n ? "Loading..." : l ? "Error" : `Select ${s}`
966
966
  }
967
967
  )
968
968
  }
969
969
  ),
970
970
  /* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(we, { children: [
971
- t ? /* @__PURE__ */ e.jsx(be, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(be, { children: s }),
971
+ n ? /* @__PURE__ */ e.jsx(be, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(be, { children: s }),
972
972
  /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
973
- c && /* @__PURE__ */ e.jsx(ee, { value: "none", children: "None" }, "none"),
974
- n && n.map((d, f) => /* @__PURE__ */ e.jsx(ee, { value: d.id, children: d.name }, f))
973
+ o && /* @__PURE__ */ e.jsx(ee, { value: "none", children: "None" }, "none"),
974
+ t && t.map((d, f) => /* @__PURE__ */ e.jsx(ee, { value: d.id, children: d.name }, f))
975
975
  ] }),
976
- (t || l) && /* @__PURE__ */ e.jsx(ee, { value: j, children: j })
976
+ (n || l) && /* @__PURE__ */ e.jsx(ee, { value: j, children: j })
977
977
  ] }) })
978
978
  ] })
979
979
  ] });
980
980
  }
981
981
  function cl({ column: s }) {
982
- const [n, a] = q(!1), t = u((f) => f.selectedTableName), l = u(
982
+ const [t, a] = q(!1), n = u((f) => f.selectedTableName), l = u(
983
983
  (f) => f.selectedSchemaName
984
984
  ), r = u(
985
985
  (f) => f.selectedDatamodelId
986
- ), i = u((f) => f.sqlGen), { modelItems: c, connectionType: o } = Ee(), m = u((f) => f.actions.setSqlGen), x = u((f) => f.actions.setCardSql), j = u((f) => f.actions.setRunSql);
986
+ ), i = u((f) => f.sqlGen), { modelItems: o, connectionType: c } = Ee(), m = u((f) => f.actions.setSqlGen), x = u((f) => f.actions.setCardSql), j = u((f) => f.actions.setRunSql);
987
987
  function b(f, g) {
988
988
  var F;
989
- const N = ga(f, i, g), v = (F = c == null ? void 0 : c.find(
989
+ const N = ga(f, i, g), v = (F = o == null ? void 0 : o.find(
990
990
  (S) => S.id === r
991
991
  )) == null ? void 0 : F.name;
992
992
  m(N);
993
993
  const V = ja(
994
994
  N,
995
995
  he(l || ""),
996
- he(t),
996
+ he(n),
997
997
  v,
998
- o
998
+ c
999
999
  );
1000
1000
  V && (x(V), j(!0)), a(!1);
1001
1001
  }
@@ -1043,10 +1043,10 @@ function cl({ column: s }) {
1043
1043
  )
1044
1044
  ] });
1045
1045
  }
1046
- return /* @__PURE__ */ e.jsxs(Ms, { openDelay: 0, open: n, onOpenChange: a, children: [
1047
- /* @__PURE__ */ e.jsx(Fs, { asChild: !0, children: /* @__PURE__ */ e.jsx(Hs, { className: "invisible size-3.5 cursor-pointer text-foreground/40 group-hover:visible" }) }),
1046
+ return /* @__PURE__ */ e.jsxs(Fs, { openDelay: 0, open: t, onOpenChange: a, children: [
1047
+ /* @__PURE__ */ e.jsx(Ls, { asChild: !0, children: /* @__PURE__ */ e.jsx(Hs, { className: "invisible size-3.5 cursor-pointer text-foreground/40 group-hover:visible" }) }),
1048
1048
  /* @__PURE__ */ e.jsx(
1049
- Ls,
1049
+ Es,
1050
1050
  {
1051
1051
  align: "center",
1052
1052
  className: "w-20 rounded-md p-0 shadow-none",
@@ -1063,17 +1063,17 @@ function qa({ column: s }) {
1063
1063
  }
1064
1064
  function dl({
1065
1065
  schemaName: s,
1066
- tableName: n,
1066
+ tableName: t,
1067
1067
  columns: a,
1068
- status: t
1068
+ status: n
1069
1069
  }) {
1070
1070
  const l = u((h) => h.sqlGen), r = u(
1071
1071
  (h) => h.selectedConnectionId
1072
1072
  ), i = u(
1073
1073
  (h) => h.selectedDatabaseName
1074
- ), c = u(
1074
+ ), o = u(
1075
1075
  (h) => h.selectedSchemaName
1076
- ), o = u((h) => h.selectedTableName), m = u(
1076
+ ), c = u((h) => h.selectedTableName), m = u(
1077
1077
  (h) => h.selectedDatamodelId
1078
1078
  ), x = k(
1079
1079
  (h) => h.dashboard.aiScopeTables
@@ -1091,7 +1091,7 @@ function dl({
1091
1091
  )) == null ? void 0 : A.name, O = ja(
1092
1092
  p,
1093
1093
  he(s),
1094
- he(n),
1094
+ he(t),
1095
1095
  I,
1096
1096
  v
1097
1097
  );
@@ -1099,16 +1099,16 @@ function dl({
1099
1099
  }
1100
1100
  function w() {
1101
1101
  return (x == null ? void 0 : x.find(
1102
- (h) => h.connectionId === r && (h.tableName === o || h.datamodelName === F)
1102
+ (h) => h.connectionId === r && (h.tableName === c || h.datamodelName === F)
1103
1103
  )) !== void 0;
1104
1104
  }
1105
1105
  function D(h) {
1106
- h === !0 && (o || F) && r ? (j({
1106
+ h === !0 && (c || F) && r ? (j({
1107
1107
  connectionId: r,
1108
1108
  connectionType: v,
1109
1109
  databaseName: i,
1110
- schemaName: c,
1111
- tableName: o,
1110
+ schemaName: o,
1111
+ tableName: c,
1112
1112
  datamodelName: F
1113
1113
  }), Je.success("Added to Assistant Scope", {
1114
1114
  position: "top-right",
@@ -1117,7 +1117,7 @@ function dl({
1117
1117
  })) : (b({
1118
1118
  connectionId: r || "",
1119
1119
  connectionType: v || "",
1120
- tableName: o || "",
1120
+ tableName: c || "",
1121
1121
  datamodelName: F || ""
1122
1122
  }), Je("Removed from Assistant Scope", {
1123
1123
  position: "top-right",
@@ -1128,7 +1128,7 @@ function dl({
1128
1128
  function R() {
1129
1129
  const h = ts({
1130
1130
  schemaName: s,
1131
- tableName: n,
1131
+ tableName: t,
1132
1132
  modelName: F,
1133
1133
  connectionType: v
1134
1134
  });
@@ -1139,7 +1139,7 @@ function dl({
1139
1139
  function C() {
1140
1140
  const h = ts({
1141
1141
  schemaName: s,
1142
- tableName: n,
1142
+ tableName: t,
1143
1143
  modelName: F,
1144
1144
  connectionType: v
1145
1145
  });
@@ -1174,13 +1174,13 @@ function dl({
1174
1174
  /* @__PURE__ */ e.jsxs(
1175
1175
  T,
1176
1176
  {
1177
- disabled: t !== "Success",
1177
+ disabled: n !== "Success",
1178
1178
  onClick: R,
1179
1179
  size: "sm",
1180
1180
  variant: "secondary",
1181
1181
  className: "flex",
1182
1182
  children: [
1183
- t !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Qn, { className: "mr-2 size-4" }),
1183
+ n !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Qn, { className: "mr-2 size-4" }),
1184
1184
  "Top 10"
1185
1185
  ]
1186
1186
  }
@@ -1188,13 +1188,13 @@ function dl({
1188
1188
  /* @__PURE__ */ e.jsxs(
1189
1189
  T,
1190
1190
  {
1191
- disabled: t !== "Success",
1191
+ disabled: n !== "Success",
1192
1192
  onClick: C,
1193
1193
  size: "sm",
1194
1194
  variant: "secondary",
1195
1195
  className: "w-full",
1196
1196
  children: [
1197
- t !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Kn, { className: "mr-2 size-4" }),
1197
+ n !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Kn, { className: "mr-2 size-4" }),
1198
1198
  "Count"
1199
1199
  ]
1200
1200
  }
@@ -1239,18 +1239,18 @@ function dl({
1239
1239
  )
1240
1240
  ] });
1241
1241
  }
1242
- function Ee(s, n) {
1242
+ function Ee(s, t) {
1243
1243
  var Gs, Us, Js, Ws, Ks, Qs;
1244
- let a = ys(() => [], []);
1245
- const t = Ie().authToken || s, l = u(
1244
+ let a = Ns(() => [], []);
1245
+ const n = Ie().authToken || s, l = u(
1246
1246
  (y) => y.selectedConnectionId
1247
1247
  ), r = u(
1248
1248
  (y) => y.selectedDatamodelId
1249
1249
  ), i = u(
1250
1250
  (y) => y.selectedDatabaseName
1251
- ), c = u(
1251
+ ), o = u(
1252
1252
  (y) => y.selectedSchemaName
1253
- ), o = u((y) => y.selectedTableName), m = u(
1253
+ ), c = u((y) => y.selectedTableName), m = u(
1254
1254
  (y) => y.actions.setCurrentColumns
1255
1255
  ), x = u(
1256
1256
  (y) => y.actions.setSelectedConnectionId
@@ -1264,10 +1264,10 @@ function Ee(s, n) {
1264
1264
  (y) => y.actions.setSelectedTableName
1265
1265
  ), g = u((y) => y.actions.setCardSql);
1266
1266
  function N(y) {
1267
- return l && i && c && i !== "NA" ? !0 : l && y === "API" ? !1 : !!(l && y === "S3");
1267
+ return l && i && o && i !== "NA" ? !0 : l && y === "API" ? !1 : !!(l && y === "S3");
1268
1268
  }
1269
1269
  function v(y) {
1270
- return !!(l && i && i !== "NA" && c && o || l && (y === "S3" || y === "API") || r && r);
1270
+ return !!(l && i && i !== "NA" && o && c || l && (y === "S3" || y === "API") || r && r);
1271
1271
  }
1272
1272
  function V(y) {
1273
1273
  return l && y ? !(y === "API" || y === "S3") : !1;
@@ -1280,9 +1280,9 @@ function Ee(s, n) {
1280
1280
  queryKey: ["connections"],
1281
1281
  queryFn: () => qe(
1282
1282
  "https://semaphor.cloud/api/v1/connections",
1283
- (t == null ? void 0 : t.accessToken) || ""
1283
+ (n == null ? void 0 : n.accessToken) || ""
1284
1284
  ),
1285
- enabled: !!(t != null && t.accessToken)
1285
+ enabled: !!(n != null && n.accessToken)
1286
1286
  // Only fetch if authToken is present
1287
1287
  }), {
1288
1288
  data: D,
@@ -1292,12 +1292,12 @@ function Ee(s, n) {
1292
1292
  queryKey: ["models", l],
1293
1293
  queryFn: () => qe(
1294
1294
  "https://semaphor.cloud/api/v1/datamodels",
1295
- (t == null ? void 0 : t.accessToken) || "",
1295
+ (n == null ? void 0 : n.accessToken) || "",
1296
1296
  {
1297
1297
  connection_id: l
1298
1298
  }
1299
1299
  ),
1300
- enabled: !!(t != null && t.accessToken) && !!l
1300
+ enabled: !!(n != null && n.accessToken) && !!l
1301
1301
  // Only fetch if authToken is present
1302
1302
  }), h = F == null ? void 0 : F.connections.find(
1303
1303
  (y) => y.id === l
@@ -1311,7 +1311,7 @@ function Ee(s, n) {
1311
1311
  queryKey: ["databases", l],
1312
1312
  queryFn: () => qe(
1313
1313
  "https://semaphor.cloud/api/v1/databases",
1314
- (t == null ? void 0 : t.accessToken) || "",
1314
+ (n == null ? void 0 : n.accessToken) || "",
1315
1315
  {
1316
1316
  connection_id: l
1317
1317
  }
@@ -1328,7 +1328,7 @@ function Ee(s, n) {
1328
1328
  queryKey: ["schemas", l, i],
1329
1329
  queryFn: () => qe(
1330
1330
  "https://semaphor.cloud/api/v1/schemas",
1331
- (t == null ? void 0 : t.accessToken) || "",
1331
+ (n == null ? void 0 : n.accessToken) || "",
1332
1332
  {
1333
1333
  connection_id: l,
1334
1334
  database_name: i
@@ -1347,15 +1347,15 @@ function Ee(s, n) {
1347
1347
  "tables",
1348
1348
  l,
1349
1349
  i,
1350
- c
1350
+ o
1351
1351
  ],
1352
1352
  queryFn: () => qe(
1353
1353
  "https://semaphor.cloud/api/v1/tables",
1354
- (t == null ? void 0 : t.accessToken) || "",
1354
+ (n == null ? void 0 : n.accessToken) || "",
1355
1355
  {
1356
1356
  connection_id: l,
1357
1357
  database_name: i,
1358
- schema_name: c
1358
+ schema_name: o
1359
1359
  }
1360
1360
  ),
1361
1361
  enabled: N(p)
@@ -1370,19 +1370,19 @@ function Ee(s, n) {
1370
1370
  l,
1371
1371
  i,
1372
1372
  r,
1373
- c,
1374
- o
1373
+ o,
1374
+ c
1375
1375
  ],
1376
1376
  queryFn: () => qe(
1377
1377
  "https://semaphor.cloud/api/v1/columns",
1378
- (t == null ? void 0 : t.accessToken) || "",
1378
+ (n == null ? void 0 : n.accessToken) || "",
1379
1379
  {
1380
1380
  connection_id: l,
1381
1381
  datamodel_id: r || "",
1382
1382
  // don't pass undefined. Pass empty string
1383
1383
  database_name: i,
1384
- schema_name: c,
1385
- table_name: o
1384
+ schema_name: o,
1385
+ table_name: c
1386
1386
  }
1387
1387
  ),
1388
1388
  enabled: v(p)
@@ -1406,7 +1406,7 @@ function Ee(s, n) {
1406
1406
  b,
1407
1407
  h
1408
1408
  ]);
1409
- const G = (h == null ? void 0 : h.type) === "API" ? (Gs = h == null ? void 0 : h.type) == null ? void 0 : Gs.toLowerCase() : o || "", de = I ? "" : c || "";
1409
+ const G = (h == null ? void 0 : h.type) === "API" ? (Gs = h == null ? void 0 : h.type) == null ? void 0 : Gs.toLowerCase() : c || "", de = I ? "" : o || "";
1410
1410
  function Ae(y) {
1411
1411
  d(y), f("");
1412
1412
  }
@@ -1435,13 +1435,13 @@ function Ee(s, n) {
1435
1435
  })), He = O == null ? void 0 : O.databases.map((y) => ({
1436
1436
  id: y.database_name,
1437
1437
  name: y.database_name
1438
- })), gs = U == null ? void 0 : U.schemas.map((y) => ({
1438
+ })), js = U == null ? void 0 : U.schemas.map((y) => ({
1439
1439
  id: y.schema_name,
1440
1440
  name: y.schema_name
1441
1441
  })), Ze = E == null ? void 0 : E.tables.map((y) => ({
1442
1442
  id: y.table_name,
1443
1443
  name: y.table_name
1444
- })), js = (Qs = D == null ? void 0 : D.datamodels.find(
1444
+ })), bs = (Qs = D == null ? void 0 : D.datamodels.find(
1445
1445
  (y) => y.id === r
1446
1446
  )) == null ? void 0 : Qs.name;
1447
1447
  return (p === "S3" || p === "API") && (b(""), d(""), j("")), {
@@ -1450,13 +1450,13 @@ function Ee(s, n) {
1450
1450
  isConnectionsError: w,
1451
1451
  modelItems: ue,
1452
1452
  selectedDatamodelId: r,
1453
- selectedDatamodelName: js,
1453
+ selectedDatamodelName: bs,
1454
1454
  isModelsLoading: R,
1455
1455
  isModelsError: C,
1456
1456
  databaseItems: He,
1457
1457
  isDatabasesLoadingOrFetching: A || $,
1458
1458
  isDatabaseError: X,
1459
- schemaItems: gs,
1459
+ schemaItems: js,
1460
1460
  isSchemaLoadingOrFetching: le || ce,
1461
1461
  isSchemaError: B,
1462
1462
  tableItems: Ze,
@@ -1479,19 +1479,19 @@ function Ra({
1479
1479
  ColumnsComponent: s
1480
1480
  }) {
1481
1481
  var ae;
1482
- const n = u(
1482
+ const t = u(
1483
1483
  (P) => P.selectedConnectionId
1484
1484
  ), a = u(
1485
1485
  (P) => P.selectedDatamodelId
1486
- ), t = u(
1486
+ ), n = u(
1487
1487
  (P) => P.selectedDatabaseName
1488
1488
  ), l = u(
1489
1489
  (P) => P.selectedSchemaName
1490
1490
  ), r = u((P) => P.selectedTableName), i = u(
1491
1491
  (P) => P.actions.setSelectedTableName
1492
1492
  ), {
1493
- connectionItems: c,
1494
- modelItems: o,
1493
+ connectionItems: o,
1494
+ modelItems: c,
1495
1495
  schemaItems: m,
1496
1496
  databaseItems: x,
1497
1497
  tableItems: j,
@@ -1532,7 +1532,7 @@ function Ra({
1532
1532
  window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
1533
1533
  }
1534
1534
  function ce() {
1535
- if (!n || h === "S3" || h === "API") return null;
1535
+ if (!t || h === "S3" || h === "API") return null;
1536
1536
  if (!a || a === "none")
1537
1537
  return /* @__PURE__ */ e.jsx(
1538
1538
  Pe,
@@ -1542,13 +1542,13 @@ function Ra({
1542
1542
  isError: V,
1543
1543
  isLoading: v,
1544
1544
  items: x,
1545
- value: t || "",
1545
+ value: n || "",
1546
1546
  title: "Database"
1547
1547
  }
1548
1548
  );
1549
1549
  }
1550
1550
  function B() {
1551
- if (n && !p && (!t || t === "none") && (!a || a === "none"))
1551
+ if (t && !p && (!n || n === "none") && (!a || a === "none"))
1552
1552
  return /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3", children: [
1553
1553
  /* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(ke, {}) }),
1554
1554
  /* @__PURE__ */ e.jsx("div", { className: "col-span-1 grid place-items-center", children: /* @__PURE__ */ e.jsx(H, { children: "OR" }) }),
@@ -1556,8 +1556,8 @@ function Ra({
1556
1556
  ] });
1557
1557
  }
1558
1558
  function re() {
1559
- if (!n || h === "S3" || h === "API") return null;
1560
- if (!t || t === "none")
1559
+ if (!t || h === "S3" || h === "API") return null;
1560
+ if (!n || n === "none")
1561
1561
  return /* @__PURE__ */ e.jsx(
1562
1562
  Pe,
1563
1563
  {
@@ -1565,14 +1565,14 @@ function Ra({
1565
1565
  onChange: $,
1566
1566
  isError: N,
1567
1567
  isLoading: f,
1568
- items: o,
1568
+ items: c,
1569
1569
  value: a || "",
1570
1570
  title: "Model"
1571
1571
  }
1572
1572
  );
1573
1573
  }
1574
1574
  function E() {
1575
- return !n || h === "S3" || h === "API" || !t || t === "none" ? null : /* @__PURE__ */ e.jsx(
1575
+ return !t || h === "S3" || h === "API" || !n || n === "none" ? null : /* @__PURE__ */ e.jsx(
1576
1576
  Pe,
1577
1577
  {
1578
1578
  onChange: A,
@@ -1587,7 +1587,7 @@ function Ra({
1587
1587
  function M() {
1588
1588
  function P() {
1589
1589
  let J = !1;
1590
- return h === "API" ? (J = !1, J) : ((h === "S3" || n && t && t !== "none" && l) && (J = !0), J);
1590
+ return h === "API" ? (J = !1, J) : ((h === "S3" || t && n && n !== "none" && l) && (J = !0), J);
1591
1591
  }
1592
1592
  return P() ? /* @__PURE__ */ e.jsx(
1593
1593
  Pe,
@@ -1606,14 +1606,14 @@ function Ra({
1606
1606
  /* @__PURE__ */ e.jsx(
1607
1607
  Pe,
1608
1608
  {
1609
- items: c,
1609
+ items: o,
1610
1610
  title: "Connection",
1611
- value: n || "",
1611
+ value: t || "",
1612
1612
  onChange: I,
1613
1613
  isLoading: d,
1614
1614
  isError: g,
1615
- connectionTooltip: ((ae = c == null ? void 0 : c.find(
1616
- (P) => P.id === n
1615
+ connectionTooltip: ((ae = o == null ? void 0 : o.find(
1616
+ (P) => P.id === t
1617
1617
  )) == null ? void 0 : ae.type) || ""
1618
1618
  }
1619
1619
  ),
@@ -1640,31 +1640,31 @@ function Ra({
1640
1640
  ] });
1641
1641
  }
1642
1642
  function ul(s) {
1643
- const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1643
+ const t = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), n = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1644
1644
  let r = s.length;
1645
- if (l !== -1 && (r = l), t !== -1 && t < r && (r = t), n !== -1) {
1646
- const i = s.substring(0, n), c = s.substring(n);
1647
- return `${i} {{ filters | where }} AND ${c.substring(
1645
+ if (l !== -1 && (r = l), n !== -1 && n < r && (r = n), t !== -1) {
1646
+ const i = s.substring(0, t), o = s.substring(t);
1647
+ return `${i} {{ filters | where }} AND ${o.substring(
1648
1648
  6
1649
1649
  )}`;
1650
1650
  } else if (a !== -1) {
1651
- const i = s.substring(0, a), c = s.substring(a);
1652
- return `${i} {{ filters | where }} ${c}`;
1651
+ const i = s.substring(0, a), o = s.substring(a);
1652
+ return `${i} {{ filters | where }} ${o}`;
1653
1653
  } else {
1654
- const i = s.substring(0, r), c = s.substring(r);
1655
- return console.log("beforeClause", i), console.log("afterClause", c), c ? `${i} {{ filters | where }} ${c}` : `${i.replace(/;$/, "")} {{ filters | where }}`;
1654
+ const i = s.substring(0, r), o = s.substring(r);
1655
+ return console.log("beforeClause", i), console.log("afterClause", o), o ? `${i} {{ filters | where }} ${o}` : `${i.replace(/;$/, "")} {{ filters | where }}`;
1656
1656
  }
1657
1657
  }
1658
1658
  function ml({
1659
1659
  error: s,
1660
- setShowAIDialog: n,
1660
+ setShowAIDialog: t,
1661
1661
  setUserInputforAI: a,
1662
- setTriggerAIRun: t
1662
+ setTriggerAIRun: n
1663
1663
  }) {
1664
- return /* @__PURE__ */ e.jsxs(Ms, { openDelay: 0, children: [
1665
- /* @__PURE__ */ e.jsx(Fs, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(Mn, { className: "h-4 w-4 text-red-500" }) }) }),
1664
+ return /* @__PURE__ */ e.jsxs(Fs, { openDelay: 0, children: [
1665
+ /* @__PURE__ */ e.jsx(Ls, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(Mn, { className: "h-4 w-4 text-red-500" }) }) }),
1666
1666
  /* @__PURE__ */ e.jsx(
1667
- Ls,
1667
+ Es,
1668
1668
  {
1669
1669
  align: "start",
1670
1670
  className: "w-full min-w-fit max-w-[700px]",
@@ -1674,7 +1674,7 @@ function ml({
1674
1674
  T,
1675
1675
  {
1676
1676
  onClick: () => {
1677
- n(!0), a(s), t(!0);
1677
+ t(!0), a(s), n(!0);
1678
1678
  },
1679
1679
  size: "sm",
1680
1680
  variant: "outline",
@@ -1691,12 +1691,12 @@ function ml({
1691
1691
  }
1692
1692
  function hl({
1693
1693
  open: s,
1694
- setOpen: n,
1694
+ setOpen: t,
1695
1695
  userInput: a,
1696
- triggerAIRun: t,
1696
+ triggerAIRun: n,
1697
1697
  setTriggerAIRun: l
1698
1698
  }) {
1699
- const r = is(null), i = is(null), [c, o] = q(""), [m, x] = q(null), { authToken: j } = Ie(), [b, d] = q(!1), [f, g] = q(!1), N = u((L) => L.actions.setCardSql), v = u((L) => L.actions.setRunSql), V = u(
1699
+ const r = is(null), i = is(null), [o, c] = q(""), [m, x] = q(null), { authToken: j } = Ie(), [b, d] = q(!1), [f, g] = q(!1), N = u((L) => L.actions.setCardSql), v = u((L) => L.actions.setRunSql), V = u(
1700
1700
  (L) => L.actions.switchCardType
1701
1701
  ), F = u((L) => L.currentColumns), S = u(
1702
1702
  (L) => L.selectedDatabaseName
@@ -1783,17 +1783,17 @@ function hl({
1783
1783
  // }
1784
1784
  // },
1785
1785
  onFinish(L, G) {
1786
- J(G.usage), o(""), console.log("onFinish", L, G), G.finishReason === "stop" && o("");
1786
+ J(G.usage), c(""), console.log("onFinish", L, G), G.finishReason === "stop" && c("");
1787
1787
  }
1788
1788
  });
1789
1789
  se(() => {
1790
- t && a && (E({
1790
+ n && a && (E({
1791
1791
  target: { value: a }
1792
1792
  }), setTimeout(() => {
1793
1793
  M(), l(!1);
1794
1794
  }, 100));
1795
1795
  }, [
1796
- t,
1796
+ n,
1797
1797
  M,
1798
1798
  a,
1799
1799
  l,
@@ -1820,7 +1820,7 @@ function hl({
1820
1820
  toolCall: L
1821
1821
  }) {
1822
1822
  if (L.toolName === "getAiScopeTables")
1823
- return o("Getting tables in scope..."), { status: "success", tables: C == null ? void 0 : C.map((de) => ({
1823
+ return c("Getting tables in scope..."), { status: "success", tables: C == null ? void 0 : C.map((de) => ({
1824
1824
  ...de,
1825
1825
  sqlDialect: A === "S3" || A === "API" ? "DuckDb" : A
1826
1826
  })) };
@@ -1832,20 +1832,20 @@ function hl({
1832
1832
  query: G
1833
1833
  };
1834
1834
  }
1835
- if (L.toolName === "getTableColumns" && o("Getting table columns..."), L.toolName === "getCurrentSchema")
1836
- return o("Getting current table columns..."), {
1835
+ if (L.toolName === "getTableColumns" && c("Getting table columns..."), L.toolName === "getCurrentSchema")
1836
+ return c("Getting current table columns..."), {
1837
1837
  sqlDialect: X,
1838
1838
  tableName: $,
1839
1839
  columns: F
1840
1840
  };
1841
- o("Thinking...");
1841
+ c("Thinking...");
1842
1842
  }
1843
1843
  function Ne(L) {
1844
- n(!1), N(L), v(!0);
1844
+ t(!1), N(L), v(!0);
1845
1845
  }
1846
1846
  const me = !["ready", "error"].includes(re);
1847
- return /* @__PURE__ */ e.jsxs(Ss, { open: s, onOpenChange: n, children: [
1848
- /* @__PURE__ */ e.jsx(ws, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1847
+ return /* @__PURE__ */ e.jsxs(ws, { open: s, onOpenChange: t, children: [
1848
+ /* @__PURE__ */ e.jsx(ks, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1849
1849
  T,
1850
1850
  {
1851
1851
  onClick: () => {
@@ -1864,10 +1864,10 @@ function hl({
1864
1864
  children: "Type your question here..."
1865
1865
  }
1866
1866
  ) }),
1867
- /* @__PURE__ */ e.jsxs(ks, { className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]", children: [
1868
- /* @__PURE__ */ e.jsx(zs, { children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-start justify-between gap-2 pr-5", children: [
1867
+ /* @__PURE__ */ e.jsxs(zs, { className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]", children: [
1868
+ /* @__PURE__ */ e.jsx(Is, { children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-start justify-between gap-2 pr-5", children: [
1869
1869
  /* @__PURE__ */ e.jsxs("div", { children: [
1870
- /* @__PURE__ */ e.jsx(Is, { children: "Assistant" }),
1870
+ /* @__PURE__ */ e.jsx(Os, { children: "Assistant" }),
1871
1871
  C && C.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
1872
1872
  /* @__PURE__ */ e.jsx("span", { className: "text-xs text-muted-foreground", children: "Tables in scope:" }),
1873
1873
  C == null ? void 0 : C.map((L, G) => /* @__PURE__ */ e.jsxs(
@@ -1887,7 +1887,7 @@ function hl({
1887
1887
  onClick: () => {
1888
1888
  h(L);
1889
1889
  },
1890
- children: /* @__PURE__ */ e.jsx(Es, { className: "size-3 text-muted-foreground hover:text-foreground" })
1890
+ children: /* @__PURE__ */ e.jsx(ds, { className: "size-3 text-muted-foreground hover:text-foreground" })
1891
1891
  }
1892
1892
  )
1893
1893
  ]
@@ -1922,9 +1922,9 @@ function hl({
1922
1922
  ] })
1923
1923
  ] }),
1924
1924
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
1925
- /* @__PURE__ */ e.jsxs(Os, { children: [
1926
- /* @__PURE__ */ e.jsx(Ds, { children: /* @__PURE__ */ e.jsx(Hs, { className: "size-3.5 text-muted-foreground/70 hover:text-muted-foreground" }) }),
1927
- /* @__PURE__ */ e.jsxs(Ts, { align: "end", children: [
1925
+ /* @__PURE__ */ e.jsxs(Ds, { children: [
1926
+ /* @__PURE__ */ e.jsx(Ts, { children: /* @__PURE__ */ e.jsx(Hs, { className: "size-3.5 text-muted-foreground/70 hover:text-muted-foreground" }) }),
1927
+ /* @__PURE__ */ e.jsxs(Ms, { align: "end", children: [
1928
1928
  /* @__PURE__ */ e.jsx(ua, { children: "Options" }),
1929
1929
  /* @__PURE__ */ e.jsx(ma, {}),
1930
1930
  /* @__PURE__ */ e.jsx(
@@ -1976,7 +1976,7 @@ function hl({
1976
1976
  /* @__PURE__ */ e.jsx(
1977
1977
  ft,
1978
1978
  {
1979
- status: gt(re, c),
1979
+ status: gt(re, o),
1980
1980
  isLoading: me
1981
1981
  }
1982
1982
  )
@@ -2015,115 +2015,115 @@ var _a = {
2015
2015
  style: void 0,
2016
2016
  attr: void 0
2017
2017
  }, na = ze.createContext && /* @__PURE__ */ ze.createContext(_a), xl = ["attr", "size", "title"];
2018
- function pl(s, n) {
2018
+ function pl(s, t) {
2019
2019
  if (s == null) return {};
2020
- var a = fl(s, n), t, l;
2020
+ var a = fl(s, t), n, l;
2021
2021
  if (Object.getOwnPropertySymbols) {
2022
2022
  var r = Object.getOwnPropertySymbols(s);
2023
2023
  for (l = 0; l < r.length; l++)
2024
- t = r[l], !(n.indexOf(t) >= 0) && Object.prototype.propertyIsEnumerable.call(s, t) && (a[t] = s[t]);
2024
+ n = r[l], !(t.indexOf(n) >= 0) && Object.prototype.propertyIsEnumerable.call(s, n) && (a[n] = s[n]);
2025
2025
  }
2026
2026
  return a;
2027
2027
  }
2028
- function fl(s, n) {
2028
+ function fl(s, t) {
2029
2029
  if (s == null) return {};
2030
2030
  var a = {};
2031
- for (var t in s)
2032
- if (Object.prototype.hasOwnProperty.call(s, t)) {
2033
- if (n.indexOf(t) >= 0) continue;
2034
- a[t] = s[t];
2031
+ for (var n in s)
2032
+ if (Object.prototype.hasOwnProperty.call(s, n)) {
2033
+ if (t.indexOf(n) >= 0) continue;
2034
+ a[n] = s[n];
2035
2035
  }
2036
2036
  return a;
2037
2037
  }
2038
2038
  function os() {
2039
2039
  return os = Object.assign ? Object.assign.bind() : function(s) {
2040
- for (var n = 1; n < arguments.length; n++) {
2041
- var a = arguments[n];
2042
- for (var t in a)
2043
- Object.prototype.hasOwnProperty.call(a, t) && (s[t] = a[t]);
2040
+ for (var t = 1; t < arguments.length; t++) {
2041
+ var a = arguments[t];
2042
+ for (var n in a)
2043
+ Object.prototype.hasOwnProperty.call(a, n) && (s[n] = a[n]);
2044
2044
  }
2045
2045
  return s;
2046
2046
  }, os.apply(this, arguments);
2047
2047
  }
2048
- function la(s, n) {
2048
+ function la(s, t) {
2049
2049
  var a = Object.keys(s);
2050
2050
  if (Object.getOwnPropertySymbols) {
2051
- var t = Object.getOwnPropertySymbols(s);
2052
- n && (t = t.filter(function(l) {
2051
+ var n = Object.getOwnPropertySymbols(s);
2052
+ t && (n = n.filter(function(l) {
2053
2053
  return Object.getOwnPropertyDescriptor(s, l).enumerable;
2054
- })), a.push.apply(a, t);
2054
+ })), a.push.apply(a, n);
2055
2055
  }
2056
2056
  return a;
2057
2057
  }
2058
2058
  function cs(s) {
2059
- for (var n = 1; n < arguments.length; n++) {
2060
- var a = arguments[n] != null ? arguments[n] : {};
2061
- n % 2 ? la(Object(a), !0).forEach(function(t) {
2062
- gl(s, t, a[t]);
2063
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(a)) : la(Object(a)).forEach(function(t) {
2064
- Object.defineProperty(s, t, Object.getOwnPropertyDescriptor(a, t));
2059
+ for (var t = 1; t < arguments.length; t++) {
2060
+ var a = arguments[t] != null ? arguments[t] : {};
2061
+ t % 2 ? la(Object(a), !0).forEach(function(n) {
2062
+ gl(s, n, a[n]);
2063
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(a)) : la(Object(a)).forEach(function(n) {
2064
+ Object.defineProperty(s, n, Object.getOwnPropertyDescriptor(a, n));
2065
2065
  });
2066
2066
  }
2067
2067
  return s;
2068
2068
  }
2069
- function gl(s, n, a) {
2070
- return n = jl(n), n in s ? Object.defineProperty(s, n, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : s[n] = a, s;
2069
+ function gl(s, t, a) {
2070
+ return t = jl(t), t in s ? Object.defineProperty(s, t, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : s[t] = a, s;
2071
2071
  }
2072
2072
  function jl(s) {
2073
- var n = bl(s, "string");
2074
- return typeof n == "symbol" ? n : n + "";
2073
+ var t = bl(s, "string");
2074
+ return typeof t == "symbol" ? t : t + "";
2075
2075
  }
2076
- function bl(s, n) {
2076
+ function bl(s, t) {
2077
2077
  if (typeof s != "object" || !s) return s;
2078
2078
  var a = s[Symbol.toPrimitive];
2079
2079
  if (a !== void 0) {
2080
- var t = a.call(s, n || "default");
2081
- if (typeof t != "object") return t;
2080
+ var n = a.call(s, t || "default");
2081
+ if (typeof n != "object") return n;
2082
2082
  throw new TypeError("@@toPrimitive must return a primitive value.");
2083
2083
  }
2084
- return (n === "string" ? String : Number)(s);
2084
+ return (t === "string" ? String : Number)(s);
2085
2085
  }
2086
2086
  function Ha(s) {
2087
- return s && s.map((n, a) => /* @__PURE__ */ ze.createElement(n.tag, cs({
2087
+ return s && s.map((t, a) => /* @__PURE__ */ ze.createElement(t.tag, cs({
2088
2088
  key: a
2089
- }, n.attr), Ha(n.child)));
2089
+ }, t.attr), Ha(t.child)));
2090
2090
  }
2091
2091
  function ye(s) {
2092
- return (n) => /* @__PURE__ */ ze.createElement(vl, os({
2092
+ return (t) => /* @__PURE__ */ ze.createElement(vl, os({
2093
2093
  attr: cs({}, s.attr)
2094
- }, n), Ha(s.child));
2094
+ }, t), Ha(s.child));
2095
2095
  }
2096
2096
  function vl(s) {
2097
- var n = (a) => {
2097
+ var t = (a) => {
2098
2098
  var {
2099
- attr: t,
2099
+ attr: n,
2100
2100
  size: l,
2101
2101
  title: r
2102
- } = s, i = pl(s, xl), c = l || a.size || "1em", o;
2103
- return a.className && (o = a.className), s.className && (o = (o ? o + " " : "") + s.className), /* @__PURE__ */ ze.createElement("svg", os({
2102
+ } = s, i = pl(s, xl), o = l || a.size || "1em", c;
2103
+ return a.className && (c = a.className), s.className && (c = (c ? c + " " : "") + s.className), /* @__PURE__ */ ze.createElement("svg", os({
2104
2104
  stroke: "currentColor",
2105
2105
  fill: "currentColor",
2106
2106
  strokeWidth: "0"
2107
- }, a.attr, t, i, {
2108
- className: o,
2107
+ }, a.attr, n, i, {
2108
+ className: c,
2109
2109
  style: cs(cs({
2110
2110
  color: s.color || a.color
2111
2111
  }, a.style), s.style),
2112
- height: c,
2113
- width: c,
2112
+ height: o,
2113
+ width: o,
2114
2114
  xmlns: "http://www.w3.org/2000/svg"
2115
2115
  }), r && /* @__PURE__ */ ze.createElement("title", null, r), s.children);
2116
2116
  };
2117
- return na !== void 0 ? /* @__PURE__ */ ze.createElement(na.Consumer, null, (a) => n(a)) : n(_a);
2117
+ return na !== void 0 ? /* @__PURE__ */ ze.createElement(na.Consumer, null, (a) => t(a)) : t(_a);
2118
2118
  }
2119
2119
  function yl(s) {
2120
2120
  return ye({ 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);
2121
2121
  }
2122
2122
  function Nl({ sql: s }) {
2123
- return /* @__PURE__ */ e.jsxs(Ms, { children: [
2124
- /* @__PURE__ */ e.jsx(Fs, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(bt, { className: "h-4 w-4 text-muted-foreground" }) }) }),
2123
+ return /* @__PURE__ */ e.jsxs(Fs, { children: [
2124
+ /* @__PURE__ */ e.jsx(Ls, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(bt, { className: "h-4 w-4 text-muted-foreground" }) }) }),
2125
2125
  /* @__PURE__ */ e.jsx(
2126
- Ls,
2126
+ Es,
2127
2127
  {
2128
2128
  align: "end",
2129
2129
  className: "w-full min-w-fit max-w-[700px] p-3 pt-2",
@@ -2136,7 +2136,7 @@ function Nl({ sql: s }) {
2136
2136
  ] });
2137
2137
  }
2138
2138
  function Pa(s) {
2139
- const { theme: n } = vt(), a = k((g) => g.theme), t = u((g) => g.frame), l = u((g) => g.card), r = u((g) => g.activeTabCardId), i = yt(), { refetch: c } = Fe(l), { updateCardTab: o, setRunSql: m } = ne(), x = is(), j = is({}), b = t.cards.find((g) => g.id === r), d = Ta(() => {
2139
+ const { theme: t } = vt(), a = k((g) => g.theme), n = u((g) => g.frame), l = u((g) => g.card), r = u((g) => g.activeTabCardId), i = yt(), { refetch: o } = Fe(l), { updateCardTab: c, setRunSql: m } = ne(), x = is(), j = is({}), b = n.cards.find((g) => g.id === r), d = Ta(() => {
2140
2140
  let g = "";
2141
2141
  return s === "python" && (g = (b == null ? void 0 : b.python) || ya), s === "sql" && (g = (b == null ? void 0 : b.sql) || ""), g;
2142
2142
  }, [s, b]);
@@ -2152,12 +2152,12 @@ function Pa(s) {
2152
2152
  }
2153
2153
  x.current.setModel(N);
2154
2154
  }
2155
- o(r, l), m(!0);
2155
+ c(r, l), m(!0);
2156
2156
  }
2157
2157
  }, [
2158
2158
  r,
2159
2159
  l,
2160
- o,
2160
+ c,
2161
2161
  i,
2162
2162
  m,
2163
2163
  s,
@@ -2178,15 +2178,15 @@ function Pa(s) {
2178
2178
  // : getCssVariableValue('--semaphor-background'),
2179
2179
  }
2180
2180
  }), i.editor.setTheme("default");
2181
- }, [n, a, i]), se(() => {
2181
+ }, [t, a, i]), se(() => {
2182
2182
  const g = x.current;
2183
2183
  g && i && l && g.addCommand(
2184
2184
  i.KeyMod.Shift | i.KeyCode.Enter,
2185
2185
  function() {
2186
- return c(), !1;
2186
+ return o(), !1;
2187
2187
  }
2188
2188
  );
2189
- }, [i, c, l]);
2189
+ }, [i, o, l]);
2190
2190
  function f(g, N) {
2191
2191
  if (x.current = g, !j.current[l.id]) {
2192
2192
  const v = g.getModel(), V = d();
@@ -2197,12 +2197,12 @@ function Pa(s) {
2197
2197
  return { handleEditorDidMount: f };
2198
2198
  }
2199
2199
  function Cl() {
2200
- const s = u((i) => i.card.sql), n = u((i) => i.sqlGen), { setCardSql: a, setSqlGen: t } = ne(), { handleEditorDidMount: l } = Pa("sql");
2200
+ const s = u((i) => i.card.sql), t = u((i) => i.sqlGen), { setCardSql: a, setSqlGen: n } = ne(), { handleEditorDidMount: l } = Pa("sql");
2201
2201
  function r(i) {
2202
- a(i), Ct(n) || t({});
2202
+ a(i), Ct(t) || n({});
2203
2203
  }
2204
2204
  return /* @__PURE__ */ e.jsx(
2205
- ds,
2205
+ us,
2206
2206
  {
2207
2207
  theme: "default",
2208
2208
  className: "pt-3",
@@ -2226,16 +2226,16 @@ function Cl() {
2226
2226
  );
2227
2227
  }
2228
2228
  function Sl() {
2229
- const s = u((l) => l.card.python), { setCardPython: n } = ne(), { handleEditorDidMount: a } = Pa("python");
2230
- function t(l) {
2231
- n(l);
2229
+ const s = u((l) => l.card.python), { setCardPython: t } = ne(), { handleEditorDidMount: a } = Pa("python");
2230
+ function n(l) {
2231
+ t(l);
2232
2232
  }
2233
2233
  return /* @__PURE__ */ e.jsx(
2234
- ds,
2234
+ us,
2235
2235
  {
2236
2236
  className: "pt-3",
2237
2237
  theme: "default",
2238
- onChange: t,
2238
+ onChange: n,
2239
2239
  value: s || ya,
2240
2240
  options: {
2241
2241
  minimap: {
@@ -2255,13 +2255,13 @@ function Sl() {
2255
2255
  );
2256
2256
  }
2257
2257
  function wl() {
2258
- const s = k((r) => r.dashboard.filters), n = k((r) => r.filterValues), a = k((r) => r.selectedSheetId), t = s == null ? void 0 : s.filter(
2258
+ const s = k((r) => r.dashboard.filters), t = k((r) => r.filterValues), a = k((r) => r.selectedSheetId), n = s == null ? void 0 : s.filter(
2259
2259
  (r) => r.sheetId === a || !r.sheetId
2260
- ), l = n == null ? void 0 : n.filter(
2261
- (r) => (t == null ? void 0 : t.some((i) => i.id === r.filterId)) || r.filterId.endsWith(a)
2260
+ ), l = t == null ? void 0 : t.filter(
2261
+ (r) => (n == null ? void 0 : n.some((i) => i.id === r.filterId)) || r.filterId.endsWith(a)
2262
2262
  );
2263
2263
  return /* @__PURE__ */ e.jsx(
2264
- ds,
2264
+ us,
2265
2265
  {
2266
2266
  theme: "default",
2267
2267
  defaultLanguage: "json",
@@ -2287,10 +2287,10 @@ function wl() {
2287
2287
  }
2288
2288
  function kl() {
2289
2289
  var Oe;
2290
- const [s, n] = q({
2290
+ const [s, t] = q({
2291
2291
  queryKey: [],
2292
2292
  queryData: null
2293
- }), a = St(), [t, l] = q(!1), [r, i] = q(!1), [c, o] = q(!1), [m, x] = q(""), [j, b] = q(!1), d = u((z) => z.frame), f = u((z) => z.card), g = u((z) => z.isShowingVisual), N = u(
2293
+ }), a = St(), [n, l] = q(!1), [r, i] = q(!1), [o, c] = q(!1), [m, x] = q(""), [j, b] = q(!1), d = u((z) => z.frame), f = u((z) => z.card), g = u((z) => z.isShowingVisual), N = u(
2294
2294
  (z) => z.selectedConnectionId
2295
2295
  ), v = u(
2296
2296
  (z) => z.selectedDatabaseName
@@ -2326,7 +2326,7 @@ function kl() {
2326
2326
  position: "top-center",
2327
2327
  richColors: !0
2328
2328
  }), p((B == null ? void 0 : B.output) || ""), B.records.length > 0)) {
2329
- const { dimensionKeys: z } = vs(B.records);
2329
+ const { dimensionKeys: z } = ys(B.records);
2330
2330
  C(z);
2331
2331
  }
2332
2332
  }, [B, C, p]), se(() => {
@@ -2347,7 +2347,7 @@ function kl() {
2347
2347
  }, [Y, te, U, J, a]);
2348
2348
  function Ne() {
2349
2349
  const z = a.getQueryData(J);
2350
- s.queryData || n({
2350
+ s.queryData || t({
2351
2351
  queryKey: J,
2352
2352
  queryData: z
2353
2353
  }), a.setQueryData(J, null), a.removeQueries({ queryKey: J, exact: !0 }), h(""), X({}), le(void 0), R(""), I({}), O("bar");
@@ -2362,8 +2362,8 @@ function kl() {
2362
2362
  if (ue == "All__Header")
2363
2363
  return z[0].id;
2364
2364
  if (ue && ue.endsWith("__Header")) {
2365
- const gs = ue.split("__")[0], Ze = z.find(
2366
- (js) => js.tabTitle === gs
2365
+ const js = ue.split("__")[0], Ze = z.find(
2366
+ (bs) => bs.tabTitle === js
2367
2367
  );
2368
2368
  return Ze ? Ze.id : z[0].id;
2369
2369
  }
@@ -2447,7 +2447,7 @@ function kl() {
2447
2447
  {
2448
2448
  id: "1",
2449
2449
  order: 1,
2450
- defaultSize: t ? 20 : 100,
2450
+ defaultSize: n ? 20 : 100,
2451
2451
  className: "relative flex grow",
2452
2452
  children: [
2453
2453
  /* @__PURE__ */ e.jsx(
@@ -2458,11 +2458,11 @@ function kl() {
2458
2458
  children: /* @__PURE__ */ e.jsx(Cl, {})
2459
2459
  }
2460
2460
  ),
2461
- t && /* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-xs text-muted-foreground/70", children: "sql" })
2461
+ n && /* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-xs text-muted-foreground/70", children: "sql" })
2462
2462
  ]
2463
2463
  }
2464
2464
  ),
2465
- t && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2465
+ n && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2466
2466
  /* @__PURE__ */ e.jsx(ls, { withHandle: !0, className: "border" }),
2467
2467
  /* @__PURE__ */ e.jsxs(
2468
2468
  Se,
@@ -2529,7 +2529,7 @@ function kl() {
2529
2529
  ml,
2530
2530
  {
2531
2531
  error: (P == null ? void 0 : P.message) || ((Oe = B == null ? void 0 : B.error) == null ? void 0 : Oe.message),
2532
- setShowAIDialog: o,
2532
+ setShowAIDialog: c,
2533
2533
  setTriggerAIRun: b,
2534
2534
  setUserInputforAI: x
2535
2535
  }
@@ -2550,7 +2550,7 @@ function kl() {
2550
2550
  /* @__PURE__ */ e.jsx(
2551
2551
  va,
2552
2552
  {
2553
- pressed: t,
2553
+ pressed: n,
2554
2554
  onPressedChange: (z) => l(z),
2555
2555
  className: "",
2556
2556
  size: "sm",
@@ -2561,8 +2561,8 @@ function kl() {
2561
2561
  /* @__PURE__ */ e.jsx(
2562
2562
  hl,
2563
2563
  {
2564
- open: c,
2565
- setOpen: o,
2564
+ open: o,
2565
+ setOpen: c,
2566
2566
  userInput: m,
2567
2567
  triggerAIRun: j,
2568
2568
  setTriggerAIRun: b
@@ -2607,18 +2607,18 @@ function kl() {
2607
2607
  }
2608
2608
  function zl({ data: s }) {
2609
2609
  var i;
2610
- const [n, a] = ze.useState([]), l = Object.keys(s[0]).map((c) => ({
2610
+ const [t, a] = ze.useState([]), l = Object.keys(s[0]).map((o) => ({
2611
2611
  // header: key,
2612
- accessorKey: c,
2613
- header: ({ column: o }) => {
2614
- const m = o.getIsSorted();
2612
+ accessorKey: o,
2613
+ header: ({ column: c }) => {
2614
+ const m = c.getIsSorted();
2615
2615
  return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
2616
2616
  "div",
2617
2617
  {
2618
2618
  className: "flex cursor-pointer items-center",
2619
- onClick: () => o.toggleSorting(o.getIsSorted() === "asc"),
2619
+ onClick: () => c.toggleSorting(c.getIsSorted() === "asc"),
2620
2620
  children: [
2621
- c,
2621
+ o,
2622
2622
  m === "asc" ? /* @__PURE__ */ e.jsx(zt, { className: "ml-2 h-5 w-5" }) : m === "desc" ? /* @__PURE__ */ e.jsx(It, { className: "ml-2 h-5 w-5" }) : null
2623
2623
  ]
2624
2624
  }
@@ -2633,38 +2633,38 @@ function zl({ data: s }) {
2633
2633
  getSortedRowModel: Et(),
2634
2634
  manualPagination: !0,
2635
2635
  state: {
2636
- sorting: n
2636
+ sorting: t
2637
2637
  }
2638
2638
  });
2639
2639
  return /* @__PURE__ */ e.jsx("div", { className: "font-mono text-xs text-foreground/95", children: /* @__PURE__ */ e.jsxs("table", { className: "w-full", children: [
2640
- /* @__PURE__ */ e.jsx(Dt, { children: r.getHeaderGroups().map((c) => /* @__PURE__ */ e.jsx(bs, { children: c.headers.map((o) => /* @__PURE__ */ e.jsx(
2640
+ /* @__PURE__ */ e.jsx(Dt, { children: r.getHeaderGroups().map((o) => /* @__PURE__ */ e.jsx(vs, { children: o.headers.map((c) => /* @__PURE__ */ e.jsx(
2641
2641
  Tt,
2642
2642
  {
2643
2643
  className: "sticky top-0 h-11 bg-muted font-semibold",
2644
- children: o.isPlaceholder ? null : Ys(
2645
- o.column.columnDef.header,
2646
- o.getContext()
2644
+ children: c.isPlaceholder ? null : Ys(
2645
+ c.column.columnDef.header,
2646
+ c.getContext()
2647
2647
  )
2648
2648
  },
2649
- o.id
2650
- )) }, c.id)) }),
2651
- /* @__PURE__ */ e.jsx(Mt, { children: (i = r.getRowModel().rows) != null && i.length ? r.getRowModel().rows.map((c) => /* @__PURE__ */ e.jsx(
2652
- bs,
2649
+ c.id
2650
+ )) }, o.id)) }),
2651
+ /* @__PURE__ */ e.jsx(Mt, { children: (i = r.getRowModel().rows) != null && i.length ? r.getRowModel().rows.map((o) => /* @__PURE__ */ e.jsx(
2652
+ vs,
2653
2653
  {
2654
2654
  className: "whitespace-nowrap py-2",
2655
- "data-state": c.getIsSelected() && "selected",
2656
- children: c.getVisibleCells().map((o) => /* @__PURE__ */ e.jsx(ea, { className: "py-3", children: Ys(o.column.columnDef.cell, o.getContext()) }, o.id))
2655
+ "data-state": o.getIsSelected() && "selected",
2656
+ children: o.getVisibleCells().map((c) => /* @__PURE__ */ e.jsx(ea, { className: "py-3", children: Ys(c.column.columnDef.cell, c.getContext()) }, c.id))
2657
2657
  },
2658
- c.id
2659
- )) : /* @__PURE__ */ e.jsx(bs, { children: /* @__PURE__ */ e.jsx(ea, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2658
+ o.id
2659
+ )) : /* @__PURE__ */ e.jsx(vs, { children: /* @__PURE__ */ e.jsx(ea, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2660
2660
  ] }) });
2661
2661
  }
2662
2662
  function Il({ card: s }) {
2663
2663
  var v, V, F, S, w, D, R, C, h, p, I;
2664
- const [n, a] = q(!1), [t, l] = q(
2664
+ const [t, a] = q(!1), [n, l] = q(
2665
2665
  []
2666
- ), { authToken: r } = Ie(), i = Vt(r == null ? void 0 : r.accessToken), c = k((O) => O.themeStyle), o = {
2667
- colors: ((V = (v = c == null ? void 0 : c.chart) == null ? void 0 : v.dataset) == null ? void 0 : V.backgroundColor) || []
2666
+ ), { authToken: r } = Ie(), i = Vt(r == null ? void 0 : r.accessToken), o = k((O) => O.themeStyle), c = {
2667
+ colors: ((V = (v = o == null ? void 0 : o.chart) == null ? void 0 : v.dataset) == null ? void 0 : V.backgroundColor) || []
2668
2668
  };
2669
2669
  (F = s.customCardPreferences) != null && F.inputData;
2670
2670
  const { getCard: m } = Na(((S = s.customCardPreferences) == null ? void 0 : S.url) || ""), x = ((w = s.customCardPreferences) == null ? void 0 : w.visualType) || "single", j = u((O) => O.frame);
@@ -2699,7 +2699,7 @@ function Il({ card: s }) {
2699
2699
  f,
2700
2700
  {
2701
2701
  params: i,
2702
- theme: o,
2702
+ theme: c,
2703
2703
  settings: (h = s.customCardPreferences) == null ? void 0 : h.settings,
2704
2704
  onDataChange: d,
2705
2705
  data: (b == null ? void 0 : b.records) || []
@@ -2728,7 +2728,7 @@ function Il({ card: s }) {
2728
2728
  /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2729
2729
  f,
2730
2730
  {
2731
- theme: o,
2731
+ theme: c,
2732
2732
  onDataChange: d,
2733
2733
  settings: N.map(
2734
2734
  (O) => {
@@ -2736,7 +2736,7 @@ function Il({ card: s }) {
2736
2736
  return (A = O == null ? void 0 : O.customCardPreferences) == null ? void 0 : A.settings;
2737
2737
  }
2738
2738
  ),
2739
- data: N.map((O) => O != null && O.id ? t == null ? void 0 : t[O.id] : [])
2739
+ data: N.map((O) => O != null && O.id ? n == null ? void 0 : n[O.id] : [])
2740
2740
  }
2741
2741
  ) })
2742
2742
  ] })
@@ -2749,16 +2749,16 @@ function $a({
2749
2749
  // card,
2750
2750
  // showCard,
2751
2751
  className: s,
2752
- ...n
2752
+ ...t
2753
2753
  }) {
2754
2754
  var N;
2755
- const a = u((v) => v.card), t = ((N = a.customCardPreferences) == null ? void 0 : N.showCardHeader) ?? !0, l = u((v) => v.frame), r = k((v) => v.dashboard.filters);
2755
+ const a = u((v) => v.card), n = ((N = a.customCardPreferences) == null ? void 0 : N.showCardHeader) ?? !0, l = u((v) => v.frame), r = k((v) => v.dashboard.filters);
2756
2756
  u((v) => v.actions.setRunSql);
2757
- const { updateFilter: i } = Re(), c = r == null ? void 0 : r.find((v) => v.id === l.filterId), { data: o, isLoading: m, isFetching: x } = Fe(a), { setCard: j } = ne(), { data: b } = Vs(a);
2757
+ const { updateFilter: i } = Re(), o = r == null ? void 0 : r.find((v) => v.id === l.filterId), { data: c, isLoading: m, isFetching: x } = Fe(a), { setCard: j } = ne(), { data: b } = Vs(a);
2758
2758
  if (!a.id) return null;
2759
2759
  let d;
2760
- o != null && o.records && (o == null ? void 0 : o.records.length) > 0 && (d = Ca({
2761
- data: o == null ? void 0 : o.records,
2760
+ c != null && c.records && (c == null ? void 0 : c.records.length) > 0 && (d = Ca({
2761
+ data: c == null ? void 0 : c.records,
2762
2762
  cardType: a.type,
2763
2763
  cfg: a.cfg,
2764
2764
  customCfg: a.customCfg,
@@ -2770,7 +2770,7 @@ function $a({
2770
2770
  }
2771
2771
  function g() {
2772
2772
  var v;
2773
- if (o != null && o.records && (o == null ? void 0 : o.records.length) === 0 && !m && !x)
2773
+ if (c != null && c.records && (c == null ? void 0 : c.records.length) === 0 && !m && !x)
2774
2774
  return /* @__PURE__ */ e.jsxs("div", { className: "flex h-full flex-col items-center justify-center gap-2", children: [
2775
2775
  /* @__PURE__ */ e.jsx($t, { className: "size-8 text-muted-foreground" }),
2776
2776
  /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "No records to display" })
@@ -2785,9 +2785,9 @@ function $a({
2785
2785
  },
2786
2786
  JSON.stringify(d) + JSON.stringify(a.preferences) + ((v = a == null ? void 0 : a.preferences) == null ? void 0 : v.customVisualCode)
2787
2787
  );
2788
- if (a.type === "table" && (o != null && o.records) && (o == null ? void 0 : o.records.length) > 0)
2788
+ if (a.type === "table" && (c != null && c.records) && (c == null ? void 0 : c.records.length) > 0)
2789
2789
  return /* @__PURE__ */ e.jsxs(ve, { className: "relative mb-2 flex h-full min-h-0 w-full flex-1 grow basis-0", children: [
2790
- /* @__PURE__ */ e.jsx(Gt, { card: a, data: o == null ? void 0 : o.records }),
2790
+ /* @__PURE__ */ e.jsx(Gt, { card: a, data: c == null ? void 0 : c.records }),
2791
2791
  /* @__PURE__ */ e.jsx(We, { orientation: "horizontal" })
2792
2792
  ] });
2793
2793
  }
@@ -2796,9 +2796,9 @@ function $a({
2796
2796
  {
2797
2797
  role: "editor-visual-card",
2798
2798
  className: Z("relative flex h-full flex-col rounded-none", s),
2799
- ...n,
2799
+ ...t,
2800
2800
  children: [
2801
- t && /* @__PURE__ */ e.jsxs(Rt, { className: "flex flex-row items-start justify-between py-4", children: [
2801
+ n && /* @__PURE__ */ e.jsxs(Rt, { className: "flex flex-row items-start justify-between py-4", children: [
2802
2802
  /* @__PURE__ */ e.jsxs("div", { children: [
2803
2803
  /* @__PURE__ */ e.jsx(
2804
2804
  es,
@@ -2819,17 +2819,17 @@ function $a({
2819
2819
  a.description
2820
2820
  )
2821
2821
  ] }),
2822
- c && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2822
+ o && /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
2823
2823
  /* @__PURE__ */ e.jsx(
2824
2824
  es,
2825
2825
  {
2826
2826
  className: "my-1",
2827
- text: c.title || c.column,
2828
- onSave: (v) => i({ ...c, title: v }),
2829
- children: /* @__PURE__ */ e.jsx(H, { children: c.title })
2827
+ text: o.title || o.column,
2828
+ onSave: (v) => i({ ...o, title: v }),
2829
+ children: /* @__PURE__ */ e.jsx(H, { children: o.title })
2830
2830
  }
2831
2831
  ),
2832
- /* @__PURE__ */ e.jsx(Sa, { filter: c })
2832
+ /* @__PURE__ */ e.jsx(Sa, { filter: o })
2833
2833
  ] })
2834
2834
  ] }),
2835
2835
  /* @__PURE__ */ e.jsx(Pt, { className: "flex grow flex-col", children: g() })
@@ -2837,8 +2837,8 @@ function $a({
2837
2837
  }
2838
2838
  );
2839
2839
  }
2840
- const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2841
- ds,
2840
+ const ra = ({ language: s, value: t, onChange: a }) => /* @__PURE__ */ e.jsx(
2841
+ us,
2842
2842
  {
2843
2843
  className: "h-full w-full overflow-hidden text-xs",
2844
2844
  theme: "default",
@@ -2854,11 +2854,11 @@ const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2854
2854
  renderLineHighlight: "none"
2855
2855
  },
2856
2856
  defaultLanguage: s,
2857
- value: n,
2857
+ value: t,
2858
2858
  onChange: a
2859
2859
  }
2860
- ), Ol = () => /* @__PURE__ */ e.jsxs(zs, { children: [
2861
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(Is, { children: "Customize Card" }) }),
2860
+ ), Ol = () => /* @__PURE__ */ e.jsxs(Is, { children: [
2861
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(Os, { children: "Customize Card" }) }),
2862
2862
  /* @__PURE__ */ e.jsxs(ca, { children: [
2863
2863
  "See the configuration options and documentation",
2864
2864
  /* @__PURE__ */ e.jsx(
@@ -2873,9 +2873,9 @@ const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2873
2873
  ] })
2874
2874
  ] }), Dl = ({
2875
2875
  defaultConfig: s,
2876
- customCode: n,
2876
+ customCode: t,
2877
2877
  customConfig: a,
2878
- onConfigChange: t,
2878
+ onConfigChange: n,
2879
2879
  onCodeChange: l
2880
2880
  }) => /* @__PURE__ */ e.jsxs(ka, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
2881
2881
  /* @__PURE__ */ e.jsxs(za, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
@@ -2908,7 +2908,7 @@ const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2908
2908
  {
2909
2909
  language: "json",
2910
2910
  value: a,
2911
- onChange: t
2911
+ onChange: n
2912
2912
  }
2913
2913
  )
2914
2914
  }
@@ -2922,7 +2922,7 @@ const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2922
2922
  ra,
2923
2923
  {
2924
2924
  language: "javascript",
2925
- value: n,
2925
+ value: t,
2926
2926
  onChange: l
2927
2927
  }
2928
2928
  )
@@ -2930,18 +2930,18 @@ const ra = ({ language: s, value: n, onChange: a }) => /* @__PURE__ */ e.jsx(
2930
2930
  )
2931
2931
  ] }), Tl = ({
2932
2932
  error: s,
2933
- hasCustomConfig: n,
2933
+ hasCustomConfig: t,
2934
2934
  onReset: a,
2935
- onApply: t,
2935
+ onApply: n,
2936
2936
  onClose: l
2937
2937
  }) => /* @__PURE__ */ e.jsxs(da, { className: "flex items-center", children: [
2938
2938
  /* @__PURE__ */ e.jsx(H, { className: "mr-2 text-red-500", children: s }),
2939
- /* @__PURE__ */ e.jsx(T, { disabled: !n, onClick: a, variant: "outline", children: "Reset" }),
2940
- /* @__PURE__ */ e.jsx(T, { onClick: t, variant: "outline", children: "Apply" }),
2939
+ /* @__PURE__ */ e.jsx(T, { disabled: !t, onClick: a, variant: "outline", children: "Reset" }),
2940
+ /* @__PURE__ */ e.jsx(T, { onClick: n, variant: "outline", children: "Apply" }),
2941
2941
  /* @__PURE__ */ e.jsx(T, { onClick: l, variant: "outline", children: "Close" })
2942
2942
  ] });
2943
2943
  function Ml() {
2944
- const [s, n] = q(!1), [a, t] = q(""), [l, r] = q(""), [i, c] = q(""), [o, m] = q(""), x = u((S) => S.card), j = u((S) => S.card.customCfg), { data: b } = Fe(x), { data: d } = Vs(x), { setCardCustomCfg: f, setCustomVisualCode: g } = ne(), N = (S, w) => Ce.transform(S, (D, R, C) => {
2944
+ const [s, t] = q(!1), [a, n] = q(""), [l, r] = q(""), [i, o] = q(""), [c, m] = q(""), x = u((S) => S.card), j = u((S) => S.card.customCfg), { data: b } = Fe(x), { data: d } = Vs(x), { setCardCustomCfg: f, setCustomVisualCode: g } = ne(), N = (S, w) => Ce.transform(S, (D, R, C) => {
2945
2945
  if (!Ce.isEqual(R, w[C]))
2946
2946
  if (Ce.isArray(R) && Ce.isArray(w[C]))
2947
2947
  D[C] = w[C];
@@ -2977,7 +2977,7 @@ function Ml() {
2977
2977
  topoJson: d
2978
2978
  });
2979
2979
  if (S) {
2980
- t(v(S)), c(((D = x.preferences) == null ? void 0 : D.customVisualCode) || "");
2980
+ n(v(S)), o(((D = x.preferences) == null ? void 0 : D.customVisualCode) || "");
2981
2981
  const R = Ce.merge(S, j);
2982
2982
  r(v(R));
2983
2983
  }
@@ -2996,8 +2996,8 @@ function Ml() {
2996
2996
  m("Invalid JSON configuration");
2997
2997
  }
2998
2998
  };
2999
- return /* @__PURE__ */ e.jsxs(Ss, { open: s, onOpenChange: n, children: [
3000
- /* @__PURE__ */ e.jsx(ws, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2999
+ return /* @__PURE__ */ e.jsxs(ws, { open: s, onOpenChange: t, children: [
3000
+ /* @__PURE__ */ e.jsx(ks, { asChild: !0, children: /* @__PURE__ */ e.jsx(
3001
3001
  T,
3002
3002
  {
3003
3003
  onClick: V,
@@ -3007,10 +3007,10 @@ function Ml() {
3007
3007
  children: /* @__PURE__ */ e.jsx(Ut, { className: "h-4 w-4" })
3008
3008
  }
3009
3009
  ) }),
3010
- /* @__PURE__ */ e.jsxs(ks, { className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]", children: [
3010
+ /* @__PURE__ */ e.jsxs(zs, { className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]", children: [
3011
3011
  /* @__PURE__ */ e.jsx(Ol, {}),
3012
3012
  /* @__PURE__ */ e.jsxs("div", { className: "flex grow gap-2", children: [
3013
- /* @__PURE__ */ e.jsx(us, { FallbackComponent: wa, children: /* @__PURE__ */ e.jsx($a, { className: "w-1/2 rounded shadow-none" }) }),
3013
+ /* @__PURE__ */ e.jsx(ms, { FallbackComponent: wa, children: /* @__PURE__ */ e.jsx($a, { className: "w-1/2 rounded shadow-none" }) }),
3014
3014
  /* @__PURE__ */ e.jsx(
3015
3015
  Dl,
3016
3016
  {
@@ -3018,20 +3018,20 @@ function Ml() {
3018
3018
  customCode: i,
3019
3019
  customConfig: l,
3020
3020
  onConfigChange: (S) => r(S ?? ""),
3021
- onCodeChange: (S) => c(S ?? "")
3021
+ onCodeChange: (S) => o(S ?? "")
3022
3022
  }
3023
3023
  )
3024
3024
  ] }),
3025
3025
  /* @__PURE__ */ e.jsx(
3026
3026
  Tl,
3027
3027
  {
3028
- error: o,
3028
+ error: c,
3029
3029
  hasCustomConfig: !!j,
3030
3030
  onReset: () => {
3031
3031
  r(a), f(null);
3032
3032
  },
3033
3033
  onApply: F,
3034
- onClose: () => n(!1)
3034
+ onClose: () => t(!1)
3035
3035
  }
3036
3036
  )
3037
3037
  ] })
@@ -3062,43 +3062,43 @@ function Za(s) {
3062
3062
  return ye({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M217 25v14h78V25h-78zm0 32v46h14V71h50v32h14V57h-78zm32 32v14h14V89h-14zm-64 32v46h30v-46h-30zm48 0v14h46v-14h-46zm64 0v46h30v-46h-30zm-64 32v14h46v-14h-46zm-80 32v46h62v-46h-62zm80 0v14h46v-14h-46zm64 0v46h62v-46h-62zm-64 32v14h46v-14h-46zm-112 32v46h94v-46h-94zm112 0v14h46v-14h-46zm64 0v46h94v-46h-94zm-64 32v14h46v-14h-46zM89 313v46h126v-46H89zm144 0v14h46v-14h-46zm64 0v46h126v-46H297zm-64 32v14h46v-14h-46zM57 377v46h158v-46H57zm176 0v14h46v-14h-46zm64 0v46h158v-46H297zm-64 32v14h46v-14h-46zM25 441v46h190v-46H25zm208 0v14h46v-14h-46zm64 0v46h190v-46H297zm-64 32v14h46v-14h-46z" }, child: [] }] })(s);
3063
3063
  }
3064
3064
  function Xa(s) {
3065
- const [n, a] = q(null);
3065
+ const [t, a] = q(null);
3066
3066
  return se(() => {
3067
3067
  s && (async () => {
3068
- const r = (await import("./lucide-react-Ch7fAUq1.js"))[s];
3068
+ const r = (await import("./lucide-react-ot2Rc7yc.js"))[s];
3069
3069
  a(r);
3070
3070
  })();
3071
- }, [s]), n;
3071
+ }, [s]), t;
3072
3072
  }
3073
3073
  function Ya() {
3074
- const { authToken: s } = Ie(), { data: n, isLoading: a, isFetching: t, isError: l } = Te({
3074
+ const { authToken: s } = Ie(), { data: t, isLoading: a, isFetching: n, isError: l } = Te({
3075
3075
  queryKey: ["plugins", s == null ? void 0 : s.accessToken],
3076
3076
  queryFn: () => Wt(s == null ? void 0 : s.accessToken)
3077
3077
  // staleTime: Infinity,
3078
3078
  });
3079
- return { data: n, isLoading: a, isFetching: t, isError: l };
3079
+ return { data: t, isLoading: a, isFetching: n, isError: l };
3080
3080
  }
3081
3081
  function Fl({
3082
3082
  onChartTypeChange: s
3083
3083
  }) {
3084
- const [n, a] = q([]), { data: t } = Ya();
3084
+ const [t, a] = q([]), { data: n } = Ya();
3085
3085
  return se(() => {
3086
3086
  (async () => {
3087
3087
  var r;
3088
- if (t) {
3089
- const c = (await Promise.all(
3090
- (r = t == null ? void 0 : t.plugins) == null ? void 0 : r.map(async (o) => (await Kt(o.value)).visuals.map((j) => ({
3088
+ if (n) {
3089
+ const o = (await Promise.all(
3090
+ (r = n == null ? void 0 : n.plugins) == null ? void 0 : r.map(async (c) => (await Kt(c.value)).visuals.map((j) => ({
3091
3091
  name: j.name,
3092
3092
  icon: j.icon,
3093
- url: o.value
3093
+ url: c.value
3094
3094
  })))
3095
3095
  )).flat();
3096
- a(c);
3096
+ a(o);
3097
3097
  }
3098
3098
  })();
3099
- }, [t]), n.length === 0 ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3099
+ }, [n]), t.length === 0 ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3100
3100
  /* @__PURE__ */ e.jsx(ke, { className: "my-2" }),
3101
- /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: n.map((l, r) => /* @__PURE__ */ e.jsx(
3101
+ /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: t.map((l, r) => /* @__PURE__ */ e.jsx(
3102
3102
  Ll,
3103
3103
  {
3104
3104
  text: l.name,
@@ -3111,35 +3111,35 @@ function Fl({
3111
3111
  }
3112
3112
  const Ll = ({
3113
3113
  text: s,
3114
- icon: n,
3114
+ icon: t,
3115
3115
  onClick: a
3116
3116
  }) => {
3117
- const t = Xa(n || ""), l = s.charAt(0).toUpperCase();
3118
- return /* @__PURE__ */ e.jsx(T, { onClick: a, title: s, variant: "ghost", children: t ? /* @__PURE__ */ e.jsx(t, { className: "h-4 w-4" }) : l });
3117
+ const n = Xa(t || ""), l = s.charAt(0).toUpperCase();
3118
+ return /* @__PURE__ */ e.jsx(T, { onClick: a, title: s, variant: "ghost", children: n ? /* @__PURE__ */ e.jsx(n, { className: "h-4 w-4" }) : l });
3119
3119
  };
3120
3120
  function El() {
3121
3121
  var x, j;
3122
- const [s, n] = q(!1), a = u((b) => b.card), t = a.type, { setCardType: l, setCardPreferences: r, setChartOrientation: i } = u((b) => b.actions), { setCardCustomCfg: c, setCustomCardPreferences: o } = ne();
3122
+ const [s, t] = q(!1), a = u((b) => b.card), n = a.type, { setCardType: l, setCardPreferences: r, setChartOrientation: i } = u((b) => b.actions), { setCardCustomCfg: o, setCustomCardPreferences: c } = ne();
3123
3123
  function m(b, d) {
3124
- c(null), r({}), l(b), d && o({
3124
+ o(null), r({}), l(b), d && c({
3125
3125
  type: "component",
3126
3126
  visualType: "single",
3127
3127
  url: d.url,
3128
3128
  componentName: d.name,
3129
3129
  icon: d.icon
3130
- }), n(!1);
3130
+ }), t(!1);
3131
3131
  }
3132
- return /* @__PURE__ */ e.jsxs(ms, { open: s, onOpenChange: n, children: [
3133
- /* @__PURE__ */ e.jsx(hs, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(
3132
+ return /* @__PURE__ */ e.jsxs(hs, { open: s, onOpenChange: t, children: [
3133
+ /* @__PURE__ */ e.jsx(xs, { asChild: !0, children: /* @__PURE__ */ e.jsx(T, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(
3134
3134
  Vl,
3135
3135
  {
3136
3136
  className: "h-4 w-4",
3137
- chartType: t,
3137
+ chartType: n,
3138
3138
  customIcon: (x = a.customCardPreferences) == null ? void 0 : x.icon,
3139
3139
  componentName: (j = a.customCardPreferences) == null ? void 0 : j.componentName
3140
3140
  }
3141
3141
  ) }) }),
3142
- /* @__PURE__ */ e.jsxs(xs, { className: "w-50", children: [
3142
+ /* @__PURE__ */ e.jsxs(ps, { className: "w-50", children: [
3143
3143
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-4 place-items-center", children: [
3144
3144
  /* @__PURE__ */ e.jsx(
3145
3145
  T,
@@ -3291,54 +3291,54 @@ function El() {
3291
3291
  }
3292
3292
  function Vl({
3293
3293
  chartType: s,
3294
- className: n,
3294
+ className: t,
3295
3295
  customIcon: a,
3296
- componentName: t
3296
+ componentName: n
3297
3297
  }) {
3298
3298
  const l = Xa(a || "");
3299
3299
  switch (s) {
3300
3300
  case "bar":
3301
- return /* @__PURE__ */ e.jsx(Rs, { className: n });
3301
+ return /* @__PURE__ */ e.jsx(Rs, { className: t });
3302
3302
  case "line":
3303
- return /* @__PURE__ */ e.jsx(_s, { className: n });
3303
+ return /* @__PURE__ */ e.jsx(_s, { className: t });
3304
3304
  case "pie":
3305
- return /* @__PURE__ */ e.jsx(Fa, { className: n });
3305
+ return /* @__PURE__ */ e.jsx(Fa, { className: t });
3306
3306
  case "radar":
3307
- return /* @__PURE__ */ e.jsx(Ba, { className: n });
3307
+ return /* @__PURE__ */ e.jsx(Ba, { className: t });
3308
3308
  case "scatter":
3309
- return /* @__PURE__ */ e.jsx(La, { className: n });
3309
+ return /* @__PURE__ */ e.jsx(La, { className: t });
3310
3310
  case "bubble":
3311
- return /* @__PURE__ */ e.jsx(Ja, { className: n });
3311
+ return /* @__PURE__ */ e.jsx(Ja, { className: t });
3312
3312
  case "doughnut":
3313
- return /* @__PURE__ */ e.jsx(Ga, { className: n });
3313
+ return /* @__PURE__ */ e.jsx(Ga, { className: t });
3314
3314
  case "stackedBar":
3315
3315
  return /* @__PURE__ */ e.jsx(Ka, { className: "size-4 text-foreground/70" });
3316
3316
  case "stackedLine":
3317
3317
  return /* @__PURE__ */ e.jsx(Wa, { className: "size-4 text-foreground/70" });
3318
3318
  case "polarArea":
3319
- return /* @__PURE__ */ e.jsx(Ua, { className: n });
3319
+ return /* @__PURE__ */ e.jsx(Ua, { className: t });
3320
3320
  case "pyramid":
3321
- return /* @__PURE__ */ e.jsx(Za, { className: n });
3321
+ return /* @__PURE__ */ e.jsx(Za, { className: t });
3322
3322
  case "range":
3323
- return /* @__PURE__ */ e.jsx(Ma, { className: n });
3323
+ return /* @__PURE__ */ e.jsx(Ma, { className: t });
3324
3324
  case "kpi":
3325
- return /* @__PURE__ */ e.jsx(Qa, { className: n });
3325
+ return /* @__PURE__ */ e.jsx(Qa, { className: t });
3326
3326
  case "text":
3327
- return /* @__PURE__ */ e.jsx($s, { className: n });
3327
+ return /* @__PURE__ */ e.jsx($s, { className: t });
3328
3328
  case "map":
3329
- return /* @__PURE__ */ e.jsx(Ea, { className: n });
3329
+ return /* @__PURE__ */ e.jsx(Ea, { className: t });
3330
3330
  case "custom":
3331
- return a && l ? /* @__PURE__ */ e.jsx(l, { className: n }) : t ? t == null ? void 0 : t.charAt(0).toUpperCase() : /* @__PURE__ */ e.jsx(Va, { className: n });
3331
+ return a && l ? /* @__PURE__ */ e.jsx(l, { className: t }) : n ? n == null ? void 0 : n.charAt(0).toUpperCase() : /* @__PURE__ */ e.jsx(Va, { className: t });
3332
3332
  default:
3333
- return /* @__PURE__ */ e.jsx(Ps, { className: n });
3333
+ return /* @__PURE__ */ e.jsx(Ps, { className: t });
3334
3334
  }
3335
3335
  }
3336
3336
  function Al() {
3337
- var n;
3337
+ var t;
3338
3338
  const s = u((a) => a.card);
3339
- return (n = s.customCardPreferences) == null || n.showCardHeader, ne(), /* @__PURE__ */ e.jsxs(Os, { children: [
3340
- /* @__PURE__ */ e.jsx(Ds, { asChild: !0, children: /* @__PURE__ */ e.jsx(Hs, { className: "size-4 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground" }) }),
3341
- /* @__PURE__ */ e.jsx(Ts, { align: "start", className: "w-40 text-muted-foreground", children: /* @__PURE__ */ e.jsxs(
3339
+ return (t = s.customCardPreferences) == null || t.showCardHeader, ne(), /* @__PURE__ */ e.jsxs(Ds, { children: [
3340
+ /* @__PURE__ */ e.jsx(Ts, { asChild: !0, children: /* @__PURE__ */ e.jsx(Hs, { className: "size-4 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground" }) }),
3341
+ /* @__PURE__ */ e.jsx(Ms, { align: "start", className: "w-40 text-muted-foreground", children: /* @__PURE__ */ e.jsxs(
3342
3342
  Qt,
3343
3343
  {
3344
3344
  onClick: () => {
@@ -3355,13 +3355,13 @@ function Al() {
3355
3355
  }
3356
3356
  function ia() {
3357
3357
  var C;
3358
- const s = u((h) => h.frame), n = u((h) => h.card), a = u((h) => h.isShowingVisual), t = u((h) => h.isSqlRunning), l = u((h) => h.pythonStdOut);
3358
+ const s = u((h) => h.frame), t = u((h) => h.card), a = u((h) => h.isShowingVisual), n = u((h) => h.isSqlRunning), l = u((h) => h.pythonStdOut);
3359
3359
  u((h) => h.actions.setRunSql);
3360
- const { setFrame: r, setCard: i, updateCardInFrame: c, setActiveTabCardId: o } = ne(), { data: m, isLoading: x, isFetching: j, error: b } = Fe(n);
3361
- if (!n) return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3360
+ const { setFrame: r, setCard: i, updateCardInFrame: o, setActiveTabCardId: c } = ne(), { data: m, isLoading: x, isFetching: j, error: b } = Fe(t);
3361
+ if (!t) return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3362
3362
  function d() {
3363
3363
  const h = {
3364
- connectionId: n.connectionId,
3364
+ connectionId: t.connectionId,
3365
3365
  id: Ue(),
3366
3366
  title: "Title",
3367
3367
  description: "Description",
@@ -3385,14 +3385,14 @@ function ia() {
3385
3385
  cards: [...s.cards, h],
3386
3386
  activeCardId: h.id
3387
3387
  };
3388
- r(p), o(h.id);
3388
+ r(p), c(h.id);
3389
3389
  }
3390
3390
  function g() {
3391
3391
  const h = {
3392
- ...n,
3392
+ ...t,
3393
3393
  id: Ue(),
3394
- title: `${n.title} Copy`,
3395
- tabTitle: `${n.tabTitle || n.title} Copy`
3394
+ title: `${t.title} Copy`,
3395
+ tabTitle: `${t.tabTitle || t.title} Copy`
3396
3396
  };
3397
3397
  f(h);
3398
3398
  }
@@ -3403,10 +3403,10 @@ function ia() {
3403
3403
  // update the active card to the first card in the frame
3404
3404
  activeCardId: I.id
3405
3405
  };
3406
- r(O), o(I.id), i(I);
3406
+ r(O), c(I.id), i(I);
3407
3407
  }
3408
3408
  function v(h) {
3409
- o(h);
3409
+ c(h);
3410
3410
  }
3411
3411
  const V = (h, p) => {
3412
3412
  console.log("handleDragStart", p), h.dataTransfer.setData("tabIndex", p.toString());
@@ -3424,7 +3424,7 @@ function ia() {
3424
3424
  {
3425
3425
  onClick: () => {
3426
3426
  const I = p.displayTab === void 0 ? !1 : !p.displayTab;
3427
- i({ ...p, displayTab: I }), c({
3427
+ i({ ...p, displayTab: I }), o({
3428
3428
  ...p,
3429
3429
  displayTab: I
3430
3430
  });
@@ -3448,7 +3448,7 @@ function ia() {
3448
3448
  {
3449
3449
  text: h.tabTitle || h.title,
3450
3450
  onSave: (I) => {
3451
- i({ ...n, tabTitle: I }), c({ ...n, tabTitle: I });
3451
+ i({ ...t, tabTitle: I }), o({ ...t, tabTitle: I });
3452
3452
  },
3453
3453
  children: /* @__PURE__ */ e.jsxs(
3454
3454
  ss,
@@ -3463,7 +3463,7 @@ function ia() {
3463
3463
  w(s, h),
3464
3464
  h.tabTitle || h.title,
3465
3465
  s.activeCardId === h.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
3466
- Es,
3466
+ ds,
3467
3467
  {
3468
3468
  className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
3469
3469
  onClick: () => N(h.id)
@@ -3499,21 +3499,21 @@ function ia() {
3499
3499
  );
3500
3500
  }
3501
3501
  function R() {
3502
- return n.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Xt, { card: n, data: m == null ? void 0 : m.records }) }) }) : n.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(ve, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e.jsx(
3502
+ return t.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Xt, { card: t, data: m == null ? void 0 : m.records }) }) }) : t.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(ve, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e.jsx(
3503
3503
  Yt,
3504
3504
  {
3505
- isLoading: t,
3506
- card: n,
3505
+ isLoading: n,
3506
+ card: t,
3507
3507
  data: m == null ? void 0 : m.records
3508
3508
  }
3509
- ) }) }) }) : /* @__PURE__ */ e.jsx(us, { FallbackComponent: wa, children: /* @__PURE__ */ e.jsx($a, { className: "grow border-none shadow-none" }) });
3509
+ ) }) }) }) : /* @__PURE__ */ e.jsx(ms, { FallbackComponent: wa, children: /* @__PURE__ */ e.jsx($a, { className: "grow border-none shadow-none" }) });
3510
3510
  }
3511
3511
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col py-3", children: [
3512
3512
  (x || j) && /* @__PURE__ */ e.jsx("div", { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto flex h-10 w-10 items-center justify-center rounded-md bg-muted", children: /* @__PURE__ */ e.jsx(Ke, { className: "h-8 w-8 animate-spin text-muted-foreground" }) }),
3513
3513
  /* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
3514
3514
  a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
3515
3515
  /* @__PURE__ */ e.jsx(El, {}),
3516
- !["table", "custom"].includes(n.type) && /* @__PURE__ */ e.jsx(Ml, {}),
3516
+ !["table", "custom"].includes(t.type) && /* @__PURE__ */ e.jsx(Ml, {}),
3517
3517
  /* @__PURE__ */ e.jsx(Al, {})
3518
3518
  ] }),
3519
3519
  /* @__PURE__ */ e.jsx(Rl, {})
@@ -3560,17 +3560,17 @@ function ia() {
3560
3560
  function ql() {
3561
3561
  const s = u((a) => a.pythonStdOut);
3562
3562
  if (!s) return null;
3563
- const n = s.replace(/\n/g, "<br>");
3563
+ const t = s.replace(/\n/g, "<br>");
3564
3564
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full flex-col border-r", children: [
3565
3565
  /* @__PURE__ */ e.jsx("div", { className: "sticky top-0 flex max-h-11 min-h-11 grow items-center border-b bg-muted px-3 font-mono text-xs font-semibold text-foreground/70", children: "Python Output" }),
3566
3566
  /* @__PURE__ */ e.jsxs(ve, { className: "overflow-y-auto px-2 pt-1 font-mono text-xs text-foreground/90", children: [
3567
- /* @__PURE__ */ e.jsx("div", { dangerouslySetInnerHTML: { __html: n } }),
3567
+ /* @__PURE__ */ e.jsx("div", { dangerouslySetInnerHTML: { __html: t } }),
3568
3568
  /* @__PURE__ */ e.jsx(We, { orientation: "horizontal" })
3569
3569
  ] })
3570
3570
  ] });
3571
3571
  }
3572
3572
  function Rl() {
3573
- const s = u((a) => a.isShowingVisual), n = u(
3573
+ const s = u((a) => a.isShowingVisual), t = u(
3574
3574
  (a) => a.actions.setIsShowingVisual
3575
3575
  );
3576
3576
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
@@ -3579,7 +3579,7 @@ function Rl() {
3579
3579
  en,
3580
3580
  {
3581
3581
  checked: s,
3582
- onCheckedChange: () => n(!s),
3582
+ onCheckedChange: () => t(!s),
3583
3583
  id: "visualize",
3584
3584
  className: "data-[state=checked]:bg-foreground/50"
3585
3585
  }
@@ -3588,31 +3588,31 @@ function Rl() {
3588
3588
  }
3589
3589
  function _l({
3590
3590
  options: s,
3591
- value: n,
3591
+ value: t,
3592
3592
  onValueChange: a
3593
3593
  }) {
3594
3594
  return /* @__PURE__ */ e.jsx(
3595
- ps,
3595
+ fs,
3596
3596
  {
3597
- value: n,
3597
+ value: t,
3598
3598
  onValueChange: a,
3599
3599
  className: "flex gap-4",
3600
3600
  defaultValue: s[0].value,
3601
- children: s.map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3602
- /* @__PURE__ */ e.jsx(Me, { value: t.value, id: t.value }),
3603
- /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: t.value, children: t.label })
3604
- ] }, t.value))
3601
+ children: s.map((n) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3602
+ /* @__PURE__ */ e.jsx(Me, { value: n.value, id: n.value }),
3603
+ /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: n.value, children: n.label })
3604
+ ] }, n.value))
3605
3605
  }
3606
3606
  );
3607
3607
  }
3608
3608
  function xe({
3609
3609
  label: s,
3610
- options: n,
3610
+ options: t,
3611
3611
  value: a,
3612
- onValueChange: t,
3612
+ onValueChange: n,
3613
3613
  className: l
3614
3614
  }) {
3615
- return /* @__PURE__ */ e.jsxs(pe, { value: a, onValueChange: t, children: [
3615
+ return /* @__PURE__ */ e.jsxs(pe, { value: a, onValueChange: n, children: [
3616
3616
  /* @__PURE__ */ e.jsx(
3617
3617
  fe,
3618
3618
  {
@@ -3622,24 +3622,24 @@ function xe({
3622
3622
  ),
3623
3623
  /* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(we, { children: [
3624
3624
  /* @__PURE__ */ e.jsx(be, { children: s }),
3625
- n.map((r) => /* @__PURE__ */ e.jsx(ee, { value: r.value, children: r.label }, r.value))
3625
+ t.map((r) => /* @__PURE__ */ e.jsx(ee, { value: r.value, children: r.label }, r.value))
3626
3626
  ] }) })
3627
3627
  ] });
3628
3628
  }
3629
3629
  function Be({
3630
3630
  children: s,
3631
- summary: n,
3631
+ summary: t,
3632
3632
  open: a,
3633
- className: t
3633
+ className: n
3634
3634
  }) {
3635
3635
  return /* @__PURE__ */ e.jsxs(
3636
3636
  "details",
3637
3637
  {
3638
3638
  open: a,
3639
- className: Z("space-y-4 [&_summary>svg]:open:-rotate-180", t),
3639
+ className: Z("space-y-4 [&_summary>svg]:open:-rotate-180", n),
3640
3640
  children: [
3641
3641
  /* @__PURE__ */ e.jsxs("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-4", children: [
3642
- /* @__PURE__ */ e.jsx(H, { children: n }),
3642
+ /* @__PURE__ */ e.jsx(H, { children: t }),
3643
3643
  /* @__PURE__ */ e.jsx(an, { className: "h-4 w-4" })
3644
3644
  ] }),
3645
3645
  /* @__PURE__ */ e.jsx("div", { className: "transition-all ease-in-out", children: s })
@@ -3651,9 +3651,9 @@ function Hl() {
3651
3651
  var g, N;
3652
3652
  const s = u(
3653
3653
  (v) => v.card.customCardPreferences
3654
- ), { data: n } = Ya(), a = (n == null ? void 0 : n.plugins) || [], t = u((v) => v.card), l = u((v) => v.frame), r = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: i } = ne(), { components: c, manifest: o } = Na(
3654
+ ), { data: t } = Ya(), a = (t == null ? void 0 : t.plugins) || [], n = u((v) => v.card), l = u((v) => v.frame), r = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: i } = ne(), { components: o, manifest: c } = Na(
3655
3655
  (s == null ? void 0 : s.url) || ""
3656
- ), m = (g = o == null ? void 0 : o.visuals) == null ? void 0 : g.find(
3656
+ ), m = (g = c == null ? void 0 : c.visuals) == null ? void 0 : g.find(
3657
3657
  (v) => v.name === (s == null ? void 0 : s.componentName)
3658
3658
  );
3659
3659
  function x(v, V) {
@@ -3790,12 +3790,12 @@ function Hl() {
3790
3790
  ),
3791
3791
  ((s == null ? void 0 : s.type) === "component" || (s == null ? void 0 : s.type) === void 0) && s && /* @__PURE__ */ e.jsx(e.Fragment, { children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3792
3792
  /* @__PURE__ */ e.jsx(H, { children: "Component" }),
3793
- /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: c && /* @__PURE__ */ e.jsx(
3793
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: o && /* @__PURE__ */ e.jsx(
3794
3794
  xe,
3795
3795
  {
3796
3796
  className: "h-8 w-full",
3797
3797
  label: "",
3798
- options: (c == null ? void 0 : c.filter(
3798
+ options: (o == null ? void 0 : o.filter(
3799
3799
  (v) => v.type === r
3800
3800
  ).map((v) => ({
3801
3801
  value: v.name,
@@ -3813,7 +3813,7 @@ function Hl() {
3813
3813
  ] }) })
3814
3814
  ] }) }) }),
3815
3815
  /* @__PURE__ */ e.jsx(ke, { className: "my-4" }),
3816
- ((N = t == null ? void 0 : t.customCardPreferences) == null ? void 0 : N.componentName) && /* @__PURE__ */ e.jsxs(Be, { summary: "Component Settings", children: [
3816
+ ((N = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : N.componentName) && /* @__PURE__ */ e.jsxs(Be, { summary: "Component Settings", children: [
3817
3817
  m && m.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3818
3818
  /* @__PURE__ */ e.jsx(H, { children: "Input Mapping" }),
3819
3819
  /* @__PURE__ */ e.jsx("div", { className: "px-2", children: j(m) })
@@ -3825,11 +3825,11 @@ function Hl() {
3825
3825
  );
3826
3826
  }
3827
3827
  function Ve() {
3828
- const [s, n] = q([]);
3828
+ const [s, t] = q([]);
3829
3829
  u(
3830
3830
  (x) => x.card.cfg
3831
3831
  );
3832
- const a = u((x) => x.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: r } = u((x) => x.actions), i = u(
3832
+ const a = u((x) => x.card.preferences), { setCardCfg: n, setFilterOnClickColumnIndex: l, setCardPreferences: r } = u((x) => x.actions), i = u(
3833
3833
  (x) => x.queryResultColumns
3834
3834
  );
3835
3835
  u(
@@ -3838,9 +3838,9 @@ function Ve() {
3838
3838
  return (j = x.card.preferences) == null ? void 0 : j.filterOnClickColumnIndex;
3839
3839
  }
3840
3840
  ), se(() => {
3841
- i && n(new Array(i.length).fill(!1));
3841
+ i && t(new Array(i.length).fill(!1));
3842
3842
  }, [i]);
3843
- function c(x, j) {
3843
+ function o(x, j) {
3844
3844
  var b, d;
3845
3845
  j ? a != null && a.onClickFilter && ((b = a == null ? void 0 : a.onClickFilter) == null ? void 0 : b.length) > 0 ? r({
3846
3846
  ...a,
@@ -3864,12 +3864,12 @@ function Ve() {
3864
3864
  onClickFilter: (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.filter(
3865
3865
  (f) => f.columnIndex !== x
3866
3866
  )
3867
- }), n((f) => {
3867
+ }), t((f) => {
3868
3868
  const g = [...f];
3869
3869
  return g[x] = !1, g;
3870
3870
  }));
3871
3871
  }
3872
- function o(x, j) {
3872
+ function c(x, j) {
3873
3873
  var d;
3874
3874
  const b = (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.map((f) => f.columnIndex === x ? {
3875
3875
  ...f,
@@ -3887,7 +3887,7 @@ function Ve() {
3887
3887
  oe,
3888
3888
  {
3889
3889
  value: (f = (d = a == null ? void 0 : a.onClickFilter) == null ? void 0 : d.find((g) => g.columnIndex === x)) == null ? void 0 : f.expression,
3890
- onChange: (g) => o(x, g),
3890
+ onChange: (g) => c(x, g),
3891
3891
  type: "text",
3892
3892
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
3893
3893
  placeholder: "Expression"
@@ -3910,7 +3910,7 @@ function Ve() {
3910
3910
  checked: !!((b = a == null ? void 0 : a.onClickFilter) != null && b.find(
3911
3911
  (f) => f.columnIndex === j
3912
3912
  )),
3913
- onCheckedChange: (f) => c(j, f)
3913
+ onCheckedChange: (f) => o(j, f)
3914
3914
  }
3915
3915
  ),
3916
3916
  /* @__PURE__ */ e.jsx(
@@ -3926,7 +3926,7 @@ function Ve() {
3926
3926
  ha,
3927
3927
  {
3928
3928
  onClick: () => {
3929
- n((f) => {
3929
+ t((f) => {
3930
3930
  const g = [...f];
3931
3931
  return g[j] = !f[j], g;
3932
3932
  });
@@ -3943,19 +3943,19 @@ function Ve() {
3943
3943
  })
3944
3944
  ] });
3945
3945
  }
3946
- function fs() {
3947
- var i, c, o;
3948
- const s = u((m) => m.card.preferences), n = u(
3946
+ function gs() {
3947
+ var i, o, c;
3948
+ const s = u((m) => m.card.preferences), t = u(
3949
3949
  (m) => m.card.cfg
3950
- ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: l } = u((m) => m.actions);
3951
- (i = n == null ? void 0 : n.options) != null && i.indexAxis;
3950
+ ), { setCardCfg: a, setCardPreferences: n, setChartOrientation: l } = u((m) => m.actions);
3951
+ (i = t == null ? void 0 : t.options) != null && i.indexAxis;
3952
3952
  function r(m) {
3953
3953
  l(m);
3954
3954
  }
3955
3955
  return /* @__PURE__ */ e.jsxs(
3956
- ps,
3956
+ fs,
3957
3957
  {
3958
- value: ((c = s == null ? void 0 : s.chartOptions) == null ? void 0 : c.indexAxis) || ((o = n == null ? void 0 : n.options) == null ? void 0 : o.indexAxis) || "x",
3958
+ value: ((o = s == null ? void 0 : s.chartOptions) == null ? void 0 : o.indexAxis) || ((c = t == null ? void 0 : t.options) == null ? void 0 : c.indexAxis) || "x",
3959
3959
  onValueChange: r,
3960
3960
  className: "flex gap-3",
3961
3961
  defaultValue: "x",
@@ -3973,26 +3973,26 @@ function fs() {
3973
3973
  );
3974
3974
  }
3975
3975
  const Xe = "focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0";
3976
- function oa(s, n) {
3977
- var t, l, r;
3978
- const a = Ia(s, n);
3979
- return ((r = (l = (t = s == null ? void 0 : s.chartOptions) == null ? void 0 : t.scales) == null ? void 0 : l[a]) == null ? void 0 : r.type) || "linear";
3976
+ function oa(s, t) {
3977
+ var n, l, r;
3978
+ const a = Ia(s, t);
3979
+ return ((r = (l = (n = s == null ? void 0 : s.chartOptions) == null ? void 0 : n.scales) == null ? void 0 : l[a]) == null ? void 0 : r.type) || "linear";
3980
3980
  }
3981
3981
  function et() {
3982
3982
  var Y, U, le, ce, B, re;
3983
- const [s, n] = q(!1), a = u((E) => {
3983
+ const [s, t] = q(!1), a = u((E) => {
3984
3984
  var M;
3985
3985
  return (M = E.card) == null ? void 0 : M.preferences;
3986
- }), t = u((E) => {
3986
+ }), n = u((E) => {
3987
3987
  var M;
3988
3988
  return (M = E.card) == null ? void 0 : M.cfg;
3989
- }), l = Ia(a, t), [r, i] = q(
3989
+ }), l = Ia(a, n), [r, i] = q(
3990
3990
  oa(a)
3991
- ), [c, o] = q(
3991
+ ), [o, c] = q(
3992
3992
  ((le = (U = (Y = a == null ? void 0 : a.chartOptions) == null ? void 0 : Y.scales) == null ? void 0 : U[l]) == null ? void 0 : le.min) || ""
3993
3993
  ), [m, x] = q(
3994
3994
  ((re = (B = (ce = a == null ? void 0 : a.chartOptions) == null ? void 0 : ce.scales) == null ? void 0 : B[l]) == null ? void 0 : re.max) || ""
3995
- ), [j, b] = q(c || m ? "custom" : "auto"), [d, f] = q(""), [g, N] = q(0), [v, V] = q(""), [F, S] = q(""), [w, D] = q(""), R = u(
3995
+ ), [j, b] = q(o || m ? "custom" : "auto"), [d, f] = q(""), [g, N] = q(0), [v, V] = q(""), [F, S] = q(""), [w, D] = q(""), R = u(
3996
3996
  (E) => E.actions.setCardPreferences
3997
3997
  ), { updateCardInFrame: C } = ne(), h = u((E) => E.card), p = u((E) => {
3998
3998
  var M;
@@ -4000,7 +4000,7 @@ function et() {
4000
4000
  }), I = ["pie", "doughnut", "polarArea"].includes(p);
4001
4001
  se(() => {
4002
4002
  var E, M, ae, P, J, te, Ne, me, L, G, de, Ae, Oe, z;
4003
- i(oa(a)), o(
4003
+ i(oa(a)), c(
4004
4004
  ((ae = (M = (E = a == null ? void 0 : a.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : M[l]) == null ? void 0 : ae.min) === 0 ? 0 : ""
4005
4005
  ), x(((te = (J = (P = a == null ? void 0 : a.chartOptions) == null ? void 0 : P.scales) == null ? void 0 : J[l]) == null ? void 0 : te.max) || ""), f(
4006
4006
  ((G = (L = (me = (Ne = a == null ? void 0 : a.chartOptions) == null ? void 0 : Ne.scales) == null ? void 0 : me[l]) == null ? void 0 : L.ticks) == null ? void 0 : G.stepSize) || ""
@@ -4081,8 +4081,8 @@ function et() {
4081
4081
  oe,
4082
4082
  {
4083
4083
  id: "min",
4084
- value: c,
4085
- onChange: (E) => o((M) => O(M, E.target.value)),
4084
+ value: o,
4085
+ onChange: (E) => c((M) => O(M, E.target.value)),
4086
4086
  className: `col-span-1 h-8 w-full ${Xe}`
4087
4087
  }
4088
4088
  ),
@@ -4114,7 +4114,7 @@ function et() {
4114
4114
  var P;
4115
4115
  let E = {};
4116
4116
  j === "custom" && (E = {
4117
- min: c,
4117
+ min: o,
4118
4118
  max: m,
4119
4119
  ticks: {
4120
4120
  stepSize: d
@@ -4147,9 +4147,9 @@ function et() {
4147
4147
  };
4148
4148
  C(ae);
4149
4149
  }
4150
- return /* @__PURE__ */ e.jsxs(ms, { onOpenChange: (E) => n(E), children: [
4151
- /* @__PURE__ */ e.jsx(hs, { asChild: !0, children: /* @__PURE__ */ e.jsx(tn, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
4152
- /* @__PURE__ */ e.jsx(xs, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
4150
+ return /* @__PURE__ */ e.jsxs(hs, { onOpenChange: (E) => t(E), children: [
4151
+ /* @__PURE__ */ e.jsx(xs, { asChild: !0, children: /* @__PURE__ */ e.jsx(tn, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
4152
+ /* @__PURE__ */ e.jsx(ps, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
4153
4153
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4154
4154
  /* @__PURE__ */ e.jsx("h4", { className: "font-medium leading-none", children: "Scale Options" }),
4155
4155
  /* @__PURE__ */ e.jsx("p", { className: "text-sm text-muted-foreground", children: "Set the scale for the number axis" })
@@ -4177,7 +4177,7 @@ function et() {
4177
4177
  r == "linear" && /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2 py-1", children: [
4178
4178
  /* @__PURE__ */ e.jsx(H, { htmlFor: "scale-option", children: "Setup" }),
4179
4179
  /* @__PURE__ */ e.jsxs(
4180
- ps,
4180
+ fs,
4181
4181
  {
4182
4182
  disabled: I,
4183
4183
  id: "scale-option",
@@ -4215,29 +4215,29 @@ function et() {
4215
4215
  ] });
4216
4216
  }
4217
4217
  function Pl({ idx: s }) {
4218
- var c;
4219
- const n = u((o) => {
4218
+ var o;
4219
+ const t = u((c) => {
4220
4220
  var m;
4221
- return (m = o.card) == null ? void 0 : m.preferences;
4221
+ return (m = c.card) == null ? void 0 : m.preferences;
4222
4222
  }), a = u(
4223
- (o) => {
4223
+ (c) => {
4224
4224
  var m;
4225
- return (m = o.card.preferences) == null ? void 0 : m.datasetOptions;
4225
+ return (m = c.card.preferences) == null ? void 0 : m.datasetOptions;
4226
4226
  }
4227
- ), t = u(
4228
- (o) => o.actions.setCardPreferences
4229
- ), l = (c = n == null ? void 0 : n.chartOptions) == null ? void 0 : c.indexAxis, r = a == null ? void 0 : a.find((o) => o.idx === s);
4230
- function i(o, m) {
4231
- (o === "end" || o === "start") && ln(rn());
4227
+ ), n = u(
4228
+ (c) => c.actions.setCardPreferences
4229
+ ), l = (o = t == null ? void 0 : t.chartOptions) == null ? void 0 : o.indexAxis, r = a == null ? void 0 : a.find((c) => c.idx === s);
4230
+ function i(c, m) {
4231
+ (c === "end" || c === "start") && ln(rn());
4232
4232
  const x = {
4233
- display: o !== "none",
4234
- align: o,
4235
- anchor: o,
4233
+ display: c !== "none",
4234
+ align: c,
4235
+ anchor: c,
4236
4236
  clamp: !0
4237
4237
  };
4238
4238
  if (!r)
4239
- t({
4240
- ...n,
4239
+ n({
4240
+ ...t,
4241
4241
  datasetOptions: [
4242
4242
  ...a || [],
4243
4243
  {
@@ -4252,15 +4252,15 @@ function Pl({ idx: s }) {
4252
4252
  const b = a == null ? void 0 : a.map(
4253
4253
  (d) => d.idx === m ? j : d
4254
4254
  );
4255
- t({
4256
- ...n,
4255
+ n({
4256
+ ...t,
4257
4257
  datasetOptions: b
4258
4258
  });
4259
4259
  }
4260
4260
  }
4261
- return /* @__PURE__ */ e.jsxs(ms, { children: [
4262
- /* @__PURE__ */ e.jsx(hs, { children: /* @__PURE__ */ e.jsx(Zn, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
4263
- /* @__PURE__ */ e.jsx(xs, { className: "w-fit p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
4261
+ return /* @__PURE__ */ e.jsxs(hs, { children: [
4262
+ /* @__PURE__ */ e.jsx(xs, { children: /* @__PURE__ */ e.jsx(Zn, { className: "invisible size-4 rotate-[135deg] cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible" }) }),
4263
+ /* @__PURE__ */ e.jsx(ps, { className: "w-fit p-1", children: /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
4264
4264
  /* @__PURE__ */ e.jsx(
4265
4265
  T,
4266
4266
  {
@@ -4268,7 +4268,7 @@ function Pl({ idx: s }) {
4268
4268
  size: "sm",
4269
4269
  variant: "secondary",
4270
4270
  className: "h-7 p-1 text-xs font-normal",
4271
- children: /* @__PURE__ */ e.jsx(Es, { className: "size-4" })
4271
+ children: /* @__PURE__ */ e.jsx(ds, { className: "size-4" })
4272
4272
  }
4273
4273
  ),
4274
4274
  /* @__PURE__ */ e.jsx(
@@ -4326,68 +4326,68 @@ function Pl({ idx: s }) {
4326
4326
  ] });
4327
4327
  }
4328
4328
  function st() {
4329
- const s = u((m) => m.card), n = u(
4329
+ const s = u((m) => m.card), t = u(
4330
4330
  (m) => {
4331
4331
  var x, j, b;
4332
4332
  return (b = (j = (x = m == null ? void 0 : m.card) == null ? void 0 : x.preferences) == null ? void 0 : j.chartOptions) == null ? void 0 : b.indexAxis;
4333
4333
  }
4334
- ), { data: a } = Fe(s), t = n === "y" ? "Y axis" : "X axis", l = n === "y" ? "X axis" : "Y axis", {
4334
+ ), { data: a } = Fe(s), n = t === "y" ? "Y axis" : "X axis", l = t === "y" ? "X axis" : "Y axis", {
4335
4335
  keys: r,
4336
4336
  metricKeys: i,
4337
- dimensionKeys: c
4338
- } = vs((a == null ? void 0 : a.records) || []);
4339
- let o = i;
4337
+ dimensionKeys: o
4338
+ } = ys((a == null ? void 0 : a.records) || []);
4339
+ let c = i;
4340
4340
  if (["stackedBar", "stackedLine"].includes(s.type)) {
4341
4341
  const m = on({
4342
4342
  dataArray: (a == null ? void 0 : a.records) || [],
4343
- groupKey: c[0],
4344
- pivotKey: c[1],
4345
- valueKey: o[0]
4346
- }), { metricKeys: x } = vs(m);
4347
- o = x;
4343
+ groupKey: o[0],
4344
+ pivotKey: o[1],
4345
+ valueKey: c[0]
4346
+ }), { metricKeys: x } = ys(m);
4347
+ c = x;
4348
4348
  }
4349
4349
  return r.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4350
4350
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4351
- /* @__PURE__ */ e.jsx(H, { children: t }),
4352
- /* @__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: c[0] }) }) })
4351
+ /* @__PURE__ */ e.jsx(H, { children: n }),
4352
+ /* @__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: o[0] }) }) })
4353
4353
  ] }),
4354
4354
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4355
4355
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
4356
4356
  /* @__PURE__ */ e.jsx(H, { children: l }),
4357
4357
  /* @__PURE__ */ e.jsx(et, {})
4358
4358
  ] }),
4359
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: o.map((m, x) => /* @__PURE__ */ e.jsx($l, { col: m, idx: x }, m)) })
4359
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: c.map((m, x) => /* @__PURE__ */ e.jsx($l, { col: m, idx: x }, m)) })
4360
4360
  ] })
4361
4361
  ] });
4362
4362
  }
4363
- function $l({ col: s, idx: n }) {
4364
- const a = u((c) => {
4365
- var o;
4366
- return (o = c.card) == null ? void 0 : o.preferences;
4367
- }), t = u(
4368
- (c) => {
4369
- var o;
4370
- return (o = c.card.preferences) == null ? void 0 : o.datasetOptions;
4363
+ function $l({ col: s, idx: t }) {
4364
+ const a = u((o) => {
4365
+ var c;
4366
+ return (c = o.card) == null ? void 0 : c.preferences;
4367
+ }), n = u(
4368
+ (o) => {
4369
+ var c;
4370
+ return (c = o.card.preferences) == null ? void 0 : c.datasetOptions;
4371
4371
  }
4372
- ), l = t == null ? void 0 : t.find((c) => c.idx === n), { setCardPreferences: r } = u((c) => c.actions);
4373
- function i(c) {
4372
+ ), l = n == null ? void 0 : n.find((o) => o.idx === t), { setCardPreferences: r } = u((o) => o.actions);
4373
+ function i(o) {
4374
4374
  if (!l)
4375
4375
  r({
4376
4376
  ...a,
4377
4377
  datasetOptions: [
4378
- ...t || [],
4378
+ ...n || [],
4379
4379
  {
4380
- idx: n,
4381
- type: c === "area" ? "line" : c,
4382
- fill: c === "area" ? "origin" : ""
4380
+ idx: t,
4381
+ type: o === "area" ? "line" : o,
4382
+ fill: o === "area" ? "origin" : ""
4383
4383
  }
4384
4384
  ]
4385
4385
  });
4386
4386
  else {
4387
- const o = { ...l };
4388
- o.type = c === "area" ? "line" : c, o.fill = c === "area" ? "origin" : "";
4389
- const m = t == null ? void 0 : t.map(
4390
- (x) => x.idx === n ? o : x
4387
+ const c = { ...l };
4388
+ c.type = o === "area" ? "line" : o, c.fill = o === "area" ? "origin" : "";
4389
+ const m = n == null ? void 0 : n.map(
4390
+ (x) => x.idx === t ? c : x
4391
4391
  );
4392
4392
  r({
4393
4393
  ...a,
@@ -4419,29 +4419,29 @@ function $l({ col: s, idx: n }) {
4419
4419
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4420
4420
  }
4421
4421
  ),
4422
- /* @__PURE__ */ e.jsx(Pl, { idx: n })
4422
+ /* @__PURE__ */ e.jsx(Pl, { idx: t })
4423
4423
  ] })
4424
4424
  ] });
4425
4425
  }
4426
4426
  function at() {
4427
- const s = u((d) => d.selectedConnectionId), n = u((d) => d.selectedDatamodelId), a = u((d) => d.selectedDatabaseName), t = u((d) => d.selectedSchemaName), l = u((d) => d.selectedTableName), r = k((d) => d.dashboard.filters) || [], i = k((d) => d.actions.addFilter), c = k((d) => d.actions.removeFilter), { removeFilterValues: o } = Re(), { modelItems: m, tableName: x, connectionType: j } = Ee();
4427
+ const s = u((d) => d.selectedConnectionId), t = u((d) => d.selectedDatamodelId), a = u((d) => d.selectedDatabaseName), n = u((d) => d.selectedSchemaName), l = u((d) => d.selectedTableName), r = k((d) => d.dashboard.filters) || [], i = k((d) => d.actions.addFilter), o = k((d) => d.actions.removeFilter), { removeFilterValues: c } = Re(), { modelItems: m, tableName: x, connectionType: j } = Ee();
4428
4428
  function b(d, f = "dashboard") {
4429
4429
  var R;
4430
- const g = he(d.column_name), N = he(a || ""), v = he(t || ""), V = he(x);
4430
+ const g = he(d.column_name), N = he(a || ""), v = he(n || ""), V = he(x);
4431
4431
  let F = cn(
4432
4432
  v,
4433
4433
  V,
4434
4434
  j
4435
4435
  ), S = `${F}.${g}`;
4436
4436
  const w = (R = m == null ? void 0 : m.find(
4437
- (C) => C.id === n
4437
+ (C) => C.id === t
4438
4438
  )) == null ? void 0 : R.name;
4439
- n && n !== "none" && (S = `${aa}.${w}.${g}`, F = `${aa}.${w}`);
4439
+ t && t !== "none" && (S = `${aa}.${w}.${g}`, F = `${aa}.${w}`);
4440
4440
  const D = r == null ? void 0 : r.find(
4441
4441
  (C) => C.column === S && C.table === V && (C.database === N || C.database === a)
4442
4442
  );
4443
4443
  if (D)
4444
- o(D.id), c(D.id);
4444
+ c(D.id), o(D.id);
4445
4445
  else {
4446
4446
  const C = Ue();
4447
4447
  return x === "api" && s ? (i({
@@ -4487,27 +4487,27 @@ function at() {
4487
4487
  }
4488
4488
  function _e() {
4489
4489
  const s = k(
4490
- (c) => c.dashboard.filters
4491
- ), n = u((c) => c.frame), { setFrame: a } = ne(), { columns: t } = Ee(), { assignFilter: l } = at();
4492
- function r(c) {
4493
- const o = l(c, "frame");
4494
- a({ ...n, filterId: o });
4490
+ (o) => o.dashboard.filters
4491
+ ), t = u((o) => o.frame), { setFrame: a } = ne(), { columns: n } = Ee(), { assignFilter: l } = at();
4492
+ function r(o) {
4493
+ const c = l(o, "frame");
4494
+ a({ ...t, filterId: c });
4495
4495
  }
4496
- const i = s == null ? void 0 : s.find((c) => c.id === n.filterId);
4496
+ const i = s == null ? void 0 : s.find((o) => o.id === t.filterId);
4497
4497
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
4498
4498
  /* @__PURE__ */ e.jsx(H, { children: "Card Filter" }),
4499
- /* @__PURE__ */ e.jsx(Bl, { onSelect: r, columns: t }),
4499
+ /* @__PURE__ */ e.jsx(Bl, { onSelect: r, columns: n }),
4500
4500
  i && /* @__PURE__ */ e.jsx(Oa, { filter: i })
4501
4501
  ] });
4502
4502
  }
4503
4503
  function Bl({
4504
4504
  columns: s,
4505
- onSelect: n
4505
+ onSelect: t
4506
4506
  }) {
4507
4507
  var i;
4508
- const [a, t] = ta.useState(!1), [l, r] = ta.useState("");
4509
- return /* @__PURE__ */ e.jsxs(ms, { open: a, onOpenChange: t, children: [
4510
- /* @__PURE__ */ e.jsx(hs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
4508
+ const [a, n] = ta.useState(!1), [l, r] = ta.useState("");
4509
+ return /* @__PURE__ */ e.jsxs(hs, { open: a, onOpenChange: n, children: [
4510
+ /* @__PURE__ */ e.jsx(xs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
4511
4511
  T,
4512
4512
  {
4513
4513
  size: "sm",
@@ -4516,37 +4516,37 @@ function Bl({
4516
4516
  "aria-expanded": a,
4517
4517
  className: "w-full justify-between font-normal",
4518
4518
  children: [
4519
- l ? (i = s.find((c) => c.column_name === l)) == null ? void 0 : i.column_name : "Select Column...",
4519
+ l ? (i = s.find((o) => o.column_name === l)) == null ? void 0 : i.column_name : "Select Column...",
4520
4520
  /* @__PURE__ */ e.jsx(dn, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
4521
4521
  ]
4522
4522
  }
4523
4523
  ) }),
4524
- /* @__PURE__ */ e.jsx(xs, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(un, { children: [
4524
+ /* @__PURE__ */ e.jsx(ps, { className: "w-[200px] p-0", children: /* @__PURE__ */ e.jsxs(un, { children: [
4525
4525
  /* @__PURE__ */ e.jsx(mn, { placeholder: "Search column", className: "h-9" }),
4526
4526
  /* @__PURE__ */ e.jsxs(hn, { children: [
4527
4527
  /* @__PURE__ */ e.jsx(xn, { children: "No framework found." }),
4528
- /* @__PURE__ */ e.jsx(pn, { children: s.map((c) => /* @__PURE__ */ e.jsxs(
4528
+ /* @__PURE__ */ e.jsx(pn, { children: s.map((o) => /* @__PURE__ */ e.jsxs(
4529
4529
  fn,
4530
4530
  {
4531
- value: c.column_name,
4532
- onSelect: (o) => {
4533
- const m = o === l ? "" : o;
4534
- r(m), t(!1), m && n(c);
4531
+ value: o.column_name,
4532
+ onSelect: (c) => {
4533
+ const m = c === l ? "" : c;
4534
+ r(m), n(!1), m && t(o);
4535
4535
  },
4536
4536
  children: [
4537
- c.column_name,
4537
+ o.column_name,
4538
4538
  /* @__PURE__ */ e.jsx(
4539
4539
  gn,
4540
4540
  {
4541
4541
  className: Z(
4542
4542
  "ml-auto h-4 w-4",
4543
- l === c.column_name ? "opacity-100" : "opacity-0"
4543
+ l === o.column_name ? "opacity-100" : "opacity-0"
4544
4544
  )
4545
4545
  }
4546
4546
  )
4547
4547
  ]
4548
4548
  },
4549
- c.column_name
4549
+ o.column_name
4550
4550
  )) })
4551
4551
  ] })
4552
4552
  ] }) })
@@ -4571,7 +4571,7 @@ function Gl({
4571
4571
  "a",
4572
4572
  {
4573
4573
  target: "_blank",
4574
- onClick: (n) => n.stopPropagation(),
4574
+ onClick: (t) => t.stopPropagation(),
4575
4575
  className: "text-blue-700",
4576
4576
  href: "https://docs.semaphor.cloud/concepts/visuals#line-chart",
4577
4577
  children: "example"
@@ -4584,7 +4584,7 @@ function Gl({
4584
4584
  /* @__PURE__ */ e.jsxs(W, { value: "item-2", children: [
4585
4585
  /* @__PURE__ */ e.jsx(K, { children: "Settings" }),
4586
4586
  /* @__PURE__ */ e.jsxs(Q, { className: "space-y-4 px-2", children: [
4587
- /* @__PURE__ */ e.jsx(fs, {}),
4587
+ /* @__PURE__ */ e.jsx(gs, {}),
4588
4588
  /* @__PURE__ */ e.jsx(st, {})
4589
4589
  ] })
4590
4590
  ] }),
@@ -4600,15 +4600,15 @@ function Gl({
4600
4600
  function Bs() {
4601
4601
  var l, r, i;
4602
4602
  const s = u(
4603
- (c) => c.card.cfg
4604
- ), n = u((c) => c.actions.setCardCfg), a = u((c) => c.card.type);
4605
- function t(c) {
4603
+ (o) => o.card.cfg
4604
+ ), t = u((o) => o.actions.setCardCfg), a = u((o) => o.card.type);
4605
+ function n(o) {
4606
4606
  var x;
4607
- const o = {
4607
+ const c = {
4608
4608
  datalabels: {
4609
- display: c !== "none",
4610
- align: c,
4611
- anchor: c,
4609
+ display: o !== "none",
4610
+ align: o,
4611
+ anchor: o,
4612
4612
  clamp: !0
4613
4613
  }
4614
4614
  }, m = {
@@ -4617,11 +4617,11 @@ function Bs() {
4617
4617
  ...s == null ? void 0 : s.options,
4618
4618
  plugins: {
4619
4619
  ...(x = s == null ? void 0 : s.options) == null ? void 0 : x.plugins,
4620
- ...o
4620
+ ...c
4621
4621
  }
4622
4622
  }
4623
4623
  };
4624
- n(m), console.log(c);
4624
+ t(m), console.log(o);
4625
4625
  }
4626
4626
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4627
4627
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between", children: [
@@ -4632,7 +4632,7 @@ function Bs() {
4632
4632
  pe,
4633
4633
  {
4634
4634
  value: (i = (r = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : r.datalabels) == null ? void 0 : i.anchor,
4635
- onValueChange: t,
4635
+ onValueChange: n,
4636
4636
  defaultValue: "none",
4637
4637
  children: [
4638
4638
  /* @__PURE__ */ e.jsx(fe, { className: "h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(ge, { placeholder: "Select position" }) }),
@@ -4651,7 +4651,7 @@ function Bs() {
4651
4651
  function Ul({
4652
4652
  cardType: s
4653
4653
  }) {
4654
- function n(a) {
4654
+ function t(a) {
4655
4655
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4656
4656
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: a === "bubble" ? "SELECT label, [group], x-axis, y-axis, radius FROM table" : "SELECT label, [group], x-axis, y-axis FROM table" }),
4657
4657
  /* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
@@ -4680,7 +4680,7 @@ function Ul({
4680
4680
  return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4681
4681
  /* @__PURE__ */ e.jsxs(W, { value: "item-1", children: [
4682
4682
  /* @__PURE__ */ e.jsx(K, { children: `${qs(s)} Chart` }),
4683
- /* @__PURE__ */ e.jsx(Q, { className: "space-y-4 font-mono text-xs", children: n(s) })
4683
+ /* @__PURE__ */ e.jsx(Q, { className: "space-y-4 font-mono text-xs", children: t(s) })
4684
4684
  ] }),
4685
4685
  /* @__PURE__ */ e.jsxs(W, { value: "item-2", children: [
4686
4686
  /* @__PURE__ */ e.jsx(K, { children: "Settings" }),
@@ -4719,7 +4719,7 @@ const Jl = {
4719
4719
  ]
4720
4720
  };
4721
4721
  function Kl() {
4722
- const s = u((n) => n.card.type);
4722
+ const s = u((t) => t.card.type);
4723
4723
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
4724
4724
  /* @__PURE__ */ e.jsx(
4725
4725
  Le,
@@ -4730,7 +4730,7 @@ function Kl() {
4730
4730
  children: Ql(s)
4731
4731
  }
4732
4732
  ),
4733
- /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(fs, {}) }),
4733
+ /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(gs, {}) }),
4734
4734
  !["kpi"].includes(s) && /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4735
4735
  /* @__PURE__ */ e.jsx(Bs, {}),
4736
4736
  /* @__PURE__ */ e.jsx(Ve, {}),
@@ -4836,8 +4836,8 @@ function Ql(s) {
4836
4836
  ] }) });
4837
4837
  }
4838
4838
  function Zl() {
4839
- var o, m, x, j, b;
4840
- const s = u((d) => d.card.preferences), n = u(
4839
+ var c, m, x, j, b;
4840
+ const s = u((d) => d.card.preferences), t = u(
4841
4841
  (d) => d.actions.setCardPreferences
4842
4842
  ), a = u(
4843
4843
  (d) => d.actions.setNumberFormat
@@ -4848,7 +4848,7 @@ function Zl() {
4848
4848
  return (g = (f = d.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : g.decimalPlaces;
4849
4849
  }
4850
4850
  );
4851
- const t = u(
4851
+ const n = u(
4852
4852
  (d) => {
4853
4853
  var f, g;
4854
4854
  return (g = (f = d.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : g.locale;
@@ -4869,15 +4869,15 @@ function Zl() {
4869
4869
  }
4870
4870
  ) || [], i = u(
4871
4871
  (d) => d.actions.setColorRanges
4872
- ), c = [...new Set(rs.map((d) => d.currency))];
4872
+ ), o = [...new Set(rs.map((d) => d.currency))];
4873
4873
  return /* @__PURE__ */ e.jsxs("div", { children: [
4874
4874
  /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
4875
4875
  /* @__PURE__ */ e.jsx(
4876
4876
  As,
4877
4877
  {
4878
- checked: !!((o = s == null ? void 0 : s.formatNumber) != null && o.enabled),
4878
+ checked: !!((c = s == null ? void 0 : s.formatNumber) != null && c.enabled),
4879
4879
  onCheckedChange: (d) => {
4880
- n({
4880
+ t({
4881
4881
  ...s,
4882
4882
  formatNumber: {
4883
4883
  ...s == null ? void 0 : s.formatNumber,
@@ -4897,7 +4897,7 @@ function Zl() {
4897
4897
  /* @__PURE__ */ e.jsxs(
4898
4898
  pe,
4899
4899
  {
4900
- value: t || "none",
4900
+ value: n || "none",
4901
4901
  onValueChange: (d) => {
4902
4902
  var f, g, N;
4903
4903
  return a(
@@ -4938,7 +4938,7 @@ function Zl() {
4938
4938
  /* @__PURE__ */ e.jsx(je, { children: /* @__PURE__ */ e.jsxs(we, { children: [
4939
4939
  /* @__PURE__ */ e.jsx(be, { children: "Currency" }),
4940
4940
  /* @__PURE__ */ e.jsx(ee, { value: "none", children: "None" }, "none"),
4941
- c.map((d) => /* @__PURE__ */ e.jsx(ee, { value: d, children: d }, d))
4941
+ o.map((d) => /* @__PURE__ */ e.jsx(ee, { value: d, children: d }, d))
4942
4942
  ] }) })
4943
4943
  ]
4944
4944
  }
@@ -5133,13 +5133,13 @@ const Yl = [
5133
5133
  value: s
5134
5134
  }));
5135
5135
  function ar() {
5136
- var o, m, x, j, b, d, f, g, N, v, V, F, S, w, D, R, C, h;
5137
- const s = u((p) => p.card), n = (m = (o = s == null ? void 0 : s.preferences) == null ? void 0 : o.mapVisualOptions) == null ? void 0 : m.topoJsonUrl, [a, t] = q(
5136
+ var c, m, x, j, b, d, f, g, N, v, V, F, S, w, D, R, C, h;
5137
+ const s = u((p) => p.card), t = (m = (c = s == null ? void 0 : s.preferences) == null ? void 0 : c.mapVisualOptions) == null ? void 0 : m.topoJsonUrl, [a, n] = q(
5138
5138
  ((j = (x = s == null ? void 0 : s.preferences) == null ? void 0 : x.mapVisualOptions) == null ? void 0 : j.customTopoJsonUrl) || ""
5139
5139
  ), { setCardPreferences: l } = ne(), { data: r } = Vs(s), i = Object.keys((r == null ? void 0 : r.objects) || {}).map((p) => ({
5140
5140
  label: p,
5141
5141
  value: p
5142
- })) || [], c = [
5142
+ })) || [], o = [
5143
5143
  {
5144
5144
  label: "US States 10m",
5145
5145
  value: "https://unpkg.com/us-atlas/states-10m.json"
@@ -5161,7 +5161,7 @@ function ar() {
5161
5161
  xe,
5162
5162
  {
5163
5163
  className: "h-9",
5164
- options: c,
5164
+ options: o,
5165
5165
  onValueChange: (p) => {
5166
5166
  console.log("value", p), l({
5167
5167
  ...s.preferences,
@@ -5171,15 +5171,15 @@ function ar() {
5171
5171
  }
5172
5172
  });
5173
5173
  },
5174
- value: n || "",
5174
+ value: t || "",
5175
5175
  label: "Select Map"
5176
5176
  }
5177
5177
  ),
5178
- n === "custom" && /* @__PURE__ */ e.jsx(
5178
+ t === "custom" && /* @__PURE__ */ e.jsx(
5179
5179
  oe,
5180
5180
  {
5181
5181
  onChange: (p) => {
5182
- t(p.target.value);
5182
+ n(p.target.value);
5183
5183
  },
5184
5184
  onBlur: () => {
5185
5185
  var p;
@@ -5338,10 +5338,10 @@ function ar() {
5338
5338
  ] });
5339
5339
  }
5340
5340
  function tr() {
5341
- var t;
5342
- const s = u((l) => l.card.preferences), { setCardPreferences: n } = u((l) => l.actions);
5341
+ var n;
5342
+ const s = u((l) => l.card.preferences), { setCardPreferences: t } = u((l) => l.actions);
5343
5343
  function a(l) {
5344
- n({
5344
+ t({
5345
5345
  ...s,
5346
5346
  textVisualOptions: {
5347
5347
  ...s == null ? void 0 : s.textVisualOptions,
@@ -5350,9 +5350,9 @@ function tr() {
5350
5350
  });
5351
5351
  }
5352
5352
  return /* @__PURE__ */ e.jsxs(
5353
- ps,
5353
+ fs,
5354
5354
  {
5355
- value: (t = s == null ? void 0 : s.textVisualOptions) != null && t.isDynamicText ? "dynamic" : "static",
5355
+ value: (n = s == null ? void 0 : s.textVisualOptions) != null && n.isDynamicText ? "dynamic" : "static",
5356
5356
  onValueChange: a,
5357
5357
  className: "flex gap-3",
5358
5358
  defaultValue: "x",
@@ -5371,14 +5371,14 @@ function tr() {
5371
5371
  }
5372
5372
  function Ye({
5373
5373
  cardType: s,
5374
- docContent: n,
5374
+ docContent: t,
5375
5375
  suffix: a = "Chart"
5376
5376
  }) {
5377
- let t = "pie-chart";
5378
- return s === "radar" && (t = "radar-chart"), /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
5377
+ let n = "pie-chart";
5378
+ return s === "radar" && (n = "radar-chart"), /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
5379
5379
  /* @__PURE__ */ e.jsxs(W, { value: "item-1", children: [
5380
5380
  /* @__PURE__ */ e.jsx(K, { children: `${qs(s)} ${a}` }),
5381
- /* @__PURE__ */ e.jsx(Q, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5381
+ /* @__PURE__ */ e.jsx(Q, { children: t || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5382
5382
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT label, measure FROM table" }),
5383
5383
  /* @__PURE__ */ e.jsxs("ul", { className: "ml-6 list-disc text-xs [&>li]:mt-2", children: [
5384
5384
  /* @__PURE__ */ e.jsx("li", { children: "label - category" }),
@@ -5392,7 +5392,7 @@ function Ye({
5392
5392
  target: "_blank",
5393
5393
  onClick: (l) => l.stopPropagation(),
5394
5394
  className: "text-blue-700",
5395
- href: `https://docs.semaphor.cloud/concepts/visuals#${t}`,
5395
+ href: `https://docs.semaphor.cloud/concepts/visuals#${n}`,
5396
5396
  children: "example"
5397
5397
  }
5398
5398
  ),
@@ -5403,7 +5403,7 @@ function Ye({
5403
5403
  /* @__PURE__ */ e.jsxs(W, { value: "item-2", children: [
5404
5404
  /* @__PURE__ */ e.jsx(K, { children: "Settings" }),
5405
5405
  /* @__PURE__ */ e.jsxs(Q, { className: "space-y-4 px-2", children: [
5406
- s === "range" && /* @__PURE__ */ e.jsx(fs, {}),
5406
+ s === "range" && /* @__PURE__ */ e.jsx(gs, {}),
5407
5407
  s !== "text" && /* @__PURE__ */ e.jsx(Bs, {}),
5408
5408
  s === "text" && /* @__PURE__ */ e.jsx(tr, {})
5409
5409
  ] })
@@ -5419,11 +5419,11 @@ function Ye({
5419
5419
  }
5420
5420
  function nr() {
5421
5421
  const s = u(
5422
- (t) => {
5422
+ (n) => {
5423
5423
  var l, r;
5424
- return (r = (l = t == null ? void 0 : t.card) == null ? void 0 : l.preferences) == null ? void 0 : r.sortChart;
5424
+ return (r = (l = n == null ? void 0 : n.card) == null ? void 0 : l.preferences) == null ? void 0 : r.sortChart;
5425
5425
  }
5426
- ), { setSortChart: n } = ne();
5426
+ ), { setSortChart: t } = ne();
5427
5427
  function a() {
5428
5428
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
5429
5429
  /* @__PURE__ */ e.jsx(H, { children: "Sort" }),
@@ -5447,8 +5447,8 @@ function nr() {
5447
5447
  }
5448
5448
  ],
5449
5449
  value: s || "none",
5450
- onValueChange: (t) => {
5451
- n(t);
5450
+ onValueChange: (n) => {
5451
+ t(n);
5452
5452
  }
5453
5453
  }
5454
5454
  )
@@ -5470,7 +5470,7 @@ function nr() {
5470
5470
  "a",
5471
5471
  {
5472
5472
  target: "_blank",
5473
- onClick: (t) => t.stopPropagation(),
5473
+ onClick: (n) => n.stopPropagation(),
5474
5474
  className: "text-blue-700",
5475
5475
  href: "https://docs.semaphor.cloud/concepts/visuals#stacked-chart",
5476
5476
  children: "example"
@@ -5483,7 +5483,7 @@ function nr() {
5483
5483
  /* @__PURE__ */ e.jsxs(W, { value: "item-2", children: [
5484
5484
  /* @__PURE__ */ e.jsx(K, { children: "Settings" }),
5485
5485
  /* @__PURE__ */ e.jsxs(Q, { className: "space-y-4 px-2", children: [
5486
- /* @__PURE__ */ e.jsx(fs, {}),
5486
+ /* @__PURE__ */ e.jsx(gs, {}),
5487
5487
  a(),
5488
5488
  /* @__PURE__ */ e.jsx(st, {})
5489
5489
  ] })
@@ -5498,15 +5498,15 @@ function nr() {
5498
5498
  ] }) });
5499
5499
  }
5500
5500
  function lr({}) {
5501
- const s = u((t) => {
5501
+ const s = u((n) => {
5502
5502
  var l;
5503
- return (l = t.card) == null ? void 0 : l.preferences;
5504
- }), n = u(
5505
- (t) => t.actions.setCardPreferences
5506
- ), a = (t) => {
5507
- n({
5503
+ return (l = n.card) == null ? void 0 : l.preferences;
5504
+ }), t = u(
5505
+ (n) => n.actions.setCardPreferences
5506
+ ), a = (n) => {
5507
+ t({
5508
5508
  ...s,
5509
- allowDownload: t
5509
+ allowDownload: n
5510
5510
  });
5511
5511
  };
5512
5512
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
@@ -5581,7 +5581,7 @@ const rr = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
5581
5581
  ] });
5582
5582
  function cr() {
5583
5583
  const s = u((a) => a.card.type);
5584
- function n(a) {
5584
+ function t(a) {
5585
5585
  switch (a) {
5586
5586
  case "stackedBar":
5587
5587
  case "stackedLine":
@@ -5622,10 +5622,10 @@ function cr() {
5622
5622
  return /* @__PURE__ */ e.jsx(Kl, {});
5623
5623
  }
5624
5624
  }
5625
- return /* @__PURE__ */ e.jsx(ve, { className: "h-full w-full text-sm", children: n(s) });
5625
+ return /* @__PURE__ */ e.jsx(ve, { className: "h-full w-full text-sm", children: t(s) });
5626
5626
  }
5627
5627
  function dr() {
5628
- const s = u((n) => n.isShowingVisual);
5628
+ const s = u((t) => t.isShowingVisual);
5629
5629
  return /* @__PURE__ */ e.jsxs(
5630
5630
  ns,
5631
5631
  {
@@ -5670,14 +5670,14 @@ function dr() {
5670
5670
  }
5671
5671
  );
5672
5672
  }
5673
- function ur({ authToken: s, onSave: n, onClose: a }) {
5673
+ function ur({ authToken: s, onSave: t, onClose: a }) {
5674
5674
  k((i) => i.themeStyle);
5675
- const t = u((i) => i.actions.setOnSave), l = u((i) => i.actions.setOnClose), r = k((i) => i.actions.setAuthToken);
5675
+ const n = u((i) => i.actions.setOnSave), l = u((i) => i.actions.setOnClose), r = k((i) => i.actions.setAuthToken);
5676
5676
  return se(() => {
5677
- n && t(n), a && l(a);
5678
- }, [n, t, a, l]), se(() => {
5677
+ t && n(t), a && l(a);
5678
+ }, [t, n, a, l]), se(() => {
5679
5679
  s && s.accessToken && r(s);
5680
- }, [s, r]), /* @__PURE__ */ e.jsx(us, { FallbackComponent: Da, children: /* @__PURE__ */ e.jsxs(
5680
+ }, [s, r]), /* @__PURE__ */ e.jsx(ms, { FallbackComponent: Da, children: /* @__PURE__ */ e.jsxs(
5681
5681
  bn,
5682
5682
  {
5683
5683
  style: {
@@ -5695,12 +5695,12 @@ function ur({ authToken: s, onSave: n, onClose: a }) {
5695
5695
  }
5696
5696
  function mr() {
5697
5697
  k((i) => i.selectedCardId);
5698
- const s = k((i) => i.selectedSheetId), { setIsVisualEditing: n } = k((i) => i.actions), a = k((i) => i.isVisualEditing), t = k((i) => i.actions.updateFrame);
5698
+ const s = k((i) => i.selectedSheetId), { setIsVisualEditing: t } = k((i) => i.actions), a = k((i) => i.isVisualEditing), n = k((i) => i.actions.updateFrame);
5699
5699
  function l(i) {
5700
- s && (t(s, i), n(!1));
5700
+ s && (n(s, i), t(!1));
5701
5701
  }
5702
5702
  function r() {
5703
- n(!1);
5703
+ t(!1);
5704
5704
  }
5705
5705
  return /* @__PURE__ */ e.jsx(
5706
5706
  "div",
@@ -5714,10 +5714,10 @@ function mr() {
5714
5714
  );
5715
5715
  }
5716
5716
  function hr() {
5717
- const s = u((r) => r.selectedDatabaseName), n = u((r) => r.selectedTableName), a = k((r) => r.dashboard.filters) || [], { columns: t } = Ee(), { assignFilter: l } = at();
5718
- return /* @__PURE__ */ e.jsx(ve, { className: "flex-1 basis-0 flex-col px-3", children: t == null ? void 0 : t.map((r) => {
5717
+ const s = u((r) => r.selectedDatabaseName), t = u((r) => r.selectedTableName), a = k((r) => r.dashboard.filters) || [], { columns: n } = Ee(), { assignFilter: l } = at();
5718
+ return /* @__PURE__ */ e.jsx(ve, { className: "flex-1 basis-0 flex-col px-3", children: n == null ? void 0 : n.map((r) => {
5719
5719
  const i = a == null ? void 0 : a.find(
5720
- (c) => c.column === he(r.column_name) && c.table === n && c.database === s
5720
+ (o) => o.column === he(r.column_name) && o.table === t && o.database === s
5721
5721
  );
5722
5722
  return /* @__PURE__ */ e.jsx(
5723
5723
  "div",
@@ -5739,9 +5739,9 @@ function hr() {
5739
5739
  }) });
5740
5740
  }
5741
5741
  function xr() {
5742
- k((n) => n.showFilters);
5742
+ k((t) => t.showFilters);
5743
5743
  const s = k(
5744
- (n) => n.actions.setShowFilters
5744
+ (t) => t.actions.setShowFilters
5745
5745
  );
5746
5746
  return /* @__PURE__ */ e.jsxs("section", { className: "relative flex min-w-72 grow flex-col border-l px-1", children: [
5747
5747
  /* @__PURE__ */ e.jsxs("div", { className: "mt-4 flex items-center justify-between gap-2 px-3", children: [
@@ -5771,39 +5771,39 @@ function xr() {
5771
5771
  ] });
5772
5772
  }
5773
5773
  function pr() {
5774
- const s = k((t) => t.dashboard.filters), n = k((t) => t.theme), a = s == null ? void 0 : s.filter((t) => t.hide);
5774
+ const s = k((n) => n.dashboard.filters), t = k((n) => n.theme), a = s == null ? void 0 : s.filter((n) => n.hide);
5775
5775
  return a != null && a.length ? /* @__PURE__ */ e.jsx(
5776
5776
  "div",
5777
5777
  {
5778
5778
  className: Z("mb-1 flex items-center gap-2 border-y px-0.5 pb-0.5", {
5779
- "bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": n === "light",
5780
- "bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": n === "dark"
5779
+ "bg-[repeating-linear-gradient(45deg,_#ffffff_0_3px,_#f3f3f3_3px_6px)]": t === "light",
5780
+ "bg-[repeating-linear-gradient(45deg,_#18171d_0_3px,_#272729_3px_6px)]": t === "dark"
5781
5781
  }),
5782
- children: a == null ? void 0 : a.map((t) => /* @__PURE__ */ e.jsxs(
5782
+ children: a == null ? void 0 : a.map((n) => /* @__PURE__ */ e.jsxs(
5783
5783
  "div",
5784
5784
  {
5785
5785
  className: "flex min-w-[250px] max-w-fit flex-col gap-1 p-2",
5786
5786
  children: [
5787
- /* @__PURE__ */ e.jsx(Oa, { filter: t }),
5788
- /* @__PURE__ */ e.jsx(Sa, { filter: t })
5787
+ /* @__PURE__ */ e.jsx(Oa, { filter: n }),
5788
+ /* @__PURE__ */ e.jsx(Sa, { filter: n })
5789
5789
  ]
5790
5790
  },
5791
- t.id
5791
+ n.id
5792
5792
  ))
5793
5793
  }
5794
5794
  ) : null;
5795
5795
  }
5796
5796
  function fr() {
5797
- const s = k((t) => t.showFilters), n = k((t) => t.isVisualEditing), a = k(
5798
- (t) => t.isDashboardEditing
5797
+ const s = k((n) => n.showFilters), t = k((n) => n.isVisualEditing), a = k(
5798
+ (n) => n.isDashboardEditing
5799
5799
  );
5800
5800
  return /* @__PURE__ */ e.jsxs(
5801
5801
  "div",
5802
5802
  {
5803
5803
  role: "dashboard-plus-main",
5804
5804
  className: Z("", {
5805
- "max-h-0 overflow-hidden": n,
5806
- "flex grow overflow-auto": !n
5805
+ "max-h-0 overflow-hidden": t,
5806
+ "flex grow overflow-auto": !t
5807
5807
  // can't do h-full because parent container has dashboard controls (10px height)
5808
5808
  //**overflow-auto** is needed to prevent the tabs from overflowing the container - important for chatbox
5809
5809
  }),
@@ -5818,55 +5818,70 @@ function fr() {
5818
5818
  );
5819
5819
  }
5820
5820
  function gr() {
5821
- const s = k((t) => t.dashboard), n = k((t) => t.actions.setDashboard), a = k(
5822
- (t) => t.showDashboardJSON
5821
+ const s = k((l) => l.dashboard), t = k((l) => l.actions.setDashboard), a = k(
5822
+ (l) => l.showDashboardJSON
5823
+ ), n = k(
5824
+ (l) => l.actions.setShowDashboardJSON
5823
5825
  );
5824
- return k(
5825
- (t) => t.actions.setShowDashboardJSON
5826
- ), /* @__PURE__ */ e.jsx(
5826
+ return /* @__PURE__ */ e.jsxs(
5827
5827
  "div",
5828
5828
  {
5829
- className: Z(" p-2", {
5829
+ className: Z("p-2", {
5830
5830
  hidden: !a
5831
5831
  }),
5832
- children: /* @__PURE__ */ e.jsx(
5833
- Cn,
5834
- {
5835
- onChange: (t) => {
5836
- if (t)
5837
- try {
5838
- JSON.parse(t), n(JSON.parse(t));
5839
- } catch {
5840
- }
5841
- },
5842
- defaultLanguage: "json",
5843
- className: "h-[550px] overflow-y-auto ",
5844
- value: JSON.stringify(s, null, 2),
5845
- options: {
5846
- minimap: {
5847
- enabled: !1
5848
- },
5849
- // lineNumbers: 'off',
5850
- glyphMargin: !1,
5851
- wordWrap: "on",
5852
- scrollbar: {
5853
- verticalScrollbarSize: 0,
5854
- horizontalScrollbarSize: 0
5832
+ children: [
5833
+ /* @__PURE__ */ e.jsxs(
5834
+ T,
5835
+ {
5836
+ variant: "secondary",
5837
+ size: "sm",
5838
+ className: "absolute right-2 top-2 z-10 h-8",
5839
+ onClick: () => n(!1),
5840
+ children: [
5841
+ /* @__PURE__ */ e.jsx(ds, { className: "mr-2 h-4 w-4" }),
5842
+ "Close"
5843
+ ]
5844
+ }
5845
+ ),
5846
+ /* @__PURE__ */ e.jsx(
5847
+ Cn,
5848
+ {
5849
+ onChange: (l) => {
5850
+ if (l)
5851
+ try {
5852
+ JSON.parse(l), t(JSON.parse(l));
5853
+ } catch {
5854
+ }
5855
5855
  },
5856
- fontSize: 12,
5857
- renderLineHighlight: "none"
5856
+ defaultLanguage: "json",
5857
+ className: "h-[550px] overflow-y-auto",
5858
+ value: JSON.stringify(s, null, 2),
5859
+ options: {
5860
+ minimap: {
5861
+ enabled: !1
5862
+ },
5863
+ // lineNumbers: 'off',
5864
+ glyphMargin: !1,
5865
+ wordWrap: "on",
5866
+ scrollbar: {
5867
+ verticalScrollbarSize: 0,
5868
+ horizontalScrollbarSize: 0
5869
+ },
5870
+ fontSize: 12,
5871
+ renderLineHighlight: "none"
5872
+ }
5858
5873
  }
5859
- }
5860
- )
5874
+ )
5875
+ ]
5861
5876
  }
5862
5877
  );
5863
5878
  }
5864
5879
  function yr({
5865
5880
  showControls: s = !1,
5866
- showFooter: n = !0,
5881
+ showFooter: t = !0,
5867
5882
  ...a
5868
5883
  }) {
5869
- return /* @__PURE__ */ e.jsx(us, { FallbackComponent: Da, children: /* @__PURE__ */ e.jsxs(Sn, { dashboardProps: a, children: [
5884
+ return /* @__PURE__ */ e.jsx(ms, { FallbackComponent: Da, children: /* @__PURE__ */ e.jsxs(Sn, { dashboardProps: a, children: [
5870
5885
  /* @__PURE__ */ e.jsx(wn, {}),
5871
5886
  /* @__PURE__ */ e.jsxs(kn, { children: [
5872
5887
  /* @__PURE__ */ e.jsx(gr, {}),